Changeset 588 for soft/giet_vm/giet_libs/stdio.c
- Timestamp:
- Jul 8, 2015, 3:40:18 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_libs/stdio.c
r581 r588 190 190 { 191 191 int val = va_arg( *args, int ); 192 if (modifiers != NO_MOD) goto return_error; // Modifiers have no meaning192 if (modifiers != NO_MOD) goto return_error; // Modifiers have no meaning 193 193 194 194 len = 1; … … 201 201 int val = va_arg( *args, int ); 202 202 203 if (modifiers == LL_MOD) goto return_error; // 64 bits not supported203 if (modifiers == LL_MOD) goto return_error; // 64 bits not supported 204 204 205 205 if (val < 0) … … 290 290 char* str = va_arg( *args, char* ); 291 291 292 if (modifiers != NO_MOD) goto return_error; // Modifiers have no meaning292 if (modifiers != NO_MOD) goto return_error; // Modifiers have no meaning 293 293 294 294 while (str[len]) … … 879 879 /////////////////////////////////////////////////////////////////////////////////// 880 880 881 /////////////////////////////////////////// 882 int giet_fat_open( const char* pathname, 883 unsigned int flags ) 884 { 885 int ret = sys_call( SYSCALL_FAT_OPEN, 886 (unsigned int)pathname, 887 flags, 888 0, 0 ); 889 if ( ret < 0 ) giet_exit("error in giet_fat_open()"); 890 return ret; 891 } 892 893 //////////////////////////////////// 894 void giet_fat_read( unsigned int fd, 881 ///////////////////////////////////////// 882 int giet_fat_open( char* pathname, 883 unsigned int flags ) 884 { 885 return sys_call( SYSCALL_FAT_OPEN, 886 (unsigned int)pathname, 887 flags, 888 0, 0 ); 889 } 890 891 ///////////////////////////////////////// 892 int giet_fat_close( unsigned int fd_id ) 893 { 894 return sys_call( SYSCALL_FAT_CLOSE, 895 fd_id, 896 0, 0, 0 ); 897 } 898 899 ///////////////////////////////////////////// 900 int giet_fat_file_info( unsigned int fd_id, 901 unsigned int* size, 902 unsigned int* offset ) 903 { 904 return sys_call( SYSCALL_FAT_FINFO, 905 fd_id, 906 (unsigned int)size, 907 (unsigned int)offset, 908 0 ); 909 } 910 911 /////////////////////////////////////// 912 int giet_fat_read( unsigned int fd_id, 913 void* buffer, 914 unsigned int count ) 915 { 916 return sys_call( SYSCALL_FAT_READ, 917 fd_id, 918 (unsigned int)buffer, 919 count, 920 0 ); 921 } 922 923 //////////////////////////////////////// 924 int giet_fat_write( unsigned int fd_id, 895 925 void* buffer, 896 unsigned int count, 897 unsigned int offset ) 898 { 899 if ( sys_call( SYSCALL_FAT_READ, 900 fd, 901 (unsigned int)buffer, 902 count, 903 offset ) != count ) giet_exit("ERROR in giet_fat_read()"); 904 } 905 906 ///////////////////////////////////// 907 void giet_fat_write( unsigned int fd, 908 void* buffer, 909 unsigned int count, 910 unsigned int offset ) 911 { 912 if ( sys_call( SYSCALL_FAT_WRITE, 913 fd, 914 (unsigned int)buffer, 915 count, 916 offset ) != count ) giet_exit("ERROR in giet_fat_write()"); 917 } 918 919 /* variant implementing the UNIX spec 920 /////////////////////////////////////////////////////////////////////////////////// 921 // This system call writes to a file identified by the "fd" file descriptor. 922 // - "buffer" is the source buffer virtual address (must be word aligned). 923 // - "count" is a number of bytes (must be multiple of 4). 924 // It uses the implicit "lseek" pointer in file descriptor. 925 /////////////////////////////////////////////////////////////////////////////////// 926 void giet_fat_write( unsigned int fd, 927 void* buffer, 928 unsigned int count ) // number of bytes 926 unsigned int count ) 929 927 { 930 928 return sys_call( SYSCALL_FAT_WRITE, 931 fd ,929 fd_id, 932 930 (unsigned int)buffer, 933 count, 0 );934 } 935 */ 936 937 ///////////////////////////////////// 938 void giet_fat_lseek( unsigned int fd, 931 count, 932 0 ); 933 } 934 935 //////////////////////////////////////// 936 int giet_fat_lseek( unsigned int fd_id, 939 937 unsigned int offset, 940 938 unsigned int whence ) 941 939 { 942 if ( sys_call( SYSCALL_FAT_LSEEK, 943 fd, 944 offset, 945 whence, 946 0 ) ) giet_exit("ERROR in giet_fat_lseek()"); 947 } 948 949 ////////////////////////////////////// 950 void giet_fat_fstat( unsigned int fd ) 951 { 952 if ( sys_call( SYSCALL_FAT_FSTAT, 953 fd, 954 0, 0, 0 ) ) giet_exit("ERROR in giet_fat_lseek()"); 940 return sys_call( SYSCALL_FAT_LSEEK, 941 fd_id, 942 offset, 943 whence, 944 0 ); 945 } 946 947 //////////////////////////////////////////// 948 int giet_fat_remove( char* pathname, 949 unsigned int should_be_dir ) 950 { 951 return sys_call( SYSCALL_FAT_REMOVE, 952 (unsigned int)pathname, 953 should_be_dir, 954 0, 0 ); 955 955 } 956 956 957 957 ///////////////////////////////////// 958 void giet_fat_close( unsigned int fd ) 959 { 960 if ( sys_call( SYSCALL_FAT_CLOSE, 961 fd, 962 0, 0, 0 ) ) giet_exit("ERROR in giet_fat_close()"); 963 } 964 958 int giet_fat_rename( char* old_path, 959 char* new_path ) 960 { 961 return sys_call( SYSCALL_FAT_RENAME, 962 (unsigned int)old_path, 963 (unsigned int)new_path, 964 0, 0 ); 965 } 966 967 //////////////////////////////////// 968 int giet_fat_mkdir( char* pathname ) 969 { 970 return sys_call( SYSCALL_FAT_MKDIR, 971 (unsigned int)pathname, 972 0, 0, 0 ); 973 } 974 975 ///////////////////////////////////// 976 int giet_fat_list( char* pathname ) 977 { 978 return sys_call( SYSCALL_FAT_LIST, 979 (unsigned int)pathname, 980 0, 0, 0 ); 981 } 965 982 966 983
Note: See TracChangeset
for help on using the changeset viewer.