diff options
Diffstat (limited to 'firmware/target/arm/s3c2440/mini2440/led-mini2440.c')
-rw-r--r-- | firmware/target/arm/s3c2440/mini2440/led-mini2440.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/firmware/target/arm/s3c2440/mini2440/led-mini2440.c b/firmware/target/arm/s3c2440/mini2440/led-mini2440.c new file mode 100644 index 0000000000..f541d75273 --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/led-mini2440.c | |||
@@ -0,0 +1,66 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Bob Cousins | ||
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 "kernel.h" | ||
24 | |||
25 | /* LED functions for debug */ | ||
26 | |||
27 | void led_init (void) | ||
28 | { | ||
29 | S3C2440_GPIO_CONFIG (GPBCON, 5, GPIO_OUTPUT); | ||
30 | S3C2440_GPIO_CONFIG (GPBCON, 6, GPIO_OUTPUT); | ||
31 | S3C2440_GPIO_CONFIG (GPBCON, 7, GPIO_OUTPUT); | ||
32 | S3C2440_GPIO_CONFIG (GPBCON, 8, GPIO_OUTPUT); | ||
33 | |||
34 | S3C2440_GPIO_PULLUP (GPBUP, 5, GPIO_PULLUP_DISABLE); | ||
35 | S3C2440_GPIO_PULLUP (GPBUP, 6, GPIO_PULLUP_DISABLE); | ||
36 | S3C2440_GPIO_PULLUP (GPBUP, 7, GPIO_PULLUP_DISABLE); | ||
37 | S3C2440_GPIO_PULLUP (GPBUP, 8, GPIO_PULLUP_DISABLE); | ||
38 | } | ||
39 | |||
40 | /* Turn on one or more LEDS */ | ||
41 | void set_leds (int led_mask) | ||
42 | { | ||
43 | GPBDAT &= ~led_mask; | ||
44 | } | ||
45 | |||
46 | /* Turn off one or more LEDS */ | ||
47 | void clear_leds (int led_mask) | ||
48 | { | ||
49 | GPBDAT |= led_mask; | ||
50 | } | ||
51 | |||
52 | /* Alternate flash pattern1 and pattern2 */ | ||
53 | /* Never returns */ | ||
54 | void led_flash (int led_pattern1, int led_pattern2) | ||
55 | { | ||
56 | while (1) | ||
57 | { | ||
58 | set_leds (led_pattern1); | ||
59 | sleep(HZ/2); | ||
60 | clear_leds (led_pattern1); | ||
61 | |||
62 | set_leds(led_pattern2); | ||
63 | sleep(HZ/2); | ||
64 | clear_leds (led_pattern2); | ||
65 | } | ||
66 | } | ||