/*
 * ENC424J600.h
 *
 *  Created on: Nov 14, 2011
 *      Author: RomanM
 */

#ifndef ENC424J600_H_
#define ENC424J600_H_

extern uint8_t	enc424j600_MacAddress[6];

void Enc424j600_SendPacket(uint8_t *toSend, uint8_t length);
uint16_t Enc424j600_ReceivePacket(uint8_t *buffer);

void Enc424j600_Init(void);
void Enc424j600_SystemReset(void);
void Enc424j600_ReadMacAddress(uint8_t *macAddr);
uint8_t Enc424j600_IsLinked(void);
void Enc424j600_MACFlush(void);

uint16_t Enc424j600_ReadReg(uint8_t regAddr);
void Enc424j600_WriteReg(uint8_t regAddr, uint16_t data);
void Enc424j600_BitSetReg(uint8_t regAddr, uint16_t bitMask);
void Enc424j600_BitClearReg(uint8_t regAddr, uint16_t bitMask);
uint16_t Enc424j600_ReadPhyReg(uint8_t regAddr);
void Enc424j600_WritePhyReg(int8_t regAddr, uint16_t data);

void Enc424j600_Cmd1B(uint8_t cmd);
uint8_t Enc424j600_Cmd2B(uint8_t cmd, uint8_t data);
uint16_t Enc424j600_Cmd3B(uint8_t cmd, unsigned short data);
uint32_t Enc424j600_Cmd4B(uint8_t cmd, uint32_t data);
void Enc424j600_WriteN(uint8_t cmd, uint8_t *toSend, uint16_t length);
void Enc424j600_ReadN(uint8_t cmd, uint8_t *readBuff, uint16_t length);

#endif /* ENC424J600_H_ */
