Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12366 Discussions

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

Honored Contributor I

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: 


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
Honored Contributor I

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.  


Honored Contributor I

My driver: 

hope it helps someone with the same problem