From a9b997708399263d5a2d1469b4c41f11513f12de Mon Sep 17 00:00:00 2001 From: Rafaël Carré Date: Tue, 3 Jan 2012 04:23:24 +0000 Subject: Move PP-specific headers to pp/ directory git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31530 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/ascodec-target.h | 103 ---------------- firmware/target/arm/ata-target.h | 92 -------------- firmware/target/arm/debug-target.h | 48 -------- firmware/target/arm/pp/ascodec-target.h | 103 ++++++++++++++++ firmware/target/arm/pp/ata-target.h | 92 ++++++++++++++ firmware/target/arm/pp/debug-target.h | 48 ++++++++ firmware/target/arm/pp/sd-pp-target.h | 32 +++++ firmware/target/arm/pp/system-target.h | 206 ++++++++++++++++++++++++++++++++ firmware/target/arm/sd-pp-target.h | 32 ----- firmware/target/arm/system-target.h | 206 -------------------------------- 10 files changed, 481 insertions(+), 481 deletions(-) delete mode 100644 firmware/target/arm/ascodec-target.h delete mode 100644 firmware/target/arm/ata-target.h delete mode 100644 firmware/target/arm/debug-target.h create mode 100644 firmware/target/arm/pp/ascodec-target.h create mode 100644 firmware/target/arm/pp/ata-target.h create mode 100644 firmware/target/arm/pp/debug-target.h create mode 100644 firmware/target/arm/pp/sd-pp-target.h create mode 100644 firmware/target/arm/pp/system-target.h delete mode 100644 firmware/target/arm/sd-pp-target.h delete mode 100644 firmware/target/arm/system-target.h diff --git a/firmware/target/arm/ascodec-target.h b/firmware/target/arm/ascodec-target.h deleted file mode 100644 index 68d9905a6b..0000000000 --- a/firmware/target/arm/ascodec-target.h +++ /dev/null @@ -1,103 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Driver for AS3514 audio codec - * - * Copyright (c) 2007 Daniel Ankers - * Copyright (c) 2007 Christian Gmeiner - * - * 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 _ASCODEC_TARGET_H -#define _ASCODEC_TARGET_H - -#include "config.h" - -#ifdef CPU_PP -/* TODO: This header is actually portalplayer specific, and should be - * moved into an appropriate subdir */ - -#include "as3514.h" -#include "i2c-pp.h" - -static inline int ascodec_write(unsigned int reg, unsigned int value) -{ - return pp_i2c_send(AS3514_I2C_ADDR, reg, value); -} - -static inline int ascodec_read(unsigned int reg) -{ - return i2c_readbyte(AS3514_I2C_ADDR, reg); -} - -static inline int ascodec_readbytes(int addr, int len, unsigned char *data) -{ - return i2c_readbytes(AS3514_I2C_ADDR, addr, len, data); -} - -static inline void ascodec_lock(void) -{ - i2c_lock(); -} - -static inline void ascodec_unlock(void) -{ - i2c_unlock(); -} - -static inline bool ascodec_chg_status(void) -{ - return ascodec_read(AS3514_IRQ_ENRD0) & CHG_STATUS; -} - -static inline bool ascodec_endofch(void) -{ - return ascodec_read(AS3514_IRQ_ENRD0) & CHG_ENDOFCH; -} - -static inline void ascodec_monitor_endofch(void) -{ - ascodec_write(AS3514_IRQ_ENRD0, IRQ_ENDOFCH); -} - -static inline void ascodec_wait_adc_finished(void) -{ - /* - * FIXME: not implemented - * - * If irqs are not available on the target platform, - * this should be most likely implemented by polling - * AS3514_IRQ_ENRD2 in the same way powermgmt-ascodec.c - * is polling IRQ_ENDOFCH. - */ -} - -static inline void ascodec_write_charger(int value) -{ - ascodec_write(AS3514_CHARGER, value); -} - -static inline int ascodec_read_charger(void) -{ - return ascodec_read(AS3514_CHARGER); -} - -extern void ascodec_suppressor_on(bool on); - -#endif /* CPU_PP */ - -#endif /* !_ASCODEC_TARGET_H */ diff --git a/firmware/target/arm/ata-target.h b/firmware/target/arm/ata-target.h deleted file mode 100644 index 616c451579..0000000000 --- a/firmware/target/arm/ata-target.h +++ /dev/null @@ -1,92 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2006 by Barry Wardell - * - * 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 ATA_TARGET_H -#define ATA_TARGET_H - -#include "config.h" - -#ifdef CPU_PP - -#ifdef HAVE_BOOTLOADER_USB_MODE -#define ATA_DRIVER_CLOSE -#endif - -/* primary channel */ -#define ATA_DATA (*((volatile unsigned short*)(IDE_BASE + 0x1e0))) -#define ATA_ERROR (*((volatile unsigned char*)(IDE_BASE + 0x1e4))) -#define ATA_NSECTOR (*((volatile unsigned char*)(IDE_BASE + 0x1e8))) -#define ATA_SECTOR (*((volatile unsigned char*)(IDE_BASE + 0x1ec))) -#define ATA_LCYL (*((volatile unsigned char*)(IDE_BASE + 0x1f0))) -#define ATA_HCYL (*((volatile unsigned char*)(IDE_BASE + 0x1f4))) -#define ATA_SELECT (*((volatile unsigned char*)(IDE_BASE + 0x1f8))) -#define ATA_COMMAND (*((volatile unsigned char*)(IDE_BASE + 0x1fc))) -#define ATA_CONTROL (*((volatile unsigned char*)(IDE_BASE + 0x3f8))) - -#if (CONFIG_CPU == PP5002) - -#define ATA_OUT8(reg,val) do { reg = (val); \ - while (!(IDE_CFG_STATUS & 0x40)); \ - } while (0) - -/* Plain C reading and writing. See comment in ata-as-arm.S */ - -#elif defined CPU_PP502x - -/* asm optimized reading and writing */ -#define ATA_OPTIMIZED_READING -#define ATA_OPTIMIZED_WRITING - -#endif /* CONFIG_CPU */ - -#endif - -#ifdef HAVE_ATA_DMA - -/* IDE DMA controller registers */ -#define IDE_DMA_CONTROL (*(volatile unsigned long *)(0xc3000400)) -#define IDE_DMA_LENGTH (*(volatile unsigned long *)(0xc3000408)) -#define IDE_DMA_ADDR (*(volatile unsigned long *)(0xc300040C)) - -/* Maximum multi-word DMA mode supported by the controller */ -#define ATA_MAX_MWDMA 2 - -#ifndef BOOTLOADER -/* The PP5020 supports UDMA 4, but it needs cpu boosting and only - * improves performance by ~10% with a stock disk. - * UDMA 2 is stable at 30 Mhz. - * UDMA 1 is stable at 24 Mhz. - */ -#if CPUFREQ_NORMAL >= 30000000 -#define ATA_MAX_UDMA 2 -#elif CPUFREQ_NORMAL >= 24000000 -#define ATA_MAX_UDMA 1 -#else -#error "CPU speeds under 24Mhz have not been tested with DMA" -#endif -#else -/* The bootloader runs at 24 Mhz and needs a slower mode */ -#define ATA_MAX_UDMA 1 -#endif - -#endif /* HAVE_ATA_DMA */ - -#endif /* ATA_TARGET_H */ diff --git a/firmware/target/arm/debug-target.h b/firmware/target/arm/debug-target.h deleted file mode 100644 index b7a1f7e5cb..0000000000 --- a/firmware/target/arm/debug-target.h +++ /dev/null @@ -1,48 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2010 by Marcin Bukat - * - * 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. - * - ****************************************************************************/ -#if (CONFIG_KEYPAD == IPOD_1G2G_PAD) || \ - (CONFIG_KEYPAD == IPOD_3G_PAD) || \ - (CONFIG_KEYPAD == IPOD_4G_PAD) -# define DEBUG_CANCEL BUTTON_MENU - -#elif (CONFIG_KEYPAD == IRIVER_H10_PAD) -# define DEBUG_CANCEL BUTTON_REW - -#elif (CONFIG_KEYPAD == MROBE100_PAD) -# define DEBUG_CANCEL BUTTON_MENU - -#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \ - (CONFIG_KEYPAD == SANSA_C200_PAD) || \ - (CONFIG_KEYPAD == PHILIPS_HDD6330_PAD) -# define DEBUG_CANCEL BUTTON_LEFT - -#elif (CONFIG_KEYPAD == PHILIPS_SA9200_PAD) || \ - (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD) -# define DEBUG_CANCEL BUTTON_POWER - -#elif (CONFIG_KEYPAD == SAMSUNG_YH_PAD) -# define DEBUG_CANCEL BUTTON_PLAY - -#elif (CONFIG_KEYPAD == PBELL_VIBE500_PAD) -# define DEBUG_CANCEL BUTTON_CANCEL -#endif -bool dbg_ports(void); -bool dbg_hw_info(void); diff --git a/firmware/target/arm/pp/ascodec-target.h b/firmware/target/arm/pp/ascodec-target.h new file mode 100644 index 0000000000..68d9905a6b --- /dev/null +++ b/firmware/target/arm/pp/ascodec-target.h @@ -0,0 +1,103 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Driver for AS3514 audio codec + * + * Copyright (c) 2007 Daniel Ankers + * Copyright (c) 2007 Christian Gmeiner + * + * 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 _ASCODEC_TARGET_H +#define _ASCODEC_TARGET_H + +#include "config.h" + +#ifdef CPU_PP +/* TODO: This header is actually portalplayer specific, and should be + * moved into an appropriate subdir */ + +#include "as3514.h" +#include "i2c-pp.h" + +static inline int ascodec_write(unsigned int reg, unsigned int value) +{ + return pp_i2c_send(AS3514_I2C_ADDR, reg, value); +} + +static inline int ascodec_read(unsigned int reg) +{ + return i2c_readbyte(AS3514_I2C_ADDR, reg); +} + +static inline int ascodec_readbytes(int addr, int len, unsigned char *data) +{ + return i2c_readbytes(AS3514_I2C_ADDR, addr, len, data); +} + +static inline void ascodec_lock(void) +{ + i2c_lock(); +} + +static inline void ascodec_unlock(void) +{ + i2c_unlock(); +} + +static inline bool ascodec_chg_status(void) +{ + return ascodec_read(AS3514_IRQ_ENRD0) & CHG_STATUS; +} + +static inline bool ascodec_endofch(void) +{ + return ascodec_read(AS3514_IRQ_ENRD0) & CHG_ENDOFCH; +} + +static inline void ascodec_monitor_endofch(void) +{ + ascodec_write(AS3514_IRQ_ENRD0, IRQ_ENDOFCH); +} + +static inline void ascodec_wait_adc_finished(void) +{ + /* + * FIXME: not implemented + * + * If irqs are not available on the target platform, + * this should be most likely implemented by polling + * AS3514_IRQ_ENRD2 in the same way powermgmt-ascodec.c + * is polling IRQ_ENDOFCH. + */ +} + +static inline void ascodec_write_charger(int value) +{ + ascodec_write(AS3514_CHARGER, value); +} + +static inline int ascodec_read_charger(void) +{ + return ascodec_read(AS3514_CHARGER); +} + +extern void ascodec_suppressor_on(bool on); + +#endif /* CPU_PP */ + +#endif /* !_ASCODEC_TARGET_H */ diff --git a/firmware/target/arm/pp/ata-target.h b/firmware/target/arm/pp/ata-target.h new file mode 100644 index 0000000000..616c451579 --- /dev/null +++ b/firmware/target/arm/pp/ata-target.h @@ -0,0 +1,92 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2006 by Barry Wardell + * + * 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 ATA_TARGET_H +#define ATA_TARGET_H + +#include "config.h" + +#ifdef CPU_PP + +#ifdef HAVE_BOOTLOADER_USB_MODE +#define ATA_DRIVER_CLOSE +#endif + +/* primary channel */ +#define ATA_DATA (*((volatile unsigned short*)(IDE_BASE + 0x1e0))) +#define ATA_ERROR (*((volatile unsigned char*)(IDE_BASE + 0x1e4))) +#define ATA_NSECTOR (*((volatile unsigned char*)(IDE_BASE + 0x1e8))) +#define ATA_SECTOR (*((volatile unsigned char*)(IDE_BASE + 0x1ec))) +#define ATA_LCYL (*((volatile unsigned char*)(IDE_BASE + 0x1f0))) +#define ATA_HCYL (*((volatile unsigned char*)(IDE_BASE + 0x1f4))) +#define ATA_SELECT (*((volatile unsigned char*)(IDE_BASE + 0x1f8))) +#define ATA_COMMAND (*((volatile unsigned char*)(IDE_BASE + 0x1fc))) +#define ATA_CONTROL (*((volatile unsigned char*)(IDE_BASE + 0x3f8))) + +#if (CONFIG_CPU == PP5002) + +#define ATA_OUT8(reg,val) do { reg = (val); \ + while (!(IDE_CFG_STATUS & 0x40)); \ + } while (0) + +/* Plain C reading and writing. See comment in ata-as-arm.S */ + +#elif defined CPU_PP502x + +/* asm optimized reading and writing */ +#define ATA_OPTIMIZED_READING +#define ATA_OPTIMIZED_WRITING + +#endif /* CONFIG_CPU */ + +#endif + +#ifdef HAVE_ATA_DMA + +/* IDE DMA controller registers */ +#define IDE_DMA_CONTROL (*(volatile unsigned long *)(0xc3000400)) +#define IDE_DMA_LENGTH (*(volatile unsigned long *)(0xc3000408)) +#define IDE_DMA_ADDR (*(volatile unsigned long *)(0xc300040C)) + +/* Maximum multi-word DMA mode supported by the controller */ +#define ATA_MAX_MWDMA 2 + +#ifndef BOOTLOADER +/* The PP5020 supports UDMA 4, but it needs cpu boosting and only + * improves performance by ~10% with a stock disk. + * UDMA 2 is stable at 30 Mhz. + * UDMA 1 is stable at 24 Mhz. + */ +#if CPUFREQ_NORMAL >= 30000000 +#define ATA_MAX_UDMA 2 +#elif CPUFREQ_NORMAL >= 24000000 +#define ATA_MAX_UDMA 1 +#else +#error "CPU speeds under 24Mhz have not been tested with DMA" +#endif +#else +/* The bootloader runs at 24 Mhz and needs a slower mode */ +#define ATA_MAX_UDMA 1 +#endif + +#endif /* HAVE_ATA_DMA */ + +#endif /* ATA_TARGET_H */ diff --git a/firmware/target/arm/pp/debug-target.h b/firmware/target/arm/pp/debug-target.h new file mode 100644 index 0000000000..b7a1f7e5cb --- /dev/null +++ b/firmware/target/arm/pp/debug-target.h @@ -0,0 +1,48 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2010 by Marcin Bukat + * + * 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. + * + ****************************************************************************/ +#if (CONFIG_KEYPAD == IPOD_1G2G_PAD) || \ + (CONFIG_KEYPAD == IPOD_3G_PAD) || \ + (CONFIG_KEYPAD == IPOD_4G_PAD) +# define DEBUG_CANCEL BUTTON_MENU + +#elif (CONFIG_KEYPAD == IRIVER_H10_PAD) +# define DEBUG_CANCEL BUTTON_REW + +#elif (CONFIG_KEYPAD == MROBE100_PAD) +# define DEBUG_CANCEL BUTTON_MENU + +#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \ + (CONFIG_KEYPAD == SANSA_C200_PAD) || \ + (CONFIG_KEYPAD == PHILIPS_HDD6330_PAD) +# define DEBUG_CANCEL BUTTON_LEFT + +#elif (CONFIG_KEYPAD == PHILIPS_SA9200_PAD) || \ + (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD) +# define DEBUG_CANCEL BUTTON_POWER + +#elif (CONFIG_KEYPAD == SAMSUNG_YH_PAD) +# define DEBUG_CANCEL BUTTON_PLAY + +#elif (CONFIG_KEYPAD == PBELL_VIBE500_PAD) +# define DEBUG_CANCEL BUTTON_CANCEL +#endif +bool dbg_ports(void); +bool dbg_hw_info(void); diff --git a/firmware/target/arm/pp/sd-pp-target.h b/firmware/target/arm/pp/sd-pp-target.h new file mode 100644 index 0000000000..222daa1a52 --- /dev/null +++ b/firmware/target/arm/pp/sd-pp-target.h @@ -0,0 +1,32 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2007 by Antonius Hellmann + * + * 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 ATA_SD_TARGET_H +#define ATA_SD_TARGET_H + +#ifdef CPU_PP /* PortalPlayer specific functions */ + +#ifdef HAVE_HOTSWAP +void microsd_int(void); +#endif + +#endif + +#endif diff --git a/firmware/target/arm/pp/system-target.h b/firmware/target/arm/pp/system-target.h new file mode 100644 index 0000000000..e7f9ce0245 --- /dev/null +++ b/firmware/target/arm/pp/system-target.h @@ -0,0 +1,206 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2002 by Alan Korr + * Copyright (C) 2007 by Michael Sevakis + * + * 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 "config.h" +#include "system-arm.h" +#include + +#ifdef CPU_PP +/* TODO: This header is actually portalplayer specific, and should be + * moved into an appropriate subdir (or even split in 2). */ + +#if CONFIG_CPU == PP5002 +#define CPUFREQ_SLEEP 32768 +#define CPUFREQ_DEFAULT 24000000 +#define CPUFREQ_NORMAL 30000000 +#define CPUFREQ_MAX 80000000 + +#else /* PP5022, PP5024 */ +#define CPUFREQ_SLEEP 32768 +#define CPUFREQ_DEFAULT 24000000 +#define CPUFREQ_NORMAL 30000000 +#define CPUFREQ_MAX 80000000 +#endif + +#define inl(a) (*(volatile unsigned long *) (a)) +#define outl(a,b) (*(volatile unsigned long *) (b) = (a)) +#define inb(a) (*(volatile unsigned char *) (a)) +#define outb(a,b) (*(volatile unsigned char *) (b) = (a)) +#define inw(a) (*(volatile unsigned short *) (a)) +#define outw(a,b) (*(volatile unsigned short *) (b) = (a)) + +void usb_pin_init(void); +bool usb_plugged(void); +void firewire_insert_int(void); +void usb_insert_int(void); + +static inline void udelay(unsigned usecs) +{ + unsigned stop = USEC_TIMER + usecs; + while (TIME_BEFORE(USEC_TIMER, stop)); +} + +static inline unsigned int current_core(void) +{ + /* + * PROCESSOR_ID seems to be 32-bits: + * CPU = 0x55555555 = |01010101|01010101|01010101|01010101| + * COP = 0xaaaaaaaa = |10101010|10101010|10101010|10101010| + * ^ + */ + unsigned int core; + asm volatile ( + "ldrb %0, [%1] \n" /* Just load the LSB */ + "mov %0, %0, lsr #7 \n" /* Bit 7 => index */ + : "=r"(core) /* CPU=0, COP=1 */ + : "r"(&PROCESSOR_ID) + ); + return core; +} + +/* Return the actual ID instead of core index */ +static inline unsigned int processor_id(void) +{ + unsigned int id; + + asm volatile ( + "ldrb %0, [%1] \n" + : "=r"(id) + : "r"(&PROCESSOR_ID) + ); + + return id; +} + +#if CONFIG_CPU == PP5002 +static inline void sleep_core(int core) +{ + asm volatile ( + /* Sleep: PP5002 crashes if the instruction that puts it to sleep is + * located at 0xNNNNNNN0. 4/8/C works. This sequence makes sure + * that the correct alternative is executed. Don't change the order + * of the next 4 instructions! */ + "tst pc, #0x0c \n" + "mov r0, #0xca \n" + "strne r0, [%[ctl]] \n" + "streq r0, [%[ctl]] \n" + "nop \n" /* nop's needed because of pipeline */ + "nop \n" + "nop \n" + : + : [ctl]"r"(&PROC_CTL(core)) + : "r0" + ); +} +static inline void wake_core(int core) +{ + asm volatile ( + "mov r0, #0xce \n" + "str r0, [%[ctl]] \n" + : + : [ctl]"r"(&PROC_CTL(core)) + : "r0" + ); +} +#else /* PP502x */ +static inline void sleep_core(int core) +{ + asm volatile ( + "mov r0, #0x80000000 \n" + "str r0, [%[ctl]] \n" + "nop \n" + : + : [ctl]"r"(&PROC_CTL(core)) + : "r0" + ); +} +static inline void wake_core(int core) +{ + asm volatile ( + "mov r0, #0 \n" + "str r0, [%[ctl]] \n" + : + : [ctl]"r"(&PROC_CTL(core)) + : "r0" + ); +} +#endif + +void commit_dcache(void); +void commit_discard_dcache(void); +void commit_discard_idcache(void); + +#if defined(BOOTLOADER) && !defined(HAVE_BOOTLOADER_USB_MODE) +/* All addresses within rockbox are in IRAM in the bootloader so + are therefore uncached */ +#define UNCACHED_ADDR(a) (a) + +#else /* !BOOTLOADER */ + +#if CONFIG_CPU == PP5002 +#define UNCACHED_BASE_ADDR 0x28000000 +#else /* PP502x */ +#define UNCACHED_BASE_ADDR 0x10000000 +#endif + +#define UNCACHED_ADDR(a) \ + ((typeof (a))((uintptr_t)(a) | UNCACHED_BASE_ADDR)) +#endif /* BOOTLOADER */ + +#if defined(CPU_PP502x) && defined(HAVE_ATA_DMA) +#define STORAGE_WANTS_ALIGN +#endif + +#if defined(IPOD_VIDEO) && !defined(BOOTLOADER) +extern unsigned char probed_ramsize; +int battery_default_capacity(void); +#endif + + +#ifdef BOOTLOADER +#if defined(TATUNG_TPJ1022) + /* Some targets don't like yielding in the bootloader - force + * yield() to return without a context switch. */ +#define YIELD_KERNEL_HOOK() true +#endif + +#ifdef HAVE_BOOTLOADER_USB_MODE +void tick_stop(void); +void system_prepare_fw_start(void); + +#else /* !HAVE_BOOTLOADER_USB_MODE */ + + /* Busy "sleep" without a tick */ +#define SLEEP_KERNEL_HOOK(ticks) \ + ({ unsigned _stop = USEC_TIMER + ((ticks) + 1) * (1000000/HZ); \ + while (TIME_BEFORE(USEC_TIMER, _stop)) \ + switch_thread(); \ + true; }) +#endif /* HAVE_BOOTLOADER_USB_MODE */ + +#endif /* BOOTLOADER */ + +#endif /* CPU_PP */ + +#endif /* SYSTEM_TARGET_H */ diff --git a/firmware/target/arm/sd-pp-target.h b/firmware/target/arm/sd-pp-target.h deleted file mode 100644 index 222daa1a52..0000000000 --- a/firmware/target/arm/sd-pp-target.h +++ /dev/null @@ -1,32 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2007 by Antonius Hellmann - * - * 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 ATA_SD_TARGET_H -#define ATA_SD_TARGET_H - -#ifdef CPU_PP /* PortalPlayer specific functions */ - -#ifdef HAVE_HOTSWAP -void microsd_int(void); -#endif - -#endif - -#endif diff --git a/firmware/target/arm/system-target.h b/firmware/target/arm/system-target.h deleted file mode 100644 index e7f9ce0245..0000000000 --- a/firmware/target/arm/system-target.h +++ /dev/null @@ -1,206 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2002 by Alan Korr - * Copyright (C) 2007 by Michael Sevakis - * - * 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 "config.h" -#include "system-arm.h" -#include - -#ifdef CPU_PP -/* TODO: This header is actually portalplayer specific, and should be - * moved into an appropriate subdir (or even split in 2). */ - -#if CONFIG_CPU == PP5002 -#define CPUFREQ_SLEEP 32768 -#define CPUFREQ_DEFAULT 24000000 -#define CPUFREQ_NORMAL 30000000 -#define CPUFREQ_MAX 80000000 - -#else /* PP5022, PP5024 */ -#define CPUFREQ_SLEEP 32768 -#define CPUFREQ_DEFAULT 24000000 -#define CPUFREQ_NORMAL 30000000 -#define CPUFREQ_MAX 80000000 -#endif - -#define inl(a) (*(volatile unsigned long *) (a)) -#define outl(a,b) (*(volatile unsigned long *) (b) = (a)) -#define inb(a) (*(volatile unsigned char *) (a)) -#define outb(a,b) (*(volatile unsigned char *) (b) = (a)) -#define inw(a) (*(volatile unsigned short *) (a)) -#define outw(a,b) (*(volatile unsigned short *) (b) = (a)) - -void usb_pin_init(void); -bool usb_plugged(void); -void firewire_insert_int(void); -void usb_insert_int(void); - -static inline void udelay(unsigned usecs) -{ - unsigned stop = USEC_TIMER + usecs; - while (TIME_BEFORE(USEC_TIMER, stop)); -} - -static inline unsigned int current_core(void) -{ - /* - * PROCESSOR_ID seems to be 32-bits: - * CPU = 0x55555555 = |01010101|01010101|01010101|01010101| - * COP = 0xaaaaaaaa = |10101010|10101010|10101010|10101010| - * ^ - */ - unsigned int core; - asm volatile ( - "ldrb %0, [%1] \n" /* Just load the LSB */ - "mov %0, %0, lsr #7 \n" /* Bit 7 => index */ - : "=r"(core) /* CPU=0, COP=1 */ - : "r"(&PROCESSOR_ID) - ); - return core; -} - -/* Return the actual ID instead of core index */ -static inline unsigned int processor_id(void) -{ - unsigned int id; - - asm volatile ( - "ldrb %0, [%1] \n" - : "=r"(id) - : "r"(&PROCESSOR_ID) - ); - - return id; -} - -#if CONFIG_CPU == PP5002 -static inline void sleep_core(int core) -{ - asm volatile ( - /* Sleep: PP5002 crashes if the instruction that puts it to sleep is - * located at 0xNNNNNNN0. 4/8/C works. This sequence makes sure - * that the correct alternative is executed. Don't change the order - * of the next 4 instructions! */ - "tst pc, #0x0c \n" - "mov r0, #0xca \n" - "strne r0, [%[ctl]] \n" - "streq r0, [%[ctl]] \n" - "nop \n" /* nop's needed because of pipeline */ - "nop \n" - "nop \n" - : - : [ctl]"r"(&PROC_CTL(core)) - : "r0" - ); -} -static inline void wake_core(int core) -{ - asm volatile ( - "mov r0, #0xce \n" - "str r0, [%[ctl]] \n" - : - : [ctl]"r"(&PROC_CTL(core)) - : "r0" - ); -} -#else /* PP502x */ -static inline void sleep_core(int core) -{ - asm volatile ( - "mov r0, #0x80000000 \n" - "str r0, [%[ctl]] \n" - "nop \n" - : - : [ctl]"r"(&PROC_CTL(core)) - : "r0" - ); -} -static inline void wake_core(int core) -{ - asm volatile ( - "mov r0, #0 \n" - "str r0, [%[ctl]] \n" - : - : [ctl]"r"(&PROC_CTL(core)) - : "r0" - ); -} -#endif - -void commit_dcache(void); -void commit_discard_dcache(void); -void commit_discard_idcache(void); - -#if defined(BOOTLOADER) && !defined(HAVE_BOOTLOADER_USB_MODE) -/* All addresses within rockbox are in IRAM in the bootloader so - are therefore uncached */ -#define UNCACHED_ADDR(a) (a) - -#else /* !BOOTLOADER */ - -#if CONFIG_CPU == PP5002 -#define UNCACHED_BASE_ADDR 0x28000000 -#else /* PP502x */ -#define UNCACHED_BASE_ADDR 0x10000000 -#endif - -#define UNCACHED_ADDR(a) \ - ((typeof (a))((uintptr_t)(a) | UNCACHED_BASE_ADDR)) -#endif /* BOOTLOADER */ - -#if defined(CPU_PP502x) && defined(HAVE_ATA_DMA) -#define STORAGE_WANTS_ALIGN -#endif - -#if defined(IPOD_VIDEO) && !defined(BOOTLOADER) -extern unsigned char probed_ramsize; -int battery_default_capacity(void); -#endif - - -#ifdef BOOTLOADER -#if defined(TATUNG_TPJ1022) - /* Some targets don't like yielding in the bootloader - force - * yield() to return without a context switch. */ -#define YIELD_KERNEL_HOOK() true -#endif - -#ifdef HAVE_BOOTLOADER_USB_MODE -void tick_stop(void); -void system_prepare_fw_start(void); - -#else /* !HAVE_BOOTLOADER_USB_MODE */ - - /* Busy "sleep" without a tick */ -#define SLEEP_KERNEL_HOOK(ticks) \ - ({ unsigned _stop = USEC_TIMER + ((ticks) + 1) * (1000000/HZ); \ - while (TIME_BEFORE(USEC_TIMER, _stop)) \ - switch_thread(); \ - true; }) -#endif /* HAVE_BOOTLOADER_USB_MODE */ - -#endif /* BOOTLOADER */ - -#endif /* CPU_PP */ - -#endif /* SYSTEM_TARGET_H */ -- cgit v1.2.3