FX_ULSF.C
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:8k
源码类别:

DVD

开发平台:

Others

  1. /**************************************************************************/ 
  2. /*                                                                        */ 
  3. /*            Copyright (c) 1996-2002 by Express Logic Inc.               */ 
  4. /*                                                                        */ 
  5. /*  This software is copyrighted by and is the sole property of Express   */ 
  6. /*  Logic, Inc.  All rights, title, ownership, or other interests         */ 
  7. /*  in the software remain the property of Express Logic, Inc.  This      */ 
  8. /*  software may only be used in accordance with the corresponding        */ 
  9. /*  license agreement.  Any unauthorized use, duplication, transmission,  */ 
  10. /*  distribution, or disclosure of this software is expressly forbidden.  */ 
  11. /*                                                                        */
  12. /*  This Copyright notice may not be removed or modified without prior    */ 
  13. /*  written consent of Express Logic, Inc.                                */ 
  14. /*                                                                        */ 
  15. /*  Express Logic, Inc. reserves the right to modify this software        */ 
  16. /*  without notice.                                                       */ 
  17. /*                                                                        */ 
  18. /*  Express Logic, Inc.                     info@expresslogic.com         */
  19. /*  11423 West Bernardo Court               http://www.expresslogic.com   */
  20. /*  San Diego, CA  92127                                                  */
  21. /*                                                                        */
  22. /**************************************************************************/
  23. /**************************************************************************/
  24. /**************************************************************************/
  25. /**                                                                       */ 
  26. /** FileX Component                                                       */ 
  27. /**                                                                       */
  28. /**   Utility (UTI)                                                       */
  29. /**                                                                       */
  30. /**************************************************************************/
  31. /**************************************************************************/
  32. #include "Config.h" // Global Configuration - do not remove!
  33. #ifdef ENABLE_FILEX
  34. #ifdef _DEBUG
  35. #undef IFTRACE
  36. #define IFTRACE if (gTraceFileSys)
  37. #include "DebugDbgMain.h"
  38. #endif //_DEBUG
  39. #define FX_SOURCE_CODE
  40. /* Include necessary system files.  */
  41. #include "PlaycoreFileSysFileXfx_api.h"
  42. #include "PlaycoreFileSysFileXfx_sys.h"
  43. #include "PlaycoreFileSysFileXfx_uti.h"
  44. /**************************************************************************/ 
  45. /*                                                                        */ 
  46. /*  FUNCTION                                               RELEASE        */ 
  47. /*                                                                        */ 
  48. /*    _fx_utility_log_sector_flush                        PORTABLE C      */ 
  49. /*                                                           3.0          */ 
  50. /*  AUTHOR                                                                */ 
  51. /*                                                                        */ 
  52. /*    William E. Lamie, Express Logic, Inc.                               */ 
  53. /*                                                                        */ 
  54. /*  DESCRIPTION                                                           */ 
  55. /*                                                                        */ 
  56. /*    This function handles logical sector flush requests for all FileX   */ 
  57. /*    components.  If the logical sector is currently marked as written,  */ 
  58. /*    it will be flushed to the media by this function and the written    */ 
  59. /*    flag is cleared.                                                    */ 
  60. /*                                                                        */ 
  61. /*    Note: Conversion of the logical sector is done inside the driver.   */ 
  62. /*          This results in a performance boost for FLASH or RAM media    */ 
  63. /*          devices.                                                      */ 
  64. /*                                                                        */ 
  65. /*  INPUT                                                                 */ 
  66. /*                                                                        */ 
  67. /*    media_ptr                             Media control block pointer   */ 
  68. /*                                                                        */ 
  69. /*  OUTPUT                                                                */ 
  70. /*                                                                        */ 
  71. /*    return status                                                       */ 
  72. /*                                                                        */ 
  73. /*  CALLS                                                                 */ 
  74. /*                                                                        */ 
  75. /*    I/O Driver                                                          */ 
  76. /*                                                                        */ 
  77. /*  CALLED BY                                                             */ 
  78. /*                                                                        */ 
  79. /*    FileX System Functions                                              */ 
  80. /*                                                                        */ 
  81. /*  RELEASE HISTORY                                                       */ 
  82. /*                                                                        */ 
  83. /*    DATE              NAME                      DESCRIPTION             */ 
  84. /*                                                                        */ 
  85. /*  01-01-1999     William E. Lamie         Initial Version 1.0           */ 
  86. /*  03-01-2000     William E. Lamie         Modified comment(s),          */ 
  87. /*                                            resulting in version 1.0b.  */ 
  88. /*  01-28-2001     William E. Lamie         Modified comment(s) and added */ 
  89. /*                                            logic to flush first cache  */ 
  90. /*                                            entry to the media,         */ 
  91. /*                                            resulting in version 2.0.   */ 
  92. /*  03-01-2002     William E. Lamie         Modified comment(s),          */ 
  93. /*                                            resulting in version 3.0.   */ 
  94. /*                                                                        */ 
  95. /**************************************************************************/ 
  96. UINT  _fx_utility_log_sector_flush(FX_MEDIA *media_ptr)
  97. {
  98.     /* Determine if the first cache entry in the internal FileX sector
  99.        cache has been modified.  */
  100.     if ((media_ptr -> fx_media_sector_cache_list_ptr) -> fx_cached_sector_buffer_dirty)
  101.     {
  102.         /* Build request to the driver.  */
  103.         media_ptr -> fx_media_driver_request =          FX_DRIVER_WRITE;
  104.         media_ptr -> fx_media_driver_status =           FX_IO_ERROR;
  105.         media_ptr -> fx_media_driver_buffer =           (media_ptr -> fx_media_sector_cache_list_ptr) -> fx_cached_sector_memory_buffer;
  106.         media_ptr -> fx_media_driver_logical_sector =   (media_ptr -> fx_media_sector_cache_list_ptr) -> fx_cached_sector;
  107.         media_ptr -> fx_media_driver_sectors =          1;
  108.         /* Invoke the driver to write the sector.  */
  109.         (media_ptr -> fx_media_driver_entry) (media_ptr);
  110.         /* Clear the written flag, if good status.  */
  111.         if (media_ptr -> fx_media_driver_status == FX_SUCCESS)
  112.         {
  113.             /* Clear the dirty flag. */
  114.             (media_ptr -> fx_media_sector_cache_list_ptr) -> fx_cached_sector_buffer_dirty =  FX_FALSE;
  115.         }
  116.         /* Return a driver status.  */
  117.         return(media_ptr -> fx_media_driver_status);
  118.     }
  119.     /* Return successful status.  */
  120.     return(FX_SUCCESS);
  121. }
  122. #endif