Skip to content

Commit 8dc1acf

Browse files
committed
add OSPI HAL and OSPIF driver
Modify the astyle Add DEVICE_OSPI in SFDP.cpp modify the bd_type order add OSPI code in static_pinmap.cpp/h
1 parent a1d9695 commit 8dc1acf

File tree

125 files changed

+7432
-1524
lines changed

Some content is hidden

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

125 files changed

+7432
-1524
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
}

0 commit comments

Comments
 (0)