summaryrefslogtreecommitdiff
path: root/io-module
diff options
context:
space:
mode:
authorMike Fiore <mfiore@multitech.com>2014-04-24 12:44:58 -0500
committerMike Fiore <mfiore@multitech.com>2014-04-24 12:44:58 -0500
commitc58590d525d218e66c8b18cfaf72e7e87bede27e (patch)
tree1445b0317adda1786db430e866bee94dd0d5e860 /io-module
parenta9f57dbc22669120270114a6fccebe5cf971df02 (diff)
downloadmts-io-c58590d525d218e66c8b18cfaf72e7e87bede27e.tar.gz
mts-io-c58590d525d218e66c8b18cfaf72e7e87bede27e.tar.bz2
mts-io-c58590d525d218e66c8b18cfaf72e7e87bede27e.zip
mts-io: move DEVICE_CAPA* macros and other useful definitions to mts_eeprom.h
Diffstat (limited to 'io-module')
-rw-r--r--io-module/mts_eeprom.h27
-rw-r--r--io-module/mts_io.h25
2 files changed, 27 insertions, 25 deletions
diff --git a/io-module/mts_eeprom.h b/io-module/mts_eeprom.h
index 56b2871..6295fc4 100644
--- a/io-module/mts_eeprom.h
+++ b/io-module/mts_eeprom.h
@@ -1,6 +1,8 @@
#ifndef __MTS_EEPROM_H
#define __MTS_EEPROM_H
+#include <stdint.h>
+
/* on-board EEPROM */
struct mts_id_eeprom_layout {
char vendor_id[32];
@@ -25,4 +27,29 @@ struct mts_dc_eeprom_layout {
uint8_t reserved[378];
};
+#define DEVICE_CAPA_INDEX(c) (((c) & 0xFF) >> 3)
+#define DEVICE_CAPA_MASK(c) BIT((c) & 0x07)
+
+#define DEVICE_CAPA(capa_buf, c) ((capa_buf)[DEVICE_CAPA_INDEX(c)] & DEVICE_CAPA_MASK(c))
+
+#define DEVICE_CAPA_SET(capa_buf, c) \
+do { \
+ (capa_buf)[DEVICE_CAPA_INDEX(c)] |= DEVICE_CAPA_MASK(c); \
+}while (0)
+
+#define DEVICE_CAPA_CLEAR(capa_buf, c) \
+do { \
+ (capa_buf)[DEVICE_CAPA_INDEX(c)] &= ~DEVICE_CAPA_MASK(c); \
+} while (0)
+
+#define DEVICE_CAPA_VALUE(index, bit) ((((index) & 0x1F) << 3) | ((bit) & 0x07))
+
+#define CAPA_GPS DEVICE_CAPA_VALUE(0, 7)
+#define CAPA_DIN DEVICE_CAPA_VALUE(0, 6)
+#define CAPA_DOUT DEVICE_CAPA_VALUE(0, 5)
+#define CAPA_ADC DEVICE_CAPA_VALUE(0, 4)
+
+#define CAPA_BLUETOOTH DEVICE_CAPA_VALUE(1, 7)
+#define CAPA_WIFI DEVICE_CAPA_VALUE(1, 6)
+
#endif
diff --git a/io-module/mts_io.h b/io-module/mts_io.h
index 78ea23b..757da05 100644
--- a/io-module/mts_io.h
+++ b/io-module/mts_io.h
@@ -67,31 +67,6 @@ enum {
MTDC_GPIOB_0_0,
};
-#define DEVICE_CAPA_INDEX(c) (((c) & 0xFF) >> 3)
-#define DEVICE_CAPA_MASK(c) BIT((c) & 0x07)
-
-#define DEVICE_CAPA(capa_buf, c) ((capa_buf)[DEVICE_CAPA_INDEX(c)] & DEVICE_CAPA_MASK(c))
-
-#define DEVICE_CAPA_SET(capa_buf, c) \
-do { \
- (capa_buf)[DEVICE_CAPA_INDEX(c)] |= DEVICE_CAPA_MASK(c); \
-}while (0)
-
-#define DEVICE_CAPA_CLEAR(capa_buf, c) \
-do { \
- (capa_buf)[DEVICE_CAPA_INDEX(c)] &= ~DEVICE_CAPA_MASK(c); \
-} while (0)
-
-#define DEVICE_CAPA_VALUE(index, bit) ((((index) & 0x1F) << 3) | ((bit) & 0x07))
-
-#define CAPA_GPS DEVICE_CAPA_VALUE(0, 7)
-#define CAPA_DIN DEVICE_CAPA_VALUE(0, 6)
-#define CAPA_DOUT DEVICE_CAPA_VALUE(0, 5)
-#define CAPA_ADC DEVICE_CAPA_VALUE(0, 4)
-
-#define CAPA_BLUETOOTH DEVICE_CAPA_VALUE(1, 7)
-#define CAPA_WIFI DEVICE_CAPA_VALUE(1, 6)
-
// GPIO pin types:input, output, open drain (1 = high Z, 0 = output low)
enum {
GPIO_DIR_INPUT,