tests: spi: spi_loopback: cleanup code formatting
Cleanup split lines and invalid whitespace. Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
parent
399a0b4b31
commit
d6c3b0a40a
1 changed files with 26 additions and 43 deletions
|
@ -42,15 +42,11 @@ struct spi_cs_control spi_cs = {
|
|||
|
||||
#if CONFIG_NOCACHE_MEMORY
|
||||
static const char tx_data[] = "0123456789abcdef\0";
|
||||
static __aligned(32) char buffer_tx[BUF_SIZE] __used
|
||||
__attribute__((__section__(".nocache")));
|
||||
static __aligned(32) char buffer_rx[BUF_SIZE] __used
|
||||
__attribute__((__section__(".nocache")));
|
||||
static __aligned(32) char buffer_tx[BUF_SIZE] __used __attribute__((__section__(".nocache")));
|
||||
static __aligned(32) char buffer_rx[BUF_SIZE] __used __attribute__((__section__(".nocache")));
|
||||
static const char tx2_data[] = "Thequickbrownfoxjumpsoverthelazydog\0";
|
||||
static __aligned(32) char buffer2_tx[BUF2_SIZE] __used
|
||||
__attribute__((__section__(".nocache")));
|
||||
static __aligned(32) char buffer2_rx[BUF2_SIZE] __used
|
||||
__attribute__((__section__(".nocache")));
|
||||
static __aligned(32) char buffer2_tx[BUF2_SIZE] __used __attribute__((__section__(".nocache")));
|
||||
static __aligned(32) char buffer2_rx[BUF2_SIZE] __used __attribute__((__section__(".nocache")));
|
||||
#else
|
||||
/* this src memory shall be in RAM to support using as a DMA source pointer.*/
|
||||
uint8_t buffer_tx[] = "0123456789abcdef\0";
|
||||
|
@ -126,6 +122,7 @@ static int spi_complete_multiple(const struct device *dev,
|
|||
.buffers = tx_bufs,
|
||||
.count = ARRAY_SIZE(tx_bufs)
|
||||
};
|
||||
|
||||
tx_bufs[0].buf = buffer_tx;
|
||||
tx_bufs[0].len = BUF_SIZE;
|
||||
|
||||
|
@ -159,10 +156,8 @@ static int spi_complete_multiple(const struct device *dev,
|
|||
if (memcmp(buffer_tx, buffer_rx, BUF_SIZE)) {
|
||||
to_display_format(buffer_tx, BUF_SIZE, buffer_print_tx);
|
||||
to_display_format(buffer_rx, BUF_SIZE, buffer_print_rx);
|
||||
LOG_ERR("Buffer contents are different: %s",
|
||||
buffer_print_tx);
|
||||
LOG_ERR(" vs: %s",
|
||||
buffer_print_rx);
|
||||
LOG_ERR("Buffer contents are different: %s", buffer_print_tx);
|
||||
LOG_ERR(" vs: %s", buffer_print_rx);
|
||||
zassert_false(1, "Buffer contents are different");
|
||||
return -1;
|
||||
}
|
||||
|
@ -170,11 +165,9 @@ static int spi_complete_multiple(const struct device *dev,
|
|||
if (memcmp(buffer2_tx, buffer2_rx, BUF2_SIZE)) {
|
||||
to_display_format(buffer2_tx, BUF2_SIZE, buffer_print_tx2);
|
||||
to_display_format(buffer2_rx, BUF2_SIZE, buffer_print_rx2);
|
||||
LOG_ERR("Buffer 2 contents are different: %s",
|
||||
buffer_print_tx2);
|
||||
LOG_ERR(" vs: %s",
|
||||
buffer_print_rx2);
|
||||
zassert_false(1, "Buffer contents are different");
|
||||
LOG_ERR("Buffer 2 contents are different: %s", buffer_print_tx2);
|
||||
LOG_ERR(" vs: %s", buffer_print_rx2);
|
||||
zassert_false(1, "Buffer 2 contents are different");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -221,10 +214,8 @@ static int spi_complete_loop(const struct device *dev,
|
|||
if (memcmp(buffer_tx, buffer_rx, BUF_SIZE)) {
|
||||
to_display_format(buffer_tx, BUF_SIZE, buffer_print_tx);
|
||||
to_display_format(buffer_rx, BUF_SIZE, buffer_print_rx);
|
||||
LOG_ERR("Buffer contents are different: %s",
|
||||
buffer_print_tx);
|
||||
LOG_ERR(" vs: %s",
|
||||
buffer_print_rx);
|
||||
LOG_ERR("Buffer contents are different: %s", buffer_print_tx);
|
||||
LOG_ERR(" vs: %s", buffer_print_rx);
|
||||
zassert_false(1, "Buffer contents are different");
|
||||
return -1;
|
||||
}
|
||||
|
@ -238,14 +229,14 @@ static int spi_null_tx_buf(const struct device *dev,
|
|||
struct spi_config *spi_conf)
|
||||
{
|
||||
static const uint8_t EXPECTED_NOP_RETURN_BUF[BUF_SIZE] = { 0 };
|
||||
|
||||
(void)memset(buffer_rx, 0x77, BUF_SIZE);
|
||||
|
||||
const struct spi_buf tx_bufs[] = {
|
||||
/* According to documentation, when sending NULL tx buf -
|
||||
* NOP frames should be sent on MOSI line
|
||||
*/
|
||||
{
|
||||
/*
|
||||
* According to documentation, when sending NULL tx buf -
|
||||
* NOP frames should be sent on MOSI line
|
||||
*/
|
||||
.buf = NULL,
|
||||
.len = BUF_SIZE,
|
||||
},
|
||||
|
@ -329,10 +320,8 @@ static int spi_rx_half_start(const struct device *dev,
|
|||
if (memcmp(buffer_tx, buffer_rx, 8)) {
|
||||
to_display_format(buffer_tx, 8, buffer_print_tx);
|
||||
to_display_format(buffer_rx, 8, buffer_print_rx);
|
||||
LOG_ERR("Buffer contents are different: %s",
|
||||
buffer_print_tx);
|
||||
LOG_ERR(" vs: %s",
|
||||
buffer_print_rx);
|
||||
LOG_ERR("Buffer contents are different: %s", buffer_print_tx);
|
||||
LOG_ERR(" vs: %s", buffer_print_rx);
|
||||
zassert_false(1, "Buffer contents are different");
|
||||
return -1;
|
||||
}
|
||||
|
@ -387,13 +376,11 @@ static int spi_rx_half_end(const struct device *dev,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (memcmp(buffer_tx+8, buffer_rx, 8)) {
|
||||
if (memcmp(buffer_tx + 8, buffer_rx, 8)) {
|
||||
to_display_format(buffer_tx + 8, 8, buffer_print_tx);
|
||||
to_display_format(buffer_rx, 8, buffer_print_rx);
|
||||
LOG_ERR("Buffer contents are different: %s",
|
||||
buffer_print_tx);
|
||||
LOG_ERR(" vs: %s",
|
||||
buffer_print_rx);
|
||||
LOG_ERR("Buffer contents are different: %s", buffer_print_tx);
|
||||
LOG_ERR(" vs: %s", buffer_print_rx);
|
||||
zassert_false(1, "Buffer contents are different");
|
||||
return -1;
|
||||
}
|
||||
|
@ -464,19 +451,15 @@ static int spi_rx_every_4(const struct device *dev,
|
|||
if (memcmp(buffer_tx + 4, buffer_rx, 4)) {
|
||||
to_display_format(buffer_tx + 4, 4, buffer_print_tx);
|
||||
to_display_format(buffer_rx, 4, buffer_print_rx);
|
||||
LOG_ERR("Buffer contents are different: %s",
|
||||
buffer_print_tx);
|
||||
LOG_ERR(" vs: %s",
|
||||
buffer_print_rx);
|
||||
LOG_ERR("Buffer contents are different: %s", buffer_print_tx);
|
||||
LOG_ERR(" vs: %s", buffer_print_rx);
|
||||
zassert_false(1, "Buffer contents are different");
|
||||
return -1;
|
||||
} else if (memcmp(buffer_tx + 12, buffer_rx + 4, 4)) {
|
||||
to_display_format(buffer_tx + 12, 4, buffer_print_tx);
|
||||
to_display_format(buffer_rx + 4, 4, buffer_print_rx);
|
||||
LOG_ERR("Buffer contents are different: %s",
|
||||
buffer_print_tx);
|
||||
LOG_ERR(" vs: %s",
|
||||
buffer_print_rx);
|
||||
LOG_ERR("Buffer contents are different: %s", buffer_print_tx);
|
||||
LOG_ERR(" vs: %s", buffer_print_rx);
|
||||
zassert_false(1, "Buffer contents are different");
|
||||
return -1;
|
||||
}
|
||||
|
@ -558,7 +541,7 @@ static int spi_async_call(const struct device *dev,
|
|||
|
||||
k_sem_take(&caller, K_FOREVER);
|
||||
|
||||
if (result) {
|
||||
if (result) {
|
||||
LOG_ERR("Call code %d", ret);
|
||||
zassert_false(result, "SPI transceive failed");
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue