add ring queue/message queue/mail queue, binary heap/priority queue/priority message queue/priority mail queue
1. remove the old msg queue and queue: i. msg queue is not a common and reusable/flexible component(need user to config the msg pool size and this componet can only be used by tos_queue) ii. tos_queue can only deliver the pointer message(cannot do a memory buffer deliver) 2. add ring queue(tos_ring_q) componet rinq queue can be reused by tos_chr_fifi/tos_msg_q/tos_mail_q as the foundational data container 3. add message queue(tos_msg_q) a little like the old queue mechanism, supply the capability to deliver a pointer message 4. add mail queue(tos_mail_q) supply the capability to deliver a memory buffer 5. add binary heap(tos_bin_heap) the basement componet to implement priority queue 6. add priority queue(tos_prio_q) can be reused by the priority message/mail queue as the foundational data container. 7. add priority message queue(tos_prio_msg_q) a message(pointer) deliver mechanism, supply the capability of delivering the message with priority(message with higher priority comes faster to the pender than with lower) 8. add priority mail queue(tos_prio_mail_q) a mail(memory buffer) deliver mechanism, supply the capability of delivering the mail with priority(mail with higher priority comes faster to the pender than with lower)
This commit is contained in:
@@ -23,20 +23,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
@@ -31,15 +29,7 @@
|
||||
|
||||
#define TOS_CFG_TICKLESS_EN 0u
|
||||
|
||||
#define TOS_CFG_VFS_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
#define TOS_CFG_VFS_EN 1u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_PWR_MGR_EN 0u
|
||||
@@ -33,14 +31,6 @@
|
||||
|
||||
#define TOS_CFG_FAULT_BACKTRACE_EN 0u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 3u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 512u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -23,20 +23,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_PWR_MGR_EN 0u
|
||||
@@ -31,14 +29,6 @@
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 3u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -23,8 +23,6 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
@@ -33,16 +31,8 @@
|
||||
|
||||
#define TOS_CFG_TICKLESS_EN 0u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_VFS_EN 1u
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -23,20 +23,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -23,20 +23,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_PWR_MGR_EN 1u
|
||||
@@ -31,14 +29,6 @@
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 3u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 512u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_PWR_MGR_EN 0u
|
||||
@@ -35,14 +33,6 @@
|
||||
|
||||
#define TOS_CFG_FAULT_BACKTRACE_EN 0u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 3u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 512u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -23,20 +23,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,20 +21,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -27,9 +27,6 @@
|
||||
// 配置TencentOS tiny是否开启互斥锁模块
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
// 配置TencentOS tiny是否开启队列模块
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
// 配置TencentOS tiny是否开启软件定时器模块
|
||||
#define TOS_CFG_TIMER_EN 0u
|
||||
|
||||
@@ -38,15 +35,6 @@
|
||||
|
||||
#define TOS_CFG_CPU_SYSTICK_PRIO 0xF
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
// 配置TencentOS tiny消息队列大小
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
// 配置TencentOS tiny空闲任务栈大小
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 512u
|
||||
|
||||
|
@@ -21,20 +21,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -23,8 +23,6 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_PWR_MGR_EN 0u
|
||||
@@ -33,14 +31,6 @@
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,20 +21,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 128u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,20 +21,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 128u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,22 +21,12 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#define TOS_CFG_TICKLESS_EN 0u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 128u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
@@ -33,14 +31,6 @@
|
||||
|
||||
#define TOS_CFG_VFS_EN 0u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 128u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,20 +21,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 128u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,20 +21,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 128u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,20 +21,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,20 +21,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_PWR_MGR_EN 0u
|
||||
@@ -33,14 +31,6 @@
|
||||
|
||||
#define TOS_CFG_FAULT_BACKTRACE_EN 0u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 3u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 512u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_PWR_MGR_EN 0u
|
||||
@@ -33,14 +31,6 @@
|
||||
|
||||
#define TOS_CFG_FAULT_BACKTRACE_EN 0u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 3u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 512u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,20 +21,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,20 +21,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,20 +21,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_PWR_MGR_EN 0u
|
||||
@@ -33,14 +31,6 @@
|
||||
|
||||
#define TOS_CFG_FAULT_BACKTRACE_EN 0u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 3u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 512u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,20 +21,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,20 +21,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 20u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -22,242 +22,12 @@ Dialog DLL: TCM.DLL V1.36.1.0
|
||||
|
||||
<h2>Project:</h2>
|
||||
D:\github\TencentOS-tiny\board\Nordic_NRF52832\KEIL\blehr\TencentOS_tiny.uvprojx
|
||||
Project File Date: 10/10/2019
|
||||
Project File Date: 10/28/2019
|
||||
|
||||
<h2>Output:</h2>
|
||||
*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
|
||||
Rebuild target 'TencentOS_tiny'
|
||||
assembling arm_startup_nrf52.s...
|
||||
compiling mcu_init.c...
|
||||
compiling nrfx_uart.c...
|
||||
compiling nrfx_glue.c...
|
||||
compiling system_nrf52.c...
|
||||
compiling simple_uart.c...
|
||||
compiling nrfx_rtc.c...
|
||||
compiling nrfx_prs.c...
|
||||
assembling port_s.S...
|
||||
compiling rtc.c...
|
||||
..\..\BSP\Src\rtc.c(57): warning: #177-D: function "rtc_config" was declared but never referenced
|
||||
static void rtc_config(void)
|
||||
..\..\BSP\Src\rtc.c: 1 warning, 0 errors
|
||||
compiling tos_cpu.c...
|
||||
compiling port_c.c...
|
||||
compiling tos_event.c...
|
||||
compiling tos_fifo.c...
|
||||
compiling tos_global.c...
|
||||
compiling tos_mmblk.c...
|
||||
compiling tos_msg.c...
|
||||
compiling tos_pend.c...
|
||||
compiling tos_mmheap.c...
|
||||
compiling tos_mutex.c...
|
||||
compiling tos_queue.c...
|
||||
compiling tos_robin.c...
|
||||
compiling tos_sched.c...
|
||||
compiling tos_sem.c...
|
||||
compiling tos_sys.c...
|
||||
compiling tos_task.c...
|
||||
compiling tos_tick.c...
|
||||
compiling tos_time.c...
|
||||
compiling cmsis_os.c...
|
||||
compiling tos_timer.c...
|
||||
compiling main.c...
|
||||
..\..\..\..\examples\blehr\main.c(135): warning: #231-D: declaration is not visible outside of function
|
||||
blehr_tx_hrate(struct os_event *ev)
|
||||
..\..\..\..\examples\blehr\main.c(308): warning: #223-D: function "nimble_port_get_dflt_eventq" declared implicitly
|
||||
ble_npl_callout_init(&blehr_tx_timer, nimble_port_get_dflt_eventq(),
|
||||
..\..\..\..\examples\blehr\main.c(308): warning: #167-D: argument of type "int" is incompatible with parameter of type "struct ble_npl_eventq *"
|
||||
ble_npl_callout_init(&blehr_tx_timer, nimble_port_get_dflt_eventq(),
|
||||
..\..\..\..\examples\blehr\main.c(309): warning: #167-D: argument of type "void (*)(struct os_event *)" is incompatible with parameter of type "ble_npl_event_fn *"
|
||||
blehr_tx_hrate, NULL);
|
||||
..\..\..\..\examples\blehr\main.c(326): warning: #167-D: argument of type "void (*)(void)" is incompatible with parameter of type "k_task_entry_t"
|
||||
nimble_port_tencentos_tiny_init(nimble_port_run);
|
||||
..\..\..\..\examples\blehr\main.c(338): warning: #223-D: function "board_init" declared implicitly
|
||||
board_init();
|
||||
..\..\..\..\examples\blehr\main.c(343): warning: #223-D: function "nimble_port_init" declared implicitly
|
||||
nimble_port_init();
|
||||
..\..\..\..\examples\blehr\main.c(345): warning: #167-D: argument of type "int (*)(void)" is incompatible with parameter of type "k_task_entry_t"
|
||||
tos_task_create(&blehr_task, "blehr_boot", blehr_boot, NULL,
|
||||
..\..\..\..\examples\blehr\main.c: 8 warnings, 0 errors
|
||||
compiling gatt_svr.c...
|
||||
compiling nimble_port_tencentos_tiny.c...
|
||||
compiling npl_os_tencenos_tiny.c...
|
||||
compiling nrf5x_isr.c...
|
||||
compiling tencent_os_tiny_libc.c...
|
||||
compiling ble_att_clt.c...
|
||||
compiling ble_att_cmd.c...
|
||||
compiling ble_att.c...
|
||||
compiling ble_eddystone.c...
|
||||
compiling ble_att_svr.c...
|
||||
compiling ble_gatts_lcl.c...
|
||||
compiling ble_gap.c...
|
||||
compiling ble_gatts.c...
|
||||
compiling ble_gattc.c...
|
||||
compiling ble_hs_adv.c...
|
||||
compiling ble_hs.c...
|
||||
compiling ble_hs_atomic.c...
|
||||
compiling ble_hs_cfg.c...
|
||||
compiling ble_hs_conn.c...
|
||||
compiling ble_hs_dbg.c...
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\src\ble_hs_dbg.c(653): warning: #111-D: statement is unreachable
|
||||
evcode = evbuf[0];
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\src\ble_hs_dbg.c: 1 warning, 0 errors
|
||||
compiling ble_hs_flow.c...
|
||||
compiling ble_hs_hci.c...
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\src\ble_hs_hci.c(88): warning: #69-D: integer conversion resulted in truncation
|
||||
rc = ble_npl_mutex_pend(&ble_hs_hci_mutex, BLE_NPL_TIME_FOREVER);
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\src\ble_hs_hci.c(38): warning: #550-D: variable "ble_hs_hci_max_pkts" was set but never used
|
||||
static uint8_t ble_hs_hci_max_pkts;
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\src\ble_hs_hci.c: 2 warnings, 0 errors
|
||||
compiling ble_hs_hci_evt.c...
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\src\ble_hs_hci_evt.c(750): warning: #186-D: pointless comparison of unsigned integer with zero
|
||||
if (evt.conn_latency < BLE_HCI_CONN_LATENCY_MIN ||
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\src\ble_hs_hci_evt.c(808): warning: #186-D: pointless comparison of unsigned integer with zero
|
||||
if (evt.latency < BLE_HCI_CONN_LATENCY_MIN ||
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\src\ble_hs_hci_evt.c: 2 warnings, 0 errors
|
||||
compiling ble_hs_hci_cmd.c...
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\src\ble_hs_hci_cmd.c(478): warning: #186-D: pointless comparison of unsigned integer with zero
|
||||
if ((hcc->conn_latency < BLE_HCI_CONN_LATENCY_MIN) ||
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\src\ble_hs_hci_cmd.c: 1 warning, 0 errors
|
||||
compiling ble_hs_hci_util.c...
|
||||
compiling ble_hs_id.c...
|
||||
compiling ble_hs_log.c...
|
||||
compiling ble_hs_mbuf.c...
|
||||
compiling ble_hs_misc.c...
|
||||
compiling ble_hs_periodic_sync.c...
|
||||
compiling ble_hs_shutdown.c...
|
||||
compiling ble_hs_mqueue.c...
|
||||
compiling ble_hs_pvcy.c...
|
||||
compiling ble_hs_startup.c...
|
||||
compiling ble_hs_stop.c...
|
||||
compiling ble_ibeacon.c...
|
||||
compiling ble_l2cap.c...
|
||||
compiling ble_l2cap_coc.c...
|
||||
compiling ble_l2cap_sig.c...
|
||||
compiling ble_l2cap_sig_cmd.c...
|
||||
compiling ble_monitor.c...
|
||||
compiling ble_store_util.c...
|
||||
compiling ble_sm_sc.c...
|
||||
compiling ble_sm_alg.c...
|
||||
compiling ble_sm.c...
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\src\ble_sm.c(984): warning: #111-D: statement is unreachable
|
||||
rc = ble_store_util_count(obj_type, &count);
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\src\ble_sm.c: 1 warning, 0 errors
|
||||
compiling ble_sm_lgcy.c...
|
||||
compiling ble_sm_cmd.c...
|
||||
compiling ble_store.c...
|
||||
compiling ble_uuid.c...
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\src\ble_uuid.c(242): warning: #1254-D: arithmetic on pointer to void or function type
|
||||
put_le32(dst + 12, BLE_UUID32(uuid)->value);
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\src\ble_uuid.c: 1 warning, 0 errors
|
||||
compiling ble_ll.c...
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\controller\src\ble_ll.c(1164): warning: #69-D: integer conversion resulted in truncation
|
||||
ev = ble_npl_eventq_get(&g_ble_ll_data.ll_evq, BLE_NPL_TIME_FOREVER);
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\controller\src\ble_ll.c: 1 warning, 0 errors
|
||||
compiling ble_ll_adv.c...
|
||||
compiling ble_ll_dtm.c...
|
||||
compiling ble_ll_ctrl.c...
|
||||
compiling ble_ll_conn_hci.c...
|
||||
compiling ble_ll_conn.c...
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\controller\src\ble_ll_conn.c(516): warning: #111-D: statement is unreachable
|
||||
connsm = g_ble_ll_conn_create_sm;
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\controller\src\ble_ll_conn.c(540): warning: #111-D: statement is unreachable
|
||||
connsm = g_ble_ll_conn_create_sm;
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\controller\src\ble_ll_conn.c: 2 warnings, 0 errors
|
||||
compiling ble_ll_hci.c...
|
||||
compiling ble_ll_resolv.c...
|
||||
compiling ble_ll_hci_ev.c...
|
||||
compiling ble_ll_rand.c...
|
||||
compiling ble_ll_sched.c...
|
||||
compiling ble_ll_supp_cmd.c...
|
||||
compiling ble_ll_scan.c...
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\controller\src\ble_ll_scan.c(2155): warning: #111-D: statement is unreachable
|
||||
return 0;
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\controller\src\ble_ll_scan.c: 1 warning, 0 errors
|
||||
compiling ble_ll_sync.c...
|
||||
compiling endian.c...
|
||||
compiling ble_ll_trace.c...
|
||||
compiling ble_ll_utils.c...
|
||||
compiling ble_ll_whitelist.c...
|
||||
compiling ble_ll_xcvr.c...
|
||||
compiling hal_timer.c...
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\porting\nimble\src\hal_timer.c(172): warning: #188-D: enumerated type mixed with another type
|
||||
NVIC_SetPendingIRQ(bsptimer->tmr_irq_num);
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\porting\nimble\src\hal_timer.c(199): warning: #188-D: enumerated type mixed with another type
|
||||
NVIC_SetPendingIRQ(bsptimer->tmr_irq_num);
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\porting\nimble\src\hal_timer.c(234): warning: #188-D: enumerated type mixed with another type
|
||||
NVIC_SetPendingIRQ(bsptimer->tmr_irq_num);
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\porting\nimble\src\hal_timer.c(488): warning: #188-D: enumerated type mixed with another type
|
||||
NVIC_DisableIRQ(irq_num);
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\porting\nimble\src\hal_timer.c(490): warning: #188-D: enumerated type mixed with another type
|
||||
NVIC_SetPriority(irq_num, (1 << __NVIC_PRIO_BITS) - 1);
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\porting\nimble\src\hal_timer.c(556): warning: #188-D: enumerated type mixed with another type
|
||||
NVIC_EnableIRQ(bsptimer->tmr_irq_num);
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\porting\nimble\src\hal_timer.c: 6 warnings, 0 errors
|
||||
compiling mem.c...
|
||||
compiling nimble_port.c...
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\porting\nimble\src\nimble_port.c(64): warning: #69-D: integer conversion resulted in truncation
|
||||
ev = ble_npl_eventq_get(&g_eventq_dflt, BLE_NPL_TIME_FOREVER);
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\porting\nimble\src\nimble_port.c: 1 warning, 0 errors
|
||||
compiling os_cputime.c...
|
||||
compiling os_cputime_pwr2.c...
|
||||
compiling os_mempool.c...
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\porting\nimble\src\os_mempool.c(129): warning: #188-D: enumerated type mixed with another type
|
||||
return rc;
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\porting\nimble\src\os_mempool.c(136): warning: #188-D: enumerated type mixed with another type
|
||||
return 0;
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\porting\nimble\src\os_mempool.c(312): warning: #188-D: enumerated type mixed with another type
|
||||
return rc;
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\porting\nimble\src\os_mempool.c: 3 warnings, 0 errors
|
||||
compiling os_mbuf.c...
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\porting\nimble\src\os_mbuf.c(388): warning: #1254-D: arithmetic on pointer to void or function type
|
||||
data += space;
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\porting\nimble\src\os_mbuf.c(403): warning: #1254-D: arithmetic on pointer to void or function type
|
||||
data += new->om_len;
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\porting\nimble\src\os_mbuf.c(654): warning: #1254-D: arithmetic on pointer to void or function type
|
||||
rc = memcmp(om->om_data + om_off, data + data_off, chunk_sz);
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\porting\nimble\src\os_mbuf.c: 3 warnings, 0 errors
|
||||
compiling os_msys_init.c...
|
||||
compiling aes_encrypt.c...
|
||||
compiling aes_decrypt.c...
|
||||
compiling cmac_mode.c...
|
||||
compiling ecc.c...
|
||||
compiling ecc_dh.c...
|
||||
compiling utils.c...
|
||||
compiling ble_hw.c...
|
||||
compiling ble_hci_ram.c...
|
||||
compiling ble_util.c...
|
||||
compiling ble_svc_ans.c...
|
||||
compiling ble_phy.c...
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\drivers\nrf52\src\ble_phy.c(1042): warning: #68-D: integer conversion resulted in a change of sign
|
||||
ble_hdr->rxinfo.rssi = (-1 * NRF_RADIO->RSSISAMPLE) +
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\drivers\nrf52\src\ble_phy.c: 1 warning, 0 errors
|
||||
compiling ble_svc_bas.c...
|
||||
compiling bleuart.c...
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\services\bleuart\src\bleuart.c(145): warning: #177-D: function "bleuart_uart_read" was declared but never referenced
|
||||
bleuart_uart_read(void)
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\services\bleuart\src\bleuart.c: 1 warning, 0 errors
|
||||
compiling ble_svc_gatt.c...
|
||||
compiling ble_store_ram.c...
|
||||
compiling ble_svc_tps.c...
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\services\tps\src\ble_svc_tps.c(88): warning: #111-D: statement is unreachable
|
||||
return 0;
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\services\tps\src\ble_svc_tps.c: 1 warning, 0 errors
|
||||
compiling ble_svc_ias.c...
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\services\ias\src\ble_svc_ias.c(117): warning: #111-D: statement is unreachable
|
||||
return 0;
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\services\ias\src\ble_svc_ias.c: 1 warning, 0 errors
|
||||
compiling ble_svc_gap.c...
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\services\gap\src\ble_svc_gap.c(38): warning: #550-D: variable "ble_svc_gap_chr_changed_cb_fn" was set but never used
|
||||
static ble_svc_gap_chr_changed_fn *ble_svc_gap_chr_changed_cb_fn;
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\services\gap\src\ble_svc_gap.c: 1 warning, 0 errors
|
||||
compiling addr.c...
|
||||
compiling ble_svc_lls.c...
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\services\lls\src\ble_svc_lls.c(116): warning: #111-D: statement is unreachable
|
||||
return 0;
|
||||
..\..\..\..\components\connectivity\Bluetooth_5.0\3rdparty\NimBLE_1_2_0\nimble\host\services\lls\src\ble_svc_lls.c: 1 warning, 0 errors
|
||||
linking...
|
||||
Program Size: Code=142684 RO-data=6136 RW-data=912 ZI-data=44424
|
||||
".\Objects\TencentOS_tiny.axf" - 0 Error(s), 40 Warning(s).
|
||||
Build target 'TencentOS_tiny'
|
||||
".\Objects\TencentOS_tiny.axf" - 0 Error(s), 0 Warning(s).
|
||||
|
||||
<h2>Software Packages used:</h2>
|
||||
|
||||
@@ -280,7 +50,7 @@ Package Vendor: NordicSemiconductor
|
||||
<h2>Collection of Component Files used:</h2>
|
||||
|
||||
* Component: ARM::CMSIS:CORE:5.3.0
|
||||
Build Time Elapsed: 00:00:22
|
||||
Build Time Elapsed: 00:00:02
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -462,11 +462,6 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_event.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_fifo.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_fifo.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_global.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -482,11 +477,6 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_mmheap.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_msg.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_msg.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_mutex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -497,11 +487,6 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_pend.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_robin.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -542,6 +527,56 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_timer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_binary_heap.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_binary_heap.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_char_fifo.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_char_fifo.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_completion.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_completion.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_countdownlatch.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_countdownlatch.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_mail_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_mail_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_message_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_message_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_priority_mail_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_priority_mail_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_priority_message_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_priority_message_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_priority_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_priority_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_ring_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_ring_queue.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
@@ -21,20 +21,18 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
#define TOS_CFG_MESSAGE_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_MAIL_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_PRIORITY_MESSAGE_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_PRIORITY_MAIL_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 20u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,20 +21,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 20u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -19,20 +19,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u // 配置TencentOS tiny是否开启互斥锁模块
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u // 配置TencentOS tiny是否开启队列模块
|
||||
|
||||
#define TOS_CFG_TIMER_EN 0u // 配置TencentOS tiny是否开启软件定时器模块
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u // 配置TencentOS tiny是否开启信号量模块
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u // 配置TencentOS tiny消息队列大小
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 512u // 配置TencentOS tiny空闲任务栈大小
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u // 配置TencentOS tiny的tick频率
|
||||
|
@@ -21,20 +21,10 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,22 +21,12 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_VFS_EN 1u
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_PWR_MGR_EN 0u
|
||||
@@ -33,14 +31,6 @@
|
||||
|
||||
#define TOS_CFG_FAULT_BACKTRACE_EN 0u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 3u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 512u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
@@ -31,15 +29,7 @@
|
||||
|
||||
#define TOS_CFG_TICKLESS_EN 0u
|
||||
|
||||
#define TOS_CFG_VFS_EN 0u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
#define TOS_CFG_VFS_EN 0u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 128u
|
||||
|
||||
|
@@ -27,9 +27,6 @@
|
||||
// 配置TencentOS tiny是否开启互斥锁模块
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
// 配置TencentOS tiny是否开启队列模块
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
// 配置TencentOS tiny是否开启软件定时器模块
|
||||
#define TOS_CFG_TIMER_EN 0u
|
||||
|
||||
@@ -38,15 +35,6 @@
|
||||
|
||||
#define TOS_CFG_CPU_SYSTICK_PRIO 0xF
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
// 配置TencentOS tiny消息队列大小
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
// 配置TencentOS tiny空闲任务栈大小
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 512u
|
||||
|
||||
|
@@ -22,8 +22,6 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_PWR_MGR_EN 0u
|
||||
@@ -34,14 +32,6 @@
|
||||
|
||||
#define TOS_CFG_FAULT_BACKTRACE_EN 0u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 3u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 512u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_PWR_MGR_EN 0u
|
||||
@@ -31,14 +29,6 @@
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 3u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 80u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_PWR_MGR_EN 1u
|
||||
@@ -31,14 +29,6 @@
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 3u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 512u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -23,8 +23,6 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_PWR_MGR_EN 0u
|
||||
@@ -37,14 +35,6 @@
|
||||
|
||||
#define TOS_CFG_FAULT_BACKTRACE_EN 0u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 3u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 512u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -0,0 +1,97 @@
|
||||
// File: STM32L43x_44x_45x_46x.dbgconf
|
||||
// Version: 1.0.0
|
||||
// Note: refer to STM32L43xxx STM32L44xxx STM32L45xxx STM32L46xxx Reference manual (RM0394)
|
||||
// refer to STM32L431xx, STM32L432xx, STM32L433xx, STM32L442xx, STM32L443xx, STM32L451xx, STM32L452xx, STM32L462xx datasheets
|
||||
|
||||
// <<< Use Configuration Wizard in Context Menu >>>
|
||||
|
||||
// <h> Debug MCU configuration register (DBGMCU_CR)
|
||||
// <o0.2> DBG_STANDBY
|
||||
// <i> Debug Standby mode
|
||||
// <i> 0: (FCLK=Off, HCLK=Off) The whole digital part is unpowered.
|
||||
// <i> 1: (FCLK=On, HCLK=On) The digital part is not unpowered and FCLK and HCLK are provided by the internal RC oscillator which remains active
|
||||
// <o0.1> DBG_STOP
|
||||
// <i> Debug Stop mode
|
||||
// <i> 0: (FCLK=Off, HCLK=Off) In STOP mode, the clock controller disables all clocks (including HCLK and FCLK).
|
||||
// <i> 1: (FCLK=On, HCLK=On) When entering STOP mode, FCLK and HCLK are provided by the internal RC oscillator which remains active in STOP mode.
|
||||
// <o0.0> DBG_SLEEP
|
||||
// <i> Debug Sleep mode
|
||||
// <i> 0: (FCLK=On, HCLK=Off) In Sleep mode, FCLK is clocked by the system clock as previously configured by the software while HCLK is disabled.
|
||||
// <i> 1: (FCLK=On, HCLK=On) When entering Sleep mode, HCLK is fed by the same clock that is provided to FCLK (system clock as previously configured by the software).
|
||||
// </h>
|
||||
DbgMCU_CR = 0x00000007;
|
||||
|
||||
// <h> Debug MCU APB1 freeze register1 (DBGMCU_APB1FZR1)
|
||||
// <o0.31> DBG_LPTIM1_STOP
|
||||
// <i> LPTIM1 counter stopped when core is halted
|
||||
// <i> 0: The counter clock of LPTIM1 is fed even if the core is halted
|
||||
// <i> 1: The counter clock of LPTIM1 is stopped when the core is halted
|
||||
// <o0.25> DBG_CAN_STOP
|
||||
// <i> bxCAN1 stopped when core is halted
|
||||
// <i> 0: Same behavior as in normal mode
|
||||
// <i> 1: The bxCAN1 receive registers are frozen
|
||||
// <o0.23> DBG_I2C3_STOP
|
||||
// <i> I2C3 SMBUS timeout counter stopped when core is halted
|
||||
// <i> 0: Same behavior as in normal mode
|
||||
// <i> 1: The I2C3 SMBus timeout is frozen
|
||||
// <o0.22> DBG_I2C2_STOP
|
||||
// <i> I2C2 SMBUS timeout counter stopped when core is halted
|
||||
// <i> 0: Same behavior as in normal mode
|
||||
// <i> 1: The I2C2 SMBus timeout is frozen
|
||||
// <o0.21> DBG_I2C1_STOP
|
||||
// <i> I2C1 SMBUS timeout counter stopped when core is halted
|
||||
// <i> 0: Same behavior as in normal mode
|
||||
// <i> 1: The I2C1 SMBus timeout is frozen
|
||||
// <o0.12> DBG_IWDG_STOP
|
||||
// <i> Independent watchdog counter stopped when core is halted
|
||||
// <i> 0: The independent watchdog counter clock continues even if the core is halted
|
||||
// <i> 1: The independent watchdog counter clock is stopped when the core is halted
|
||||
// <o0.11> DBG_WWDG_STOP
|
||||
// <i> Window watchdog counter stopped when core is halted
|
||||
// <i> 0: The window watchdog counter clock continues even if the core is halted
|
||||
// <i> 1: The window watchdog counter clock is stopped when the core is halted
|
||||
// <o0.10> DBG_RTC_STOP
|
||||
// <i> RTC counter stopped when core is halted
|
||||
// <i> 0: The clock of the RTC counter is fed even if the core is halted
|
||||
// <i> 1: The clock of the RTC counter is stopped when the core is halted
|
||||
// <o0.5> DBG_TIM7_STOP
|
||||
// <i> TIM7 counter stopped when core is halted
|
||||
// <i> 0: The counter clock of TIM7 is fed even if the core is halted
|
||||
// <i> 1: The counter clock of TIM7 is stopped when the core is halted
|
||||
// <o0.4> DBG_TIM6_STOP
|
||||
// <i> TIM6 counter stopped when core is halted
|
||||
// <i> 0: The counter clock of TIM6 is fed even if the core is halted
|
||||
// <i> 1: The counter clock of TIM6 is stopped when the core is halted
|
||||
// <o0.0> DBG_TIM2_STOP
|
||||
// <i> TIM2 counter stopped when core is halted
|
||||
// <i> 0: The counter clock of TIM2 is fed even if the core is halted
|
||||
// <i> 1: The counter clock of TIM2 is stopped when the core is halted
|
||||
// </h>
|
||||
DbgMCU_APB1_Fz1 = 0x00000000;
|
||||
|
||||
// <h> Debug MCU APB1 freeze register 2 (DBGMCU_APB1FZR2)
|
||||
// <o0.5> DBG_LPTIM2_STOP
|
||||
// <i> LPTIM2 counter stopped when core is halted
|
||||
// <i> 0: The counter clock of LPTIM2 is fed even if the core is halted
|
||||
// <i> 1: The counter clock of LPTIM2 is stopped when the core is halted
|
||||
// </h>
|
||||
DbgMCU_APB1_Fz2 = 0x00000000;
|
||||
|
||||
// <h> Debug MCU APB2 freeze register (DBGMCU_APB2FZR)
|
||||
// <o0.17> DBG_TIM16_STOP
|
||||
// <i> TIM16 counter stopped when core is halted
|
||||
// <i> 0: The clock of the TIM16 counter is fed even if the core is halted
|
||||
// <i> 1: The clock of the TIM16 counter is stopped when the core is halted
|
||||
// <o0.16> DBG_TIM15_STOP
|
||||
// <i> TIM15 counter stopped when core is halted
|
||||
// <i> 0: The clock of the TIM15 counter is fed even if the core is halted
|
||||
// <i> 1: The clock of the TIM15 counter is stopped when the core is halted
|
||||
// <o0.11> DBG_TIM1_STOP
|
||||
// <i> TIM1 counter stopped when core is halted
|
||||
// <i> 0: The clock of the TIM1 counter is fed even if the core is halted
|
||||
// <i> 1: The clock of the TIM1 counter is stopped when the core is halted
|
||||
// </h>
|
||||
DbgMCU_APB2_Fz = 0x00000000;
|
||||
// </h>
|
||||
|
||||
// <<< end of configuration section >>>
|
@@ -0,0 +1,20 @@
|
||||
|
||||
/*
|
||||
* Auto generated Run-Time-Environment Component Configuration File
|
||||
* *** Do not modify ! ***
|
||||
*
|
||||
* Project: 'TencentOS_tiny'
|
||||
* Target: 'TencentOS_tiny'
|
||||
*/
|
||||
|
||||
#ifndef RTE_COMPONENTS_H
|
||||
#define RTE_COMPONENTS_H
|
||||
|
||||
|
||||
/*
|
||||
* Define the Device Header File:
|
||||
*/
|
||||
#define CMSIS_device_header "stm32l4xx.h"
|
||||
|
||||
|
||||
#endif /* RTE_COMPONENTS_H */
|
File diff suppressed because one or more lines are too long
@@ -148,7 +148,24 @@
|
||||
<Name>-U303030303030303030303031 -O10446 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32L4xx_256.FLM -FS08000000 -FL040000 -FP0($$Device:STM32L431RCTx$CMSIS\Flash\STM32L4xx_256.FLM)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Breakpoint>
|
||||
<Bp>
|
||||
<Number>0</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>57</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>134237826</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>1</BreakIfRCount>
|
||||
<Filename>..\..\..\..\test\suit_priority_message_queue.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression>\\TencentOS_tiny\../../../../test/suit_priority_message_queue.c\57</Expression>
|
||||
</Bp>
|
||||
</Breakpoint>
|
||||
<WatchWindow1>
|
||||
<Ww>
|
||||
<count>0</count>
|
||||
@@ -270,7 +287,7 @@
|
||||
|
||||
<Group>
|
||||
<GroupName>Application/User</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
@@ -781,18 +798,6 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\kernel\core\tos_msg.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tos_msg.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>42</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\kernel\core\tos_mutex.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tos_mutex.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
@@ -800,19 +805,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>43</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\kernel\core\tos_queue.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tos_queue.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>44</FileNumber>
|
||||
<FileNumber>42</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -824,7 +817,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>45</FileNumber>
|
||||
<FileNumber>43</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -836,7 +829,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>46</FileNumber>
|
||||
<FileNumber>44</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -848,7 +841,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>47</FileNumber>
|
||||
<FileNumber>45</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -860,7 +853,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>48</FileNumber>
|
||||
<FileNumber>46</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -872,7 +865,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>49</FileNumber>
|
||||
<FileNumber>47</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -884,7 +877,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>50</FileNumber>
|
||||
<FileNumber>48</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -896,7 +889,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>51</FileNumber>
|
||||
<FileNumber>49</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -908,19 +901,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>52</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\kernel\core\tos_fifo.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tos_fifo.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>53</FileNumber>
|
||||
<FileNumber>50</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -932,7 +913,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>54</FileNumber>
|
||||
<FileNumber>51</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -944,7 +925,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>55</FileNumber>
|
||||
<FileNumber>52</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -954,6 +935,126 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>53</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\kernel\core\tos_binary_heap.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tos_binary_heap.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>54</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\kernel\core\tos_char_fifo.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tos_char_fifo.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>55</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\kernel\core\tos_completion.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tos_completion.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>56</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\kernel\core\tos_countdownlatch.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tos_countdownlatch.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>57</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\kernel\core\tos_mail_queue.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tos_mail_queue.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>58</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\kernel\core\tos_message_queue.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tos_message_queue.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>59</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\kernel\core\tos_priority_mail_queue.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tos_priority_mail_queue.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>60</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\kernel\core\tos_priority_message_queue.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tos_priority_message_queue.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>61</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\kernel\core\tos_priority_queue.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tos_priority_queue.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>62</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\kernel\core\tos_ring_queue.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tos_ring_queue.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
@@ -964,7 +1065,7 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>56</FileNumber>
|
||||
<FileNumber>63</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -976,7 +1077,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>57</FileNumber>
|
||||
<FileNumber>64</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -988,7 +1089,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>58</FileNumber>
|
||||
<FileNumber>65</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -1008,7 +1109,7 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>8</GroupNumber>
|
||||
<FileNumber>59</FileNumber>
|
||||
<FileNumber>66</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -1028,7 +1129,7 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>9</GroupNumber>
|
||||
<FileNumber>60</FileNumber>
|
||||
<FileNumber>67</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -1048,7 +1149,7 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>61</FileNumber>
|
||||
<FileNumber>68</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -1060,19 +1161,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>62</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\test\suit_fifo.c</PathWithFileName>
|
||||
<FilenameWithoutPath>suit_fifo.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>63</FileNumber>
|
||||
<FileNumber>69</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -1084,7 +1173,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>64</FileNumber>
|
||||
<FileNumber>70</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -1096,19 +1185,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>65</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\test\suit_msg_queue.c</PathWithFileName>
|
||||
<FilenameWithoutPath>suit_msg_queue.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>66</FileNumber>
|
||||
<FileNumber>71</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -1120,19 +1197,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>67</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\test\suit_queue.c</PathWithFileName>
|
||||
<FilenameWithoutPath>suit_queue.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>68</FileNumber>
|
||||
<FileNumber>72</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -1144,7 +1209,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>69</FileNumber>
|
||||
<FileNumber>73</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -1156,7 +1221,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>70</FileNumber>
|
||||
<FileNumber>74</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -1168,7 +1233,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>71</FileNumber>
|
||||
<FileNumber>75</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -1180,7 +1245,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>72</FileNumber>
|
||||
<FileNumber>76</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -1192,7 +1257,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>73</FileNumber>
|
||||
<FileNumber>77</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -1202,6 +1267,102 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>78</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\test\suit_binary_heap.c</PathWithFileName>
|
||||
<FilenameWithoutPath>suit_binary_heap.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>79</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\test\suit_char_fifo.c</PathWithFileName>
|
||||
<FilenameWithoutPath>suit_char_fifo.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>80</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\test\suit_mail_queue.c</PathWithFileName>
|
||||
<FilenameWithoutPath>suit_mail_queue.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>81</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\test\suit_message_queue.c</PathWithFileName>
|
||||
<FilenameWithoutPath>suit_message_queue.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>82</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\test\suit_priority_mail_queue.c</PathWithFileName>
|
||||
<FilenameWithoutPath>suit_priority_mail_queue.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>83</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\test\suit_priority_message_queue.c</PathWithFileName>
|
||||
<FilenameWithoutPath>suit_priority_message_queue.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>84</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\test\suit_priority_queue.c</PathWithFileName>
|
||||
<FilenameWithoutPath>suit_priority_queue.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>85</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\test\suit_ring_queue.c</PathWithFileName>
|
||||
<FilenameWithoutPath>suit_ring_queue.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
|
@@ -16,7 +16,7 @@
|
||||
<TargetCommonOption>
|
||||
<Device>STM32L431RCTx</Device>
|
||||
<Vendor>STMicroelectronics</Vendor>
|
||||
<PackID>Keil.STM32L4xx_DFP.2.2.0</PackID>
|
||||
<PackID>Keil.STM32L4xx_DFP.2.0.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack</PackURL>
|
||||
<Cpu>IRAM(0x20000000-0x2000FFFF) IROM(0x8000000-0x803FFFF) CLOCK(8000000) FPU2 CPUTYPE("Cortex-M4")</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
@@ -607,21 +607,11 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_mmheap.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_msg.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_msg.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_mutex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_mutex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_sched.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -662,11 +652,6 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_event.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_fifo.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_fifo.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_global.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -682,6 +667,56 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_robin.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_binary_heap.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_binary_heap.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_char_fifo.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_char_fifo.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_completion.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_completion.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_countdownlatch.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_countdownlatch.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_mail_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_mail_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_message_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_message_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_priority_mail_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_priority_mail_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_priority_message_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_priority_message_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_priority_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_priority_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_ring_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_ring_queue.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
@@ -732,11 +767,6 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\test\suit_event.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>suit_fifo.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\test\suit_fifo.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>suit_mmblk.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -747,21 +777,11 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\test\suit_mmheap.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>suit_msg_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\test\suit_msg_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>suit_mutex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\test\suit_mutex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>suit_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\test\suit_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>suit_robin.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -792,6 +812,46 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\test\test_utils.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>suit_binary_heap.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\test\suit_binary_heap.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>suit_char_fifo.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\test\suit_char_fifo.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>suit_mail_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\test\suit_mail_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>suit_message_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\test\suit_message_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>suit_priority_mail_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\test\suit_priority_mail_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>suit_priority_message_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\test\suit_priority_message_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>suit_priority_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\test\suit_priority_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>suit_ring_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\test\suit_ring_queue.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
@@ -0,0 +1,143 @@
|
||||
<html>
|
||||
<body>
|
||||
<pre>
|
||||
<h1><EFBFBD>Vision Build Log</h1>
|
||||
<h2>Tool Versions:</h2>
|
||||
IDE-Version: <20><>Vision V5.26.2.0
|
||||
Copyright (C) 2018 ARM Ltd and ARM Germany GmbH. All rights reserved.
|
||||
License Information: sheldon dai, tencent, LIC=AK1CX-H5HPV-SGF7K-ZGDWF-QC6LB-GRJE8
|
||||
|
||||
Tool Versions:
|
||||
Toolchain: MDK-ARM Professional Version: 5.26.2.0
|
||||
Toolchain Path: C:\Keil_v5\ARM\ARMCC\Bin
|
||||
C Compiler: Armcc.exe V5.06 update 6 (build 750)
|
||||
Assembler: Armasm.exe V5.06 update 6 (build 750)
|
||||
Linker/Locator: ArmLink.exe V5.06 update 6 (build 750)
|
||||
Library Manager: ArmAr.exe V5.06 update 6 (build 750)
|
||||
Hex Converter: FromElf.exe V5.06 update 6 (build 750)
|
||||
CPU DLL: SARMCM3.DLL V5.26.2.0
|
||||
Dialog DLL: DCM.DLL V1.17.2.0
|
||||
Target DLL: STLink\ST-LINKIII-KEIL_SWO.dll V3.0.5.0
|
||||
Dialog DLL: TCM.DLL V1.36.1.0
|
||||
|
||||
<h2>Project:</h2>
|
||||
D:\github\master\TencentOS-tiny\board\TencentOS_tiny_EVB_MX_Plus\KEIL\test\TencentOS_tiny.uvprojx
|
||||
Project File Date: 10/28/2019
|
||||
|
||||
<h2>Output:</h2>
|
||||
*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
|
||||
Rebuild target 'TencentOS_tiny'
|
||||
assembling startup_stm32l431xx.s...
|
||||
compiling gpio.c...
|
||||
compiling mcu_init.c...
|
||||
compiling stm32l4xx_hal_msp.c...
|
||||
compiling adc.c...
|
||||
compiling usart.c...
|
||||
compiling stm32l4xx_it.c...
|
||||
compiling main.c...
|
||||
compiling spi.c...
|
||||
compiling i2c.c...
|
||||
compiling dac.c...
|
||||
compiling stm32l4xx_hal_tim_ex.c...
|
||||
compiling stm32l4xx_hal_uart_ex.c...
|
||||
compiling stm32l4xx_hal_tim.c...
|
||||
compiling stm32l4xx_hal_uart.c...
|
||||
compiling stm32l4xx_hal.c...
|
||||
compiling stm32l4xx_hal_i2c_ex.c...
|
||||
compiling stm32l4xx_hal_i2c.c...
|
||||
compiling stm32l4xx_hal_rcc_ex.c...
|
||||
compiling stm32l4xx_hal_rcc.c...
|
||||
compiling stm32l4xx_hal_flash.c...
|
||||
compiling stm32l4xx_hal_flash_ex.c...
|
||||
compiling stm32l4xx_hal_flash_ramfunc.c...
|
||||
compiling stm32l4xx_hal_gpio.c...
|
||||
compiling stm32l4xx_hal_pwr_ex.c...
|
||||
compiling stm32l4xx_hal_dma.c...
|
||||
compiling stm32l4xx_hal_dma_ex.c...
|
||||
compiling stm32l4xx_hal_pwr.c...
|
||||
compiling stm32l4xx_hal_cortex.c...
|
||||
compiling stm32l4xx_hal_adc.c...
|
||||
compiling stm32l4xx_hal_adc_ex.c...
|
||||
compiling stm32l4xx_hal_dac_ex.c...
|
||||
compiling stm32l4xx_hal_spi_ex.c...
|
||||
compiling system_stm32l4xx.c...
|
||||
compiling stm32l4xx_hal_dac.c...
|
||||
compiling DHT11_BUS.c...
|
||||
compiling stm32l4xx_hal_spi.c...
|
||||
compiling oled.c...
|
||||
compiling tos_mmblk.c...
|
||||
compiling tos_mutex.c...
|
||||
compiling tos_mmheap.c...
|
||||
compiling tos_sched.c...
|
||||
compiling tos_sem.c...
|
||||
compiling tos_task.c...
|
||||
compiling tos_sys.c...
|
||||
compiling tos_tick.c...
|
||||
compiling tos_timer.c...
|
||||
compiling tos_time.c...
|
||||
compiling tos_event.c...
|
||||
compiling tos_pend.c...
|
||||
compiling tos_global.c...
|
||||
compiling tos_robin.c...
|
||||
compiling tos_binary_heap.c...
|
||||
compiling tos_char_fifo.c...
|
||||
compiling tos_countdownlatch.c...
|
||||
compiling tos_completion.c...
|
||||
compiling tos_message_queue.c...
|
||||
compiling tos_mail_queue.c...
|
||||
compiling tos_priority_mail_queue.c...
|
||||
compiling tos_priority_message_queue.c...
|
||||
assembling port_s.S...
|
||||
compiling tos_priority_queue.c...
|
||||
compiling tos_ring_queue.c...
|
||||
compiling tos_cpu.c...
|
||||
compiling port_c.c...
|
||||
compiling cmsis_os.c...
|
||||
compiling suit_event.c...
|
||||
compiling suit_mmheap.c...
|
||||
compiling suit_mmblk.c...
|
||||
compiling suit_mutex.c...
|
||||
compiling suit_robin.c...
|
||||
compiling suit_task.c...
|
||||
compiling suit_sem.c...
|
||||
compiling suit_timer.c...
|
||||
compiling test_main.c...
|
||||
compiling test_utils.c...
|
||||
compiling suit_binary_heap.c...
|
||||
compiling suit_char_fifo.c...
|
||||
compiling suit_mail_queue.c...
|
||||
compiling suit_message_queue.c...
|
||||
compiling suit_priority_mail_queue.c...
|
||||
compiling suit_priority_message_queue.c...
|
||||
compiling suit_priority_queue.c...
|
||||
compiling suit_ring_queue.c...
|
||||
linking...
|
||||
Program Size: Code=109768 RO-data=5824 RW-data=336 ZI-data=47544
|
||||
FromELF: creating hex file...
|
||||
".\obj\TencentOS_tiny.axf" - 0 Error(s), 0 Warning(s).
|
||||
|
||||
<h2>Software Packages used:</h2>
|
||||
|
||||
Package Vendor: ARM
|
||||
http://www.keil.com/pack/ARM.CMSIS.5.6.0.pack
|
||||
ARM.CMSIS.5.6.0
|
||||
CMSIS (Cortex Microcontroller Software Interface Standard)
|
||||
* Component: CORE Version: 5.3.0
|
||||
|
||||
Package Vendor: Keil
|
||||
http://www.keil.com/pack/Keil.STM32L4xx_DFP.2.0.0.pack
|
||||
Keil.STM32L4xx_DFP.2.0.0
|
||||
STMicroelectronics STM32L4 Series Device Support, Drivers and Examples
|
||||
|
||||
<h2>Collection of Component include folders:</h2>
|
||||
.\RTE\_TencentOS_tiny
|
||||
C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.6.0\CMSIS\Core\Include
|
||||
C:\Keil_v5\ARM\PACK\Keil\STM32L4xx_DFP\2.0.0\Drivers\CMSIS\Device\ST\STM32L4xx\Include
|
||||
|
||||
<h2>Collection of Component Files used:</h2>
|
||||
|
||||
* Component: ARM::CMSIS:CORE:5.3.0
|
||||
Build Time Elapsed: 00:00:16
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
6454
board/TencentOS_tiny_EVB_MX_Plus/KEIL/test/obj/TencentOS_tiny.htm
Normal file
6454
board/TencentOS_tiny_EVB_MX_Plus/KEIL/test/obj/TencentOS_tiny.htm
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,16 @@
|
||||
; *************************************************************
|
||||
; *** Scatter-Loading Description File generated by uVision ***
|
||||
; *************************************************************
|
||||
|
||||
LR_IROM1 0x08000000 0x00040000 { ; load region size_region
|
||||
ER_IROM1 0x08000000 0x00040000 { ; load address = execution address
|
||||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
.ANY (+RO)
|
||||
.ANY (+XO)
|
||||
}
|
||||
RW_IRAM1 0x20000000 0x00010000 { ; RW data
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
}
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_PWR_MGR_EN 1u
|
||||
@@ -31,14 +29,6 @@
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 3u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 512u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
#define TOS_CFG_TASK_PRIO_MAX 10u
|
||||
|
||||
#define TOS_CFG_ROUND_ROBIN_EN 1u
|
||||
#define TOS_CFG_ROUND_ROBIN_EN 0u
|
||||
|
||||
#define TOS_CFG_OBJECT_VERIFY_EN 1u
|
||||
|
||||
@@ -23,7 +23,13 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
#define TOS_CFG_MESSAGE_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_MAIL_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_PRIORITY_MESSAGE_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_PRIORITY_MAIL_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
@@ -37,14 +43,6 @@
|
||||
|
||||
#define TOS_CFG_FAULT_BACKTRACE_EN 0u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 3u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 128u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 1u
|
||||
|
||||
#define TOS_CFG_PWR_MGR_EN 0u
|
||||
@@ -33,14 +31,6 @@
|
||||
|
||||
#define TOS_CFG_FAULT_BACKTRACE_EN 0u
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#else
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 3u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 512u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
@@ -51,7 +51,7 @@ struct ble_npl_event {
|
||||
};
|
||||
|
||||
struct ble_npl_eventq {
|
||||
k_queue_t q;
|
||||
k_msg_q_t q;
|
||||
};
|
||||
|
||||
struct ble_npl_callout {
|
||||
|
@@ -27,18 +27,21 @@ volatile int ble_npl_in_critical = 0;
|
||||
void
|
||||
npl_tencentos_tiny_eventq_init(struct ble_npl_eventq *evq)
|
||||
{
|
||||
tos_queue_create(&evq->q);
|
||||
void *msg_pool = tos_mmheap_alloc(sizeof(void *));
|
||||
if (!msg_pool) {
|
||||
return;
|
||||
}
|
||||
|
||||
#define EVENT_Q_MSG_CNT 32
|
||||
tos_msg_q_create(&evq->q, msg_pool, EVENT_Q_MSG_CNT);
|
||||
}
|
||||
|
||||
struct ble_npl_event *
|
||||
npl_tencentos_tiny_eventq_get(struct ble_npl_eventq *evq, ble_npl_time_t tmo)
|
||||
{
|
||||
k_err_t err;
|
||||
size_t msg_size;
|
||||
struct ble_npl_event *ev = NULL;
|
||||
|
||||
err = tos_queue_pend(&evq->q, (void **)&ev, &msg_size, tmo);
|
||||
if (err != K_ERR_NONE) {
|
||||
if (tos_msg_q_pend(&evq->q, (void **)&ev, tmo) != K_ERR_NONE) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -60,7 +63,7 @@ npl_tencentos_tiny_eventq_put(struct ble_npl_eventq *evq, struct ble_npl_event *
|
||||
|
||||
ev->queued = true;
|
||||
|
||||
err = tos_queue_post(&evq->q, ev, sizeof(struct ble_npl_event));
|
||||
err = tos_msg_q_post(&evq->q, ev);
|
||||
|
||||
assert(err == K_ERR_NONE);
|
||||
}
|
||||
@@ -69,11 +72,36 @@ void
|
||||
npl_tencentos_tiny_eventq_remove(struct ble_npl_eventq *evq,
|
||||
struct ble_npl_event *ev)
|
||||
{
|
||||
k_err_t err;
|
||||
int i, count;
|
||||
struct ble_npl_event *ev_received;
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
|
||||
if (!ev->queued) {
|
||||
return;
|
||||
}
|
||||
|
||||
tos_queue_remove(&evq->q, ev);
|
||||
/*
|
||||
* XXX We cannot extract element from inside TencentOS tiny message queue so as a quick
|
||||
* workaround we'll just remove all elements and add them back except the
|
||||
* one we need to remove. This is silly, but works for now
|
||||
*/
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
count = evq->q.ring_q.total;
|
||||
for (i = 0; i < count; ++i) {
|
||||
err = tos_msg_q_pend(&evq->q, (void **)&ev_received, TOS_TIME_NOWAIT);
|
||||
TOS_ASSERT(err == K_ERR_NONE);
|
||||
if (ev_received == ev) {
|
||||
continue;
|
||||
}
|
||||
|
||||
err = tos_msg_q_post(&evq->q, ev_received);
|
||||
TOS_ASSERT(err == K_ERR_NONE);
|
||||
}
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
ev->queued = false;
|
||||
}
|
||||
@@ -81,7 +109,7 @@ npl_tencentos_tiny_eventq_remove(struct ble_npl_eventq *evq,
|
||||
bool
|
||||
npl_tencentos_tiny_eventq_is_empty(struct ble_npl_eventq *evq)
|
||||
{
|
||||
return tos_list_empty(&evq->q.msg_queue.queue_head);
|
||||
return tos_ring_q_is_empty(&evq->q.ring_q);
|
||||
}
|
||||
|
||||
ble_npl_error_t
|
||||
|
@@ -1,18 +1,18 @@
|
||||
#include "tos.h"
|
||||
#include "mcu_init.h"
|
||||
|
||||
#define STK_SIZE_TASK_DEMO 512
|
||||
#define STK_SIZE_TASK_DEMO 512
|
||||
|
||||
#define PRIO_TASK_DEMO 4
|
||||
|
||||
k_stack_t stack_task_demo[STK_SIZE_TASK_DEMO];
|
||||
|
||||
k_stack_t stack_task_demo[STK_SIZE_TASK_DEMO];
|
||||
|
||||
k_task_t task_demo;
|
||||
|
||||
#define FIFO_BUFFER_SIZE 5
|
||||
uint8_t fifo_buffer[FIFO_BUFFER_SIZE];
|
||||
|
||||
k_fifo_t fifo;
|
||||
k_chr_fifo_t fifo;
|
||||
|
||||
extern void entry_task_demo(void *arg);
|
||||
|
||||
@@ -24,30 +24,30 @@ void char_push(void)
|
||||
|
||||
for (i = 0; i < FIFO_BUFFER_SIZE; ++i) {
|
||||
printf("char pushed: %c\n", 'a' + i);
|
||||
err = tos_fifo_push(&fifo, 'a' + i);
|
||||
err = tos_chr_fifo_push(&fifo, 'a' + i);
|
||||
if (err != K_ERR_NONE) {
|
||||
printf("should never happen\n");
|
||||
}
|
||||
}
|
||||
|
||||
err = tos_fifo_push(&fifo, 'z');
|
||||
err = tos_chr_fifo_push(&fifo, 'z');
|
||||
if (err == K_ERR_FIFO_FULL) {
|
||||
printf("fifo is full: %s\n", tos_fifo_is_full(&fifo) ? "TRUE" : "FALSE");
|
||||
printf("fifo is full: %s\n", tos_chr_fifo_is_full(&fifo) ? "TRUE" : "FALSE");
|
||||
} else {
|
||||
printf("should never happen\n");
|
||||
}
|
||||
|
||||
for (i = 0; i < FIFO_BUFFER_SIZE; ++i) {
|
||||
err = tos_fifo_pop(&fifo, &data);
|
||||
err = tos_chr_fifo_pop(&fifo, &data);
|
||||
if (err == K_ERR_NONE) {
|
||||
printf("%d pop: %c\n", i, data);
|
||||
} else {
|
||||
printf("should never happen\n");
|
||||
}
|
||||
}
|
||||
err = tos_fifo_pop(&fifo, &data);
|
||||
err = tos_chr_fifo_pop(&fifo, &data);
|
||||
if (err == K_ERR_FIFO_EMPTY) {
|
||||
printf("fifo is empty: %s\n", tos_fifo_is_empty(&fifo) ? "TRUE" : "FALSE");
|
||||
printf("fifo is empty: %s\n", tos_chr_fifo_is_empty(&fifo) ? "TRUE" : "FALSE");
|
||||
} else {
|
||||
printf("should never happen\n");
|
||||
}
|
||||
@@ -60,19 +60,19 @@ void stream_push(void)
|
||||
uint8_t stream_dummy[1] = { 'z' };
|
||||
uint8_t stream_pop[FIFO_BUFFER_SIZE];
|
||||
|
||||
count = tos_fifo_push_stream(&fifo, &stream[0], FIFO_BUFFER_SIZE);
|
||||
count = tos_chr_fifo_push_stream(&fifo, &stream[0], FIFO_BUFFER_SIZE);
|
||||
if (count != FIFO_BUFFER_SIZE) {
|
||||
printf("should never happen\n");
|
||||
}
|
||||
|
||||
count = tos_fifo_push_stream(&fifo, &stream_dummy[0], 1);
|
||||
count = tos_chr_fifo_push_stream(&fifo, &stream_dummy[0], 1);
|
||||
if (count == 0) {
|
||||
printf("fifo is full: %s\n", tos_fifo_is_full(&fifo) ? "TRUE" : "FALSE");
|
||||
printf("fifo is full: %s\n", tos_chr_fifo_is_full(&fifo) ? "TRUE" : "FALSE");
|
||||
} else {
|
||||
printf("should never happen\n");
|
||||
}
|
||||
|
||||
count = tos_fifo_pop_stream(&fifo, &stream_pop[0], FIFO_BUFFER_SIZE);
|
||||
count = tos_chr_fifo_pop_stream(&fifo, &stream_pop[0], FIFO_BUFFER_SIZE);
|
||||
if (count == FIFO_BUFFER_SIZE) {
|
||||
printf("stream popped:\n");
|
||||
for (i = 0; i < FIFO_BUFFER_SIZE; ++i) {
|
||||
@@ -83,9 +83,9 @@ void stream_push(void)
|
||||
printf("should never happen\n");
|
||||
}
|
||||
|
||||
count = tos_fifo_pop_stream(&fifo, &stream_pop[0], 1);
|
||||
count = tos_chr_fifo_pop_stream(&fifo, &stream_pop[0], 1);
|
||||
if (count == 0) {
|
||||
printf("fifo is empty: %s\n", tos_fifo_is_empty(&fifo) ? "TRUE" : "FALSE");
|
||||
printf("fifo is empty: %s\n", tos_chr_fifo_is_empty(&fifo) ? "TRUE" : "FALSE");
|
||||
} else {
|
||||
printf("should never happen\n");
|
||||
}
|
||||
@@ -93,7 +93,7 @@ void stream_push(void)
|
||||
|
||||
void entry_task_demo(void *arg)
|
||||
{
|
||||
tos_fifo_create(&fifo, &fifo_buffer[0], FIFO_BUFFER_SIZE);
|
||||
tos_chr_fifo_create(&fifo, &fifo_buffer[0], FIFO_BUFFER_SIZE);
|
||||
|
||||
printf("fifo, dealing with char\n");
|
||||
char_push();
|
||||
@@ -105,10 +105,10 @@ void entry_task_demo(void *arg)
|
||||
int main(void)
|
||||
{
|
||||
board_init();
|
||||
tos_knl_init();
|
||||
tos_knl_init();
|
||||
(void)tos_task_create(&task_demo, "demo1", entry_task_demo, NULL,
|
||||
PRIO_TASK_DEMO, stack_task_demo, STK_SIZE_TASK_DEMO,
|
||||
0);
|
||||
0);
|
||||
tos_knl_start();
|
||||
}
|
||||
|
||||
|
@@ -82,7 +82,7 @@ typedef enum at_channel_status_en {
|
||||
|
||||
typedef struct at_data_channel_st {
|
||||
uint8_t is_free;
|
||||
k_fifo_t rx_fifo;
|
||||
k_chr_fifo_t rx_fifo;
|
||||
uint8_t *rx_fifo_buffer;
|
||||
|
||||
at_channel_status_t status;
|
||||
@@ -115,21 +115,21 @@ typedef struct at_agent_st {
|
||||
|
||||
at_data_channel_t data_channel[AT_DATA_CHANNEL_NUM];
|
||||
|
||||
at_event_t *event_table;
|
||||
size_t event_table_size;
|
||||
at_event_t *event_table;
|
||||
size_t event_table_size;
|
||||
|
||||
at_echo_t *echo;
|
||||
at_echo_t *echo;
|
||||
|
||||
at_cache_t recv_cache;
|
||||
at_cache_t recv_cache;
|
||||
|
||||
at_timer_t timer;
|
||||
at_timer_t timer;
|
||||
|
||||
char *cmd_buf;
|
||||
char *cmd_buf;
|
||||
|
||||
hal_uart_t uart;
|
||||
hal_uart_t uart;
|
||||
|
||||
k_fifo_t uart_rx_fifo;
|
||||
uint8_t *uart_rx_fifo_buffer;
|
||||
k_chr_fifo_t uart_rx_fifo;
|
||||
uint8_t *uart_rx_fifo_buffer;
|
||||
} at_agent_t;
|
||||
|
||||
#define AT_AGENT ((at_agent_t *)(&at_agent))
|
||||
|
@@ -8,7 +8,7 @@ __STATIC__ int at_uart_getchar(uint8_t *data, k_tick_t timeout)
|
||||
|
||||
at_delay(1);
|
||||
|
||||
err = tos_fifo_pop(&AT_AGENT->uart_rx_fifo, data);
|
||||
err = tos_chr_fifo_pop(&AT_AGENT->uart_rx_fifo, data);
|
||||
|
||||
return err == K_ERR_NONE ? 0 : -1;
|
||||
}
|
||||
@@ -315,7 +315,7 @@ __API__ int tos_at_channel_read(int channel_id, uint8_t *buffer, size_t buffer_l
|
||||
}
|
||||
|
||||
while (K_TRUE) {
|
||||
read_len = tos_fifo_pop_stream(&data_channel->rx_fifo, buffer, buffer_len);
|
||||
read_len = tos_chr_fifo_pop_stream(&data_channel->rx_fifo, buffer, buffer_len);
|
||||
|
||||
total_read_len += read_len;
|
||||
if (total_read_len < buffer_len) {
|
||||
@@ -347,7 +347,7 @@ __API__ int tos_at_channel_read_timed(int channel_id, uint8_t *buffer, size_t bu
|
||||
return total_read_len;
|
||||
}
|
||||
|
||||
read_len = tos_fifo_pop_stream(&data_channel->rx_fifo, buffer + read_len, buffer_len - total_read_len);
|
||||
read_len = tos_chr_fifo_pop_stream(&data_channel->rx_fifo, buffer + read_len, buffer_len - total_read_len);
|
||||
|
||||
total_read_len += read_len;
|
||||
if (total_read_len < buffer_len) {
|
||||
@@ -369,7 +369,7 @@ __API__ int tos_at_channel_write(int channel_id, uint8_t *buffer, size_t buffer_
|
||||
return -1;
|
||||
}
|
||||
|
||||
return tos_fifo_push_stream(&data_channel->rx_fifo, buffer, buffer_len);
|
||||
return tos_chr_fifo_push_stream(&data_channel->rx_fifo, buffer, buffer_len);
|
||||
}
|
||||
|
||||
__STATIC_INLINE__ int at_channel_construct(at_data_channel_t *data_channel, const char *ip, const char *port)
|
||||
@@ -382,7 +382,7 @@ __STATIC_INLINE__ int at_channel_construct(at_data_channel_t *data_channel, cons
|
||||
}
|
||||
|
||||
data_channel->rx_fifo_buffer = fifo_buffer;
|
||||
tos_fifo_create(&data_channel->rx_fifo, fifo_buffer, AT_DATA_CHANNEL_FIFO_BUFFER_SIZE);
|
||||
tos_chr_fifo_create(&data_channel->rx_fifo, fifo_buffer, AT_DATA_CHANNEL_FIFO_BUFFER_SIZE);
|
||||
data_channel->remote_ip = ip;
|
||||
data_channel->remote_port = port;
|
||||
|
||||
@@ -441,7 +441,7 @@ __API__ int tos_at_channel_free(int channel_id)
|
||||
}
|
||||
|
||||
tos_mmheap_free(data_channel->rx_fifo_buffer);
|
||||
tos_fifo_destroy(&data_channel->rx_fifo);
|
||||
tos_chr_fifo_destroy(&data_channel->rx_fifo);
|
||||
|
||||
memset(data_channel, 0, sizeof(at_data_channel_t));
|
||||
|
||||
@@ -542,7 +542,7 @@ __API__ int tos_at_init(hal_uart_port_t uart_port, evtdrv_task_id_t at_task_id,
|
||||
}
|
||||
|
||||
AT_AGENT->uart_rx_fifo_buffer = (uint8_t *)buffer;
|
||||
tos_fifo_create(&AT_AGENT->uart_rx_fifo, (uint8_t *)buffer, AT_UART_RX_FIFO_BUFFER_SIZE);
|
||||
tos_chr_fifo_create(&AT_AGENT->uart_rx_fifo, (uint8_t *)buffer, AT_UART_RX_FIFO_BUFFER_SIZE);
|
||||
|
||||
buffer = tos_mmheap_alloc(AT_CMD_BUFFER_SIZE);
|
||||
if (!buffer) {
|
||||
@@ -570,7 +570,7 @@ errout1:
|
||||
errout0:
|
||||
tos_mmheap_free(AT_AGENT->uart_rx_fifo_buffer);
|
||||
AT_AGENT->uart_rx_fifo_buffer = K_NULL;
|
||||
tos_fifo_destroy(&AT_AGENT->uart_rx_fifo);
|
||||
tos_chr_fifo_destroy(&AT_AGENT->uart_rx_fifo);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@@ -587,7 +587,7 @@ __API__ void tos_at_deinit(void)
|
||||
tos_mmheap_free(AT_AGENT->uart_rx_fifo_buffer);
|
||||
AT_AGENT->uart_rx_fifo_buffer = K_NULL;
|
||||
|
||||
tos_fifo_destroy(&AT_AGENT->uart_rx_fifo);
|
||||
tos_chr_fifo_destroy(&AT_AGENT->uart_rx_fifo);
|
||||
|
||||
at_channel_deinit();
|
||||
}
|
||||
@@ -596,9 +596,9 @@ __API__ void tos_at_deinit(void)
|
||||
hal(driver framework), that would be a huge work, we place it in future plans. */
|
||||
__API__ void tos_at_uart_write_byte(uint8_t data)
|
||||
{
|
||||
if (tos_fifo_push(&AT_AGENT->uart_rx_fifo, data) == K_ERR_NONE) {
|
||||
if (tos_chr_fifo_push(&AT_AGENT->uart_rx_fifo, data) == K_ERR_NONE) {
|
||||
tos_evtdrv_event_set(AT_AGENT->at_task_id, EVENT_AT_UART_INCOMING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__STATIC__ void at_echo_event_emit(at_echo_t *echo)
|
||||
|
@@ -8,34 +8,222 @@ osThreadDef(task1, osPriorityNormal, 1, TASK1_STK_SIZE);
|
||||
void task2(void *arg);
|
||||
osThreadDef(task2, osPriorityNormal, 1, TASK2_STK_SIZE);
|
||||
|
||||
|
||||
k_ring_q_t ring_q;
|
||||
k_chr_fifo_t chr_fifo;
|
||||
k_msg_q_t msg_q;
|
||||
|
||||
k_mail_q_t mail_q;
|
||||
|
||||
k_bin_heap_t bin_heap;
|
||||
|
||||
k_prio_q_t prio_q;
|
||||
|
||||
typedef struct fuck {
|
||||
int a;
|
||||
char *name;
|
||||
} fuck_t;
|
||||
|
||||
char ring_q_pool[sizeof(fuck_t) * 4];
|
||||
|
||||
uint8_t chr_fifo_pool[sizeof(uint8_t) * 4];
|
||||
|
||||
uint8_t msg_q_pool[sizeof(void *) * 4];
|
||||
|
||||
uint8_t mail_q_pool[sizeof(fuck_t) * 4];
|
||||
|
||||
int int_pool[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
int int_seq[] = { 0, 1, 2, 3, 4, 8, 9, 3, 5 };
|
||||
|
||||
fuck_t fuck_pool[9];
|
||||
|
||||
fuck_t fuck_seq[9] = {
|
||||
{ 0, "000" },
|
||||
{ 1, "111" },
|
||||
{ 2, "222" },
|
||||
{ 3, "333" },
|
||||
{ 4, "444" },
|
||||
{ 8, "888" },
|
||||
{ 9, "999" },
|
||||
{ 3, "333" },
|
||||
{ 5, "555" },
|
||||
};
|
||||
|
||||
uint8_t mgr_entry_array[TOS_PRIO_Q_ARRAY_SIZE(3)];
|
||||
|
||||
int int_cmp(void *first, void *second)
|
||||
{
|
||||
int f = *(int *)first;
|
||||
int s = *(int *)second;
|
||||
|
||||
if (f > s) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fuck_cmp(void *first, void *second)
|
||||
{
|
||||
fuck_t *f = (fuck_t *)first;
|
||||
fuck_t *s = (fuck_t *)second;
|
||||
|
||||
if (f->a > s->a) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int fuck_int(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < bin_heap.total; ++i) {
|
||||
printf("%d\n", int_pool[i]);
|
||||
}
|
||||
}
|
||||
|
||||
int fuck_fuck(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < bin_heap.total; ++i) {
|
||||
printf("%d %s\n", fuck_pool[i].a, fuck_pool[i].name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int fuck(void)
|
||||
{
|
||||
fuck_fuck();
|
||||
}
|
||||
|
||||
void task1(void *arg)
|
||||
{
|
||||
size_t item_size;
|
||||
int fuckx = 19;
|
||||
k_err_t err;
|
||||
int i = 0;
|
||||
|
||||
fuck_t dummy = {
|
||||
10, "dummy"
|
||||
};
|
||||
|
||||
#if 0
|
||||
for (i = 0; i < sizeof(int_seq) / sizeof(int); ++i) {
|
||||
err = tos_bin_heap_push(&bin_heap, &int_seq[i]);
|
||||
printf("%d %d\n", int_seq[i], err);
|
||||
}
|
||||
|
||||
err = tos_bin_heap_push(&bin_heap, &fuckx);
|
||||
printf("%d %d\n", fuckx, err);
|
||||
|
||||
printf("=============\n\n");
|
||||
fuck();
|
||||
|
||||
while (!tos_bin_heap_is_empty(&bin_heap)) {
|
||||
err = tos_bin_heap_pop(&bin_heap, &fuckx, &item_size);
|
||||
printf("!!!!!! %d %d %d\n", err, fuckx, item_size);
|
||||
}
|
||||
#elif 0
|
||||
for (i = 0; i < 9; ++i) {
|
||||
err = tos_bin_heap_push(&bin_heap, &fuck_seq[i]);
|
||||
printf("%d %s %d\n", fuck_seq[i].a, fuck_seq[i].name, err);
|
||||
}
|
||||
|
||||
err = tos_bin_heap_push(&bin_heap, &dummy);
|
||||
printf("%d %d\n", dummy.a, err);
|
||||
|
||||
printf("=============\n\n");
|
||||
fuck();
|
||||
|
||||
while (!tos_bin_heap_is_empty(&bin_heap)) {
|
||||
err = tos_bin_heap_pop(&bin_heap, &dummy, &item_size);
|
||||
printf("!!!!!! %d %d %s %d\n", err, dummy.a, dummy.name, item_size);
|
||||
}
|
||||
#else
|
||||
|
||||
for (i = 0; i < 9; ++i) {
|
||||
err = tos_prio_q_enqueue(&prio_q, &fuck_seq[i], sizeof(fuck_t), fuck_seq[i].a);
|
||||
printf("%d %s %d\n", fuck_seq[i].a, fuck_seq[i].name, err);
|
||||
}
|
||||
|
||||
err = tos_prio_q_enqueue(&prio_q, &dummy, sizeof(fuck_t), dummy.a);
|
||||
printf("%d %d\n", dummy.a, err);
|
||||
|
||||
printf("=============\n\n");
|
||||
// fuck();
|
||||
|
||||
while (!tos_prio_q_is_empty(&prio_q)) {
|
||||
err = tos_prio_q_dequeue(&prio_q, &dummy, &item_size);
|
||||
printf("!!!!!! %d %d %s %d\n", err, dummy.a, dummy.name, item_size);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
return;
|
||||
|
||||
|
||||
fuck_t fuck1 = { 1, "111" };
|
||||
fuck_t fuck2 = { 2, "222" };
|
||||
fuck_t fuck3 = { 3, "333" };
|
||||
fuck_t fuck4 = { 4, "444" };
|
||||
fuck_t fuck5 = { 5, "555" };
|
||||
|
||||
int count = 1;
|
||||
while (1) {
|
||||
printf("###This is task1, %d\r\n", count++);
|
||||
osDelay(2000);
|
||||
|
||||
osDelay(1000);
|
||||
|
||||
if (count == 2) {
|
||||
err = tos_mail_q_post(&mail_q, &fuck1, sizeof(fuck1));
|
||||
printf("task1: %d\n", err);
|
||||
} else if (count == 3) {
|
||||
err = tos_mail_q_post(&mail_q, &fuck2, sizeof(fuck2));
|
||||
printf("task1: %d\n", err);
|
||||
} else if (count == 4) {
|
||||
err = tos_mail_q_post(&mail_q, &fuck3, sizeof(fuck3));
|
||||
printf("task1: %d\n", err);
|
||||
} else if (count == 5) {
|
||||
err = tos_mail_q_post(&mail_q, &fuck4, sizeof(fuck4));
|
||||
printf("task1: %d\n", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void task2(void *arg)
|
||||
{
|
||||
return;
|
||||
k_err_t err;
|
||||
void *msg;
|
||||
size_t msg_size;
|
||||
|
||||
int count = 1;
|
||||
while (1) {
|
||||
#if TOS_CFG_TASK_STACK_DRAUGHT_DEPTH_DETACT_EN > 0u
|
||||
k_err_t rc;
|
||||
int depth;
|
||||
|
||||
rc = tos_task_stack_draught_depth(K_NULL, &depth);
|
||||
printf("%d %d\n", rc, depth);
|
||||
#endif
|
||||
|
||||
printf("***This is task2, %d\r\n", count++);
|
||||
osDelay(1000);
|
||||
|
||||
err = tos_mail_q_pend(&mail_q, &msg, &msg_size, TOS_TIME_FOREVER);
|
||||
printf("task2: %d %d %x %d %s\n", err, msg_size, msg, ((fuck_t *)msg)->a, ((fuck_t *)msg)->name);
|
||||
}
|
||||
}
|
||||
|
||||
void application_entry(void *arg)
|
||||
{
|
||||
tos_prio_q_create(&prio_q, mgr_entry_array, fuck_pool, sizeof(fuck_t), sizeof(fuck_pool) / sizeof(fuck_t));
|
||||
// tos_bin_heap_create(&bin_heap, int_pool, sizeof(int), sizeof(int_pool) / sizeof(int), int_cmp);
|
||||
// tos_bin_heap_create(&bin_heap, fuck_pool, sizeof(fuck_t), sizeof(fuck_pool) / sizeof(fuck_t), fuck_cmp);
|
||||
|
||||
#if 0
|
||||
tos_ring_q_create(&ring_q, ring_q_pool, sizeof(fuck_t), 4);
|
||||
|
||||
tos_chr_fifo_create(&chr_fifo, chr_fifo_pool, sizeof(chr_fifo_pool));
|
||||
|
||||
tos_msg_q_create(&msg_q, msg_q_pool, 4);
|
||||
|
||||
tos_mail_q_create(&mail_q, mail_q_pool, sizeof(fuck_t), 4);
|
||||
#endif
|
||||
|
||||
osThreadCreate(osThread(task1), NULL); // Create task1
|
||||
osThreadCreate(osThread(task2), NULL); // Create task2
|
||||
}
|
||||
|
@@ -35,11 +35,16 @@
|
||||
#include <tos_pm.h>
|
||||
#include <tos_pend.h>
|
||||
#include <tos_sys.h>
|
||||
#include <tos_fifo.h>
|
||||
#include <tos_ring_queue.h>
|
||||
#include <tos_char_fifo.h>
|
||||
#include <tos_mail_queue.h>
|
||||
#include <tos_message_queue.h>
|
||||
#include <tos_binary_heap.h>
|
||||
#include <tos_priority_queue.h>
|
||||
#include <tos_priority_mail_queue.h>
|
||||
#include <tos_priority_message_queue.h>
|
||||
#include <tos_task.h>
|
||||
#include <tos_robin.h>
|
||||
#include <tos_msg.h>
|
||||
#include <tos_queue.h>
|
||||
#include <tos_mutex.h>
|
||||
#include <tos_sem.h>
|
||||
#include <tos_event.h>
|
||||
|
149
kernel/core/include/tos_binary_heap.h
Normal file
149
kernel/core/include/tos_binary_heap.h
Normal file
@@ -0,0 +1,149 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _TOS_BINARY_HEAP_H_
|
||||
#define _TOS_BINARY_HEAP_H_
|
||||
|
||||
typedef int (*k_bin_heap_cmp)(void *first, void *second);
|
||||
|
||||
typedef struct k_binary_heap_st {
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_obj_t knl_obj;
|
||||
#endif
|
||||
|
||||
size_t total;
|
||||
|
||||
k_bin_heap_cmp cmp;
|
||||
size_t item_size;
|
||||
size_t item_cnt;
|
||||
uint8_t *pool;
|
||||
} k_bin_heap_t;
|
||||
|
||||
#define BIN_HEAP_FIRST_ITEM(bin_heap) (void *)(&bin_heap->pool[0])
|
||||
#define BIN_HEAP_LAST_ITEM(bin_heap) (void *)(&bin_heap->pool[bin_heap->total * bin_heap->item_size])
|
||||
#define BIN_HEAP_THE_ITEM(bin_heap, index) (void *)(&bin_heap->pool[index * bin_heap->item_size])
|
||||
|
||||
#define BIN_HEAP_PARENT(index) ((index - 1) / 2)
|
||||
#define BIN_HEAP_RCHILD(index) (2 * (index + 1))
|
||||
#define BIN_HEAP_LSIBLING(index) (index - 1)
|
||||
|
||||
/**
|
||||
* @brief Create a binary heap.
|
||||
* create a binary heap.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] bin_heap pointer to the handler of the binary heap.
|
||||
* @param[in] pool pool buffer of the binary heap.
|
||||
* @param[in] item_cnt item count of the binary heap.
|
||||
* @param[in] item_size size of each item of the binary heap.
|
||||
* @param[in] cmp compare function to determine two items which is bigger or smaller.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_bin_heap_create(k_bin_heap_t *bin_heap, void *pool, size_t item_cnt, size_t item_size, k_bin_heap_cmp cmp);
|
||||
|
||||
/**
|
||||
* @brief Destroy a binary heap.
|
||||
* destroy a binary heap.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] bin_heap pointer to the handler of the binary heap.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_bin_heap_destroy(k_bin_heap_t *bin_heap);
|
||||
|
||||
/**
|
||||
* @brief Push an item.
|
||||
* push an item into the binary heap.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] bin_heap pointer to the handler of the binary heap.
|
||||
* @param[in] item the item to be pushed.
|
||||
* @param[in] item_size size of the item(should be consistent with the item_size passed to tos_bin_heap_create).
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
* @retval #K_ERR_BIN_HEAP_ITEM_SIZE_NOT_MATCH the item_size is not consistent with the item_size passed to tos_bin_heap_create.
|
||||
* @retval #K_ERR_BIN_HEAP_FULL the binary heap is full.
|
||||
*/
|
||||
__API__ k_err_t tos_bin_heap_push(k_bin_heap_t *bin_heap, void *item, size_t item_size);
|
||||
|
||||
/**
|
||||
* @brief Pop an item.
|
||||
* pop an item from the binary heap.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] bin_heap pointer to the handler of the binary heap.
|
||||
* @param[out] item buffer to hold the item poped.
|
||||
* @param[out] item_size size of the item poped(should be consistent with the item_size passed to tos_bin_heap_create).
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
* @retval #K_ERR_BIN_HEAP_EMPTY the ring queue is empty.
|
||||
*/
|
||||
__API__ k_err_t tos_bin_heap_pop(k_bin_heap_t *bin_heap, void *item, size_t *item_size);
|
||||
|
||||
/**
|
||||
* @brief Flush the binary heap.
|
||||
* flush the binary heap.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] bin_heap pointer to the handler of the binary heap.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_bin_heap_flush(k_bin_heap_t *bin_heap);
|
||||
|
||||
/**
|
||||
* @brief Whether the binary heap is empty.
|
||||
* Whether the binary heap is empty.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] bin_heap pointer to the handler of the binary heap.
|
||||
*
|
||||
* @return whether the binary heap is emtpy.
|
||||
* @retval #0 the binary heap is not empty.
|
||||
* @retval #Not 0 the binary heap is empty.
|
||||
*/
|
||||
__API__ int tos_bin_heap_is_empty(k_bin_heap_t *bin_heap);
|
||||
|
||||
/**
|
||||
* @brief Whether the binary heap is full.
|
||||
* Whether the binary heap is full.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] bin_heap pointer to the handler of the binary heap.
|
||||
*
|
||||
* @return whether the binary hea is full.
|
||||
* @retval #0 the binary hea is not full.
|
||||
* @retval #Not 0 the binary hea is full.
|
||||
*/
|
||||
__API__ int tos_bin_heap_is_full(k_bin_heap_t *bin_heap);
|
||||
|
||||
#endif /* _TOS_BINARY_HEAP_H_ */
|
||||
|
159
kernel/core/include/tos_char_fifo.h
Normal file
159
kernel/core/include/tos_char_fifo.h
Normal file
@@ -0,0 +1,159 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _TOS_CHAR_FIFO_H_
|
||||
#define _TOS_CHAR_FIFO_H_
|
||||
|
||||
typedef struct k_char_fifo_st {
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_obj_t knl_obj;
|
||||
#endif
|
||||
|
||||
k_ring_q_t ring_q;
|
||||
} k_chr_fifo_t;
|
||||
|
||||
/**
|
||||
* @brief Create a character fifo.
|
||||
* Create a character fifo.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] fifo pointer to the handler of the fifo.
|
||||
* @param[in] buffer memory buffer provided to be as the inner buffer.
|
||||
* @param[in] size size of the memory buffer.
|
||||
*
|
||||
* @return errno
|
||||
* @retval #K_ERR_OBJ_PTR_NULL fifo is a NULL pointer.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_chr_fifo_create(k_chr_fifo_t *chr_fifo, void *buffer, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Destroy a character fifo.
|
||||
* Destroy a character fifo.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] fifo pointer to the handler of the fifo.
|
||||
*
|
||||
* @return errno
|
||||
* @retval #K_ERR_OBJ_PTR_NULL fifo is a NULL pointer.
|
||||
* @retval #K_ERR_OBJ_INVALID not a valid pointer to a fifo.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_chr_fifo_destroy(k_chr_fifo_t *chr_fifo);
|
||||
|
||||
/**
|
||||
* @brief Push data into character fifo.
|
||||
* Push one single data into the character fifo.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] fifo pointer to the handler of the character fifo.
|
||||
* @param[in] data data to push into the fifo.
|
||||
*
|
||||
* @return errno
|
||||
* @retval #K_ERR_RING_Q_FULL the character fifo is full.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_chr_fifo_push(k_chr_fifo_t *chr_fifo, uint8_t data);
|
||||
|
||||
/**
|
||||
* @brief Push stream into character fifo.
|
||||
* Push a stream data into the character fifo.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] fifo pointer to the handler of the character fifo.
|
||||
* @param[IN] stream stream to be pushed into the character fifo.
|
||||
* @param[OUT] size size of the stream.
|
||||
*
|
||||
* @return the actual number of the data pushed into the character fifo.
|
||||
*/
|
||||
__API__ int tos_chr_fifo_push_stream(k_chr_fifo_t *chr_fifo, uint8_t *stream, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Pop data from character fifo.
|
||||
* Pop one single data from the character fifo.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] fifo pointer to the handler of the character fifo.
|
||||
* @param[OUT] out one signle buffer to hold the data poped from the character fifo.
|
||||
*
|
||||
* @return errno
|
||||
* @retval #K_ERR_FIFO_EMPTY the character fifo is empty.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_chr_fifo_pop(k_chr_fifo_t *chr_fifo, uint8_t *out);
|
||||
|
||||
/**
|
||||
* @brief Pop stream from character fifo.
|
||||
* Pop a stream data from the character fifo.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] fifo pointer to the handler of the character fifo.
|
||||
* @param[OUT] buffer pointer to the buffer to receive the stream poped.
|
||||
* @param[OUT] size size of the buffer.
|
||||
*
|
||||
* @return the actual number of the data poped from the character fifo.
|
||||
*/
|
||||
__API__ int tos_chr_fifo_pop_stream(k_chr_fifo_t *chr_fifo, uint8_t *buffer, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Flush character fifo.
|
||||
* Flush/reset the character fifo.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] fifo pointer to the handler of the character fifo.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
__API__ k_err_t tos_chr_fifo_flush(k_chr_fifo_t *chr_fifo);
|
||||
|
||||
/**
|
||||
* @brief Whether the character fifo is empty.
|
||||
* Whether the character fifo is empty.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] fifo pointer to the handler of the character fifo.
|
||||
*
|
||||
* @return whether the character fifo is emtpy.
|
||||
* @retval #0 the character fifo is not empty.
|
||||
* @retval #Not 0 the character fifo is empty.
|
||||
*/
|
||||
__API__ int tos_chr_fifo_is_empty(k_chr_fifo_t *chr_fifo);
|
||||
|
||||
/**
|
||||
* @brief Whether the character fifo is full.
|
||||
* Whether the character fifo is full.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] fifo pointer to the handler of the character fifo.
|
||||
*
|
||||
* @return whether the character fifo is full.
|
||||
* @retval #0 the character fifo is not full.
|
||||
* @retval #Not 0 the character fifo is full.
|
||||
*/
|
||||
__API__ int tos_chr_fifo_is_full(k_chr_fifo_t *chr_fifo);
|
||||
|
||||
#endif // _TOS_CHAR_FIFO_H_
|
||||
|
@@ -44,8 +44,12 @@
|
||||
#error "INVALID config, must enable TOS_CFG_MMHEAP_EN to support dynamic task create"
|
||||
#endif
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u) && (TOS_CFG_MSG_EN == 0u)
|
||||
#error "INVALID config, must enable TOS_CFG_MSG_EN to use tos_queue"
|
||||
#if (TOS_CFG_PRIORITY_MESSAGE_QUEUE_EN > 0u) && (TOS_CFG_MMHEAP_EN == 0u)
|
||||
#error "INVALID config, must enable TOS_CFG_MMHEAP_EN to support tos_prio_msg_q"
|
||||
#endif
|
||||
|
||||
#if (TOS_CFG_PRIORITY_MAIL_QUEUE_EN > 0u) && (TOS_CFG_MMHEAP_EN == 0u)
|
||||
#error "INVALID config, must enable TOS_CFG_MMHEAP_EN to support tos_prio_mail_q"
|
||||
#endif
|
||||
|
||||
#if ((TOS_CFG_TIMER_EN > 0u) && !defined(TOS_CFG_TIMER_AS_PROC))
|
||||
|
@@ -60,15 +60,6 @@
|
||||
/////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////
|
||||
// disable queue
|
||||
#ifdef TOS_CFG_QUEUE_EN
|
||||
#undef TOS_CFG_QUEUE_EN
|
||||
#endif
|
||||
#define TOS_CFG_QUEUE_EN 0u
|
||||
/////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////
|
||||
// disable semaphore
|
||||
#ifdef TOS_CFG_SEM_EN
|
||||
@@ -195,8 +186,20 @@
|
||||
#define TOS_CFG_MUTEX_EN 0u
|
||||
#endif
|
||||
|
||||
#ifndef TOS_CFG_QUEUE_EN
|
||||
#define TOS_CFG_QUEUE_EN 0u
|
||||
#ifndef TOS_CFG_MESSAGE_QUEUE_EN
|
||||
#define TOS_CFG_MESSAGE_QUEUE_EN 0u
|
||||
#endif
|
||||
|
||||
#ifndef TOS_CFG_MAIL_QUEUE_EN
|
||||
#define TOS_CFG_MAIL_QUEUE_EN 0u
|
||||
#endif
|
||||
|
||||
#ifndef TOS_CFG_PRIORITY_MESSAGE_QUEUE_EN
|
||||
#define TOS_CFG_PRIORITY_MESSAGE_QUEUE_EN 0u
|
||||
#endif
|
||||
|
||||
#ifndef TOS_CFG_PRIORITY_MAIL_QUEUE_EN
|
||||
#define TOS_CFG_PRIORITY_MAIL_QUEUE_EN 0u
|
||||
#endif
|
||||
|
||||
#ifndef TOS_CFG_SEM_EN
|
||||
@@ -211,12 +214,6 @@
|
||||
#define TOS_CFG_COMPLETION_EN 0u
|
||||
#endif
|
||||
|
||||
#if (TOS_CFG_QUEUE_EN > 0u) && !defined(TOS_CFG_MSG_EN)
|
||||
#define TOS_CFG_MSG_EN 1u
|
||||
#elif (TOS_CFG_QUEUE_EN == 0u) && !defined(TOS_CFG_MSG_EN)
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#ifndef TOS_CFG_TIMER_EN
|
||||
#define TOS_CFG_TIMER_EN 0u
|
||||
#endif
|
||||
@@ -225,10 +222,6 @@
|
||||
#define TOS_CFG_TIMER_AS_PROC 0u
|
||||
#endif
|
||||
|
||||
#ifndef TOS_CFG_MSG_POOL_SIZE
|
||||
#define TOS_CFG_MSG_POOL_SIZE 100u
|
||||
#endif
|
||||
|
||||
#ifndef TOS_CFG_IDLE_TASK_STK_SIZE
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 128u
|
||||
#endif
|
||||
|
@@ -21,6 +21,10 @@
|
||||
typedef enum k_err_en {
|
||||
K_ERR_NONE = 0u,
|
||||
|
||||
K_ERR_BIN_HEAP_FULL = 10u,
|
||||
K_ERR_BIN_HEAP_EMPTY,
|
||||
K_ERR_BIN_HEAP_ITEM_SIZE_NOT_MATCH,
|
||||
|
||||
K_ERR_COMPLETION_OVERFLOW = 25u,
|
||||
|
||||
K_ERR_COUNTDOWNLATCH_OVERFLOW = 50u,
|
||||
@@ -30,9 +34,6 @@ typedef enum k_err_en {
|
||||
|
||||
K_ERR_EVENT_PEND_OPT_INVALID = 200u,
|
||||
|
||||
K_ERR_FIFO_FULL = 300u,
|
||||
K_ERR_FIFO_EMPTY,
|
||||
|
||||
K_ERR_IN_IRQ = 400u,
|
||||
|
||||
K_ERR_KNL_NOT_RUNNING = 500u,
|
||||
@@ -51,10 +52,6 @@ typedef enum k_err_en {
|
||||
K_ERR_MMHEAP_POOL_ALREADY_EXIST,
|
||||
K_ERR_MMHEAP_POOL_NOT_EXIST,
|
||||
|
||||
K_ERR_MSG_QUEUE_FULL = 900u,
|
||||
K_ERR_MSG_QUEUE_EMPTY,
|
||||
K_ERR_MSG_QUEUE_MSG_NOT_EXIST,
|
||||
|
||||
K_ERR_MUTEX_NOT_OWNER = 1000u,
|
||||
K_ERR_MUTEX_NESTING,
|
||||
K_ERR_MUTEX_NESTING_OVERFLOW,
|
||||
@@ -62,15 +59,9 @@ typedef enum k_err_en {
|
||||
K_ERR_OBJ_PTR_NULL = 1100u,
|
||||
K_ERR_OBJ_INVALID,
|
||||
|
||||
K_ERR_PM_DEVICE_ALREADY_REG = 1200u,
|
||||
K_ERR_PM_DEVICE_OVERFLOW = 1300u,
|
||||
K_ERR_PM_WKUP_SOURCE_NOT_INSTALL = 1400u,
|
||||
K_ERR_OUT_OF_MEMORY = 1150u,
|
||||
|
||||
K_ERR_QUEUE_EMPTY = 1500u,
|
||||
K_ERR_QUEUE_FULL,
|
||||
K_ERR_QUEUE_MSG_NOT_EXIST,
|
||||
|
||||
K_ERR_PEND_NOWAIT = 1600u,
|
||||
K_ERR_PEND_NOWAIT = 1200u,
|
||||
K_ERR_PEND_SCHED_LOCKED,
|
||||
K_ERR_PEND_IN_IRQ,
|
||||
K_ERR_PEND_ABNORMAL,
|
||||
@@ -78,6 +69,19 @@ typedef enum k_err_en {
|
||||
K_ERR_PEND_DESTROY,
|
||||
K_ERR_PEND_OWNER_DIE,
|
||||
|
||||
K_ERR_PM_DEVICE_ALREADY_REG = 1300u,
|
||||
K_ERR_PM_DEVICE_OVERFLOW,
|
||||
K_ERR_PM_WKUP_SOURCE_NOT_INSTALL,
|
||||
|
||||
K_ERR_PRIO_Q_EMPTY = 1400u,
|
||||
K_ERR_PRIO_Q_FULL,
|
||||
K_ERR_PRIO_Q_SLOT_NOT_TAKEN,
|
||||
K_ERR_PRIO_Q_ITEM_SIZE_NOT_MATCH,
|
||||
|
||||
K_ERR_RING_Q_FULL = 1600u,
|
||||
K_ERR_RING_Q_EMPTY,
|
||||
K_ERR_RING_Q_ITEM_SIZE_NOT_MATCH,
|
||||
|
||||
K_ERR_SCHED_LOCKED = 1700u,
|
||||
K_ERR_SCHED_NOT_LOCKED,
|
||||
|
||||
|
@@ -1,163 +0,0 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _TOS_FIFO_H_
|
||||
#define _TOS_FIFO_H_
|
||||
|
||||
typedef struct k_fifo_st {
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_obj_t knl_obj;
|
||||
#endif
|
||||
|
||||
int beg;
|
||||
int end;
|
||||
size_t cnt;
|
||||
uint8_t *buf;
|
||||
size_t siz;
|
||||
} k_fifo_t;
|
||||
|
||||
/**
|
||||
* @brief Create a fifo.
|
||||
* Create a fifo.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] fifo pointer to the handler of the fifo.
|
||||
* @param[in] buffer memory buffer provided to be as the inner buffer.
|
||||
* @param[in] size size of the memory buffer.
|
||||
*
|
||||
* @return errno
|
||||
* @retval #K_ERR_OBJ_PTR_NULL fifo is a NULL pointer.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_fifo_create(k_fifo_t *fifo, uint8_t *buffer, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Destroy a fifo.
|
||||
* Destroy a fifo.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] fifo pointer to the handler of the fifo.
|
||||
*
|
||||
* @return errno
|
||||
* @retval #K_ERR_OBJ_PTR_NULL fifo is a NULL pointer.
|
||||
* @retval #K_ERR_OBJ_INVALID not a valid pointer to a fifo.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_fifo_destroy(k_fifo_t *fifo);
|
||||
|
||||
/**
|
||||
* @brief Push data into fifo.
|
||||
* Push one single data into the fifo.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] fifo pointer to the handler of the fifo.
|
||||
* @param[in] data data to push into the fifo.
|
||||
*
|
||||
* @return errno
|
||||
* @retval #K_ERR_FIFO_FULL the fifo is full.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_fifo_push(k_fifo_t *fifo, uint8_t data);
|
||||
|
||||
/**
|
||||
* @brief Push stream into fifo.
|
||||
* Push a stream data into the fifo.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] fifo pointer to the handler of the fifo.
|
||||
* @param[IN] stream stream to be pushed into the fifo.
|
||||
* @param[OUT] size size of the stream.
|
||||
*
|
||||
* @return the actual number of the data pushed into the fifo.
|
||||
*/
|
||||
__API__ int tos_fifo_push_stream(k_fifo_t *fifo, uint8_t *stream, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Pop data from fifo.
|
||||
* Pop one single data from the fifo.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] fifo pointer to the handler of the fifo.
|
||||
* @param[OUT] out one signle buffer to hold the data poped from the fifo.
|
||||
*
|
||||
* @return errno
|
||||
* @retval #K_ERR_FIFO_EMPTY the fifo is empty.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_fifo_pop(k_fifo_t *fifo, uint8_t *out);
|
||||
|
||||
/**
|
||||
* @brief Pop stream from fifo.
|
||||
* Pop a stream data from the fifo.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] fifo pointer to the handler of the fifo.
|
||||
* @param[OUT] buffer pointer to the buffer to receive the stream poped.
|
||||
* @param[OUT] size size of the buffer.
|
||||
*
|
||||
* @return the actual number of the data poped from the fifo.
|
||||
*/
|
||||
__API__ int tos_fifo_pop_stream(k_fifo_t *fifo, uint8_t *buffer, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Flush fifo.
|
||||
* Flush/reset the fifo.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] fifo pointer to the handler of the fifo.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
__API__ void tos_fifo_flush(k_fifo_t *fifo);
|
||||
|
||||
/**
|
||||
* @brief Whether the fifo is empty.
|
||||
* Whether the fifo is empty.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] fifo pointer to the handler of the fifo.
|
||||
*
|
||||
* @return whether the fifo is emtpy.
|
||||
* @retval #0 the fifo is not empty.
|
||||
* @retval #Not 0 the fifo is empty.
|
||||
*/
|
||||
__API__ int tos_fifo_is_empty(k_fifo_t *fifo);
|
||||
|
||||
/**
|
||||
* @brief Whether the fifo is full.
|
||||
* Whether the fifo is full.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] fifo pointer to the handler of the fifo.
|
||||
*
|
||||
* @return whether the fifo is full.
|
||||
* @retval #0 the fifo is not full.
|
||||
* @retval #Not 0 the fifo is full.
|
||||
*/
|
||||
__API__ int tos_fifo_is_full(k_fifo_t *fifo);
|
||||
|
||||
#endif // _TOS_FIFO_H_
|
||||
|
@@ -90,11 +90,6 @@ extern size_t const k_timer_task_stk_size;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (TOS_CFG_MSG_EN > 0u)
|
||||
extern k_list_t k_msg_freelist;
|
||||
extern k_msg_t k_msg_pool[];
|
||||
#endif
|
||||
|
||||
#if TOS_CFG_PWR_MGR_EN > 0u
|
||||
extern pm_device_ctl_t k_pm_device_ctl;
|
||||
|
||||
|
@@ -51,5 +51,17 @@
|
||||
printf(__VA_ARGS__); \
|
||||
printf("\n");
|
||||
|
||||
#define TOS_ASSERT_AUX(exp, function, line) \
|
||||
if (!(exp)) { \
|
||||
tos_kprintln("assert failed: %s %d\n", function, line); \
|
||||
tos_knl_sched_lock(); \
|
||||
tos_cpu_int_disable(); \
|
||||
while (K_TRUE) { \
|
||||
; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define TOS_ASSERT(exp) TOS_ASSERT_AUX(exp, __FUNCTION__, __LINE__)
|
||||
|
||||
#endif /* _TOS_KLIB_H_ */
|
||||
|
||||
|
125
kernel/core/include/tos_mail_queue.h
Normal file
125
kernel/core/include/tos_mail_queue.h
Normal file
@@ -0,0 +1,125 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _TOS_MAIL_QUEUE_H_
|
||||
#define _TOS_MAIL_QUEUE_H_
|
||||
|
||||
#if TOS_CFG_MAIL_QUEUE_EN > 0u
|
||||
|
||||
typedef struct k_mail_queue_st {
|
||||
pend_obj_t pend_obj;
|
||||
k_ring_q_t ring_q;
|
||||
} k_mail_q_t;
|
||||
|
||||
/**
|
||||
* @brief Create a mail queue.
|
||||
* create a mail queue.
|
||||
*
|
||||
* @attention a MAIL is a buffer with a certain size.
|
||||
*
|
||||
* @param[in] mail_q pointer to the handler of the mail queue.
|
||||
* @param[in] pool pool buffer of the mail queue.
|
||||
* @param[in] mail_cnt mail count of the mail queue.
|
||||
* @param[in] mail_size size of each mail in the mail queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_mail_q_create(k_mail_q_t *mail_q, void *pool, size_t mail_cnt, size_t mail_size);
|
||||
|
||||
/**
|
||||
* @brief Destroy a mail queue.
|
||||
* destroy a mail queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] mail_q pointer to the handler of the mail queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_mail_q_destroy(k_mail_q_t *mail_q);
|
||||
|
||||
/**
|
||||
* @brief Flush the mail queue.
|
||||
* flush the mail queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] mail_q pointer to the handler of the mail queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_mail_q_flush(k_mail_q_t *mail_q);
|
||||
|
||||
/**
|
||||
* @brief Pend a mail queue.
|
||||
* pend a mail queue.
|
||||
*
|
||||
* @attention we WILL perform a memcpy when mail_buf is received(a MAIL is a buffer with a certain size).
|
||||
*
|
||||
* @param[in] mail_q pointer to the handler of the mail queue.
|
||||
* @param[OUT] mail_buf a pointer to the mail buffer we wanna receive.
|
||||
* @param[OUT] mail_size size of the mail buffer received(should be consistent with the mail_size passed to tos_mail_q_create).
|
||||
* @param[in] timeout how much time(in k_tick_t) we would like to wait.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_PEND_NOWAIT we get nothing, and we don't wanna wait.
|
||||
* @retval #K_ERR_PEND_SCHED_LOCKED we can wait, but scheduler is locked.
|
||||
* @retval #K_ERR_PEND_TIMEOUT the time we wait is up, we get nothing.
|
||||
* @retval #K_ERR_PEND_DESTROY the queue we are pending is destroyed.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_mail_q_pend(k_mail_q_t *mail_q, void *mail_buf, size_t *mail_size, k_tick_t timeout);
|
||||
|
||||
/**
|
||||
* @brief Post a mail queue.
|
||||
* post a mail queue and wakeup one pending task.
|
||||
*
|
||||
* @attention when tos_mail_q_post return successfully, only one task who are waitting for the mail queue will be woken up.
|
||||
*
|
||||
* @param[in] mail_q pointer to the handler of the mail queue.
|
||||
* @param[in] mail_buf the mail to post(a MAIL is a buffer).
|
||||
* @param[in] mail_size the size of the mail to post(a MAIL is just a buffer).
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_RING_Q_FULL the mail queue is full.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_mail_q_post(k_mail_q_t *mail_q, void *mail_buf, size_t mail_size);
|
||||
|
||||
/**
|
||||
* @brief Post a mail queue.
|
||||
* post a mail queue and wakeup all the pending task.
|
||||
*
|
||||
* @attention when tos_mail_q_post_all return successfully, all of the tasks who are waitting for the message queue will be woken up.
|
||||
*
|
||||
* @param[in] mail_q pointer to the handler of the mail queue.
|
||||
* @param[in] mail_buf the mail to post(a MAIL is a buffer).
|
||||
* @param[in] mail_size the size of the mail to post(a MAIL is just a buffer).
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_RING_Q_FULL the mail queue is full.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_mail_q_post_all(k_mail_q_t *mail_q, void *mail_buf, size_t mail_size);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _TOS_MAIL_QUEUE_H_ */
|
||||
|
121
kernel/core/include/tos_message_queue.h
Normal file
121
kernel/core/include/tos_message_queue.h
Normal file
@@ -0,0 +1,121 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _TOS_MESSAGE_QUEUE_H_
|
||||
#define _TOS_MESSAGE_QUEUE_H_
|
||||
|
||||
#if TOS_CFG_MESSAGE_QUEUE_EN > 0u
|
||||
|
||||
typedef struct k_message_queue_st {
|
||||
pend_obj_t pend_obj;
|
||||
k_ring_q_t ring_q;
|
||||
} k_msg_q_t;
|
||||
|
||||
/**
|
||||
* @brief Create a message queue.
|
||||
* create a message queue.
|
||||
*
|
||||
* @attention a MESSAGE is a "void *" pointer.
|
||||
*
|
||||
* @param[in] msg_q pointer to the handler of the message queue.
|
||||
* @param[in] pool pool buffer of the message queue.
|
||||
* @param[in] msg_cnt message count of the message queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_msg_q_create(k_msg_q_t *msg_q, void *pool, size_t msg_cnt);
|
||||
|
||||
/**
|
||||
* @brief Destroy a message queue.
|
||||
* destroy a message queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] msg_q pointer to the handler of the message queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_msg_q_destroy(k_msg_q_t *msg_q);
|
||||
|
||||
/**
|
||||
* @brief Flush the message queue.
|
||||
* flush the message queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] msg_q pointer to the handler of the message queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_msg_q_flush(k_msg_q_t *msg_q);
|
||||
|
||||
/**
|
||||
* @brief Pend a message queue.
|
||||
* pend a message queue.
|
||||
*
|
||||
* @attention we DONNOT perform a memcpy when msg_ptr is received(a MESSAGE is just a pointer).
|
||||
*
|
||||
* @param[in] msg_q pointer to the handler of the message queue.
|
||||
* @param[OUT] msg_ptr a pointer to the message we wanna receive.
|
||||
* @param[in] timeout how much time(in k_tick_t) we would like to wait.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_PEND_NOWAIT we get nothing, and we don't wanna wait.
|
||||
* @retval #K_ERR_PEND_SCHED_LOCKED we can wait, but scheduler is locked.
|
||||
* @retval #K_ERR_PEND_TIMEOUT the time we wait is up, we get nothing.
|
||||
* @retval #K_ERR_PEND_DESTROY the queue we are pending is destroyed.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_msg_q_pend(k_msg_q_t *msg_q, void **msg_ptr, k_tick_t timeout);
|
||||
|
||||
/**
|
||||
* @brief Post a message queue.
|
||||
* post a message queue and wakeup one pending task.
|
||||
*
|
||||
* @attention when tos_msg_q_post return successfully, only one task who are waitting for the message queue will be woken up.
|
||||
*
|
||||
* @param[in] msg_q pointer to the handler of the message queue.
|
||||
* @param[in] msg_ptr the message to post(a MESSAGE is just a pointer).
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_RING_Q_FULL the message queue is full.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_msg_q_post(k_msg_q_t *msg_q, void *msg_ptr);
|
||||
|
||||
/**
|
||||
* @brief Post a message queue.
|
||||
* post a message queue and wakeup all the pending task.
|
||||
*
|
||||
* @attention when tos_msg_q_post_all return successfully, all of the tasks who are waitting for the message queue will be woken up.
|
||||
*
|
||||
* @param[in] msg_q pointer to the handler of the message queue.
|
||||
* @param[in] msg_ptr the message to post(a MESSAGE is just a pointer).
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_RING_Q_FULL the message queue is full.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_msg_q_post_all(k_msg_q_t *msg_q, void *msg_ptr);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _TOS_MESSAGE_QUEUE_H_ */
|
||||
|
@@ -1,129 +0,0 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _TOS_MSG_H_
|
||||
#define _TOS_MSG_H_
|
||||
|
||||
#define TOS_OPT_MSG_PUT_LIFO (k_opt_t)0x0001
|
||||
#define TOS_OPT_MSG_PUT_FIFO (k_opt_t)0x0002
|
||||
|
||||
typedef struct k_message_st {
|
||||
k_list_t list;
|
||||
void *msg_addr;
|
||||
size_t msg_size;
|
||||
} k_msg_t;
|
||||
|
||||
typedef struct k_msg_queue_st {
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_obj_t knl_obj;
|
||||
#endif
|
||||
|
||||
k_list_t queue_head;
|
||||
} k_msg_queue_t;
|
||||
|
||||
/**
|
||||
* @brief Create a message queue.
|
||||
* Initialize a message queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[IN] msg_queue the pointer to the handler of the message queue.
|
||||
*
|
||||
* @return errcode.
|
||||
* @retval #K_ERR_OBJ_PTR_NULL msg_queue is a null pointer
|
||||
* @retval #K_ERR_NONE return successfully
|
||||
*/
|
||||
__API__ k_err_t tos_msg_queue_create(k_msg_queue_t *msg_queue);
|
||||
|
||||
/**
|
||||
* @brief Destroy a message queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[IN] msg_queue the pointer to the handler of the message queue.
|
||||
*
|
||||
* @return errcode.
|
||||
* @retval #K_ERR_OBJ_PTR_NULL msg_queue is a null pointer
|
||||
* @retval #K_ERR_OBJ_INVALID msg_queue is not a valid pointer to a message queue
|
||||
* @retval #K_ERR_NONE return successfully
|
||||
*/
|
||||
__API__ k_err_t tos_msg_queue_destroy(k_msg_queue_t *msg_queue);
|
||||
|
||||
/**
|
||||
* @brief Get a message.
|
||||
* Get a message from the queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[IN] msg_queue the pointer to the handler of the message queue.
|
||||
* @param[OUT] msg_body the pointer to the body of the message.
|
||||
* @param[OUT] msg_size the pointer to the size of the message.
|
||||
*
|
||||
* @return errcode.
|
||||
* @retval #K_ERR_QUEUE_EMPTY the queue is empty.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_msg_queue_get(k_msg_queue_t *msg_queue, void **msg_addr, size_t *msg_size);
|
||||
|
||||
/**
|
||||
* @brief Put a message.
|
||||
* Put a message to the queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[IN] msg_queue the pointer to the handler of the message queue.
|
||||
* @param[IN] msg_body the pointer to the body of the message.
|
||||
* @param[IN] msg_size the pointer to the size of the message.
|
||||
* @param[IN] opt option for the function call.
|
||||
*
|
||||
* @return errcode.
|
||||
* @retval #K_ERR_QUEUE_FULL the queue is full.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_msg_queue_put(k_msg_queue_t *msg_queue, void *msg_addr, size_t msg_size, k_opt_t opt);
|
||||
|
||||
/**
|
||||
* @brief Remove one message from the message queue.
|
||||
* Remove one message with certain address from the message queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[IN] msg_queue the pointer to the handler of the message queue.
|
||||
* @param[IN] msg_addr the address of the message.
|
||||
*
|
||||
* @return errcode.
|
||||
* @retval #K_ERR_MSG_QUEUE_MSG_NOT_EXIST message to remove is not existed
|
||||
* @retval #K_ERR_NONE return successfully
|
||||
*/
|
||||
__API__ k_err_t tos_msg_queue_remove(k_msg_queue_t *msg_queue, void *msg_addr);
|
||||
|
||||
/**
|
||||
* @brief Flush all of the messages.
|
||||
* Flush all of the messages in the queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[IN] msg_queue the pointer to the handler of the message queue.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
__API__ void tos_msg_queue_flush(k_msg_queue_t *msg_queue);
|
||||
|
||||
__KERNEL__ void msgpool_init(void);
|
||||
|
||||
#endif /* _TOS_MSG_H_ */
|
||||
|
@@ -37,13 +37,16 @@ typedef enum pend_state_en {
|
||||
is initialized, or whether user pass the correct parameter.
|
||||
*/
|
||||
typedef enum pend_type_en {
|
||||
PEND_TYPE_NONE = 0x0000,
|
||||
PEND_TYPE_SEM = 0x1BEE,
|
||||
PEND_TYPE_MUTEX = 0x2BEE,
|
||||
PEND_TYPE_EVENT = 0x3BEE,
|
||||
PEND_TYPE_QUEUE = 0x4BEE,
|
||||
PEND_TYPE_COUNTDOWNLATCH = 0x5BEE,
|
||||
PEND_TYPE_COMPLETION = 0x6BEE,
|
||||
PEND_TYPE_NONE = 0x0000,
|
||||
PEND_TYPE_SEM = 0x1BEE,
|
||||
PEND_TYPE_MUTEX = 0x2BEE,
|
||||
PEND_TYPE_EVENT = 0x3BEE,
|
||||
PEND_TYPE_MAIL_QUEUE = 0x4BEE,
|
||||
PEND_TYPE_MESSAGE_QUEUE = 0x5BEE,
|
||||
PEND_TYPE_PRIORITY_MAIL_QUEUE = 0x6BEE,
|
||||
PEND_TYPE_PRIORITY_MESSAGE_QUEUE = 0x7BEE,
|
||||
PEND_TYPE_COUNTDOWNLATCH = 0x8BEE,
|
||||
PEND_TYPE_COMPLETION = 0x9BEE,
|
||||
} pend_type_t;
|
||||
|
||||
typedef enum opt_post_en {
|
||||
|
133
kernel/core/include/tos_priority_mail_queue.h
Normal file
133
kernel/core/include/tos_priority_mail_queue.h
Normal file
@@ -0,0 +1,133 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _TOS_PRIORITY_MAIL_QUEUE_H_
|
||||
#define _TOS_PRIORITY_MAIL_QUEUE_H_
|
||||
|
||||
#if TOS_CFG_PRIORITY_MAIL_QUEUE_EN > 0u
|
||||
|
||||
typedef struct k_priority_mail_queue_st {
|
||||
pend_obj_t pend_obj;
|
||||
|
||||
void *prio_q_mgr_array;
|
||||
k_prio_q_t prio_q;
|
||||
} k_prio_mail_q_t;
|
||||
|
||||
/**
|
||||
* @brief Create a priority mail queue.
|
||||
* create a priority mail queue.
|
||||
*
|
||||
* @attention a MAIL is a buffer with a certain size.
|
||||
*
|
||||
* @param[in] prio_mail_q pointer to the handler of the priority mail queue.
|
||||
* @param[in] pool pool buffer of the priority mail queue.
|
||||
* @param[in] mail_cnt mail count of the priority mail queue.
|
||||
* @param[in] mail_size size of each mail in the priority mail queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_prio_mail_q_create(k_prio_mail_q_t *prio_mail_q, void *pool, size_t mail_cnt, size_t mail_size);
|
||||
|
||||
/**
|
||||
* @brief Destroy a priority mail queue.
|
||||
* destroy a priority mail queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] prio_mail_q pointer to the handler of the priority mail queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_prio_mail_q_destroy(k_prio_mail_q_t *prio_mail_q);
|
||||
|
||||
/**
|
||||
* @brief Flush the priority mail queue.
|
||||
* flush the priority mail queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] prio_mail_q pointer to the handler of the priority mail queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_prio_mail_q_flush(k_prio_mail_q_t *prio_mail_q);
|
||||
|
||||
/**
|
||||
* @brief Pend a priority mail queue.
|
||||
* pend a priority mail queue.
|
||||
*
|
||||
* @attention
|
||||
* 1. we WILL perform a memcpy when mail_buf is received(a MAIL is a buffer with a certain size).
|
||||
* 2. With priority mail queue, if the poster has post several mail with different priority, the pender will receive
|
||||
* the mail in priority order(numerically bigger, actually smaller, means the mail with highest priority(numerically
|
||||
* smallest) will be received first, then the second highest priority mail, and so on).
|
||||
*
|
||||
* @param[in] prio_mail_q pointer to the handler of the priority mail queue.
|
||||
* @param[OUT] mail_buf a pointer to the mail buffer we wanna receive.
|
||||
* @param[OUT] mail_size size of the mail buffer received(should be consistent with the mail_size passed to tos_prio_mail_q_create).
|
||||
* @param[in] timeout how much time(in k_tick_t) we would like to wait.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_PEND_NOWAIT we get nothing, and we don't wanna wait.
|
||||
* @retval #K_ERR_PEND_SCHED_LOCKED we can wait, but scheduler is locked.
|
||||
* @retval #K_ERR_PEND_TIMEOUT the time we wait is up, we get nothing.
|
||||
* @retval #K_ERR_PEND_DESTROY the queue we are pending is destroyed.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_prio_mail_q_pend(k_prio_mail_q_t *prio_mail_q, void *mail_buf, size_t *mail_size, k_tick_t timeout);
|
||||
|
||||
/**
|
||||
* @brief Post a priority mail queue.
|
||||
* post a priority mail queue and wakeup one pending task.
|
||||
*
|
||||
* @attention when tos_prio_mail_q_post return successfully, only one task who are waitting for the mail queue will be woken up.
|
||||
*
|
||||
* @param[in] prio_mail_q pointer to the handler of the priority mail queue.
|
||||
* @param[in] mail_buf the mail to post(a MAIL is a buffer).
|
||||
* @param[in] mail_size the size of the mail to post(a MAIL is just a buffer).
|
||||
* @param[in] prio the priority of the mail.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_PRIO_Q_FULL the mail queue is full.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_prio_mail_q_post(k_prio_mail_q_t *prio_mail_q, void *mail_buf, size_t mail_size, k_prio_t prio);
|
||||
|
||||
/**
|
||||
* @brief Post a priority mail queue.
|
||||
* post a priority mail queue and wakeup all the pending task.
|
||||
*
|
||||
* @attention when tos_prio_mail_q_post_all return successfully, all of the tasks who are waitting for the message queue will be woken up.
|
||||
*
|
||||
* @param[in] prio_mail_q pointer to the handler of the priority mail queue.
|
||||
* @param[in] mail_buf the mail to post(a MAIL is a buffer).
|
||||
* @param[in] mail_size the size of the mail to post(a MAIL is just a buffer).
|
||||
* @param[in] prio the priority of the mail.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_PRIO_Q_FULL the mail queue is full.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_prio_mail_q_post_all(k_prio_mail_q_t *prio_mail_q, void *mail_buf, size_t mail_size, k_prio_t prio);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* TOS_CFG_PRIORITY_MAIL_QUEUE_EN */
|
||||
|
129
kernel/core/include/tos_priority_message_queue.h
Normal file
129
kernel/core/include/tos_priority_message_queue.h
Normal file
@@ -0,0 +1,129 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _TOS_PRIORITY_MESSAGE_QUEUE_H_
|
||||
#define _TOS_PRIORITY_MESSAGE_QUEUE_H_
|
||||
|
||||
#if TOS_CFG_PRIORITY_MESSAGE_QUEUE_EN > 0u
|
||||
|
||||
typedef struct k_priority_message_queue_st {
|
||||
pend_obj_t pend_obj;
|
||||
|
||||
void *prio_q_mgr_array;
|
||||
k_prio_q_t prio_q;
|
||||
} k_prio_msg_q_t;
|
||||
|
||||
/**
|
||||
* @brief Create a priority message queue.
|
||||
* create a priority message queue.
|
||||
*
|
||||
* @attention a MESSAGE is a "void *" pointer.
|
||||
*
|
||||
* @param[in] prio_msg_q pointer to the handler of the priority message queue.
|
||||
* @param[in] pool pool buffer of the priority message queue.
|
||||
* @param[in] msg_cnt message count of the priority message queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_prio_msg_q_create(k_prio_msg_q_t *prio_msg_q, void *pool, size_t msg_cnt);
|
||||
|
||||
/**
|
||||
* @brief Destroy a priority message queue.
|
||||
* destroy a priority message queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] prio_msg_q pointer to the handler of the priority message queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_prio_msg_q_destroy(k_prio_msg_q_t *prio_msg_q);
|
||||
|
||||
/**
|
||||
* @brief Flush the priority message queue.
|
||||
* flush the priority message queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] prio_msg_q pointer to the handler of the priority message queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_prio_msg_q_flush(k_prio_msg_q_t *prio_msg_q);
|
||||
|
||||
/**
|
||||
* @brief Pend a priority message queue.
|
||||
* pend a priority message queue.
|
||||
*
|
||||
* @attentio
|
||||
* 1. we DONNOT perform a memcpy when msg_ptr is received(a MESSAGE is just a pointer).
|
||||
* 2. With priority message queue, if the poster has post several message with different priority, the pender will receive
|
||||
* the message in priority order(numerically bigger, actually smaller, means the message with highest priority(numerically
|
||||
* smallest) will be received first, then the second highest priority message, and so on).
|
||||
*
|
||||
* @param[in] prio_msg_q pointer to the handler of the priority message queue.
|
||||
* @param[OUT] msg_ptr a pointer to the message we wanna receive.
|
||||
* @param[in] timeout how much time(in k_tick_t) we would like to wait.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_PEND_NOWAIT we get nothing, and we don't wanna wait.
|
||||
* @retval #K_ERR_PEND_SCHED_LOCKED we can wait, but scheduler is locked.
|
||||
* @retval #K_ERR_PEND_TIMEOUT the time we wait is up, we get nothing.
|
||||
* @retval #K_ERR_PEND_DESTROY the queue we are pending is destroyed.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_prio_msg_q_pend(k_prio_msg_q_t *prio_msg_q, void **msg_ptr, k_tick_t timeout);
|
||||
|
||||
/**
|
||||
* @brief Post a priority message queue.
|
||||
* post a priority message queue and wakeup one pending task.
|
||||
*
|
||||
* @attention when tos_prio_msg_q_post return successfully, only one task who are waitting for the priority message queue will be woken up.
|
||||
*
|
||||
* @param[in] prio_msg_q pointer to the handler of the priority message queue.
|
||||
* @param[in] msg_ptr the message to post(a MESSAGE is just a pointer).
|
||||
* @param[in] prio the priority of the message.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_PRIO_Q_FULL the priority message queue is full.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_prio_msg_q_post(k_prio_msg_q_t *prio_msg_q, void *msg_ptr, k_prio_t prio);
|
||||
|
||||
/**
|
||||
* @brief Post a priority message queue.
|
||||
* post a priority message queue and wakeup all the pending task.
|
||||
*
|
||||
* @attention when tos_prio_msg_q_post_all return successfully, all of the tasks who are waitting for the priority message queue will be woken up.
|
||||
*
|
||||
* @param[in] prio_msg_q pointer to the handler of the priority message queue.
|
||||
* @param[in] msg_ptr the priority message to post(a MESSAGE is just a pointer).
|
||||
* @param[in] prio the priority of the message.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_PRIO_Q_FULL the priority message queue is full.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_prio_msg_q_post_all(k_prio_msg_q_t *prio_msg_q, void *msg_ptr, k_prio_t prio);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _TOS_PRIORITY_MESSAGE_QUEUE_H_ */
|
||||
|
178
kernel/core/include/tos_priority_queue.h
Normal file
178
kernel/core/include/tos_priority_queue.h
Normal file
@@ -0,0 +1,178 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _TOS_PRIORITY_QUEUE_H_
|
||||
#define _TOS_PRIORITY_QUEUE_H_
|
||||
|
||||
typedef uint16_t prio_q_slot_t;
|
||||
|
||||
typedef struct prio_q_pool_manager_entry_st {
|
||||
prio_q_slot_t next;
|
||||
} prio_q_pool_mgr_ent_t;
|
||||
|
||||
typedef struct prio_q_pool_manager_st {
|
||||
prio_q_slot_t first_free;
|
||||
prio_q_pool_mgr_ent_t *pool_mgr_ent_array;
|
||||
} prio_q_pool_mgr_t;
|
||||
|
||||
typedef struct prio_q_priority_manager_entry_st {
|
||||
k_prio_t priority;
|
||||
prio_q_slot_t slot;
|
||||
} prio_q_prio_mgr_ent_t;
|
||||
|
||||
typedef struct prio_q_prio_manager_st {
|
||||
k_bin_heap_t prio_mgr_bin_heap;
|
||||
prio_q_prio_mgr_ent_t *prio_mgr_ent_pool;
|
||||
} prio_q_prio_mgr_t;
|
||||
|
||||
typedef struct k_priority_queue_st {
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_obj_t knl_obj;
|
||||
#endif
|
||||
|
||||
prio_q_pool_mgr_t pool_mgr;
|
||||
prio_q_prio_mgr_t prio_mgr;
|
||||
|
||||
size_t total;
|
||||
size_t item_size;
|
||||
size_t item_cnt;
|
||||
|
||||
uint8_t *pool;
|
||||
} k_prio_q_t;
|
||||
|
||||
#define PRIO_Q_POOL_SLOT_INVALID ((prio_q_slot_t)-1)
|
||||
|
||||
#define PRIO_Q_POOL_MGR_ENT_ARRAY_SIZE(item_cnt) \
|
||||
(item_cnt * sizeof(prio_q_pool_mgr_ent_t))
|
||||
|
||||
#define PRIO_Q_PRIO_MGR_ENT_POOL_SIZE(item_cnt) \
|
||||
(item_cnt * sizeof(prio_q_prio_mgr_ent_t))
|
||||
|
||||
#define PRIO_Q_THE_ITEM(prio_q, slot) (void *)(&prio_q->pool[slot * prio_q->item_size])
|
||||
|
||||
// get the size of mgr_array to create a priority queue
|
||||
#define TOS_PRIO_Q_MGR_ARRAY_SIZE(item_cnt) \
|
||||
(PRIO_Q_POOL_MGR_ENT_ARRAY_SIZE(item_cnt) + PRIO_Q_PRIO_MGR_ENT_POOL_SIZE(item_cnt))
|
||||
|
||||
/**
|
||||
* @brief Create a priority queue.
|
||||
* create a priority queue.
|
||||
*
|
||||
* @attention if we wanna create a priority queue, we should offer a manager array buffer of which the size can be calculated by TOS_PRIO_Q_MGR_ARRAY_SIZE.
|
||||
*
|
||||
* @param[in] prio_q pointer to the handler of the priority queue.
|
||||
* @param[in] mgr_array manager array buffer of the priority queue.
|
||||
* @param[in] pool pool buffer of the priority queue.
|
||||
* @param[in] item_cnt item count of the priority queue.
|
||||
* @param[in] item_size size of each item of the priority queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_prio_q_create(k_prio_q_t *prio_q, void *mgr_array, void *pool, size_t item_cnt, size_t item_size);
|
||||
|
||||
/**
|
||||
* @brief Destroy a priority queue.
|
||||
* destroy a priority queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] prio_q pointer to the handler of the bpriority queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_prio_q_destroy(k_prio_q_t *prio_q);
|
||||
|
||||
/**
|
||||
* @brief Enqueue an priority queue.
|
||||
* enqueue an item into the priority queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] prio_q pointer to the handler of priority queue.
|
||||
* @param[in] item the item to be enqueued.
|
||||
* @param[in] item_size size of the item(should be consistent with the item_size passed to tos_prio_q_create).
|
||||
* @param[in] prio priority of the item to be enqueued(should be consistent with the item_size passed to tos_prio_q_create).
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
* @retval #K_ERR_PRIO_Q_ITEM_SIZE_NOT_MATCH the item_size is not consistent with the item_size passed to tos_prio_q_create.
|
||||
* @retval #K_ERR_PRIO_Q_FULL the priority queue is full.
|
||||
*/
|
||||
__API__ k_err_t tos_prio_q_enqueue(k_prio_q_t *prio_q, void *item, size_t item_size, k_prio_t prio);
|
||||
|
||||
/**
|
||||
* @brief Dequeue an item.
|
||||
* dequeue an item from the priority queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] prio_q pointer to the handler of the priority queue.
|
||||
* @param[out] item buffer to hold the item dequeued.
|
||||
* @param[out] item_size size of the item dequeued(should be consistent with the item_size passed to tos_prio_q_create).
|
||||
* @param[out] prio priority of the item dequeued.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
* @retval #K_ERR_PRIO_Q_EMPTY the priority queue is empty.
|
||||
*/
|
||||
__API__ k_err_t tos_prio_q_dequeue(k_prio_q_t *prio_q, void *item, size_t *item_size, k_prio_t *prio);
|
||||
|
||||
/**
|
||||
* @brief Flush the priority queue.
|
||||
* flush the priority queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] prio_q pointer to the handler of the priority queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_prio_q_flush(k_prio_q_t *prio_q);
|
||||
|
||||
/**
|
||||
* @brief Whether the priority queue is empty.
|
||||
* Whether the priority queue is empty.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] prio_q pointer to the handler of the priority queue.
|
||||
*
|
||||
* @return whether the priority queue is emtpy.
|
||||
* @retval #0 the priority queue is not empty.
|
||||
* @retval #Not 0 the priority queue is empty.
|
||||
*/
|
||||
__API__ int tos_prio_q_is_empty(k_prio_q_t *prio_q);
|
||||
|
||||
/**
|
||||
* @brief Whether the priority queue is full.
|
||||
* Whether the priority queue is full.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] prio_q pointer to the handler of the priority queue.
|
||||
*
|
||||
* @return whether the priority queue is full.
|
||||
* @retval #0 the priority queue is not full.
|
||||
* @retval #Not 0 the priority queue is full.
|
||||
*/
|
||||
__API__ int tos_prio_q_is_full(k_prio_q_t *prio_q);
|
||||
|
||||
#endif /* _TOS_PRIORITY_QUEUE_H_ */
|
||||
|
@@ -1,134 +0,0 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _TOS_QUEUE_H_
|
||||
#define _TOS_QUEUE_H_
|
||||
|
||||
#if TOS_CFG_QUEUE_EN > 0u
|
||||
|
||||
typedef struct k_queue_st {
|
||||
pend_obj_t pend_obj;
|
||||
k_msg_queue_t msg_queue;
|
||||
} k_queue_t;
|
||||
|
||||
/**
|
||||
* @brief Create a queue.
|
||||
* create a queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] queue pointer to the handler of the queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_queue_create(k_queue_t *queue);
|
||||
|
||||
/**
|
||||
* @brief Destroy a queue.
|
||||
* destroy a queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] queue pointer to the handler of the queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_queue_destroy(k_queue_t *queue);
|
||||
|
||||
/**
|
||||
* @brief Pend a queue.
|
||||
* pend a queue.
|
||||
*
|
||||
* @attention we DONNOT perform a memcpy when msg_addr returned, we just let the *msg_addr point to an inner memory block.
|
||||
* that means you DONNOT need to alloc memory for msg_addr, msg_addr can just be a pointer.
|
||||
*
|
||||
* @param[in] queue pointer to the handler of the queue.
|
||||
* @param[out] msg_addr a pointer point to the message we wanna recive.
|
||||
* @param[out] msg_size pointer to the message size returned.
|
||||
* @param[in] timeout how much time(in k_tick_t) we would like to wait.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_PEND_NOWAIT we get nothing, and we don't wanna wait.
|
||||
* @retval #K_ERR_PEND_SCHED_LOCKED we can wait, but scheduler is locked.
|
||||
* @retval #K_ERR_PEND_TIMEOUT the time we wait is up, we get nothing.
|
||||
* @retval #K_ERR_PEND_DESTROY the queue we are pending is destroyed.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_queue_pend(k_queue_t *queue, void **msg_addr, size_t *msg_size, k_tick_t timeout);
|
||||
|
||||
/**
|
||||
* @brief Post a queue.
|
||||
* post a queue and wakeup one pending task.
|
||||
*
|
||||
* @attention when tos_queue_post return successfully, only one task who are waitting for the queue will be woken up.
|
||||
*
|
||||
* @param[in] queue pointer to the handler of the queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_QUEUE_FULL the message pool is full.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_queue_post(k_queue_t *queue, void *msg_addr, size_t msg_size);
|
||||
|
||||
/**
|
||||
* @brief Post a queue.
|
||||
* post a queue and wakeup all the pending task.
|
||||
*
|
||||
* @attention when tos_queue_post_all return successfully, all of the tasks who are waitting for the queue will be woken up.
|
||||
*
|
||||
* @param[in] queue pointer to the handler of the queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_QUEUE_FULL the message pool is full.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_queue_post_all(k_queue_t *queue, void *msg_addr, size_t msg_size);
|
||||
|
||||
/**
|
||||
* @brief Flush a queue.
|
||||
* flush a queue, clear all the msg in the queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] queue pointer to the handler of the queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_queue_flush(k_queue_t *queue);
|
||||
|
||||
/**
|
||||
* @brief Remove one message from the queue.
|
||||
* Remove one message with certain address from the queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] queue pointer to the handler of the queue.
|
||||
* @param[in] msg_addr the address of the message.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_QUEUE_MSG_NOT_EXIST message to remove is not existed.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_queue_remove(k_queue_t *queue, void *msg_addr);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _TOS_QUEUE_H_ */
|
||||
|
144
kernel/core/include/tos_ring_queue.h
Normal file
144
kernel/core/include/tos_ring_queue.h
Normal file
@@ -0,0 +1,144 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _TOS_RING_QUEUE_H_
|
||||
#define _TOS_RING_QUEUE_H_
|
||||
|
||||
typedef struct k_ring_queue_st {
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_obj_t knl_obj;
|
||||
#endif
|
||||
|
||||
uint16_t head;
|
||||
uint16_t tail;
|
||||
size_t total;
|
||||
|
||||
uint8_t *pool;
|
||||
|
||||
size_t item_size;
|
||||
size_t item_cnt;
|
||||
} k_ring_q_t;
|
||||
|
||||
#define RING_HEAD_ITEM(ring_q) (uint8_t *)(&ring_q->pool[ring_q->head * ring_q->item_size])
|
||||
#define RING_TAIL_ITEM(ring_q) (uint8_t *)(&ring_q->pool[ring_q->tail * ring_q->item_size])
|
||||
#define RING_NEXT(ring_q, index) ((index + 1) % ring_q->item_cnt)
|
||||
|
||||
/**
|
||||
* @brief Create a ring queue.
|
||||
* create a ring queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] ring_q pointer to the handler of the ring queue.
|
||||
* @param[in] pool pool buffer of the ring queue.
|
||||
* @param[in] item_cnt item count of the ring queue.
|
||||
* @param[in] item_size size of each item of the ring queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_ring_q_create(k_ring_q_t *ring_q, void *pool, size_t item_cnt, size_t item_size);
|
||||
|
||||
/**
|
||||
* @brief Destroy a ring queue.
|
||||
* destroy a ring queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] ring_q pointer to the handler of the ring queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_ring_q_destroy(k_ring_q_t *ring_q);
|
||||
|
||||
/**
|
||||
* @brief Enqueue an item.
|
||||
* enqueue an item into the ring queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] ring_q pointer to the handler of the ring queue.
|
||||
* @param[in] item the item to be enqueued.
|
||||
* @param[in] item_size size of the item(should be consistent with the item_size passed to tos_ring_q_create).
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
* @retval #K_ERR_RING_Q_ITEM_SIZE_NOT_MATCH the item_size is not consistent with the item_size passed to tos_ring_q_create.
|
||||
* @retval #K_ERR_RING_Q_FULL the ring queue is full.
|
||||
*/
|
||||
__API__ k_err_t tos_ring_q_enqueue(k_ring_q_t *ring_q, void *item, size_t item_size);
|
||||
|
||||
/**
|
||||
* @brief Dequeue an item.
|
||||
* dequeue an item from the ring queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] ring_q pointer to the handler of the ring queue.
|
||||
* @param[out] item buffer to hold the item dequeued.
|
||||
* @param[out] item_size size of the item dequeued(should be consistent with the item_size passed to tos_ring_q_create).
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
* @retval #K_ERR_RING_Q_EMPTY the ring queue is empty.
|
||||
*/
|
||||
__API__ k_err_t tos_ring_q_dequeue(k_ring_q_t *ring_q, void *item, size_t *item_size);
|
||||
|
||||
/**
|
||||
* @brief Flush the ring queue.
|
||||
* flush the ring queue.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] ring_q pointer to the handler of the ring queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
*/
|
||||
__API__ k_err_t tos_ring_q_flush(k_ring_q_t *ring_q);
|
||||
|
||||
/**
|
||||
* @brief Whether the ring queue is empty.
|
||||
* Whether the ring queue is empty.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] ring_q pointer to the handler of the ring queue.
|
||||
*
|
||||
* @return whether the ring queue is emtpy.
|
||||
* @retval #0 the ring queue is not empty.
|
||||
* @retval #Not 0 the ring queue is empty.
|
||||
*/
|
||||
__API__ int tos_ring_q_is_empty(k_ring_q_t *ring_q);
|
||||
|
||||
/**
|
||||
* @brief Whether the ring queue is full.
|
||||
* Whether the ring queue is full.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] ring_q pointer to the handler of the ring queue.
|
||||
*
|
||||
* @return whether the ring queue is full.
|
||||
* @retval #0 the ring queue is not full.
|
||||
* @retval #Not 0 the ring queue is full.
|
||||
*/
|
||||
__API__ int tos_ring_q_is_full(k_ring_q_t *ring_q);
|
||||
|
||||
#endif
|
||||
|
@@ -29,13 +29,16 @@ typedef enum knl_state_en {
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
// some kind of magic number, mainly for identifing whether the object is initialized, or whether user pass the correct parameter.
|
||||
typedef enum knl_obj_type_en {
|
||||
KNL_OBJ_TYPE_NONE = 0x0000,
|
||||
KNL_OBJ_TYPE_TASK = 0xDAD1,
|
||||
KNL_OBJ_TYPE_TASK_DYN = 0xDAD2,
|
||||
KNL_OBJ_TYPE_TIMER = 0xDAD3,
|
||||
KNL_OBJ_TYPE_MSG_QUEUE = 0xDAD4,
|
||||
KNL_OBJ_TYPE_MMBLK_POOL = 0xDAD5,
|
||||
KNL_OBJ_TYPE_FIFO = 0xDAD6,
|
||||
KNL_OBJ_TYPE_NONE = 0x0000,
|
||||
KNL_OBJ_TYPE_TASK = 0xDAD1,
|
||||
KNL_OBJ_TYPE_TASK_DYN = 0xDAD2,
|
||||
KNL_OBJ_TYPE_TIMER = 0xDAD3,
|
||||
KNL_OBJ_TYPE_MSG_QUEUE = 0xDAD4,
|
||||
KNL_OBJ_TYPE_MMBLK_POOL = 0xDAD5,
|
||||
KNL_OBJ_TYPE_RING_QUEUE = 0xDAD6,
|
||||
KNL_OBJ_TYPE_BINARY_HEAP = 0xDAD7,
|
||||
KNL_OBJ_TYPE_PRIORITY_QUEUE = 0xDAD8,
|
||||
KNL_OBJ_TYPE_CHAR_FIFO = 0xDAD9,
|
||||
} knl_obj_type_t;
|
||||
|
||||
typedef struct knl_object_st {
|
||||
|
@@ -112,9 +112,13 @@ typedef struct k_task_st {
|
||||
k_timeslice_t timeslice; /**< how much time slice left for us? */
|
||||
#endif
|
||||
|
||||
#if TOS_CFG_MSG_EN > 0u
|
||||
void *msg_addr; /**< if we pend a queue successfully, our msg_addr and msg_size will be set by the queue poster */
|
||||
size_t msg_size;
|
||||
#if (TOS_CFG_MESSAGE_QUEUE_EN > 0u) || (TOS_CFG_PRIORITY_MESSAGE_QUEUE_EN > 0u)
|
||||
void *msg; /**< if we pend a message queue successfully, our msg will be set by the message queue poster */
|
||||
#endif
|
||||
|
||||
#if (TOS_CFG_MAIL_QUEUE_EN > 0u) || (TOS_CFG_PRIORITY_MAIL_QUEUE_EN > 0u)
|
||||
void *mail; /**< if we pend a mail queue successfully, our mail and mail_size will be set by the message queue poster */
|
||||
size_t mail_size;
|
||||
#endif
|
||||
|
||||
#if TOS_CFG_EVENT_EN > 0u
|
||||
|
282
kernel/core/tos_binary_heap.c
Normal file
282
kernel/core/tos_binary_heap.c
Normal file
@@ -0,0 +1,282 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "tos.h"
|
||||
|
||||
__STATIC_INLINE__ void bin_heap_item_copy_to(k_bin_heap_t *bin_heap, void *item_out, size_t *item_size)
|
||||
{
|
||||
memcpy(item_out, BIN_HEAP_FIRST_ITEM(bin_heap), bin_heap->item_size);
|
||||
if (item_size) {
|
||||
*item_size = bin_heap->item_size;
|
||||
}
|
||||
}
|
||||
|
||||
__STATIC_INLINE__ void bin_heap_item_copy_from(k_bin_heap_t *bin_heap, void *item_in)
|
||||
{
|
||||
memcpy(BIN_HEAP_LAST_ITEM(bin_heap), item_in, bin_heap->item_size);
|
||||
}
|
||||
|
||||
__STATIC_INLINE__ void bin_heap_item_increase(k_bin_heap_t *bin_heap)
|
||||
{
|
||||
++bin_heap->total;
|
||||
}
|
||||
|
||||
__STATIC_INLINE__ void bin_heap_item_decrease(k_bin_heap_t *bin_heap)
|
||||
{
|
||||
--bin_heap->total;
|
||||
}
|
||||
|
||||
__STATIC__ void bin_heap_do_percolate_up(k_bin_heap_t *bin_heap, uint16_t hole, void *item_backup)
|
||||
{
|
||||
k_bin_heap_cmp cmp;
|
||||
size_t item_size;
|
||||
uint16_t parent, top;
|
||||
void *hole_item, *parent_item;
|
||||
|
||||
// hole = bin_heap->total;
|
||||
top = 0u;
|
||||
parent = BIN_HEAP_PARENT(hole);
|
||||
cmp = bin_heap->cmp;
|
||||
item_size = bin_heap->item_size;
|
||||
|
||||
hole_item = BIN_HEAP_THE_ITEM(bin_heap, hole);
|
||||
parent_item = BIN_HEAP_THE_ITEM(bin_heap, parent);
|
||||
|
||||
while (hole > top && cmp(item_backup, parent_item)) {
|
||||
memcpy(hole_item, parent_item, item_size);
|
||||
hole = parent;
|
||||
parent = BIN_HEAP_PARENT(hole);
|
||||
hole_item = BIN_HEAP_THE_ITEM(bin_heap, hole);
|
||||
parent_item = BIN_HEAP_THE_ITEM(bin_heap, parent);
|
||||
}
|
||||
hole_item = BIN_HEAP_THE_ITEM(bin_heap, hole);
|
||||
memcpy(hole_item, item_backup, item_size);
|
||||
}
|
||||
|
||||
__STATIC__ void bin_heap_percolate_up(k_bin_heap_t *bin_heap, void *item_backup)
|
||||
{
|
||||
bin_heap_do_percolate_up(bin_heap, bin_heap->total, item_backup);
|
||||
}
|
||||
|
||||
__STATIC__ void bin_heap_percolate_down(k_bin_heap_t *bin_heap)
|
||||
{
|
||||
k_bin_heap_cmp cmp;
|
||||
size_t item_size;
|
||||
uint16_t lchild, rchild, the_child, hole;
|
||||
void *hole_item, *rchild_item, *lchild_item, *the_child_item;
|
||||
|
||||
hole = 0u;
|
||||
rchild = BIN_HEAP_RCHILD(hole);
|
||||
lchild = BIN_HEAP_LSIBLING(rchild);
|
||||
the_child = rchild;
|
||||
cmp = bin_heap->cmp;
|
||||
item_size = bin_heap->item_size;
|
||||
|
||||
hole_item = BIN_HEAP_THE_ITEM(bin_heap, hole);
|
||||
rchild_item = BIN_HEAP_THE_ITEM(bin_heap, rchild);
|
||||
lchild_item = BIN_HEAP_THE_ITEM(bin_heap, lchild);
|
||||
|
||||
while (the_child < bin_heap->total) {
|
||||
if (cmp(lchild_item, rchild_item)) {
|
||||
the_child = lchild;
|
||||
}
|
||||
the_child_item = BIN_HEAP_THE_ITEM(bin_heap, the_child);
|
||||
memcpy(hole_item, the_child_item, item_size);
|
||||
|
||||
hole = the_child;
|
||||
the_child = BIN_HEAP_RCHILD(the_child);
|
||||
rchild = the_child;
|
||||
lchild = BIN_HEAP_LSIBLING(rchild);
|
||||
|
||||
hole_item = BIN_HEAP_THE_ITEM(bin_heap, hole);
|
||||
rchild_item = BIN_HEAP_THE_ITEM(bin_heap, rchild);
|
||||
lchild_item = BIN_HEAP_THE_ITEM(bin_heap, lchild);
|
||||
}
|
||||
|
||||
if (the_child == bin_heap->total) {
|
||||
memcpy(hole_item, lchild_item, item_size);
|
||||
hole = lchild;
|
||||
hole_item = BIN_HEAP_THE_ITEM(bin_heap, hole);
|
||||
}
|
||||
bin_heap_do_percolate_up(bin_heap, hole, BIN_HEAP_LAST_ITEM(bin_heap));
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_bin_heap_create(k_bin_heap_t *bin_heap, void *pool, size_t item_cnt, size_t item_size, k_bin_heap_cmp cmp)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(bin_heap);
|
||||
TOS_PTR_SANITY_CHECK(pool);
|
||||
TOS_PTR_SANITY_CHECK(cmp);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_object_init(&bin_heap->knl_obj, KNL_OBJ_TYPE_BINARY_HEAP);
|
||||
#endif
|
||||
|
||||
bin_heap->total = 0;
|
||||
bin_heap->cmp = cmp;
|
||||
bin_heap->item_size = item_size;
|
||||
bin_heap->item_cnt = item_cnt;
|
||||
bin_heap->pool = (uint8_t *)pool;
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_bin_heap_destroy(k_bin_heap_t *bin_heap)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(bin_heap);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&bin_heap->knl_obj, KNL_OBJ_TYPE_BINARY_HEAP)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
bin_heap->total = 0;
|
||||
bin_heap->cmp = K_NULL;
|
||||
bin_heap->item_size = 0;
|
||||
bin_heap->item_cnt = 0;
|
||||
bin_heap->pool = K_NULL;
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_object_deinit(&bin_heap->knl_obj);
|
||||
#endif
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_bin_heap_push(k_bin_heap_t *bin_heap, void *item, size_t item_size)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
|
||||
TOS_PTR_SANITY_CHECK(bin_heap);
|
||||
TOS_PTR_SANITY_CHECK(item);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&bin_heap->knl_obj, KNL_OBJ_TYPE_BINARY_HEAP)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (item_size != bin_heap->item_size) {
|
||||
return K_ERR_BIN_HEAP_ITEM_SIZE_NOT_MATCH;
|
||||
}
|
||||
|
||||
if (tos_bin_heap_is_full(bin_heap)) {
|
||||
return K_ERR_BIN_HEAP_FULL;
|
||||
}
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
bin_heap_item_copy_from(bin_heap, item);
|
||||
bin_heap_percolate_up(bin_heap, item);
|
||||
bin_heap_item_increase(bin_heap);
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_bin_heap_pop(k_bin_heap_t *bin_heap, void *item, size_t *item_size)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
|
||||
TOS_PTR_SANITY_CHECK(bin_heap);
|
||||
TOS_PTR_SANITY_CHECK(item);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&bin_heap->knl_obj, KNL_OBJ_TYPE_BINARY_HEAP)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
if (tos_bin_heap_is_empty(bin_heap)) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_BIN_HEAP_EMPTY;
|
||||
}
|
||||
|
||||
bin_heap_item_copy_to(bin_heap, item, item_size);
|
||||
bin_heap_item_decrease(bin_heap);
|
||||
bin_heap_percolate_down(bin_heap);
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_bin_heap_flush(k_bin_heap_t *bin_heap)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
|
||||
TOS_PTR_SANITY_CHECK(bin_heap);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&bin_heap->knl_obj, KNL_OBJ_TYPE_BINARY_HEAP)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
bin_heap->total = 0;
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ int tos_bin_heap_is_empty(k_bin_heap_t *bin_heap)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
int is_empty = 0;
|
||||
|
||||
if (!bin_heap) {
|
||||
return K_FALSE;
|
||||
}
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&bin_heap->knl_obj, KNL_OBJ_TYPE_BINARY_HEAP)) {
|
||||
return K_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
is_empty = (bin_heap->total == 0);
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
return is_empty;
|
||||
}
|
||||
|
||||
__API__ int tos_bin_heap_is_full(k_bin_heap_t *bin_heap)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
int is_full = 0;
|
||||
|
||||
if (!bin_heap) {
|
||||
return K_FALSE;
|
||||
}
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&bin_heap->knl_obj, KNL_OBJ_TYPE_BINARY_HEAP)) {
|
||||
return K_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
is_full = (bin_heap->total == bin_heap->item_cnt);
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
return is_full;
|
||||
}
|
||||
|
182
kernel/core/tos_char_fifo.c
Normal file
182
kernel/core/tos_char_fifo.c
Normal file
@@ -0,0 +1,182 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "tos.h"
|
||||
|
||||
__API__ k_err_t tos_chr_fifo_create(k_chr_fifo_t *chr_fifo, void *buffer, size_t size)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(chr_fifo);
|
||||
TOS_PTR_SANITY_CHECK(buffer);
|
||||
k_err_t err;
|
||||
|
||||
err = tos_ring_q_create(&chr_fifo->ring_q, buffer, size, sizeof(uint8_t));
|
||||
if (err != K_ERR_NONE) {
|
||||
return err;
|
||||
}
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_object_init(&chr_fifo->knl_obj, KNL_OBJ_TYPE_CHAR_FIFO);
|
||||
#endif
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_chr_fifo_destroy(k_chr_fifo_t *chr_fifo)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(chr_fifo);
|
||||
k_err_t err;
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&chr_fifo->knl_obj, KNL_OBJ_TYPE_CHAR_FIFO)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
err = tos_ring_q_destroy(&chr_fifo->ring_q);
|
||||
if (err != K_ERR_NONE) {
|
||||
return err;
|
||||
}
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_object_deinit(&chr_fifo->knl_obj);
|
||||
#endif
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_chr_fifo_push(k_chr_fifo_t *chr_fifo, uint8_t data)
|
||||
{
|
||||
k_err_t err;
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&chr_fifo->knl_obj, KNL_OBJ_TYPE_CHAR_FIFO)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
err = tos_ring_q_enqueue(&chr_fifo->ring_q, &data, sizeof(uint8_t));
|
||||
if (err != K_ERR_NONE) {
|
||||
return err;
|
||||
}
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ int tos_chr_fifo_push_stream(k_chr_fifo_t *chr_fifo, uint8_t *stream, size_t size)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_err_t err;
|
||||
int i = 0;
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&chr_fifo->knl_obj, KNL_OBJ_TYPE_CHAR_FIFO)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
while (i < size) {
|
||||
err = tos_ring_q_enqueue(&chr_fifo->ring_q, &stream[i], sizeof(uint8_t));
|
||||
if (err != K_ERR_NONE) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return i;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return i;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_chr_fifo_pop(k_chr_fifo_t *chr_fifo, uint8_t *out)
|
||||
{
|
||||
k_err_t err;
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&chr_fifo->knl_obj, KNL_OBJ_TYPE_CHAR_FIFO)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
err = tos_ring_q_dequeue(&chr_fifo->ring_q, (void *)out, K_NULL);
|
||||
if (err != K_ERR_NONE) {
|
||||
return err;
|
||||
}
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ int tos_chr_fifo_pop_stream(k_chr_fifo_t *chr_fifo, uint8_t *buffer, size_t size)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
int i = 0;
|
||||
uint8_t data;
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&chr_fifo->knl_obj, KNL_OBJ_TYPE_CHAR_FIFO)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
while (i < size) {
|
||||
if (tos_ring_q_dequeue(&chr_fifo->ring_q, &data, K_NULL) != K_ERR_NONE) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return i;
|
||||
}
|
||||
buffer[i++] = data;
|
||||
}
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return i;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_chr_fifo_flush(k_chr_fifo_t *chr_fifo)
|
||||
{
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&chr_fifo->knl_obj, KNL_OBJ_TYPE_CHAR_FIFO)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
return tos_ring_q_flush(&chr_fifo->ring_q);
|
||||
}
|
||||
|
||||
__API__ int tos_chr_fifo_is_empty(k_chr_fifo_t *chr_fifo)
|
||||
{
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&chr_fifo->knl_obj, KNL_OBJ_TYPE_CHAR_FIFO)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
return tos_ring_q_is_empty(&chr_fifo->ring_q);
|
||||
}
|
||||
|
||||
__API__ int tos_chr_fifo_is_full(k_chr_fifo_t *chr_fifo)
|
||||
{
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&chr_fifo->knl_obj, KNL_OBJ_TYPE_CHAR_FIFO)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
return tos_ring_q_is_full(&chr_fifo->ring_q);
|
||||
}
|
||||
|
@@ -1,213 +0,0 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "tos.h"
|
||||
|
||||
__STATIC_INLINE__ int fifo_next(k_fifo_t *fifo, int index)
|
||||
{
|
||||
return (index + 1) % fifo->siz;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_fifo_create(k_fifo_t *fifo, uint8_t *buffer, size_t size)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(fifo);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_object_init(&fifo->knl_obj, KNL_OBJ_TYPE_FIFO);
|
||||
#endif
|
||||
|
||||
fifo->beg = 0;
|
||||
fifo->end = 0;
|
||||
fifo->cnt = 0;
|
||||
fifo->buf = buffer;
|
||||
fifo->siz = size;
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_fifo_destroy(k_fifo_t *fifo)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(fifo);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&fifo->knl_obj, KNL_OBJ_TYPE_FIFO)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
fifo->beg = 0;
|
||||
fifo->end = 0;
|
||||
fifo->cnt = 0;
|
||||
fifo->buf = K_NULL;
|
||||
fifo->siz = 0;
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_object_deinit(&fifo->knl_obj);
|
||||
#endif
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_fifo_push(k_fifo_t *fifo, uint8_t data)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&fifo->knl_obj, KNL_OBJ_TYPE_FIFO)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
if (tos_fifo_is_full(fifo)) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_FIFO_FULL;
|
||||
}
|
||||
|
||||
fifo->buf[fifo->end] = data;
|
||||
fifo->end = fifo_next(fifo, fifo->end);
|
||||
++fifo->cnt;
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ int tos_fifo_push_stream(k_fifo_t *fifo, uint8_t *stream, size_t size)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
int i = 0;
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&fifo->knl_obj, KNL_OBJ_TYPE_FIFO)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
while (!tos_fifo_is_full(fifo) && i < size) {
|
||||
if (tos_fifo_push(fifo, stream[i]) != K_ERR_NONE) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return i;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return i;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_fifo_pop(k_fifo_t *fifo, uint8_t *out)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
uint8_t data;
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&fifo->knl_obj, KNL_OBJ_TYPE_FIFO)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
if (tos_fifo_is_empty(fifo)) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_FIFO_EMPTY;
|
||||
}
|
||||
|
||||
data = fifo->buf[fifo->beg];
|
||||
fifo->beg = fifo_next(fifo, fifo->beg);
|
||||
--fifo->cnt;
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
*out = data;
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ int tos_fifo_pop_stream(k_fifo_t *fifo, uint8_t *buffer, size_t size)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
int i = 0;
|
||||
uint8_t data;
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&fifo->knl_obj, KNL_OBJ_TYPE_FIFO)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
while (!tos_fifo_is_empty(fifo) && i < size) {
|
||||
if (tos_fifo_pop(fifo, &data) != K_ERR_NONE) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return i;
|
||||
}
|
||||
buffer[i++] = data;
|
||||
}
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return i;
|
||||
}
|
||||
|
||||
__API__ void tos_fifo_flush(k_fifo_t *fifo)
|
||||
{
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&fifo->knl_obj, KNL_OBJ_TYPE_FIFO)) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
fifo->beg = 0;
|
||||
fifo->end = 0;
|
||||
fifo->cnt = 0;
|
||||
}
|
||||
|
||||
__API__ int tos_fifo_is_empty(k_fifo_t *fifo)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
int is_empty = 0;
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&fifo->knl_obj, KNL_OBJ_TYPE_FIFO)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
is_empty = (fifo->cnt == 0);
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
return is_empty;
|
||||
}
|
||||
|
||||
__API__ int tos_fifo_is_full(k_fifo_t *fifo)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
int is_full = 0;
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&fifo->knl_obj, KNL_OBJ_TYPE_FIFO)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
is_full = (fifo->cnt == fifo->siz);
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
return is_full;
|
||||
}
|
||||
|
@@ -72,11 +72,6 @@ size_t const k_timer_task_stk_size = TOS_CFG_TIMER_TASK_STK_SIZ
|
||||
|
||||
#endif
|
||||
|
||||
#if TOS_CFG_MSG_EN > 0u
|
||||
TOS_LIST_DEFINE(k_msg_freelist);
|
||||
k_msg_t k_msg_pool[TOS_CFG_MSG_POOL_SIZE];
|
||||
#endif
|
||||
|
||||
#if TOS_CFG_PWR_MGR_EN > 0u
|
||||
pm_device_ctl_t k_pm_device_ctl = { 0u };
|
||||
|
||||
|
200
kernel/core/tos_mail_queue.c
Normal file
200
kernel/core/tos_mail_queue.c
Normal file
@@ -0,0 +1,200 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "tos.h"
|
||||
|
||||
#if TOS_CFG_MAIL_QUEUE_EN > 0u
|
||||
|
||||
__API__ k_err_t tos_mail_q_create(k_mail_q_t *mail_q, void *pool, size_t mail_cnt, size_t mail_size)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(mail_q);
|
||||
k_err_t err;
|
||||
|
||||
pend_object_init(&mail_q->pend_obj, PEND_TYPE_MAIL_QUEUE);
|
||||
|
||||
err = tos_ring_q_create(&mail_q->ring_q, pool, mail_cnt, mail_size);
|
||||
if (err != K_ERR_NONE) {
|
||||
return err;
|
||||
}
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_mail_q_destroy(k_mail_q_t *mail_q)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_err_t err;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(mail_q);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&mail_q->pend_obj, PEND_TYPE_MAIL_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
err = tos_ring_q_destroy(&mail_q->ring_q);
|
||||
if (err != K_ERR_NONE) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return err;
|
||||
}
|
||||
|
||||
if (!pend_is_nopending(&mail_q->pend_obj)) {
|
||||
pend_wakeup_all(&mail_q->pend_obj, PEND_STATE_DESTROY);
|
||||
}
|
||||
|
||||
pend_object_deinit(&mail_q->pend_obj);
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
knl_sched();
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_mail_q_flush(k_mail_q_t *mail_q)
|
||||
{
|
||||
k_err_t err;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(mail_q);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&mail_q->pend_obj, PEND_TYPE_MAIL_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
err = tos_ring_q_flush(&mail_q->ring_q);
|
||||
if (err != K_ERR_NONE) {
|
||||
return err;
|
||||
}
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_mail_q_pend(k_mail_q_t *mail_q, void *mail_buf, size_t *mail_size, k_tick_t timeout)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_err_t err;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(mail_q);
|
||||
TOS_PTR_SANITY_CHECK(mail_buf);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&mail_q->pend_obj, PEND_TYPE_MAIL_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
if (tos_ring_q_dequeue(&mail_q->ring_q, mail_buf, mail_size) == K_ERR_NONE) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
if (timeout == TOS_TIME_NOWAIT) {
|
||||
*mail_size = 0;
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_PEND_NOWAIT;
|
||||
}
|
||||
|
||||
if (knl_is_sched_locked()) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_PEND_SCHED_LOCKED;
|
||||
}
|
||||
|
||||
pend_task_block(k_curr_task, &mail_q->pend_obj, timeout);
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
knl_sched();
|
||||
|
||||
err = pend_state2errno(k_curr_task->pend_state);
|
||||
|
||||
if (err == K_ERR_NONE) {
|
||||
memcpy(mail_buf, k_curr_task->mail, k_curr_task->mail_size);
|
||||
*mail_size = k_curr_task->mail_size;
|
||||
k_curr_task->mail = K_NULL;
|
||||
k_curr_task->mail_size = 0;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
__STATIC__ void mail_task_recv(k_task_t *task, void *mail_buf, size_t mail_size)
|
||||
{
|
||||
task->mail = mail_buf;
|
||||
task->mail_size = mail_size;
|
||||
pend_task_wakeup(task, PEND_STATE_POST);
|
||||
}
|
||||
|
||||
__STATIC__ k_err_t mail_q_do_post(k_mail_q_t *mail_q, void *mail_buf, size_t mail_size, opt_post_t opt)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_err_t err;
|
||||
k_list_t *curr, *next;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(mail_q);
|
||||
TOS_PTR_SANITY_CHECK(mail_buf);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&mail_q->pend_obj, PEND_TYPE_MAIL_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
if (pend_is_nopending(&mail_q->pend_obj)) {
|
||||
err = tos_ring_q_enqueue(&mail_q->ring_q, mail_buf, mail_size);
|
||||
if (err != K_ERR_NONE) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return err;
|
||||
}
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
if (opt == OPT_POST_ONE) {
|
||||
mail_task_recv(TOS_LIST_FIRST_ENTRY(&mail_q->pend_obj.list, k_task_t, pend_list),
|
||||
mail_buf, mail_size);
|
||||
} else { // OPT_POST_ALL
|
||||
TOS_LIST_FOR_EACH_SAFE(curr, next, &mail_q->pend_obj.list) {
|
||||
mail_task_recv(TOS_LIST_ENTRY(curr, k_task_t, pend_list),
|
||||
mail_buf, mail_size);
|
||||
}
|
||||
}
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
knl_sched();
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_mail_q_post(k_mail_q_t *mail_q, void *mail_buf, size_t mail_size)
|
||||
{
|
||||
return mail_q_do_post(mail_q, mail_buf, mail_size, OPT_POST_ONE);
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_mail_q_post_all(k_mail_q_t *mail_q, void *mail_buf, size_t mail_size)
|
||||
{
|
||||
return mail_q_do_post(mail_q, mail_buf, mail_size, OPT_POST_ALL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
187
kernel/core/tos_message_queue.c
Normal file
187
kernel/core/tos_message_queue.c
Normal file
@@ -0,0 +1,187 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "tos.h"
|
||||
|
||||
#if TOS_CFG_MESSAGE_QUEUE_EN > 0u
|
||||
|
||||
__API__ k_err_t tos_msg_q_create(k_msg_q_t *msg_q, void *pool, size_t msg_cnt)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(msg_q);
|
||||
k_err_t err;
|
||||
|
||||
pend_object_init(&msg_q->pend_obj, PEND_TYPE_MESSAGE_QUEUE);
|
||||
|
||||
err = tos_ring_q_create(&msg_q->ring_q, pool, msg_cnt, sizeof(void *));
|
||||
if (err != K_ERR_NONE) {
|
||||
return err;
|
||||
}
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_msg_q_destroy(k_msg_q_t *msg_q)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_err_t err;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(msg_q);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&msg_q->pend_obj, PEND_TYPE_MESSAGE_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
err = tos_ring_q_destroy(&msg_q->ring_q);
|
||||
if (err != K_ERR_NONE) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return err;
|
||||
}
|
||||
|
||||
if (!pend_is_nopending(&msg_q->pend_obj)) {
|
||||
pend_wakeup_all(&msg_q->pend_obj, PEND_STATE_DESTROY);
|
||||
}
|
||||
|
||||
pend_object_deinit(&msg_q->pend_obj);
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
knl_sched();
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_msg_q_flush(k_msg_q_t *msg_q)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(msg_q);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&msg_q->pend_obj, PEND_TYPE_MESSAGE_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
return tos_ring_q_flush(&msg_q->ring_q);
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_msg_q_pend(k_msg_q_t *msg_q, void **msg_ptr, k_tick_t timeout)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_err_t err;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(msg_q);
|
||||
TOS_PTR_SANITY_CHECK(msg_ptr);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&msg_q->pend_obj, PEND_TYPE_MESSAGE_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
if (tos_ring_q_dequeue(&msg_q->ring_q, msg_ptr, K_NULL) == K_ERR_NONE) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
if (timeout == TOS_TIME_NOWAIT) {
|
||||
*msg_ptr = K_NULL;
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_PEND_NOWAIT;
|
||||
}
|
||||
|
||||
if (knl_is_sched_locked()) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_PEND_SCHED_LOCKED;
|
||||
}
|
||||
|
||||
pend_task_block(k_curr_task, &msg_q->pend_obj, timeout);
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
knl_sched();
|
||||
|
||||
err = pend_state2errno(k_curr_task->pend_state);
|
||||
|
||||
if (err == K_ERR_NONE) {
|
||||
*msg_ptr = k_curr_task->msg;
|
||||
k_curr_task->msg = K_NULL;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
__STATIC__ void msg_q_task_recv(k_task_t *task, void *msg_ptr)
|
||||
{
|
||||
task->msg = msg_ptr;
|
||||
pend_task_wakeup(task, PEND_STATE_POST);
|
||||
}
|
||||
|
||||
__STATIC__ k_err_t msg_q_do_post(k_msg_q_t *msg_q, void *msg_ptr, opt_post_t opt)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_err_t err;
|
||||
k_list_t *curr, *next;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(msg_q);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&msg_q->pend_obj, PEND_TYPE_MESSAGE_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
if (pend_is_nopending(&msg_q->pend_obj)) {
|
||||
err = tos_ring_q_enqueue(&msg_q->ring_q, &msg_ptr, sizeof(void*));
|
||||
if (err != K_ERR_NONE) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return err;
|
||||
}
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
if (opt == OPT_POST_ONE) {
|
||||
msg_q_task_recv(TOS_LIST_FIRST_ENTRY(&msg_q->pend_obj.list, k_task_t, pend_list), msg_ptr);
|
||||
} else { // OPT_POST_ALL
|
||||
TOS_LIST_FOR_EACH_SAFE(curr, next, &msg_q->pend_obj.list) {
|
||||
msg_q_task_recv(TOS_LIST_ENTRY(curr, k_task_t, pend_list), msg_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
knl_sched();
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_msg_q_post(k_msg_q_t *msg_q, void *msg_ptr)
|
||||
{
|
||||
return msg_q_do_post(msg_q, msg_ptr, OPT_POST_ONE);
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_msg_q_post_all(k_msg_q_t *msg_q, void *msg_ptr)
|
||||
{
|
||||
return msg_q_do_post(msg_q, msg_ptr, OPT_POST_ALL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -1,209 +0,0 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <tos.h>
|
||||
|
||||
#if TOS_CFG_MSG_EN > 0u
|
||||
|
||||
__KERNEL__ void msgpool_init(void)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < TOS_CFG_MSG_POOL_SIZE; ++i) {
|
||||
tos_list_init(&k_msg_pool[i].list);
|
||||
tos_list_add(&k_msg_pool[i].list, &k_msg_freelist);
|
||||
}
|
||||
}
|
||||
|
||||
__STATIC__ k_msg_t *msgpool_alloc(void)
|
||||
{
|
||||
k_msg_t *msg = K_NULL;
|
||||
|
||||
if (tos_list_empty(&k_msg_freelist)) {
|
||||
return K_NULL;
|
||||
}
|
||||
|
||||
msg = TOS_LIST_FIRST_ENTRY(&k_msg_freelist, k_msg_t, list);
|
||||
tos_list_del(&msg->list);
|
||||
return msg;
|
||||
}
|
||||
|
||||
__STATIC__ void msgpool_free(k_msg_t *msg)
|
||||
{
|
||||
tos_list_del(&msg->list);
|
||||
tos_list_add(&msg->list, &k_msg_freelist);
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_msg_queue_create(k_msg_queue_t *msg_queue)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(msg_queue);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_object_init(&msg_queue->knl_obj, KNL_OBJ_TYPE_MSG_QUEUE);
|
||||
#endif
|
||||
|
||||
tos_list_init(&msg_queue->queue_head);
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_msg_queue_destroy(k_msg_queue_t *msg_queue)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(msg_queue);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&msg_queue->knl_obj, KNL_OBJ_TYPE_MSG_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
tos_msg_queue_flush(msg_queue);
|
||||
tos_list_init(&msg_queue->queue_head);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_object_deinit(&msg_queue->knl_obj);
|
||||
#endif
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_msg_queue_get(k_msg_queue_t *msg_queue, void **msg_addr, size_t *msg_size)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_msg_t *msg;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(msg_queue);
|
||||
TOS_PTR_SANITY_CHECK(msg_addr);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&msg_queue->knl_obj, KNL_OBJ_TYPE_MSG_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
msg = TOS_LIST_FIRST_ENTRY_OR_NULL(&msg_queue->queue_head, k_msg_t, list);
|
||||
if (!msg) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_MSG_QUEUE_EMPTY;
|
||||
}
|
||||
|
||||
*msg_addr = msg->msg_addr;
|
||||
*msg_size = msg->msg_size;
|
||||
msgpool_free(msg);
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_msg_queue_put(k_msg_queue_t *msg_queue, void *msg_addr, size_t msg_size, k_opt_t opt)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_msg_t *msg;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(msg_queue);
|
||||
TOS_PTR_SANITY_CHECK(msg_addr);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&msg_queue->knl_obj, KNL_OBJ_TYPE_MSG_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
msg = msgpool_alloc();
|
||||
if (!msg) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_MSG_QUEUE_FULL;
|
||||
}
|
||||
|
||||
msg->msg_addr = msg_addr;
|
||||
msg->msg_size = msg_size;
|
||||
|
||||
if (opt & TOS_OPT_MSG_PUT_LIFO) {
|
||||
tos_list_add(&msg->list, &msg_queue->queue_head);
|
||||
} else {
|
||||
tos_list_add_tail(&msg->list, &msg_queue->queue_head);
|
||||
}
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_msg_queue_remove(k_msg_queue_t *msg_queue, void *msg_addr)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_msg_t *msg;
|
||||
k_list_t *curr, *next;
|
||||
int is_msg_exist = K_FALSE;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(msg_queue);
|
||||
TOS_PTR_SANITY_CHECK(msg_addr);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&msg_queue->knl_obj, KNL_OBJ_TYPE_MSG_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
TOS_LIST_FOR_EACH_SAFE(curr, next, &msg_queue->queue_head) {
|
||||
msg = TOS_LIST_ENTRY(curr, k_msg_t, list);
|
||||
|
||||
if (msg->msg_addr != msg_addr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
is_msg_exist = K_TRUE;
|
||||
msgpool_free(msg);
|
||||
}
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
return is_msg_exist ? K_ERR_NONE : K_ERR_MSG_QUEUE_MSG_NOT_EXIST;
|
||||
}
|
||||
|
||||
__API__ void tos_msg_queue_flush(k_msg_queue_t *msg_queue)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_list_t *curr, *next;
|
||||
|
||||
if(!msg_queue) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&msg_queue->knl_obj, KNL_OBJ_TYPE_MSG_QUEUE)) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
TOS_LIST_FOR_EACH_SAFE(curr, next, &msg_queue->queue_head) {
|
||||
msgpool_free(TOS_LIST_ENTRY(curr, k_msg_t, list));
|
||||
}
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
203
kernel/core/tos_priority_mail_queue.c
Normal file
203
kernel/core/tos_priority_mail_queue.c
Normal file
@@ -0,0 +1,203 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "tos.h"
|
||||
|
||||
#if TOS_CFG_PRIORITY_MAIL_QUEUE_EN > 0u
|
||||
|
||||
__API__ k_err_t tos_prio_mail_q_create(k_prio_mail_q_t *prio_mail_q, void *pool, size_t mail_cnt, size_t mail_size)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(prio_mail_q);
|
||||
k_err_t err;
|
||||
void *prio_q_mgr_array = K_NULL;
|
||||
|
||||
prio_q_mgr_array = tos_mmheap_alloc(TOS_PRIO_Q_MGR_ARRAY_SIZE(mail_cnt));
|
||||
if (!prio_q_mgr_array) {
|
||||
return K_ERR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
err = tos_prio_q_create(&prio_mail_q->prio_q, prio_q_mgr_array, pool, mail_cnt, mail_size);
|
||||
if (err != K_ERR_NONE) {
|
||||
tos_mmheap_free(prio_q_mgr_array);
|
||||
return err;
|
||||
}
|
||||
|
||||
prio_mail_q->prio_q_mgr_array = prio_q_mgr_array;
|
||||
pend_object_init(&prio_mail_q->pend_obj, PEND_TYPE_PRIORITY_MAIL_QUEUE);
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_prio_mail_q_destroy(k_prio_mail_q_t *prio_mail_q)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_err_t err;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(prio_mail_q);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&prio_mail_q->pend_obj, PEND_TYPE_PRIORITY_MAIL_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
err = tos_prio_q_destroy(&prio_mail_q->prio_q);
|
||||
if (err != K_ERR_NONE) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return err;
|
||||
}
|
||||
|
||||
if (!pend_is_nopending(&prio_mail_q->pend_obj)) {
|
||||
pend_wakeup_all(&prio_mail_q->pend_obj, PEND_STATE_DESTROY);
|
||||
}
|
||||
|
||||
pend_object_deinit(&prio_mail_q->pend_obj);
|
||||
tos_mmheap_free(prio_mail_q->prio_q_mgr_array);
|
||||
prio_mail_q->prio_q_mgr_array = K_NULL;
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
knl_sched();
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_prio_mail_q_flush(k_prio_mail_q_t *prio_mail_q)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(prio_mail_q);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&prio_mail_q->pend_obj, PEND_TYPE_PRIORITY_MAIL_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
return tos_prio_q_flush(&prio_mail_q->prio_q);
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_prio_mail_q_pend(k_prio_mail_q_t *prio_mail_q, void *mail_buf, size_t *mail_size, k_tick_t timeout)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_err_t err;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(prio_mail_q);
|
||||
TOS_PTR_SANITY_CHECK(mail_buf);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&prio_mail_q->pend_obj, PEND_TYPE_PRIORITY_MAIL_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
if (tos_prio_q_dequeue(&prio_mail_q->prio_q, mail_buf, mail_size, K_NULL) == K_ERR_NONE) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
if (timeout == TOS_TIME_NOWAIT) {
|
||||
*mail_size = 0;
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_PEND_NOWAIT;
|
||||
}
|
||||
|
||||
if (knl_is_sched_locked()) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_PEND_SCHED_LOCKED;
|
||||
}
|
||||
|
||||
pend_task_block(k_curr_task, &prio_mail_q->pend_obj, timeout);
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
knl_sched();
|
||||
|
||||
err = pend_state2errno(k_curr_task->pend_state);
|
||||
|
||||
if (err == K_ERR_NONE) {
|
||||
memcpy(mail_buf, k_curr_task->mail, k_curr_task->mail_size);
|
||||
*mail_size = k_curr_task->mail_size;
|
||||
k_curr_task->mail = K_NULL;
|
||||
k_curr_task->mail_size = 0;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
__STATIC__ void prio_mail_task_recv(k_task_t *task, void *mail_buf, size_t mail_size)
|
||||
{
|
||||
task->mail = mail_buf;
|
||||
task->mail_size = mail_size;
|
||||
pend_task_wakeup(task, PEND_STATE_POST);
|
||||
}
|
||||
|
||||
__STATIC__ k_err_t prio_mail_q_do_post(k_prio_mail_q_t *prio_mail_q, void *mail_buf, size_t mail_size, k_prio_t prio, opt_post_t opt)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_err_t err;
|
||||
k_list_t *curr, *next;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(prio_mail_q);
|
||||
TOS_PTR_SANITY_CHECK(mail_buf);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&prio_mail_q->pend_obj, PEND_TYPE_PRIORITY_MAIL_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
if (pend_is_nopending(&prio_mail_q->pend_obj)) {
|
||||
err = tos_prio_q_enqueue(&prio_mail_q->prio_q, mail_buf, mail_size, prio);
|
||||
if (err != K_ERR_NONE) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return err;
|
||||
}
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
if (opt == OPT_POST_ONE) {
|
||||
prio_mail_task_recv(TOS_LIST_FIRST_ENTRY(&prio_mail_q->pend_obj.list, k_task_t, pend_list),
|
||||
mail_buf, mail_size);
|
||||
} else { // OPT_POST_ALL
|
||||
TOS_LIST_FOR_EACH_SAFE(curr, next, &prio_mail_q->pend_obj.list) {
|
||||
prio_mail_task_recv(TOS_LIST_ENTRY(curr, k_task_t, pend_list),
|
||||
mail_buf, mail_size);
|
||||
}
|
||||
}
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
knl_sched();
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_prio_mail_q_post(k_prio_mail_q_t *prio_mail_q, void *mail_buf, size_t mail_size, k_prio_t prio)
|
||||
{
|
||||
return prio_mail_q_do_post(prio_mail_q, mail_buf, mail_size, prio, OPT_POST_ONE);
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_prio_mail_q_post_all(k_prio_mail_q_t *prio_mail_q, void *mail_buf, size_t mail_size, k_prio_t prio)
|
||||
{
|
||||
return prio_mail_q_do_post(prio_mail_q, mail_buf, mail_size, prio, OPT_POST_ALL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
197
kernel/core/tos_priority_message_queue.c
Normal file
197
kernel/core/tos_priority_message_queue.c
Normal file
@@ -0,0 +1,197 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "tos.h"
|
||||
|
||||
#if TOS_CFG_PRIORITY_MESSAGE_QUEUE_EN > 0u
|
||||
|
||||
__API__ k_err_t tos_prio_msg_q_create(k_prio_msg_q_t *prio_msg_q, void *pool, size_t msg_cnt)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(prio_msg_q);
|
||||
k_err_t err;
|
||||
void *prio_q_mgr_array = K_NULL;
|
||||
|
||||
prio_q_mgr_array = tos_mmheap_alloc(TOS_PRIO_Q_MGR_ARRAY_SIZE(msg_cnt));
|
||||
if (!prio_q_mgr_array) {
|
||||
return K_ERR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
err = tos_prio_q_create(&prio_msg_q->prio_q, prio_q_mgr_array, pool, msg_cnt, sizeof(void *));
|
||||
if (err != K_ERR_NONE) {
|
||||
tos_mmheap_free(prio_q_mgr_array);
|
||||
return err;
|
||||
}
|
||||
|
||||
prio_msg_q->prio_q_mgr_array = prio_q_mgr_array;
|
||||
pend_object_init(&prio_msg_q->pend_obj, PEND_TYPE_PRIORITY_MESSAGE_QUEUE);
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_prio_msg_q_destroy(k_prio_msg_q_t *prio_msg_q)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_err_t err;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(prio_msg_q);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&prio_msg_q->pend_obj, PEND_TYPE_PRIORITY_MESSAGE_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
err = tos_prio_q_destroy(&prio_msg_q->prio_q);
|
||||
if (err != K_ERR_NONE) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return err;
|
||||
}
|
||||
|
||||
if (!pend_is_nopending(&prio_msg_q->pend_obj)) {
|
||||
pend_wakeup_all(&prio_msg_q->pend_obj, PEND_STATE_DESTROY);
|
||||
}
|
||||
|
||||
pend_object_deinit(&prio_msg_q->pend_obj);
|
||||
tos_mmheap_free(prio_msg_q->prio_q_mgr_array);
|
||||
prio_msg_q->prio_q_mgr_array = K_NULL;
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
knl_sched();
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_prio_msg_q_flush(k_prio_msg_q_t *prio_msg_q)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(prio_msg_q);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&prio_msg_q->pend_obj, PEND_TYPE_PRIORITY_MESSAGE_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
return tos_prio_q_flush(&prio_msg_q->prio_q);
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_prio_msg_q_pend(k_prio_msg_q_t *prio_msg_q, void **msg_ptr, k_tick_t timeout)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_err_t err;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(prio_msg_q);
|
||||
TOS_PTR_SANITY_CHECK(msg_ptr);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&prio_msg_q->pend_obj, PEND_TYPE_PRIORITY_MESSAGE_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
if (tos_prio_q_dequeue(&prio_msg_q->prio_q, msg_ptr, K_NULL, K_NULL) == K_ERR_NONE) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
if (timeout == TOS_TIME_NOWAIT) {
|
||||
*msg_ptr = K_NULL;
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_PEND_NOWAIT;
|
||||
}
|
||||
|
||||
if (knl_is_sched_locked()) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_PEND_SCHED_LOCKED;
|
||||
}
|
||||
|
||||
pend_task_block(k_curr_task, &prio_msg_q->pend_obj, timeout);
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
knl_sched();
|
||||
|
||||
err = pend_state2errno(k_curr_task->pend_state);
|
||||
|
||||
if (err == K_ERR_NONE) {
|
||||
*msg_ptr = k_curr_task->msg;
|
||||
k_curr_task->msg = K_NULL;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
__STATIC__ void prio_msg_q_task_recv(k_task_t *task, void *msg_ptr)
|
||||
{
|
||||
task->msg = msg_ptr;
|
||||
pend_task_wakeup(task, PEND_STATE_POST);
|
||||
}
|
||||
|
||||
__STATIC__ k_err_t prio_msg_q_do_post(k_prio_msg_q_t *prio_msg_q, void *msg_ptr, k_prio_t prio, opt_post_t opt)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_err_t err;
|
||||
k_list_t *curr, *next;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(prio_msg_q);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&prio_msg_q->pend_obj, PEND_TYPE_PRIORITY_MESSAGE_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
if (pend_is_nopending(&prio_msg_q->pend_obj)) {
|
||||
err = tos_prio_q_enqueue(&prio_msg_q->prio_q, &msg_ptr, sizeof(void *), prio);
|
||||
if (err != K_ERR_NONE) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return err;
|
||||
}
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
if (opt == OPT_POST_ONE) {
|
||||
prio_msg_q_task_recv(TOS_LIST_FIRST_ENTRY(&prio_msg_q->pend_obj.list, k_task_t, pend_list), msg_ptr);
|
||||
} else { // OPT_POST_ALL
|
||||
TOS_LIST_FOR_EACH_SAFE(curr, next, &prio_msg_q->pend_obj.list) {
|
||||
prio_msg_q_task_recv(TOS_LIST_ENTRY(curr, k_task_t, pend_list), msg_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
knl_sched();
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_prio_msg_q_post(k_prio_msg_q_t *prio_msg_q, void *msg_ptr, k_prio_t prio)
|
||||
{
|
||||
return prio_msg_q_do_post(prio_msg_q, msg_ptr, prio, OPT_POST_ONE);
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_prio_msg_q_post_all(k_prio_msg_q_t *prio_msg_q, void *msg_ptr, k_prio_t prio)
|
||||
{
|
||||
return prio_msg_q_do_post(prio_msg_q, msg_ptr, prio, OPT_POST_ALL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
351
kernel/core/tos_priority_queue.c
Normal file
351
kernel/core/tos_priority_queue.c
Normal file
@@ -0,0 +1,351 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "tos.h"
|
||||
|
||||
__STATIC_INLINE__ void prio_q_item_copy_to(k_prio_q_t *prio_q, void *item_out, size_t *item_size, prio_q_slot_t slot)
|
||||
{
|
||||
memcpy(item_out, PRIO_Q_THE_ITEM(prio_q, slot), prio_q->item_size);
|
||||
if (item_size) {
|
||||
*item_size = prio_q->item_size;
|
||||
}
|
||||
}
|
||||
|
||||
__STATIC_INLINE__ void prio_q_item_copy_from(k_prio_q_t *prio_q, void *item_in, prio_q_slot_t slot)
|
||||
{
|
||||
memcpy(PRIO_Q_THE_ITEM(prio_q, slot), item_in, prio_q->item_size);
|
||||
}
|
||||
|
||||
__STATIC_INLINE__ void prio_q_item_increase(k_prio_q_t *prio_q)
|
||||
{
|
||||
++prio_q->total;
|
||||
}
|
||||
|
||||
__STATIC_INLINE__ void prio_q_item_decrease(k_prio_q_t *prio_q)
|
||||
{
|
||||
--prio_q->total;
|
||||
}
|
||||
|
||||
__STATIC__ void prio_q_pool_mgr_init(prio_q_pool_mgr_t *pool_mgr, prio_q_pool_mgr_ent_t *pool_mgr_ent_array, size_t item_cnt)
|
||||
{
|
||||
prio_q_slot_t i;
|
||||
|
||||
pool_mgr->first_free = (prio_q_slot_t)0u;
|
||||
pool_mgr->pool_mgr_ent_array = pool_mgr_ent_array;
|
||||
|
||||
for (i = 0; i < item_cnt; ++i) {
|
||||
pool_mgr_ent_array[i].next = i + 1;
|
||||
}
|
||||
pool_mgr_ent_array[item_cnt - 1].next = PRIO_Q_POOL_SLOT_INVALID;
|
||||
}
|
||||
|
||||
__STATIC__ void prio_q_pool_mgr_reset(prio_q_pool_mgr_t *pool_mgr, size_t item_cnt)
|
||||
{
|
||||
prio_q_slot_t i;
|
||||
prio_q_pool_mgr_ent_t *pool_mgr_ent_array;
|
||||
|
||||
pool_mgr->first_free = (prio_q_slot_t)0u;
|
||||
pool_mgr_ent_array = pool_mgr->pool_mgr_ent_array;
|
||||
|
||||
for (i = 0; i < item_cnt; ++i) {
|
||||
pool_mgr_ent_array[i].next = i + 1;
|
||||
}
|
||||
pool_mgr_ent_array[item_cnt - 1].next = PRIO_Q_POOL_SLOT_INVALID;
|
||||
}
|
||||
|
||||
__STATIC__ void prio_q_pool_mgr_deinit(prio_q_pool_mgr_t *pool_mgr)
|
||||
{
|
||||
pool_mgr->first_free = (prio_q_slot_t)0u;
|
||||
pool_mgr->pool_mgr_ent_array = K_NULL;
|
||||
}
|
||||
|
||||
__STATIC__ int prio_q_mgr_entry_cmp(void *first, void *second)
|
||||
{
|
||||
prio_q_prio_mgr_ent_t *first_entry, *second_entry;
|
||||
|
||||
first_entry = (prio_q_prio_mgr_ent_t *)first;
|
||||
second_entry = (prio_q_prio_mgr_ent_t *)second;
|
||||
|
||||
// numerically bigger, actually smaller, we build a minimal binary heap here
|
||||
if (first_entry->priority < second_entry->priority) {
|
||||
return K_TRUE;
|
||||
}
|
||||
return K_FALSE;
|
||||
}
|
||||
|
||||
__STATIC__ void prio_q_prio_mgr_init(prio_q_prio_mgr_t *prio_mgr, prio_q_prio_mgr_ent_t *prio_mgr_ent_pool, size_t item_cnt)
|
||||
{
|
||||
prio_mgr->prio_mgr_ent_pool = prio_mgr_ent_pool;
|
||||
tos_bin_heap_create(&prio_mgr->prio_mgr_bin_heap, prio_mgr_ent_pool, item_cnt, sizeof(prio_q_prio_mgr_ent_t), prio_q_mgr_entry_cmp);
|
||||
}
|
||||
|
||||
__STATIC__ void prio_q_prio_mgr_reset(prio_q_prio_mgr_t *prio_mgr)
|
||||
{
|
||||
tos_bin_heap_flush(&prio_mgr->prio_mgr_bin_heap);
|
||||
}
|
||||
|
||||
__STATIC__ void prio_q_prio_mgr_deinit(prio_q_prio_mgr_t *prio_mgr)
|
||||
{
|
||||
prio_mgr->prio_mgr_ent_pool = K_NULL;
|
||||
tos_bin_heap_destroy(&prio_mgr->prio_mgr_bin_heap);
|
||||
}
|
||||
|
||||
__STATIC__ prio_q_slot_t prio_q_pool_mgr_slot_alloc(prio_q_pool_mgr_t *pool_mgr)
|
||||
{
|
||||
prio_q_slot_t fresh;
|
||||
prio_q_pool_mgr_ent_t *first_free;
|
||||
|
||||
if (pool_mgr->first_free == PRIO_Q_POOL_SLOT_INVALID) {
|
||||
return PRIO_Q_POOL_SLOT_INVALID;
|
||||
}
|
||||
|
||||
fresh = pool_mgr->first_free;
|
||||
first_free = &pool_mgr->pool_mgr_ent_array[pool_mgr->first_free];
|
||||
pool_mgr->first_free = first_free->next;
|
||||
|
||||
return fresh;
|
||||
}
|
||||
|
||||
__STATIC__ void prio_q_pool_mgr_slot_free(prio_q_pool_mgr_t *pool_mgr, prio_q_slot_t slot)
|
||||
{
|
||||
prio_q_pool_mgr_ent_t *slot_entry;
|
||||
|
||||
slot_entry = &pool_mgr->pool_mgr_ent_array[slot];
|
||||
slot_entry->next = pool_mgr->first_free;
|
||||
pool_mgr->first_free = slot;
|
||||
}
|
||||
|
||||
__STATIC__ void prio_q_prio_mgr_slot_enqueue(prio_q_prio_mgr_t *prio_mgr, prio_q_slot_t slot, k_prio_t prio)
|
||||
{
|
||||
k_err_t err;
|
||||
prio_q_prio_mgr_ent_t prio_mgr_entry;
|
||||
|
||||
prio_mgr_entry.priority = prio;
|
||||
prio_mgr_entry.slot = slot;
|
||||
|
||||
err = tos_bin_heap_push(&prio_mgr->prio_mgr_bin_heap, &prio_mgr_entry, sizeof(prio_q_prio_mgr_ent_t));
|
||||
TOS_ASSERT(err == K_ERR_NONE);
|
||||
}
|
||||
|
||||
__STATIC__ prio_q_slot_t prio_q_prio_mgr_slot_dequeue(prio_q_prio_mgr_t *prio_mgr, k_prio_t *prio)
|
||||
{
|
||||
k_err_t err;
|
||||
size_t dummy;
|
||||
prio_q_prio_mgr_ent_t prio_mgr_entry;
|
||||
|
||||
err = tos_bin_heap_pop(&prio_mgr->prio_mgr_bin_heap, &prio_mgr_entry, &dummy);
|
||||
TOS_ASSERT(err == K_ERR_NONE);
|
||||
TOS_ASSERT(dummy == sizeof(prio_q_prio_mgr_ent_t));
|
||||
|
||||
if (prio) {
|
||||
*prio = prio_mgr_entry.priority;
|
||||
}
|
||||
|
||||
return prio_mgr_entry.slot;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_prio_q_create(k_prio_q_t *prio_q, void *mgr_array, void *pool, size_t item_cnt, size_t item_size)
|
||||
{
|
||||
prio_q_pool_mgr_ent_t *pool_mgr_ent_array;
|
||||
prio_q_prio_mgr_ent_t *prio_mgr_ent_pool;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(prio_q);
|
||||
TOS_PTR_SANITY_CHECK(mgr_array);
|
||||
TOS_PTR_SANITY_CHECK(pool);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_object_init(&prio_q->knl_obj, KNL_OBJ_TYPE_PRIORITY_QUEUE);
|
||||
#endif
|
||||
|
||||
pool_mgr_ent_array = (prio_q_pool_mgr_ent_t *)mgr_array;
|
||||
prio_mgr_ent_pool = (prio_q_prio_mgr_ent_t *)((uint8_t *)mgr_array + PRIO_Q_POOL_MGR_ENT_ARRAY_SIZE(item_cnt));
|
||||
|
||||
prio_q_pool_mgr_init(&prio_q->pool_mgr, pool_mgr_ent_array, item_cnt);
|
||||
prio_q_prio_mgr_init(&prio_q->prio_mgr, prio_mgr_ent_pool, item_cnt);
|
||||
|
||||
prio_q->total = 0;
|
||||
prio_q->item_size = item_size;
|
||||
prio_q->item_cnt = item_cnt;
|
||||
prio_q->pool = (uint8_t *)pool;
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_prio_q_destroy(k_prio_q_t *prio_q)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(prio_q);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&prio_q->knl_obj, KNL_OBJ_TYPE_PRIORITY_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
prio_q_pool_mgr_deinit(&prio_q->pool_mgr);
|
||||
prio_q_prio_mgr_deinit(&prio_q->prio_mgr);
|
||||
|
||||
prio_q->total = 0;
|
||||
prio_q->item_size = 0;
|
||||
prio_q->item_cnt = 0;
|
||||
prio_q->pool = K_NULL;
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_object_deinit(&prio_q->knl_obj);
|
||||
#endif
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__STATIC__ void prio_q_do_enqueue(k_prio_q_t *prio_q, void *item, prio_q_slot_t slot, k_prio_t prio)
|
||||
{
|
||||
prio_q_item_copy_from(prio_q, item, slot);
|
||||
prio_q_prio_mgr_slot_enqueue(&prio_q->prio_mgr, slot, prio);
|
||||
prio_q_item_increase(prio_q);
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_prio_q_enqueue(k_prio_q_t *prio_q, void *item, size_t item_size, k_prio_t prio)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
prio_q_slot_t the_slot;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(prio_q);
|
||||
TOS_PTR_SANITY_CHECK(item);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&prio_q->knl_obj, KNL_OBJ_TYPE_PRIORITY_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (item_size != prio_q->item_size) {
|
||||
return K_ERR_PRIO_Q_ITEM_SIZE_NOT_MATCH;
|
||||
}
|
||||
|
||||
if (tos_prio_q_is_full(prio_q)) {
|
||||
return K_ERR_PRIO_Q_FULL;
|
||||
}
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
the_slot = prio_q_pool_mgr_slot_alloc(&prio_q->pool_mgr);
|
||||
TOS_ASSERT(the_slot != PRIO_Q_POOL_SLOT_INVALID);
|
||||
prio_q_do_enqueue(prio_q, item, the_slot, prio);
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__STATIC__ void prio_q_do_dequeue(k_prio_q_t *prio_q, void *item, size_t *item_size, prio_q_slot_t slot)
|
||||
{
|
||||
prio_q_pool_mgr_slot_free(&prio_q->pool_mgr, slot);
|
||||
prio_q_item_copy_to(prio_q, item, item_size, slot);
|
||||
prio_q_item_decrease(prio_q);
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_prio_q_dequeue(k_prio_q_t *prio_q, void *item, size_t *item_size, k_prio_t *prio)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
prio_q_slot_t the_slot;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(prio_q);
|
||||
TOS_PTR_SANITY_CHECK(item);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&prio_q->knl_obj, KNL_OBJ_TYPE_PRIORITY_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (tos_prio_q_is_empty(prio_q)) {
|
||||
return K_ERR_PRIO_Q_EMPTY;
|
||||
}
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
the_slot = prio_q_prio_mgr_slot_dequeue(&prio_q->prio_mgr, prio);
|
||||
prio_q_do_dequeue(prio_q, item, item_size, the_slot);
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_prio_q_flush(k_prio_q_t *prio_q)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
|
||||
TOS_PTR_SANITY_CHECK(prio_q);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&prio_q->knl_obj, KNL_OBJ_TYPE_PRIORITY_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
prio_q_pool_mgr_reset(&prio_q->pool_mgr, prio_q->item_cnt);
|
||||
prio_q_prio_mgr_reset(&prio_q->prio_mgr);
|
||||
prio_q->total = 0;
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ int tos_prio_q_is_empty(k_prio_q_t *prio_q)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
int is_empty = K_FALSE;
|
||||
|
||||
if (!prio_q) {
|
||||
return K_FALSE;
|
||||
}
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&prio_q->knl_obj, KNL_OBJ_TYPE_PRIORITY_QUEUE)) {
|
||||
return K_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
is_empty = (prio_q->total == 0);
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
return is_empty;
|
||||
}
|
||||
|
||||
__API__ int tos_prio_q_is_full(k_prio_q_t *prio_q)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
int is_full = K_FALSE;
|
||||
|
||||
if (!prio_q) {
|
||||
return K_FALSE;
|
||||
}
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&prio_q->knl_obj, KNL_OBJ_TYPE_PRIORITY_QUEUE)) {
|
||||
return K_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
is_full = (prio_q->total == prio_q->item_cnt);
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
return is_full;
|
||||
}
|
||||
|
@@ -1,213 +0,0 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "tos.h"
|
||||
|
||||
#if TOS_CFG_QUEUE_EN > 0u
|
||||
|
||||
__API__ k_err_t tos_queue_create(k_queue_t *queue)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(queue);
|
||||
|
||||
pend_object_init(&queue->pend_obj, PEND_TYPE_QUEUE);
|
||||
tos_msg_queue_create(&queue->msg_queue);
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_queue_destroy(k_queue_t *queue)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
|
||||
TOS_PTR_SANITY_CHECK(queue);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&queue->pend_obj, PEND_TYPE_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
if (!pend_is_nopending(&queue->pend_obj)) {
|
||||
pend_wakeup_all(&queue->pend_obj, PEND_STATE_DESTROY);
|
||||
}
|
||||
|
||||
pend_object_deinit(&queue->pend_obj);
|
||||
tos_msg_queue_flush(&queue->msg_queue);
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
knl_sched();
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_queue_pend(k_queue_t *queue, void **msg_addr, size_t *msg_size, k_tick_t timeout)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_err_t err;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(queue);
|
||||
TOS_PTR_SANITY_CHECK(msg_addr);
|
||||
TOS_PTR_SANITY_CHECK(msg_size);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&queue->pend_obj, PEND_TYPE_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
if (tos_msg_queue_get(&queue->msg_queue, msg_addr, msg_size) == K_ERR_NONE) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
if (timeout == TOS_TIME_NOWAIT) {
|
||||
*msg_addr = K_NULL;
|
||||
*msg_size = 0;
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_PEND_NOWAIT;
|
||||
}
|
||||
|
||||
if (knl_is_inirq()) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_PEND_IN_IRQ;
|
||||
}
|
||||
|
||||
if (knl_is_sched_locked()) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_PEND_SCHED_LOCKED;
|
||||
}
|
||||
|
||||
pend_task_block(k_curr_task, &queue->pend_obj, timeout);
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
knl_sched();
|
||||
|
||||
err = pend_state2errno(k_curr_task->pend_state);
|
||||
|
||||
if (err == K_ERR_NONE) {
|
||||
*msg_addr = k_curr_task->msg_addr;
|
||||
*msg_size = k_curr_task->msg_size;
|
||||
k_curr_task->msg_addr = K_NULL;
|
||||
k_curr_task->msg_size = 0;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
__STATIC__ void queue_task_msg_recv(k_task_t *task, void *msg_addr, size_t msg_size)
|
||||
{
|
||||
task->msg_addr = msg_addr;
|
||||
task->msg_size = msg_size;
|
||||
pend_task_wakeup(task, PEND_STATE_POST);
|
||||
}
|
||||
|
||||
__STATIC__ k_err_t queue_do_post(k_queue_t *queue, void *msg_addr, size_t msg_size, opt_post_t opt)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_list_t *curr, *next;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(queue);
|
||||
TOS_PTR_SANITY_CHECK(msg_addr);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&queue->pend_obj, PEND_TYPE_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
if (pend_is_nopending(&queue->pend_obj)) {
|
||||
if (tos_msg_queue_put(&queue->msg_queue, msg_addr, msg_size, TOS_OPT_MSG_PUT_FIFO) != K_ERR_NONE) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_QUEUE_FULL;
|
||||
}
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
if (opt == OPT_POST_ONE) {
|
||||
queue_task_msg_recv(TOS_LIST_FIRST_ENTRY(&queue->pend_obj.list, k_task_t, pend_list),
|
||||
msg_addr, msg_size);
|
||||
} else { // OPT_QUEUE_POST_ALL
|
||||
TOS_LIST_FOR_EACH_SAFE(curr, next, &queue->pend_obj.list) {
|
||||
queue_task_msg_recv(TOS_LIST_ENTRY(curr, k_task_t, pend_list),
|
||||
msg_addr, msg_size);
|
||||
}
|
||||
}
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
knl_sched();
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_queue_post(k_queue_t *queue, void *msg_addr, size_t msg_size)
|
||||
{
|
||||
return queue_do_post(queue, msg_addr, msg_size, OPT_POST_ONE);
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_queue_post_all(k_queue_t *queue, void *msg_addr, size_t msg_size)
|
||||
{
|
||||
return queue_do_post(queue, msg_addr, msg_size, OPT_POST_ALL);
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_queue_remove(k_queue_t *queue, void *msg_addr)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_err_t err;
|
||||
|
||||
TOS_PTR_SANITY_CHECK(queue);
|
||||
TOS_PTR_SANITY_CHECK(msg_addr);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&queue->pend_obj, PEND_TYPE_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
err = tos_msg_queue_remove(&queue->msg_queue, msg_addr);
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
return err == K_ERR_MSG_QUEUE_MSG_NOT_EXIST ? K_ERR_QUEUE_MSG_NOT_EXIST : K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_queue_flush(k_queue_t *queue)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
|
||||
TOS_PTR_SANITY_CHECK(queue);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!pend_object_verify(&queue->pend_obj, PEND_TYPE_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
tos_msg_queue_flush(&queue->msg_queue);
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
213
kernel/core/tos_ring_queue.c
Normal file
213
kernel/core/tos_ring_queue.c
Normal file
@@ -0,0 +1,213 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "tos.h"
|
||||
|
||||
__STATIC_INLINE__ void ring_q_item_copy_to(k_ring_q_t *ring_q, void *item_out, size_t *item_size)
|
||||
{
|
||||
memcpy(item_out, RING_HEAD_ITEM(ring_q), ring_q->item_size);
|
||||
if (item_size) {
|
||||
*item_size = ring_q->item_size;
|
||||
}
|
||||
}
|
||||
|
||||
__STATIC_INLINE__ void ring_q_item_copy_from(k_ring_q_t *ring_q, void *item_in)
|
||||
{
|
||||
memcpy(RING_TAIL_ITEM(ring_q), item_in, ring_q->item_size);
|
||||
}
|
||||
|
||||
__STATIC_INLINE__ void ring_q_item_increase(k_ring_q_t *ring_q)
|
||||
{
|
||||
ring_q->tail = RING_NEXT(ring_q, ring_q->tail);
|
||||
++ring_q->total;
|
||||
}
|
||||
|
||||
__STATIC_INLINE__ void ring_q_item_decrease(k_ring_q_t *ring_q)
|
||||
{
|
||||
ring_q->head = RING_NEXT(ring_q, ring_q->head);
|
||||
--ring_q->total;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_ring_q_create(k_ring_q_t *ring_q, void *pool, size_t item_cnt, size_t item_size)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(ring_q);
|
||||
TOS_PTR_SANITY_CHECK(pool);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_object_init(&ring_q->knl_obj, KNL_OBJ_TYPE_RING_QUEUE);
|
||||
#endif
|
||||
|
||||
ring_q->head = 0u;
|
||||
ring_q->tail = 0u;
|
||||
ring_q->total = 0;
|
||||
ring_q->pool = (uint8_t *)pool;
|
||||
ring_q->item_size = item_size;
|
||||
ring_q->item_cnt = item_cnt;
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_ring_q_destroy(k_ring_q_t *ring_q)
|
||||
{
|
||||
TOS_PTR_SANITY_CHECK(ring_q);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&ring_q->knl_obj, KNL_OBJ_TYPE_RING_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
ring_q->head = 0u;
|
||||
ring_q->tail = 0u;
|
||||
ring_q->total = 0;
|
||||
ring_q->pool = K_NULL;
|
||||
ring_q->item_size = 0u;
|
||||
ring_q->item_cnt = 0u;
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_object_deinit(&ring_q->knl_obj);
|
||||
#endif
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_ring_q_enqueue(k_ring_q_t *ring_q, void *item, size_t item_size)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
|
||||
TOS_PTR_SANITY_CHECK(ring_q);
|
||||
TOS_PTR_SANITY_CHECK(item);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&ring_q->knl_obj, KNL_OBJ_TYPE_RING_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (item_size != ring_q->item_size) {
|
||||
return K_ERR_RING_Q_ITEM_SIZE_NOT_MATCH;
|
||||
}
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
if (tos_ring_q_is_full(ring_q)) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_RING_Q_FULL;
|
||||
}
|
||||
|
||||
ring_q_item_copy_from(ring_q, item);
|
||||
ring_q_item_increase(ring_q);
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_ring_q_dequeue(k_ring_q_t *ring_q, void *item, size_t *item_size)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
|
||||
TOS_PTR_SANITY_CHECK(ring_q);
|
||||
TOS_PTR_SANITY_CHECK(item);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&ring_q->knl_obj, KNL_OBJ_TYPE_RING_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
if (tos_ring_q_is_empty(ring_q)) {
|
||||
TOS_CPU_INT_ENABLE();
|
||||
return K_ERR_RING_Q_EMPTY;
|
||||
}
|
||||
|
||||
ring_q_item_copy_to(ring_q, item, item_size);
|
||||
ring_q_item_decrease(ring_q);
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ k_err_t tos_ring_q_flush(k_ring_q_t *ring_q)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
|
||||
TOS_PTR_SANITY_CHECK(ring_q);
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&ring_q->knl_obj, KNL_OBJ_TYPE_RING_QUEUE)) {
|
||||
return K_ERR_OBJ_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
ring_q->head = 0u;
|
||||
ring_q->tail = 0u;
|
||||
ring_q->total = 0;
|
||||
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
return K_ERR_NONE;
|
||||
}
|
||||
|
||||
__API__ int tos_ring_q_is_empty(k_ring_q_t *ring_q)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
int is_empty = 0;
|
||||
|
||||
if (!ring_q) {
|
||||
return K_FALSE;
|
||||
}
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&ring_q->knl_obj, KNL_OBJ_TYPE_RING_QUEUE)) {
|
||||
return K_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
is_empty = (ring_q->total == 0);
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
return is_empty;
|
||||
}
|
||||
|
||||
__API__ int tos_ring_q_is_full(k_ring_q_t *ring_q)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
int is_full = 0;
|
||||
|
||||
if (!ring_q) {
|
||||
return K_FALSE;
|
||||
}
|
||||
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
if (!knl_object_verify(&ring_q->knl_obj, KNL_OBJ_TYPE_RING_QUEUE)) {
|
||||
return K_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
is_full = (ring_q->total == ring_q->item_cnt);
|
||||
TOS_CPU_INT_ENABLE();
|
||||
|
||||
return is_full;
|
||||
}
|
||||
|
@@ -36,10 +36,6 @@ __API__ k_err_t tos_knl_init(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (TOS_CFG_MSG_EN) > 0
|
||||
msgpool_init();
|
||||
#endif
|
||||
|
||||
err = knl_idle_init();
|
||||
if (err != K_ERR_NONE) {
|
||||
return err;
|
||||
|
@@ -38,10 +38,15 @@ __STATIC_INLINE__ void task_reset(k_task_t *task)
|
||||
task->pend_state = PEND_STATE_NONE;
|
||||
task->pending_obj = (pend_obj_t *)K_NULL;
|
||||
|
||||
#if TOS_CFG_MSG_EN > 0u
|
||||
task->msg_addr = K_NULL;
|
||||
task->msg_size = 0;
|
||||
#if TOS_CFG_MESSAGE_QUEUE_EN > 0u
|
||||
task->msg = K_NULL;
|
||||
#endif
|
||||
|
||||
#if TOS_CFG_MAIL_QUEUE_EN > 0u
|
||||
task->mail = K_NULL;
|
||||
task->mail_size = 0;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
__STATIC__ void task_exit(void)
|
||||
|
@@ -74,7 +74,7 @@ typedef enum at_channel_status_en {
|
||||
|
||||
typedef struct at_data_channel_st {
|
||||
uint8_t is_free;
|
||||
k_fifo_t rx_fifo;
|
||||
k_chr_fifo_t rx_fifo;
|
||||
uint8_t *rx_fifo_buffer;
|
||||
k_mutex_t rx_lock;
|
||||
|
||||
@@ -105,27 +105,27 @@ typedef struct at_event_st {
|
||||
typedef struct at_agent_st {
|
||||
at_data_channel_t data_channel[AT_DATA_CHANNEL_NUM];
|
||||
|
||||
at_event_t *event_table;
|
||||
size_t event_table_size;
|
||||
at_event_t *event_table;
|
||||
size_t event_table_size;
|
||||
|
||||
at_echo_t *echo;
|
||||
at_echo_t *echo;
|
||||
|
||||
k_task_t parser;
|
||||
at_cache_t recv_cache;
|
||||
k_task_t parser;
|
||||
at_cache_t recv_cache;
|
||||
|
||||
at_timer_t timer;
|
||||
at_timer_t timer;
|
||||
|
||||
k_mutex_t global_lock;
|
||||
k_mutex_t global_lock;
|
||||
|
||||
char *cmd_buf;
|
||||
k_mutex_t cmd_buf_lock;
|
||||
char *cmd_buf;
|
||||
k_mutex_t cmd_buf_lock;
|
||||
|
||||
hal_uart_t uart;
|
||||
k_mutex_t uart_tx_lock;
|
||||
k_mutex_t uart_rx_lock;
|
||||
k_sem_t uart_rx_sem;
|
||||
k_fifo_t uart_rx_fifo;
|
||||
uint8_t *uart_rx_fifo_buffer;
|
||||
hal_uart_t uart;
|
||||
k_mutex_t uart_tx_lock;
|
||||
k_mutex_t uart_rx_lock;
|
||||
k_sem_t uart_rx_sem;
|
||||
k_chr_fifo_t uart_rx_fifo;
|
||||
uint8_t *uart_rx_fifo_buffer;
|
||||
} at_agent_t;
|
||||
|
||||
#define AT_AGENT ((at_agent_t *)(&at_agent))
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user