2 * hl_api.h -- provide high-level API for Hostlink IO.
4 * Copyright (c) 2024 Synopsys Inc.
6 * The authors hereby grant permission to use, copy, modify, distribute,
7 * and license this software and its documentation for any purpose, provided
8 * that existing copyright notices are retained in all copies and that this
9 * notice is included verbatim in any distributions. No written agreement,
10 * license, or royalty fee is required for any of the authorized uses.
11 * Modifications to this software may be copyrighted by their authors
12 * and need not follow the licensing terms described here, provided that
13 * the new terms are clearly indicated on the first page of each file where
19 #include "hl_toolchain.h"
24 #define HL_SYSCALL_OPEN 0
25 #define HL_SYSCALL_CLOSE 1
26 #define HL_SYSCALL_READ 2
27 #define HL_SYSCALL_WRITE 3
28 #define HL_SYSCALL_LSEEK 4
29 #define HL_SYSCALL_UNLINK 5
30 #define HL_SYSCALL_ISATTY 6
31 #define HL_SYSCALL_TMPNAM 7
32 #define HL_SYSCALL_GETENV 8
33 #define HL_SYSCALL_CLOCK 9
34 #define HL_SYSCALL_TIME 10
35 #define HL_SYSCALL_RENAME 11
36 #define HL_SYSCALL_ARGC 12
37 #define HL_SYSCALL_ARGV 13
38 #define HL_SYSCALL_RETCODE 14
39 #define HL_SYSCALL_ACCESS 15
40 #define HL_SYSCALL_GETPID 16
41 #define HL_SYSCALL_GETCWD 17
42 #define HL_SYSCALL_USER 18
44 #define HL_GNUIO_EXT_VENDOR_ID 1025
46 #define HL_GNUIO_EXT_FSTAT 1
49 * Main functions to work with regular syscalls and user-defined hostlink
52 volatile __uncached
char *_hl_message (uint32_t syscall
,
53 const char *format
, ...);
54 uint32_t _user_hostlink (uint32_t vendor
, uint32_t opcode
,
55 const char *format
, ...);
58 /* Fuctions for direct work with the Hostlink buffer. */
59 volatile __uncached
char *_hl_pack_int (volatile __uncached
char *p
,
61 volatile __uncached
char *_hl_pack_ptr (volatile __uncached
char *p
,
62 const void *s
, uint16_t len
);
63 volatile __uncached
char *_hl_pack_str (volatile __uncached
char *p
,
65 volatile __uncached
char *_hl_unpack_int (volatile __uncached
char *p
,
67 volatile __uncached
char *_hl_unpack_ptr (volatile __uncached
char *p
,
68 void *s
, uint32_t *plen
);
69 volatile __uncached
char *_hl_unpack_str (volatile __uncached
char *p
,
71 uint32_t _hl_get_ptr_len (volatile __uncached
char *p
);
73 /* Low-level functions from hl_gw. */
74 extern uint32_t _hl_iochunk_size (void);
75 extern void _hl_delete (void);
77 #endif /* !_HL_API_H */