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