Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

Device Driver problem

hello Guys,

I am new to Nios and uClinux

I have written a simple device driver for a nios custom peripheral

After configuring the peripheral ,through the driver, the peripheral writes result to on-chip memory ... but i am unable to read the new value of memory location from the application c code

However , i get the correct (updated) value if i read the memory location in the driver itself

If i write another application in c , just to read the particular memory location, and execute it after excuting the first application, the memory location shows the correct value

So please suggest a way(s) to read the updated memory cotents in the same application

Thanking in anticipation,

Kunal

7 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by kuni124d@Jun 29 2006, 12:53 PM

    hello guys,

    i am new to nios and uclinux

    i have written a simple device driver for a nios custom peripheral

    after configuring the peripheral ,through the driver, the peripheral writes result to on-chip memory ... but i am unable to read the new value of memory location from the application c code

    however , i get the correct (updated) value if i read the memory location in the driver itself

    if i write another application in c , just to read the particular memory location, and execute it after excuting the first application, the memory location shows the correct value

    so please suggest a way(s) to read the updated memory cotents in the same application

    thanking in anticipation,

    kunal

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=16532)

    --- quote end ---

    --- Quote End ---

    This sounds like a cache issue. I would start looking there first.

    Keith
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    set bit 31 of the memory address , ie | 0x80000000 , to uncache the access in both driver and user app.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by hippo@Jun 30 2006, 07:02 AM

    set bit 31 of the memory address , ie | 0x80000000 , to uncache the access in both driver and user app.

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=16544)

    --- quote end ---

    --- Quote End ---

    Thanx , i shall follow your instructions. But , the memory location is in "On- chip" memory , which I beleive is not cached. There could be some other problem
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by kuni124d+jun 30 2006, 01:44 pm--><div class='quotetop'>quote (kuni124d @ jun 30 2006, 01:44 pm)</div>

    --- quote start ---

    <!--quotebegin-hippo@Jun 30 2006, 07:02 AM

    set bit 31 of the memory address , ie | 0x80000000 , to uncache the access in both driver and user app.

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=16544)

    --- quote end ---

    --- Quote End ---

    Thanx , i shall follow your instructions. But , the memory location is in "On- chip" memory , which I beleive is not cached. There could be some other problem

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=16553)</div>

    [/b]

    --- Quote End ---

    Why do you mean the onchip memory is not cached?

    If you have d-cache in nios2, everything is cached unless you turn on bit31 of the address or use IORW macro .