diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2008-11-10 11:04:43 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2008-11-10 11:04:43 +0000 |
commit | 6b566568ebdb9e06a0f007606cce98ac996d541a (patch) | |
tree | 00808daafeee2b419ad12c3306d0a02b29c2ff35 /firmware/target/arm | |
parent | b52a3da2b5ad0ee7d7061af863f0acd33d327292 (diff) |
Fix Clip firmware building by adding missing symbols
Implement some of the new functions
Use as3514 rtc
Add AS3525 case in rolo.c
Copy card_get_info_target() from ata-sd-pp.c , and use the correct 32bits words order
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19064 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm')
-rw-r--r-- | firmware/target/arm/as3525/adc-as3525.c | 33 | ||||
-rw-r--r-- | firmware/target/arm/as3525/ata_sd_as3525.c | 60 | ||||
-rw-r--r-- | firmware/target/arm/as3525/audio-as3525.c | 38 | ||||
-rw-r--r-- | firmware/target/arm/as3525/debug-as3525.c | 35 | ||||
-rw-r--r-- | firmware/target/arm/as3525/debug-target.h | 25 | ||||
-rw-r--r-- | firmware/target/arm/as3525/i2c-as3525.c | 28 | ||||
-rw-r--r-- | firmware/target/arm/as3525/i2s-as3525.c | 28 | ||||
-rw-r--r-- | firmware/target/arm/as3525/pcm-as3525.c | 76 | ||||
-rw-r--r-- | firmware/target/arm/as3525/power-as3525.c | 59 | ||||
-rw-r--r-- | firmware/target/arm/as3525/powermgmt-as3525.c | 56 | ||||
-rw-r--r-- | firmware/target/arm/as3525/system-as3525.c | 16 | ||||
-rw-r--r-- | firmware/target/arm/as3525/usb-as3525.c | 41 |
12 files changed, 486 insertions, 9 deletions
diff --git a/firmware/target/arm/as3525/adc-as3525.c b/firmware/target/arm/as3525/adc-as3525.c new file mode 100644 index 0000000000..6e1aac5a65 --- /dev/null +++ b/firmware/target/arm/as3525/adc-as3525.c @@ -0,0 +1,33 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright © 2008 Rafaël Carré + * + * 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 "adc.h" + +/* TODO */ + +unsigned short adc_read(int channel) +{ + return 0; +} + +void adc_init(void) +{ +} diff --git a/firmware/target/arm/as3525/ata_sd_as3525.c b/firmware/target/arm/as3525/ata_sd_as3525.c index 25052de826..6722e8e94a 100644 --- a/firmware/target/arm/as3525/ata_sd_as3525.c +++ b/firmware/target/arm/as3525/ata_sd_as3525.c @@ -616,6 +616,7 @@ sd_read_error: } } +#ifndef BOOTLOADER void sd_sleep(void) { } @@ -628,3 +629,62 @@ void sd_spindown(int seconds) { (void)seconds; } + +long sd_last_disk_activity(void) +{ + return last_disk_activity; +} + +void sd_enable(bool on) +{ + if(on) + { + CGU_PERI |= CGU_NAF_CLOCK_ENABLE; +#ifdef HAVE_MULTIVOLUME + CGU_PERI |= CGU_MCI_CLOCK_ENABLE; +#endif + CGU_IDE |= (1<<7) /* AHB interface enable */ | + (1<<6) /* interface enable */; + } + else + { + CGU_PERI &= ~CGU_NAF_CLOCK_ENABLE; +#ifdef HAVE_MULTIVOLUME + CGU_PERI &= ~CGU_MCI_CLOCK_ENABLE; +#endif + CGU_IDE &= ~((1<<7)|(1<<6)); + } +} + +/* move the sd-card info to mmc struct */ +tCardInfo *card_get_info_target(int card_no) +{ + int i, temp; + static tCardInfo card; + static const char mantissa[] = { /* *10 */ + 0, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80 }; + static const int exponent[] = { /* use varies */ + 1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000 }; + + card.initialized = card_info[card_no].initialized; + card.ocr = card_info[card_no].ocr; + for(i=0; i<4; i++) card.csd[i] = card_info[card_no].csd[i]; + for(i=0; i<4; i++) card.cid[i] = card_info[card_no].cid[i]; + card.numblocks = card_info[card_no].numblocks; + card.blocksize = card_info[card_no].block_size; + temp = card_extract_bits(card.csd, 29, 3); + card.speed = mantissa[card_extract_bits(card.csd, 25, 4)] + * exponent[temp > 2 ? 7 : temp + 4]; + card.nsac = 100 * card_extract_bits(card.csd, 16, 8); + temp = card_extract_bits(card.csd, 13, 3); + card.tsac = mantissa[card_extract_bits(card.csd, 9, 4)] + * exponent[temp] / 10; + card.cid[0] = htobe32(card.cid[0]); /* ascii chars here */ + card.cid[1] = htobe32(card.cid[1]); /* ascii chars here */ + temp = *((char*)card.cid+13); /* adjust year<=>month, 1997 <=> 2000 */ + *((char*)card.cid+13) = (unsigned char)((temp >> 4) | (temp << 4)) + 3; + + return &card; +} + +#endif /* BOOTLOADER */ diff --git a/firmware/target/arm/as3525/audio-as3525.c b/firmware/target/arm/as3525/audio-as3525.c new file mode 100644 index 0000000000..d88fd1b5ec --- /dev/null +++ b/firmware/target/arm/as3525/audio-as3525.c @@ -0,0 +1,38 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright © 2008 Rafaël Carré + * + * 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 "system.h" +#include "cpu.h" +#include "audio.h" +#include "sound.h" + +/* TODO */ + +void audiohw_enable_output(bool on) +{ +} + +void audio_set_output_source(int source) +{ +} + +void audio_input_mux(int source, unsigned flags) +{ +} diff --git a/firmware/target/arm/as3525/debug-as3525.c b/firmware/target/arm/as3525/debug-as3525.c new file mode 100644 index 0000000000..8a2f8838d6 --- /dev/null +++ b/firmware/target/arm/as3525/debug-as3525.c @@ -0,0 +1,35 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright © 2008 Rafaël Carré + * + * 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 <stdbool.h> +#include "debug-target.h" + +/* TODO */ + +bool __dbg_ports(void) +{ + return false; +} + +bool __dbg_hw_info(void) +{ + return false; +} diff --git a/firmware/target/arm/as3525/debug-target.h b/firmware/target/arm/as3525/debug-target.h new file mode 100644 index 0000000000..d3b7a28aee --- /dev/null +++ b/firmware/target/arm/as3525/debug-target.h @@ -0,0 +1,25 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2007 by Karl Kurbjun + * + * 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 <stdbool.h> + +bool __dbg_hw_info(void); +bool __dbg_ports(void); diff --git a/firmware/target/arm/as3525/i2c-as3525.c b/firmware/target/arm/as3525/i2c-as3525.c new file mode 100644 index 0000000000..32f33435bc --- /dev/null +++ b/firmware/target/arm/as3525/i2c-as3525.c @@ -0,0 +1,28 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright © 2008 Rafaël Carré + * + * 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 "i2c.h" + +/* TODO */ + +void i2c_init(void) +{ +} diff --git a/firmware/target/arm/as3525/i2s-as3525.c b/firmware/target/arm/as3525/i2s-as3525.c new file mode 100644 index 0000000000..298788e796 --- /dev/null +++ b/firmware/target/arm/as3525/i2s-as3525.c @@ -0,0 +1,28 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright © 2008 Rafaël Carré + * + * 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 "i2s.h" + +/* TODO */ + +void i2s_reset(void) +{ +} diff --git a/firmware/target/arm/as3525/pcm-as3525.c b/firmware/target/arm/as3525/pcm-as3525.c new file mode 100644 index 0000000000..e2c31ad047 --- /dev/null +++ b/firmware/target/arm/as3525/pcm-as3525.c @@ -0,0 +1,76 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright © 2008 Rafaël Carré + * + * 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 "system.h" +#include "audio.h" +#include "string.h" + +/* TODO */ + +void pcm_play_lock(void) +{ +} + +void pcm_play_unlock(void) +{ +} + +void pcm_play_dma_start(const void *addr, size_t size) +{ +} + +void pcm_play_dma_stop(void) +{ +} + +void pcm_play_dma_pause(bool pause) +{ +} + +unsigned long physical_address(void *p) +{ + return 0; +} + +void pcm_play_dma_init(void) +{ +} + +void pcm_postinit(void) +{ +} + +void pcm_set_frequency(unsigned int frequency) +{ +} + +void pcm_apply_settings(void) +{ +} + +size_t pcm_get_bytes_waiting(void) +{ + return 0; +} + +const void * pcm_play_dma_get_peak_buffer(int *count) +{ + return NULL; +} diff --git a/firmware/target/arm/as3525/power-as3525.c b/firmware/target/arm/as3525/power-as3525.c new file mode 100644 index 0000000000..3d191ec3b5 --- /dev/null +++ b/firmware/target/arm/as3525/power-as3525.c @@ -0,0 +1,59 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright © 2008 Rafaël Carré + * + * 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 "as3525-codec.h" +#include <stdbool.h> + +void power_off(void) +{ + /* clear bit 0 of system register */ + ascodec_write(0x20, ascodec_read(0x20) & ~1); + + /* TODO : turn off peripherals properly ? */ + + while(1); /* wait for system to shut down */ +} + +void power_init(void) +{ +} + +bool charger_inserted(void) +{ + if(ascodec_read(0x25) & (1<<5)) + return true; + else + return false; +} + +void ide_power_enable(bool on) +{ + (void)on; +} + +#if CONFIG_TUNER +bool tuner_power(bool status) +{ + (void)status; + return false; +} +#endif diff --git a/firmware/target/arm/as3525/powermgmt-as3525.c b/firmware/target/arm/as3525/powermgmt-as3525.c new file mode 100644 index 0000000000..ac1ee79f00 --- /dev/null +++ b/firmware/target/arm/as3525/powermgmt-as3525.c @@ -0,0 +1,56 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright © 2008 Rafaël Carré + * + * 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 "adc.h" +#include "powermgmt.h" + +/* TODO */ + +const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = +{ + 0 +}; + +const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = +{ + 0 +}; + +/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ +const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = +{ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +}; + +#if CONFIG_CHARGING +/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ +const unsigned short percent_to_volt_charge[11] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 +}; +#endif /* CONFIG_CHARGING */ + +/* Returns battery voltage from ADC [millivolts] */ +unsigned int battery_adc_voltage(void) +{ + return 1; +} diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c index e79dd460fa..07832f1a49 100644 --- a/firmware/target/arm/as3525/system-as3525.c +++ b/firmware/target/arm/as3525/system-as3525.c @@ -252,14 +252,12 @@ int system_memory_guard(int newmode) return 0; } -void power_off(void) -{ - int system; - system = ascodec_read(0x20); - system &= ~1; /* clear bit 0 of system register */ - ascodec_write(0x20, system); - - /* TODO : turn off peripherals properly ? */ +#ifndef BOOTLOADER - while(1); +#ifdef HAVE_ADJUSTABLE_CPU_FREQ +void set_cpu_frequency(long frequency) +{ + /* TODO */ } +#endif /* HAVE_ADJUSTABLE_CPU_FREQ */ +#endif /* BOOTLOADER */ diff --git a/firmware/target/arm/as3525/usb-as3525.c b/firmware/target/arm/as3525/usb-as3525.c new file mode 100644 index 0000000000..c9a6381b38 --- /dev/null +++ b/firmware/target/arm/as3525/usb-as3525.c @@ -0,0 +1,41 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright © 2008 Rafaël Carré + * + * 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 "usb.h" +#include "power.h" +#include <stdbool.h> + +void usb_enable(bool on) +{ + (void)on; +} + +void usb_init_device(void) +{ + /* TODO */ +} + +int usb_detect(void) +{ + if (charger_inserted()) + return USB_INSERTED; + return USB_EXTRACTED; +} |