aboutsummaryrefslogtreecommitdiff
path: root/semihosting.h
blob: 40817c27cc887e3d0731a252c89255959ed6a4d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Copyright (c) 2012 Linaro Limited
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 * 3. Neither the name of Linaro Limited nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 */

#ifndef SEMIHOSTING_H
#define SEMIHOSTING_H

#define SYS_OPEN	1
#define OPEN_RDONLY	1
#define SYS_CLOSE	2
#define SYS_WRITE0	4
#define SYS_READ	6
#define SYS_FLEN	0x0C
#define SYS_GET_CMDLINE	0x15
#define SYS_REPORTEXC	0x18
#define REPORTEXC_REASON_APP_EXIT 0x20026
#define SEMIHOSTING_SVC	0x123456	/* SVC comment field for semihosting */

#ifndef __ASSEMBLER__

int __semi_call(int id, ...);
int semi_open(char const *filename, int mode);
int semi_close(int fd);
int semi_write0(char const *string);
int semi_read(int fd, char *buffer, int length);
int semi_flen(int fd);
int semi_get_cmdline(char *buffer, int size, int *length);
int semi_reportexc(int reason);
void semi_fatal(char const *message);
void semi_exit(void);
/* semi_load_file: *dest is advanced to point to the end of the loaded data */
int semi_load_file(void **dest, unsigned *size, char const *filename);

#endif /* ! __ASSEMBLER__ */

#endif /* ! SEMIHOSTING_H */