1 #include "system_config.h" 2 #include "system_definitions.h" 3 4 // **************************************************************************** 5 // **************************************************************************** 6 // Section: Configuration Bits 7 // **************************************************************************** 8 // **************************************************************************** 9 10 /*** DEVCFG0 ***/ 11 12 #pragma config DEBUG = ON 13 #pragma config JTAGEN = OFF 14 #pragma config ICESEL = ICS_PGx2 15 #pragma config PWP = 0xff 16 #pragma config BWP = OFF 17 #pragma config CP = OFF 18 19 /*** DEVCFG1 ***/ 20 21 #pragma config FNOSC = PRIPLL 22 #pragma config FSOSCEN = OFF 23 #pragma config IESO = OFF 24 #pragma config POSCMOD = HS 25 #pragma config OSCIOFNC = OFF 26 #pragma config FPBDIV = DIV_2 27 #pragma config FCKSM = CSDCMD 28 #pragma config WDTPS = PS1048576 29 #pragma config FWDTEN = OFF 30 #pragma config WINDIS = OFF 31 #pragma config FWDTWINSZ = WINSZ_25 32 33 /*** DEVCFG2 ***/ 34 35 #pragma config FPLLIDIV = DIV_3 36 #pragma config FPLLMUL = MUL_24 37 #pragma config FPLLODIV = DIV_1 38 #pragma config UPLLIDIV = DIV_3 39 #pragma config UPLLEN = ON 40 41 /*** DEVCFG3 ***/ 42 43 #pragma config USERID = 0xffff 44 #pragma config FSRSSEL = PRIORITY_7 45 #pragma config PMDL1WAY = OFF 46 #pragma config IOL1WAY = OFF 47 #pragma config FUSBIDIO = OFF 48 #pragma config FVBUSONIO = OFF 49 50 51 /* TMR Driver Initialization Data */ 52 const DRV_TMR_INIT drvTmrInitData = 53 { 54 {APP_TMR_DRV_POWER_MODE}, 55 APP_TMR_DRV_HW_ID, 56 APP_TMR_DRV_CLOCK_SOURCE, 57 APP_TMR_DRV_PRESCALE, 58 APP_TMR_DRV_INT_SOURCE, 59 APP_TMR_DRV_OPERATION_MODE 60 }; 61 62 /* Structure to hold the system objects. */ 63 SYSTEM_OBJECTS sysObj; 64 65 /* System Initialization Function */ SYS_Initialize(void * data)66void SYS_Initialize ( void* data ) 67 { 68 /* Initialize services, drivers & libraries */ 69 SYS_CLK_Initialize(NULL); 70 71 // optimize system tuning 72 sysObj.sysDevcon = SYS_DEVCON_Initialize(SYS_DEVCON_INDEX_0, NULL); 73 SYS_DEVCON_PerformanceConfig(SYS_CLOCK_FREQENCY); 74 75 sysObj.drvTmr = DRV_TMR_Initialize(APP_TMR_DRV_INDEX, (SYS_MODULE_INIT *)&drvTmrInitData); 76 77 /* Initialize the application. */ 78 APP_Initialize(); 79 }