[PATCH 3/7] move-kboot.h-to-include.patch
Andy Green
andy at openmoko.com
Mon Aug 18 00:24:14 CEST 2008
Signed-off-by: Andy Green <andy at openmoko.com>
---
include/qi-ctype.h | 45 ++++++++++++++++++++
include/qi-serial.h | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++
include/qi.h | 42 +++++++++++++++++++
src/ctype.c | 2 -
src/ctype.h | 45 --------------------
src/kboot.h | 37 -----------------
src/nand_read.c | 2 -
src/phase2.c | 6 ---
src/serial.c | 2 -
src/start_kboot.c | 2 -
src/utils.c | 2 -
11 files changed, 205 insertions(+), 92 deletions(-)
create mode 100644 include/qi-ctype.h
create mode 100644 include/qi-serial.h
create mode 100644 include/qi.h
delete mode 100644 src/ctype.h
delete mode 100644 src/kboot.h
diff --git a/include/qi-ctype.h b/include/qi-ctype.h
new file mode 100644
index 0000000..ed65522
--- /dev/null
+++ b/include/qi-ctype.h
@@ -0,0 +1,45 @@
+#define _U 0x01 /* upper */
+#define _L 0x02 /* lower */
+#define _D 0x04 /* digit */
+#define _C 0x08 /* cntrl */
+#define _P 0x10 /* punct */
+#define _S 0x20 /* white space (space/lf/tab) */
+#define _X 0x40 /* hex digit */
+#define _SP 0x80 /* hard space (0x20) */
+
+extern unsigned char _ctype[];
+
+#define __ismask(x) (_ctype[(int)(unsigned char)(x)])
+
+#define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0)
+#define isalpha(c) ((__ismask(c)&(_U|_L)) != 0)
+#define iscntrl(c) ((__ismask(c)&(_C)) != 0)
+#define isdigit(c) ((__ismask(c)&(_D)) != 0)
+#define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0)
+#define islower(c) ((__ismask(c)&(_L)) != 0)
+#define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
+#define ispunct(c) ((__ismask(c)&(_P)) != 0)
+#define isspace(c) ((__ismask(c)&(_S)) != 0)
+#define isupper(c) ((__ismask(c)&(_U)) != 0)
+#define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0)
+
+#define isascii(c) (((unsigned char)(c))<=0x7f)
+#define toascii(c) (((unsigned char)(c))&0x7f)
+
+static inline unsigned char __tolower(unsigned char c)
+{
+ if (isupper(c))
+ c -= 'A'-'a';
+ return c;
+}
+
+static inline unsigned char __toupper(unsigned char c)
+{
+ if (islower(c))
+ c -= 'a'-'A';
+ return c;
+}
+
+#define tolower(c) __tolower(c)
+#define toupper(c) __toupper(c)
+
diff --git a/include/qi-serial.h b/include/qi-serial.h
new file mode 100644
index 0000000..732fe67
--- /dev/null
+++ b/include/qi-serial.h
@@ -0,0 +1,112 @@
+/*
+ * (C) Copyright 2007 OpenMoko, Inc.
+ * Author: xiangfu liu <xiangfu at openmoko.org>
+ *
+ * Configuation settings for the FIC Neo GTA02 Linux GSM phone
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+
+#ifndef __SERIAL_H__
+#define __SERIAL_H__
+
+#define UART0 0
+#define UART1 1
+#define UART2 2
+
+#define rGPHCON (*(volatile unsigned *)0x56000070) /*UART 0 Line control*/
+
+#define rULCON0 (*(volatile unsigned *)0x50000000) /*UART 0 Line control*/
+#define rUCON0 (*(volatile unsigned *)0x50000004) /*UART 0 Control*/
+#define rUFCON0 (*(volatile unsigned *)0x50000008) /*UART 0 FIFO control*/
+#define rUMCON0 (*(volatile unsigned *)0x5000000c) /*UART 0 Modem control*/
+#define rUTRSTAT0 (*(volatile unsigned *)0x50000010) /*UART 0 Tx/Rx status*/
+#define rUERSTAT0 (*(volatile unsigned *)0x50000014) /*UART 0 Rx error status*/
+#define rUFSTAT0 (*(volatile unsigned *)0x50000018) /*UART 0 FIFO status*/
+#define rUMSTAT0 (*(volatile unsigned *)0x5000001c) /*UART 0 Modem status*/
+#define rUBRDIV0 (*(volatile unsigned *)0x50000028) /*UART 0 Baud rate divisor*/
+
+#define rULCON1 (*(volatile unsigned *)0x50004000) /*UART 1 Line control*/
+#define rUCON1 (*(volatile unsigned *)0x50004004) /*UART 1 Control*/
+#define rUFCON1 (*(volatile unsigned *)0x50004008) /*UART 1 FIFO control*/
+#define rUMCON1 (*(volatile unsigned *)0x5000400c) /*UART 1 Modem control*/
+#define rUTRSTAT1 (*(volatile unsigned *)0x50004010) /*UART 1 Tx/Rx status*/
+#define rUERSTAT1 (*(volatile unsigned *)0x50004014) /*UART 1 Rx error status*/
+#define rUFSTAT1 (*(volatile unsigned *)0x50004018) /*UART 1 FIFO status*/
+#define rUMSTAT1 (*(volatile unsigned *)0x5000401c) /*UART 1 Modem status*/
+#define rUBRDIV1 (*(volatile unsigned *)0x50004028) /*UART 1 Baud rate divisor*/
+
+#define rULCON2 (*(volatile unsigned *)0x50008000) /*UART 2 Line control*/
+#define rUCON2 (*(volatile unsigned *)0x50008004) /*UART 2 Control*/
+#define rUFCON2 (*(volatile unsigned *)0x50008008) /*UART 2 FIFO control*/
+#define rUTRSTAT2 (*(volatile unsigned *)0x50008010) /*UART 2 Tx/Rx status*/
+#define rUERSTAT2 (*(volatile unsigned *)0x50008014) /*UART 2 Rx error status*/
+#define rUFSTAT2 (*(volatile unsigned *)0x50008018) /*UART 2 FIFO status*/
+#define rUBRDIV2 (*(volatile unsigned *)0x50008028) /*UART 2 Baud rate divisor*/
+
+#define WrUTXH0(ch) (*(volatile unsigned char *)0x50000020)=(unsigned char)(ch)
+#define RdURXH0() (*(volatile unsigned char *)0x50000024)
+#define WrUTXH1(ch) (*(volatile unsigned char *)0x50004020)=(unsigned char)(ch)
+#define RdURXH1() (*(volatile unsigned char *)0x50004024)
+#define WrUTXH2(ch) (*(volatile unsigned char *)0x50008020)=(unsigned char)(ch)
+#define RdURXH2() (*(volatile unsigned char *)0x50008024)
+
+
+
+// I/O PORT
+#define rGPACON (*(volatile unsigned *)0x56000000)
+#define rGPADAT (*(volatile unsigned *)0x56000004)
+
+#define rGPBCON (*(volatile unsigned *)0x56000010)
+#define rGPBDAT (*(volatile unsigned *)0x56000014)
+#define rGPBUP (*(volatile unsigned *)0x56000018)
+
+#define rGPCCON (*(volatile unsigned *)0x56000020)
+#define rGPCDAT (*(volatile unsigned *)0x56000024)
+#define rGPCUP (*(volatile unsigned *)0x56000028)
+
+#define rGPDCON (*(volatile unsigned *)0x56000030)
+#define rGPDDAT (*(volatile unsigned *)0x56000034)
+#define rGPDUP (*(volatile unsigned *)0x56000038)
+
+#define rGPECON (*(volatile unsigned *)0x56000040)
+#define rGPEDAT (*(volatile unsigned *)0x56000044)
+#define rGPEUP (*(volatile unsigned *)0x56000048)
+
+#define rGPFCON (*(volatile unsigned *)0x56000050)
+#define rGPFDAT (*(volatile unsigned *)0x56000054)
+#define rGPFUP (*(volatile unsigned *)0x56000058)
+
+#define rGPGCON (*(volatile unsigned *)0x56000060)
+#define rGPGDAT (*(volatile unsigned *)0x56000064)
+#define rGPGUP (*(volatile unsigned *)0x56000068)
+
+#define rGPHCON (*(volatile unsigned *)0x56000070)
+#define rGPHDAT (*(volatile unsigned *)0x56000074)
+#define rGPHUP (*(volatile unsigned *)0x56000078)
+
+#define rGPJCON (*(volatile unsigned *)0x560000d0) //Port J control
+#define rGPJDAT (*(volatile unsigned *)0x560000d4) //Port J data
+#define rGPJUP (*(volatile unsigned *)0x560000d8) //Port J data
+
+void port_init(void);
+void serial_init (const int ubrdiv_val,const int uart);
+void serial_putc (const int uart,const char c);
+int printk(const char *fmt, ...);
+int puts(const char *string);
+
+#endif
diff --git a/include/qi.h b/include/qi.h
new file mode 100644
index 0000000..92d92ca
--- /dev/null
+++ b/include/qi.h
@@ -0,0 +1,42 @@
+/*
+ * (C) Copyright 2008 Openmoko, Inc.
+ * Author: Andy Green <andy at openmoko.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __QI_H__
+#define __QI_H__
+
+#include <stdarg.h>
+#include <qi-serial.h>
+#include <qi-ctype.h>
+
+#define u32 unsigned int
+#define u16 unsigned short
+#define u8 unsigned char
+typedef unsigned int uint32_t;
+
+int printk(const char *fmt, ...);
+int vsprintf(char *buf, const char *fmt, va_list args);
+int puts(const char *string);
+void printhex(unsigned char v);
+void print32(unsigned int u);
+void hexdump(unsigned char *start, int len);
+unsigned int _ntohl(unsigned int n);
+
+#endif
+
diff --git a/src/ctype.c b/src/ctype.c
index ce1d315..cf5a5a6 100644
--- a/src/ctype.c
+++ b/src/ctype.c
@@ -1,4 +1,4 @@
-#include "ctype.h"
+#include <qi-ctype.h>
unsigned char _ctype[] = {
_C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */
diff --git a/src/ctype.h b/src/ctype.h
deleted file mode 100644
index ed65522..0000000
--- a/src/ctype.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#define _U 0x01 /* upper */
-#define _L 0x02 /* lower */
-#define _D 0x04 /* digit */
-#define _C 0x08 /* cntrl */
-#define _P 0x10 /* punct */
-#define _S 0x20 /* white space (space/lf/tab) */
-#define _X 0x40 /* hex digit */
-#define _SP 0x80 /* hard space (0x20) */
-
-extern unsigned char _ctype[];
-
-#define __ismask(x) (_ctype[(int)(unsigned char)(x)])
-
-#define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0)
-#define isalpha(c) ((__ismask(c)&(_U|_L)) != 0)
-#define iscntrl(c) ((__ismask(c)&(_C)) != 0)
-#define isdigit(c) ((__ismask(c)&(_D)) != 0)
-#define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0)
-#define islower(c) ((__ismask(c)&(_L)) != 0)
-#define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
-#define ispunct(c) ((__ismask(c)&(_P)) != 0)
-#define isspace(c) ((__ismask(c)&(_S)) != 0)
-#define isupper(c) ((__ismask(c)&(_U)) != 0)
-#define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0)
-
-#define isascii(c) (((unsigned char)(c))<=0x7f)
-#define toascii(c) (((unsigned char)(c))&0x7f)
-
-static inline unsigned char __tolower(unsigned char c)
-{
- if (isupper(c))
- c -= 'A'-'a';
- return c;
-}
-
-static inline unsigned char __toupper(unsigned char c)
-{
- if (islower(c))
- c -= 'a'-'A';
- return c;
-}
-
-#define tolower(c) __tolower(c)
-#define toupper(c) __toupper(c)
-
diff --git a/src/kboot.h b/src/kboot.h
deleted file mode 100644
index af47a12..0000000
--- a/src/kboot.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * (C) Copyright 2008 Openmoko, Inc.
- * Author: Andy Green <andy at openmoko.org>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#ifndef __KBOOT_H__
-#define __KBOOT_H__
-
-#include <stdarg.h>
-#include "serial.h"
-#include "ctype.h"
-
-int printk(const char *fmt, ...);
-int vsprintf(char *buf, const char *fmt, va_list args);
-int puts(const char *string);
-void printhex(unsigned char v);
-void print32(unsigned int u);
-void hexdump(unsigned char *start, int len);
-unsigned int _ntohl(unsigned int n);
-
-#endif
-
diff --git a/src/nand_read.c b/src/nand_read.c
index 16310bb..bdd1b6a 100644
--- a/src/nand_read.c
+++ b/src/nand_read.c
@@ -18,8 +18,8 @@
/* NOTE this stuff runs in steppingstone context! */
+#include <qi.h>
#include "nand_read.h"
-#include "kboot.h"
#define NAND_CMD_READ0 0
#define NAND_CMD_READSTART 0x30
diff --git a/src/phase2.c b/src/phase2.c
index ac43822..59a18f0 100644
--- a/src/phase2.c
+++ b/src/phase2.c
@@ -21,16 +21,12 @@
* MA 02111-1307 USA
*/
-#include "kboot.h"
+#include <qi.h>
#include <neo_gta02.h>
#include "blink_led.h"
#include <string.h>
#define __ARM__
#include <image.h>
-#define u32 unsigned int
-#define u16 unsigned short
-#define u8 unsigned char
-typedef unsigned int uint32_t;
#include <setup.h>
#include "nand_read.h"
diff --git a/src/serial.c b/src/serial.c
index 5432056..19fb850 100644
--- a/src/serial.c
+++ b/src/serial.c
@@ -20,8 +20,8 @@
* MA 02111-1307 USA
*/
+#include <qi.h>
#include "blink_led.h"
-#include "kboot.h"
void serial_init (const int uart)
{
diff --git a/src/start_kboot.c b/src/start_kboot.c
index 683b2f7..8b5078c 100644
--- a/src/start_kboot.c
+++ b/src/start_kboot.c
@@ -24,9 +24,9 @@
/* NOTE this stuff runs in steppingstone context! */
+#include <qi.h>
#include "blink_led.h"
#include "nand_read.h"
-#include "kboot.h"
#include <neo_gta02.h>
#define stringify2(s) stringify1(s)
diff --git a/src/utils.c b/src/utils.c
index c9506c2..55fc3f1 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -20,7 +20,7 @@
* MA 02111-1307 USA
*/
-#include "kboot.h"
+#include <qi.h>
#include <string.h>
#define DEBUG_CONSOLE_UART UART2
More information about the openmoko-kernel
mailing list