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.

OMAP Timer4 Virtual Address not able to get in driver

Other Parts Discussed in Thread: OMAP3530

Hi
I am using the OMAP 3530 BSP. I am not able to get virtual address for Timer4 using MmmapIOSpace(). My  aim is to use the 2 timers to operate the stepper motor but I couldn't able to get the virtual address and because of this  i couldn't configure the timer.  I am trying this process in driver.

FYI: But i can able to get virtual address for Timer1.
--
Thanks&Regards
Raja.S

  • I dont see a reason why you should not be able to map Timer 4 registers. Can you please share some more information about the issue you are seeing? Code snippet for your Timer4 mmap code will help. Also, what is the error that you are seeing - MmmapIOSpace() returns an error code and a null virtual pointer or you get a wrong virtual pointer? Are you trrying this from kernel-mode driver or user-mode?

    -Madhvi

  • Hi Madhvi

    Thanks for your reply

    Here is the code
    ----------------
    OMAP_GPTIMER_REGS* g_pTimer4Regs;
    pa.QuadPart = OMAP_GPTIMER4_REGS_PA;
    g_pTimer4Regs = (OMAP_GPTIMER_REGS *)MmMapIoSpace(pa,
    sizeof(OMAP_GPTIMER_REGS), FALSE);
    if (g_pTimer4Regs == NULL)
    {
    RETAILMSG(RETAIL_DEBUG_ENABLE,(TEXT("g_pTimerRegs is NULL:\r\n")));
    }
    RETAILMSG(1,(TEXT("g_pTimer4Regs Address =
    0x%X\r\n"),&(g_pTimer4Regs->TIDR)) );
    RETAILMSG(1,(TEXT("g_pTimer4Regs = 0x%X\r\n"),(g_pTimer4Regs->TIDR)) );
    ---------------------------------------------------------------------

    Here is the debug output
    ------------------------
    g_pTimer4Regs Address = 0xD3956000
    Exception 'Data Abort' (4): Thread-Id=00a40002(pth=8af44c60),
    Proc-Id=00400002(p
    prc=85e31308) 'NK.EXE', VM-active=00c30006(pprc=8acc84a4) 'udevice.exe'
    PC=d3b5596c(stmotor.dll+0x0000596c) RA=d3b5596c(stmotor.dll+0x0000596c)
    SP=d02ae
    c10, BVA=00000000
    Exception 'Raised Exception' (-1): Thread-Id=00a40002(pth=8af44c60),
    Proc-Id=004
    00002(pprc=85e31308) 'NK.EXE', VM-active=00c30006(pprc=8acc84a4) 'udevice.exe'
    PC=c003bc70(k.coredll.dll+0x0001bc70) RA=8402c4c8(kernel.dll+0x000064c8)
    SP=d02a
    e4ac, BVA=ffffffff

    FYI: Using the same code i can get the Virtual address for Timer1 and can retrieve the value.


    It is Kernel Mode Driver.

     

    Thanks & Regards

    Raja.S.

  • Hi Raja,

    One possible reason for the issue you are seeing is that the clock for the particular controller you are accessing is not setup.

    I believe there are two ways to do it in the OMAP3530 BSP:
    - In the bootloader, by setting the appropriate CM_FCLKEN and CM_ICLKEN registers (check the OMAP3530 datasheet to know what TIMER4 corresponds to)
    - In the OS image, by calling PrcmDeviceEnableIClock and PrcmDeviceEnableFClock

    Hope this helps,

    Sebastien Ronsse
    Embedded Software Engineer
    Adeneo Embedded

  • Hi Raja,

    After quickly checking, I believe all you need to do is set the EN_GPT4 bit in CM_FCLKEN_PER and CM_ICLKEN_PER beforehand.

    Regards,

    Sebastien Ronsse
    Embedded Software Engineer
    Adeneo Embedded 

  • Hi Sebastien

    Thanks for your reply.

    Yes you are right.. After enabling the FCLK and ICLK i can able to access the Timer without any data abort.

    Once again Thank you for your repl..

    Regards

    Raja