Beispiel #1
0
void CnxtAdslLEDTask(void *sem)
{
    BOOL HandShakeLED;
    BOOL ShowtimeLED;

    struct task_struct *tsk = current ;
    tsk->session = 1 ;
    tsk->pgrp = 1 ;
    strcpy ( tsk->comm, "CnxtAdslLEDTask" ) ;

    /* sigstop and sigcont will stop and wakeup kupdate */
    spin_lock_irq(&tsk->sigmask_lock);
    sigfillset(&tsk->blocked);
    siginitsetinv(&current->blocked, sigmask(SIGCONT) | sigmask(SIGSTOP));
    recalc_sigpending(tsk);
    spin_unlock_irq(&tsk->sigmask_lock);

    up((struct semaphore *)sem);

    while(1)
    {
        /* Condensed Showtime State to two Booleans - In Showtime and In Training */
        ShowtimeLED= FALSE;
        HandShakeLED= FALSE;

        switch (HWSTATE.dwLineStatus)
        {
        case HW_IO_MODEM_STATUS_ACTIVATED:
            ShowtimeLED= TRUE;
            break;

        case HW_IO_MODEM_STATUS_CHANNEL_ANALYSIS:
        case HW_IO_MODEM_STATUS_TRANSCEIVER_TRAINING:
        case HW_IO_MODEM_STATUS_EXCHANGE:
        case HW_IO_MODEM_STATUS_ACTIVATION:
            HandShakeLED= TRUE;
            break;
        }

        /* Blink Showtime LED if in Training */
        if (ShowtimeLED || HandShakeLED)
        {
            WriteGPIOData( GPOUT_SHOWTIME_LED,LED_ON );
        }

        /* This logic is for a blinking Showtime LED */
        if (!ShowtimeLED)
        {
            WriteGPIOData( GPOUT_SHOWTIME_LED,LED_OFF );
        }

        TaskDelayMsec(LED_DELAY_PERIOD);

    }
}
Beispiel #2
0
BOOLEAN uart_xmtr_fifo_put_chars
(
	BYTE		*charbuf,	// Pointer to data to be put on fifo
	UINT16		charbufsize	// Number of characters to be put on fifo
)
{

	BYTE		*pChar;
	UINT16		numcharsput;
	UINT16		numcharsleft;
	CNXT_UART	*pUARTChan = &spUartChan[0];

	numcharsleft = charbufsize;
	pChar = charbuf;

	while( 1 )
	{
		UINT8 IERStatus ;

		// Put the characters into the transmitter fifo
		numcharsput = uart_fifo_put_chars( &pUARTChan->xmtr_uart_fifo, pChar, numcharsleft );

		//adjust the character pointer and the character count.
		pChar += numcharsput;
		numcharsleft -= numcharsput;

		// Is the transmit interrupt disabled?
		// (It gets disabled in the ISR when it empties the FIFO)
		if
		(
			( HW_UART == HWSTATE.eUARTState)
		&&
			
			( ! (SPUART_REG_READ( pUARTChan, Ser_IER, IERStatus ) & IER_THR ) )
		)
		{
			// Put the first character into the uart
			// to start the interrupt driven draining process

			UINT8 IERStatus ;
			char outChar ;

			// (There may be no chars if ISR has already drained the FIFO between
			// the time we put them in and the time we reach this statement)
			if ( uart_fifo_get_char(&pUARTChan->xmtr_uart_fifo, &outChar) )
			{
				// output first char
				SPUART_REG_WRITE(pUARTChan, Ser_THR, outChar);

				// Reenable tx interrupt since ISR disables it when it
				// empties software FIFO and that must be the case if the
				// HW TX FIFO (aka Tx Hold Reg) is empty.
				SPUART_REG_READ( pUARTChan, Ser_IER, IERStatus );
				IERStatus |= IER_THR;
				SPUART_REG_WRITE(pUARTChan, Ser_IER, IERStatus );
			}
		}

		// Did the xmtr fifo accept all of the characters?
		if ( numcharsleft == 0)
		{
			// Then we are through.
			return TRUE;
		}

		// It did not so delay a while
		// and try again.
		TaskDelayMsec(10);
	}
}