From: kosmirror <kos...@us...> - 2025-06-28 22:44:21
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via b50848f0ccc2c227f3cd90aeeb7c903016c6c45a (commit) via 19a74dd3f02dc6fdec3fa42dc9123e5293865355 (commit) via d099c4fefee1ac4a4c70f5a5d5740220b6b33a78 (commit) from 821ce865fd1bc51b6bd7c93800520ae76a52ecaf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b50848f0ccc2c227f3cd90aeeb7c903016c6c45a Author: QuzarDC <qu...@co...> Date: Sun Jun 22 19:36:28 2025 -0400 Clean up usage of packed attribute in addons. Both KOS and newlib provide `__packed` as a compatibility layer, no reason the addons should be operating differently. commit 19a74dd3f02dc6fdec3fa42dc9123e5293865355 Author: QuzarDC <qu...@co...> Date: Sun Jun 22 04:53:13 2025 -0400 Use regfield macros. This actually makes a difference in asic as there was a possibility of shifting up by 32, enough to be invalid for a signed int and the BIT macro enforces `1u`. commit d099c4fefee1ac4a4c70f5a5d5740220b6b33a78 Author: QuzarDC <qu...@co...> Date: Sat Jun 21 15:04:39 2025 -0400 Use `__is_aligned` and `__alignup` builtins. To note, I've applied them only when the param is a pointer. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/superblock.h | 2 +- addons/libkosfat/bpb.h | 10 +-- addons/libkosfat/directory.h | 4 +- addons/libkosutils/pcx_small.c | 2 +- addons/libppp/pap.c | 10 +-- addons/libppp/ppp_internal.h | 10 +-- kernel/arch/dreamcast/fs/fs_iso9660.c | 2 +- kernel/arch/dreamcast/hardware/asic.c | 7 +- kernel/arch/dreamcast/hardware/dmac.c | 2 +- kernel/arch/dreamcast/hardware/g2dma.c | 6 +- kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c | 4 +- kernel/arch/dreamcast/hardware/pvr/pvr_scene.c | 2 +- kernel/arch/dreamcast/hardware/scif-spi.c | 13 ++-- kernel/arch/dreamcast/hardware/spu.c | 2 +- kernel/arch/dreamcast/hardware/sq.c | 2 +- kernel/arch/dreamcast/include/dc/fifo.h | 14 ++-- .../arch/dreamcast/include/dc/maple/controller.h | 77 +++++++++++----------- kernel/arch/dreamcast/include/dc/maple/mouse.h | 7 +- kernel/arch/dreamcast/kernel/timer.c | 19 +++--- kernel/arch/dreamcast/kernel/wdt.c | 13 ++-- kernel/arch/dreamcast/sound/snd_stream.c | 8 +-- 21 files changed, 103 insertions(+), 113 deletions(-) diff --git a/addons/libkosext2fs/superblock.h b/addons/libkosext2fs/superblock.h index 65116f0f..e0dcdcd6 100644 --- a/addons/libkosext2fs/superblock.h +++ b/addons/libkosext2fs/superblock.h @@ -95,7 +95,7 @@ typedef struct ext2_superblock { uint32_t s_first_meta_bg; uint8_t unused[760]; -} __attribute__((packed)) ext2_superblock_t; +} __packed ext2_superblock_t; /* s_state values */ #define EXT2_VALID_FS 1 diff --git a/addons/libkosfat/bpb.h b/addons/libkosfat/bpb.h index b7ac1e95..64d0cc98 100644 --- a/addons/libkosfat/bpb.h +++ b/addons/libkosfat/bpb.h @@ -27,7 +27,7 @@ typedef struct fat_bpb { uint8_t num_heads[2]; uint8_t hidden_sector_count[4]; uint8_t num_sectors32[4]; -} __attribute__((packed)) fat_bpb_t; +} __packed fat_bpb_t; typedef struct fat16_ebpb { uint8_t drive_number; @@ -38,7 +38,7 @@ typedef struct fat16_ebpb { uint8_t fs_type[8]; uint8_t boot_code[448]; uint8_t boot_sig[2]; -} __attribute__((packed)) fat16_ebpb_t; +} __packed fat16_ebpb_t; typedef struct fat32_ebpb { uint8_t fat_size[4]; @@ -56,7 +56,7 @@ typedef struct fat32_ebpb { uint8_t fs_type[8]; uint8_t boot_code[420]; uint8_t boot_sig[2]; -} __attribute__((packed)) fat32_ebpb_t; +} __packed fat32_ebpb_t; typedef struct fat_bootblock { fat_bpb_t bpb; @@ -64,7 +64,7 @@ typedef struct fat_bootblock { fat16_ebpb_t fat16; fat32_ebpb_t fat32; } ebpb; -} __attribute__((packed,aligned(32))) fat_bootblock_t; +} __packed __attribute__((aligned(32))) fat_bootblock_t; typedef struct fat32_fsinfo { uint32_t fsinfo_sig1; @@ -74,7 +74,7 @@ typedef struct fat32_fsinfo { uint32_t last_alloc_cluster; uint8_t reserved2[12]; uint32_t fsinfo_sig3; -} __attribute__((packed,aligned(32))) fat32_fsinfo_t; +} __packed __attribute__((aligned(32))) fat32_fsinfo_t; #define FAT32_FSINFO_SIG1 0x41615252 #define FAT32_FSINFO_SIG2 0x61417272 diff --git a/addons/libkosfat/directory.h b/addons/libkosfat/directory.h index b938ef40..b78d6ea7 100644 --- a/addons/libkosfat/directory.h +++ b/addons/libkosfat/directory.h @@ -27,7 +27,7 @@ typedef struct fat_dentry { uint16_t mdate; uint16_t cluster_low; uint32_t size; -} __attribute__((packed)) fat_dentry_t; +} __packed fat_dentry_t; #define FAT_ENTRY_EOD 0x00 #define FAT_ENTRY_FREE 0xE5 @@ -54,7 +54,7 @@ typedef struct fat_longname { uint8_t name2[12]; uint16_t cluster_low; uint8_t name3[4]; -} __attribute__((packed)) fat_longname_t; +} __packed fat_longname_t; #define FAT_ORDER_LAST 0x40 diff --git a/addons/libkosutils/pcx_small.c b/addons/libkosutils/pcx_small.c index 7f8ce79c..0dc8faa6 100644 --- a/addons/libkosutils/pcx_small.c +++ b/addons/libkosutils/pcx_small.c @@ -27,7 +27,7 @@ typedef struct { uint16 bpl; /* bytes per line, 80 in mode 0x13 */ uint16 pltype; /* Grey or Color palette flag */ char filler[58]; /* Zsoft wanted a 128 byte header */ -} __attribute__((packed)) pcx_hdr; +} __packed pcx_hdr; /* This version converts directly into 16-bit BGR data */ int pcx_load_flat(const char *fn, int *w_out, int *h_out, void *pic_out) { diff --git a/addons/libppp/pap.c b/addons/libppp/pap.c index 5255ae1c..b4a58241 100644 --- a/addons/libppp/pap.c +++ b/addons/libppp/pap.c @@ -23,20 +23,12 @@ static int resend_cnt; #define PAP_AUTHENTICATE_ACK 2 #define PAP_AUTHENTICATE_NAK 3 -#ifdef PACKED -#undef PACKED -#endif - -#define PACKED __attribute__((packed)) - typedef struct pap_packet { uint8_t code; uint8_t id; uint16_t len; uint8_t data[]; -} PACKED pap_pkt_t; - -#undef PACKED +} __packed pap_pkt_t; static int pap_send_auth_req(ppp_protocol_t *self, int resend) { int nl = strlen(ppp_state->username); diff --git a/addons/libppp/ppp_internal.h b/addons/libppp/ppp_internal.h index 2f4cf018..7f8d66ac 100644 --- a/addons/libppp/ppp_internal.h +++ b/addons/libppp/ppp_internal.h @@ -69,24 +69,16 @@ typedef struct ppp_state { #define PPP_PROTOCOL_PAP 0xc023 /* RFC 1334 */ #define PPP_PROTOCOL_CHAP 0xc223 /* RFC 1994 */ -#ifdef PACKED -#undef PACKED -#endif - -#define PACKED __attribute__((packed)) - /* LCP packet structure - RFC 1661 Section 5 */ typedef struct lcp_packet { uint8_t code; uint8_t id; uint16_t len; uint8_t data[]; -} PACKED lcp_pkt_t; +} __packed lcp_pkt_t; typedef struct lcp_packet ipcp_pkt_t; -#undef PACKED - /* LCP Packet codes - RFC 1661 Section 5 Note: These also apply (in part) to network control protocols like IPCP. */ #define LCP_CONFIGURE_REQUEST 1 diff --git a/kernel/arch/dreamcast/fs/fs_iso9660.c b/kernel/arch/dreamcast/fs/fs_iso9660.c index c8a1aaba..5fbd4d74 100644 --- a/kernel/arch/dreamcast/fs/fs_iso9660.c +++ b/kernel/arch/dreamcast/fs/fs_iso9660.c @@ -690,7 +690,7 @@ static ssize_t iso_read(void * h, void *buf, size_t bytes) { /* If we're on a sector boundary and we have more than one full sector to read, then short-circuit the cache here and use the multi-sector reads from the CD unit. */ - if(thissect == 2048 && toread >= 2048 && (((uintptr_t)outbuf) & 31) == 0) { + if(thissect == 2048 && toread >= 2048 && __is_aligned(outbuf, 32)) { /* Round it off to an even sector count. */ thissect = toread / 2048; toread = thissect * 2048; diff --git a/kernel/arch/dreamcast/hardware/asic.c b/kernel/arch/dreamcast/hardware/asic.c index e9f78b0b..30c610e4 100644 --- a/kernel/arch/dreamcast/hardware/asic.c +++ b/kernel/arch/dreamcast/hardware/asic.c @@ -102,6 +102,7 @@ #include <dc/asic.h> #include <arch/spinlock.h> #include <kos/genwait.h> +#include <kos/regfield.h> #include <kos/worker_thread.h> /* XXX These based on g1ata.c and pvr.h and should be replaced by a standardized method */ @@ -167,7 +168,7 @@ static void handler_irq9(irq_t source, irq_context_t *context, void *data) { for(i = 0; i < ASIC_EVT_REG_HNDS; i++) { entry = &handlers[reg][i]; - if((mask & (1 << i)) && entry->hdl != NULL) + if((mask & BIT(i)) && entry->hdl != NULL) entry->hdl((reg << 8) | i, entry->data); } } @@ -195,7 +196,7 @@ void asic_evt_disable(uint16_t code, uint8_t irqlevel) { uint32_t addr = ASIC_EVT_REG_ADDR(irqlevel, evtreg); uint32_t val = IN32(addr); - OUT32(addr, val & ~(1 << evt)); + OUT32(addr, val & ~BIT(evt)); } /* Enable a particular G2 event */ @@ -209,7 +210,7 @@ void asic_evt_enable(uint16_t code, uint8_t irqlevel) { uint32_t addr = ASIC_EVT_REG_ADDR(irqlevel, evtreg); uint32_t val = IN32(addr); - OUT32(addr, val | (1 << evt)); + OUT32(addr, val | BIT(evt)); } /* Initialize events */ diff --git a/kernel/arch/dreamcast/hardware/dmac.c b/kernel/arch/dreamcast/hardware/dmac.c index aec59034..d674fbf7 100644 --- a/kernel/arch/dreamcast/hardware/dmac.c +++ b/kernel/arch/dreamcast/hardware/dmac.c @@ -129,7 +129,7 @@ int dma_transfer(const dma_config_t *cfg, dma_addr_t dst, dma_addr_t src, unsigned int transfer_size = dma_unit_size[cfg->unit_size]; uint32_t chcr; - if((len | dst | src) & (transfer_size - 1)) { + if(!__is_aligned(len | dst | src, transfer_size)) { dbglog(DBG_ERROR, "dmac: src/dst/len not aligned to the bus width\n"); errno = EFAULT; return -1; diff --git a/kernel/arch/dreamcast/hardware/g2dma.c b/kernel/arch/dreamcast/hardware/g2dma.c index ed37533d..e8ae8e12 100644 --- a/kernel/arch/dreamcast/hardware/g2dma.c +++ b/kernel/arch/dreamcast/hardware/g2dma.c @@ -173,13 +173,13 @@ int g2_dma_transfer(void *sh4, void *g2bus, size_t length, uint32_t block, } /* Check alignments */ - if(((uint32_t)sh4) & 31) { + if(!__is_aligned(sh4, 32)) { dbglog(DBG_ERROR, "g2_dma: Unaligned sh4 DMA %p\n", sh4); errno = EFAULT; return -1; } - if(((uint32_t)g2bus) & 31) { + if(!__is_aligned(g2bus, 32)) { dbglog(DBG_ERROR, "g2_dma: Unaligned g2bus DMA %p\n", g2bus); errno = EFAULT; return -1; @@ -193,7 +193,7 @@ int g2_dma_transfer(void *sh4, void *g2bus, size_t length, uint32_t block, dma_progress[g2chn] = 1; /* Make sure length is a multiple of 32 */ - length = (length + 0x1f) & ~0x1f; + length = __align_up(length, 32); dma_blocking[g2chn] = block; dma_callback[g2chn] = callback; diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c b/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c index 8652b61b..7000e75d 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c @@ -149,9 +149,7 @@ available texture RAM, the PVR structures for the two frames are broken up and placed at 0x000000 and 0x400000. */ -#define BUF_ALIGN 128 -#define BUF_ALIGN_MASK (BUF_ALIGN - 1) -#define APPLY_ALIGNMENT(addr) (((addr) + BUF_ALIGN_MASK) & ~BUF_ALIGN_MASK) +#define APPLY_ALIGNMENT(addr) __align_up(addr, 128) void pvr_allocate_buffers(const pvr_init_params_t *params) { volatile pvr_ta_buffers_t *buf; diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c b/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c index 9bdc6746..69fa89a9 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c @@ -48,7 +48,7 @@ void *pvr_set_vertbuf(pvr_list_t list, void *buffer, size_t len) { assert(pvr_state.lists_enabled & BIT(list)); // Make sure the buffer parameters are valid. - assert(!(((uintptr_t)buffer) & 31)); + assert(__is_aligned(buffer, 32)); assert(!(len & 63)); // Save the old value. diff --git a/kernel/arch/dreamcast/hardware/scif-spi.c b/kernel/arch/dreamcast/hardware/scif-spi.c index cef162b1..0485a9e5 100644 --- a/kernel/arch/dreamcast/hardware/scif-spi.c +++ b/kernel/arch/dreamcast/hardware/scif-spi.c @@ -10,6 +10,7 @@ #include <dc/fs_dcload.h> #include <arch/timer.h> #include <kos/dbglog.h> +#include <kos/regfield.h> /* SCIF registers */ #define SCIFREG08(x) *((volatile uint8 *)(x)) @@ -26,12 +27,12 @@ #define SCLSR2 SCIFREG16(0xffe80024) /* Values for the SCSPTR2 register */ -#define PTR2_RTSIO (1 << 7) -#define PTR2_RTSDT (1 << 6) -#define PTR2_CTSIO (1 << 5) -#define PTR2_CTSDT (1 << 4) -#define PTR2_SPB2IO (1 << 1) -#define PTR2_SPB2DT (1 << 0) +#define PTR2_RTSIO BIT(7) +#define PTR2_RTSDT BIT(6) +#define PTR2_CTSIO BIT(5) +#define PTR2_CTSDT BIT(4) +#define PTR2_SPB2IO BIT(1) +#define PTR2_SPB2DT BIT(0) /* This doesn't seem to actually be necessary on any of the SD cards I've tried, but I'm keeping it around, just in case... */ diff --git a/kernel/arch/dreamcast/hardware/spu.c b/kernel/arch/dreamcast/hardware/spu.c index e5db35f5..21e55966 100644 --- a/kernel/arch/dreamcast/hardware/spu.c +++ b/kernel/arch/dreamcast/hardware/spu.c @@ -121,7 +121,7 @@ void spu_memload_dma(uintptr_t dst, void *src_void, size_t length) { spu_memload(dst, src_void, length); return; } - if(((uintptr_t)src_void) & 31) { + if(!__is_aligned(src_void, 32)) { spu_memload_sq(dst, src_void, length); return; } diff --git a/kernel/arch/dreamcast/hardware/sq.c b/kernel/arch/dreamcast/hardware/sq.c index 263038ba..53ae4427 100644 --- a/kernel/arch/dreamcast/hardware/sq.c +++ b/kernel/arch/dreamcast/hardware/sq.c @@ -142,7 +142,7 @@ __no_inline void *sq_cpy(void *dest, const void *src, size_t n) { n -= nb; /* If src is not 8-byte aligned, slow path */ - if ((uintptr_t)src & 7) { + if (!__is_aligned(src, 8)) { while(nb--) { dcache_pref_block(s + 8); /* Prefetch 32 bytes for next loop */ d[0] = *(s++); diff --git a/kernel/arch/dreamcast/include/dc/fifo.h b/kernel/arch/dreamcast/include/dc/fifo.h index 682e9b58..c029b7a5 100644 --- a/kernel/arch/dreamcast/include/dc/fifo.h +++ b/kernel/arch/dreamcast/include/dc/fifo.h @@ -21,6 +21,8 @@ #include <sys/cdefs.h> __BEGIN_DECLS +#include <kos/regfield.h> + /** \defgroup system_fifo FIFO \brief API for checking FIFO statuses \ingroup system @@ -46,12 +48,12 @@ __BEGIN_DECLS @{ */ -#define FIFO_AICA (1 << 0) /** \brief AICA FIFO status mask. */ -#define FIFO_BBA (1 << 1) /** \brief BBA FIFO status mask. */ -#define FIFO_EXT2 (1 << 2) /** \brief EXT2 FIFO status mask. */ -#define FIFO_EXTDEV (1 << 3) /** \brief EXTDEV FIFO status mask. */ -#define FIFO_G2 (1 << 4) /** \brief G2 FIFO status mask. */ -#define FIFO_SH4 (1 << 5) /** \brief SH4 FIFO status mask. */ +#define FIFO_AICA BIT(0) /** \brief AICA FIFO status mask. */ +#define FIFO_BBA BIT(1) /** \brief BBA FIFO status mask. */ +#define FIFO_EXT2 BIT(2) /** \brief EXT2 FIFO status mask. */ +#define FIFO_EXTDEV BIT(3) /** \brief EXTDEV FIFO status mask. */ +#define FIFO_G2 BIT(4) /** \brief G2 FIFO status mask. */ +#define FIFO_SH4 BIT(5) /** \brief SH4 FIFO status mask. */ /** @} */ diff --git a/kernel/arch/dreamcast/include/dc/maple/controller.h b/kernel/arch/dreamcast/include/dc/maple/controller.h index c5450091..22034888 100644 --- a/kernel/arch/dreamcast/include/dc/maple/controller.h +++ b/kernel/arch/dreamcast/include/dc/maple/controller.h @@ -28,6 +28,7 @@ __BEGIN_DECLS #include <stdint.h> +#include <kos/regfield.h> /** \defgroup controller Controller \brief Controller Maple Device API @@ -99,22 +100,22 @@ __BEGIN_DECLS @{ */ -#define CONT_C (1<<0) /**< \brief C button Mask. */ -#define CONT_B (1<<1) /**< \brief B button Mask. */ -#define CONT_A (1<<2) /**< \brief A button Mask. */ -#define CONT_START (1<<3) /**< \brief Start button Mask. */ -#define CONT_DPAD_UP (1<<4) /**< \brief Main Dpad Up button Mask. */ -#define CONT_DPAD_DOWN (1<<5) /**< \brief Main Dpad Down button Mask. */ -#define CONT_DPAD_LEFT (1<<6) /**< \brief Main Dpad Left button Mask. */ -#define CONT_DPAD_RIGHT (1<<7) /**< \brief Main Dpad right button Mask. */ -#define CONT_Z (1<<8) /**< \brief Z button Mask. */ -#define CONT_Y (1<<9) /**< \brief Y button Mask. */ -#define CONT_X (1<<10) /**< \brief X button Mask. */ -#define CONT_D (1<<11) /**< \brief D button Mask. */ -#define CONT_DPAD2_UP (1<<12) /**< \brief Secondary Dpad Up button Mask. */ -#define CONT_DPAD2_DOWN (1<<13) /**< \brief Secondary Dpad Down button Mask. */ -#define CONT_DPAD2_LEFT (1<<14) /**< \brief Secondary Dpad Left button Mask. */ -#define CONT_DPAD2_RIGHT (1<<15) /**< \brief Secondary Dpad Right button Mask. */ +#define CONT_C BIT(0) /**< \brief C button Mask. */ +#define CONT_B BIT(1) /**< \brief B button Mask. */ +#define CONT_A BIT(2) /**< \brief A button Mask. */ +#define CONT_START BIT(3) /**< \brief Start button Mask. */ +#define CONT_DPAD_UP BIT(4) /**< \brief Main Dpad Up button Mask. */ +#define CONT_DPAD_DOWN BIT(5) /**< \brief Main Dpad Down button Mask. */ +#define CONT_DPAD_LEFT BIT(6) /**< \brief Main Dpad Left button Mask. */ +#define CONT_DPAD_RIGHT BIT(7) /**< \brief Main Dpad right button Mask. */ +#define CONT_Z BIT(8) /**< \brief Z button Mask. */ +#define CONT_Y BIT(9) /**< \brief Y button Mask. */ +#define CONT_X BIT(10) /**< \brief X button Mask. */ +#define CONT_D BIT(11) /**< \brief D button Mask. */ +#define CONT_DPAD2_UP BIT(12) /**< \brief Secondary Dpad Up button Mask. */ +#define CONT_DPAD2_DOWN BIT(13) /**< \brief Secondary Dpad Down button Mask. */ +#define CONT_DPAD2_LEFT BIT(14) /**< \brief Secondary Dpad Left button Mask. */ +#define CONT_DPAD2_RIGHT BIT(15) /**< \brief Secondary Dpad Right button Mask. */ /** @} */ /** \brief Controller buttons for standard reset action @@ -238,28 +239,28 @@ int cont_btn_callback(uint8_t addr, uint32_t btns, cont_btn_callback_t cb); @{ */ -#define CONT_CAPABILITY_C (1<<24) /**< \brief C button capability mask. */ -#define CONT_CAPABILITY_B (1<<25) /**< \brief B button capability mask. */ -#define CONT_CAPABILITY_A (1<<26) /**< \brief A button capability mask. */ -#define CONT_CAPABILITY_START (1<<27) /**< \brief Start button capability mask. */ -#define CONT_CAPABILITY_DPAD_UP (1<<28) /**< \brief First Dpad up capability mask. */ -#define CONT_CAPABILITY_DPAD_DOWN (1<<29) /**< \brief First Dpad down capability mask. */ -#define CONT_CAPABILITY_DPAD_LEFT (1<<30) /**< \brief First Dpad left capability mask. */ -#define CONT_CAPABILITY_DPAD_RIGHT (1<<31) /**< \brief First Dpad right capability mask. */ -#define CONT_CAPABILITY_Z (1<<16) /**< \brief Z button capability mask. */ -#define CONT_CAPABILITY_Y (1<<17) /**< \brief Y button capability mask. */ -#define CONT_CAPABILITY_X (1<<18) /**< \brief X button capability mask. */ -#define CONT_CAPABILITY_D (1<<19) /**< \brief D button capability mask. */ -#define CONT_CAPABILITY_DPAD2_UP (1<<20) /**< \brief Second Dpad up capability mask. */ -#define CONT_CAPABILITY_DPAD2_DOWN (1<<21) /**< \brief Second Dpad down capability mask. */ -#define CONT_CAPABILITY_DPAD2_LEFT (1<<22) /**< \brief Second Dpad left capability mask. */ -#define CONT_CAPABILITY_DPAD2_RIGHT (1<<23) /**< \brief Second Dpad right capability mask. */ -#define CONT_CAPABILITY_RTRIG (1<<8) /**< \brief Right trigger capability mask. */ -#define CONT_CAPABILITY_LTRIG (1<<9) /**< \brief Left trigger capability mask. */ -#define CONT_CAPABILITY_ANALOG_X (1<<10) /**< \brief First analog X axis capability mask. */ -#define CONT_CAPABILITY_ANALOG_Y (1<<11) /**< \brief First analog Y axis capability mask. */ -#define CONT_CAPABILITY_ANALOG2_X (1<<12) /**< \brief Second analog X axis capability mask. */ -#define CONT_CAPABILITY_ANALOG2_Y (1<<13) /**< \brief Second analog Y axis capability mask. */ +#define CONT_CAPABILITY_C BIT(24) /**< \brief C button capability mask. */ +#define CONT_CAPABILITY_B BIT(25) /**< \brief B button capability mask. */ +#define CONT_CAPABILITY_A BIT(26) /**< \brief A button capability mask. */ +#define CONT_CAPABILITY_START BIT(27) /**< \brief Start button capability mask. */ +#define CONT_CAPABILITY_DPAD_UP BIT(28) /**< \brief First Dpad up capability mask. */ +#define CONT_CAPABILITY_DPAD_DOWN BIT(29) /**< \brief First Dpad down capability mask. */ +#define CONT_CAPABILITY_DPAD_LEFT BIT(30) /**< \brief First Dpad left capability mask. */ +#define CONT_CAPABILITY_DPAD_RIGHT BIT(31) /**< \brief First Dpad right capability mask. */ +#define CONT_CAPABILITY_Z BIT(16) /**< \brief Z button capability mask. */ +#define CONT_CAPABILITY_Y BIT(17) /**< \brief Y button capability mask. */ +#define CONT_CAPABILITY_X BIT(18) /**< \brief X button capability mask. */ +#define CONT_CAPABILITY_D BIT(19) /**< \brief D button capability mask. */ +#define CONT_CAPABILITY_DPAD2_UP BIT(20) /**< \brief Second Dpad up capability mask. */ +#define CONT_CAPABILITY_DPAD2_DOWN BIT(21) /**< \brief Second Dpad down capability mask. */ +#define CONT_CAPABILITY_DPAD2_LEFT BIT(22) /**< \brief Second Dpad left capability mask. */ +#define CONT_CAPABILITY_DPAD2_RIGHT BIT(23) /**< \brief Second Dpad right capability mask. */ +#define CONT_CAPABILITY_RTRIG BIT(8) /**< \brief Right trigger capability mask. */ +#define CONT_CAPABILITY_LTRIG BIT(9) /**< \brief Left trigger capability mask. */ +#define CONT_CAPABILITY_ANALOG_X BIT(10) /**< \brief First analog X axis capability mask. */ +#define CONT_CAPABILITY_ANALOG_Y BIT(11) /**< \brief First analog Y axis capability mask. */ +#define CONT_CAPABILITY_ANALOG2_X BIT(12) /**< \brief Second analog X axis capability mask. */ +#define CONT_CAPABILITY_ANALOG2_Y BIT(13) /**< \brief Second analog Y axis capability mask. */ /** @} */ /** \defgroup controller_caps_groups Capability Groups diff --git a/kernel/arch/dreamcast/include/dc/maple/mouse.h b/kernel/arch/dreamcast/include/dc/maple/mouse.h index 31803f92..b10a4f01 100644 --- a/kernel/arch/dreamcast/include/dc/maple/mouse.h +++ b/kernel/arch/dreamcast/include/dc/maple/mouse.h @@ -23,6 +23,7 @@ __BEGIN_DECLS #include <stdint.h> +#include <kos/regfield.h> /** \defgroup mouse Mouse \brief Driver for the Dreamcast's Mouse Input Device @@ -37,9 +38,9 @@ __BEGIN_DECLS @{ */ -#define MOUSE_RIGHTBUTTON (1<<1) /**< \brief Right mouse button */ -#define MOUSE_LEFTBUTTON (1<<2) /**< \brief Left mouse button */ -#define MOUSE_SIDEBUTTON (1<<3) /**< \brief Side mouse button */ +#define MOUSE_RIGHTBUTTON BIT(1) /**< \brief Right mouse button */ +#define MOUSE_LEFTBUTTON BIT(2) /**< \brief Left mouse button */ +#define MOUSE_SIDEBUTTON BIT(3) /**< \brief Side mouse button */ /** @} */ ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |