From: Christian Lamparter Date: Sat, 19 Jan 2013 13:18:33 +0000 (+0100) Subject: Merge branch 'master' of git://github.com/chunkeey/carl9170fw X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=d617e64afcad4c4a589bcbf68adf808959bfcdfb;hp=6a216e33d086b2a57dccda0563c44779d828ccbd;p=carl9170fw.git Merge branch 'master' of git://github.com/chunkeey/carl9170fw --- diff --git a/autogen.sh b/autogen.sh index 729041e..a360065 100755 --- a/autogen.sh +++ b/autogen.sh @@ -9,7 +9,8 @@ case "$1" in cmake . make popd - config/conf Kconfig + shift 1 + config/conf Kconfig "$@" cmake . ;; @@ -27,19 +28,24 @@ case "$1" in make echo -n "Installing firmware..." - if [ "$CONFIG_CARL9170FW_BUILD_TOOLS" = "y" ] && - [ "$CONFIG_CARL9170FW_BUILD_MINIBOOT" = "y" ]; then - echo -n "Apply miniboot..." - tools/src/miniboot a carlfw/carl9170.fw minifw/miniboot.fw + if [ "$CONFIG_CARL9170FW_BUILD_TOOLS" = "y" ]; then + if [ "$CONFIG_CARL9170FW_BUILD_MINIBOOT" = "y" ]; then + echo -n "Apply miniboot..." + # also adds checksum + tools/src/miniboot a carlfw/carl9170.fw minifw/miniboot.fw + else + echo -n "Add checksum..." + tools/src/checksum carlfw/carl9170.fw + fi fi - sudo install -m 644 carlfw/carl9170.fw \ - /lib/firmware/carl9170-$CONFIG_CARL9170FW_RELEASE_VERSION.fw + install -m 644 carlfw/carl9170.fw \ + ../carl9170-$CONFIG_CARL9170FW_RELEASE_VERSION.fw echo "done." ;; *) - $0 config + $0 config "$@" $0 compile ;; diff --git a/carlfw/Kconfig b/carlfw/Kconfig index 09445c4..656fcdb 100644 --- a/carlfw/Kconfig +++ b/carlfw/Kconfig @@ -190,7 +190,7 @@ config CARL9170FW_UNUSABLE config CARL9170FW_USB_MODESWITCH def_bool n prompt "USB 1.1 / 2.0 switching support" - depends on CARL9170FW_BROKEN_FEATURES + depends on CARL9170FW_BROKEN_FEATURES && CARL9170FW_USB_STANDARD_CMDS ---help--- Mostly implemented, but untested and some serious doubts remain. diff --git a/carlfw/src/main.c b/carlfw/src/main.c index e36dfad..b2d1639 100644 --- a/carlfw/src/main.c +++ b/carlfw/src/main.c @@ -84,10 +84,13 @@ static void handle_fw(void) static void tally_update(void) { - unsigned int boff, time, delta; + unsigned int time; time = get_clock_counter(); +#ifdef CONFIG_CARL9170FW_RADIO_FUNCTIONS if (fw.phy.state == CARL9170_PHY_ON) { + unsigned int boff, delta; + delta = (time - fw.tally_clock); fw.tally.active += delta; @@ -98,7 +101,7 @@ static void tally_update(void) if (boff & AR9170_MAC_BACKOFF_CCA) fw.tally.cca += delta; } - +#endif /* CONFIG_CARL9170FW_RADIO_FUNCTIONS */ fw.tally_clock = time; fw.counter++; } diff --git a/carlfw/src/uart.c b/carlfw/src/uart.c index 58f6486..919e683 100644 --- a/carlfw/src/uart.c +++ b/carlfw/src/uart.c @@ -33,7 +33,7 @@ void uart_putc(const char c) set(AR9170_UART_REG_TX_HOLDING, c); while (get(AR9170_UART_REG_LINE_STATUS) & - AR9170_UART_LINE_STS_TX_FIFO_ALMOST_EMPTY) { + AR9170_UART_LINE_STS_TX_FIFO_NEAR_EMPTY) { /* * wait until the byte has made it */ diff --git a/carlfw/src/wlan.c b/carlfw/src/wlan.c index 0f4dfeb..384d8d1 100644 --- a/carlfw/src/wlan.c +++ b/carlfw/src/wlan.c @@ -56,7 +56,7 @@ static void wlan_dump_queue(unsigned int qidx) entries++; } - desc = get_wlan_txq_addr(qidx); + desc = (struct dma_desc *)get_wlan_txq_addr(qidx); DBG("Queue: %d: te:%d td:%d h:%p c:%p t:%p", qidx, entries, queue_len(&fw.wlan.tx_queue[qidx]), diff --git a/extra/FindGPERF.cmake b/extra/FindGPERF.cmake index ddb6bf2..baf8749 100644 --- a/extra/FindGPERF.cmake +++ b/extra/FindGPERF.cmake @@ -43,15 +43,35 @@ # Copyright 2009 Kitware, Inc. # Copyright 2006 Tristan Carel # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: # -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cmake_minimum_required(VERSION 2.8.4) FIND_PROGRAM(GPERF_EXECUTABLE gperf DOC "path to the gperf executable") MARK_AS_ADVANCED(GPERF_EXECUTABLE) diff --git a/extra/FindPackageHandleStandardArgs.cmake b/extra/FindPackageHandleStandardArgs.cmake index 1acb021..ec3440c 100644 --- a/extra/FindPackageHandleStandardArgs.cmake +++ b/extra/FindPackageHandleStandardArgs.cmake @@ -72,15 +72,33 @@ #============================================================================= # Copyright 2007-2009 Kitware, Inc. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: # -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. INCLUDE(FindPackageMessage) INCLUDE(CMakeParseArguments) diff --git a/extra/FindUSB-1.0.cmake b/extra/FindUSB-1.0.cmake index 00ed2f2..83df063 100644 --- a/extra/FindUSB-1.0.cmake +++ b/extra/FindUSB-1.0.cmake @@ -8,9 +8,28 @@ # # Copyright (c) 2009 Andreas Schneider # -# Redistribution and use is allowed according to the terms of the New -# BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # diff --git a/extra/GCCVersion.cmake b/extra/GCCVersion.cmake index d394f17..bb5fef3 100644 --- a/extra/GCCVersion.cmake +++ b/extra/GCCVersion.cmake @@ -6,15 +6,33 @@ # Copyright 2008 Andreas Pakulat # Copyright 2008-2009 Philip Lowman # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: # -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distributed this file outside of CMake, substitute the full -# License text for the above reference.) +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #------------------------------------------------------------------------------- diff --git a/toolchain/Makefile b/toolchain/Makefile index 9876061..b012760 100644 --- a/toolchain/Makefile +++ b/toolchain/Makefile @@ -2,9 +2,9 @@ BINUTILS_VER=2.23.1 BINUTILS_TAR=binutils-$(BINUTILS_VER).tar.bz2 BINUTILS_URL="http://mirrors.kernel.org/gnu/binutils/$(BINUTILS_TAR)" -NEWLIB_VER=1.20.0 +NEWLIB_VER=2.0.0 NEWLIB_TAR=newlib-$(NEWLIB_VER).tar.gz -NEWLIB_URL="ftp://sources.redhat.com/pub/newlib/$(NEWLIB_TAR)" +NEWLIB_URL="ftp://sourceware.org/pub/newlib/$(NEWLIB_TAR)" GCC_VER=4.7.2 GCC_TAR=gcc-$(GCC_VER).tar.bz2 @@ -12,16 +12,27 @@ GCC_URL="http://mirrors.kernel.org/gnu/gcc/gcc-$(GCC_VER)/$(GCC_TAR)" BASEDIR=$(shell pwd) +define checksum +@if grep -q ' $(subst .,\.,$(1))$$' SHA256SUMS; then \ + grep ' $(subst .,\.,$(1))$$' SHA256SUMS | sha256sum -c; \ +else \ + echo "WARNING: no checksum defined for $(1)"; \ +fi +endef + all: gcc src/$(BINUTILS_TAR): wget -P src $(BINUTILS_URL) + $(call checksum,$@) src/$(NEWLIB_TAR): wget -P src $(NEWLIB_URL) + $(call checksum,$@) src/$(GCC_TAR): wget -P src $(GCC_URL) + $(call checksum,$@) src/binutils-$(BINUTILS_VER): src/$(BINUTILS_TAR) tar -C src -xf $< diff --git a/toolchain/SHA256SUMS b/toolchain/SHA256SUMS new file mode 100644 index 0000000..d1b7896 --- /dev/null +++ b/toolchain/SHA256SUMS @@ -0,0 +1,7 @@ +6c7af8ed1c8cf9b4b9d6e6fe09a3e1d3d479fe63984ba8b9b26bf356b6313ca9 src/binutils-2.22.tar.bz2 +16093f6fa01732adf378d97fe338f113c933bdf56da22bf87c76beff13da406f src/gcc-4.7.1.tar.bz2 +c644b2847244278c57bec2ddda69d8fab5a7c767f3b9af69aa7aa3da823ff692 src/newlib-1.20.0.tar.gz +2ab2e5b03e086d12c6295f831adad46b3e1410a3a234933a2e8fac66cb2e7a19 src/binutils-2.23.1.tar.bz2 +8a9283d7010fb9fe5ece3ca507e0af5c19412626384f8a5e9434251ae100b084 src/gcc-4.7.2.tar.bz2 +49c29e9129325e7c3b221aa829743ddcd796d024440e47c80fc0d6769af72d8a src/newlib-2.0.0.tar.gz + diff --git a/tools/lib/carlfw.c b/tools/lib/carlfw.c index ce61afb..79a7467 100644 --- a/tools/lib/carlfw.c +++ b/tools/lib/carlfw.c @@ -186,10 +186,15 @@ static void *__carlfw_find_desc(struct carlfw_file *file, unsigned int len, uint8_t compatible_revision) { - int scan = file->len, found = 0; + int scan, found = 0; struct carl9170fw_desc_head *tmp = NULL; - while (scan >= 0) { + /* + * Note: the last desc also has atleast a full desc_head. + * There's no reason for looking beyond that point. + */ + scan = (file->len - 1) - (sizeof(*tmp) - CARL9170FW_MAGIC_SIZE); + while (scan > 0) { if (file->data[scan] == descid[CARL9170FW_MAGIC_SIZE - found - 1]) found++; else @@ -202,10 +207,13 @@ static void *__carlfw_find_desc(struct carlfw_file *file, } if (found == CARL9170FW_MAGIC_SIZE) { + u16 tmp_desc_len; + tmp = (void *) &file->data[scan]; + tmp_desc_len = le16_to_cpu(tmp->length); if (!CHECK_HDR_VERSION(tmp, compatible_revision) && - (le16_to_cpu(tmp->length) >= len)) + (scan + tmp_desc_len <= file->len) && (tmp_desc_len >= len)) return tmp; }