Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

Device Driver problem

Altera_Forum
Honored Contributor II
1,039 Views

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
0 Kudos
7 Replies
Altera_Forum
Honored Contributor II
331 Views

 

--- 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
0 Kudos
Altera_Forum
Honored Contributor II
331 Views

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

0 Kudos
Altera_Forum
Honored Contributor II
331 Views

 

--- 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
0 Kudos
Altera_Forum
Honored Contributor II
331 Views

 

--- 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 .
0 Kudos
Altera_Forum
Honored Contributor II
331 Views

TO_BE_DONE

0 Kudos
Altera_Forum
Honored Contributor II
331 Views

TO_BE_DONE

0 Kudos
Altera_Forum
Honored Contributor II
331 Views

add "volatile" to your variable. 

eg 

volatile int data;
0 Kudos
Reply