]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/SemihostLib/SemihostPrivate.h
ARM Packages: Removed trailing spaces
[mirror_edk2.git] / ArmPkg / Library / SemihostLib / SemihostPrivate.h
CommitLineData
1e57a462 1/** @file\r
2\r
3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
228fdff4 4 Copyright (c) 2013 - 2014, ARM Ltd. All rights reserved.<BR>\r
1e57a462 5\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef __SEMIHOST_PRIVATE_H__\r
17#define __SEMIHOST_PRIVATE_H__\r
18\r
19typedef struct {\r
20 CHAR8 *FileName;\r
228fdff4
HL
21 UINTN Mode;\r
22 UINTN NameLength;\r
1e57a462 23} SEMIHOST_FILE_OPEN_BLOCK;\r
24\r
25typedef struct {\r
228fdff4 26 UINTN Handle;\r
1e57a462 27 VOID *Buffer;\r
228fdff4 28 UINTN Length;\r
1e57a462 29} SEMIHOST_FILE_READ_WRITE_BLOCK;\r
30\r
31typedef struct {\r
228fdff4
HL
32 UINTN Handle;\r
33 UINTN Location;\r
1e57a462 34} SEMIHOST_FILE_SEEK_BLOCK;\r
35\r
36typedef struct {\r
37 CHAR8 *FileName;\r
228fdff4 38 UINTN NameLength;\r
1e57a462 39} SEMIHOST_FILE_REMOVE_BLOCK;\r
40\r
41typedef struct {\r
42 CHAR8 *CommandLine;\r
228fdff4 43 UINTN CommandLength;\r
1e57a462 44} SEMIHOST_SYSTEM_BLOCK;\r
45\r
3402aac7 46#if defined(__CC_ARM)\r
1e57a462 47\r
48#if defined(__thumb__)\r
49#define SWI 0xAB\r
50#else\r
51#define SWI 0x123456\r
52#endif\r
53\r
54#define SEMIHOST_SUPPORTED TRUE\r
55\r
56__swi(SWI)\r
57INT32\r
58_Semihost_SYS_OPEN(\r
59 IN UINTN SWI_0x01,\r
60 IN SEMIHOST_FILE_OPEN_BLOCK *OpenBlock\r
61 );\r
62\r
63__swi(SWI)\r
64INT32\r
65_Semihost_SYS_CLOSE(\r
66 IN UINTN SWI_0x02,\r
67 IN UINT32 *Handle\r
68 );\r
69\r
70__swi(SWI)\r
71VOID\r
72_Semihost_SYS_WRITEC(\r
73 IN UINTN SWI_0x03,\r
74 IN CHAR8 *Character\r
75 );\r
76\r
77__swi(SWI)\r
78VOID\r
79_Semihost_SYS_WRITE0(\r
80 IN UINTN SWI_0x04,\r
81 IN CHAR8 *String\r
82 );\r
83\r
84__swi(SWI)\r
85UINT32\r
86_Semihost_SYS_WRITE(\r
87 IN UINTN SWI_0x05,\r
88 IN OUT SEMIHOST_FILE_READ_WRITE_BLOCK *WriteBlock\r
89 );\r
90\r
91__swi(SWI)\r
92UINT32\r
93_Semihost_SYS_READ(\r
94 IN UINTN SWI_0x06,\r
95 IN OUT SEMIHOST_FILE_READ_WRITE_BLOCK *ReadBlock\r
96 );\r
97\r
98__swi(SWI)\r
99CHAR8\r
100_Semihost_SYS_READC(\r
101 IN UINTN SWI_0x07,\r
102 IN UINTN Zero\r
103 );\r
104\r
105__swi(SWI)\r
106INT32\r
107_Semihost_SYS_SEEK(\r
108 IN UINTN SWI_0x0A,\r
109 IN SEMIHOST_FILE_SEEK_BLOCK *SeekBlock\r
110 );\r
111\r
112__swi(SWI)\r
113INT32\r
114_Semihost_SYS_FLEN(\r
115 IN UINTN SWI_0x0C,\r
116 IN UINT32 *Handle\r
117 );\r
118\r
119__swi(SWI)\r
120UINT32\r
121_Semihost_SYS_REMOVE(\r
122 IN UINTN SWI_0x0E,\r
123 IN SEMIHOST_FILE_REMOVE_BLOCK *RemoveBlock\r
124 );\r
125\r
126__swi(SWI)\r
127UINT32\r
128_Semihost_SYS_SYSTEM(\r
129 IN UINTN SWI_0x12,\r
130 IN SEMIHOST_SYSTEM_BLOCK *SystemBlock\r
131 );\r
132\r
133#define Semihost_SYS_OPEN(OpenBlock) _Semihost_SYS_OPEN(0x01, OpenBlock)\r
134#define Semihost_SYS_CLOSE(Handle) _Semihost_SYS_CLOSE(0x02, Handle)\r
135#define Semihost_SYS_WRITE0(String) _Semihost_SYS_WRITE0(0x04, String)\r
136#define Semihost_SYS_WRITEC(Character) _Semihost_SYS_WRITEC(0x03, Character)\r
137#define Semihost_SYS_WRITE(WriteBlock) _Semihost_SYS_WRITE(0x05, WriteBlock)\r
138#define Semihost_SYS_READ(ReadBlock) _Semihost_SYS_READ(0x06, ReadBlock)\r
139#define Semihost_SYS_READC() _Semihost_SYS_READC(0x07, 0)\r
140#define Semihost_SYS_SEEK(SeekBlock) _Semihost_SYS_SEEK(0x0A, SeekBlock)\r
141#define Semihost_SYS_FLEN(Handle) _Semihost_SYS_FLEN(0x0C, Handle)\r
142#define Semihost_SYS_REMOVE(RemoveBlock) _Semihost_SYS_REMOVE(0x0E, RemoveBlock)\r
143#define Semihost_SYS_SYSTEM(SystemBlock) _Semihost_SYS_SYSTEM(0x12, SystemBlock)\r
144\r
145#elif defined(__GNUC__) // __CC_ARM\r
146\r
147#define SEMIHOST_SUPPORTED TRUE\r
148\r
149UINT32\r
150GccSemihostCall (\r
151 IN UINT32 Operation,\r
152 IN UINTN SystemBlockAddress\r
153 ); // __attribute__ ((interrupt ("SVC")));\r
154\r
155#define Semihost_SYS_OPEN(OpenBlock) GccSemihostCall(0x01, (UINTN)(OpenBlock))\r
156#define Semihost_SYS_CLOSE(Handle) GccSemihostCall(0x02, (UINTN)(Handle))\r
157#define Semihost_SYS_WRITE0(String) GccSemihostCall(0x04, (UINTN)(String))\r
158#define Semihost_SYS_WRITEC(Character) GccSemihostCall(0x03, (UINTN)(Character))\r
159#define Semihost_SYS_WRITE(WriteBlock) GccSemihostCall(0x05, (UINTN)(WriteBlock))\r
160#define Semihost_SYS_READ(ReadBlock) GccSemihostCall(0x06, (UINTN)(ReadBlock))\r
161#define Semihost_SYS_READC() GccSemihostCall(0x07, (UINTN)(0))\r
162#define Semihost_SYS_SEEK(SeekBlock) GccSemihostCall(0x0A, (UINTN)(SeekBlock))\r
163#define Semihost_SYS_FLEN(Handle) GccSemihostCall(0x0C, (UINTN)(Handle))\r
164#define Semihost_SYS_REMOVE(RemoveBlock) GccSemihostCall(0x0E, (UINTN)(RemoveBlock))\r
165#define Semihost_SYS_SYSTEM(SystemBlock) GccSemihostCall(0x12, (UINTN)(SystemBlock))\r
166\r
167#else // __CC_ARM\r
168\r
169#define SEMIHOST_SUPPORTED FALSE\r
170\r
171#define Semihost_SYS_OPEN(OpenBlock) (-1)\r
172#define Semihost_SYS_CLOSE(Handle) (-1)\r
173#define Semihost_SYS_WRITE0(String)\r
174#define Semihost_SYS_WRITEC(Character)\r
175#define Semihost_SYS_WRITE(WriteBlock) (0)\r
176#define Semihost_SYS_READ(ReadBlock) ((ReadBlock)->Length)\r
177#define Semihost_SYS_READC() ('x')\r
178#define Semihost_SYS_SEEK(SeekBlock) (-1)\r
179#define Semihost_SYS_FLEN(Handle) (-1)\r
180#define Semihost_SYS_REMOVE(RemoveBlock) (-1)\r
181#define Semihost_SYS_SYSTEM(SystemBlock) (-1)\r
182\r
183#endif // __CC_ARM\r
184\r
185#endif //__SEMIHOST_PRIVATE_H__\r