Synopsis
typedef struct {
  CTL_NET_MAC_ADDR_t mac_addr;
  CTL_NET_MAC_INIT_FN_t init_fn;
  CTL_NET_MAC_UPDATE_FN_t update_fn;
  CTL_NET_MAC_GET_STATE_FN_t get_state_fn;
  CTL_NET_MAC_SEND_FN_t send_fn;
  CTL_NET_MAC_MULTICAST_ACCEPT_FN_t multicast_accept_fn;
  CTL_NET_MAC_MULTICAST_QUERY_FN_t multicast_query_fn;
  CTL_NET_MAC_MII_WRITE_FN_t mii_write_fn;
  CTL_NET_MAC_MII_READ_FN_t mii_read_fn;
  CTL_NET_MAC_MII_DEFERRED_READ_FN_t mii_deferred_read_fn;
  CTL_NET_MAC_MII_DEFERRED_READ_RESULT_FN_t mii_deferred_read_result_fn;
  CTL_NET_MAC_SELECT_PHY_FN_t select_phy_fn;
  CTL_NET_MAC_PRIVATE_s *device;
} CTL_NET_MAC_DRIVER_t;
Associated types
typedef CTL_STATUS_t (*CTL_NET_MAC_INIT_FN_t)(CTL_NET_INTERFACE_t *);
typedef void (*CTL_NET_MAC_UPDATE_FN_t)(CTL_NET_INTERFACE_t *, unsigned);
typedef CTL_MAC_STATE_t (*CTL_NET_MAC_GET_STATE_FN_t)(CTL_NET_INTERFACE_t *);
typedef void (*CTL_NET_MAC_SEND_FN_t)(CTL_NET_INTERFACE_t *, CTL_ETH_TX_FRAME_t *);
typedef unsigned (*CTL_NET_MAC_MULTICAST_ACCEPT_FN_t)(CTL_NET_INTERFACE_t *, const CTL_NET_MAC_ADDR_t *, unsigned);
typedef unsigned (*CTL_NET_MAC_MULTICAST_QUERY_FN_t)(CTL_NET_INTERFACE_t *, const CTL_NET_MAC_ADDR_t *);
typedef CTL_STATUS_t (*CTL_NET_MAC_MII_WRITE_FN_t)(CTL_NET_INTERFACE_t *, int , int);
typedef CTL_STATUS_t (*CTL_NET_MAC_MII_READ_FN_t)(CTL_NET_INTERFACE_t *, int);
typedef CTL_STATUS_t (*CTL_NET_MAC_MII_DEFERRED_READ_FN_t)(CTL_NET_INTERFACE_t *, int);
typedef CTL_STATUS_t (*CTL_NET_MAC_MII_DEFERRED_READ_RESULT_FN_t)(CTL_NET_INTERFACE_t *);
typedef CTL_STATUS_t (*CTL_NET_MAC_SELECT_PHY_FN_t)(CTL_NET_INTERFACE_t *);
Description

CTL_NET_MAC_DRIVER_t holds the data and functions that handle the MAC layer.

mac_addr
The Ethernet MAC address that the network interface uses. You must set this before calling init_fn.
init_fn
This should return non-zero if MAC hardware initialization was successful.
update_fn
The network stack will call update_fn called periodically (with a non-zero isHousekeeping) or when the network task is activated by ctl_mac_wake_net_task.
get_state_fn
The network stack will will call get_state_fn to query the state of the MAC in various layers.
send_fn
The IP layer will call send_fn to send a frame to the MAC for transmission. send_fn must be thread-safe.
multicast_accept_fn
Enable or disable accepting packets given the layer 2 destination address. Returns non-zero if successful.
multicast_query_fn
Returns non-zero if the MAC layer is currently accepting mulitcast packets with the given MAC address.
mii_write_fn
Writes to a PHY register. This doesn't need to be thread-safe as it is only called from the network task.
mii_read_fn
Reads a PHY register. This doesn't need to be thread-safe as it is only called from the network task.
mii_deferred_read_fn
Start a deferred read of an MII register. The result will be read by calling mii_deferred_read_result_fn.
mii_deferred_read_result_fn
Return the PHY register requested by mii_deferred_read_fn. If the result is not ready, return CTL_PHY_AGAIN, or an error code if there is an error, else the register contents.
select_phy_fn
Select the appropriate PHY attached to the MAC.
device
Additional MAC data, if any.