git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1327 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2009-11-26 21:03:05 +00:00
parent 0ed2cd487a
commit 780110bd2c
20 changed files with 15058 additions and 53 deletions

View File

@ -59,10 +59,12 @@ static CH_IRQ_HANDLER(SYSIrqHandler) {
/*
* Digital I/O ports static configuration as defined in @p board.h.
*/
static const AT91SAM7XPIOConfig config =
static const AT91SAM7PIOConfig config =
{
{VAL_PIOA_ODSR, VAL_PIOA_OSR, VAL_PIOA_PUSR},
#if defined(SAM7X128) || defined(SAM7X256) || defined(SAM7X512)
{VAL_PIOB_ODSR, VAL_PIOB_OSR, VAL_PIOB_PUSR}
#endif
};
/*

View File

@ -20,7 +20,14 @@
#ifndef _BOARD_H_
#define _BOARD_H_
#include "at91lib/AT91SAM7X256.h"
/*
* Select your platform by modifying the following line.
*/
#if !defined(SAM7_PLATFORM)
#define SAM7_PLATFORM SAM7X256
#endif
#include "at91sam7.h"
#define BOARD_OLIMEX_SAM7_EX256

View File

@ -60,10 +60,12 @@ static CH_IRQ_HANDLER(SYSIrqHandler) {
/*
* Digital I/O ports static configuration as defined in @p board.h.
*/
static const AT91SAM7XPIOConfig config =
static const AT91SAM7PIOConfig config =
{
{VAL_PIOA_ODSR, VAL_PIOA_OSR, VAL_PIOA_PUSR},
#if defined(SAM7X128) || defined(SAM7X256) || defined(SAM7X512)
{VAL_PIOB_ODSR, VAL_PIOB_OSR, VAL_PIOB_PUSR}
#endif
};
/*

View File

@ -20,7 +20,14 @@
#ifndef _BOARD_H_
#define _BOARD_H_
#include "at91lib/AT91SAM7X256.h"
/*
* Select your platform by modifying the following line.
*/
#if !defined(SAM7_PLATFORM)
#define SAM7_PLATFORM SAM7X256
#endif
#include "at91sam7.h"
#define BOARD_OLIMEX_SAM7_EX256

View File

@ -61,10 +61,12 @@ static CH_IRQ_HANDLER(SYSIrqHandler) {
/*
* Digital I/O ports static configuration as defined in @p board.h.
*/
static const AT91SAM7XPIOConfig config =
static const AT91SAM7PIOConfig config =
{
{VAL_PIOA_ODSR, VAL_PIOA_OSR, VAL_PIOA_PUSR},
#if defined(SAM7X128) || defined(SAM7X256) || defined(SAM7X512)
{VAL_PIOB_ODSR, VAL_PIOB_OSR, VAL_PIOB_PUSR}
#endif
};
/*

View File

@ -20,7 +20,14 @@
#ifndef _BOARD_H_
#define _BOARD_H_
#include "at91lib/AT91SAM7X256.h"
/*
* Select your platform by modifying the following line.
*/
#if !defined(SAM7_PLATFORM)
#define SAM7_PLATFORM SAM7X256
#endif
#include "at91sam7.h"
#define BOARD_OLIMEX_SAM7_EX256

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
/*
ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
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/>.
*/
#ifndef _AT91SAM7_H_
#define _AT91SAM7_H_
/*
* Supported platforms.
*/
#define SAM7S64 0
#define SAM7S128 1
#define SAM7S256 2
#define SAM7S512 3
#define SAM7X128 4
#define SAM7X256 5
#define SAM7X512 6
#ifndef SAM7_PLATFORM
#error "SAM7 platform not defined"
#endif
#if SAM7_PLATFORM == SAM7S64
#include "at91lib/AT91SAM7S64.h"
#elif SAM7_PLATFORM == SAM7S128
#include "at91lib/AT91SAM7S128.h"
#elif SAM7_PLATFORM == SAM7S256
#include "at91lib/AT91SAM7S256.h"
#elif SAM7_PLATFORM == SAM7S512
#include "at91lib/AT91SAM7S512.h"
#elif SAM7_PLATFORM == SAM7X128
#include "at91lib/AT91SAM7X128.h"
#elif SAM7_PLATFORM == SAM7X256
#include "at91lib/AT91SAM7X256.h"
#elif SAM7_PLATFORM == SAM7X512
#include "at91lib/AT91SAM7X512.h"
#else
#error "SAM7 platform not supported"
#endif
#endif /* _AT91SAM7_H_ */

View File

@ -27,7 +27,6 @@
#ifndef _MII_LLD_H_
#define _MII_LLD_H_
#include <mii.h>
#include "board.h"
/*===========================================================================*/

View File

@ -27,15 +27,21 @@
#include <ch.h>
#include <pal.h>
#include "board.h"
/**
* @brief AT91SAM7X I/O ports configuration.
* @brief AT91SAM7 I/O ports configuration.
* @details PIO registers initialization.
*
* @param[in] config the AT91SAM7X ports configuration
* @param[in] config the AT91SAM7 ports configuration
*/
void _pal_lld_init(const AT91SAM7XPIOConfig *config) {
void _pal_lld_init(const AT91SAM7PIOConfig *config) {
AT91C_BASE_PMC->PMC_PCER = (1 << AT91C_ID_PIOA) | (1 << AT91C_ID_PIOB);
unsigned int ports = (1 << AT91C_ID_PIOA);
#if defined(SAM7X128) || defined(SAM7X256) || defined(SAM7X512)
ports |= (1 << AT91C_ID_PIOB);
#endif
AT91C_BASE_PMC->PMC_PCER = ports;
/*
* PIOA setup.
@ -55,8 +61,9 @@ void _pal_lld_init(const AT91SAM7XPIOConfig *config) {
/*
* PIOB setup.
*/
AT91C_BASE_PIOB->PIO_PPUER = config->P0Data.pusr; /* Pull-up as spec.*/
AT91C_BASE_PIOB->PIO_PPUDR = ~config->P0Data.pusr;
#if defined(SAM7X128) || defined(SAM7X256) || defined(SAM7X512)
AT91C_BASE_PIOB->PIO_PPUER = config->P1Data.pusr; /* Pull-up as spec.*/
AT91C_BASE_PIOB->PIO_PPUDR = ~config->P1Data.pusr;
AT91C_BASE_PIOB->PIO_PER = 0xFFFFFFFF; /* PIO enabled.*/
AT91C_BASE_PIOB->PIO_ODSR = config->P1Data.odsr; /* Data as specified.*/
AT91C_BASE_PIOB->PIO_OER = config->P1Data.osr; /* Dir. as specified.*/
@ -66,6 +73,7 @@ void _pal_lld_init(const AT91SAM7XPIOConfig *config) {
AT91C_BASE_PIOB->PIO_MDDR = 0xFFFFFFFF; /* Push Pull drive.*/
AT91C_BASE_PIOB->PIO_ASR = 0xFFFFFFFF; /* Peripheral A.*/
AT91C_BASE_PIOB->PIO_OWER = 0xFFFFFFFF; /* Write enabled.*/
#endif
}
/**

View File

@ -27,7 +27,7 @@
#ifndef _PAL_LLD_H_
#define _PAL_LLD_H_
#include "at91lib/AT91SAM7X256.h"
#include "board.h"
/*===========================================================================*/
/* Unsupported modes and specific modes */
@ -49,10 +49,10 @@ typedef struct {
uint32_t osr;
/** Initial value for PUSR register (Pull-ups).*/
uint32_t pusr;
} at91sam7x_pio_setup_t;
} at91sam7_pio_setup_t;
/**
* @brief AT91SAM7X PIO static initializer.
* @brief AT91SAM7 PIO static initializer.
* @details An instance of this structure must be passed to @p palInit() at
* system startup time in order to initialized the digital I/O
* subsystem. This represents only the initial setup, specific pads
@ -60,10 +60,13 @@ typedef struct {
*/
typedef struct {
/** @brief Port 0 setup data.*/
at91sam7x_pio_setup_t P0Data;
at91sam7_pio_setup_t P0Data;
#if defined(SAM7X128) || defined(SAM7X256) || defined(SAM7X512) || \
defined(__DOXYGEN__)
/** @brief Port 1 setup data.*/
at91sam7x_pio_setup_t P1Data;
} AT91SAM7XPIOConfig;
at91sam7_pio_setup_t P1Data;
#endif
} AT91SAM7PIOConfig;
/**
* @brief Width, in bits, of an I/O port.
@ -95,7 +98,10 @@ typedef AT91PS_PIO ioportid_t;
/**
* @brief PIO port B identifier.
*/
#if defined(SAM7X128) || defined(SAM7X256) || defined(SAM7X512) || \
defined(__DOXYGEN__)
#define IOPORT2 AT91C_BASE_PIOB
#endif
/*===========================================================================*/
/* Implementation, some of the following macros could be implemented as */
@ -232,7 +238,7 @@ typedef AT91PS_PIO ioportid_t;
#ifdef __cplusplus
extern "C" {
#endif
void _pal_lld_init(const AT91SAM7XPIOConfig *config);
void _pal_lld_init(const AT91SAM7PIOConfig *config);
void _pal_lld_setgroupmode(ioportid_t port,
ioportmask_t mask,
uint_fast8_t mode);

View File

@ -28,13 +28,32 @@
#include <serial.h>
#include "at91lib/aic.h"
#include "at91sam7.h"
#if USE_SAM7X_USART0 || defined(__DOXYGEN__)
#if SAM7_PLATFORM == SAM7S256
#define SAM7_USART0_RX AT91C_PA5_RXD0
#define SAM7_USART0_TX AT91C_PA6_TXD0
#define SAM7_USART1_RX AT91C_PA21_RXD1
#define SAM7_USART1_TX AT91C_PA22_TXD1
#elif SAM7_PLATFORM == SAM7X256
#define SAM7_USART0_RX AT91C_PA0_RXD0
#define SAM7_USART0_TX AT91C_PA1_TXD0
#define SAM7_USART1_RX AT91C_PA5_RXD1
#define SAM7_USART1_TX AT91C_PA6_TXD1
#else
#error "serial lines not defined for this SAM7 version"
#endif
#if USE_SAM7_USART0 || defined(__DOXYGEN__)
/** @brief USART0 serial driver identifier.*/
SerialDriver SD1;
#endif
#if USE_SAM7X_USART1 || defined(__DOXYGEN__)
#if USE_SAM7_USART1 || defined(__DOXYGEN__)
/** @brief USART1 serial driver identifier.*/
SerialDriver SD2;
#endif
@ -142,14 +161,14 @@ static void serve_interrupt(AT91PS_USART u, SerialDriver *sdp) {
AT91C_BASE_AIC->AIC_EOICR = 0;
}
#if USE_SAM7X_USART0 || defined(__DOXYGEN__)
#if USE_SAM7_USART0 || defined(__DOXYGEN__)
static void notify1(void) {
AT91C_BASE_US0->US_IER = AT91C_US_TXRDY;
}
#endif
#if USE_SAM7X_USART1 || defined(__DOXYGEN__)
#if USE_SAM7_USART1 || defined(__DOXYGEN__)
static void notify2(void) {
AT91C_BASE_US1->US_IER = AT91C_US_TXRDY;
@ -160,7 +179,7 @@ static void notify2(void) {
/* Low Level Driver interrupt handlers. */
/*===========================================================================*/
#if USE_SAM7X_USART0 || defined(__DOXYGEN__)
#if USE_SAM7_USART0 || defined(__DOXYGEN__)
CH_IRQ_HANDLER(USART0IrqHandler) {
CH_IRQ_PROLOGUE();
@ -171,7 +190,7 @@ CH_IRQ_HANDLER(USART0IrqHandler) {
}
#endif
#if USE_SAM7X_USART1 || defined(__DOXYGEN__)
#if USE_SAM7_USART1 || defined(__DOXYGEN__)
CH_IRQ_HANDLER(USART1IrqHandler) {
CH_IRQ_PROLOGUE();
@ -191,23 +210,23 @@ CH_IRQ_HANDLER(USART1IrqHandler) {
*/
void sd_lld_init(void) {
#if USE_SAM7X_USART0
#if USE_SAM7_USART0
sdObjectInit(&SD1, NULL, notify1);
AT91C_BASE_PIOA->PIO_PDR = AT91C_PA0_RXD0 | AT91C_PA1_TXD0;
AT91C_BASE_PIOA->PIO_ASR = AT91C_PIO_PA0 | AT91C_PIO_PA1;
AT91C_BASE_PIOA->PIO_PPUDR = AT91C_PIO_PA0 | AT91C_PIO_PA1;
AT91C_BASE_PIOA->PIO_PDR = SAM7_USART0_RX | SAM7_USART0_TX;
AT91C_BASE_PIOA->PIO_ASR = SAM7_USART0_RX | SAM7_USART0_TX;
AT91C_BASE_PIOA->PIO_PPUDR = SAM7_USART0_RX | SAM7_USART0_TX;
AIC_ConfigureIT(AT91C_ID_US0,
AT91C_AIC_SRCTYPE_HIGH_LEVEL | SAM7X_USART0_PRIORITY,
AT91C_AIC_SRCTYPE_HIGH_LEVEL | SAM7_USART0_PRIORITY,
USART0IrqHandler);
#endif
#if USE_SAM7X_USART1
#if USE_SAM7_USART1
sdObjectInit(&SD2, NULL, notify2);
AT91C_BASE_PIOA->PIO_PDR = AT91C_PA5_RXD1 | AT91C_PA6_TXD1;
AT91C_BASE_PIOA->PIO_ASR = AT91C_PIO_PA5 | AT91C_PIO_PA6;
AT91C_BASE_PIOA->PIO_PPUDR = AT91C_PIO_PA5 | AT91C_PIO_PA6;
AT91C_BASE_PIOA->PIO_PDR = SAM7_USART1_RX | SAM7_USART1_TX;
AT91C_BASE_PIOA->PIO_ASR = SAM7_USART1_RX | SAM7_USART1_TX;
AT91C_BASE_PIOA->PIO_PPUDR = SAM7_USART1_RX | SAM7_USART1_TX;
AIC_ConfigureIT(AT91C_ID_US1,
AT91C_AIC_SRCTYPE_HIGH_LEVEL | SAM7X_USART1_PRIORITY,
AT91C_AIC_SRCTYPE_HIGH_LEVEL | SAM7_USART1_PRIORITY,
USART1IrqHandler);
#endif
}
@ -225,7 +244,7 @@ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) {
if (config == NULL)
config = &default_config;
#if USE_SAM7X_USART0
#if USE_SAM7_USART0
if (&SD1 == sdp) {
/* Starts the clock and clears possible sources of immediate interrupts.*/
AT91C_BASE_PMC->PMC_PCER = (1 << AT91C_ID_US0);
@ -236,7 +255,7 @@ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) {
return;
}
#endif
#if USE_SAM7X_USART1
#if USE_SAM7_USART1
if (&SD2 == sdp) {
/* Starts the clock and clears possible sources of immediate interrupts.*/
AT91C_BASE_PMC->PMC_PCER = (1 << AT91C_ID_US1);
@ -258,7 +277,7 @@ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) {
*/
void sd_lld_stop(SerialDriver *sdp) {
#if USE_SAM7X_USART0
#if USE_SAM7_USART0
if (&SD1 == sdp) {
usart_deinit(AT91C_BASE_US0);
AT91C_BASE_PMC->PMC_PCDR = (1 << AT91C_ID_US0);
@ -266,7 +285,7 @@ void sd_lld_stop(SerialDriver *sdp) {
return;
}
#endif
#if USE_SAM7X_USART1
#if USE_SAM7_USART1
if (&SD2 == sdp) {
usart_deinit(AT91C_BASE_US1);
AT91C_BASE_PMC->PMC_PCDR = (1 << AT91C_ID_US1);

View File

@ -46,8 +46,8 @@
* @details If set to @p TRUE the support for USART1 is included.
* @note The default is @p TRUE.
*/
#if !defined(USE_SAM7X_USART0) || defined(__DOXYGEN__)
#define USE_SAM7X_USART0 TRUE
#if !defined(USE_SAM7_USART0) || defined(__DOXYGEN__)
#define USE_SAM7_USART0 TRUE
#endif
/**
@ -55,22 +55,22 @@
* @details If set to @p TRUE the support for USART2 is included.
* @note The default is @p TRUE.
*/
#if !defined(USE_SAM7X_USART1) || defined(__DOXYGEN__)
#define USE_SAM7X_USART1 TRUE
#if !defined(USE_SAM7_USART1) || defined(__DOXYGEN__)
#define USE_SAM7_USART1 TRUE
#endif
/**
* @brief UART1 interrupt priority level setting.
*/
#if !defined(SAM7X_USART0_PRIORITY) || defined(__DOXYGEN__)
#define SAM7X_USART0_PRIORITY (AT91C_AIC_PRIOR_HIGHEST - 2)
#if !defined(SAM7_USART0_PRIORITY) || defined(__DOXYGEN__)
#define SAM7_USART0_PRIORITY (AT91C_AIC_PRIOR_HIGHEST - 2)
#endif
/**
* @brief UART2 interrupt priority level setting.
*/
#if !defined(SAM7X_USART1_PRIORITY) || defined(__DOXYGEN__)
#define SAM7X_USART1_PRIORITY (AT91C_AIC_PRIOR_HIGHEST - 2)
#if !defined(SAM7_USART1_PRIORITY) || defined(__DOXYGEN__)
#define SAM7_USART1_PRIORITY (AT91C_AIC_PRIOR_HIGHEST - 2)
#endif
/*===========================================================================*/
@ -110,11 +110,11 @@ struct _serial_driver_data {
*/
sdflags_t flags;
/**
* Input circular buffer.
* Input circular buffer.
*/
uint8_t ib[SERIAL_BUFFERS_SIZE];
/**
* Output circular buffer.
* Output circular buffer.
*/
uint8_t ob[SERIAL_BUFFERS_SIZE];
};
@ -134,10 +134,10 @@ typedef struct {
/*===========================================================================*/
/** @cond never*/
#if USE_SAM7X_USART0
#if USE_SAM7_USART0
extern SerialDriver SD1;
#endif
#if USE_SAM7X_USART1
#if USE_SAM7_USART1
extern SerialDriver SD2;
#endif

View File

@ -20,7 +20,7 @@
#ifndef _WFI_H_
#define _WFI_H_
#include "at91lib/AT91SAM7X256.h"
#include "board.h"
#ifndef port_wait_for_interrupt
#if ENABLE_WFI_IDLE != 0

View File

@ -5,6 +5,8 @@
*** 1.3.5 ***
- FIX: Fixed some problems in the MMC_SPI driver (bugs 2901084 and 2901172).
- NEW: STM32 ADC driver implementation with DMA support.
- NEW: Added AT91SAM7S support and support for all the memory sizes in
both AT91SAM7S and AT91SAM7X families.
- CHANGE: In the STM32 drivers now the DMA errors are handled by hook macros
rather than by events. The default action is to halt the system but users
are able to override this and define custom handling.