FX_ULSF.C
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:8k
- /**************************************************************************/
- /* */
- /* Copyright (c) 1996-2002 by Express Logic Inc. */
- /* */
- /* This software is copyrighted by and is the sole property of Express */
- /* Logic, Inc. All rights, title, ownership, or other interests */
- /* in the software remain the property of Express Logic, Inc. This */
- /* software may only be used in accordance with the corresponding */
- /* license agreement. Any unauthorized use, duplication, transmission, */
- /* distribution, or disclosure of this software is expressly forbidden. */
- /* */
- /* This Copyright notice may not be removed or modified without prior */
- /* written consent of Express Logic, Inc. */
- /* */
- /* Express Logic, Inc. reserves the right to modify this software */
- /* without notice. */
- /* */
- /* Express Logic, Inc. info@expresslogic.com */
- /* 11423 West Bernardo Court http://www.expresslogic.com */
- /* San Diego, CA 92127 */
- /* */
- /**************************************************************************/
- /**************************************************************************/
- /**************************************************************************/
- /** */
- /** FileX Component */
- /** */
- /** Utility (UTI) */
- /** */
- /**************************************************************************/
- /**************************************************************************/
- #include "Config.h" // Global Configuration - do not remove!
- #ifdef ENABLE_FILEX
- #ifdef _DEBUG
- #undef IFTRACE
- #define IFTRACE if (gTraceFileSys)
- #include "DebugDbgMain.h"
- #endif //_DEBUG
- #define FX_SOURCE_CODE
- /* Include necessary system files. */
- #include "PlaycoreFileSysFileXfx_api.h"
- #include "PlaycoreFileSysFileXfx_sys.h"
- #include "PlaycoreFileSysFileXfx_uti.h"
- /**************************************************************************/
- /* */
- /* FUNCTION RELEASE */
- /* */
- /* _fx_utility_log_sector_flush PORTABLE C */
- /* 3.0 */
- /* AUTHOR */
- /* */
- /* William E. Lamie, Express Logic, Inc. */
- /* */
- /* DESCRIPTION */
- /* */
- /* This function handles logical sector flush requests for all FileX */
- /* components. If the logical sector is currently marked as written, */
- /* it will be flushed to the media by this function and the written */
- /* flag is cleared. */
- /* */
- /* Note: Conversion of the logical sector is done inside the driver. */
- /* This results in a performance boost for FLASH or RAM media */
- /* devices. */
- /* */
- /* INPUT */
- /* */
- /* media_ptr Media control block pointer */
- /* */
- /* OUTPUT */
- /* */
- /* return status */
- /* */
- /* CALLS */
- /* */
- /* I/O Driver */
- /* */
- /* CALLED BY */
- /* */
- /* FileX System Functions */
- /* */
- /* RELEASE HISTORY */
- /* */
- /* DATE NAME DESCRIPTION */
- /* */
- /* 01-01-1999 William E. Lamie Initial Version 1.0 */
- /* 03-01-2000 William E. Lamie Modified comment(s), */
- /* resulting in version 1.0b. */
- /* 01-28-2001 William E. Lamie Modified comment(s) and added */
- /* logic to flush first cache */
- /* entry to the media, */
- /* resulting in version 2.0. */
- /* 03-01-2002 William E. Lamie Modified comment(s), */
- /* resulting in version 3.0. */
- /* */
- /**************************************************************************/
- UINT _fx_utility_log_sector_flush(FX_MEDIA *media_ptr)
- {
- /* Determine if the first cache entry in the internal FileX sector
- cache has been modified. */
- if ((media_ptr -> fx_media_sector_cache_list_ptr) -> fx_cached_sector_buffer_dirty)
- {
- /* Build request to the driver. */
- media_ptr -> fx_media_driver_request = FX_DRIVER_WRITE;
- media_ptr -> fx_media_driver_status = FX_IO_ERROR;
- media_ptr -> fx_media_driver_buffer = (media_ptr -> fx_media_sector_cache_list_ptr) -> fx_cached_sector_memory_buffer;
- media_ptr -> fx_media_driver_logical_sector = (media_ptr -> fx_media_sector_cache_list_ptr) -> fx_cached_sector;
- media_ptr -> fx_media_driver_sectors = 1;
- /* Invoke the driver to write the sector. */
- (media_ptr -> fx_media_driver_entry) (media_ptr);
- /* Clear the written flag, if good status. */
- if (media_ptr -> fx_media_driver_status == FX_SUCCESS)
- {
- /* Clear the dirty flag. */
- (media_ptr -> fx_media_sector_cache_list_ptr) -> fx_cached_sector_buffer_dirty = FX_FALSE;
- }
- /* Return a driver status. */
- return(media_ptr -> fx_media_driver_status);
- }
- /* Return successful status. */
- return(FX_SUCCESS);
- }
- #endif