/* -------------------------------------------------------- */
/* Macros for setting device configuration registers */
/* -------------------------------------------------------- */
/* Register CONFIG2 (0x157fc) */
extern __attribute__((space(prog))) int _CONFIG2;
#define _CONFIG2(x) __attribute__((section("__CONFIG2.sec"),space(prog))) int _CONFIG2 = (x);
/*
** Only one invocation of CONFIG2 should appear in a project,
** at the top of a C source file (outside of any function).
**
** The following constants can be used to set CONFIG2.
** Multiple options may be combined, as shown:
**
** _CONFIG2( OPT1_ON & OPT2_OFF & OPT3_PLL )
**
** Primary Oscillator Select:
** POSCMOD_EC EC Oscillator mode selected
** POSCMOD_XT XT Oscillator mode selected
** POSCMOD_HS HS Oscillator mode selected
** POSCMOD_NONE Primary oscillator disabled
**
** Primary Oscillator Output Function:
** OSCIOFNC_ON OSC2/CLKO/RC15 functions as port I/O (RC15)
** OSCIOFNC_OFF OSC2/CLKO/RC15 functions as CLKO (FOSC/2)
**
** Clock Switching and Monitor:
** FCKSM_CSECME Clock switching is enabled, Fail-Safe Clock Monitor is enabled
** FCKSM_CSECMD Clock switching is enabled, Fail-Safe Clock Monitor is disabled
** FCKSM_CSDCMD Clock switching and Fail-Safe Clock Monitor are disabled
**
** Oscillator Select:
** FNOSC_FRC Fast RC Oscillator (FRC)
** FNOSC_FRCPLL Fast RC Oscillator with PLL module (FRCPLL)
** FNOSC_PRI Primary Oscillator (XT, HS, EC)
** FNOSC_PRIPLL Primary Oscillator with PLL module (HSPLL, ECPLL)
** FNOSC_SOSC Secondary Oscillator (SOSC)
** FNOSC_LPRC Low-Power RC Oscillator (LPRC)
** FNOSC_FRCDIV Fast RC Oscillator with Postscaler (FRCDIV)
**
** Internal External Switch Over Mode:
** IESO_OFF IESO mode (Two-Speed Start-up) disabled
** IESO_ON IESO mode (Two-Speed Start-up) enabled
**
*/
#define POSCMOD_EC 0xFFFC
#define POSCMOD_XT 0xFFFD
#define POSCMOD_HS 0xFFFE
#define POSCMOD_NONE 0xFFFF
#define OSCIOFNC_ON 0xFFDF
#define OSCIOFNC_OFF 0xFFFF
#define FCKSM_CSECME 0xFF3F
#define FCKSM_CSECMD 0xFF7F
#define FCKSM_CSDCMD 0xFFBF
#define FNOSC_FRC 0xF8FF
#define FNOSC_FRCPLL 0xF9FF
#define FNOSC_PRI 0xFAFF
#define FNOSC_PRIPLL 0xFBFF
#define FNOSC_SOSC 0xFCFF
#define FNOSC_LPRC 0xFDFF
#define FNOSC_FRCDIV 0xFFFF
#define IESO_OFF 0x7FFF
#define IESO_ON 0xFFFF
/* Register CONFIG1 (0x157fe) */
extern __attribute__((space(prog))) int _CONFIG1;
#define _CONFIG1(x) __attribute__((section("__CONFIG1.sec"),space(prog))) int _CONFIG1 = (x);
/*
** Only one invocation of CONFIG1 should appear in a project,
** at the top of a C source file (outside of any function).
**
** The following constants can be used to set CONFIG1.
** Multiple options may be combined, as shown:
**
** _CONFIG1( OPT1_ON & OPT2_OFF & OPT3_PLL )
**
** Watchdog Timer Postscaler:
** WDTPS_PS1 1:1
** WDTPS_PS2 1:2
** WDTPS_PS4 1:4
** WDTPS_PS8 1:8
** WDTPS_PS16 1:16
** WDTPS_PS32 1:32
** WDTPS_PS64 1:64
** WDTPS_PS128 1:128
** WDTPS_PS256 1:256
** WDTPS_PS512 1:512
** WDTPS_PS1024 1:1,024
** WDTPS_PS2048 1:2,048
** WDTPS_PS4096 1:4,096
** WDTPS_PS8192 1:8,192
** WDTPS_PS16384 1:16,384
** WDTPS_PS32768 1:32,768
**
** WDT Prescaler:
** FWPSA_PR32 Prescaler ratio of 1:32
** FWPSA_PR128 Prescaler ratio of 1:128
**
** Watchdog Timer Window:
** WINDIS_OFF Windowed Watchdog Timer enabled; FWDTEN must be 1
** WINDIS_ON Standard Watchdog Timer enabled,(Windowed-mode is disabled)
**
** Watchdog Timer Enable:
** FWDTEN_OFF Watchdog Timer is disabled
** FWDTEN_ON Watchdog Timer is enabled
**
** Comm Channel Select:
** ICS_PGx1 Emulator/debugger uses EMUC1/EMUD1
** ICS_PGx2 Emulator/debugger uses EMUC2/EMUD2
**
** Set Clip On Emulation Mode:
** COE_ON Reset Into Clip On Emulation Mode
** COE_OFF Reset Into Operational Mode
**
** Background Debug:
** BKBUG_ON Device resets into Debug mode
** BKBUG_OFF Device resets into Operational mode
**
** General Code Segment Write Protect:
** GWRP_ON Writes to program memory are disabled
** GWRP_OFF Writes to program memory are allowed
**
** General Code Segment Code Protect:
** GCP_ON Code protection is enabled for the entire program memory space
** GCP_OFF Code protection is disabled
**
** JTAG Port Enable:
** JTAGEN_OFF JTAG port is disabled
** JTAGEN_ON JTAG port is enabled
**
*/
#define WDTPS_PS1 0x7FF0
#define WDTPS_PS2 0x7FF1
#define WDTPS_PS4 0x7FF2
#define WDTPS_PS8 0x7FF3
#define WDTPS_PS16 0x7FF4
#define WDTPS_PS32 0x7FF5
#define WDTPS_PS64 0x7FF6
#define WDTPS_PS128 0x7FF7
#define WDTPS_PS256 0x7FF8
#define WDTPS_PS512 0x7FF9
#define WDTPS_PS1024 0x7FFA
#define WDTPS_PS2048 0x7FFB
#define WDTPS_PS4096 0x7FFC
#define WDTPS_PS8192 0x7FFD
#define WDTPS_PS16384 0x7FFE
#define WDTPS_PS32768 0x7FFF
#define FWPSA_PR32 0x7FEF
#define FWPSA_PR128 0x7FFF
#define WINDIS_OFF 0x7FBF
#define WINDIS_ON 0x7FFF
#define FWDTEN_OFF 0x7F7F
#define FWDTEN_ON 0x7FFF
#define ICS_PGx1 0x7EFF
#define ICS_PGx2 0x7FFF
#define COE_ON 0x7FFF
#define COE_OFF 0x7FFF
#define BKBUG_ON 0x7FFF
#define BKBUG_OFF 0x7FFF
#define GWRP_ON 0x6FFF
#define GWRP_OFF 0x7FFF
#define GCP_ON 0x5FFF
#define GCP_OFF 0x7FFF
#define JTAGEN_OFF 0x3FFF
#define JTAGEN_ON 0x7FFF
#endif