コード例 #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
ファイル: serviceReq.c プロジェクト: jiezhi320/quadfork
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             */
}