My implementation: #define HAL_TAS_SET( _tas_, _oldb_ ) \ CYG_MACRO_START \ { \ register CYG_WORD32 __old; \ register CYG_WORD32 __tas = &_tas_; \ __asm__ volatile ( \ "mov r1,#1\n" \ "ldrex r0,[%1]\n" \ "cmp r0,#0" \ "strexeq %0,r1,[%1]\n" \ : "=r" (__old), "=r" (__tas), \ : \ : "memory","r1","r0" \ ); \ _oldb_ = ( __old & 1 ) != 0; \ } \ CYG_MACRO_END
#define HAL_TAS_CLEAR( _tas_, _oldb_ ) \ CYG_MACRO_START \ { \ register CYG_WORD32 __tas = &_tas_; \ __asm__ volatile ( \ " mov r1,#0\n" \ " str r1,[%0]\n" \ " dsb\n" \ : "=r" (__tas) \ : \ : "memory","r1" \ ); \ } \ CYG_MACRO_END Because of the lack of the real target board, I did not know it worked or not. So, guys, give me some advice. BR Jerry -----Original Message----- From: Christophe Coutand [mailto:ccout...@stmi.com] Sent: 2011年1月30日 17:57 To: Fan Chongbin-B32609; ecos-discuss@ecos.sourceware.org Subject: RE: [ECOS] cortex a9 SMP spinlock You can find some inputs here: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489b/Cih bghef.html Christophe -----Original Message----- From: ecos-discuss-ow...@ecos.sourceware.org [mailto:ecos-discuss-ow...@ecos.sourceware.org] On Behalf Of Fan Chongbin-B32609 Sent: 30. januar 2011 10:31 To: ecos-discuss@ecos.sourceware.org Subject: [ECOS] cortex a9 SMP spinlock Hi, all For cortex-a9 SMP, how to implement HAL_TAS_SET(_tas, _oldb_) macro? BR Jerry -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss