void SYS_Initialize ( void* data ) { /* Core Processor Initialization */ SYS_CLK_Initialize( NULL ); sysObj.sysDevcon = SYS_DEVCON_Initialize(SYS_DEVCON_INDEX_0, (SYS_MODULE_INIT*)&sysDevconInit); SYS_DEVCON_PerformanceConfig(SYS_CLK_SystemFrequencyGet()); SYS_DEVCON_JTAGDisable(); SYS_PORTS_Initialize(); /* Initialize Drivers */ /*Initialize TMR0 */ DRV_TMR0_Initialize(); /*Initialize TMR1 */ DRV_TMR1_Initialize(); /*Initialize TMR2 */ DRV_TMR2_Initialize(); /*Initialize TMR3 */ DRV_TMR3_Initialize(); DRV_USART0_Initialize(); DRV_USART1_Initialize(); /*Initialize OC0 */ DRV_OC0_Initialize(); /*Initialize OC1 */ DRV_OC1_Initialize(); /* Initialize System Services */ SYS_INT_Initialize(); /*Setup the INT_SOURCE_EXTERNAL_1 and Enable it*/ SYS_INT_VectorPrioritySet(INT_VECTOR_INT1, INT_PRIORITY_LEVEL1); SYS_INT_VectorSubprioritySet(INT_VECTOR_INT1, INT_SUBPRIORITY_LEVEL0); SYS_INT_ExternalInterruptTriggerSet(INT_EXTERNAL_INT_SOURCE1,INT_EDGE_TRIGGER_RISING); SYS_INT_SourceEnable(INT_SOURCE_EXTERNAL_1); /*Setup the INT_SOURCE_EXTERNAL_2 and Enable it*/ SYS_INT_VectorPrioritySet(INT_VECTOR_INT2, INT_PRIORITY_LEVEL1); SYS_INT_VectorSubprioritySet(INT_VECTOR_INT2, INT_SUBPRIORITY_LEVEL0); SYS_INT_ExternalInterruptTriggerSet(INT_EXTERNAL_INT_SOURCE2,INT_EDGE_TRIGGER_RISING); SYS_INT_SourceEnable(INT_SOURCE_EXTERNAL_2); /* Initialize Middleware */ initDebugU(); /* Initialize the Application */ COMMUNICATION_Initialize(); MOTOR_Initialize(); }
void SYS_Initialize ( void* data ) { /* Core Processor Initialization */ SYS_CLK_Initialize( NULL ); sysObj.sysDevcon = SYS_DEVCON_Initialize(SYS_DEVCON_INDEX_0, (SYS_MODULE_INIT*)&sysDevconInit); SYS_DEVCON_PerformanceConfig(SYS_CLK_SystemFrequencyGet()); SYS_DEVCON_JTAGDisable(); SYS_PORTS_Initialize(); #ifdef DEBUG_ON setDebugVal(SYS_INIT_START); // has to be after ports init #endif /* Initialize Drivers */ /*Initialize TMR0 */ DRV_TMR0_Initialize(); DRV_USART0_Initialize(); DRV_USART1_Initialize(); #ifdef DEBUG_ON setDebugVal(SYS_INIT_UART); #endif /*Initialize OC0 */ DRV_OC0_Initialize(); /*Initialize OC1 */ DRV_OC1_Initialize(); /* Initialize System Services */ SYS_INT_Initialize(); #ifdef DEBUG_ON setDebugVal(SYS_INIT_SYS); #endif /*Setup the INT_SOURCE_EXTERNAL_2 and Enable it*/ SYS_INT_VectorPrioritySet(INT_VECTOR_INT2, INT_PRIORITY_LEVEL3); SYS_INT_VectorSubprioritySet(INT_VECTOR_INT2, INT_SUBPRIORITY_LEVEL0); SYS_INT_ExternalInterruptTriggerSet(INT_EXTERNAL_INT_SOURCE2,INT_EDGE_TRIGGER_RISING); SYS_INT_SourceEnable(INT_SOURCE_EXTERNAL_2); /*Setup the INT_SOURCE_EXTERNAL_1 and Enable it*/ SYS_INT_VectorPrioritySet(INT_VECTOR_INT1, INT_PRIORITY_LEVEL3); SYS_INT_VectorSubprioritySet(INT_VECTOR_INT1, INT_SUBPRIORITY_LEVEL0); SYS_INT_ExternalInterruptTriggerSet(INT_EXTERNAL_INT_SOURCE1,INT_EDGE_TRIGGER_RISING); SYS_INT_SourceEnable(INT_SOURCE_EXTERNAL_1); /*Setup the INT_SOURCE_EXTERNAL_3 and Enable it*/ SYS_INT_VectorPrioritySet(INT_VECTOR_INT3, INT_PRIORITY_LEVEL3); SYS_INT_VectorSubprioritySet(INT_VECTOR_INT3, INT_SUBPRIORITY_LEVEL0); SYS_INT_ExternalInterruptTriggerSet(INT_EXTERNAL_INT_SOURCE3,INT_EDGE_TRIGGER_RISING); SYS_INT_SourceEnable(INT_SOURCE_EXTERNAL_3); /* Initialize Middleware */ /* Initialize the Application */ MOTORAPP_Initialize(); #ifdef DEBUG_ON setDebugVal(SYS_INIT_APP); #endif UART_TX_APP_Initialize(); #ifdef DEBUG_ON setDebugVal(SYS_INIT_UART_TX_APP); #endif UART_RX_APP_Initialize(); #ifdef DEBUG_ON setDebugVal(SYS_INIT_UART_RX_APP); #endif }