1
2
3
4
5
6
7
8#ifndef _API_PUBLIC_H_
9#define _API_PUBLIC_H_
10
11#define API_EINVAL 1
12#define API_ENODEV 2
13#define API_ENOMEM 3
14#define API_EBUSY 4
15#define API_EIO 5
16#define API_ESYSC 6
17
18typedef int (*scp_t)(int, int *, ...);
19
20#define API_SIG_VERSION 1
21#define API_SIG_MAGIC "UBootAPI"
22#define API_SIG_MAGLEN 8
23
24struct api_signature {
25 char magic[API_SIG_MAGLEN];
26 uint16_t version;
27 uint32_t checksum;
28 scp_t syscall;
29};
30
31enum {
32 API_RSVD = 0,
33 API_GETC,
34 API_PUTC,
35 API_TSTC,
36 API_PUTS,
37 API_RESET,
38 API_GET_SYS_INFO,
39 API_UDELAY,
40 API_GET_TIMER,
41 API_DEV_ENUM,
42 API_DEV_OPEN,
43 API_DEV_CLOSE,
44 API_DEV_READ,
45 API_DEV_WRITE,
46 API_ENV_ENUM,
47 API_ENV_GET,
48 API_ENV_SET,
49 API_DISPLAY_GET_INFO,
50 API_DISPLAY_DRAW_BITMAP,
51 API_DISPLAY_CLEAR,
52 API_MAXCALL
53};
54
55#define MR_ATTR_FLASH 0x0001
56#define MR_ATTR_DRAM 0x0002
57#define MR_ATTR_SRAM 0x0003
58
59struct mem_region {
60 unsigned long start;
61 unsigned long size;
62 int flags;
63};
64
65struct sys_info {
66 unsigned long clk_bus;
67 unsigned long clk_cpu;
68 unsigned long bar;
69 struct mem_region *mr;
70 int mr_no;
71};
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90typedef unsigned long lbasize_t;
91
92typedef unsigned long lbastart_t;
93
94#define DEV_TYP_NONE 0x0000
95#define DEV_TYP_NET 0x0001
96
97#define DEV_TYP_STOR 0x0002
98#define DT_STOR_IDE 0x0010
99#define DT_STOR_SCSI 0x0020
100#define DT_STOR_USB 0x0040
101#define DT_STOR_MMC 0x0080
102#define DT_STOR_SATA 0x0100
103
104#define DEV_STA_CLOSED 0x0000
105#define DEV_STA_OPEN 0x0001
106
107struct device_info {
108 int type;
109 void *cookie;
110
111 union {
112 struct {
113 lbasize_t block_count;
114 unsigned long block_size;
115 } storage;
116
117 struct {
118 unsigned char hwaddr[6];
119 } net;
120 } info;
121#define di_stor info.storage
122#define di_net info.net
123
124 int state;
125};
126
127#define DISPLAY_TYPE_LCD 0x0001
128#define DISPLAY_TYPE_VIDEO 0x0002
129
130struct display_info {
131 int type;
132
133 int pixel_width;
134 int pixel_height;
135
136 int screen_rows;
137 int screen_cols;
138};
139
140#endif
141