예제 #1
0
STATUS semBGive(SEM_ID semId)
{
	/* RAIN_TCB* pOwner; */
	int level = intLock();
	
	if(!IS_CLASS(semId, semClassId))
	{
		intUnlock(level);
		return (ERROR);
	}

	/*pOwner = semId->semOwner;*/

	if(NULL == (semId->semOwner = (RAIN_TCB*)Q_FIRST(&semId->qHead)))
	{
		intUnlock(level);
	}
	else
	{
		kernelState = TRUE;
		intUnlock(level);

		kernelPendQGet(&semId->qHead);

		kernelExit();
	}

	return (OK);
}
예제 #2
0
/*****************************************************************************
 Prototype      : MailBox_SpMsgWrite
 Description    : 专有邮箱读接口封装
 Input          : 
                ulAddr : 专有邮箱的偏移地址(从消息头开始的地址)
                ulSize : 初始值的大小(以字节为单位)
                pData  : 数据信息(不包含消息头信息)
 Return Value   : 
                0: 表示操作成功
                其他: 表示操作失败
*****************************************************************************/
u32 MailBox_SpMsgRead(u32 ulAddr, 
                          u32 ulSize, 
                          void* pData)
{
    s32 key;

    key = intLock();

    /* 如果DSP已睡眠,表示邮箱中无数据 */
    /* 如果DSP没睡眠,由锁中断保证不调度低功耗模块对DSP的下电处理 */
    if(BSP_TRUE == BSP_MailBox_IsDspSleep()) /*lint !e746*/
    {
        intUnlock(key);
        return ERR_MAILBOX_READ_NULL;
    }
    
    /* 判断当前消息是否已读走 */
    if(0 == *((u32*)ulAddr))
    {
        intUnlock(key);
        return ERR_MAILBOX_READ_NULL;
    }

    memcpy(pData, ((u8*)ulAddr + 4), ulSize);

    /* 设置可以DSP可以读 */
    *((u32*)ulAddr) = 0;
    
    intUnlock(key);

    return BSP_OK;
}
예제 #3
0
파일: wdLib.c 프로젝트: andy345/vxworks5
STATUS wdCancel
(
    WDOG_ID wdId        /* ID of watchdog to cancel */
)
{
    int level = intLock ();			/* LOCK INTERRUPTS */

    if (OBJ_VERIFY (wdId, wdClassId) != OK)
    {
        intUnlock (level);			/* UNLOCK INTERRUPTS */
        return (ERROR);
    }

#ifdef WV_INSTRUMENTATION
    /* windview - level 1 event logging */
    EVT_OBJ_1 (OBJ, wdId, wdClassId, EVENT_WDCANCEL, wdId);
#endif

    if (kernelState)
    {
        intUnlock (level);			/* UNLOCK INTERRUPTS */
        workQAdd1 ((FUNCPTR)windWdCancel, (int)wdId);
    }
    else
    {
        kernelState = TRUE;			/* KERNEL_ENT */
        intUnlock (level);			/* UNLOCK INTERRUPTS */

        windWdCancel (wdId);			/* cancel watchdog */

        windExit ();				/* KERNEL EXIT */
    }

    return (OK);
}
예제 #4
0
BOOLEAN uart_fifo_get_char
(
	UART_FIFO_T	*FifoCtx,
	BYTE		*charbuf	// Place to put data retrieved from the fifo
)
{
	// Protect the fifo manipulation operations from interrupts
	UINT32 oldlevel = intLock();

	// Is there data on the fifo?
	if ( FifoCtx->entry_cnt > 0 )
	{
		// Get data from the fifo context given to us
		*charbuf = FifoCtx->fifo[ FifoCtx->get_idx++ ];

		// Process the get index to account for queue wrapping
		if(	FifoCtx->get_idx >= SIZE_OF_UART_FIFO )
		{
			FifoCtx->get_idx = 0;
		}

		// Indicate an entry was removed from the queue
		FifoCtx->entry_cnt--;

		// Response successfully dequeued
		intUnlock(oldlevel);
		return TRUE;
	}
	else
	{
		// No response to remove from the queue.
		intUnlock(oldlevel);
		return FALSE;
	}
}
예제 #5
0
void UrgencyTask (void)
    {
    FAST int	key;
    Urgency_JOB_INFO * pInfo = &UrgencyJobInfo;


    FOREVER
	{
	/* wait for somebody to wake us up */

        semTake (&pInfo->sem, WAIT_FOREVER);


        key = intLock ();

        while (TRUE)
            {
            TODO_NODE * pHead;
            TODO_NODE * pNode;

            /* Pull all the active nodes off of the queue */

            if ( (pHead = pInfo->pHead) == NULL)
                break;

            pInfo->pHead = NULL;
            pInfo->pTail = NULL;

            intUnlock (key);

            pNode = pHead;

            while (TRUE)
                {
                pNode->routine (pNode->param1, pNode->param2,
                                pNode->param3, pNode->param4,
                                pNode->param5);

                if (pNode->pNext == NULL)
                    break;

                pNode = pNode->pNext;
                }

            /* Place all processed nodes on the free queue */

            key = intLock ();
            pNode->pNext = pInfo->pFree;
            pInfo->pFree = pHead;
            }

	intUnlock (key);

	}
    }
예제 #6
0
STATUS semBTake(SEM_ID semId, int timeout)
{
	int level;
	int status;

	/* TODO ISR no be allowed */

again:
	level = intLock();

	if(!IS_CLASS(semId, semClassId))
	{
		intUnlock(level);
		return (ERROR);
	}

	if(NULL == semId->semOwner)
	{
		semId->semOwner = (RAIN_TCB*)taskIdCurrent;
		intUnlock(level);

		return (OK);
	}

	/* semId have been take by other task */
	kernelState = TRUE;
	intUnlock(level);

	if(OK != kernelPendQPut(&semId->qHead, timeout))
	{
		kernelExit();

		return (ERROR);
	}

	/* test for interrupt in kernelState=TRUE of semGive */
	/*{
		int j = 1000000;
		while(j >= 0)
		{
			j--;
		}
	}*/
	
	if(RESTART == (status = kernelExit()))
	{
		goto again;
	}

	return (status);
}
예제 #7
0
파일: wdLib.c 프로젝트: andy345/vxworks5
STATUS wdStart
(
    WDOG_ID wdId,               /* watchdog ID */
    int delay,                  /* delay count, in ticks */
    FUNCPTR pRoutine,           /* routine to call on time-out */
    int parameter               /* parameter with which to call routine */
)
{
    int level = intLock ();			/* LOCK INTERRUPTS */

    if (OBJ_VERIFY (wdId, wdClassId) != OK)
    {
        intUnlock (level);			/* UNLOCK INTERRUPTS */
        return (ERROR);
    }

#ifdef WV_INSTRUMENTATION
    /* windview - level 1 event logging */
    EVT_OBJ_2 (OBJ, wdId, wdClassId, EVENT_WDSTART, wdId, delay);
#endif

    if (kernelState)				/* already in kernel? */
    {
        wdId->deferStartCnt ++;			/* bump the start count */
        wdId->wdParameter = parameter;		/* update w/ new parameter */
        wdId->wdRoutine   = pRoutine;		/* update w/ new routine */
        intUnlock (level);			/* UNLOCK INTERRUPTS */

        workQAdd2 (windWdStart, (int)wdId, delay);	/* defer the wdStart */
    }
    else
    {
        wdId->deferStartCnt  = 1;		/* initialize start count */
        wdId->wdParameter    = parameter;	/* update w/ new parameter */
        wdId->wdRoutine      = pRoutine;	/* update w/ new routine */
        kernelState	     = TRUE;		/* KERNEL ENTER */
        intUnlock (level);			/* UNLOCK INTERRUPTS */

        if (windWdStart (wdId, delay) != OK)	/* start the watchdog */
        {
            windExit ();			/* KERNEL EXIT */
            return (ERROR);
        }

        windExit ();				/* KERNEL EXIT */
    }

    return (OK);
}
예제 #8
0
파일: wdLib.c 프로젝트: andy345/vxworks5
WDOG_ID wdCreate (void)
{
    WDOG_ID wdId;
#ifdef WV_INSTRUMENTATION
    int level;
#endif

    if ((!wdLibInstalled) && (wdLibInit () != OK))
        return (NULL);				/* package init problem */

    wdId = (WDOG_ID) objAlloc (wdClassId);


    /* initialize allocated watchdog */

    if ((wdId != NULL) && (wdInit (wdId) != OK))
    {
        objFree (wdClassId, (char *) wdId);
        return (NULL);
    }

#ifdef WV_INSTRUMENTATION
    /* windview - level 1 event logging */
    level = intLock ();
    EVT_OBJ_1 (OBJ, wdId, wdClassId, EVENT_WDCREATE, wdId);
    intUnlock (level);
#endif

    return (wdId);
}
예제 #9
0
파일: bsp.c 프로젝트: liuning587/rtos_811
void sysHwInit0(void)
{
    intLock();

#if PLL_EN == 0
    /*  Not use PLL  不使用PLL      */
    SysCtlClockSet(CCLK_DIV
            | SYSCTL_USE_OSC
            | SYSCTL_OSC_MAIN
            | EXT_CLK);
 #else
    /*  Use PLL  使用PLL            */
    SysCtlClockSet(CCLK_DIV
            | SYSCTL_USE_PLL
            | SYSCTL_OSC_MAIN
            | EXT_CLK);
#endif

    intLibInit();

    //系统IO初始化
    bsp_gpio_init();

    //系统串口初始化
    sysSerialHwInit();

    intUnlock();

}
예제 #10
0
static void i8250InitChannel
    (
    I8250_CHAN *pChan
    )
    {
    int oldLevel;

    oldLevel = intLock ();

    /* 8 data bits, 1 stop bit, no parity */

    (*pChan->outByte) (pChan->lcr, 0x03);

    /* enable the receiver and transmitter */

    (*pChan->outByte) (pChan->mdc, 0x0b);

    (*pChan->inByte) (pChan->data);	/* clear the port */

    /* enables interrupts  */

    (*pChan->outByte) (pChan->ier,0x1);
    
    intUnlock (oldLevel);
    }
예제 #11
0
void ADSL_DisableIRQ2(void)
{
	register UINT32 temp;

	if (pF2_IRQ2_ISR == 0)
		return;

	temp = intLock();

#ifdef LEVEL_MODE_ADSL

	DisableInterruptCount++;
	if (pF2_IRQ2_ISR)
		SetGPIOIntEnable(GPIOINT_F2_IRQ2, 0);

	/* Indicate start of critical section for debug */
	SetGPIOF2PCS(TRUE);

	intUnlock(temp);

#else /* LEVEL_MODE_ADSL */

	oldValue[DisableInterruptCount]=temp;
	if (DisableInterruptCount == 0)
		/* Indicate start of critical section for debug */
		SetGPIOF2PCS(TRUE);
	DisableInterruptCount++;

#endif /* LEVEL_MODE_ADSL */
}
예제 #12
0
파일: wdbLib.c 프로젝트: andy345/vxworks5
void wdbSuspendSystemHere
    (
    void  (*callback)(),
    int   arg
    )
    {
    u_int	lockKey;
    WDB_IU_REGS	regSet;

    lockKey = intLock();

#if CPU==SIMNT
    sysClkDisable();
#endif
    if (WDB_CTX_SAVE (&regSet) == 0)
        {
        _sigCtxRtnValSet (&regSet, 1);
        wdbSuspendSystem (&regSet, callback, arg);
        }
#if CPU==SIMNT
    sysClkEnable();
#endif

    intUnlock (lockKey);
    }
예제 #13
0
void sysClkInt 
    (
    int timerNum
    )
    {
    int myLock;

    myLock = intLock();

    /* ack the interrupt */

    MIPS3_SD(sysClkBase + R_SCD_TIMER_CFG,
		M_SCD_TIMER_ENABLE | M_SCD_TIMER_MODE_CONTINUOUS);

#if defined(USE_SIBYTE_INTR)
    SOC_INTR_INVOKE();
#endif

    /* call system clock service routine */

    if (sysClkRoutine != NULL)
        (* sysClkRoutine) (sysClkArg);

    intUnlock(myLock);
    }
예제 #14
0
STATUS semDestroy(SEM_ID semId, BOOL dealloc)
{
    int level;

    level = intLock();

    if(!IS_CLASS(semId, semClassId))
    {
        return (ERROR);
    }

    objCoreTerminate(&semId->objCore);

    kernelState = TRUE;

    intUnlock(level);

    kernelSemDelete(semId);

    TASK_SAFE();

    kernelExit();

    if(dealloc)
    {
        objFree(semClassId, (char*)semId);
    }

    TASK_UNSAFE();

    return (OK);
}
예제 #15
0
파일: bsplib.c 프로젝트: OurDreams/mx207
void
bspHwInit(void)
{
    intLock();

    intUnlock();
}
예제 #16
0
void ns16550DevInit
(
    NS16550_CHAN * pChan	/* pointer to channel */
)
{
    int oldlevel = intLock ();

    /* initialize the driver function pointers in the SIO_CHAN's */

    pChan->pDrvFuncs    = &ns16550SioDrvFuncs;

    /* set the non BSP-specific constants */

    pChan->getTxChar    = ns16550DummyCallback;
    pChan->putRcvChar   = ns16550DummyCallback;
    pChan->channelMode  = 0;    /* undefined */
    pChan->options      = (CLOCAL | CREAD | CS8);
    pChan->mcr		= MCR_OUT2;

    /* reset the chip */

    ns16550InitChannel (pChan);

    intUnlock (oldlevel);
}
예제 #17
0
STATUS
pciIntDisconnect
    (
    VOIDFUNCPTR *vector,        /* interrupt vector to attach to     */
    VOIDFUNCPTR routine         /* routine to be called              */
    )
{
    int irq = IVEC_TO_INUM ((int)vector) - INT_NUM_IRQ0;
    PCI_INT_RTN *pRtn;
    int oldLevel;

    for (pRtn = (PCI_INT_RTN *)DLL_FIRST (&pciIntList[irq]); pRtn != NULL;
         pRtn = (PCI_INT_RTN *)DLL_NEXT (&pRtn->node)) {
        if (pRtn->routine == routine) {
            oldLevel = intLock ();                      /* LOCK INTERRUPT */
            dllRemove (&pciIntList[irq], &pRtn->node);
            intUnlock (oldLevel);                       /* UNLOCK INTERRUPT */

            free ((char *)pRtn);
            return (OK);
        }
    }

    return (ERROR);
}
예제 #18
0
void bcm_robo_mii_rx(UINT8 *b, int *l)
{
    M_BLK_ID pMblk;
    int s;
    int n = 10;

    *l = 0;

    while(*l == 0) {
        pMblk = robo_txrx_info.rx_head;
        if (pMblk != NULL) {
            s = intLock();
            robo_txrx_info.rx_head = pMblk->mBlkHdr.mNextPkt;
            if (robo_txrx_info.rx_head == NULL) {
                robo_txrx_info.rx_tail = NULL;
            }
            intUnlock(s);


            *l = pMblk->mBlkPktHdr.len;
            netMblkToBufCopy(pMblk, b, NULL);
            netMblkClChainFree(pMblk);
#ifdef ROBO_TXRX_DEBUG
            ROBO_TXRX_PRINT("DeQueued a packet %08x len = %d\n",
                            (int)pMblk, *l, 3, 4, 5, 6);
#endif
        } else {
            /* Wait for a packet */
            /* semTake(robo_txrx_info.rx_sem); */
            taskDelay(1);
            if (!(n--)) break;
        }
    }
}
/*-------------------------
 set  DMAcntl, SampleRate,
 <8bits unsigned mono>
  ------------------------*/
int prog_codec(void)
{
    UINT32 format;
    int lockkey;
 
    lockkey = intLock();

    /* Program record/playback sampling rate -- 11025 */


    /* DAC */
    format = DMRn_DMA | DMRn_AUTO |DMRn_TR_READ|DMRn_USIGN|DMRn_SIZE8|DMRn_MONO;
    writel(format, CS4281_pBA0+BA0_DMR0);
    
    writel(0x04, CS4281_pBA0+BA0_DACSR);

    /* ADC */
    format = DMRn_DMA | DMRn_AUTO |DMRn_TR_WRITE/*|DMRn_USIGN*/|DMRn_SIZE8|DMRn_MONO;
    writel(format, CS4281_pBA0+BA0_DMR1);

    writel(0x04, CS4281_pBA0+BA0_ADCSR);

    intUnlock(lockkey);
    return 0;
}
예제 #20
0
/*******************************************************************************
*
* spUartDevInit - initialise an SPUART channel
*
* This routine initialises some CNXT_SIO function pointers and then resets
* the chip in a quiescent state.  Before this routine is called, the BSP
* must already have initialised all the device addresses, etc. in the
* CNXT_UART structure.
*
* RETURNS: N/A
*******************************************************************************/
eUARTType spUartDevInit ( CNXT_UART *pUARTChan )
{
	static eUARTType spUartInitChannel(CNXT_UART *pUARTChan)  ;

	eUARTType eStatus;

	UINT32 oldlevel = intLock();

	HWSTATE.g_pUARTChan = pUARTChan;

	/* reset the chip */
	eStatus = spUartInitChannel(pUARTChan);

	pUARTChan->xmtr_uart_fifo.get_idx = 0;
	pUARTChan->xmtr_uart_fifo.put_idx = 0;
	pUARTChan->xmtr_uart_fifo.entry_cnt = 0;

	pUARTChan->rcvr_uart_fifo.get_idx = 0;
	pUARTChan->rcvr_uart_fifo.put_idx = 0;
	pUARTChan->rcvr_uart_fifo.entry_cnt = 0;

	intUnlock(oldlevel);

	return(eStatus);
}
예제 #21
0
파일: ns16550Sio.c 프로젝트: ariavie/bcm
LOCAL STATUS ns16550Open
    (
    NS16550_CHAN * pChan 	/* pointer to channel */
    )
    {
    FAST int     oldlevel;	/* current interrupt level mask */
    char mask;

    mask = ns16550RegRd(REGPTR(MCR, pChan)) & (MCR_RTS | MCR_DTR);

    if (mask != (MCR_RTS | MCR_DTR)) 
    	{
    	/* RTS and DTR not set yet */

    	oldlevel = intLock ();

	/* set RTS and DTR TRUE */

    	pChan->mcr |= (MCR_DTR | MCR_RTS); 
        ns16550RegWr(REGPTR(MCR, pChan) , pChan->mcr); 

    	/* clear Tx and receive and enable FIFO */

        ns16550RegWr(REGPTR(FCR, pChan) , (RxCLEAR | TxCLEAR | FIFO_ENABLE));

    	intUnlock (oldlevel);
	}

    return (OK);
    }
예제 #22
0
파일: ns16550Sio.c 프로젝트: ariavie/bcm
LOCAL STATUS  ns16550BaudSet
    (
    NS16550_CHAN * pChan,	/* pointer to channel */
    UINT	   baud		/* requested baud rate */
    )
    {
    int   oldlevel;
    int   divisor = ((pChan->xtal + (8 * baud)) / (16 * baud));

    /* disable interrupts during chip access */

    oldlevel = intLock ();

    /* Enable access to the divisor latches by setting DLAB in LCR. */
    ns16550RegWr(REGPTR(LCR, pChan) , LCR_DLAB | pChan->lcr);

    /* Set divisor latches. */

    ns16550RegWr(REGPTR(DLL,pChan) , divisor);
    ns16550RegWr(REGPTR(DLM,pChan) , (divisor >> 8));

    /* Restore line control register */

    ns16550RegWr(REGPTR(LCR, pChan) , pChan->lcr);

    pChan->baudRate = baud;
 
    intUnlock (oldlevel);

    return (OK);
    }
예제 #23
0
/*****************************************************************************
 Prototype      : BSP_MailBox_SpMsgRead
 Description    : 专有邮箱(Special Mailbox)的读接口
                  (由调用者保证调用接口时DSP处于非睡眠状态)
 Input          : 
                ulAddr : 专有邮箱的偏移地址(从消息头开始的地址)
                ulSize : 初始值的大小(以字节为单位)
                pData  : 数据信息(不包含消息头信息)
 Return Value   : 
                BSP_OK: 读取成功
                ERR_MAILBOX_READ_NULL: 无数据
                ERR_MAILBOX_NOT_INIT: 邮箱未初始化
                ERR_MAILBOX_PARAM_INCORRECT: 参数错误
*****************************************************************************/
u32 BSP_MailBox_SpMsgRead(u32 ulAddr, 
                              u32 ulSize, 
                              void* pData)
{
    s32 key = 0;
    u32 ret = 0;

    if(!(g_stMbxCtrl.bMbxInit))
    {
        g_stMbxMntn.stAbnormal.ulNInitSlic = BSP_GetSliceValue();
        return ERR_MAILBOX_NOT_INIT;
    }

    if((BSP_NULL == pData) || (0 == ulSize))
    {
        return ERR_MAILBOX_PARAM_INCORRECT;
    }

    key = intLock();
    
    ret = MailBox_SpMsgRead(ulAddr, ulSize, pData);

    intUnlock(key);

    return ret;
}
예제 #24
0
/*****************************************************************************
 Prototype      : MailBox_SpMsgWrite
 Description    : 专有邮箱写接口封装
 Input          : 
                ulAddr : 专有邮箱的地址
                ulSize : 缓冲区大小(以字节为单位)
                pData  : 缓冲区指针(不包含消息头信息)
 Return Value   : 
                0: 表示操作成功
                其他: 表示操作失败
*****************************************************************************/
u32 MailBox_SpMsgWrite(u32 ulAddr, 
                           u32 ulSize, 
                           void* pData)
{
    u32 ret = BSP_OK;
    s32 key;

    key = intLock();
    if(*((u32*)ulAddr))
    {
        /* 设置为无数据 */
        *((u32*)ulAddr) = 0;
        
        ret = ERR_MAILBOX_COVER;
    }
    
    memcpy(((u8*)ulAddr + 4), pData, ulSize);
    
    /* 设置为DSP可以读 */
    *((u32*)ulAddr) = 1;
    
    intUnlock(key);

    return ret;
}
예제 #25
0
int readSerialMod_9(int *intBuffer) 
{
	int  lvl;
    STATUS ret;
    unsigned char * buffer;
    unsigned char bufAux[9];
    int i, size = 0;
    
    buffer = (unsigned char *)(*intBuffer);
    ret = scMemValidate((void *)buffer, 9, SC_PROT_WRITE);
    if (ret == OK) {
        while (size < 9) {
            lvl = intLock ();         /* lock interrupts */	
            /* invoke the DLL refillBuffer routine */
            i = pDllReadSerial(bufAux,(9-size)); 
            intUnlock (lvl);          /* unlock interrupts */
            if (i > 0) {
                memcpy (&(buffer[size]),bufAux,i);
                size = size +i;
            }
        }
		return(size);	
	} else {
		printf ("reproducir: error en buffer\n");
		return(-1);	
	}
}
예제 #26
0
STATUS
pciIntConnect (VOIDFUNCPTR *vector, VOIDFUNCPTR routine, int parameter)
{
    static int alreadyConnected=FALSE;

    int irq = IVEC_TO_INUM ((int)vector) - sysVectorIRQ0;
    PCI_INT_RTN *pRtn;
    int oldLevel;

    pRtn = (PCI_INT_RTN *)malloc (sizeof (PCI_INT_RTN));
    if (pRtn == NULL) {
        return (ERROR);
    }

    pRtn->routine   = routine;
    pRtn->parameter = parameter;

    oldLevel = intLock ();                      /* LOCK INTERRUPT */
    dllAdd (&pciIntList[irq], &pRtn->node);
    intUnlock (oldLevel);                       /* UNLOCK INTERRUPT */

    if (!alreadyConnected) {
        if (intConnect(vector, (VOIDFUNCPTR) pciInt, irq) == ERROR) {
            return -1;
        }
        alreadyConnected=TRUE;
    }
    return (OK);
}
예제 #27
0
void et_drv_mii_rx(int unit, UINT8 *b, int *l)
{
    M_BLK_ID pMblk;
    int s;
    int n = 10;

    *l = 0;

    while(*l == 0) {
        pMblk = et_drv_txrx_info[unit].rx_head;
        if (pMblk != NULL) {
            s = intLock();
            et_drv_txrx_info[unit].rx_head = pMblk->mBlkHdr.mNextPkt;
            if (et_drv_txrx_info[unit].rx_head == NULL) {
                et_drv_txrx_info[unit].rx_tail = NULL;
            }
            intUnlock(s);

            *l = pMblk->mBlkPktHdr.len;
            netMblkToBufCopy(pMblk, (char *)b, NULL);
            netMblkClChainFree(pMblk);
            ET_DRV_TXRX_PRINT("DeQueued a packet %08x len = %d\n",
                            (int)pMblk, *l, 3, 4, 5, 6);
        } else {
            /* Wait for a packet */
            /* semTake(et_drv_txrx_info.rx_sem); */
            taskDelay(1);
            if (!(n--)) break;
        }
    }
}
예제 #28
0
static void wdbExcHook
    (
    WDB_CTX	context,
    u_int	vec,
    char *	pESF,
    WDB_IU_REGS	* pRegs
    )
    {
    wdbExcInfoNode_t *	pExcInfoNode;
    int			lockKey;

    /* get a node off the queue */

    lockKey = intLock();
    pExcInfoNode = (wdbExcInfoNode_t *)dll_tail (&wdbExcEvtList);

    /* if event list if full and this is a task exception, just return */

    if ((pExcInfoNode->valid) && (context.contextType == WDB_CTX_TASK))
	{
	intUnlock (lockKey);
	return;
	}

    pExcInfoNode->valid     = TRUE;
    pExcInfoNode->context   = context;
    pExcInfoNode->excVector = vec;
    pExcInfoNode->pESF	    = pESF;

    dll_remove (&pExcInfoNode->node);
    dll_insert (&pExcInfoNode->node, &wdbExcEvtList);
    intUnlock (lockKey);

    /* exception in task context */

    if (wdbIsNowTasking())
	{
	wdbEventPost (&wdbExcEvtNode);
	return;
	}

    /* exception in system context - suspend system before posting event */

    wdbSuspendSystem (pRegs, wdbEventPost, (int)&wdbExcEvtNode);

    /* NOTREACHED */
    }
예제 #29
0
파일: wdLib.c 프로젝트: andy345/vxworks5
STATUS wdDestroy
(
    WDOG_ID wdId,               /* ID of watchdog to terminate */
    BOOL    dealloc             /* dealloc associated memory */
)
{
    int level;

    if (INT_RESTRICT () != OK)			/* restrict isr use */
        return (ERROR);

    level = intLock ();				/* LOCK INTERRUPTS */

    if (OBJ_VERIFY (wdId, wdClassId) != OK)	/* validate watchdog ID */
    {
        intUnlock (level);			/* UNLOCK INTERRUPTS */
        return (ERROR);
    }

#ifdef WV_INSTRUMENTATION
    /* windview - level 1 event logging */
    EVT_OBJ_1 (OBJ, wdId, wdClassId, EVENT_WDDELETE, wdId);
#endif

    objCoreTerminate (&wdId->objCore);		/* invalidate watchdog */

    kernelState = TRUE;				/* KERNEL ENTER */

    intUnlock (level);				/* UNLOCK INTERRUPTS */

    windWdCancel (wdId);			/* cancel watchdog */

    wdId->status = WDOG_DEAD;			/* dead dog */

    TASK_SAFE ();				/* TASK SAFE */

    windExit ();				/* EXIT KERNEL */

    if (dealloc)
        objFree (wdClassId, (char *) wdId);	/* deallocate watchdog */

    TASK_UNSAFE ();				/* TASK UNSAFE */

    return (OK);
}
예제 #30
0
void ADSL_EnableIRQ1_2(void)
{
	register UINT32 temp;

	if (pF2_IRQ1_ISR == 0 && pF2_IRQ2_ISR == 0)
		return;

	temp= intLock();

#ifdef LEVEL_MODE_ADSL

	if (DisableInterruptCount)
		DisableInterruptCount--;
	if (DisableInterruptCount == 0)
	{
		/* Indicate out of critical section for debug */
		SetGPIOF2PCS(FALSE);

		if (pF2_IRQ1_ISR)
			SetGPIOIntEnable(GPIOINT_F2_IRQ1, 1);
		if (pF2_IRQ2_ISR)
			SetGPIOIntEnable(GPIOINT_F2_IRQ2, 1);
	}

	intUnlock(temp);

#else /* LEVEL_MODE_ADSL */

	if (DisableInterruptCount == 0)
	{
		intUnlock(temp);
		return;
	}

	DisableInterruptCount--;
	if (DisableInterruptCount == 0)
		/* Indicate out of critical section for debug */
		SetGPIOF2PCS(FALSE);

	/* Allow for nesting, push values onto a stack */
	intUnlock(temp);
	intUnlock(oldValue[DisableInterruptCount]);

#endif /* LEVEL_MODE_ADSL */
}