1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-04 23:14:06 +02:00

atusb: firmware update for the 2010-12-16 board series

- fw/Makefile: replaced "make" with $(MAKE) (just for style)
- common/Makefile.common: Makefile settings shared within project. For now,
  this contains only the board version, which defaults to 2010-12-16.
- fw/common/Makefile, fw/boot/Makefile, fw/atusb/Makefile: include
  common/Makefile.common
- fw/common/Makefile, fw/boot/Makefile, fw/atusb/Makefile: pass board
  version to cpp and gcc
- fw/atusb/atusb.c (init_io): individually set IRQ_RF to one, LED and TST
  to zero
- fw/atusb/atusb.c (init_io): added macros to set all unused pins to zero
  in a way that doesn't need updating if a signal moves from one pin to
  another
- include/atusb/ep0.h: added hardware type 1 (2010-12-16 design)
- common/config.h: set hardware type depending on board version
- common/io.h: assign pins depending on board version
This commit is contained in:
Werner Almesberger 2010-12-17 23:01:31 -03:00
parent ba310a8ce4
commit ad2c72fa7f
9 changed files with 100 additions and 10 deletions

View File

@ -17,10 +17,10 @@ DIRS=common boot atusb
.PHONY: all depend install uninstall clean spotless
all:
for d in $(DIRS); do make -C $$d all || exit 1; done
for d in $(DIRS); do $(MAKE) -C $$d all || exit 1; done
depend:
for d in $(DIRS); do make -C $$d depend || exit 1; done
for d in $(DIRS); do $(MAKE) -C $$d depend || exit 1; done
# Top-level Makefile recurses for "install" and "uninstall", which have no use
# here. Just ignore them.
@ -30,7 +30,7 @@ install:
uninstall:
clean:
for d in $(DIRS); do make -C $$d clean || exit 1; done
for d in $(DIRS); do $(MAKE) -C $$d clean || exit 1; done
spotless:
for d in $(DIRS); do make -C $$d spotless || exit 1; done
for d in $(DIRS); do $(MAKE) -C $$d spotless || exit 1; done

View File

@ -18,8 +18,9 @@ F32XBASE = ../../../../f32xbase
include $(F32XBASE)/fw/common/Makefile.system
include $(F32XBASE)/fw/common/Makefile.common
include ../common/Makefile.common
CFLAGS += -I../common -I../include
CFLAGS += -I../common -I../include -D$(BOARD)
LDFLAGS += --code-size $(PAYLOAD_SIZE) --code-loc $(PAYLOAD_START)
USB_ID = $(shell \

View File

@ -59,6 +59,35 @@ void test_mode(void)
}
/*
* The following macros set all unused pins on a given port to zero. This is
* more elaborate than just setting the ports directly, but it has the
* advantage of hiding the pin to port relation.
*/
#define PORT_NUM_P0 0
#define PORT_NUM_P2 2
#define PORT_NUM_P3 3
#define __PORT_NUM(mode) PORT_NUM_##mode
#define PORT_NUM(mode) __PORT_NUM(mode)
#define USED(port, net) (PORT_NUM(net##_PORT) == port ? 1 << net##_BIT : 0)
#define ZERO_UNUSED(port) \
P##port &= \
USED(port, LED) | \
USED(port, ID) | \
USED(port, MOSI) | \
USED(port, MISO) | \
USED(port, SCLK) | \
USED(port, nSS) | \
USED(port, nRST_RF) | \
USED(port, IRQ_RF) | \
USED(port, SLP_TR) | \
USED(port, TST)
static void init_io(void)
{
/*
@ -91,8 +120,13 @@ static void init_io(void)
SLP_TR = 0;
SLP_TR_MODE |= 1 << SLP_TR_BIT;
P0 = 1; /* IRQ_RF = 1; LED = 0; TST = Z; the rest is unused */
P3 = 0;
IRQ_RF = 1;
LED = 0;
TST = 0;
ZERO_UNUSED(0);
ZERO_UNUSED(2);
ZERO_UNUSED(3);
#if 0
/*

View File

@ -17,6 +17,7 @@ F32XBASE = ../../../../f32xbase
include $(F32XBASE)/fw/common/Makefile.system
include $(F32XBASE)/fw/common/Makefile.common
include ../common/Makefile.common
CFLAGS += -I../common -I../include
CFLAGS += -I../common -I../include -D$(BOARD)
LDFLAGS += --code-size $(PAYLOAD_START)

View File

@ -10,6 +10,8 @@
# (at your option) any later version.
#
include Makefile.common
GEN_quiet = @echo " GENERATE " $@ &&
@ -25,7 +27,7 @@ endif
all: io-parts.h
io-parts.h: io.h Makefile
$(GEN) $(CPP) -dD $< | \
$(GEN) $(CPP) -D$(BOARD) -dD $< | \
sed '1,/IO_H/d' | \
awk \
'BEGIN { print "/* MACHINE-GENERATED. DO NOT EDIT ! */"; \

View File

@ -0,0 +1,14 @@
#
# common/Makefile.common - Makefile settings shared within project
#
# Written 2010 by Werner Almesberger
# Copyright 2010 Werner Almesberger
#
# 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 2 of the License, or
# (at your option) any later version.
#
#BOARD=BOARD_100813
BOARD=BOARD_101216

View File

@ -39,6 +39,12 @@
/* ----- Application configuration ----------------------------------------- */
#if defined(BOARD_1008xx)
#define HW_TYPE HW_TYPE_100813
#elif defined(BOARD_1012xx)
#define HW_TYPE HW_TYPE_101216
#else
#error must define BOARD_1008xx or BOARD_1012xx
#endif
#endif /* !CONFIG_H */

View File

@ -18,6 +18,17 @@
#define LED P0_1
/* ID pin */
/*
* 100813 open
* 101216 GND
*/
#define ID P0_2
#if defined(BOARD_100813)
/* SPI */
#define MOSI P2_2
@ -32,4 +43,24 @@
#define SLP_TR P2_1
#define TST P0_7
#elif defined(BOARD_101216)
/* SPI */
#define MOSI P2_1
#define MISO P2_0
#define SCLK P0_7
#define nSS P2_4
/* Miscellaneous RF signals */
#define nRST_RF P0_6
#define IRQ_RF P0_0
#define SLP_TR P0_5
#define TST P0_4
#else
#error must define BOARD_1008xx or BOARD1012xx
#endif /* !BOARD_101216 */
#endif /* !IO_H */

View File

@ -43,7 +43,8 @@
#define EP0ATUSB_MAJOR 0 /* EP0 protocol, major revision */
#define EP0ATUSB_MINOR 1 /* EP0 protocol, minor revision */
#define HW_TYPE_100813 0 /* 100813 */
#define HW_TYPE_100813 0 /* 2010-08-13 */
#define HW_TYPE_101216 1 /* 2010-12-16 */
/*