Esempio n. 1
0
File: SPIM_PM.c Progetto: Qmax/PT6
/*******************************************************************************
* Function Name: SPIM_Wakeup
********************************************************************************
*
* Summary:
*  Prepare SPIM Component to wake up.
*
* Parameters:  
*  None.
*
* Return: 
*  None.
*
* Global Variables:
*  SPIM_backup - used when non-retention registers are restored.
*  SPIM_txBufferWrite - modified every function call - resets to 
*  zero.
*  SPIM_txBufferRead - modified every function call - resets to 
*  zero.
*  SPIM_rxBufferWrite - modified every function call - resets to
*  zero.
*  SPIM_rxBufferRead - modified every function call - resets to
*  zero. 
*
* Reentrant:
*  No.
*
*******************************************************************************/
void SPIM_Wakeup(void) 
{        
    SPIM_RestoreConfig();
         
    #if (SPIM_TXBUFFERSIZE > 4u)
    
        SPIM_txBufferRead = 0u;
        SPIM_txBufferWrite = 0u;
        
    #endif /* SPIM_TXBUFFERSIZE > 4u */
    
    #if (SPIM_RXBUFFERSIZE > 4u)    
    
        SPIM_rxBufferRead = 0u;
        SPIM_rxBufferWrite = 0u;
        
    #endif /* SPIM_RXBUFFERSIZE > 4u */ 
    
    SPIM_ClearFIFO();
    
    /* Restore components block enable state */
    if (SPIM_backup.enableState != 0u)
    {
         /* Components block was enabled */
         SPIM_Enable();
    } /* Do nothing if components block was disabled */
}
Esempio n. 2
0
/*******************************************************************************
* Function Name: SPIM_Wakeup
********************************************************************************
*
* Summary:
*  Prepare SPIM Component to wake up.
*
* Parameters:
*  None.
*
* Return:
*  None.
*
* Global Variables:
*  SPIM_backup - used when non-retention registers are restored.
*  SPIM_txBufferWrite - modified every function call - resets to
*  zero.
*  SPIM_txBufferRead - modified every function call - resets to
*  zero.
*  SPIM_rxBufferWrite - modified every function call - resets to
*  zero.
*  SPIM_rxBufferRead - modified every function call - resets to
*  zero.
*
* Reentrant:
*  No.
*
*******************************************************************************/
void SPIM_Wakeup(void) 
{
    SPIM_RestoreConfig();

    #if(SPIM_RX_SOFTWARE_BUF_ENABLED)
        SPIM_rxBufferFull  = 0u;
        SPIM_rxBufferRead  = 0u;
        SPIM_rxBufferWrite = 0u;
    #endif /* (SPIM_RX_SOFTWARE_BUF_ENABLED) */

    #if(SPIM_TX_SOFTWARE_BUF_ENABLED)
        SPIM_txBufferFull  = 0u;
        SPIM_txBufferRead  = 0u;
        SPIM_txBufferWrite = 0u;
    #endif /* (SPIM_TX_SOFTWARE_BUF_ENABLED) */

    /* Clear any data from the RX and TX FIFO */
    SPIM_ClearFIFO();

    /* Restore components block enable state */
    if(0u != SPIM_backup.enableState)
    {
        SPIM_Enable();
    }
}