- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

# arch/avr32/include/arch/softirq.h

Go to the documentation of this file.

    00001
    00041 #ifndef ARCH_SOFTIRQ_H_INCLUDED
    00042 #define ARCH_SOFTIRQ_H_INCLUDED
    00043
    00044 #include <bitops.h>
    00045 #include <compiler.h>
    00046 #include <arch/sysreg.h>
    00047
    00052 typedef void (*softirq_handler_t)(void *data);
    00053
    00054 extern unsigned long softirq_priv_status;
    00055
    00056 extern void softirq_set_handler(unsigned int id,
    00057                 softirq_handler_t handler, void *data);
    00058 extern void softirq_priv_do_pending(void);
    00059 extern void softirq_enable(void);
    00060
    00067 static inline void softirq_disable(void)
    00068 {
    00069         avr32_set_sr_bit(SYSREG_SR_T_BIT);
    00070         barrier();
    00071 }
    00072
    00083 static inline void softirq_raise(unsigned int id)
    00084 {
    00085         atomic_set_bit(id, &softirq_priv_status);
    00086 }
    00087
    00094 static inline bool softirq_is_enabled_flags(unsigned long flags)
    00095 {
    00096         return !(flags & SYSREG_SR_T);
    00097 }
    00098
    00104 static inline bool softirq_is_enabled(void)
    00105 {
    00106         return softirq_is_enabled_flags(sysreg_read(SR));
    00107 }
    00108
    00116 static inline unsigned long softirq_save(void)
    00117 {
    00118         unsigned long flags;
    00119
    00120         flags = sysreg_read(SR);
    00121         softirq_disable();
    00122
    00123         return flags;
    00124 }
    00125
    00130 static inline void softirq_restore(unsigned long flags)
    00131 {
    00132         /*
    00133          * We can't just write directly to SR as we do for interrupts,
    00134          * since we must also check for pending softirqs.
    00135          */
    00136         if (softirq_is_enabled_flags(flags))
    00137                 softirq_enable();
    00138 }
    00139
    00140 #endif /* ARCH_SOFTIRQ_H_INCLUDED */