Source
x
/*
* linux/drivers/spi/spi-test.h
*
* (c) Martin Sperl <kernel@martin.sperl.org>
*
* spi_test definitions
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/* the "dummy" start addresses used in spi_test
* these addresses get translated at a later stage
*/
/* some special defines for offsets */
/* detection pattern for unfinished reads...
* - 0x00 or 0xff could be valid levels for tx_buf = NULL,
* so we do not use either of them
*/
/**
* struct spi_test - describes a specific (set of) tests to execute
*
* @description: description of the test
*
* @msg: a template @spi_message usedfor the default settings
* @transfers: array of @spi_transfers that are part of the
* resulting spi_message.
* @transfer_count: number of transfers
*
* @run_test: run a specific spi_test - this allows to override
* the default implementation of @spi_test_run_transfer
* either to add some custom filters for a specific test
* or to effectively run some very custom tests...
* @execute_msg: run the spi_message for real - this allows to override
* @spi_test_execute_msg to apply final modifications
* on the spi_message
* @expected_return: the expected return code - in some cases we want to
* test also for error conditions
*
* @iterate_len: list of length to iterate on
* @iterate_tx_align: change the alignment of @spi_transfer.tx_buf
* for all values in the below range if set.
* the ranges are:
* [0 : @spi_master.dma_alignment[ if set
* [0 : iterate_tx_align[ if unset
* @iterate_rx_align: change the alignment of @spi_transfer.rx_buf
* see @iterate_tx_align for details
* @iterate_transfer_mask: the bitmask of transfers to which the iterations
* apply - if 0, then it applies to all transfer
*
* @fill_option: define the way how tx_buf is filled
* @fill_pattern: fill pattern to apply to the tx_buf
* (used in some of the @fill_options)
* @elapsed_time: elapsed time in nanoseconds
*/
struct spi_test {
char description[64];
struct spi_message msg;
struct spi_transfer transfers[SPI_TEST_MAX_TRANSFERS];
unsigned int transfer_count;
int (*run_test)(struct spi_device *spi, struct spi_test *test,
void *tx, void *rx);
int (*execute_msg)(struct spi_device *spi, struct spi_test *test,
void *tx, void *rx);
int expected_return;
/* iterate over all values, terminated by a -1 */
int iterate_len[SPI_TEST_MAX_ITERATE];