2 \defgroup eth_mac_interface_gr Ethernet MAC Interface
3 \ingroup eth_interface_gr
4 \brief Driver API for Ethernet MAC Peripheral (%Driver_ETH_MAC.h)
6 The following section describes the Ethernet MAC Interface as defined in the %Driver_ETH_MAC.h header file.
11 \struct ARM_ETH_MAC_CAPABILITIES
13 An Ethernet MAC driver can be implemented with different capabilities.
14 The data fields of this struct encode the capabilities implemented by this driver.
17 - \ref ARM_ETH_MAC_GetCapabilities
21 \struct ARM_DRIVER_ETH_MAC
23 The functions of the Ethernet MAC are accessed by function pointers. Refer to \ref DriverFunctions for
26 Each instance of an Ethernet MAC provides such an access struct. The instance is indicated by
27 a postfix in the symbol name of the access struct, for example:
28 - \b Driver_ETH_MAC0 is the name of the access struct of the first instance (no. 0).
29 - \b Driver_ETH_MAC1 is the name of the access struct of the second instance (no. 1).
31 A configuration setting in the middleware allows connecting the middleware to a specific driver instance <b>Driver_ETH_MAC<i>n</i></b>.
32 The default is \token{0}, which connects a middleware to the first instance of a driver.
36 \struct ARM_ETH_MAC_TIME
38 The two members of this struct provide fields to encode time values in the order \token{Nano seconds} and \token{seconds}.
40 The member \em ns is also used as a correction factor for \ref ARM_ETH_MAC_TIMER_ADJUST_CLOCK.
43 - \ref ARM_ETH_MAC_GetRxFrameTime
44 - \ref ARM_ETH_MAC_GetTxFrameTime
45 - \ref ARM_ETH_MAC_ControlTimer
47 *******************************************************************************************************************/
50 \typedef ARM_ETH_MAC_SignalEvent_t
52 Provides the typedef for the callback function \ref ARM_ETH_MAC_SignalEvent.
55 - \ref ARM_ETH_MAC_Initialize
56 *******************************************************************************************************************/
59 \defgroup ETH_MAC_events Ethernet MAC Events
60 \ingroup eth_mac_interface_gr
61 \brief The Ethernet MAC driver generates call back events that are notified via the function \ref ARM_ETH_MAC_SignalEvent.
63 This section provides the event values for the \ref ARM_ETH_MAC_SignalEvent callback function.
65 The following call back notification events are generated:
67 \def ARM_ETH_MAC_EVENT_RX_FRAME
68 \def ARM_ETH_MAC_EVENT_TX_FRAME
69 \def ARM_ETH_MAC_EVENT_WAKEUP
70 \def ARM_ETH_MAC_EVENT_TIMER_ALARM
75 // Function documentation
78 ARM_DRIVER_VERSION ARM_ETH_MAC_GetVersion (void) {
82 \fn ARM_DRIVER_VERSION ARM_ETH_MAC_GetVersion (void);
84 The function \b ARM_ETH_MAC_GetVersion returns version information of the driver implementation in \ref ARM_DRIVER_VERSION
85 - API version is the version of the CMSIS-Driver specification used to implement this driver.
86 - Driver version is source code version of the actual driver implementation.
90 extern ARM_DRIVER_ETH_MAC Driver_ETH_MAC0;
91 ARM_DRIVER_ETH_MAC *mac;
93 void setup_ethernet (void) {
94 ARM_DRIVER_VERSION version;
96 mac = &Driver_ETH_MAC0;
97 version = mac->GetVersion ();
98 if (version.api < 0x10A) { // requires at minimum API version 1.10 or higher
104 *******************************************************************************************************************/
106 ARM_ETH_MAC_CAPABILITIES ARM_ETH_MAC_GetCapabilities (void) {
110 \fn ARM_ETH_MAC_CAPABILITIES ARM_ETH_MAC_GetCapabilities (void)
112 The function \b ARM_ETH_MAC_GetCapabilities retrieves information about capabilities in this driver implementation.
113 The data fields of the struct \ref ARM_ETH_MAC_CAPABILITIES encode various capabilities, for example
114 if a hardware is capable to create checksums in hardware or signal events using the \ref ARM_ETH_MAC_SignalEvent
119 extern ARM_DRIVER_ETH_MAC Driver_ETH_MAC0;
120 ARM_DRIVER_ETH_MAC *mac;
122 void read_capabilities (void) {
123 ARM_ETH_MAC_CAPABILITIES mac_capabilities;
125 mac = &Driver_ETH_MAC0;
126 mac_capabilities = mac->GetCapabilities ();
127 // interrogate capabilities
131 *******************************************************************************************************************/
133 int32_t ARM_ETH_MAC_Initialize (ARM_ETH_MAC_SignalEvent_t cb_event) {
137 \fn int32_t ARM_ETH_MAC_Initialize (ARM_ETH_MAC_SignalEvent_t cb_event)
139 The function \b ARM_ETH_MAC_Initialize initializes the Ethernet MAC interface.
140 It is called when the middleware component starts operation.
142 The \ref ARM_ETH_MAC_Initialize function performs the following operations:
143 - Initializes the resources needed for the Ethernet MAC peripheral.
144 - Registers the \ref ARM_ETH_MAC_SignalEvent callback function.
146 The parameter \em cb_event is a pointer to the \ref ARM_ETH_MAC_SignalEvent callback function; use a NULL pointer
147 when no callback signals are required.
150 - see \ref eth_interface_gr - Driver Functions
151 *******************************************************************************************************************/
153 int32_t ARM_ETH_MAC_Uninitialize (void) {
157 \fn int32_t ARM_ETH_MAC_Uninitialize (void)
159 The function \b ARM_ETH_MAC_Uninitialize de-initializes the resources of Ethernet MAC interface.
161 It is called when the middleware component stops operation and releases the software resources
162 used by the interface.
163 *******************************************************************************************************************/
165 int32_t ARM_ETH_MAC_PowerControl (ARM_POWER_STATE state) {
169 \fn int32_t ARM_ETH_MAC_PowerControl (ARM_POWER_STATE state)
171 The function \b ARM_ETH_MAC_PowerControl allows you to configure the power modes of the Ethernet MAC interface.
173 The parameter \em state can be:
174 - ARM_POWER_OFF: Ethernet MAC peripheral is turned off.
175 - ARM_POWER_FULL: Ethernet MAC peripheral is turned on and fully operational.
177 If power \em state specifies an unsupported mode, the function returns \ref ARM_DRIVER_ERROR_UNSUPPORTED as status information
178 and the previous power state of the peripheral is unchanged. Multiple calls with the same \em state generate no
182 - see \ref eth_interface_gr - Driver Functions
183 *******************************************************************************************************************/
185 int32_t ARM_ETH_MAC_GetMacAddress (ARM_ETH_MAC_ADDR *ptr_addr) {
189 \fn int32_t ARM_ETH_MAC_GetMacAddress (ARM_ETH_MAC_ADDR *ptr_addr)
191 The function \b ARM_ETH_MAC_GetMacAddress retrieves the Ethernet MAC own address from the driver.
192 *******************************************************************************************************************/
194 int32_t ARM_ETH_MAC_SetMacAddress (const ARM_ETH_MAC_ADDR *ptr_addr) {
198 \fn int32_t ARM_ETH_MAC_SetMacAddress (const ARM_ETH_MAC_ADDR *ptr_addr)
200 The function \b ARM_ETH_MAC_SetMacAddress configures Ethernet MAC own address.
201 The Ethernet MAC accepts packets <a href="http://en.wikipedia.org/wiki/Ethernet_frame" target="_blank"><b>Ethernet frames</b></a> which contains
202 a MAC destination address that matches the address specified with \em ptr_addr.
204 The Ethernet MAC receiver will accept also packets with addresses configured by \ref ARM_ETH_MAC_SetAddressFilter function.
206 MAC receiver can be configured to accept also packets with broadcast address, any multicast address or even all packets regardless of address (Promiscuity Mode).
207 This is configured by function \ref ARM_ETH_MAC_Control with \ref ARM_ETH_MAC_CONFIGURE as control parameter.
208 *******************************************************************************************************************/
210 int32_t ARM_ETH_MAC_SetAddressFilter (const ARM_ETH_MAC_ADDR *ptr_addr, uint32_t num_addr) {
214 \fn int32_t ARM_ETH_MAC_SetAddressFilter (const ARM_ETH_MAC_ADDR *ptr_addr, uint32_t num_addr)
216 The function \b ARM_ETH_MAC_SetAddressFilter configures Ethernet MAC receiver address filtering.
217 The Ethernet MAC accepts packets <a href="http://en.wikipedia.org/wiki/Ethernet_frame" target="_blank"><b>Ethernet frames</b></a> which contains
218 a MAC destination address of the list supplied with \em ptr_addr. The parameter \em ptr_addr provides and array of Ethernet MAC addresses. The number of addresses
219 is supplied by \em num_addr. Specifying \em num_adr = 0 disables address filtering previously set with this function.
221 The Ethernet MAC receiver will accept packets addressed to its own address and packets with addresses configured by this function.
223 MAC receiver can be configured to accept also packets with broadcast address, any multicast address or even all packets regardless of address (Promiscuity Mode).
224 This is configured by function \ref ARM_ETH_MAC_Control with \ref ARM_ETH_MAC_CONFIGURE as control parameter.
225 *******************************************************************************************************************/
227 int32_t ARM_ETH_MAC_SendFrame (const uint8_t *frame, uint32_t len, uint32_t flags) {
231 \fn int32_t ARM_ETH_MAC_SendFrame (const uint8_t *frame, uint32_t len, uint32_t flags)
233 The function \b ARM_ETH_MAC_SendFrame writes an <a href="http://en.wikipedia.org/wiki/Ethernet_frame" target="_blank"><b>Ethernet frame</b></a> to the Ethernet MAC transmit buffer.
235 The Ethernet MAC transmit engine must be enabled by using the function \ref ARM_ETH_MAC_Control (ARM_ETH_MAC_CONTROL_TX, 1) before a call to this function.
237 The frame data addressed by \em buf starts with MAC destination and ends with the last Payload data byte. The frame data is copied into
238 the transmit buffer of the Ethernet MAC interface. The function does not wait until the transmission over the Ethernet is complete,
239 however the memory addressed by \em buf is available for the next Ethernet frame after return.
241 The maximum value for \em len is implied by the size restrictions of the Ethernet frame but is not verified.
242 Using an invalid value for \em len may generate unpredicted results.
244 The parameter \em flags specifies additional attributes for the function as shown in the following table. Multiple flags can be combined, for example:
245 ARM_ETH_MAC_TX_FRAME_EVENT | ARM_ETH_MAC_TX_FRAME_TIMESTAMP.
247 Flag bit | Description
248 :--------------------------------------|:-----------------------------------------
249 \ref ARM_ETH_MAC_TX_FRAME_FRAGMENT | Indicates that it is a fragment of the frame. allows you to collect multiple fragments before the frame is sent.
250 \ref ARM_ETH_MAC_TX_FRAME_EVENT | \ref ARM_ETH_MAC_SignalEvent with \em event bit \ref ARM_ETH_MAC_EVENT_TX_FRAME set will be called when frame send is complete.
251 \ref ARM_ETH_MAC_TX_FRAME_TIMESTAMP | Capture the time stamp of the frame. The time stamp can be obtained using the function \ref ARM_ETH_MAC_GetTxFrameTime.
256 status = mac->SendFrame (&frame->data[0], frame->length, 0);
257 if (status != ARM_DRIVER_OK) {
262 *******************************************************************************************************************/
264 int32_t ARM_ETH_MAC_ReadFrame (uint8_t *frame, uint32_t len) {
268 \fn int32_t ARM_ETH_MAC_ReadFrame (uint8_t *frame, uint32_t len)
270 The function \b ARM_ETH_MAC_ReadFrame reads an <a href="http://en.wikipedia.org/wiki/Ethernet_frame" target="_blank"><b>Ethernet frame</b></a> from the Ethernet MAC receive buffer.
272 The Ethernet MAC receive engine must be enabled using the function \ref ARM_ETH_MAC_Control (ARM_ETH_MAC_CONTROL_RX , 1) before a call to this function.
273 The \em len of the Ethernet frame can be checked using the function \ref ARM_ETH_MAC_GetRxFrameSize.
275 The frame data addressed by \em buf starts with MAC destination and ends with the last Payload data byte. The frame data is read from
276 the receive buffer of the Ethernet MAC interface and the number of bytes written into the memory addressed by \em buf is returned.
277 A negative return value indicates an error whereby the status code is defined with driver common return codes.
279 The function \ref ARM_ETH_MAC_ReadFrame may be called with \em buf = NULL and \em len = 0 to discard or release an frame. This is useful when an incorrect frame has been received or
280 no memory is available to hold the Ethernet frame.
284 size = mac->GetRxFrameSize ();
285 if ((size < 14) || (size > 1514)) { // frame excludes CRC
286 mac->ReadFrame (NULL, 0); // Frame error, release it
288 len = mac->ReadFrame (&frame->data[0], size);
293 *******************************************************************************************************************/
295 uint32_t ARM_ETH_MAC_GetRxFrameSize (void) {
299 \fn uint32_t ARM_ETH_MAC_GetRxFrameSize (void)
301 The function \b ARM_ETH_MAC_GetRxFrameSize returns the size of a received
302 <a href="http://en.wikipedia.org/wiki/Ethernet_frame" target="_blank"><b>Ethernet frame</b></a>.
303 This function is called before \ref ARM_ETH_MAC_ReadFrame and supplies the value \em len.
305 The frame size includes MAC destination and ends with the last Payload data byte.
306 Value \em 0 indicates that no Ethernet frame is available in the receive buffer.
307 Values smaller than minimum size of Ethernet frame or larger than maximum size of Ethernet frame
308 indicate an invalid frame which needs to be discarded by calling \ref ARM_ETH_MAC_ReadFrame.
311 - see \ref ARM_ETH_MAC_ReadFrame
313 *******************************************************************************************************************/
315 int32_t ARM_ETH_MAC_GetRxFrameTime (ARM_ETH_MAC_TIME *time) {
319 \fn int32_t ARM_ETH_MAC_GetRxFrameTime (ARM_ETH_MAC_TIME *time)
321 Retrieve time stamp of a received <a href="http://en.wikipedia.org/wiki/Ethernet_frame" target="_blank"><b>Ethernet frame</b></a>.
322 This function must be called before the frame is read using \ref ARM_ETH_MAC_ReadFrame.
323 *******************************************************************************************************************/
325 int32_t ARM_ETH_MAC_GetTxFrameTime (ARM_ETH_MAC_TIME *time) {
329 \fn int32_t ARM_ETH_MAC_GetTxFrameTime (ARM_ETH_MAC_TIME *time)
331 The function \b returns the time stamp of a transmitted <a href="http://en.wikipedia.org/wiki/Ethernet_frame" target="_blank"><b>Ethernet frame</b></a>.
332 *******************************************************************************************************************/
334 int32_t ARM_ETH_MAC_Control (uint32_t control, uint32_t arg) {
338 \fn int32_t ARM_ETH_MAC_Control (uint32_t control, uint32_t arg)
340 The function \b ARM_ETH_MAC_Control controls the Ethernet MAC interface and executes various operations.
341 After initialization, the Ethernet transceiver and receiver are disabled.
343 The parameter \em control specifies an operation as defined in the table <b>Parameter \em control</b>. \n
344 The parameter \em arg provides, depending on the operation, additional information or values.
346 The table lists values for the parameter \em control.
348 Parameter \em control | Operation
349 :----------------------------------------------------|:--------------------------------------------
350 \ref ARM_ETH_MAC_CONFIGURE | Configure the Ethernet MAC interface; For \em arg values, see table <b>Parameter \em arg for CONFIGURE</b>
351 \ref ARM_ETH_MAC_CONTROL_TX | Enable or disable the transmitter; \em arg : \token{0=disable; 1=enable}
352 \ref ARM_ETH_MAC_CONTROL_RX | Enable or disable the receiver; \em arg : \token{0=disable; 1=enable}
353 \ref ARM_ETH_MAC_FLUSH | Flush a buffer; \em arg : see table <b>Parameter \em arg for FLUSH</b>
354 \ref ARM_ETH_MAC_SLEEP | Exit/Enter Sleep mode; \em arg : \token{0=exit; 1=enter and wait for Magic packet}
355 \ref ARM_ETH_MAC_VLAN_FILTER | Configure VLAN Filter for received frames; \em arg : See table <b>Parameter \em arg for VLAN Filter</b>
358 The table <b>Parameter \em arg for CONFIGURE</b> lists the \em arg values for the \em control \b ARM_ETH_MAC_CONFIGURE.
359 The values can be ORed in the following way:
361 mac->Control(ARM_ETH_MAC_CONFIGURE, ARM_ETH_MAC_SPEED_100M | ARM_ETH_MAC_DUPLEX_FULL | ARM_ETH_MAC_LOOPBACK);
364 <table class="cmtable" summary="">
365 <tr><th colspan="4">Parameter \em arg CONFIGURE </th></tr>
366 <tr><th>Parameter \em arg </th><th> Bit </th><th> Category </th><th>Description </th></tr>
367 <tr><td>\ref ARM_ETH_MAC_SPEED_10M </td><td rowspan="3"> 0..1 </td><td rowspan="3">Link Speed </td><td>Set the link speed to \token{10 [Mbps]} </td></tr>
368 <tr><td>\ref ARM_ETH_MAC_SPEED_100M </td> <td>Set the link speed to \token{100 [Mbps]}</td></tr>
369 <tr><td>\ref ARM_ETH_MAC_SPEED_1G </td> <td>Set the link speed to \token{1 [Gbps]} </td></tr>
370 <tr><td>\ref ARM_ETH_MAC_DUPLEX_HALF </td><td rowspan="2"> 2 </td><td rowspan="2">Link Mode </td><td>Set the link mode to half duplex </td></tr>
371 <tr><td>\ref ARM_ETH_MAC_DUPLEX_FULL </td> <td>Set the link mode to full duplex </td></tr>
372 <tr><td>n.a. </td><td> 3 </td><td> n.a. </td><td>\em reserved </td></tr>
373 <tr><td>\ref ARM_ETH_MAC_LOOPBACK </td><td> 4 </td><td> Loopback Test Mode </td><td>Set the interface into a Loop-back test mode</td></tr>
374 <tr><td>\ref ARM_ETH_MAC_CHECKSUM_OFFLOAD_RX</td><td> 5 </td><td>Receiver Checksum offload</td><td>Enable Receiver Checksum offload </td></tr>
375 <tr><td>\ref ARM_ETH_MAC_CHECKSUM_OFFLOAD_TX</td><td> 6 </td><td>Transmitter Checksum offload</td><td>Enable Transmitter Checksum offload </td></tr>
376 <tr><td>\ref ARM_ETH_MAC_ADDRESS_BROADCAST </td><td> 7 </td><td>Broadcast Frame address </td><td>Accept frames with Broadcast address </td></tr>
377 <tr><td>\ref ARM_ETH_MAC_ADDRESS_MULTICAST </td><td> 8 </td><td>Multicast Frame address </td><td>Accept frames with any Multicast address</td></tr>
378 <tr><td>\ref ARM_ETH_MAC_ADDRESS_ALL </td><td> 9 </td><td>Any Frame address </td><td>Accept frames with any address (Promiscuous Mode)</td></tr>
381 The table <b>Parameter \em arg for FLUSH</b> lists the \em arg values for the \em control \b ARM_ETH_MAC_FLUSH.
382 The \em arg values can be ORed.
384 <table class="cmtable" summary="">
385 <tr><th colspan="4">Parameter \em arg for FLUSH </th></tr>
386 <tr><th>Parameter \em arg </th><th> Bit </th><th> Category </th><th> Description </th></tr>
387 <tr><td>\ref ARM_ETH_MAC_FLUSH_RX </td><td> 1 </td><td> Receive buffer </td><td> Flush the Receive buffer </td></tr>
388 <tr><td>\ref ARM_ETH_MAC_FLUSH_TX </td><td> 2 </td><td> Transmit buffer </td><td> Flush the Transmit buffer </td></tr>
391 The table <b>Parameter \em arg for VLAN Filter</b> lists the \em arg values for the \em control \b ARM_ETH_MAC_VLAN_FILTER.
392 The \em arg values can be ORed.
394 <table class="cmtable" summary="">
395 <tr><th colspan="4">Parameter \em arg for VLAN Filter</th></tr>
396 <tr><th>Parameter \em arg </th><th> Bit </th><th> Category </th><th> Description </th></tr>
397 <tr><td>\em value </td><td> 0..15 </td><td> VLAN Tag </td><td> Set VLAN Tag value </td></tr>
398 <tr><td>\token{0} </td><td rowspan="2"> 16 </td><td rowspan="2"> Use of VLAN </td><td> Compare the complete 16-bit VLAN Tag value </td></tr>
399 <tr><td>\ref ARM_ETH_MAC_VLAN_FILTER_ID_ONLY </td> <td>Compare only the 12-bit VLAN Identifier </td></tr>
400 <tr><td>\token{0} </td><td> 0..16 </td><td> Disable </td><td> Disable the VLAN Filter </td></tr>
409 mac->Control(ARM_ETH_MAC_CONFIGURE, ARM_ETH_MAC_SPEED_100M | ARM_ETH_MAC_DUPLEX_FULL | ARM_ETH_MAC_ADDRESS_BROADCAST);
410 mac->Control(ARM_ETH_MAC_CONTROL_TX, 1);
411 mac->Control(ARM_ETH_MAC_CONTROL_RX, 1);
414 mac->Control(ARM_ETH_MAC_FLUSH, ARM_ETH_MAC_FLUSH_TX | ARM_ETH_MAC_FLUSH_RX);
415 mac->Control(ARM_ETH_MAC_CONTROL_TX, 0);
416 mac->Control(ARM_ETH_MAC_CONTROL_RX, 0);
421 For a complete example, refer to \ref eth_interface_gr - Driver Functions.
423 *******************************************************************************************************************/
425 int32_t ARM_ETH_MAC_ControlTimer (uint32_t control, ARM_ETH_MAC_TIME *time) {
429 \fn int32_t ARM_ETH_MAC_ControlTimer (uint32_t control, ARM_ETH_MAC_TIME *time)
431 The function \b ARM_ETH_MAC_ControlTimer controls the timer required for PTP (Precision Time Protocol).
433 The parameter \em control receives \b ARM_ETH_MAC_TIMER_xxx codes to manage the timer for a PTP enabled Ethernet MAC interface. \n
434 The parameter \em time is pointer to a structure that holds time information.
436 Mode Parameters: Timer Controls | Description
437 :---------------------------------------|:--------------------------------------------
438 \ref ARM_ETH_MAC_TIMER_GET_TIME | Retrieve the current time and update the content \ref ARM_ETH_MAC_TIME *time.
439 \ref ARM_ETH_MAC_TIMER_SET_TIME | Set the new time using the values provided with \ref ARM_ETH_MAC_TIME *time.
440 \ref ARM_ETH_MAC_TIMER_INC_TIME | Increment the current time by using the values provided with \ref ARM_ETH_MAC_TIME *time.
441 \ref ARM_ETH_MAC_TIMER_DEC_TIME | Decrement the current time by using the values provided with \ref ARM_ETH_MAC_TIME *time.
442 \ref ARM_ETH_MAC_TIMER_SET_ALARM | Set the alarm time to the values provided with \ref ARM_ETH_MAC_TIME *time.
443 \ref ARM_ETH_MAC_TIMER_ADJUST_CLOCK | Set the clock frequency; the value in time->ns is the <b>correction factor</b> in fractional format q31.
445 *******************************************************************************************************************/
447 int32_t ARM_ETH_MAC_PHY_Read (uint8_t phy_addr, uint8_t reg_addr, uint16_t *data) {
451 \fn int32_t ARM_ETH_MAC_PHY_Read (uint8_t phy_addr, uint8_t reg_addr, uint16_t *data)
454 Read Ethernet PHY Register through the Management Interface. The function is passed to \ref ARM_ETH_PHY_Initialize.
455 The Ethernet PHY driver uses this function to read the value of PHY registers.
458 - see \ref eth_interface_gr - Driver Functions
459 *******************************************************************************************************************/
461 int32_t ARM_ETH_MAC_PHY_Write (uint8_t phy_addr, uint8_t reg_addr, uint16_t data) {
465 \fn int32_t ARM_ETH_MAC_PHY_Write (uint8_t phy_addr, uint8_t reg_addr, uint16_t data)
467 The function \b ARM_ETH_MAC_PHY_Write writes to a Ethernet PHY register through the Management Interface. The function is passed to \ref ARM_ETH_PHY_Initialize.
468 The Ethernet PHY driver uses this function to write data to PHY registers.
471 - see \ref eth_interface_gr - Driver Functions
473 *******************************************************************************************************************/
475 void ARM_ETH_MAC_SignalEvent (uint32_t event) {
479 \fn void ARM_ETH_MAC_SignalEvent (uint32_t event)
482 The function \b ARM_ETH_MAC_SignalEvent is a callback function registered by the function
483 \ref ARM_ETH_MAC_Initialize. This function is typically called from interrupt service routines (ISR) to indicate that
484 a frame is processed or a special event occurred.
486 The parameter \a event indicates one or more events that occurred during driver operation.
487 Each event is encoded in a separate bit and therefore it is possible to signal multiple events within the same call.
489 Not every event is necessarily generated by the driver. This depends on the implemented capabilities stored in the
490 data fields of the structure \ref ARM_ETH_MAC_CAPABILITIES, which can be retrieved with the function \ref ARM_ETH_MAC_GetCapabilities.
492 The following events can be generated:
494 Parameter \em event | Bit | Description
495 :----------------------------------------|:---:|:----------------------------------------
496 \ref ARM_ETH_MAC_EVENT_RX_FRAME | 0 | Occurs after a frame is received. Frame can be read by calling \ref ARM_ETH_MAC_ReadFrame.
497 \ref ARM_ETH_MAC_EVENT_TX_FRAME | 1 | Occurs after call to \ref ARM_ETH_MAC_SendFrame to indicate that the frame is transmitted.
498 \ref ARM_ETH_MAC_EVENT_WAKEUP | 2 | Indicates that a Magic Packet is received while the driver is in Sleep mode (set by \ref ARM_ETH_MAC_SLEEP using \ref ARM_ETH_MAC_Control).
499 \ref ARM_ETH_MAC_EVENT_TIMER_ALARM | 3 | Indicates that a Timer Alarm occurred that was set with \ref ARM_ETH_MAC_TIMER_SET_ALARM using ARM_ETH_MAC_ControlTimer.
501 *******************************************************************************************************************/
505 \defgroup eth_mac_control Ethernet MAC Control Codes
506 \ingroup eth_mac_interface_gr
507 \brief Configure and control the Ethernet MAC using the \ref ARM_ETH_MAC_Control.
510 Many parameters of the Ethernet MAC driver are configured using the \ref ARM_ETH_MAC_Control function.
512 The various Ethernet MAC control codes define:
514 - \ref eth_mac_ctrls configures and controls the Ethernet MAC interface
515 - \ref eth_mac_configuration_ctrls specifies speed mode, link mode, checksum, and frame filtering modes
516 - \ref eth_mac_flush_flag_ctrls specify controls to flush a buffer
517 - \ref eth_mac_vlan_filter_ctrls specifies whether to compare only the VLAN Identifier
519 Refer to the \ref ARM_ETH_MAC_Control function for further details.
523 \defgroup eth_mac_ctrls Ethernet MAC Controls
524 \brief Configure and control the Ethernet MAC interface.
527 \def ARM_ETH_MAC_CONFIGURE
528 \sa ARM_ETH_MAC_Control
529 \def ARM_ETH_MAC_CONTROL_TX
530 \sa ARM_ETH_MAC_Control
531 \def ARM_ETH_MAC_CONTROL_RX
532 \sa ARM_ETH_MAC_Control
533 \def ARM_ETH_MAC_FLUSH
534 \sa ARM_ETH_MAC_Control
535 \def ARM_ETH_MAC_SLEEP
536 \sa ARM_ETH_MAC_Control
537 \def ARM_ETH_MAC_VLAN_FILTER
538 \sa ARM_ETH_MAC_Control
544 \defgroup eth_mac_configuration_ctrls Ethernet MAC Configuration
545 \brief Specifies speed mode, link mode, checksum, and frame filtering modes.
548 The function \ref ARM_ETH_MAC_Control with \em control = \ref ARM_ETH_MAC_CONFIGURE configures the Ethernet MAC interface
549 as specified with \em arg listed bellow.
551 \def ARM_ETH_MAC_SPEED_10M
552 \def ARM_ETH_MAC_SPEED_100M
553 \def ARM_ETH_MAC_SPEED_1G
554 \def ARM_ETH_MAC_DUPLEX_HALF
555 \def ARM_ETH_MAC_DUPLEX_FULL
556 \def ARM_ETH_MAC_LOOPBACK
557 \def ARM_ETH_MAC_CHECKSUM_OFFLOAD_RX
558 \def ARM_ETH_MAC_CHECKSUM_OFFLOAD_TX
559 \def ARM_ETH_MAC_ADDRESS_BROADCAST
560 \def ARM_ETH_MAC_ADDRESS_MULTICAST
561 \def ARM_ETH_MAC_ADDRESS_ALL
566 \defgroup eth_mac_flush_flag_ctrls Ethernet MAC Flush Flags
567 \brief Specify controls to flush a buffer
570 The function \ref ARM_ETH_MAC_Control with \em control = \ref ARM_ETH_MAC_FLUSH flushes the buffer
571 which is specified with \em arg listed bellow.
573 \def ARM_ETH_MAC_FLUSH_RX
574 \def ARM_ETH_MAC_FLUSH_TX
580 \defgroup eth_mac_vlan_filter_ctrls Ethernet MAC VLAN Filter Flag
581 \brief Specify whether to compare only the VLAN Identifier
584 The function \ref ARM_ETH_MAC_Control with \em control = \ref ARM_ETH_MAC_VLAN_FILTER configures the VLAN Filter for received frames as specified with \em arg.
586 By default the complete VLAN Tag (16-bit) is compared. When \ref ARM_ETH_MAC_VLAN_FILTER_ID_ONLY is specified then only the VLAN Identifier (12-bit) is compared.
588 Specifying \em arg=0 disables the VLAN Filter.
590 \def ARM_ETH_MAC_VLAN_FILTER_ID_ONLY
596 @} */ // end group eth_mac_control
600 \defgroup eth_mac_time_control Ethernet MAC Timer Control Codes
601 \ingroup eth_mac_interface_gr
602 \brief Control codes for \ref ARM_ETH_MAC_ControlTimer function.
604 The following timer controls are used as parameter \em control for the \ref ARM_ETH_MAC_ControlTimer function:
606 \def ARM_ETH_MAC_TIMER_GET_TIME
607 \sa ARM_ETH_MAC_ControlTimer
608 \def ARM_ETH_MAC_TIMER_SET_TIME
609 \sa ARM_ETH_MAC_ControlTimer
610 \def ARM_ETH_MAC_TIMER_INC_TIME
611 \sa ARM_ETH_MAC_ControlTimer
612 \def ARM_ETH_MAC_TIMER_DEC_TIME
613 \sa ARM_ETH_MAC_ControlTimer
614 \def ARM_ETH_MAC_TIMER_SET_ALARM
615 \sa ARM_ETH_MAC_ControlTimer
616 \def ARM_ETH_MAC_TIMER_ADJUST_CLOCK
617 \sa ARM_ETH_MAC_ControlTimer
623 \defgroup eth_mac_frame_transmit_ctrls Ethernet MAC Frame Transmit Flags
624 \brief Specify frame transmit flags
627 \def ARM_ETH_MAC_TX_FRAME_FRAGMENT
628 \sa ARM_ETH_MAC_SendFrame
629 \def ARM_ETH_MAC_TX_FRAME_EVENT
630 \sa ARM_ETH_MAC_SendFrame
631 \def ARM_ETH_MAC_TX_FRAME_TIMESTAMP
632 \sa ARM_ETH_MAC_SendFrame
641 // End ETH MAC Interface