# rtai_srq.h

    00001 /*
    00002 COPYRIGHT (C) 2000  Paolo Mantegazza (mantegazza@aero.polimi.it)
    00003
    00004 Port to ARM Copyright (c) 2001 Alex Züpke, SYSGO RTS GmbH (azu@sysgo.de)
    00005
    00006 This library is free software; you can redistribute it and/or
    00007 modify it under the terms of the GNU Lesser General Public
    00008 License as published by the Free Software Foundation; either
    00009 version 2 of the License, or (at your option) any later version.
    00010
    00011 This library is distributed in the hope that it will be useful,
    00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00014 Lesser General Public License for more details.
    00015
    00016 You should have received a copy of the GNU Lesser General Public
    00017 License along with this library; if not, write to the Free Software
    00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
    00019 */
    00020
    00021
    00022 #ifndef _RTAI_SRQ_H_
    00023 #define _RTAI_SRQ_H_
    00024
    00025 #define RTAI_SRQ_MAGIC  "0x404404"
    00026
    00027 static inline long long rtai_srq(unsigned long srq, unsigned long whatever)
    00028 {
    00029         long long retval;
    00030         register unsigned long __sc_0 __asm__ ("r0") = srq;
    00031         register unsigned long __sc_1 __asm__ ("r1") = whatever;
    00032
    00033         __asm__ __volatile__ (
    00034         "swi\t" RTAI_SRQ_MAGIC "\n\t"
    00035                 : "=r" (__sc_0), "=r" (__sc_1)
    00036                 : "0" (__sc_0), "1" (__sc_1)
    00037                 );
    00038         ((unsigned long *)&retval)[0] = __sc_0;
    00039         ((unsigned long *)&retval)[1] = __sc_1;
    00040         return retval;
    00041 }
    00042
    00043 static inline int rtai_open_srq(unsigned int label)
    00044 {
    00045         return (int)rtai_srq(0, label);
    00046 }
    00047 #endif