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

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. /**   Directory (DIR)                                                     */
  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_dir.h"
  44. #include "PlaycoreFileSysFileXfx_fil.h"
  45. #include "PlaycoreFileSysFileXfx_uti.h"
  46. /**************************************************************************/ 
  47. /*                                                                        */ 
  48. /*  FUNCTION                                               RELEASE        */ 
  49. /*                                                                        */ 
  50. /*    _fx_directory_information_get                       PORTABLE C      */ 
  51. /*                                                           3.0          */ 
  52. /*  AUTHOR                                                                */ 
  53. /*                                                                        */ 
  54. /*    William E. Lamie, Express Logic, Inc.                               */ 
  55. /*                                                                        */ 
  56. /*  DESCRIPTION                                                           */ 
  57. /*                                                                        */ 
  58. /*    This function first attempts to find the specified directory name.  */ 
  59. /*    If found, the complete file parameters are placed in all non-null   */ 
  60. /*    return parameters.  If the file name is not found, the appropriate  */ 
  61. /*    error code is returned to the caller.                               */ 
  62. /*                                                                        */ 
  63. /*  INPUT                                                                 */ 
  64. /*                                                                        */ 
  65. /*    media_ptr                             Media control block pointer   */ 
  66. /*    directory_name                        Directory name pointer        */ 
  67. /*    attributes                            Pointer to attributes         */ 
  68. /*    size                                  Pointer to size               */ 
  69. /*    year                                  Pointer to year               */ 
  70. /*    month                                 Pointer to month              */ 
  71. /*    day                                   Pointer to day                */ 
  72. /*    hour                                  Pointer to hour               */ 
  73. /*    minute                                Pointer to minute             */ 
  74. /*    second                                Pointer to second             */ 
  75. /*                                                                        */ 
  76. /*  OUTPUT                                                                */ 
  77. /*                                                                        */ 
  78. /*    return status                                                       */ 
  79. /*                                                                        */ 
  80. /*  CALLS                                                                 */ 
  81. /*                                                                        */ 
  82. /*    _fx_directory_search                  Search for the file name in   */ 
  83. /*                                          the directory structure       */ 
  84. /*                                                                        */ 
  85. /*  CALLED BY                                                             */ 
  86. /*                                                                        */ 
  87. /*    Application Code                                                    */ 
  88. /*                                                                        */ 
  89. /*  RELEASE HISTORY                                                       */ 
  90. /*                                                                        */ 
  91. /*    DATE              NAME                      DESCRIPTION             */ 
  92. /*                                                                        */ 
  93. /*  01-01-1999     William E. Lamie         Initial Version 1.0           */ 
  94. /*  03-01-2000     William E. Lamie         Modified comment(s), and      */ 
  95. /*                                            corrected problem returning */ 
  96. /*                                            half-seconds instead of     */ 
  97. /*                                            seconds, resulting in       */ 
  98. /*                                            version 1.0b.               */ 
  99. /*  01-28-2001     William E. Lamie         Modified comment(s),          */ 
  100. /*                                            resulting in version 2.0.   */ 
  101. /*  03-01-2002     William E. Lamie         Modified comment(s),          */ 
  102. /*                                            resulting in version 3.0.   */ 
  103. /*                                                                        */ 
  104. /**************************************************************************/ 
  105. UINT  _fx_directory_information_get(FX_MEDIA *media_ptr, CHAR *directory_name,
  106.                             UINT *attributes, ULONG *size,
  107.                             UINT *year, UINT *month, UINT *day, 
  108.                             UINT *hour, UINT *minute, UINT *second)
  109. {
  110. UINT            status;
  111. FX_DIR_ENTRY    dir_entry;
  112.     /* Check the media to make sure it is open.  */
  113.     if (media_ptr -> fx_media_id != FX_MEDIA_ID)
  114.     {
  115.         /* Return the media not opened error.  */
  116.         return(FX_MEDIA_NOT_OPEN);
  117.     }
  118.     /* Protect against other threads accessing the media.  */
  119.     FX_PROTECT
  120.     /* Search the system for the supplied directory name.  */
  121.     status =  _fx_directory_search(media_ptr, directory_name, &dir_entry, FX_NULL, FX_NULL);
  122.     /* Determine if the search was successful.  */
  123.     if (status != FX_SUCCESS)
  124.     {
  125.         /* Release media protection.  */
  126.         FX_UNPROTECT
  127.         /* Return the error code.  */
  128.         return(status);
  129.     }
  130.     /* Check to see if attributes are required.  */
  131.     if (attributes)
  132.     {
  133.         /* Pickup the attributes.  */
  134.         *attributes =  dir_entry.fx_dir_entry_attributes;
  135.     }
  136.     /* Check to see if the size is required.  */
  137.     if (size)
  138.     {
  139.         /* Pickup the size.  */
  140.         *size =  dir_entry.fx_dir_entry_file_size;
  141.     }
  142.     /* Check to see if the year is required.  */
  143.     if (year)
  144.     {
  145.         /* Pickup the year.  */
  146.         *year =  ((dir_entry.fx_dir_entry_date >> FX_YEAR_SHIFT) & FX_YEAR_MASK) +
  147.                                                                         FX_BASE_YEAR;
  148.     }
  149.     /* Check to see if the month is required.  */
  150.     if (month)
  151.     {
  152.         /* Pickup the month.  */
  153.         *month =  (dir_entry.fx_dir_entry_date >> FX_MONTH_SHIFT) & FX_MONTH_MASK;
  154.     }
  155.     /* Check to see if the day is required.  */
  156.     if (day)
  157.     {
  158.         /* Pickup the day.  */
  159.         *day =  dir_entry.fx_dir_entry_date & FX_DAY_MASK;
  160.     }
  161.     /* Check to see if the hour is required.  */
  162.     if (hour)
  163.     {
  164.         /* Pickup the hour.  */
  165.         *hour =  (dir_entry.fx_dir_entry_time >> FX_HOUR_SHIFT) & FX_HOUR_MASK;
  166.     }
  167.     /* Check to see if the minute is required.  */
  168.     if (minute)
  169.     {
  170.         /* Pickup the minute.  */
  171.         *minute =  (dir_entry.fx_dir_entry_time >> FX_MINUTE_SHIFT) & FX_MINUTE_MASK;
  172.     }
  173.     /* Check to see if the second is required.  */
  174.     if (second)
  175.     {
  176.         /* Pickup the second.  */
  177.         *second =  (dir_entry.fx_dir_entry_time & FX_SECOND_MASK) * 2;
  178.     }
  179.     /* Release media protection.  */
  180.     FX_UNPROTECT
  181.     /* Directory information get is complete, return successful status.  */
  182.     return(FX_SUCCESS);
  183. }
  184. #endif