/*  ============================================================================
 *   Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005
 *
 *   Use of this software is controlled by the terms and conditions found in the
 *   license agreement under which this software has been supplied.
 *   ===========================================================================
 */

/** @file csl_i2cAux.h
 *
 * @brief   Header file for functional layer of CSL
 *
 * Description
 *    - The defines inline function definitions
 *
 *  Modification 1
 *    - Modified on: 18/1/2005
 *    - Reason: created the sources
 *	  - Modified on: 25/10/2005
 *	  - Added API for setting I2C as master/slave
 * 
 *  @author Ramitha Mathew.
 */
 


#ifndef _CSL_I2CAUX_H_
#define _CSL_I2CAUX_H_

#include <csl_i2c.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 *  Control Functions of i2c.
 */
/** ============================================================================
 *   @n@b CSL_i2cEnable
 *
 *   @b Description
 *   @n This function enables the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cEnable (hI2c);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cEnable (    
    CSL_I2cHandle        hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR,I2C_ICMDR_IRS, FALSE);
    CSL_FINS(hI2c->regs->ICPFUNC,I2C_ICPFUNC_PFUNC, FALSE);
    CSL_FINS(hI2c->regs->ICMDR,I2C_ICMDR_IRS, TRUE);
}

/** ============================================================================
 *   @n@b CSL_i2cConfigAsGio
 *
 *   @b Description
 *   @n This function configures I2C as GIO.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cConfigAsGio (hI2c);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cConfigAsGio (    
    CSL_I2cHandle        hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR,I2C_ICMDR_IRS, FALSE);
    CSL_FINS(hI2c->regs->ICPFUNC,I2C_ICPFUNC_PFUNC, TRUE);
    CSL_FINS(hI2c->regs->ICMDR,I2C_ICMDR_IRS, TRUE);
}

/** ============================================================================
 *   @n@b CSL_i2cReset
 *
 *   @b Description
 *   @n This function resets the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cReset (hI2c);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cReset (    
    CSL_I2cHandle        hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR,I2C_ICMDR_IRS, FALSE);
}

/** ============================================================================
 *   @n@b CSL_i2cOutOfReset
 *
 *   @b Description
 *   @n This function pulls the I2C out of reset.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cOutOfReset (hI2c);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cOutOfReset (    
    CSL_I2cHandle        hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR,I2C_ICMDR_IRS, TRUE);
}

/** ============================================================================
 *   @n@b CSL_i2cClearStatus
 *
 *   @b Description
 *   @n This function clears the status register of I2C.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cClearStatus (hI2c);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cClearStatus (    
    CSL_I2cHandle        hI2c
)
{  
    /* writing 1 to already set interrupt flags clears them */
    hI2c->regs->ICSTR = hI2c->regs->ICSTR ;
}

/** ============================================================================
 *   @n@b CSL_i2cSetSlaveAddr
 *
 *   @b Description
 *   @n This function sets the slave address of I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance
            *arg            pointer to hold the slave address

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cSetSlaveAddr (hI2c, &arg);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cSetSlaveAddr (    
    CSL_I2cHandle        hI2c,

    /* Arguments if any for the command */
    void                 *arg
)
{
    CSL_FINS(hI2c->regs->ICSAR, I2C_ICSAR_A, ((*(Uint16 *)arg) & 0x3FF)); 
}

/** ============================================================================
 *   @n@b CSL_i2cSetOwnAddr
 *
 *   @b Description
 *   @n This function sets its own address.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance
            *arg            pointer to hold the own address

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cSetOwnAddr (hI2c, &arg);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cSetOwnAddr (    
    CSL_I2cHandle        hI2c,

    /* Arguments if any for the command */
    void                 *arg
)
{
    CSL_FINS(hI2c->regs->ICOAR, I2C_ICOAR_A, ((*(Uint16 *)arg) & 0x3FF));
}


/** ============================================================================
 *   @n@b CSL_i2cSetMode
 *
 *   @b Description
 *   @n This function sets i2c in Master/Slave mode depending on the arg passed.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance
            *arg            pointer to the mode value for the MST bit in I2C mode 
							register

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cSetMode (hI2c, &arg);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cSetMode (    
    CSL_I2cHandle        hI2c,

    /* Arguments if any for the command */
    void                 *arg
)
{
    CSL_FINS(hI2c->regs->ICMDR, I2C_ICMDR_MST, ((*(Uint8 *)arg) & 0x1) );
}


/** ============================================================================
 *   @n@b CSL_i2cEnableIntr
 *
 *   @b Description
 *   @n This function enables selected interrupts of I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance
            arg             OR-ed value of interrupts

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cEnableIntr (hI2c, arg);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cEnableIntr (
        CSL_I2cHandle        hI2c

)
{
    Uint16 arg = 0x7f;
    hI2c->regs->ICIMR = (hI2c->regs->ICIMR | (arg));
}

/** ============================================================================
 *   @n@b CSL_i2cDisableIntr
 *
 *   @b Description
 *   @n This function disables selected interrupts of I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance
            arg             OR-ed value of interrupts

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cDisableIntr (hI2c, arg);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cDisableIntr (    
    CSL_I2cHandle        hI2c

)
{
    Uint16 arg = 0xff80;
    hI2c->regs->ICIMR = (hI2c->regs->ICIMR & arg);
}

/** ============================================================================
 *   @n@b CSL_i2cSetDataCount
 *
 *   @b Description
 *   @n This function sets the data count of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance
            *arg            pointer to hold the data count

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cSetDataCount (hI2c, &arg);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cSetDataCount (    
    CSL_I2cHandle        hI2c,

    /* Arguments if any for the command */
    void                 *arg
)
{
    hI2c->regs->ICCNT = (*(Uint16 *)arg) & 0xFFFF;
}


/** ============================================================================
 *   @n@b CSL_i2cSetClock
 *
 *   @b Description
 *   @n This function sets the I2C Clock.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            arg             address of ClkSetup structure.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cSetClockSetup (hI2c, &arg);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cSetClock (    
    CSL_I2cHandle        hI2c,

    /* Placeholder to return the status. @a void* casted */
    CSL_I2cClkSetup      *arg
)
{
    CSL_FINS(hI2c->regs->ICPSC, I2C_ICPSC_IPSC, arg->prescalar);
    CSL_FINS(hI2c->regs->ICCLKL, I2C_ICCLKL_ICCL, arg->clklowdiv);
    CSL_FINS(hI2c->regs->ICCLKH, I2C_ICCLKH_ICCH, arg->clkhighdiv);
}

/** ============================================================================
 *   @n@b CSL_i2cStart
 *
 *   @b Description
 *   @n This function writes the start command to the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cStart (hI2c);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cStart (    
    CSL_I2cHandle        hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR,I2C_ICMDR_STT, TRUE);
}

/** ============================================================================
 *   @n@b CSL_i2cStop
 *
 *   @b Description
 *   @n This function writes the stop command to the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cStop (hI2c);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cStop (   
    CSL_I2cHandle        hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR,I2C_ICMDR_STP, TRUE);
}

/** ============================================================================
 *   @n@b CSL_i2cDirTransmit
 *
 *   @b Description
 *   @n This function sets the direction of data as transmit of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cDirTransmit (hI2c);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cDirTransmit (    
    CSL_I2cHandle        hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR,I2C_ICMDR_TRX, TRUE);
}

/** ============================================================================
 *   @n@b CSL_i2cDirReceive
 *
 *   @b Description
 *   @n This function sets the direction of data as receive of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cDirReceive (hI2c);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cDirReceive (   
    CSL_I2cHandle        hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR,I2C_ICMDR_TRX, FALSE);
}

/** ============================================================================
 *   @n@b CSL_i2RmEnable
 *
 *   @b Description
 *   @n This function enables the repeat mode of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2RmEnable (hI2c);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cRmEnable (   
    CSL_I2cHandle        hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR,I2C_ICMDR_RM, TRUE);
}

/** ============================================================================
 *   @n@b CSL_i2cRmDisable
 *
 *   @b Description
 *   @n This function disables the repeat mode of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cRmDisable (hI2c);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cRmDisable (   
    CSL_I2cHandle        hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR,I2C_ICMDR_RM, FALSE);
}

/** ============================================================================
 *   @n@b CSL_i2cDlbEnable
 *
 *   @b Description
 *   @n This function enables the data loop back of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cDlbEnable (hI2c);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cDlbEnable (    
    CSL_I2cHandle        hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR,I2C_ICMDR_DLB, TRUE);
}

/** ============================================================================
 *   @n@b CSL_i2cDlbDisable
 *
 *   @b Description
 *   @n This function disables the data loop back of I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cDlbDisable (hI2c);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cDlbDisable (   
    CSL_I2cHandle        hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR,I2C_ICMDR_DLB, FALSE);
}

/** ============================================================================
 *   @n@b CSL_i2cGetClockSetup
 *
 *   @b Description
 *   @n This function gets the clock setup of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetClockSetup (hI2c, &response);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cGetClockSetup (   
    CSL_I2cHandle        hI2c,    
    void                 *response
)
{
    ((CSL_I2cClkSetup *)response)->prescalar
                = CSL_FEXT(hI2c->regs->ICPSC,I2C_ICPSC_IPSC);
    ((CSL_I2cClkSetup *)response)->clklowdiv
                = CSL_FEXT(hI2c->regs->ICCLKL,I2C_ICCLKL_ICCL);
    ((CSL_I2cClkSetup *)response)->clkhighdiv
                = CSL_FEXT(hI2c->regs->ICCLKH,I2C_ICCLKH_ICCH);
}

/** ============================================================================
 *   @n@b CSL_i2cGetBusBusy
 *
 *   @b Description
 *   @n This function gets the bus busy status of I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetBusBusy (hI2c, &response);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cGetBusBusy (    
    CSL_I2cHandle        hI2c,    
    void                 *response
)
{
    *(Uint16 *)response = CSL_FEXT(hI2c->regs->ICSTR,I2C_ICSTR_BB);
}

/** ============================================================================
 *   @n@b CSL_i2cGetRxRdy
 *
 *   @b Description
 *   @n This function gets the receive ready status of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetRxRdy (hI2c, &response);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cGetRxRdy (   
    CSL_I2cHandle        hI2c,    
    void                 *response
)
{
    *(Uint16 *)response = CSL_FEXT(hI2c->regs->ICSTR,I2C_ICSTR_ICRRDY);
}

/** ============================================================================
 *   @n@b CSL_i2cGetTxRdy
 *
 *   @b Description
 *   @n This function gets the transmit ready status of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetTxRdy (hI2c, &response);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cGetTxRdy (    
    CSL_I2cHandle        hI2c,    
    void                 *response
)
{
    *(Uint16 *)response = CSL_FEXT(hI2c->regs->ICSTR,I2C_ICSTR_ICXRDY);
}

/** ============================================================================
 *   @n@b CSL_i2cGetAcsRdy
 *
 *   @b Description
 *   @n This function gets the ACS ready status of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetAcsRdy (hI2c, &response);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cGetAcsRdy (   
    CSL_I2cHandle        hI2c,    
    void                 *response
)
{
    *(Uint16 *)response = CSL_FEXT(hI2c->regs->ICSTR,I2C_ICSTR_ARDY);
}

/** ============================================================================
 *   @n@b CSL_i2cGetScd
 *
 *   @b Description
 *   @n This function gets the SCD status of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetScd (hI2c, &response);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cGetScd (   
    CSL_I2cHandle        hI2c,    
    void                 *response
)
{
    *(Uint16 *)response = CSL_FEXT(hI2c->regs->ICSTR,I2C_ICSTR_SCD);
}


/** ============================================================================
 *   @n@b CSL_i2cGetAd0
 *
 *   @b Description
 *   @n This function gets the AD0 status of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetAd0 (hI2c, &response);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cGetAd0 (   
    CSL_I2cHandle        hI2c,    
    void                 *response
)
{
    *(Uint16 *)response = CSL_FEXT(hI2c->regs->ICSTR,I2C_ICSTR_AD0);
}


/** ============================================================================
 *   @n@b CSL_i2cGetAas
 *
 *   @b Description
 *   @n This function gets the AAS status of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetAas (hI2c, &response);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cGetAas (   
    CSL_I2cHandle        hI2c,   
    void                 *response
)
{
    *(Uint16 *)response = CSL_FEXT(hI2c->regs->ICSTR,I2C_ICSTR_AAS);
}

/** ============================================================================
 *   @n@b CSL_i2cGetRsFull
 *
 *   @b Description
 *   @n This function gets the RS Full status of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetRsFull (hI2c, &response);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cGetRsFull (    
    CSL_I2cHandle        hI2c,    
    void                 *response
)
{
    *(Uint16 *)response = CSL_FEXT(hI2c->regs->ICSTR,I2C_ICSTR_RSFULL);
}

/** ============================================================================
 *   @n@b CSL_i2cGetXsmt
 *
 *   @b Description
 *   @n This function gets the transmit status of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetXsmt (hI2c, &response);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cGetXsmt (   
    CSL_I2cHandle        hI2c,   
    void                 *response
)
{
    *(Uint16 *)response = CSL_FEXT(hI2c->regs->ICSTR,I2C_ICSTR_XSMT);
}

/** ============================================================================
 *   @n@b CSL_i2cGetAl
 *
 *   @b Description
 *   @n This function gets the AL status of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetAl (hI2c, &response);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cGetAl (    
    CSL_I2cHandle        hI2c,    
    void                 *response
)
{
    *(Uint16 *)response = CSL_FEXT(hI2c->regs->ICSTR,I2C_ICSTR_AL);
}

/** ============================================================================
 *   @n@b CSL_i2cGetSdir
 *
 *   @b Description
 *   @n This function gets the SDIR status of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetSdir (hI2c, &response);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cGetSdir (    
    CSL_I2cHandle        hI2c,    
    void                 *response
)
{
    *(Uint16 *)response = CSL_FEXT(hI2c->regs->ICSTR,I2C_ICSTR_SDIR);
}

/** ============================================================================
 *   @n@b CSL_i2cGetNacksnt
 *
 *   @b Description
 *   @n This function gets the No Ack Sent status of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetNacksnt (hI2c, &response);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cGetNacksnt (    
    CSL_I2cHandle        hI2c,    
    void                 *response
)
{
    *(Uint16 *)response = CSL_FEXT(hI2c->regs->ICSTR,I2C_ICSTR_NACKSNT);
}

/** ============================================================================
 *   @n@b CSL_i2cGetRdone
 *
 *   @b Description
 *   @n This function gets the Reset Done status of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetRdone (hI2c, &response);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cGetRdone (   
    CSL_I2cHandle        hI2c,    
    void                 *response
)
{
    *(Uint16 *)response = CSL_FEXT(hI2c->regs->ICMDR,I2C_ICMDR_IRS);
}

/** ============================================================================
 *   @n@b CSL_i2cGetBitcount
 *
 *   @b Description
 *   @n This function gets the bit count number of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetBitcount (hI2c, &response);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cGetBitcount (   
    CSL_I2cHandle        hI2c,    
    void                 *response
)
{
    *(Uint16 *)response = CSL_FEXT(hI2c->regs->ICMDR,I2C_ICMDR_BC);
}

/** ============================================================================
 *   @n@b CSL_i2cGetIntcode
 *
 *   @b Description
 *   @n This function gets the interrupt code of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetIntcode (hI2c, &response);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cGetIntcode (   
    CSL_I2cHandle        hI2c,    
    void                 *response
)
{
    *(Uint16 *)response = CSL_FEXT(hI2c->regs->ICIVR,I2C_ICIVR_INTCODE);
}

/** ============================================================================
 *   @n@b CSL_i2cGetRev
 *
 *   @b Description
 *   @n This function gets the revision of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetRev (hI2c, &response);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cGetRev (   
    CSL_I2cHandle        hI2c,    
    void                 *response
)
{
    *(Uint16 *)response = CSL_FEXT(hI2c->regs->ICPID1,I2C_ICPID1_REVISION);
}

/** ============================================================================
 *   @n@b CSL_i2cGetClass
 *
 *   @b Description
 *   @n This function gets the class of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetClass (hI2c, &response);

     @endverbatim
 * =============================================================================
 */
static inline
void CSL_i2cGetClass (   
    CSL_I2cHandle        hI2c,    
    void                 *response
)
{
    *(Uint16 *)response = CSL_FEXT(hI2c->regs->ICPID1,I2C_ICPID1_CLASS);
}

/** ============================================================================
 *   @n@b CSL_i2cGetType
 *
 *   @b Description
 *   @n This function gets the type of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetType (hI2c, &response);

     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_i2cGetType (    
    CSL_I2cHandle        hI2c,    
    void                 *response
)
{
    *(Uint16 *)response = CSL_FEXT(hI2c->regs->ICPID2,I2C_ICPID2_TYPE);
}



#ifdef __cplusplus
}
#endif

#endif /* CSL_I2CAUX_H_ */
