diff --git a/firmware/SOURCES b/firmware/SOURCES index 2564a88812..859ae24920 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -336,7 +336,19 @@ target/arm/pnx0101/system-pnx0101.c target/arm/as3525/system-as3525.c target/arm/as3525/kernel-as3525.c target/arm/as3525/ata_sd_as3525.c -#endif +target/arm/as3525/power-as3525.c +target/arm/as3525/usb-as3525.c +#ifndef BOOTLOADER +target/arm/as3525/adc-as3525.c +target/arm/as3525/pcm-as3525.c +target/arm/as3525/audio-as3525.c +target/arm/as3525/debug-as3525.c +target/arm/as3525/i2s-as3525.c +target/arm/as3525/i2c-as3525.c +drivers/rtc/rtc_as3514.c +target/arm/as3525/powermgmt-as3525.c +#endif /* BOOTLOADER */ +#endif /* CONFIG_CPU == AS3525 */ #if defined(CPU_PP) target/arm/kernel-pp.c diff --git a/firmware/export/config-clip.h b/firmware/export/config-clip.h index 9bc4a14bf5..17d975f49d 100644 --- a/firmware/export/config-clip.h +++ b/firmware/export/config-clip.h @@ -9,6 +9,8 @@ #define FIRMWARE_OFFSET_FILE_DATA 8 #define FIRMWARE_OFFSET_FILE_CRC 0 +#if 0 /* disabled since there is no driver (yet) */ + #define HW_SAMPR_CAPS (SAMPR_CAP_44) /* define this if you have recording possibility */ @@ -23,6 +25,8 @@ explicitly if different */ #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_FMRADIO) +#endif + /* define this if you have a bitmap LCD display */ #define HAVE_LCD_BITMAP @@ -93,8 +97,10 @@ #define AB_REPEAT_ENABLE 1 /* FM Tuner */ +#if 0 /* disabled since there is no driver (yet) */ #define CONFIG_TUNER SI4700 /* in fact SI4702 but let's hope it's compatible */ //#define HAVE_TUNER_PWR_CTRL +#endif /* Define this for LCD backlight available */ #define HAVE_BACKLIGHT diff --git a/firmware/rolo.c b/firmware/rolo.c index 9724db2306..6a3fcd2bbb 100644 --- a/firmware/rolo.c +++ b/firmware/rolo.c @@ -230,7 +230,8 @@ int rolo_load(const char* filename) length = filesize(fd) - FIRMWARE_OFFSET_FILE_DATA; #if defined(CPU_COLDFIRE) || defined(CPU_PP) || (CONFIG_CPU==DM320) \ - || defined(CPU_TCC780X) || (CONFIG_CPU==IMX31L) || (CONFIG_CPU == S3C2440) + || defined(CPU_TCC780X) || (CONFIG_CPU==IMX31L) || (CONFIG_CPU == S3C2440) \ + || (CONFIG_CPU==AS3525) /* Read and save checksum */ lseek(fd, FIRMWARE_OFFSET_FILE_CRC, SEEK_SET); if (read(fd, &file_checksum, 4) != 4) { 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 +#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 + +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 + +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) +#ifndef BOOTLOADER + +#ifdef HAVE_ADJUSTABLE_CPU_FREQ +void set_cpu_frequency(long frequency) { - int system; - system = ascodec_read(0x20); - system &= ~1; /* clear bit 0 of system register */ - ascodec_write(0x20, system); - - /* TODO : turn off peripherals properly ? */ - - while(1); + /* 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 + +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; +}