Cleans up the defines in EXI_DeviceEthernet.h by putting them into a enum(Makes it look a lot better as you don't see about 20 #defines).

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3165 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
death2droid 2009-05-07 06:41:43 +00:00
parent 2849cef161
commit e4e1367045
2 changed files with 51 additions and 47 deletions

View File

@ -42,20 +42,12 @@ inline u32 getbitsw(u32 dword, int start, int end) {
return (dword & makemaskw(start, end)) >> (31 - end); return (dword & makemaskw(start, end)) >> (31 - end);
} }
enum {
EXPECT_NONE = 0,
EXPECT_ID,
};
#define MAKE(type, arg) (*(type *)&(arg)) #define MAKE(type, arg) (*(type *)&(arg))
#define RISE(flags) ((SwappedData & (flags)) && !(mBbaMem[0x00] & (flags))) #define RISE(flags) ((SwappedData & (flags)) && !(mBbaMem[0x00] & (flags)))
#define BBA_INTERRUPT_RECV 0x02
#define BBA_INTERRUPT_SENT 0x04
#define BBA_INTERRUPT_RECV_ERROR 0x08
#define BBA_INTERRUPT_SEND_ERROR 0x10
int mPacketsSent = 0; int mPacketsSent = 0;
u8 mac_address[6] = {0x4D, 0xFF, 0x11, 0x88, 0xF1, 0x76}; u8 mac_address[6] = {0x4D, 0xFF, 0x11, 0x88, 0xF1, 0x76};
unsigned int Expecting; unsigned int Expecting;

View File

@ -18,6 +18,8 @@
#ifndef _EXIDEVICE_ETHERNET_H #ifndef _EXIDEVICE_ETHERNET_H
#define _EXIDEVICE_ETHERNET_H #define _EXIDEVICE_ETHERNET_H
class WriteBuffer { class WriteBuffer {
public: public:
WriteBuffer(u32 s) :_size(0) { _buffer = (u8*)malloc(s*sizeof(u8)); ucapacity = s;} WriteBuffer(u32 s) :_size(0) { _buffer = (u8*)malloc(s*sizeof(u8)); ucapacity = s;}
@ -83,50 +85,60 @@ private:
CMD_ID = 0x00, CMD_ID = 0x00,
CMD_READ_REG = 0x01, CMD_READ_REG = 0x01,
}; };
void recordSendComplete(); void recordSendComplete();
bool sendPacket(u8 *etherpckt, size_t size); bool sendPacket(u8 *etherpckt, size_t size);
}; };
#define CB_OFFSET 0x100 enum {
#define CB_SIZE (BBAMEM_SIZE - CB_OFFSET) EXPECT_NONE = 0,
#define SIZEOF_RECV_DESCRIPTOR 4 EXPECT_ID,
};
enum{
CB_OFFSET = 0x100,
CB_SIZE = (BBAMEM_SIZE - CB_OFFSET),
SIZEOF_RECV_DESCRIPTOR = 4,
#define EXI_DEVTYPE_ETHER 0x04020200 EXI_DEVTYPE_ETHER = 0x04020200,
#define BBA_NCRA 0x00 /* Network Control Register A, RW */ BBA_NCRA = 0x00, /* Network Control Register A, RW */
#define BBA_NCRA_RESET (1<<0) /* RESET */ BBA_NCRA_RESET = (1<<0), /* RESET */
#define BBA_NCRA_ST0 (1<<1) /* ST0, Start transmit command/status */ BBA_NCRA_ST0 = (1<<1), /* ST0, Start transmit command/status */
#define BBA_NCRA_ST1 (1<<2) /* ST1, " */ BBA_NCRA_ST1 = (1<<2), /* ST1, " */
#define BBA_NCRA_SR (1<<3) /* SR, Start Receive */ BBA_NCRA_SR = (1<<3), /* SR, Start Receive */
BBA_NCRB = 0x01, /* Network Control Register B, RW */
BBA_NCRB_PR = (1<<0), /* PR, Promiscuous Mode */
BBA_NCRB_CA = (1<<1), /* CA, Capture Effect Mode */
BBA_NCRB_PM = (1<<2), /* PM, Pass Multicast */
BBA_NCRB_PB = (1<<3), /* PB, Pass Bad Frame */
BBA_NCRB_AB = (1<<4), /* AB, Accept Broadcast */
BBA_NCRB_HBD = (1<<5), /* HBD, reserved */
BBA_NCRB_RXINTC0 = (1<<6), /* RXINTC, Receive Interrupt Counter */
BBA_NCRB_RXINTC1 = (1<<7), /* " */
BBA_NCRB_1_PACKET_PER_INT = (0<<6), /* 0 0 */
BBA_NCRB_2_PACKETS_PER_INT = (1<<6), /* 0 1 */
BBA_NCRB_4_PACKETS_PER_INT = (2<<6), /* 1 0 */
BBA_NCRB_8_PACKETS_PER_INT = (3<<6), /* 1 1 */
#define BBA_NCRB 0x01 /* Network Control Register B, RW */ BBA_NWAYC = 0x30, /* NWAY Configuration Register, RW, 84h */
#define BBA_NCRB_PR (1<<0) /* PR, Promiscuous Mode */ BBA_NWAYC_FD = (1<<0), /* FD, Full Duplex Mode */
#define BBA_NCRB_CA (1<<1) /* CA, Capture Effect Mode */ BBA_NWAYC_PS100 = (1<<1), /* PS100/10, Port Select 100/10 */
#define BBA_NCRB_PM (1<<2) /* PM, Pass Multicast */ BBA_NWAYC_ANE = (1<<2), /* ANE, Autonegotiation Enable */
#define BBA_NCRB_PB (1<<3) /* PB, Pass Bad Frame */ BBA_NWAYC_ANS_RA = (1<<3), /* ANS, Restart Autonegotiation */
#define BBA_NCRB_AB (1<<4) /* AB, Accept Broadcast */ BBA_NWAYC_LTE = (1<<7), /* LTE, Link Test Enable */
#define BBA_NCRB_HBD (1<<5) /* HBD, reserved */
#define BBA_NCRB_RXINTC0 (1<<6) /* RXINTC, Receive Interrupt Counter */
#define BBA_NCRB_RXINTC1 (1<<7) /* " */
#define BBA_NCRB_1_PACKET_PER_INT (0<<6) /* 0 0 */
#define BBA_NCRB_2_PACKETS_PER_INT (1<<6) /* 0 1 */
#define BBA_NCRB_4_PACKETS_PER_INT (2<<6) /* 1 0 */
#define BBA_NCRB_8_PACKETS_PER_INT (3<<6) /* 1 1 */
#define BBA_NWAYC 0x30 /* NWAY Configuration Register, RW, 84h */ BBA_NWAYS = 0x31,
#define BBA_NWAYC_FD (1<<0) /* FD, Full Duplex Mode */ BBA_NWAYS_LS10 = (1<<0),
#define BBA_NWAYC_PS100 (1<<1) /* PS100/10, Port Select 100/10 */ BBA_NWAYS_LS100 = (1<<1),
#define BBA_NWAYC_ANE (1<<2) /* ANE, Autonegotiation Enable */ BBA_NWAYS_LPNWAY = (1<<2),
#define BBA_NWAYC_ANS_RA (1<<3) /* ANS, Restart Autonegotiation */ BBA_NWAYS_ANCLPT = (1<<3),
#define BBA_NWAYC_LTE (1<<7) /* LTE, Link Test Enable */ BBA_NWAYS_100TXF = (1<<4),
BBA_NWAYS_100TXH = (1<<5),
#define BBA_NWAYS 0x31 BBA_NWAYS_10TXF = (1<<6),
#define BBA_NWAYS_LS10 (1<<0) BBA_NWAYS_10TXH = (1<<7),
#define BBA_NWAYS_LS100 (1<<1) BBA_INTERRUPT_RECV = 0x02,
#define BBA_NWAYS_LPNWAY (1<<2) BBA_INTERRUPT_SENT = 0x04,
#define BBA_NWAYS_ANCLPT (1<<3) BBA_INTERRUPT_RECV_ERROR = 0x08,
#define BBA_NWAYS_100TXF (1<<4) BBA_INTERRUPT_SEND_ERROR = 0x10,
#define BBA_NWAYS_100TXH (1<<5) };
#define BBA_NWAYS_10TXF (1<<6)
#define BBA_NWAYS_10TXH (1<<7)
#endif #endif