예제 #1
0
BOOL InsertInSRQ(U8 type,U8 id,void* arg)
{
    U16 cnt;
    P_SQC pcell;
    cnt = Inc8(&ServiceReq.cnt);        /* Service request counter decrease   */
    if(cnt >= CFG_MAX_SERVICE_REQUEST)  /* If counter exceed max              */
    {
        return FALSE;                   /* Error return                       */
    }
    IsrReq = TRUE;
    pcell = &ServiceReq.cell[cnt]; /* Save service request type and parameter */
    pcell->type = type;
    pcell->id   = id;
    pcell->arg  = arg;
    return TRUE;                        /* Return OK                          */
}
예제 #2
0
BOOL InsertInSRQ(U8 type,U8 id,void* arg) {
	P_SQC   pcell;
	U8 cnt;
	U8 heed;
	IRQ_DISABLE_SAVE();
	if (ServiceReq.cnt >= CFG_MAX_SERVICE_REQUEST) {
		IRQ_ENABLE_RESTORE ();

		return Co_FALSE;                   /* Error return                       */
	}
	cnt = Inc8(&ServiceReq.cnt);
	heed = ServiceReq.head;
	IsrReq = Co_TRUE;
	pcell = &ServiceReq.cell[((cnt+heed)%CFG_MAX_SERVICE_REQUEST)];/*the tail */
	pcell->type = type;                 /* Save service request type,         */
	pcell->id   = id;                   /* event id                           */
	pcell->arg  = arg;                  /* and parameter                      */
	IRQ_ENABLE_RESTORE ();

	return Co_TRUE;                        /* Return OK                          */
}
예제 #3
0
파일: core.c 프로젝트: jiezhi320/quadfork
/**
 *******************************************************************************
 * @brief      Enter a ISR.
 * @param[in]  None
 * @param[out] None
 * @retval     None
 *
 * @par Description
 * @details    This function is called to notify OS when enter to an ISR.
 *
 * @note       When you call API in ISR,you must call CoEnterISR() before your
 *             interrupt handler code,and call CoExitISR() after your handler
 *             code and before exiting from ISR.
 *******************************************************************************
 */
void CoEnterISR(void) {
	Inc8(&OSIntNesting);                /* OSIntNesting increment             */
}