target/linux/at91/image/dfboot/src/include/lib_AT91RM9200.h
//*----------------------------------------------------------------------------
//* \fn    AT91F_SSC_SetBaudrate
//* \brief Set the baudrate according to the CPU clock
//*----------------------------------------------------------------------------
\fn    AT91F_SSC_SetBaudrate
\brief Set the baudrate according to the CPU clock
\ fn AT91F_SSC_SetBaudrate \ brief Set the baudrate according to the CPU clock
static inline void AT91F_SSC_SetBaudrate (
        AT91PS_SSC pSSC,        
        unsigned int mainClock, 
        unsigned int speed)     
{
        unsigned int baud_value;
        if (speed == 0)
           baud_value = 0;
        else
        {
           baud_value = (unsigned int) (mainClock * 10)/(2*speed);
           if ((baud_value % 10) >= 5)
                  baud_value = (baud_value / 10) + 1;
           else
                  baud_value /= 10;
        }
        pSSC->SSC_CMR = baud_value;
}
static inline void AT91F_SSC_SetBaudrate ( AT91PS_SSC pSSC , unsigned int mainClock , unsigned int speed ) { unsigned int baud_value ; if ( speed == 0 ) baud_value = 0 ; else { baud_value = ( unsigned int ) ( mainClock * 10 ) / ( 2 * speed ) ; if ( ( baud_value % 10 ) >= 5 ) baud_value = ( baud_value / 10 ) + 1 ; else baud_value /= 10 ; } pSSC -> SSC_CMR = baud_value ; }
\fn    AT91F_SSC_SetBaudrate
\brief Set the baudrate according to the CPU clock
\ fn AT91F_SSC_SetBaudrate \ brief Set the baudrate according to the CPU clock
// \arg pointer to a SSC controller // \arg peripheral clock // \arg SSC baudrate //* Define the baud rate divisor register