utils.loadPlatform("ti.platforms.ezdsp28335"); /* The following DSP/BIOS Features are enabled. */ bios.enableRealTimeAnalysis(prog); bios.enableRtdx(prog); bios.enableTskManager(prog); bios.PRD.create("GLedBlink_PRD"); bios.PRD.instance("GLedBlink_PRD").order = 1; bios.PRD.instance("GLedBlink_PRD").comment = "This periodic function is used to toggle the green LED on the Semikron board on and off"; bios.PRD.instance("GLedBlink_PRD").period = 500; bios.PRD.instance("GLedBlink_PRD").fxn = prog.extern("GLedBlink"); bios.PIE.instance("PIE_INT1_4").fxn = prog.extern("FAULT_ISR"); bios.PIE.instance("PIE_INT1_4").useDispatcher = 1; bios.LOG.create("trace"); bios.PIE.instance("PIE_INT5_1").fxn = prog.extern("EQEP1_INT_ISR"); bios.PIE.instance("PIE_INT5_1").useDispatcher = 1; bios.PRD.instance("GLedBlink_PRD").fxn = prog.extern("GLedBlink_SWI"); bios.SWI.create("RESET_swi"); bios.SWI.instance("RESET_swi").order = 1; bios.SWI.instance("RESET_swi").comment = "This function resets the DSP"; bios.SWI.instance("RESET_swi").fxn = prog.extern("Reset_SWI"); bios.SWI.instance("RESET_swi").priority = 4; bios.MEM.STACKSIZE = 0x0800; bios.SWI.instance("RESET_swi").priority = 14; bios.MEM.STACKSIZE = 0x0500; bios.MEM.STACKSIZE = 0x04a0; bios.MEM.STACKSIZE = 0x047f; bios.MEM.STACKSIZE = 0x0500; bios.SWI.instance("RESET_swi").fxn = prog.extern("Reset_ISR"); bios.PRD.instance("GLedBlink_PRD").fxn = prog.extern("GLedBlink_ISR"); bios.SWI.instance("RESET_swi").fxn = prog.extern("Reset_SWI"); bios.PRD.instance("GLedBlink_PRD").fxn = prog.extern("GLedBlink_SWI"); bios.SWI.create("FAULT_swi"); bios.SWI.instance("FAULT_swi").order = 2; bios.SWI.instance("FAULT_swi").priority = 14; bios.SWI.instance("FAULT_swi").priority = 13; bios.SWI.instance("FAULT_swi").fxn = prog.extern("Fault_SWI"); bios.SWI.instance("FAULT_swi").comment = "This SWI is executed whenever the FPGA sends a fault signal to the DSP"; bios.PIE.instance("PIE_INT1_6").fxn = prog.extern("ADC_INT_ISR"); bios.PIE.instance("PIE_INT1_6").useDispatcher = 1; bios.SWI.create("ADC_swi"); bios.SWI.instance("ADC_swi").order = 3; bios.SWI.instance("ADC_swi").priority = 14; bios.SWI.instance("ADC_swi").priority = 12; bios.SWI.instance("ADC_swi").comment = "Analog to Digital Converter Interrupt Service Routine"; bios.SWI.instance("ADC_swi").fxn = prog.extern("ADC_SWI"); bios.SWI.instance("PRD_swi").order = 1; bios.SWI.instance("KNL_swi").order = 2; bios.SWI.instance("RESET_swi").order = 3; bios.SWI.instance("FAULT_swi").order = 4; bios.SWI.instance("ADC_swi").destroy(); bios.SWI.create("ADCSEQ1_swi"); bios.SWI.instance("ADCSEQ1_swi").order = 6; bios.SWI.instance("ADCSEQ1_swi").comment = "Analog to Digital Converter Interrupt Service Routine"; bios.SWI.instance("ADCSEQ1_swi").fxn = prog.extern("ADC_SWI"); bios.SWI.instance("ADCSEQ1_swi").priority = 14; bios.SWI.instance("ADCSEQ1_swi").fxn = prog.extern("ADC_SEQ1_SWI"); bios.SWI.instance("ADCSEQ1_swi").priority = 12; bios.SWI.create("ADCSEQ2_swi"); bios.SWI.instance("ADCSEQ2_swi").order = 7; bios.SWI.instance("ADCSEQ2_swi").priority = 14; bios.SWI.instance("ADCSEQ2_swi").priority = 11; bios.SWI.instance("ADCSEQ2_swi").fxn = prog.extern("ADC_SEQ2_SWI"); bios.SWI.instance("ADCSEQ2_swi").priority = 6; bios.MEM.GBLINITSEG = prog.get("FLASH"); bios.MEM.BIOSSEG = prog.get("FLASH"); bios.MEM.SYSINITSEG = prog.get("FLASH"); bios.MEM.HWISEG = prog.get("FLASH"); bios.MEM.RTDXTEXTSEG = prog.get("FLASH"); bios.MEM.TEXTSEG = prog.get("FLASH"); bios.MEM.SWITCHSEG = prog.get("FLASH"); bios.MEM.CINITSEG = prog.get("FLASH"); bios.MEM.PINITSEG = prog.get("FLASH"); bios.MEM.ECONSTSEG = prog.get("FLASH"); bios.MEM.CONSTSEG = prog.get("FLASH"); bios.MEM.DATASEG = prog.get("FLASH"); bios.MEM.ENABLELOADADDR = 1; bios.MEM.LOADBIOSSEG = prog.get("FLASH"); bios.MEM.LOADSYSINITSEG = prog.get("FLASH"); bios.MEM.LOADGBLINITSEG = prog.get("FLASH"); bios.MEM.LOADTRCDATASEG = prog.get("FLASH"); bios.MEM.LOADTEXTSEG = prog.get("FLASH"); bios.MEM.LOADSWITCHSEG = prog.get("FLASH"); bios.MEM.LOADCINITSEG = prog.get("FLASH"); bios.MEM.LOADPINITSEG = prog.get("FLASH"); bios.MEM.LOADECONSTSEG = prog.get("FLASH"); bios.MEM.LOADCONSTSEG = prog.get("FLASH"); bios.MEM.LOADDATASEG = prog.get("FLASH"); bios.MEM.LOADHWISEG = prog.get("FLASH"); bios.MEM.LOADHWIVECSEG = prog.get("FLASH"); bios.MEM.LOADRTDXTEXTSEG = prog.get("FLASH"); bios.GBL.CALLUSERINITFXN = 1; bios.GBL.USERINITFXN = prog.extern("UserInit"); // Added .base and .len for L03SARAM - 2013-09-19 bios.MEM.instance("L03SARAM").base = 0x008000; bios.MEM.instance("L03SARAM").len = 0x004000; bios.MEM.instance("L03SARAM").space = "code"; bios.MEM.instance("FLASH").len = 0x3fff6; bios.MEM.create("BEGIN_FLASH"); bios.MEM.instance("BEGIN_FLASH").space = "code"; bios.MEM.instance("BEGIN_FLASH").base = 0x33fff6; bios.MEM.instance("BEGIN_FLASH").len = 0x0002; bios.MEM.instance("FLASH").len = 0x3ff80; bios.MEM.create("CSM_RSVD"); bios.MEM.instance("CSM_RSVD").base = 0x33ff80; bios.MEM.instance("CSM_RSVD").len = 0x0076; bios.MEM.instance("CSM_RSVD").space = "code"; bios.MEM.create("PASSWORDS"); bios.MEM.instance("PASSWORDS").base = 0x33fff8; bios.MEM.instance("PASSWORDS").len = 0x0008; bios.MEM.instance("PASSWORDS").space = "code"; bios.SWI.create("CURRENTLOOPA_swi"); bios.SWI.instance("CURRENTLOOPA_swi").order = 8; bios.SWI.instance("CURRENTLOOPA_swi").priority = 14; bios.SWI.instance("CURRENTLOOPA_swi").priority = 11; bios.SWI.instance("CURRENTLOOPA_swi").fxn = prog.extern("CurrentLoopPhaseA_SWI"); bios.SWI.create("CURRENTLOOPB_swi"); bios.SWI.instance("CURRENTLOOPB_swi").order = 9; bios.SWI.instance("CURRENTLOOPB_swi").priority = 14; bios.SWI.instance("CURRENTLOOPB_swi").priority = 11; bios.SWI.instance("CURRENTLOOPB_swi").fxn = prog.extern("CurrentLoopPhaseB_SWI"); bios.SWI.create("CURRENTLOOPC_swi"); bios.SWI.instance("CURRENTLOOPC_swi").order = 10; bios.SWI.instance("CURRENTLOOPC_swi").priority = 14; bios.SWI.instance("CURRENTLOOPC_swi").priority = 11; bios.SWI.instance("CURRENTLOOPC_swi").fxn = prog.extern("CurrentLoopPhaseC_SWI"); // Added .base and .len for L47SARAM - 2013-09-19 bios.MEM.instance("L47SARAM").base = 0x00c000; bios.MEM.instance("L47SARAM").len = 0x004000; bios.MEM.instance("L47SARAM").space = "data"; bios.LCK.create("SPIBUSY_lck"); bios.LCK.instance("SPIBUSY_lck").comment = "This lock indicates that the SPI module is busy."; bios.SEM.create("READTEMPS_sem"); bios.SEM.instance("READTEMPS_sem").comment = "This semaphore tells whether it is ok to allow the Read Temperatures Task to activate"; bios.TSK.instance("TSK_idle").order = 1; bios.TSK.create("READTEMPS_tsk"); bios.TSK.instance("READTEMPS_tsk").order = 3; bios.TSK.instance("READTEMPS_tsk").fxn = prog.extern("CheckTemperatures_TSK"); bios.PRD.create("TICKLEREADTEMPS_prd"); bios.PRD.instance("TICKLEREADTEMPS_prd").order = 3; bios.PRD.instance("TICKLEREADTEMPS_prd").fxn = prog.extern("TickleReadTemps_SWI"); bios.PRD.instance("TICKLEREADTEMPS_prd").period = 100; bios.PRD.instance("TICKLEREADTEMPS_prd").comment = "This periodic function causes the Read Temperatures function to activate every 100 ms"; bios.PIE.instance("PIE_INT6_1").fxn = prog.extern("SPIINTA_ISR"); bios.PIE.instance("PIE_INT6_1").useDispatcher = 1; bios.SEM.create("SPIMSGRDY_sem"); bios.SEM.instance("SPIMSGRDY_sem").comment = "A positive count on this semaphore indicates a message is ready in the SPI RX buffer"; bios.SEM.create("CANATXREADY_sem"); bios.SEM.instance("CANATXREADY_sem").comment = "A Positive count on this semaphore indicates that the CAN A module is ready to transmit a new mess"; bios.SEM.instance("CANATXREADY_sem").count = 1; bios.SEM.create("CANBTXREADY_sem"); bios.SEM.instance("CANBTXREADY_sem").comment = "A Positive count on this semaphore indicates that the CAN B module is ready to transmit a new mess"; bios.SEM.instance("CANBTXREADY_sem").count = 1; bios.PIE.instance("PIE_INT9_5").fxn = prog.extern("ECAN0INTA_ISR"); bios.PIE.instance("PIE_INT9_5").useDispatcher = 1; bios.PIE.instance("PIE_INT9_6").fxn = prog.extern("ECAN1INTA_ISR"); bios.PIE.instance("PIE_INT9_6").useDispatcher = 1; bios.PIE.instance("PIE_INT9_7").fxn = prog.extern("ECAN0INTB_ISR"); bios.PIE.instance("PIE_INT9_7").useDispatcher = 1; bios.PIE.instance("PIE_INT9_8").fxn = prog.extern("ECAN1INTB_ISR"); bios.PIE.instance("PIE_INT9_8").useDispatcher = 1; bios.SWI.create("ECAN0INTA_swi"); bios.SWI.instance("ECAN0INTA_swi").order = 11; bios.SWI.instance("ECAN0INTA_swi").priority = 14; bios.SWI.instance("ECAN0INTA_swi").priority = 4; bios.SWI.instance("ECAN0INTA_swi").fxn = prog.extern("ECAN0INTA_SWI"); bios.SWI.create("ECAN1INTA_swi"); bios.SWI.instance("ECAN1INTA_swi").order = 12; bios.SWI.instance("ECAN1INTA_swi").priority = 14; bios.SWI.instance("ECAN1INTA_swi").priority = 2; bios.SWI.instance("ECAN1INTA_swi").fxn = prog.extern("ECAN1INTA_SWI"); bios.SWI.create("ECAN0INTB_swi"); bios.SWI.instance("ECAN0INTB_swi").order = 13; bios.SWI.instance("ECAN0INTB_swi").priority = 14; bios.SWI.instance("ECAN0INTB_swi").priority = 4; bios.SWI.instance("ECAN0INTB_swi").fxn = prog.extern("ECAN0INTB_SWI"); bios.SWI.create("ECAN1INTB_swi"); bios.SWI.instance("ECAN1INTB_swi").order = 14; bios.SWI.instance("ECAN1INTB_swi").priority = 14; bios.SWI.instance("ECAN1INTB_swi").fxn = prog.extern("ECAN1INTB_SWI"); bios.SWI.instance("ECAN1INTB_swi").priority = 2; bios.TSK.create("SENDCANMSGS_tsk"); bios.TSK.instance("SENDCANMSGS_tsk").order = 4; bios.TSK.instance("SENDCANMSGS_tsk").fxn = prog.extern("SendCANMessages_TSK"); bios.TSK.instance("READTEMPS_tsk").priority = 2; bios.TSK.instance("READTEMPS_tsk").priority = 1; bios.TSK.instance("SENDCANMSGS_tsk").priority = 2; bios.SEM.create("SENDCANMSGS_sem"); bios.SEM.instance("SENDCANMSGS_sem").comment = "This semaphore tells whether it is ok to allow the SendCANMessages task to activate"; bios.PRD.create("TICKLESENDCANMSGS_prd"); bios.PRD.instance("TICKLESENDCANMSGS_prd").order = 4; bios.PRD.instance("TICKLESENDCANMSGS_prd").period = 100; bios.PRD.instance("TICKLESENDCANMSGS_prd").comment = "This periodic function calls the Send CAN Messages task to activate every 100 ms"; bios.PRD.instance("TICKLESENDCANMSGS_prd").fxn = prog.extern("TickleSendCANMessages_SWI"); bios.PRD.instance("TICKLEREADTEMPS_prd").order = 2; bios.PRD.instance("TICKLESENDCANMSGS_prd").order = 3; bios.PRD.instance("TICKLEREADTEMPS_prd").order = 1; bios.PRD.instance("GLedBlink_PRD").order = 2; bios.PRD.instance("TICKLESENDCANMSGS_prd").order = 2; bios.PRD.instance("GLedBlink_PRD").order = 3; bios.CLK.instance("PRD_clock").order = 1; bios.SEM.create("TIMEOUT_sem"); bios.SEM.instance("TIMEOUT_sem").comment = "This Semaphore will never be posted. Any function can pend on it for a finite amount of time in o"; bios.TSK.create("DEBUGTASKS_tsk"); bios.TSK.instance("DEBUGTASKS_tsk").order = 5; bios.TSK.instance("DEBUGTASKS_tsk").fxn = prog.extern("DebugTasks_TSK"); bios.TSK.instance("READTEMPS_tsk").order = 2; bios.TSK.instance("DEBUGTASKS_tsk").order = 3; bios.TSK.instance("DEBUGTASKS_tsk").order = 2; bios.TSK.instance("READTEMPS_tsk").order = 3; bios.PRD.instance("TICKLEREADTEMPS_prd").period = 250; bios.PRD.instance("TICKLEREADTEMPS_prd").comment = "This periodic function causes the Read Temperatures function to activate every 250 ms"; bios.TSK.instance("DEBUGTASKS_tsk").priority = 15; bios.SEM.create("SPIBUSY_sem"); bios.SEM.instance("SPIBUSY_sem").count = 1; bios.SEM.instance("SPIBUSY_sem").comment = "This semaphore will be checked out if any task is currently using the SPI module"; bios.SEM.instance("SPIBUSY_sem").destroy(); bios.TSK.instance("DEBUGTASKS_tsk").priority = 1; bios.TSK.instance("SENDCANMSGS_tsk").priority = 3; bios.TSK.instance("READTEMPS_tsk").priority = 2; bios.SEM.create("COMPLETEINIT_sem"); bios.SEM.instance("COMPLETEINIT_sem").comment = "When this semaphore is posted, it means that the processor must complete initialization by loading"; bios.TSK.create("COMPLETEINIT_tsk"); bios.TSK.instance("COMPLETEINIT_tsk").order = 5; bios.TSK.instance("COMPLETEINIT_tsk").priority = 15; bios.TSK.instance("COMPLETEINIT_tsk").comment = "This task completes initialization steps which must occur at the task level"; bios.TSK.instance("COMPLETEINIT_tsk").fxn = prog.extern("CompleteInitialization_TSK"); bios.PRD.create("RESETWATCHDOG_prd"); bios.PRD.instance("RESETWATCHDOG_prd").order = 4; bios.PRD.instance("RESETWATCHDOG_prd").period = 1; bios.PRD.instance("RESETWATCHDOG_prd").comment = "Resets the watchdog timer"; bios.PRD.instance("RESETWATCHDOG_prd").fxn = prog.extern("ResetWatchdogTimer_SWI"); bios.SEM.create("STATEMACHINE_sem"); bios.SEM.instance("STATEMACHINE_sem").comment = "This semaphore tells the StateMachine_TSK() task to execute the number of times as the semaphore c"; bios.TSK.create("STATEMACHINE_tsk"); bios.TSK.instance("STATEMACHINE_tsk").order = 6; bios.TSK.instance("STATEMACHINE_tsk").comment = "This task runs the main state machine on the dsp."; bios.TSK.instance("STATEMACHINE_tsk").priority = 8; bios.TSK.instance("STATEMACHINE_tsk").fxn = prog.extern("StateMachine_TSK"); bios.PRD.create("TICKLESTATEMACHINE_prd"); bios.PRD.instance("TICKLESTATEMACHINE_prd").order = 5; bios.PRD.instance("TICKLESTATEMACHINE_prd").period = 2; bios.PRD.instance("TICKLESTATEMACHINE_prd").fxn = prog.extern("TickleStateMachine_SWI"); bios.PRD.instance("GLedBlink_PRD").order = 1; bios.PRD.instance("TICKLEREADTEMPS_prd").order = 2; bios.PRD.instance("TICKLESTATEMACHINE_prd").order = 3; bios.PRD.instance("TICKLESENDCANMSGS_prd").order = 4; bios.PRD.instance("RESETWATCHDOG_prd").order = 5; bios.PRD.instance("TICKLESTATEMACHINE_prd").order = 2; bios.PRD.instance("TICKLEREADTEMPS_prd").order = 3; bios.PRD.instance("TICKLESENDCANMSGS_prd").order = 3; bios.PRD.instance("TICKLEREADTEMPS_prd").order = 4; bios.PRD.instance("RESETWATCHDOG_prd").order = 2; bios.PRD.instance("TICKLESTATEMACHINE_prd").order = 3; bios.PRD.instance("TICKLESENDCANMSGS_prd").order = 4; bios.PRD.instance("TICKLEREADTEMPS_prd").order = 5; bios.PRD.instance("RESETWATCHDOG_prd").order = 1; bios.PRD.instance("TICKLESTATEMACHINE_prd").order = 2; bios.PRD.instance("TICKLESENDCANMSGS_prd").order = 3; bios.PRD.instance("TICKLEREADTEMPS_prd").order = 4; bios.PRD.instance("GLedBlink_PRD").order = 5; bios.PRD.instance("TICKLESTATEMACHINE_prd").comment = "This periodic function causes the primary state machine function to activate every 2 ms"; bios.TSK.instance("DEBUGTASKS_tsk").priority = 2; bios.TSK.instance("SENDCANMSGS_tsk").priority = 4; bios.TSK.instance("READTEMPS_tsk").priority = 3; bios.TSK.create("SERVICEWATCHDOG_tsk"); bios.TSK.instance("SERVICEWATCHDOG_tsk").order = 7; bios.TSK.instance("SERVICEWATCHDOG_tsk").comment = "This task resets the watchdog timer. "; bios.TSK.instance("SERVICEWATCHDOG_tsk").fxn = prog.extern("ServiceWatchdog_TSK"); bios.SEM.create("SERVICEWATCHDOG_sem"); bios.SEM.instance("SERVICEWATCHDOG_sem").comment = "This semaphore tells the ServiceWatchdog_TSK() task to execute the number of times as the semaphor"; bios.PRD.instance("TICKLESTATEMACHINE_prd").period = 1; bios.TSK.create("RUNCONTACTOR_tsk"); bios.TSK.instance("RUNCONTACTOR_tsk").order = 8; bios.TSK.instance("SENDCANMSGS_tsk").priority = 5; bios.TSK.instance("RUNCONTACTOR_tsk").priority = 4; bios.TSK.instance("RUNCONTACTOR_tsk").comment = "This task, when activated, enables the precharge then run contactor."; bios.TSK.instance("RUNCONTACTOR_tsk").fxn = prog.extern("EnableContactor_TSK"); bios.SEM.create("ENABLECONTACTOR_sem"); bios.SEM.instance("ENABLECONTACTOR_sem").comment = "This semaphore tells whether the run contactor must be enabled"; bios.SEM.create("READWRITESAVEDVAR_sem"); bios.SEM.instance("READWRITESAVEDVAR_sem").comment = "This semaphore is posted whenever a read/write saved variable command message is received. It tel"; bios.TSK.create("READWRITESAVEDVAR_tsk"); bios.TSK.instance("READWRITESAVEDVAR_tsk").order = 9; bios.TSK.instance("READWRITESAVEDVAR_tsk").comment = "This task handles a request to read/write a saved variable in EEPROM"; bios.TSK.instance("READWRITESAVEDVAR_tsk").fxn = prog.extern("ReadWriteSavedVar_TSK"); bios.TSK.instance("READWRITESAVEDVAR_tsk").priority = 2; bios.PRD.instance("GLedBlink_PRD").period = 250; bios.PRD.instance("TICKLESENDCANMSGS_prd").period = 250; bios.PRD.instance("TICKLESENDCANMSGS_prd").comment = "This periodic function calls the Send CAN Messages task to activate every 250 ms"; bios.TSK.instance("STATEMACHINE_tsk").priority = 6; bios.TSK.instance("COMPLETEINIT_tsk").priority = 7; bios.MEM.STACKSIZE = 0x0500; bios.TSK.instance("COMPLETEINIT_tsk").priority = 15; bios.TSK.instance("STATEMACHINE_tsk").priority = 13; bios.TSK.instance("RUNCONTACTOR_tsk").priority = 7; bios.TSK.instance("STATEMACHINE_tsk").priority = 8; bios.TSK.instance("RUNCONTACTOR_tsk").priority = 4; bios.MEM.instance("SRAM").space = "data"; bios.MEM.instance("SRAM").space = "code/data"; bios.MEM.instance("SRAM").space = "data"; bios.MEM.ECONSTSEG = prog.get("L47SARAM"); bios.MEM.ECONSTSEG = prog.get("SRAM"); bios.MEM.ECONSTSEG = prog.get("L47SARAM"); bios.SEM.instance("CANATXREADY_sem").count = 0; bios.SEM.instance("CANBTXREADY_sem").count = 0; // !GRAPHICAL_CONFIG_TOOL_SCRIPT_INSERT_POINT! prog.gen();