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
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Help in semaphores

Altera_Forum
Honored Contributor II
1,133 Views

Hi  

Can anyone Plz Help me in Semaphores in MicroC os2 .Just Give me some Working Code of two task swithched on semaphores.Whether the task print hello word .it is fine.I have Used the the Function OSSemCreate(),OSSempend() and OSSempost()...They are not working in My Case .I dont know the Stupid Reason Behind it.But Some how the output is different from the Code which i have write. 

I also read the different Manuals of altera on MicroC OS2 but it cant helped me alot.. 

 

SO Urgent Help Required PLZ Plz ..... 

 

Some Simple Example......  

 

Thanks In Advanced for The Nice Guy Who Give me SOme Soution... 

 

 

regards 

Hasil86
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
470 Views

Creating the Semaphore  

// create Semaphore m_t_sem_access = OSSemCreate(0); if (m_t_sem_access == NULL) { // just in case some error handling } Accessing a semaphore protected area 

 

OSSemPend(m_t_sem_access, L_SPI_ACCESS_TIMEOUT, &proc_i_error); switch (proc_i_error) { // error handling .... } Removing the Lock 

proc_i_error = OSSemPost(m_t_sem_access); if (proc_i_error != OS_NO_ERR) { .... } This code snippets are taken from my current project. The semaphore is used to protect access to a hardware device. 

 

Karsten
0 Kudos
Altera_Forum
Honored Contributor II
470 Views

thanks  

 

Karsten
0 Kudos
Reply