Index: firmware/export/config/ipodnano2g.h =================================================================== --- firmware/export/config/ipodnano2g.h (revision 29783) +++ firmware/export/config/ipodnano2g.h (working copy) @@ -15,7 +15,7 @@ /* Define bitmask of input sources - recordable bitmask can be defined explicitly if different */ -#define INPUT_SRC_CAPS (SRC_CAP_LINEIN) +#define INPUT_SRC_CAPS (SRC_CAP_LINEIN|SRC_CAP_FMRADIO) /* define the bitmask of hardware sample rates */ #define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | SAMPR_CAP_11 \ @@ -159,8 +159,8 @@ //#define HAVE_LCD_CONTRAST /* Define Apple remote tuner */ -//#define CONFIG_TUNER IPOD_REMOTE_TUNER -//#define HAVE_RDS_CAP +#define CONFIG_TUNER IPOD_REMOTE_TUNER +#define HAVE_RDS_CAP /* The exact type of CPU */ #define CONFIG_CPU S5L8701 @@ -227,8 +227,8 @@ /* Define this if you can switch on/off the accessory power supply */ #define HAVE_ACCESSORY_SUPPLY -//#define IPOD_ACCESSORY_PROTOCOL -//#define HAVE_SERIAL +#define IPOD_ACCESSORY_PROTOCOL +#define HAVE_SERIAL /* Define this, if you can switch on/off the lineout */ #define HAVE_LINEOUT_POWEROFF Index: firmware/SOURCES =================================================================== --- firmware/SOURCES (revision 29783) +++ firmware/SOURCES (working copy) @@ -1547,6 +1547,7 @@ target/arm/s5l8700/timer-s5l8700.c target/arm/s5l8700/debug-s5l8700.c target/arm/s5l8700/pcm-s5l8700.c +target/arm/s5l8700/uart-s5l8700.c target/arm/s5l8700/wmcodec-s5l8700.c target/arm/s5l8700/ipodnano2g/audio-nano2g.c target/arm/s5l8700/ipodnano2g/adc-nano2g.c Index: firmware/target/arm/s5l8700/adc-target.h =================================================================== --- firmware/target/arm/s5l8700/adc-target.h (revision 29783) +++ firmware/target/arm/s5l8700/adc-target.h (working copy) @@ -26,7 +26,7 @@ #define ADC_UNKNOWN_0 0 #define ADC_UNKNOWN_1 1 #define ADC_BATTERY 2 -#define ADC_UNKNOWN_3 3 +#define ADC_ACCESSORY 3 /* complete guess */ #define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */ Index: firmware/target/arm/s5l8700/uart-s5l8700.c =================================================================== --- firmware/target/arm/s5l8700/uart-s5l8700.c (revision 0) +++ firmware/target/arm/s5l8700/uart-s5l8700.c (revision 0) @@ -0,0 +1,120 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2011 by 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 "config.h" +#include "s5l8700.h" +#include "iap.h" +#include "serial.h" + + +/* use UART 0 */ +#define ULCON ULCON0 +#define UCON UCON0 +#define UFCON UFCON0 +#define UMCON UFCON0 +#define UTRSTAT UTRSTAT0 +#define UTXH UTXH0 +#define URXH URXH0 +#define UBRDIV UBRDIV0 + + +void serial_setup(void) +{ + /* enable UART clock */ + PWRCON &= ~(1 << 9); + + /* set up UART pins */ + PCON0 = (PCON0 & ~(0x2 << 12)) | (2 << 12); /* TxD0 */ + PCON0 = (PCON0 & ~(0x2 << 14)) | (2 << 14); /* RxD0 */ + + /* set up UART */ + ULCON = (0 << 6) | /* IR mode, 0 = normal, 1 = IR */ + (0 << 3) | /* parity mode, 0 = no parity */ + (0 << 2) | /* stop bits, 0 = 1 stop bit */ + (3 << 0); /* data bits, 3 = 8 data bits */ + UCON = (0 << 15) | /* modem interrupt enable */ + (0 << 14) | /* error interrupt enable */ + (0 << 13) | /* transmit interrupt enable */ + (1 << 12) | /* receive interrupt enable */ + (0 << 10) | /* clock selection, 0 = PCLK, 1 = UCLK */ + (0 << 7) | /* rx time out enable */ + (0 << 5) | /* loopback mode */ + (0 << 4) | /* send break signal */ + (1 << 2) | /* tx mode, 1 = interrupt/polling mode */ + (1 << 0); /* rx mode, 1 = interrupt/polling mode */ + UFCON = (1 << 2) | /* tx fifo reset */ + (1 << 1) | /* rx fifo reset */ + (0 << 0); /* fifo enable */ + UMCON = (0 << 4) | /* auto flow control, 0 = disabled */ + (1 << 0); /* RTS */ + + serial_bitrate(115200); +} + +void serial_bitrate(int rate) +{ + if (rate == 0) { + return; + } + + unsigned int divisor = (48000000 + (8 * rate)) / (16 * rate); + UBRDIV = divisor - 1; +} + +void tx_writec(unsigned char c) +{ + UTXH = c; +} + +int tx_rdy(void) +{ + if (UTRSTAT & (1 << 1)) { + return 1; + } else { + return 0; + } +} + +static int rx_rdy(void) +{ + if (UTRSTAT & (1 << 0)) { + return 1; + } else { + return 0; + } +} + +static unsigned char rx_readc(void) +{ + return URXH & 0xFF; +} + +void INT_UART0(void) +{ + unsigned char temp; + + while(rx_rdy()) + { + temp = rx_readc(); + iap_getc(temp); + } +} + Property changes on: firmware/target/arm/s5l8700/uart-s5l8700.c ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Index: firmware/drivers/serial.c =================================================================== --- firmware/drivers/serial.c (revision 29783) +++ firmware/drivers/serial.c (working copy) @@ -30,7 +30,8 @@ #include "serial.h" #include "iap.h" -#if defined(IPOD_ACCESSORY_PROTOCOL) +#if defined(IPOD_ACCESSORY_PROTOCOL) && \ + (defined(IPOD_NANO) || defined(IPOD_COLOR) || defined(IPOD_4G) || defined(IPOD_VIDEO)) static int autobaud = 0; static void set_bitrate(unsigned int rate)