summaryrefslogtreecommitdiff
path: root/ucoolib
diff options
context:
space:
mode:
authorNicolas Schodet2012-10-21 16:34:40 +0200
committerNicolas Schodet2019-10-06 23:26:34 +0200
commitbff93ec7a2c0502a9b6b59960f3863acdca32bee (patch)
treece364d6aeb784822136e70f8f8bee6852cc932dd /ucoolib
parent27b1e0c43bcc0024c56d31f5704efaf11d3b2dc9 (diff)
ucoolib: add common header
Diffstat (limited to 'ucoolib')
-rw-r--r--ucoolib/common.hh40
1 files changed, 40 insertions, 0 deletions
diff --git a/ucoolib/common.hh b/ucoolib/common.hh
new file mode 100644
index 0000000..a27dfe3
--- /dev/null
+++ b/ucoolib/common.hh
@@ -0,0 +1,40 @@
+#ifndef ucoolib_common_hh
+#define ucoolib_common_hh
+// ucoolib - Microcontroller object oriented library. {{{
+//
+// Copyright (C) 2012 Nicolas Schodet
+//
+// APBTeam:
+// Web: http://apbteam.org/
+// Email: team AT apbteam DOT org
+//
+// 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.
+//
+// }}}
+#include <stdint.h>
+
+namespace ucoo {
+
+/// Compiler barrier. Prevents the compiler from moving the memory accesses
+/// from one side of it to the other side.
+extern inline void
+barrier ()
+{
+ __asm__ __volatile__("": : : "memory");
+}
+
+} // namespace ucoo
+
+#endif // ucoolib_common_h