aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/octoclock/include/avrlibdefs.h
diff options
context:
space:
mode:
authorNicholas Corgan <nick.corgan@ettus.com>2014-07-17 11:50:50 -0700
committerNicholas Corgan <nick.corgan@ettus.com>2014-07-23 07:37:32 -0700
commita6e18604befdb6a954542f7722c8d55424065621 (patch)
tree22168e6f4c41c931e38ccd07ff8881b56c8cd88a /firmware/octoclock/include/avrlibdefs.h
parent7423d1691fff3af08f8e42e3e09d8c8d9ec99fe8 (diff)
downloaduhd-a6e18604befdb6a954542f7722c8d55424065621.tar.gz
uhd-a6e18604befdb6a954542f7722c8d55424065621.tar.bz2
uhd-a6e18604befdb6a954542f7722c8d55424065621.zip
OctoClock firmware upgrade, added host driver
* OctoClock can communicate with UHD over Ethernet * Can read NMEA strings from GPSDO and send to host * Added multi_usrp_clock class for clock devices * uhd::device can now filter to return only USRP devices or clock devices * New OctoClock bootloader can accept firmware download over Ethernet * Added octoclock_burn_eeprom,octoclock_firmware_burner utilities * Added test_clock_synch example to show clock API
Diffstat (limited to 'firmware/octoclock/include/avrlibdefs.h')
-rw-r--r--firmware/octoclock/include/avrlibdefs.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/firmware/octoclock/include/avrlibdefs.h b/firmware/octoclock/include/avrlibdefs.h
new file mode 100644
index 000000000..7f0cc0adc
--- /dev/null
+++ b/firmware/octoclock/include/avrlibdefs.h
@@ -0,0 +1,72 @@
+/*! \file avrlibdefs.h \brief AVRlib global defines and macros. */
+//*****************************************************************************
+//
+// File Name : 'avrlibdefs.h'
+// Title : AVRlib global defines and macros include file
+// Author : Pascal Stang
+// Created : 7/12/2001
+// Revised : 9/30/2002
+// Version : 1.1
+// Target MCU : Atmel AVR series
+// Editor Tabs : 4
+//
+// Description : This include file is designed to contain items useful to all
+// code files and projects, regardless of specific implementation.
+//
+// This code is distributed under the GNU Public License
+// which can be found at http://www.gnu.org/licenses/gpl.txt
+//
+//*****************************************************************************
+
+
+#ifndef AVRLIBDEFS_H
+#define AVRLIBDEFS_H
+
+// Code compatibility to new AVR-libc
+// outb(), inb(), inw(), outw(), BV(), sbi(), cbi(), sei(), cli()
+#ifndef outb
+ #define outb(addr, data) addr = (data)
+#endif
+#ifndef inb
+ #define inb(addr) (addr)
+#endif
+#ifndef outw
+ #define outw(addr, data) addr = (data)
+#endif
+#ifndef inw
+ #define inw(addr) (addr)
+#endif
+#ifndef BV
+ #define BV(bit) (1<<(bit))
+#endif
+#ifndef cbi
+ #define cbi(reg,bit) reg &= ~(BV(bit))
+#endif
+#ifndef sbi
+ #define sbi(reg,bit) reg |= (BV(bit))
+#endif
+#ifndef cli
+ #define cli() __asm__ __volatile__ ("cli" ::)
+#endif
+#ifndef sei
+ #define sei() __asm__ __volatile__ ("sei" ::)
+#endif
+
+// use this for packed structures
+// (this is seldom necessary on an 8-bit architecture like AVR,
+// but can assist in code portability to AVR)
+#define GNUC_PACKED __attribute__((packed))
+
+// port address helpers
+#define DDR(x) ((x)-1) // address of data direction register of port x
+#define PIN(x) ((x)-2) // address of input register of port x
+
+// MIN/MAX/ABS macros
+#define MIN(a,b) ((a<b)?(a):(b))
+#define MAX(a,b) ((a>b)?(a):(b))
+#define ABS(x) ((x>0)?(x):(-x))
+
+// constants
+#define PI 3.14159265359
+
+#endif