| Datenblatt-Suchmaschine für elektronische Bauteile |
|
PM0056 Datenblatt(PDF) 32 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
PM0056 Datenblatt(HTML) 32 Page - STMicroelectronics |
|
32 / 156 page ![]() The Cortex-M3 processor PM0056 32/156 DocID15491 Rev 5 Software can use the synchronization primitives to implement a semaphores as follows: 1. Use a Load-Exclusive instruction to read from the semaphore address to check whether the semaphore is free. 2. If the semaphore is free, use a Store-Exclusive to write the claim value to the semaphore address. 3. If the returned status bit from step 2 indicates that the Store-Exclusive succeeded then the software has claimed the semaphore. However, if the Store-Exclusive failed, another process might have claimed the semaphore after the software performed step 1. The Cortex-M3 includes an exclusive access monitor, that tags the fact that the processor has executed a Load-Exclusive instruction. The processor removes its exclusive access tag if: • It executes a CLREX instruction • It executes a Store-Exclusive instruction, regardless of whether the write succeeds. • An exception occurs. This means the processor can resolve semaphore conflicts between different threads. For more information about the synchronization primitive instructions, see LDREX and STREX on page 70 and CLREX on page 71. 2.2.8 Programming hints for the synchronization primitives ANSI C cannot directly generate the exclusive access instructions. Some C compilers provide intrinsic functions for generation of these instructions: The actual exclusive access instruction generated depends on the data type of the pointer passed to the intrinsic function. For example, the following C code generates the require LDREXB operation: __ldrex((volatile char *) 0xFF); Table 15. C compiler intrinsic functions for exclusive access instructions Instruction Intrinsic function LDREX, LDREXH, or LDREXB unsigned int __ldrex(volatile void *ptr) STREX, STREXH, or STREXB int __strex(unsigned int val, volatile void *ptr) CLREX void __clrex(void) |
|
Link URL |
| War ALLDATASHEET hilfreich? [ DONATE ] |
Über Alldatasheet | Werbung | Kontakt | Privatsphäre und Datenschutz | Link zum Datenblatt | Linktausch | Hersteller All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |