Fixed bug 3504450.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4039 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
82984e1b55
commit
52e98077ee
|
@ -364,6 +364,7 @@ msg_t chMBFetchI(Mailbox *mbp, msg_t *msgp) {
|
||||||
|
|
||||||
if (chSemGetCounterI(&mbp->mb_fullsem) <= 0)
|
if (chSemGetCounterI(&mbp->mb_fullsem) <= 0)
|
||||||
return RDY_TIMEOUT;
|
return RDY_TIMEOUT;
|
||||||
|
chSemFastWaitI(&mbp->mb_fullsem);
|
||||||
*msgp = *mbp->mb_rdptr++;
|
*msgp = *mbp->mb_rdptr++;
|
||||||
if (mbp->mb_rdptr >= mbp->mb_top)
|
if (mbp->mb_rdptr >= mbp->mb_top)
|
||||||
mbp->mb_rdptr = mbp->mb_buffer;
|
mbp->mb_rdptr = mbp->mb_buffer;
|
||||||
|
|
|
@ -79,6 +79,8 @@
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
|
|
||||||
*** 2.5.0 ***
|
*** 2.5.0 ***
|
||||||
|
- FIX: Fixed chMBFetchI does not decrement mb_fullsem (bug 3504450)(backported
|
||||||
|
to 2.2.9 and 2.4.1).
|
||||||
- FIX: Fixed USART3 not working on STM32F2/F4 UART driver (bug 3496981)
|
- FIX: Fixed USART3 not working on STM32F2/F4 UART driver (bug 3496981)
|
||||||
(backported to 2.4.1).
|
(backported to 2.4.1).
|
||||||
- FIX: Fixed stack misalignment on Posix-MacOSX (bug 3495487)(backported
|
- FIX: Fixed stack misalignment on Posix-MacOSX (bug 3495487)(backported
|
||||||
|
|
|
@ -180,30 +180,34 @@ static void mbox1_execute(void) {
|
||||||
test_emit_token(msg2);
|
test_emit_token(msg2);
|
||||||
}
|
}
|
||||||
test_assert_sequence(29, "ABCDE");
|
test_assert_sequence(29, "ABCDE");
|
||||||
test_assert(30, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
|
test_assert_lock(30, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
|
||||||
|
test_assert_lock(31, chMBGetUsedCountI(&mb1) == 0, "still full");
|
||||||
|
test_assert(32, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
msg1 = chMBPostAheadI(&mb1, 'E');
|
msg1 = chMBPostAheadI(&mb1, 'E');
|
||||||
test_assert(31, msg1 == RDY_OK, "wrong wake-up message");
|
|
||||||
msg1 = chMBPostAheadI(&mb1, 'D');
|
|
||||||
test_assert(32, msg1 == RDY_OK, "wrong wake-up message");
|
|
||||||
msg1 = chMBPostAheadI(&mb1, 'C');
|
|
||||||
test_assert(33, msg1 == RDY_OK, "wrong wake-up message");
|
test_assert(33, msg1 == RDY_OK, "wrong wake-up message");
|
||||||
msg1 = chMBPostAheadI(&mb1, 'B');
|
msg1 = chMBPostAheadI(&mb1, 'D');
|
||||||
test_assert(34, msg1 == RDY_OK, "wrong wake-up message");
|
test_assert(34, msg1 == RDY_OK, "wrong wake-up message");
|
||||||
|
msg1 = chMBPostAheadI(&mb1, 'C');
|
||||||
|
test_assert(35, msg1 == RDY_OK, "wrong wake-up message");
|
||||||
|
msg1 = chMBPostAheadI(&mb1, 'B');
|
||||||
|
test_assert(36, msg1 == RDY_OK, "wrong wake-up message");
|
||||||
msg1 = chMBPostAheadI(&mb1, 'A');
|
msg1 = chMBPostAheadI(&mb1, 'A');
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
test_assert(35, msg1 == RDY_OK, "wrong wake-up message");
|
test_assert(37, msg1 == RDY_OK, "wrong wake-up message");
|
||||||
test_assert(36, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
|
test_assert(38, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
|
||||||
for (i = 0; i < MB_SIZE; i++) {
|
for (i = 0; i < MB_SIZE; i++) {
|
||||||
chSysLock();
|
chSysLock();
|
||||||
msg1 = chMBFetchI(&mb1, &msg2);
|
msg1 = chMBFetchI(&mb1, &msg2);
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
test_assert(37, msg1 == RDY_OK, "wrong wake-up message");
|
test_assert(39, msg1 == RDY_OK, "wrong wake-up message");
|
||||||
test_emit_token(msg2);
|
test_emit_token(msg2);
|
||||||
}
|
}
|
||||||
test_assert_sequence(38, "ABCDE");
|
test_assert_sequence(38, "ABCDE");
|
||||||
test_assert(39, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
|
test_assert_lock(39, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
|
||||||
|
test_assert_lock(40, chMBGetUsedCountI(&mb1) == 0, "still full");
|
||||||
|
test_assert(41, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Testing reset.
|
* Testing reset.
|
||||||
|
@ -213,10 +217,10 @@ static void mbox1_execute(void) {
|
||||||
/*
|
/*
|
||||||
* Re-testing final conditions.
|
* Re-testing final conditions.
|
||||||
*/
|
*/
|
||||||
test_assert_lock(40, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
|
test_assert_lock(42, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
|
||||||
test_assert_lock(41, chMBGetUsedCountI(&mb1) == 0, "still full");
|
test_assert_lock(43, chMBGetUsedCountI(&mb1) == 0, "still full");
|
||||||
test_assert_lock(42, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base");
|
test_assert_lock(44, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base");
|
||||||
test_assert_lock(43, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base");
|
test_assert_lock(45, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base");
|
||||||
}
|
}
|
||||||
|
|
||||||
ROMCONST struct testcase testmbox1 = {
|
ROMCONST struct testcase testmbox1 = {
|
||||||
|
|
Loading…
Reference in New Issue