/usr/include/rtai/rtai_usi.h is in librtai-dev 3.8.1-4build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | /*
* Copyright (C) 1999-2005 Paolo Mantegazza <mantegazza@aero.polimi.it>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _RTAI_USI_H
#define _RTAI_USI_H
#ifndef __KERNEL__
#include <asm/rtai_usi.h>
//#include <asm/rtai_atomic.h>
#include <asm/rtai_srq.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
static inline int rt_startup_irq(unsigned int irq)
{
return (int)rtai_srq(USI_SRQ_MASK | _STARTUP_IRQ, irq);
}
#define rt_shutdown_irq(irq) \
do { rtai_srq(USI_SRQ_MASK | _SHUTDOWN_IRQ, irq); } while (0)
#define rt_enable_irq(irq) \
do { rtai_srq(USI_SRQ_MASK | _ENABLE_IRQ, irq); } while (0)
#define rt_disable_irq(irq) \
do { rtai_srq(USI_SRQ_MASK | _DISABLE_IRQ, irq); } while (0)
#define rt_mask_and_ack_irq(irq) \
do { rtai_srq(USI_SRQ_MASK | _MASK_AND_ACK_IRQ, irq); } while (0)
#define rt_ack_irq(irq) \
do { rtai_srq(USI_SRQ_MASK | _ACK_IRQ, irq); } while (0)
#define rt_unmask_irq(irq) \
do { rtai_srq(USI_SRQ_MASK | _UNMASK_IRQ, irq); } while (0)
#define rtai_cli() \
do { rtai_srq(USI_SRQ_MASK | _DISINT, 0); } while (0)
#define rtai_sti() \
do { rtai_srq(USI_SRQ_MASK | _ENINT, 0); } while (0)
#define rtai_save_flags_and_cli(flags) \
do { flags = (unsigned long)rtai_srq(USI_SRQ_MASK | _SAVE_FLAGS_CLI, 0); } while(0)
#define rtai_restore_flags(flags) \
do { rtai_srq(USI_SRQ_MASK | _RESTORE_FLAGS, flags); } while (0)
#ifdef CONFIG_SMP
struct __usi_xchg_dummy { unsigned long a[100]; };
#define __usi_xg(x) ((struct __usi_xchg_dummy *)(x))
static inline unsigned long usi_atomic_cmpxchg(volatile void *ptr, unsigned long o, unsigned long n)
{
unsigned long prev;
__asm__ __volatile__ ("lock; cmpxchgl %1, %2"
: "=a" (prev)
: "q"(n), "m" (*__usi_xg(ptr)), "0" (o)
: "memory");
return prev;
}
#define rt_spin_lock(lock) \
do { while (usi_atomic_cmpxchg(lock, 0, 1)); } while (0)
#define rt_spin_unlock(lock) \
do { *(volatile int *)lock = 0; } while (0)
#else
#define rt_spin_lock(lock);
#define rt_spin_unlock(lock);
#endif
#define rt_spin_lock_init(lock) \
do { *(volatile int *)lock = 0; } while (0)
#define rt_spin_lock_irq(lock) \
do { rtai_cli(); rt_spin_lock(lock); } while (0)
#define rt_spin_unlock_irq(lock) \
do { rt_spin_unlock(lock); rtai_sti(); } while (0)
static inline unsigned long rt_spin_lock_irqsave(void *lock)
{
unsigned long flags;
rtai_save_flags_and_cli(flags);
rt_spin_lock(lock);
return flags;
}
#define rt_spin_unlock_irqrestore(flags, lock) \
do { rt_spin_unlock(lock); rtai_restore_flags(flags); } while (0)
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* !__KERNEL__ */
#endif /* !_RTAI_USI_H */
|