/*!
    @defgroup sent Single Edge Nibble Transmission Receiver (SENT)
    @brief Single Edge Nibble Transmission Receiver (SENT) Peripheral Driver
    <p>
        The SENT driver allows reception of messages on the SENT bus.
    </p>
     ## Features ##
    - Support for the reception of Fast and Slow SENT messages.
    - Polled, Interrupt or DMA driven transfers.
    - Configurable FIFO mode for Fast messages.
    - Configurable number of nibbles.
    - Support for standard or extended Slow messages.
    - Support for standard diagnostics events.
    - Configurable tick duration.
    <p>
        In order to use the SENT driver, it must be first initialized using the SENT_DRV_Init function.
        Once initialized, it must be reinitialized with SENT_DRV_Deinit before any configuration
        settings are to be changed. Different SENT module instances can be configured independently.
    </p>
    <p>
        The driver can be used in multiple modes, the choice between modes is made through data
        passed in the configuration structure. Or by changing the callbacks function during runtime by use of the
        "SENT_DRV_SetRxCallback" function.
        The following cases are possible:
    </p>    
        ## Modes ##
        - Polled mode:
        <p>
            This is entered as long as no notification function is provided and DMA activation
            flags are disabled for the given channel. In this mode the application shall poll any
            incoming data available flags, then read the data.
 
            ## Polling functions ##
            - Polling for data availability
            <p>
                bool SENT_DRV_GetFastRxStatus(uint32_t instance, uint32_t channel);
                bool SENT_DRV_GetSlowRxStatus(uint32_t instance, uint32_t channel);
            </p>
            
            - Getting the actual messages
            <p>
                status_t SENT_DRV_GetFastMsg(uint32_t instance, uint32_t channel, sent_fast_msg_t * message);
                status_t SENT_DRV_GetSlowMsg(uint32_t instance, uint32_t channel, sent_slow_msg_t * message);
            </p>
            
            - Getting the diagnostics event flags
            <p>
                status_t SENT_DRV_GetEvents(uint32_t instance, uint32_t channel, sent_event_t * events)
            </p>
        </p>    
        - Interrupt mode:
        <p>
            This is entered as long as a notification function is provided and DMA activation
            flags are disabled for the given channel. The driver will call the notification function
            back to the application with flags indicating the event that occurred. The application
            should read the data when the notification comes. Same functions used in the polling mode should be used to get the data.
            For example:
            
            ## Notification functions ##
            - Getting the actual messages
            <p>
            	case SENT_CALLBACK_SLOW_RX_COMPLETE:
                    SENT_DRV_GetSlowMsg(instance, channel, &slowMessage);
                    break;

                case SENT_CALLBACK_FAST_RX_COMPLETE:
                    SENT_DRV_GetFastMsg(instance, channel, &fastMessage);
                    break;
            </p>
            
            - Getting the diagnostics event flags
            <p>
                case SENT_CALLBACK_RX_ERROR:
                    SENT_DRV_GetEvents(instance, channel, &activeEvents);
                    break;   
            </p> 
        </p>
        - DMA mode:
        <p>
            This is active as long as DMA activation flags are enabled for the given channels. In this mode,
            based on the given configuration, the peripheral will transfer the data to the given buffers.
            This mode will also call the notification function (if provided) with a suitable event flag.   
        </p>
    ## Important Notes ###    
    </p>
        - The driver configures interrupt states, but the interrupt priority should be set by the application.
    <p>
    </p>
        The driver uses the interrupt manager and the DMA peripheral as shared resources. 
        These should be configured and initialized before the driver.
    <p>
	<p>
		In MPC574xP devices, SENT module has errata e7204. "Number of Expected Edges Error status flag spuriously set when
		operating with Option 1 of the Successive Calibration Check method". For this errata, possible workarounds are to be
		implemented in the application software, and they consist of the following actions:
			- Sensor should be enabled before the peripheral driver (i.e. power or output enabling). This means that first transmitted message wil not be received.
			- Ignore the error at startup.
		This issue should be taken care of when using the SENT module.
	</p>
    ## Example code ###
    @code
    sent_state_t sentState;
    sent_event_t activeEvents;
    sent_raw_msg_t fastMessageBuffer[32];
    sent_raw_msg_t slowMessageBuffer;
    sent_fast_msg_t fastMessage;
    sent_slow_msg_t slowMessage;

    void sentNotification(uint32_t instance, uint32_t channel, sent_callback_type_t type, void * param)
    {
        switch(type)
        {
        case SENT_CALLBACK_SLOW_DMA_RX_COMPLETE:
            break;

        case SENT_CALLBACK_FAST_DMA_RX_COMPLETE:
            break;

        case SENT_CALLBACK_SLOW_RX_COMPLETE:
            SENT_DRV_GetSlowMsg(instance, channel, &slowMessage);
            break;

        case SENT_CALLBACK_FAST_RX_COMPLETE:
            SENT_DRV_GetFastMsg(instance, channel, &fastMessage);
            break;

        case SENT_CALLBACK_RX_ERROR:
            SENT_DRV_GetEvents(instance, channel, &activeEvents);
            break;

        default:
            break;
        }
    }
    
    sent_driver_user_config_t def_cfg;
    sent_channel_config_t def_chn_cfg;
    def_cfg.channelConfig = &def_chn_cfg;
    
    SENT_DRV_GetDefaultConfig(&def_cfg);

    void main(void)
    {
        SENT_DRV_Init(0, &driverConfig1, &sentState);
        INT_SYS_EnableIRQGlobal();
        while(1);
    }     
    @endcode
@}*/
