48#if defined(XWCDCFG_ds_PM) && (1 == XWCDCFG_ds_PM)
61#if defined(XWCDCFG_ds_PM) && (1 == XWCDCFG_ds_PM)
153 goto err_dev_vop_remove;
195#if (defined(XWCDCFG_ds_PM)) && (1 == XWCDCFG_ds_PM)
233 xwsz_t available, real, cp, rest_buffer_size;
247 rest_buffer_size = *size;
248 while (rest_buffer_size) {
251 goto err_sem_wait_to;
260 real = available > rest_buffer_size ? rest_buffer_size : available;
261 if ((real + uartc->
rxq.
pos) >=
sizeof(uartc->
rxq.
mem)) {
264 memcpy(&buf[cp + pos], &uartc->
rxq.
mem[0], real - cp);
265 uartc->
rxq.
pos = real - cp;
267 memcpy(&buf[pos], &uartc->
rxq.
mem[uartc->
rxq.
pos], real);
272 rest_buffer_size -= real;
273 if (available > real) {
292 xwsz_t available, real, cp, rest_buffer_size;
306 rest_buffer_size = *size;
307 while (rest_buffer_size) {
310 goto err_sem_trywait;
319 real = available > rest_buffer_size ? rest_buffer_size : available;
320 if ((real + uartc->
rxq.
pos) >=
sizeof(uartc->
rxq.
mem)) {
323 memcpy(&buf[cp + pos], &uartc->
rxq.
mem[0], real - cp);
324 uartc->
rxq.
pos = real - cp;
326 memcpy(&buf[pos], &uartc->
rxq.
mem[uartc->
rxq.
pos], real);
331 rest_buffer_size -= real;
332 if (available > real) {
368 if ((drv) && (drv->
tx)) {
369 rc = drv->
tx(uartc, data, size, to);
405 if ((drv) && (drv->
eq)) {
406 rc = drv->
eq(uartc, data, size, cb);
441 if ((drv) && (drv->
putc)) {
442 rc = drv->
putc(uartc,
byte);
476 if ((drv) && (drv->
cfg)) {
477 rc = drv->
cfg(uartc,
cfg);
511 for (
xwsz_t i = 0; i < size; i++) {
527 if (
sizeof(uartc->
rxq.
mem) == pub) {
533 }
else if (pub > uartc->
rxq.
tail) {
536 }
else if (uartc->
rxq.
pos <= pub) {
547 if (uartc->
rxq.
pos <= pub) {
static xwer_t xwds_device_grab(struct xwds_device *dev)
XWDS API:增加对象的引用计数
xwer_t xwds_device_vop_start(struct xwds_device *dev)
设备基本操作函数:启动设备
void xwds_device_construct(struct xwds_device *dev)
XWDS API:设备的构造函数
void xwds_device_destruct(struct xwds_device *dev)
XWDS API:设备的析构函数
static xwer_t xwds_device_put(struct xwds_device *dev)
XWDS API:减少对象的引用计数
xwer_t xwds_device_vop_stop(struct xwds_device *dev)
设备基本操作函数:停止设备
xwer_t xwds_device_vop_remove(struct xwds_device *dev)
设备基本操作函数:删除设备
xwer_t xwds_device_vop_resume(struct xwds_device *dev)
设备基本操作函数:继续设备
xwer_t xwds_device_vop_probe(struct xwds_device *dev)
设备基本操作函数:探测设备
xwer_t xwds_device_vop_suspend(struct xwds_device *dev)
设备基本操作函数:暂停设备
xwer_t xwds_uartc_grab(struct xwds_uartc *uartc)
增加对象的引用计数
xwer_t xwds_uartc_tx(struct xwds_uartc *uartc, const xwu8_t *data, xwsz_t *size, xwtm_t to)
XWDS API:同步发送
void xwds_uartc_drvcb_rxq_pub(struct xwds_uartc *uartc, xwsq_t pub)
XWDS Driver Callback:发布数据到接收队列
xwer_t xwds_uartc_cfg(struct xwds_uartc *uartc, const struct xwds_uart_cfg *cfg)
XWDS API:配置UART
void xwds_uartc_destruct(struct xwds_uartc *uartc)
XWDS API:UART控制器对象的析构函数
xwer_t xwds_uartc_rx(struct xwds_uartc *uartc, xwu8_t *buf, xwsz_t *size, xwtm_t to)
XWDS API:从接收队列中获取数据
void xwds_uartc_construct(struct xwds_uartc *uartc)
XWDS API:UART控制器的构造函数
xwer_t xwds_uartc_eq(struct xwds_uartc *uartc, const xwu8_t *data, xwsz_t *size, xwds_uartc_eqcb_f cb)
XWDS API:异步发送
xwer_t xwds_uartc_put(struct xwds_uartc *uartc)
减少对象的引用计数
xwer_t xwds_uartc_putc(struct xwds_uartc *uartc, const xwu8_t byte, xwtm_t to)
XWDS API:直接发送一个字节(非DMA模式)
void(* xwds_uartc_eqcb_f)(struct xwds_uartc *, xwer_t)
异步发送的回调函数类型
xwsq_t xwds_uartc_drvcb_rxq_fill(struct xwds_uartc *uartc, xwu8_t bytes[], xwsz_t size)
XWDS Driver Callback:从UART硬件接收数据到缓冲区
void xwds_uartc_drvcb_rxq_flush(struct xwds_uartc *uartc)
XWDS Driver Callback:清空接收队列
xwer_t xwds_uartc_try_rx(struct xwds_uartc *uartc, xwu8_t *buf, xwsz_t *size)
XWDS API:尝试从接收队列中获取数据
#define xwds_cast(type, dev)
#define XWDS_VALIDATE(exp, errstr,...)
#define EFAULT
Bad address
#define ENOSYS
Function not implemented
xws64_t xwtm_t
XWOS系统时间 (有符号)
static xwer_t xwos_mtx_init(struct xwos_mtx *mtx, xwpr_t sprio)
XWOS API:静态方式初始化互斥锁
static xwer_t xwos_mtx_lock_to(struct xwos_mtx *mtx, xwtm_t to)
XWOS API:限时等待上锁互斥锁
static xwer_t xwos_mtx_fini(struct xwos_mtx *mtx)
XWOS API:销毁静态方式初始化的互斥锁
static xwer_t xwos_mtx_unlock(struct xwos_mtx *mtx)
XWOS API:解锁互斥锁
static void xwos_splk_unlock_cpuirqrs(struct xwos_splk *spl, xwreg_t cpuirq)
XWOS API:解锁自旋锁,并恢复本地CPU的中断标志
static void xwos_splk_init(struct xwos_splk *spl)
XWOS API:初始化自旋锁
static void xwos_splk_lock_cpuirqsv(struct xwos_splk *spl, xwreg_t *cpuirq)
XWOS API:上锁自旋锁,保存本地CPU的中断标志并关闭
#define XWOS_SKD_PRIORITY_RT_MIN
XWOS API:最小实时优先级
static xwer_t xwos_sem_trywait(struct xwos_sem *sem)
XWOS API:尝试获取信号量
static xwer_t xwos_sem_fini(struct xwos_sem *sem)
XWOS API:销毁静态方式初始化的信号量对象
static xwer_t xwos_sem_wait_to(struct xwos_sem *sem, xwtm_t to)
XWOS API:限时等待并获取信号量
static xwer_t xwos_sem_init(struct xwos_sem *sem, xwssq_t val, xwssq_t max)
XWOS API:静态方式初始化信号量对象
static xwer_t xwos_sem_post(struct xwos_sem *sem)
XWOS API:发布信号量
const struct xwds_driver * drv
const struct xwds_virtual_operation * vop
xwer_t(* eq)(struct xwds_uartc *, const xwu8_t *, xwsz_t *, xwds_uartc_eqcb_f)
xwer_t(* cfg)(struct xwds_uartc *, const struct xwds_uart_cfg *)
xwer_t(* tx)(struct xwds_uartc *, const xwu8_t *, xwsz_t *, xwtm_t)
xwer_t(* putc)(struct xwds_uartc *, const xwu8_t)
struct xwds_uartc::@27 rxq
xwer_t(* stop)(struct xwds_device *)
xwer_t(* remove)(struct xwds_device *)
xwer_t(* probe)(struct xwds_device *)
xwer_t(* resume)(struct xwds_device *)
static xwer_t xwds_uartc_vop_probe(struct xwds_uartc *uartc)
XWDS VOP:探测UART控制器
const struct xwds_virtual_operation xwds_uartc_vop
static xwer_t xwds_uartc_vop_resume(struct xwds_uartc *uartc)
XWDS VOP:继续UART控制器
static xwer_t xwds_uartc_vop_stop(struct xwds_uartc *uartc)
XWDS VOP:停止UART控制器
static xwer_t xwds_uartc_vop_remove(struct xwds_uartc *uartc)
XWDS VOP:移除UART控制器
static xwer_t xwds_uartc_vop_start(struct xwds_uartc *uartc)
XWDS VOP:启动UART控制器
static xwer_t xwds_uartc_vop_suspend(struct xwds_uartc *uartc)
XWDS VOP:暂停UART控制器