Skip to content

Commit f88b7cb

Browse files
authored
Merge pull request #10816 from mprse/bring_fpga_spi_tests
Bring FPGA SPI tests to feature-hal-spec-spi
2 parents a42e9b4 + b06b57c commit f88b7cb

File tree

13 files changed

+1471
-98
lines changed

13 files changed

+1471
-98
lines changed

TESTS/mbed_hal/spi/main.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ static void async_handler(spi_t *obj, void *ctx, spi_async_event_t *event)
176176

177177
/* Test that spi_get_module() returns the SPIName - unique identifier to the peripheral associated
178178
* to this SPI channel. */
179-
void test_get_module()
179+
void spi_test_get_module()
180180
{
181181
SPIName spi_name;
182182

@@ -193,7 +193,7 @@ void test_get_module()
193193

194194
/* Test that spi_get_capabilities() fills the given spi_capabilities_t instance with capabilities
195195
* of the specified SPI peripheral. */
196-
void test_get_capabilities()
196+
void spi_test_get_capabilities()
197197
{
198198
spi_capabilities_t capabilities;
199199

@@ -229,7 +229,7 @@ void test_get_capabilities()
229229

230230
/* Test that spi_init() successfully initializes the pins and spi_free() can successfully
231231
* reset the pins to their default state. */
232-
void test_init_free()
232+
void spi_test_init_free()
233233
{
234234
spi_t spi_obj = { 0 };
235235
spi_capabilities_t capabilities = { 0 };
@@ -295,7 +295,7 @@ void test_init_free()
295295
}
296296

297297
/* Test that spi_format() sets/updates the transmission format of the SPI peripheral. */
298-
void test_set_format()
298+
void spi_test_set_format()
299299
{
300300
spi_t spi_obj = { 0 };
301301
spi_capabilities_t capabilities = { 0 };
@@ -343,8 +343,8 @@ void test_set_format()
343343
TEST_ASSERT_TRUE(true);
344344
}
345345

346-
/* Test that test_set_frequency() sets the frequency used during the SPI transfer. */
347-
void test_set_frequency()
346+
/* Test that spi_test_set_frequency() sets the frequency used during the SPI transfer. */
347+
void spi_test_set_frequency()
348348
{
349349
spi_t spi_obj = { 0 };
350350
uint32_t real_freq;
@@ -372,7 +372,7 @@ void test_set_frequency()
372372
/* Test that spi_transfer() can successfully perform transfer in master mode
373373
* (TX/RX buffers are defined and have the same sizes) and returns the number of
374374
* symbols clocked on the bus during this transfer. */
375-
void test_transfer_master()
375+
void spi_test_transfer_master()
376376
{
377377
spi_t spi_obj = { 0 };
378378
spi_capabilities_t capabilities = { 0 };
@@ -420,7 +420,7 @@ void test_transfer_master()
420420
/* Test that spi_transfer() can successfully perform transfer in master mode
421421
* (TX/RX buffers are undefined or have different sizes) and returns the number of
422422
* symbols clocked on the bus during this transfer. */
423-
void test_transfer_master_fill_sym()
423+
void spi_test_transfer_master_fill_sym()
424424
{
425425
spi_t spi_obj = { 0 };
426426
spi_capabilities_t capabilities = { 0 };
@@ -457,7 +457,7 @@ void test_transfer_master_fill_sym()
457457
#ifdef DEVICE_SPI_ASYNCH
458458
/* Test that spi_transfer_async() can successfully perform asynchronous transfer
459459
* in master mode. */
460-
void test_transfer_master_async()
460+
void spi_test_transfer_master_async()
461461
{
462462
spi_t spi_obj = {0};
463463
spi_capabilities_t capabilities = {0};
@@ -521,7 +521,7 @@ void test_transfer_master_async()
521521
}
522522

523523
/* Test that spi_transfer_async_abort() can successfully abort an on-going async transfer. */
524-
void test_transfer_master_async_abort()
524+
void spi_test_transfer_master_async_abort()
525525
{
526526
spi_t spi_obj = {0};
527527
spi_capabilities_t capabilities = {0};
@@ -615,16 +615,16 @@ utest::v1::status_t greentea_failure_handler_abort(const Case *const source, con
615615
}
616616

617617
Case cases[] = {
618-
Case("SPI - get module name test", test_get_module, greentea_failure_handler),
619-
Case("SPI - get capabilities test", test_get_capabilities, greentea_failure_handler),
620-
Case("SPI - init, free test", test_init_free, greentea_failure_handler),
621-
Case("SPI - set format test", test_set_format, greentea_failure_handler),
622-
Case("SPI - set frequency test", test_set_frequency, greentea_failure_handler),
623-
Case("SPI - master transfer test", test_transfer_master, greentea_failure_handler),
624-
Case("SPI - fill symbol test", test_transfer_master_fill_sym, greentea_failure_handler),
618+
Case("SPI - get module name test", spi_test_get_module, greentea_failure_handler),
619+
Case("SPI - get capabilities test", spi_test_get_capabilities, greentea_failure_handler),
620+
Case("SPI - init, free test", spi_test_init_free, greentea_failure_handler),
621+
Case("SPI - set format test", spi_test_set_format, greentea_failure_handler),
622+
Case("SPI - set frequency test", spi_test_set_frequency, greentea_failure_handler),
623+
Case("SPI - master transfer test", spi_test_transfer_master, greentea_failure_handler),
624+
Case("SPI - fill symbol test", spi_test_transfer_master_fill_sym, greentea_failure_handler),
625625
#ifdef DEVICE_SPI_ASYNCH
626-
Case("SPI - master transfer async test", test_transfer_master_async, greentea_failure_handler),
627-
Case("SPI - master transfer async abort test", test_transfer_master_async_abort, greentea_failure_handler),
626+
Case("SPI - master transfer async test", spi_test_transfer_master_async, greentea_failure_handler),
627+
Case("SPI - master transfer async abort test", spi_test_transfer_master_async_abort, greentea_failure_handler),
628628
#endif
629629
};
630630

TESTS/mbed_hal/spi/spi_api_tests.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ extern "C" {
3838
*
3939
* @note `mosi` or `miso` pin can be undefined (but not both). `mclk` must be defined.
4040
*/
41-
void test_get_module();
41+
void spi_test_get_module();
4242

4343
/** Test that spi_get_capabilities() fills the given spi_capabilities_t instance with capabilities
4444
* of the specified SPI peripheral.
@@ -52,7 +52,7 @@ void test_get_module();
5252
* support_slave_mode capability.
5353
*
5454
*/
55-
void test_get_capabilities();
55+
void spi_test_get_capabilities();
5656

5757
/** Test that spi_init() successfully initializes the pins and spi_free() can successfully
5858
* reset the pins to their default state.
@@ -63,7 +63,7 @@ void test_get_capabilities();
6363
* Then both operations are successfully performed.
6464
*
6565
*/
66-
void test_init_free();
66+
void spi_test_init_free();
6767

6868
/** Test that spi_format() sets/updates the transmission format of the SPI peripheral.
6969
*
@@ -72,19 +72,19 @@ void test_init_free();
7272
* Then function is executed successfully.
7373
*
7474
*/
75-
void test_set_format();
75+
void spi_test_set_format();
7676

77-
/** Test that test_set_frequency() sets the frequency used during the SPI transfer.
77+
/** Test that spi_test_set_frequency() sets the frequency used during the SPI transfer.
7878
*
7979
* Given is platform with SPI support.
80-
* When test_set_frequency() is called and valid frequency is specified.
80+
* When spi_test_set_frequency() is called and valid frequency is specified.
8181
* Then function is executed successfully and actual frequency which will be used during the transfer is returned.
8282
*
8383
* @note Frequency can be only set by SPI peripheral operating in master mode.
8484
* @note Frequency must be in range specified by the capabilities of the SPI peripheral.
8585
*
8686
*/
87-
void test_set_frequency();
87+
void spi_test_set_frequency();
8888

8989
/** Test that spi_transfer() can successfully perform transfer in master mode
9090
* (TX/RX buffers are defined and have the same sizes) and returns the number of
@@ -96,7 +96,7 @@ void test_set_frequency();
9696
* Then function is executed successfully and returns number of symbols clocked on the bus during this transfer.
9797
*
9898
*/
99-
void test_transfer_master();
99+
void spi_test_transfer_master();
100100

101101
/** Test that spi_transfer() can successfully perform transfer in master mode
102102
* (TX/RX buffers are undefined or have different sizes) and returns the number of
@@ -108,7 +108,7 @@ void test_transfer_master();
108108
* Then function is executed successfully and returns number of symbols clocked on the bus during this transfer.
109109
*
110110
*/
111-
void test_transfer_master_fill_sym();
111+
void spi_test_transfer_master_fill_sym();
112112

113113
/** Test that spi_transfer_async() can successfully perform asynchronous transfer
114114
* in master mode.
@@ -119,7 +119,7 @@ void test_transfer_master_fill_sym();
119119
* when the transfer completes (passing the operation status).
120120
*
121121
*/
122-
void test_transfer_master_async();
122+
void spi_test_transfer_master_async();
123123

124124
/** Test that spi_transfer_async_abort() can successfully abort an on-going async transfer.
125125
*
@@ -130,7 +130,7 @@ void test_transfer_master_async();
130130
* the status which indicates that the transfer has been aborted.
131131
*
132132
*/
133-
void test_transfer_master_async_abort();
133+
void spi_test_transfer_master_async_abort();
134134

135135
/**@}*/
136136

0 commit comments

Comments
 (0)