66
77#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL
88#include <zephyr/logging/log.h>
9- LOG_MODULE_REGISTER (main );
9+ LOG_MODULE_REGISTER (spi_loopback );
1010
1111#include <zephyr/kernel.h>
1212#include <zephyr/sys/printk.h>
@@ -29,8 +29,8 @@ LOG_MODULE_REGISTER(main);
2929 SPI_MODE_CPHA | SPI_WORD_SET(8) | SPI_LINES_SINGLE
3030
3131
32- struct spi_dt_spec spi_fast = SPI_DT_SPEC_GET (SPI_FAST_DEV , SPI_OP , 0 );
33- struct spi_dt_spec spi_slow = SPI_DT_SPEC_GET (SPI_SLOW_DEV , SPI_OP , 0 );
32+ static struct spi_dt_spec spi_fast = SPI_DT_SPEC_GET (SPI_FAST_DEV , SPI_OP , 0 );
33+ static struct spi_dt_spec spi_slow = SPI_DT_SPEC_GET (SPI_SLOW_DEV , SPI_OP , 0 );
3434
3535/* to run this test, connect MOSI pin to the MISO of the SPI */
3636
@@ -47,22 +47,22 @@ static __aligned(32) char buffer2_tx[BUF2_SIZE] __used __attribute__((__section_
4747static __aligned (32 ) char buffer2_rx [BUF2_SIZE ] __used __attribute__((__section__ (".nocache" ))) ;
4848#else
4949/* this src memory shall be in RAM to support using as a DMA source pointer.*/
50- uint8_t buffer_tx [] = "0123456789abcdef\0" ;
51- uint8_t buffer_rx [BUF_SIZE ] = {};
50+ static uint8_t buffer_tx [] = "0123456789abcdef\0" ;
51+ static uint8_t buffer_rx [BUF_SIZE ] = {};
5252
53- uint8_t buffer2_tx [] = "Thequickbrownfoxjumpsoverthelazydog\0" ;
54- uint8_t buffer2_rx [BUF2_SIZE ] = {};
53+ static uint8_t buffer2_tx [] = "Thequickbrownfoxjumpsoverthelazydog\0" ;
54+ static uint8_t buffer2_rx [BUF2_SIZE ] = {};
5555#endif
5656
5757/*
5858 * We need 5x(buffer size) + 1 to print a comma-separated list of each
5959 * byte in hex, plus a null.
6060 */
61- uint8_t buffer_print_tx [BUF_SIZE * 5 + 1 ];
62- uint8_t buffer_print_rx [BUF_SIZE * 5 + 1 ];
61+ static uint8_t buffer_print_tx [BUF_SIZE * 5 + 1 ];
62+ static uint8_t buffer_print_rx [BUF_SIZE * 5 + 1 ];
6363
64- uint8_t buffer_print_tx2 [BUF2_SIZE * 5 + 1 ];
65- uint8_t buffer_print_rx2 [BUF2_SIZE * 5 + 1 ];
64+ static uint8_t buffer_print_tx2 [BUF2_SIZE * 5 + 1 ];
65+ static uint8_t buffer_print_rx2 [BUF2_SIZE * 5 + 1 ];
6666
6767static void to_display_format (const uint8_t * src , size_t size , char * dst )
6868{
0 commit comments