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

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. /**   Port Specific                                                       */
  29. /**                                                                       */
  30. /**************************************************************************/
  31. /**************************************************************************/
  32. /**************************************************************************/ 
  33. /*                                                                        */ 
  34. /*  PORT SPECIFIC C INFORMATION                            RELEASE        */ 
  35. /*                                                                        */ 
  36. /*    fx_port.h                                       LX4180/Green Hills  */ 
  37. /*                                                           3.0          */ 
  38. /*                                                                        */
  39. /*  AUTHOR                                                                */ 
  40. /*                                                                        */ 
  41. /*    William E. Lamie, Express Logic, Inc.                               */ 
  42. /*                                                                        */ 
  43. /*  DESCRIPTION                                                           */ 
  44. /*                                                                        */ 
  45. /*    This file contains data type definitions that make the FileX MS-DOS */ 
  46. /*    compatible file system function identically on a variety of         */ 
  47. /*    different processor architectures.  For example, the byte offset of */ 
  48. /*    various entries in the boot record, and directory entries are       */ 
  49. /*    defined in this file.                                               */ 
  50. /*                                                                        */ 
  51. /*  RELEASE HISTORY                                                       */ 
  52. /*                                                                        */ 
  53. /*    DATE              NAME                      DESCRIPTION             */ 
  54. /*                                                                        */ 
  55. /*  01-28-2001     William E. Lamie         Initial LX4180/Green Hills    */
  56. /*                                            Support Version 2.0         */
  57. /*  03-01-2002     William E. Lamie         Modified comment(s), added    */ 
  58. /*                                            FAT32 constants, and        */ 
  59. /*                                            changed version string,     */ 
  60. /*                                            resulting in version 3.0.   */ 
  61. /*                                                                        */ 
  62. /**************************************************************************/ 
  63. #ifndef FX_PORT
  64. #define FX_PORT
  65. #include "Includesysdefs.h"
  66. /* Definitions of types used throughout the FileX lib */
  67. #define USHORT UINT16
  68. #define UCHAR_PTR PBYTE
  69. #define CHAR_PTR LPSTR
  70. #define UCHAR BYTE
  71. #define PCHAR LPSTR
  72. #define VOID void
  73. #define PULONG ULONG*
  74. /*
  75. #define FX_NO_LOCAL_PATH
  76. #define FX_NO_TIMER
  77. */
  78. /* Define various constants for the port.  */ 
  79. /**************************************************************************/
  80. /*                                                                        */
  81. /* Define constants for the MS-DOS master boot record,                    */ 
  82. /*                                          which is defined as follows:  */ 
  83. /*                                                                        */ 
  84. /*          Byte Offset         Meaning             Size                  */ 
  85. /*                                                                        */ 
  86. /*            0x000         Reserved                 446                  */ 
  87. /*            0x1BE         Boot indicator  0        1                    */ 
  88. /*            0x1BF         Start CHS       0        3                    */ 
  89. /*            0x1C2         Partition type  0        1                    */ 
  90. /*            0x1C3         End CHS         0        3                    */ 
  91. /*            0x1C6         Partition start 0        4                    */ 
  92. /*            0x1CA         Partition size  0        4                    */ 
  93. /*            0x1CE         Boot indicator  1        1                    */ 
  94. /*            0x1CF         Start CHS       1        3                    */ 
  95. /*            0x1D2         Partition type  1        1                    */ 
  96. /*            0x1D3         End CHS         1        3                    */ 
  97. /*            0x1D6         Partition start 1        4                    */ 
  98. /*            0x1DA         Partition size  1        4                    */ 
  99. /*            0x1DE         Boot indicator  2        1                    */ 
  100. /*            0x1DF         Start CHS       2        3                    */ 
  101. /*            0x1E2         Partition type  2        1                    */ 
  102. /*            0x1E3         End CHS         2        3                    */ 
  103. /*            0x1E6         Partition start 2        4                    */ 
  104. /*            0x1EA         Partition size  2        4                    */ 
  105. /*            0x1EE         Boot indicator  3        1                    */ 
  106. /*            0x1EF         Start CHS       3        3                    */ 
  107. /*            0x1F2         Partition type  3        1                    */ 
  108. /*            0x1F3         End CHS         3        3                    */ 
  109. /*            0x1F6         Partition start 3        4                    */ 
  110. /*            0x1FA         Partition size  3        4                    */ 
  111. /*            0x1FE         Signature (0x55aa)       2                    */
  112. /*                                                                        */  
  113. /**************************************************************************/
  114. #define FX_JUMP_INSTR       0x000
  115. #define FX_OEM_NAME         0x003
  116. #define FX_BYTES_SECTOR     0x00B
  117. #define FX_SECTORS_CLUSTER  0x00D
  118. #define FX_RESERVED_SECTORS 0x00E
  119. #define FX_NUMBER_OF_FATS   0x010
  120. #define FX_ROOT_DIR_ENTRIES 0x011
  121. #define FX_SECTORS          0x013
  122. #define FX_MEDIA_TYPE       0x015
  123. #define FX_SECTORS_PER_FAT  0x016
  124. #define FX_SECTORS_PER_TRK  0x018
  125. #define FX_HEADS            0x01A
  126. #define FX_HIDDEN_SECTORS   0x01C
  127. #define FX_HUGE_SECTORS     0x020
  128. #define FX_DRIVE_NUMBER     0x024
  129. #define FX_RESERVED         0x025
  130. #define FX_BOOT_SIG         0x026
  131. #define FX_VOLUME_ID        0x027
  132. #define FX_VOLUME_LABEL     0x02B
  133. #define FX_FILE_SYSTEM_TYPE 0x036
  134. #define FX_SIG_OFFSET       0x1FE
  135. #define FX_ROOT_CLUS_32        0x02C
  136. #define FX_SECTORS_PER_FAT_32  0x024
  137. #define FX_SIG_BYTE_1       0x55
  138. #define FX_SIG_BYTE_2       0xAA
  139. #define FX_PARTITION_SIG_OFFSET     0x1FE
  140. /**************************************************************************/
  141. /*                                                                        */
  142. /* Define constants for the MS-DOS boot record,                           */ 
  143. /*                                          which is defined as follows:  */ 
  144. /*                                                                        */ 
  145. /*          Byte Offset         Meaning             Size                  */ 
  146. /*                                                                        */ 
  147. /*            0x000         Jump Instructions        3                    */ 
  148. /*            0x003         OEM Name                 8                    */ 
  149. /*            0x00B         Bytes per Sector         2                    */ 
  150. /*            0x00D         Sectors per Cluster      1                    */ 
  151. /*            0x00E         Reserved Sectors         2                    */ 
  152. /*            0x010         Number of FATs           1                    */ 
  153. /*            0x011         Max Root Dir Entries     2                    */ 
  154. /*            0x013         Number of Sectors        2                    */ 
  155. /*            0x015         Media Type               1                    */ 
  156. /*            0x016         Sectors per FAT          2                    */ 
  157. /*            0x018         Sectors per Track        2                    */ 
  158. /*            0x01A         Number of Heads          2                    */ 
  159. /*            0x01C         Hidden Sectors           4                    */ 
  160. /*            0x020         Huge Sectors             4                    */ 
  161. /*            0x024         Drive Number             1                    */ 
  162. /*            0x025         Reserved                 1                    */ 
  163. /*            0x026         Boot Signature           1                    */ 
  164. /*            0x027         Volume ID                4                    */ 
  165. /*            0x02B         Volume Label             11                   */ 
  166. /*            0x036         File System Type         8                    */ 
  167. /*             ...              ...                 ...                   */ 
  168. /*            0x1FE         Signature (0x55aa)       2                    */
  169. /*                                                                        */  
  170. /**************************************************************************/
  171. /* Define FAT constants.  */
  172. #define FX_MAX_12BIT_CLUST  0x0FF0
  173. #define FX_SIGN_EXTEND      0xF000
  174. /* Define FileX internal protection macros.  If FX_SINGLE_THREAD is defined,
  175.    these protection macros are effectively disabled.  However, for non-single
  176.    threaded uses, the macros are setup to utilize ThreadX semaphores for 
  177.    multiple thread access control into an open media.  */
  178. #ifdef  FX_SINGLE_THREAD
  179. #define FX_PROTECT                   
  180. #define FX_UNPROTECT
  181. #else
  182. #define FX_PROTECT              os_semaphore_obtain(&(media_ptr -> fx_media_protect),1);
  183. #define FX_UNPROTECT            os_semaphore_release(&(media_ptr -> fx_media_protect));
  184. #endif
  185. #ifndef WIN32
  186. /* Define interrupt lockout constructs to protect the system date/time from being updated
  187.    while they are being read.  */
  188. #define FX_INT_SAVE_AREA        unsigned int  old_interrupt_posture;
  189. #define FX_DISABLE_INTS         
  190. #define FX_RESTORE_INTS         
  191. /* Define the error checking logic to determine if there is a caller error in the FileX API.  
  192.    The default definitions assume ThreadX is being used.  This code can be completely turned 
  193.    off by just defining these macros to white space.  */
  194. #define FX_CALLER_CHECKING_EXTERNS      
  195. #define FX_CALLER_CHECKING_CODE         
  196. #else
  197. /* Define interrupt lockout constructs to protect the system date/time from being updated
  198.    while they are being read.  */
  199. #define FX_INT_SAVE_AREA
  200. #define FX_DISABLE_INTS
  201. #define FX_RESTORE_INTS
  202. /* Define the error checking logic to determine if there is a caller error in the FileX API.  
  203.    The default definitions assume ThreadX is being used.  This code can be completely turned 
  204.    off by just defining these macros to white space.  */
  205. #define FX_CALLER_CHECKING_EXTERNS
  206. #define FX_CALLER_CHECKING_CODE
  207. #endif
  208. /* Define the update rate of the system timer.  These values may also be defined at the command
  209.    line when compiling the fx_si.c module in the FileX library build.  Alternatively, they can
  210.    be modified in this file.  Note: the update rate must be an even number of seconds greater
  211.    than or equal to 2, which is the minimal update rate for MS-DOS time. */
  212. #ifndef FX_UPDATE_RATE_IN_SECONDS
  213. #define FX_UPDATE_RATE_IN_SECONDS   10     /* Update time at 10 second intervals */
  214. #endif
  215. #ifndef FX_UPDATE_RATE_IN_TICKS
  216. #define FX_UPDATE_RATE_IN_TICKS     180    /* Same update rate, but in ticks  */
  217. #endif
  218. #endif