1. 程式人生 > >lwIP(Light Weight IP)協議

lwIP(Light Weight IP)協議

  • 訊號量

  訊號量結構體:struct sys_semt

    struct _sys_sem {
    void *sem;
    };

        err_t sys_sem_new(sys_sem_t *sem, u8_t count)                 新建訊號量

        void sys_sem_signal(sys_sem_t *sem)                                  傳送訊號量

        u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout) 等待訊號量

        void sys_sem_free(sys_sem_t *sem)                                        刪除訊號量

        int sys_sem_valid(sys_sem_t *sem)                                        查詢是否可用

        void sys_sem_set_invalid(sys_sem_t *sem)                            設定為失效

   

    void sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg)//設定一個超時事件

    void sys_untimeout(sys_timeout_handler h, void *arg)//刪除一個超時事件

  • 互斥鎖

  

  err_t sys_mutex_new(sys_mutex_t *mutex)                  新建鎖

        void sys_mutex_lock(sys_mutex_t *mutex)                  獲取鎖

        void sys_mutex_unlock(sys_mutex_t *mutex)             釋放鎖

        void sys_mutex_free(sys_mutex_t *mutex)                   刪除鎖

        int sys_mutex_valid(sys_mutex_t *mutex)                    查詢鎖是否可用

        void sys_mutex_set_invalid(sys_mutex_t *mutex)        設定鎖為失效

 

 

  • 建立執行緒

  sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio)