Main Page   Modules   Data Structures   File List   Globals  

otos_def.h

Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2002, 2003, Oliver Tscherwitschke
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without
00006 modification, are permitted provided that the following conditions are met:
00007 
00008 1. Redistributions of source code must retain the above copyright notice,
00009    this list of conditions and the following disclaimer.
00010 2. Redistributions in binary form must reproduce the above copyright notice,
00011    this list of conditions and the following disclaimer in the documentation
00012    and/or other materials provided with the distribution.
00013 3. The name of the author may not be used to endorse or promote products
00014    derived from this software without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
00017 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00018 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
00019 EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00020 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00021 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00022 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00023 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00024 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00025 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 */
00027 
00034 #ifndef OTOS_DEF_H
00035 #define OTOS_DEF_H
00036 
00037 
00039 #define OTOS_VERSION    "0.9.0"     /* mayor.minor.release */
00040 
00041 
00042 /* some generally useful constants */
00043 #define TRUE    1
00044 #define FALSE   0
00045 
00046 
00047 /*
00048  * macros
00049  */
00050 
00051 
00052 /* get the stack pointer */
00053 #define GET_SP() ({                 \
00054     uint16_t result;                \
00055      __asm__ volatile (             \
00056         "in %A0, %1"    "\n\t"      \
00057         "in %B0, %2"    "\n\t"      \
00058         : "=r" (result)             \
00059         : "I" (_SFR_IO_ADDR(SPL)),  \
00060           "I" (_SFR_IO_ADDR(SPH))   \
00061     );                              \
00062     result;                         \
00063 })
00064  
00065 /* returns 1 if global interrupt enable bit is set */
00066 #define ISR_ACTIVE() ({         \
00067     uint8_t t;                  \
00068     __asm__ volatile (          \
00069         "clr %0" "\n\t"         \
00070         "brie L_%=" "\n\t"      \
00071         "inc %0" "\n"           \
00072         "L_%=: " "\n\t"         \
00073         : "=r" (t)              \
00074         :                       \
00075     );                          \
00076     t;                          \
00077 })
00078 
00079 /* returns 1 if global interrupt enable bit is not set */
00080 #define ISR_NOT_ACTIVE() ({     \
00081     uint8_t t;                  \
00082     __asm__ volatile (          \
00083         "clr %0" "\n\t"         \
00084         "brid L_%=" "\n\t"      \
00085         "inc %0" "\n"           \
00086         "L_%=: " "\n\t"         \
00087         : "=r" (t)              \
00088         :                       \
00089     );                          \
00090     t;                          \
00091 })
00092 
00093 
00094 #endif

Generated on Sat Jan 25 18:41:43 2003 for otOS by doxygen1.3-rc2