Main Page | Modules | Data Structures | File List | Data Fields | Globals

locks.h

Go to the documentation of this file.
00001 /* Locks -- Operations to protect critical sections
00002     Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
00003     Written by Stephane Carrez (stcarrez@nerim.fr)  
00004     Modified by Paul Harvey (csirac@users.sourceforge.net)
00005     for use with the BeeOS project 2004/03.
00006     
00007     This file was free software; you can redistribute it and/or modify it
00008     under the terms of the GNU General Public License as published by the
00009     Free Software Foundation; either version 2, or (at your option) any
00010     later version.
00011     
00012     In addition to the permissions in the GNU General Public License, the
00013     Free Software Foundation gives you unlimited permission to link the
00014     compiled version of this file with other programs, and to distribute
00015     those programs without any restriction coming from the use of this
00016     file.  (The General Public License restrictions do apply in other
00017     respects; for example, they cover modification of the file, and
00018     distribution when not linked into another program.)
00019     
00020     This file is distributed in the hope that it will be useful, but
00021     WITHOUT ANY WARRANTY; without even the implied warranty of
00022     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00023     General Public License for more details.
00024     
00025     You should have received a copy of the GNU General Public License
00026     along with this program; see the file COPYING.  If not, write to
00027     the Free Software Foundation, 59 Temple Place - Suite 330,
00028     Boston, MA 02111-1307, USA.
00029  */
00030 
00040 #ifndef _M68HC11_LOCKS_H
00041 #define _M68HC11_LOCKS_H
00042 
00093   
00104 static __inline__ unsigned short
00105 lock (void)
00106 {
00107   unsigned short mask;
00108 
00109   __asm__ __volatile__ ("tpa\n\tsei" : "=d"(mask));
00110   return mask;
00111 }
00112 
00121 static __inline__ void
00122 unlock (void)
00123 {
00124   __asm__ __volatile__ ("cli");
00125 }
00126 
00135 static __inline__ void
00136 restore (unsigned short mask)
00137 {
00138   __asm__ __volatile__ ("tap" : : "d"(mask));
00139 }
00140 
00154 static __inline__ void
00155 interruption_point (void)
00156 {
00157   __asm__ __volatile__ ("cli\n\t"
00158                         "nop\n\t"
00159                         "sei");  
00160 }
00161 
00164 #endif

Generated on Sat Apr 10 17:08:02 2004 for BeeOS by doxygen 1.3.6-20040222