aboutsummaryrefslogtreecommitdiff
path: root/src/platforms/dev2/platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/platforms/dev2/platform.c')
-rw-r--r--src/platforms/dev2/platform.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/src/platforms/dev2/platform.c b/src/platforms/dev2/platform.c
index 3d5929b..a62c49e 100644
--- a/src/platforms/dev2/platform.c
+++ b/src/platforms/dev2/platform.c
@@ -17,13 +17,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "platform.h"
+#include "general.h"
#include "gdb_if.h"
-#include "jtag_scan.h"
+#include "version.h"
-#include <stdlib.h>
#include <stdarg.h>
-#include <string.h>
#include <assert.h>
#include <termios.h>
#include <unistd.h>
@@ -31,6 +29,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <sys/time.h>
static int serial_fd = -1;
static int debug;
@@ -68,7 +67,7 @@ int serial_open(const char *name)
return fd;
}
-int platform_init(int argc, char **argv)
+void platform_init(int argc, char **argv)
{
int c;
char *serial = NULL;
@@ -105,11 +104,12 @@ int platform_init(int argc, char **argv)
};
platform_buffer_write (init_str, sizeof (init_str));
- assert(gdb_if_init() == 0);
-
- jtag_scan(NULL);
+ printf("\nBlack Magic Probe (" FIRMWARE_VERSION ")\n");
+ printf("Copyright (C) 2015 Black Sphere Technologies Ltd.\n");
+ printf("License GPLv3+: GNU GPL version 3 or later "
+ "<http://gnu.org/licenses/gpl.html>\n\n");
- return 0;
+ assert(gdb_if_init() == 0);
}
void platform_buffer_flush(void)
@@ -169,3 +169,22 @@ void platform_debug(const char *fmt, ...)
va_end(ap);
}
}
+
+static uint32_t timeout_time;
+static uint32_t time_ms(void)
+{
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
+}
+
+void platform_timeout_set(uint32_t ms)
+{
+ timeout_time = time_ms() + ms;
+}
+
+bool platform_timeout_is_expired(void)
+{
+ return time_ms() > timeout_time;
+}
+