/* * Copyright (c) Hisilicon Technologies Co., Ltd.. 2020-2020. All rights reserved. * Description: the header for spi driver. */ #ifndef DRV_SPI_H #define DRV_SPI_H #include #include "td_type.h" #ifdef __cplusplus #if __cplusplus extern "C" { #endif #endif #define spi_check_param(ret, errno, param, cmd) do { \ if ((param)) { \ soc_log_err("%s failed!\n", #param); \ ret = (errno); \ cmd; \ } \ } while (0) #define spi_func_call(ret, func, cmd) do { \ (ret) = (func); \ if ((ret) != TD_SUCCESS) { \ soc_log_err("failed!\n"); \ cmd; \ } \ } while (0) #define spi_mem_func_call(ret, func, cmd) do { \ (ret) = (func); \ if ((ret) != EOK) { \ soc_log_err("failed!\n"); \ cmd; \ } \ } while (0) td_s32 ext_drv_spi_set_loop(td_u8 dev_id, td_u8 set); td_s32 ext_drv_spi_rw_loop(td_u8 dev_id, const td_u8 *send, td_u32 send_cnt, td_u8 *read, td_u32 read_cnt); td_s32 ext_drv_spi_ioctl(const struct file *file, td_u32 cmd, td_size_t arg); #ifdef CONFIG_COMPAT td_s32 ext_drv_spi_compat_ioctl(const struct file *file, td_u32 cmd, td_size_t arg); #endif #ifdef __cplusplus #if __cplusplus } #endif #endif #endif