add misc definitions / asserts

This commit is contained in:
Zack Buhman 2023-06-02 15:46:30 -07:00
parent e40fade736
commit 949116b285
4 changed files with 10 additions and 2 deletions

5
scsp.h
View File

@ -90,7 +90,7 @@ typedef struct scsp_ctrl {
static_assert((sizeof (struct scsp_ctrl)) == 0x30); static_assert((sizeof (struct scsp_ctrl)) == 0x30);
static_assert((offsetof (struct scsp_ctrl, STATUS)) == 0x08); static_assert((offsetof (struct scsp_ctrl, STATUS)) == 0x08);
static_assert((offsetof (struct scsp_ctrl, DMEA)) == 0x12); static_assert((offsetof (struct scsp_ctrl, DMAL)) == 0x12);
static_assert((offsetof (struct scsp_ctrl, MCIRE)) == 0x2e); static_assert((offsetof (struct scsp_ctrl, MCIRE)) == 0x2e);
typedef struct scsp_dsp_lh { typedef struct scsp_dsp_lh {
@ -154,6 +154,7 @@ extern struct scsp scsp __asm("scsp");
static_assert((sizeof (struct scsp)) == 0x100ee4); static_assert((sizeof (struct scsp)) == 0x100ee4);
static_assert((offsetof (struct scsp, ram)) == 0x000000); static_assert((offsetof (struct scsp, ram)) == 0x000000);
static_assert((offsetof (struct scsp, reg)) == 0x100000); static_assert((offsetof (struct scsp, reg)) == 0x100000);
static_assert((sizeof (scsp.reg.dsp.STEP)) == 0x400);
// bits // bits
@ -247,7 +248,7 @@ enum mixer_bits {
#define PITCH__FNS(n) (((n) & 0x3ff) << 0 ) #define PITCH__FNS(n) (((n) & 0x3ff) << 0 )
//}; //};
enum master_bits { enum scsp_bits {
MIXER__MEM4MB = (1 << 9), MIXER__MEM4MB = (1 << 9),
MIXER__DAC18B = (1 << 8), MIXER__DAC18B = (1 << 8),
#define MIXER__MVOL(n) ((n) << 0) #define MIXER__MVOL(n) ((n) << 0)

1
scu.h
View File

@ -58,6 +58,7 @@ typedef struct scu_reg {
static_assert((sizeof (struct scu_reg)) == 0xD0); static_assert((sizeof (struct scu_reg)) == 0xD0);
static_assert((offsetof (struct scu_reg, D1R)) == 0x20); static_assert((offsetof (struct scu_reg, D1R)) == 0x20);
static_assert((offsetof (struct scu_reg, AIACK)) == 0xA8); static_assert((offsetof (struct scu_reg, AIACK)) == 0xA8);
static_assert((offsetof (struct scu_reg, AREF)) == 0xB8);
struct scu { struct scu {
scu_reg reg; scu_reg reg;

View File

@ -2,6 +2,7 @@ OUTPUT_FORMAT("elf32-sh", "elf32-sh", "elf32-sh")
OUTPUT_ARCH(sh) OUTPUT_ARCH(sh)
MEMORY MEMORY
{ {
ipl_rom : ORIGIN = 0x00000000, LENGTH = 512K
work_ram_l : ORIGIN = 0x00200000, LENGTH = 1M work_ram_l : ORIGIN = 0x00200000, LENGTH = 1M
work_ram_h : ORIGIN = 0x06000000, LENGTH = 1M work_ram_h : ORIGIN = 0x06000000, LENGTH = 1M
} }
@ -44,3 +45,6 @@ vdp2 = 0x25E00000;
scu = 0x25FE0000; scu = 0x25FE0000;
sh2_vec = 0x06000000; sh2_vec = 0x06000000;
sh2 = 0xfffffe00; sh2 = 0xfffffe00;
work_ram_l = 0x20200000;
work_ram_h = 0x26000000;

2
smpc.h
View File

@ -206,6 +206,8 @@ static_assert((sizeof (smpc_reg)) == 0x80);
static_assert((offsetof (struct smpc_reg, oreg.OREG0)) == 0x21); static_assert((offsetof (struct smpc_reg, oreg.OREG0)) == 0x21);
static_assert((offsetof (struct smpc_reg, oreg.OREG1)) == 0x23); static_assert((offsetof (struct smpc_reg, oreg.OREG1)) == 0x23);
static_assert((offsetof (struct smpc_reg, oreg.OREG31)) == 0x5f); static_assert((offsetof (struct smpc_reg, oreg.OREG31)) == 0x5f);
static_assert((offsetof (struct smpc_reg, COMREG)) == 0x1f);
static_assert((offsetof (struct smpc_reg, SR)) == 0x61);
static_assert((offsetof (struct smpc_reg, SF)) == 0x63); static_assert((offsetof (struct smpc_reg, SF)) == 0x63);
struct smpc { struct smpc {