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;
|
return OS_ERR_NO_FREE_IDS;
|
||||||
}
|
}
|
||||||
|
|
||||||
chSysLock();
|
strncpy(otp->name, timer_name, OS_MAX_API_NAME - 1);
|
||||||
|
|
||||||
strncpy(otp->name, timer_name, OS_MAX_API_NAME);
|
|
||||||
chVTObjectInit(&otp->vt);
|
chVTObjectInit(&otp->vt);
|
||||||
otp->start_time = 0;
|
otp->start_time = 0;
|
||||||
otp->interval_time = 0;
|
otp->interval_time = 0;
|
||||||
otp->callback_ptr = callback_ptr;
|
otp->callback_ptr = callback_ptr;
|
||||||
otp->is_free = 0; /* Note, last.*/
|
otp->is_free = 0; /* Note, last.*/
|
||||||
|
|
||||||
|
*timer_id = (uint32)otp;
|
||||||
*clock_accuracy = (uint32)(1000000 / CH_CFG_ST_FREQUENCY);
|
*clock_accuracy = (uint32)(1000000 / CH_CFG_ST_FREQUENCY);
|
||||||
|
|
||||||
chSysUnlock();
|
|
||||||
|
|
||||||
return OS_SUCCESS;
|
return OS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -727,7 +724,7 @@ int32 OS_QueueCreate(uint32 *queue_id, const char *queue_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initializing object static parts.*/
|
/* 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);
|
chMBObjectInit(&oqp->mb, oqp->q_buffer, (size_t)queue_depth);
|
||||||
chSemObjectInit(&oqp->free_msgs, (cnt_t)queue_depth);
|
chSemObjectInit(&oqp->free_msgs, (cnt_t)queue_depth);
|
||||||
chPoolObjectInit(&oqp->messages, msgsize, NULL);
|
chPoolObjectInit(&oqp->messages, msgsize, NULL);
|
||||||
|
|
|
@ -1157,16 +1157,17 @@ test_assert(err == OS_ERR_INVALID_ID, "wrong timer id not detected");]]></value>
|
||||||
</tags>
|
</tags>
|
||||||
<code>
|
<code>
|
||||||
<value><![CDATA[int32 err;
|
<value><![CDATA[int32 err;
|
||||||
uint32 qid1, qid2;
|
uint32 tmid1, tmid2;
|
||||||
|
uint32 accuracy;
|
||||||
|
|
||||||
err = OS_QueueCreate(&qid1, "my queue", 4, 128, 0);
|
err = OS_TimerCreate(&tmid1, "my timer", &accuracy, tmr_callback);
|
||||||
test_assert(err == OS_SUCCESS, "queue creation failed");
|
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");
|
test_assert(err == OS_ERR_NAME_TAKEN, "name conflict not detected");
|
||||||
|
|
||||||
err = OS_QueueDelete(qid1);
|
err = OS_TimerDelete(tmid1);
|
||||||
test_assert(err == OS_SUCCESS, "queue deletion failed");]]></value>
|
test_assert(err == OS_SUCCESS, "timer deletion failed");]]></value>
|
||||||
</code>
|
</code>
|
||||||
</step>
|
</step>
|
||||||
</steps>
|
</steps>
|
||||||
|
|
|
@ -173,16 +173,17 @@ static void test_003_001_execute(void) {
|
||||||
test_set_step(7);
|
test_set_step(7);
|
||||||
{
|
{
|
||||||
int32 err;
|
int32 err;
|
||||||
uint32 qid1, qid2;
|
uint32 tmid1, tmid2;
|
||||||
|
uint32 accuracy;
|
||||||
|
|
||||||
err = OS_QueueCreate(&qid1, "my queue", 4, 128, 0);
|
err = OS_TimerCreate(&tmid1, "my timer", &accuracy, tmr_callback);
|
||||||
test_assert(err == OS_SUCCESS, "queue creation failed");
|
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");
|
test_assert(err == OS_ERR_NAME_TAKEN, "name conflict not detected");
|
||||||
|
|
||||||
err = OS_QueueDelete(qid1);
|
err = OS_TimerDelete(tmid1);
|
||||||
test_assert(err == OS_SUCCESS, "queue deletion failed");
|
test_assert(err == OS_SUCCESS, "timer deletion failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue