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

This commit is contained in:
gdisirio 2009-12-08 08:47:14 +00:00
parent 456490bf06
commit 3ff9afd048
10 changed files with 93 additions and 68 deletions

View File

@ -28,19 +28,6 @@
#include "mmcsd.h"
#include "buzzer.h"
/*
* Non-vectored IRQs handling here.
*/
static CH_IRQ_HANDLER(IrqHandler) {
CH_IRQ_PROLOGUE();
/* nothing */
VICVectAddr = 0;
CH_IRQ_EPILOGUE();
}
/*
* Timer 0 IRQ handling here.
*/
@ -76,43 +63,7 @@ static const LPC214xFIOConfig config =
*/
void hwinit0(void) {
/*
* All peripherals clock disabled by default in order to save power.
*/
PCONP = PCRTC | PCTIM0;
/*
* MAM setup.
*/
MAMTIM = 0x3; /* 3 cycles for flash accesses. */
MAMCR = 0x2; /* MAM fully enabled. */
/*
* PLL setup for Fosc=12MHz and CCLK=48MHz.
* P=2 M=3.
*/
PLL *pll = PLL0Base;
pll->PLL_CFG = 0x23; /* P and M values. */
pll->PLL_CON = 0x1; /* Enables the PLL 0. */
pll->PLL_FEED = 0xAA;
pll->PLL_FEED = 0x55;
while (!(pll->PLL_STAT & 0x400))
; /* Wait for PLL lock. */
pll->PLL_CON = 0x3; /* Connects the PLL. */
pll->PLL_FEED = 0xAA;
pll->PLL_FEED = 0x55;
/*
* VPB setup.
* PCLK = CCLK / 4.
*/
VPBDIV = VPD_D4;
/*
* I/O pins configuration.
*/
palInit(&config);
lpc214x_clock_init();
}
/*
@ -123,10 +74,9 @@ void hwinit0(void) {
void hwinit1(void) {
/*
* Interrupt vectors assignment.
* HAL initialization.
*/
vic_init();
VICDefVectAddr = (IOREG32)IrqHandler;
halInit();
/*
* System Timer initialization, 1ms intervals.
@ -143,7 +93,6 @@ void hwinit1(void) {
/*
* Other subsystems.
*/
sdInit();
ssp_init();
InitMMC();
InitBuzzer();

View File

@ -27,6 +27,8 @@
#ifndef _PWM_H_
#define _PWM_H_
#if CH_HAL_USEPWM || defined(__DOXYGEN__)
/**
* @brief Driver state machine possible states.
*/
@ -82,6 +84,8 @@ extern "C" {
}
#endif
#endif /* CH_HAL_USEPWM */
#endif /* _PWM_H_ */
/** @} */

View File

@ -35,8 +35,9 @@
/* Low Level Driver local variables. */
/*===========================================================================*/
/*
* Digital I/O ports static configuration as defined in @p board.h.
/**
* @brief PAL setup.
* @details Digital I/O ports static configuration as defined in @p board.h.
*/
const AT91SAM7PIOConfig pal_default_config =
{

View File

@ -30,6 +30,10 @@
#include "at91sam7.h"
#include "at91lib/aic.h"
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
@ -48,10 +52,6 @@
#define AT91SAM7_USBDIV AT91C_CKGR_USBDIV_1
#endif
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/

View File

@ -56,6 +56,20 @@ const LPC214xFIOConfig pal_default_config =
/* Low Level Driver interrupt handlers. */
/*===========================================================================*/
/*
* Non-vectored IRQs handler, the default action can be overridden by
* redefining the @p LPC214x_NON_VECTORED_IRQ_HOOK() hook macro.
*/
static CH_IRQ_HANDLER(irq_handler) {
CH_IRQ_PROLOGUE();
LPC214x_NON_VECTORED_IRQ_HOOK();
VICVectAddr = 0;
CH_IRQ_EPILOGUE();
}
/*===========================================================================*/
/* Low Level Driver exported functions. */
/*===========================================================================*/
@ -65,6 +79,49 @@ const LPC214xFIOConfig pal_default_config =
*/
void hal_lld_init(void) {
vic_init();
VICDefVectAddr = (IOREG32)irq_handler;
}
/**
* @brief LPC214x clocks and PLL initialization.
* @note All the involved constants come from the file @p board.h.
*/
void lpc214x_clock_init(void) {
/*
* All peripherals clock disabled by default in order to save power.
*/
PCONP = PCRTC | PCTIM0;
/*
* MAM setup.
*/
MAMTIM = 0x3; /* 3 cycles for flash accesses. */
MAMCR = 0x2; /* MAM fully enabled. */
/*
* PLL setup for Fosc=12MHz and CCLK=48MHz.
* P=2 M=3.
*/
PLL *pll = PLL0Base;
pll->PLL_CFG = 0x23; /* P and M values. */
pll->PLL_CON = 0x1; /* Enables the PLL 0. */
pll->PLL_FEED = 0xAA;
pll->PLL_FEED = 0x55;
while (!(pll->PLL_STAT & 0x400))
; /* Wait for PLL lock. */
pll->PLL_CON = 0x3; /* Connects the PLL. */
pll->PLL_FEED = 0xAA;
pll->PLL_FEED = 0x55;
/*
* VPB setup.
* PCLK = CCLK / 4.
*/
VPBDIV = VPD_D4;
}
/** @} */

View File

@ -31,13 +31,20 @@
#include "vic.h"
/*===========================================================================*/
/* Driver pre-compile time settings. */
/* Driver constants. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver constants. */
/* Driver pre-compile time settings. */
/*===========================================================================*/
/**
* @brief Default action for the non vectored IRQ handler, nothing.
*/
#if !defined(LPC214x_NON_VECTORED_IRQ_HOOK) || defined(__DOXYGEN__)
#define LPC214x_NON_VECTORED_IRQ_HOOK()
#endif
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
@ -54,6 +61,7 @@
extern "C" {
#endif
void hal_lld_init(void);
void lpc214x_clock_init(void);
#ifdef __cplusplus
}
#endif

View File

@ -31,8 +31,9 @@
/* Low Level Driver exported variables. */
/*===========================================================================*/
/*
* Digital I/O ports static configuration as defined in @p board.h.
/**
* @brief PAL setup.
* @details Digital I/O ports static configuration as defined in @p board.h.
*/
const MSP430DIOConfig pal_default_config =
{

View File

@ -37,8 +37,9 @@
/* Low Level Driver local variables. */
/*===========================================================================*/
/*
* Digital I/O ports static configuration as defined in @p board.h.
/**
* @brief PAL setup.
* @details Digital I/O ports static configuration as defined in @p board.h.
*/
const STM32GPIOConfig pal_default_config =
{

View File

@ -27,6 +27,8 @@
#include "ch.h"
#include "hal.h"
#if CH_HAL_USE_PWM || defined(__DOXYGEN__)
/**
* @brief PWM Driver initialization.
*/
@ -148,4 +150,6 @@ void pwmDisableChannel(PWMDriver *pwmp, pwmchannel_t channel) {
chSysUnlock();
}
#endif /* CH_HAL_USE_PWM */
/** @} */

View File

@ -28,11 +28,11 @@
#define _HAL_LLD_H_
/*===========================================================================*/
/* Driver pre-compile time settings. */
/* Driver constants. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver constants. */
/* Driver pre-compile time settings. */
/*===========================================================================*/
/*===========================================================================*/