Mercurial > games > semicongine
comparison fuhtark_test/include/ddk/ioaccess.h @ 1500:91c8c3b7cbf0
add: futhark tests for generating vulkan api
| author | sam <sam@basx.dev> |
|---|---|
| date | Wed, 26 Nov 2025 21:36:48 +0700 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1499:1f58458b7ef7 | 1500:91c8c3b7cbf0 |
|---|---|
| 1 /* | |
| 2 * ioaccess.h | |
| 3 * | |
| 4 * Windows Device Driver Kit | |
| 5 * | |
| 6 * This file is part of the w32api package. | |
| 7 * | |
| 8 * THIS SOFTWARE IS NOT COPYRIGHTED | |
| 9 * | |
| 10 * This source code is offered for use in the public domain. You may | |
| 11 * use, modify or distribute it freely. | |
| 12 * | |
| 13 * This code is distributed in the hope that it will be useful but | |
| 14 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY | |
| 15 * DISCLAIMED. This includes but is not limited to warranties of | |
| 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
| 17 * | |
| 18 */ | |
| 19 #ifndef __IOACCESS_H | |
| 20 #define __IOACCESS_H | |
| 21 | |
| 22 #ifdef __cplusplus | |
| 23 extern "C" { | |
| 24 #endif | |
| 25 | |
| 26 #define H2I(p) PtrToUshort(p) | |
| 27 | |
| 28 #ifndef NO_PORT_MACROS | |
| 29 | |
| 30 #if defined(_X86_) || defined(_M_AMD64) | |
| 31 #define READ_REGISTER_UCHAR(r) (*(volatile UCHAR *)(r)) | |
| 32 #define READ_REGISTER_USHORT(r) (*(volatile USHORT *)(r)) | |
| 33 #define READ_REGISTER_ULONG(r) (*(volatile ULONG *)(r)) | |
| 34 #define WRITE_REGISTER_UCHAR(r, v) (*(volatile UCHAR *)(r) = (v)) | |
| 35 #define WRITE_REGISTER_USHORT(r, v) (*(volatile USHORT *)(r) = (v)) | |
| 36 #define WRITE_REGISTER_ULONG(r, v) (*(volatile ULONG *)(r) = (v)) | |
| 37 #define READ_PORT_UCHAR(p) (UCHAR)(__inbyte (H2I(p))) | |
| 38 #define READ_PORT_USHORT(p) (USHORT)(__inword (H2I(p))) | |
| 39 #define READ_PORT_ULONG(p) (ULONG)(__indword (H2I(p))) | |
| 40 #define WRITE_PORT_UCHAR(p, v) __outbyte (H2I(p), (v)) | |
| 41 #define WRITE_PORT_USHORT(p, v) __outword (H2I(p), (v)) | |
| 42 #define WRITE_PORT_ULONG(p, v) __outdword (H2I(p), (v)) | |
| 43 | |
| 44 #elif defined(_PPC_) || defined(_MIPS_) || defined(_ARM_) | |
| 45 | |
| 46 #define READ_REGISTER_UCHAR(r) (*(volatile UCHAR * const)(r)) | |
| 47 #define READ_REGISTER_USHORT(r) (*(volatile USHORT * const)(r)) | |
| 48 #define READ_REGISTER_ULONG(r) (*(volatile ULONG * const)(r)) | |
| 49 #define WRITE_REGISTER_UCHAR(r, v) (*(volatile UCHAR * const)(r) = (v)) | |
| 50 #define WRITE_REGISTER_USHORT(r, v) (*(volatile USHORT * const)(r) = (v)) | |
| 51 #define WRITE_REGISTER_ULONG(r, v) (*(volatile ULONG * const)(r) = (v)) | |
| 52 #define READ_PORT_UCHAR(r) READ_REGISTER_UCHAR(r) | |
| 53 #define READ_PORT_USHORT(r) READ_REGISTER_USHORT(r) | |
| 54 #define READ_PORT_ULONG(r) READ_REGISTER_ULONG(r) | |
| 55 #define WRITE_PORT_UCHAR(p, v) WRITE_REGISTER_UCHAR(p, (UCHAR) (v)) | |
| 56 #define WRITE_PORT_USHORT(p, v) WRITE_REGISTER_USHORT(p, (USHORT) (v)) | |
| 57 #define WRITE_PORT_ULONG(p, v) WRITE_REGISTER_ULONG(p, (ULONG) (v)) | |
| 58 | |
| 59 #else | |
| 60 | |
| 61 #error Unsupported architecture | |
| 62 | |
| 63 #endif | |
| 64 | |
| 65 #endif /* NO_PORT_MACROS */ | |
| 66 #endif /* __IOACCESS_H */ |
