Merge branch 'master' of git://github.com/chunkeey/carl9170fw
authorChristian Lamparter <chunkeey@googlemail.com>
Sat, 19 Jan 2013 13:18:33 +0000 (14:18 +0100)
committerChristian Lamparter <chunkeey@googlemail.com>
Sat, 19 Jan 2013 13:18:33 +0000 (14:18 +0100)
12 files changed:
autogen.sh
carlfw/Kconfig
carlfw/src/main.c
carlfw/src/uart.c
carlfw/src/wlan.c
extra/FindGPERF.cmake
extra/FindPackageHandleStandardArgs.cmake
extra/FindUSB-1.0.cmake
extra/GCCVersion.cmake
toolchain/Makefile
toolchain/SHA256SUMS [new file with mode: 0644]
tools/lib/carlfw.c

index 729041e6e537656566a9b8035f5a3aee9a4bff51..a360065b8b4a467c9c051f75d1ce98b57a6e1677 100755 (executable)
@@ -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
        ;;
 
index 09445c4200a78c1925a8cdc3ff8cb016f9a29c55..656fcdb4ddd67a66db67e8fb0690f24d10e45a92 100644 (file)
@@ -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.
index e36dfad2df0013ad7d22567b63754bf5065db7f3..b2d16390cff576eea2f4fd2608ba849b650f1849 100644 (file)
@@ -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++;
 }
index 58f64866bae04352e09239c9c14045df68e35e16..919e6835de633b6ae9ce70b96f93cfa6d239cde3 100644 (file)
@@ -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
                 */
index 0f4dfeba074dfb53c898cb0bfb59887a7caca1d9..384d8d1118fafb89d994895ba2841ca66081fb04 100644 (file)
@@ -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]),
index ddb6bf2715b65be90f97ab3e0a3c9635fcf572ff..baf87494e0fe4e9e97c9a2fb9b1bc600a29511a0 100644 (file)
 # 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)
index 1acb021e80bc2d47ce0de0ad99871fd2b4aa7984..ec3440c0111e64f8f2884367d1fca39e9363fba9 100644 (file)
 #=============================================================================
 # 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)
index 00ed2f205750d98dbad6b86fde3699b6c7431755..83df063901c1a82ab0d920411c2470c09dfaa4c4 100644 (file)
@@ -8,9 +8,28 @@
 #
 #  Copyright (c) 2009 Andreas Schneider <mail@cynapses.org>
 #
-#  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.
 #
 
 
index d394f17147034e692da437619cce937973771427..bb5fef3f75698ead47df3acb07286cc8483b49d9 100644 (file)
@@ -6,15 +6,33 @@
 # Copyright 2008      Andreas Pakulat <apaku@gmx.de>
 # Copyright 2008-2009 Philip Lowman <philip@yhbt.com>
 #
-# 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.
 
 #-------------------------------------------------------------------------------
 
index 987606172bf5d454571d6dc7db173c2c31fc0687..b01276088177be35cbcbd10888fad2a1265db71c 100644 (file)
@@ -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 (file)
index 0000000..d1b7896
--- /dev/null
@@ -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
+
index ce61afb244913f1c892a878d5f6b90ac60bc287a..79a7467ad3f5e0e0f547f5263d8215b91b1d560d 100644 (file)
@@ -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;
        }