1c2c66affSColin Finck /******************************************************************************
2c2c66affSColin Finck  *
3c2c66affSColin Finck  * Name: accygwin.h - OS specific defines, etc. for cygwin environment
4c2c66affSColin Finck  *
5c2c66affSColin Finck  *****************************************************************************/
6c2c66affSColin Finck 
7c2c66affSColin Finck /*
8*03b24380SThomas Faber  * Copyright (C) 2000 - 2022, Intel Corp.
9c2c66affSColin Finck  * All rights reserved.
10c2c66affSColin Finck  *
11c2c66affSColin Finck  * Redistribution and use in source and binary forms, with or without
12c2c66affSColin Finck  * modification, are permitted provided that the following conditions
13c2c66affSColin Finck  * are met:
14c2c66affSColin Finck  * 1. Redistributions of source code must retain the above copyright
15c2c66affSColin Finck  *    notice, this list of conditions, and the following disclaimer,
16c2c66affSColin Finck  *    without modification.
17c2c66affSColin Finck  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18c2c66affSColin Finck  *    substantially similar to the "NO WARRANTY" disclaimer below
19c2c66affSColin Finck  *    ("Disclaimer") and any redistribution must be conditioned upon
20c2c66affSColin Finck  *    including a substantially similar Disclaimer requirement for further
21c2c66affSColin Finck  *    binary redistribution.
22c2c66affSColin Finck  * 3. Neither the names of the above-listed copyright holders nor the names
23c2c66affSColin Finck  *    of any contributors may be used to endorse or promote products derived
24c2c66affSColin Finck  *    from this software without specific prior written permission.
25c2c66affSColin Finck  *
26c2c66affSColin Finck  * Alternatively, this software may be distributed under the terms of the
27c2c66affSColin Finck  * GNU General Public License ("GPL") version 2 as published by the Free
28c2c66affSColin Finck  * Software Foundation.
29c2c66affSColin Finck  *
30c2c66affSColin Finck  * NO WARRANTY
31c2c66affSColin Finck  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32c2c66affSColin Finck  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
336eb8cc49SThomas Faber  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34c2c66affSColin Finck  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35c2c66affSColin Finck  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36c2c66affSColin Finck  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37c2c66affSColin Finck  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38c2c66affSColin Finck  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39c2c66affSColin Finck  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40c2c66affSColin Finck  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41c2c66affSColin Finck  * POSSIBILITY OF SUCH DAMAGES.
42c2c66affSColin Finck  */
43c2c66affSColin Finck 
44c2c66affSColin Finck #ifndef __ACCYGWIN_H__
45c2c66affSColin Finck #define __ACCYGWIN_H__
46c2c66affSColin Finck 
47c2c66affSColin Finck /*
48c2c66affSColin Finck  * ACPICA configuration
49c2c66affSColin Finck  */
50c2c66affSColin Finck #define ACPI_USE_STANDARD_HEADERS
51c2c66affSColin Finck #define ACPI_USE_SYSTEM_CLIBRARY
52c2c66affSColin Finck #define ACPI_USE_DO_WHILE_0
53c2c66affSColin Finck #define ACPI_FLUSH_CPU_CACHE()
54c2c66affSColin Finck 
55c2c66affSColin Finck /*
56c2c66affSColin Finck  * This is needed since sem_timedwait does not appear to work properly
57c2c66affSColin Finck  * on cygwin (always hangs forever).
58c2c66affSColin Finck  */
59c2c66affSColin Finck #define ACPI_USE_ALTERNATE_TIMEOUT
60c2c66affSColin Finck 
61c2c66affSColin Finck 
62c2c66affSColin Finck #ifdef ACPI_USE_STANDARD_HEADERS
63c2c66affSColin Finck #include <unistd.h>
64c2c66affSColin Finck #endif
65c2c66affSColin Finck 
66c2c66affSColin Finck #if defined(__ia64__) || defined(__x86_64__)
67c2c66affSColin Finck #define ACPI_MACHINE_WIDTH          64
68c2c66affSColin Finck #define COMPILER_DEPENDENT_INT64    long
69c2c66affSColin Finck #define COMPILER_DEPENDENT_UINT64   unsigned long
70c2c66affSColin Finck #else
71c2c66affSColin Finck #define ACPI_MACHINE_WIDTH          32
72c2c66affSColin Finck #define COMPILER_DEPENDENT_INT64    long long
73c2c66affSColin Finck #define COMPILER_DEPENDENT_UINT64   unsigned long long
74c2c66affSColin Finck #define ACPI_USE_NATIVE_DIVIDE
75c2c66affSColin Finck #define ACPI_USE_NATIVE_MATH64
76c2c66affSColin Finck #endif
77c2c66affSColin Finck 
78c2c66affSColin Finck #ifndef __cdecl
79c2c66affSColin Finck #define __cdecl
80c2c66affSColin Finck #endif
81c2c66affSColin Finck 
82c2c66affSColin Finck #define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) if (GLptr) Acq=1; else Acq=0;
83c2c66affSColin Finck #define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pending) Pending = 1
84c2c66affSColin Finck 
85c2c66affSColin Finck /* On Cygwin, pthread_t is a pointer */
86c2c66affSColin Finck 
87c2c66affSColin Finck #define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) ACPI_TO_INTEGER (pthread))
88c2c66affSColin Finck 
89c2c66affSColin Finck 
90c2c66affSColin Finck /*
91c2c66affSColin Finck  * The vsnprintf/snprintf functions are defined by c99, but cygwin/gcc
92c2c66affSColin Finck  * does not enable this prototype when the -ansi flag is set. Also related
93c2c66affSColin Finck  * to __STRICT_ANSI__. So, we just declare the prototype here.
94c2c66affSColin Finck  */
95c2c66affSColin Finck int
96c2c66affSColin Finck vsnprintf (char *s, size_t n, const char *format, va_list ap);
97c2c66affSColin Finck 
98c2c66affSColin Finck int
99c2c66affSColin Finck snprintf (char *s, size_t n, const char *format, ...);
100c2c66affSColin Finck 
101c2c66affSColin Finck #endif /* __ACCYGWIN_H__ */
102