diff options
-rw-r--r-- | firmware/target/arm/imx31/gigabeat-s/pcm-imx31.c | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/pcm-imx31.c b/firmware/target/arm/imx31/gigabeat-s/pcm-imx31.c index c29c4b2930..b62051e41d 100644 --- a/firmware/target/arm/imx31/gigabeat-s/pcm-imx31.c +++ b/firmware/target/arm/imx31/gigabeat-s/pcm-imx31.c | |||
@@ -29,66 +29,24 @@ static int pcm_freq = HW_SAMPR_DEFAULT; /* 44.1 is default */ | |||
29 | 29 | ||
30 | void fiq_handler(void) __attribute__((naked)); | 30 | void fiq_handler(void) __attribute__((naked)); |
31 | 31 | ||
32 | /* Implement separately on recording and playback - simply disable the | ||
33 | specific DMA interrupt. Disable the FIQ itself only temporarily to sync | ||
34 | with the DMA interrupt and restore its previous state. The pcm routines | ||
35 | will call the lockout first then call into these low-level routines. */ | ||
36 | struct dma_lock | ||
37 | { | ||
38 | int locked; | ||
39 | unsigned long state; | ||
40 | }; | ||
41 | |||
42 | static struct dma_play_lock = | ||
43 | { | ||
44 | .locked = 0, | ||
45 | .state = 0, /* Initialize this as disabled */ | ||
46 | }; | ||
47 | |||
48 | void pcm_play_lock(void) | 32 | void pcm_play_lock(void) |
49 | { | 33 | { |
50 | int status = set_fiq_status(FIQ_DISABLED); | ||
51 | if (++dma_play_lock.locked == 1) | ||
52 | ; /* Mask the DMA interrupt */ | ||
53 | set_fiq_status(status); | ||
54 | } | 34 | } |
55 | 35 | ||
56 | void pcm_play_unlock(void) | 36 | void pcm_play_unlock(void) |
57 | { | 37 | { |
58 | int status = set_fiq_status(FIQ_DISABLED); | ||
59 | if (--dma_play_lock.locked == 0) | ||
60 | ; /* Unmask the DMA interrupt if enabled */ | ||
61 | set_fiq_status(status); | ||
62 | } | 38 | } |
63 | 39 | ||
64 | static void _pcm_apply_settings(void) | 40 | static void _pcm_apply_settings(void) |
65 | { | 41 | { |
66 | if (pcm_freq != pcm_curr_sampr) | ||
67 | { | ||
68 | pcm_curr_sampr = pcm_freq; | ||
69 | /* Change hardware sample rate */ | ||
70 | /* */ | ||
71 | } | ||
72 | } | 42 | } |
73 | 43 | ||
74 | void pcm_apply_settings(void) | 44 | void pcm_apply_settings(void) |
75 | { | 45 | { |
76 | /* Lockout FIQ and sync the hardware to the settings */ | ||
77 | int oldstatus = set_fiq_status(FIQ_DISABLED); | ||
78 | _pcm_apply_settings(); | ||
79 | set_fiq_status(oldstatus); | ||
80 | } | 46 | } |
81 | 47 | ||
82 | void pcm_play_dma_init(void) | 48 | void pcm_play_dma_init(void) |
83 | { | 49 | { |
84 | pcm_set_frequency(SAMPR_44); | ||
85 | |||
86 | #if 0 | ||
87 | /* Do basic init enable output in pcm_postinit if popping is a | ||
88 | problem at boot to enable a lenghy delay and let the boot | ||
89 | process continue */ | ||
90 | audiohw_init(); | ||
91 | #endif | ||
92 | } | 50 | } |
93 | 51 | ||
94 | void pcm_postinit(void) | 52 | void pcm_postinit(void) |
@@ -98,19 +56,11 @@ void pcm_postinit(void) | |||
98 | /* Connect the DMA and start filling the FIFO */ | 56 | /* Connect the DMA and start filling the FIFO */ |
99 | static void play_start_pcm(void) | 57 | static void play_start_pcm(void) |
100 | { | 58 | { |
101 | #if 0 | ||
102 | /* unmask DMA interrupt when unlocking */ | ||
103 | dma_play_lock.state = 0; /* Set to allow pcm_play_unlock to unmask interrupt */ | ||
104 | #endif | ||
105 | } | 59 | } |
106 | 60 | ||
107 | /* Disconnect the DMA and wait for the FIFO to clear */ | 61 | /* Disconnect the DMA and wait for the FIFO to clear */ |
108 | static void play_stop_pcm(void) | 62 | static void play_stop_pcm(void) |
109 | { | 63 | { |
110 | #if 0 | ||
111 | /* Keep interrupt masked when unlocking */ | ||
112 | dma_play_lock.state = 0; /* Set to keep pcm_play_unlock from unmasking interrupt */ | ||
113 | #endif | ||
114 | } | 64 | } |
115 | 65 | ||
116 | void pcm_play_dma_start(const void *addr, size_t size) | 66 | void pcm_play_dma_start(const void *addr, size_t size) |
@@ -121,30 +71,16 @@ void pcm_play_dma_start(const void *addr, size_t size) | |||
121 | 71 | ||
122 | void pcm_play_dma_stop(void) | 72 | void pcm_play_dma_stop(void) |
123 | { | 73 | { |
124 | play_stop_pcm(); | ||
125 | } | 74 | } |
126 | 75 | ||
127 | void pcm_play_dma_pause(bool pause) | 76 | void pcm_play_dma_pause(bool pause) |
128 | { | 77 | { |
129 | if (pause) | ||
130 | { | ||
131 | play_stop_pcm(); | ||
132 | } | ||
133 | else | ||
134 | { | ||
135 | play_start_pcm(); | ||
136 | } | ||
137 | } | 78 | } |
138 | 79 | ||
139 | /* Get more samples to play out - call pcm_play_dma_stop and | 80 | /* Get more samples to play out - call pcm_play_dma_stop and |
140 | pcm_play_dma_stopped_callback if the data runs out */ | 81 | pcm_play_dma_stopped_callback if the data runs out */ |
141 | void fiq_handler(void) | 82 | void fiq_handler(void) |
142 | { | 83 | { |
143 | #if 0 | ||
144 | /* Callback missing or no more DMA to do */ | ||
145 | pcm_play_dma_stop(); | ||
146 | pcm_play_dma_stopped_callback(); | ||
147 | #endif | ||
148 | } | 84 | } |
149 | 85 | ||
150 | /* Set the pcm frequency hardware will use when play is next started or | 86 | /* Set the pcm frequency hardware will use when play is next started or |
@@ -152,7 +88,6 @@ void fiq_handler(void) | |||
152 | hardware here but simply cache it. */ | 88 | hardware here but simply cache it. */ |
153 | void pcm_set_frequency(unsigned int frequency) | 89 | void pcm_set_frequency(unsigned int frequency) |
154 | { | 90 | { |
155 | pcm_freq = frequency; | ||
156 | } | 91 | } |
157 | 92 | ||
158 | /* Return the number of bytes waiting - full L-R sample pairs only */ | 93 | /* Return the number of bytes waiting - full L-R sample pairs only */ |