23#if VSF_USE_KERNEL == ENABLED && defined(__EDA_GADGET__)
27#if VSF_EDA_QUEUE_CFG_REGION != ENABLED
28# if VSF_EDA_QUEUE_CFG_SUPPORT_ISR == ENABLED
29# define __vsf_eda_queue_protect vsf_protect(interrupt)
30# define __vsf_eda_queue_unprotect vsf_unprotect(interrupt)
32# define __vsf_eda_queue_protect vsf_protect(scheduler)
33# define __vsf_eda_queue_unprotect vsf_unprotect(scheduler)
36# define vsf_protect_eda_queue_region() pthis->region->enter()
37# define vsf_unprotect_eda_queue_region(__orig) pthis->region->leave(__orig)
38# define __vsf_eda_queue_protect vsf_protect(eda_queue_region)
39# define __vsf_eda_queue_unprotect vsf_unprotect(eda_queue_region)
49#if VSF_KERNEL_CFG_SUPPORT_SYNC == ENABLED && VSF_KERNEL_CFG_SUPPORT_EDA_QUEUE == ENABLED
57 bool is_dequeued =
false;
59#if VSF_EDA_QUEUE_CFG_SUPPORT_ISR == ENABLED
60 if (pthis->readable_cnt > 0) {
61 pthis->readable_cnt--;
63 if (pthis->cur_union.cur_value > 0) {
65 pthis->cur_union.cur_value--;
66 pthis->op.dequeue(pthis, node);
69 __vsf_eda_queue_unprotect(origlevel);
73#if VSF_EDA_QUEUE_CFG_SUPPORT_ISR == ENABLED
74# define __vsf_eda_queue_enqueue(__queue, __node, __readable) \
75 ____vsf_eda_queue_enqueue((__queue), (__node), (__readable))
78static
bool ____vsf_eda_queue_enqueue(
vsf_eda_queue_t *pthis,
void *node,
bool readable)
80# define __vsf_eda_queue_enqueue(__queue, __node, __readable) \
81 ____vsf_eda_queue_enqueue((__queue), (__node))
84static
bool ____vsf_eda_queue_enqueue(
vsf_eda_queue_t *pthis,
void *node)
87 bool is_enqueued =
false;
89 if (pthis->cur_union.cur_value < pthis->max_union.max_value) {
90 pthis->cur_union.cur_value++;
91#if VSF_EDA_QUEUE_CFG_SUPPORT_ISR == ENABLED
93 pthis->readable_cnt++;
96 pthis->op.enqueue(pthis, node);
99 __vsf_eda_queue_unprotect(origlevel);
107#if VSF_KERNEL_CFG_QUEUE_MULTI_TX_EN == ENABLED
108 __vsf_eda_sync_get_eda_pending(&pthis->use_as__vsf_sync_t)
116#if VSF_KERNEL_CFG_QUEUE_MULTI_TX_EN == ENABLED
117 pthis->tx_processing =
true;
119 pthis->eda_tx =
NULL;
122 pthis->eda_rx =
NULL;
123#if VSF_KERNEL_CFG_QUEUE_HAS_RX_NOTIFIED == ENABLED
124 pthis->rx_notified =
true;
128 eda->flag.state.is_sync_got =
true;
133#if VSF_KERNEL_CFG_QUEUE_MULTI_TX_EN == ENABLED
135 pthis->tx_processing =
false;
146#if VSF_KERNEL_CFG_QUEUE_MULTI_TX_EN == ENABLED
147 pthis->tx_processing =
false;
149 pthis->eda_rx =
NULL;
150#if VSF_EDA_QUEUE_CFG_REGION == ENABLED
151 if (
NULL == pthis->region) {
155#if VSF_KERNEL_CFG_QUEUE_HAS_RX_NOTIFIED == ENABLED
156 pthis->rx_notified =
false;
158#if VSF_EDA_QUEUE_CFG_SUPPORT_ISR == ENABLED
159 pthis->readable_cnt = 0;
169 bool is_enqueued = __vsf_eda_queue_enqueue(pthis, node,
true);
172 __vsf_eda_queue_notify(pthis,
false, origlevel);
196 bool is_enqueued = __vsf_eda_queue_enqueue(pthis, node,
true);
199 __vsf_eda_queue_notify(pthis,
false, origlevel);
201#if VSF_KERNEL_CFG_QUEUE_MULTI_TX_EN == ENABLED
203 if (
sync->cur_union.cur_value <
sync->max) {
204 __vsf_eda_queue_notify(pthis,
true, origlevel);
207 pthis->tx_processing =
false;
227 bool is_dequeued = __vsf_eda_queue_dequeue(pthis, node);
230#if VSF_KERNEL_CFG_QUEUE_MULTI_TX_EN == ENABLED
231 if (!pthis->tx_processing) {
232 __vsf_eda_queue_notify(pthis,
true, origlevel);
238 __vsf_eda_queue_notify(pthis,
true, origlevel);
244 pthis->eda_rx = __vsf_eda_set_timeout(eda,
timeout);
263 bool is_dequeued = __vsf_eda_queue_dequeue(pthis, node);
266#if VSF_KERNEL_CFG_QUEUE_HAS_RX_NOTIFIED == ENABLED
267 pthis->rx_notified =
false;
269 __vsf_eda_queue_notify(pthis,
true, origlevel);
277 pthis->eda_rx =
NULL;
287 cnt = pthis->cur_union.cur_value;
288 __vsf_eda_queue_unprotect(origlevel);
296 if (pthis->eda_rx !=
NULL) {
298 pthis->eda_rx =
NULL;
303#if VSF_EDA_QUEUE_CFG_SUPPORT_ISR == ENABLED
310 pthis->readable_cnt++;
311 __vsf_eda_queue_unprotect(origlevel);
322 if (!__vsf_eda_queue_enqueue(pthis, node,
false)) {
333 if (!__vsf_eda_queue_dequeue(pthis, node)) {
#define VSF_CAL_SECTION(__SEC)
Definition __compiler.h:181
vsf_err_t
Definition __type.h:42
@ VSF_ERR_NONE
none error
Definition __type.h:44
@ VSF_ERR_NOT_READY
service not ready yet
Definition __type.h:43
__le16 timeout
Definition ieee80211.h:94
#define NULL
Definition lvgl.h:26
#define max(x, y)
Definition minmax.h:12
unsigned short uint_fast16_t
Definition stdint.h:25
Definition vsf_arch_abstraction.h:54
void sync(void)
Definition vsf_linux_fs.c:2137
uintalu_t vsf_protect_t
Definition vsf_arch_abstraction.h:53
vsf_err_t vsf_eda_post_evt_msg(vsf_eda_t *pthis, vsf_evt_t evt, void *msg)
Definition vsf_eda.c:963
vsf_err_t __vsf_eda_post_evt_ex(vsf_eda_t *pthis, vsf_evt_t evt, bool force)
Definition vsf_eda.c:947
int16_t vsf_evt_t
Definition vsf_eda.h:654
vsf_err_t vsf_eda_sync_init(vsf_sync_t *pthis, uint_fast16_t cur_value, uint_fast16_t max_value)
vsf_sync_reason_t vsf_eda_sync_get_reason(vsf_sync_t *pthis, vsf_evt_t evt)
vsf_err_t vsf_eda_queue_init(vsf_eda_queue_t *pthis, uint_fast16_t max)
vsf_err_t vsf_eda_queue_recv_isr(vsf_eda_queue_t *pthis, void **node)
void vsf_eda_queue_cancel(vsf_eda_queue_t *pthis)
@ VSF_EVT_SYNC_CANCEL
Definition vsf_eda.h:616
@ VSF_EVT_SYNC
Definition vsf_eda.h:615
vsf_err_t vsf_eda_queue_recv_ex(vsf_eda_queue_t *pthis, void **node, vsf_timeout_tick_t timeout, vsf_eda_t *eda)
VSF_KERNEL_TIMEOUT_TICK_T vsf_timeout_tick_t
Definition vsf_eda.h:592
uint_fast16_t vsf_eda_queue_get_cnt(vsf_eda_queue_t *pthis)
vsf_err_t vsf_eda_queue_recv(vsf_eda_queue_t *pthis, void **node, vsf_timeout_tick_t timeout)
vsf_sync_reason_t vsf_eda_queue_send_get_reason(vsf_eda_queue_t *pthis, vsf_evt_t evt, void *node)
vsf_err_t vsf_eda_queue_send_isr(vsf_eda_queue_t *pthis, void *node)
vsf_err_t vsf_eda_queue_send_ex(vsf_eda_queue_t *pthis, void *node, vsf_timeout_tick_t timeout, vsf_eda_t *eda)
vsf_sync_reason_t vsf_eda_queue_recv_get_reason(vsf_eda_queue_t *pthis, vsf_evt_t evt, void **node)
vsf_sync_reason_t
Definition vsf_eda.h:1053
@ VSF_SYNC_GET
Definition vsf_eda.h:1057
@ VSF_SYNC_TIMEOUT
Definition vsf_eda.h:1055
@ VSF_SYNC_PENDING
Definition vsf_eda.h:1056
vsf_err_t vsf_eda_queue_send(vsf_eda_queue_t *pthis, void *node, vsf_timeout_tick_t timeout)
void vsf_eda_sync_cancel(vsf_sync_t *pthis)
@ VSF_KERNEL_EVT_QUEUE_SEND_NOTIFY
Definition vsf_eda.h:628
@ VSF_KERNEL_EVT_QUEUE_RECV_NOTIFY
Definition vsf_eda.h:629
vsf_err_t vsf_evtq_post_evt_ex(vsf_eda_t *eda, vsf_evt_t evt, bool force)
Definition vsf_evtq_list.c:219
#define VSF_KERNEL_ASSERT
Definition vsf_kernel_cfg.h:32
void __vsf_eda_sync_pend(vsf_sync_t *sync, vsf_eda_t *eda, vsf_timeout_tick_t timeout)
#define vsf_protect_region_sched
Definition vsf_os.h:185
#define vsf_protect_sched()
Definition vsf_os.h:88
#define vsf_unprotect_sched(__prot)
Definition vsf_os.h:89