aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorGareth McMullin2015-03-01 22:16:04 -0800
committerGareth McMullin2015-03-01 22:16:04 -0800
commit4d4813de87721528fc9a06174dd1da5c245ae2f3 (patch)
tree298266ed212f574b51d21d5b3fa18d37a4388907 /src/include
parent9d80641261cee52fdf1976caa41d4fd24c392c9a (diff)
Clean up includes everywhere.
All source files include general.h first and before anything else. This inlcludes platform.h and platform_support.h No header file needs to include to include any of these, but should include any others needed for it's own declarations.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/adiv5.h1
-rw-r--r--src/include/arm7tdmi.h1
-rw-r--r--src/include/command.h1
-rw-r--r--src/include/cortexm.h20
-rw-r--r--src/include/crc32.h2
-rw-r--r--src/include/gdb_packet.h2
-rw-r--r--src/include/general.h12
-rw-r--r--src/include/jtag_scan.h2
-rw-r--r--src/include/jtagtap.h2
-rw-r--r--src/include/morse.h2
-rw-r--r--src/include/platform_support.h41
-rw-r--r--src/include/swdptap.h2
-rw-r--r--src/include/target.h2
13 files changed, 70 insertions, 20 deletions
diff --git a/src/include/adiv5.h b/src/include/adiv5.h
index 0f17119..e0ce9cf 100644
--- a/src/include/adiv5.h
+++ b/src/include/adiv5.h
@@ -21,7 +21,6 @@
#ifndef __ADIV5_H
#define __ADIV5_H
-#include "general.h"
#include "jtag_scan.h"
#include "target.h"
diff --git a/src/include/arm7tdmi.h b/src/include/arm7tdmi.h
index ffcd6e9..fa7d586 100644
--- a/src/include/arm7tdmi.h
+++ b/src/include/arm7tdmi.h
@@ -21,7 +21,6 @@
#ifndef __ARM7TDMI_H
#define __ARM7TDMI_H
-#include "general.h"
#include "jtag_scan.h"
void arm7tdmi_jtag_handler(jtag_dev_t *dev);
diff --git a/src/include/command.h b/src/include/command.h
index 32b0d7b..3910bbb 100644
--- a/src/include/command.h
+++ b/src/include/command.h
@@ -21,7 +21,6 @@
#ifndef __COMMAND_H
#define __COMMAND_H
-#include "general.h"
#include "target.h"
int command_process(target *t, char *cmd);
diff --git a/src/include/cortexm.h b/src/include/cortexm.h
index f1fc07a..1fd77e6 100644
--- a/src/include/cortexm.h
+++ b/src/include/cortexm.h
@@ -1,6 +1,26 @@
+/*
+ * This file is part of the Black Magic Debug project.
+ *
+ * Copyright (C) 2015 Gareth McMullin <gareth@blacksphere.co.nz>
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
#ifndef __CORTEXM_H
#define __CORTEXM_H
+#include "target.h"
+
/* Private peripheral bus base address */
#define CORTEXM_PPB_BASE 0xE0000000
diff --git a/src/include/crc32.h b/src/include/crc32.h
index 6cc00ea..9966d8d 100644
--- a/src/include/crc32.h
+++ b/src/include/crc32.h
@@ -21,8 +21,6 @@
#ifndef __CRC32_H
#define __CRC32_H
-#include "platform.h"
-
uint32_t crc32_calc(uint32_t crc, uint8_t data);
uint32_t generic_crc32(struct target_s *target, uint32_t base, int len);
diff --git a/src/include/gdb_packet.h b/src/include/gdb_packet.h
index 9f5430f..222b86d 100644
--- a/src/include/gdb_packet.h
+++ b/src/include/gdb_packet.h
@@ -21,8 +21,6 @@
#ifndef __GDB_PACKET_H
#define __GDB_PACKET_H
-#include <string.h>
-
int gdb_getpacket(unsigned char *packet, int size);
void gdb_putpacket(unsigned char *packet, int size);
#define gdb_putpacketz(packet) gdb_putpacket((packet), strlen(packet))
diff --git a/src/include/general.h b/src/include/general.h
index b0721ac..b4e9aeb 100644
--- a/src/include/general.h
+++ b/src/include/general.h
@@ -21,15 +21,21 @@
#ifndef __GENERAL_H
#define __GENERAL_H
+#define _GNU_SOURCE
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stddef.h>
+
#include "platform.h"
+#include "platform_support.h"
#ifndef DEBUG
#include <stdio.h>
#define DEBUG printf
#endif
-#include <stdint.h>
-#include <stdbool.h>
-
#endif
diff --git a/src/include/jtag_scan.h b/src/include/jtag_scan.h
index b425b95..aa006e7 100644
--- a/src/include/jtag_scan.h
+++ b/src/include/jtag_scan.h
@@ -21,8 +21,6 @@
#ifndef __JTAG_SCAN_H
#define __JTAG_SCAN_H
-#include "general.h"
-
#define JTAG_MAX_DEVS 5
#define JTAG_MAX_IR_LEN 16
diff --git a/src/include/jtagtap.h b/src/include/jtagtap.h
index fd13f2b..0072594 100644
--- a/src/include/jtagtap.h
+++ b/src/include/jtagtap.h
@@ -21,8 +21,6 @@
#ifndef __JTAGTAP_H
#define __JTAGTAP_H
-#include "general.h"
-
/* Note: Signal names are as for the device under test. */
int jtagtap_init(void);
diff --git a/src/include/morse.h b/src/include/morse.h
index ac53893..5ba39b1 100644
--- a/src/include/morse.h
+++ b/src/include/morse.h
@@ -21,8 +21,6 @@
#ifndef __MORSE_H
#define __MORSE_H
-#include <stdbool.h>
-
extern const char *morse_msg;
void morse(const char *msg, char repeat);
diff --git a/src/include/platform_support.h b/src/include/platform_support.h
new file mode 100644
index 0000000..cc88ab6
--- /dev/null
+++ b/src/include/platform_support.h
@@ -0,0 +1,41 @@
+/*
+ * This file is part of the Black Magic Debug project.
+ *
+ * Copyright (C) 2015 Gareth McMullin <gareth@blacksphere.co.nz>
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __PLATFORM_SUPPORT_H
+#define __PLATFORM_SUPPORT_H
+
+#ifndef __GENERAL_H
+# error "Include 'general.h' instead"
+#endif
+
+#if defined(LIBFTDI)
+void platform_init(int argc, char **argv);
+#else
+void platform_init(void);
+#endif
+
+const char *platform_target_voltage(void);
+int platform_hwversion(void);
+void platform_delay(uint32_t delay);
+void platform_srst_set_val(bool assert);
+bool platform_target_get_power(void);
+void platform_target_set_power(bool power);
+
+#endif
+
diff --git a/src/include/swdptap.h b/src/include/swdptap.h
index 5bb0545..3263a1d 100644
--- a/src/include/swdptap.h
+++ b/src/include/swdptap.h
@@ -21,8 +21,6 @@
#ifndef __SWDPTAP_H
#define __SWDPTAP_H
-#include "general.h"
-
int swdptap_init(void);
void swdptap_reset(void);
diff --git a/src/include/target.h b/src/include/target.h
index 50f1ebe..0e6d9c2 100644
--- a/src/include/target.h
+++ b/src/include/target.h
@@ -25,8 +25,6 @@
#ifndef __TARGET_H
#define __TARGET_H
-#include "general.h"
-
typedef struct target_s target;
/* The destroy callback function will be called by target_list_free() just