Fixed bug 3504450.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/stable_2.4.x@4042 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
9130cbca55
commit
a46db2b014
|
@ -371,6 +371,7 @@ msg_t chMBFetchI(Mailbox *mbp, msg_t *msgp) {
|
|||
|
||||
if (chSemGetCounterI(&mbp->mb_fullsem) <= 0)
|
||||
return RDY_TIMEOUT;
|
||||
chSemFastWaitI(&mbp->mb_fullsem);
|
||||
*msgp = *mbp->mb_rdptr++;
|
||||
if (mbp->mb_rdptr >= mbp->mb_top)
|
||||
mbp->mb_rdptr = mbp->mb_buffer;
|
||||
|
|
|
@ -79,6 +79,7 @@
|
|||
*****************************************************************************
|
||||
|
||||
*** 2.4.1 ***
|
||||
- FIX: Fixed chMBFetchI does not decrement mb_fullsem (bug 3504450).
|
||||
- FIX: Fixed stack misalignment on Posix-MacOSX (bug 3495487).
|
||||
- FIX: Fixed STM8S HSI clock initialization error (bug 3489727).
|
||||
- FIX: Fixed MMC over SPI driver performs an unnecessary SPI read (bug
|
||||
|
|
|
@ -187,30 +187,34 @@ static void mbox1_execute(void) {
|
|||
test_emit_token(msg2);
|
||||
}
|
||||
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();
|
||||
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");
|
||||
msg1 = chMBPostAheadI(&mb1, 'B');
|
||||
msg1 = chMBPostAheadI(&mb1, 'D');
|
||||
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');
|
||||
chSysUnlock();
|
||||
test_assert(35, msg1 == RDY_OK, "wrong wake-up message");
|
||||
test_assert(36, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
|
||||
test_assert(37, msg1 == RDY_OK, "wrong wake-up message");
|
||||
test_assert(38, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
|
||||
for (i = 0; i < MB_SIZE; i++) {
|
||||
chSysLock();
|
||||
msg1 = chMBFetchI(&mb1, &msg2);
|
||||
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_assert_sequence(38, "ABCDE");
|
||||
test_assert(39, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
|
||||
test_assert_sequence(40, "ABCDE");
|
||||
test_assert_lock(41, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
|
||||
test_assert_lock(42, chMBGetUsedCountI(&mb1) == 0, "still full");
|
||||
test_assert(43, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
|
||||
|
||||
/*
|
||||
* Testing reset.
|
||||
|
@ -220,10 +224,10 @@ static void mbox1_execute(void) {
|
|||
/*
|
||||
* Re-testing final conditions.
|
||||
*/
|
||||
test_assert_lock(40, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
|
||||
test_assert_lock(41, chMBGetUsedCountI(&mb1) == 0, "still full");
|
||||
test_assert_lock(42, 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(44, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
|
||||
test_assert_lock(45, chMBGetUsedCountI(&mb1) == 0, "still full");
|
||||
test_assert_lock(46, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base");
|
||||
test_assert_lock(47, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base");
|
||||
}
|
||||
|
||||
ROMCONST struct testcase testmbox1 = {
|
||||
|
|
Loading…
Reference in New Issue