Files | |
file | hal.h |
Hardware abstraction (license: GPLv2). | |
Defines | |
#define | hal_init(mac) |
Initializes the network hardware and assigns the given hardware address. | |
#define | hal_receive_packet(buffer, buffer_len) |
Fetches the next ethernet packet from the device. | |
#define | hal_send_packet(buffer, buffer_len) |
Sends an ethernet packet to the device. | |
#define | hal_link_up() |
Checks wether the network link is up and has been continuously up since the last call. |
#define hal_init | ( | mac | ) |
Initializes the network hardware and assigns the given hardware address.
[in] | mac | A pointer to a 6-byte buffer containing the network mac address. |
#define hal_receive_packet | ( | buffer, | |||
buffer_len | ) |
Fetches the next ethernet packet from the device.
The packet has to be written into the given buffer and the size of the packet (ethernet header plus payload, exclusive the CRC) must be returned.
Zero must be returned in the following cases:
[out] | buffer | The pointer to the buffer which receives the packet. |
[in] | buffer_len | The length of the buffer. |
0
in the cases noted above. #define hal_send_packet | ( | buffer, | |||
buffer_len | ) |
Sends an ethernet packet to the device.
The packet buffer contains the ethernet header and the payload without CRC. If the CRC cannot be generated by the network hardware, it has to be calculated by the driver.
[in] | buffer | A pointer to the buffer containing the packet to be sent. |
[in] | buffer_len | The length of the ethernet packet header plus payload. |
#define hal_link_up | ( | ) |
Checks wether the network link is up and has been continuously up since the last call.
TRUE
if the network link is and has been up, FALSE
otherwise.