2008-08-13 02:45:55 +03:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2008 Openmoko, Inc.
|
|
|
|
* Author: Andy Green <andy@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
|
|
|
|
*/
|
2008-08-13 02:36:46 +03:00
|
|
|
|
2008-11-28 12:16:35 +02:00
|
|
|
#ifndef __QI_H__
|
|
|
|
#define __QI_H__
|
2008-08-13 02:36:46 +03:00
|
|
|
|
|
|
|
#include <stdarg.h>
|
2008-11-28 12:16:35 +02:00
|
|
|
#include <qi-ctype.h>
|
2008-11-28 12:16:37 +02:00
|
|
|
#include <asm/byteorder.h>
|
|
|
|
|
2008-11-28 12:16:42 +02:00
|
|
|
#define MALLOC_POOL_EXTENT (100 * 1024)
|
2008-11-28 12:16:35 +02:00
|
|
|
|
|
|
|
#define u32 unsigned int
|
|
|
|
#define u16 unsigned short
|
|
|
|
#define u8 unsigned char
|
|
|
|
typedef unsigned int uint32_t;
|
2008-11-28 12:16:37 +02:00
|
|
|
typedef unsigned short uint16_t;
|
|
|
|
typedef unsigned char uint8_t;
|
2008-08-13 02:36:46 +03:00
|
|
|
|
2008-11-28 12:16:36 +02:00
|
|
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
|
|
|
|
2008-11-28 12:16:36 +02:00
|
|
|
enum filesystem {
|
|
|
|
FS_RAW,
|
|
|
|
FS_FAT,
|
|
|
|
FS_EXT2
|
|
|
|
};
|
|
|
|
|
2008-12-01 03:26:03 +02:00
|
|
|
enum ui_actions {
|
|
|
|
UI_ACTION_ADD_DEBUG = (1 << 0),
|
|
|
|
UI_ACTION_SKIPKERNEL = (1 << 1),
|
|
|
|
};
|
|
|
|
|
2008-11-28 12:16:36 +02:00
|
|
|
/* describes a source for getting kernel image */
|
|
|
|
|
|
|
|
struct kernel_source {
|
|
|
|
const char *name; /* NULL name means invalid */
|
2008-11-28 12:16:37 +02:00
|
|
|
const char *filepath;
|
2008-11-28 12:16:41 +02:00
|
|
|
const char *initramfs_filepath;
|
2008-11-28 12:16:36 +02:00
|
|
|
int (*block_init)(void);
|
2008-11-28 12:16:37 +02:00
|
|
|
int (*block_read)(unsigned char * buf, unsigned long start512,
|
|
|
|
int blocks512);
|
2008-11-28 12:16:36 +02:00
|
|
|
int partition_index; /* -1 means no partition table */
|
2008-11-28 12:16:37 +02:00
|
|
|
int offset_blocks512_if_no_partition; /* used if partition_index is -1 */
|
2008-11-28 12:16:36 +02:00
|
|
|
enum filesystem filesystem;
|
2008-11-28 12:16:45 +02:00
|
|
|
const char * commandline_append;
|
2008-11-28 12:16:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* describes a board variant, eg, PCB revision */
|
|
|
|
|
|
|
|
struct board_variant {
|
|
|
|
const char * name;
|
|
|
|
int machine_revision; /* passed in revision tag to linux */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* describes a "board", ie, a device like GTA02 including revisions */
|
|
|
|
|
|
|
|
struct board_api {
|
|
|
|
const char * name;
|
|
|
|
int linux_machine_id;
|
|
|
|
unsigned long linux_mem_start;
|
|
|
|
unsigned long linux_mem_size;
|
|
|
|
unsigned long linux_tag_placement;
|
2008-11-28 12:16:45 +02:00
|
|
|
const char *commandline_board;
|
|
|
|
const char *commandline_board_debug;
|
2008-11-28 12:16:45 +02:00
|
|
|
const char *noboot;
|
|
|
|
const char *append;
|
2008-12-01 03:26:03 +02:00
|
|
|
|
2008-11-28 12:16:36 +02:00
|
|
|
const struct board_variant const * (*get_board_variant)(void);
|
|
|
|
int (*is_this_board)(void);
|
2008-11-28 12:16:42 +02:00
|
|
|
void (*early_port_init)(void);
|
2008-11-28 12:16:36 +02:00
|
|
|
void (*port_init)(void);
|
2008-11-28 12:16:36 +02:00
|
|
|
void (*putc)(char);
|
2008-11-28 12:16:39 +02:00
|
|
|
void (*close)(void);
|
2008-12-01 03:26:03 +02:00
|
|
|
u8 (*get_ui_keys)(void);
|
2008-11-28 12:16:40 +02:00
|
|
|
|
2008-12-01 03:26:03 +02:00
|
|
|
struct kernel_source kernel_source[8];
|
2008-11-28 12:16:40 +02:00
|
|
|
};
|
|
|
|
|
2008-11-28 12:16:36 +02:00
|
|
|
/* this is the board we are running on */
|
|
|
|
|
|
|
|
extern struct board_api const * this_board;
|
2008-11-28 12:16:37 +02:00
|
|
|
extern struct kernel_source const * this_kernel;
|
2008-11-28 12:16:36 +02:00
|
|
|
|
2008-08-13 02:36:46 +03:00
|
|
|
int printk(const char *fmt, ...);
|
|
|
|
int vsprintf(char *buf, const char *fmt, va_list args);
|
2008-08-13 02:40:01 +03:00
|
|
|
int puts(const char *string);
|
|
|
|
void printhex(unsigned char v);
|
2008-11-28 12:16:37 +02:00
|
|
|
void print8(unsigned char u);
|
2008-08-13 02:40:01 +03:00
|
|
|
void print32(unsigned int u);
|
2008-11-28 12:16:37 +02:00
|
|
|
void printdec(int n);
|
2008-08-13 02:44:29 +03:00
|
|
|
void hexdump(unsigned char *start, int len);
|
2008-11-28 12:16:40 +02:00
|
|
|
void udelay(int n);
|
|
|
|
|
2008-11-28 12:16:37 +02:00
|
|
|
|
2008-11-28 12:16:36 +02:00
|
|
|
unsigned long crc32(unsigned long crc, const unsigned char *buf,
|
|
|
|
unsigned int len);
|
2008-11-28 12:16:37 +02:00
|
|
|
int nand_read_ll(unsigned char *buf, unsigned long start512, int blocks512);
|
2008-08-13 02:36:46 +03:00
|
|
|
|
2008-11-28 12:16:41 +02:00
|
|
|
extern void memory_test(void * start, unsigned int length);
|
|
|
|
|
2008-11-28 12:16:41 +02:00
|
|
|
void set_putc_func(void (*p)(char));
|
|
|
|
|
2008-08-13 02:36:46 +03:00
|
|
|
#endif
|
|
|
|
|