semihosting.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (c) 2013-2014, Arm Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef SEMIHOSTING_H
  7. #define SEMIHOSTING_H
  8. #include <stdint.h>
  9. #include <stdio.h> /* For ssize_t */
  10. #define SEMIHOSTING_SYS_OPEN 0x01
  11. #define SEMIHOSTING_SYS_CLOSE 0x02
  12. #define SEMIHOSTING_SYS_WRITE0 0x04
  13. #define SEMIHOSTING_SYS_WRITEC 0x03
  14. #define SEMIHOSTING_SYS_WRITE 0x05
  15. #define SEMIHOSTING_SYS_READ 0x06
  16. #define SEMIHOSTING_SYS_READC 0x07
  17. #define SEMIHOSTING_SYS_SEEK 0x0A
  18. #define SEMIHOSTING_SYS_FLEN 0x0C
  19. #define SEMIHOSTING_SYS_REMOVE 0x0E
  20. #define SEMIHOSTING_SYS_SYSTEM 0x12
  21. #define SEMIHOSTING_SYS_ERRNO 0x13
  22. #define SEMIHOSTING_SYS_EXIT 0x18
  23. #define FOPEN_MODE_R 0x0
  24. #define FOPEN_MODE_RB 0x1
  25. #define FOPEN_MODE_RPLUS 0x2
  26. #define FOPEN_MODE_RPLUSB 0x3
  27. #define FOPEN_MODE_W 0x4
  28. #define FOPEN_MODE_WB 0x5
  29. #define FOPEN_MODE_WPLUS 0x6
  30. #define FOPEN_MODE_WPLUSB 0x7
  31. #define FOPEN_MODE_A 0x8
  32. #define FOPEN_MODE_AB 0x9
  33. #define FOPEN_MODE_APLUS 0xa
  34. #define FOPEN_MODE_APLUSB 0xb
  35. long semihosting_connection_supported(void);
  36. long semihosting_file_open(const char *file_name, size_t mode);
  37. long semihosting_file_seek(long file_handle, ssize_t offset);
  38. long semihosting_file_read(long file_handle, size_t *length, uintptr_t buffer);
  39. long semihosting_file_write(long file_handle,
  40. size_t *length,
  41. const uintptr_t buffer);
  42. long semihosting_file_close(long file_handle);
  43. long semihosting_file_length(long file_handle);
  44. long semihosting_system(char *command_line);
  45. long semihosting_get_flen(const char *file_name);
  46. long semihosting_download_file(const char *file_name,
  47. size_t buf_size,
  48. uintptr_t buf);
  49. void semihosting_write_char(char character);
  50. void semihosting_write_string(char *string);
  51. char semihosting_read_char(void);
  52. void semihosting_exit(uint32_t reason, uint32_t subcode);
  53. #endif /* SEMIHOSTING_H */