CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Loading...
Searching...
No Matches
KunyanEthernet Class Reference

The driver for Kunyan Liu's custom Ethernet MAC for the Arty A7. More...

#include <platform-ethernet.hh>

Classes

class  BufferedFrame
 Class encapsulating a frame that has been received. More...

Public Member Functions

 KunyanEthernet ()
 Initialise a reference to the Ethernet device.
 KunyanEthernet (const KunyanEthernet &)=delete
 KunyanEthernet (KunyanEthernet &&)=delete
void mac_address_set (MACAddress address=mac_address_default())
uint32_t receive_interrupt_value ()
int receive_interrupt_complete (Timeout *timeout, uint32_t lastInterruptValue)
void autonegotiation_enable (uint8_t phyAddress=1)
 Enable autonegotiation on the PHY.
bool phy_link_status ()
 Check the link status of the PHY.
std::optional< uint16_t > check_frame (BufferID index=BufferID::Ping)
void complete_receive (BufferID index=BufferID::Ping)
std::optional< BufferedFramereceive_frame ()
bool send_frame (const uint8_t *buffer, uint16_t length, auto &&check)
 Send a packet.
void dropped_frames_log_all_if_changed ()
 If debugging dropped frames is enabled, log any counter values that have changed since the last call to this function.
void received_frames_log ()

Static Public Member Functions

static constexpr bool has_unique_mac_address ()
 This device does not have a unique MAC address and so users must provide a locally administered MAC address if more than one device is present on the same network.
static constexpr MACAddress mac_address_default ()

Detailed Description

The driver for Kunyan Liu's custom Ethernet MAC for the Arty A7.

This is intended to run at 10Mb/s. It provides two send and two receive buffers in shared SRAM.

WARNING: This is currently evolving and is not yet stable.

Definition at line 27 of file platform-ethernet.hh.

Constructor & Destructor Documentation

◆ KunyanEthernet()

KunyanEthernet::KunyanEthernet ( )
inline

Initialise a reference to the Ethernet device.

This will check the ID registers to make sure that this is the kind of device that we're expecting.

Definition at line 455 of file platform-ethernet.hh.

References autonegotiation_enable(), interrupt_futex_get(), and STATIC_SEALED_VALUE.

Member Function Documentation

◆ autonegotiation_enable()

void KunyanEthernet::autonegotiation_enable ( uint8_t phyAddress = 1)
inline

Enable autonegotiation on the PHY.

FIXME: This blocks forever if the cable is disconnected!

Definition at line 549 of file platform-ethernet.hh.

Referenced by KunyanEthernet().

◆ check_frame()

std::optional< uint16_t > KunyanEthernet::check_frame ( BufferID index = BufferID::Ping)
inline

Definition at line 595 of file platform-ethernet.hh.

◆ complete_receive()

void KunyanEthernet::complete_receive ( BufferID index = BufferID::Ping)
inline

Definition at line 611 of file platform-ethernet.hh.

◆ dropped_frames_log_all_if_changed()

void KunyanEthernet::dropped_frames_log_all_if_changed ( )
inline

If debugging dropped frames is enabled, log any counter values that have changed since the last call to this function.

Definition at line 802 of file platform-ethernet.hh.

◆ has_unique_mac_address()

constexpr bool KunyanEthernet::has_unique_mac_address ( )
inlinestaticconstexpr

This device does not have a unique MAC address and so users must provide a locally administered MAC address if more than one device is present on the same network.

Definition at line 490 of file platform-ethernet.hh.

◆ mac_address_default()

constexpr MACAddress KunyanEthernet::mac_address_default ( )
inlinestaticconstexpr

Definition at line 495 of file platform-ethernet.hh.

◆ mac_address_set()

void KunyanEthernet::mac_address_set ( MACAddress address = mac_address_default())
inline

Definition at line 500 of file platform-ethernet.hh.

◆ phy_link_status()

bool KunyanEthernet::phy_link_status ( )
inline

Check the link status of the PHY.

Definition at line 590 of file platform-ethernet.hh.

◆ receive_frame()

std::optional< BufferedFrame > KunyanEthernet::receive_frame ( )
inline

Definition at line 680 of file platform-ethernet.hh.

◆ receive_interrupt_complete()

int KunyanEthernet::receive_interrupt_complete ( Timeout * timeout,
uint32_t lastInterruptValue )
inline

Definition at line 514 of file platform-ethernet.hh.

◆ receive_interrupt_value()

uint32_t KunyanEthernet::receive_interrupt_value ( )
inline

Definition at line 509 of file platform-ethernet.hh.

◆ received_frames_log()

void KunyanEthernet::received_frames_log ( )
inline

Definition at line 816 of file platform-ethernet.hh.

◆ send_frame()

bool KunyanEthernet::send_frame ( const uint8_t * buffer,
uint16_t length,
auto && check )
inline

Send a packet.

This is synchronous and will block until the packet has been sent. A better version would use the next available ping or pong buffer and return as soon as the send operation had been enqueued.

The third argument is a callback that allows the caller to check the frame before it's sent but after it's copied into memory that isn't shared with other compartments.

Definition at line 747 of file platform-ethernet.hh.

References heap_claim_ephemeral().


The documentation for this class was generated from the following file: