Root/qiboot/src/blink_led.c

1/*
2 * (C) Copyright 2007 OpenMoko, Inc.
3 * Author: xiangfu liu <xiangfu@openmoko.org>
4 *
5 * Configuation settings for the FIC Neo GTA02 Linux GSM phone
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * MA 02111-1307 USA
21 */
22
23#include "blink_led.h"
24
25int delay(int time)
26{
27  int i=0;
28  for(i=0;i<time;i++);
29  return 0;
30}
31int set_GPB(void)
32{
33  GPBCON = 0x5;
34  GPBDW = 0xffff;
35  return 0;
36}
37
38int orange_on(int times)
39{
40  int count=0;
41  set_GPB();
42
43  for(count=0;count<times;count++)
44    {
45      ORANGE_ON();
46      delay(0xfffff);
47      ORANGE_OFF() ;
48      delay(0xfffff);
49    }
50
51  return 0;
52}
53
54int blue_on(int times)
55{
56  int count=0;
57  set_GPB();
58
59  for(count=0;count<times;count++)
60    {
61      BLUE_ON();
62      delay(0xfffff);
63      BLUE_OFF();
64      delay(0xfffff);
65    }
66
67  return 0;
68}
69
70int blink_led(void)
71{
72  set_GPB();
73
74  while(1)
75    {
76      ORANGE_ON();
77      delay(0xfffff);
78      ORANGE_OFF() ;
79      delay(0xfffff);
80
81      BLUE_ON();
82      delay(0xfffff);
83      BLUE_OFF();
84      delay(0xfffff);
85    }
86
87  return 0;
88}
89
90
91

Archive Download this file



interactive