• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ CPU_CRITICAL_EXIT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CPU_CRITICAL_EXIT函数的典型用法代码示例。如果您正苦于以下问题:C++ CPU_CRITICAL_EXIT函数的具体用法?C++ CPU_CRITICAL_EXIT怎么用?C++ CPU_CRITICAL_EXIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CPU_CRITICAL_EXIT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CPU_SR_ALLOC

void  *OSMemGet (OS_MEM  *p_mem,
                 OS_ERR  *p_err)
{
    void    *p_blk;
    CPU_SR_ALLOC();



#ifdef OS_SAFETY_CRITICAL
    if (p_err == (OS_ERR *)0) {
        OS_SAFETY_CRITICAL_EXCEPTION();
        return ((void *)0);
    }
#endif

#if OS_CFG_ARG_CHK_EN > 0u
    if (p_mem == (OS_MEM *)0) {                             /* Must point to a valid memory partition                 */
       *p_err  = OS_ERR_MEM_INVALID_P_MEM;
        return ((void *)0);
    }
#endif

    CPU_CRITICAL_ENTER();
    if (p_mem->NbrFree == (OS_MEM_QTY)0) {                  /* See if there are any free memory blocks                */
        CPU_CRITICAL_EXIT();
       *p_err = OS_ERR_MEM_NO_FREE_BLKS;                    /* No,  Notify caller of empty memory partition           */
        return ((void *)0);                                 /*      Return NULL pointer to caller                     */
    }
    p_blk              = p_mem->FreeListPtr;                /* Yes, point to next free memory block                   */
    p_mem->FreeListPtr = *(void **)p_blk;                   /*      Adjust pointer to new free list                   */
    p_mem->NbrFree--;                                       /*      One less memory block in this partition           */
    CPU_CRITICAL_EXIT();
   *p_err = OS_ERR_NONE;                                    /*      No error                                          */
    return (p_blk);                                         /*      Return memory block to caller                     */
}
开发者ID:FanNiu,项目名称:wildfire_stm32_iso_mini,代码行数:35,代码来源:os_mem.c


示例2: CPU_SR_ALLOC

void  *SerialOS_SemCreate (CPU_INT16U  cnt)
{
    OS_EVENT  *psem;
    INT8U      os_err;
    CPU_SR_ALLOC();


    CPU_CRITICAL_ENTER();
    if (OSEventObjIx < 1u) {
        CPU_CRITICAL_EXIT();
        return ((void *)0);
    }

    if (OSEventObjIx > SERIAL_OS_MAX_NBR_SEM) {
        CPU_CRITICAL_EXIT();
        return ((void *)0);
    }

                                                                /* -------------- GET OS EVENT FROM POOL -------------- */
    OSEventObjIx--;
    psem = OSEventObj[OSEventObjIx];
    CPU_CRITICAL_EXIT();

    OSSemSet(psem, cnt, &os_err);

    return ((void *)psem);
}
开发者ID:ptracton,项目名称:experimental,代码行数:27,代码来源:serial_os.c


示例3: SerialBuf_Cmp

CPU_BOOLEAN  SerialBuf_Cmp (SERIAL_BUF  *pbuf,
                            CPU_INT08U   datum)
{
    CPU_SIZE_T   ix_rd;
    CPU_BOOLEAN  full;
    CPU_SR_ALLOC();


    CPU_CRITICAL_ENTER();
    full = SerialBuf_IsFull(pbuf);
    if (full == DEF_NO) {
        CPU_CRITICAL_EXIT();
        return (DEF_NO);
    }

    ix_rd = pbuf->IxRd;
    if(pbuf->DataPtr[ix_rd] != datum) {
        pbuf->IxRd = 0;                                         /* Reset comparison.                                    */
        CPU_CRITICAL_EXIT();
        return (DEF_NO);
    }

    ix_rd++;

    if (ix_rd == pbuf->Len) {
        pbuf->IxRd = 0;
        CPU_CRITICAL_EXIT();
        return (DEF_YES);
    }

    pbuf->IxRd = ix_rd;
    CPU_CRITICAL_EXIT();
    return (DEF_NO);
}
开发者ID:ptracton,项目名称:experimental,代码行数:34,代码来源:serial_buf.c


示例4: wireless_exec_cmd

int wireless_exec_cmd(char *cmd)
{
    SHELL_ERR err;
    CPU_SR cpu_sr;
    struct net_device *net_dev;
    char s[45];

    CPU_CRITICAL_ENTER();
    if(!_pnet_device)
    {
        CPU_CRITICAL_EXIT();
        return -1;
    }    
    net_dev = _pnet_device;
    net_dev->status |= NET_IOCTL_RUNNING;
    CPU_CRITICAL_EXIT();
    
    strncpy(s,cmd,sizeof(s));
    Shell_Exec(s, NULL, NULL, &err);   

    CPU_CRITICAL_ENTER();
    net_dev->status &= ~NET_IOCTL_RUNNING;
    CPU_CRITICAL_EXIT();
    return 0; 
}
开发者ID:flyleaf91,项目名称:USB-Wireless-LAN-Driver-for-STM32F4xx,代码行数:25,代码来源:wlan.c


示例5: SerialOS_SemDel

void  SerialOS_SemDel (void  *psem)
{
    INT8U       os_err;
#if (SERIAL_CFG_ARG_CHK_EXT_EN == DEF_ENABLED)
    CPU_SIZE_T  i;
#endif
    CPU_SR_ALLOC();


    OSSemPendAbort((OS_EVENT *) psem,
                   (INT8U     ) OS_PEND_OPT_BROADCAST,
                   (INT8U    *)&os_err);

    CPU_CRITICAL_ENTER();
    if (OSEventObjIx >= SERIAL_OS_MAX_NBR_SEM) {
        CPU_CRITICAL_EXIT();
        return;
    }

#if (SERIAL_CFG_ARG_CHK_EXT_EN == DEF_ENABLED)                  /* ----------------- VALIDATE OS EVENT ---------------- */
    for (i = 0u; i < OSEventObjIx; i++) {
        if (OSEventObj[i] == (OS_EVENT *)psem) {
            CPU_CRITICAL_EXIT();
            return;
        }
    }
#endif
                                                                /* --------------- FREE OS EVENT TO POOL -------------- */
    OSEventObj[OSEventObjIx] = (OS_EVENT *)psem;
    OSEventObjIx++;

    CPU_CRITICAL_EXIT();
}
开发者ID:ptracton,项目名称:experimental,代码行数:33,代码来源:serial_os.c


示例6: tasklet_kill

//in t->func(t->data), don't restart tasklet_schedule,oterwise tasklet_kill will not exit.
void tasklet_kill(struct tasklet_struct *t)
{
    OS_ERR err;
    CPU_SR cpu_sr;
    
	if (in_interrupt())
		USBH_DBG("tasklet_kill Attempt to kill tasklet from interrupt\r\n");

    CPU_CRITICAL_ENTER();   
	while (t->state == TASKLET_STATE_SCHED){
        t->state = TASKLET_STATE_SCHED; 
		do {
            CPU_CRITICAL_EXIT();
			OSTimeDlyHMSM(0,0,0,5, OS_OPT_TIME_DLY,&err);
            CPU_CRITICAL_ENTER();  
		} while (t->state == TASKLET_STATE_SCHED);
	}
    CPU_CRITICAL_EXIT();
    
    
//	while (test_and_set_bit(TASKLET_STATE_SCHED, &t->state)) {
//		do {
//			yield();
//		} while (test_bit(TASKLET_STATE_SCHED, &t->state));
//	}
//	tasklet_unlock_wait(t);
//	clear_bit(TASKLET_STATE_SCHED, &t->state);
}
开发者ID:flyleaf91,项目名称:USB-Wireless-LAN-Driver-for-STM32F4xx,代码行数:29,代码来源:tasklet.c


示例7: SerialBuf_WrOctet

CPU_BOOLEAN  SerialBuf_WrOctet (SERIAL_BUF  *pbuf,
                                CPU_INT08U   datum)
{
    CPU_SIZE_T  empty_cnt;
    CPU_SIZE_T  ix_wr;
    CPU_SIZE_T  len;
    CPU_SR_ALLOC();


    CPU_CRITICAL_ENTER();
    empty_cnt = pbuf->EmptyCnt;

    if (empty_cnt == 0) {
        CPU_CRITICAL_EXIT();
        return (DEF_NO);
    }

    ix_wr                = pbuf->IxWr;
    pbuf->DataPtr[ix_wr] = datum;
    pbuf->EmptyCnt       = empty_cnt - 1;
    len                  = pbuf->Len;

    if (ix_wr + 1 == len) {
        pbuf->IxWr = 0;
    } else {
        pbuf->IxWr = ix_wr + 1;
    }
    CPU_CRITICAL_EXIT();

    return (DEF_YES);
}
开发者ID:ptracton,项目名称:experimental,代码行数:31,代码来源:serial_buf.c


示例8: SerialBuf_RdOctet

CPU_BOOLEAN  SerialBuf_RdOctet (SERIAL_BUF  *pbuf,
                                CPU_INT08U  *pdatum)
{
    CPU_SIZE_T  empty_cnt;
    CPU_SIZE_T  ix_rd;
    CPU_SIZE_T  len;
    CPU_SR_ALLOC();


    CPU_CRITICAL_ENTER();
    len       = pbuf->Len;
    empty_cnt = pbuf->EmptyCnt;

    if (empty_cnt == len) {
        CPU_CRITICAL_EXIT();
        return (DEF_NO);
    }

    ix_rd          = pbuf->IxRd;
   *pdatum         = pbuf->DataPtr[ix_rd];
    pbuf->EmptyCnt = empty_cnt + 1;

    if (ix_rd + 1 == len) {
        pbuf->IxRd = 0;
    } else {
        pbuf->IxRd = ix_rd + 1;
    }
    CPU_CRITICAL_EXIT();

    return (DEF_YES);
}
开发者ID:ptracton,项目名称:experimental,代码行数:31,代码来源:serial_buf.c


示例9: OS_TLS_GetID

OS_TLS_ID  OS_TLS_GetID (OS_ERR  *p_err)
{
    OS_TLS_ID  id;
    CPU_SR_ALLOC();



#ifdef OS_SAFETY_CRITICAL
    if (p_err == (OS_ERR *)0) {
        OS_SAFETY_CRITICAL_EXCEPTION();
        return ((OS_TLS_ID)OS_CFG_TLS_TBL_SIZE);
    }
#endif

    CPU_CRITICAL_ENTER();
    if (OS_TLS_NextAvailID >= OS_CFG_TLS_TBL_SIZE) {              /* See if we exceeded the number of IDs available   */
       *p_err = OS_ERR_TLS_NO_MORE_AVAIL;                         /* Yes, cannot allocate more TLS                    */
        CPU_CRITICAL_EXIT();
        return ((OS_TLS_ID)OS_CFG_TLS_TBL_SIZE);
    }
     
    id    = OS_TLS_NextAvailID;									  /* Assign the next available ID                     */
    OS_TLS_NextAvailID++;										  /* Increment available ID for next request          */
    CPU_CRITICAL_EXIT();
   *p_err = OS_ERR_NONE;
    return (id);
}
开发者ID:Akagi201,项目名称:uCOS-III,代码行数:27,代码来源:os_tls.c


示例10: OSMemPut

void  OSMemPut (OS_MEM  *p_mem,
                void    *p_blk,
                OS_ERR  *p_err)
{
    CPU_SR_ALLOC();



#ifdef OS_SAFETY_CRITICAL
    if (p_err == DEF_NULL) {
        OS_SAFETY_CRITICAL_EXCEPTION();
        return;
    }
#endif

#if (OS_CFG_ARG_CHK_EN == DEF_ENABLED)
    if (p_mem == DEF_NULL) {                                    /* Must point to a valid memory partition               */
#if (defined(TRACE_CFG_EN) && (TRACE_CFG_EN == DEF_ENABLED))
        TRACE_OS_MEM_PUT_FAILED(p_mem);                         /* Record the event.                                    */
#endif
       *p_err  = OS_ERR_MEM_INVALID_P_MEM;
        return;
    }
    if (p_blk == DEF_NULL) {                                    /* Must release a valid block                           */
#if (defined(TRACE_CFG_EN) && (TRACE_CFG_EN == DEF_ENABLED))
        TRACE_OS_MEM_PUT_FAILED(p_mem);                         /* Record the event.                                    */
#endif
       *p_err  = OS_ERR_MEM_INVALID_P_BLK;
        return;
    }
#endif

#if (OS_CFG_OBJ_TYPE_CHK_EN == DEF_ENABLED)
    if (p_mem->Type != OS_OBJ_TYPE_MEM) {                       /* Make sure the memory block was created               */
       *p_err = OS_ERR_OBJ_TYPE;
        return;
    }
#endif


    CPU_CRITICAL_ENTER();
    if (p_mem->NbrFree >= p_mem->NbrMax) {                      /* Make sure all blocks not already returned            */
        CPU_CRITICAL_EXIT();
#if (defined(TRACE_CFG_EN) && (TRACE_CFG_EN == DEF_ENABLED))
        TRACE_OS_MEM_PUT_FAILED(p_mem);                         /* Record the event.                                    */
#endif
       *p_err = OS_ERR_MEM_FULL;
        return;
    }
    *(void **)p_blk    = p_mem->FreeListPtr;                    /* Insert released block into free block list           */
    p_mem->FreeListPtr = p_blk;
    p_mem->NbrFree++;                                           /* One more memory block in this partition              */
    CPU_CRITICAL_EXIT();
#if (defined(TRACE_CFG_EN) && (TRACE_CFG_EN == DEF_ENABLED))
    TRACE_OS_MEM_PUT(p_mem);                                    /* Record the event.                                    */
#endif
   *p_err              = OS_ERR_NONE;                           /* Notify caller that memory block was released         */
}
开发者ID:wagnerN02645786,项目名称:Real_Time_Operating_Systems,代码行数:58,代码来源:os_mem.c


示例11: OS_SemPost

OS_SEM_CTR  OS_SemPost (OS_SEM  *p_sem,
                        OS_OPT   opt,
                        CPU_TS   ts,
                        OS_ERR  *p_err)
{
    OS_SEM_CTR     ctr;
    OS_PEND_LIST  *p_pend_list;
    OS_PEND_DATA  *p_pend_data;
    OS_PEND_DATA  *p_pend_data_next;
    OS_TCB        *p_tcb;
    CPU_SR_ALLOC();


    CPU_CRITICAL_ENTER();
    p_pend_list = &p_sem->PendList;
    if (p_pend_list->HeadPtr == DEF_NULL) {                     /* Any task waiting on semaphore?                       */
        if (p_sem->Ctr == (OS_SEM_CTR)-1) {
           CPU_CRITICAL_EXIT();
          *p_err = OS_ERR_SEM_OVF;
           return (0u);
        }
        p_sem->Ctr++;                                           /* No                                                   */
        ctr       = p_sem->Ctr;
#if (OS_CFG_TS_EN == DEF_ENABLED)
        p_sem->TS = ts;                                         /* Save timestamp in semaphore control block            */
#endif
        CPU_CRITICAL_EXIT();
       *p_err     = OS_ERR_NONE;
        return (ctr);
    }

    OS_CRITICAL_ENTER_CPU_EXIT();
    p_pend_data = p_pend_list->HeadPtr;
    while (p_pend_data != DEF_NULL) {
        p_tcb            = p_pend_data->TCBPtr;
        p_pend_data_next = p_pend_data->NextPtr;
        OS_Post((OS_PEND_OBJ *)((void *)p_sem),
                p_tcb,
                DEF_NULL,
                0u,
                ts);
        if ((opt & OS_OPT_POST_ALL) == 0) {                     /* Post to all tasks waiting?                           */
            break;                                              /* No                                                   */
        }
        p_pend_data = p_pend_data_next;
    }
    OS_CRITICAL_EXIT_NO_SCHED();
    if ((opt & OS_OPT_POST_NO_SCHED) == 0u) {
        OSSched();                                              /* Run the scheduler                                    */
    }
   *p_err = OS_ERR_NONE;
    return (0u);
}
开发者ID:wagnerN02645786,项目名称:Real_Time_Operating_Systems,代码行数:53,代码来源:os_sem.c


示例12: CPU_SR_ALLOC

void  *OSMemGet (OS_MEM  *p_mem,
                 OS_ERR  *p_err)
{
    void    *p_blk;
    CPU_SR_ALLOC();



#ifdef OS_SAFETY_CRITICAL
    if (p_err == DEF_NULL) {
        OS_SAFETY_CRITICAL_EXCEPTION();
        return (DEF_NULL);
    }
#endif

#if (OS_CFG_ARG_CHK_EN == DEF_ENABLED)
    if (p_mem == DEF_NULL) {                                    /* Must point to a valid memory partition               */
#if (defined(TRACE_CFG_EN) && (TRACE_CFG_EN == DEF_ENABLED))
        TRACE_OS_MEM_GET_FAILED(p_mem);                         /* Record the event.                                    */
#endif
       *p_err  = OS_ERR_MEM_INVALID_P_MEM;
        return (DEF_NULL);
    }
#endif

#if (OS_CFG_OBJ_TYPE_CHK_EN == DEF_ENABLED)
    if (p_mem->Type != OS_OBJ_TYPE_MEM) {                       /* Make sure the memory block was created               */
       *p_err = OS_ERR_OBJ_TYPE;
        return (DEF_NULL);
    }
#endif


    CPU_CRITICAL_ENTER();
    if (p_mem->NbrFree == 0u) {                                 /* See if there are any free memory blocks              */
        CPU_CRITICAL_EXIT();
#if (defined(TRACE_CFG_EN) && (TRACE_CFG_EN == DEF_ENABLED))
        TRACE_OS_MEM_GET_FAILED(p_mem);                         /* Record the event.                                    */
#endif
       *p_err = OS_ERR_MEM_NO_FREE_BLKS;                        /* No,  Notify caller of empty memory partition         */
        return (DEF_NULL);                                      /* Return NULL pointer to caller                        */
    }
    p_blk              = p_mem->FreeListPtr;                    /* Yes, point to next free memory block                 */
    p_mem->FreeListPtr = *(void **)p_blk;                       /* Adjust pointer to new free list                      */
    p_mem->NbrFree--;                                           /* One less memory block in this partition              */
    CPU_CRITICAL_EXIT();
#if (defined(TRACE_CFG_EN) && (TRACE_CFG_EN == DEF_ENABLED))
    TRACE_OS_MEM_GET(p_mem);                                    /* Record the event.                                    */
#endif
   *p_err = OS_ERR_NONE;                                        /* No error                                             */
    return (p_blk);                                             /* Return memory block to caller                        */
}
开发者ID:wagnerN02645786,项目名称:Real_Time_Operating_Systems,代码行数:52,代码来源:os_mem.c


示例13: OS_TLS_LockCreate

void  OS_TLS_LockCreate (void  **p_lock)
{
    OS_TLS_LOCK   *p_tls_lock;
    OS_ERR         os_err;
    CPU_SR_ALLOC();

    
    if (p_lock == (void **)0) {
        return;
    }

    if (OS_TLS_LockPoolListPtr == (OS_TLS_LOCK *)0) {             /* If 'OS_TLS_LOCK' object pool is empty?           */
        *p_lock = (void *)0;                                      /*   return a 'NULL' pointer.                       */
        return;
    }

    p_tls_lock = OS_TLS_LockPoolListPtr;                          /* Get the first object in the list.                */

    OSMutexCreate((OS_MUTEX *)&p_tls_lock->Mutex,                 /* Create the mutex in the kernel.                  */
                  (CPU_CHAR *) 0,				       
                  (OS_ERR   *)&os_err);			       
                             					       
    if (os_err != OS_ERR_NONE) {                                  /* If the mutex create funtion fail?                */
        *p_lock = (void *)0;                                      /* ... return a 'NULL' pointer.                     */
         return;        						       
    }											       

    CPU_CRITICAL_ENTER();
    OS_TLS_LockPoolListPtr = p_tls_lock->NextPtr;                 /* Move HEAD pointer to the next object in the list.*/
    CPU_CRITICAL_EXIT();
    
    *p_lock = (void *)p_tls_lock;                                 /* Return the new 'OS_TLS_LOCK' object pointer.     */
}
开发者ID:Akagi201,项目名称:uCOS-III,代码行数:33,代码来源:os_tls.c


示例14: OSView_RxTxISRHandler

/*
*********************************************************************************************************
*                                Rx/Tx Communication handler for uC/OS-View
*
* Description: This function is  called in stm32f10x_it.c 
*********************************************************************************************************
*/ 
void  OSView_RxTxISRHandler (void)
{
    CPU_SR          cpu_sr;

    CPU_CRITICAL_ENTER();                                       /* Tell uC/OS-II that we are starting an ISR            */
    OSIntNesting++;
    CPU_CRITICAL_EXIT();


    if (USART_GetITStatus(OS_VIEW_USART, USART_IT_RXNE) != RESET) {
                      /* Read one byte from the receive data register         */
        OSView_RxHandler( USART_ReceiveData(OS_VIEW_USART) & 0xFF );

        USART_ClearITPendingBit(OS_VIEW_USART, USART_IT_RXNE);          /* Clear the USART Receive interrupt                   */

    }

    if (USART_GetITStatus(OS_VIEW_USART, USART_IT_TXE) != RESET) {
        OSView_TxHandler();

        USART_ClearITPendingBit(OS_VIEW_USART, USART_IT_TXE);           /* Clear the USART transmit interrupt                  */

    }

    OSIntExit();                                                /* Tell uC/OS-II that we are leaving the ISR            */
}
开发者ID:sunyao8,项目名称:control,代码行数:33,代码来源:os_viewc.c


示例15: OS_TLS_Init

void  OS_TLS_Init (OS_ERR *p_err)
{
    CPU_INT16U    ix;
    OS_TLS_LOCK  *p_lock;
    CPU_SR_ALLOC();



    OS_TLS_NextAvailID = 0u;
    OS_TLS_LibID       = OS_TLS_GetID(p_err);
    
    CPU_CRITICAL_ENTER();    
                                                                   /* Create the link list of OS_TLS_LOCK objects.    */
    for (ix = 0u; ix < (OS_TLS_LOCK_MAX - 1u); ix++) {
        p_lock             = &OS_TLS_LockPoolTbl[ix];
        p_lock->NextPtr    = &OS_TLS_LockPoolTbl[ix + 1u];
    }
    
    p_lock                 = &OS_TLS_LockPoolTbl[OS_TLS_LOCK_MAX - 1u];
    p_lock->NextPtr        = (OS_TLS_LOCK *)0;                     /* Last node points to 'NULL'                      */

    OS_TLS_LockPoolListPtr = &OS_TLS_LockPoolTbl[0];               /* Initialize the list head pointer.               */

    CPU_CRITICAL_EXIT();    
}
开发者ID:Akagi201,项目名称:uCOS-III,代码行数:25,代码来源:os_tls.c


示例16: CSP_DMA_CH_FreeExt

CPU_BOOLEAN  CSP_DMA_CH_FreeExt (CSP_DEV_NBR  ch_nbr)
                               
{
    CSP_DMA_REG     *p_dma_reg;    
    CSP_DMA_CH_REG  *p_dma_ch_reg;
    CSP_DMA_CH      *p_ch_tbl;
    
    CPU_SR_ALLOC();

#if (CSP_CFG_ARG_CHK_EN == DEF_ENABLED)         
    if (ch_nbr > CSP_DMA_CH_MAX_NBR - 1u) {
        return (DEF_FAIL);
    }
#endif    

    p_dma_reg    = (CSP_DMA_REG *)CSP_ADDR_DMA_REG;
    p_dma_ch_reg = &(p_dma_reg->CHx[ch_nbr]);
    p_ch_tbl     = &CSP_DMA_ChTbl[ch_nbr];
        
    CPU_CRITICAL_ENTER();
    p_dma_reg->IntTCClr    = DEF_BIT(ch_nbr);                   /* Clear all pending interrupts.                        */
    p_dma_reg->IntErrClr   = DEF_BIT(ch_nbr);    
    p_ch_tbl->State        = CSP_DMA_CH_STATE_FREE;             /* Free the channel.                                    */
    p_dma_ch_reg->SrcAddr  = DEF_BIT_NONE;                      /* Unitialize DMA channel cfg & ctrl registers.         */
    p_dma_ch_reg->DestAddr = DEF_BIT_NONE;
    p_dma_ch_reg->Cfg      = DEF_BIT_NONE;
    p_dma_ch_reg->Ctrl     = DEF_BIT_NONE;       
    CPU_CRITICAL_EXIT();

    return (DEF_OK);
}
开发者ID:strahlex,项目名称:LPC_Ethernet,代码行数:31,代码来源:csp_dma.c


示例17: IsEmptyQueue

/*******************************************************************
函数功能: 判断CAN队列是否为空
返 回 值: 1: 空; 0:非空
********************************************************************/
u8 IsEmptyQueue(_CANQUEUE* canqueue)
{
	CPU_SR_ALLOC();// 申请cpu_sr
	////
	CPU_CRITICAL_ENTER(); // 关键段,关闭全局中断,视具体情况添加此语句
    if(canqueue->front == canqueue->rear)
    {
		CPU_CRITICAL_EXIT(); // 退出关键段,开启全局中断,视具体情况添加此语句
        return 1;
    }
    else
    {
		CPU_CRITICAL_EXIT(); // 退出关键段,开启全局中断,视具体情况添加此语句
        return 0;
    }
}
开发者ID:Psunshine,项目名称:MainBoard,代码行数:20,代码来源:CANQueue.c


示例18: IsFullQueue

/*******************************************************************
函数功能: 判队列是否满
返 回 值: 1: 满; 0:非满
********************************************************************/
u8 IsFullQueue(_CANQUEUE* canqueue)
{
	CPU_SR_ALLOC();// 申请cpu_sr
	////
	CPU_CRITICAL_ENTER(); // 关键段,关闭全局中断,视具体情况添加此语句
    if(((MAX_CAN_QUEUE_SIZE - canqueue->front) + canqueue->rear) == (MAX_CAN_QUEUE_SIZE - 1))
    {
		CPU_CRITICAL_EXIT(); // 退出关键段,开启全局中断,视具体情况添加此语句
        return 1;
    }
    else
    {
		CPU_CRITICAL_EXIT(); // 退出关键段,开启全局中断,视具体情况添加此语句
        return 0;
    }
}
开发者ID:Psunshine,项目名称:MainBoard,代码行数:20,代码来源:CANQueue.c


示例19: CSP_TmrInit

void  CSP_TmrInit (void)
{
    CSP_DEV_NBR  per_nbr;
    CSP_DEV_NBR  tmr_nbr;
    CSP_TMR_REG  *p_tmr_reg;
    CPU_SR_ALLOC();


    for (tmr_nbr = CSP_TMR_NBR_00; tmr_nbr <= CSP_TMR_NBR_03; tmr_nbr++) {
        p_tmr_reg = (CSP_TMR_REG *)CSP_TmrAddrTbl[tmr_nbr];
        per_nbr   = (CSP_DEV_NBR  )CSP_TmrPerTbl[tmr_nbr];
        
        CPU_CRITICAL_ENTER();
        CSP_PM_PerClkEn(per_nbr);
        p_tmr_reg->MCR    = DEF_BIT_NONE;
        p_tmr_reg->MRx[0] = 0u;
        p_tmr_reg->MRx[1] = 0u;
        p_tmr_reg->MRx[2] = 0u;
        p_tmr_reg->IR     = DEF_BIT_FIELD(5u, 0u);
        p_tmr_reg->TCR    = DEF_BIT_NONE;        
        p_tmr_reg->MCR    = DEF_BIT_NONE;
        p_tmr_reg->EMR    = DEF_BIT_NONE;
        CSP_PM_PerClkDis(per_nbr);        
        CPU_CRITICAL_EXIT();
    }
}
开发者ID:strahlex,项目名称:LPC_Ethernet,代码行数:26,代码来源:csp_tmr.c


示例20: tasklet_action

void tasklet_action(void *p_arg)
{
    OS_ERR err;
    OS_MSG_SIZE msg_size;
    struct tasklet_struct *t;
    CPU_SR cpu_sr;


    while(1)
    {
        t = OSTaskQPend(0, OS_OPT_PEND_BLOCKING, &msg_size, 0,&err);
        if(err != OS_ERR_NONE)
        {
            USBH_DBG("tasklet_schedule OSTaskQPend Failed %d\r\n",err);
            continue;
        }
        if(!t){
            USBH_DBG("tasklet_schedule t == NULL\r\n");
            continue;
        }

        
//        OSSchedLock(&err);
        CPU_CRITICAL_ENTER();
        if(t->state == TASKLET_STATE_UNSCHED)
            USBH_DBG("tasklet_action Error at %d\r\n",__LINE__);
        t->state = TASKLET_STATE_UNSCHED;
        CPU_CRITICAL_EXIT();      
        
        t->func(t->data);
//        OSSchedUnlock(&err);
    }

}
开发者ID:flyleaf91,项目名称:USB-Wireless-LAN-Driver-for-STM32F4xx,代码行数:34,代码来源:tasklet.c



注:本文中的CPU_CRITICAL_EXIT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CPU_DATA_CACHE函数代码示例发布时间:2022-05-30
下一篇:
C++ CPU_CRITICAL_ENTER函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap