You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.6 KiB
57 lines
1.6 KiB
/*
|
|
* 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 <linux/fs.h>
|
|
#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
|