45 memset(w25qxx->
txq, 0,
sizeof(w25qxx->
txq));
46 memset(w25qxx->
rxq, 0,
sizeof(w25qxx->
rxq));
60#if defined(XWCDCFG_ds_PM) && (1 == XWCDCFG_ds_PM)
84 xwsz_t i, j, idx, rxofs, xfersize;
95 w25qxx->
txq[idx] = instruction;
98 for (i = 0, j = (
xwsz_t)(address_size - 1);
101 w25qxx->
txq[idx] = (
xwu8_t)(address >> (j * 8));
106 for (i = 0; i < (dummy_cycles / 8); i++) {
107 w25qxx->
txq[idx] = 0;
112 for (i = 0; i < size; i++) {
114 w25qxx->
txq[idx] = txd[i];
116 w25qxx->
txq[idx] = 0;
122 w25qxx->
txq, w25qxx->
rxq, &xfersize,
128 for (i = 0; i < size; i++) {
129 rxb[i] = w25qxx->
rxq[rxofs + i];
157 goto err_w25qxx_ctrl;
168 goto err_w25qxx_ctrl;
239 goto err_not_support;
247 goto err_w25qxx_ctrl;
278 goto err_not_support;
286 goto err_w25qxx_ctrl;
320 goto err_not_support;
328 goto err_w25qxx_ctrl;
364 sleepto =
xwtm_cmp(sleepto, to) > 0 ? to : sleepto;
385 goto err_not_support;
393 goto err_w25qxx_ctrl;
415 goto err_not_support;
423 goto err_w25qxx_ctrl;
445 goto err_not_support;
453 goto err_w25qxx_ctrl;
481 goto err_not_support;
487 NULL, rxb, xfsize, to);
489 goto err_w25qxx_ctrl;
523 goto err_not_support;
529 txb,
NULL, xfsize, to);
531 goto err_w25qxx_ctrl;
559 goto err_not_support;
567 goto err_w25qxx_ctrl;
598 goto err_not_support;
606 goto err_w25qxx_ctrl;
637 goto err_not_support;
645 goto err_w25qxx_ctrl;
676 goto err_not_support;
684 goto err_w25qxx_ctrl;
#define xwds_cast(type, dev)
#define XWDS_VALIDATE(exp, errstr,...)
static xwer_t xwds_w25qxx_grab(struct xwds_w25qxx *w25qxx)
W25QXX API:增加对象的引用计数
static xwer_t xwds_w25qxx_put(struct xwds_w25qxx *w25qxx)
W25QXX API:减少对象的引用计数
@ XWDS_W25QXX_CMD_64KBLOCK_ERASE
@ XWDS_W25QXX_CMD_READ_STATUS_REG_2
@ XWDS_W25QXX_CMD_CHIP_ERASE
@ XWDS_W25QXX_CMD_UNIQUE_ID
@ XWDS_W25QXX_CMD_ENABLE_RESET
@ XWDS_W25QXX_CMD_PAGE_PROGRAM
@ XWDS_W25QXX_CMD_WRITE_DISABLE
@ XWDS_W25QXX_CMD_MANUFACTURER_DEVICE_ID
@ XWDS_W25QXX_CMD_READ_STATUS_REG_1
@ XWDS_W25QXX_CMD_READ_STATUS_REG_3
@ XWDS_W25QXX_CMD_32KBLOCK_ERASE
@ XWDS_W25QXX_CMD_SECTOR_ERASE
@ XWDS_W25QXX_CMD_WRITE_ENABLE
@ XWDS_W25QXX_CMD_JEDEC_DEVICE_ID
@ XWDS_W25QXX_CMD_FAST_READ_DATA
#define __xwcc_unlikely(x)
#define ECHRNG
Channel number out of range
#define EINVAL
Invalid argument
#define EFAULT
Bad address
#define EBUSY
Device or resource busy
#define ENOTSUP
Not supported
#define EACCES
Permission denied
static __xwcc_inline xwtm_t xwtm_add_safely(const xwtm_t a, const xwtm_t b)
将两个系统时间相加,并检查溢出
xws64_t xwtm_t
XWOS系统时间 (有符号)
static __xwcc_inline xwer_t xwtm_cmp(const xwtm_t a, const xwtm_t b)
比较两个系统时间
#define XWTM_MS(ms)
系统时间的单位:毫秒
#define xwbop_re(type, data)
XWOS BOPLIB:将数据的大小端翻转
static xwer_t xwos_cthd_sleep_to(xwtm_t to)
XWOS API:线程睡眠到一个时间点
static xwtm_t xwtm_now(void)
XWOS API:获取当前CPU的系统时间点
xwer_t xwds_w25qxx_read_uid(struct xwds_w25qxx *w25qxx, xwu64_t *uidbuf, xwtm_t to)
W25QXX API:读取W25QXX的UID
xwer_t xwds_w25qxx_write(struct xwds_w25qxx *w25qxx, xwu32_t address, xwu8_t *txb, xwsz_t *size, xwtm_t to)
W25QXX API:向W25QXX写入数据
xwer_t xwds_w25qxx_ctrl(struct xwds_w25qxx *w25qxx, xwu8_t instruction, xwu8_t address_size, xwu32_t address, xwu32_t dummy_cycles, const xwu8_t txd[], xwu8_t *rxb, xwsz_t size, xwtm_t to)
W25QXX API:向W25QXX发送指令
xwer_t xwds_w25qxx_read_mid(struct xwds_w25qxx *w25qxx, xwu16_t *midbuf, xwtm_t to)
W25QXX API:读取W25QXX的MID
xwer_t xwds_w25qxx_wait_idle(struct xwds_w25qxx *w25qxx, xwtm_t period, xwtm_t to)
W25QXX API:等待W25QXX是否空闲
xwer_t xwds_w25qxx_reset(struct xwds_w25qxx *w25qxx, xwtm_t to)
W25QXX API:向W25QXX发送复位命令
xwer_t xwds_w25qxx_write_disable(struct xwds_w25qxx *w25qxx, xwtm_t to)
W25QXX API:关闭W25QXX的写操作
xwer_t xwds_w25qxx_read(struct xwds_w25qxx *w25qxx, xwu32_t address, xwu8_t *rxb, xwsz_t *size, xwtm_t to)
W25QXX API:向W25QXX读取数据
xwer_t xwds_w25qxx_check_idle(struct xwds_w25qxx *w25qxx, xwtm_t to)
W25QXX API:检测W25QXX是否空闲
xwer_t xwds_w25qxx_write_enable(struct xwds_w25qxx *w25qxx, xwtm_t to)
W25QXX API:开启W25QXX的写操作
xwer_t xwds_w25qxx_erase_32kblk(struct xwds_w25qxx *w25qxx, xwu32_t address, xwtm_t to)
W25QXX API:擦除W25QXX的32KiB的块
xwer_t xwds_w25qxx_drv_start(struct xwds_device *dev)
W25QXX基本驱动:启动设备
xwer_t xwds_w25qxx_read_jid(struct xwds_w25qxx *w25qxx, xwu32_t *jidbuf, xwtm_t to)
W25QXX API:读取W25QXX的JID
xwer_t xwds_w25qxx_erase_64kblk(struct xwds_w25qxx *w25qxx, xwu32_t address, xwtm_t to)
W25QXX API:擦除W25QXX的64KiB的块
xwer_t xwds_w25qxx_drv_suspend(struct xwds_device *dev)
W25QXX基本驱动:继续设备
xwer_t xwds_w25qxx_read_sr(struct xwds_w25qxx *w25qxx, xwu32_t sridx, xwu8_t *srbuf, xwtm_t to)
W25QXX API:读取W25QXX的SR寄存器
xwer_t xwds_w25qxx_drv_stop(struct xwds_device *dev)
W25QXX基本驱动:停止设备
xwer_t xwds_w25qxx_erase_sector(struct xwds_w25qxx *w25qxx, xwu32_t address, xwtm_t to)
W25QXX API:擦除W25QXX的sector
xwer_t xwds_w25qxx_init_parameter(struct xwds_w25qxx *w25qxx, xwtm_t to)
W25QXX API:初始化W25QXX的参数
xwer_t xwds_w25qxx_drv_resume(struct xwds_device *dev)
W25QXX基本驱动:暂停设备
xwer_t xwds_w25qxx_erase_chip(struct xwds_w25qxx *w25qxx, xwtm_t to)
W25QXX API:擦除W25QXX的全部数据
const struct xwds_driver * drv
xwer_t(* io)(struct xwds_w25qxx *, xwu8_t *, xwu8_t *, xwsz_t *, xwtm_t)
struct xwds_w25qxx_parameter parameter
const struct xwds_w25qxx_cmd * cmdtbl