ChibiOS/HAL 9.0.0
hal_mac_lld.h
Go to the documentation of this file.
1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17/**
18 * @file hal_mac_lld.h
19 * @brief PLATFORM MAC subsystem low level driver header.
20 *
21 * @addtogroup MAC
22 * @{
23 */
24
25#ifndef HAL_MAC_LLD_H
26#define HAL_MAC_LLD_H
27
28#if (HAL_USE_MAC == TRUE) || defined(__DOXYGEN__)
29
30/*===========================================================================*/
31/* Driver constants. */
32/*===========================================================================*/
33
34/**
35 * @brief This implementation supports the zero-copy mode API.
36 */
37#define MAC_SUPPORTS_ZERO_COPY TRUE
38
39/*===========================================================================*/
40/* Driver pre-compile time settings. */
41/*===========================================================================*/
42
43/**
44 * @name PLATFORM configuration options
45 * @{
46 */
47/**
48 * @brief MAC driver enable switch.
49 * @details If set to @p TRUE the support for MAC1 is included.
50 * @note The default is @p FALSE.
51 */
52#if !defined(PLATFORM_MAC_USE_MAC1) || defined(__DOXYGEN__)
53#define PLATFORM_MAC_USE_MAC1 FALSE
54#endif
55/** @} */
56
57/*===========================================================================*/
58/* Derived constants and error checks. */
59/*===========================================================================*/
60
61/*===========================================================================*/
62/* Driver data structures and types. */
63/*===========================================================================*/
64
65/*===========================================================================*/
66/* Driver macros. */
67/*===========================================================================*/
68
69/**
70 * @brief Low level fields of the MAC driver structure.
71 */
72#define mac_lld_driver_fields
73
74/**
75 * @brief Low level fields of the MAC configuration structure.
76 */
77#define mac_lld_config_fields
78
79/**
80 * @brief Low level fields of the MAC transmit descriptor structure.
81 */
82#define mac_lld_transmit_descriptor_fields
83
84/**
85 * @brief Low level fields of the MAC receive descriptor structure.
86 */
87#define mac_lld_receive_descriptor_fields
88
89/*===========================================================================*/
90/* External declarations. */
91/*===========================================================================*/
92
93#if (PLATFORM_MAC_USE_MAC1 == TRUE) && !defined(__DOXYGEN__)
94extern MACDriver ETHD1;
95#endif
96
97#ifdef __cplusplus
98extern "C" {
99#endif
100 void mac_lld_init(void);
101 void mac_lld_start(MACDriver *macp);
102 void mac_lld_stop(MACDriver *macp);
111 uint8_t *buf,
112 size_t size);
114 uint8_t *buf,
115 size_t size);
116#if MAC_USE_ZERO_COPY == TRUE
118 size_t size,
119 size_t *sizep);
121 size_t *sizep);
122#endif
123#ifdef __cplusplus
124}
125#endif
126
127#endif /* HAL_USE_MAC == TRUE */
128
129#endif /* HAL_MAC_LLD_H */
130
131/** @} */
size_t mac_lld_read_receive_descriptor(MACReceiveDescriptor *rdp, uint8_t *buf, size_t size)
Reads from a receive descriptor's stream.
const uint8_t * mac_lld_get_next_receive_buffer(MACReceiveDescriptor *rdp, size_t *sizep)
Returns a pointer to the next receive buffer in the descriptor chain.
void mac_lld_release_transmit_descriptor(MACTransmitDescriptor *tdp)
Releases a transmit descriptor and starts the transmission of the enqueued data as a single frame.
struct hal_mac_driver MACDriver
Type of a structure representing a MAC driver.
Definition hal_mac.h:75
msg_t mac_lld_get_transmit_descriptor(MACDriver *macp, MACTransmitDescriptor *tdp)
Returns a transmission descriptor.
void mac_lld_init(void)
Low level MAC initialization.
Definition hal_mac_lld.c:69
struct hal_mac_receive_descriptor MACReceiveDescriptor
Type of structure representing a MAC receive descriptor.
Definition hal_mac.h:90
struct hal_mac_transmit_descriptor MACTransmitDescriptor
Type of structure representing a MAC transmit descriptor.
Definition hal_mac.h:85
uint8_t * mac_lld_get_next_transmit_buffer(MACTransmitDescriptor *tdp, size_t size, size_t *sizep)
Returns a pointer to the next transmit buffer in the descriptor chain.
void mac_lld_stop(MACDriver *macp)
Deactivates the MAC peripheral.
void mac_lld_release_receive_descriptor(MACReceiveDescriptor *rdp)
Releases a receive descriptor.
MACDriver ETHD1
MAC1 driver identifier.
Definition hal_mac_lld.c:45
msg_t mac_lld_get_receive_descriptor(MACDriver *macp, MACReceiveDescriptor *rdp)
Returns a receive descriptor.
void mac_lld_start(MACDriver *macp)
Configures and activates the MAC peripheral.
Definition hal_mac_lld.c:84
bool mac_lld_poll_link_status(MACDriver *macp)
Updates and returns the link status.
size_t mac_lld_write_transmit_descriptor(MACTransmitDescriptor *tdp, uint8_t *buf, size_t size)
Writes to a transmit descriptor's stream.
int32_t msg_t
Type of a message.
Definition osal.h:159