atomic.h

Go to the documentation of this file.
00001 /**************************************************************************/
00018 #ifndef _ATOMIC_H
00019 #define _ATOMIC_H
00020 
00021 /******************************************************************************
00022                    Includes section
00023 ******************************************************************************/
00024 #if defined(AT91SAM7X256)
00025   #include <inttypes.h>
00026 #elif defined(ATMEGA1281) || defined(ATMEGA2561) || defined(ATMEGA1284) || defined(AT90USB1287)
00027   #include <halAtomic.h>
00028 #endif
00029 
00030 #if defined(AT91SAM7X256)
00031 /******************************************************************************
00032                    Types section
00033 ******************************************************************************/
00034 typedef  uint32_t atomic_t;
00035 
00036 /******************************************************************************
00037                    Inline static functions section
00038 ******************************************************************************/
00039 /******************************************************************************
00040  Disables global interrupt. Enter atomic section.
00041 ******************************************************************************/
00042 void halStartAtomic(atomic_t volatile *pAtomic);
00043 
00044 /******************************************************************************
00045  Exit atomic section
00046 ******************************************************************************/
00047 void halEndAtomic(atomic_t volatile *pAtomic);
00048 #endif
00049 
00050 #if defined(AT91SAM7X256)
00051 
00052   #define ATOMIC_SECTION_ENTER  {volatile atomic_t __atomic; halStartAtomic(&__atomic);
00053 
00054   #define ATOMIC_SECTION_LEAVE  halEndAtomic(&__atomic);}
00055 #elif defined(ATMEGA1281) || defined(ATMEGA2561) || defined(ATMEGA1284) || defined(AT90USB1287)
00056 
00057   #define ATOMIC_SECTION_ENTER {atomic_t __atomic = halStartAtomic();
00058 
00059   #define ATOMIC_SECTION_LEAVE halEndAtomic(__atomic);}
00060 #endif
00061 
00062 #endif
00063 // eof atomic.h

Generated on Mon Feb 16 17:53:40 2009 for BitCloud Stack Documentation by  doxygen 1.5.1-p1