/**
 * @file si_drv_cra_api.h
 *
 * @brief Chip Register Access Driver
 *
 *****************************************************************************/

#ifndef SI_DRV_CRA_API_H
#define SI_DRV_CRA_API_H

/***** #include statements ***************************************************/

#include "si_datatypes.h"
#include "sii9777_platform_api.h"

/***** public type definitions ***********************************************/

typedef uint16_t      SiiDrvCraAddr_t;
typedef uint16_t      SiiDrvCraSize_t;
typedef uint8_t       SiiDrvCraIdx_t;

/***** public functions ******************************************************/

void                SiiDrvCraCreate( SiiPlatformDevId_t devId );
void                SiiDrvCraDelete( SiiPlatformDevId_t devId );

void                SiiDrvCraWrite8( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr, uint8_t val );
uint8_t             SiiDrvCraRead8( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr );
void                SiiDrvCraBitsSet8( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr, uint8_t mask, bool_t bSet );
void                SiiDrvCraBitsMod8( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr, uint8_t mask, uint8_t val );

void                SiiDrvCraWrite16( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr, uint16_t val );
uint16_t            SiiDrvCraRead16( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr );
void                SiiDrvCraBitsSet16( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr, uint16_t mask, bool_t bSet );
void                SiiDrvCraBitsMod16( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr, uint16_t mask, uint16_t val );

void                SiiDrvCraWrite24( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr, uint32_t val );
uint32_t            SiiDrvCraRead24( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr );
void                SiiDrvCraBitsSet24( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr, uint32_t mask, bool_t bSet );
void                SiiDrvCraBitsMod24( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr, uint32_t mask, uint32_t val );

void                SiiDrvCraWrite32( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr, uint32_t val );
uint32_t            SiiDrvCraRead32( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr );
void                SiiDrvCraBitsSet32( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr, uint32_t mask, bool_t bSet );
void                SiiDrvCraBitsMod32( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr, uint32_t mask, uint32_t val );

void                SiiDrvCraFifoWrite8( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr, const uint8_t* pData, SiiDrvCraSize_t size );
void                SiiDrvCraFifoRead8( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr, uint8_t* pData, SiiDrvCraSize_t size );
void                SiiDrvCraBlockWrite8( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr, const uint8_t* pData, SiiDrvCraSize_t size );
void                SiiDrvCraBlockRead8( SiiPlatformDevId_t devId, SiiDrvCraAddr_t addr, uint8_t* pData, SiiDrvCraSize_t size );

#endif /* SI_DRV_CRA_API_H */
