aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-12-29 11:40:09 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-12-29 11:40:09 +0000
commit99563ecc3d5290e1d09b0698ce1ad6196a05fef4 (patch)
tree6afdca3e93b6ac2b169be31bd35bd6368fc02aa1 /os/hal
parentfe24da9fcca4967e58b25a2698c46717995de0ad (diff)
downloadChibiOS-99563ecc3d5290e1d09b0698ce1ad6196a05fef4.tar.gz
ChibiOS-99563ecc3d5290e1d09b0698ce1ad6196a05fef4.tar.bz2
ChibiOS-99563ecc3d5290e1d09b0698ce1ad6196a05fef4.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1474 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/platforms/AT91SAM7/at91sam7_mii.c20
-rw-r--r--os/hal/platforms/AT91SAM7/at91sam7_mii.h16
-rw-r--r--os/hal/platforms/AT91SAM7/hal_lld.c10
-rw-r--r--os/hal/platforms/AT91SAM7/hal_lld.h8
-rw-r--r--os/hal/platforms/AT91SAM7/mac_lld.c56
-rw-r--r--os/hal/platforms/AT91SAM7/mac_lld.h86
-rw-r--r--os/hal/platforms/AT91SAM7/pal_lld.c20
-rw-r--r--os/hal/platforms/AT91SAM7/serial_lld.c14
-rw-r--r--os/hal/platforms/AT91SAM7/serial_lld.h10
9 files changed, 168 insertions, 72 deletions
diff --git a/os/hal/platforms/AT91SAM7/at91sam7_mii.c b/os/hal/platforms/AT91SAM7/at91sam7_mii.c
index f390d3e23..8637f5b0c 100644
--- a/os/hal/platforms/AT91SAM7/at91sam7_mii.c
+++ b/os/hal/platforms/AT91SAM7/at91sam7_mii.c
@@ -30,6 +30,26 @@
#if CH_HAL_USE_MAC || defined(__DOXYGEN__)
+/*===========================================================================*/
+/* Driver exported variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver local variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver local functions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver interrupt handlers. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver exported functions. */
+/*===========================================================================*/
+
/**
* @brief Low level MII driver initialization.
*/
diff --git a/os/hal/platforms/AT91SAM7/at91sam7_mii.h b/os/hal/platforms/AT91SAM7/at91sam7_mii.h
index 23dfa70ae..be37a21f1 100644
--- a/os/hal/platforms/AT91SAM7/at91sam7_mii.h
+++ b/os/hal/platforms/AT91SAM7/at91sam7_mii.h
@@ -30,6 +30,13 @@
#if CH_HAL_USE_MAC || defined(__DOXYGEN__)
/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+#define PHY_MICREL_KS8721 0
+#define PHY_DAVICOM_9161 1
+
+/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
@@ -41,12 +48,9 @@
#endif
/*===========================================================================*/
-/* PHY specific constants. */
+/* Derived constants and error checks. */
/*===========================================================================*/
-#define PHY_MICREL_KS8721 0
-#define PHY_DAVICOM_9161 1
-
/**
* @brief Pins latched by the PHY at reset.
*/
@@ -84,6 +88,10 @@ typedef uint16_t phyreg_t;
typedef uint8_t phyaddr_t;
/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
+
+/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
diff --git a/os/hal/platforms/AT91SAM7/hal_lld.c b/os/hal/platforms/AT91SAM7/hal_lld.c
index 5a3859ed1..3b23b4f74 100644
--- a/os/hal/platforms/AT91SAM7/hal_lld.c
+++ b/os/hal/platforms/AT91SAM7/hal_lld.c
@@ -28,11 +28,11 @@
#include "hal.h"
/*===========================================================================*/
-/* Low Level Driver exported variables. */
+/* Driver exported variables. */
/*===========================================================================*/
/*===========================================================================*/
-/* Low Level Driver local variables. */
+/* Driver local variables. */
/*===========================================================================*/
/**
@@ -49,11 +49,11 @@ const AT91SAM7PIOConfig pal_default_config =
};
/*===========================================================================*/
-/* Low Level Driver local functions. */
+/* Driver local functions. */
/*===========================================================================*/
/*===========================================================================*/
-/* Low Level Driver interrupt handlers. */
+/* Driver interrupt handlers. */
/*===========================================================================*/
static CH_IRQ_HANDLER(spurious_handler) {
@@ -68,7 +68,7 @@ static CH_IRQ_HANDLER(spurious_handler) {
}
/*===========================================================================*/
-/* Low Level Driver exported functions. */
+/* Driver exported functions. */
/*===========================================================================*/
/**
diff --git a/os/hal/platforms/AT91SAM7/hal_lld.h b/os/hal/platforms/AT91SAM7/hal_lld.h
index a328dfdf6..958353702 100644
--- a/os/hal/platforms/AT91SAM7/hal_lld.h
+++ b/os/hal/platforms/AT91SAM7/hal_lld.h
@@ -53,10 +53,18 @@
#endif
/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
+
+/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
diff --git a/os/hal/platforms/AT91SAM7/mac_lld.c b/os/hal/platforms/AT91SAM7/mac_lld.c
index 9cd4ad4fe..9517c4838 100644
--- a/os/hal/platforms/AT91SAM7/mac_lld.c
+++ b/os/hal/platforms/AT91SAM7/mac_lld.c
@@ -33,11 +33,6 @@
#if CH_HAL_USE_MAC || defined(__DOXYGEN__)
-/**
- * @brief Ethernet driver 1.
- */
-MACDriver ETH1;
-
#define EMAC_PIN_MASK (AT91C_PB0_ETXCK_EREFCK | AT91C_PB1_ETXEN | \
AT91C_PB2_ETX0 | AT91C_PB3_ETX1 | \
AT91C_PB4_ECRS | AT91C_PB5_ERX0 | \
@@ -53,6 +48,19 @@ MACDriver ETH1;
#define TSR_BITS (AT91C_EMAC_UBR | AT91C_EMAC_COL | AT91C_EMAC_RLES | \
AT91C_EMAC_BEX | AT91C_EMAC_COMP | AT91C_EMAC_UND)
+/*===========================================================================*/
+/* Driver exported variables. */
+/*===========================================================================*/
+
+/**
+ * @brief Ethernet driver 1.
+ */
+MACDriver ETH1;
+
+/*===========================================================================*/
+/* Driver local variables. */
+/*===========================================================================*/
+
#ifndef __DOXYGEN__
static bool_t link_up;
@@ -70,6 +78,10 @@ static uint8_t tb[EMAC_TRANSMIT_DESCRIPTORS * EMAC_TRANSMIT_BUFFERS_SIZE]
__attribute__((aligned(8)));
#endif
+/*===========================================================================*/
+/* Driver local functions. */
+/*===========================================================================*/
+
/**
* @brief IRQ handler.
*/
@@ -108,6 +120,23 @@ static void serve_interrupt(void) {
}
/**
+ * @brief Cleans an incomplete frame.
+ * @param from the start position of the incomplete frame
+ */
+static void cleanup(EMACDescriptor *from) {
+
+ while (from != rxptr) {
+ from->w1 &= ~W1_R_OWNERSHIP;
+ if (++from >= &rd[EMAC_RECEIVE_DESCRIPTORS])
+ from = rd;
+ }
+}
+
+/*===========================================================================*/
+/* Driver interrupt handlers. */
+/*===========================================================================*/
+
+/**
* @brief EMAC IRQ veneer handler.
*/
CH_IRQ_HANDLER(irq_handler) {
@@ -119,6 +148,10 @@ CH_IRQ_HANDLER(irq_handler) {
CH_IRQ_EPILOGUE();
}
+/*===========================================================================*/
+/* Driver exported functions. */
+/*===========================================================================*/
+
/**
* @brief Low level MAC initialization.
*/
@@ -296,19 +329,6 @@ void mac_lld_release_transmit_descriptor(MACTransmitDescriptor *tdp) {
}
/**
- * @brief Cleans an incomplete frame.
- * @param from the start position of the incomplete frame
- */
-static void cleanup(EMACDescriptor *from) {
-
- while (from != rxptr) {
- from->w1 &= ~W1_R_OWNERSHIP;
- if (++from >= &rd[EMAC_RECEIVE_DESCRIPTORS])
- from = rd;
- }
-}
-
-/**
* @brief Returns a receive descriptor.
*
* @param[in] macp pointer to the @p MACDriver object
diff --git a/os/hal/platforms/AT91SAM7/mac_lld.h b/os/hal/platforms/AT91SAM7/mac_lld.h
index 23139e989..ea52c4560 100644
--- a/os/hal/platforms/AT91SAM7/mac_lld.h
+++ b/os/hal/platforms/AT91SAM7/mac_lld.h
@@ -30,47 +30,7 @@
#if CH_HAL_USE_MAC || defined(__DOXYGEN__)
/*===========================================================================*/
-/* Driver pre-compile time settings. */
-/*===========================================================================*/
-
-/**
- * @brief Number of available transmit buffers.
- */
-#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
-
-/**
- * @brief Interrupt priority level for the EMAC device.
- */
-#if !defined(EMAC_INTERRUPT_PRIORITY) || defined(__DOXYGEN__)
-#define EMAC_INTERRUPT_PRIORITY (AT91C_AIC_PRIOR_HIGHEST - 3)
-#endif
-
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
-
-#if !CH_USE_SEMAPHORES || !CH_USE_EVENTS
-#error "the MAC driver requires CH_USE_SEMAPHORES and CH_USE_EVENTS"
-#endif
-
-/*===========================================================================*/
-/* EMAC specific constants. */
+/* Driver constants. */
/*===========================================================================*/
#define EMAC_RECEIVE_BUFFERS_SIZE 128 /* Do not modify */
@@ -117,6 +77,46 @@
#define W2_T_USED 0x80000000
/*===========================================================================*/
+/* Driver pre-compile time settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Number of available transmit buffers.
+ */
+#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
+
+/**
+ * @brief Interrupt priority level for the EMAC device.
+ */
+#if !defined(EMAC_INTERRUPT_PRIORITY) || defined(__DOXYGEN__)
+#define EMAC_INTERRUPT_PRIORITY (AT91C_AIC_PRIOR_HIGHEST - 3)
+#endif
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+#if !CH_USE_SEMAPHORES || !CH_USE_EVENTS
+#error "the MAC driver requires CH_USE_SEMAPHORES and CH_USE_EVENTS"
+#endif
+
+/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
@@ -164,6 +164,10 @@ typedef struct {
} MACReceiveDescriptor;
/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
+
+/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
diff --git a/os/hal/platforms/AT91SAM7/pal_lld.c b/os/hal/platforms/AT91SAM7/pal_lld.c
index 7cc03b925..60fbb9899 100644
--- a/os/hal/platforms/AT91SAM7/pal_lld.c
+++ b/os/hal/platforms/AT91SAM7/pal_lld.c
@@ -29,6 +29,26 @@
#if CH_HAL_USE_PAL || defined(__DOXYGEN__)
+/*===========================================================================*/
+/* Driver exported variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver local variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver local functions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver interrupt handlers. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver exported functions. */
+/*===========================================================================*/
+
/**
* @brief AT91SAM7 I/O ports configuration.
* @details PIO registers initialization.
diff --git a/os/hal/platforms/AT91SAM7/serial_lld.c b/os/hal/platforms/AT91SAM7/serial_lld.c
index 4b69fc798..be28045fc 100644
--- a/os/hal/platforms/AT91SAM7/serial_lld.c
+++ b/os/hal/platforms/AT91SAM7/serial_lld.c
@@ -47,6 +47,10 @@
#error "serial lines not defined for this SAM7 version"
#endif
+/*===========================================================================*/
+/* Driver exported variables. */
+/*===========================================================================*/
+
#if USE_SAM7_USART0 || defined(__DOXYGEN__)
/** @brief USART0 serial driver identifier.*/
SerialDriver SD1;
@@ -57,6 +61,10 @@ SerialDriver SD1;
SerialDriver SD2;
#endif
+/*===========================================================================*/
+/* Driver local variables. */
+/*===========================================================================*/
+
/** @brief Driver default configuration.*/
static const SerialDriverConfig default_config = {
38400,
@@ -65,7 +73,7 @@ static const SerialDriverConfig default_config = {
};
/*===========================================================================*/
-/* Low Level Driver local functions. */
+/* Driver local functions. */
/*===========================================================================*/
/**
@@ -175,7 +183,7 @@ static void notify2(void) {
#endif
/*===========================================================================*/
-/* Low Level Driver interrupt handlers. */
+/* Driver interrupt handlers. */
/*===========================================================================*/
#if USE_SAM7_USART0 || defined(__DOXYGEN__)
@@ -201,7 +209,7 @@ CH_IRQ_HANDLER(USART1IrqHandler) {
#endif
/*===========================================================================*/
-/* Low Level Driver exported functions. */
+/* Driver exported functions. */
/*===========================================================================*/
/**
diff --git a/os/hal/platforms/AT91SAM7/serial_lld.h b/os/hal/platforms/AT91SAM7/serial_lld.h
index 36984d1b2..b5394aeed 100644
--- a/os/hal/platforms/AT91SAM7/serial_lld.h
+++ b/os/hal/platforms/AT91SAM7/serial_lld.h
@@ -30,6 +30,10 @@
#if CH_HAL_USE_SERIAL || defined(__DOXYGEN__)
/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
@@ -76,7 +80,7 @@
#endif
/*===========================================================================*/
-/* Unsupported event flags and custom events. */
+/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
@@ -132,6 +136,10 @@ typedef struct {
} SerialDriverConfig;
/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
+
+/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/