Skip to content

Commit 119ce8c

Browse files
committed
Merge branch 'master' of http://github.com/ARMmbed/mbed-os into macronix_ospi
2 parents 58cad6f + 532654e commit 119ce8c

File tree

102 files changed

+1257
-1511
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+1257
-1511
lines changed

TESTS/events/equeue/main.cpp

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,23 +1003,24 @@ static void test_equeue_user_allocated_event_post()
10031003

10041004
uint8_t touched = 0;
10051005
user_allocated_event e1 = { { 0, 0, 0, NULL, NULL, NULL, 0, -1, NULL, NULL }, 0 };
1006-
user_allocated_event e2 = { { 0, 0, 0, NULL, NULL, NULL, 1, -1, NULL, NULL }, 0 };
1007-
user_allocated_event e3 = { { 0, 0, 0, NULL, NULL, NULL, 1, -1, NULL, NULL }, 0 };
1008-
user_allocated_event e4 = { { 0, 0, 0, NULL, NULL, NULL, 1, -1, NULL, NULL }, 0 };
1006+
user_allocated_event e2 = { { 0, 0, 0, NULL, NULL, NULL, 10, 10, NULL, NULL }, 0 };
1007+
user_allocated_event e3 = { { 0, 0, 0, NULL, NULL, NULL, 10, 10, NULL, NULL }, 0 };
1008+
user_allocated_event e4 = { { 0, 0, 0, NULL, NULL, NULL, 10, 10, NULL, NULL }, 0 };
10091009
user_allocated_event e5 = { { 0, 0, 0, NULL, NULL, NULL, 0, -1, NULL, NULL }, 0 };
10101010

1011-
TEST_ASSERT_NOT_EQUAL(0, equeue_call(&q, simple_func, &touched));
1012-
TEST_ASSERT_EQUAL_INT(0, equeue_call(&q, simple_func, &touched));
1013-
TEST_ASSERT_EQUAL_INT(0, equeue_call(&q, simple_func, &touched));
1011+
TEST_ASSERT_NOT_EQUAL(0, equeue_call_every(&q, 10, simple_func, &touched));
1012+
TEST_ASSERT_EQUAL_INT(0, equeue_call_every(&q, 10, simple_func, &touched));
1013+
TEST_ASSERT_EQUAL_INT(0, equeue_call_every(&q, 10, simple_func, &touched));
10141014

10151015
equeue_post_user_allocated(&q, simple_func, &e1.e);
10161016
equeue_post_user_allocated(&q, simple_func, &e2.e);
10171017
equeue_post_user_allocated(&q, simple_func, &e3.e);
10181018
equeue_post_user_allocated(&q, simple_func, &e4.e);
10191019
equeue_post_user_allocated(&q, simple_func, &e5.e);
10201020
equeue_cancel_user_allocated(&q, &e3.e);
1021+
equeue_cancel_user_allocated(&q, &e3.e);
10211022

1022-
equeue_dispatch(&q, 1);
1023+
equeue_dispatch(&q, 11);
10231024

10241025
TEST_ASSERT_EQUAL_UINT8(1, touched);
10251026
TEST_ASSERT_EQUAL_UINT8(1, e1.touched);
@@ -1028,13 +1029,16 @@ static void test_equeue_user_allocated_event_post()
10281029
TEST_ASSERT_EQUAL_UINT8(1, e4.touched);
10291030
TEST_ASSERT_EQUAL_UINT8(1, e5.touched);
10301031

1031-
equeue_dispatch(&q, 10);
1032+
e3.e.target = 10; // set target as it's modified by equeue_call
1033+
e3.e.period = 10; // set period as it's reset by equeue_cancel
1034+
equeue_post_user_allocated(&q, simple_func, &e3.e);
1035+
equeue_dispatch(&q, 101);
10321036

1033-
TEST_ASSERT_EQUAL_UINT8(1, touched);
1037+
TEST_ASSERT_EQUAL_UINT8(11, touched);
10341038
TEST_ASSERT_EQUAL_UINT8(1, e1.touched);
1035-
TEST_ASSERT_EQUAL_UINT8(1, e2.touched);
1036-
TEST_ASSERT_EQUAL_UINT8(0, e3.touched);
1037-
TEST_ASSERT_EQUAL_UINT8(1, e4.touched);
1039+
TEST_ASSERT_EQUAL_UINT8(11, e2.touched);
1040+
TEST_ASSERT_EQUAL_UINT8(10, e3.touched);
1041+
TEST_ASSERT_EQUAL_UINT8(11, e4.touched);
10381042
TEST_ASSERT_EQUAL_UINT8(1, e5.touched);
10391043

10401044
equeue_destroy(&q);

TESTS/events/queue/main.cpp

Lines changed: 55 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -363,14 +363,18 @@ void mixed_dynamic_static_events_queue_test()
363363

364364
EventTest e1_test;
365365
Event<void()> e1 = queue.event(&e1_test, &EventTest::f0);
366+
e1.delay(10);
367+
e1.period(10);
366368
int id1 = e1.post();
367369
TEST_ASSERT_NOT_EQUAL(0, id1);
368370
EventTest e2_test;
369371
Event<void()> e2 = queue.event(&e2_test, &EventTest::f1, 3);
372+
e2.period(10);
370373
int id2 = e2.post();
371374
TEST_ASSERT_NOT_EQUAL(0, id2);
372375
EventTest e3_test;
373376
Event<void()> e3 = queue.event(&e3_test, &EventTest::f5, 1, 2, 3, 4, 5);
377+
e3.period(10);
374378
int id3 = e3.post();
375379
TEST_ASSERT_NOT_EQUAL(0, id3);
376380

@@ -391,8 +395,11 @@ void mixed_dynamic_static_events_queue_test()
391395
TEST_ASSERT_EQUAL(false, ue0.try_call());
392396
ue1.call_on(&queue);
393397
TEST_ASSERT_EQUAL(false, ue1.try_call());
398+
ue2.period(10);
394399
ue2.call_on(&queue);
395400
TEST_ASSERT_EQUAL(false, ue2.try_call());
401+
ue3.period(10);
402+
ue3.delay(50);
396403
ue3.call_on(&queue);
397404
TEST_ASSERT_EQUAL(false, ue3.try_call());
398405
ue4.call_on(&queue);
@@ -401,21 +408,36 @@ void mixed_dynamic_static_events_queue_test()
401408
ue4.cancel();
402409
e2.cancel();
403410

404-
queue.dispatch(1);
411+
queue.dispatch(101);
405412

406413
TEST_ASSERT_EQUAL(true, touched);
407414
TEST_ASSERT_EQUAL(1, ue1_test.counter);
408-
TEST_ASSERT_EQUAL(3, ue2_test.counter);
409-
TEST_ASSERT_EQUAL(15, ue3_test.counter);
415+
TEST_ASSERT_EQUAL(33, ue2_test.counter);
416+
TEST_ASSERT_EQUAL(90, ue3_test.counter);
410417
TEST_ASSERT_EQUAL(0, ue4_test.counter);
411-
TEST_ASSERT_EQUAL(1, e1_test.counter);
418+
TEST_ASSERT_EQUAL(10, e1_test.counter);
412419
TEST_ASSERT_EQUAL(0, e2_test.counter);
413-
TEST_ASSERT_EQUAL(15, e3_test.counter);
420+
TEST_ASSERT_EQUAL(165, e3_test.counter);
421+
422+
// user allocated event have to be canceled(removed from the queue) before destruction
423+
// cancel all periodic user events
424+
ue2.cancel();
425+
ue3.cancel();
414426
}
415427
}
416428

417429

418430
static EventQueue g_queue(0);
431+
static auto ue0 = g_queue.make_user_allocated_event(func0);
432+
static EventTest test1;
433+
static auto ue1 = make_user_allocated_event(&test1, &EventTest::f0);
434+
static EventTest test2;
435+
static auto ue2 = g_queue.make_user_allocated_event(&test2, &EventTest::f1, 3);
436+
static EventTest test3;
437+
static auto ue3 = make_user_allocated_event(&test3, &EventTest::f5, 1, 2, 3, 4, 5);
438+
static EventTest test4;
439+
static auto ue4 = g_queue.make_user_allocated_event(&test4, &EventTest::f5, 1, 2, 3, 4, 5);
440+
419441

420442
/** Test that static queue executes user allocated events.
421443
*
@@ -429,15 +451,20 @@ void static_events_queue_test()
429451
Event<void()> e0 = g_queue.event(func0);
430452
TEST_ASSERT_EQUAL(0, e0.post());
431453

432-
auto ue0 = g_queue.make_user_allocated_event(func0);
433-
EventTest test1;
434-
auto ue1 = make_user_allocated_event(&test1, &EventTest::f0);
435-
EventTest test2;
436-
auto ue2 = g_queue.make_user_allocated_event(&test2, &EventTest::f1, 3);
437-
EventTest test3;
438-
auto ue3 = make_user_allocated_event(&test3, &EventTest::f5, 1, 2, 3, 4, 5);
439-
EventTest test4;
440-
auto ue4 = g_queue.make_user_allocated_event(&test4, &EventTest::f5, 1, 2, 3, 4, 5);
454+
ue0.delay(100);
455+
ue0.period(200);
456+
457+
ue1.delay(100);
458+
ue1.period(200);
459+
460+
ue2.delay(100);
461+
ue2.period(200);
462+
463+
ue3.delay(100);
464+
ue3.period(200);
465+
466+
ue4.delay(100);
467+
ue4.period(200);
441468

442469
ue0.call();
443470
TEST_ASSERT_EQUAL(false, ue0.try_call());
@@ -449,16 +476,26 @@ void static_events_queue_test()
449476
TEST_ASSERT_EQUAL(false, ue3.try_call());
450477
ue4.call();
451478
ue4.cancel();
479+
ue4.cancel();
452480
TEST_ASSERT_EQUAL(true, ue4.try_call());
453481
g_queue.cancel(&ue4);
482+
g_queue.cancel(&ue4);
454483

455-
g_queue.dispatch(1);
484+
g_queue.dispatch(400);
456485

457-
TEST_ASSERT_EQUAL(1, test1.counter);
458-
TEST_ASSERT_EQUAL(3, test2.counter);
459-
TEST_ASSERT_EQUAL(15, test3.counter);
486+
TEST_ASSERT_EQUAL(2, test1.counter);
487+
TEST_ASSERT_EQUAL(6, test2.counter);
488+
TEST_ASSERT_EQUAL(30, test3.counter);
460489
TEST_ASSERT_EQUAL(0, test4.counter);
461490

491+
ue4.delay(1);
492+
TEST_ASSERT_EQUAL(true, ue4.try_call());
493+
g_queue.dispatch(1);
494+
495+
TEST_ASSERT_EQUAL(2, test1.counter);
496+
TEST_ASSERT_EQUAL(6, test2.counter);
497+
TEST_ASSERT_EQUAL(30, test3.counter);
498+
TEST_ASSERT_EQUAL(15, test4.counter);
462499
}
463500

464501
// Test setup

TESTS/mbed_drivers/c_strings/main.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,15 @@ Case cases[] = {
116116
Case("C strings: %u %d integer formatting", test_case_c_string_u_d, greentea_failure_handler),
117117
Case("C strings: %x %E integer formatting", test_case_c_string_x_X, greentea_failure_handler),
118118
#if !defined(__NEWLIB_NANO)
119-
//In build tools, GCC with Newlib-nano linker option "-u _printf_float" is not configured
120-
//to enable printf floating format. So disabling floating format test case.
119+
// Newlib-nano linker option "-u _printf_float" is not set to enable floating point support.
120+
#if (defined(MBED_MINIMAL_PRINTF) && MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_FLOATING_POINT) || !defined(MBED_MINIMAL_PRINTF)
121121
Case("C strings: %f %f float formatting", test_case_c_string_f_f, greentea_failure_handler),
122+
#endif
122123
#ifndef MBED_MINIMAL_PRINTF
123124
Case("C strings: %e %E float formatting", test_case_c_string_e_E, greentea_failure_handler),
124125
Case("C strings: %g %g float formatting", test_case_c_string_g_g, greentea_failure_handler),
125-
#endif
126-
#endif
126+
#endif // MBED_MINIMAL_PRINTF
127+
#endif // !defined(__NEWLIB_NANO)
127128
};
128129

129130
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)

TESTS/mbed_drivers/reset_reason/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static cmd_status_t handle_command(const char *key, const char *value)
7575
int raw_reason_hex_str_len = snprintf(raw_reason_hex_str,
7676
sizeof raw_reason_hex_str, "%08lx", raw_reason);
7777

78-
if (raw_reason_hex_str_len != (sizeof raw_reason_hex_str) - 1) {
78+
if (raw_reason_hex_str_len < 0) {
7979
TEST_ASSERT_MESSAGE(0, "Failed to compose raw reset reason hex string.");
8080
return CMD_STATUS_ERROR;
8181
}
@@ -134,7 +134,7 @@ void test_reset_reason()
134134
hal_reset_reason_get_capabilities(&rrcap);
135135
char msg_value[11];
136136
int str_len = snprintf(msg_value, sizeof msg_value, "%08lx,%01x", rrcap.reasons, MSG_VALUE_WATCHDOG_STATUS);
137-
if (str_len != (sizeof msg_value) - 1) {
137+
if (str_len < 0) {
138138
printf("Failed to compose a value string to be sent to host.");
139139
GREENTEA_TESTSUITE_RESULT(0);
140140
return;

TESTS/mbed_drivers/watchdog_reset/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ bool send_reset_notification(testcase_data *tcdata, uint32_t delay_ms)
9292
{
9393
char msg_value[12];
9494
int str_len = snprintf(msg_value, sizeof msg_value, "%02x,%08lx", tcdata->start_index + tcdata->index, delay_ms);
95-
if (str_len != (sizeof msg_value) - 1) {
95+
if (str_len < 0) {
9696
utest_printf("Failed to compose a value string to be sent to host.");
9797
return false;
9898
}

TESTS/mbed_hal/pinmap/main.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121

2222
using namespace utest::v1;
2323

24-
#include "gpio_api.h"
25-
#include "gpio_irq_api.h"
2624
#include "analogin_api.h"
2725
#include "analogout_api.h"
2826
#include "can_api.h"
@@ -41,10 +39,6 @@ typedef struct {
4139
} pinmap_info_t;
4240

4341
const pinmap_info_t pinmap_functions[] = {
44-
PINMAP_TEST_ENTRY(gpio_pinmap),
45-
#if DEVICE_INTERRUPTIN
46-
PINMAP_TEST_ENTRY(gpio_irq_pinmap),
47-
#endif
4842
#if DEVICE_ANALOGIN
4943
PINMAP_TEST_ENTRY(analogin_pinmap),
5044
#endif

TESTS/mbed_hal/reset_reason/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static cmd_status_t handle_command(const char *key, const char *value)
7575
int raw_reason_hex_str_len = snprintf(raw_reason_hex_str,
7676
sizeof raw_reason_hex_str, "%08lx", raw_reason);
7777

78-
if (raw_reason_hex_str_len != (sizeof raw_reason_hex_str) - 1) {
78+
if (raw_reason_hex_str_len < 0) {
7979
TEST_ASSERT_MESSAGE(0, "Failed to compose raw reset reason hex string.");
8080
return CMD_STATUS_ERROR;
8181
}
@@ -129,7 +129,7 @@ void test_reset_reason()
129129
hal_reset_reason_get_capabilities(&rrcap);
130130
char msg_value[11];
131131
int str_len = snprintf(msg_value, sizeof msg_value, "%08lx,%01x", rrcap.reasons, MSG_VALUE_WATCHDOG_STATUS);
132-
if (str_len != (sizeof msg_value) - 1) {
132+
if (str_len < 0) {
133133
printf("Failed to compose a value string to be sent to host.");
134134
GREENTEA_TESTSUITE_RESULT(0);
135135
return;

TESTS/mbed_hal/watchdog_reset/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ bool send_reset_notification(testcase_data *tcdata, uint32_t delay_ms)
9090
{
9191
char msg_value[12];
9292
int str_len = snprintf(msg_value, sizeof msg_value, "%02x,%08lx", tcdata->start_index + tcdata->index, delay_ms);
93-
if (str_len != (sizeof msg_value) - 1) {
93+
if (str_len < 0) {
9494
utest_printf("Failed to compose a value string to be sent to host.");
9595
return false;
9696
}

TESTS/mbed_hal/watchdog_timing/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ bool send_reset_notification(testcase_data *tcdata, uint32_t delay_ms)
5959
{
6060
char msg_value[12];
6161
int str_len = snprintf(msg_value, sizeof msg_value, "%02x,%08lx", tcdata->start_index + tcdata->index, delay_ms);
62-
if (str_len != (sizeof msg_value) - 1) {
62+
if (str_len < 0) {
6363
utest_printf("Failed to compose a value string to be sent to host.");
6464
return false;
6565
}
@@ -110,7 +110,7 @@ void test_timing()
110110

111111
int str_len = snprintf(msg_value, sizeof msg_value, "%02x,%08lx", current_case.start_index + current_case.index,
112112
(uint32_t) current_ts);
113-
if (str_len != (sizeof msg_value) - 1) {
113+
if (str_len < 0) {
114114
utest_printf("Failed to compose a value string to be sent to host.");
115115
return;
116116
}

TESTS/mbed_hal/watchdog_timing/watchdog_timing_tests.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ void test_timing();
4343
/** Test Watchdog timeout
4444
*
4545
* Given a device with a Watchdog started,
46-
* when the Watchdog timout doesn't expire,
46+
* when the Watchdog timeout doesn't expire,
4747
* then the device restart is not performed.
48-
* When the Watchdog timout does expire,
48+
* When the Watchdog timeout does expire,
4949
* then the device is restarted after the timeout and before twice the timeout value.
5050
*/
5151
void test_timeout_lower_limit();

TESTS/mbed_hal_fpga_ci_test_shield/uart/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@
2828
#include "greentea-client/test_env.h"
2929
#include "platform/mbed_critical.h"
3030
#include <stdlib.h>
31+
#include "hal/serial_api.h"
3132
#include "UARTTester.h"
3233
#include "pinmap.h"
3334
#include "test_utils.h"
34-
#include "serial_api.h"
3535
#include "us_ticker_api.h"
3636
#include "uart_fpga_test.h"
3737
#include "hal/static_pinmap.h"
3838

39+
3940
using namespace utest::v1;
4041

4142
#define PUTC_REPS 16

TESTS/mbed_timing_fpga_ci_test_shield/watchdog/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ bool send_reset_notification(testcase_data *tcdata, uint32_t delay_ms)
119119
{
120120
char msg_value[12];
121121
int str_len = snprintf(msg_value, sizeof msg_value, "%02x,%08lx", tcdata->start_index + tcdata->index, delay_ms);
122-
if (str_len != (sizeof msg_value) - 1) {
122+
if (str_len < 0) {
123123
utest_printf("Failed to compose a value string to be sent to host.");
124124
return false;
125125
}

0 commit comments

Comments
 (0)