- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 Hasil86Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks
Karsten
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page