diff options
Diffstat (limited to 'os/hal/platforms/AT91SAM7')
| -rw-r--r-- | os/hal/platforms/AT91SAM7/ext_lld.c | 238 | ||||
| -rw-r--r-- | os/hal/platforms/AT91SAM7/ext_lld.h | 249 | ||||
| -rw-r--r-- | os/hal/platforms/AT91SAM7/mac_lld.c | 74 | ||||
| -rw-r--r-- | os/hal/platforms/AT91SAM7/mac_lld.h | 80 | ||||
| -rw-r--r-- | os/hal/platforms/AT91SAM7/platform.mk | 1 |
5 files changed, 600 insertions, 42 deletions
diff --git a/os/hal/platforms/AT91SAM7/ext_lld.c b/os/hal/platforms/AT91SAM7/ext_lld.c new file mode 100644 index 000000000..bee226ca2 --- /dev/null +++ b/os/hal/platforms/AT91SAM7/ext_lld.c @@ -0,0 +1,238 @@ +/*
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio,
+ 2011 Florian Goebe, Chair for Computer Science 11,
+ RWTH Aachen University
+
+ This file is part of ChibiOS/RT.
+
+ ChibiOS/RT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/RT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * @file AT91SAM7/ext_lld.c
+ * @brief AT91SAM7 EXT subsystem low level driver source.
+ *
+ * @addtogroup EXT
+ * @{
+ */
+
+#include "ch.h"
+#include "hal.h"
+
+#if HAL_USE_EXT || defined(__DOXYGEN__)
+
+/*===========================================================================*/
+/* Driver local definitions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver exported variables. */
+/*===========================================================================*/
+
+/**
+ * @brief EXTDA driver identifier.
+ */
+EXTDriver EXTDA;
+
+#if (SAM7_PLATFORM == SAM7X128) || (SAM7_PLATFORM == SAM7X256) || \
+ (SAM7_PLATFORM == SAM7X512)
+/**
+ * @brief EXTDB driver identifier.
+ */
+EXTDriver EXTDB;
+#endif
+
+/*===========================================================================*/
+/* Driver local variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver local functions. */
+/*===========================================================================*/
+
+/**
+ * @brief Handles external interrupts.
+ *
+ * @param[in] extp pointer to the driver that received the interrupt
+ */
+static void ext_lld_serveInterrupt(EXTDriver *extp) {
+ uint32_t irqFlags;
+ uint32_t ch;
+
+ chSysLockFromIsr();
+
+ /* Read flags of pending PIO interrupts.*/
+ irqFlags = extp->pio->PIO_ISR;
+
+ /* Call callback function for any pending interrupt.*/
+ for(ch = 0; ch < 32; ch++) {
+
+ /* Check if the channel is activated and if its IRQ flag is set.*/
+ if((extp->config->channels[ch].mode &
+ EXT_CH_MODE_ENABLED & EXT_CH_MODE_EDGES_MASK)
+ && ((1 << ch) & irqFlags)) {
+ (extp->config->channels[ch].cb)(extp, ch);
+ }
+ }
+
+ chSysUnlockFromIsr();
+
+ AT91C_BASE_AIC->AIC_EOICR = 0;
+}
+
+/*===========================================================================*/
+/* Driver interrupt handlers. */
+/*===========================================================================*/
+
+/**
+ * @brief EXTI[0] interrupt handler.
+ *
+ * @isr
+ */
+CH_IRQ_HANDLER(EXTIA_IRQHandler) {
+
+ CH_IRQ_PROLOGUE();
+
+ ext_lld_serveInterrupt(&EXTDA);
+
+ CH_IRQ_EPILOGUE();
+}
+
+#if (SAM7_PLATFORM == SAM7X128) || (SAM7_PLATFORM == SAM7X256) || \
+ (SAM7_PLATFORM == SAM7X512)
+/**
+ * @brief EXTI[1] interrupt handler.
+ *
+ * @isr
+ */
+CH_IRQ_HANDLER(EXTIB_IRQHandler) {
+ CH_IRQ_PROLOGUE();
+
+ ext_lld_serveInterrupt(&EXTDB);
+
+ CH_IRQ_EPILOGUE();
+}
+#endif
+
+/*===========================================================================*/
+/* Driver exported functions. */
+/*===========================================================================*/
+
+/**
+ * @brief Low level EXT driver initialization.
+ *
+ * @notapi
+ */
+void ext_lld_init(void) {
+
+ /* Driver initialization.*/
+ extObjectInit(&EXTDA);
+
+ /* Set PIO base addresses.*/
+ EXTDA.pio = AT91C_BASE_PIOA;
+
+ /* Set peripheral IDs.*/
+ EXTDA.pid = AT91C_ID_PIOA;
+
+#if (SAM7_PLATFORM == SAM7X128) || (SAM7_PLATFORM == SAM7X256) || \
+ (SAM7_PLATFORM == SAM7X512)
+ /* Aame for PIOB.*/
+ extObjectInit(&EXTDB);
+ EXTDB.pio = AT91C_BASE_PIOB;
+ EXTDB.pid = AT91C_ID_PIOB;
+#endif
+}
+
+/**
+ * @brief Configures and activates the EXT peripheral.
+ *
+ * @param[in] extp pointer to the @p EXTDriver object
+ *
+ * @notapi
+ */
+void ext_lld_start(EXTDriver *extp) {
+ uint16_t ch;
+ uint32_t ier = 0;
+ const EXTConfig *config = extp->config;
+
+ switch(extp->pid) {
+ case AT91C_ID_PIOA:
+ AIC_ConfigureIT(AT91C_ID_PIOA, SAM7_computeSMR(config->mode,
+ config->priority),
+ EXTIA_IRQHandler);
+ break;
+#if (SAM7_PLATFORM == SAM7X128) || (SAM7_PLATFORM == SAM7X256) || \
+ (SAM7_PLATFORM == SAM7X512)
+ case AT91C_ID_PIOB:
+ AIC_ConfigureIT(AT91C_ID_PIOB, SAM7_computeSMR(config->mode,
+ config->priority),
+ EXTIB_IRQHandler);
+ break;
+#endif
+ }
+
+ /* Enable and Disable channels with respect to config.*/
+ for(ch = 0; ch < EXT_MAX_CHANNELS; ch++) {
+ ier |= (config->channels[ch].mode & EXT_CH_MODE_EDGES_MASK & EXT_CH_MODE_ENABLED ? 1 : 0) << ch;
+ }
+ extp->pio->PIO_IER = ier;
+ extp->pio->PIO_IDR = ~ier;
+
+ /* Enable interrupt on corresponding PIO port in AIC.*/
+ AIC_EnableIT(extp->pid);
+}
+
+/**
+ * @brief Deactivates the EXT peripheral.
+ *
+ * @param[in] extp pointer to the @p EXTDriver object
+ *
+ * @notapi
+ */
+void ext_lld_stop(EXTDriver *extp) {
+
+ /* Disable interrupt on corresponding PIO port in AIC.*/
+ AIC_DisableIT(extp->pid);
+}
+
+/**
+ * @brief Enables an EXT channel.
+ *
+ * @param[in] extp pointer to the @p EXTDriver object
+ * @param[in] channel channel to be enabled
+ *
+ * @notapi
+ */
+void ext_lld_channel_enable(EXTDriver *extp, expchannel_t channel) {
+
+ extp->pio->PIO_IER = (1 << channel);
+}
+
+/**
+ * @brief Disables an EXT channel.
+ *
+ * @param[in] extp pointer to the @p EXTDriver object
+ * @param[in] channel channel to be disabled
+ *
+ * @notapi
+ */
+void ext_lld_channel_disable(EXTDriver *extp, expchannel_t channel) {
+
+ extp->pio->PIO_IDR = (1 << channel);
+}
+
+#endif /* HAL_USE_EXT */
+
+/** @} */
diff --git a/os/hal/platforms/AT91SAM7/ext_lld.h b/os/hal/platforms/AT91SAM7/ext_lld.h new file mode 100644 index 000000000..4c8442481 --- /dev/null +++ b/os/hal/platforms/AT91SAM7/ext_lld.h @@ -0,0 +1,249 @@ +/*
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio,
+ 2011 Florian Goebe, Chair for Computer Science 11,
+ RWTH Aachen University
+
+ This file is part of ChibiOS/RT.
+
+ ChibiOS/RT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/RT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file AT91SAM7/ext_lld.h
+ * @brief AT91SAM7 EXT subsystem low level driver header.
+ *
+ * @addtogroup EXT
+ * @{
+ */
+
+#ifndef _EXT_LLD_H_
+#define _EXT_LLD_H_
+
+#if HAL_USE_EXT || defined(__DOXYGEN__)
+
+/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+/**
+ * @brief Pointer to the SAM7 AIC register block. + */
+#define SAM7_EXT_AIC ((AT91PS_AIC *)AT91C_BASE_AIC)
+
+/**
+ * @brief Number of channels within one ext driver. + */
+#define EXT_MAX_CHANNELS 32
+
+/**
+ * @brief Mask of priority bits in interrupt mode register. + */
+#define SAM7_EXT_PRIORITY_MASK 0x00000007
+
+/**
+ * @brief Shifter for priority bits in interrupt mode register. + */
+#define SAM7_EXT_PRIORITY_SHIFTER 0
+
+/**
+ * @brief Shifter for mode bits in interrupt mode register.
+ */
+#define SAM7_EXT_MODE_SHIFTER 5
+
+/*
+ * On the SAM7 architecture, a single channel can only be enables or disabled
+ * Hence, undefine the other channel mode constants + */
+#ifdef EXT_CH_MODE_RISING_EDGE
+#undef EXT_CH_MODE_RISING_EDGE
+#endif
+
+#ifdef EXT_CH_MODE_FALLING_EDGE
+#undef EXT_CH_MODE_FALLING_EDGE
+#endif
+
+#ifdef EXT_CH_MODE_BOTH_EDGES
+#undef EXT_CH_MODE_BOTH_EDGES
+#endif
+
+/**
+ * @name EXT channels mode
+ * @{
+ */
+#define EXT_CH_MODE_ENABLED 1 /**< @brief Channel is enabled. */
+/** @} */
+
+/**
+ * @name EXT drivers mode
+ * @{
+ */
+/**
+ * @brief Mask for modes.
+ */
+#define SAM7_EXT_MODE_MASK AT91C_AIC_SRCTYPE
+/**
+ * @brief Falling edge callback.
+ */
+#define SAM7_EXT_MODE_FALLING_EDGE AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE
+/**
+ * @brief Rising edge callback.
+ */
+#define SAM7_EXT_MODE_RISING_EDGE AT91C_AIC_SRCTYPE_POSITIVE_EDGE
+/**
+ * @brief High-level callback.
+ */
+#define SAM7_EXT_MODE_HIGH_LEVEL AT91C_AIC_SRCTYPE_HIGH_LEVEL
+/**
+ * @brief Low-level callback.
+ */
+#define SAM7_EXT_MODE_LOW_LEVEL AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL
+/** @} */
+
+/**
+ * @name EXT drivers priorities
+ * @{ + */
+#define SAM7_EXT_PRIOR_HIGHEST AT91C_AIC_PRIOR_HIGHEST
+#define SAM7_EXT_PRIOR_LOWEST AT91C_AIC_PRIOR_LOWEST
+/** @} */
+
+/*===========================================================================*/
+/* Driver pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver data structures and types. */
+/*===========================================================================*/
+
+/**
+ * @brief EXT channel identifier.
+ */
+typedef uint32_t expchannel_t;
+
+/**
+ * @brief Type of an EXT generic notification callback.
+ *
+ * @param[in] extp pointer to the @p EXPDriver object triggering the
+ * callback
+ */
+typedef void (*extcallback_t)(EXTDriver *extp, expchannel_t channel);
+
+/**
+ * @brief Channel configuration structure.
+ */
+typedef struct {
+ /**
+ * @brief Channel mode.
+ */
+ uint32_t mode;
+ /**
+ * @brief Channel callback.
+ * @details In the STM32 implementation a @p NULL callback pointer is
+ * valid and configures the channel as an event sources instead
+ * of an interrupt source.
+ */
+ extcallback_t cb;
+} EXTChannelConfig;
+
+/**
+ * @brief Driver configuration structure.
+ * @note It could be empty on some architectures.
+ */
+typedef struct {
+ /**
+ * @brief Channel configurations.
+ */
+ EXTChannelConfig channels[EXT_MAX_CHANNELS];
+ /* End of the mandatory fields.*/
+
+ /**
+ * @brief interrupt mode.
+ */
+ uint32_t mode;
+
+ /**
+ * @brief interrupt priority. + */
+ uint32_t priority;
+} EXTConfig;
+
+/**
+ * @brief Structure representing an EXT driver.
+ */
+struct EXTDriver {
+ /**
+ * @brief Driver state.
+ */
+ extstate_t state;
+ /**
+ * @brief Current configuration data.
+ */
+ const EXTConfig *config;
+ /* End of the mandatory fields.*/
+ /**
+ * @brief Pointer to the corresponding PIO registers block. + */
+ AT91PS_PIO pio;
+ /**
+ * @brief peripheral ID of the corresponding PIO block. + */
+ uint32_t pid;
+};
+
+/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
+
+/**
+ * @brief Computes the content for the interrupt source mode register. + */
+#define SAM7_computeSMR(mode, prio) ( \
+ ((mode & SAM7_EXT_MODE_MASK) << SAM7_EXT_MODE_SHIFTER) | \
+ ((prio & SAM7_EXT_PRIORITY_MASK) << SAM7_EXT_PRIORITY_SHIFTER) \
+)
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
+#if !defined(__DOXYGEN__)
+extern EXTDriver EXTDA;
+#if (SAM7_PLATFORM == SAM7X128) || (SAM7_PLATFORM == SAM7X256) || \
+ (SAM7_PLATFORM == SAM7X512)
+extern EXTDriver EXTDB;
+#endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void ext_lld_init(void);
+ void ext_lld_start(EXTDriver *extp);
+ void ext_lld_stop(EXTDriver *extp);
+ void ext_lld_channel_enable(EXTDriver *extp, expchannel_t channel);
+ void ext_lld_channel_disable(EXTDriver *extp, expchannel_t channel);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* HAL_USE_EXT */
+
+#endif /* _EXT_LLD_H_ */
+
+/** @} */
diff --git a/os/hal/platforms/AT91SAM7/mac_lld.c b/os/hal/platforms/AT91SAM7/mac_lld.c index 43055b94d..fc610fcc7 100644 --- a/os/hal/platforms/AT91SAM7/mac_lld.c +++ b/os/hal/platforms/AT91SAM7/mac_lld.c @@ -64,7 +64,6 @@ MACDriver ETH1; /*===========================================================================*/
#ifndef __DOXYGEN__
-static bool_t link_up;
static uint8_t default_mac[] = {0xAA, 0x55, 0x13, 0x37, 0x01, 0x10};
@@ -102,7 +101,7 @@ static void serve_interrupt(void) { if (rsr & AT91C_EMAC_REC) {
chSysLockFromIsr();
chSemResetI(Ð1.rdsem, 0);
-#if CH_USE_EVENTS
+#if MAC_USE_EVENTS
chEvtBroadcastI(Ð1.rdevent);
#endif
chSysUnlockFromIsr();
@@ -135,6 +134,19 @@ static void cleanup(EMACDescriptor *from) { }
}
+/**
+ * @brief MAC address setup.
+ *
+ * @param[in] p pointer to a six bytes buffer containing the MAC
+ * address
+ */
+static void set_address(const uint8_t *p) {
+
+ AT91C_BASE_EMAC->EMAC_SA1L = (AT91_REG)((p[3] << 24) | (p[2] << 16) |
+ (p[1] << 8) | p[0]);
+ AT91C_BASE_EMAC->EMAC_SA1H = (AT91_REG)((p[5] << 8) | p[4]);
+}
+
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
@@ -163,12 +175,35 @@ CH_IRQ_HANDLER(irq_handler) { * @notapi
*/
void mac_lld_init(void) {
- unsigned i;
miiInit();
macObjectInit(Ð1);
/*
+ * Associated PHY initialization.
+ */
+ miiReset(Ð1);
+
+ /*
+ * EMAC pins setup. Note, PB18 is not included because it is
+ * used as #PD control and not as EF100.
+ */
+ AT91C_BASE_PIOB->PIO_ASR = EMAC_PIN_MASK;
+ AT91C_BASE_PIOB->PIO_PDR = EMAC_PIN_MASK;
+ AT91C_BASE_PIOB->PIO_PPUDR = EMAC_PIN_MASK;
+}
+
+/**
+ * @brief Configures and activates the MAC peripheral.
+ *
+ * @param[in] macp pointer to the @p MACDriver object
+ *
+ * @notapi
+ */
+void mac_lld_start(MACDriver *macp) {
+ unsigned i;
+
+ /*
* Buffers initialization.
*/
for (i = 0; i < EMAC_RECEIVE_DESCRIPTORS; i++) {
@@ -185,18 +220,9 @@ void mac_lld_init(void) { txptr = td;
/*
- * Associated PHY initialization.
- */
- miiReset(Ð1);
-
- /*
- * EMAC pins setup and clock enable. Note, PB18 is not included because it is
- * used as #PD control and not as EF100.
+ * EMAC clock enable.
*/
AT91C_BASE_PMC->PMC_PCER = 1 << AT91C_ID_EMAC;
- AT91C_BASE_PIOB->PIO_ASR = EMAC_PIN_MASK;
- AT91C_BASE_PIOB->PIO_PDR = EMAC_PIN_MASK;
- AT91C_BASE_PIOB->PIO_PPUDR = EMAC_PIN_MASK;
/*
* EMAC Initial setup.
@@ -213,7 +239,10 @@ void mac_lld_init(void) { AT91C_BASE_EMAC->EMAC_NCR |= AT91C_EMAC_TE |
AT91C_EMAC_RE |
AT91C_EMAC_CLRSTAT;/* Initial NCR settings.*/
- mac_lld_set_address(Ð1, default_mac);
+ if (macp->config->mac_address == NULL)
+ set_address(default_mac);
+ else
+ set_address(macp->config->mac_address);
/*
* PHY device identification.
@@ -235,22 +264,15 @@ void mac_lld_init(void) { }
/**
- * @brief Low level MAC address setup.
+ * @brief Deactivates the MAC peripheral.
*
* @param[in] macp pointer to the @p MACDriver object
- * @param[in] p pointer to a six bytes buffer containing the MAC
- * address. If this parameter is set to @p NULL then
- * a system default MAC is used. The MAC address must
- * be aligned with the most significant byte first.
*
* @notapi
*/
-void mac_lld_set_address(MACDriver *macp, const uint8_t *p) {
+void mac_lld_stop(MACDriver *macp) {
(void)macp;
- AT91C_BASE_EMAC->EMAC_SA1L = (AT91_REG)((p[3] << 24) | (p[2] << 16) |
- (p[1] << 8) | p[0]);
- AT91C_BASE_EMAC->EMAC_SA1H = (AT91_REG)((p[5] << 8) | p[4]);
}
/**
@@ -272,7 +294,7 @@ msg_t max_lld_get_transmit_descriptor(MACDriver *macp, (void)macp;
- if (!link_up)
+ if (!macp->link_up)
return RDY_TIMEOUT;
chSysLock();
@@ -505,7 +527,7 @@ bool_t mac_lld_poll_link_status(MACDriver *macp) { bmsr = miiGet(macp, MII_BMSR);
if (!(bmsr & BMSR_LSTATUS)) {
AT91C_BASE_EMAC->EMAC_NCR &= ~AT91C_EMAC_MPE;
- return link_up = FALSE;
+ return macp->link_up = FALSE;
}
ncfgr = AT91C_BASE_EMAC->EMAC_NCFGR & ~(AT91C_EMAC_SPD | AT91C_EMAC_FD);
@@ -525,7 +547,7 @@ bool_t mac_lld_poll_link_status(MACDriver *macp) { }
AT91C_BASE_EMAC->EMAC_NCFGR = ncfgr;
AT91C_BASE_EMAC->EMAC_NCR &= ~AT91C_EMAC_MPE;
- return link_up = TRUE;
+ return macp->link_up = TRUE;
}
#endif /* HAL_USE_MAC */
diff --git a/os/hal/platforms/AT91SAM7/mac_lld.h b/os/hal/platforms/AT91SAM7/mac_lld.h index 9f30e0426..97a8ba2ae 100644 --- a/os/hal/platforms/AT91SAM7/mac_lld.h +++ b/os/hal/platforms/AT91SAM7/mac_lld.h @@ -128,38 +128,85 @@ typedef struct { } EMACDescriptor;
/**
- * @brief Structure representing a MAC driver.
+ * @brief Driver configuration structure.
*/
typedef struct {
- Semaphore tdsem; /**< Transmit semaphore. */
- Semaphore rdsem; /**< Receive semaphore. */
-#if CH_USE_EVENTS
- EventSource rdevent; /**< Receive event source. */
+ /**
+ * @brief MAC address.
+ */
+ uint8_t *mac_address;
+ /* End of the mandatory fields.*/
+} MACConfig;
+
+/**
+ * @brief Structure representing a MAC driver.
+ */
+struct MACDriver {
+ /**
+ * @brief Driver state.
+ */
+ macstate_t state;
+ /**
+ * @brief Current configuration data.
+ */
+ const MACConfig *config;
+ /**
+ * @brief Transmit semaphore.
+ */
+ Semaphore tdsem;
+ /**
+ * @brief Receive semaphore.
+ */
+ Semaphore rdsem;
+#if MAC_USE_EVENTS || defined(__DOXYGEN__)
+ /**
+ * @brief Receive event.
+ */
+ EventSource rdevent;
#endif
/* End of the mandatory fields.*/
-} MACDriver;
+ /**
+ * @brief Link status flag.
+ */
+ bool_t link_up;
+};
/**
* @brief Structure representing a transmit descriptor.
*/
typedef struct {
- size_t offset; /**< Current write offset. */
- size_t size; /**< Available space size. */
+ /**
+ * @brief Current write offset.
+ */
+ size_t offset;
+ /**
+ * @brief Available space size.
+ */
+ size_t size;
/* End of the mandatory fields.*/
- EMACDescriptor *physdesc; /**< Pointer to the physical
- descriptor. */
+ /**
+ * @brief Pointer to the physical descriptor.
+ */
+ EMACDescriptor *physdesc;
} MACTransmitDescriptor;
/**
* @brief Structure representing a receive descriptor.
*/
typedef struct {
- size_t offset; /**< Current read offset. */
- size_t size; /**< Available data size. */
+ /**
+ * @brief Current read offset.
+ */
+ size_t offset;
+ /**
+ * @brief Available data size.
+ */
+ size_t size;
/* End of the mandatory fields.*/
- EMACDescriptor *physdesc; /**< Pointer to the first
- descriptor of the buffers
- chain. */
+ /**
+ * @brief Pointer to the first descriptor of the buffers chain.
+ */
+ EMACDescriptor *physdesc;
} MACReceiveDescriptor;
/*===========================================================================*/
@@ -178,7 +225,8 @@ extern MACDriver ETH1; extern "C" {
#endif
void mac_lld_init(void);
- void mac_lld_set_address(MACDriver *macp, const uint8_t *p);
+ void mac_lld_start(MACDriver *macp);
+ void mac_lld_stop(MACDriver *macp);
msg_t max_lld_get_transmit_descriptor(MACDriver *macp,
MACTransmitDescriptor *tdp);
size_t mac_lld_write_transmit_descriptor(MACTransmitDescriptor *tdp,
diff --git a/os/hal/platforms/AT91SAM7/platform.mk b/os/hal/platforms/AT91SAM7/platform.mk index 9a5bba436..83b53491a 100644 --- a/os/hal/platforms/AT91SAM7/platform.mk +++ b/os/hal/platforms/AT91SAM7/platform.mk @@ -1,6 +1,7 @@ # List of all the AT91SAM7 platform files.
PLATFORMSRC = ${CHIBIOS}/os/hal/platforms/AT91SAM7/hal_lld.c \
${CHIBIOS}/os/hal/platforms/AT91SAM7/pal_lld.c \
+ ${CHIBIOS}/os/hal/platforms/AT91SAM7/ext_lld.c \
${CHIBIOS}/os/hal/platforms/AT91SAM7/serial_lld.c \
${CHIBIOS}/os/hal/platforms/AT91SAM7/spi_lld.c \
${CHIBIOS}/os/hal/platforms/AT91SAM7/mac_lld.c \
|
