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 /**   Utility                                                             */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 
23 /**************************************************************************/
24 /*                                                                        */
25 /*  COMPONENT DEFINITION                                   RELEASE        */
26 /*                                                                        */
27 /*    fx_utility.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 Utility component constants, data       */
36 /*    definitions, and external references.  It is assumed that fx_api.h  */
37 /*    (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_UTILITY_H
50 #define FX_UTILITY_H
51 
52 
53 /* Define the internal Utility component function prototypes.  */
54 
55 UINT    _fx_utility_16_unsigned_read(UCHAR *source_ptr);
56 VOID    _fx_utility_16_unsigned_write(UCHAR *dest_ptr, UINT value);
57 ULONG   _fx_utility_32_unsigned_read(UCHAR *source_ptr);
58 VOID    _fx_utility_32_unsigned_write(UCHAR *dest_ptr, ULONG value);
59 ULONG64 _fx_utility_64_unsigned_read(UCHAR *source_ptr);
60 VOID    _fx_utility_64_unsigned_write(UCHAR *dest_ptr, ULONG64 value);
61 VOID    _fx_utility_memory_copy(UCHAR *source_ptr, UCHAR *dest_ptr, ULONG size);
62 VOID    _fx_utility_memory_set(UCHAR *dest_ptr, UCHAR value, ULONG size);
63 FX_CACHED_SECTOR
64        *_fx_utility_logical_sector_cache_entry_read(FX_MEDIA *media_ptr, ULONG64 logical_sector, FX_CACHED_SECTOR **previous_cache_entry);
65 UINT    _fx_utility_logical_sector_read(FX_MEDIA *media_ptr, ULONG64 logical_sector,
66                                         VOID *buffer_ptr, ULONG sectors, UCHAR sector_type);
67 UINT    _fx_utility_logical_sector_write(FX_MEDIA *media_ptr, ULONG64 logical_sector,
68                                          VOID *buffer_ptr, ULONG sectors, UCHAR sector_type);
69 UINT    _fx_utility_logical_sector_flush(FX_MEDIA *media_ptr, ULONG64 starting_sector, ULONG64 sectors, UINT invalidate);
70 UINT    _fx_utility_FAT_entry_read(FX_MEDIA *media_ptr, ULONG cluster, ULONG *entry_ptr);
71 UINT    _fx_utility_FAT_entry_write(FX_MEDIA *media_ptr, ULONG cluster, ULONG next_cluster);
72 UINT    _fx_utility_FAT_flush(FX_MEDIA *media_ptr);
73 UINT    _fx_utility_FAT_map_flush(FX_MEDIA *media_ptr);
74 ULONG   _fx_utility_FAT_sector_get(FX_MEDIA *media_ptr, ULONG cluster);
75 UINT    _fx_utility_string_length_get(CHAR *string, UINT max_length);
76 
77 
78 
79 
80 #endif
81 
82