// CryptoMemory I2C Very Low Level Header File
//
// This library is used in all of the low level hardware interface for I2C communications.
//
// Revision Date      Changes
// -------- --------- -----------------------------------------------------------------
//    0.1   07 Nov 04 First Release

// Protect Library against multiple inclusion
#ifndef CM_I2C_L_H
#define CM_I2C_L_H

// -------------------------------------------------------------------------------------------------
// Other includes required by this header file
// -------------------------------------------------------------------------------------------------


#include "CM_LIB.h"
#include "CM_I2C.h"
#define CM_PWRON_CLKS (15)
// Constants used in low level functions
// Power on clocks (spec call for 5, but California Card uses 15)

// Mid-Level Functions
uint8_t cm_ReadCommand(uint8_t * pucInsBuff, uint8_t * pucRetVal, uint8_t ucLen);
uint8_t cm_WriteCommand(uint8_t * pucInsBuff, uint8_t * pucSendVal, uint8_t ucLen);

// Functions in CM_I2C.C used internally by other low level functions
void cm_Clockhigh(void);
void cm_Clocklow(void);
void cm_ClockCycle(void);
void cm_ClockCycles(uint8_t ucCount);
void cm_Start(void);
void cm_Stop(void);
uint8_t cm_Write(uint8_t ucData);
void cm_Ack(void);
void cm_N_Ack(void);
uint8_t cm_Read(void);
void cm_WaitClock(uint8_t loop);
uint8_t cm_SendCommand(uint8_t * pucInsBuff);
uint8_t cm_ReceiveRet(uint8_t * pucRecBuf, uint8_t ucLen);
uint8_t cm_SendDat(uint8_t * pucSendBuf, uint8_t ucLen);
void cm_RandomGen(uint8_t * pucRanddat);

void cm_Delay(uint8_t ucDelay);

// end of multiple inclusion protection
#endif