none
WEC7 - error when trying to read IO structure at virtual address set by MmMapIOSpace RRS feed

  • Question

  • Hi everyone

    (using Adeneo BSP for TI AM335x)

    In the backlight driver for this BSP I've added MmMapIOSpace to map the ECAP register structure at Physical Address 0x48300100 and I get a Virtual Address of 0x90300100.

    When I use this VA in the driver IOControl() block using

    DWORD revID = pECAP_REGS->REVID;  //pECAP_REGS contains VA

    I get the following exception

    PID:00400002 TID:067A000A +GPIO_Backlight::IOControl()
    PID:00400002 TID:067A000A dwIoControlCode = (0x0000003C)
    PID:00400002 TID:067A000A GPIO_Backlight::IOControl() -  ECAP Vaddr = 0x90300100

    PID:00400002 TID:067A000A Exception 'Data Abort' (0x4): Thread-Id=067a000a(pth=9e903000), Proc-Id=00400002(pprc=8624e5e0) 'NK.EXE', VM-active=0678000a(pprc=9e877000) 'BackLight_GPIO.exe'
    PID:00400002 TID:067A000A PC=ef1917a8(backlight.dll+0x000017a8) RA=80037254(kernel.dll+0x00008254) SP=adc7fc70, BVA=00000000

    PID:00400002 TID:067A000A Exception 'Raised Exception' (0x116): Thread-Id=067a000a(pth=9e903000), Proc-Id=00400002(pprc=8624e5e0) 'NK.EXE', VM-active=0678000a(pprc=9e877000) 'BackLight_GPIO.exe'
    PID:00400002 TID:067A000A PC=eff6ee40(k.coredll.dll+0x0001ee40) RA=8003d648(kernel.dll+0x0000e648) SP=adc7f378, BVA=ffffffff

    The IOControl() is invoked from a C#.NET app. If in the IOControl() I return a constant DWORD instead it gets returned to the .NET app with no errors so the IOControl() mechanism seems to be working ok.

    I know the line DWORD revID = pECAP_REGS->REVID; is causing the exception - can anyone see from the error message anything I'm doing wrong or should be doing?

    Thanks
    Terry

     

    Tuesday, October 28, 2014 10:55 AM

Answers

  • Problem solved from another thread - nothing wrong with the code just that the Peripheral Clock was not switched on so was never going to work.
    • Marked as answer by Terence P Tuesday, November 4, 2014 11:07 AM
    Tuesday, November 4, 2014 11:07 AM

All replies

  • Is REVID the first field in the mapped structure?  From the exception (BVA) it seems that you try to access through a NULL pointer.


    Tuesday, October 28, 2014 7:20 PM
  • After you map with MmMapIoSpace you need to access the registrer as follows:

    UINT32 u32RevID = INREG32(&pECAP_REGS->REVID);

    or, if INREG32 is not available:

    UINT32 u32RevID = READ_REGISTER_ULONG((ULONG*)&pECAP_REGS->REVID);


    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: http://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    http://guruce.com
    Consultancy, training and development services.

    Wednesday, October 29, 2014 12:55 AM
    Moderator
  • Mario, Michel

    Thanks for the replies but still no luck trying to sort this.

    The VA I get from MmMapIOSpace is tested before using and its value is output using a RETAILMSG. It is not zero but looks to be a valid VA. The INREG32() makes no difference either.

    Now I'm really at a loss as to what to do next.

    Terry  

     
    Wednesday, October 29, 2014 10:04 AM
  • Also, make sure that you are providing proper NumberOfBytes in MmMapIoSpace, I think in your case it is sizeof(ECAP_REGS). :)

    Keshava G N ,
    Member - Technical (Software) ,
    iWave Systems Technologies Pvt. Ltd., Bangalore .
    Company Website: http://iwavesystems.com
    e-mail : keshavaDOTgnATgmailDOTcom
    Blog : http://wec7.blogspot.in
    Skype : keshava.gn
    Phone: +91-8861520851

    :)

    Wednesday, October 29, 2014 11:26 AM
  • Problem solved from another thread - nothing wrong with the code just that the Peripheral Clock was not switched on so was never going to work.
    • Marked as answer by Terence P Tuesday, November 4, 2014 11:07 AM
    Tuesday, November 4, 2014 11:07 AM