git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9066 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
ade53fbc15
commit
55d20075bd
|
@ -483,19 +483,16 @@ int32 OS_TimerCreate(uint32 *timer_id, const char *timer_name,
|
|||
return OS_ERR_NO_FREE_IDS;
|
||||
}
|
||||
|
||||
chSysLock();
|
||||
|
||||
strncpy(otp->name, timer_name, OS_MAX_API_NAME);
|
||||
strncpy(otp->name, timer_name, OS_MAX_API_NAME - 1);
|
||||
chVTObjectInit(&otp->vt);
|
||||
otp->start_time = 0;
|
||||
otp->interval_time = 0;
|
||||
otp->callback_ptr = callback_ptr;
|
||||
otp->is_free = 0; /* Note, last.*/
|
||||
|
||||
*timer_id = (uint32)otp;
|
||||
*clock_accuracy = (uint32)(1000000 / CH_CFG_ST_FREQUENCY);
|
||||
|
||||
chSysUnlock();
|
||||
|
||||
return OS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -727,7 +724,7 @@ int32 OS_QueueCreate(uint32 *queue_id, const char *queue_name,
|
|||
}
|
||||
|
||||
/* Initializing object static parts.*/
|
||||
strncpy(oqp->name, queue_name, OS_MAX_API_NAME);
|
||||
strncpy(oqp->name, queue_name, OS_MAX_API_NAME - 1);
|
||||
chMBObjectInit(&oqp->mb, oqp->q_buffer, (size_t)queue_depth);
|
||||
chSemObjectInit(&oqp->free_msgs, (cnt_t)queue_depth);
|
||||
chPoolObjectInit(&oqp->messages, msgsize, NULL);
|
||||
|
@ -983,7 +980,7 @@ int32 OS_QueueGetInfo (uint32 queue_id, OS_queue_prop_t *queue_prop) {
|
|||
}
|
||||
|
||||
strncpy(queue_prop->name, oqp->name, OS_MAX_API_NAME - 1);
|
||||
queue_prop->creator = (uint32)0;
|
||||
queue_prop->creator = (uint32)0;
|
||||
|
||||
/* Leaving the critical zone.*/
|
||||
chSysRestoreStatusX(sts);
|
||||
|
|
|
@ -1157,16 +1157,17 @@ test_assert(err == OS_ERR_INVALID_ID, "wrong timer id not detected");]]></value>
|
|||
</tags>
|
||||
<code>
|
||||
<value><![CDATA[int32 err;
|
||||
uint32 qid1, qid2;
|
||||
uint32 tmid1, tmid2;
|
||||
uint32 accuracy;
|
||||
|
||||
err = OS_QueueCreate(&qid1, "my queue", 4, 128, 0);
|
||||
test_assert(err == OS_SUCCESS, "queue creation failed");
|
||||
err = OS_TimerCreate(&tmid1, "my timer", &accuracy, tmr_callback);
|
||||
test_assert(err == OS_SUCCESS, "timer creation failed");
|
||||
|
||||
err = OS_QueueCreate(&qid2, "my queue", 4, 128, 0);
|
||||
err = OS_TimerCreate(&tmid2, "my timer", &accuracy, tmr_callback);
|
||||
test_assert(err == OS_ERR_NAME_TAKEN, "name conflict not detected");
|
||||
|
||||
err = OS_QueueDelete(qid1);
|
||||
test_assert(err == OS_SUCCESS, "queue deletion failed");]]></value>
|
||||
err = OS_TimerDelete(tmid1);
|
||||
test_assert(err == OS_SUCCESS, "timer deletion failed");]]></value>
|
||||
</code>
|
||||
</step>
|
||||
</steps>
|
||||
|
|
|
@ -173,16 +173,17 @@ static void test_003_001_execute(void) {
|
|||
test_set_step(7);
|
||||
{
|
||||
int32 err;
|
||||
uint32 qid1, qid2;
|
||||
uint32 tmid1, tmid2;
|
||||
uint32 accuracy;
|
||||
|
||||
err = OS_QueueCreate(&qid1, "my queue", 4, 128, 0);
|
||||
test_assert(err == OS_SUCCESS, "queue creation failed");
|
||||
err = OS_TimerCreate(&tmid1, "my timer", &accuracy, tmr_callback);
|
||||
test_assert(err == OS_SUCCESS, "timer creation failed");
|
||||
|
||||
err = OS_QueueCreate(&qid2, "my queue", 4, 128, 0);
|
||||
err = OS_TimerCreate(&tmid2, "my timer", &accuracy, tmr_callback);
|
||||
test_assert(err == OS_ERR_NAME_TAKEN, "name conflict not detected");
|
||||
|
||||
err = OS_QueueDelete(qid1);
|
||||
test_assert(err == OS_SUCCESS, "queue deletion failed");
|
||||
err = OS_TimerDelete(tmid1);
|
||||
test_assert(err == OS_SUCCESS, "timer deletion failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue