diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2021-04-23 11:09:49 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2021-04-26 07:41:51 -0400 |
commit | 3ba2f6e5c7383c5d7a6f8a1c38b6b5403a8a5dcb (patch) | |
tree | 2741885caf2393cf05ddd5fac7559df3abcd17dd /firmware/target/arm/tcc77x/adc-tcc77x.c | |
parent | 77188e41f5c9966432a0fbb3bffd2069d53cc608 (diff) | |
download | rockbox-3ba2f6e5c7383c5d7a6f8a1c38b6b5403a8a5dcb.tar.gz rockbox-3ba2f6e5c7383c5d7a6f8a1c38b6b5403a8a5dcb.zip |
Nuke all TCC77x targets: iAudio 7, Sansa C100, M200(v1-3), Logik DAX
They were never finished, never saw any release ever, and haven't
compiled for the better part of a decade. Given their HW capabilities [1],
they are not worth trying to fix.
[1] 1-2MB RAM, ~256MB onboard flash, no expandability
Change-Id: I7b2a5806d687114c22156bb0458d4a10a9734190
Diffstat (limited to 'firmware/target/arm/tcc77x/adc-tcc77x.c')
-rw-r--r-- | firmware/target/arm/tcc77x/adc-tcc77x.c | 121 |
1 files changed, 0 insertions, 121 deletions
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 | |||
50 | static int channel_group; | ||
51 | static unsigned short adcdata[8]; | ||
52 | |||
53 | /* Tick task */ | ||
54 | static 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 */ | ||
72 | void 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 | |||
100 | unsigned short adc_read(int channel) | ||
101 | { | ||
102 | return adcdata[channel]; | ||
103 | } | ||
104 | |||
105 | void 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 | } | ||