TianoCore EDK2 master
Loading...
Searching...
No Matches
LibFdtSupport.h
Go to the documentation of this file.
1
10#ifndef FDT_LIB_SUPPORT_H_
11#define FDT_LIB_SUPPORT_H_
12
13#include <Base.h>
14#include <Library/BaseLib.h>
16
17typedef UINT8 uint8_t;
18typedef UINT16 uint16_t;
19typedef INT32 int32_t;
20typedef UINT32 uint32_t;
21typedef UINT64 uint64_t;
22typedef UINTN uintptr_t;
23typedef UINTN size_t;
24typedef BOOLEAN bool;
25
26#define true (1 == 1)
27#define false (1 == 0)
28
29//
30// Definitions for global constants used by libfdt library routines
31//
32#define INT_MAX 0x7FFFFFFF /* Maximum (signed) int value */
33#define INT32_MAX 0x7FFFFFFF /* Maximum (signed) int32 value */
34#define UINT32_MAX 0xFFFFFFFF /* Maximum unsigned int32 value */
35
36//
37// Function prototypes of libfdt Library routines
38//
39void *
40memset (
41 void *,
42 int,
43 size_t
44 );
45
46int
47memcmp (
48 const void *,
49 const void *,
50 size_t
51 );
52
53int
54strcmp (
55 const char *,
56 const char *
57 );
58
59char *
60strchr (
61 const char *,
62 int
63 );
64
65char *
66fdt_strrchr (
67 const char *,
68 int
69 );
70
71unsigned long
72fdt_strtoul (
73 const char *,
74 char **,
75 int
76 );
77
78char *
79strcpy (
80 char *strDest,
81 const char *strSource
82 );
83
84//
85// Macros that directly map functions to BaseLib, BaseMemoryLib, and DebugLib functions
86//
87#define memcpy(dest, source, count) CopyMem(dest,source, (UINTN)(count))
88#define memset(dest, ch, count) SetMem(dest, (UINTN)(count),(UINT8)(ch))
89#define memchr(buf, ch, count) ScanMem8(buf, (UINTN)(count),(UINT8)ch)
90#define memcmp(buf1, buf2, count) (int)(CompareMem(buf1, buf2, (UINTN)(count)))
91#define memmove(dest, source, count) CopyMem(dest, source, (UINTN)(count))
92#define strlen(str) (size_t)(AsciiStrLen(str))
93#define strnlen(str, count) (size_t)(AsciiStrnLenS(str, count))
94#define strncpy(strDest, strSource, count) AsciiStrnCpyS(strDest, MAX_STRING_SIZE, strSource, (UINTN)count)
95#define strcat(strDest, strSource) AsciiStrCatS(strDest, MAX_STRING_SIZE, strSource)
96#define strchr(str, ch) ScanMem8(str, AsciiStrSize (str), (UINT8)ch)
97#define strcmp(string1, string2, count) (int)(AsciiStrCmp(string1, string2))
98#define strncmp(string1, string2, count) (int)(AsciiStrnCmp(string1, string2, (UINTN)(count)))
99#define strrchr(str, ch) fdt_strrchr(str, ch)
100#define strtoul(ptr, end_ptr, base) fdt_strtoul(ptr, end_ptr, base)
101
102#endif /* FDT_LIB_SUPPORT_H_ */
UINT64 UINTN