Esempio n. 1
0
/*
** McSPI Interrupt Service Routine. This function will clear the status of the
** Tx/Rx interrupts when generated. Will write the Tx data on transmit data
** register and also will put the received data from receive data register to
** a location in memory.
*/
static void McSPIIsr(void)
{
    unsigned int intCode = 0;

    intCode = McSPIIntStatusGet(SOC_SPI_0_REGS);

    while(intCode)
    {
        if(MCSPI_INT_TX_EMPTY(chNum) == (intCode & MCSPI_INT_TX_EMPTY(chNum)))
        {
            McSPIIntStatusClear(SOC_SPI_0_REGS, MCSPI_INT_TX_EMPTY(chNum));

            length--;

            McSPITransmitData(SOC_SPI_0_REGS,(unsigned int)(*p_tx++), chNum);

            if(!length)
            {
                McSPIIntDisable(SOC_SPI_0_REGS, MCSPI_INT_TX_EMPTY(chNum));

                McSPIIntStatusClear(SOC_SPI_0_REGS, MCSPI_INT_TX_EMPTY(chNum));
            }
        }

        if(MCSPI_INT_RX_FULL(chNum) == (intCode & MCSPI_INT_RX_FULL(chNum)))
        {
            McSPIIntStatusClear(SOC_SPI_0_REGS, MCSPI_INT_RX_FULL(chNum));

            *p_rx++ = (unsigned char) McSPIReceiveData(SOC_SPI_0_REGS, chNum);

            if(!(length))
            {
                McSPIIntDisable(SOC_SPI_0_REGS, MCSPI_INT_RX_FULL(chNum));

                flag = 0;
            }
        }

        intCode = McSPIIntStatusGet(SOC_SPI_0_REGS);
    }
}
Esempio n. 2
0
/*
** McSPI Interrupt Service Routine. This function will clear the status of the
** Tx/Rx interrupts when generated. Will write the Tx data on transmit data
** register and also will put the received data from receive data register to
** a location in memory.
*/
static void McSPIIsr(Mcspi_t *McspiStruct)
{
    unsigned int intCode = 0;

    intCode = McSPIIntStatusGet(McspiStruct->BaseAddr);

    /*while(intCode)
    {
        if(MCSPI_INT_TX_EMPTY(McspiStruct->CsSelect) == (intCode & MCSPI_INT_TX_EMPTY(McspiStruct->CsSelect)))
        {
            McSPIIntStatusClear(McspiStruct->BaseAddr, MCSPI_INT_TX_EMPTY(McspiStruct->CsSelect));

            McspiStruct->numOfBytes--;

            McSPITransmitData(McspiStruct->BaseAddr,(unsigned int)(*McspiStruct->BuffTmp++), McspiStruct->CsSelect);

            if(!McspiStruct->numOfBytes)
            {
                McSPIIntDisable(McspiStruct->BaseAddr, MCSPI_INT_TX_EMPTY(McspiStruct->CsSelect));

                McSPIIntStatusClear(McspiStruct->BaseAddr, MCSPI_INT_TX_EMPTY(McspiStruct->CsSelect));
            }
        }

        if(MCSPI_INT_RX_FULL(McspiStruct->CsSelect) == (intCode & MCSPI_INT_RX_FULL(McspiStruct->CsSelect)))
        {
            McSPIIntStatusClear(McspiStruct->BaseAddr, MCSPI_INT_RX_FULL(McspiStruct->CsSelect));

            *McspiStruct->BuffTmp++ = (unsigned char) McSPIReceiveData(McspiStruct->BaseAddr, McspiStruct->CsSelect);

            if(!(McspiStruct->numOfBytes))
            {
                McSPIIntDisable(McspiStruct->BaseAddr, MCSPI_INT_RX_FULL(McspiStruct->CsSelect));

                McspiStruct->flag = 0;
            }
        }

        intCode = McSPIIntStatusGet(McspiStruct->BaseAddr);
    }*/
}