@@ -149,11 +149,7 @@ line_coding_t test_codings[] = {
149
149
{ 9600 , 8 , 0 , 0 },
150
150
{ 57600 , 8 , 0 , 0 },
151
151
};
152
- #if defined(MBED_CONF_RTOS_PRESENT)
153
- Mail<line_coding_t , 8 > lc_mail;
154
- #else
155
152
static CircularBuffer<line_coding_t , 8 > lc_data;
156
- #endif
157
153
158
154
#define EF_SEND (1ul << 0 )
159
155
EventFlags event_flags;
@@ -773,14 +769,6 @@ void test_serial_printf_scanf()
773
769
774
770
void line_coding_changed_cb (int baud, int bits, int parity, int stop)
775
771
{
776
- #if defined(MBED_CONF_RTOS_PRESENT)
777
- line_coding_t *lc = lc_mail.alloc ();
778
- lc->baud = baud;
779
- lc->bits = bits;
780
- lc->parity = parity;
781
- lc->stop = stop;
782
- lc_mail.put (lc);
783
- #else
784
772
line_coding_t lc = {
785
773
.baud = baud,
786
774
.bits = bits,
@@ -789,7 +777,6 @@ void line_coding_changed_cb(int baud, int bits, int parity, int stop)
789
777
};
790
778
lc_data.push (lc);
791
779
event_flags.set (EF_SEND);
792
- #endif
793
780
}
794
781
795
782
/* * Test Serial / CDC line coding change
@@ -813,9 +800,9 @@ void test_serial_line_coding_change()
813
800
size_t num_line_codings = sizeof test_codings / sizeof test_codings[0 ];
814
801
line_coding_t *lc_prev = &default_lc;
815
802
line_coding_t *lc_expected = NULL ;
816
- line_coding_t *lc_actual = NULL ;
817
803
int num_expected_callbacks, rc;
818
804
for (size_t i = 0 ; i < num_line_codings; i++) {
805
+ line_coding_t lc_actual = {0 };
819
806
lc_expected = &(test_codings[i]);
820
807
num_expected_callbacks = lc_prev->get_num_diffs (*lc_expected);
821
808
rc = usb_serial.printf (" %06i,%02i,%01i,%01i%c" , lc_expected->baud , lc_expected->bits , lc_expected->parity ,
@@ -827,34 +814,16 @@ void test_serial_line_coding_change()
827
814
// calls to line_coding_changed callback on the device.
828
815
while (num_expected_callbacks > 0 ) {
829
816
num_expected_callbacks--;
830
- #if defined(MBED_CONF_RTOS_PRESENT)
831
- osEvent event = lc_mail.get ();
832
- TEST_ASSERT_EQUAL_UINT32 (osEventMail, event.status );
833
- lc_actual = (line_coding_t *) event.value .p ;
834
- if (lc_expected->get_num_diffs (*lc_actual) == 0 ) {
835
- break ;
836
- } else if (num_expected_callbacks > 0 ) {
837
- // Discard lc_actual only if there is still a chance to get new
838
- // set of params.
839
- lc_mail.free (lc_actual);
840
- }
841
- #else
842
- line_coding_t lc_receive = {0 };
843
817
event_flags.wait_all (EF_SEND);
844
- lc_data.pop (lc_receive );
845
- if (lc_expected->get_num_diffs (lc_receive ) == 0 ) {
818
+ lc_data.pop (lc_actual );
819
+ if (lc_expected->get_num_diffs (lc_actual ) == 0 ) {
846
820
break ;
847
821
}
848
- lc_actual = &lc_receive;
849
- #endif
850
822
}
851
- TEST_ASSERT_EQUAL_INT (lc_expected->baud , lc_actual->baud );
852
- TEST_ASSERT_EQUAL_INT (lc_expected->bits , lc_actual->bits );
853
- TEST_ASSERT_EQUAL_INT (lc_expected->parity , lc_actual->parity );
854
- TEST_ASSERT_EQUAL_INT (lc_expected->stop , lc_actual->stop );
855
- #if defined(MBED_CONF_RTOS_PRESENT)
856
- lc_mail.free (lc_actual);
857
- #endif
823
+ TEST_ASSERT_EQUAL_INT (lc_expected->baud , lc_actual.baud );
824
+ TEST_ASSERT_EQUAL_INT (lc_expected->bits , lc_actual.bits );
825
+ TEST_ASSERT_EQUAL_INT (lc_expected->parity , lc_actual.parity );
826
+ TEST_ASSERT_EQUAL_INT (lc_expected->stop , lc_actual.stop );
858
827
lc_prev = lc_expected;
859
828
}
860
829
// Wait for the host to close its port.
0 commit comments