1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-22 23:55:54 +02:00

Further cleanup to make the tools build for the "ben" target.

- tools/Makefile.common: set CC to the target-specific compiler
- tools/atspi-id/atspi-id.c: exclude everything USB if HAVE_USB is not set
- tools/atspi-id/atspi-id.c (atspi_usb_handle): rearrange to use a "struct
  atspi_dsc *" argument, so that we don't expose an USB dependency
- tools/lib/Makefile: $(F32XBASE)/lib/usb.o is target-specific. Moved it
  from OBJS to OBJS_host.
- tools/lib/Makefile (clean): remove objects of all targets
This commit is contained in:
Werner Almesberger 2010-09-05 20:51:07 -03:00
parent f20d685f8e
commit bb65155eab
3 changed files with 29 additions and 10 deletions

View File

@ -27,5 +27,6 @@ LDLIBS_ben =
MACROS_host = -DHAVE_USB MACROS_host = -DHAVE_USB
MACROS_ben = -DHAVE_USD MACROS_ben = -DHAVE_USD
CC = $(CC_$(TARGET))
CFLAGS += -I../../atrf/fw/include -I../include $(MACROS_$(TARGET)) CFLAGS += -I../../atrf/fw/include -I../include $(MACROS_$(TARGET))
LDLIBS = $(LDLIBS_$(TARGET)) -L../lib -latspi LDLIBS = $(LDLIBS_$(TARGET)) -L../lib -latspi

View File

@ -13,19 +13,23 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#ifdef HAVE_USB
#include <usb.h> #include <usb.h>
#endif
#include "at86rf230.h" #include "at86rf230.h"
#include "atspi/ep0.h" #include "atspi/ep0.h"
#include "atspi.h" #include "atspi.h"
#ifdef HAVE_USB
#define FROM_DEV ATSPI_FROM_DEV(0) #define FROM_DEV ATSPI_FROM_DEV(0)
#define BUF_SIZE 256 #define BUF_SIZE 256
static int get_id(usb_dev_handle *dev, void *data, int size) static int get_id(usb_dev_handle *dev, void *data, int size)
{ {
int res; int res;
@ -67,13 +71,19 @@ static int get_build(usb_dev_handle *dev, char *buf, size_t size)
} }
static void show_usb_info(usb_dev_handle *dev) static void show_usb_info(struct atspi_dsc *dsc)
{ {
const struct usb_device *device = usb_device(dev); usb_dev_handle *dev;
const struct usb_device *device;
uint8_t major, minor, target; uint8_t major, minor, target;
char buf[BUF_SIZE+1]; /* +1 for terminating \0 */ char buf[BUF_SIZE+1]; /* +1 for terminating \0 */
int len; int len;
dev = atspi_usb_handle(dsc);
if (!dev)
return;
device = usb_device(dev);
printf("%04x:%04x ", printf("%04x:%04x ",
device->descriptor.idVendor, device->descriptor.idProduct); device->descriptor.idVendor, device->descriptor.idProduct);
@ -89,14 +99,22 @@ static void show_usb_info(usb_dev_handle *dev)
} }
#else /* HAVE_USB */
static void show_usb_info(struct atspi_dsc *dsc)
{
}
#endif /* !HAVE_USB */
static void show_info(struct atspi_dsc *dsc) static void show_info(struct atspi_dsc *dsc)
{ {
usb_dev_handle *dev;
uint8_t part, version, man_id_0, man_id_1; uint8_t part, version, man_id_0, man_id_1;
dev = atspi_usb_handle(dsc); show_usb_info(dsc);
if (dev)
show_usb_info(dev);
part = atspi_reg_read(dsc, REG_PART_NUM); part = atspi_reg_read(dsc, REG_PART_NUM);
version = atspi_reg_read(dsc, REG_VERSION_NUM); version = atspi_reg_read(dsc, REG_VERSION_NUM);

View File

@ -16,9 +16,9 @@ LIB = libatspi.a
include ../Makefile.common include ../Makefile.common
CFLAGS += -Wall -I$(F32XBASE)/include CFLAGS += -Wall -I$(F32XBASE)/include
OBJS_host = atusb.o OBJS_host = atusb.o $(F32XBASE)/lib/usb.o
OBJS_ben = atusd.o OBJS_ben = atusd.o
OBJS = $(F32XBASE)/lib/usb.o atspi.o $(OBJS_$(TARGET)) OBJS = atspi.o $(OBJS_$(TARGET))
.PHONY: all clean spotless .PHONY: all clean spotless
@ -28,7 +28,7 @@ $(LIB): $(OBJS)
$(AR) cr $@ $^ $(AR) cr $@ $^
clean: clean:
rm -f $(OBJS) rm -f $(OBJS) $(OBJS_ben) $(OBJS_host)
spotless: clean spotless: clean
rm -f $(LIB) rm -f $(LIB)