]> begriffs open source - cmsis/blob - CMSIS/DoxyGen/Driver/src/Driver_ETH_MAC.c
Driver: Updated demo code for Flash Driver usage.
[cmsis] / CMSIS / DoxyGen / Driver / src / Driver_ETH_MAC.c
1 /**
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)
5 \details 
6 The following section describes the Ethernet MAC Interface as defined in the %Driver_ETH_MAC.h header file.
7 @{
8 */
9
10 /**
11 \struct     ARM_ETH_MAC_CAPABILITIES
12 \details
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.
15
16 <b>Returned by:</b>
17   - \ref ARM_ETH_MAC_GetCapabilities
18 */
19
20 /**
21 \struct     ARM_DRIVER_ETH_MAC
22 \details
23 The functions of the Ethernet MAC are accessed by function pointers. Refer to \ref DriverFunctions for 
24 overview information.
25
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).
30
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.
33 */
34
35 /**
36 \struct     ARM_ETH_MAC_TIME
37 \details
38 The two members of this struct provide fields to encode time values in the order \token{Nano seconds} and \token{seconds}.
39
40 The member \em ns is also used as a correction factor for \ref ARM_ETH_MAC_TIMER_ADJUST_CLOCK.
41
42 <b>Used in:</b>
43   - \ref ARM_ETH_MAC_GetRxFrameTime
44   - \ref ARM_ETH_MAC_GetTxFrameTime
45   - \ref ARM_ETH_MAC_ControlTimer
46
47 *******************************************************************************************************************/
48
49 /**
50 \typedef    ARM_ETH_MAC_SignalEvent_t
51 \details
52 Provides the typedef for the callback function \ref ARM_ETH_MAC_SignalEvent.
53
54 <b>Parameter for:</b>
55   - \ref ARM_ETH_MAC_Initialize
56 *******************************************************************************************************************/
57
58 /**
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.
62 \details 
63 This section provides the event values for the \ref ARM_ETH_MAC_SignalEvent callback function.
64
65 The following call back notification events are generated:
66 @{
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
71 @}
72 */
73
74 //
75 // Function documentation
76 //
77
78 ARM_DRIVER_VERSION ARM_ETH_MAC_GetVersion (void)  {
79   ;
80 }
81 /**
82 \fn       ARM_DRIVER_VERSION ARM_ETH_MAC_GetVersion (void);
83 \details
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.
87
88 Example:
89 \code
90 extern ARM_DRIVER_ETH_MAC Driver_ETH_MAC0;
91 ARM_DRIVER_ETH_MAC *mac;
92  
93 void setup_ethernet (void)  {
94   ARM_DRIVER_VERSION  version;
95  
96   mac = &Driver_ETH_MAC0;  
97   version = mac->GetVersion ();
98   if (version.api < 0x10A)   {      // requires at minimum API version 1.10 or higher
99     // error handling
100     return;
101   }
102 }
103 \endcode
104 *******************************************************************************************************************/
105
106 ARM_ETH_MAC_CAPABILITIES ARM_ETH_MAC_GetCapabilities (void)  {
107   ;
108 }
109 /**
110 \fn       ARM_ETH_MAC_CAPABILITIES ARM_ETH_MAC_GetCapabilities (void)
111 \details
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 
115 callback function.
116  
117 Example:
118 \code
119 extern ARM_DRIVER_ETH_MAC Driver_ETH_MAC0;
120 ARM_DRIVER_ETH_MAC *mac;
121   
122 void read_capabilities (void)  {
123   ARM_ETH_MAC_CAPABILITIES mac_capabilities;
124  
125   mac = &Driver_ETH_MAC0;  
126   mac_capabilities = mac->GetCapabilities ();
127   // interrogate capabilities
128  
129 }
130 \endcode
131 *******************************************************************************************************************/
132
133 int32_t ARM_ETH_MAC_Initialize (ARM_ETH_MAC_SignalEvent_t cb_event)  {
134   
135 }
136 /**
137 \fn     int32_t ARM_ETH_MAC_Initialize (ARM_ETH_MAC_SignalEvent_t cb_event)
138 \details 
139 The function \b ARM_ETH_MAC_Initialize initializes the Ethernet MAC interface. 
140 It is called when the middleware component starts operation.
141
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.
145
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.
148
149 \b Example:
150  - see \ref eth_interface_gr - Driver Functions
151 *******************************************************************************************************************/
152
153 int32_t ARM_ETH_MAC_Uninitialize (void)  {
154   
155 }
156 /**
157 \fn       int32_t ARM_ETH_MAC_Uninitialize (void)
158 \details
159 The function \b ARM_ETH_MAC_Uninitialize de-initializes the resources of Ethernet MAC interface.
160
161 It is called when the middleware component stops operation and releases the software resources 
162 used by the interface.
163 *******************************************************************************************************************/
164
165 int32_t ARM_ETH_MAC_PowerControl (ARM_POWER_STATE state)  {
166   
167 }
168 /**
169 \fn int32_t ARM_ETH_MAC_PowerControl (ARM_POWER_STATE state)
170 \details     
171 The function \b ARM_ETH_MAC_PowerControl allows you to configure the power modes of the Ethernet MAC interface.  
172
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.
176
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
179 error.
180
181 \b Example:
182  - see \ref eth_interface_gr - Driver Functions
183 *******************************************************************************************************************/
184
185 int32_t ARM_ETH_MAC_GetMacAddress (ARM_ETH_MAC_ADDR *ptr_addr)  {
186   
187 }
188 /**
189 \fn int32_t ARM_ETH_MAC_GetMacAddress (ARM_ETH_MAC_ADDR *ptr_addr)
190 \details
191 The function \b ARM_ETH_MAC_GetMacAddress retrieves the Ethernet MAC own address from the driver.
192 *******************************************************************************************************************/
193
194 int32_t ARM_ETH_MAC_SetMacAddress (const ARM_ETH_MAC_ADDR *ptr_addr)  {
195   
196 }
197 /**
198 \fn int32_t ARM_ETH_MAC_SetMacAddress (const ARM_ETH_MAC_ADDR *ptr_addr)
199 \details
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. 
203
204 The Ethernet MAC receiver will accept also packets with addresses configured by \ref ARM_ETH_MAC_SetAddressFilter function.
205
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 *******************************************************************************************************************/
209
210 int32_t ARM_ETH_MAC_SetAddressFilter (const ARM_ETH_MAC_ADDR *ptr_addr, uint32_t num_addr)  {
211   
212 }
213 /**
214 \fn int32_t ARM_ETH_MAC_SetAddressFilter (const ARM_ETH_MAC_ADDR *ptr_addr, uint32_t num_addr)
215 \details
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.
220
221 The Ethernet MAC receiver will accept packets addressed to its own address and packets with addresses configured by this function.
222
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 *******************************************************************************************************************/
226
227 int32_t ARM_ETH_MAC_SendFrame (const uint8_t *frame, uint32_t len, uint32_t flags)  {
228   
229 }
230 /**
231 \fn int32_t ARM_ETH_MAC_SendFrame (const uint8_t *frame, uint32_t len, uint32_t flags)
232 \details
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.
234
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.
236
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.
240
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.
243
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.
246
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.
252
253
254 \b Example:
255 \code
256   status = mac->SendFrame (&frame->data[0], frame->length, 0);
257   if (status != ARM_DRIVER_OK)  {
258     // error handling
259   }
260 \endcode
261
262 *******************************************************************************************************************/
263
264 int32_t ARM_ETH_MAC_ReadFrame (uint8_t *frame, uint32_t len)  {
265   
266 }
267 /**
268 \fn int32_t ARM_ETH_MAC_ReadFrame (uint8_t *frame, uint32_t len)
269 \details
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.
271
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.
274
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.
278
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.
281
282 \b Example:
283 \code
284   size = mac->GetRxFrameSize ();
285   if ((size < 14) || (size > 1514)) {    // frame excludes CRC
286     mac->ReadFrame (NULL, 0);            // Frame error, release it
287   }
288   len = mac->ReadFrame (&frame->data[0], size);
289   if (len < 0)  {
290     // error handling
291   }
292 \endcode
293 *******************************************************************************************************************/
294
295 uint32_t ARM_ETH_MAC_GetRxFrameSize (void)  {
296   
297 }
298 /**
299 \fn uint32_t ARM_ETH_MAC_GetRxFrameSize (void)
300 \details
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.
304
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.
309
310 \b Example:
311   - see \ref ARM_ETH_MAC_ReadFrame
312
313 *******************************************************************************************************************/
314
315 int32_t ARM_ETH_MAC_GetRxFrameTime (ARM_ETH_MAC_TIME *time)  {
316   
317 }
318 /**
319 \fn int32_t ARM_ETH_MAC_GetRxFrameTime (ARM_ETH_MAC_TIME *time)
320 \details
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 *******************************************************************************************************************/
324
325 int32_t ARM_ETH_MAC_GetTxFrameTime (ARM_ETH_MAC_TIME *time)  {
326   
327 }
328 /**
329 \fn int32_t ARM_ETH_MAC_GetTxFrameTime (ARM_ETH_MAC_TIME *time)
330 \details
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 *******************************************************************************************************************/
333
334 int32_t ARM_ETH_MAC_Control (uint32_t control, uint32_t arg)  {
335   
336 }
337 /**
338 \fn int32_t ARM_ETH_MAC_Control (uint32_t control, uint32_t arg)
339 \details
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.
342
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.
345
346 The table lists values for the parameter \em control.
347
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>
356
357
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:
360 \code
361     mac->Control(ARM_ETH_MAC_CONFIGURE, ARM_ETH_MAC_SPEED_100M | ARM_ETH_MAC_DUPLEX_FULL | ARM_ETH_MAC_LOOPBACK);
362 \endcode
363
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>
379 </table>
380
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. 
383
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>
389 </table>
390
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. 
393
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>
401 </table>
402
403
404 \b Example:
405
406 \code
407 ...
408                                          // start transfer
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);
412          
413 ...                                      // stop transfer
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);
417   }
418 }
419 \endcode
420
421 For a complete example, refer to  \ref eth_interface_gr - Driver Functions.
422
423 *******************************************************************************************************************/
424
425 int32_t ARM_ETH_MAC_ControlTimer (uint32_t control, ARM_ETH_MAC_TIME *time)  {
426   
427 }
428 /**
429 \fn int32_t ARM_ETH_MAC_ControlTimer (uint32_t control, ARM_ETH_MAC_TIME *time)
430 \details
431 The function \b ARM_ETH_MAC_ControlTimer controls the timer required for PTP (Precision Time Protocol).
432
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.
435
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.
444
445 *******************************************************************************************************************/
446
447 int32_t ARM_ETH_MAC_PHY_Read (uint8_t phy_addr, uint8_t reg_addr, uint16_t *data)  {
448   
449 }
450 /**
451 \fn int32_t ARM_ETH_MAC_PHY_Read (uint8_t phy_addr, uint8_t reg_addr, uint16_t *data)
452 \details
453
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.
456
457 \b Example:
458  - see \ref eth_interface_gr - Driver Functions
459 *******************************************************************************************************************/
460
461 int32_t ARM_ETH_MAC_PHY_Write (uint8_t phy_addr, uint8_t reg_addr, uint16_t data)  {
462   
463 }
464 /**
465 \fn int32_t ARM_ETH_MAC_PHY_Write (uint8_t phy_addr, uint8_t reg_addr, uint16_t data)
466 \details
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.
469
470 \b Example:
471  - see \ref eth_interface_gr - Driver Functions
472
473 *******************************************************************************************************************/
474
475 void ARM_ETH_MAC_SignalEvent (uint32_t event)  {
476   ;
477 }
478 /**
479 \fn void ARM_ETH_MAC_SignalEvent (uint32_t event)
480 \details
481
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.
485
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. 
488
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.
491
492 The following events can be generated:
493
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.
500
501 *******************************************************************************************************************/
502
503
504 /**
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.
508 \details 
509 @{
510 Many parameters of the Ethernet MAC driver are configured using the \ref ARM_ETH_MAC_Control function.
511
512 The various Ethernet MAC control codes define:
513   
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
518
519 Refer to the \ref ARM_ETH_MAC_Control function for further details.
520 */
521
522 /**
523 \defgroup eth_mac_ctrls Ethernet MAC Controls
524 \brief Configure and control the Ethernet MAC interface.
525 \details
526 @{
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
539 @}
540 */
541
542
543 /**
544 \defgroup eth_mac_configuration_ctrls Ethernet MAC Configuration
545 \brief Specifies speed mode, link mode, checksum, and frame filtering modes.
546 \details
547 @{
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.
550
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         
562 @}
563 */
564
565 /**
566 \defgroup eth_mac_flush_flag_ctrls  Ethernet MAC Flush Flags
567 \brief Specify controls to flush a buffer
568 \details
569 @{
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.
572
573 \def ARM_ETH_MAC_FLUSH_RX           
574 \def ARM_ETH_MAC_FLUSH_TX           
575 @}
576 */
577
578
579 /**
580 \defgroup eth_mac_vlan_filter_ctrls   Ethernet MAC VLAN Filter Flag
581 \brief Specify whether to compare only the VLAN Identifier
582 \details
583 @{
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.
585
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.
587
588 Specifying \em arg=0 disables the VLAN Filter. 
589
590 \def ARM_ETH_MAC_VLAN_FILTER_ID_ONLY 
591 @}
592 */
593
594
595 /**
596 @} */  // end group eth_mac_control 
597
598
599 /**
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.
603 \details 
604 The following timer controls are used as parameter \em control for the \ref ARM_ETH_MAC_ControlTimer function:
605 @{
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
618 @}
619 */
620
621
622 /**
623 \defgroup eth_mac_frame_transmit_ctrls Ethernet MAC Frame Transmit Flags
624 \brief Specify frame transmit flags
625 \details
626 @{
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
633 @}
634 */
635
636
637
638 /**
639 @}
640 */ 
641 // End ETH MAC Interface