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

C++ CPU_CRITICAL_ENTER函数代码示例

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

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



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

示例1: 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


示例2: 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


示例3: OS_TLS_LockDel

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

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

    (void)OSMutexDel((OS_MUTEX *)&p_tls_lock->Mutex,
                     (OS_OPT    ) OS_OPT_DEL_ALWAYS,
                     (OS_ERR   *)&os_err);
    (void)&os_err;

    CPU_CRITICAL_ENTER();
                                                                  /* Return the OS_TLS_LOCK in front of the list      */
    if (OS_TLS_LockPoolListPtr == (OS_TLS_LOCK *)0) {
        p_tls_lock->NextPtr  = (OS_TLS_LOCK *)0;
    } else {
        p_tls_lock->NextPtr = OS_TLS_LockPoolListPtr;
    }
    OS_TLS_LockPoolListPtr = p_tls_lock;                      

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


示例4: IAP_JumpTo

/*******************************************************************************
 * 名    称: IAP_JumpTo()
 * 功    能: 跳转到应用程序段
 * 入口参数:
 * 出口参数: 无
 * 作   者: 无名沈
 * 创建日期: 2014-04-23
 * 修    改: 
 * 修改日期: 
 *******************************************************************************/
void IAP_JumpTo(u32 appAddr)
{    
    u32     JumpAddress = 0;
    u8      cpu_sr;
        
    /***********************************************
    * 描述: 保存程序地址
    */
    IAP_SetAppAddr(appAddr);
    /***********************************************
    * 描述: 关中断,防止值被中断修改
    */
    CPU_CRITICAL_ENTER();
    /***********************************************
    * 描述: 外设恢复默认,避免进入应用程序后影响程序正常运行
    */
    IAP_DevDeInit();  
    /***********************************************
    * 描述: 获取应用入口及初始化堆栈指针
    */
    JumpAddress   =*(volatile u32*) (appAddr + 4); // 地址+4为PC地址
    pApp          = (pFunction)JumpAddress;         // 函数指针指向APP
    __set_MSP       (*(volatile u32*) appAddr);    // 初始化主堆栈指针(MSP)
    __set_PSP       (*(volatile u32*) appAddr);    // 初始化进程堆栈指针(PSP)
    __set_CONTROL   (0);                            // 清零CONTROL
    /***********************************************
    * 描述: 跳转到APP程序
    */
    pApp();
    
    CPU_CRITICAL_EXIT();
}
开发者ID:redmorningcn,项目名称:NC136B-320,代码行数:42,代码来源:iap.c


示例5: 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


示例6: 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


示例7: OS_TLS_SetDestruct

void  OS_TLS_SetDestruct (OS_TLS_ID            id,
                          OS_TLS_DESTRUCT_PTR  p_destruct,
                          OS_ERR              *p_err)
{
    CPU_SR_ALLOC();


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

    if (id >= OS_TLS_NextAvailID) {                             /* See if we exceeded the number of TLS IDs available */
       *p_err = OS_ERR_TLS_ID_INVALID;
        return;
    }
     
    if (OS_TLS_DestructPtrTbl[id] != (OS_TLS_DESTRUCT_PTR)0) {  /* Can only assign a destructor once                  */
       *p_err = OS_ERR_TLS_DESTRUCT_ASSIGNED;
        return;
    }
     
    CPU_CRITICAL_ENTER();
    OS_TLS_DestructPtrTbl[id] = p_destruct;
    CPU_CRITICAL_EXIT();
   *p_err                     = OS_ERR_NONE;
}
开发者ID:Akagi201,项目名称:uCOS-III,代码行数:29,代码来源:os_tls.c


示例8: 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


示例9: 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


示例10: 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


示例11: 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


示例12: 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


示例13: 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


示例14: 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


示例15: 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


示例16: 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


示例17: SW1_Intr_Handler

// handler associated to SW1 (labeled SW2 on board)
void SW1_Intr_Handler(void)
{
  static uint32_t c_ifsr;          // port c interrupt flag status register
  uint32_t c_portBaseAddr = g_portBaseAddr[GPIO_EXTRACT_PORT(kGpioSW1)];
  uint32_t portPinMask = (1 << GPIO_EXTRACT_PIN(kGpioSW1));

  CPU_CRITICAL_ENTER();         // enter critical section (disable interrupts)

  OSIntEnter();         // notify to scheduler the beginning of an ISR ("This allows ?C/OS-III to keep track of interrupt nesting")

  c_ifsr = PORT_HAL_GetPortIntFlag(c_portBaseAddr);         // get intr flag reg related to port C

  if( (c_ifsr & portPinMask) ) // check if kGpioSW1 generated the interrupt [pin 6 -> 7th flag (flags start with index 0)]
  {
      //sem_sw1_post
    OSSemPost(&MySem1,
                         OS_OPT_POST_1 + OS_OPT_POST_NO_SCHED,
                        &os_err);
  }

  GPIO_DRV_ClearPinIntFlag( kGpioSW1 );
  CPU_CRITICAL_EXIT();  // renable interrupts

  OSIntExit();          /* notify to scheduler the end of an ISR ("determines if a higher priority task is ready-to-run.
                          If so, the interrupt returns to the higher priority task instead of the interrupted task.") */
}
开发者ID:sinkswim,项目名称:micriumOS-apps,代码行数:27,代码来源:sw1sw2_interrupts_lab5.c


示例18: 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


示例19: 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


示例20: OS_IntQTask

void  OS_IntQTask (void  *p_arg)
{
    CPU_BOOLEAN  done;
#if (OS_CFG_TS_EN == DEF_ENABLED)
    CPU_TS       ts_start;
    CPU_TS       ts_end;
#endif
    CPU_SR_ALLOC();



    (void)p_arg;                                                /* Not using 'p_arg', prevent compiler warning          */

    while (DEF_ON) {
        done = DEF_FALSE;
        while (done == DEF_FALSE) {
            CPU_CRITICAL_ENTER();
            if (OSIntQNbrEntries == 0u) {
#if (OS_CFG_DBG_EN == DEF_ENABLED)
                OSRdyList[0].NbrEntries = 0u;                   /* Remove from ready list                               */
#endif
                OSRdyList[0].HeadPtr    = DEF_NULL;
                OSRdyList[0].TailPtr    = DEF_NULL;
                OS_PrioRemove(0u);                              /* Remove from the priority table                       */
                CPU_CRITICAL_EXIT();
                OSSched();
                done = DEF_TRUE;                                /* No more entries in the queue, we are done            */
            } else {
                CPU_CRITICAL_EXIT();
#if (OS_CFG_TS_EN == DEF_ENABLED)
                ts_start = OS_TS_GET();
#endif
                OS_IntQRePost();
#if (OS_CFG_TS_EN == DEF_ENABLED)
                ts_end   = OS_TS_GET() - ts_start;              /* Measure execution time of tick task                  */
                if (OSIntQTaskTimeMax < ts_end) {
                    OSIntQTaskTimeMax = ts_end;
                }
#endif
                CPU_CRITICAL_ENTER();
                OSIntQOutPtr = OSIntQOutPtr->NextPtr;           /* Point to next item in the ISR queue                  */
                OSIntQNbrEntries--;
                CPU_CRITICAL_EXIT();
            }
        }
    }
}
开发者ID:wagnerN02645786,项目名称:Real_Time_Operating_Systems,代码行数:47,代码来源:os_int.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ CPU_CRITICAL_EXIT函数代码示例发布时间:2022-05-30
下一篇:
C++ CPU_COUNT函数代码示例发布时间: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