- Timestamp:
- Apr 5, 2019, 9:26:53 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/platform/mbed_semihost_api.c
r352 r374 45 45 46 46 #if DEVICE_LOCALFILESYSTEM 47 FILEHANDLE semihost_open(const char* name, int openmode) { 47 FILEHANDLE semihost_open(const char* name, int openmode) 48 { 48 49 uint32_t args[3]; 49 50 args[0] = (uint32_t)name; … … 53 54 } 54 55 55 int semihost_close(FILEHANDLE fh) { 56 int semihost_close(FILEHANDLE fh) 57 { 56 58 return __semihost(SYS_CLOSE, &fh); 57 59 } 58 60 59 int semihost_write(FILEHANDLE fh, const unsigned char* buffer, unsigned int length, int mode) { 60 if (length == 0) return 0; 61 int semihost_write(FILEHANDLE fh, const unsigned char* buffer, unsigned int length, int mode) 62 { 63 if (length == 0) { 64 return 0; 65 } 61 66 62 67 uint32_t args[3]; … … 67 72 } 68 73 69 int semihost_read(FILEHANDLE fh, unsigned char* buffer, unsigned int length, int mode) { 74 int semihost_read(FILEHANDLE fh, unsigned char *buffer, unsigned int length, int mode) 75 { 70 76 uint32_t args[3]; 71 77 args[0] = (uint32_t)fh; … … 75 81 } 76 82 77 int semihost_istty(FILEHANDLE fh) { 83 int semihost_istty(FILEHANDLE fh) 84 { 78 85 return __semihost(SYS_ISTTY, &fh); 79 86 } 80 87 81 int semihost_seek(FILEHANDLE fh, long position) { 88 int semihost_seek(FILEHANDLE fh, long position) 89 { 82 90 uint32_t args[2]; 83 91 args[0] = (uint32_t)fh; … … 86 94 } 87 95 88 int semihost_ensure(FILEHANDLE fh) { 96 int semihost_ensure(FILEHANDLE fh) 97 { 89 98 return __semihost(SYS_ENSURE, &fh); 90 99 } 91 100 92 long semihost_flen(FILEHANDLE fh) { 101 long semihost_flen(FILEHANDLE fh) 102 { 93 103 return __semihost(SYS_FLEN, &fh); 94 104 } 95 105 96 int semihost_remove(const char *name) { 106 int semihost_remove(const char *name) 107 { 97 108 uint32_t args[2]; 98 109 args[0] = (uint32_t)name; … … 101 112 } 102 113 103 int semihost_rename(const char *old_name, const char *new_name) { 114 int semihost_rename(const char *old_name, const char *new_name) 115 { 104 116 uint32_t args[4]; 105 117 args[0] = (uint32_t)old_name; … … 111 123 #endif 112 124 113 int semihost_exit(void) { 125 int semihost_exit(void) 126 { 114 127 uint32_t args[4]; 115 128 return __semihost(SYS_EXIT, args); 116 129 } 117 130 118 int semihost_uid(char *uid) { 131 int semihost_uid(char *uid) 132 { 119 133 uint32_t args[2]; 120 134 args[0] = (uint32_t)uid; … … 123 137 } 124 138 125 int semihost_reset(void) { 139 int semihost_reset(void) 140 { 126 141 // Does not normally return, however if used with older firmware versions 127 142 // that do not support this call it will return -1. … … 129 144 } 130 145 131 int semihost_vbus(void) { 146 int semihost_vbus(void) 147 { 132 148 return __semihost(USR_VBUS, NULL); 133 149 } 134 150 135 int semihost_powerdown(void) { 151 int semihost_powerdown(void) 152 { 136 153 return __semihost(USR_POWERDOWN, NULL); 137 154 } … … 139 156 #if DEVICE_DEBUG_AWARENESS 140 157 141 int semihost_connected(void) { 158 int semihost_connected(void) 159 { 142 160 return (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) ? 1 : 0; 143 161 } … … 147 165 static int is_debugger_attached = 1; 148 166 149 int semihost_connected(void) { 167 int semihost_connected(void) 168 { 150 169 return is_debugger_attached; 151 170 } 152 171 #endif 153 172 154 int semihost_disabledebug(void) { 173 int semihost_disabledebug(void) 174 { 155 175 uint32_t args[1]; 156 176 #if !(DEVICE_DEBUG_AWARENESS)
Note:
See TracChangeset
for help on using the changeset viewer.