11
11
12
12
#include "pico/cyw43_arch.h"
13
13
#include "pico/cyw43_driver.h"
14
- #include "pico/async_context_freertos.h"
15
14
16
15
#if CYW43_LWIP
17
16
#include "pico/lwip_freertos.h"
22
21
#include "pico/btstack_cyw43.h"
23
22
#endif
24
23
25
- //#if NO_SYS
26
- //#error example_cyw43_arch_freetos_sys requires NO_SYS=0
27
- //#endif
28
-
29
- static async_context_freertos_t cyw43_async_context_freertos ;
30
-
31
- #if configSUPPORT_STATIC_ALLOCATION && !CYW43_NO_DEFAULT_TASK_STACK
32
- static StackType_t cyw43_async_context_freertos_task_stack [CYW43_TASK_STACK_SIZE ];
33
- #endif
34
-
35
- async_context_t * cyw43_arch_init_default_async_context (void ) {
36
- async_context_freertos_config_t config = async_context_freertos_default_config ();
37
- #ifdef CYW43_TASK_PRIORITY
38
- config .task_priority = CYW43_TASK_PRIORITY ;
39
- #endif
40
- #ifdef CYW43_TASK_STACK_SIZE
41
- config .task_stack_size = CYW43_TASK_STACK_SIZE ;
42
- #endif
43
- #if configSUPPORT_STATIC_ALLOCATION && !CYW43_NO_DEFAULT_TASK_STACK
44
- config .task_stack = cyw43_async_context_freertos_task_stack ;
45
- #endif
46
- if (async_context_freertos_init (& cyw43_async_context_freertos , & config )) {
47
- return & cyw43_async_context_freertos .core ;
48
- }
49
- return NULL ;
50
- }
51
24
52
25
int cyw43_arch_init (void ) {
53
- // async_context_t *context = cyw43_arch_async_context();
54
- // if (!context) {
55
- // context = cyw43_arch_init_default_async_context();
56
- // if (!context) {
57
- // return PICO_ERROR_GENERIC;
58
- // }
59
- // cyw43_arch_set_async_context(context);
60
- // }
61
26
async_context_t * context = NULL ;
62
27
cyw43_arch_set_async_context (context );
63
28
@@ -77,24 +42,7 @@ int cyw43_arch_init(void) {
77
42
}
78
43
79
44
void cyw43_arch_deinit (void ) {
80
- async_context_t * context = cyw43_arch_async_context ();
81
- #if CYW43_ENABLE_BLUETOOTH
82
- btstack_cyw43_deinit (context );
83
- #endif
84
- // there is a bit of a circular dependency here between lwIP and cyw43_driver. We
85
- // shut down cyw43_driver first as it has IRQs calling back into lwIP. Also lwIP itself
86
- // does not actually get shut down.
87
- // todo add a "pause" method to async_context if we need to provide some atomicity (we
88
- // don't want to take the lock as these methods may invoke execute_sync()
89
- cyw43_driver_deinit (context );
90
- #if CYW43_LWIP
91
- lwip_freertos_deinit (context );
92
- #endif
93
- // if it is our context, then we de-init it.
94
- if (context == & cyw43_async_context_freertos .core ) {
95
- async_context_deinit (context );
96
- cyw43_arch_set_async_context (NULL );
97
- }
45
+ panic ("Unsupported" );
98
46
}
99
47
100
48
#endif
0 commit comments