联盛德wifi芯片学习

1 综述

/*
*********************************************************************************************************
*                                           PEND ON SEMAPHORE
*
* Description: This function waits for a semaphore.
*
* Arguments  : sem        is a pointer to the event control block associated with the desired
*                            semaphore.
*
*              wait_time     是一个可选的时间段(in clock ticks)
*                            如果是非零,你的任务将等待资源直到设置的等待时间
*                            如果是零,你的任务将要等到指定信号量或直到资源变得可用(或发生事件)
*
* Returns    : TLS_OS_SUCCESS
*	           TLS_OS_ERROR
*********************************************************************************************************
*/
//该函数不可用于中断服务程序中
static __inline tls_os_status_t tls_os_sem_acquire(tls_os_sem_t *sem,
        u32 wait_time)
{
    INT8U error;
    tls_os_status_t os_status;
	unsigned int time;

	if(0 == wait_time)
		time = portMAX_DELAY;
	else
		time = wait_time;
	error = xSemaphoreTake( sem, time );
    if (error == pdPASS)
        os_status = TLS_OS_SUCCESS;
    else 
        os_status = TLS_OS_ERROR;

    return os_status;
}



/*
*********************************************************************************************************
*                                         删除一个信号量
*
* Description: 这个函数删除一个信号量 and readies 所有任务保留信号量.
*
* Arguments  : sem        is a pointer to the event control block associated with the desired
*                            semaphore.
*
* Returns    : TLS_OS_SUCCESS             The call was successful and the semaphore was deleted
*                            TLS_OS_ERROR          
*
*********************************************************************************************************
*/
static __inline tls_os_status_t tls_os_sem_delete(tls_os_sem_t *sem)
{
	vSemaphoreDelete(sem);

    return TLS_OS_SUCCESS; 
}



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值