Commit 558b18f4 authored by Alessandro Rubini's avatar Alessandro Rubini

Merge branch 'v3.3-dev'

parents 89322f34 620e5880
......@@ -19,8 +19,8 @@ linux-2.6.39.tar.bz2 1aab7a741abe08d42e8eccf20de61e05 \
http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.39.tar.bz2
# our gateware binaries
wrs3-gw-v3.0-20120801.tar.gz 28a7ac3ec004d3e441c232fa125d820a \
http://www.ohwr.org/attachments/download/1485/wrs3-gw-v3.0-20120801.tar.gz
wrs3-gw-v3.3-20130213.tar.gz f7cd4323aa4de317d3fa8a0fd8c82479 \
http://www.ohwr.org/attachments/download/1909/wrs3-gw-v3.3-20130213.tar.gz
# buildroot core and packages
buildroot-2011.11.tar.bz2 7b852f4ef17c63857ca7b9388b782070 \
......
......@@ -25,6 +25,7 @@ showhelp()
printf "Options: \n"
printf " -h|--help\t Show this help message\n"
printf " -m|--mode\t can be: default (df and nf), df (dataflash),\n\t\t nf (nandflash), ddr (ddr memories).\n"
printf " -g|--gateware\t Select the gateware: 18p (18 ports, default), 8p (8 ports), LX130T (small FPGA), LX240T (big FGPA)\n"
printf " -e \t\t Completely erase the memory (Can erase your configuration)\n"
printf " -b|--build\t Use files that you have built in the WRS_OUTPUT_DIR\n"
printf " -m1|--mac1\t Default MAC address for the ethernet port on board\n"
......@@ -107,6 +108,10 @@ MAC1=$MAC1_DEF
MAC2_DEF="02:34:56:78:9A:00"
MAC2=$MAC2_DEF
# By default we select the gateware only for 18ports because 8ports are
# only used by developper.
gateware="18p*.bin"
DEV=""
FLAGS=""
......@@ -156,6 +161,19 @@ while [ $# -ge 1 ]; do
fi
memmode="$2"
shift; shift;;
-g|--gateware)
# Obtain which gateware type we want to keep for flash
if [ "$2" = "18p" ] || [ "$2" = "8p" ]; then
gateware="$2*.bin";
elif [ "$2" = "LX240T" ] || [ "$2" = "LX130T" ]; then
gateware="*-$2.bin";
else
echo "Error: Invalid gateware selection \"$2\""
showhelp
exit 1
fi
shift; shift;;
/* ) DEV="-s $1"; shift ;;
......@@ -224,9 +242,9 @@ if lsusb | grep -q "at91sam"; then
else
echo ""
echo "$me: Waiting for at91sam SAMBA bootloader on usb."
echo " Please check the jumper is plugged"
echo " and the USB cable is connected."
echo " Then reset the switch or turn it on."
echo " Please check the Managment USB cable is connected "
echo " and keep pressed the Flash button while"
echo " resetting/powering the switch."
while true; do
if lsusb | grep -q "at91sam"; then
break
......@@ -239,7 +257,7 @@ fi
# Remove the jumper now, before proceeding
echo "$me: I'm talking with the switch;"
echo -n " please remove the jumper and press Enter to start flashing: "
echo -n " please release the flash button and press Enter to start flashing: "
read unused
# Create a temporary barebox binary with modified MAC addresses
......@@ -269,6 +287,9 @@ if [ $nf ]; then
TMPSCRIPT=$TMPDIR/wrsrootfs-script
cat > $TMPSCRIPT << EOF
tar --directory $TMPFS -xzf $rootfsgz
# Remove the unnecessary HDL files, by default we keep 18 ports HDL for both FPGA type
# (There is not enough place in DDR to extract 4 HDLs, be carefull if you add custom files)
find $TMPFS/wr/lib/firmware/ -type f \( ! -name ''${gateware}'' \) -a \( ! -name '*rt_cpu.bin' \) -exec rm -f {} \;
mkfs.jffs2 --little-endian --eraseblock=0x20000 -n --pad -d $TMPFS -o $rootfsjffs2
......
......@@ -21,11 +21,13 @@ else
fi
if [ "$WRS_HW_DIR" != "" ]; then
wrs_echo "Copying binaries from $WRS_HW_DIR"
cp ${WRS_HW_DIR}/syn/scb_8ports/scb_top_synthesis.bin $FWDIR/8ports_mb.bin
cp ${WRS_HW_DIR}/syn/scb_18ports/scb_top_synthesis.bin $FWDIR/18ports_mb.bin
wrs_echo "Copying binaries from $WRS_HW_DIR"
cp ${WRS_HW_DIR}/syn/scb_8ports/scb_top_synthesis.bin $FWDIR/8p_mb-LX130T.bin
cp ${WRS_HW_DIR}/syn/scb_18ports/scb_top_synthesis.bin $FWDIR/18p_mb-LX130T.bin
# cp ${WRS_HW_DIR}/syn/scb_8ports/scb_top_synthesis.bin $FWDIR/8p_mb-LX240T.bin
# cp ${WRS_HW_DIR}/syn/scb_18ports/scb_top_synthesis.bin $FWDIR/18p_mb-LX240T.bin
else
tarname="wrs3-gw-v3.0-20120801.tar.gz"
tarname="wrs3-gw-v3.3-20130213.tar.gz"
wrs_echo "Using pre-build binaries from $tarname"
wrs_download $tarname
tar xzf $WRS_DOWNLOAD_DIR/$tarname -C $FWDIR
......
~
pdf/
tex/
*.aux
*.log
*.out
*.pdf
*.tex
*.toc
########################################################################
## Makefile to generate multiple document from the same markdown file
## using pandoc software:
##
## References:
##
## Authors:
## - Benoit Rat (Seven Solutions, www.sevensols.com)
##
## GNU Lesser General Public License Usage
## This file may be used under the terms of the GNU Lesser
## General Public License version 2.1 as published by the Free Software
## Foundation and appearing in the file LICENSE.LGPL included in the
## packaging of this file. Please review the following information to
## ensure the GNU Lesser General Public License version 2.1 requirements
## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
########################################################################
## Obtaining the proper file
SRC=$(wildcard *.md)
PDF=$(addprefix pdf/, $(SRC:.md=.pdf))
TEX=$(SRC:.md=.tex)
DOC=$(SRC:.md=.doc)
## Pandoc arguments
OPTIONS=-f markdown --toc --number-sections --smart
TEMPLATE=pandoc.latex
ifneq "$(TEMPLATE)" ""
TEMPLATEARG=--template=$(TEMPLATE)
endif
## Obtain the version
VERSION = $(shell git describe --always --dirty=+ | sed 's;^wr-switch-sw-;;')
DATE = $(shell date +"%d %b. %Y")
#--highlight-style=pygments (the default), kate, monochrome, espresso, haddock, and tango
#-V highlight-bg=true
## Main targets
all: $(PDF)
tex: $(TEX)
doc: $(DOC)
pdf: $(PDF)
## Special targets to create directory
DIR_%:
mkdir -p $(subst DIR_,,$@)
pdf/%.pdf: %.md Makefile $(TEMPLATE) DIR_pdf
pandoc $(OPTIONS) --latex-engine=xelatex --listings --highlight-style=haddock $(TEMPLATEARG) \
-V lang=english -V fontsize=11pt -V documentclass=article -V bg-color=238,245,240 -V date="$(DATE) - $(VERSION)" -o $@ $<
%.tex: %.md Makefile $(TEMPLATE)
@echo "$(VERSION) @ $(notdir $@) $@ < $< ^ $^"
pandoc $(OPTIONS) --listings --highlight-style=haddock $(TEMPLATEARG) \
-V lang=english -V fontsize=11pt -V documentclass=article -V bg-color=238,245,240 -o $@ $<
%.doc: %.md Makefile $(TEMPLATE)
@echo "$(VERSION) @ $(notdir $@) $@ < $< ^ $^"
pandoc $(OPTIONS) --listings \
-V lang=english -V fontsize=11pt -V documentclass=article -V bg-color=238,245,240 -o $@ $<
install: $(PDF)
mkdir -p ../pdf
cp $< ../$(subst .pdf,-$(VERSION).pdf,$<)
.PHONY: clean
clean:
rm -f pdf/*.pdf *~ *.tex *.log
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -141,11 +141,8 @@ void pwm_configure_fpga(int enmask, float rate)
{
uint8_t u8speed=(uint8_t)((rate>=1)?0xff:(rate*255.0));
if(enmask & 0x1) spwm_wbr->DR0=u8speed;
else spwm_wbr->DR0=0;
if(enmask & 0x2) spwm_wbr->DR1=u8speed;
else spwm_wbr->DR0=0;
if((enmask & 0x1)>0) spwm_wbr->DR0=u8speed;
if((enmask & 0x2)>0) spwm_wbr->DR1=u8speed;
}
/* Configures a PWM output. Rate accepts range is from 0 (0%) to 1 (100%) */
......@@ -214,12 +211,12 @@ int shw_init_fans()
uint32_t val=0;
int detect, i;
TRACE(TRACE_INFO, "Configuring PWMs for fans (desired temperature = %.1f degC)...", DESIRED_TEMPERATURE);
//Set the type of PWM
if(shw_get_hw_ver()<330) is_cpu_pwn=1;
else is_cpu_pwn=0;
TRACE(TRACE_INFO, "Configuring %s PWMs for fans (desired temperature = %.1f degC)... %d",is_cpu_pwn?"CPU":"FPGA");
if(is_cpu_pwn)
{
......@@ -241,8 +238,8 @@ int shw_init_fans()
//Point to the corresponding WB direction
spwm_wbr= (volatile struct SPWM_WB *) (FPGA_BASE_ADDR + FPGA_BASE_SPWM);
//Configure SPWM register the 60=(62.5MHz÷(4kHz×2^8))−1
val= SPWM_CR_PRESC_W(60) | SPWM_CR_PERIOD_W(255);
//Configure SPWM register the 30~=(62.5MHz÷(8kHz×2^8))−1
val= SPWM_CR_PRESC_W(30) | SPWM_CR_PERIOD_W(255);
spwm_wbr->CR=val;
fan_pi.ki = 1.0;
......
......@@ -47,7 +47,10 @@ uint64_t shw_get_tics()
}
/**
* \brief Helper function to quickly display byte into binary code.
* WARNING: this returns static storage
*/
const char *shw_2binary(uint8_t x)
{
static char b[9];
......
......@@ -9,8 +9,10 @@ for arg in $(cat /proc/cmdline); do
fi;
done
# Obtain the type of FPGA (LX130XT or LX240XT)
tfpga=$($WR_HOME/bin/shw_ver -f)
$WR_HOME/bin/load-virtex $WR_HOME/lib/firmware/18ports_mb.bin
$WR_HOME/bin/load-virtex $WR_HOME/lib/firmware/18p_mb-${tfpga}.bin
$WR_HOME/bin/load-lm32 $WR_HOME/lib/firmware/rt_cpu.bin
insmod $WR_HOME/lib/modules/at91_softpwm.ko
insmod $WR_HOME/lib/modules/wr_vic.ko
......
......@@ -13,8 +13,8 @@ STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
#
GIT_VER = $(shell git describe --always --dirty=+ | sed 's;^[a-zA-Z\-]*-\(.*\)$$;\1;' )
#
GIT_VER = $(shell git describe --always --dirty=+ | sed 's;^wr-switch-sw-;;')
GIT_USR = $(shell git config --get-all user.name)
# LOTs of includes
......
......@@ -32,6 +32,7 @@
/**
* \brief Helper function to convert mac address into a string
* WARNING: this returns static storage
*/
char *mac_to_string(uint8_t mac[ETH_ALEN])
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment