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