[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6809 - gnuradio/branches/developers/matt/u2f/firmware
From: |
eb |
Subject: |
[Commit-gnuradio] r6809 - gnuradio/branches/developers/matt/u2f/firmware |
Date: |
Sat, 3 Nov 2007 21:45:09 -0600 (MDT) |
Author: eb
Date: 2007-11-03 21:45:08 -0600 (Sat, 03 Nov 2007)
New Revision: 6809
Modified:
gnuradio/branches/developers/matt/u2f/firmware/hal_io.c
gnuradio/branches/developers/matt/u2f/firmware/hal_io.h
Log:
added interrupt enable/disable inline functions
Modified: gnuradio/branches/developers/matt/u2f/firmware/hal_io.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/hal_io.c 2007-11-03
22:51:15 UTC (rev 6808)
+++ gnuradio/branches/developers/matt/u2f/firmware/hal_io.c 2007-11-04
03:45:08 UTC (rev 6809)
@@ -44,7 +44,9 @@
{
unsigned mask = hal_gpio_mode_mask(high_bitno, low_bitno, 0x3);
unsigned val = hal_gpio_mode_mask(high_bitno, low_bitno, mode);
+ int ei = hal_disable_ints();
gpio_base->rx_mode = (gpio_base->rx_mode & ~mask) | (val & mask);
+ hal_restore_ints(ei);
}
void
@@ -52,7 +54,9 @@
{
unsigned mask = hal_gpio_mode_mask(high_bitno, low_bitno, 0x3);
unsigned val = hal_gpio_mode_mask(high_bitno, low_bitno, mode);
+ int ei = hal_disable_ints();
gpio_base->tx_mode = (gpio_base->tx_mode & ~mask) | (val & mask);
+ hal_restore_ints(ei);
}
// in top 16-bits of io reg
@@ -61,7 +65,9 @@
{
value <<= 16;
mask <<= 16;
+ int ei = hal_disable_ints();
gpio_base->io = (gpio_base->io & ~mask) | (value & mask);
+ hal_restore_ints(ei);
}
// in bottom 16-bits of io reg
@@ -70,7 +76,9 @@
{
value &= 0xffff;
mask &= 0xffff;
+ int ei = hal_disable_ints();
gpio_base->io = (gpio_base->io & ~mask) | (value & mask);
+ hal_restore_ints(ei);
}
// ================================================================
Modified: gnuradio/branches/developers/matt/u2f/firmware/hal_io.h
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/hal_io.h 2007-11-03
22:51:15 UTC (rev 6808)
+++ gnuradio/branches/developers/matt/u2f/firmware/hal_io.h 2007-11-04
03:45:08 UTC (rev 6809)
@@ -57,5 +57,52 @@
timer_regs->time = t;
}
+/*!
+ * \brief Disable interrupts and return previous interrupt enable state.
+ * [Microblaze specific]
+ */
+static inline int
+hal_disable_ints(void)
+{
+ int result, t0;
+ asm volatile("mfs %0, rmsr \n\
+ andni %1, %0, 0x2 \n\
+ mts rmsr, %1"
+ : "=r" (result), "=r" (t0));
+ return result;
+}
+
+/*!
+ * \brief Enable interrupts and return previous interrupt enable state.
+ * [Microblaze specific]
+ */
+static inline int
+hal_enable_ints(void)
+{
+ int result, t0;
+
+ asm volatile("mfs %0, rmsr \n\
+ ori %1, %0, 0x2 \n\
+ mts rmsr, %1"
+ : "=r" (result), "=r" (t0));
+ return result;
+}
+
+/*!
+ * \brief Set interrupt enable state to \p prev_state.
+ * [Microblaze specific]
+ */
+static inline void
+hal_restore_ints(int prev_state)
+{
+ int t0, t1;
+ asm volatile("andi %0, %2, 0x2 \n\
+ mfs %1, rmsr \n\
+ andni %1, %1, 0x2 \n\
+ or %1, %1, %0 \n\
+ mts rmsr, %1"
+ : "=r" (t0), "=r"(t1) : "r" (prev_state));
+}
+
#endif /* INCLUDED_HAL_IO_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6809 - gnuradio/branches/developers/matt/u2f/firmware,
eb <=