Browse Source

Fix errors when building for non-native platforms.

pull/85/head
Gareth McMullin 10 years ago
parent
commit
9a8dbdeff7
  1. 1
      src/platforms/f4discovery/platform.h
  2. 14
      src/platforms/launchpad-icdi/platform.c
  3. 2
      src/platforms/launchpad-icdi/platform.h
  4. 19
      src/platforms/libftdi/platform.c
  5. 1
      src/platforms/stlink/platform.h
  6. 1
      src/platforms/swlink/platform.h

1
src/platforms/f4discovery/platform.h

@ -28,6 +28,7 @@
#include "gpio.h"
#include "morse.h"
#include "timing.h"
#include "target.h"
#include <setjmp.h>

14
src/platforms/launchpad-icdi/platform.c

@ -86,10 +86,20 @@ platform_init(void)
cdcacm_init();
}
void platform_timeout_set(uint32_t ms)
{
timeout_counter = ms / 10;
}
bool platform_timeout_is_expired(void)
{
return timeout_counter == 0;
}
void platform_delay(uint32_t delay)
{
timeout_counter = delay * 10;
while(timeout_counter);
platform_timeout_set(delay);
while (platform_timeout_is_expired());
}
const char *platform_target_voltage(void)

2
src/platforms/launchpad-icdi/platform.h

@ -18,6 +18,8 @@
#define __PLATFORM_H
#include "gdb_packet.h"
#include "target.h"
#include "morse.h"
#include <setjmp.h>

19
src/platforms/libftdi/platform.c

@ -21,6 +21,7 @@
#include "gdb_if.h"
#include <assert.h>
#include <sys/time.h>
struct ftdi_context *ftdic;
@ -258,3 +259,21 @@ void platform_delay(uint32_t delay)
usleep(delay * 100000);
}
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;
}

1
src/platforms/stlink/platform.h

@ -27,6 +27,7 @@
#include "gdb_packet.h"
#include "gpio.h"
#include "timing.h"
#include "target.h"
#include <libopencm3/cm3/common.h>
#include <libopencm3/stm32/f1/memorymap.h>

1
src/platforms/swlink/platform.h

@ -27,6 +27,7 @@
#include "gdb_packet.h"
#include "gpio.h"
#include "timing.h"
#include "target.h"
#include <setjmp.h>

Loading…
Cancel
Save