1 #ifndef MICROPY_INCLUDED_SAL_H 2 #define MICROPY_INCLUDED_SAL_H 3 4 #include <stdio.h> 5 #include "py/obj.h" 6 #include "ulog/ulog.h" 7 #include "aos/kernel.h" 8 9 #include "repl.h" 10 #include "amp_platform.h" 11 // #include "ql_rtos.h" 12 13 #define MP_SAL_THREAD_MIN_STACK_SIZE (1024 + 256) 14 #define MP_SAL_THREAD_DEFAULT_STACK_SIZE (MP_THREAD_MIN_STACK_SIZE + 1024) 15 #define MP_SAL_THREAD_PRIORITY (AOS_DEFAULT_APP_PRI) 16 17 #define mp_sal_taskhandler_obj_t ql_task_t 18 #define mp_sal_mutex_obj_t ql_mutex_t 19 20 uint32_t mp_sal_get_stack_size(); 21 void* mp_sal_get_stack_addr(); 22 mp_sal_taskhandler_obj_t mp_sal_get_taskhandler(); 23 // int32_t mp_sal_thread_set_state(void *state); 24 // int32_t mp_sal_thread_get_state(void **state); 25 int32_t mp_sal_task_create(mp_sal_taskhandler_obj_t id, 26 void (*entry)(void*), 27 void *arg, 28 void *stack_buf, 29 size_t *stack_size_byte, 30 int priority, 31 char *name); 32 void mp_sal_task_delete(mp_sal_taskhandler_obj_t id, int32_t *status); 33 int32_t mp_sal_mutex_create(mp_sal_mutex_obj_t *mutex); 34 int32_t mp_sal_mutex_lock(mp_sal_mutex_obj_t *mutex, uint32_t timeout); 35 int32_t mp_sal_mutex_unlock(mp_sal_mutex_obj_t *mutex); 36 void mp_sal_mutex_delete(mp_sal_mutex_obj_t *mutex); 37 38 #endif 39