 /*  keapiBSPRtn.h - KEAPI BSP implementation routine objects declarations (to be assigned by BSP) */

/*
 * Copyright 2011 Kontron KGSC.
 */

/*
 modification history
 --------------------
 01a,02may11,edv initial version
 */

#ifndef KEAPIBSPRTN_H
#define KEAPIBSPRTN_H

#include <vxWorks.h>
#include <../3rdparty/kontron/KEAPI/keapi_types.h>
	
/*****************************************************************************
 * General information
 ****************************************************************************/

IMPORT KEAPI_RETVAL (*_keapiGetIntruderStatus_Rtn) (
	KEAPI_PINT32 pIntruderStatus
);

IMPORT KEAPI_RETVAL (*_keapiResetIntruderStatus_Rtn) (void);

/*****************************************************************************
 * Temperature sensors information
 ****************************************************************************/

IMPORT KEAPI_RETVAL (*_keapiGetTempSensorCount_Rtn) (
	KEAPI_PINT32 pTempSensorCount
);

IMPORT KEAPI_RETVAL (*_keapiGetTempSensorList_Rtn) (
	PTEMP_SENSOR pTempSensors,
	KEAPI_INT32 tempSensorCount
);

IMPORT KEAPI_RETVAL (*_keapiGetTempSensorValue_Rtn) (
	KEAPI_INT32 tempSensorNr,
	KEAPI_PINT32 pTempSensorValue
);

IMPORT KEAPI_RETVAL (*_keapiGetCpuTemp_Rtn) (
	KEAPI_INT32 cpuNr,
	KEAPI_PINT32 pCpuTemp
);

IMPORT KEAPI_RETVAL (*_keapiGetChipsetTemp_Rtn) (
	KEAPI_PINT32 pChipsetTemp
);

IMPORT KEAPI_RETVAL (*_keapiGetSystemTemp_Rtn) (
	KEAPI_PINT32 pSystemTemp
);

/*****************************************************************************
 * Voltage sensors information
 ****************************************************************************/

IMPORT KEAPI_RETVAL (*_keapiGetVoltageSensorCount_Rtn) (
	KEAPI_PINT32 pVoltageSensorCount
);

IMPORT KEAPI_RETVAL (*_keapiGetVoltageSensorList_Rtn) (
	PVOLTAGE_SENSOR pVoltageSensors,
	KEAPI_INT32 voltageSensorCount
);

IMPORT KEAPI_RETVAL (*_keapiGetVoltageSensorValue_Rtn) (
	KEAPI_INT32 voltageSensorNr,
	KEAPI_PINT32 pVoltageSensorValue
);

/*****************************************************************************
 * Fan control
 ****************************************************************************/

IMPORT KEAPI_RETVAL (*_keapiGetFanCount_Rtn) (
	KEAPI_PINT32 pFanCount
);

IMPORT KEAPI_RETVAL (*_keapiGetFanList_Rtn) (
	PFAN pFans,
	KEAPI_INT32 fanCount
);

IMPORT KEAPI_RETVAL (*_keapiGetFanSpeed_Rtn) (
	KEAPI_INT32 fanNr,
	KEAPI_PUINT8 pwm,
	KEAPI_PINT32 rpm
);

IMPORT KEAPI_RETVAL (*_keapiGetFanMode_Rtn) (
	KEAPI_UINT32 fanNr,
	KEAPI_PUINT8 fanMode
);

IMPORT KEAPI_RETVAL (*_keapiSetFanModeManual_Rtn) (
	KEAPI_INT32 fanNr,
	KEAPI_UINT8 targetPwm
);

IMPORT KEAPI_RETVAL (*_keapiSetFanModeThermalCruise_Rtn) (
	KEAPI_UINT32 fanNr,
	KEAPI_UINT32 targetTemp,
	KEAPI_UINT32 toleranceTemp
);

IMPORT KEAPI_RETVAL (*_keapiGetCpuFanSpeed_Rtn) (
	KEAPI_PINT32 pCpuFanRpm
);

IMPORT KEAPI_RETVAL (*_keapiSetCpuFanSpeed_Rtn) (
	KEAPI_UINT8 cpuFanSpeedPwm
);

IMPORT KEAPI_RETVAL (*_keapiGetSystemFanSpeed_Rtn) (
	KEAPI_PINT32 pSystemFanRpm
);

IMPORT KEAPI_RETVAL (*_keapiSetSystemFanSpeed_Rtn) (
	KEAPI_UINT8 systemFanSpeedPwm
);

/*****************************************************************************
 * Storage area
 ****************************************************************************/

IMPORT KEAPI_RETVAL (*_keapiGetStorageCount_Rtn) (
    KEAPI_PINT32 pStorageCount
);

IMPORT KEAPI_RETVAL (*_keapiGetStorageSize_Rtn) (
	KEAPI_INT32 storageNr,
	KEAPI_PINT32 pStorageSize
);

IMPORT KEAPI_RETVAL (*_keapiStorageRead_Rtn) (
	KEAPI_INT32 storageNr,
	KEAPI_INT32 offset,
	KEAPI_PUINT8 pData,
	KEAPI_INT32 dataLength
);

IMPORT KEAPI_RETVAL (*_keapiStorageWrite_Rtn) (
	KEAPI_INT32 storageNr,
	KEAPI_INT32 offset,
	KEAPI_PUINT8 pData,
	KEAPI_INT32 dataLength
);

/*****************************************************************************
 * I2C
 ****************************************************************************/

IMPORT KEAPI_RETVAL (*_keapiGetI2cBusCount_Rtn) (
	KEAPI_PUCHAR pI2cBusCount
); 

IMPORT KEAPI_RETVAL (*_keapiI2cWrite_Rtn) (
        KEAPI_UCHAR     i2cNr,
        KEAPI_UCHAR     i2cAddress,
        KEAPI_UCHAR     memoryAddress,
        KEAPI_PUCHAR    pData,
        KEAPI_UINT32    dataLength
);

IMPORT KEAPI_RETVAL (*_keapiI2cRead_Rtn) (
	KEAPI_UCHAR i2cNr,
	KEAPI_UCHAR i2cAddress,
	KEAPI_UCHAR memoryAddress,
	KEAPI_BOOL memoryAddressUsed,
	KEAPI_PUCHAR pData,
	KEAPI_PUINT32 pDataLength
); 

/*****************************************************************************
 * SMBus
 ****************************************************************************/

IMPORT KEAPI_RETVAL (*_keapiGetSmbusCount_Rtn) (
	KEAPI_PUCHAR pSmbusCount
); 

IMPORT KEAPI_RETVAL (*_keapiSmbusQuickCommand_Rtn) (
	KEAPI_UCHAR smbusNr,
	KEAPI_UCHAR smbusAddress,
	KEAPI_UCHAR operation
); 

IMPORT KEAPI_RETVAL (*_keapiSmbusSendByte_Rtn) (
        KEAPI_UCHAR     smbusNr,
        KEAPI_UCHAR     smbusAddress,
        KEAPI_UCHAR     byte
);

IMPORT KEAPI_RETVAL (*_keapiSmbusReceiveByte_Rtn) (
	KEAPI_UCHAR smbusNr,
	KEAPI_UCHAR smbusAddress,
	KEAPI_PUCHAR pByte
); 

IMPORT KEAPI_RETVAL (*_keapiSmbusWriteByte_Rtn) (
	KEAPI_UCHAR smbusNr,
	KEAPI_UCHAR smbusAddress,
	KEAPI_UCHAR command,
	KEAPI_UCHAR byte
); 

IMPORT KEAPI_RETVAL (*_keapiSmbusReadByte_Rtn) (
	KEAPI_UCHAR smbusNr,
	KEAPI_UCHAR smbusAddress,
	KEAPI_UCHAR command,
	KEAPI_PUCHAR pByte
); 

IMPORT KEAPI_RETVAL (*_keapiSmbusWriteWord_Rtn) (
	KEAPI_UCHAR smbusNr,
	KEAPI_UCHAR smbusAddress,
	KEAPI_UCHAR command,
	KEAPI_UINT16 word
); 

IMPORT KEAPI_RETVAL (*_keapiSmbusReadWord_Rtn) (
	KEAPI_UCHAR smbusNr,
	KEAPI_UCHAR smbusAddress,
	KEAPI_UCHAR command,
	KEAPI_PUINT16 pWord
); 

IMPORT KEAPI_RETVAL (*_keapiSmbusWriteBlock_Rtn) (
	KEAPI_UCHAR smbusNr,
	KEAPI_UCHAR smbusAddress,
	KEAPI_UCHAR command,
	KEAPI_PUCHAR pData,
	KEAPI_UCHAR dataLength
);

IMPORT KEAPI_RETVAL (*_keapiSmbusReadBlock_Rtn) (
	KEAPI_UCHAR smbusNr,
	KEAPI_UCHAR smbusAddress,
	KEAPI_UCHAR command,
	KEAPI_PUCHAR pData,
	KEAPI_PUCHAR pDataLength
); 

/*****************************************************************************
 * GPIO
 ****************************************************************************/

IMPORT KEAPI_RETVAL (*_keapiGpioGetCount_Rtn) (
        KEAPI_PUINT32   pGpioCount
);

IMPORT KEAPI_RETVAL (*_keapiGpioGetDirectionCaps_Rtn) (
	KEAPI_UINT32 gpioNr,
	KEAPI_PBOOL pIsInput,
	KEAPI_PBOOL pIsOutput
);

IMPORT KEAPI_RETVAL (*_keapiGpioGetDirection_Rtn) (
	KEAPI_UINT32 gpioNr,
	KEAPI_PUCHAR pDirection
); 

IMPORT KEAPI_RETVAL (*_keapiGpioSetDirection_Rtn) (
	KEAPI_UINT32 gpioNr,
	KEAPI_UCHAR  direction
); 

IMPORT KEAPI_RETVAL (*_keapiGpioGetLevel_Rtn) (
	KEAPI_UINT32 gpioNr,
	KEAPI_PUCHAR pLevel
); 

IMPORT KEAPI_RETVAL (*_keapiGpioSetLevel_Rtn) (
        KEAPI_UINT32    gpioNr,
        KEAPI_UCHAR     level
);

/*****************************************************************************
 * Watchdog
 ****************************************************************************/

IMPORT KEAPI_RETVAL (*_keapiWatchdogEnable_Rtn) (
	KEAPI_INT32 timeout
);

IMPORT KEAPI_RETVAL (*_keapiWatchdogDisable_Rtn) (void);

IMPORT KEAPI_RETVAL (*_keapiWatchdogTrigger_Rtn) (void);

#endif  /* KEAPIBSPRTN_H */

