#define SPIDEVTEST_BUFLEN 32 /* one block */ #define SPIDEVTEST_BUFLEN2 (32*2) /* two blocks */ #define SPIDEVTEST_BUFLEN3 (32*3) /* three blocks */ #define SPIDEVTEST_BUFLEN4 (32*4) /* fifo size */ #define SPIDEVTEST_BUFLEN5 (32+8) /* fifo size + something */ #define SPIDEVTEST_1K_BUFLEN (1024) #define SPIDEVTEST_2K_BUFLEN (1024*2) #define SPIDEVTEST_3K_BUFLEN (1024*3) #define SPIDEVTEST_4K_BUFLEN (1024*4) #define SPIDEVTEST_DEVLEN 50 #define SPIDEVTEST_INVALID_CS 5 #define ARRAY_SIZE(a) (int)(sizeof(a) / sizeof((a)[0])) #define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) #define SPI_REPEAT_COUNT 10 #define USHORT_MAX (~0U) #define SPI_SLAVE_SYS_BUF_MAX_SIZE (4096) static uint8_t saved_mode; static uint8_t req_mode; static uint8_t verbose; static uint8_t suppress_errors; static uint8_t loop; static uint8_t aardvark; static uint8_t testid = -1; static uint32_t test_set; static uint32_t max_speed; static uint8_t continuous; static uint8_t cross_tran = 0; static int sys_spi_slave_fd = -1; #define SYSFS_SPI_SLAVE_PATH "/sys/class/spi_slave/spi4/spi4.0/slave-j5" static int sysfs_slave_fd = -1; static pthread_mutex_t start_mutex; static pthread_mutex_t stop_mutex; static pthread_cond_t start_cond; static pthread_cond_t stop_cond; int slave_rw_stop = 0; int slave_cmd;
时间: 2024-02-26 12:56:08 浏览: 85
这段代码是关于 SPI 设备的测试代码,其中定义了各种缓冲区大小、设备长度、重复次数等常量和变量。代码中还定义了一些静态变量和互斥锁以及条件变量,用于线程同步。同时,代码中也包含了一些宏定义,比如计算数组大小的宏和按给定对齐方式对齐的宏等。最后,代码中还定义了一些函数和变量,但是这里没有给出完整的代码,所以不好判断具体的功能。
阅读全文