Forum Discussion
Altera_Forum
Honored Contributor
19 years ago --- Quote Start --- originally posted by hippo+nov 2 2006, 11:52 pm--><div class='quotetop'>quote (hippo @ nov 2 2006, 11:52 pm)</div>
--- quote start ---
<!--quotebegin-kwokwong@Nov 2 2006, 10:14 PM hi all,
according the header file (d:\altera5\kits\nios2_50\bin\eclipse\plugins\com.microtronix.nios2linux.uclibc_1.4.0\include\bits\atomicity.h),
the implemented function is only stub (not really atomic!).
does anyone know how to do it really atomic?
i thought that the simplest way is to disable the interrupt when doing this function and re-enable the interrupt afterwards.
so i need to know how to enable/disable interrupt ??
regards,
kwok wong
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=19104)
--- quote end ---
--- Quote End --- It is not implemented, so we need a nios2 version in, uClibc/libc/sysdeps/linux/nios2/bits/atomicity.h Look at other arch, eg, arm,m68k,mips,i386, they use locked exchange instead of disable interrupt. Are there locked instructions in Nios2? <div align='right'><{post_snapback}> (index.php?act=findpost&pid=19108)</div> [/b] --- Quote End --- $ find uClibc -name "atomic*.h" uClibc/libc/sysdeps/linux/sh/bits/atomic.h uClibc/libc/sysdeps/linux/arm/bits/atomicity.h uClibc/libc/sysdeps/linux/i386/bits/atomic.h uClibc/libc/sysdeps/linux/i386/bits/atomicity.h uClibc/libc/sysdeps/linux/m68k/bits/atomicity.h uClibc/libc/sysdeps/linux/mips/bits/atomic.h uClibc/libc/sysdeps/linux/mips/bits/atomicity.h uClibc/libc/sysdeps/linux/alpha/bits/atomic.h uClibc/libc/sysdeps/linux/alpha/bits/atomicity.h uClibc/libc/sysdeps/linux/h8300/bits/atomicity.h uClibc/libc/sysdeps/linux/sparc/bits/atomicity.h uClibc/libc/sysdeps/linux/common/bits/atomic.h uClibc/libc/sysdeps/linux/common/bits/atomicity.h uClibc/libc/sysdeps/linux/x86_64/bits/atomic.h uClibc/libc/sysdeps/linux/x86_64/bits/atomicity.h uClibc/libc/sysdeps/linux/powerpc/bits/atomic.h uClibc/libc/sysdeps/linux/powerpc/bits/atomicity.h uClibc/include/bits/atomic.h uClibc/include/bits/atomicity.h uClibc/include/atomic.h If we create uClibc/libc/sysdeps/linux/nios2/bits/atomicity.h ,then it will become uClibc/include/bits/atomicity.h . Otherwise, it will come from uClibc/libc/sysdeps/linux/common/bits/atomicity.h, which is a stub. If nios2 does not have lock, then we can use disable/enable interrupr, with inline assembly.