From b52a3da2b5ad0ee7d7061af863f0acd33d327292 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 10 Nov 2008 10:21:36 +0000 Subject: ... and the entire dir is renamed too git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19063 a1c6a512-1295-4272-9138-f99709370657 --- .../target/arm/as3525/sansa-m200v4/adc-target.h | 24 ++++++ .../arm/as3525/sansa-m200v4/backlight-target.h | 40 ++++++++++ .../target/arm/as3525/sansa-m200v4/button-m200v4.c | 93 ++++++++++++++++++++++ .../target/arm/as3525/sansa-m200v4/button-target.h | 55 +++++++++++++ .../target/arm/as3525/sansa-m200v4/system-target.h | 28 +++++++ .../target/arm/as3525/sansa-m200v4/timer-target.h | 38 +++++++++ 6 files changed, 278 insertions(+) create mode 100644 firmware/target/arm/as3525/sansa-m200v4/adc-target.h create mode 100644 firmware/target/arm/as3525/sansa-m200v4/backlight-target.h create mode 100644 firmware/target/arm/as3525/sansa-m200v4/button-m200v4.c create mode 100644 firmware/target/arm/as3525/sansa-m200v4/button-target.h create mode 100644 firmware/target/arm/as3525/sansa-m200v4/system-target.h create mode 100644 firmware/target/arm/as3525/sansa-m200v4/timer-target.h (limited to 'firmware/target/arm/as3525/sansa-m200v4') diff --git a/firmware/target/arm/as3525/sansa-m200v4/adc-target.h b/firmware/target/arm/as3525/sansa-m200v4/adc-target.h new file mode 100644 index 0000000000..bea0272496 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-m200v4/adc-target.h @@ -0,0 +1,24 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2008 ?? + * + * This program 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 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef _ADC_TARGET_H_ +#define _ADC_TARGET_H_ + +#endif /* _ADC_TARGET_H_ */ diff --git a/firmware/target/arm/as3525/sansa-m200v4/backlight-target.h b/firmware/target/arm/as3525/sansa-m200v4/backlight-target.h new file mode 100644 index 0000000000..50404f7090 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-m200v4/backlight-target.h @@ -0,0 +1,40 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2008 ?? + * + * This program 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 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef BACKLIGHT_TARGET_H +#define BACKLIGHT_TARGET_H + +static inline bool _backlight_init(void) +{ + GPIOD_DIR |= (1<<1); + return true; +} + +static inline void _backlight_on(void) +{ + GPIOD_PIN(1) = (1<<1); +} + +static inline void _backlight_off(void) +{ + GPIOD_PIN(1) = 0x00; +} + +#endif diff --git a/firmware/target/arm/as3525/sansa-m200v4/button-m200v4.c b/firmware/target/arm/as3525/sansa-m200v4/button-m200v4.c new file mode 100644 index 0000000000..c5d6c4941d --- /dev/null +++ b/firmware/target/arm/as3525/sansa-m200v4/button-m200v4.c @@ -0,0 +1,93 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2008 by ?? + * + * This program 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 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "config.h" +#include "cpu.h" +#include "button.h" +#include "adc.h" + +void button_init_device(void) +{ + GPIOA_DIR &= ~((1<<3) | (1<<2) | (1<<1) | (1<<0)); /* A3-A0 is input */ + GPIOA_DIR |= ((1<<6) | (1<<5) | (1<<4)); /* A4-A6 row outputs */ +} + +int button_read_device(void) +{ + int result = BUTTON_NONE; + + /* direct GPIO connections */ + if (GPIOA_PIN(3)) + result |= BUTTON_MENU; + + /* This is a keypad using A4-A6 as columns and A0-A2 as rows */ + GPIOA_PIN(4) = (1<<4); + + /* A4A0 is unused */ + + if (GPIOA_PIN(1)) + result |= BUTTON_VOLDOWN; + + if (GPIOA_PIN(2)) + result |= BUTTON_PLAYPAUSE; + + GPIOA_PIN(4) = 0x00; + + GPIOA_PIN(5) = (1<<5); + + if (GPIOA_PIN(0)) + result |= BUTTON_LEFT; + + if (GPIOA_PIN(1)) + result |= BUTTON_SELECT; + + if (GPIOA_PIN(2)) + result |= BUTTON_RIGHT; + + GPIOA_PIN(5) = 0x00; + + + GPIOA_PIN(6) = (1<<6); + + if (GPIOA_PIN(0)) + result |= BUTTON_REPEATAB; + + if (GPIOA_PIN(1)) + result |= BUTTON_VOLUP; + + if (GPIOA_PIN(2)) + result |= BUTTON_HOLD; + GPIOA_PIN(6) = 0x00; + + return result; +} + +bool button_hold(void) +{ + bool ret = false; + + GPIOA_PIN(6) = (1<<6); + if (GPIOA_PIN(2)) + ret = true; + GPIOA_PIN(6) = 0x00; + + return ret; +} diff --git a/firmware/target/arm/as3525/sansa-m200v4/button-target.h b/firmware/target/arm/as3525/sansa-m200v4/button-target.h new file mode 100644 index 0000000000..779f7400bb --- /dev/null +++ b/firmware/target/arm/as3525/sansa-m200v4/button-target.h @@ -0,0 +1,55 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2007 by Dave Chapman + * + * This program 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 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef _BUTTON_TARGET_H_ +#define _BUTTON_TARGET_H_ + +#include +#include "config.h" + +#define HAS_BUTTON_HOLD + +void button_init_device(void); +int button_read_device(void); +bool button_hold(void); + +/* Main unit's buttons */ +#define BUTTON_MENU 0x00000001 +#define BUTTON_VOLUP 0x00000002 +#define BUTTON_VOLDOWN 0x00000004 +#define BUTTON_PLAYPAUSE 0x00000008 +#define BUTTON_REPEATAB 0x00000010 +#define BUTTON_LEFT 0x00000020 +#define BUTTON_RIGHT 0x00000040 +#define BUTTON_SELECT 0x00000080 +#define BUTTON_HOLD 0x00000100 + +#define BUTTON_MAIN (BUTTON_MENU|BUTTON_VOLUP|BUTTON_VOLDOWN\ + |BUTTON_PLAYPAUSE|BUTTON_REPEATAB|BUTTON_LEFT\ + |BUTTON_RIGHT|BUTTON_SELECT|BUTTON_HOLD) + +#define BUTTON_REMOTE 0 + +/* Software power-off */ +#define POWEROFF_BUTTON BUTTON_MENU +#define POWEROFF_COUNT 40 + +#endif /* _BUTTON_TARGET_H_ */ diff --git a/firmware/target/arm/as3525/sansa-m200v4/system-target.h b/firmware/target/arm/as3525/sansa-m200v4/system-target.h new file mode 100644 index 0000000000..b712d1c124 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-m200v4/system-target.h @@ -0,0 +1,28 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2008 ?? + * + * This program 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 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef SYSTEM_TARGET_H +#define SYSTEM_TARGET_H + +#include "system-arm.h" + +#define CPUFREQ_MAX 250000000 + +#endif /* SYSTEM_TARGET_H */ diff --git a/firmware/target/arm/as3525/sansa-m200v4/timer-target.h b/firmware/target/arm/as3525/sansa-m200v4/timer-target.h new file mode 100644 index 0000000000..b81da57885 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-m200v4/timer-target.h @@ -0,0 +1,38 @@ +/*************************************************************************** +* __________ __ ___. +* Open \______ \ ____ ____ | | _\_ |__ _______ ___ +* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +* \/ \/ \/ \/ \/ +* $Id$ +* +* Copyright (C) 2008 ?? +* +* This program 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 2 +* of the License, or (at your option) any later version. +* +* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +* KIND, either express or implied. +* +****************************************************************************/ +#ifndef TIMER_TARGET_H +#define TIMER_TARGET_H + +bool __timer_set(long cycles, bool set); +bool __timer_register(void); +void __timer_unregister(void); + +#define __TIMER_SET(cycles, set) \ + __timer_set(cycles, set) + +#define __TIMER_REGISTER(reg_prio, unregister_callback, cycles, \ + int_prio, timer_callback) \ + __timer_register() + +#define __TIMER_UNREGISTER(...) \ + __timer_unregister() + +#endif /* TIMER_TARGET_H */ -- cgit v1.2.3