Skip to content

Commit 693d5f7

Browse files
authored
Merge pull request #81 from rahmanih/fix_issue_79
Update media driver status initialization FX_DRIVER_INIT request
2 parents 048a01e + 853f8a2 commit 693d5f7

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

common/src/fx_media_format.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,11 @@ UINT sectors_per_fat, f, s;
161161
media_ptr -> fx_media_hidden_sectors = hidden_sectors;
162162

163163
/* Initialize the supplied media I/O driver. First, build the
164-
initialize driver request. */
164+
initialize driver request. Set the fx_media_driver_status to FX_MEDIA_INVALID
165+
to let the driver know that the request is issued from a fx_media_format() call
166+
*/
165167
media_ptr -> fx_media_driver_request = FX_DRIVER_INIT;
166-
media_ptr -> fx_media_driver_status = FX_IO_ERROR;
168+
media_ptr -> fx_media_driver_status = FX_MEDIA_INVALID;
167169
media_ptr -> fx_media_driver_info = driver_info_ptr;
168170
media_ptr -> fx_media_driver_write_protect = FX_FALSE;
169171
media_ptr -> fx_media_driver_free_sector_update = FX_FALSE;

common/src/fx_media_open.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,11 @@ FX_INT_SAVE_AREA
261261
FX_TRACE_IN_LINE_INSERT(FX_TRACE_MEDIA_OPEN, media_ptr, media_driver, memory_ptr, memory_size, FX_TRACE_MEDIA_EVENTS, 0, 0)
262262

263263
/* Initialize the supplied media I/O driver. First, build the
264-
initialize driver request. */
264+
initialize driver request. Set the fx_media_driver_status to FX_MEDIA_NOT_OPEN
265+
to let the driver understand that the request is issued from a fx_media_open() call.
266+
*/
265267
media_ptr -> fx_media_driver_request = FX_DRIVER_INIT;
266-
media_ptr -> fx_media_driver_status = FX_IO_ERROR;
268+
media_ptr -> fx_media_driver_status = FX_MEDIA_NOT_OPEN;
267269
media_ptr -> fx_media_driver_info = driver_info_ptr;
268270
media_ptr -> fx_media_driver_write_protect = FX_FALSE;
269271
media_ptr -> fx_media_driver_free_sector_update = FX_FALSE;

0 commit comments

Comments
 (0)