From 6dbde65d2a38de56966069f251038c23649ea8d8 Mon Sep 17 00:00:00 2001 From: Ondrej Spinka Date: Mon, 30 Mar 2009 10:20:41 +0200 Subject: [PATCH] migrated to "official" release of the pwm library. Axed MEMMAP setting due to new startup code. --- app/rama_dam/Makefile.omk | 4 ++-- app/rama_dam/pwm.c | 52 ----------------------------------------------- app/rama_dam/pwm.h | 10 --------- app/rama_dam/rama_dam.c | 13 +----------- 4 files changed, 3 insertions(+), 76 deletions(-) delete mode 100644 app/rama_dam/pwm.c delete mode 100644 app/rama_dam/pwm.h diff --git a/app/rama_dam/Makefile.omk b/app/rama_dam/Makefile.omk index 92a2901..983b861 100644 --- a/app/rama_dam/Makefile.omk +++ b/app/rama_dam/Makefile.omk @@ -4,8 +4,8 @@ ifeq ($(BOARD),spejblarm) # Other boards do not have enough free ram bin_PROGRAMS = rama_dam -rama_dam_SOURCES = rama_dam.c pwm.c -rama_dam_LIBS = can uart_zen +rama_dam_SOURCES = rama_dam.c +rama_dam_LIBS = can uart_zen pwm link_VARIANTS = mpflash endif diff --git a/app/rama_dam/pwm.c b/app/rama_dam/pwm.c deleted file mode 100644 index dbce87e..0000000 --- a/app/rama_dam/pwm.c +++ /dev/null @@ -1,52 +0,0 @@ -#include "pwm.h" - -int PWM_PINSEL[] = { - /*nothing*/ 1, /*PWM1*/ 1, 15, 3, 17, /*PWM5*/ 11, /*PWM6*/ 19 -}; - -uint32_t *PWM_MR[] = { - (uint32_t*)&(PWMMR0), - (uint32_t*)&(PWMMR1), - (uint32_t*)&(PWMMR2), - (uint32_t*)&(PWMMR3), - (uint32_t*)&(PWMMR4), - (uint32_t*)&(PWMMR5), - (uint32_t*)&(PWMMR6) -}; - -void pwm_channel(int n, int double_edge) { - uint32_t bit; - - PWMPCR |= (0x100 | (double_edge && n)) << n; - if (n == 5) { - PINSEL1 |= 0x00000400; - PINSEL1 &= 0xfffff7ff; - } - else { - bit = 1 << PWM_PINSEL[n]; - PINSEL0 |= bit; - bit = ~(bit >> 1); - PINSEL0 &= bit; - } -} - -void pwm_set(int n, uint32_t when) { - *PWM_MR[n] = when; - PWMLER |= 1 << n; -} - -void pwm_set_double(int n, uint32_t from, uint32_t to) { - *PWM_MR[n-1] = from; - *PWM_MR[n] = to; - PWMLER |= 0x3 << (n-1); -} - -void pwm_init(uint32_t prescale, uint32_t period) { - PWMPR = prescale - 1; - PWMMR0 = period - 1; - PWMLER |= 0x1; - PWMMCR |= 0x00000002; - PWMTCR &= ~0x2; - PWMTCR |= 0x9; -} - diff --git a/app/rama_dam/pwm.h b/app/rama_dam/pwm.h deleted file mode 100644 index 0478539..0000000 --- a/app/rama_dam/pwm.h +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -extern int PWM_PINSEL[]; -extern uint32_t *PWM_MR[]; - -void pwm_channel(int n, int double_edge); -void pwm_set(int n, uint32_t when); -void pwm_set_double(int n, uint32_t from, uint32_t to); -void pwm_init(uint32_t prescale, uint32_t period); diff --git a/app/rama_dam/rama_dam.c b/app/rama_dam/rama_dam.c index 9cf45a1..de291a2 100644 --- a/app/rama_dam/rama_dam.c +++ b/app/rama_dam/rama_dam.c @@ -16,7 +16,7 @@ #include #include #include -#include "pwm.h" +#include /*! @defgroup defines Constants Definitions * @{ @@ -53,15 +53,6 @@ /* 0x0003D090 corresponds to 100ms reset timeout */ #define WATCHDOG_INIT 0x0003D090 -/*! @defgroup MEMMAP_EXC Exception Mapping Definitions -* @ingroup defines -* These constants serve to set the exception mapping either to FLASH (0x01) or RAM (0x02). -* @{ -*/ -#define MEMMAP_EXC_FLASH 0x01 -#define MEMMAP_EXC_RAM 0x02 -/*! @} */ - /*!\def STATUS_LED * Defines that status LEDs exist on the target board. */ @@ -1006,8 +997,6 @@ int main ( void ) { VPBDIV = 0x01; // peripheral clock = CPU clock (60MHz) - MEMMAP = MEMMAP_EXC_FLASH; // map exception handling to FLASH - VICIntEnClr = 0xFFFFFFFF; // init Vector Interrupt Controller VICIntSelect = 0x00000000; -- 2.11.4.GIT