Results 1 to 6 of 6

Thread: GP2x: accessing hw regs from asm

  1. #1

    GP2x: accessing hw regs from asm

    I translated the SDL function gp2x_joystick_read to Pascal, using fpMmap and /dev/mem.

    Will the ARM throw an exception if I access the hw regs directly? I could 'try', but I'd like to know the proper way to do full access full speed hw access.

    I dunno how many GP2x guys are on here... getting an answer is a long shot maybe?
    Henrik Erlandsson, programmer
    <br />bitBrain Studios, bitbrain.se
    <br />(Done 7 sites so far, but who's counting?)

  2. #2

    GP2x: accessing hw regs from asm

    AFAIK you can access hw registers in two way:

    [pascal]
    const
    MY_REGISTER: pinteger = pointer($04000000);
    ...
    MY_REGISTER^ := $B00B5
    [/pascal]
    or
    [pascal]
    var
    MY_REGISTER: pinteger absolute $04000000;
    ...
    MY_REGISTER^ := $B00B5
    [/pascal]

    I do it in arm nds and all works without exceptions, though I don't know if it works fine on gp2x because the linux OS :?
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

  3. #3

    GP2x: accessing hw regs from asm

    Thanks for anwering!

    But how do you know the hardware registers start on $04000000 on the gp2x??


    For system-stuff and games I would probably use SDL/Open2X or something. But for a demo, the ultimate goal is to

    1. Get some resources from the OS with SWI's and own them, or point the hardware to my own buffers etc.
    2. Get control of the interrupts and replace them with my own (simplification: turn off all ints and start my own little vsync interrupt
    3. When demo is exited, provide a clean exit to menu after returning interrupts and resources to the system.

    It's the way I make demos on all platforms, and I want to make sure I have full control and performance, i.e. no processes running in the background... it's not like people play videos or read pdfs while watching demos or playing games anyway

    I would like to access hw regs physically, uncached. Frame and sound buffer could be taken from the upper 32MB, just don't know how to "malloc", mmapping means virtual access (?) which is slow and can't be used in asm.

    But I'd still like to get base pointers etc, in case something is moved between firmware versions.
    Henrik Erlandsson, programmer
    <br />bitBrain Studios, bitbrain.se
    <br />(Done 7 sites so far, but who's counting?)

  4. #4

    GP2x: accessing hw regs from asm

    You can access the hardware registers on the gp2x if you mmap them into your address space. To do so you open /dev/mem and then mmap a page at the right offset. It is very easy to do.

  5. #5

    GP2x: accessing hw regs from asm

    The GP2X should have an open source sdk. Try to get the infos you need from it
    BTW, try to ask in the official GP2X forums too and read this thread:

    http://www.gp32x.com/board/index.php?showtopic=27433
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

  6. #6

    GP2x: accessing hw regs from asm

    Yep, I was on page 5 of the thread when I asked this, he seemed to do it with /dev/mem, so...

    Is there a full list of hw registers and their bits, with official names of the constants? Or do you have to 'extract' them from the MagicEyes PDF? I have 100+MB of PDFs, still haven't found one

    I'll be happy to make such a list if the info is available! But it almost seems like you have to talk to the chip companies to get the info
    Henrik Erlandsson, programmer
    <br />bitBrain Studios, bitbrain.se
    <br />(Done 7 sites so far, but who's counting?)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •