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++

MicroC-OSII mutexs

Altera_Forum
Honored Contributor II
1,128 Views

does anyone know if you can define multiple mutexs in microC OS 2?  

 

I have more than one shared resource that I would like to have different semaphores for. But I would like to use mutex semaphores.  

 

Based on the microC OS 2 book, it seems like you can only make 1 mutex :confused: 

 

am i missing something?
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
403 Views

maybe he has a mistake in his example in chapter 8.1 of his book?  

 

He has a line of code that says  

 

OSMutexCreate(9,&err); 

 

I think maybe this should read 

 

ResourceMutex = OSMutexCreate(9,&err);  

 

??? 

 

I guess the question is do you need to create an OS_EVENT* type and set it eqaual to OSMutexCreate() ?  

 

It must just be a mistake in the documentation. Can someone confirm?
0 Kudos
Altera_Forum
Honored Contributor II
403 Views

My uC/OS-2 manual reads 

 

DispMutex = OSMutexCreate(20, &err); 

 

Based on this i see no reason why there should be not more then 1 Mutex in a System. 

What you need to do is reserve enough space for the event control blocks in the system lib settings. 

 

karsten
0 Kudos
Altera_Forum
Honored Contributor II
403 Views

thank you, yes I believe you are correct.

0 Kudos
Reply