@@ -29,11 +29,42 @@ typedef struct neo_file_stat {
2929 uint8_t attr ;
3030} neo_file_stat_t ;
3131
32- #define NEO_FILE_ATTR_DIRECTORY 0x01
33- #define NEO_FILE_ATTR_SYSTEM 0x02
34- #define NEO_FILE_ATTR_ARCHIVE 0x04
35- #define NEO_FILE_ATTR_READ_ONLY 0x08
36- #define NEO_FILE_ATTR_HIDDEN 0x10
32+ #define NEO_FIOATTR_DIR 0x01
33+ #define NEO_FIOATTR_SYSTEM 0x02
34+ #define NEO_FIOATTR_ARCHIVE 0x04
35+ #define NEO_FIOATTR_READONLY 0x08
36+ #define NEO_FIOATTR_HIDDEN 0x10
37+
38+ #define NEO_FIOERROR_OK 0x00
39+ #define NEO_FIOERROR_UNKNOWN 0x01
40+ #define NEO_FIOERROR_EOF 0x02
41+ #define NEO_FIOERROR_UNIMPLEMENTED 0x03
42+ #define NEO_FIOERROR_NO_FILE 0x11
43+ #define NEO_FIOERROR_NO_PATH 0x12
44+ #define NEO_FIOERROR_INVALID_DRIVE 0x13
45+ #define NEO_FIOERROR_INVALID_NAME 0x14
46+ #define NEO_FIOERROR_INVALID_PARAMETER 0x15
47+ #define NEO_FIOERROR_DENIED 0x21
48+ #define NEO_FIOERROR_EXIST 0x22
49+ #define NEO_FIOERROR_INVALID_OBJECT 0x23
50+ #define NEO_FIOERROR_WRITE_PROTECTED 0x24
51+ #define NEO_FIOERROR_LOCKED 0x25
52+ #define NEO_FIOERROR_DISK_ERR 0x31
53+ #define NEO_FIOERROR_INT_ERR 0x32
54+ #define NEO_FIOERROR_NOT_READY 0x33
55+ #define NEO_FIOERROR_NOT_ENABLED 0x34
56+ #define NEO_FIOERROR_NO_FILESYSTEM 0x35
57+ #define NEO_FIOERROR_MKFS_ABORTED 0x41
58+ #define NEO_FIOERROR_TIMEOUT 0x42
59+ #define NEO_FIOERROR_NOT_ENOUGH_CORE 0x43
60+ #define NEO_FIOERROR_TOO_MANY_OPEN_FILES 0x44
61+
62+ // Legacy synonyms.
63+ #define NEO_FILE_ATTR_DIRECTORY NEO_FIOATTR_DIR
64+ #define NEO_FILE_ATTR_SYSTEM NEO_FIOATTR_SYSTEM
65+ #define NEO_FILE_ATTR_ARCHIVE NEO_FIOATTR_ARCHIVE
66+ #define NEO_FILE_ATTR_READ_ONLY NEO_FIOATTR_READONLY
67+ #define NEO_FILE_ATTR_HIDDEN NEO_FIOATTR_HIDDEN
3768
3869/**
3970 * @brief Display the listing of files in the current directory.
@@ -89,7 +120,7 @@ void neo_file_store(const char *filename, const void *src, uint16_t len);
89120/**
90121 * @brief Open a file channel, using a Pascal string for the filename.
91122 *
92- * @param channel Channel ID
123+ * @param channel File channel ID
93124 * @param filename Filename (Pascal string)
94125 * @param mode Mode @see neo_file_mode_t
95126 *
@@ -100,7 +131,7 @@ void neo_file_open_p(uint8_t channel, const neo_pstring_t *filename, uint8_t mod
100131/**
101132 * @brief Open a file channel, using a C string for the filename.
102133 *
103- * @param channel Channel ID
134+ * @param channel File channel ID
104135 * @param filename Filename (C string)
105136 * @param mode Mode @see neo_file_mode_t
106137 *
@@ -111,7 +142,7 @@ void neo_file_open(uint8_t channel, const char *filename, uint8_t mode);
111142/**
112143 * @brief Close a file channel.
113144 *
114- * @param channel Channel ID
145+ * @param channel File channel ID
115146 *
116147 * Check errors with @see neo_api_error
117148 */
@@ -120,7 +151,7 @@ void neo_file_close(uint8_t channel);
120151/**
121152 * @brief Seek a file.
122153 *
123- * @param channel Channel ID
154+ * @param channel File channel ID
124155 * @param pos New file position
125156 *
126157 * Check errors with @see neo_api_error
@@ -130,7 +161,7 @@ void neo_file_seek(uint8_t channel, uint32_t pos);
130161/**
131162 * @brief Tell a file's position.
132163 *
133- * @param channel Channel ID
164+ * @param channel File channel ID
134165 * @return Current file position
135166 *
136167 * Check errors with @see neo_api_error
@@ -142,7 +173,7 @@ uint32_t neo_file_tell(uint8_t channel);
142173 *
143174 * To read into graphics memory, use @see NEO_FILE_DESTINATION_GRAPHICS .
144175 *
145- * @param channel Channel ID
176+ * @param channel File channel ID
146177 * @param dest Destination
147178 * @param len Length, in bytes
148179 * @return Amount of data actually read
@@ -154,7 +185,7 @@ uint16_t neo_file_read(uint8_t channel, void *dest, uint16_t len);
154185/**
155186 * @brief Write bytes to an open file.
156187 *
157- * @param channel Channel ID
188+ * @param channel File channel ID
158189 * @param src Source
159190 * @param len Length, in bytes
160191 * @return Amount of data actually written
@@ -166,7 +197,7 @@ uint32_t neo_file_write(uint8_t channel, const void *src, uint16_t len);
166197/**
167198 * @brief Get the file's size, in bytes.
168199 *
169- * @param channel Channel ID
200+ * @param channel File channel ID
170201 * @return File size, in bytes
171202 *
172203 * Check errors with @see neo_api_error
@@ -176,7 +207,7 @@ uint32_t neo_file_size(uint8_t channel);
176207/**
177208 * @brief Set the file's size.
178209 *
179- * @param channel Channel ID
210+ * @param channel File channel ID
180211 * @param size New file size, in bytes
181212 *
182213 * Check errors with @see neo_api_error
@@ -368,6 +399,22 @@ void neo_file_set_attr_p(const neo_pstring_t *path, uint8_t attr);
368399 */
369400void neo_file_set_attr (const char * path , uint8_t attr );
370401
402+ /**
403+ * @brief Check if file is at end of file.
404+ *
405+ * @param channel File channel ID
406+ * @return True if file is at end of file.
407+ */
408+ bool neo_file_eof (uint8_t channel );
409+
410+ /**
411+ * @brief Retrieve the current working directory.
412+ *
413+ * @param buffer Buffer to write the current working directory to.
414+ * @param length Length of buffer, in bytes.
415+ */
416+ void neo_file_get_cwd (char * buffer , uint8_t length );
417+
371418/**
372419 * @brief Display a filtered listing of files in the current directory, using a Pascal string for the needle.
373420 *
0 commit comments