Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
LPC1769Emac.h
- Committer:
- moccos
- Date:
- 2012-05-06
- Revision:
- 0:b4bf563e9741
- Child:
- 1:95a4c234aaf6
File content as of revision 0:b4bf563e9741:
#ifndef LPC1769EMAC_H #define LPC1769EMAC_H #include <stdint.h> #include "Frame.h" class LPC1769Emac { public: enum LinkMode { AutoNegotiate, HalfDuplex10, FullDuplex10, HalfDuplex100, FullDuplex100 }; public: LPC1769Emac(); ~LPC1769Emac(); bool PhyWrite(uint8_t reg, uint16_t value); uint16_t PhyRead(uint16_t reg); static void SetAddress(uint8_t a5, uint8_t a4, uint8_t a3, uint8_t a2, uint8_t a1, uint8_t a0); void StartRx(); void StartTx(); void StopRx(); void StopTx(); bool Link(); uint16_t Recv(void *buf, uint16_t max_size); uint16_t ReadyToReceive(); uint16_t Write(void *buf, uint16_t size); bool Send(); bool Send(void *buf, uint16_t size); bool Reset(LinkMode mode=AutoNegotiate); static const char* getHwAddr() { return (const char*)mac_; } private: static const uint8_t N_RX_BUF = 5; static const uint8_t N_TX_BUF = 3; static const uint32_t BASE_ADDR = 0x20080000; static const uint16_t PHY_ADDR = 0x0100; static uint8_t mac_[6]; static Descriptor rx_desc_[N_RX_BUF]; static Descriptor tx_desc_[N_TX_BUF]; static StatusRx rx_status_[N_RX_BUF]; static StatusTx tx_status_[N_TX_BUF]; static Frame rx_frame_[N_RX_BUF]; static Frame tx_frame_[N_TX_BUF]; /* Descriptor *rx_desc_; Descriptor *tx_desc_; StatusRx *rx_status_; StatusTx *tx_status_; Frame *rx_frame_; Frame *tx_frame_; */ uint8_t *write_next_; uint8_t *read_next_; uint16_t write_size_; uint16_t read_size_; private: void WriteAddress_(); bool CheckAutoNeg_(); void InitRxBuffer_(); void InitTxBuffer_(); }; #endif