// eFile.h // Runs on either TM4C123 or MSP432 // High-level implementation of the file system implementation. // Daniel and Jonathan Valvano // August 29, 2016 //********OS_File_New************* // Returns a file number of a new file for writing // Inputs: none // Outputs: number of a new file // Errors: return 255 on failure or disk full uint8_t OS_File_New(void); //********OS_File_Size************* // Check the size of this file // Inputs: num, 8-bit file number, 0 to 254 // Outputs: 0 if empty, otherwise the number of sectors // Errors: none uint8_t OS_File_Size(uint8_t num); //********OS_File_Append************* // Save 512 bytes into the file // Inputs: num, 8-bit file number, 0 to 254 // buf, pointer to 512 bytes of data // Outputs: 0 if successful // Errors: 255 on failure or disk full uint8_t OS_File_Append(uint8_t num, uint8_t buf[512]); //********OS_File_Read************* // Read 512 bytes from the file // Inputs: num, 8-bit file number, 0 to 254 // location, logical address, 0 to 254 // buf, pointer to 512 empty spaces in RAM // Outputs: 0 if successful // Errors: 255 on failure because no data uint8_t OS_File_Read(uint8_t num, uint8_t location, uint8_t buf[512]); //********OS_File_Flush************* // Update working buffers onto the disk // Power can be removed after calling flush // Inputs: none // Outputs: 0 if success // Errors: 255 on disk write failure uint8_t OS_File_Flush(void); //********OS_File_Format************* // Erase all files and all data // Inputs: none // Outputs: 0 if success // Errors: 255 on disk write failure uint8_t OS_File_Format(void);