]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Include/Library/SemihostLib.h
ArmPkg: Fix Ecc error 8003
[mirror_edk2.git] / ArmPkg / Include / Library / SemihostLib.h
CommitLineData
1e57a462 1/** @file\r
2\r
3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
c63626b7 4 Portions copyright (c) 2011, 2012, ARM Ltd. All rights reserved.<BR>\r
1e57a462 5\r
4059386c 6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
1e57a462 7\r
8**/\r
9\r
cc15a619
PG
10#ifndef SEMIHOSTING_LIB_H_\r
11#define SEMIHOSTING_LIB_H_\r
1e57a462 12\r
13/*\r
14 *\r
15 * Please refer to ARM RVDS 3.0 Compiler and Libraries Guide for more information\r
16 * about the semihosting interface.\r
17 *\r
18 */\r
3402aac7 19\r
1e57a462 20#define SEMIHOST_FILE_MODE_READ (0 << 2)\r
21#define SEMIHOST_FILE_MODE_WRITE (1 << 2)\r
22#define SEMIHOST_FILE_MODE_APPEND (2 << 2)\r
c20f8ec6 23#define SEMIHOST_FILE_MODE_UPDATE (1 << 1)\r
1e57a462 24#define SEMIHOST_FILE_MODE_BINARY (1 << 0)\r
25#define SEMIHOST_FILE_MODE_ASCII (0 << 0)\r
26\r
27BOOLEAN\r
28SemihostConnectionSupported (\r
29 VOID\r
30 );\r
31\r
32RETURN_STATUS\r
33SemihostFileOpen (\r
34 IN CHAR8 *FileName,\r
35 IN UINT32 Mode,\r
c63626b7 36 OUT UINTN *FileHandle\r
1e57a462 37 );\r
38\r
39RETURN_STATUS\r
40SemihostFileSeek (\r
c63626b7 41 IN UINTN FileHandle,\r
42 IN UINTN Offset\r
1e57a462 43 );\r
44\r
45RETURN_STATUS\r
46SemihostFileRead (\r
c63626b7 47 IN UINTN FileHandle,\r
48 IN OUT UINTN *Length,\r
1e57a462 49 OUT VOID *Buffer\r
50 );\r
51\r
52RETURN_STATUS\r
53SemihostFileWrite (\r
c63626b7 54 IN UINTN FileHandle,\r
55 IN OUT UINTN *Length,\r
1e57a462 56 IN VOID *Buffer\r
57 );\r
58\r
59RETURN_STATUS\r
60SemihostFileClose (\r
c63626b7 61 IN UINTN FileHandle\r
1e57a462 62 );\r
63\r
64RETURN_STATUS\r
65SemihostFileLength (\r
c63626b7 66 IN UINTN FileHandle,\r
67 OUT UINTN *Length\r
1e57a462 68 );\r
69\r
5521b5cc
RC
70/**\r
71 Get a temporary name for a file from the host running the debug agent.\r
72\r
73 @param[out] Buffer Pointer to the buffer where the temporary name has to\r
74 be stored\r
75 @param[in] Identifier File name identifier (integer in the range 0 to 255)\r
76 @param[in] Length Length of the buffer to store the temporary name\r
77\r
78 @retval RETURN_SUCCESS Temporary name returned\r
79 @retval RETURN_INVALID_PARAMETER Invalid buffer address\r
80 @retval RETURN_ABORTED Temporary name not returned\r
81\r
82**/\r
83RETURN_STATUS\r
84SemihostFileTmpName(\r
85 OUT VOID *Buffer,\r
86 IN UINT8 Identifier,\r
87 IN UINTN Length\r
88 );\r
89\r
1e57a462 90RETURN_STATUS\r
91SemihostFileRemove (\r
92 IN CHAR8 *FileName\r
93 );\r
94\r
5521b5cc
RC
95/**\r
96 Rename a specified file.\r
97\r
98 @param[in] FileName Name of the file to rename.\r
99 @param[in] NewFileName The new name of the file.\r
100\r
101 @retval RETURN_SUCCESS File Renamed\r
102 @retval RETURN_INVALID_PARAMETER Either the current or the new name is not specified\r
103 @retval RETURN_ABORTED Rename failed\r
104\r
105**/\r
106RETURN_STATUS\r
107SemihostFileRename(\r
108 IN CHAR8 *FileName,\r
109 IN CHAR8 *NewFileName\r
110 );\r
111\r
1e57a462 112CHAR8\r
113SemihostReadCharacter (\r
114 VOID\r
115 );\r
116\r
117VOID\r
118SemihostWriteCharacter (\r
119 IN CHAR8 Character\r
120 );\r
121\r
122VOID\r
123SemihostWriteString (\r
124 IN CHAR8 *String\r
125 );\r
3402aac7 126\r
1e57a462 127UINT32\r
128SemihostSystem (\r
129 IN CHAR8 *CommandLine\r
130 );\r
3402aac7 131\r
cc15a619 132#endif // SEMIHOSTING_LIB_H_\r