summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/SOURCES67
-rw-r--r--firmware/drivers/rtc/rtc_tcc77x.c81
-rw-r--r--firmware/drivers/tuner/lv24020lp.c10
-rw-r--r--firmware/export/config.h29
-rw-r--r--firmware/export/config/iaudio7.h164
-rw-r--r--firmware/export/config/logikdax.h152
-rw-r--r--firmware/export/config/sansac100.h130
-rw-r--r--firmware/export/config/sansam200.h139
-rw-r--r--firmware/export/cpu.h3
-rw-r--r--firmware/export/tcc77x.h262
-rw-r--r--firmware/target/arm/ata-nand-telechips.c9
-rw-r--r--firmware/target/arm/lcd-ssd1815.c75
-rw-r--r--firmware/target/arm/pcm-telechips.c18
-rw-r--r--firmware/target/arm/system-arm.h2
-rw-r--r--firmware/target/arm/tcc77x/adc-tcc77x.c121
-rw-r--r--firmware/target/arm/tcc77x/app.lds99
-rw-r--r--firmware/target/arm/tcc77x/ata-nand-target.h33
-rw-r--r--firmware/target/arm/tcc77x/boot.lds63
-rw-r--r--firmware/target/arm/tcc77x/c100/adc-target.h26
-rw-r--r--firmware/target/arm/tcc77x/c100/backlight-target.h40
-rw-r--r--firmware/target/arm/tcc77x/c100/button-c100.c64
-rw-r--r--firmware/target/arm/tcc77x/c100/button-target.h45
-rw-r--r--firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c286
-rw-r--r--firmware/target/arm/tcc77x/c100/power-c100.c43
-rw-r--r--firmware/target/arm/tcc77x/crt0.S230
-rw-r--r--firmware/target/arm/tcc77x/debug-tcc77x.c77
-rw-r--r--firmware/target/arm/tcc77x/i2c-target.h39
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/adc-target.h28
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/ata2501.c110
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/ata2501.h27
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c94
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/backlight-target.h48
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/button-iaudio7.c93
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/button-target.h47
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c260
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/power-iaudio7.c149
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/powermgmt-iaudio7.c84
-rw-r--r--firmware/target/arm/tcc77x/kernel-tcc77x.c47
-rw-r--r--firmware/target/arm/tcc77x/logikdax/adc-target.h28
-rw-r--r--firmware/target/arm/tcc77x/logikdax/audio-logikdax.c40
-rw-r--r--firmware/target/arm/tcc77x/logikdax/backlight-target.h40
-rw-r--r--firmware/target/arm/tcc77x/logikdax/button-logikdax.c100
-rw-r--r--firmware/target/arm/tcc77x/logikdax/button-target.h45
-rw-r--r--firmware/target/arm/tcc77x/logikdax/power-logikdax.c44
-rw-r--r--firmware/target/arm/tcc77x/m200/adc-target.h28
-rw-r--r--firmware/target/arm/tcc77x/m200/audio-m200.c38
-rw-r--r--firmware/target/arm/tcc77x/m200/backlight-target.h44
-rw-r--r--firmware/target/arm/tcc77x/m200/button-m200.c99
-rw-r--r--firmware/target/arm/tcc77x/m200/button-target.h45
-rw-r--r--firmware/target/arm/tcc77x/m200/power-m200.c43
-rw-r--r--firmware/target/arm/tcc77x/powermgmt-tcc77x.c66
-rw-r--r--firmware/target/arm/tcc77x/system-target.h59
-rw-r--r--firmware/target/arm/tcc77x/system-tcc77x.c326
-rw-r--r--firmware/target/arm/tcc77x/timer-tcc77x.c69
-rw-r--r--firmware/target/arm/wmcodec-telechips.c2
-rw-r--r--firmware/target/hosted/sdl/sim-ui-defines.h7
-rw-r--r--firmware/usb.c2
-rw-r--r--firmware/usbstack/usb_storage.c4
58 files changed, 10 insertions, 4413 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 463933b8c5..b6f7688946 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -392,8 +392,6 @@ drivers/rtc/rtc_rx5x348ab.c
392drivers/rtc/rtc_mr100.c 392drivers/rtc/rtc_mr100.c
393#elif (CONFIG_RTC == RTC_MC13783) 393#elif (CONFIG_RTC == RTC_MC13783)
394drivers/rtc/rtc_mc13783.c 394drivers/rtc/rtc_mc13783.c
395#elif (CONFIG_RTC == RTC_TCC77X)
396drivers/rtc/rtc_tcc77x.c
397#elif (CONFIG_RTC == RTC_JZ4740) 395#elif (CONFIG_RTC == RTC_JZ4740)
398drivers/rtc/rtc_jz4740.c 396drivers/rtc/rtc_jz4740.c
399#elif (CONFIG_RTC == RTC_JZ4760) 397#elif (CONFIG_RTC == RTC_JZ4760)
@@ -603,7 +601,7 @@ target/arm/ipod/powermgmt-ipod-pcf.c
603target/arm/pp/i2c-pp.c 601target/arm/pp/i2c-pp.c
604#elif CONFIG_I2C == I2C_PNX0101 602#elif CONFIG_I2C == I2C_PNX0101
605target/arm/pnx0101/i2c-pnx0101.c 603target/arm/pnx0101/i2c-pnx0101.c
606#elif CONFIG_I2C == I2C_TCC780X || CONFIG_I2C == I2C_TCC77X 604#elif CONFIG_I2C == I2C_TCC780X
607target/arm/i2c-telechips.c 605target/arm/i2c-telechips.c
608#elif CONFIG_I2C == I2C_S3C2440 606#elif CONFIG_I2C == I2C_S3C2440
609target/arm/s3c2440/i2c-s3c2440.c 607target/arm/s3c2440/i2c-s3c2440.c
@@ -749,8 +747,6 @@ target/arm/pnx0101/crt0-pnx0101.S
749target/arm/tms320dm320/crt0.S 747target/arm/tms320dm320/crt0.S
750#elif CONFIG_CPU==S3C2440 748#elif CONFIG_CPU==S3C2440
751target/arm/s3c2440/crt0.S 749target/arm/s3c2440/crt0.S
752#elif defined(CPU_TCC77X)
753target/arm/tcc77x/crt0.S
754#elif defined(CPU_TCC780X) 750#elif defined(CPU_TCC780X)
755target/arm/tcc780x/crt0.S 751target/arm/tcc780x/crt0.S
756#elif CONFIG_CPU==IMX31L 752#elif CONFIG_CPU==IMX31L
@@ -897,28 +893,8 @@ target/arm/s5l8700/ipodnano2g/adc-nano2g.c
897target/arm/s5l8700/adc-s5l8700.c 893target/arm/s5l8700/adc-s5l8700.c
898# endif 894# endif
899 895
900#elif CONFIG_I2C == I2C_TCC77X
901target/arm/tcc77x/adc-tcc77x.c
902
903#endif /* CONFIG_I2C */ 896#endif /* CONFIG_I2C */
904 897
905#ifdef CPU_TCC77X
906target/arm/usb-tcc.c
907target/arm/tcc77x/kernel-tcc77x.c
908target/arm/tcc77x/system-tcc77x.c
909target/arm/tcc77x/timer-tcc77x.c
910# ifndef IAUDIO7
911target/arm/tcc77x/powermgmt-tcc77x.c
912# endif /* !IAUDIO7 */
913# ifndef BOOTLOADER
914# ifndef SANSA_C100
915target/arm/wmcodec-telechips.c
916# endif /* !C100 */
917target/arm/pcm-telechips.c
918target/arm/tcc77x/debug-tcc77x.c
919# endif /* !BOOTLOADER */
920#endif /* CPU_TCC77X */
921
922#if CONFIG_CPU == S5L8700 || CONFIG_CPU == S5L8701 898#if CONFIG_CPU == S5L8700 || CONFIG_CPU == S5L8701
923target/arm/s5l8700/kernel-s5l8700.c 899target/arm/s5l8700/kernel-s5l8700.c
924target/arm/s5l8700/system-s5l8700.c 900target/arm/s5l8700/system-s5l8700.c
@@ -1386,34 +1362,6 @@ target/arm/pnx0101/pcm-pnx0101.c
1386#endif /* BOOTLOADER */ 1362#endif /* BOOTLOADER */
1387#endif /* IRIVER_IFP7XX */ 1363#endif /* IRIVER_IFP7XX */
1388 1364
1389#ifdef LOGIK_DAX
1390drivers/nand_id.c
1391target/arm/tcc77x/logikdax/button-logikdax.c
1392target/arm/tcc77x/logikdax/power-logikdax.c
1393#ifndef BOOTLOADER
1394target/arm/tcc77x/logikdax/audio-logikdax.c
1395#endif /* BOOTLOADER */
1396#endif /* LOGIK_DAX */
1397
1398#ifdef SANSA_M200
1399drivers/nand_id.c
1400target/arm/tcc77x/m200/button-m200.c
1401target/arm/tcc77x/m200/power-m200.c
1402#ifndef BOOTLOADER
1403target/arm/tcc77x/m200/audio-m200.c
1404#endif /* BOOTLOADER */
1405#endif /* SANSA_M200 */
1406
1407#ifdef SANSA_C100
1408drivers/nand_id.c
1409target/arm/tcc77x/c100/lcd-S6B33B2.c
1410target/arm/tcc77x/c100/button-c100.c
1411target/arm/tcc77x/c100/power-c100.c
1412#ifndef BOOTLOADER
1413target/arm/tcc77x/c100/audio-c100.c
1414#endif /* BOOTLOADER */
1415#endif /* SANSA_C100 */
1416
1417#ifdef SANSA_CLIPPLUS 1365#ifdef SANSA_CLIPPLUS
1418target/arm/as3525/sansa-clipplus/lcd-clip-plus.c 1366target/arm/as3525/sansa-clipplus/lcd-clip-plus.c
1419target/arm/as3525/sansa-clipplus/button-clip.c 1367target/arm/as3525/sansa-clipplus/button-clip.c
@@ -1525,19 +1473,6 @@ target/arm/as3525/sansa-clipzip/powermgmt-clipzip.c
1525#endif /* !BOOTLOADER */ 1473#endif /* !BOOTLOADER */
1526#endif /* SANSA_CLIPZIP */ 1474#endif /* SANSA_CLIPZIP */
1527 1475
1528#ifdef IAUDIO_7
1529drivers/nand_id.c
1530drivers/pcf50606.c
1531target/arm/tcc77x/iaudio7/lcd-iaudio7.c
1532target/arm/tcc77x/iaudio7/power-iaudio7.c
1533target/arm/tcc77x/iaudio7/powermgmt-iaudio7.c
1534target/arm/tcc77x/iaudio7/button-iaudio7.c
1535target/arm/tcc77x/iaudio7/ata2501.c
1536#ifndef BOOTLOADER
1537target/arm/tcc77x/iaudio7/audio-iaudio7.c
1538#endif /* BOOTLOADER */
1539#endif /* IAUDIO_7 */
1540
1541#ifdef COWON_D2 1476#ifdef COWON_D2
1542drivers/lcd-memframe.c 1477drivers/lcd-memframe.c
1543drivers/nand_id.c 1478drivers/nand_id.c
diff --git a/firmware/drivers/rtc/rtc_tcc77x.c b/firmware/drivers/rtc/rtc_tcc77x.c
deleted file mode 100644
index a85c93d65a..0000000000
--- a/firmware/drivers/rtc/rtc_tcc77x.c
+++ /dev/null
@@ -1,81 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "config.h"
22#include "rtc.h"
23#include "system.h"
24#include <stdbool.h>
25
26void rtc_init(void)
27{
28}
29
30int rtc_read_datetime(struct tm *tm)
31{
32 (void)tm;
33 return 0;
34}
35
36int rtc_write_datetime(const struct tm *tm)
37{
38 (void)tm;
39 return 1;
40}
41
42#ifdef HAVE_RTC_ALARM
43/**
44 * Checks to see if an alarm interrupt has triggered since last we checked.
45 */
46bool rtc_check_alarm_flag(void)
47{
48}
49
50/**
51 * Enables or disables the alarm.
52 */
53void rtc_enable_alarm(bool enable)
54{
55}
56
57/**
58 * Check if alarm caused unit to start.
59 */
60bool rtc_check_alarm_started(bool release_alarm)
61{
62}
63
64void rtc_set_alarm(int h, int m)
65{
66 /* Convert to BCD */
67// pcf50605_write(0x12, ((m/10) << 4) | m%10);
68// pcf50605_write(0x13, ((h/10) << 4) | h%10);
69}
70
71void rtc_get_alarm(int *h, int *m)
72{
73 char buf[2];
74
75 /* Convert from BCD */
76// *m = ((buf[0] >> 4) & 0x7)*10 + (buf[0] & 0x0f);
77// *h = ((buf[1] >> 4) & 0x3)*10 + (buf[1] & 0x0f);
78}
79#endif /* HAVE_RTC_ALARM */
80
81
diff --git a/firmware/drivers/tuner/lv24020lp.c b/firmware/drivers/tuner/lv24020lp.c
index bb137d60ff..2fbf88b01b 100644
--- a/firmware/drivers/tuner/lv24020lp.c
+++ b/firmware/drivers/tuner/lv24020lp.c
@@ -80,16 +80,6 @@ static int fd_log = -1;
80#define FM_CLOCK_PIN 4 80#define FM_CLOCK_PIN 4
81#define FM_DATA_PIN 5 81#define FM_DATA_PIN 5
82 82
83#elif defined(IAUDIO_7)
84#define TUNER_GPIO_INPUT_VAL GPIOA
85#define TUNER_GPIO_OUTPUT_EN_SET(mask) (GPIOA_DIR |= (mask))
86#define TUNER_GPIO_OUTPUT_EN_CLEAR(mask) (GPIOA_DIR &= ~(mask))
87#define TUNER_GPIO_OUTPUT_VAL_SET(mask) (GPIOA |= (mask))
88#define TUNER_GPIO_OUTPUT_VAL_CLEAR(mask) (GPIOA &= ~(mask))
89#define FM_CLOCK_PIN 5
90#define FM_DATA_PIN 6
91#define FM_NRW_PIN 7
92
93#elif defined(COWON_D2) 83#elif defined(COWON_D2)
94#define TUNER_GPIO_INPUT_VAL GPIOC 84#define TUNER_GPIO_INPUT_VAL GPIOC
95#define TUNER_GPIO_OUTPUT_EN_SET(mask) (GPIOC_DIR |= (mask)) 85#define TUNER_GPIO_OUTPUT_EN_SET(mask) (GPIOC_DIR |= (mask))
diff --git a/firmware/export/config.h b/firmware/export/config.h
index db1c589043..d23abfa086 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -68,9 +68,6 @@
68#define DSC25 25 68#define DSC25 25
69#define DM320 320 69#define DM320 320
70#define IMX31L 31 70#define IMX31L 31
71#define TCC770 770
72#define TCC771L 771
73#define TCC773L 773
74#define TCC7801 7801 71#define TCC7801 7801
75#define S5L8700 8700 72#define S5L8700 8700
76#define S5L8701 8701 73#define S5L8701 8701
@@ -113,15 +110,12 @@
113#define MROBE100_PAD 17 110#define MROBE100_PAD 17
114#define MROBE500_PAD 18 111#define MROBE500_PAD 18
115#define GIGABEAT_S_PAD 19 112#define GIGABEAT_S_PAD 19
116#define LOGIK_DAX_PAD 20
117#define IAUDIO67_PAD 21
118#define COWON_D2_PAD 22 113#define COWON_D2_PAD 22
119#define IAUDIO_M3_PAD 23 114#define IAUDIO_M3_PAD 23
120#define CREATIVEZVM_PAD 24 115#define CREATIVEZVM_PAD 24
121#define SANSA_M200_PAD 25 116#define SANSA_M200_PAD 25
122#define CREATIVEZV_PAD 26 117#define CREATIVEZV_PAD 26
123#define PHILIPS_SA9200_PAD 27 118#define PHILIPS_SA9200_PAD 27
124#define SANSA_C100_PAD 28
125#define PHILIPS_HDD1630_PAD 29 119#define PHILIPS_HDD1630_PAD 29
126#define MEIZU_M6SL_PAD 30 120#define MEIZU_M6SL_PAD 30
127#define ONDAVX747_PAD 31 121#define ONDAVX747_PAD 31
@@ -236,13 +230,11 @@
236#define LCD_C200 17 /* as used by Sandisk Sansa c200 */ 230#define LCD_C200 17 /* as used by Sandisk Sansa c200 */
237#define LCD_MROBE500 18 /* as used by Olympus M:Robe 500i */ 231#define LCD_MROBE500 18 /* as used by Olympus M:Robe 500i */
238#define LCD_MROBE100 19 /* as used by Olympus M:Robe 100 */ 232#define LCD_MROBE100 19 /* as used by Olympus M:Robe 100 */
239#define LCD_LOGIKDAX 20 /* as used by Logik DAX - SSD1815 */
240#define LCD_IAUDIO67 21 /* as used by iAudio 6/7 - unknown */
241#define LCD_CREATIVEZVM 22 /* as used by Creative Zen Vision:M */ 233#define LCD_CREATIVEZVM 22 /* as used by Creative Zen Vision:M */
242#define LCD_TL0350A 23 /* as used by the iAudio M3 remote, treated as main LCD */ 234#define LCD_TL0350A 23 /* as used by the iAudio M3 remote, treated as main LCD */
243#define LCD_COWOND2 24 /* as used by Cowon D2 - LTV250QV, TCC7801 driver */ 235#define LCD_COWOND2 24 /* as used by Cowon D2 - LTV250QV, TCC7801 driver */
244#define LCD_SA9200 25 /* as used by the Philips SA9200 */ 236#define LCD_SA9200 25 /* as used by the Philips SA9200 */
245#define LCD_S6B33B2 26 /* as used by the Sansa c100 */ 237#define LCD_S6B33B2 26 /* as used by the Samsumg YH820 */
246#define LCD_HDD1630 27 /* as used by the Philips HDD1630 */ 238#define LCD_HDD1630 27 /* as used by the Philips HDD1630 */
247#define LCD_MEIZUM6 28 /* as used by the Meizu M6SP and M6SL (various models) */ 239#define LCD_MEIZUM6 28 /* as used by the Meizu M6SP and M6SL (various models) */
248#define LCD_ONDAVX747 29 /* as used by the Onda VX747 */ 240#define LCD_ONDAVX747 29 /* as used by the Onda VX747 */
@@ -314,7 +306,6 @@ Lyre prototype 1 */
314#define I2C_S3C2440 7 306#define I2C_S3C2440 7
315#define I2C_PP5024 8 /* PP5024 style */ 307#define I2C_PP5024 8 /* PP5024 style */
316#define I2C_IMX31L 9 308#define I2C_IMX31L 9
317#define I2C_TCC77X 10
318#define I2C_TCC780X 11 309#define I2C_TCC780X 11
319#define I2C_DM320 12 /* DM320 style */ 310#define I2C_DM320 12 /* DM320 style */
320#define I2C_S5L8700 13 311#define I2C_S5L8700 13
@@ -347,7 +338,6 @@ Lyre prototype 1 */
347#define RTC_DS1339_DS3231 7 /* h1x0 RTC mod */ 338#define RTC_DS1339_DS3231 7 /* h1x0 RTC mod */
348#define RTC_IMX31L 8 339#define RTC_IMX31L 8
349#define RTC_RX5X348AB 9 340#define RTC_RX5X348AB 9
350#define RTC_TCC77X 10
351#define RTC_TCC780X 11 341#define RTC_TCC780X 11
352#define RTC_MR100 12 342#define RTC_MR100 12
353#define RTC_MC13783 13 /* Freescale MC13783 PMIC */ 343#define RTC_MC13783 13 /* Freescale MC13783 PMIC */
@@ -438,18 +428,12 @@ Lyre prototype 1 */
438#include "config/sansae200.h" 428#include "config/sansae200.h"
439#elif defined(SANSA_C200) 429#elif defined(SANSA_C200)
440#include "config/sansac200.h" 430#include "config/sansac200.h"
441#elif defined(SANSA_M200)
442#include "config/sansam200.h"
443#elif defined(TATUNG_TPJ1022) 431#elif defined(TATUNG_TPJ1022)
444#include "config/tatungtpj1022.h" 432#include "config/tatungtpj1022.h"
445#elif defined(MROBE_100) 433#elif defined(MROBE_100)
446#include "config/mrobe100.h" 434#include "config/mrobe100.h"
447#elif defined(MROBE_500) 435#elif defined(MROBE_500)
448#include "config/mrobe500.h" 436#include "config/mrobe500.h"
449#elif defined(LOGIK_DAX)
450#include "config/logikdax.h"
451#elif defined(IAUDIO_7)
452#include "config/iaudio7.h"
453#elif defined(COWON_D2) 437#elif defined(COWON_D2)
454#include "config/cowond2.h" 438#include "config/cowond2.h"
455#elif defined(CREATIVE_ZVM) 439#elif defined(CREATIVE_ZVM)
@@ -468,8 +452,6 @@ Lyre prototype 1 */
468#include "config/gogearhdd1630.h" 452#include "config/gogearhdd1630.h"
469#elif defined(PHILIPS_HDD6330) 453#elif defined(PHILIPS_HDD6330)
470#include "config/gogearhdd6330.h" 454#include "config/gogearhdd6330.h"
471#elif defined(SANSA_C100)
472#include "config/sansac100.h"
473#elif defined(MEIZU_M6SL) 455#elif defined(MEIZU_M6SL)
474#include "config/meizum6sl.h" 456#include "config/meizum6sl.h"
475#elif defined(MEIZU_M6SP) 457#elif defined(MEIZU_M6SP)
@@ -666,11 +648,6 @@ Lyre prototype 1 */
666#define CPU_S5L870X 648#define CPU_S5L870X
667#endif 649#endif
668 650
669/* define for all cpus from TCC77X family */
670#if (CONFIG_CPU == TCC771L) || (CONFIG_CPU == TCC773L) || (CONFIG_CPU == TCC770)
671#define CPU_TCC77X
672#endif
673
674/* define for all cpus from TCC780 family */ 651/* define for all cpus from TCC780 family */
675#if (CONFIG_CPU == TCC7801) 652#if (CONFIG_CPU == TCC7801)
676#define CPU_TCC780X 653#define CPU_TCC780X
@@ -1202,7 +1179,7 @@ Lyre prototype 1 */
1202 (CONFIG_USBOTG == USBOTG_RK27XX) 1179 (CONFIG_USBOTG == USBOTG_RK27XX)
1203#define USB_HAS_BULK 1180#define USB_HAS_BULK
1204#define USB_HAS_INTERRUPT 1181#define USB_HAS_INTERRUPT
1205#elif defined(CPU_TCC780X) || defined(CPU_TCC77X) 1182#elif defined(CPU_TCC780X)
1206#define USB_HAS_BULK 1183#define USB_HAS_BULK
1207#elif CONFIG_USBOTG == USBOTG_S3C6400X 1184#elif CONFIG_USBOTG == USBOTG_S3C6400X
1208#define USB_HAS_BULK 1185#define USB_HAS_BULK
@@ -1219,7 +1196,7 @@ Lyre prototype 1 */
1219 1196
1220/* enable usb storage for targets that do bootloader usb */ 1197/* enable usb storage for targets that do bootloader usb */
1221#if defined(HAVE_BOOTLOADER_USB_MODE) || \ 1198#if defined(HAVE_BOOTLOADER_USB_MODE) || \
1222 defined(CREATIVE_ZVx) || defined(CPU_TCC77X) || defined(CPU_TCC780X) || \ 1199 defined(CREATIVE_ZVx) || defined(CPU_TCC780X) || \
1223 CONFIG_USBOTG == USBOTG_JZ4740 || CONFIG_USBOTG == USBOTG_AS3525 || \ 1200 CONFIG_USBOTG == USBOTG_JZ4740 || CONFIG_USBOTG == USBOTG_AS3525 || \
1224 CONFIG_USBOTG == USBOTG_S3C6400X || CONFIG_USBOTG == USBOTG_DESIGNWARE || \ 1201 CONFIG_USBOTG == USBOTG_S3C6400X || CONFIG_USBOTG == USBOTG_DESIGNWARE || \
1225 CONFIG_USBOTG == USBOTG_JZ4760 1202 CONFIG_USBOTG == USBOTG_JZ4760
diff --git a/firmware/export/config/iaudio7.h b/firmware/export/config/iaudio7.h
deleted file mode 100644
index 698ff13724..0000000000
--- a/firmware/export/config/iaudio7.h
+++ /dev/null
@@ -1,164 +0,0 @@
1/*
2 * This config file is for the Iaudio7 series
3 */
4
5/* For Rolo and boot loader */
6#define MODEL_NUMBER 32
7#define MODEL_NAME "Cowon iAudio7"
8
9/* define this if you have recording possibility */
10#define HAVE_RECORDING
11
12/* Define bitmask of input sources - recordable bitmask can be defined
13 explicitly if different */
14#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_FMRADIO)
15
16/* FM Tuner */
17#define CONFIG_TUNER LV24020LP
18#define HAVE_TUNER_PWR_CTRL
19
20/* Define this for FM radio input available */
21#define HAVE_FMRADIO_IN
22
23/* define hardware samples rate caps mask */
24#define HW_SAMPR_CAPS (/*SAMPR_CAP_88 | */SAMPR_CAP_44/* | SAMPR_CAP_22 | SAMPR_CAP_11*/)
25
26/* define the bitmask of recording sample rates */
27#define REC_SAMPR_CAPS (SAMPR_CAP_44/* | SAMPR_CAP_22 | SAMPR_CAP_11*/)
28
29
30
31
32/* define this if you have a colour LCD */
33#define HAVE_LCD_COLOR
34
35/* define this if you can flip your LCD */
36//#define HAVE_LCD_FLIP
37
38/* define this if you can invert the colours on your LCD */
39//#define HAVE_LCD_INVERT
40
41/* define this if you want album art for this target */
42#define HAVE_ALBUMART
43
44/* define this to enable bitmap scaling */
45#define HAVE_BMP_SCALING
46
47/* define this to enable JPEG decoding */
48#define HAVE_JPEG
49
50/* define this if you have access to the quickscreen */
51#define HAVE_QUICKSCREEN
52
53/* define this if you have LCD enable function */
54#define HAVE_LCD_ENABLE
55
56/* define this if you would like tagcache to build on this target */
57#define HAVE_TAGCACHE
58
59#define HAVE_FAT16SUPPORT
60
61#if 0 && !defined(SIMULATOR) /* Enable for USB driver test */
62#define HAVE_USBSTACK
63#define USB_VENDOR_ID 0x0e21
64#define USB_PRODUCT_ID 0x0750
65#endif
66
67/* define this if you have a flash memory storage */
68#define HAVE_FLASH_STORAGE
69
70#define CONFIG_STORAGE STORAGE_NAND
71
72#define CONFIG_NAND NAND_TCC
73
74/* LCD dimensions */
75#define LCD_WIDTH 160
76#define LCD_HEIGHT 128
77/* sqrt(160^2 + 128^2) / 1.3 = 157.6 */
78#define LCD_DPI 158
79/* 16bits for now... */
80#define LCD_DEPTH 16 /* 262144 colours */
81#define LCD_PIXELFORMAT RGB565 /*rgb565*/
82
83/*#define LCD_PIXELFORMAT VERTICAL_PACKING*/
84
85/* define this to indicate your device's keypad */
86#define CONFIG_KEYPAD IAUDIO67_PAD
87
88/* #define HAVE_BUTTON_DATA */
89
90/* define this if you have a real-time clock */
91#define CONFIG_RTC RTC_PCF50606
92
93/* define this if you have RTC RAM available for settings */
94//#define HAVE_RTC_RAM
95
96/* Define this if you have a software controlled poweroff */
97#define HAVE_SW_POWEROFF
98
99/* Reduce Tremor's ICODE usage */
100#define ICODE_ATTR_TREMOR_NOT_MDCT
101
102/* The number of bytes reserved for loadable codecs */
103#define CODEC_SIZE 0x100000
104
105/* The number of bytes reserved for loadable plugins */
106#define PLUGIN_BUFFER_SIZE 0x80000
107
108#define AB_REPEAT_ENABLE
109
110
111
112
113/* The iaudio7 uses built-in WM8731 codec */
114#define HAVE_WM8731
115/* Codec is slave on serial bus */
116#define CODEC_SLAVE
117
118/* WM8731 has no tone controls, so we use the software ones */
119#define HAVE_SW_TONE_CONTROLS
120
121/* Define this for LCD backlight available */
122#define HAVE_BACKLIGHT
123
124#define CONFIG_I2C I2C_TCC77X
125
126#define BATTERY_CAPACITY_DEFAULT 540 /* default battery capacity */
127#define BATTERY_CAPACITY_MIN 540 /* min. capacity selectable */
128#define BATTERY_CAPACITY_MAX 540 /* max. capacity selectable */
129#define BATTERY_CAPACITY_INC 50 /* capacity increment */
130#define BATTERY_TYPES_COUNT 1 /* only one type */
131
132#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
133
134#define CONFIG_CHARGING CHARGING_SIMPLE
135
136/* Define this if you have a TCC770 */
137#define CONFIG_CPU TCC770
138
139/* Define this if you have ATA power-off control */
140#define HAVE_ATA_POWER_OFF
141
142/* Define this to the CPU frequency */
143#define CPU_FREQ 120000000
144
145/* Offset ( in the firmware file's header ) to the file CRC */
146#define FIRMWARE_OFFSET_FILE_CRC 0
147
148/* Offset ( in the firmware file's header ) to the real data */
149#define FIRMWARE_OFFSET_FILE_DATA 8
150
151#define CONFIG_LCD LCD_IAUDIO67
152
153#define BOOTFILE_EXT "iaudio"
154#define BOOTFILE "rockbox." BOOTFILE_EXT
155#define BOOTDIR "/.rockbox"
156
157#ifdef BOOTLOADER
158#define TCCBOOT
159#endif
160
161#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
162
163/* Define this if a programmable hotkey is mapped */
164//#define HAVE_HOTKEY
diff --git a/firmware/export/config/logikdax.h b/firmware/export/config/logikdax.h
deleted file mode 100644
index 47229f7a1d..0000000000
--- a/firmware/export/config/logikdax.h
+++ /dev/null
@@ -1,152 +0,0 @@
1/*
2 * This config file is for the Logik DAX MP3/DAB
3 */
4
5/* For Rolo and boot loader */
6#define MODEL_NUMBER 33
7
8#define MODEL_NAME "Logik DAX MP3/DAB"
9
10/* define this if you have recording possibility */
11//#define HAVE_RECORDING
12
13/* Define bitmask of input sources - recordable bitmask can be defined
14 explicitly if different */
15//#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_SPDIF)
16
17#if 0 /* Enable for USB driver test */
18#define HAVE_USBSTACK
19#define USB_VENDOR_ID 0x13d1
20#define USB_PRODUCT_ID 0x1002
21#endif
22
23
24
25
26
27/* define this if you can flip your LCD */
28#define HAVE_LCD_FLIP
29
30/* define this if you can invert the colours on your LCD */
31#define HAVE_LCD_INVERT
32
33/* define this if you have access to the quickscreen */
34#define HAVE_QUICKSCREEN
35
36/* define this if you would like tagcache to build on this target */
37#define HAVE_TAGCACHE
38
39#define HAVE_FAT16SUPPORT
40
41/* define this if you have a flash memory storage */
42#define HAVE_FLASH_STORAGE
43
44#define CONFIG_STORAGE STORAGE_NAND
45
46#define CONFIG_NAND NAND_TCC
47
48/* LCD dimensions */
49#define LCD_WIDTH 128
50#define LCD_HEIGHT 64
51/* sqrt(128^2 + 64^2) / 1.0 = 143.1 */
52#define LCD_DPI 143
53#define LCD_DEPTH 1
54
55#define LCD_PIXELFORMAT VERTICAL_PACKING
56
57/* Display colours, for screenshots and sim (0xRRGGBB) */
58#define LCD_DARKCOLOR 0x000000
59#define LCD_BRIGHTCOLOR 0x5a915a
60#define LCD_BL_DARKCOLOR 0x000000
61#define LCD_BL_BRIGHTCOLOR 0x82b4fa
62
63/* define this to indicate your device's keypad */
64#define CONFIG_KEYPAD LOGIK_DAX_PAD
65
66/* define this if you have a real-time clock */
67#define CONFIG_RTC RTC_TCC77X
68
69/* define this if you have RTC RAM available for settings */
70//#define HAVE_RTC_RAM
71
72/* Define this if you have a software controlled poweroff */
73#define HAVE_SW_POWEROFF
74
75/* The number of bytes reserved for loadable codecs */
76#define CODEC_SIZE 0x38000
77
78/* The number of bytes reserved for loadable plugins */
79#define PLUGIN_BUFFER_SIZE 0x10000
80
81#define AB_REPEAT_ENABLE
82
83
84
85
86/* The DAX uses built-in WM8731 codec */
87#define HAVE_WM8731
88/* Codec is slave on serial bus */
89#define CODEC_SLAVE
90/* WM8731 has no tone controls, so we use the software ones */
91#define HAVE_SW_TONE_CONTROLS
92
93/* Define this for LCD backlight available */
94#define HAVE_BACKLIGHT
95
96#define CONFIG_I2C I2C_TCC77X
97
98#define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */
99#define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */
100#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */
101#define BATTERY_CAPACITY_INC 50 /* capacity increment */
102#define BATTERY_TYPES_COUNT 1 /* only one type */
103
104#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
105
106/* define this if the unit should not shut down on low battery. */
107#define NO_LOW_BATTERY_SHUTDOWN
108
109/* Define this if you have a TCC773L */
110#define CONFIG_CPU TCC773L
111
112/* Define this if you have ATA power-off control */
113#define HAVE_ATA_POWER_OFF
114
115#define HAVE_FAT16SUPPORT
116
117/* Define this to the CPU frequency */
118#define CPU_FREQ 120000000
119
120/* Offset ( in the firmware file's header ) to the file length */
121#define FIRMWARE_OFFSET_FILE_LENGTH 0
122
123/* Offset ( in the firmware file's header ) to the file CRC */
124#define FIRMWARE_OFFSET_FILE_CRC 4
125
126/* Offset ( in the firmware file's header ) to the real data */
127#define FIRMWARE_OFFSET_FILE_DATA 6
128
129/* The start address index for ROM builds */
130/* #define ROM_START 0x11010 for behind original Archos */
131#define ROM_START 0x7010 /* for behind BootBox */
132
133#define CONFIG_LCD LCD_SSD1815
134
135#define BOOTFILE_EXT "logik"
136#define BOOTFILE "rockbox." BOOTFILE_EXT
137#define BOOTDIR "/"
138
139#define IBSS_ATTR_VOICE_STACK
140#define ICODE_ATTR_TREMOR_NOT_MDCT
141#define ICODE_ATTR_TREMOR_MDCT
142#define ICODE_ATTR_FLAC
143#define IBSS_ATTR_FLAC_DECODED0
144#define ICONST_ATTR_MPA_HUFFMAN
145#define IBSS_ATTR_MPC_SAMPLE_BUF
146#define ICODE_ATTR_ALAC
147#define IBSS_ATTR_SHORTEN_DECODED0
148
149#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
150
151/* Define this if a programmable hotkey is mapped */
152//#define HAVE_HOTKEY
diff --git a/firmware/export/config/sansac100.h b/firmware/export/config/sansac100.h
deleted file mode 100644
index c2956eed12..0000000000
--- a/firmware/export/config/sansac100.h
+++ /dev/null
@@ -1,130 +0,0 @@
1/*
2 * This config file is for the Sansa C100 series
3 */
4
5#define MODEL_NAME "Sandisk Sansa c100 series"
6
7/* For Rolo and bootloader */
8#define MODEL_NUMBER 30
9
10/* define hardware samples rate caps mask */
11#define HW_SAMPR_CAPS (/*SAMPR_CAP_88 | */SAMPR_CAP_44/* | SAMPR_CAP_22 | SAMPR_CAP_11*/)
12
13
14
15
16/* define this if you have a colour LCD */
17#define HAVE_LCD_COLOR
18
19/* define this if you can flip your LCD */
20/*#define HAVE_LCD_FLIP*/
21
22/* define this if you can invert the colours on your LCD */
23/*#define HAVE_LCD_INVERT*/
24
25/* define this if you have access to the quickscreen */
26#define HAVE_QUICKSCREEN
27
28/* define this if you would like tagcache to build on this target */
29#define HAVE_TAGCACHE
30
31/* define this if you have a flash memory storage */
32#define HAVE_FLASH_STORAGE
33
34/* Only v1 */
35#define CONFIG_STORAGE STORAGE_NAND
36#define CONFIG_NAND NAND_TCC
37
38/* c100's with direct-to-NAND access are FAT16 */
39#define HAVE_FAT16SUPPORT
40
41/* LCD dimensions */
42#define LCD_WIDTH 128
43#define LCD_HEIGHT 64
44/* sqrt(128^2 + 64^2) / 1.7 = 84.2 */
45#define LCD_DPI 84
46#define LCD_DEPTH 16 /* 65536 colours */
47#define LCD_PIXELFORMAT RGB565 /*rgb565*/
48
49/*#define LCD_PIXELFORMAT VERTICAL_PACKING*/
50
51/* define this to indicate your device's keypad */
52#define CONFIG_KEYPAD SANSA_C100_PAD
53
54/* define this if you have a real-time clock */
55#define CONFIG_RTC RTC_TCC77X
56
57/* define this if you have RTC RAM available for settings */
58//#define HAVE_RTC_RAM
59
60/* Define this if you have a software controlled poweroff */
61#define HAVE_SW_POWEROFF
62
63/* The number of bytes reserved for loadable codecs */
64#define CODEC_SIZE 0x50000
65
66/* The number of bytes reserved for loadable plugins */
67#define PLUGIN_BUFFER_SIZE 0x50000
68
69#define AB_REPEAT_ENABLE
70
71
72
73
74/* Define this if you have the TLV320 audio codec */
75#define HAVE_TLV320
76
77/*#define CONFIG_TUNER TEA5767*/
78
79/* TLV320 has no tone controls, so we use the software ones */
80#define HAVE_SW_TONE_CONTROLS
81
82/* Define this for LCD backlight available */
83#define HAVE_BACKLIGHT
84
85#define CONFIG_I2C I2C_TCC77X
86
87#define BATTERY_CAPACITY_DEFAULT 540 /* default battery capacity */
88#define BATTERY_CAPACITY_MIN 540 /* min. capacity selectable */
89#define BATTERY_CAPACITY_MAX 540 /* max. capacity selectable */
90#define BATTERY_CAPACITY_INC 50 /* capacity increment */
91#define BATTERY_TYPES_COUNT 1 /* only one type */
92
93#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
94
95/* define this if the unit should not shut down on low battery. */
96#define NO_LOW_BATTERY_SHUTDOWN
97
98/* Define this if you have a TCC770 */
99#define CONFIG_CPU TCC770
100
101/* Define this if you have ATA power-off control */
102#define HAVE_ATA_POWER_OFF
103
104/* Define this to the CPU frequency */
105#define CPU_FREQ 120000000
106
107/* Offset ( in the firmware file's header ) to the file CRC */
108#define FIRMWARE_OFFSET_FILE_CRC 0
109
110/* Offset ( in the firmware file's header ) to the real data */
111#define FIRMWARE_OFFSET_FILE_DATA 8
112
113/* The start address index for ROM builds */
114/* #define ROM_START 0x11010 for behind original Archos */
115#define ROM_START 0x7010 /* for behind BootBox */
116
117#define CONFIG_LCD LCD_S6B33B2
118
119#define BOOTFILE_EXT "c100"
120#define BOOTFILE "rockbox." BOOTFILE_EXT
121#define BOOTDIR "/.rockbox"
122
123#ifdef BOOTLOADER
124#define TCCBOOT
125#endif
126
127#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
128
129/* Define this if a programmable hotkey is mapped */
130#define HAVE_HOTKEY
diff --git a/firmware/export/config/sansam200.h b/firmware/export/config/sansam200.h
deleted file mode 100644
index 95647013e7..0000000000
--- a/firmware/export/config/sansam200.h
+++ /dev/null
@@ -1,139 +0,0 @@
1/*
2 * This config file is for the Sansa M200 series
3 */
4
5/* For Rolo and boot loader */
6#define MODEL_NUMBER 29
7
8#define MODEL_NAME "Sandisk Sansa m200 series"
9
10/* Enable FAT16 support */
11#define HAVE_FAT16SUPPORT
12
13/* define this if you have recording possibility */
14//#define HAVE_RECORDING
15
16/* Define bitmask of input sources - recordable bitmask can be defined
17 explicitly if different */
18//#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_SPDIF)
19
20
21
22
23/* define this if you can flip your LCD */
24#define HAVE_LCD_FLIP
25
26/* define this if you can invert the colours on your LCD */
27#define HAVE_LCD_INVERT
28
29/* define this if you have access to the quickscreen */
30#define HAVE_QUICKSCREEN
31
32/* define this if you would like tagcache to build on this target */
33#define HAVE_TAGCACHE
34
35/* define this if you have a flash memory storage */
36#define HAVE_FLASH_STORAGE
37
38#define CONFIG_STORAGE STORAGE_NAND
39
40#define CONFIG_NAND NAND_TCC
41
42/* LCD dimensions */
43#define LCD_WIDTH 128
44#define LCD_HEIGHT 64
45/* sqrt(128^2 + 64^2) / 1.8 = 79.5 */
46#define LCD_DPI 80
47#define LCD_DEPTH 1
48
49#define LCD_PIXELFORMAT VERTICAL_PACKING
50
51/* Display colours, for screenshots and sim (0xRRGGBB) */
52#define LCD_BARKCOLOR 0x000000
53#define LCD_BRIGHTCOLOR 0x5e6854
54#define LCD_BL_DARKCOLOR 0x000000
55#define LCD_BL_BRIGHTCOLOR 0x3ca0e6
56
57/* define this to indicate your device's keypad */
58#define CONFIG_KEYPAD SANSA_M200_PAD
59
60/* Define this to enable morse code input */
61#define HAVE_MORSE_INPUT
62
63/* define this if you have a real-time clock */
64#define CONFIG_RTC RTC_TCC77X
65
66/* define this if you have RTC RAM available for settings */
67//#define HAVE_RTC_RAM
68
69/* Define this if you have a software controlled poweroff */
70#define HAVE_SW_POWEROFF
71
72/* The number of bytes reserved for loadable codecs */
73#define CODEC_SIZE 0x38000
74
75/* The number of bytes reserved for loadable plugins */
76#define PLUGIN_BUFFER_SIZE 0x10000
77
78#define AB_REPEAT_ENABLE
79
80
81
82
83/* Define this if you have the TLV320 audio codec */
84#define HAVE_TLV320
85
86/* TLV320 has no tone controls, so we use the software ones */
87#define HAVE_SW_TONE_CONTROLS
88
89/* Define this for LCD backlight available */
90#define HAVE_BACKLIGHT
91
92#define CONFIG_I2C I2C_TCC77X
93
94#define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */
95#define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */
96#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */
97#define BATTERY_CAPACITY_INC 50 /* capacity increment */
98#define BATTERY_TYPES_COUNT 1 /* only one type */
99
100#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
101
102/* define this if the unit should not shut down on low battery. */
103#define NO_LOW_BATTERY_SHUTDOWN
104
105/* Define this if you have a TCC770 */
106#define CONFIG_CPU TCC770
107
108/* Define this if you have ATA power-off control */
109#define HAVE_ATA_POWER_OFF
110
111/* Define this to the CPU frequency */
112#define CPU_FREQ 120000000
113
114/* Offset ( in the firmware file's header ) to the file CRC */
115#define FIRMWARE_OFFSET_FILE_CRC 0
116
117/* Offset ( in the firmware file's header ) to the real data */
118#define FIRMWARE_OFFSET_FILE_DATA 8
119
120#define CONFIG_LCD LCD_SSD1815
121
122#define BOOTFILE_EXT "m200"
123#define BOOTFILE "rockbox." BOOTFILE_EXT
124#define BOOTDIR "/"
125
126#define IBSS_ATTR_VOICE_STACK
127#define ICODE_ATTR_TREMOR_NOT_MDCT
128#define ICODE_ATTR_TREMOR_MDCT
129#define ICODE_ATTR_FLAC
130#define IBSS_ATTR_FLAC_DECODED0
131#define ICONST_ATTR_MPA_HUFFMAN
132#define IBSS_ATTR_MPC_SAMPLE_BUF
133#define ICODE_ATTR_ALAC
134#define IBSS_ATTR_SHORTEN_DECODED0
135
136#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
137
138/* Define this if a programmable hotkey is mapped */
139#define HAVE_HOTKEY
diff --git a/firmware/export/cpu.h b/firmware/export/cpu.h
index aade199dd2..e862cedb74 100644
--- a/firmware/export/cpu.h
+++ b/firmware/export/cpu.h
@@ -50,9 +50,6 @@
50#if CONFIG_CPU == IMX31L 50#if CONFIG_CPU == IMX31L
51#include "imx31l.h" 51#include "imx31l.h"
52#endif 52#endif
53#ifdef CPU_TCC77X
54#include "tcc77x.h"
55#endif
56#ifdef CPU_TCC780X 53#ifdef CPU_TCC780X
57#include "tcc780x.h" 54#include "tcc780x.h"
58#endif 55#endif
diff --git a/firmware/export/tcc77x.h b/firmware/export/tcc77x.h
deleted file mode 100644
index 3c457c5b38..0000000000
--- a/firmware/export/tcc77x.h
+++ /dev/null
@@ -1,262 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef __TCC77X_H__
22#define __TCC77X_H__
23
24#define CACHEALIGN_BITS (5)
25
26/* General-purpose IO */
27
28#define GPIOA (*(volatile unsigned long *)0x80000300)
29#define GPIOB (*(volatile unsigned long *)0x80000310)
30#define GPIOC (*(volatile unsigned long *)0x80000320)
31#define GPIOD (*(volatile unsigned long *)0x80000330)
32#define GPIOE (*(volatile unsigned long *)0x80000340)
33
34#define GPIOA_DIR (*(volatile unsigned long *)0x80000304)
35#define GPIOB_DIR (*(volatile unsigned long *)0x80000314)
36#define GPIOC_DIR (*(volatile unsigned long *)0x80000324)
37#define GPIOD_DIR (*(volatile unsigned long *)0x80000334)
38#define GPIOE_DIR (*(volatile unsigned long *)0x80000344)
39
40#define GPIOA_FUNC (*(volatile unsigned long *)0x80000308)
41#define GPIOB_FUNC (*(volatile unsigned long *)0x80000318)
42#define GPIOC_FUNC (*(volatile unsigned long *)0x80000328)
43#define GPIOD_FUNC (*(volatile unsigned long *)0x80000338)
44#define GPIOE_FUNC (*(volatile unsigned long *)0x80000348)
45
46#define BMI (*(volatile unsigned long *)0x80000364)
47
48/* Clock Generator */
49
50#define CLKCTRL (*(volatile unsigned long *)0x80000400)
51#define PLL0CFG (*(volatile unsigned long *)0x80000404)
52#define CLKDIVC (*(volatile unsigned long *)0x8000040c)
53#define MODECTR (*(volatile unsigned long *)0x80000410)
54#define BCLKCTR (*(volatile unsigned long *)0x80000414)
55#define SWRESET (*(volatile unsigned long *)0x80000418)
56#define PCLKCFG0 (*(volatile unsigned long *)0x8000041c)
57#define PCLKCFG1 (*(volatile unsigned long *)0x80000420)
58#define PCLKCFG2 (*(volatile unsigned long *)0x80000424)
59#define PCLKCFG3 (*(volatile unsigned long *)0x80000428)
60#define PCLKCFG4 (*(volatile unsigned long *)0x8000042c)
61#define PCLKCFG5 (*(volatile unsigned long *)0x80000430)
62#define PCLKCFG6 (*(volatile unsigned long *)0x80000434)
63
64#define PCLK_DAI PCLKCFG6
65
66/* Device bits for SWRESET & BCLKCTR */
67
68#define DEV_DAI (1<<0)
69#define DEV_USBD (1<<4)
70#define DEV_ECC (1<<9)
71#define DEV_NAND (1<<16)
72
73/* ADC */
74
75#define ADCCON (*(volatile unsigned long *)0x80000a00)
76#define ADCDATA (*(volatile unsigned long *)0x80000a04)
77#define ADCCONA (*(volatile unsigned long *)0x80000a80)
78#define ADCSTATUS (*(volatile unsigned long *)0x80000a84)
79#define ADCCFG (*(volatile unsigned long *)0x80000a88)
80
81
82/* Memory Controller */
83#define SDCFG (*(volatile unsigned long *)0xf0000000)
84#define SDFSM (*(volatile unsigned long *)0xf0000004)
85#define MCFG (*(volatile unsigned long *)0xf0000008)
86#define TST (*(volatile unsigned long *)0xf000000c)
87#define CSCFG0 (*(volatile unsigned long *)0xf0000010)
88#define CSCFG1 (*(volatile unsigned long *)0xf0000014)
89#define CSCFG2 (*(volatile unsigned long *)0xf0000018)
90#define CSCFG3 (*(volatile unsigned long *)0xf000001c)
91#define CLKCFG (*(volatile unsigned long *)0xf0000020)
92#define SDCMD (*(volatile unsigned long *)0xf0000024)
93
94
95/* IRQ Controller */
96#define EXT0_IRQ_MASK (1<<0)
97#define EXT1_IRQ_MASK (1<<1)
98#define EXT2_IRQ_MASK (1<<2)
99#define EXT3_IRQ_MASK (1<<3)
100#define I2SR_IRQ_MASK (1<<4)
101#define I2ST_IRQ_MASK (1<<5)
102#define TIMER0_IRQ_MASK (1<<6)
103#define USBD_IRQ_MASK (1<<8) /* USB 2.0 device */
104#define USBH_IRQ_MASK (1<<10) /* USB 1.1 host */
105#define ADC_IRQ_MASK (1<<16)
106#define USB_DMA_IRQ_MASK (1<<26) /* USB DMA */
107#define ECC_IRQ_MASK (1<<27)
108
109#define DAI_RX_IRQ_MASK I2SR_IRQ_MASK
110#define DAI_TX_IRQ_MASK I2ST_IRQ_MASK
111
112#define USB_DMA_IRQ_MASK (1<<26) /* USB DMA */
113
114#define IEN (*(volatile unsigned long *)0x80000100)
115#define CREQ (*(volatile unsigned long *)0x80000104)
116#define IREQ (*(volatile unsigned long *)0x80000108)
117#define IRQSEL (*(volatile unsigned long *)0x8000010c)
118#define ICFG (*(volatile unsigned long *)0x80000110)
119#define MREQ (*(volatile unsigned long *)0x80000114)
120#define TSTREQ (*(volatile unsigned long *)0x80000118)
121#define IRQ (*(volatile unsigned long *)0x80000120)
122#define FIQ (*(volatile unsigned long *)0x80000124)
123#define MIRQ (*(volatile unsigned long *)0x80000128)
124#define MFIQ (*(volatile unsigned long *)0x8000012c)
125#define TMODE (*(volatile unsigned long *)0x80000130)
126#define SYNC (*(volatile unsigned long *)0x80000134)
127#define WKUP (*(volatile unsigned long *)0x80000138)
128
129/* Timer Controller */
130
131#define TCFG0 (*(volatile unsigned long *)0x80000200)
132#define TCNT0 (*(volatile unsigned long *)0x80000204)
133#define TREF0 (*(volatile unsigned long *)0x80000208)
134#define TMREF0 (*(volatile unsigned long *)0x8000020c)
135#define TCFG1 (*(volatile unsigned long *)0x80000210)
136#define TCNT1 (*(volatile unsigned long *)0x80000214)
137#define TREF1 (*(volatile unsigned long *)0x80000218)
138#define TMREF1 (*(volatile unsigned long *)0x8000021c)
139#define TCFG2 (*(volatile unsigned long *)0x80000220)
140#define TCNT2 (*(volatile unsigned long *)0x80000224)
141#define TREF2 (*(volatile unsigned long *)0x80000228)
142#define TMREF2 (*(volatile unsigned long *)0x8000022c)
143#define TCFG3 (*(volatile unsigned long *)0x80000230)
144#define TCNT3 (*(volatile unsigned long *)0x80000234)
145#define TREF3 (*(volatile unsigned long *)0x80000238)
146#define TMREF3 (*(volatile unsigned long *)0x8000023c)
147#define TCFG4 (*(volatile unsigned long *)0x80000240)
148#define TCNT4 (*(volatile unsigned long *)0x80000244)
149#define TREF4 (*(volatile unsigned long *)0x80000248)
150#define TCFG5 (*(volatile unsigned long *)0x80000250)
151#define TCNT5 (*(volatile unsigned long *)0x80000254)
152#define TREF5 (*(volatile unsigned long *)0x80000258)
153#define TIREQ (*(volatile unsigned long *)0x80000260)
154#define TWDCFG (*(volatile unsigned long *)0x80000270)
155#define TWDCLR (*(volatile unsigned long *)0x80000274)
156#define TC32EN (*(volatile unsigned long *)0x80000280)
157#define TC32LDV (*(volatile unsigned long *)0x80000284)
158#define TC32CMP0 (*(volatile unsigned long *)0x80000288)
159#define TC32CMP1 (*(volatile unsigned long *)0x8000028c)
160#define TC32PCNT (*(volatile unsigned long *)0x80000290)
161#define TC32MCNT (*(volatile unsigned long *)0x80000294)
162#define TC32IRQ (*(volatile unsigned long *)0x80000298)
163
164/* TIREQ flags */
165#define TF0 (1<<8) /* Timer 0 reference value reached */
166#define TF1 (1<<9) /* Timer 1 reference value reached */
167#define TI0 (1<<0) /* Timer 0 IRQ flag */
168#define TI1 (1<<1) /* Timer 1 IRQ flag */
169
170/* NAND Flash Controller */
171
172#define NFC_CMD (*(volatile unsigned long *)0x90000000)
173#define NFC_SADDR (*(volatile unsigned long *)0x9000000C)
174#define NFC_SDATA (*(volatile unsigned long *)0x90000040)
175#define NFC_WDATA (*(volatile unsigned long *)0x90000010)
176#define NFC_CTRL (*(volatile unsigned long *)0x90000050)
177 #define NFC_16BIT (1<<26)
178 #define NFC_CS0 (1<<23)
179 #define NFC_CS1 (1<<22)
180 #define NFC_READY (1<<20)
181#define NFC_IREQ (*(volatile unsigned long *)0x90000060)
182#define NFC_RST (*(volatile unsigned long *)0x90000064)
183
184
185/* ECC controller */
186
187#define ECC_CTRL (*(volatile unsigned long *)0x80000900)
188 #define ECC_DMA_REQ (1<<28)
189 #define ECC_ENC (1<<27) /* MLC ECC3/4 */
190 #define ECC_READY (1<<26)
191 #define ECC_IEN (1<<25)
192 #define ECC_MANUAL (1<<22)
193 #define ECC_WCNT (1<<12) /* [21:12] */
194 #define ECC_HOLD (1<<7)
195 #define ECC_M4EN (1<<6)
196 #define ECC_ZERO (1<<5)
197 #define ECC_M3EN (1<<4)
198 #define ECC_CNT_MASK (7<<1)
199 #define ECC_CNT (1<<1)
200 #define ECC_SLC (1<<0)
201
202#define ECC_BASE (*(volatile unsigned long *)0x80000904)
203#define ECC_MASK (*(volatile unsigned long *)0x80000908)
204#define ECC_CLR (*(volatile unsigned long *)0x8000090c)
205#define SLC_ECC0 (*(volatile unsigned long *)0x80000910)
206#define SLC_ECC1 (*(volatile unsigned long *)0x80000914)
207#define SLC_ECC2 (*(volatile unsigned long *)0x80000918)
208#define SLC_ECC3 (*(volatile unsigned long *)0x8000091c)
209#define SLC_ECC4 (*(volatile unsigned long *)0x80000920)
210#define SLC_ECC5 (*(volatile unsigned long *)0x80000924)
211#define SLC_ECC6 (*(volatile unsigned long *)0x80000928)
212#define SLC_ECC7 (*(volatile unsigned long *)0x8000092c)
213#define MLC_ECC0W (*(volatile unsigned long *)0x80000930)
214#define MLC_ECC1W (*(volatile unsigned long *)0x80000934)
215#define MLC_ECC2W (*(volatile unsigned long *)0x80000938)
216#define MLC_ECC0R (*(volatile unsigned long *)0x80000940)
217#define MLC_ECC1R (*(volatile unsigned long *)0x80000944)
218#define MLC_ECC2R (*(volatile unsigned long *)0x80000948)
219#define ECC_CORR_START (*(volatile unsigned long *)0x8000094c)
220#define ECC_ERRADDR(x) (*(volatile unsigned long *)(0x80000950+4*(x)))
221#define ECC_ERRDATA(x) (*(volatile unsigned long *)(0x80000960+4*(x)))
222#define ECC_ERR_NUM (*(volatile unsigned long *)0x80000970)
223
224
225/* Digital Audio Interface */
226#define DADI_L0 (*(volatile unsigned long *)0x80000000)
227#define DADI_R0 (*(volatile unsigned long *)0x80000004)
228#define DADI_L1 (*(volatile unsigned long *)0x80000008)
229#define DADI_R1 (*(volatile unsigned long *)0x8000000C)
230#define DADI_L2 (*(volatile unsigned long *)0x80000010)
231#define DADI_R2 (*(volatile unsigned long *)0x80000014)
232#define DADI_L3 (*(volatile unsigned long *)0x80000018)
233#define DADI_R3 (*(volatile unsigned long *)0x8000001c)
234
235#define DADO_L0 (*(volatile unsigned long *)0x80000020)
236#define DADO_R0 (*(volatile unsigned long *)0x80000024)
237#define DADO_L1 (*(volatile unsigned long *)0x80000028)
238#define DADO_R1 (*(volatile unsigned long *)0x8000002C)
239#define DADO_L2 (*(volatile unsigned long *)0x80000030)
240#define DADO_R2 (*(volatile unsigned long *)0x80000034)
241#define DADO_L3 (*(volatile unsigned long *)0x80000038)
242#define DADO_R3 (*(volatile unsigned long *)0x8000003c)
243
244#define DAMR (*(volatile unsigned long *)0x80000040)
245#define DAVC (*(volatile unsigned long *)0x80000044)
246
247#define DADI_L(x) (*(volatile unsigned long *)(0x80000000 + (x) * 8))
248#define DADI_R(x) (*(volatile unsigned long *)(0x80000004 + (x) * 8))
249#define DADO_L(x) (*(volatile unsigned long *)(0x80000020 + (x) * 8))
250#define DADO_R(x) (*(volatile unsigned long *)(0x80000024 + (x) * 8))
251
252/* USB 2.0 device system MMR base address */
253#define USB_BASE 0x90000b00
254
255#define USB_NUM_ENDPOINTS 3
256#define USB_DEVBSS_ATTR IBSS_ATTR
257
258/* Timer frequency */
259/* timers are based on XIN (12Mhz) */
260#define TIMER_FREQ (12000000)
261
262#endif
diff --git a/firmware/target/arm/ata-nand-telechips.c b/firmware/target/arm/ata-nand-telechips.c
index 73d92a5215..55f6b1f3f7 100644
--- a/firmware/target/arm/ata-nand-telechips.c
+++ b/firmware/target/arm/ata-nand-telechips.c
@@ -48,7 +48,7 @@ static long next_yield = 0;
48 48
49static struct mutex ata_mtx SHAREDBSS_ATTR; 49static struct mutex ata_mtx SHAREDBSS_ATTR;
50 50
51#if defined(COWON_D2) || defined(IAUDIO_7) 51#if defined(COWON_D2)
52#define FTL_V2 52#define FTL_V2
53#define MAX_WRITE_CACHES 8 53#define MAX_WRITE_CACHES 8
54#else 54#else
@@ -906,13 +906,6 @@ int nand_init(void)
906 906
907 mutex_init(&ata_mtx); 907 mutex_init(&ata_mtx);
908 908
909#ifdef CPU_TCC77X
910 CSCFG2 = 0x018a8010 | tcc77x_cscfg_bw(TCC77X_CSCFG_BW8);
911
912 GPIOC_FUNC &= ~(CS_GPIO_BIT | WE_GPIO_BIT);
913 GPIOC_FUNC |= 0x1;
914#endif
915
916 /* Set GPIO direction for chip select & write protect */ 909 /* Set GPIO direction for chip select & write protect */
917 NAND_GPIO_OUT_EN(CS_GPIO_BIT | WE_GPIO_BIT); 910 NAND_GPIO_OUT_EN(CS_GPIO_BIT | WE_GPIO_BIT);
918 911
diff --git a/firmware/target/arm/lcd-ssd1815.c b/firmware/target/arm/lcd-ssd1815.c
index 891d4ef64d..028362f91c 100644
--- a/firmware/target/arm/lcd-ssd1815.c
+++ b/firmware/target/arm/lcd-ssd1815.c
@@ -144,81 +144,6 @@ void lcd_init_device(void)
144 lcd_write_command(LCD_SET_NORMAL_DISPLAY); 144 lcd_write_command(LCD_SET_NORMAL_DISPLAY);
145} 145}
146 146
147
148#elif defined(CPU_TCC77X)
149
150/* TCC77x specific defines */
151#define LCD_BASE 0x50000000
152#define LCD_CMD *(volatile unsigned char*)(LCD_BASE)
153#define LCD_DATA *(volatile unsigned char*)(LCD_BASE+1)
154
155void lcd_write_command(int byte)
156{
157 LCD_CMD = byte;
158
159 asm volatile (
160 "nop \n\t"
161 "nop \n\t"
162 "nop \n\t"
163 );
164}
165
166void lcd_write_data(const fb_data* p_bytes, int count)
167{
168 while (count--)
169 {
170 LCD_DATA = *(p_bytes++);
171
172 asm volatile (
173 "nop \n\t"
174 "nop \n\t"
175 "nop \n\t"
176 );
177 }
178}
179
180/* LCD init */
181void lcd_init_device(void)
182{
183 uint32_t bus_width;
184
185 /* Telechips init the same as the original firmware */
186 CSCFG1 &= 0xc3ffc000;
187 CSCFG1 |= 0x3400101a;
188 CSCFG1 |= (1 << 21);
189 CSCFG1 &= ~(1 << 21);
190
191 bus_width = ((MCFG >> 11) & 0x3) ^ 3;
192
193 CSCFG1 = (bus_width << 28) |
194 (3 << 26) | /* MTYPE = 3 */
195 ((LCD_BASE >> 28) << 22) | /* CSBASE = 0x5 */
196 (1 << 20) | /* Unknown */
197 (3 << 11) | /* Setup time = 3 cycles */
198 (3 << 3) | /* Pulse width = 3+1 cycles */
199 (1 << 0); /* Hold time = 1 cycle */
200
201 /* SSD1815 inits like the original firmware */
202 lcd_write_command(LCD_SET_DISPLAY_OFF);
203 lcd_set_flip(false);
204 lcd_write_command(LCD_SET_INTERNAL_REGULATOR_RESISTOR_RATIO | 5);
205 lcd_set_contrast(lcd_default_contrast());
206 lcd_write_command(LCD_SET_POWER_CONTROL_REGISTER | 7);
207 /* power control register: op-amp=1, regulator=1, booster=1 */
208 lcd_write_command(LCD_SET_BIAS_TC_OSC);
209
210 /* 0xc2 = 110 000 10: Osc. Freq 110 - ???
211 TC value 000 - "-0.01%/C (TC0, POR)"
212 Bias ratio 10 - "1/9, 1/7 (POR)"
213 */
214 lcd_write_command(0xc2);
215 lcd_write_command(LCD_SET_DISPLAY_ON);
216
217 lcd_clear_display();
218 lcd_update();
219}
220
221/* End of TCC77x specific defines */
222#endif 147#endif
223 148
224 149
diff --git a/firmware/target/arm/pcm-telechips.c b/firmware/target/arm/pcm-telechips.c
index 68bae1b0a9..ff550b14d6 100644
--- a/firmware/target/arm/pcm-telechips.c
+++ b/firmware/target/arm/pcm-telechips.c
@@ -82,19 +82,6 @@ void pcm_play_dma_init(void)
82 82
83 /* Enable DAI block in Master mode, 256fs->32fs, 16bit LSB */ 83 /* Enable DAI block in Master mode, 256fs->32fs, 16bit LSB */
84 DAMR = 0x3c8e80; 84 DAMR = 0x3c8e80;
85#elif defined(IAUDIO_7)
86 BCLKCTR &= ~DEV_DAI;
87 PCLK_DAI = (0x800a << 16) | (PCLK_DAI & 0xffff);
88 BCLKCTR |= DEV_DAI;
89
90 /* Master mode, 256->64fs, 16bit LSB*/
91 DAMR = 0x3cce20;
92#elif defined(LOGIK_DAX)
93 /* TODO */
94#elif defined(SANSA_M200)
95 /* TODO */
96#elif defined(SANSA_C100)
97 /* TODO */
98#else 85#else
99#error "Target isn't supported" 86#error "Target isn't supported"
100#endif 87#endif
@@ -228,7 +215,7 @@ const void * pcm_rec_dma_get_peak_buffer(void)
228} 215}
229#endif 216#endif
230 217
231#if defined(CPU_TCC77X) || defined(CPU_TCC780X) 218#if defined(CPU_TCC780X)
232void fiq_handler(void) ICODE_ATTR __attribute__((naked)); 219void fiq_handler(void) ICODE_ATTR __attribute__((naked));
233void fiq_handler(void) 220void fiq_handler(void)
234{ 221{
@@ -245,9 +232,6 @@ void fiq_handler(void)
245#if defined(CPU_TCC780X) 232#if defined(CPU_TCC780X)
246 "mov r8, #0xc000 \n" /* DAI_TX_IRQ_MASK | DAI_RX_IRQ_MASK */ 233 "mov r8, #0xc000 \n" /* DAI_TX_IRQ_MASK | DAI_RX_IRQ_MASK */
247 "ldr r9, =0xf3001004 \n" /* CREQ */ 234 "ldr r9, =0xf3001004 \n" /* CREQ */
248#elif defined(CPU_TCC77X)
249 "mov r8, #0x0030 \n" /* DAI_TX_IRQ_MASK | DAI_RX_IRQ_MASK */
250 "ldr r9, =0x80000104 \n" /* CREQ */
251#endif 235#endif
252 "str r8, [r9] \n" /* clear DAI IRQs */ 236 "str r8, [r9] \n" /* clear DAI IRQs */
253 "ldmia r11, { r8-r9 } \n" /* r8 = p, r9 = size */ 237 "ldmia r11, { r8-r9 } \n" /* r8 = p, r9 = size */
diff --git a/firmware/target/arm/system-arm.h b/firmware/target/arm/system-arm.h
index e5d3f35001..af16346b51 100644
--- a/firmware/target/arm/system-arm.h
+++ b/firmware/target/arm/system-arm.h
@@ -382,7 +382,7 @@ static inline uint32_t swaw32_hw(uint32_t value)
382 382
383} 383}
384 384
385#if defined(CPU_TCC780X) || defined(CPU_TCC77X) /* Single core only for now */ \ 385#if defined(CPU_TCC780X) /* Single core only for now */ \
386|| CONFIG_CPU == IMX31L || CONFIG_CPU == DM320 || CONFIG_CPU == AS3525 \ 386|| CONFIG_CPU == IMX31L || CONFIG_CPU == DM320 || CONFIG_CPU == AS3525 \
387|| CONFIG_CPU == S3C2440 || CONFIG_CPU == S5L8701 || CONFIG_CPU == AS3525v2 \ 387|| CONFIG_CPU == S3C2440 || CONFIG_CPU == S5L8701 || CONFIG_CPU == AS3525v2 \
388|| CONFIG_CPU == S5L8702 388|| CONFIG_CPU == S5L8702
diff --git a/firmware/target/arm/tcc77x/adc-tcc77x.c b/firmware/target/arm/tcc77x/adc-tcc77x.c
deleted file mode 100644
index f48528639e..0000000000
--- a/firmware/target/arm/tcc77x/adc-tcc77x.c
+++ /dev/null
@@ -1,121 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "config.h"
22#include "cpu.h"
23#include "system.h"
24#include "kernel.h"
25#include "thread.h"
26#include "string.h"
27#include "adc.h"
28
29/**************************************************************************
30 ** The A/D conversion is done every tick, in three steps:
31 **
32 ** 1) On the tick interrupt, the conversion of channels 0-3 is started, and
33 ** the A/D interrupt is enabled.
34 **
35 ** 2) After the conversion is done, an interrupt
36 ** is generated at level 1, which is the same level as the tick interrupt
37 ** itself. This interrupt will be pending until the tick interrupt is
38 ** finished.
39 ** When the A/D interrupt is finally served, it will read the results
40 ** from the first conversion and start the conversion of channels 4-7.
41 **
42 ** 3) When the conversion of channels 4-7 is finished, the interrupt is
43 ** triggered again, and the results are read. This time, no new
44 ** conversion is started, it will be done in the next tick interrupt.
45 **
46 ** Thus, each channel will be updated HZ times per second.
47 **
48 *************************************************************************/
49
50static int channel_group;
51static unsigned short adcdata[8];
52
53/* Tick task */
54static void adc_tick(void)
55{
56 /* Start a conversion of channels 0-3. This will trigger an interrupt,
57 and the interrupt handler will take care of channels 4-7. */
58
59 int i;
60
61 PCLKCFG6 |= (1<<15); /* Enable ADC clock */
62
63 channel_group = 0;
64
65 /* Start converting the first 4 channels */
66 for (i = 0; i < 4; i++)
67 ADCCON = i;
68
69}
70
71/* IRQ handler */
72void ADC(void)
73{
74 int num;
75 int i;
76 uint32_t adc_status;
77
78 do
79 {
80 adc_status = ADCSTATUS;
81 num = (adc_status>>24) & 7;
82 if (num) adcdata[(adc_status >> 16) & 0x7] = adc_status & 0x3ff;
83 } while (num);
84
85
86 if (channel_group == 0)
87 {
88 /* Start conversion of channels 4-7 */
89 for (i = 4; i < 8; i++)
90 ADCCON = i;
91
92 channel_group = 1;
93 }
94 else
95 {
96 PCLKCFG6 &= ~(1<<15); /* Disable ADC clock */
97 }
98}
99
100unsigned short adc_read(int channel)
101{
102 return adcdata[channel];
103}
104
105void adc_init(void)
106{
107 /* Initialize ADC clocks */
108 PCLKCFG6 = (PCLKCFG6 & 0xffff0000) | 4004;
109
110 ADCCON = (1<<4); /* Leave standby mode */
111
112 /* IRQ enable, auto power-down, single-mode */
113 ADCCFG |= (1<<3) | (1<<1) | (1<<0);
114
115 /* Unmask ADC IRQ */
116 IEN |= ADC_IRQ_MASK;
117
118 tick_add_task(adc_tick);
119
120 sleep(2); /* Ensure adc_data[] contains data before returning */
121}
diff --git a/firmware/target/arm/tcc77x/app.lds b/firmware/target/arm/tcc77x/app.lds
deleted file mode 100644
index 991b7156fe..0000000000
--- a/firmware/target/arm/tcc77x/app.lds
+++ /dev/null
@@ -1,99 +0,0 @@
1#include "config.h"
2
3ENTRY(start)
4OUTPUT_FORMAT(elf32-littlearm)
5OUTPUT_ARCH(arm)
6STARTUP(target/arm/tcc77x/crt0.o)
7
8#define PLUGINSIZE PLUGIN_BUFFER_SIZE
9#define CODECSIZE CODEC_SIZE
10
11#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE - CODECSIZE
12
13#define DRAMORIG 0x20000000
14#define IRAMORIG 0x00000000
15#define IRAMSIZE 64K
16
17
18/* End of the audio buffer, where the codec buffer starts */
19#define ENDAUDIOADDR (DRAMORIG + DRAMSIZE)
20
21/* Where the codec buffer ends, and the plugin buffer starts */
22#define ENDADDR (ENDAUDIOADDR + CODECSIZE)
23
24
25MEMORY
26{
27#ifdef TCCBOOT
28 DRAM : ORIGIN = DRAMORIG + DRAMSIZE - 0x100000, LENGTH = 0x100000
29#else
30 DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
31#endif
32 IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
33}
34
35SECTIONS
36{
37 .text : {
38 loadaddress = .;
39 _loadaddress = .;
40 . = ALIGN(0x200);
41 *(.init.text)
42 *(.text)
43 *(.text*)
44 *(.glue_7)
45 *(.glue_7t)
46 } > DRAM
47
48 .data : {
49 *(.icode)
50 *(.irodata)
51 *(.idata)
52 *(.data*)
53 *(.rodata.*)
54 *(.rodata)
55 . = ALIGN(0x4);
56 _dataend = . ;
57 } > DRAM
58
59 .stack :
60 {
61 *(.stack)
62 _stackbegin = .;
63 stackbegin = .;
64 . += 0x2000;
65 _stackend = .;
66 stackend = .;
67 } > DRAM
68
69 .bss : {
70 _edata = .;
71 *(.bss*);
72 *(.ibss);
73 *(COMMON)
74 _end = .;
75 } > DRAM
76 .audiobuf ALIGN(4) :
77 {
78 _audiobuffer = .;
79 audiobuffer = .;
80 } > DRAM
81
82 .audiobufend ENDAUDIOADDR:
83 {
84 audiobufend = .;
85 _audiobufend = .;
86 } > DRAM
87
88 .codec ENDAUDIOADDR:
89 {
90 codecbuf = .;
91 _codecbuf = .;
92 }
93
94 .plugin ENDADDR:
95 {
96 _pluginbuf = .;
97 pluginbuf = .;
98 }
99}
diff --git a/firmware/target/arm/tcc77x/ata-nand-target.h b/firmware/target/arm/tcc77x/ata-nand-target.h
deleted file mode 100644
index 93139a16d5..0000000000
--- a/firmware/target/arm/tcc77x/ata-nand-target.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef ATA_TARGET_H
22#define ATA_TARGET_H
23
24/* GPIOs */
25
26#define NAND_GPIO_SET(n) GPIOC |= n
27#define NAND_GPIO_CLEAR(n) GPIOC &= (~n)
28#define NAND_GPIO_OUT_EN(n) GPIOC_DIR |= n
29
30#define CS_GPIO_BIT (1<<24) /* Chip Select */
31#define WE_GPIO_BIT (1<<25) /* Write Enable */
32
33#endif
diff --git a/firmware/target/arm/tcc77x/boot.lds b/firmware/target/arm/tcc77x/boot.lds
deleted file mode 100644
index 6303de0c34..0000000000
--- a/firmware/target/arm/tcc77x/boot.lds
+++ /dev/null
@@ -1,63 +0,0 @@
1#include "config.h"
2
3ENTRY(start)
4OUTPUT_FORMAT(elf32-littlearm)
5OUTPUT_ARCH(arm)
6STARTUP(target/arm/tcc77x/crt0.o)
7
8#define DRAMSIZE (MEMORYSIZE * 0x100000)
9
10#define DRAMORIG 0x20000000
11#define IRAMORIG 0x00000000
12#define IRAMSIZE 64K
13
14
15MEMORY
16{
17#ifdef TCCBOOT
18 DRAM : ORIGIN = DRAMORIG + DRAMSIZE - 0x100000, LENGTH = 0x100000
19#else
20 DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
21#endif
22 IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
23}
24
25SECTIONS
26{
27 .text : {
28 *(.init.text)
29 *(.text)
30 *(.text*)
31 *(.glue_7)
32 *(.glue_7t)
33 } > DRAM
34
35 .data : {
36 *(.icode)
37 *(.irodata)
38 *(.idata)
39 *(.data*)
40 *(.rodata.*)
41 *(.rodata)
42 . = ALIGN(0x4);
43 _dataend = . ;
44 } > DRAM
45
46 .stack (NOLOAD) :
47 {
48 *(.stack)
49 _stackbegin = .;
50 stackbegin = .;
51 . += 0x2000;
52 _stackend = .;
53 stackend = .;
54 } > DRAM
55
56 .bss (NOLOAD) : {
57 _edata = .;
58 *(.bss*);
59 *(.ibss);
60 *(COMMON)
61 _end = .;
62 } > DRAM
63}
diff --git a/firmware/target/arm/tcc77x/c100/adc-target.h b/firmware/target/arm/tcc77x/c100/adc-target.h
deleted file mode 100644
index 0990d4d62d..0000000000
--- a/firmware/target/arm/tcc77x/c100/adc-target.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef _ADC_TARGET_H_
22#define _ADC_TARGET_H_
23
24#define NUM_ADC_CHANNELS 8
25
26#endif /* _ADC_TARGET_H_ */
diff --git a/firmware/target/arm/tcc77x/c100/backlight-target.h b/firmware/target/arm/tcc77x/c100/backlight-target.h
deleted file mode 100644
index 7ae71022f0..0000000000
--- a/firmware/target/arm/tcc77x/c100/backlight-target.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef BACKLIGHT_TARGET_H
22#define BACKLIGHT_TARGET_H
23
24#include "tcc77x.h"
25
26#define backlight_hw_init() true
27
28static inline void backlight_hw_on(void)
29{
30 /* Enable backlight */
31 GPIOE |= 0x2;
32}
33
34static inline void backlight_hw_off(void)
35{
36 /* Disable backlight */
37 GPIOE &= ~0x2;
38}
39
40#endif
diff --git a/firmware/target/arm/tcc77x/c100/button-c100.c b/firmware/target/arm/tcc77x/c100/button-c100.c
deleted file mode 100644
index 47b004eb61..0000000000
--- a/firmware/target/arm/tcc77x/c100/button-c100.c
+++ /dev/null
@@ -1,64 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "config.h"
23#include "cpu.h"
24#include "button.h"
25
26void button_init_device(void)
27{
28 GPIOA_DIR |= 0xC;
29}
30
31int button_read_device(void)
32{
33 int btn = BUTTON_NONE;
34
35 if (!button_hold())
36 {
37 GPIOA |= 0x4;
38 GPIOA &= ~0x8;
39
40 int i=20; while (i--);
41
42 if (GPIOA & 0x10) btn |= BUTTON_UP;
43 if (GPIOA & 0x20) btn |= BUTTON_RIGHT;
44 if (GPIOA & 0x40) btn |= BUTTON_LEFT;
45
46 GPIOA |= 0x8;
47 GPIOA &= ~0x4;
48
49 i=20; while (i--);
50
51 if (GPIOA & 0x10) btn |= BUTTON_VOLUP;
52 if (GPIOA & 0x20) btn |= BUTTON_VOLDOWN;
53 if (GPIOA & 0x40) btn |= BUTTON_DOWN;
54
55 if (GPIOA & 0x80) btn |= BUTTON_SELECT;
56 if (GPIOA & 0x100) btn |= BUTTON_POWER;
57 }
58 return btn;
59}
60
61bool button_hold(void)
62{
63 return (GPIOA & 0x2);
64}
diff --git a/firmware/target/arm/tcc77x/c100/button-target.h b/firmware/target/arm/tcc77x/c100/button-target.h
deleted file mode 100644
index 0e8b7e8f1c..0000000000
--- a/firmware/target/arm/tcc77x/c100/button-target.h
+++ /dev/null
@@ -1,45 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#ifndef _BUTTON_TARGET_H_
23#define _BUTTON_TARGET_H_
24
25#define HAS_BUTTON_HOLD
26
27/* Main unit's buttons */
28#define BUTTON_POWER 0x00000001
29#define BUTTON_VOLUP 0x00000002
30#define BUTTON_VOLDOWN 0x00000004
31#define BUTTON_UP 0x00000008
32#define BUTTON_DOWN 0x00000010
33#define BUTTON_LEFT 0x00000020
34#define BUTTON_RIGHT 0x00000040
35#define BUTTON_SELECT 0x00000080
36
37#define BUTTON_MAIN (BUTTON_POWER|BUTTON_VOLUP|BUTTON_VOLDOWN\
38 |BUTTON_UP|BUTTON_DOWN|BUTTON_LEFT\
39 |BUTTON_RIGHT|BUTTON_SELECT)
40
41/* Software power-off */
42#define POWEROFF_BUTTON BUTTON_POWER
43#define POWEROFF_COUNT 40
44
45#endif /* _BUTTON_TARGET_H_ */
diff --git a/firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c b/firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c
deleted file mode 100644
index c53aadaf30..0000000000
--- a/firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c
+++ /dev/null
@@ -1,286 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Mark Arigo
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "config.h"
22#include "cpu.h"
23#include "lcd.h"
24#include "kernel.h"
25#include "system.h"
26
27/* Display status */
28static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0;
29
30/* LCD command set for Samsung S6B33B2 */
31#define R_NOP 0x00
32#define R_OSCILLATION_MODE 0x02
33#define R_DRIVER_OUTPUT_MODE 0x10
34#define R_DCDC_SET 0x20
35#define R_BIAS_SET 0x22
36#define R_DCDC_CLOCK_DIV 0x24
37#define R_DCDC_AMP_ONOFF 0x26
38#define R_TEMP_COMPENSATION 0x28
39#define R_CONTRAST_CONTROL1 0x2a
40#define R_CONTRAST_CONTROL2 0x2b
41#define R_STANDBY_OFF 0x2c
42#define R_STANDBY_ON 0x2d
43#define R_DDRAM_BURST_OFF 0x2e
44#define R_DDRAM_BURST_ON 0x2f
45#define R_ADDRESSING_MODE 0x30
46#define R_ROW_VECTOR_MODE 0x32
47#define R_N_LINE_INVERSION 0x34
48#define R_FRAME_FREQ_CONTROL 0x36
49#define R_RED_PALETTE 0x38
50#define R_GREEN_PALETTE 0x3a
51#define R_BLUE_PALETTE 0x3c
52#define R_ENTRY_MODE 0x40
53#define R_X_ADDR_AREA 0x42
54#define R_Y_ADDR_AREA 0x43
55#define R_RAM_SKIP_AREA 0x45
56#define R_DISPLAY_OFF 0x50
57#define R_DISPLAY_ON 0x51
58#define R_SPEC_DISPLAY_PATTERN 0x53
59#define R_PARTIAL_DISPLAY_MODE 0x55
60#define R_PARTIAL_START_LINE 0x56
61#define R_PARTIAL_END_LINE 0x57
62#define R_AREA_SCROLL_MODE 0x59
63#define R_SCROLL_START_LINE 0x5a
64#define R_DATA_FORMAT_SELECT 0x60
65
66/* TCC77x specific defines */
67#define LCD_BASE 0x50000000
68#define LCD_CMD *(volatile unsigned char*)(LCD_BASE)
69#define LCD_DATA *(volatile unsigned char*)(LCD_BASE+1)
70
71static void lcd_send_command(unsigned cmd)
72{
73 LCD_CMD = cmd;
74
75 asm volatile (
76 "nop \n\t"
77 "nop \n\t"
78 "nop \n\t"
79 );
80}
81
82static void lcd_send_data(unsigned data)
83{
84 LCD_DATA = (data & 0xff00) >> 8;
85 LCD_DATA = (data & 0x00ff);
86}
87
88/* End of TCC77x specific defines */
89
90/* LCD init */
91void lcd_init_device(void)
92{
93 uint32_t bus_width;
94
95 /* Telechips init the same as the original firmware */
96 bus_width = ((MCFG >> 11) & 0x3) ^ 3;
97
98 CSCFG1 = (bus_width << 28) |
99 (3 << 26) | /* MTYPE = 3 */
100 ((LCD_BASE >> 28) << 22) | /* CSBASE = 0x5 */
101 (1 << 20) | /* Unknown */
102 (2 << 11) | /* Setup time = 2 cycles */
103 (2 << 3) | /* Pulse width = 2+1 cycles */
104 (2 << 0); /* Hold time = 2 cycle */
105
106 GPIOE &= ~0x8;
107 sleep(HZ/100); /* 10ms */
108
109 GPIOE |= 0x08;
110 sleep(HZ/100); /* 10ms */
111
112 lcd_send_command(R_STANDBY_OFF);
113 sleep(HZ/20); /* 50ms */
114
115 lcd_send_command(R_OSCILLATION_MODE);
116 lcd_send_command(0x01);
117 sleep(HZ/100); /* 10ms */
118
119 lcd_send_command(R_DCDC_AMP_ONOFF);
120 lcd_send_command(0x01);
121 sleep(HZ/100); /* 10ms */
122
123 lcd_send_command(R_DCDC_AMP_ONOFF);
124 lcd_send_command(0x09);
125 sleep(HZ/100); /* 10ms */
126
127 lcd_send_command(R_DCDC_AMP_ONOFF);
128 lcd_send_command(0x0b);
129 sleep(HZ/100); /* 10ms */
130
131 lcd_send_command(R_DCDC_AMP_ONOFF);
132 lcd_send_command(0x0f);
133 sleep(HZ/100); /* 10ms */
134
135 lcd_send_command(R_DCDC_SET);
136 lcd_send_command(0x01);
137 sleep(HZ/100); /* 10ms */
138 sleep(HZ/10); /* 100ms */
139
140 lcd_send_command(R_TEMP_COMPENSATION);
141 lcd_send_command(0x01);
142 sleep(HZ/100); /* 10ms */
143
144 lcd_send_command(R_DRIVER_OUTPUT_MODE);
145 lcd_send_command(0x03);
146
147 lcd_send_command(R_ENTRY_MODE);
148 lcd_send_command(0x81);
149
150 lcd_send_command(R_N_LINE_INVERSION);
151 lcd_send_command(0x04);
152 lcd_send_command(0xfa);
153 lcd_send_command(0x5f);
154
155 lcd_set_contrast(0x28);
156
157 lcd_send_command(R_SPEC_DISPLAY_PATTERN);
158 lcd_send_command(0x0);
159 sleep(HZ/100); /* 10ms */
160
161 lcd_send_command(R_ADDRESSING_MODE);
162 lcd_send_command(0x0);
163 sleep(HZ/100); /* 10ms */
164
165 lcd_send_command(R_PARTIAL_DISPLAY_MODE);
166 lcd_send_command(0x0);
167 sleep(HZ/100); /* 10ms */
168
169 lcd_send_command(R_X_ADDR_AREA);
170 lcd_send_command(0);
171 lcd_send_command(0x80);
172
173 lcd_send_command(R_Y_ADDR_AREA);
174 lcd_send_command(0x0);
175 lcd_send_command(0x80);
176
177 lcd_send_command(R_DISPLAY_ON);
178
179 lcd_send_command(R_SPEC_DISPLAY_PATTERN);
180 lcd_send_command(0x0);
181
182 /* Rockbox init */
183 lcd_clear_display();
184 lcd_update();
185}
186
187/*** hardware configuration ***/
188int lcd_default_contrast(void)
189{
190 return 0x28;
191}
192
193void lcd_set_contrast(int val)
194{
195 //val &= 0xFF;
196 lcd_send_command(R_CONTRAST_CONTROL1);
197 lcd_send_command(val);
198}
199
200void lcd_set_invert_display(bool yesno)
201{
202 /* TODO: Implement lcd_set_invert_display() */
203 (void)yesno;
204}
205
206/* turn the display upside down (call lcd_update() afterwards) */
207void lcd_set_flip(bool yesno)
208{
209 lcd_send_command(R_DRIVER_OUTPUT_MODE);
210 lcd_send_command(yesno ? 0x02 : 0x07);
211}
212
213/*** update functions ***/
214void lcd_yuv_set_options(unsigned options)
215{
216 lcd_yuv_options = options;
217}
218
219/* TODO: implement me */
220void lcd_blit_yuv(unsigned char *const src[3],
221 int src_x, int src_y, int stride,
222 int x, int y, int width, int height)
223{
224 (void) src;
225 (void) src_x;
226 (void) src_y;
227 (void) stride;
228 (void) x;
229 (void) y;
230
231 return;
232
233}
234
235/* Update the display.
236 This must be called after all other LCD functions that change the display. */
237void lcd_update(void)
238{
239 lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
240}
241
242/* Update a fraction of the display. */
243void lcd_update_rect(int x, int y, int width, int height)
244{
245 const fb_data *addr;
246
247 if (x + width >= LCD_WIDTH)
248 width = LCD_WIDTH - x;
249 if (y + height >= LCD_HEIGHT)
250 height = LCD_HEIGHT - y;
251
252 if ((width <= 0) || (height <= 0))
253 return; /* Nothing left to do. */
254
255 addr = FBADDR(x,y);
256
257 if (width <= 1) {
258 lcd_send_command(R_ENTRY_MODE); /* The X end address must be larger */
259 lcd_send_command(0x80); /* that the X start address, so we */
260 lcd_send_command(R_X_ADDR_AREA); /* switch to vertical mode for */
261 lcd_send_command(x); /* single column updates and set */
262 lcd_send_command(x + 1); /* the window width to 2 */
263 } else {
264 lcd_send_command(R_ENTRY_MODE);
265 lcd_send_command(0x82);
266 lcd_send_command(R_X_ADDR_AREA);
267 lcd_send_command(x);
268 lcd_send_command(x + width - 1);
269 }
270
271 lcd_send_command(R_Y_ADDR_AREA);
272 lcd_send_command(y);
273 lcd_send_command(y + height - 1);
274
275 /* NOP needed because on some c200s, the previous lcd_send_command is
276 interpreted as a separate command instead of part of R_Y_ADDR_AREA. */
277 lcd_send_command(R_NOP);
278
279 do {
280 int w = width;
281 do {
282 lcd_send_data(*addr++);
283 } while (--w > 0);
284 addr += LCD_WIDTH - width;
285 } while (--height > 0);
286}
diff --git a/firmware/target/arm/tcc77x/c100/power-c100.c b/firmware/target/arm/tcc77x/c100/power-c100.c
deleted file mode 100644
index e84ff1c852..0000000000
--- a/firmware/target/arm/tcc77x/c100/power-c100.c
+++ /dev/null
@@ -1,43 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "config.h"
22#include "cpu.h"
23#include <stdbool.h>
24#include "kernel.h"
25#include "system.h"
26#include "power.h"
27
28void power_init(void)
29{
30}
31
32void ide_power_enable(bool on)
33{
34}
35
36bool ide_powered(void)
37{
38 return true;
39}
40
41void power_off(void)
42{
43}
diff --git a/firmware/target/arm/tcc77x/crt0.S b/firmware/target/arm/tcc77x/crt0.S
deleted file mode 100644
index aebd8974da..0000000000
--- a/firmware/target/arm/tcc77x/crt0.S
+++ /dev/null
@@ -1,230 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22/* Arm bootloader and startup code based on startup.s from the iPodLinux loader
23 *
24 * Copyright (c) 2003, Daniel Palffy (dpalffy (at) rainstorm.org)
25 * Copyright (c) 2005, Bernard Leach <leachbj@bouncycastle.org>
26 *
27 */
28
29#include "config.h"
30#include "cpu.h"
31
32 .section .init.text,"ax",%progbits
33
34 .extern irq
35 .extern fiq
36 .extern UIE
37 .extern main
38
39 .global start
40
41/* Telechips firmware files start with a 32-byte header, as part of the code. */
42
43start:
44#ifdef TCCBOOT
45 /* Add -DTCCBOOT to EXTRA_DEFINES in the bootloader Makefile to
46 enable building the bootloader to be appended to the end of the
47 original firmware, dual-booting based on a key-press.
48
49 The following two values are filled in by mktccboot.
50 */
51of_entrypoint: .word 0 /* Saved entrypoint of original firmware*/
52bl_entrypoint: .word 0 /* Location in RAM of the start of our bootloader */
53
54#else
55// ldr pc, =start_loc /* jump to the main entry point */
56 b start_loc
57
58 .word 0xffff0601 /* Unknown magic */
59 .word 0x3a726556 /* "Ver:" */
60 .word 0x31373030 /* "0071" */
61 .word 0 /* First CRC32 */
62 .word 0 /* Unknown - always 0 */
63 .word 0 /* Second CRC32 */
64 .word 0 /* length of firmware file */
65
66#if defined(LOGIK_DAX) || defined(SANSA_C100)
67 /* Some original firmwares have 0x40 bytes of zeroes here - we
68 don't know why, but err on the side of caution and include it
69 here. */
70 .space 0x40
71#endif
72#endif
73
74start_loc:
75
76#ifdef BOOTLOADER
77
78/*
79 If we are appended to the OF (i.e. dual-booting), do a simple GPIO
80 button check, and branch to the OF's entry point (saved by mktccboot)
81 if not active
82*/
83
84#ifdef TCCBOOT
85 mov r0, #0x80000000
86#if defined(LOGIK_DAX) || defined(SANSA_C100)
87 ldr r0, [r0, #0x300] /* Hold button is GPIO A, pin 0x2 */
88 tst r0, #0x2
89#elif defined(SANSA_M200)
90 ldr r0, [r0, #0x310] /* Hold button is GPIO B, pin 0x200 */
91 tst r0, #0x200
92#elif defined(IAUDIO_7)
93 ldr r0, [r0, #0x300] /* Hold button is !GPIO A, pin 0x2 */
94 tst r0, #0x2
95#else
96 #error No bootup key detection implemented for this target
97#endif
98
99 ldrne pc, of_entrypoint /* Jump to OF if HOLD button not pressed */
100#endif /* TCCBOOT */
101
102/* We are now definitely executing the bootloader, so we relocate to the
103 linked address (see boot.lds) - 1MB from the end of DRAM.
104*/
105
106#ifdef TCCBOOT
107 ldr r0, bl_entrypoint
108#else
109 mov r0, #0x20000000 /* Otherwise, load address is the start of DRAM */
110#endif
111 mov r1, #0x20000000 /* Destination: 1MB from end of DRAM */
112 add r1, r1, #((MEMORYSIZE - 1) * 0x100000)
113
114 ldr r2, =_dataend
1151:
116 cmp r2, r1
117 ldrhi r3, [r0], #4
118 strhi r3, [r1], #4
119 bhi 1b
120
121 ldr pc, =copied_start /* jump to the relocated start_loc: */
122copied_start:
123#endif /* BOOTLOADER */
124
125 /* Set up stack for IRQ mode */
126 mov r0,#0xd2
127 msr cpsr, r0
128 ldr sp, =irq_stack
129
130 /* Set up stack for FIQ mode */
131 mov r0,#0xd1
132 msr cpsr, r0
133 ldr sp, =fiq_stack
134
135#ifndef BOOTLOADER
136 /* Load the banked FIQ mode registers with useful values here.
137 These values will be used in the FIQ handler in pcm-telechips.c */
138 .equ DADO_BASE, 0x80000020
139
140 ldr r10, =DADO_BASE
141 ldr r11, =dma_play_data
142#endif
143
144 /* Let svc, abort and undefined modes use irq stack */
145 msr cpsr, #0xd3
146 ldr sp, =irq_stack
147 msr cpsr, #0xd7
148 ldr sp, =irq_stack
149 msr cpsr, #0xdb
150 ldr sp, =irq_stack
151
152 /* Switch to sys mode */
153 mov r0,#0xdf
154 msr cpsr, r0
155 ldr sp, =stackend
156
157 /* Copy exception handler code to address 0 */
158 mov r2, #0x0
159 ldr r3, =vectors_start
160 ldr r4, =vectors_end
1611:
162 cmp r4, r3
163 ldrhi r5, [r3], #4
164 strhi r5, [r2], #4
165 bhi 1b
166
167 /* Initialise bss section to zero */
168 ldr r2, =_edata
169 ldr r3, =_end
170 mov r4, #0
1711:
172 cmp r3, r2
173 strhi r4, [r2], #4
174 bhi 1b
175
176 /* Set up some stack and munge it with 0xdeadbeef */
177 ldr sp, =stackend
178 mov r3, sp
179 ldr r2, =stackbegin
180 ldr r4, =0xdeadbeef
1811:
182 cmp r3, r2
183 strhi r4, [r2], #4
184 bhi 1b
185
186 bl main
187 /* main() should never return */
188
189/* Exception handlers. Will be copied to address 0 after memory remapping */
190vectors_start:
191 ldr pc, [pc, #24]
192 ldr pc, [pc, #24]
193 ldr pc, [pc, #24]
194 ldr pc, [pc, #24]
195 ldr pc, [pc, #24]
196 ldr pc, [pc, #24]
197 ldr pc, [pc, #24]
198 ldr pc, [pc, #24]
199
200 /* Exception vectors */
201 .global vectors
202vectors:
203 .word start
204 .word undef_instr_handler
205 .word software_int_handler
206 .word prefetch_abort_handler
207 .word data_abort_handler
208 .word reserved_handler
209 .word irq_handler
210 .word fiq_handler
211vectors_end:
212
213 .text
214
215irq_handler:
216 stmfd sp!, {r0-r3, r12, lr}
217 bl irq
218 ldmfd sp!, {r0-r3, r12, lr}
219 subs pc, lr, #4
220
221/* Align stacks to cache line boundary */
222 .balign 16
223
224/* 256 words of IRQ stack */
225 .space 256*4
226irq_stack:
227
228/* 256 words of FIQ stack */
229 .space 256*4
230fiq_stack:
diff --git a/firmware/target/arm/tcc77x/debug-tcc77x.c b/firmware/target/arm/tcc77x/debug-tcc77x.c
deleted file mode 100644
index 5a97706722..0000000000
--- a/firmware/target/arm/tcc77x/debug-tcc77x.c
+++ /dev/null
@@ -1,77 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Rob Purchase
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "config.h"
23#include "cpu.h"
24#include "system.h"
25#include "string.h"
26#include <stdio.h>
27#include <stdbool.h>
28#include "button.h"
29#include "lcd.h"
30#include "font.h"
31#include "adc.h"
32
33bool dbg_ports(void)
34{
35 return false;
36}
37
38bool dbg_hw_info(void)
39{
40 int line = 0, i, button, oldline;
41 bool done=false;
42
43 lcd_setfont(FONT_SYSFIXED);
44 lcd_clear_display();
45
46 /* Put all the static text before the while loop */
47 lcd_puts(0, line++, "[Hardware info]");
48
49 line++;
50 oldline=line;
51 while(!done)
52 {
53 line = oldline;
54 button = button_get(false);
55
56 button &= ~BUTTON_REPEAT;
57#ifdef BUTTON_SELECT
58 if (button == BUTTON_SELECT)
59#else
60 if (button == BUTTON_STOP)
61#endif
62 done=true;
63
64 lcd_putsf(0, line++, "current tick: %08lx Seconds running: %08ld",
65 current_tick, current_tick/HZ);
66
67 lcd_putsf(0, line++, "GPIOA: 0x%08lx GPIOB: 0x%08lx", GPIOA, GPIOB);
68 lcd_putsf(0, line++, "GPIOC: 0x%08lx GPIOD: 0x%08lx", GPIOC, GPIOD);
69 lcd_putsf(0, line++, "GPIOE: 0x%08lx", GPIOE);
70
71 for (i = 0; i<4; i++)
72 lcd_putsf(0, line++, "ADC%d: 0x%04x", i, adc_read(i));
73
74 lcd_update();
75 }
76 return false;
77}
diff --git a/firmware/target/arm/tcc77x/i2c-target.h b/firmware/target/arm/tcc77x/i2c-target.h
deleted file mode 100644
index 9b9a74b4d2..0000000000
--- a/firmware/target/arm/tcc77x/i2c-target.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Rob Purchase
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef I2C_TARGET_H
22#define I2C_TARGET_H
23
24/* Definitions for the TCC77X I2C bus */
25
26#define SDA_BIT (1<<10)
27#define SCL_BIT (1<<11)
28
29#define SCL (GPIOB & SCL_BIT)
30#define SCL_HI GPIOB |= SCL_BIT
31#define SCL_LO GPIOB &= ~SCL_BIT
32
33#define SDA (GPIOB & SDA_BIT)
34#define SDA_HI GPIOB |= SDA_BIT
35#define SDA_LO GPIOB &= ~SDA_BIT
36#define SDA_INPUT GPIOB_DIR &= ~SDA_BIT
37#define SDA_OUTPUT GPIOB_DIR |= SDA_BIT
38
39#endif /* I2C_TARGET_H */
diff --git a/firmware/target/arm/tcc77x/iaudio7/adc-target.h b/firmware/target/arm/tcc77x/iaudio7/adc-target.h
deleted file mode 100644
index 1916d93598..0000000000
--- a/firmware/target/arm/tcc77x/iaudio7/adc-target.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef _ADC_TARGET_H_
22#define _ADC_TARGET_H_
23
24#define NUM_ADC_CHANNELS 8
25
26#define ADC_BUTTONS 0
27
28#endif /* _ADC_TARGET_H_ */
diff --git a/firmware/target/arm/tcc77x/iaudio7/ata2501.c b/firmware/target/arm/tcc77x/iaudio7/ata2501.c
deleted file mode 100644
index f7526b2b9a..0000000000
--- a/firmware/target/arm/tcc77x/iaudio7/ata2501.c
+++ /dev/null
@@ -1,110 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 Vitja Makarov
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "config.h"
23#include "system.h"
24#include "cpu.h"
25#include "button.h"
26
27#include "ata2501.h"
28
29#define STB (1<<5)
30#define SDATA (1<<4)
31#define RESET (1<<6)
32#define SIFMD (1<<7)
33#define STB_DELAY 200
34
35static inline void ndelay(unsigned long nsecs)
36{
37 nsecs /= 8;
38 while (nsecs)
39 nsecs--;
40}
41
42/*
43 TODO: sensitivity
44*/
45void ata2501_init(void)
46{
47 GPIOD_DIR |= (RESET | STB | SIFMD | (1 << 8) | (1 << 9));
48 GPIOD_DIR &= ~SDATA;
49
50 GPIOD &= ~STB;
51 GPIOD |= (1 << 8) | SIFMD | (1 << 9);
52
53 GPIOD &= ~RESET;
54 ndelay(1000);
55 GPIOD |= RESET;
56}
57
58unsigned short ata2501_read(void)
59{
60 unsigned short ret = 0;
61 int i;
62
63 for (i = 0; i < 12; i++) {
64 GPIOD |= STB;
65 ndelay(100);
66 ret <<= 1;
67 if (GPIOD & SDATA)
68 ret |= 1;
69 GPIOD &= ~STB;
70 ndelay(100);
71 }
72
73 return ret;
74}
75
76//#define ATA2501_TEST
77#ifdef ATA2501_TEST
78#include "lcd.h"
79
80static
81void bits(char *str, unsigned short val)
82{
83 int i;
84
85 for (i = 0; i < 12; i++)
86 str[i] = (val & (1 << i)) ? '1' : '0';
87 str[i] = 0;
88}
89
90void ata2501_test(void)
91{
92 char buf[100];
93 ata2501_init();
94
95 while (1) {
96 unsigned short data;
97 int line = 0;
98
99 data = ata2501_read();
100 lcd_clear_display();
101 lcd_puts(0, line++, "ATA2501 test");
102
103 bits(buf, data);
104 lcd_puts(0, line++, buf);
105
106 lcd_update();
107 sleep(HZ/10);
108 }
109}
110#endif
diff --git a/firmware/target/arm/tcc77x/iaudio7/ata2501.h b/firmware/target/arm/tcc77x/iaudio7/ata2501.h
deleted file mode 100644
index 465d0b199c..0000000000
--- a/firmware/target/arm/tcc77x/iaudio7/ata2501.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 Vitja Makarov
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef _ATA2501_H_
22#define _ATA2501_H_
23
24void ata2501_init(void);
25unsigned short ata2501_read(void);
26
27#endif /* _ATA2501_H_ */
diff --git a/firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c b/firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c
deleted file mode 100644
index bcb6843286..0000000000
--- a/firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c
+++ /dev/null
@@ -1,94 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Michael Sevakis
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "system.h"
22#include "cpu.h"
23#include "audio.h"
24#include "sound.h"
25
26int audio_channels = 2;
27int audio_output_source = AUDIO_SRC_PLAYBACK;
28
29void audio_set_output_source(int source)
30{
31 int oldmode = set_fiq_status(FIQ_DISABLED);
32
33 if ((unsigned)source >= AUDIO_NUM_SOURCES)
34 source = AUDIO_SRC_PLAYBACK;
35
36 audio_output_source = source;
37 set_fiq_status(oldmode);
38}
39
40void audio_input_mux(int source, unsigned flags)
41{
42 static int last_source = AUDIO_SRC_PLAYBACK;
43 static bool last_recording = false;
44 bool recording = flags & SRCF_RECORDING;
45
46 switch (source)
47 {
48 default: /* playback - no recording */
49 source = AUDIO_SRC_PLAYBACK;
50 case AUDIO_SRC_PLAYBACK:
51 audio_channels = 2;
52 if (source != last_source)
53 {
54 audiohw_set_monitor(false);
55 /* audiohw_disable_recording();*/
56 }
57 break;
58
59 case AUDIO_SRC_MIC: /* recording only */
60 GPIOD |= 0x1;
61
62 audio_channels = 1;
63 if (source != last_source)
64 {
65 /*audiohw_set_monitor(false);
66 audiohw_enable_recording(true); /. source mic */
67 }
68 break;
69
70 case AUDIO_SRC_FMRADIO: /* recording and playback */
71 GPIOD &= ~0x1;
72
73 audio_channels = 2;
74
75 if (source == last_source && recording == last_recording)
76 break;
77
78 last_recording = recording;
79
80 if (recording)
81 {
82 /*audiohw_set_monitor(false);
83 audiohw_enable_recording(false);*/
84 }
85 else
86 {
87 /*audiohw_disable_recording(); */
88 audiohw_set_monitor(true); /* line 1 analog audio path */
89 }
90 break;
91 } /* end switch */
92
93 last_source = source;
94} /* audio_input_mux */
diff --git a/firmware/target/arm/tcc77x/iaudio7/backlight-target.h b/firmware/target/arm/tcc77x/iaudio7/backlight-target.h
deleted file mode 100644
index 0b227cd11c..0000000000
--- a/firmware/target/arm/tcc77x/iaudio7/backlight-target.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 Vitja Makarov
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef BACKLIGHT_TARGET_H
22#define BACKLIGHT_TARGET_H
23
24#include <stdbool.h>
25#include "tcc77x.h"
26
27void power_touch_panel(bool on);
28
29static inline bool backlight_hw_init(void)
30{
31 GPIOD_DIR |= 0x2;
32 /* set backlight on by default, since the screen is unreadable without it */
33 GPIOD |= 0x2;
34 return true;
35}
36
37static inline void backlight_hw_on(void)
38{
39 GPIOD |= 0x2;
40 power_touch_panel(true);
41}
42
43static inline void backlight_hw_off(void)
44{
45 GPIOD &= ~0x2;
46 power_touch_panel(false);
47}
48#endif /* BACKLIGHT_TARGET_H */
diff --git a/firmware/target/arm/tcc77x/iaudio7/button-iaudio7.c b/firmware/target/arm/tcc77x/iaudio7/button-iaudio7.c
deleted file mode 100644
index abf31b4feb..0000000000
--- a/firmware/target/arm/tcc77x/iaudio7/button-iaudio7.c
+++ /dev/null
@@ -1,93 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 Vitja Makarov
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "config.h"
22#include "cpu.h"
23#include "button.h"
24#include "backlight.h"
25#include "adc.h"
26
27#include "button-target.h"
28#include "ata2501.h"
29
30void button_init_device(void)
31{
32 ata2501_init();
33}
34
35/*
36 touchpad:
37 0: stop
38 1-8: between next & prev
39 9: play
40 10: next
41 11: prev
42*/
43
44int button_read_device(void)
45{
46 static bool hold_button = false;
47 bool hold_button_old;
48
49 int btn = BUTTON_NONE;
50 int adc;
51 int sensor;
52
53 hold_button_old = hold_button;
54 hold_button = button_hold();
55
56#ifndef BOOTLOADER
57 if (hold_button != hold_button_old)
58 backlight_hold_changed(hold_button);
59#endif
60
61 if (button_hold())
62 return BUTTON_NONE;
63
64 adc = adc_read(0);
65 sensor = ata2501_read();
66
67 if (0 == (GPIOA & 4))
68 btn |= BUTTON_POWER;
69
70 /* seems they can't be hold together */
71 if (adc < 0x120)
72 btn |= BUTTON_VOLUP;
73 else if (adc < 0x270)
74 btn |= BUTTON_VOLDOWN;
75 else if (adc < 0x300)
76 btn |= BUTTON_MENU;
77
78 if (sensor & (1 << 0))
79 btn |= BUTTON_STOP;
80 if (sensor & (1 << 9))
81 btn |= BUTTON_PLAY;
82 if (sensor & ((1 << 10) | 0x1c0))
83 btn |= BUTTON_RIGHT;
84 if (sensor & ((1 << 11) | 0xe))
85 btn |= BUTTON_LEFT;
86
87 return btn;
88}
89
90bool button_hold(void)
91{
92 return !(GPIOA & 0x2);
93}
diff --git a/firmware/target/arm/tcc77x/iaudio7/button-target.h b/firmware/target/arm/tcc77x/iaudio7/button-target.h
deleted file mode 100644
index 9d232d9ae8..0000000000
--- a/firmware/target/arm/tcc77x/iaudio7/button-target.h
+++ /dev/null
@@ -1,47 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 Vitja Makarov
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef _IAUDIO7_BUTTON_TARGET_H_
22#define _IAUDIO7_BUTTON_TARGET_H_
23
24#define HAS_BUTTON_HOLD
25
26/* Main unit's buttons */
27#define BUTTON_POWER 0x00000001
28#define BUTTON_VOLUP 0x00000002
29#define BUTTON_VOLDOWN 0x00000004
30#define BUTTON_MENU 0x00000008
31
32#define BUTTON_LEFT 0x00000010
33#define BUTTON_RIGHT 0x00000020
34#define BUTTON_PLAY 0x00000040
35#define BUTTON_STOP 0x00000080
36
37#define BUTTON_ON BUTTON_POWER
38
39#define BUTTON_MAIN (BUTTON_POWER|BUTTON_VOLUP|BUTTON_VOLDOWN| \
40 BUTTON_MENU|BUTTON_LEFT|BUTTON_RIGHT| \
41 BUTTON_PLAY|BUTTON_STOP)
42
43/* Software power-off */
44#define POWEROFF_BUTTON BUTTON_POWER
45#define POWEROFF_COUNT 10
46
47#endif /* _IAUDIO7_BUTTON_TARGET_H_ */
diff --git a/firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c b/firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c
deleted file mode 100644
index e681e1eff7..0000000000
--- a/firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c
+++ /dev/null
@@ -1,260 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2004 by Linus Nielsen Feltzing
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22/*
23 Thanks Hein-Pieter van Braam for initial work.
24
25 Mostly based on lcd-h300.c, adapted for the iaudio 7 by Vitja Makarov
26 */
27
28#include <config.h>
29
30#include <kernel.h>
31#include <cpu.h>
32#include <lcd.h>
33#include <system-target.h>
34#include <panic.h>
35
36#include "hd66789r.h"
37
38static bool display_on = false; /* is the display turned on? */
39
40static inline void lcd_write_reg(int reg, int data)
41{
42 GPIOA &= ~0x400;
43 outw(0, 0x50010000);
44 outw(reg << 1, 0x50010000);
45 GPIOA |= 0x400;
46
47 outw((data & 0xff00) >> 7, 0x50010008);
48 outw((data << 24) >> 23, 0x50010008);
49}
50
51static void lcd_write_cmd(int reg)
52{
53 GPIOA &= ~0x400;
54 outw(0, 0x50010000);
55 outw(reg << 1, 0x50010000);
56 GPIOA |= 0x400;
57}
58
59/* Do what OF do */
60static void lcd_delay(int x)
61{
62 int i;
63
64 x *= 0xc35;
65 for (i = 0; i < x * 8; i++) {
66 }
67}
68
69
70static void _display_on(void)
71{
72 GPIOA_DIR |= 0x8000 | 0x400;
73 GPIOA |= 0x8000;
74
75 /* power setup */
76 lcd_write_reg(R_START_OSC, 0x0001);
77 lcd_delay(0xf);
78 lcd_write_reg(R_DISP_CONTROL1, 0x000);
79 lcd_delay(0xa);
80 lcd_write_reg(R_POWER_CONTROL2, 0x0002);
81 lcd_write_reg(R_POWER_CONTROL3, 0x000a);
82 lcd_write_reg(R_POWER_CONTROL4, 0xc5a);
83 lcd_write_reg(R_POWER_CONTROL1, 0x0004);
84 lcd_write_reg(R_POWER_CONTROL1, 0x0134);
85 lcd_write_reg(R_POWER_CONTROL2, 0x0111);
86 lcd_write_reg(R_POWER_CONTROL3, 0x001c);
87 lcd_delay(0x28);
88 lcd_write_reg(R_POWER_CONTROL4, 0x2c40);
89 lcd_write_reg(R_POWER_CONTROL1, 0x0510);
90 lcd_delay(0x3c);
91
92 /* lcd init 2 */
93 lcd_write_reg(R_DRV_OUTPUT_CONTROL, 0x0113);
94 lcd_write_reg(R_DRV_WAVEFORM_CONTROL, 0x0700);
95 lcd_write_reg(R_ENTRY_MODE, 0x1038);
96 lcd_write_reg(R_DISP_CONTROL2, 0x0508); // 0x3c8, TMM
97 lcd_write_reg(R_DISP_CONTROL3, 0x0000);
98 lcd_write_reg(R_FRAME_CYCLE_CONTROL, 0x0003);
99 lcd_write_reg(R_RAM_ADDR_SET, 0x0000);
100 lcd_write_reg(R_GAMMA_FINE_ADJ_POS1, 0x0406);
101 lcd_write_reg(R_GAMMA_FINE_ADJ_POS2, 0x0303);
102 lcd_write_reg(R_GAMMA_FINE_ADJ_POS3, 0x0000);
103 lcd_write_reg(R_GAMMA_GRAD_ADJ_POS, 0x0305);
104 lcd_write_reg(R_GAMMA_FINE_ADJ_NEG1, 0x0404);
105 lcd_write_reg(R_GAMMA_FINE_ADJ_NEG2, 0x0000);
106 lcd_write_reg(R_GAMMA_FINE_ADJ_NEG3, 0x0000);
107 lcd_write_reg(R_GAMMA_GRAD_ADJ_NEG, 0x0503);
108 lcd_write_reg(R_GAMMA_AMP_ADJ_RES_POS, 0x1d05);
109 lcd_write_reg(R_GAMMA_AMP_AVG_ADJ_RES_NEG, 0x1d05);
110 lcd_write_reg(R_VERT_SCROLL_CONTROL, 0x0000);
111 lcd_write_reg(R_1ST_SCR_DRV_POS, 0x9f00);
112 lcd_write_reg(R_2ND_SCR_DRV_POS, 0x9f00);
113 lcd_write_reg(R_HORIZ_RAM_ADDR_POS, 0x7f00);
114 lcd_write_reg(R_VERT_RAM_ADDR_POS, 0x9f00);
115
116 /* lcd init 3 */
117 lcd_write_reg(R_POWER_CONTROL1, 0x4510);
118 lcd_write_reg(R_DISP_CONTROL1, 0x0005);
119 lcd_delay(0x28);
120 lcd_write_reg(R_DISP_CONTROL1, 0x0025);
121 lcd_write_reg(R_DISP_CONTROL1, 0x0027);
122 lcd_delay(0x28);
123 lcd_write_reg(R_DISP_CONTROL1, 0x0037);
124
125 display_on = true;
126}
127
128void lcd_init_device(void)
129{
130 /* Configure external memory banks */
131 CSCFG1 = 0x0d500023 | tcc77x_cscfg_bw(TCC77X_CSCFG_BW16);
132
133 /* may be reset */
134 GPIOA |= 0x8000;
135
136 _display_on();
137}
138
139void lcd_enable(bool on)
140{
141 if (display_on == on)
142 return;
143
144 if (on) {
145 _display_on();
146 send_event(LCD_EVENT_ACTIVATION, NULL);
147 } else {
148 /** Off sequence according to datasheet, p. 130 **/
149 lcd_write_reg(R_FRAME_CYCLE_CONTROL, 0x0002); /* EQ=0, 18 clks/line */
150 lcd_write_reg(R_DISP_CONTROL1, 0x0036); /* GON=1, DTE=1, REV=1, D1-0=10 */
151 sleep(2);
152
153 lcd_write_reg(R_DISP_CONTROL1, 0x0026); /* GON=1, DTE=0, REV=1, D1-0=10 */
154 sleep(2);
155
156 lcd_write_reg(R_DISP_CONTROL1, 0x0000); /* GON=0, DTE=0, D1-0=00 */
157
158 lcd_write_reg(R_POWER_CONTROL1, 0x0000); /* SAP2-0=000, AP2-0=000 */
159 lcd_write_reg(R_POWER_CONTROL3, 0x0000); /* PON=0 */
160 lcd_write_reg(R_POWER_CONTROL4, 0x0000); /* VCOMG=0 */
161
162 /* datasheet p. 131 */
163 lcd_write_reg(R_POWER_CONTROL1, 0x0001); /* STB=1: standby mode */
164
165 display_on = false;
166 }
167}
168
169bool lcd_active(void)
170{
171 return display_on;
172}
173
174
175#define RGB(r,g,b) ((((r)&0x3f) << 12)|(((g)&0x3f) << 6)|(((b)&0x3f)))
176
177
178void lcd_update(void)
179{
180 lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
181}
182
183/* todo: need tests */
184void lcd_update_rect(int sx, int sy, int width, int height)
185{
186 int x, y;
187
188 if (!display_on)
189 return;
190
191 if (width <= 0 || height <= 0) /* nothing to do */
192 return;
193
194 width += sx;
195 height += sy;
196
197 if (width > LCD_WIDTH)
198 width = LCD_WIDTH;
199 if (height > LCD_HEIGHT)
200 height = LCD_HEIGHT;
201
202 lcd_write_reg(R_ENTRY_MODE, 0x1028);
203 /* set update window */
204 lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (LCD_HEIGHT - 1) << 8);
205 lcd_write_reg(R_VERT_RAM_ADDR_POS, ((width - 1) << 8) | sx);
206 lcd_write_reg(R_RAM_ADDR_SET, (sx << 8) | (LCD_HEIGHT - sy - 1));
207 lcd_write_cmd(R_WRITE_DATA_2_GRAM);
208
209 for (y = sy; y < height; y++) {
210 for (x = sx; x < width; x++) {
211 fb_data c;
212 unsigned long color;
213
214 c = *FBADDR(x,y);
215 color =
216 ((c & 0x1f) << 1) | ((c & 0x7e0) << 1) | ((c & 0xf800) <<
217 2);
218
219 /* TODO: our color is 18-bit */
220 outw((color >> 9) & 0x1ff, 0x50010008);
221 outw((color) & 0x1ff, 0x50010008);
222 }
223 }
224}
225
226void lcd_set_contrast(int val)
227{
228 (void) val;
229}
230
231void lcd_set_invert_display(bool yesno)
232{
233 (void) yesno;
234}
235
236void lcd_set_flip(bool yesno)
237{
238 (void) yesno;
239}
240
241/* TODO: implement me */
242void lcd_blit_yuv(unsigned char *const src[3],
243 int src_x, int src_y, int stride,
244 int x, int y, int width, int height)
245{
246 (void) src;
247 (void) src_x;
248 (void) src_y;
249 (void) stride;
250 (void) x;
251 (void) y;
252
253 if (!display_on)
254 return;
255
256 width &= ~1; /* stay on the safe side */
257 height &= ~1;
258
259 panicf("%s", __func__);
260}
diff --git a/firmware/target/arm/tcc77x/iaudio7/power-iaudio7.c b/firmware/target/arm/tcc77x/iaudio7/power-iaudio7.c
deleted file mode 100644
index baf93b73aa..0000000000
--- a/firmware/target/arm/tcc77x/iaudio7/power-iaudio7.c
+++ /dev/null
@@ -1,149 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 Vitja Makarov
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include <stdbool.h>
22
23#include "config.h"
24#include "cpu.h"
25#include "kernel.h"
26#include "system.h"
27#include "power.h"
28#include "backlight-target.h"
29
30#include "pcf50606.h"
31
32void power_init(void)
33{
34 pcf50606_write(PCF5060X_DCDC1, 0x90);
35 pcf50606_write(PCF5060X_DCDC2, 0x48);
36 pcf50606_write(PCF5060X_DCDC3, 0xfc);
37 pcf50606_write(PCF5060X_DCDC4, 0xb1);
38
39 pcf50606_write(PCF5060X_IOREGC, 0xe9);
40 /* 3.3V, touch-panel */
41 pcf50606_write(PCF5060X_D1REGC1, 0xf8);
42 pcf50606_write(PCF5060X_D2REGC1, 0xf2);
43 pcf50606_write(PCF5060X_D3REGC1, 0xf5);
44
45 pcf50606_write(PCF5060X_LPREGC1, 0x00);
46 pcf50606_write(PCF5060X_LPREGC2, 0x02);
47
48 pcf50606_write(PCF5060X_DCUDC1, 0xe6);
49 pcf50606_write(PCF5060X_DCUDC2, 0x30);
50
51 pcf50606_write(PCF5060X_DCDEC1, 0xe7);
52 pcf50606_write(PCF5060X_DCDEC2, 0x02);
53
54 pcf50606_write(PCF5060X_INT1M, 0x5b);
55 pcf50606_write(PCF5060X_INT1M, 0xaf);
56 pcf50606_write(PCF5060X_INT1M, 0x8f);
57
58 pcf50606_write(PCF5060X_OOCC1, 0x40);
59 pcf50606_write(PCF5060X_OOCC2, 0x05);
60
61 pcf50606_write(PCF5060X_MBCC3, 0x3a);
62 pcf50606_write(PCF5060X_GPOC1, 0x00);
63 pcf50606_write(PCF5060X_BBCC, 0xf8);
64}
65
66/* Control leds on ata2501 board */
67void power_touch_panel(bool on)
68{
69 if (on)
70 pcf50606_write(PCF5060X_D1REGC1, 0xf8);
71 else
72 pcf50606_write(PCF5060X_D1REGC1, 0x00);
73}
74
75void ide_power_enable(bool on)
76{
77 (void) on;
78}
79
80bool ide_powered(void)
81{
82 return true;
83}
84
85void power_off(void)
86{
87 /* Forcibly cut power to SoC & peripherals by putting the PCF to sleep */
88 pcf50606_write(PCF5060X_OOCC1, GOSTDBY | CHGWAK | EXTONWAK);
89}
90
91#if CONFIG_TUNER
92#include "tuner.h"
93
94/** Tuner **/
95static bool powered = false;
96
97#define TUNNER_CLK (1 << 5)
98#define TUNNER_DATA (1 << 6)
99#define TUNNER_NR_W (1 << 7)
100
101bool tuner_power(bool status)
102{
103 bool old_status;
104 lv24020lp_lock();
105
106 old_status = powered;
107
108 if (status != old_status)
109 {
110 if (status)
111 {
112 /* When power up, host should initialize the 3-wire bus
113 in host read mode: */
114
115 /* 1. Set direction of the DATA-line to input-mode. */
116 GPIOA_DIR &= ~TUNNER_DATA;
117
118 /* 2. Drive NR_W low */
119 GPIOA &= ~TUNNER_NR_W;
120 GPIOA_DIR |= TUNNER_NR_W;
121
122 /* 3. Drive CLOCK high */
123 GPIOA |= TUNNER_CLK;
124 GPIOA_DIR |= TUNNER_CLK;
125
126 lv24020lp_power(true);
127 }
128 else
129 {
130 lv24020lp_power(false);
131
132 /* set all as inputs */
133 GPIOC_DIR &= ~(TUNNER_CLK | TUNNER_DATA | TUNNER_NR_W);
134 }
135
136 powered = status;
137 }
138
139 lv24020lp_unlock();
140 return old_status;
141}
142
143#endif /* CONFIG_TUNER */
144
145unsigned int power_input_status(void)
146{
147 return (GPIOA & 0x1) ?
148 POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE;
149}
diff --git a/firmware/target/arm/tcc77x/iaudio7/powermgmt-iaudio7.c b/firmware/target/arm/tcc77x/iaudio7/powermgmt-iaudio7.c
deleted file mode 100644
index bc7ead61f0..0000000000
--- a/firmware/target/arm/tcc77x/iaudio7/powermgmt-iaudio7.c
+++ /dev/null
@@ -1,84 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: powermgmt-cowond2.c 17847 2008-06-28 18:10:04Z bagder $
9 *
10 * Copyright (C) 2007 by Karl Kurbjun
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "config.h"
23#include "adc.h"
24#include "powermgmt.h"
25#include "kernel.h"
26#include "pcf50606.h"
27
28unsigned short current_voltage = 5150;
29
30const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
31{
32 /* FIXME: calibrate value */
33 4400
34};
35
36const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
37{
38 /* FIXME: calibrate value */
39 4600
40};
41
42/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
43const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
44{
45 /* FIXME: calibrate values. Table is "inherited" from iPod-PCF / H100 */
46 { 4500, 4810, 4910, 4970, 5030, 5070, 5120, 5140, 5170, 5250, 5400 }
47};
48
49#if CONFIG_CHARGING
50/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
51const unsigned short percent_to_volt_charge[11] =
52{
53 /* FIXME: calibrate values. Table is "inherited" from iPod-PCF / H100 */
54 4760, 5440, 5510, 5560, 5610, 5640, 5660, 5760, 5820, 5840, 5850 /* NiMH */
55};
56#endif /* CONFIG_CHARGING */
57
58#define BATTERY_SCALE_FACTOR 6000
59/* full-scale ADC readout (2^10) in millivolt */
60
61/* Returns battery voltage from ADC [millivolts] */
62int _battery_voltage(void)
63{
64 static unsigned last_tick = 0;
65
66 if (0 == last_tick || TIME_BEFORE(last_tick+HZ, current_tick))
67 {
68 int adc_val, irq_status;
69 unsigned char buf[2];
70
71 irq_status = disable_irq_save();
72 pcf50606_write(PCF5060X_ADCC2, 0x1);
73 pcf50606_read_multiple(PCF5060X_ADCS1, buf, 2);
74 restore_interrupt(irq_status);
75
76 adc_val = (buf[0]<<2) | (buf[1] & 3); //ADCDAT1H+ADCDAT1L
77 current_voltage = (adc_val * BATTERY_SCALE_FACTOR) >> 10;
78
79 last_tick = current_tick;
80 }
81
82 return current_voltage;
83}
84
diff --git a/firmware/target/arm/tcc77x/kernel-tcc77x.c b/firmware/target/arm/tcc77x/kernel-tcc77x.c
deleted file mode 100644
index bbfc29d915..0000000000
--- a/firmware/target/arm/tcc77x/kernel-tcc77x.c
+++ /dev/null
@@ -1,47 +0,0 @@
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
9*
10* Copyright (C) 2008 by Rob Purchase
11*
12* This program is free software; you can redistribute it and/or
13* modify it under the terms of the GNU General Public License
14* as published by the Free Software Foundation; either version 2
15* of the License, or (at your option) any later version.
16*
17* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18* KIND, either express or implied.
19*
20****************************************************************************/
21
22#include "config.h"
23#include "system.h"
24#include "kernel.h"
25#include "timer.h"
26#include "thread.h"
27
28void tick_start(unsigned int interval_in_ms)
29{
30 /* configure Timer T-Clock to 2Mhz (clock source 4 (Xin) divided by 6) */
31 PCLKCFG4 = (1 << 31) | (4 << 28) | (5 << 16);
32
33 /* disable Timer0 */
34 TCFG0 &= ~1;
35
36 /* set counter reference value based on 1Mhz tick */
37 TREF0 = interval_in_ms * 1000;
38
39 /* Timer0 = reset to 0, divide=2, IRQ enable, enable (continuous) */
40 TCFG0 = (1<<8) | (0<<4) | (1<<3) | 1;
41
42 /* Unmask timer IRQ */
43 IEN |= TIMER0_IRQ_MASK;
44}
45
46/* NB: Since we are using a single timer IRQ, tick tasks are dispatched as
47 part of the central timer IRQ processing in timer-tcc77x.c */
diff --git a/firmware/target/arm/tcc77x/logikdax/adc-target.h b/firmware/target/arm/tcc77x/logikdax/adc-target.h
deleted file mode 100644
index 1916d93598..0000000000
--- a/firmware/target/arm/tcc77x/logikdax/adc-target.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef _ADC_TARGET_H_
22#define _ADC_TARGET_H_
23
24#define NUM_ADC_CHANNELS 8
25
26#define ADC_BUTTONS 0
27
28#endif /* _ADC_TARGET_H_ */
diff --git a/firmware/target/arm/tcc77x/logikdax/audio-logikdax.c b/firmware/target/arm/tcc77x/logikdax/audio-logikdax.c
deleted file mode 100644
index 90c9a68827..0000000000
--- a/firmware/target/arm/tcc77x/logikdax/audio-logikdax.c
+++ /dev/null
@@ -1,40 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Michael Sevakis
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "system.h"
22#include "cpu.h"
23#include "audio.h"
24#include "sound.h"
25
26int audio_channels = 2;
27int audio_output_source = AUDIO_SRC_PLAYBACK;
28
29#if INPUT_SRC_CAPS != 0
30void audio_set_output_source(int source)
31{
32 (void)source;
33}
34
35void audio_input_mux(int source, unsigned flags)
36{
37 (void)source;
38 (void)flags;
39}
40#endif
diff --git a/firmware/target/arm/tcc77x/logikdax/backlight-target.h b/firmware/target/arm/tcc77x/logikdax/backlight-target.h
deleted file mode 100644
index 202e118606..0000000000
--- a/firmware/target/arm/tcc77x/logikdax/backlight-target.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef BACKLIGHT_TARGET_H
22#define BACKLIGHT_TARGET_H
23
24#include "tcc77x.h"
25
26#define backlight_hw_init() true
27
28static inline void backlight_hw_on(void)
29{
30 /* Enable backlight */
31 GPIOD |= 0x10;
32}
33
34static inline void backlight_hw_off(void)
35{
36 /* Disable backlight */
37 GPIOD &= ~0x10;
38}
39
40#endif
diff --git a/firmware/target/arm/tcc77x/logikdax/button-logikdax.c b/firmware/target/arm/tcc77x/logikdax/button-logikdax.c
deleted file mode 100644
index abf939753a..0000000000
--- a/firmware/target/arm/tcc77x/logikdax/button-logikdax.c
+++ /dev/null
@@ -1,100 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "config.h"
23#include "cpu.h"
24#include "button.h"
25#include "adc.h"
26
27/*
28
29Results of button testing:
30
31HOLD: GPIOA & 0x0002 (0=pressed, 0x0002 = released)
32POWER: GPIOA & 0x8000 (0=pressed, 0x8000 = released)
33
34ADC[0]: (approx values)
35
36RIGHT - 0x37
37LEFT - 0x7f
38JOYSTICK PRESS - 0xc7
39UP - 0x11e
40DOWN - 0x184
41MODE - 0x1f0/0x1ff
42PRESET - 0x268/0x269
43REC - 0x2dd
44
45Values of ADC[0] tested in OF disassembly: 0x50, 0x96, 0xdc, 0x208, 0x384
46
47*/
48
49void button_init_device(void)
50{
51 /* Nothing to do */
52}
53
54int button_read_device(void)
55{
56 int btn = BUTTON_NONE;
57 int adc;
58
59 adc = adc_read(ADC_BUTTONS);
60
61 if (adc < 0x384) {
62 if (adc < 0x140) {
63 if (adc < 0x96) {
64 if (adc < 0x50) {
65 btn |= BUTTON_RIGHT; /* 0x00..0x4f */
66 } else {
67 btn |= BUTTON_LEFT; /* 0x50..0x95 */
68 }
69 } else {
70 if (adc < 0xe0) {
71 btn |= BUTTON_SELECT; /* 0x96..0xdf */
72 } else {
73 btn |= BUTTON_UP; /* 0xe0..0x13f */
74 }
75 }
76 } else {
77 if (adc < 0x208) {
78 if (adc < 0x1b0) {
79 btn |= BUTTON_DOWN; /* 0x140..0x1af */
80 } else {
81 btn |= BUTTON_MODE; /* 0x1b0..0x207 */
82 }
83 } else {
84 if (adc < 0x290) {
85 btn |= BUTTON_PRESET; /* 0x208..0x28f */
86 } else {
87 btn |= BUTTON_REC; /* 0x290..0x383 */
88 }
89 }
90 }
91 }
92
93 if (!(GPIOA & 0x2))
94 btn |= BUTTON_HOLD;
95
96 if (!(GPIOA & 0x8000))
97 btn |= BUTTON_POWERPLAY;
98
99 return btn;
100}
diff --git a/firmware/target/arm/tcc77x/logikdax/button-target.h b/firmware/target/arm/tcc77x/logikdax/button-target.h
deleted file mode 100644
index 505fe438ed..0000000000
--- a/firmware/target/arm/tcc77x/logikdax/button-target.h
+++ /dev/null
@@ -1,45 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#ifndef _BUTTON_TARGET_H_
23#define _BUTTON_TARGET_H_
24
25/* Main unit's buttons */
26#define BUTTON_POWERPLAY 0x00000001
27#define BUTTON_MODE 0x00000002
28#define BUTTON_HOLD 0x00000004
29#define BUTTON_REC 0x00000008
30#define BUTTON_PRESET 0x00000010
31#define BUTTON_LEFT 0x00000020
32#define BUTTON_RIGHT 0x00000040
33#define BUTTON_UP 0x00000080
34#define BUTTON_DOWN 0x00000100
35#define BUTTON_SELECT 0x00000200
36
37#define BUTTON_MAIN (BUTTON_POWERPLAY|BUTTON_MODE|BUTTON_HOLD\
38 |BUTTON_REC|BUTTON_PRESET|BUTTON_LEFT\
39 |BUTTON_RIGHT|BUTTON_UP|BUTTON_DOWN|BUTTON_SELECT)
40
41/* Software power-off */
42#define POWEROFF_BUTTON BUTTON_POWERPLAY
43#define POWEROFF_COUNT 40
44
45#endif /* _BUTTON_TARGET_H_ */
diff --git a/firmware/target/arm/tcc77x/logikdax/power-logikdax.c b/firmware/target/arm/tcc77x/logikdax/power-logikdax.c
deleted file mode 100644
index 840b02a2a5..0000000000
--- a/firmware/target/arm/tcc77x/logikdax/power-logikdax.c
+++ /dev/null
@@ -1,44 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "config.h"
22#include "cpu.h"
23#include <stdbool.h>
24#include "kernel.h"
25#include "system.h"
26#include "power.h"
27
28void power_init(void)
29{
30}
31
32void ide_power_enable(bool on)
33{
34 (void)on;
35}
36
37bool ide_powered(void)
38{
39 return true;
40}
41
42void power_off(void)
43{
44}
diff --git a/firmware/target/arm/tcc77x/m200/adc-target.h b/firmware/target/arm/tcc77x/m200/adc-target.h
deleted file mode 100644
index e9640cc9da..0000000000
--- a/firmware/target/arm/tcc77x/m200/adc-target.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef _ADC_TARGET_H_
22#define _ADC_TARGET_H_
23
24#define NUM_ADC_CHANNELS 8
25
26#define ADC_BUTTONS 1
27
28#endif /* _ADC_TARGET_H_ */
diff --git a/firmware/target/arm/tcc77x/m200/audio-m200.c b/firmware/target/arm/tcc77x/m200/audio-m200.c
deleted file mode 100644
index 107b2743ae..0000000000
--- a/firmware/target/arm/tcc77x/m200/audio-m200.c
+++ /dev/null
@@ -1,38 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Michael Sevakis
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "system.h"
22#include "cpu.h"
23#include "audio.h"
24#include "sound.h"
25
26int audio_channels = 2;
27int audio_output_source = AUDIO_SRC_PLAYBACK;
28
29void audio_set_output_source(int source)
30{
31 (void)source;
32}
33
34void audio_input_mux(int source, unsigned flags)
35{
36 (void)source;
37 (void)flags;
38}
diff --git a/firmware/target/arm/tcc77x/m200/backlight-target.h b/firmware/target/arm/tcc77x/m200/backlight-target.h
deleted file mode 100644
index d73ac78852..0000000000
--- a/firmware/target/arm/tcc77x/m200/backlight-target.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef BACKLIGHT_TARGET_H
22#define BACKLIGHT_TARGET_H
23
24#include "tcc77x.h"
25
26static inline bool backlight_hw_init(void)
27{
28 GPIOA_DIR |= 0x40;
29 return true;
30}
31
32static inline void backlight_hw_on(void)
33{
34 /* Enable backlight */
35 GPIOA |= 0x40;
36}
37
38static inline void backlight_hw_off(void)
39{
40 /* Disable backlight */
41 GPIOA &= ~0x40;
42}
43
44#endif
diff --git a/firmware/target/arm/tcc77x/m200/button-m200.c b/firmware/target/arm/tcc77x/m200/button-m200.c
deleted file mode 100644
index a37fe1302c..0000000000
--- a/firmware/target/arm/tcc77x/m200/button-m200.c
+++ /dev/null
@@ -1,99 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "config.h"
23#include "cpu.h"
24#include "button.h"
25#include "adc.h"
26
27/*
28
29Results of button testing (viewing ADC values whilst pressing buttons):
30
31HOLD: GPIOB & 0x0200 (0=hold active, 0x0200 = hold inactive)
32
33ADC[1]: (approx values)
34
35Idle - 0x3ff
36MENU - unknown
37
38REPEAT/AB - 0x03?
39LEFT - 0x07?-0x08?
40SELECT - 0x0c?
41RIGHT - 0x11?
42
43PLAY/PAUSE - 0x17?-0x018?
44VOL UP - 0x1e?-0x01f?
45VOL DOWN - 0x26?
46
47*/
48
49void button_init_device(void)
50{
51 /* Nothing to do */
52}
53
54int button_read_device(void)
55{
56 int btn = BUTTON_NONE;
57 int adc;
58
59 /* TODO - determine how to detect BUTTON_MENU - it doesn't appear to
60 be connected to a GPIO or to an ADC
61 */
62
63 adc = adc_read(ADC_BUTTONS);
64
65 if (adc < 0x384) {
66 if (adc < 0x140) {
67 if (adc < 0x96) {
68 if (adc < 0x50) {
69 btn |= BUTTON_REPEATAB; /* 0x00..0x4f */
70 } else {
71 btn |= BUTTON_LEFT; /* 0x50..0x95 */
72 }
73 } else {
74 if (adc < 0xe0) {
75 btn |= BUTTON_SELECT; /* 0x96..0xdf */
76 } else {
77 btn |= BUTTON_RIGHT; /* 0xe0..0x13f */
78 }
79 }
80 } else {
81 if (adc < 0x208) {
82 if (adc < 0x1b0) {
83 btn |= BUTTON_PLAYPAUSE; /* 0x140..0x1af */
84 } else {
85 btn |= BUTTON_VOLUP; /* 0x1b0..0x207 */
86 }
87 } else {
88 btn |= BUTTON_VOLDOWN; /* 0x209..0x383 */
89 }
90 }
91 }
92
93 return btn;
94}
95
96bool button_hold(void)
97{
98 return (GPIOB & 0x200)?false:true;
99}
diff --git a/firmware/target/arm/tcc77x/m200/button-target.h b/firmware/target/arm/tcc77x/m200/button-target.h
deleted file mode 100644
index b96df22edc..0000000000
--- a/firmware/target/arm/tcc77x/m200/button-target.h
+++ /dev/null
@@ -1,45 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#ifndef _BUTTON_TARGET_H_
23#define _BUTTON_TARGET_H_
24
25#define HAS_BUTTON_HOLD
26
27/* Main unit's buttons */
28#define BUTTON_MENU 0x00000001
29#define BUTTON_VOLUP 0x00000002
30#define BUTTON_VOLDOWN 0x00000004
31#define BUTTON_PLAYPAUSE 0x00000008
32#define BUTTON_REPEATAB 0x00000010
33#define BUTTON_LEFT 0x00000020
34#define BUTTON_RIGHT 0x00000040
35#define BUTTON_SELECT 0x00000080
36
37#define BUTTON_MAIN (BUTTON_MENU|BUTTON_VOLUP|BUTTON_VOLDOWN\
38 |BUTTON_PLAYPAUSE|BUTTON_REPEATAB|BUTTON_LEFT\
39 |BUTTON_RIGHT|BUTTON_SELECT)
40
41/* Software power-off */
42#define POWEROFF_BUTTON BUTTON_MENU
43#define POWEROFF_COUNT 40
44
45#endif /* _BUTTON_TARGET_H_ */
diff --git a/firmware/target/arm/tcc77x/m200/power-m200.c b/firmware/target/arm/tcc77x/m200/power-m200.c
deleted file mode 100644
index e84ff1c852..0000000000
--- a/firmware/target/arm/tcc77x/m200/power-m200.c
+++ /dev/null
@@ -1,43 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "config.h"
22#include "cpu.h"
23#include <stdbool.h>
24#include "kernel.h"
25#include "system.h"
26#include "power.h"
27
28void power_init(void)
29{
30}
31
32void ide_power_enable(bool on)
33{
34}
35
36bool ide_powered(void)
37{
38 return true;
39}
40
41void power_off(void)
42{
43}
diff --git a/firmware/target/arm/tcc77x/powermgmt-tcc77x.c b/firmware/target/arm/tcc77x/powermgmt-tcc77x.c
deleted file mode 100644
index 07a56777d0..0000000000
--- a/firmware/target/arm/tcc77x/powermgmt-tcc77x.c
+++ /dev/null
@@ -1,66 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Karl Kurbjun
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "config.h"
23#include "adc.h"
24#include "powermgmt.h"
25#include "kernel.h"
26#include "pcf50606.h"
27
28unsigned short current_voltage = 3910;
29
30const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
31{
32 /* FIXME: calibrate value */
33 3380
34};
35
36const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
37{
38 /* FIXME: calibrate value */
39 3300
40};
41
42/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
43const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
44{
45 /* FIXME: calibrate values. Table is "inherited" from iPod-PCF / H100 */
46 { 3370, 3650, 3700, 3740, 3780, 3820, 3870, 3930, 4000, 4080, 4160 }
47};
48
49#if CONFIG_CHARGING
50/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
51const unsigned short percent_to_volt_charge[11] =
52{
53 /* FIXME: calibrate values. Table is "inherited" from iPod-PCF / H100 */
54 3370, 3650, 3700, 3740, 3780, 3820, 3870, 3930, 4000, 4080, 4160
55};
56#endif /* CONFIG_CHARGING */
57
58#define BATTERY_SCALE_FACTOR 6000
59/* full-scale ADC readout (2^10) in millivolt */
60
61/* Returns battery voltage from ADC [millivolts] */
62int _battery_voltage(void)
63{
64 return current_voltage;
65}
66
diff --git a/firmware/target/arm/tcc77x/system-target.h b/firmware/target/arm/tcc77x/system-target.h
deleted file mode 100644
index beeeac05c6..0000000000
--- a/firmware/target/arm/tcc77x/system-target.h
+++ /dev/null
@@ -1,59 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef SYSTEM_TARGET_H
22#define SYSTEM_TARGET_H
23
24#include "system-arm.h"
25
26#define CPUFREQ_DEFAULT 98784000
27#define CPUFREQ_NORMAL 98784000
28#define CPUFREQ_MAX 120000000
29
30#define inl(a) (*(volatile unsigned long *) (a))
31#define outl(a,b) (*(volatile unsigned long *) (b) = (a))
32#define inb(a) (*(volatile unsigned char *) (a))
33#define outb(a,b) (*(volatile unsigned char *) (b) = (a))
34#define inw(a) (*(volatile unsigned short *) (a))
35#define outw(a,b) (*(volatile unsigned short *) (b) = (a))
36
37/* TC32 is configured to 1MHz in clock_init() */
38#define USEC_TIMER TC32MCNT
39
40static inline void udelay(unsigned usecs)
41{
42 unsigned stop = USEC_TIMER + usecs;
43 while (TIME_BEFORE(USEC_TIMER, stop));
44}
45
46
47#define TCC77X_CSCFG_BW8 0
48#define TCC77X_CSCFG_BW16 1
49
50/* Due to hardware bug or "feature" this hack is needed to set bus width bits */
51static inline
52unsigned long tcc77x_cscfg_bw(int bw) {
53 if (bw == TCC77X_CSCFG_BW8)
54 return (((MCFG >> 11) & 3) ^ 3) << 28;
55 else
56 return (((MCFG >> 11) & 3) ^ 2) << 28;
57}
58
59#endif /* SYSTEM_TARGET_H */
diff --git a/firmware/target/arm/tcc77x/system-tcc77x.c b/firmware/target/arm/tcc77x/system-tcc77x.c
deleted file mode 100644
index cffb4deba4..0000000000
--- a/firmware/target/arm/tcc77x/system-tcc77x.c
+++ /dev/null
@@ -1,326 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "kernel.h"
23#include "system.h"
24#include "panic.h"
25
26/* Externally defined interrupt handlers */
27extern void TIMER(void);
28extern void ADC(void);
29extern void USB_DEVICE(void);
30
31void irq(void)
32{
33 int irq = IREQ & 0x7fffffff;
34 CREQ = irq; /* Clears the corresponding IRQ status */
35
36 if (irq & TIMER0_IRQ_MASK)
37 TIMER();
38 else if (irq & ADC_IRQ_MASK)
39 ADC();
40#ifdef HAVE_USBSTACK
41 else if (irq & USBD_IRQ_MASK)
42 USB_DEVICE();
43#endif
44 else
45 panicf("Unhandled IRQ 0x%08X", irq);
46}
47
48void fiq_handler(void) __attribute__((interrupt ("FIQ"), naked));
49
50#ifdef BOOTLOADER
51void fiq_handler(void)
52{
53 /* TODO */
54}
55#endif
56
57void system_reboot(void)
58{
59}
60
61void system_exception_wait(void)
62{
63 while (1);
64}
65
66/* TODO - these should live in the target-specific directories and
67 once we understand what all the GPIO pins do, move the init to the
68 specific driver for that hardware. For now, we just perform the
69 same GPIO init as the original firmware - this makes it easier to
70 investigate what the GPIO pins do.
71*/
72
73#ifdef LOGIK_DAX
74static void gpio_init(void)
75{
76 /* Do what the original firmware does */
77 GPIOD_FUNC = 0;
78 GPIOD_DIR = 0x3f0;
79 GPIOD = 0xe0;
80
81 GPIOE_FUNC = 0;
82 GPIOE_DIR = 0xe0;
83 GPIOE = 0;
84
85 GPIOA_FUNC = 0;
86 GPIOA_DIR = 0xffff1000; /* 0 - 0xf000 */
87 GPIOA = 0x1080;
88
89 GPIOB_FUNC = 0x16a3;
90 GPIOB_DIR = 0x6ffff;
91 GPIOB = 0;
92
93 GPIOC_FUNC = 1;
94 GPIOC_DIR = 0x03ffffff; /* mvn r2, 0xfc000000 */
95 GPIOC = 0;
96}
97#elif defined(IAUDIO_7)
98static void gpio_init(void)
99{
100 /* Do what the original firmware does */
101 GPIOA_FUNC = 0;
102 GPIOB_FUNC = 0x1623;
103 GPIOC_FUNC = 1;
104 GPIOD_FUNC = 0;
105 GPIOE_FUNC = 0;
106 GPIOA = 0x30;
107 GPIOB = 0x00c00;
108 GPIOC = 0;
109 GPIOD = 0x180;
110 GPIOE = 0x80;
111 GPIOA_DIR = 0x84b0;
112 GPIOB_DIR = 0x80c00;
113 GPIOC_DIR = 0x2000000;
114 GPIOD_DIR = 0x3e3;
115 GPIOE_DIR = 0x88;
116}
117#elif defined(SANSA_M200)
118static void gpio_init(void)
119{
120 /* TODO - Implement for M200 */
121}
122#elif defined(SANSA_C100)
123static void gpio_init(void)
124{
125 /* Do what the original firmware does */
126 GPIOA_FUNC = 0;
127 GPIOB_FUNC = 0x16A3;
128 GPIOC_FUNC = 1;
129 GPIOD_FUNC |= 2;
130 GPIOE_FUNC = 0;
131
132 GPIOA_DIR = 0xFFFF0E00;
133 GPIOB_DIR = 0x6FFFF;
134 GPIOC_DIR = 0x03FFFFFF;
135 GPIOD_DIR = 0x3F7;
136 GPIOE_DIR = 0x9B;
137
138 GPIOA = 0x80;
139 GPIOB = 0;
140 GPIOC = 0;
141 GPIOD |= 0xC0;
142 GPIOE = 0x9B;
143}
144#endif
145
146/* Second function called in the original firmware's startup code - we just
147 set up the clocks in the same way as the original firmware for now. */
148static void clock_init(void)
149{
150 unsigned int i;
151
152 /* STP = 0x1, PW = 0x04 , HLD = 0x0 */
153 CSCFG3 = (CSCFG3 &~ 0x3fff) | 0x820;
154
155 /* XIN=External main, Fcpu=Fsys, BCKDIV=1 (Fbus = Fsys / 2) */
156 CLKCTRL = (CLKCTRL & ~0xff) | 0x14;
157
158 if (BMI & 0x20)
159 PCLKCFG0 = 0xc82d7000; /* EN1 = 1, XIN=Ext. main, DIV1 = 0x2d, P1 = 1 */
160 else
161 PCLKCFG0 = 0xc8ba7000; /* EN1 = 1, XIN=Ext. main, DIV1 = 0xba, P1 = 1 */
162
163 MCFG |= 0x2000;
164
165#ifdef LOGIK_DAX
166 /* Only seen in the Logik DAX original firmware */
167 SDCFG = (SDCFG & ~0x7000) | 0x2000;
168#endif
169
170 /* Disable PLL */
171 PLL0CFG |= 0x80000000;
172
173 /* Enable PLL, M=0xcf, P=0x13. m=M+8, p=P+2, S = 0
174 Fout = (215/21)*12MHz = 122857142Hz */
175 PLL0CFG = 0x0000cf13;
176
177 i = 8000;
178 while (--i) {};
179
180 /* Enable PLL0 */
181 CLKDIVC = 0x81000000;
182
183 /* Fsys = PLL0, Fcpu = Fsys, Fbus=Fsys / 2 */
184 CLKCTRL = 0x80000010;
185
186 asm volatile (
187 "nop \n\t"
188 "nop \n\t"
189 );
190
191 /* Enable Z-Clock */
192 PCLKCFG5 |= (1<<31) | (4<<28); /* Timer Z-Clock enable, XIN direct*/
193
194 /* Set TC32 timer to be our USEC_TIMER (Xin divided by 12 = 1MHz) */
195 TC32MCNT = 0;
196 TC32LDV = 0;
197 TC32EN = (1<<24) | 11;
198}
199
200static void cpu_init(void)
201{
202 /* Memory protection - see page 48 of ARM946 TRM
203http://infocenter.arm.com/help/topic/com.arm.doc.ddi0201d/DDI0201D_arm946es_r1p1_trm.pdf
204 */
205 asm volatile (
206 /* Region 0 - addr=0, size=4GB, enabled */
207 "mov r0, #0x3f \n\t"
208 "mcr p15, 0, r0, c6, c0, 0 \n\t"
209 "mcr p15, 0, r0, c6, c0, 1 \n\t"
210
211#if defined(LOGIK_DAX) || defined(SANSA_C100)
212 /* Address region 1 - addr 0x2fff0000, size=64KB, enabled*/
213 "ldr r0, =0x2fff001f \n\t"
214#elif defined(IAUDIO_7)
215 /* Address region 1 - addr 0x20000000, size=8KB, enabled*/
216 "mov r0, #0x19 \n\t"
217 "add r0, r0, #0x20000000 \n\t"
218#elif defined(SANSA_M200)
219 /* Address region 1 - addr 0x20000000, size=256MB, enabled*/
220 "mov r0, #0x37 \n\t"
221 "add r0, r0, #0x20000000 \n\t"
222#endif
223 "mcr p15, 0, r0, c6, c1, 0 \n\t"
224 "mcr p15, 0, r0, c6, c1, 1 \n\t"
225
226 /* Address region 2 - addr 0x30000000, size=256MB, enabled*/
227 "mov r0, #0x37 \n\t"
228 "add r0, r0, #0x30000000 \n\t"
229 "mcr p15, 0, r0, c6, c2, 0 \n\t"
230 "mcr p15, 0, r0, c6, c2, 1 \n\t"
231
232 /* Address region 2 - addr 0x40000000, size=512MB, enabled*/
233 "mov r0, #0x39 \n\t"
234 "add r0, r0, #0x40000000 \n\t"
235 "mcr p15, 0, r0, c6, c3, 0 \n\t"
236 "mcr p15, 0, r0, c6, c3, 1 \n\t"
237
238 /* Address region 4 - addr 0x60000000, size=256MB, enabled*/
239 "mov r0, #0x37 \n\t"
240 "add r0, r0, #0x60000000 \n\t"
241 "mcr p15, 0, r0, c6, c4, 0 \n\t"
242 "mcr p15, 0, r0, c6, c4, 1 \n\t"
243
244 /* Address region 5 - addr 0x10000000, size=256MB, enabled*/
245 "mov r0, #0x37 \n\t"
246 "add r0, r0, #0x10000000 \n\t"
247 "mcr p15, 0, r0, c6, c5, 0 \n\t"
248 "mcr p15, 0, r0, c6, c5, 1 \n\t"
249
250 /* Address region 6 - addr 0x80000000, size=2GB, enabled*/
251 "mov r0, #0x37 \n\t"
252 "add r0, r0, #0x80000006 \n\t"
253 "mcr p15, 0, r0, c6, c6, 0 \n\t"
254 "mcr p15, 0, r0, c6, c6, 1 \n\t"
255
256 /* Address region 7 - addr 0x3000f000, size=4KB, enabled*/
257 "ldr r0, =0x3000f017 \n\t"
258 "mcr p15, 0, r0, c6, c7, 0 \n\t"
259 "mcr p15, 0, r0, c6, c7, 1 \n\t"
260
261
262 /* Register 5 - Access Permission Registers */
263
264 "ldr r0, =0xffff \n\t"
265 "mcr p15, 0, r0, c5, c0, 0 \n\t" /* write data access permission bits */
266 "mcr p15, 0, r0, c5, c0, 1 \n\t" /* write instruction access permission bits */
267
268 "mov r0, #0xa7 \n\t"
269 "mcr p15, 0, r0, c3, c0, 0 \n\t" /* set write buffer control register */
270
271#if defined(LOGIK_DAX) || defined(SANSA_C100)
272 "mov r0, #0xa5 \n\t"
273#elif defined(IAUDIO_7) || defined(SANSA_M200)
274 "mov r0, #0xa7 \n\t"
275#else
276 #error NOT DEFINED FOR THIS TARGET!
277#endif
278 "mcr p15, 0, r0, c2, c0, 0 \n\t"
279 "mcr p15, 0, r0, c2, c0, 1 \n\t"
280
281 "mov r0, #0xa0000006 \n\t"
282 "mcr p15, 0, r0, c9, c1, 0 \n\t"
283
284 "ldr r1, =0x1107d \n\t"
285 "mov r0, #0x0 \n\t"
286 "mcr p15, 0, r0, c7, c5, 0 \n\t" /* Flush instruction cache */
287 "mcr p15, 0, r0, c7, c6, 0 \n\t" /* Flush data cache */
288
289 "mcr p15, 0, r1, c1, c0, 0 \n\t" /* CPU control bits */
290 : : : "r0", "r1"
291 );
292}
293
294
295
296void system_init(void)
297{
298 /* mask all interrupts */
299 IEN = 0;
300
301 /* Set all interrupts as IRQ for now - some may need to be FIQ in future */
302 IRQSEL = 0xffffffff;
303
304 /* Set master enable bit */
305 IEN = 0x80000000;
306
307 cpu_init();
308 clock_init();
309 gpio_init();
310
311 enable_irq();
312}
313
314int system_memory_guard(int newmode)
315{
316 (void)newmode;
317 return 0;
318}
319
320#ifdef HAVE_ADJUSTABLE_CPU_FREQ
321
322void set_cpu_frequency(long frequency)
323{
324}
325
326#endif
diff --git a/firmware/target/arm/tcc77x/timer-tcc77x.c b/firmware/target/arm/tcc77x/timer-tcc77x.c
deleted file mode 100644
index 6e8764d9ce..0000000000
--- a/firmware/target/arm/tcc77x/timer-tcc77x.c
+++ /dev/null
@@ -1,69 +0,0 @@
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
9*
10* Copyright (C) 2008 by Rob Purchase
11*
12* This program is free software; you can redistribute it and/or
13* modify it under the terms of the GNU General Public License
14* as published by the Free Software Foundation; either version 2
15* of the License, or (at your option) any later version.
16*
17* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18* KIND, either express or implied.
19*
20****************************************************************************/
21
22#include "config.h"
23#include "cpu.h"
24#include "system.h"
25#include "timer.h"
26#include "logf.h"
27
28/* Use the TC32 counter [sourced by Xin:12Mhz] for this timer, as it's the
29 only one that allows a 32-bit counter (Timer0-5 are 16/20 bit only). */
30
31bool timer_set(long cycles, bool start)
32{
33 #warning function not implemented
34
35 (void)cycles;
36 (void)start;
37 return false;
38}
39
40bool timer_start(void)
41{
42 #warning function not implemented
43
44 return false;
45}
46
47void timer_stop(void)
48{
49 #warning function not implemented
50}
51
52
53/* Timer interrupt processing - all timers (inc. tick) have a single IRQ */
54void TIMER(void)
55{
56 if (TIREQ & TF0) /* Timer0 reached ref value */
57 {
58 /* Run through the list of tick tasks */
59 call_tick_tasks();
60
61 /* reset Timer 0 IRQ & ref flags */
62 TIREQ |= TI0 | TF0;
63 }
64
65 if (TC32IRQ & (1<<3)) /* end of TC32 prescale */
66 {
67 /* dispatch timer */
68 }
69}
diff --git a/firmware/target/arm/wmcodec-telechips.c b/firmware/target/arm/wmcodec-telechips.c
index 8fb035bdfa..deaced2682 100644
--- a/firmware/target/arm/wmcodec-telechips.c
+++ b/firmware/target/arm/wmcodec-telechips.c
@@ -34,8 +34,6 @@
34#if defined(COWON_D2) 34#if defined(COWON_D2)
35/* The D2's audio codec uses an I2C address of 0x34 */ 35/* The D2's audio codec uses an I2C address of 0x34 */
36#define I2C_AUDIO_ADDRESS 0x34 36#define I2C_AUDIO_ADDRESS 0x34
37#elif defined (IAUDIO_7) || defined(LOGIK_DAX) || defined(SANSA_M200)
38#define I2C_AUDIO_ADDRESS 0x34
39#else 37#else
40#error wmcodec not implemented for this target! 38#error wmcodec not implemented for this target!
41#endif 39#endif
diff --git a/firmware/target/hosted/sdl/sim-ui-defines.h b/firmware/target/hosted/sdl/sim-ui-defines.h
index c3ae7c0551..97562ef933 100644
--- a/firmware/target/hosted/sdl/sim-ui-defines.h
+++ b/firmware/target/hosted/sdl/sim-ui-defines.h
@@ -226,13 +226,6 @@
226#define UI_LCD_POSX 58 /* x position of lcd */ 226#define UI_LCD_POSX 58 /* x position of lcd */
227#define UI_LCD_POSY 67 /* y position of lcd */ 227#define UI_LCD_POSY 67 /* y position of lcd */
228 228
229#elif defined(IAUDIO_7)
230#define UI_TITLE "iAudio7"
231#define UI_WIDTH 494 /* width of GUI window */
232#define UI_HEIGHT 214 /* height of GUI window */
233#define UI_LCD_POSX 131 /* x position of lcd */
234#define UI_LCD_POSY 38 /* y position of lcd */
235
236#elif defined(CREATIVE_ZVM) || defined(CREATIVE_ZVM60GB) 229#elif defined(CREATIVE_ZVM) || defined(CREATIVE_ZVM60GB)
237#ifdef CREATIVE_ZVM 230#ifdef CREATIVE_ZVM
238 #define UI_TITLE "Creative Zen Vision:M 30GB" 231 #define UI_TITLE "Creative Zen Vision:M 30GB"
diff --git a/firmware/usb.c b/firmware/usb.c
index 05597dff9b..b919fe468d 100644
--- a/firmware/usb.c
+++ b/firmware/usb.c
@@ -57,7 +57,7 @@
57 (defined(HAVE_USBSTACK) && defined(IPOD_NANO2G)) || \ 57 (defined(HAVE_USBSTACK) && defined(IPOD_NANO2G)) || \
58 (defined(HAVE_USBSTACK) && (defined(CREATIVE_ZVx))) || \ 58 (defined(HAVE_USBSTACK) && (defined(CREATIVE_ZVx))) || \
59 (defined(HAVE_USBSTACK) && (defined(OLYMPUS_MROBE_500))) || \ 59 (defined(HAVE_USBSTACK) && (defined(OLYMPUS_MROBE_500))) || \
60 defined(CPU_TCC77X) || defined(CPU_TCC780X) || \ 60 defined(CPU_TCC780X) || \
61 (CONFIG_USBOTG == USBOTG_JZ4740) || \ 61 (CONFIG_USBOTG == USBOTG_JZ4740) || \
62 (CONFIG_USBOTG == USBOTG_JZ4760) 62 (CONFIG_USBOTG == USBOTG_JZ4760)
63/* TODO: condition should be reset to be only the original 63/* TODO: condition should be reset to be only the original
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c
index c42cc830ee..39ccb9a6e5 100644
--- a/firmware/usbstack/usb_storage.c
+++ b/firmware/usbstack/usb_storage.c
@@ -47,7 +47,7 @@
47#endif 47#endif
48 48
49#ifndef USBSTOR_WRITE_SECTORS_FILTER 49#ifndef USBSTOR_WRITE_SECTORS_FILTER
50#define USBSTOR_WRITE_SECTORS_FILTER() ({ 0; }) 50#define USBSTOR_WRITE_SECTORS_FILTER() ({ 0; })
51#endif 51#endif
52 52
53/* the ARC driver currently supports up to 64k USB transfers. This is 53/* the ARC driver currently supports up to 64k USB transfers. This is
@@ -433,7 +433,7 @@ void usb_storage_init_connection(void)
433 /* prime rx endpoint. We only need room for commands */ 433 /* prime rx endpoint. We only need room for commands */
434 state = WAITING_FOR_COMMAND; 434 state = WAITING_FOR_COMMAND;
435 435
436#if (CONFIG_CPU == IMX31L || defined(CPU_TCC77X) || defined(CPU_TCC780X) || \ 436#if (CONFIG_CPU == IMX31L || defined(CPU_TCC780X) || \
437 CONFIG_CPU == S5L8702 || CONFIG_CPU == S5L8701 || CONFIG_CPU == AS3525v2 || \ 437 CONFIG_CPU == S5L8702 || CONFIG_CPU == S5L8701 || CONFIG_CPU == AS3525v2 || \
438 defined(BOOTLOADER) || CONFIG_CPU == DM320) && !defined(CPU_PP502x) 438 defined(BOOTLOADER) || CONFIG_CPU == DM320) && !defined(CPU_PP502x)
439 static unsigned char _cbw_buffer[MAX_CBW_SIZE] 439 static unsigned char _cbw_buffer[MAX_CBW_SIZE]