Various minor cleanups for mini2440
[maemo-rb.git] / firmware / target / arm / s3c2440 / mini2440 / led-mini2440.c
blob606d4431847b2f3544c0c47917139595955ce9f8
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2009 by Bob Cousins
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #include "config.h"
22 #include "cpu.h"
23 #include "kernel.h"
24 #include "led-mini2440.h"
26 /* LED functions for debug */
28 void led_init (void)
30 S3C2440_GPIO_CONFIG (GPBCON, 5, GPIO_OUTPUT);
31 S3C2440_GPIO_CONFIG (GPBCON, 6, GPIO_OUTPUT);
32 S3C2440_GPIO_CONFIG (GPBCON, 7, GPIO_OUTPUT);
33 S3C2440_GPIO_CONFIG (GPBCON, 8, GPIO_OUTPUT);
35 S3C2440_GPIO_PULLUP (GPBUP, 5, GPIO_PULLUP_DISABLE);
36 S3C2440_GPIO_PULLUP (GPBUP, 6, GPIO_PULLUP_DISABLE);
37 S3C2440_GPIO_PULLUP (GPBUP, 7, GPIO_PULLUP_DISABLE);
38 S3C2440_GPIO_PULLUP (GPBUP, 8, GPIO_PULLUP_DISABLE);
41 /* Turn on one or more LEDS */
42 void set_leds (int led_mask)
44 GPBDAT &= ~led_mask;
47 /* Turn off one or more LEDS */
48 void clear_leds (int led_mask)
50 GPBDAT |= led_mask;
53 /* Alternate flash pattern1 and pattern2 */
54 /* Never returns */
55 void led_flash (int led_pattern1, int led_pattern2)
57 while (1)
59 set_leds (led_pattern1);
60 sleep(HZ/2);
61 clear_leds (led_pattern1);
63 set_leds(led_pattern2);
64 sleep(HZ/2);
65 clear_leds (led_pattern2);