Other Parts Discussed in Thread: EK-TM4C1294XL
Tool/software: TI-RTOS
I do not receive the correct number when setting up a HWI through the .cfg file. The value arg comes in with random values. The HWI is set up with:
/* ================ Application Specific Instances ================ */ var halHwi0Params = new halHwi.Params(); halHwi0Params.instance.name = "ResetIP"; halHwi0Params.arg = 6; halHwi0Params.priority = 5; Program.global.ResetIP = halHwi.create(68, "&IPButtonISR", halHwi0Params);
This was generated for me automatically by the XGCONF GUI. and it looks correct according to the user guide. My HWI code is:
//toggle the debug LED for now void IPButtonISR(UArg arg){ uint32_t ui32Status = GPIOIntStatus(GPIO_PORTK_BASE, true); GPIOIntClear(GPIO_PORTK_BASE, ui32Status); uint32_t debugLEDState = GPIOPinRead(GPIO_PORTP_BASE, GPIO_PIN_4); GPIOPinWrite(GPIO_PORTP_BASE, GPIO_PIN_4, ~debugLEDState); }
I noticed this error because I am confused on the form of HWI. I have seen example code taking the form void HWI_function(void), but I do not understand what happens when you pass arguments to a function that doesn't accept arguments. GCC won't let me do this.
A HWI successfully gets the correct arg value every time when created dynamically:
//this is the code at the end of main() InitTimer(); Hwi_Handle hwi0; Hwi_Params hwiParams; Error_Block eb; Error_init(&eb); Hwi_Params_init(&hwiParams); hwiParams.arg = 5; hwiParams.priority = 7; hwiParams.instance->name = "example HWI"; hwi0 = Hwi_create(39, myTimerISR, &hwiParams, &eb); if (hwi0 == NULL) { while(1); } /* Start BIOS */ BIOS_start(); return (0); } void myTimerISR(UArg arg){ dummy = 0; dummy++; }
The ROV agrees with the .cfg file as to what arg should be, but the same screenshot shows that the value given is not what I expect: