1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** FileX Component                                                       */
16 /**                                                                       */
17 /**   System                                                              */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 
23 /**************************************************************************/
24 /*                                                                        */
25 /*  COMPONENT DEFINITION                                   RELEASE        */
26 /*                                                                        */
27 /*    fx_system.h                                         PORTABLE C      */
28 /*                                                           6.1          */
29 /*  AUTHOR                                                                */
30 /*                                                                        */
31 /*    William E. Lamie, Microsoft Corporation                             */
32 /*                                                                        */
33 /*  DESCRIPTION                                                           */
34 /*                                                                        */
35 /*    This file defines the FileX system constants and global data        */
36 /*    definitions, including external references.  It is assumed that     */
37 /*    fx_api.h (and fx_port.h) have already been included.                */
38 /*                                                                        */
39 /*  RELEASE HISTORY                                                       */
40 /*                                                                        */
41 /*    DATE              NAME                      DESCRIPTION             */
42 /*                                                                        */
43 /*  05-19-2020     William E. Lamie         Initial Version 6.0           */
44 /*  09-30-2020     William E. Lamie         Modified comment(s),          */
45 /*                                            resulting in version 6.1    */
46 /*                                                                        */
47 /**************************************************************************/
48 
49 #ifndef FX_SYSTEM_H
50 #define FX_SYSTEM_H
51 
52 
53 /* Define System component constants.  */
54 
55 #define FX_TIMER_ID                 ((ULONG) 0x46585359)
56 
57 
58 /* Define the external System component function prototypes.  */
59 
60 VOID _fx_system_initialize(VOID);
61 UINT _fx_system_date_set(UINT year, UINT month, UINT day);
62 UINT _fx_system_time_set(UINT hour, UINT minute, UINT second);
63 UINT _fx_system_date_get(UINT *year, UINT *month, UINT *day);
64 UINT _fx_system_time_get(UINT *hour, UINT *minute, UINT *second);
65 VOID _fx_system_timer_entry(ULONG id);
66 
67 UINT _fxe_system_date_set(UINT year, UINT month, UINT day);
68 UINT _fxe_system_time_set(UINT hour, UINT minute, UINT second);
69 UINT _fxe_system_date_get(UINT *year, UINT *month, UINT *day);
70 UINT _fxe_system_time_get(UINT *hour, UINT *minute, UINT *second);
71 
72 
73 /* System Component data declarations follow.  */
74 
75 /* Determine if the initialization function of this component is including
76    this file.  If so, make the data definitions really happen.  Otherwise,
77    make them extern so other functions in the component can access them.  */
78 
79 #ifdef FX_SYSTEM_INIT
80 #define SYSTEM_DECLARE
81 #else
82 #define SYSTEM_DECLARE extern
83 #endif
84 
85 
86 /* Define the head pointer of the opened media list.  */
87 
88 SYSTEM_DECLARE  FX_MEDIA  *_fx_system_media_opened_ptr;
89 
90 
91 /* Define the variable that holds the number of open media. */
92 
93 SYSTEM_DECLARE  ULONG  _fx_system_media_opened_count;
94 
95 
96 /* Define the system date variable.  */
97 
98 SYSTEM_DECLARE  UINT  _fx_system_date;
99 
100 
101 /* Define the system time variable.  */
102 
103 SYSTEM_DECLARE  UINT  _fx_system_time;
104 
105 
106 /* Define the variable that holds the maximum size of the sector cache.  */
107 
108 SYSTEM_DECLARE  ULONG  _fx_system_media_max_sector_cache;
109 
110 
111 /* Define the variable that holds the maximum size of the FAT cache.  */
112 
113 SYSTEM_DECLARE  ULONG  _fx_system_media_max_fat_cache;
114 
115 
116 /* Define the global FileX build options variables. These variables contain a bit
117    map representing how the FileX library was built. The following are the bit
118    field definitions:
119 
120     _fx_system_build_options_1:
121 
122                     Bit(s)                   Meaning
123 
124                     31-24               FX_MAX_LONG_NAME_LEN
125                     23-16               FX_MAX_LAST_NAME_LEN
126                     15-11               Reserved
127                     10                  FX_NO_TIMER defined
128                     9                   FX_SINGLE_THREAD defined
129                     8                   FX_DONT_UPDATE_OPEN_FILES defined
130                     7                   FX_MEDIA_DISABLE_SEARCH_CACHE defined
131                     6                   FX_MEDIA_STATISTICS_DISABLE defined
132                     5                   Reserved
133                     4                   FX_SINGLE_OPEN_LEGACY defined
134                     3                   FX_RENAME_PATH_INHERIT defined
135                     2                   FX_NO_LOCAL_PATH defined
136                     1                   FX_FAULT_TOLERANT_DATA defined
137                     0                   FX_FAULT_TOLERANT defined
138 
139     _fx_system_build_options_2:
140 
141                     Bit(s)                   Meaning
142 
143                     31-16               FX_MAX_SECTOR_CACHE
144                     15-8                FX_FAT_MAP_SIZE
145                     7-0                 FX_MAX_FAT_CACHE
146 
147     _fx_system_build_options_3:
148 
149                     Bit(s)                   Meaning
150 
151                     31-24               Reserved
152                     23-16               FX_UPDATE_RATE_IN_SECONDS
153                     15-0                FX_UPDATE_RATE_IN_TICKS
154 
155    Note that values greater than the value that can be represented in the build options
156    bit field are represented as all ones in the bit field. For example, if FX_MAX_LONG_NAME_LEN
157    is 256, the value in the bits 31-24 of _fx_system_build_options_1 is 0xFF, which is 255
158    decimal.  */
159 
160 SYSTEM_DECLARE  ULONG _fx_system_build_options_1;
161 SYSTEM_DECLARE  ULONG _fx_system_build_options_2;
162 SYSTEM_DECLARE  ULONG _fx_system_build_options_3;
163 
164 
165 /* Define system timer control block.  If accurate date/time stamps on
166    files is not needed, the define FX_NO_TIMER should be used when
167    compiling fx_system_initialize.c to eliminate the FileX timer.  */
168 
169 #ifndef FX_NO_TIMER
170 SYSTEM_DECLARE  TX_TIMER _fx_system_timer;
171 #endif
172 
173 #endif
174 
175