Modifications to compile on Cygwin.

This commit is contained in:
Daniel Beer 2010-05-13 16:45:38 +12:00
parent b8a3ef41c7
commit c84f2ab579
4 changed files with 9 additions and 10 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.*.swp .*.swp
*.o *.o
mspdebug mspdebug
mspdebug.exe

View File

@ -27,6 +27,8 @@ READLINE_CFLAGS = -DUSE_READLINE
READLINE_LIBS = -lreadline READLINE_LIBS = -lreadline
endif endif
MSPDEBUG_CFLAGS = -O1 -Wall -Wno-char-subscripts -ggdb
all: mspdebug all: mspdebug
clean: clean:
@ -45,4 +47,4 @@ mspdebug: main.o fet.o rf2500.o dis.o uif.o ihex.o elf32.o stab.o util.o \
$(CC) $(LDFLAGS) -o $@ $^ -lusb $(READLINE_LIBS) $(CC) $(LDFLAGS) -o $@ $^ -lusb $(READLINE_LIBS)
.c.o: .c.o:
$(CC) $(CFLAGS) $(READLINE_CFLAGS) -O1 -Wall -ggdb -o $@ -c $*.c $(CC) $(CFLAGS) $(READLINE_CFLAGS) $(MSPDEBUG_CFLAGS) -o $@ -c $*.c

View File

@ -65,7 +65,7 @@ static int open_interface(struct rf2500_transport *tr,
return -1; return -1;
} }
#ifndef __APPLE__ #if !(defined(__APPLE__) || defined(WIN32))
if (usb_detach_kernel_driver_np(tr->handle, tr->int_number) < 0) if (usb_detach_kernel_driver_np(tr->handle, tr->int_number) < 0)
perror("rf2500: warning: can't " perror("rf2500: warning: can't "
"detach kernel driver"); "detach kernel driver");
@ -124,7 +124,7 @@ static int usbtr_send(transport_t tr_base, const uint8_t *data, int len)
debug_hexdump("USB transfer out", pbuf, txlen); debug_hexdump("USB transfer out", pbuf, txlen);
#endif #endif
if (usb_bulk_write(tr->handle, USB_FET_OUT_EP, if (usb_bulk_write(tr->handle, USB_FET_OUT_EP,
(const char *)pbuf, txlen, 10000) < 0) { (char *)pbuf, txlen, 10000) < 0) {
perror("rf2500: can't send data"); perror("rf2500: can't send data");
return -1; return -1;
} }

10
util.c
View File

@ -40,12 +40,7 @@ static void sigint_handler(int signum)
void ctrlc_init(void) void ctrlc_init(void)
{ {
const static struct sigaction siga = { signal(SIGINT, sigint_handler);
.sa_handler = sigint_handler,
.sa_flags = 0
};
sigaction(SIGINT, &siga, NULL);
} }
void ctrlc_reset(void) void ctrlc_reset(void)
@ -111,7 +106,8 @@ int open_serial(const char *device, int rate)
tcgetattr(fd, &attr); tcgetattr(fd, &attr);
cfmakeraw(&attr); cfmakeraw(&attr);
cfsetspeed(&attr, rate); cfsetispeed(&attr, rate);
cfsetospeed(&attr, rate);
if (tcsetattr(fd, TCSAFLUSH, &attr) < 0) if (tcsetattr(fd, TCSAFLUSH, &attr) < 0)
return -1; return -1;