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.

TDA4VM: Adjust the time period

Part Number: TDA4VM


Hi team,

SDK: Processor SDK RTOS J721E 08_06_01

1) If the customer want to adjust the time period, are there any requirements other than using TIMERPreScalerClkEnable? 

static void csldmTimerTest_Stub(uintptr_t arg)
{
  uint32_t baseAddr = (uint32_t) (CSL_TIMER12_CFG_BASE);

  //TIMERPreScalerClkEnable(CSL_TIMER12_CFG_BASE, TIMER_PRESCALER_CLK_DIV_BY_256);

  /* Disable the Timer interrupts */
  TIMERIntDisable(baseAddr, TIMER_INT_OVF_EN_FLAG);

  /* acknowledge the interrupt */
  TIMERIntStatusClear(baseAddr, TIMER_IRQSTATUS_OVF_IT_FLAG_MASK);

  printf("Timer Interrupt\n");

   /* Enable the Timer interrupts */
  TIMERIntEnable(baseAddr, TIMER_INT_OVF_EN_FLAG);
}

static int32_t csldmTimer_registerTimerInt(void)
{
    int32_t                  testStatus;
    OsalInterruptRetCode_e   retVal;
    OsalRegisterIntrParams_t interruptRegParams;
    /* Initialize with defaults */
    Osal_RegisterInterrupt_initParams(&interruptRegParams);

    /* Populate the interrupt parameters */
    interruptRegParams.corepacConfig.arg = (uintptr_t) CSL_TIMER12_CFG_BASE;
    interruptRegParams.corepacConfig.name = NULL;
    interruptRegParams.corepacConfig.isrRoutine = csldmTimerTest_Stub;
    interruptRegParams.corepacConfig.triggerSensitivity =  OSAL_ARM_GIC_TRIG_TYPE_HIGH_LEVEL;
    interruptRegParams.corepacConfig.priority = 0xFU; // R5: 0-15

    interruptRegParams.corepacConfig.intVecNum = CSLR_R5FSS0_CORE0_INTR_TIMER12_INTR_PEND_0; /* Host Interrupt vector */
    interruptRegParams.corepacConfig.corepacEventNum = CSLR_R5FSS0_CORE0_INTR_TIMER12_INTR_PEND_0;

    printf("Register interrupts\n");
    /* Register interrupts */
    retVal = Osal_RegisterInterrupt(&interruptRegParams,&(gdmTimerTest_HwiPHandle));

    printf("retVal %d\n", retVal);

    if (retVal == OSAL_INT_SUCCESS)
    {
        testStatus = CSL_APP_TEST_PASS;
    }
    else        
    {    
        testStatus = CSL_APP_TEST_FAILED;
    }
    return (testStatus);
}

static void appMain(void* arg0, void* arg1)
{
    appUtilsTaskInit();
    appInit();
    appRun();
    #if 1
    appLogPrintf("mcu2_0: Task - start\n");

    TIMERPreScalerClkEnable(CSL_TIMER12_CFG_BASE, TIMER_PRESCALER_CLK_DIV_BY_256);
    csldmTimer_registerTimerInt();

    while(1)
    {
        appLogWaitMsecs(100u);
        appLogPrintf("mcu2_0: Task - appMain\n");
    }
    #else
    appDeInit();
    #endif
}

int main(void)
{
    TaskP_Params tskParams;
    TaskP_Handle task;

    /* This is moved before the wait function as NDK comes up with BIOS
        and looks for semaphore handle created by appEthFwEarlyInit() */
#ifdef ENABLE_ETHFW
    appEthFwEarlyInit();
#endif

    /* This is for debug purpose - see the description of function header */
    StartupEmulatorWaitFxn();

    OS_init();

    TaskP_Params_init(&tskParams);
    tskParams.priority = 8u;
    tskParams.stack = gTskStackMain;
    tskParams.stacksize = sizeof (gTskStackMain);
    task = TaskP_create(&appMain, &tskParams);

    //csldmTimer_registerTimerInt();

    if(NULL == task)
    {
        OS_stop();
    }

    OS_start();
    
    return 0;
}

2) If csldmTimer_registerTimerInt is started on appMain of Task, the Timer interrupt has an action, but Task is stuck (printf log in while does not output). However, if csldmTimer_registerTimerInt is started in main, Task can output normally (printf log within while). 

The customer will then switch to TimerP.h and now work as expected. But why is there a problem with dmTimer with CSL? 

Could you help check this case? Thanks.

Best Regards,

Cherry