moccos mizuki / EthernetXpresso

Dependents:   XNetServicesMin

Revision:
1:95a4c234aaf6
Parent:
0:b4bf563e9741
--- a/LPC1769Emac.cpp	Sun May 06 10:11:53 2012 +0000
+++ b/LPC1769Emac.cpp	Sun May 06 10:52:06 2012 +0000
@@ -23,7 +23,7 @@
 Frame LPC1769Emac::tx_frame_[LPC1769Emac::N_TX_BUF] BUFFER_SECTION;
 
 // === inline debug function
-#ifdef __MY_DEBUG__
+#if 0
 #include "global.h"
 static inline void print_buffer(const char* title, uint8_t *buf, uint16_t size) {
     serial.printf("%s (%d bytes) dst:%02x %02x %02x %02x %02x %02x ",
@@ -34,8 +34,6 @@
     buf += 6;
     serial.printf("type:%02x %02x\r\n", buf[0], buf[1]);
 }
-#else
-static inline void print_buffer(const char* title, uint8_t *buf, uint16_t size){}
 #endif
 
 // === public functions ===
@@ -76,7 +74,7 @@
 }
 
 uint16_t
-LPC1769Emac::PhyRead(uint16_t reg) {
+LPC1769Emac::PhyRead(uint8_t reg) {
     LPC_EMAC->MADR = PHY_ADDR | reg;
     LPC_EMAC->MCMD = MCMD_READ;
 
@@ -99,7 +97,17 @@
     mac_[2] = a3;
     mac_[1] = a4;
     mac_[0] = a5;
-    //WriteAddress_();
+}
+
+void
+LPC1769Emac::UpdateAddress(uint8_t a5, uint8_t a4, uint8_t a3, uint8_t a2, uint8_t a1, uint8_t a0) {
+    mac_[5] = a0;
+    mac_[4] = a1;
+    mac_[3] = a2;
+    mac_[2] = a3;
+    mac_[1] = a4;
+    mac_[0] = a5;
+    WriteAddress_();
 }
 
 void
@@ -134,7 +142,7 @@
 }
 
 uint16_t
-LPC1769Emac::Recv(void *buf, uint16_t max_size) {
+LPC1769Emac::Read(void *buf, uint16_t max_size) {
     uint32_t index = LPC_EMAC->RxConsumeIndex;
     if (index == LPC_EMAC->RxProduceIndex || max_size == 0) return 0;