📄 main._h
字号:
#endif
#define InitPORT() do { P1DIR |= 0xFF; \
PORT = 0x00; \
} while (0) /* P1 is all-output */
/* */
/* ====================== M68HC11 ========================= */
/* */
#elif defined(SYST) /* ImageCraft ICC11 */
#if 0
/* EVB has vectors in RAM -- therefore we set them in */
/* Init(). Change these values and/or code below if your */
/* target has a different interrupt scheme. */
#define JMP_INSTRUCTION 0x7E
#define EVB_RTI_VECTOR 0xEB
extern void IntVector(void);
*(char *)EVB_RTI_VECTOR = JMP_INSTRUCTION;
*(void (**)())(EVB_RTI_VECTOR+1) = intVector;
#endif /* #if 0 */
#if defined(USE_PORTC)
#define PORT PORTC
#else
#define PORT PORTB
#endif
#if !defined(USE_INTERRUPTS)
#define Init()
#else
#define Init() do { PACTL &= 0b11111100; \
PACTL |= 0b00000010; \
TMSK2 |= 0b01000000; \
} while (0)
#endif
#if defined(USE_PORTC)
#define InitPORT() do { PIOC &= 0b00001111; \
DDRC = 0b11111111; \
PORT = 0x00; \
} while (0)
#else
#define InitPORT() do { PORT = 0x00; \
} while (0) /* PORTB is output-only */
#endif
/* */
/* ====================== Z8Encore ======================== */
/* */
#elif defined(SYSU) /* Zilog Z8Encore Compiler */
/* PORTE is used to force writes to the LED arrays ... */
/* only D1 and D4 really show anything useful ... */
#define PORT PGOUT
#if !defined(USE_INTERRUPTS)
#define Init() do { PEADDR = 0x01; \
PECTL = 0x00; \
PGADDR = 0x01; \
PGCTL = 0x00; \
PEOUT = 0x00; \
PEOUT |= 0x20; \
PEOUT &= ~0x00; \
PGOUT = 0x01; \
PEOUT |= 0xC0; \
PEOUT &= ~0xC0; \
} while (0)
#else
#define Init() do { PEADDR = 0x01; \
PECTL = 0x00; \
PGADDR = 0x01; \
PGCTL = 0x00; \
PEOUT = 0x00; \
PEOUT |= 0x20; \
PEOUT &= ~0x00; \
PGOUT = 0x01; \
PEOUT |= 0xC0; \
PEOUT &= ~0xC0; \
SET_VECTOR(TIMER0, IntVector);\
T0H = 0x00; \
T0L = 0x00; \
T0RH = 0x5A; \
T0RL = 0x00; \
T0CTL = 0x99; \
IRQ0E0 &= 0xDF; \
IRQ0E1 |= 0x20; \
} while (0)
#endif
/* */
/* ======================= AVR ============================ */
/* */
#elif defined(SYSV) /* ImageCraft ICCAVR */ \
|| defined(SYSY) /* AVR-GCC */ \
|| defined(SYSAC) /* IAR AVR C */
#if defined(SYSV)
#include <iom16v.h> /* for M16 */
#elif defined(SYSY)
#elif defined(SYSAC)
#include <iom16.h>
#endif
/*
#define PORT PORTB
#define InitPORT() do { DDRB = 0xFF; \
PORT = 0x00; \
} while (0)*/
#if !defined(USE_INTERRUPTS)
#define Init()
#else
#define Init() do { TCCR0 = 0x00; /* Stop Timer1 */ \
TCNT0 = 0x00; /* Clear Timer1 */ \
/*OCR1AH = 0x00; Set Compare A to 39 */ \
OCR0 = 0x26; /* ((4MHz/1024)/39) = 10ms (9.984ms) timer */ \
TIMSK = 0x02; /* Compare A Interrupt enable */ \
TCCR0 = 0x0d; /* Start Timer1 with clk/1024 */ \
} while (0)
#endif
/* */
/* ===================== TMS320C28x ======================= */
/* */
#elif defined(SYSW) /* TI Code Composer Studio 'C2000 */
/* just define an imaginary port called PORTB and write */
/* to it ... */
unsigned int PORTB;
/* Initialization of Timer2 is in InitTMR2() in vectors.asm.*/
extern void InitTMR2(void);
#if !defined(USE_INTERRUPTS)
#define Init()
#else
#define Init() do { InitTMR2();\
} while (0)
#endif
#define PORT PORTB
#define InitPORT() do { PORT = 0x00; } while (0)
/* */
/* ===================== DSP56F8xxx ======================= */
/* */
#elif defined(SYSZ) /* DSP56F826 */
/* Initialization of Timer is in TMR_InitTmrA0() in tmrA.c */
extern void TMR_InitTmrA0(void);
#if !defined(USE_INTERRUPTS)
#define Init()
#else
#define Init() do { TMR_InitTmrA0();\
OSEi(); \
} while (0)
#endif
#define InitPORT() do { asm { MOVE #0x0000,X:GPIO_B_PER }\
asm { MOVE #0x00FF,X:GPIO_B_DDR }\
asm { MOVE #0x0001,X:GPIO_B_DR } } while (0)
/* */
/* ===================== TMS320C24x ======================= */
/* */
#elif defined(SYSAA) /* TI Code Composer */
#include <f2407_c.h> /* for TMS320LF2407A */
/* Initialization of '2407 is in initialize.c. */
extern void InitLF2407(void);
#if !defined(USE_INTERRUPTS)
#define Init() do { InitLF2407();\
} while (0)
/* since vectors.asm is not compiled conditionally, we need */
/* a "dummy ISR3" to satisfy its external reference to */
/* _ISR3. */
interrupt void ISR3(void) { *EVAIFRB = *EVAIFRB & 0x0001; }
#else
#define Init() do { InitLF2407();\
} while (0)
#endif
/* set GPIO PORT B to all outputs and zero it in one op. */
#define PORT *PBDATDIR
#define InitPORT() do { PORT = 0xFF00; \
} while (0)
/* */
/* ====================== undefined ======================= */
/* */
#else
#error Undefined Salvo test system (SYS*). Definition required.
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -