📄 ports_def.h
字号:
/* IO DEFINITIONS AND MACROS FOR THE MCS912DG256B
09/19/03
EMAC.inc
Nathan Z. Gustavson ngustavson@emacinc.com
Emac.inc
May 2005; Modified by Jefferson Smith for general use in GEL
*/
#ifndef _ARCH_IODG256B_H
#define _ARCH_IODG256B_H
#define IO_BASE 0
/*macros
*/
#define ienable() __asm("cli");
#define idisable() __asm("orcc #0x10")
#define xenable() __asm("andcc #0xbf")
#define xdisable()__asm("orcc #0x40")
/* constant offsets to use where a C expression doesn't work
*/
#define M6811_PORTA 0x00
#define M6811_PORTB 0x01
#define M6811_PTT 0x240
#define M6811_PTM 0x250
#define M6811_PTP 0x258
#define M6811_PTH 0x260
#define PORTIO_8 *(volatile unsigned char *)
#define PORTIO_16 *(volatile unsigned short int *)
/* Core HC12 Registers
*/
#define PORTA PORTIO_8(IO_BASE + 0x00) /* port A */
#define PORTB PORTIO_8(IO_BASE + 0x01) /* port B */
#define DDRA PORTIO_8(IO_BASE + 0x02) /* data direction port A */
#define DDRB PORTIO_8(IO_BASE + 0x03) /* data direction port B */
#define PORTE PORTIO_8(IO_BASE + 0x08) /* port E */
#define DDRE PORTIO_8(IO_BASE + 0x09) /* data direction port E */
#define PEAR PORTIO_8(IO_BASE + 0x0a) /* port E assignment register */
#define MODE PORTIO_8(IO_BASE + 0x0b) /* mode register */
#define PUCR PORTIO_8(IO_BASE + 0x0c) /* pull-up control register */
#define RDRIV PORTIO_8(IO_BASE + 0x0d) /* reduced drive of I/O lines */
#define EBICTL PORTIO_8(IO_BASE + 0x0e) /* external bus control */
#define INITRM PORTIO_8(IO_BASE + 0x10) /* RAM mapping register */
#define INITRG PORTIO_8(IO_BASE + 0x11) /* IO mapping register */
#define INITEE PORTIO_8(IO_BASE + 0x12) /* EEPROM mapping register */
#define MISC PORTIO_8(IO_BASE + 0x13) /* mapping control register */
#define MTST0 PORTIO_8(IO_BASE + 0x14) /* mapping test register 0 */
#define ITCR PORTIO_8(IO_BASE + 0x15) /* interrupt test control reg. */
#define ITEST PORTIO_8(IO_BASE + 0x16) /* interrupt test register */
#define MTST1 PORTIO_8(IO_BASE + 0x17) /* mapping test register 1 */
#define PARTID PORTIO_16(IO_BASE + 0x1a) /* part ID register */
#define MEMSIZ0 PORTIO_8(IO_BASE + 0x1c) /* memory size register 0 */
#define MEMSIZ1 PORTIO_8(IO_BASE + 0x1d) /* memory size register 1 */
#define INTCR PORTIO_8(IO_BASE + 0x1e) /* interrupt control */
#define HPRIO PORTIO_8(IO_BASE + 0x1f) /* highest priority */
/*
bitflags
*/
//PEAR
#define NOACCE 0x80
#define PIPOE 0x20
#define NECLK 0x10
#define LSTRE 0x08
#define RDWE 0x04
//INTCR bitflags
#define IRQE 0x80
#define IRQEN 0x40
#define DLY 0x20
/* BKP Module
*/
#define BKPCT0 PORTIO_8(IO_BASE + 0x28) /* Breakpoint Control 0 */
#define BKPCT1 PORTIO_8(IO_BASE + 0x29) /* Breakpoint Control 1 */
#define BKP0X PORTIO_8(IO_BASE + 0x2a) /* Breakpoint 0 address upper */
#define BKP0 PORTIO_16(IO_BASE + 0x2b) /* Breakpoint 0 address */
#define BKP1X PORTIO_8(IO_BASE + 0x2d) /* Breakpoint 1 address upper */
#define BKP1 PORTIO_16(IO_BASE + 0x2e) /* Breakpoint 1 address */
/* MEBI Module
*/
#define PPAGE PORTIO_8(IO_BASE + 0x30) /* program page register */
#define PORTK PORTIO_8(IO_BASE + 0x32) /* port K data register */
#define DDRK PORTIO_8(IO_BASE + 0x33) /* port K data direction */
/* CRG Module
*/
#define SYNR PORTIO_8(IO_BASE + 0x34) /* synthesizer register */
#define REFDV PORTIO_8(IO_BASE + 0x35) /* reference divider register */
#define CTFLG PORTIO_8(IO_BASE + 0x36) /* clock test flag register */
#define CRGFLG PORTIO_8(IO_BASE + 0x37) /* clock generator flag register */
#define CRGINT PORTIO_8(IO_BASE + 0x38) /* clock interrupt enable */
#define CLKSEL PORTIO_8(IO_BASE + 0x39) /* clock select register */
#define PLLCTL PORTIO_8(IO_BASE + 0x3a) /* PLL control register */
#define RTICTL PORTIO_8(IO_BASE + 0x3b) /* clock real time control reg. */
#define COPCTL PORTIO_8(IO_BASE + 0x3c) /* COP control register */
#define FORBYP PORTIO_8(IO_BASE + 0x3d) /* clock force and bypass register */
#define CTCTL PORTIO_8(IO_BASE + 0x3e) /* clock test control register */
#define ARMCOP PORTIO_8(IO_BASE + 0x3f) /* COP arm/reset register with sequence 0x55,0xaa. */
// CRG bitflags
#define RTIF 0x80
#define RTIE 0x80
#define LOCK 0x08
#define AUTO 0x20
#define PLLSEL 0x80
// COPCTL bitflags
#define WCOP 0x80
#define RSBCK 0x40
/* ECT Module
*/
#define TIOS PORTIO_8(IO_BASE + 0x40) /* timer select register */
#define TCFORC PORTIO_8(IO_BASE + 0x41) /* compare force register */
#define TOC7M PORTIO_8(IO_BASE + 0x42) /* oc7 mask register */
#define TOC7D PORTIO_8(IO_BASE + 0x43) /* oc7 data register */
#define TCNT PORTIO_16(IO_BASE + 0x44) /* timer counter */
#define TSCR1 PORTIO_8(IO_BASE + 0x46) /* system control register 1 */
#define TTOV PORTIO_8(IO_BASE + 0x47) /* toggle on overflow register */
#define TCTL1 PORTIO_8(IO_BASE + 0x48) /* control register 1 */
#define TCTL2 PORTIO_8(IO_BASE + 0x49) /* control register 2 */
#define TCTL3 PORTIO_8(IO_BASE + 0x4a) /* control register 3 */
#define TCTL4 PORTIO_8(IO_BASE + 0x4b) /* control register 4 */
#define TIE PORTIO_8(IO_BASE + 0x4c) /* interrupt enable register */
#define TSCR2 PORTIO_8(IO_BASE + 0x4d) /* system control register 2 */
#define TFLG1 PORTIO_8(IO_BASE + 0x4e) /* interrupt flag register 1 */
#define TFLG2 PORTIO_8(IO_BASE + 0x4f) /* interrupt flag register 2 */
#define TC0 PORTIO_16(IO_BASE + 0x50) /* capture/compare register 0 */
#define TC1 PORTIO_16(IO_BASE + 0x52) /* capture/compare register 0 */
#define TC2 PORTIO_16(IO_BASE + 0x54) /* capture/compare register 0 */
#define TC3 PORTIO_16(IO_BASE + 0x56) /* capture/compare register 0 */
#define TC4 PORTIO_16(IO_BASE + 0x58) /* capture/compare register 0 */
#define TC5 PORTIO_16(IO_BASE + 0x5a) /* capture/compare register 0 */
#define TC6 PORTIO_16(IO_BASE + 0x5c) /* capture/compare register 0 */
#define TC7 PORTIO_16(IO_BASE + 0x5e) /* capture/compare register 0 */
#define PACTL PORTIO_8(IO_BASE + 0x60) /* pulse accumulator A control */
#define PAFLG PORTIO_8(IO_BASE + 0x61) /* pulse accumulator A flag */
#define PACN3 PORTIO_8(IO_BASE + 0x62) /* pulse accumulator A3 count */
#define PACN2 PORTIO_8(IO_BASE + 0x63) /* pulse accumulator A2 count */
#define PACN1 PORTIO_8(IO_BASE + 0x64) /* pulse accumulator A1 count */
#define PACN0 PORTIO_8(IO_BASE + 0x65) /* pulse accumulator A0 count */
#define MCCTL PORTIO_8(IO_BASE + 0x66) /* modulus counter control reg */
#define MCFLG PORTIO_8(IO_BASE + 0x67) /* modulus counter flag reg */
#define ICPAR PORTIO_8(IO_BASE + 0x68) /* input control pulse acc reg */
#define DLYCT PORTIO_8(IO_BASE + 0x69) /* delay counter control reg */
#define ICOVW PORTIO_8(IO_BASE + 0x6a) /* input control overwrite reg */
#define ICSYS PORTIO_8(IO_BASE + 0x6b) /* input control system reg */
#define TIMTST PORTIO_8(IO_BASE + 0x6d) /* timer test register */
#define PBCTL PORTIO_8(IO_BASE + 0x70) /* pulse accumulator B control */
#define PBFLG PORTIO_8(IO_BASE + 0x71) /* pulse accumulator B flag */
#define PA3H PORTIO_8(IO_BASE + 0x72) /* pulse accumulator B3 count */
#define PA2H PORTIO_8(IO_BASE + 0x73) /* pulse accumulator B2 count */
#define PA1H PORTIO_8(IO_BASE + 0x74) /* pulse accumulator B1 count */
#define PA0H PORTIO_8(IO_BASE + 0x75) /* pulse accumulator B0 count */
#define MCCNT PORTIO_16(IO_BASE + 0x76) /* modulus counter count reg */
#define TC0H PORTIO_16(IO_BASE + 0x78) /* timer input capture hold 0 */
#define TC1H PORTIO_16(IO_BASE + 0x7a) /* timer input capture hold 1 */
#define TC2H PORTIO_16(IO_BASE + 0x7c) /* timer input capture hold 2 */
#define TC3H PORTIO_16(IO_BASE + 0x7e) /* timer input capture hold 3 */
/* ATD0 Module
*/
#define ATD0_BASE (IO_BASE + 0x80)
#define ATD0CTL0 PORTIO_8(IO_BASE + 0x80) /* A/D0 control register 0 */
#define ATD0CTL1 PORTIO_8(IO_BASE + 0x81) /* A/D0 control register 1 */
#define ATD0CTL2 PORTIO_8(IO_BASE + 0x82) /* A/D0 control register 2 */
#define ATD0CTL3 PORTIO_8(IO_BASE + 0x83) /* A/D0 control register 3 */
#define ATD0CTL4 PORTIO_8(IO_BASE + 0x84) /* A/D0 control register 4 */
#define ATD0CTL5 PORTIO_8(IO_BASE + 0x85) /* A/D0 control register 5 */
#define ATD0STAT0 PORTIO_8(IO_BASE + 0x86) /* A/D0 status register 0 */
#define ATD0STAT1 PORTIO_8(IO_BASE + 0x87) /* A/D0 status register 1 */
#define ATD0TEST0 PORTIO_8(IO_BASE + 0x88) /* A/D0 test register 0 */
#define ATD0TEST1 PORTIO_8(IO_BASE + 0x89) /* A/D0 test register 1 */
#define ATD0DIEN PORTIO_8(IO_BASE + 0x8d) /* A/D0 interrupt enable */
#define PORTAD0 PORTIO_8(IO_BASE + 0x8f) /* port AD0 data input register */
#define ATD0DR0 PORTIO_16(IO_BASE + 0x90) /* A/D0 result 0 */
#define ATD0DR0H PORTIO_8(IO_BASE + 0x90) /* A/D0 result 0 */
#define ATD0DR1 PORTIO_16(IO_BASE + 0x92) /* A/D0 result 1 */
#define ATD0DR1H PORTIO_8(IO_BASE + 0x92) /* A/D0 result 1 */
#define ATD0DR2 PORTIO_16(IO_BASE + 0x94) /* A/D0 result 2 */
#define ATD0DR2H PORTIO_8(IO_BASE + 0x94) /* A/D0 result 2 */
#define ATD0DR3 PORTIO_16(IO_BASE + 0x96) /* A/D0 result 3 */
#define ATD0DR3H PORTIO_8(IO_BASE + 0x96) /* A/D0 result 3 */
#define ATD0DR4 PORTIO_16(IO_BASE + 0x98) /* A/D0 result 4 */
#define ATD0DR4H PORTIO_8(IO_BASE + 0x98) /* A/D0 result 4 */
#define ATD0DR5 PORTIO_16(IO_BASE + 0x9a) /* A/D0 result 5 */
#define ATD0DR5H PORTIO_8(IO_BASE + 0x9a) /* A/D0 result 5 */
#define ATD0DR6 PORTIO_16(IO_BASE + 0x9c) /* A/D0 result 6 */
#define ATD0DR6H PORTIO_8(IO_BASE + 0x9c) /* A/D0 result 6 */
#define ATD0DR7 PORTIO_16(IO_BASE + 0x9e) /* A/D0 result 7 */
#define ATD0DR7H PORTIO_8(IO_BASE + 0x9e) /* A/D0 result 7 */
//ATDnCTL5 bitflags
#define DJM 0x80
#define DSGN 0x40
#define SCAN 0x20
#define MULT 0x10
//ATDnSTAT0 bitflags
#define SCF 0x80
#define ETORF 0x20
#define FIFOR 0x10
/* PWM Module
*/
#define PWME PORTIO_8(IO_BASE + 0xa0) /* PWM Enable */
#define PWMPOL PORTIO_8(IO_BASE + 0xa1) /* PWM Clock Polarity */
#define PWMCLK PORTIO_8(IO_BASE + 0xa2) /* PWM Clocks */
#define PWMPRCLK PORTIO_8(IO_BASE + 0xa3) /* PWM prescale clock select */
#define PWMCAE PORTIO_8(IO_BASE + 0xa4) /* PWM center align enable */
#define PWMCTL PORTIO_8(IO_BASE + 0xa5) /* PWM Control Register */
#define PWMTST PORTIO_8(IO_BASE + 0xa6) /* PWM Test Register */
#define PWMPRSC PORTIO_8(IO_BASE + 0xa7) /* PWM Test Register */
#define PWMSCLA PORTIO_8(IO_BASE + 0xa8) /* PWM scale A */
#define PWMSCLB PORTIO_8(IO_BASE + 0xa9) /* PWM scale B */
#define PWMSCNTA PORTIO_8(IO_BASE + 0xaa) /* PWM Test Register A */
#define PWMSCNTB PORTIO_8(IO_BASE + 0xab) /* PWM Test Register B */
#define PWMCNT0 PORTIO_8(IO_BASE + 0xac) /* PWM Channel Counter 0 */
#define PWMCNT1 PORTIO_8(IO_BASE + 0xad) /* PWM Channel Counter 1 */
#define PWMCNT2 PORTIO_8(IO_BASE + 0xae) /* PWM Channel Counter 2 */
#define PWMCNT3 PORTIO_8(IO_BASE + 0xaf) /* PWM Channel Counter 3 */
#define PWMCNT4 PORTIO_8(IO_BASE + 0xb0) /* PWM Channel Counter 4 */
#define PWMCNT5 PORTIO_8(IO_BASE + 0xb1) /* PWM Channel Counter 5 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -