Hi Daniel,
Your method is very suitable and will allow you to re-use your peripherals easily on other devices.
The only thing I would change is not to declare one ARRAY but instead create an union so it's easy for you to access within your code: you can call via bit or byte with the register name instead of a name and same index.
See some exmple below of what I use:
Code:typedef union uCOPCTL{ tU08 byte; struct { tU08 cr :3; /*cop timer rate select */ tU08 coprstp:1; /*cop runs in stop mode */ tU08 copswai:1; /*cop stops in wait mode */ tU08 wrtmask:1; /*Write Mask for WCOP and CR[2:0] Bit */ tU08 rsbck :1; /*cop stops in active bdm */ tU08 wcop :1; /*window cop enable */ }bit;}tCOPCTL;#define CR0 0x01 /*bit masks */#define CR1 0x02#define CR2 0x04#define COPRSTP 0x08#define COPSWAI 0x10#define WRTMASK 0x20#define RSBCK 0x40#define WCOP 0x80typedef struct { volatile tCOPCTL ctl; /* COP control register */ volatile tU08 armcop; /* COP timer arm/reset register */}tCOP; and declare it in a periph.h
Code:extern volatile tCOP COP @0x003E; /* COP */
Cheers,
Alban.