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++
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.
12516 Discussions

Two processors sharing the same mutex, one with linux the otherone without

Altera_Forum
Honored Contributor II
1,099 Views

Hello to everyone! I am struggling to make this work, let me share my efforts to make the mutex work between a NIOS2-MMU Linux and a NIOS2- w/o LINUX 

 

My NIOS2 NO-LINUX is running this program: 

 

int main() { alt_putstr("Proc 2!\n"); /* get the mutex device handle */ alt_mutex_dev* mutex = altera_avalon_mutex_open( "/dev/mutex" ); /* acquire the mutex, setting the value to one */ altera_avalon_mutex_trylock( mutex, 1 ); while(1){ if(altera_avalon_mutex_is_mine(mutex)) { usleep(100); alt_printf("%x\n", IORD_32DIRECT(SHARED_MEM_BASE, 0x00)); } altera_avalon_mutex_unlock( mutex ); } return 0; } My Device Driver of the MMU Linux is written here: http://pastebin.com/gwlfqawv 

 

However it is'nt working. When i boot my Linux it says that my Mutex 

is at the adress e0000001c4, i dont understand why it has this "e" in 

the front of the adress? Also it isn't locking because when i lock in 

Linux i still can lock/unlock at NIOS2-NOLINUX 

 

outl(0x00000001, shmem.mutex); 

 

if (inl(shmem.mutex) == 0x00000001) {printk(KERN_INFO "locked\n"); return 1;} 

 

I get the locked message at Linux, however the mutex isnt locking. 

 

Any help is appreciated
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
116 Views

Maybe the MMU programming for Kernel space defines this region as non-cached. I don't know if this includes translating the address do 0x000.. for the hardware access.  

 

-Michael
Altera_Forum
Honored Contributor II
116 Views

My driver: http://pastebin.com/2zabsbzh 

hope it helps someone with the same problem
Reply