ChibiOS/RT Logo ChibiOS/RT

Architecture - Reference Manual - Guides

Modules | Defines | Functions

MAC Driver
[HAL]

Generic MAC driver. More...

Collaboration diagram for MAC Driver:


Description

Generic MAC driver.

This module implements a generic interface for MAC (Media Access Control) drivers, as example Ethernet controllers.

Modules

 MAC Low Level Driver
 

MAC Driver low level driver template.


Defines

#define macGetReceiveEventSource(macp)   (&(macp)->md_rdevent)
 Returns the received frames event source.
#define macWriteTransmitDescriptor(tdp, buf, size)   mac_lld_write_transmit_descriptor(tdp, buf, size)
 Writes to a transmit descriptor's stream.
#define macReadReceiveDescriptor(rdp, buf, size)   mac_lld_read_receive_descriptor(rdp, buf, size)
 Reads from a receive descriptor's stream.

Functions

void macInit (void)
 MAC Driver initialization.
void macObjectInit (MACDriver *macp)
 Initialize the standard part of a MACDriver structure.
void macSetAddress (MACDriver *macp, const uint8_t *p)
 MAC address setup.
msg_t macWaitTransmitDescriptor (MACDriver *macp, MACTransmitDescriptor *tdp, systime_t time)
 Allocates a transmission descriptor.
void macReleaseTransmitDescriptor (MACTransmitDescriptor *tdp)
 Releases a transmit descriptor and starts the transmission of the enqueued data as a single frame.
msg_t macWaitReceiveDescriptor (MACDriver *macp, MACReceiveDescriptor *rdp, systime_t time)
 Waits for a received frame.
void macReleaseReceiveDescriptor (MACReceiveDescriptor *rdp)
 Releases a receive descriptor.
bool_t macPollLinkStatus (MACDriver *macp)
 Updates and returns the link status.

Define Documentation

#define macGetReceiveEventSource (   macp  )     (&(macp)->md_rdevent)

Returns the received frames event source.

Parameters:
[in] macp pointer to the MACDriver object
Returns:
The pointer to the EventSource structure.

Definition at line 72 of file mac.h.

#define macWriteTransmitDescriptor (   tdp,
  buf,
  size 
)    mac_lld_write_transmit_descriptor(tdp, buf, size)

Writes to a transmit descriptor's stream.

Parameters:
[in] tdp pointer to a MACTransmitDescriptor structure
[in] buf pointer to the buffer containing the data to be written
[in] size number of bytes to be written
Returns:
The number of bytes written into the descriptor's stream, this value can be less than the amount specified in the parameter size if the maximum frame size is reached.

Definition at line 86 of file mac.h.

#define macReadReceiveDescriptor (   rdp,
  buf,
  size 
)    mac_lld_read_receive_descriptor(rdp, buf, size)

Reads from a receive descriptor's stream.

Parameters:
[in] rdp pointer to a MACReceiveDescriptor structure
[in] buf pointer to the buffer that will receive the read data
[in] size number of bytes to be read
Returns:
The number of bytes read from the descriptor's stream, this value can be less than the amount specified in the parameter size if there are no more bytes to read.

Definition at line 99 of file mac.h.


Function Documentation

void macInit ( void   ) 

MAC Driver initialization.

Definition at line 63 of file mac.c.

References mac_lld_init().

Referenced by halInit().

Here is the call graph for this function:

void macObjectInit ( MACDriver macp  ) 

Initialize the standard part of a MACDriver structure.

Parameters:
[in] macp pointer to the MACDriver object

Definition at line 73 of file mac.c.

References chEvtInit, chSemInit(), MACDriver::md_rdevent, MACDriver::md_rdsem, and MACDriver::md_tdsem.

Here is the call graph for this function:

void macSetAddress ( MACDriver macp,
const uint8_t p 
)

MAC address setup.

Note:
This function must be invoked only with the driver in the stopped state. If invoked on an active interface then it is ignored.
Parameters:
[in] macp pointer to the MACDriver object
[in] p pointer to a six bytes buffer containing the MAC address. If this parameter is set to NULL then MAC a system default is used.

Definition at line 93 of file mac.c.

References mac_lld_set_address().

Here is the call graph for this function:

msg_t macWaitTransmitDescriptor ( MACDriver macp,
MACTransmitDescriptor tdp,
systime_t  time 
)

Allocates a transmission descriptor.

One of the available transmission descriptors is locked and returned. If a descriptor is not currently available then the invoking thread is queued until one is freed.

Parameters:
[in] macp pointer to the MACDriver object
[out] tdp pointer to a MACTransmitDescriptor structure
[in] time the number of ticks before the operation timeouts, the following special values are allowed:

  • TIME_IMMEDIATE immediate timeout.
  • TIME_INFINITE no timeout.
Returns:
The operation status.
Return values:
RDY_OK the descriptor was obtained.
RDY_TIMEOUT the operation timed out, descriptor not initialized.

Definition at line 115 of file mac.c.

References chSemWaitTimeoutS(), chSysLock, chSysUnlock, chTimeNow, max_lld_get_transmit_descriptor(), MACDriver::md_tdsem, RDY_OK, RDY_TIMEOUT, and TIME_INFINITE.

Here is the call graph for this function:

void macReleaseTransmitDescriptor ( MACTransmitDescriptor tdp  ) 

Releases a transmit descriptor and starts the transmission of the enqueued data as a single frame.

Parameters:
[in] tdp the pointer to the MACTransmitDescriptor structure

Definition at line 139 of file mac.c.

References mac_lld_release_transmit_descriptor().

Here is the call graph for this function:

msg_t macWaitReceiveDescriptor ( MACDriver macp,
MACReceiveDescriptor rdp,
systime_t  time 
)

Waits for a received frame.

Stops until a frame is received and buffered. If a frame is not immediately available then the invoking thread is queued until one is received.

Parameters:
[in] macp pointer to the MACDriver object
[out] rdp pointer to a MACReceiveDescriptor structure
[in] time the number of ticks before the operation timeouts, the following special values are allowed:

  • TIME_IMMEDIATE immediate timeout.
  • TIME_INFINITE no timeout.
Returns:
The operation status.
Return values:
RDY_OK the descriptor was obtained.
RDY_TIMEOUT the operation timed out, descriptor not initialized.

Definition at line 161 of file mac.c.

References chSemWaitTimeoutS(), chSysLock, chSysUnlock, chTimeNow, max_lld_get_receive_descriptor(), MACDriver::md_rdsem, RDY_OK, RDY_TIMEOUT, and TIME_INFINITE.

Here is the call graph for this function:

void macReleaseReceiveDescriptor ( MACReceiveDescriptor rdp  ) 

Releases a receive descriptor.

The descriptor and its buffer are made available for more incoming frames.

Parameters:
[in] rdp the pointer to the MACReceiveDescriptor structure

Definition at line 186 of file mac.c.

References mac_lld_release_receive_descriptor().

Here is the call graph for this function:

bool_t macPollLinkStatus ( MACDriver macp  ) 

Updates and returns the link status.

Parameters:
[in] macp pointer to the MACDriver object
Returns:
The link status.
Return values:
TRUE if the link is active.
FALSE if the link is down.

Definition at line 199 of file mac.c.

References mac_lld_poll_link_status().

Here is the call graph for this function:


Generated on Sun Oct 24 2010 09:40:48 for ChibiOS/RT by doxygen 1.7.1