diff options
Diffstat (limited to 'os/hal/platforms')
| -rw-r--r-- | os/hal/platforms/AT91SAM7/hal_lld.c | 5 | ||||
| -rw-r--r-- | os/hal/platforms/AT91SAM7/hal_lld.h | 8 | ||||
| -rw-r--r-- | os/hal/platforms/LPC214x/hal_lld.c | 57 | ||||
| -rw-r--r-- | os/hal/platforms/LPC214x/hal_lld.h | 12 | ||||
| -rw-r--r-- | os/hal/platforms/MSP430/hal_lld.c | 5 | ||||
| -rw-r--r-- | os/hal/platforms/STM32/hal_lld.c | 5 | 
6 files changed, 80 insertions, 12 deletions
diff --git a/os/hal/platforms/AT91SAM7/hal_lld.c b/os/hal/platforms/AT91SAM7/hal_lld.c index 6da681fcd..b79e40ffe 100644 --- a/os/hal/platforms/AT91SAM7/hal_lld.c +++ b/os/hal/platforms/AT91SAM7/hal_lld.c @@ -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 =
  {
 diff --git a/os/hal/platforms/AT91SAM7/hal_lld.h b/os/hal/platforms/AT91SAM7/hal_lld.h index 733ef9a51..0a2d97a66 100644 --- a/os/hal/platforms/AT91SAM7/hal_lld.h +++ b/os/hal/platforms/AT91SAM7/hal_lld.h @@ -31,6 +31,10 @@  #include "at91lib/aic.h"
  /*===========================================================================*/
 +/* Driver constants.                                                         */
 +/*===========================================================================*/
 +
 +/*===========================================================================*/
  /* Driver pre-compile time settings.                                         */
  /*===========================================================================*/
 @@ -49,10 +53,6 @@  #endif
  /*===========================================================================*/
 -/* Driver constants.                                                         */
 -/*===========================================================================*/
 -
 -/*===========================================================================*/
  /* Driver data structures and types.                                         */
  /*===========================================================================*/
 diff --git a/os/hal/platforms/LPC214x/hal_lld.c b/os/hal/platforms/LPC214x/hal_lld.c index 09d5c639d..705a42498 100644 --- a/os/hal/platforms/LPC214x/hal_lld.c +++ b/os/hal/platforms/LPC214x/hal_lld.c @@ -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;
  }
  /** @} */
 diff --git a/os/hal/platforms/LPC214x/hal_lld.h b/os/hal/platforms/LPC214x/hal_lld.h index 40345ec72..dcedb386c 100644 --- a/os/hal/platforms/LPC214x/hal_lld.h +++ b/os/hal/platforms/LPC214x/hal_lld.h @@ -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
 diff --git a/os/hal/platforms/MSP430/hal_lld.c b/os/hal/platforms/MSP430/hal_lld.c index b8ca618d7..65cac60de 100644 --- a/os/hal/platforms/MSP430/hal_lld.c +++ b/os/hal/platforms/MSP430/hal_lld.c @@ -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 =
  {
 diff --git a/os/hal/platforms/STM32/hal_lld.c b/os/hal/platforms/STM32/hal_lld.c index b69bbbd9b..892767a00 100644 --- a/os/hal/platforms/STM32/hal_lld.c +++ b/os/hal/platforms/STM32/hal_lld.c @@ -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 =
  {
  | 
