Changeset 279 for EcnlProtoTool/trunk/ntshell/fatfs
- Timestamp:
- Apr 29, 2017, 4:33:37 PM (7 years ago)
- Location:
- EcnlProtoTool/trunk/ntshell/fatfs
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/ntshell/fatfs/ccsbcs.c
r278 r279 266 266 267 267 268 #if !_TBLDEF || !_USE_LFN268 #if _CODE_PAGE != 65001 && (!_TBLDEF || !_USE_LFN) 269 269 #error This file is not needed at current configuration. Remove from the project. 270 270 #endif … … 272 272 273 273 274 274 #if _CODE_PAGE != 65001 275 275 WCHAR ff_convert ( /* Converted character, Returns zero on error */ 276 276 WCHAR chr, /* Character code to be converted */ … … 298 298 return c; 299 299 } 300 300 #endif 301 301 302 302 -
EcnlProtoTool/trunk/ntshell/fatfs/diskio.c
r278 r279 15 15 #define MAX_DRIVES 1 /* Max number of physical drives to be used */ 16 16 17 unsigned char RamDisk[SZ_RAMDISK * 1024]; 17 #define RamDisk _binary____webserver_httpd_fs_bin_start 18 extern unsigned char RamDisk[]; 18 19 19 20 typedef struct { -
EcnlProtoTool/trunk/ntshell/fatfs/ff.c
r278 r279 314 314 #endif 315 315 #define _DF1S 0 316 317 #elif _CODE_PAGE == 65001 /* UTF-8 */ 318 #if _LFN_UNICODE 319 #error Cannot use LFN_UNICODE feature without valid code page. 320 #endif 321 #define _DF1S 0 322 323 void Utf16_to_Utf8(unsigned char *ret_code, int *ret_size, UINT chr) 324 { 325 ret_code[0] = ret_code[1] = ret_code[2] = ret_code[3] = 0; 326 327 if (chr <= 0x7f) { // ASCIIäºæ 328 ret_code[0] = chr; 329 *ret_size = 1; 330 return; 331 } 332 333 if (chr <= 0x7ff) { 334 ret_code[1] = (0x80 | (chr & 0x3f)); 335 ret_code[0] = (0xc0 | (chr >> 6)); 336 *ret_size = 2; 337 return; 338 } 339 340 if (chr <= 0xffff) { 341 ret_code[2] = (0x80 | (chr & 0x3f)); 342 ret_code[1] = (0x80 | ((chr >> 6) & 0x3f)); 343 ret_code[0] = (0xe0 | ((chr >> 12) & 0x0f)); 344 *ret_size = 3; 345 return; 346 } 347 348 if (chr <= 0x1fffff) { 349 ret_code[3] = (0x80 | (chr & 0x3f)); 350 ret_code[2] = (0x80 | ((chr >> 6) & 0x3f)); 351 ret_code[1] = (0x80 | ((chr >> 12) & 0x3f)); 352 ret_code[0] = (0xf0 | ((chr >> 18) & 0x07)); 353 *ret_size = 4; 354 return; 355 } 356 357 if (chr <= 0x3ffffff) { 358 ret_code[4] = (0x80 | (chr & 0x3f)); 359 ret_code[3] = (0x80 | ((chr >> 6) & 0x3f)); 360 ret_code[2] = (0x80 | ((chr >> 12) & 0x3f)); 361 ret_code[1] = (0x80 | ((chr >> 18) & 0x3f)); 362 ret_code[0] = (0xf8 | ((chr >> 24) & 0x03)); 363 *ret_size = 5; 364 return; 365 } 366 367 ret_code[5] = (0x80 | (chr & 0x3f)); 368 ret_code[4] = (0x80 | ((chr >> 6) & 0x3f)); 369 ret_code[3] = (0x80 | ((chr >> 12) & 0x3f)); 370 ret_code[2] = (0x80 | ((chr >> 18) & 0x3f)); 371 ret_code[1] = (0x80 | ((chr >> 24) & 0x3f)); 372 ret_code[0] = (0xfc | ((chr >> 30) & 0x01)); 373 *ret_size = 6; 374 return; 375 } 376 377 //2ãã¤ãã®UTF-16ã³ã¼ããå¾ããã 378 WCHAR Utf8_to_Utf16(const char *src, int *code_size) 379 { 380 int i; 381 unsigned int uc = 0; 382 unsigned char len = 0; 383 384 len = 0; 385 if ((src[0] & 0x80) == 0) { uc = src[0] & 0x7F; len = 0; } 386 else if ((src[0] & 0xE0) == 0xC0) { uc = src[0] & 0x1F; len = 1; } 387 else if ((src[0] & 0xF0) == 0xE0) { uc = src[0] & 0x0F; len = 2; } 388 else if ((src[0] & 0xF8) == 0xF0) { uc = src[0] & 0x07; len = 3; } 389 else if ((src[0] & 0xFC) == 0xF8) { uc = src[0] & 0x03; len = 4; } 390 else if ((src[0] & 0xFE) == 0xFC) { uc = src[0] & 0x01; len = 5; } 391 392 i = 1; 393 while ((i <= len) && ((src[i] & 0xC0) == 0x80)) { 394 uc = (uc << 6) | (src[i] & 0x3F); 395 i++; 396 } 397 398 //æ¶è²»æåæ°è¨å® 399 *code_size = i; 400 401 //ç¾ç¶ã2ãã¤ãéå® 402 return uc; 403 } 316 404 317 405 #else … … 1712 1800 WCHAR w, *lfn; 1713 1801 #endif 1802 #if _CODE_PAGE == 65001 1803 unsigned char utf8_code[6]; 1804 int code_size; 1805 #endif 1714 1806 1715 1807 p = fno->fname; … … 1748 1840 while ((w = *lfn++) != 0) { /* Get an LFN character */ 1749 1841 #if !_LFN_UNICODE 1842 #if _CODE_PAGE == 65001 1843 Utf16_to_Utf8(utf8_code, &code_size, w); 1844 for (int j = 0; j < code_size - 1; j++) { 1845 p[i++] = utf8_code[j]; 1846 } 1847 w = utf8_code[code_size - 1]; 1848 #else 1750 1849 w = ff_convert(w, 0); /* Unicode -> OEM */ 1751 1850 if (!w) { i = 0; break; } /* No LFN if it could not be converted */ … … 1753 1852 p[i++] = (TCHAR)(w >> 8); 1754 1853 #endif 1854 #endif 1755 1855 if (i >= fno->lfsize - 1) { i = 0; break; } /* No LFN if buffer overflow */ 1756 1856 p[i++] = (TCHAR)w; … … 1778 1878 1779 1879 #if !_LFN_UNICODE 1880 #if _CODE_PAGE == 65001 1881 int code_size; 1882 chr = Utf8_to_Utf16(*ptr, &code_size); 1883 (*ptr) += code_size; 1884 #else 1780 1885 chr = (BYTE)*(*ptr)++; /* Get a byte */ 1781 1886 if (IsLower(chr)) chr -= 0x20; /* To upper ASCII char */ 1782 1887 if (IsDBCS1(chr) && IsDBCS2(**ptr)) /* Get DBC 2nd byte if needed */ 1783 1888 chr = chr << 8 | (BYTE)*(*ptr)++; 1889 #endif 1784 1890 #ifdef _EXCVT 1785 1891 if (chr >= 0x80) chr = ExCvt[chr - 0x80]; /* To upper SBCS extended char */ … … 1851 1957 UINT i, ni, si, di; 1852 1958 const TCHAR *p; 1853 1959 #if _CODE_PAGE == 65001 1960 char utf8_code[6]; 1961 int code_size; 1962 #endif 1854 1963 /* Create LFN in Unicode */ 1855 1964 for (p = *path; *p == '/' || *p == '\\'; p++) ; /* Strip duplicated separator */ … … 1862 1971 return FR_INVALID_NAME; 1863 1972 #if !_LFN_UNICODE 1973 #if _CODE_PAGE == 65001 1974 w = Utf8_to_Utf16(&p[si - 1], &code_size); 1975 si += code_size - 1; 1976 #else 1864 1977 w &= 0xFF; 1865 1978 if (IsDBCS1(w)) { /* Check if it is a DBC 1st byte (always false on SBCS cfg) */ … … 1871 1984 w = ff_convert(w, 1); /* Convert ANSI/OEM to Unicode */ 1872 1985 if (!w) return FR_INVALID_NAME; /* Reject invalid code */ 1986 #endif 1873 1987 #endif 1874 1988 if (w < 0x80 && chk_chr("\"*:<>\?|\x7F", w)) /* Reject illegal characters for LFN */ … … 1925 2039 if (w) w = ExCvt[w - 0x80]; /* Convert extended character to upper (SBCS) */ 1926 2040 #else 2041 #if _CODE_PAGE == 65001 2042 Utf16_to_Utf8(utf8_code, &code_size, ff_wtoupper(w)); 2043 #else 1927 2044 w = ff_convert(ff_wtoupper(w), 0); /* Upper converted Unicode -> OEM code */ 1928 2045 #endif 2046 #endif 1929 2047 cf |= NS_LFN; /* Force create LFN entry */ 1930 2048 } 1931 2049 #if _CODE_PAGE == 65001 2050 else 2051 code_size = 1; 2052 #endif 2053 2054 #if _CODE_PAGE == 65001 2055 if (code_size > 1) { /* Is this DBC? (always false at SBCS cfg) */ 2056 if (i >= ni - 1) { 2057 cf |= NS_LOSS | NS_LFN; i = ni; continue; 2058 } 2059 for (int j = 0; j < code_size; j++) { 2060 dp->fn[i++] = (BYTE)utf8_code[j]; 2061 } 2062 } 2063 else { /* SBC */ 2064 if (!w || chk_chr("+,;=[]", w)) { /* Replace illegal characters for SFN */ 2065 w = '_'; cf |= NS_LOSS | NS_LFN;/* Lossy conversion */ 2066 } 2067 else { 2068 if (IsUpper(w)) { /* ASCII large capital */ 2069 b |= 2; 2070 } 2071 else { 2072 if (IsLower(w)) { /* ASCII small capital */ 2073 b |= 1; w -= 0x20; 2074 } 2075 } 2076 } 2077 dp->fn[i++] = (BYTE)w; 2078 } 2079 #else 1932 2080 if (_DF1S && w >= 0x100) { /* Is this DBC? (always false at SBCS cfg) */ 1933 2081 if (i >= ni - 1) { … … 1949 2097 } 1950 2098 dp->fn[i++] = (BYTE)w; 2099 #endif 1951 2100 } 1952 2101 … … 3178 3327 } 3179 3328 3180 3329 FRESULT f_seek(FIL* fp, DWORD ofs, BYTE mode) 3330 { 3331 switch (mode) { 3332 case F_SEEK_SET: 3333 return f_lseek((fp), ofs); 3334 case F_SEEK_CUR: 3335 return f_lseek((fp), (fp)->fptr + ofs); 3336 case F_SEEK_END: 3337 return f_lseek((fp), (fp)->fsize - ofs); 3338 default: 3339 return FR_INVALID_PARAMETER; 3340 } 3341 } 3181 3342 3182 3343 #if _FS_MINIMIZE <= 1 … … 3719 3880 DWORD dw; 3720 3881 DEFINE_NAMEBUF; 3882 TCHAR *temp_new_path = 0; 3721 3883 3722 3884 … … 3742 3904 else 3743 3905 res = FR_INVALID_DRIVE; 3744 if (res == FR_OK) res = FR_EXIST; /* The new object name is already existing */ 3906 if (res == FR_OK) { 3907 res = FR_EXIST; /* The new object name is already existing */ 3908 dir = djn.dir; 3909 if (dir[DIR_Attr] & AM_DIR) { /* The new object is a directory */ 3910 temp_new_path = (TCHAR *)ff_memalloc((_MAX_LFN + 1) * sizeof(WCHAR)); 3911 snprintf(temp_new_path, _MAX_LFN, "%s/%s", path_new, basename((char *)path_old)); 3912 res = follow_path(&djn, temp_new_path); 3913 } 3914 } 3745 3915 if (res == FR_NO_FILE) { /* It is a valid path and no name collision */ 3746 3916 res = dir_register(&djn); /* Register the new entry */ … … 3777 3947 } 3778 3948 3949 if (temp_new_path != 0) ff_memfree(temp_new_path); 3950 3779 3951 LEAVE_FF(djo.fs, res); 3780 3952 } … … 3912 4084 WCHAR w; 3913 4085 DWORD tm; 3914 4086 #if _CODE_PAGE == 65001 4087 int code_size; 4088 char utf8_code[6]; 4089 #endif 3915 4090 3916 4091 /* Get logical drive number */ … … 3925 4100 i = j = 0; 3926 4101 do { 4102 #if _CODE_PAGE == 65001 4103 w = ff_wtoupper(Utf8_to_Utf16(&label[i], &code_size)); 4104 i += code_size; 4105 Utf16_to_Utf8(utf8_code, &code_size, w); 4106 if (!w || chk_chr("\"*+,.:;<=>\?[]|\x7F", w) || j >= sizeof(vn) - code_size) /* Reject invalid characters for volume label */ 4107 LEAVE_FF(dj.fs, FR_INVALID_NAME); 4108 for (int k = 0; k < code_size; k++) 4109 vn[j++] = utf8_code[k]; 4110 #else 3927 4111 #if _USE_LFN && _LFN_UNICODE 3928 4112 w = ff_convert(ff_wtoupper(label[i++]), 0); … … 3946 4130 if (w >= 0x100) vn[j++] = (BYTE)(w >> 8); 3947 4131 vn[j++] = (BYTE)w; 4132 #endif 3948 4133 } while (i < sl); 3949 4134 while (j < 11) vn[j++] = ' '; /* Fill remaining name field */ -
EcnlProtoTool/trunk/ntshell/fatfs/ff.h
r278 r279 143 143 /* Directory object structure (DIR) */ 144 144 145 typedef struct {145 typedef struct __dirstream { 146 146 FATFS* fs; /* Pointer to the owner file system object (**do not change order**) */ 147 147 WORD id; /* Owner file system mount ID (**do not change order**) */ … … 162 162 const TCHAR* pat; /* Pointer to the name matching pattern */ 163 163 #endif 164 struct dirent *dirent; 164 165 } DIR; 165 166 … … 252 253 #define f_rewind(fp) f_lseek((fp), 0) 253 254 #define f_rewinddir(dp) f_readdir((dp), 0) 254 #define f_flush(fp) 255 #define f_flush(fp) (FR_OK) 255 256 256 257 #define F_SEEK_SET 1 257 258 #define F_SEEK_CUR 2 258 259 #define F_SEEK_END 3 259 static FRESULT f_seek(FIL* fp, DWORD ofs, BYTE mode) 260 { 261 switch (mode) { 262 case F_SEEK_SET: 263 return f_lseek((fp), ofs); 264 case F_SEEK_CUR: 265 return f_lseek((fp), (fp)->fptr + ofs); 266 case F_SEEK_END: 267 return f_lseek((fp), (fp)->fsize - ofs); 268 default: 269 return FR_INVALID_PARAMETER; 270 } 271 } 260 FRESULT f_seek(FIL* fp, DWORD ofs, BYTE mode); 272 261 273 262 #ifndef EOF -
EcnlProtoTool/trunk/ntshell/fatfs/ffarch.c
r278 r279 56 56 #include <kernel.h> 57 57 #include <stdlib.h> 58 #include <errno.h>59 #include <sys/types.h>60 58 #include <string.h> 61 59 #include "t_stdlib.h" 60 #include "syssvc/serial.h" 62 61 #include "syssvc/syslog.h" 63 62 #include "kernel_cfg.h" … … 65 64 #include "sdfs.h" 66 65 #include "ff.h" 66 #include "tlsf.h" 67 #include "ntstdio.h" 68 69 #define SIO_PORTID 1 70 extern ntstdio_t ntstdio; 71 72 static tlsf_t sys_tlsf; 73 static pool_t sys_pool; 74 75 uint32_t __HeapBase; 76 uint32_t __HeapLimit; 77 FATFS RomDisk; 67 78 68 79 gpio_t ins; … … 70 81 #define WP() false 71 82 72 extern FATFS RomDisk; 73 extern unsigned char RamDisk[SZ_RAMDISK * 1024]; 74 83 typedef struct SD { 84 DSTATUS dst; 85 BYTE type; 86 FATFS FatFs; 87 } SD; 88 SD Sd; 89 90 void sys_init(void); 75 91 bool_t romdisk_init(); 92 bool_t SD_begin(); 76 93 77 94 int mruby_arduino_init() 78 95 { 79 96 int result = -1; 97 98 sys_init(); 80 99 81 100 /* SD_CD */ … … 85 104 sdfs_init(&sdfs, P8_5, P8_6, P8_3, P8_4, "sd"); 86 105 87 SD_begin(); 88 89 FIL fd; 90 UINT rlen = 0; 91 memset(&fd, 0, sizeof(fd)); 92 if (f_open(&fd, "1:/httpd-fs.bin", FA_OPEN_EXISTING | FA_READ) == FR_OK) { 93 f_read(&fd, RamDisk, SZ_RAMDISK * 1024, &rlen); 94 f_close(&fd); 95 if (romdisk_init()) 96 result = 0; 97 } 98 106 result = SD_begin() ? 0 : -1; 99 107 if (result == 0) { 100 syslog(LOG_NOTICE, "ramdisk ok!");108 ntstdio_printf(&ntstdio, "SD card (1:) OK!\n"); 101 109 } 102 110 else { 103 syslog(LOG_NOTICE, "ramdisk ng!"); 104 } 105 106 arduino_init(); 111 ntstdio_printf(&ntstdio, "SD card (1:) NG!\n"); 112 } 113 sta_cyc(SDFS_CYC); 114 115 if (romdisk_init()) 116 result = 0; 117 118 if (result == 0) { 119 ntstdio_printf(&ntstdio, "ROM disk (0:) OK!\n"); 120 } 121 else { 122 ntstdio_printf(&ntstdio, "ROM disk (0:) NG!\n"); 123 } 124 125 /* uploadãã£ã¬ã¯ããªãä½æãã¦ãã */ 126 f_mkdir("1:/upload"); 127 128 serial_ctl_por(SIO_PORTID, IOCTL_FCSND | IOCTL_FCRCV); 107 129 108 130 return result; 131 } 132 133 void sys_init(void) 134 { 135 sys_tlsf = tlsf_create(&__HeapBase); 136 if (sys_tlsf == NULL) 137 return; 138 139 sys_pool = tlsf_add_pool(sys_tlsf, ((uint8_t *)&__HeapBase) + tlsf_size(), ((size_t)&__HeapLimit - (size_t)&__HeapBase) - tlsf_size()); 140 } 141 142 void sys_fini(void) 143 { 144 tlsf_destroy(sys_tlsf); 145 } 146 147 void *sys_malloc(size_t size) 148 { 149 return tlsf_malloc(sys_tlsf, size); 150 } 151 152 void *sys_calloc(size_t size, size_t count) 153 { 154 void *result = tlsf_malloc(sys_tlsf, count * size); 155 memset(result, 0, count * size); 156 return result; 157 } 158 159 void *sys_realloc(void *ptr, size_t size) 160 { 161 return tlsf_realloc(sys_tlsf, ptr, size); 162 } 163 164 void sys_free(void *ptr) 165 { 166 tlsf_free(sys_tlsf, ptr); 109 167 } 110 168 … … 122 180 123 181 if ((res = f_mount(&RomDisk, "0:", 1)) != FR_OK) { 182 return false; 183 } 184 185 return true; 186 } 187 188 bool_t SD_begin() 189 { 190 DSTATUS dst; 191 FRESULT res; 192 BYTE pdrv = 1, type; 193 194 if (Sd.FatFs.fs_type != 0) 195 return true; 196 197 if ((dst = disk_initialize(pdrv)) != RES_OK) { 198 return false; 199 } 200 201 if ((dst = disk_ioctl(pdrv, MMC_GET_TYPE, &type)) != RES_OK) { 202 Sd.dst = dst; 203 Sd.type = 0; 204 } 205 else { 206 Sd.dst = RES_OK; 207 Sd.type = type; 208 } 209 210 if ((res = f_mount(&Sd.FatFs, "1:", 1)) != FR_OK) { 124 211 return false; 125 212 } … … 207 294 } 208 295 209 static int lock[TNUM_TSKID]; 210 static int stack_pos[TNUM_TSKID]; 211 212 void __malloc_lock(struct _reent *a) 213 { 214 ID tskid; 296 int ff_cre_syncobj(BYTE vol, _SYNC_t* sobj) 297 { 298 return 1; 299 } 300 301 int ff_req_grant(_SYNC_t sobj) 302 { 215 303 ER ret; 216 int count, sp; 217 218 ret = get_tid(&tskid); 219 if (ret != E_OK) { 220 /*syslog(LOG_DEBUG, "get_tid %s", itron_strerror(ret));*/ 221 Asm("bkpt #0"); 222 } 223 224 Asm("mov %0, sp" : "=r"(sp) :); 225 if ((stack_pos[tskid - 1] == 0) || (stack_pos[tskid - 1] < sp)) 226 stack_pos[tskid - 1] = sp; 227 228 count = ++lock[tskid - 1]; 229 if (count != 1) 230 return; 231 232 ret = wai_sem(SEM_MALLOC); 233 if (ret != E_OK) { 234 /*syslog(LOG_DEBUG, "wai_sem %s", itron_strerror(ret));*/ 235 Asm("bkpt #0"); 236 } 237 } 238 239 void __malloc_unlock(struct _reent *a) 240 { 241 ID tskid; 242 ER ret; 243 int count; 244 245 ret = get_tid(&tskid); 246 if (ret != E_OK) { 247 /*syslog(LOG_DEBUG, "get_tid %s", itron_strerror(ret));*/ 248 Asm("bkpt #0"); 249 } 250 251 count = --lock[tskid - 1]; 252 if(count != 0) 253 return; 254 255 ret = sig_sem(SEM_MALLOC); 256 if (ret != E_OK) { 257 /*syslog(LOG_DEBUG, "sig_sem %s", itron_strerror(ret));*/ 258 Asm("bkpt #0"); 259 } 260 } 261 262 // Provide implementation of _sbrk (low-level dynamic memory allocation 263 // routine) for GCC_ARM which compares new heap pointer with MSP instead of 264 // SP. This make it compatible with RTX RTOS thread stacks. 265 266 // Linker defined symbol used by _sbrk to indicate where heap should start. 267 int __end__; 268 uint32_t __HeapLimit; 269 270 // Turn off the errno macro and use actual global variable instead. 271 #undef errno 272 int errno; 273 274 static unsigned char* heap = (unsigned char*)&__end__; 275 276 // Dynamic memory allocation related syscall. 277 caddr_t _sbrk(int incr) { 278 unsigned char* prev_heap = heap; 279 unsigned char* new_heap = heap + incr; 280 281 if (new_heap >= (unsigned char*)&__HeapLimit) { /* __HeapLimit is end of heap section */ 282 errno = ENOMEM; 283 return (caddr_t)-1; 284 } 285 286 heap = new_heap; 287 return (caddr_t) prev_heap; 288 } 289 290 void reset_heap() 291 { 292 // .data 293 extern uint8_t __malloc_av_[0x408]; 294 extern uint8_t __malloc_sbrk_base[0x4]; 295 extern uint8_t __malloc_trim_threshold[0x4]; 296 // .bss 297 extern uint8_t __malloc_top_pad[0x4]; 298 extern uint8_t __malloc_current_mallinfo[0x28]; 299 extern uint8_t __malloc_max_sbrked_mem[0x4]; 300 extern uint8_t __malloc_max_total_mem[0x4]; 301 // 302 extern void *__etext; 303 extern void *__data_start__; 304 305 int offset = (int)&__etext - (int)&__data_start__; 306 307 __malloc_lock(_REENT); 308 309 memcpy(__malloc_av_, &__malloc_av_[offset], sizeof(__malloc_av_)); 310 memcpy(__malloc_sbrk_base, &__malloc_sbrk_base[offset], sizeof(__malloc_sbrk_base)); 311 memcpy(__malloc_trim_threshold, &__malloc_trim_threshold[offset], sizeof(__malloc_trim_threshold)); 312 313 memset(__malloc_top_pad, 0, sizeof(__malloc_top_pad)); 314 memset(__malloc_current_mallinfo, 0, sizeof(__malloc_current_mallinfo)); 315 memset(__malloc_max_sbrked_mem, 0, sizeof(__malloc_max_sbrked_mem)); 316 memset(__malloc_max_total_mem, 0, sizeof(__malloc_max_total_mem)); 317 318 heap = (unsigned char*)&__end__; 319 320 __malloc_unlock(_REENT); 321 } 322 323 void exit(int return_code) { 324 Asm("bkpt #0"); 325 reset_heap(); 326 ext_tsk(); 327 for(;;); 328 } 304 ret = wai_sem(SEM_FILESYSTEM); 305 return ret == E_OK; 306 } 307 308 void ff_rel_grant(_SYNC_t sobj) 309 { 310 sig_sem(SEM_FILESYSTEM); 311 } 312 313 int ff_del_syncobj(_SYNC_t sobj) 314 { 315 return 1; 316 } 317 318 void* ff_memalloc (UINT msize) 319 { 320 return sys_malloc(msize); 321 } 322 323 void ff_memfree (void* mblock) 324 { 325 sys_free(mblock); 326 } -
EcnlProtoTool/trunk/ntshell/fatfs/ffarch.cfg
r278 r279 51 51 */ 52 52 53 #include " mruby_arduino.h"53 #include "ffarch.h" 54 54 55 CRE_CYC(SDFS_CYC, { TA_NULL, { TNFY_HANDLER, 0, sdfs_cychdr }, 1000 , 0 });55 CRE_CYC(SDFS_CYC, { TA_NULL, { TNFY_HANDLER, 0, sdfs_cychdr }, 1000000, 0 }); 56 56 57 57 CRE_SEM(SEM_MALLOC, { TA_TPRI, 1, 1 }); -
EcnlProtoTool/trunk/ntshell/fatfs/ffarch.h
r278 r279 54 54 55 55 int mruby_arduino_init(); 56 void reset_heap();57 56 void sdfs_cychdr(intptr_t exinf); 58 57 -
EcnlProtoTool/trunk/ntshell/fatfs/ffconf.h
r278 r279 62 62 /---------------------------------------------------------------------------*/ 63 63 64 #define _CODE_PAGE 43764 #define _CODE_PAGE 65001 65 65 /* This option specifies the OEM code page to be used on the target system. 66 66 / Incorrect setting of the code page can cause a file open failure. … … 91 91 92 92 93 #define _USE_LFN 193 #define _USE_LFN 3 94 94 #define _MAX_LFN 255 95 95 /* The _USE_LFN option switches the LFN feature. … … 227 227 228 228 229 #define _FS_REENTRANT 0229 #define _FS_REENTRANT 1 230 230 #define _FS_TIMEOUT 1000 231 #define _SYNC_t HANDLE231 #define _SYNC_t unsigned int 232 232 /* The _FS_REENTRANT option switches the re-entrancy (thread safe) of the FatFs 233 233 / module itself. Note that regardless of this option, file access to different
Note:
See TracChangeset
for help on using the changeset viewer.