This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM2634-Q1: SemaphoreP in epwm example

Part Number: AM2634-Q1

Dear Champs,

I found there were SemaphoreP APIs in epwm example.

for example, in epwm_hr_duty_cycle.c example, I found below SemaphoreP APIs as below.

Could you please let me know why these SemaphoreP APIs used in these epwm examples?

Should these SemaphoreP APIs be used in single core application?

Should these SemaphoreP APIs be used in multi-core application even when only one core access epwm?

Where I can find details on these Semaphore APIs?

Actually when my customer implemented their own source to use epwm ISR without these Semaphore APIs, they faced hang in the ISR. Should they add these Semaphore APIs?

~~~~~~`

/* Get Address of ePWM */
gEpwmBaseAddr = CONFIG_EPWM_BASE_ADDR;

status = SemaphoreP_constructCounting(&gEpwmSyncSemObject, 0, numIsrCnt);
DebugP_assert(SystemP_SUCCESS == status);

/* Register & enable interrupt */
HwiP_Params_init(&hwiPrms);
/* Integrate with Syscfg */
hwiPrms.intNum = CSLR_R5FSS0_CORE0_CONTROLSS_INTRXBAR0_OUT_0;
hwiPrms.callback = &App_epwmIntrISR;
/* Integrate with Syscfg */
hwiPrms.isPulse = APP_INT_IS_PULSE;
status = HwiP_construct(&gEpwmHwiObject, &hwiPrms);
DebugP_assert(status == SystemP_SUCCESS);

EPWM_clearEventTriggerInterruptFlag(gEpwmBaseAddr);

while(numIsrCnt > 0)
{
SemaphoreP_pend(&gEpwmSyncSemObject, SystemP_WAIT_FOREVER);
numIsrCnt--;
}

EPWM_disableInterrupt(gEpwmBaseAddr);
EPWM_clearEventTriggerInterruptFlag(gEpwmBaseAddr); /* Clear any pending interrupts if any */
HwiP_destruct(&gEpwmHwiObject);
SemaphoreP_destruct(&gEpwmSyncSemObject);

DebugP_log("EPWM Duty Cycle Test Passed!!\r\n");
DebugP_log("All tests have passed!!\r\n");

Board_driversClose();
Drivers_close();
}


~~~~~~~

Thanks and Best Regards,

SI.