- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
i got other problem with my mutex. This is my code for two slaves processor (assume the OnChip address is fine ):#include "sys/alt_stdio.h"# include "system.h"# include "stdio.h"# include "alt_types.h"# include "io.h"# include "altera_avalon_mutex.h"
# define OnChip 0x00007000
int main()
{
alt_mutex_dev *s1;
# ifdef MUTEX_BASE
s1 = altera_avalon_mutex_open("/dev/mutex");# endif
printf("NIOS %d is waiting for control signal\n",ALT_CPU_CPU_ID_VALUE);
// waiting for control signal
while(!IORD(OnChip,0x00));
while(altera_avalon_mutex_trylock(s1,ALT_CPU_CPU_ID_VALUE));
// printing data
printf("NIOS %d captured Mutex \n",ALT_CPU_CPU_ID_VALUE);
altera_avalon_mutex_unlock(s1);
return 0;
and this is my code for my top processor
# include "sys/alt_stdio.h"# include "system.h"# include "stdio.h"# include "alt_types.h"# include "io.h"# include "altera_avalon_mutex.h"
# define OnChip 0x00007000
int main()
{
printf("NIOS top gives control signal\n");
IOWR(OnChip,0x00,1);
while(1);
return 0;
}
My expectation should be : NIOS 1 captured mutex NIOS 2 captured mutex however the result is out of my expectation, the result shown in attachment. here the text version of my result : NNIIOOSS 22 ccaappptuuurreedd muutttexx Need for advice. Thanks
Link Copied
0 Replies
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