Changeset 260 for soft/giet_vm
- Timestamp:
- Dec 9, 2013, 5:26:37 PM (11 years ago)
- Location:
- soft/giet_vm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_fat32/fat32.c
r259 r260 1309 1309 1310 1310 ///////////////////////////////////////////////////////////////////////////////// 1311 // Return stats of a file identified by "fd". 1312 // (Only the file_size in sectors for this moment) 1313 ///////////////////////////////////////////////////////////////////////////////// 1314 // Returns file size (on sectors) on success, -1 on failure. 1315 ///////////////////////////////////////////////////////////////////////////////// 1316 int _fat_fstat( unsigned int fd_id ) 1317 { 1318 unsigned int file_size = 0; 1319 unsigned int file_sectors = 0; 1320 1321 if( (fd_id < GIET_OPEN_FILES_MAX) ) 1322 { 1323 file_size = fat.fd[fd_id].file_size; 1324 1325 if ( file_size & 0x1FF ) file_sectors = (file_size >> 9) + 1; 1326 else file_sectors = (file_size >> 9); 1327 1328 return file_sectors; 1329 } 1330 else 1331 { 1332 _tty_get_lock( 0 ); 1333 _puts("\n[FAT ERROR] in _fat_fstat() : illegal file descriptor index\n"); 1334 _tty_release_lock( 0 ); 1335 return -1; 1336 } 1337 } // end _fat_fstat() 1338 1339 ///////////////////////////////////////////////////////////////////////////////// 1311 1340 // Close the file identified by the file_descriptor index. 1312 1341 ///////////////////////////////////////////////////////////////////////////////// -
soft/giet_vm/giet_fat32/fat32.h
r258 r260 174 174 unsigned int offset ); // offset sector in file 175 175 176 extern int _fat_fstat( unsigned int fd_id ); // file descriptor index 177 176 178 extern int _fat_close( unsigned int fd_id ); // file descriptor index 177 179 -
soft/giet_vm/giet_kernel/sys_handler.c
r258 r260 67 67 &_fat_user_write, /* 0x22 */ 68 68 &_fat_user_lseek, /* 0x23 */ 69 &_fat_ close, /* 0x24 */70 &_ sys_ukn,/* 0x25 */69 &_fat_fstat, /* 0x24 */ 70 &_fat_close, /* 0x25 */ 71 71 &_sys_ukn, /* 0x26 */ 72 72 &_sys_ukn, /* 0x27 */ -
soft/giet_vm/giet_libs/stdio.c
r258 r260 744 744 0 ); 745 745 } 746 747 /////////////////////////////////////////////////////////////////////////////////// 748 // giet_fat_fstat() 749 /////////////////////////////////////////////////////////////////////////////////// 750 // Return stats of a file identified by "fd". 751 // (Only the file_size in sectors for this moment) 752 /////////////////////////////////////////////////////////////////////////////////// 753 int giet_fat_fstat( unsigned int fd ) 754 { 755 return sys_call( SYSCALL_FAT_FSTAT, 756 fd, 757 0, 0, 0 ); 758 } 759 746 760 /////////////////////////////////////////////////////////////////////////////////// 747 761 // giet_fat_close() -
soft/giet_vm/giet_libs/stdio.h
r259 r260 50 50 #define SYSCALL_FAT_WRITE 0x22 51 51 #define SYSCALL_FAT_LSEEK 0x23 52 #define SYSCALL_FAT_CLOSE 0x24 52 #define SYSCALL_FAT_FSTAT 0x24 53 #define SYSCALL_FAT_CLOSE 0x25 53 54 54 55 ////////////////////////////////////////////////////////////////////////////////// … … 182 183 unsigned int whence ); 183 184 185 extern int giet_fat_fstat( unsigned int fd ); 186 184 187 extern int giet_fat_close( unsigned int fd ); 185 188
Note: See TracChangeset
for help on using the changeset viewer.