|
3 | 3 | #include <stdio.h> |
4 | 4 | #include "espnet.h" |
5 | 5 |
|
| 6 | +// Stub functions, to know which functions need to be implemented for OS |
| 7 | +// functionality. |
| 8 | + |
| 9 | +static bool _env_is_chip(void) { |
| 10 | + printf("called: _env_is_chip\n"); |
| 11 | + return false; |
| 12 | +} |
| 13 | +static void _set_intr(int32_t cpu_no, uint32_t intr_source, uint32_t intr_num, int32_t intr_prio) { |
| 14 | + printf("called: _set_intr\n"); |
| 15 | +} |
| 16 | +static void _clear_intr(uint32_t intr_source, uint32_t intr_num) { |
| 17 | + printf("called: _clear_intr\n"); |
| 18 | +} |
| 19 | +static void _set_isr(int32_t n, void *f, void *arg) { |
| 20 | + printf("called: _set_isr\n"); |
| 21 | +} |
| 22 | +static void _ints_on(uint32_t mask) { |
| 23 | + printf("called: _ints_on\n"); |
| 24 | +} |
| 25 | +static void _ints_off(uint32_t mask) { |
| 26 | + printf("called: _ints_off\n"); |
| 27 | +} |
| 28 | +static bool _is_from_isr(void) { |
| 29 | + printf("called: _is_from_isr\n"); |
| 30 | + return false; |
| 31 | +} |
| 32 | +static void * _spin_lock_create(void) { |
| 33 | + printf("called: _spin_lock_create\n"); |
| 34 | + return NULL; |
| 35 | +} |
| 36 | +static void _spin_lock_delete(void *lock) { |
| 37 | + printf("called: _spin_lock_delete\n"); |
| 38 | +} |
| 39 | +static uint32_t _wifi_int_disable(void *wifi_int_mux) { |
| 40 | + printf("called: _wifi_int_disable\n"); |
| 41 | + return 0; |
| 42 | +} |
| 43 | +static void _wifi_int_restore(void *wifi_int_mux, uint32_t tmp) { |
| 44 | + printf("called: _wifi_int_restore\n"); |
| 45 | +} |
| 46 | +static void _task_yield_from_isr(void) { |
| 47 | + printf("called: _task_yield_from_isr\n"); |
| 48 | +} |
| 49 | +static void *_semphr_create(uint32_t max, uint32_t init) { |
| 50 | + printf("called: _semphr_create\n"); |
| 51 | + return NULL; |
| 52 | +} |
| 53 | +static void _semphr_delete(void *semphr) { |
| 54 | + printf("called: _semphr_delete\n"); |
| 55 | +} |
| 56 | +static int32_t _semphr_take(void *semphr, uint32_t block_time_tick) { |
| 57 | + printf("called: _semphr_take\n"); |
| 58 | + return 0; |
| 59 | +} |
| 60 | +static int32_t _semphr_give(void *semphr) { |
| 61 | + printf("called: _semphr_give\n"); |
| 62 | + return 0; |
| 63 | +} |
| 64 | +static void *_wifi_thread_semphr_get(void) { |
| 65 | + printf("called: _wifi_thread_semphr_get\n"); |
| 66 | + return NULL; |
| 67 | +} |
| 68 | +static void *_mutex_create(void) { |
| 69 | + printf("called: _mutex_create\n"); |
| 70 | + return NULL; |
| 71 | +} |
| 72 | +static void *_recursive_mutex_create(void) { |
| 73 | + printf("called: _recursive_mutex_create\n"); |
| 74 | + return NULL; |
| 75 | +} |
| 76 | +static void _mutex_delete(void *mutex) { |
| 77 | + printf("called: _mutex_delete\n"); |
| 78 | +} |
| 79 | +static int32_t _mutex_lock(void *mutex) { |
| 80 | + printf("called: _mutex_lock\n"); |
| 81 | + return 0; |
| 82 | +} |
| 83 | +static int32_t _mutex_unlock(void *mutex) { |
| 84 | + printf("called: _mutex_unlock\n"); |
| 85 | + return 0; |
| 86 | +} |
| 87 | +static void * _queue_create(uint32_t queue_len, uint32_t item_size) { |
| 88 | + printf("called: _queue_create\n"); |
| 89 | + return NULL; |
| 90 | +} |
| 91 | +static void _queue_delete(void *queue) { |
| 92 | + printf("called: _queue_delete\n"); |
| 93 | +} |
| 94 | +static int32_t _queue_send(void *queue, void *item, uint32_t block_time_tick) { |
| 95 | + printf("called: _queue_send\n"); |
| 96 | + return 0; |
| 97 | +} |
| 98 | +static int32_t _queue_send_from_isr(void *queue, void *item, void *hptw) { |
| 99 | + printf("called: _queue_send_from_isr\n"); |
| 100 | + return 0; |
| 101 | +} |
| 102 | +static int32_t _queue_send_to_back(void *queue, void *item, uint32_t block_time_tick) { |
| 103 | + printf("called: _queue_send_to_back\n"); |
| 104 | + return 0; |
| 105 | +} |
| 106 | +static int32_t _queue_send_to_front(void *queue, void *item, uint32_t block_time_tick) { |
| 107 | + printf("called: _queue_send_to_front\n"); |
| 108 | + return 0; |
| 109 | +} |
| 110 | +static int32_t _queue_recv(void *queue, void *item, uint32_t block_time_tick) { |
| 111 | + printf("called: _queue_recv\n"); |
| 112 | + return 0; |
| 113 | +} |
| 114 | +static uint32_t _queue_msg_waiting(void *queue) { |
| 115 | + printf("called: _queue_msg_waiting\n"); |
| 116 | + return 0; |
| 117 | +} |
| 118 | +static void * _event_group_create(void) { |
| 119 | + printf("called: _event_group_create\n"); |
| 120 | + return NULL; |
| 121 | +} |
| 122 | +static void _event_group_delete(void *event) { |
| 123 | + printf("called: _event_group_delete\n"); |
| 124 | +} |
| 125 | +static uint32_t _event_group_set_bits(void *event, uint32_t bits) { |
| 126 | + printf("called: _event_group_set_bits\n"); |
| 127 | + return 0; |
| 128 | +} |
| 129 | +static uint32_t _event_group_clear_bits(void *event, uint32_t bits) { |
| 130 | + printf("called: _event_group_clear_bits\n"); |
| 131 | + return 0; |
| 132 | +} |
| 133 | +static uint32_t _event_group_wait_bits(void *event, uint32_t bits_to_wait_for, int clear_on_exit, int wait_for_all_bits, uint32_t block_time_tick) { |
| 134 | + printf("called: _event_group_wait_bits\n"); |
| 135 | + return 0; |
| 136 | +} |
| 137 | + |
6 | 138 | // OS adapter functions. |
7 | 139 | // See: esp-idf/components/esp_wifi/include/esp_private/wifi_os_adapter.h |
8 | 140 | wifi_osi_funcs_t g_wifi_osi_funcs = { |
9 | 141 | ._version = ESP_WIFI_OS_ADAPTER_VERSION, |
10 | | - // TODO: define these functions. |
| 142 | + ._env_is_chip = _env_is_chip, |
| 143 | + ._set_intr = _set_intr, |
| 144 | + ._clear_intr = _clear_intr, |
| 145 | + ._set_isr = _set_isr, |
| 146 | + ._ints_on = _ints_on, |
| 147 | + ._ints_off = _ints_off, |
| 148 | + ._is_from_isr = _is_from_isr, |
| 149 | + ._spin_lock_create = _spin_lock_create, |
| 150 | + ._spin_lock_delete = _spin_lock_delete, |
| 151 | + ._wifi_int_disable = _wifi_int_disable, |
| 152 | + ._wifi_int_restore = _wifi_int_restore, |
| 153 | + ._task_yield_from_isr = _task_yield_from_isr, |
| 154 | + ._semphr_create = _semphr_create, |
| 155 | + ._semphr_delete = _semphr_delete, |
| 156 | + ._semphr_take = _semphr_take, |
| 157 | + ._semphr_give = _semphr_give, |
| 158 | + ._wifi_thread_semphr_get = _wifi_thread_semphr_get, |
| 159 | + ._mutex_create = _mutex_create, |
| 160 | + ._recursive_mutex_create = _recursive_mutex_create, |
| 161 | + ._mutex_delete = _mutex_delete, |
| 162 | + ._mutex_lock = _mutex_lock, |
| 163 | + ._mutex_unlock = _mutex_unlock, |
| 164 | + ._queue_create = _queue_create, |
| 165 | + ._queue_delete = _queue_delete, |
| 166 | + ._queue_send = _queue_send, |
| 167 | + ._queue_send_from_isr = _queue_send_from_isr, |
| 168 | + ._queue_send_to_back = _queue_send_to_back, |
| 169 | + ._queue_send_to_front = _queue_send_to_front, |
| 170 | + ._queue_recv = _queue_recv, |
| 171 | + ._queue_msg_waiting = _queue_msg_waiting, |
| 172 | + ._event_group_create = _event_group_create, |
| 173 | + ._event_group_delete = _event_group_delete, |
| 174 | + ._event_group_set_bits = _event_group_set_bits, |
| 175 | + ._event_group_clear_bits = _event_group_clear_bits, |
| 176 | + ._event_group_wait_bits = _event_group_wait_bits, |
| 177 | + // TODO: define more of these functions |
11 | 178 | ._magic = ESP_WIFI_OS_ADAPTER_MAGIC, |
12 | 179 | }; |
13 | 180 |
|
|
0 commit comments