diff options
author | Michael Hennerich <michael.hennerich@analog.com> | 2009-05-04 05:11:37 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-06-12 06:11:47 -0400 |
commit | c8d5ea8ccb1ce586131c6c549899cb5073222da0 (patch) | |
tree | 8577a765ef1b9c5c4813ed9ceed5a03a885894f1 /arch/blackfin/kernel/gptimers.c | |
parent | 9ba3c24f10c948dadac2ca91ed714dfbcedd61ca (diff) |
Blackfin: update gptimers API
First we fix the prototypes for functions that return boolean values by
using "int" rather than "uint16_t". Then we introduce a get_gptimer_run()
function for checking the current run status of a timer, and then we add a
disable_gptimers_sync() function which parallels disable_gptimers() with
corresponding normal "_sync" behavior.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/kernel/gptimers.c')
-rw-r--r-- | arch/blackfin/kernel/gptimers.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/arch/blackfin/kernel/gptimers.c b/arch/blackfin/kernel/gptimers.c index 3a3e9615b002..7281a91d26b5 100644 --- a/arch/blackfin/kernel/gptimers.c +++ b/arch/blackfin/kernel/gptimers.c | |||
@@ -189,10 +189,10 @@ void set_gptimer_status(int group, uint32_t value) | |||
189 | } | 189 | } |
190 | EXPORT_SYMBOL(set_gptimer_status); | 190 | EXPORT_SYMBOL(set_gptimer_status); |
191 | 191 | ||
192 | uint16_t get_gptimer_intr(int timer_id) | 192 | int get_gptimer_intr(int timer_id) |
193 | { | 193 | { |
194 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 194 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
195 | return (group_regs[BFIN_TIMER_OCTET(timer_id)]->status & timil_mask[timer_id]) ? 1 : 0; | 195 | return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & timil_mask[timer_id]); |
196 | } | 196 | } |
197 | EXPORT_SYMBOL(get_gptimer_intr); | 197 | EXPORT_SYMBOL(get_gptimer_intr); |
198 | 198 | ||
@@ -203,10 +203,10 @@ void clear_gptimer_intr(int timer_id) | |||
203 | } | 203 | } |
204 | EXPORT_SYMBOL(clear_gptimer_intr); | 204 | EXPORT_SYMBOL(clear_gptimer_intr); |
205 | 205 | ||
206 | uint16_t get_gptimer_over(int timer_id) | 206 | int get_gptimer_over(int timer_id) |
207 | { | 207 | { |
208 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 208 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
209 | return (group_regs[BFIN_TIMER_OCTET(timer_id)]->status & tovf_mask[timer_id]) ? 1 : 0; | 209 | return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & tovf_mask[timer_id]); |
210 | } | 210 | } |
211 | EXPORT_SYMBOL(get_gptimer_over); | 211 | EXPORT_SYMBOL(get_gptimer_over); |
212 | 212 | ||
@@ -217,6 +217,13 @@ void clear_gptimer_over(int timer_id) | |||
217 | } | 217 | } |
218 | EXPORT_SYMBOL(clear_gptimer_over); | 218 | EXPORT_SYMBOL(clear_gptimer_over); |
219 | 219 | ||
220 | int get_gptimer_run(int timer_id) | ||
221 | { | ||
222 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | ||
223 | return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & trun_mask[timer_id]); | ||
224 | } | ||
225 | EXPORT_SYMBOL(get_gptimer_run); | ||
226 | |||
220 | void set_gptimer_config(int timer_id, uint16_t config) | 227 | void set_gptimer_config(int timer_id, uint16_t config) |
221 | { | 228 | { |
222 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 229 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
@@ -244,7 +251,7 @@ void enable_gptimers(uint16_t mask) | |||
244 | } | 251 | } |
245 | EXPORT_SYMBOL(enable_gptimers); | 252 | EXPORT_SYMBOL(enable_gptimers); |
246 | 253 | ||
247 | void disable_gptimers(uint16_t mask) | 254 | static void _disable_gptimers(uint16_t mask) |
248 | { | 255 | { |
249 | int i; | 256 | int i; |
250 | uint16_t m = mask; | 257 | uint16_t m = mask; |
@@ -253,6 +260,12 @@ void disable_gptimers(uint16_t mask) | |||
253 | group_regs[i]->disable = m & 0xFF; | 260 | group_regs[i]->disable = m & 0xFF; |
254 | m >>= 8; | 261 | m >>= 8; |
255 | } | 262 | } |
263 | } | ||
264 | |||
265 | void disable_gptimers(uint16_t mask) | ||
266 | { | ||
267 | int i; | ||
268 | _disable_gptimers(mask); | ||
256 | for (i = 0; i < MAX_BLACKFIN_GPTIMERS; ++i) | 269 | for (i = 0; i < MAX_BLACKFIN_GPTIMERS; ++i) |
257 | if (mask & (1 << i)) | 270 | if (mask & (1 << i)) |
258 | group_regs[BFIN_TIMER_OCTET(i)]->status |= trun_mask[i]; | 271 | group_regs[BFIN_TIMER_OCTET(i)]->status |= trun_mask[i]; |
@@ -260,6 +273,13 @@ void disable_gptimers(uint16_t mask) | |||
260 | } | 273 | } |
261 | EXPORT_SYMBOL(disable_gptimers); | 274 | EXPORT_SYMBOL(disable_gptimers); |
262 | 275 | ||
276 | void disable_gptimers_sync(uint16_t mask) | ||
277 | { | ||
278 | _disable_gptimers(mask); | ||
279 | SSYNC(); | ||
280 | } | ||
281 | EXPORT_SYMBOL(disable_gptimers_sync); | ||
282 | |||
263 | void set_gptimer_pulse_hi(int timer_id) | 283 | void set_gptimer_pulse_hi(int timer_id) |
264 | { | 284 | { |
265 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 285 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |