diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-09-29 19:29:59 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-09-29 19:29:59 +0000 |
commit | ea9916ae798da3689d64689b88343d26508d137e (patch) | |
tree | a9b5a44a6bd7be5b15b3ab421803b74f41a5a7cd /os/io/templates/mac_lld.h | |
parent | c9bfcaa15ec3d03ee088ecfa5cf6cf82e718cb38 (diff) | |
download | ChibiOS-ea9916ae798da3689d64689b88343d26508d137e.tar.gz ChibiOS-ea9916ae798da3689d64689b88343d26508d137e.tar.bz2 ChibiOS-ea9916ae798da3689d64689b88343d26508d137e.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1193 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/io/templates/mac_lld.h')
-rw-r--r-- | os/io/templates/mac_lld.h | 59 |
1 files changed, 40 insertions, 19 deletions
diff --git a/os/io/templates/mac_lld.h b/os/io/templates/mac_lld.h index 377a18ea1..2b6e19c26 100644 --- a/os/io/templates/mac_lld.h +++ b/os/io/templates/mac_lld.h @@ -32,10 +32,24 @@ /*===========================================================================*/
/**
- * @brief Number of available descriptors/buffers. + * @brief Number of available transmit buffers.
*/
-#if !defined(MAC_TRANSMIT_DESCRIPTORS) || defined(__DOXYGEN__)
-#define MAC_TRANSMIT_DESCRIPTORS 2
+#if !defined(MAC_TRANSMIT_BUFFERS) || defined(__DOXYGEN__)
+#define MAC_TRANSMIT_BUFFERS 2
+#endif
+
+/**
+ * @brief Number of available receive buffers.
+ */
+#if !defined(MAC_RECEIVE_BUFFERS) || defined(__DOXYGEN__)
+#define MAC_RECEIVE_BUFFERS 2
+#endif
+
+/**
+ * @brief Maximum supported frame size. + */
+#if !defined(MAC_BUFFERS_SIZE) || defined(__DOXYGEN__)
+#define MAC_BUFFERS_SIZE 1518
#endif
/*===========================================================================*/
@@ -46,25 +60,30 @@ * @brief Structure representing a MAC driver.
*/
typedef struct {
- Semaphore md_tdsem; /**< Transmit semaphore.*/
- Semaphore md_rdsem; /**< Receive semaphore.*/
+ Semaphore md_tdsem; /**< Transmit semaphore. */
+ Semaphore md_rdsem; /**< Receive semaphore. */
#if CH_USE_EVENTS
- EventSource md_rdevent; /**< Receive event source.*/
+ EventSource md_rdevent; /**< Receive event source. */
#endif
+ /* End of the mandatory fields.*/
} MACDriver;
/**
- * @brief Structure representing a transmission descriptor.
+ * @brief Structure representing a transmit descriptor.
*/
typedef struct {
-
+ size_t td_offset; /**< Current write offset. */
+ size_t td_size; /**< Available space size. */
+ /* End of the mandatory fields.*/
} MACTransmitDescriptor;
/**
* @brief Structure representing a receive descriptor.
*/
typedef struct {
-
+ size_t rd_offset; /**< Current read offset. */
+ size_t rd_size; /**< Available data size. */
+ /* End of the mandatory fields.*/
} MACReceiveDescriptor;
/*===========================================================================*/
@@ -76,16 +95,18 @@ extern "C" { #endif
void mac_lld_init(void);
void mac_lld_set_address(MACDriver *macp, const uint8_t *p);
- MACTransmitDescriptor *max_lld_get_transmit_descriptor(MACDriver *macp,
- size_t size);
- void mac_lld_release_transmit_descriptor(MACDriver *macp,
- MACTransmitDescriptor *tdp);
- uint8_t *mac_lld_get_transmit_buffer(MACTransmitDescriptor *tdp);
- MACReceiveDescriptor *max_lld_get_receive_descriptor(MACDriver *macp,
- size_t *szp);
- void mac_lld_release_receive_descriptor(MACDriver *macp,
- MACReceiveDescriptor *rdp);
- uint8_t *mac_lld_get_receive_buffer(MACReceiveDescriptor *rdp);
+ msg_t max_lld_get_transmit_descriptor(MACDriver *macp,
+ MACTransmitDescriptor *tdp);
+ size_t mac_lld_write_transmit_descriptor(MACTransmitDescriptor *tdp,
+ uint8_t *buf,
+ size_t size);
+ void mac_lld_release_transmit_descriptor(MACTransmitDescriptor *tdp);
+ msg_t max_lld_get_receive_descriptor(MACDriver *macp,
+ MACReceiveDescriptor *rdp);
+ size_t mac_lld_read_receive_descriptor(MACReceiveDescriptor *rdp,
+ uint8_t *buf,
+ size_t size);
+ void mac_lld_release_receive_descriptor(MACReceiveDescriptor *rdp);
bool_t mac_lld_poll_link_status(MACDriver *macp);
#ifdef __cplusplus
}
|