📄 mc68230.h
字号:
/*
* File: dev/mc68230.h
* Purpose: Defintions for the MC68230 PI/T.
*
* Notes: Macros in lower caps are meant to be private to this
* header file. Macros in all caps are for global use.
*
* Modifications:
*
*/
#ifndef _DEV_MC68230_H
#define _DEV_MC68230_H
/********************************************************************/
#ifndef MC68230_CUSTOM
/*
* This macro defines the interval between registers on the device as
* seen by the CPU.
*/
#ifndef MC68230_INTERVAL
#error "Must define value for MC68230_INTERVAL"
#endif
/*
* This macros defines the offset from zero of the first register on
* the device. It is then assumed that the next register is INTERVAL
* bytes away.
*/
#ifndef MC68230_OFFSET
#error "Must define value for MC68230_OFFSET"
#endif
#endif /* MC68230_CUSTOM */
/********************************************************************/
/*
* Physical device register offsets
*/
#define MC68230_PGCR 0
#define MC68230_PSRR 1
#define MC68230_PADDR 2
#define MC68230_PBDDR 3
#define MC68230_PCDDR 4
#define MC68230_PIVR 5
#define MC68230_PACR 6
#define MC68230_PBCR 7
#define MC68230_PADR 8
#define MC68230_PBDR 9
#define MC68230_PAAR 10
#define MC68230_PBAR 11
#define MC68230_PCDR 12
#define MC68230_PSR 13
#define MC68230_TCR 16
#define MC68230_TIVR 17
#define MC68230_CPRH 19
#define MC68230_CPRM 20
#define MC68230_CPRL 21
#define MC68230_CRH 23
#define MC68230_CRM 24
#define MC68230_CRL 25
#define MC68230_TSR 26
/*
* Definitions of register contents
*/
#define MC68230_PGCR_MODE_0 (0x00)
#define MC68230_PGCR_MODE_1 (0x40)
#define MC68230_PGCR_MODE_2 (0x80)
#define MC68230_PGCR_MODE_3 (0xC0)
#define MC68230_PGCR_H34_EN (0x20)
#define MC68230_PGCR_H12_EN (0x10)
#define MC68230_PGCR_H4_SENSE (0x08)
#define MC68230_PGCR_H3_SENSE (0x04)
#define MC68230_PGCR_H2_SENSE (0x02)
#define MC68230_PGCR_H1_SENSE (0x01)
#define MC68230_PSRR_SVCRQ_XX (0x00)
#define MC68230_PSRR_IPF_XXXX (0x00)
#define MC68230_PSRR_PIPC_XXX (0x00)
#define MC68230_PADDR_BIT_7 (0x80)
#define MC68230_PADDR_BIT_6 (0x40)
#define MC68230_PADDR_BIT_5 (0x20)
#define MC68230_PADDR_BIT_4 (0x10)
#define MC68230_PADDR_BIT_3 (0x08)
#define MC68230_PADDR_BIT_2 (0x04)
#define MC68230_PADDR_BIT_1 (0x02)
#define MC68230_PADDR_BIT_0 (0x01)
#define MC68230_PBDDR_BIT_7 (0x80)
#define MC68230_PBDDR_BIT_6 (0x40)
#define MC68230_PBDDR_BIT_5 (0x20)
#define MC68230_PBDDR_BIT_4 (0x10)
#define MC68230_PBDDR_BIT_3 (0x08)
#define MC68230_PBDDR_BIT_2 (0x04)
#define MC68230_PBDDR_BIT_1 (0x02)
#define MC68230_PBDDR_BIT_0 (0x01)
#define MC68230_PCDDR_BIT_7 (0x80)
#define MC68230_PCDDR_BIT_6 (0x40)
#define MC68230_PCDDR_BIT_5 (0x20)
#define MC68230_PCDDR_BIT_4 (0x10)
#define MC68230_PCDDR_BIT_3 (0x08)
#define MC68230_PCDDR_BIT_2 (0x04)
#define MC68230_PCDDR_BIT_1 (0x02)
#define MC68230_PCDDR_BIT_0 (0x01)
#define MC68230_PIVR_MASK (0xFC)
#define MC68230_PIVR_VECTOR(V) ((V) & MC68230_PIVR_MASK)
#define MC68230_PACR_SUB_00 (0x00)
#define MC68230_PACR_SUB_01 (0x00)
#define MC68230_PACR_SUB_10 (0x00)
#define MC68230_PACR_SUB_11 (0x00)
#define MC68230_PACR_H2C_XXX (0x00)
#define MC68230_PACR_H2C_XXX (0x00)
#define MC68230_PACR_H2_INT (0x04)
#define MC68230_PACR_H1_SVCRQ (0x02)
#define MC68230_PACR_H1_STAT (0x01)
#define MC68230_PBCR_SUB_00 (0x00)
#define MC68230_PBCR_SUB_01 (0x00)
#define MC68230_PBCR_SUB_10 (0x00)
#define MC68230_PBCR_SUB_11 (0x00)
#define MC68230_PBCR_H4C_XXX (0x00)
#define MC68230_PBCR_H4C_XXX (0x00)
#define MC68230_PBCR_H4_INT (0x04)
#define MC68230_PBCR_H3_SVCRQ (0x02)
#define MC68230_PBCR_H3_STAT (0x01)
#define MC68230_PADR_BIT_7 (0x80)
#define MC68230_PADR_BIT_6 (0x40)
#define MC68230_PADR_BIT_5 (0x20)
#define MC68230_PADR_BIT_4 (0x10)
#define MC68230_PADR_BIT_3 (0x08)
#define MC68230_PADR_BIT_2 (0x04)
#define MC68230_PADR_BIT_1 (0x02)
#define MC68230_PADR_BIT_0 (0x01)
#define MC68230_PBDR_BIT_7 (0x80)
#define MC68230_PBDR_BIT_6 (0x40)
#define MC68230_PBDR_BIT_5 (0x20)
#define MC68230_PBDR_BIT_4 (0x10)
#define MC68230_PBDR_BIT_3 (0x08)
#define MC68230_PBDR_BIT_2 (0x04)
#define MC68230_PBDR_BIT_1 (0x02)
#define MC68230_PBDR_BIT_0 (0x01)
#define MC68230_PCDR_BIT_7 (0x80)
#define MC68230_PCDR_BIT_6 (0x40)
#define MC68230_PCDR_BIT_5 (0x20)
#define MC68230_PCDR_BIT_4 (0x10)
#define MC68230_PCDR_BIT_3 (0x08)
#define MC68230_PCDR_BIT_2 (0x04)
#define MC68230_PCDR_BIT_1 (0x02)
#define MC68230_PCDR_BIT_0 (0x01)
#define MC68230_PSR_H4_LEVEL (0x80)
#define MC68230_PSR_H3_LEVEL (0x40)
#define MC68230_PSR_H2_LEVEL (0x20)
#define MC68230_PSR_H1_LEVEL (0x10)
#define MC68230_PSR_H4S (0x08)
#define MC68230_PSR_H3S (0x04)
#define MC68230_PSR_H2S (0x02)
#define MC68230_PSR_H1S (0x01)
#define MC68230_TCR_PERIODIC (0xA0)
#define MC68230_TCR_FREE_RUN (0x10)
/********************************************************************/
/*
* If the device is connected to the system in a "non-standard" way,
* then obtain the board-specifics.
*/
#ifdef MC68230_CUSTOM
#include MC68230_CUSTOM /* Local MC68230 definitions */
#else
/*
* Macros for accessing the peripheral registers
*/
#define Mc68230_addr(BASE,REG) \
((void *)&((uint8 *)BASE)[(REG * MC68230_INTERVAL) + MC68230_OFFSET])
#define Mc68230_iord(BASE,REG) \
cpu_iord_8(Mc68230_addr(BASE,REG))
#define Mc68230_iowr(BASE,REG,DATA) \
cpu_iowr_8(Mc68230_addr(BASE,REG),DATA)
#define MC68230_RD_PGCR(BASE) Mc68230_iord(BASE,MC68230_PGCR)
#define MC68230_RD_PSRR(BASE) Mc68230_iord(BASE,MC68230_PSRR)
#define MC68230_RD_PADDR(BASE) Mc68230_iord(BASE,MC68230_PADDR)
#define MC68230_RD_PBDDR(BASE) Mc68230_iord(BASE,MC68230_PBDDR)
#define MC68230_RD_PCDDR(BASE) Mc68230_iord(BASE,MC68230_PCDDR)
#define MC68230_RD_PIVR(BASE) Mc68230_iord(BASE,MC68230_PIVR)
#define MC68230_RD_PACR(BASE) Mc68230_iord(BASE,MC68230_PACR)
#define MC68230_RD_PBCR(BASE) Mc68230_iord(BASE,MC68230_PBCR)
#define MC68230_RD_PADR(BASE) Mc68230_iord(BASE,MC68230_PADR)
#define MC68230_RD_PBDR(BASE) Mc68230_iord(BASE,MC68230_PBDR)
#define MC68230_RD_PAAR(BASE) Mc68230_iord(BASE,MC68230_PAAR)
#define MC68230_RD_PBAR(BASE) Mc68230_iord(BASE,MC68230_PBAR)
#define MC68230_RD_PCDR(BASE) Mc68230_iord(BASE,MC68230_PCDR)
#define MC68230_RD_PSR(BASE) Mc68230_iord(BASE,MC68230_PSR)
#define MC68230_RD_TCR(BASE) Mc68230_iord(BASE,MC68230_TCR)
#define MC68230_RD_TIVR(BASE) Mc68230_iord(BASE,MC68230_TIVR)
#define MC68230_RD_CPRH(BASE) Mc68230_iord(BASE,MC68230_CPRH)
#define MC68230_RD_CPRM(BASE) Mc68230_iord(BASE,MC68230_CPRM)
#define MC68230_RD_CPRL(BASE) Mc68230_iord(BASE,MC68230_CPRL)
#define MC68230_RD_CRH(BASE) Mc68230_iord(BASE,MC68230_CRH)
#define MC68230_RD_CRM(BASE) Mc68230_iord(BASE,MC68230_CRM)
#define MC68230_RD_CRL(BASE) Mc68230_iord(BASE,MC68230_CRL)
#define MC68230_RD_TSR(BASE) Mc68230_iord(BASE,MC68230_TSR)
#define MC68230_WR_PGCR(BASE,DATA) Mc68230_iowr(BASE,MC68230_PGCR,DATA)
#define MC68230_WR_PSRR(BASE,DATA) Mc68230_iowr(BASE,MC68230_PSRR,DATA)
#define MC68230_WR_PADDR(BASE,DATA) Mc68230_iowr(BASE,MC68230_PADDR,DATA)
#define MC68230_WR_PBDDR(BASE,DATA) Mc68230_iowr(BASE,MC68230_PBDDR,DATA)
#define MC68230_WR_PCDDR(BASE,DATA) Mc68230_iowr(BASE,MC68230_PCDDR,DATA)
#define MC68230_WR_PIVR(BASE,DATA) Mc68230_iowr(BASE,MC68230_PIVR,DATA)
#define MC68230_WR_PACR(BASE,DATA) Mc68230_iowr(BASE,MC68230_PACR,DATA)
#define MC68230_WR_PBCR(BASE,DATA) Mc68230_iowr(BASE,MC68230_PBCR,DATA)
#define MC68230_WR_PADR(BASE,DATA) Mc68230_iowr(BASE,MC68230_PADR,DATA)
#define MC68230_WR_PBDR(BASE,DATA) Mc68230_iowr(BASE,MC68230_PBDR,DATA)
#define MC68230_WR_PAAR(BASE,DATA) Mc68230_iowr(BASE,MC68230_PAAR,DATA)
#define MC68230_WR_PBAR(BASE,DATA) Mc68230_iowr(BASE,MC68230_PBAR,DATA)
#define MC68230_WR_PCDR(BASE,DATA) Mc68230_iowr(BASE,MC68230_PCDR,DATA)
#define MC68230_WR_PSR(BASE,DATA) Mc68230_iowr(BASE,MC68230_PSR,DATA)
#define MC68230_WR_TCR(BASE,DATA) Mc68230_iowr(BASE,MC68230_TCR,DATA)
#define MC68230_WR_TIVR(BASE,DATA) Mc68230_iowr(BASE,MC68230_TIVR,DATA)
#define MC68230_WR_CPRH(BASE,DATA) Mc68230_iowr(BASE,MC68230_CPRH,DATA)
#define MC68230_WR_CPRM(BASE,DATA) Mc68230_iowr(BASE,MC68230_CPRM,DATA)
#define MC68230_WR_CPRL(BASE,DATA) Mc68230_iowr(BASE,MC68230_CPRL,DATA)
#define MC68230_WR_CRH(BASE,DATA) Mc68230_iowr(BASE,MC68230_CRH,DATA)
#define MC68230_WR_CRM(BASE,DATA) Mc68230_iowr(BASE,MC68230_CRM,DATA)
#define MC68230_WR_CRL(BASE,DATA) Mc68230_iowr(BASE,MC68230_CRL,DATA)
#define MC68230_WR_TSR(BASE,DATA) Mc68230_iowr(BASE,MC68230_TSR,DATA)
#endif /* MC68230_CUSTOM */
/*
* Fake out a typedef with void, ie MC68230 * == void *
*/
#define MC68230 void
/********************************************************************/
#endif /* _DEV_MC68230_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -