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

C++ CPU_SR_ALLOC函数代码示例

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

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



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

示例1: led0_task

//led0任务函数
void led0_task(void *p_arg)
{
	OS_ERR err;
	u8 test[20];
	u8 times = 0;
	CPU_SR_ALLOC();
	u8 temp;	
	p_arg = p_arg;
	while(1)
	{
		OS_CRITICAL_ENTER();
		temp = FloatTaskTCB.MsgQ.NbrEntriesSize - FloatTaskTCB.MsgQ.NbrEntries;
		printf("que remain %d.\r\n",temp);
		OS_CRITICAL_EXIT();	
		sprintf((char *)test,"led_send_que %d",times++);
		printf("led0 task send que.\r\n");
		OSTaskQPost((OS_TCB*	)&FloatTaskTCB,	//向任务Msgdis发送消息
					(void*		)test,
          (OS_MSG_SIZE)20,
          (OS_OPT		)OS_OPT_POST_FIFO,
					(OS_ERR*	)&err);
				
		OSTimeDlyHMSM(0,0,1,0,OS_OPT_TIME_HMSM_STRICT,&err); //延时1s	
			
	}
}
开发者ID:BearZPY,项目名称:STM32-uCOSIII,代码行数:27,代码来源:led_task.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: 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: 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


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


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


示例9: PngGetData

/*********************************************************************
*
*       PngGetData
*
* Function description
*   This routine is called by GUI_PNG_DrawEx(). The routine is responsible
*   for setting the data pointer to a valid data location with at least
*   one valid byte.
*
* Parameters:
*   p           - Pointer to application defined data.
*   NumBytesReq - Number of bytes requested.
*   ppData      - Pointer to data pointer. This pointer should be set to
*                 a valid location.
*   StartOfFile - If this flag is 1, the data pointer should be set to the
*                 beginning of the data stream.
*
* Return value:
*   Number of data bytes available.
*/
static int PngGetData(void * p, const U8 ** ppData, unsigned NumBytesReq, U32 Off) 
{
	static int readaddress=0;
	FIL * phFile;
	U8 *pData;
	UINT NumBytesRead;
	#if SYSTEM_SUPPORT_OS
		CPU_SR_ALLOC();
	#endif
	
	pData = (U8*)*ppData;
	phFile = (FIL *)p;
	
	//移动指针到应该读取的位置
	if(Off == 1) readaddress = 0;
	else readaddress=Off;
	
	#if SYSTEM_SUPPORT_OS
		OS_CRITICAL_ENTER();	//临界区
	#endif
	f_lseek(phFile,readaddress); 
	
	//读取数据到缓冲区中
	f_read(phFile,pData,NumBytesReq,&NumBytesRead);
	
		
	#if SYSTEM_SUPPORT_OS
		OS_CRITICAL_EXIT();//退出临界区
	#endif
	return NumBytesRead;//返回读取到的字节数
}
开发者ID:fanwenl,项目名称:STM32F469,代码行数:51,代码来源:displaypng.c


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


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


示例12: OSTimeDly

void  OSTimeDly (OS_TICK   dly,
                 OS_OPT    opt,
                 OS_ERR   *p_err)
{
    CPU_SR_ALLOC();



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

#if OS_CFG_CALLED_FROM_ISR_CHK_EN > 0u
    if (OSIntNestingCtr > (OS_NESTING_CTR)0u) {             /* Not allowed to call from an ISR                        */
       *p_err = OS_ERR_TIME_DLY_ISR;
        return;
    }
#endif

    if (OSSchedLockNestingCtr > (OS_NESTING_CTR)0u) {       /* Can't delay when the scheduler is locked               */
       *p_err = OS_ERR_SCHED_LOCKED;
        return;
    }

    switch (opt) {
        case OS_OPT_TIME_DLY:
        case OS_OPT_TIME_TIMEOUT:
        case OS_OPT_TIME_PERIODIC:
             if (dly == (OS_TICK)0u) {                      /* 0 means no delay!                                      */
                *p_err = OS_ERR_TIME_ZERO_DLY;
                 return;
             }
             break;

        case OS_OPT_TIME_MATCH:
             break;

        default:
            *p_err = OS_ERR_OPT_INVALID;
             return;
    }

    OS_CRITICAL_ENTER();
    OSTCBCurPtr->TaskState = OS_TASK_STATE_DLY;
    OS_TickListInsert(OSTCBCurPtr,
                      dly,
                      opt,
                      p_err);
    if (*p_err != OS_ERR_NONE) {
         OS_CRITICAL_EXIT_NO_SCHED();
         return;
    }
    OS_RdyListRemove(OSTCBCurPtr);                          /* Remove current task from ready list                    */
    OS_CRITICAL_EXIT_NO_SCHED();
    OSSched();                                              /* Find next task to run!                                 */
   *p_err = OS_ERR_NONE;
}
开发者ID:AtomicForceMiscrocopy,项目名称:ucos3-stm32f4-discovery-AFM,代码行数:60,代码来源:os_time.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: 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


示例15: OS_TickTask

void  OS_TickTask (void  *p_arg)
{
    OS_ERR  err;
    CPU_TS  ts_delta;
    CPU_TS  ts_delta_dly;
    CPU_TS  ts_delta_timeout;
    CPU_SR_ALLOC();


    (void)&p_arg;                                               /* Prevent compiler warning                             */

    while (DEF_ON) {
        (void)OSTaskSemPend((OS_TICK  )0,
                            (OS_OPT   )OS_OPT_PEND_BLOCKING,
                            (CPU_TS  *)0,
                            (OS_ERR  *)&err);                   /* Wait for signal from tick interrupt                  */
        if (err == OS_ERR_NONE) {
            OS_CRITICAL_ENTER();
            OSTickCtr++;                                        /* Keep track of the number of ticks                    */
#if (defined(TRACE_CFG_EN) && (TRACE_CFG_EN > 0u))
            TRACE_OS_TICK_INCREMENT(OSTickCtr);                 /* Record the event.                                    */
#endif
            OS_CRITICAL_EXIT();
            ts_delta_dly     = OS_TickListUpdateDly();
            ts_delta_timeout = OS_TickListUpdateTimeout();
            ts_delta         = ts_delta_dly + ts_delta_timeout; /* Compute total execution time of list updates         */
            if (OSTickTaskTimeMax < ts_delta) {
                OSTickTaskTimeMax = ts_delta;
            }
        }
    }
}
开发者ID:PlainSailing,项目名称:K60_uCOSIII,代码行数:32,代码来源:os_tick.c


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


示例17: float_task

//浮点测试任务
void float_task(void *p_arg)
{
	OS_ERR err;
	CPU_SR_ALLOC();
	static float float_num = 0.01;
	//uint32_t temp = &float_num;
	while(1)
	{
		float_num+=0.01f;
		OS_CRITICAL_ENTER();	//进入临界区
		//printf("float_num的值为: %.4f\r\n",float_num);
		OS_CRITICAL_EXIT();		//退出临界区
		if(float_num > 0.901f && float_num < 0.919f)
		{
				OSTaskSuspend((OS_TCB*)&Led0TaskTCB,&err);
				printf("挂起LED任务\n\r");
		}
		if(float_num > 1.991f && float_num < 2.001f)
		{
				OSTaskResume((OS_TCB*)&Led0TaskTCB,&err);
				printf("恢复LED任务\n\r");
				float_num = 0.0f;
		}
		OSTimeDlyHMSM(0,0,0,300,OS_OPT_TIME_HMSM_STRICT,&err); //延时300ms	
	}
}
开发者ID:HEKR-Cloud,项目名称:HEKR-MCU-SDK,代码行数:27,代码来源:float_task.c


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


示例19: main

//主函数
int main(void)
{
	OS_ERR err;
	CPU_SR_ALLOC();
	
	delay_init(168);  //时钟初始化
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//中断分组配置
	uart_init(115200);   //串口初始化
	LED_Init();         //LED初始化	
	LCD_Init();			//LCD初始化	
	KEY_Init();			//按键初始化
	BEEP_Init();		//初始化蜂鸣器
	FSMC_SRAM_Init();	//初始化SRAM
	my_mem_init(SRAMIN);//初始化内部RAM
	ucos_load_main_ui();//加载主UI
	
	OSInit(&err);		    //初始化UCOSIII
	OS_CRITICAL_ENTER();	//进入临界区			 
	//创建开始任务
	OSTaskCreate((OS_TCB 	* )&StartTaskTCB,		//任务控制块
				 (CPU_CHAR	* )"start task", 		//任务名字
                 (OS_TASK_PTR )start_task, 			//任务函数
                 (void		* )0,					//传递给任务函数的参数
                 (OS_PRIO	  )START_TASK_PRIO,     //任务优先级
                 (CPU_STK   * )&START_TASK_STK[0],	//任务堆栈基地址
                 (CPU_STK_SIZE)START_STK_SIZE/10,	//任务堆栈深度限位
                 (CPU_STK_SIZE)START_STK_SIZE,		//任务堆栈大小
                 (OS_MSG_QTY  )0,					//任务内部消息队列能够接收的最大消息数目,为0时禁止接收消息
                 (OS_TICK	  )0,					//当使能时间片轮转时的时间片长度,为0时为默认长度,
                 (void   	* )0,					//用户补充的存储区
                 (OS_OPT      )OS_OPT_TASK_STK_CHK|OS_OPT_TASK_STK_CLR, //任务选项
                 (OS_ERR 	* )&err);				//存放该函数错误时的返回值
	OS_CRITICAL_EXIT();	//退出临界区	 
	OSStart(&err);      //开启UCOSIII
}
开发者ID:wms124,项目名称:STM32_UCOSIII,代码行数:36,代码来源:main.c


示例20: CSP_DMA_XferStartExt

CPU_BOOLEAN  CSP_DMA_XferStartExt (CSP_DEV_NBR     ch_nbr,
                                   void           *p_dest,
                                   void           *p_src,                                   
                                   CPU_SIZE_T      xfer_size,
                                   CSP_OPT_FLAGS   opt)

{   
    CSP_DMA_REG     *p_dma_reg;
    CSP_DMA_CH_REG  *p_dma_ch_reg;
    CPU_INT32U       reg_ctrl;    
    CPU_SR_ALLOC();

                                                                /* ------------------ ARGUMENTS CHECKING -------------- */
#if (CSP_CFG_ARG_CHK_EN == DEF_ENABLED)             
    if (ch_nbr > CSP_DMA_CH_MAX_NBR - 1u) {                     /* Invalid channel number?                              */
        return (DEF_FAIL);
    }
                                                                /* Channel not available?                               */
    if (CSP_DMA_ChTbl[ch_nbr].State != CSP_DMA_CH_STATE_ALLOC) {
        return (DEF_FAIL);
    }

    if ((p_dest == (void *)0) ||                                /* Null pointers?                                        */
        (p_src  == (void *)0)) {
        return (DEF_FAIL);
    }    
#endif    

    p_dma_reg    = (CSP_DMA_REG *)CSP_ADDR_DMA_REG;                  
    p_dma_ch_reg = &(p_dma_reg->CHx[ch_nbr]);
    reg_ctrl     = p_dma_ch_reg->Ctrl;

    DEF_BIT_CLR(reg_ctrl, CSP_DMA_MSK_CH_CTRL_XFER_SIZE |
                          CSP_DMA_BIT_CH_CTRL_SI        |
                          CSP_DMA_BIT_CH_CTRL_DI        |
                          CSP_DMA_BIT_CH_CTRL_I);

    DEF_BIT_SET(reg_ctrl, (xfer_size & CSP_DMA_MSK_CH_CTRL_XFER_SIZE));

    if (DEF_BIT_IS_SET(opt, CSP_DMA_OPT_FLAG_XFER_SRC_INC)) {
        DEF_BIT_SET(reg_ctrl, CSP_DMA_BIT_CH_CTRL_SI);
    }
    
    if (DEF_BIT_IS_SET(opt, CSP_DMA_OPT_FLAG_XFER_DEST_INC)) {
        DEF_BIT_SET(reg_ctrl, CSP_DMA_BIT_CH_CTRL_DI);        
    }        
    
    
    CPU_CRITICAL_ENTER();
    p_dma_ch_reg->SrcAddr     = (CPU_INT32U )p_src;
    p_dma_ch_reg->DestAddr    = (CPU_INT32U )p_dest;       
    p_dma_ch_reg->Ctrl        = reg_ctrl;
    DEF_BIT_CLR(p_dma_ch_reg->Cfg, CSP_DMA_BIT_CH_CFG_ITC   | 
                                   CSP_DMA_BIT_CH_CFG_IE);
    DEF_BIT_SET(p_dma_ch_reg->Cfg, CSP_DMA_BIT_CH_CFG_CH_EN); 
    CPU_CRITICAL_EXIT();

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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