1
0
Fork 0
forked from len0rd/rockbox

Work-in-progress iriver iFP-7xx port by Tomasz Malesinski

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8342 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dave Chapman 2006-01-12 00:35:50 +00:00
parent 8d13068421
commit d83e929f3f
52 changed files with 737 additions and 18 deletions

View file

@ -74,8 +74,12 @@ drivers/adc.c
#ifdef HAVE_MMC
drivers/ata_mmc.c
#else
#ifdef HAVE_FLASH_DISK
drivers/ata_flash.c
#else
drivers/ata.c
#endif
#endif
drivers/button.c
drivers/dac.c
drivers/fat.c
@ -93,6 +97,8 @@ tuner_philips.c
drivers/i2c-coldfire.c
#elif CONFIG_I2C == I2C_PP5020
drivers/i2c-pp5020.c
#elif CONFIG_I2C == I2C_PNX0101
drivers/i2c-pnx0101.c
#else
drivers/i2c.c
#endif

View file

@ -7,7 +7,7 @@ INPUT(crt0.o)
#elif CONFIG_CPU == TCC730
OUTPUT_FORMAT(elf32-calmrisc16)
INPUT(crt0.o)
#elif CONFIG_CPU == PP5020
#elif defined(CPU_ARM)
OUTPUT_FORMAT(elf32-littlearm)
OUTPUT_ARCH(arm)
INPUT(crt0.o)
@ -126,6 +126,10 @@ _pluginbuf = 0;
#define DRAMORIG 0x00000000 + STUBOFFSET
#define IRAMORIG 0x40000000
#define IRAMSIZE 0xc000
#elif CONFIG_CPU==PNX0101
#define DRAMORIG 0x24000000 + STUBOFFSET
#define IRAMORIG 0x400100
#define IRAMSIZE 0x7f00
#else
#define DRAMORIG 0x09000000 + STUBOFFSET
#define IRAMORIG 0x0f000000
@ -161,7 +165,7 @@ SECTIONS
. = ALIGN(0x200);
*(.init.text)
*(.text*)
#if CONFIG_CPU==PP5020
#ifdef CPU_ARM
*(.glue_7)
*(.glue_7t)
#endif
@ -214,7 +218,7 @@ SECTIONS
_iend = .;
} > IRAM
#if defined(CPU_COLDFIRE) || CONFIG_CPU==PP5020
#if defined(CPU_COLDFIRE) || defined(CPU_ARM)
.stack :
{
*(.stack)
@ -234,7 +238,7 @@ SECTIONS
} > DRAM
#endif
#if defined(CPU_COLDFIRE) || CONFIG_CPU==PP5020
#if defined(CPU_COLDFIRE) || defined(CPU_ARM)
.bss ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram):
#else
.bss :

View file

@ -242,6 +242,8 @@ static void __backlight_on(void)
/* set port L07 on */
outl(((0x100 | 1) << 7), 0x6000d12c);
#elif CONFIG_BACKLIGHT==BL_IRIVER_IFP7XX
GPIO3_SET = 1;
#endif
}
@ -279,6 +281,8 @@ static void __backlight_off(void)
/* set port L07 off */
outl(((0x100 | 0) << 7), 0x6000d12c);
#elif CONFIG_BACKLIGHT==BL_IRIVER_IFP7XX
GPIO3_CLR = 1;
#endif
}

View file

@ -37,6 +37,8 @@ start:
*
*/
msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ */
#ifndef BOOTLOADER
#if CONFIG_CPU == PP5002 || CONFIG_CPU == PP5020
b pad_skip
@ -247,8 +249,8 @@ boot_table:
/* Set up stack for IRQ mode */
msr cpsr_c, #0xd2
ldr sp, =irq_stack
/* Switch to supervisor mode, enable IRQ and FIQ processing */
msr cpsr_c, #0x13
/* Switch to supervisor mode */
msr cpsr_c, #0xd3
ldr sp, =stackend
bl main
/* main() should never return */

View file

@ -294,4 +294,38 @@ void adc_init(void)
}
#elif CONFIG_CPU == PNX0101
static unsigned short adcdata[NUM_ADC_CHANNELS];
unsigned short adc_read(int channel)
{
return adcdata[channel];
}
static void adc_tick(void)
{
if (ADCST & 0x10) {
adcdata[0] = ADCCH0 & 0x3ff;
adcdata[1] = ADCCH1 & 0x3ff;
adcdata[2] = ADCCH2 & 0x3ff;
adcdata[3] = ADCCH3 & 0x3ff;
adcdata[4] = ADCCH4 & 0x3ff;
ADCST = 0xa;
}
}
void adc_init(void)
{
ADCR24 = 0xaaaaa;
ADCR28 = 0;
ADCST = 2;
ADCST = 0xa;
while (!(ADCST & 0x10));
adc_tick();
tick_add_task(adc_tick);
}
#endif

View file

@ -61,7 +61,7 @@ static bool flipped; /* buttons can be flipped to match the LCD flip */
#define REPEAT_INTERVAL_FINISH 5
/* the power-off button and number of repeated keys before shutting off */
#if CONFIG_KEYPAD == IPOD_4G_PAD
#if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD)
#define POWEROFF_BUTTON BUTTON_PLAY
#define POWEROFF_COUNT 40
#else
@ -731,6 +731,47 @@ static int button_read(void)
if (!remote_hold_button && ((data & 0x40) == 0))
btn |= BUTTON_RC_ON;
#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
static bool hold_button = false;
/* light handling */
if (hold_button && !button_hold())
{
backlight_on();
}
hold_button = button_hold();
/* normal buttons */
if (!button_hold())
{
data = adc_read(ADC_BUTTONS);
if (data < 0x151)
if (data < 0xc7)
if (data < 0x41)
btn = BUTTON_LEFT;
else
btn = BUTTON_RIGHT;
else
btn = BUTTON_SELECT;
else
if (data < 0x268)
if (data < 0x1d7)
btn = BUTTON_UP;
else
btn = BUTTON_DOWN;
else
if (data < 0x2f9)
btn = BUTTON_EQ;
else
if (data < 0x35c)
btn = BUTTON_MODE;
}
if (!button_hold() && (adc_read(ADC_BUTTON_PLAY) < 0x64))
btn |= BUTTON_PLAY;
#elif CONFIG_KEYPAD == RECORDER_PAD
#ifdef HAVE_FMADC
@ -877,6 +918,13 @@ bool remote_button_hold(void)
}
#endif
#if CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
bool button_hold(void)
{
return (GPIO5_READ & 4) ? false : true;
}
#endif
int button_status(void)
{
return lastbtn;

View file

@ -135,6 +135,24 @@ void lcd_write_data( const unsigned char* data, int count ) {
P2 |= 0x20;
}
}
#elif CONFIG_CPU == PNX0101
void lcd_write_command(int cmd)
{
while ((LCDSTAT & 3) != 3);
LCDCMD = cmd;
}
void lcd_write_data( const unsigned char* data, int count )
{
int i;
for (i=0; i < count; i++) {
while ((LCDSTAT & 3) != 3);
LCDDATA = data[i];
}
}
#endif
/*** hardware configuration ***/
@ -145,6 +163,8 @@ int lcd_default_contrast(void)
return 30;
#elif CONFIG_LCD == LCD_GMINI100
return 31;
#elif CONFIG_LCD == LCD_IFP7XX
return 45;
#else
return (read_hw_mask() & LCD_CONTRAST_BIAS) ? 31 : 49;
#endif
@ -197,7 +217,11 @@ void lcd_set_flip(bool yesno)
{
lcd_write_command(LCD_SET_SEGMENT_REMAP | 0x01);
lcd_write_command(LCD_SET_COM_OUTPUT_SCAN_DIRECTION | 0x08);
#if CONFIG_LCD == LCD_IFP7XX
xoffset = 4;
#else
xoffset = 0;
#endif
}
#endif
}
@ -236,6 +260,9 @@ void lcd_init(void)
P2CONL |= 0x5a;
P2CONL &= 0x5b;
P2CONH |= 1;
#elif CONFIG_CPU == PNX0101
LCDREG10 = 0xf;
LCDREG04 = 0x4084;
#else
/* Initialize PB0-3 as output pins */
PBCR2 &= 0xff00; /* MD = 00 */
@ -245,7 +272,11 @@ void lcd_init(void)
/* inits like the original firmware */
lcd_write_command(LCD_SOFTWARE_RESET);
lcd_write_command(LCD_SET_INTERNAL_REGULATOR_RESISTOR_RATIO + 4);
#if CONFIG_LCD == LCD_IFP7XX
lcd_write_command(LCD_SET_LCD_BIAS);
#else
lcd_write_command(LCD_SET_1OVER4_BIAS_RATIO + 0); /* force 1/4 bias: 0 */
#endif
lcd_write_command(LCD_SET_POWER_CONTROL_REGISTER + 7);
/* power control register: op-amp=1, regulator=1, booster=1 */
lcd_write_command(LCD_SET_DISPLAY_ON);

View file

@ -182,6 +182,8 @@ void ide_power_enable(bool on)
P1 |= 0x08;
else
P1 &= ~0x08;
#elif CONFIG_CPU == PNX0101
/* no ide controller */
#else /* SH1 based archos */
bool touched = false;
#ifdef NEEDS_ATA_POWER_ON
@ -266,6 +268,9 @@ void power_off(void)
/* We don't turn off the ipod, we put it in a deep sleep */
pcf50605_standby_mode();
#endif
#elif CONFIG_CPU == PNX0101
GPIO1_CLR = 1 << 16;
GPIO2_SET = 1;
#elif defined(GMINI_ARCH)
P1 &= ~1;
P1CON &= ~1;

View file

@ -27,8 +27,9 @@
#include "lcd.h"
#include "serial.h"
#if (CONFIG_CPU != MCF5249) && (CONFIG_CPU != TCC730) && (CONFIG_CPU != PP5020)
#if (CONFIG_CPU != MCF5249) && (CONFIG_CPU != TCC730) && (CONFIG_CPU != PP5020) && (CONFIG_CPU != PNX0101)
/* FIX: this doesn't work on iRiver or Gmini or iPod yet */
/* iFP7xx has no remote */
#ifndef HAVE_MMC /* MMC takes serial port 1, so don't mess with it */

View file

@ -29,6 +29,15 @@
#define ADC_BATTERY 2
#define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */
#elif defined(IRIVER_IFP7XX)
#define NUM_ADC_CHANNELS 5
#define ADC_BUTTONS 0
#define ADC_BATTERY 1
#define ADC_BUTTON_PLAY 2
#define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */
#else
#define NUM_ADC_CHANNELS 8

View file

@ -45,6 +45,10 @@ bool button_hold(void);
bool remote_button_hold(void);
#endif
#if CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
bool button_hold(void);
#endif
#define BUTTON_NONE 0x0000
/* Shared button codes */
@ -159,6 +163,15 @@ bool remote_button_hold(void);
#define BUTTON_SCROLL_FWD 0x0010
#define BUTTON_SCROLL_BACK 0x0020
#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
#define BUTTON_PLAY 0x0001
#define BUTTON_EQ 0x0002
#define BUTTON_MODE 0x0004
#define BUTTON_UP 0x0010
#define BUTTON_DOWN 0x0020
#define BUTTON_SELECT 0x0100
#endif /* RECORDER/PLAYER/ONDIO/GMINI KEYPAD */
#endif /* _BUTTON_H_ */

View file

@ -0,0 +1,96 @@
/*
* This config file is for iriver iFP-799
*/
#define IRIVER_IFP7XX_SERIES 1
/* For Rolo and boot loader */
#define MODEL_NUMBER 6
/* define this if you have recording possibility */
/*#define HAVE_RECORDING 1*/
/* define this if you have a bitmap LCD display */
#define HAVE_LCD_BITMAP 1
/* define this if you have a colour LCD */
/* #define HAVE_LCD_COLOR 1 */
/* LCD dimensions */
#define LCD_WIDTH 128
#define LCD_HEIGHT 64
#define LCD_DEPTH 1
#define CONFIG_KEYPAD IRIVER_IFP7XX_PAD
#define CONFIG_FLASH FLASH_IFP7XX
#define HAVE_FAT16SUPPORT
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
/* The number of bytes reserved for loadable codecs */
#define CODEC_SIZE 0x30000
/* The number of bytes reserved for loadable plugins */
#define PLUGIN_BUFFER_SIZE 0x20000
/* Define this if you have the WM8975 audio codec */
/* #define HAVE_WM8975 */
#define HAVE_FLASH_DISK
#ifndef SIMULATOR
/* Define this if you have a Philips PNX0101 */
#define CONFIG_CPU PNX0101
/* Define this if you want to use the PNX0101 i2c interface */
#define CONFIG_I2C I2C_PNX0101
/* Type of mobile power */
//#define CONFIG_BATTERY BATT_LIPOL1300
#define BATTERY_SCALE_FACTOR 16665 /* FIX: this value is picked at random */
/* Define this if the platform can charge batteries */
//#define HAVE_CHARGING 1
/* define this if the hardware can be powered off while charging */
//#define HAVE_POWEROFF_WHILE_CHARGING
/* The start address index for ROM builds */
#define ROM_START 0x00000000
/* Define this for LCD backlight available */
#define CONFIG_BACKLIGHT BL_IRIVER_IFP7XX /* port controlled */
/* Define this to the CPU frequency */
#define CPU_FREQ 30000000
#define CONFIG_LCD LCD_IFP7XX
/* Offset ( in the firmware file's header ) to the file length */
#define FIRMWARE_OFFSET_FILE_LENGTH 0
/* Offset ( in the firmware file's header ) to the file CRC */
#define FIRMWARE_OFFSET_FILE_CRC 0
/* Offset ( in the firmware file's header ) to the real data */
#define FIRMWARE_OFFSET_FILE_DATA 8
#define USB_ISP1582
/* Virtual LED (icon) */
#define CONFIG_LED LED_VIRTUAL
/* Define this if you have adjustable CPU frequency */
//#define HAVE_ADJUSTABLE_CPU_FREQ
#define BOOTFILE_EXT "iriver"
#define BOOTFILE "rockbox." BOOTFILE_EXT
#endif

View file

@ -41,6 +41,7 @@
#define TCC730 730 /* lacking a proper abbrivation */
#define PP5002 5002
#define PP5020 5020
#define PNX0101 101
/* CONFIG_KEYPAD */
#define PLAYER_PAD 0
@ -51,6 +52,7 @@
#define IRIVER_H300_PAD 5
#define IAUDIO_X5_PAD 6
#define IPOD_4G_PAD 7
#define IRIVER_IFP7XX_PAD 8
/* CONFIG_REMOTE_KEYPAD */
#define H100_REMOTE 1
@ -75,6 +77,7 @@
#define LCD_IPODCOLOR 6 /* as used by iPod Color/Photo */
#define LCD_IPODNANO 7 /* as used by iPod Nano */
#define LCD_IPODVIDEO 8 /* as used by iPod Video */
#define LCD_IFP7XX 9 /* as used by iRiver iFP 7xx/8xx */
/* LCD_PIXELFORMAT */
#define RGB565 565
@ -89,6 +92,7 @@
#define BL_IPOD4G 5 /* Apple iPod 4G */
#define BL_IPODNANO 6 /* Apple iPod Nano and iPod Video*/
#define BL_IRIVER_H300 7 /* IRiver PWM */
#define BL_IRIVER_IFP7XX 8 /* IRiver GPIO */
/* CONFIG_I2C */
#define I2C_PLAYREC 0 /* Archos Player/Recorder style */
@ -96,11 +100,15 @@
#define I2C_GMINI 2 /* Gmini style */
#define I2C_COLDFIRE 3 /* Coldfire style */
#define I2C_PP5020 4 /* PP5020 style */
#define I2C_PNX0101 5 /* PNX0101 style */
/* CONFIG_LED */
#define LED_REAL 1 /* SW controlled LED (Archos recorders, player, Gmini) */
#define LED_VIRTUAL 2 /* Virtual LED (icon) (Archos Ondio) */
/* CONFIG_FLASH */
#define FLASH_IFP7XX 1
/* CONFIG_RTC */
#define RTC_M41ST84W 1 /* Archos Recorder */
#define RTC_PCF50605 2 /* iPod 4G */
@ -139,6 +147,8 @@
#include "config-ipodnano.h"
#elif defined(IPOD_VIDEO)
#include "config-ipodvideo.h"
#elif defined(IRIVER_IFP7XX)
#include "config-ifp7xx.h"
#else
/* no known platform */
#endif
@ -156,7 +166,7 @@
#endif
/* define for all cpus from ARM family */
#if (CONFIG_CPU == PP5020)
#if (CONFIG_CPU == PP5020) || (CONFIG_CPU == PNX0101)
#define CPU_ARM
#endif

View file

@ -33,3 +33,6 @@
#if CONFIG_CPU == PP5020
#include "pp5020.h"
#endif
#if CONFIG_CPU == PNX0101
#include "pnx0101.h"
#endif

67
firmware/export/pnx0101.h Normal file
View file

@ -0,0 +1,67 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2005 by Tomasz Malesinski
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef __PNX0101_H__
#define __PNX0101_H__
#define GPIO0_READ (*(volatile unsigned long *)0x80003000)
#define GPIO0_SET (*(volatile unsigned long *)0x80003014)
#define GPIO0_CLR (*(volatile unsigned long *)0x80003018)
#define GPIO1_READ (*(volatile unsigned long *)0x80003040)
#define GPIO1_SET (*(volatile unsigned long *)0x80003054)
#define GPIO1_CLR (*(volatile unsigned long *)0x80003058)
#define GPIO2_READ (*(volatile unsigned long *)0x80003080)
#define GPIO2_SET (*(volatile unsigned long *)0x80003094)
#define GPIO2_CLR (*(volatile unsigned long *)0x80003098)
#define GPIO3_READ (*(volatile unsigned long *)0x800030c0)
#define GPIO3_SET (*(volatile unsigned long *)0x800030d4)
#define GPIO3_CLR (*(volatile unsigned long *)0x800030d8)
#define GPIO4_READ (*(volatile unsigned long *)0x80003100)
#define GPIO4_SET (*(volatile unsigned long *)0x80003114)
#define GPIO4_CLR (*(volatile unsigned long *)0x80003118)
#define GPIO5_READ (*(volatile unsigned long *)0x80003140)
#define GPIO5_SET (*(volatile unsigned long *)0x80003154)
#define GPIO5_CLR (*(volatile unsigned long *)0x80003158)
#define GPIO6_READ (*(volatile unsigned long *)0x80003180)
#define GPIO6_SET (*(volatile unsigned long *)0x80003194)
#define GPIO6_CLR (*(volatile unsigned long *)0x80003198)
#define GPIO7_READ (*(volatile unsigned long *)0x800031c0)
#define GPIO7_SET (*(volatile unsigned long *)0x800031d4)
#define GPIO7_CLR (*(volatile unsigned long *)0x800031d8)
#define LCDREG04 (*(volatile unsigned long *)0x80104004)
#define LCDSTAT (*(volatile unsigned long *)0x80104008)
#define LCDREG10 (*(volatile unsigned long *)0x80104010)
#define LCDCMD (*(volatile unsigned long *)0x80104020)
#define LCDDATA (*(volatile unsigned long *)0x80104030)
#define TIMERR00 (*(volatile unsigned long *)0x80020000)
#define TIMERR08 (*(volatile unsigned long *)0x80020008)
#define TIMERR0C (*(volatile unsigned long *)0x8002000c)
#define ADCCH0 (*(volatile unsigned long *)0x80002400)
#define ADCCH1 (*(volatile unsigned long *)0x80002404)
#define ADCCH2 (*(volatile unsigned long *)0x80002408)
#define ADCCH3 (*(volatile unsigned long *)0x8000240c)
#define ADCCH4 (*(volatile unsigned long *)0x80002410)
#define ADCST (*(volatile unsigned long *)0x80002420)
#define ADCR24 (*(volatile unsigned long *)0x80002424)
#define ADCR28 (*(volatile unsigned long *)0x80002428)
#endif

View file

@ -299,7 +299,7 @@ static inline void invalidate_icache(void)
#define CPUFREQ_MAX_MULT 11
#define CPUFREQ_MAX (CPUFREQ_MAX_MULT * CPU_FREQ)
#elif CONFIG_CPU == PP5020
#elif defined(CPU_ARM)
/* TODO: Implement set_irq_level and check CPU frequencies */
@ -330,14 +330,26 @@ static inline unsigned long swap32(unsigned long value)
}
#define HIGHEST_IRQ_LEVEL (1)
static inline int set_irq_level(int level)
{
int result=level;
return result;
unsigned long cpsr;
/* Read the old level and set the new one */
asm volatile ("mrs %0,cpsr" : "=r" (cpsr));
asm volatile ("msr cpsr_c,%0"
: : "r" ((cpsr & ~0x80) | (level << 7)));
return (cpsr >> 7) & 1;
}
#define invalidate_icache()
#if CONFIG_CPU == PNX0101
typedef void (*interrupt_handler_t)(void);
void irq_set_int_handler(int n, interrupt_handler_t handler);
void irq_enable_int(int n);
#endif
#elif CONFIG_CPU == TCC730
extern int smsc_version(void);

View file

@ -358,6 +358,41 @@ void tick_start(unsigned int interval_in_ms)
#endif
}
#elif CONFIG_CPU == PNX0101
void timer_handler(void)
{
int i;
/* Run through the list of tick tasks */
for(i = 0;i < MAX_NUM_TICK_TASKS;i++)
{
if(tick_funcs[i])
tick_funcs[i]();
}
current_tick++;
wake_up_thread();
TIMERR0C = 1;
}
void tick_start(unsigned int interval_in_ms)
{
TIMERR08 &= ~0x80;
TIMERR0C = 1;
TIMERR08 &= ~0x80;
TIMERR08 |= 0x40;
TIMERR00 = 3000000 * interval_in_ms / 1000;
TIMERR08 &= ~0xc;
TIMERR0C = 1;
irq_set_int_handler(4, timer_handler);
irq_enable_int(4);
TIMERR08 |= 0x80;
}
#endif
int tick_add_task(void (*f)(void))

View file

@ -487,4 +487,55 @@ long pcm_get_bytes_waiting(void)
return 0;
}
#elif CONFIG_CPU == PNX0101
/* TODO: Implement for iFP7xx
For now, just implement some dummy functions.
*/
void pcm_init(void)
{
}
void pcm_set_frequency(unsigned int frequency)
{
(void)frequency;
}
void pcm_play_data(void (*get_more)(unsigned char** start, long* size))
{
(void)get_more;
}
void pcm_play_stop(void)
{
}
void pcm_play_pause(bool play)
{
(void)play;
}
bool pcm_is_paused(void)
{
return false;
}
bool pcm_is_playing(void)
{
return false;
}
void pcm_calculate_peaks(int *left, int *right)
{
(void)left;
(void)right;
}
long pcm_get_bytes_waiting(void)
{
return 0;
}
#endif

View file

@ -1191,5 +1191,86 @@ int system_memory_guard(int newmode)
return 0;
}
#elif CONFIG_CPU==PNX0101
interrupt_handler_t interrupt_vector[0x1d] __attribute__ ((section(".idata")));
#define IRQ_REG(reg) (*(volatile unsigned long *)(0x80300000 + (reg)))
static inline unsigned long irq_read(int reg)
{
unsigned long v, v2;
do
{
v = IRQ_REG(reg);
v2 = IRQ_REG(reg);
} while (v != v2);
return v;
}
#define IRQ_WRITE_WAIT(reg, val, cond) \
do { unsigned long v, v2; \
do { \
IRQ_REG(reg) = (val); \
v = IRQ_REG(reg); \
v2 = IRQ_REG(reg); \
} while ((v != v2) || !(cond)); \
} while (0);
static void UIE(void) {}
void irq(void)
{
int n = irq_read(0x100) >> 3;
(*(interrupt_vector[n]))();
}
void irq_enable_int(int n)
{
IRQ_WRITE_WAIT(0x404 + n * 4, 0x4010000, v & 0x10000);
}
void irq_set_int_handler(int n, interrupt_handler_t handler)
{
interrupt_vector[n + 1] = handler;
}
void system_init(void)
{
int i;
/* turn off watchdog */
(*(volatile unsigned long *)0x80002804) = 0;
/*
IRQ_WRITE_WAIT(0x100, 0, v == 0);
IRQ_WRITE_WAIT(0x104, 0, v == 0);
IRQ_WRITE_WAIT(0, 0, v == 0);
IRQ_WRITE_WAIT(4, 0, v == 0);
*/
for (i = 0; i < 0x1c; i++)
{
IRQ_WRITE_WAIT(0x404 + i * 4, 0x1e000001, (v & 0x3010f) == 1);
IRQ_WRITE_WAIT(0x404 + i * 4, 0x4000000, (v & 0x10000) == 0);
IRQ_WRITE_WAIT(0x404 + i * 4, 0x10000001, (v & 0xf) == 1);
interrupt_vector[i + 1] = UIE;
}
interrupt_vector[0] = UIE;
}
void system_reboot(void)
{
(*(volatile unsigned long *)0x80002804) = 1;
while (1);
}
int system_memory_guard(int newmode)
{
(void)newmode;
return 0;
}
#endif /* CONFIG_CPU */

View file

@ -326,7 +326,7 @@ int create_thread(void (*function)(void), void* stack, int stack_size,
thread_stack[num_threads] = stack;
thread_stack_size[num_threads] = stack_size;
regs = &thread_contexts[num_threads];
#if defined(CPU_COLDFIRE) || (CONFIG_CPU == SH7034) || (CONFIG_CPU == PP5020)
#if defined(CPU_COLDFIRE) || (CONFIG_CPU == SH7034) || defined(CPU_ARM)
/* Align stack to an even 32 bit boundary */
regs->sp = (void*)(((unsigned int)stack + stack_size) & ~3);
#elif CONFIG_CPU == TCC730

View file

@ -180,6 +180,9 @@ void usb_enable(bool on)
outl(1, 0x40017F10);
outl(inl(0x60006004) | 0x4, 0x60006004);
}
#elif defined(USB_ISP1582)
/* TODO: Implement USB_ISP1582 */
(void) on;
#else
#ifdef HAVE_LCD_BITMAP
if(read_hw_mask() & USB_ACTIVE_HIGH)
@ -403,6 +406,10 @@ bool usb_detect(void)
return false;
}
current_status = (USB_STATUS & 0x800)?true:false;
#endif
#ifdef USB_ISP1582
/* TODO: Implement USB_ISP1582 */
current_status = false;
#endif
return current_status;
}