/src/tinyusb/src/osal/osal_none.h
Line | Count | Source |
1 | | /* |
2 | | * SPDX-FileCopyrightText: Copyright (c) 2019 Ha Thach (tinyusb.org) |
3 | | * SPDX-License-Identifier: MIT |
4 | | * |
5 | | * This file is part of the TinyUSB stack. |
6 | | */ |
7 | | |
8 | | #ifndef TUSB_OSAL_NONE_H_ |
9 | | #define TUSB_OSAL_NONE_H_ |
10 | | |
11 | | #ifdef __cplusplus |
12 | | extern "C" { |
13 | | #endif |
14 | | |
15 | | // osal_time_millis() is not provided, tusb_time_millis_api() must be implemented by user application |
16 | | |
17 | | //--------------------------------------------------------------------+ |
18 | | // TASK API |
19 | | //--------------------------------------------------------------------+ |
20 | | // Bare-metal single context: return a non-NULL sentinel so equality compares true. |
21 | | typedef void* osal_task_handle_t; |
22 | | |
23 | 0 | TU_ATTR_ALWAYS_INLINE static inline osal_task_handle_t osal_task_get_current_handle(void) { |
24 | 0 | return (osal_task_handle_t) 1; |
25 | 0 | } Unexecuted instantiation: tusb.c:osal_task_get_current_handle Unexecuted instantiation: tusb_fifo.c:osal_task_get_current_handle Unexecuted instantiation: usbd.c:osal_task_get_current_handle Unexecuted instantiation: dcd_fuzz.cc:osal_task_get_current_handle() Unexecuted instantiation: usbd_fuzz.cc:osal_task_get_current_handle() Unexecuted instantiation: fuzz.cc:osal_task_get_current_handle() Unexecuted instantiation: usb_descriptors.cc:osal_task_get_current_handle() Unexecuted instantiation: cdc_device.c:osal_task_get_current_handle Unexecuted instantiation: ecm_rndis_device.c:osal_task_get_current_handle Unexecuted instantiation: rndis_reports.c:osal_task_get_current_handle Unexecuted instantiation: msc_device.c:osal_task_get_current_handle Unexecuted instantiation: msc_fuzz.cc:osal_task_get_current_handle() Unexecuted instantiation: fuzz.c:osal_task_get_current_handle |
26 | | |
27 | | // Bare-metal has no scheduler to yield to; this is dead code in practice because |
28 | | // callers gate it on running outside the host task, which can't happen here. |
29 | 0 | TU_ATTR_ALWAYS_INLINE static inline void osal_task_delay(uint32_t msec) { |
30 | 0 | (void) msec; |
31 | 0 | } Unexecuted instantiation: tusb.c:osal_task_delay Unexecuted instantiation: tusb_fifo.c:osal_task_delay Unexecuted instantiation: usbd.c:osal_task_delay Unexecuted instantiation: dcd_fuzz.cc:osal_task_delay(unsigned int) Unexecuted instantiation: usbd_fuzz.cc:osal_task_delay(unsigned int) Unexecuted instantiation: fuzz.cc:osal_task_delay(unsigned int) Unexecuted instantiation: usb_descriptors.cc:osal_task_delay(unsigned int) Unexecuted instantiation: cdc_device.c:osal_task_delay Unexecuted instantiation: ecm_rndis_device.c:osal_task_delay Unexecuted instantiation: rndis_reports.c:osal_task_delay Unexecuted instantiation: msc_device.c:osal_task_delay Unexecuted instantiation: msc_fuzz.cc:osal_task_delay(unsigned int) Unexecuted instantiation: fuzz.c:osal_task_delay |
32 | | |
33 | | //--------------------------------------------------------------------+ |
34 | | // Spinlock API |
35 | | //--------------------------------------------------------------------+ |
36 | | // Note: This implementation is designed for bare-metal single-core systems without RTOS. |
37 | | // - Supports nested locking within the same execution context |
38 | | // - NOT suitable for true SMP (Symmetric Multi-Processing) systems |
39 | | // - NOT thread-safe for multi-threaded environments |
40 | | // - Primarily manages interrupt enable/disable state for critical sections |
41 | | typedef struct { |
42 | | void (* interrupt_set)(bool enabled); |
43 | | uint32_t nested_count; |
44 | | } osal_spinlock_t; |
45 | | |
46 | | // For SMP, spinlock must be locked by hardware, cannot just use interrupt |
47 | | #define OSAL_SPINLOCK_DEF(_name, _int_set) \ |
48 | | osal_spinlock_t _name = { .interrupt_set = _int_set, .nested_count = 0 } |
49 | | |
50 | 3 | TU_ATTR_ALWAYS_INLINE static inline void osal_spin_init(osal_spinlock_t *ctx) { |
51 | 3 | (void) ctx; |
52 | 3 | } Unexecuted instantiation: tusb.c:osal_spin_init Unexecuted instantiation: tusb_fifo.c:osal_spin_init Line | Count | Source | 50 | 3 | TU_ATTR_ALWAYS_INLINE static inline void osal_spin_init(osal_spinlock_t *ctx) { | 51 | 3 | (void) ctx; | 52 | 3 | } |
Unexecuted instantiation: dcd_fuzz.cc:osal_spin_init(osal_spinlock_t*) Unexecuted instantiation: usbd_fuzz.cc:osal_spin_init(osal_spinlock_t*) Unexecuted instantiation: fuzz.cc:osal_spin_init(osal_spinlock_t*) Unexecuted instantiation: usb_descriptors.cc:osal_spin_init(osal_spinlock_t*) Unexecuted instantiation: cdc_device.c:osal_spin_init Unexecuted instantiation: ecm_rndis_device.c:osal_spin_init Unexecuted instantiation: rndis_reports.c:osal_spin_init Unexecuted instantiation: msc_device.c:osal_spin_init Unexecuted instantiation: msc_fuzz.cc:osal_spin_init(osal_spinlock_t*) Unexecuted instantiation: fuzz.c:osal_spin_init |
53 | | |
54 | 0 | TU_ATTR_ALWAYS_INLINE static inline void osal_spin_deinit(osal_spinlock_t *ctx) { |
55 | 0 | (void) ctx; |
56 | 0 | } Unexecuted instantiation: tusb.c:osal_spin_deinit Unexecuted instantiation: tusb_fifo.c:osal_spin_deinit Unexecuted instantiation: usbd.c:osal_spin_deinit Unexecuted instantiation: dcd_fuzz.cc:osal_spin_deinit(osal_spinlock_t*) Unexecuted instantiation: usbd_fuzz.cc:osal_spin_deinit(osal_spinlock_t*) Unexecuted instantiation: fuzz.cc:osal_spin_deinit(osal_spinlock_t*) Unexecuted instantiation: usb_descriptors.cc:osal_spin_deinit(osal_spinlock_t*) Unexecuted instantiation: cdc_device.c:osal_spin_deinit Unexecuted instantiation: ecm_rndis_device.c:osal_spin_deinit Unexecuted instantiation: rndis_reports.c:osal_spin_deinit Unexecuted instantiation: msc_device.c:osal_spin_deinit Unexecuted instantiation: msc_fuzz.cc:osal_spin_deinit(osal_spinlock_t*) Unexecuted instantiation: fuzz.c:osal_spin_deinit |
57 | | |
58 | 0 | TU_ATTR_ALWAYS_INLINE static inline void osal_spin_lock(osal_spinlock_t *ctx, bool in_isr) { |
59 | | // Disable interrupts first to make nested_count increment atomic |
60 | 0 | if (!in_isr && ctx->nested_count == 0) { |
61 | 0 | ctx->interrupt_set(false); |
62 | 0 | } |
63 | 0 | ctx->nested_count++; |
64 | 0 | } Unexecuted instantiation: tusb.c:osal_spin_lock Unexecuted instantiation: tusb_fifo.c:osal_spin_lock Unexecuted instantiation: usbd.c:osal_spin_lock Unexecuted instantiation: dcd_fuzz.cc:osal_spin_lock(osal_spinlock_t*, bool) Unexecuted instantiation: usbd_fuzz.cc:osal_spin_lock(osal_spinlock_t*, bool) Unexecuted instantiation: fuzz.cc:osal_spin_lock(osal_spinlock_t*, bool) Unexecuted instantiation: usb_descriptors.cc:osal_spin_lock(osal_spinlock_t*, bool) Unexecuted instantiation: cdc_device.c:osal_spin_lock Unexecuted instantiation: ecm_rndis_device.c:osal_spin_lock Unexecuted instantiation: rndis_reports.c:osal_spin_lock Unexecuted instantiation: msc_device.c:osal_spin_lock Unexecuted instantiation: msc_fuzz.cc:osal_spin_lock(osal_spinlock_t*, bool) Unexecuted instantiation: fuzz.c:osal_spin_lock |
65 | | |
66 | 0 | TU_ATTR_ALWAYS_INLINE static inline void osal_spin_unlock(osal_spinlock_t *ctx, bool in_isr) { |
67 | 0 | if (ctx->nested_count == 0) { |
68 | 0 | return; // spin is not locked to begin with |
69 | 0 | } |
70 | | |
71 | 0 | ctx->nested_count--; |
72 | | |
73 | | // Only re-enable interrupts when fully unlocked |
74 | 0 | if (!in_isr && ctx->nested_count == 0) { |
75 | 0 | ctx->interrupt_set(true); |
76 | 0 | } |
77 | 0 | } Unexecuted instantiation: tusb.c:osal_spin_unlock Unexecuted instantiation: tusb_fifo.c:osal_spin_unlock Unexecuted instantiation: usbd.c:osal_spin_unlock Unexecuted instantiation: dcd_fuzz.cc:osal_spin_unlock(osal_spinlock_t*, bool) Unexecuted instantiation: usbd_fuzz.cc:osal_spin_unlock(osal_spinlock_t*, bool) Unexecuted instantiation: fuzz.cc:osal_spin_unlock(osal_spinlock_t*, bool) Unexecuted instantiation: usb_descriptors.cc:osal_spin_unlock(osal_spinlock_t*, bool) Unexecuted instantiation: cdc_device.c:osal_spin_unlock Unexecuted instantiation: ecm_rndis_device.c:osal_spin_unlock Unexecuted instantiation: rndis_reports.c:osal_spin_unlock Unexecuted instantiation: msc_device.c:osal_spin_unlock Unexecuted instantiation: msc_fuzz.cc:osal_spin_unlock(osal_spinlock_t*, bool) Unexecuted instantiation: fuzz.c:osal_spin_unlock |
78 | | |
79 | | //--------------------------------------------------------------------+ |
80 | | // Binary Semaphore API |
81 | | //--------------------------------------------------------------------+ |
82 | | typedef struct { |
83 | | volatile uint16_t count; |
84 | | } osal_semaphore_def_t; |
85 | | |
86 | | typedef osal_semaphore_def_t* osal_semaphore_t; |
87 | | |
88 | 0 | TU_ATTR_ALWAYS_INLINE static inline osal_semaphore_t osal_semaphore_create(osal_semaphore_def_t* semdef) { |
89 | 0 | semdef->count = 0; |
90 | 0 | return semdef; |
91 | 0 | } Unexecuted instantiation: tusb.c:osal_semaphore_create Unexecuted instantiation: tusb_fifo.c:osal_semaphore_create Unexecuted instantiation: usbd.c:osal_semaphore_create Unexecuted instantiation: dcd_fuzz.cc:osal_semaphore_create(osal_semaphore_def_t*) Unexecuted instantiation: usbd_fuzz.cc:osal_semaphore_create(osal_semaphore_def_t*) Unexecuted instantiation: fuzz.cc:osal_semaphore_create(osal_semaphore_def_t*) Unexecuted instantiation: usb_descriptors.cc:osal_semaphore_create(osal_semaphore_def_t*) Unexecuted instantiation: cdc_device.c:osal_semaphore_create Unexecuted instantiation: ecm_rndis_device.c:osal_semaphore_create Unexecuted instantiation: rndis_reports.c:osal_semaphore_create Unexecuted instantiation: msc_device.c:osal_semaphore_create Unexecuted instantiation: msc_fuzz.cc:osal_semaphore_create(osal_semaphore_def_t*) Unexecuted instantiation: fuzz.c:osal_semaphore_create |
92 | | |
93 | 0 | TU_ATTR_ALWAYS_INLINE static inline bool osal_semaphore_delete(osal_semaphore_t semd_hdl) { |
94 | 0 | (void) semd_hdl; |
95 | 0 | return true; // nothing to do |
96 | 0 | } Unexecuted instantiation: tusb.c:osal_semaphore_delete Unexecuted instantiation: tusb_fifo.c:osal_semaphore_delete Unexecuted instantiation: usbd.c:osal_semaphore_delete Unexecuted instantiation: dcd_fuzz.cc:osal_semaphore_delete(osal_semaphore_def_t*) Unexecuted instantiation: usbd_fuzz.cc:osal_semaphore_delete(osal_semaphore_def_t*) Unexecuted instantiation: fuzz.cc:osal_semaphore_delete(osal_semaphore_def_t*) Unexecuted instantiation: usb_descriptors.cc:osal_semaphore_delete(osal_semaphore_def_t*) Unexecuted instantiation: cdc_device.c:osal_semaphore_delete Unexecuted instantiation: ecm_rndis_device.c:osal_semaphore_delete Unexecuted instantiation: rndis_reports.c:osal_semaphore_delete Unexecuted instantiation: msc_device.c:osal_semaphore_delete Unexecuted instantiation: msc_fuzz.cc:osal_semaphore_delete(osal_semaphore_def_t*) Unexecuted instantiation: fuzz.c:osal_semaphore_delete |
97 | | |
98 | | |
99 | 0 | TU_ATTR_ALWAYS_INLINE static inline bool osal_semaphore_post(osal_semaphore_t sem_hdl, bool in_isr) { |
100 | 0 | (void) in_isr; |
101 | 0 | sem_hdl->count = (uint16_t) (sem_hdl->count + 1u); |
102 | 0 | return true; |
103 | 0 | } Unexecuted instantiation: tusb.c:osal_semaphore_post Unexecuted instantiation: tusb_fifo.c:osal_semaphore_post Unexecuted instantiation: usbd.c:osal_semaphore_post Unexecuted instantiation: dcd_fuzz.cc:osal_semaphore_post(osal_semaphore_def_t*, bool) Unexecuted instantiation: usbd_fuzz.cc:osal_semaphore_post(osal_semaphore_def_t*, bool) Unexecuted instantiation: fuzz.cc:osal_semaphore_post(osal_semaphore_def_t*, bool) Unexecuted instantiation: usb_descriptors.cc:osal_semaphore_post(osal_semaphore_def_t*, bool) Unexecuted instantiation: cdc_device.c:osal_semaphore_post Unexecuted instantiation: ecm_rndis_device.c:osal_semaphore_post Unexecuted instantiation: rndis_reports.c:osal_semaphore_post Unexecuted instantiation: msc_device.c:osal_semaphore_post Unexecuted instantiation: msc_fuzz.cc:osal_semaphore_post(osal_semaphore_def_t*, bool) Unexecuted instantiation: fuzz.c:osal_semaphore_post |
104 | | |
105 | | // TODO blocking for now |
106 | 0 | TU_ATTR_ALWAYS_INLINE static inline bool osal_semaphore_wait(osal_semaphore_t sem_hdl, uint32_t msec) { |
107 | 0 | (void) msec; |
108 | 0 |
|
109 | 0 | while (sem_hdl->count == 0) {} |
110 | 0 | sem_hdl->count = (uint16_t) (sem_hdl->count - 1u); |
111 | 0 |
|
112 | 0 | return true; |
113 | 0 | } Unexecuted instantiation: tusb.c:osal_semaphore_wait Unexecuted instantiation: tusb_fifo.c:osal_semaphore_wait Unexecuted instantiation: usbd.c:osal_semaphore_wait Unexecuted instantiation: dcd_fuzz.cc:osal_semaphore_wait(osal_semaphore_def_t*, unsigned int) Unexecuted instantiation: usbd_fuzz.cc:osal_semaphore_wait(osal_semaphore_def_t*, unsigned int) Unexecuted instantiation: fuzz.cc:osal_semaphore_wait(osal_semaphore_def_t*, unsigned int) Unexecuted instantiation: usb_descriptors.cc:osal_semaphore_wait(osal_semaphore_def_t*, unsigned int) Unexecuted instantiation: cdc_device.c:osal_semaphore_wait Unexecuted instantiation: ecm_rndis_device.c:osal_semaphore_wait Unexecuted instantiation: rndis_reports.c:osal_semaphore_wait Unexecuted instantiation: msc_device.c:osal_semaphore_wait Unexecuted instantiation: msc_fuzz.cc:osal_semaphore_wait(osal_semaphore_def_t*, unsigned int) Unexecuted instantiation: fuzz.c:osal_semaphore_wait |
114 | | |
115 | 0 | TU_ATTR_ALWAYS_INLINE static inline void osal_semaphore_reset(osal_semaphore_t sem_hdl) { |
116 | 0 | sem_hdl->count = 0; |
117 | 0 | } Unexecuted instantiation: tusb.c:osal_semaphore_reset Unexecuted instantiation: tusb_fifo.c:osal_semaphore_reset Unexecuted instantiation: usbd.c:osal_semaphore_reset Unexecuted instantiation: dcd_fuzz.cc:osal_semaphore_reset(osal_semaphore_def_t*) Unexecuted instantiation: usbd_fuzz.cc:osal_semaphore_reset(osal_semaphore_def_t*) Unexecuted instantiation: fuzz.cc:osal_semaphore_reset(osal_semaphore_def_t*) Unexecuted instantiation: usb_descriptors.cc:osal_semaphore_reset(osal_semaphore_def_t*) Unexecuted instantiation: cdc_device.c:osal_semaphore_reset Unexecuted instantiation: ecm_rndis_device.c:osal_semaphore_reset Unexecuted instantiation: rndis_reports.c:osal_semaphore_reset Unexecuted instantiation: msc_device.c:osal_semaphore_reset Unexecuted instantiation: msc_fuzz.cc:osal_semaphore_reset(osal_semaphore_def_t*) Unexecuted instantiation: fuzz.c:osal_semaphore_reset |
118 | | |
119 | | //--------------------------------------------------------------------+ |
120 | | // MUTEX API |
121 | | // Within tinyusb, mutex is never used in ISR context |
122 | | //--------------------------------------------------------------------+ |
123 | | typedef osal_semaphore_def_t osal_mutex_def_t; |
124 | | typedef osal_semaphore_t osal_mutex_t; |
125 | | |
126 | | #if OSAL_MUTEX_REQUIRED |
127 | | // Note: multiple cores MCUs usually do provide IPC API for mutex |
128 | | // or we can use std atomic function |
129 | | |
130 | | TU_ATTR_ALWAYS_INLINE static inline osal_mutex_t osal_mutex_create(osal_mutex_def_t* mdef) { |
131 | | mdef->count = 1; |
132 | | return mdef; |
133 | | } |
134 | | |
135 | | TU_ATTR_ALWAYS_INLINE static inline bool osal_mutex_delete(osal_mutex_t mutex_hdl) { |
136 | | (void) mutex_hdl; |
137 | | return true; // nothing to do |
138 | | } |
139 | | |
140 | | TU_ATTR_ALWAYS_INLINE static inline bool osal_mutex_lock (osal_mutex_t mutex_hdl, uint32_t msec) { |
141 | | return osal_semaphore_wait(mutex_hdl, msec); |
142 | | } |
143 | | |
144 | | TU_ATTR_ALWAYS_INLINE static inline bool osal_mutex_unlock(osal_mutex_t mutex_hdl) { |
145 | | return osal_semaphore_post(mutex_hdl, false); |
146 | | } |
147 | | |
148 | | #else |
149 | | |
150 | | #define osal_mutex_create(_mdef) (NULL) |
151 | 5.75k | #define osal_mutex_lock(_mutex_hdl, _ms) (true) |
152 | 5.75k | #define osal_mutex_unlock(_mutex_hdl) (true) |
153 | | |
154 | | #endif |
155 | | |
156 | | //--------------------------------------------------------------------+ |
157 | | // QUEUE API |
158 | | //--------------------------------------------------------------------+ |
159 | | #include "common/tusb_fifo.h" |
160 | | |
161 | | typedef struct { |
162 | | void (* interrupt_set)(bool enabled); |
163 | | uint16_t item_size; |
164 | | tu_fifo_t ff; |
165 | | } osal_queue_def_t; |
166 | | |
167 | | typedef osal_queue_def_t* osal_queue_t; |
168 | | |
169 | | // _int_set is used as mutex in OS NONE (disable/enable USB ISR) |
170 | | #define OSAL_QUEUE_DEF(_int_set, _name, _depth, _type) \ |
171 | | uint8_t _name##_buf[_depth * sizeof(_type)]; \ |
172 | | osal_queue_def_t _name = {.interrupt_set = _int_set, \ |
173 | | .item_size = sizeof(_type), \ |
174 | | .ff = TU_FIFO_INIT(_name##_buf, _depth * sizeof(_type), false)} |
175 | | |
176 | 3 | TU_ATTR_ALWAYS_INLINE static inline osal_queue_t osal_queue_create(osal_queue_def_t* qdef) { |
177 | 3 | tu_fifo_clear(&qdef->ff); |
178 | 3 | return (osal_queue_t) qdef; |
179 | 3 | } Unexecuted instantiation: tusb.c:osal_queue_create Unexecuted instantiation: tusb_fifo.c:osal_queue_create Line | Count | Source | 176 | 3 | TU_ATTR_ALWAYS_INLINE static inline osal_queue_t osal_queue_create(osal_queue_def_t* qdef) { | 177 | 3 | tu_fifo_clear(&qdef->ff); | 178 | 3 | return (osal_queue_t) qdef; | 179 | 3 | } |
Unexecuted instantiation: dcd_fuzz.cc:osal_queue_create(osal_queue_def_t*) Unexecuted instantiation: usbd_fuzz.cc:osal_queue_create(osal_queue_def_t*) Unexecuted instantiation: fuzz.cc:osal_queue_create(osal_queue_def_t*) Unexecuted instantiation: usb_descriptors.cc:osal_queue_create(osal_queue_def_t*) Unexecuted instantiation: cdc_device.c:osal_queue_create Unexecuted instantiation: ecm_rndis_device.c:osal_queue_create Unexecuted instantiation: rndis_reports.c:osal_queue_create Unexecuted instantiation: msc_device.c:osal_queue_create Unexecuted instantiation: msc_fuzz.cc:osal_queue_create(osal_queue_def_t*) Unexecuted instantiation: fuzz.c:osal_queue_create |
180 | | |
181 | 0 | TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_delete(osal_queue_t qhdl) { |
182 | 0 | (void) qhdl; |
183 | 0 | return true; // nothing to do |
184 | 0 | } Unexecuted instantiation: tusb.c:osal_queue_delete Unexecuted instantiation: tusb_fifo.c:osal_queue_delete Unexecuted instantiation: usbd.c:osal_queue_delete Unexecuted instantiation: dcd_fuzz.cc:osal_queue_delete(osal_queue_def_t*) Unexecuted instantiation: usbd_fuzz.cc:osal_queue_delete(osal_queue_def_t*) Unexecuted instantiation: fuzz.cc:osal_queue_delete(osal_queue_def_t*) Unexecuted instantiation: usb_descriptors.cc:osal_queue_delete(osal_queue_def_t*) Unexecuted instantiation: cdc_device.c:osal_queue_delete Unexecuted instantiation: ecm_rndis_device.c:osal_queue_delete Unexecuted instantiation: rndis_reports.c:osal_queue_delete Unexecuted instantiation: msc_device.c:osal_queue_delete Unexecuted instantiation: msc_fuzz.cc:osal_queue_delete(osal_queue_def_t*) Unexecuted instantiation: fuzz.c:osal_queue_delete |
185 | | |
186 | 327k | TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_receive(osal_queue_t qhdl, void* data, uint32_t msec) { |
187 | 327k | (void) msec; // not used, always behave as msec = 0 |
188 | | |
189 | 327k | qhdl->interrupt_set(false); |
190 | 327k | const bool success = (tu_fifo_read_n(&qhdl->ff, data, qhdl->item_size) > 0); |
191 | 327k | qhdl->interrupt_set(true); |
192 | | |
193 | 327k | return success; |
194 | 327k | } Unexecuted instantiation: tusb.c:osal_queue_receive Unexecuted instantiation: tusb_fifo.c:osal_queue_receive usbd.c:osal_queue_receive Line | Count | Source | 186 | 327k | TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_receive(osal_queue_t qhdl, void* data, uint32_t msec) { | 187 | 327k | (void) msec; // not used, always behave as msec = 0 | 188 | | | 189 | 327k | qhdl->interrupt_set(false); | 190 | 327k | const bool success = (tu_fifo_read_n(&qhdl->ff, data, qhdl->item_size) > 0); | 191 | 327k | qhdl->interrupt_set(true); | 192 | | | 193 | 327k | return success; | 194 | 327k | } |
Unexecuted instantiation: dcd_fuzz.cc:osal_queue_receive(osal_queue_def_t*, void*, unsigned int) Unexecuted instantiation: usbd_fuzz.cc:osal_queue_receive(osal_queue_def_t*, void*, unsigned int) Unexecuted instantiation: fuzz.cc:osal_queue_receive(osal_queue_def_t*, void*, unsigned int) Unexecuted instantiation: usb_descriptors.cc:osal_queue_receive(osal_queue_def_t*, void*, unsigned int) Unexecuted instantiation: cdc_device.c:osal_queue_receive Unexecuted instantiation: ecm_rndis_device.c:osal_queue_receive Unexecuted instantiation: rndis_reports.c:osal_queue_receive Unexecuted instantiation: msc_device.c:osal_queue_receive Unexecuted instantiation: msc_fuzz.cc:osal_queue_receive(osal_queue_def_t*, void*, unsigned int) Unexecuted instantiation: fuzz.c:osal_queue_receive |
195 | | |
196 | 121k | TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_send(osal_queue_t qhdl, void const* data, bool in_isr) { |
197 | 121k | if (!in_isr) { |
198 | 57.7k | qhdl->interrupt_set(false); |
199 | 57.7k | } |
200 | | |
201 | 121k | const bool success = (tu_fifo_write_n(&qhdl->ff, data, qhdl->item_size) > 0); |
202 | | |
203 | 121k | if (!in_isr) { |
204 | 57.7k | qhdl->interrupt_set(true); |
205 | 57.7k | } |
206 | | |
207 | 121k | return success; |
208 | 121k | } Unexecuted instantiation: tusb.c:osal_queue_send Unexecuted instantiation: tusb_fifo.c:osal_queue_send Line | Count | Source | 196 | 121k | TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_send(osal_queue_t qhdl, void const* data, bool in_isr) { | 197 | 121k | if (!in_isr) { | 198 | 57.7k | qhdl->interrupt_set(false); | 199 | 57.7k | } | 200 | | | 201 | 121k | const bool success = (tu_fifo_write_n(&qhdl->ff, data, qhdl->item_size) > 0); | 202 | | | 203 | 121k | if (!in_isr) { | 204 | 57.7k | qhdl->interrupt_set(true); | 205 | 57.7k | } | 206 | | | 207 | 121k | return success; | 208 | 121k | } |
Unexecuted instantiation: dcd_fuzz.cc:osal_queue_send(osal_queue_def_t*, void const*, bool) Unexecuted instantiation: usbd_fuzz.cc:osal_queue_send(osal_queue_def_t*, void const*, bool) Unexecuted instantiation: fuzz.cc:osal_queue_send(osal_queue_def_t*, void const*, bool) Unexecuted instantiation: usb_descriptors.cc:osal_queue_send(osal_queue_def_t*, void const*, bool) Unexecuted instantiation: cdc_device.c:osal_queue_send Unexecuted instantiation: ecm_rndis_device.c:osal_queue_send Unexecuted instantiation: rndis_reports.c:osal_queue_send Unexecuted instantiation: msc_device.c:osal_queue_send Unexecuted instantiation: msc_fuzz.cc:osal_queue_send(osal_queue_def_t*, void const*, bool) Unexecuted instantiation: fuzz.c:osal_queue_send |
209 | | |
210 | 0 | TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_empty(osal_queue_t qhdl) { |
211 | | // Skip queue lock/unlock since this function is primarily called |
212 | | // with interrupt disabled before going into low power mode |
213 | 0 | return tu_fifo_empty(&qhdl->ff); |
214 | 0 | } Unexecuted instantiation: tusb.c:osal_queue_empty Unexecuted instantiation: tusb_fifo.c:osal_queue_empty Unexecuted instantiation: usbd.c:osal_queue_empty Unexecuted instantiation: dcd_fuzz.cc:osal_queue_empty(osal_queue_def_t*) Unexecuted instantiation: usbd_fuzz.cc:osal_queue_empty(osal_queue_def_t*) Unexecuted instantiation: fuzz.cc:osal_queue_empty(osal_queue_def_t*) Unexecuted instantiation: usb_descriptors.cc:osal_queue_empty(osal_queue_def_t*) Unexecuted instantiation: cdc_device.c:osal_queue_empty Unexecuted instantiation: ecm_rndis_device.c:osal_queue_empty Unexecuted instantiation: rndis_reports.c:osal_queue_empty Unexecuted instantiation: msc_device.c:osal_queue_empty Unexecuted instantiation: msc_fuzz.cc:osal_queue_empty(osal_queue_def_t*) Unexecuted instantiation: fuzz.c:osal_queue_empty |
215 | | |
216 | | #ifdef __cplusplus |
217 | | } |
218 | | #endif |
219 | | |
220 | | #endif |