summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2009-09-17 07:26:08 +0000
committerDave Chapman <dave@dchapman.com>2009-09-17 07:26:08 +0000
commit8dae933293223e28648ec72ac818ab2a98ee2482 (patch)
tree78f056b1eb6ebc7db6fa3563faaad71032c02a72 /firmware
parentf10450e44e7efdd3f4d795a795486ced1326ce75 (diff)
downloadrockbox-8dae933293223e28648ec72ac818ab2a98ee2482.tar.gz
rockbox-8dae933293223e28648ec72ac818ab2a98ee2482.tar.bz2
rockbox-8dae933293223e28648ec72ac818ab2a98ee2482.zip
Add an app.lds and some stub functions for the Nano 2G - this isn't enough to make rockbox.bin compile, but it's a step towards it (more commits coming soon).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22714 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/s5l8700/app.lds150
-rw-r--r--firmware/target/arm/s5l8700/ipodnano2g/audio-nano2g.c59
-rw-r--r--firmware/target/arm/s5l8700/ipodnano2g/power-nano2g.c56
-rw-r--r--firmware/target/arm/s5l8700/ipodnano2g/powermgmt-nano2g.c65
-rw-r--r--firmware/target/arm/s5l8700/usb-s5l8700.c47
5 files changed, 377 insertions, 0 deletions
diff --git a/firmware/target/arm/s5l8700/app.lds b/firmware/target/arm/s5l8700/app.lds
new file mode 100644
index 0000000000..812bce8cbb
--- /dev/null
+++ b/firmware/target/arm/s5l8700/app.lds
@@ -0,0 +1,150 @@
+#include "config.h"
+#include "cpu.h"
+
+ENTRY(start)
+
+OUTPUT_FORMAT(elf32-littlearm)
+OUTPUT_ARCH(arm)
+STARTUP(target/arm/s5l8700/crt0.o)
+
+#define PLUGINSIZE PLUGIN_BUFFER_SIZE
+#define CODECSIZE CODEC_SIZE
+
+#ifdef DEBUG
+#define STUBOFFSET 0x10000
+#else
+#define STUBOFFSET 0
+#endif
+
+
+#define IRAMORIG 0x0
+#define DRAMORIG 0x08000000
+
+/* End of the audio buffer, where the codec buffer starts */
+#define ENDAUDIOADDR (DRAMORIG + DRAMSIZE)
+
+#define DRAM_SIZE (MEMORYSIZE * 0x100000)
+
+#define DRAMSIZE (DRAM_SIZE - STUBOFFSET - PLUGINSIZE - CODECSIZE)
+#define CODECORIG (ENDAUDIOADDR)
+#define IRAMSIZE (0x20000)
+
+/* Where the codec buffer ends, and the plugin buffer starts */
+#define ENDADDR (ENDAUDIOADDR + CODECSIZE)
+
+MEMORY
+{
+ IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
+ DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
+}
+
+SECTIONS
+{
+ loadaddress = DRAMORIG;
+
+ .intvect : {
+ _intvectstart = . ;
+ *(.intvect)
+ _intvectend = _newstart ;
+ } >IRAM AT> DRAM
+ _intvectcopy = LOADADDR(.intvect) ;
+
+ .text :
+ {
+ _loadaddress = .;
+ _textstart = .;
+ *(.init.text)
+ *(.text)
+ *(.text*)
+ *(.glue_7)
+ *(.glue_7t)
+ . = ALIGN(0x4);
+ } > DRAM
+
+ .rodata :
+ {
+ *(.rodata*)
+ . = ALIGN(0x4);
+ } > DRAM
+
+ .data :
+ {
+ *(.data*)
+ . = ALIGN(0x4);
+ } > DRAM
+
+ /DISCARD/ :
+ {
+ *(.eh_frame)
+ }
+
+ .iram :
+ {
+ _iramstart = .;
+ *(.icode)
+ *(.irodata)
+ *(.idata)
+ . = ALIGN(0x4);
+ _iramend = .;
+ } > IRAM AT> DRAM
+ _iramcopy = LOADADDR(.iram) ;
+
+ .ibss (NOLOAD) :
+ {
+ _iedata = .;
+ *(.qharray)
+ *(.ibss)
+ . = ALIGN(0x4);
+ _iend = .;
+ } > IRAM
+
+ .stack (NOLOAD) :
+ {
+ *(.stack)
+ stackbegin = .;
+ _stackbegin = .;
+ . += 0x2000;
+ stackend = .;
+ _stackend = .;
+ _irqstackbegin = .;
+ . += 0x400;
+ _irqstackend = .;
+ _fiqstackbegin = .;
+ . += 0x400;
+ _fiqstackend = .;
+ } > IRAM
+
+ .bss (NOLOAD) :
+ {
+ _edata = .;
+ *(.bss*)
+ *(COMMON)
+ . = ALIGN(0x4);
+ _end = .;
+ } > DRAM
+
+ .audiobuf (NOLOAD) :
+ {
+ . = ALIGN(4);
+ _audiobuffer = .;
+ audiobuffer = .;
+ } > DRAM
+
+ .audiobufend ENDAUDIOADDR (NOLOAD) :
+ {
+ audiobufend = .;
+ _audiobufend = .;
+ } > DRAM
+
+ .codec CODECORIG (NOLOAD) :
+ {
+ codecbuf = .;
+ _codecbuf = .;
+ } > DRAM
+
+ .plugin ENDADDR (NOLOAD) :
+ {
+ _pluginbuf = .;
+ pluginbuf = .;
+ }
+}
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/audio-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/audio-nano2g.c
new file mode 100644
index 0000000000..fb37cf2378
--- /dev/null
+++ b/firmware/target/arm/s5l8700/ipodnano2g/audio-nano2g.c
@@ -0,0 +1,59 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2006 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.
+ *
+ ****************************************************************************/
+#include "system.h"
+#include "cpu.h"
+#include "audio.h"
+#include "sound.h"
+
+void audio_set_output_source(int source)
+{
+ if ((unsigned)source >= AUDIO_NUM_SOURCES)
+ source = AUDIO_SRC_PLAYBACK;
+} /* audio_set_output_source */
+
+void audio_input_mux(int source, unsigned flags)
+{
+ (void)flags;
+ /* Prevent pops from unneeded switching */
+ static int last_source = AUDIO_SRC_PLAYBACK;
+
+ switch (source)
+ {
+ default: /* playback - no recording */
+ source = AUDIO_SRC_PLAYBACK;
+ case AUDIO_SRC_PLAYBACK:
+ if (source != last_source)
+ {
+ audiohw_set_monitor(false);
+ audiohw_disable_recording();
+ }
+ break;
+ case AUDIO_SRC_LINEIN: /* recording only */
+ if (source != last_source)
+ {
+ audiohw_set_monitor(false);
+ audiohw_enable_recording(false); /* source line */
+ }
+ break;
+ } /* end switch */
+
+ last_source = source;
+} /* audio_input_mux */
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/power-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/power-nano2g.c
new file mode 100644
index 0000000000..aa3367b941
--- /dev/null
+++ b/firmware/target/arm/s5l8700/ipodnano2g/power-nano2g.c
@@ -0,0 +1,56 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright © 2009 Bertrik Sikken
+ *
+ * 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 "config.h"
+#include "inttypes.h"
+#include "s5l8700.h"
+#include "power.h"
+
+/* Power handling for S5L8700 based Meizu players
+
+ The M3 and M6 players appear to use the same pins for power, USB detection
+ and charging status.
+*/
+
+void power_off(void)
+{
+ /* TODO */
+ while(1);
+}
+
+void power_init(void)
+{
+ /* TODO */
+}
+
+#if CONFIG_CHARGING
+unsigned int power_input_status(void)
+{
+ /* TODO */
+ return POWER_INPUT_NONE;
+}
+
+bool charging_state(void)
+{
+ /* TODO */
+ return false;
+}
+#endif /* CONFIG_CHARGING */
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/powermgmt-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/powermgmt-nano2g.c
new file mode 100644
index 0000000000..508995c436
--- /dev/null
+++ b/firmware/target/arm/s5l8700/ipodnano2g/powermgmt-nano2g.c
@@ -0,0 +1,65 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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 "adc-target.h"
+#include "powermgmt.h"
+
+const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
+{
+ /* TODO: this is just an initial guess */
+ 3400
+};
+
+const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
+{
+ /* TODO: this is just an initial guess */
+ 3300
+};
+
+/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
+const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
+{
+ /* TODO: simple uncalibrated curve, linear except for first 10% */
+ { 3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200 }
+};
+
+#if CONFIG_CHARGING
+/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
+const unsigned short percent_to_volt_charge[11] =
+{
+ /* TODO: simple uncalibrated curve, linear except for first 10% */
+ 3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200
+};
+#endif /* CONFIG_CHARGING */
+
+/* ADC should read 0x3ff=5.12V */
+#define BATTERY_SCALE_FACTOR 5125
+/* full-scale ADC readout (2^10) in millivolt */
+
+
+/* Returns battery voltage from ADC [millivolts] */
+unsigned int battery_adc_voltage(void)
+{
+ return 4000;
+}
+
diff --git a/firmware/target/arm/s5l8700/usb-s5l8700.c b/firmware/target/arm/s5l8700/usb-s5l8700.c
new file mode 100644
index 0000000000..6ad4dcea95
--- /dev/null
+++ b/firmware/target/arm/s5l8700/usb-s5l8700.c
@@ -0,0 +1,47 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id: usb-fw-pp502x.c 21932 2009-07-17 22:07:06Z roolku $
+ *
+ * Copyright (C) 2009 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 "usb.h"
+
+void usb_init_device(void)
+{
+}
+
+void usb_enable(bool on)
+{
+ (void)on;
+}
+
+void usb_attach(void)
+{
+
+}
+
+static bool usb_pin_state(void)
+{
+ return false;
+}
+
+/* detect host or charger (INSERTED or EXTRACTED) */
+int usb_detect(void)
+{
+ return usb_pin_state() ? USB_INSERTED : USB_EXTRACTED;
+}