Driver: ath9k_htc - Atheros HTC devices (USB)
-Version: 1.4.0
+Version: Based on commit d19607454d656cb14d8c16dfbf161eebb542e8fe
+dated June 25 2017
Licence: Free software. See ath9k_htc/LICENCE.TXT for details.
--- /dev/null
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided this notice is
+# preserved. This file is offered as-is, without any warranty.
+# Names of contributors must not be used to endorse or promote products
+# derived from this file without specific prior written permission.
+
+# EditorConfig
+# http://EditorConfig.org
+
+# top-most EditorConfig file
+root = true
+
+# LF end-of-line, insert an empty new line and UTF-8
+[*]
+end_of_line = lf
+insert_final_newline = true
+charset = utf-8
+
+# Tab indentation
+[makefile,Makefile]
+indent_style = tab
--- /dev/null
+.gitattributes export-ignore
+.gitignore export-ignore
\ No newline at end of file
--- /dev/null
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided this notice is
+# preserved. This file is offered as-is, without any warranty.
+# Names of contributors must not be used to endorse or promote products
+# derived from this file without specific prior written permission.
+
+# See YAML format https://en.wikipedia.org/wiki/YAML
+# See Travis CI (Continuous Integration) https://docs.travis-ci.com/
+
+
+language: c
+
+os:
+ - linux
+
+addons:
+ apt:
+ packages:
+ - cmake
+
+script:
+ - make toolchain
+ - make -C target_firmware
+ - make -C target_firmware clean
-GMP_VER=5.0.5
+GMP_VER=6.1.1
GMP_URL=https://ftp.gnu.org/gnu/gmp/gmp-$(GMP_VER).tar.bz2
GMP_TAR=gmp-$(GMP_VER).tar.bz2
GMP_DIR=gmp-$(GMP_VER)
+GMP_SUM=a8109865f2893f1373b0a8ed5ff7429de8db696fc451b1036bd7bdf95bbeffd6
-MPFR_VER=3.1.1
+MPFR_VER=3.1.4
MPFR_URL=https://ftp.gnu.org/gnu/mpfr/mpfr-$(MPFR_VER).tar.bz2
MPFR_TAR=mpfr-$(MPFR_VER).tar.bz2
MPFR_DIR=mpfr-$(MPFR_VER)
+MPFR_SUM=d3103a80cdad2407ed581f3618c4bed04e0c92d1cf771a65ead662cc397f7775
-MPC_VER=1.0.1
+MPC_VER=1.0.3
MPC_URL=https://ftp.gnu.org/gnu/mpc/mpc-$(MPC_VER).tar.gz
MPC_TAR=mpc-$(MPC_VER).tar.gz
MPC_DIR=mpc-$(MPC_VER)
+MPC_SUM=617decc6ea09889fb08ede330917a00b16809b8db88c29c31bfbb49cbf88ecc3
-BINUTILS_VER=2.23.1
+BINUTILS_VER=2.27
BINUTILS_URL=https://ftp.gnu.org/gnu/binutils/binutils-$(BINUTILS_VER).tar.bz2
BINUTILS_TAR=binutils-$(BINUTILS_VER).tar.bz2
BINUTILS_DIR=binutils-$(BINUTILS_VER)
-BINUTILS_PATCHES=local/patches/binutils.patch local/patches/binutils-elf32-xtensa-sec_cache.patch
+BINUTILS_PATCHES=local/patches/binutils.patch local/patches/binutils-2.27_fixup.patch
+BINUTILS_SUM=369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88
-GCC_VER=4.7.4
+GCC_VER=6.3.0
GCC_URL=https://ftp.gnu.org/gnu/gcc/gcc-$(GCC_VER)/gcc-$(GCC_VER).tar.bz2
GCC_TAR=gcc-$(GCC_VER).tar.bz2
GCC_DIR=gcc-$(GCC_VER)
-GCC_PATCHES=local/patches/gcc.patch
+GCC_PATCHES=local/patches/gcc.patch local/patches/gcc-6.3.0_fixup.patch
+GCC_SUM=f06ae7f3f790fbf0f018f6d40e844451e6bc3b7bc96e128e63b09825c1f8b29f
BASEDIR=$(shell pwd)
TOOLCHAIN_DIR=$(BASEDIR)/toolchain
$(DL_DIR)/$($(1)_TAR):
mkdir -p $(DL_DIR)
wget -N -P $(DL_DIR) $($(1)_URL)
+ printf "%s %s\n" $($(1)_SUM) $$@ | shasum -a 256 -c
$(DL_DIR)/$($(1)_DIR)/.prepared: $(DL_DIR)/$($(1)_TAR)
tar -C $(DL_DIR) -x$(if $(findstring bz2,$($(1)_TAR)),j,z)f $(DL_DIR)/$($(1)_TAR)
* Copyright (c) 2002-2005 Atheros Communications, Inc.
* Copyright (c) 2008-2010, Atheros Communications Inc.
*
- * Redistribution and use in source and binary forms are permitted
- * provided that the following conditions are met:
- * 1. The materials contained herein are unmodified and are used
- * unmodified.
- * 2. Redistributions of source code must retain the above copyright
+ * 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 above copyright
* notice, this list of conditions and the following NO
* ''WARRANTY'' disclaimer below (''Disclaimer''), without
* modification.
- * 3. Redistributions in binary form must reproduce at minimum a
+ * 2. Redistributions in binary form must reproduce at minimum a
* disclaimer similar to the Disclaimer below and any redistribution
* must be conditioned upon including a substantially similar
* Disclaimer requirement for further binary redistribution.
- * 4. Neither the names of the above-listed copyright holders nor the
+ * 3. Neither the names of the above-listed copyright holders nor the
* names of any contributors may be used to endorse or promote
* product derived from this software without specific prior written
* permission.
The following files are from ECoS with a GPLv2 licence with modification
and linking caveats. Please see the licence below for more information:
-target_firmware/magpie_fw_dev/build/magpie_1_1/sboot/cmnos/printf/src/cmnos_printf.c
+sboot/magpie_1_1/sboot/cmnos/printf/src/cmnos_printf.c
target_firmware/magpie_fw_dev/target/cmnos/cmnos_printf.c
target_firmware/magpie_fw_dev/target/cmnos/k2_fw_cmnos_printf.c
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
-// You should have received a copy of the GNU General Public License along
-// with eCos; if not, write to the Free Software Foundation, Inc.,
-// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
--- /dev/null
+diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
+index d062044..ca261ae 100644
+--- a/gas/config/tc-xtensa.c
++++ b/gas/config/tc-xtensa.c
+@@ -2228,7 +2228,7 @@ xg_reverse_shift_count (char **cnt_argp)
+ cnt_arg = *cnt_argp;
+
+ /* replace the argument with "31-(argument)" */
+- new_arg = concat ("31-(", cnt_argp, ")", (char *) NULL);
++ new_arg = concat ("31-(", cnt_arg, ")", (char *) NULL);
+
+ free (cnt_arg);
+ *cnt_argp = new_arg;
+++ /dev/null
---- a/bfd/elf32-xtensa.c 2012-06-29 17:46:01.000000000 +0300
-+++ b/bfd/elf32-xtensa.c 2013-05-08 19:16:39.436716824 +0300
-@@ -6075,7 +6075,7 @@
- release_internal_relocs (sec_cache->sec, sec_cache->relocs);
- if (sec_cache->ptbl)
- free (sec_cache->ptbl);
-- memset (sec_cache, 0, sizeof (sec_cache));
-+ memset (sec_cache, 0, sizeof (*sec_cache));
- }
- }
-
-@@ -6117,7 +6117,7 @@
-
- /* Fill in the new section cache. */
- clear_section_cache (sec_cache);
-- memset (sec_cache, 0, sizeof (sec_cache));
-+ memset (sec_cache, 0, sizeof (*sec_cache));
-
- sec_cache->sec = sec;
- sec_cache->contents = contents;
index 30f4f41..fe9b051 100644
--- a/include/xtensa-config.h
+++ b/include/xtensa-config.h
-@@ -1,7 +1,7 @@
- /* Xtensa configuration settings.
-- Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010
-+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
- Free Software Foundation, Inc.
-- Contributed by Bob Wilson (bob.wilson@acm.org) at Tensilica.
-+ Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.
-
- 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
@@ -44,10 +44,7 @@
#define XCHAL_HAVE_L32R 1
--- /dev/null
+diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
+index 015dd1049fb..df80ad9117e 100644
+--- a/gcc/config/xtensa/xtensa.c
++++ b/gcc/config/xtensa/xtensa.c
+@@ -1780,7 +1780,8 @@ xtensa_emit_call (int callop, rtx *operands)
+ rtx tgt = operands[callop];
+
+ if (GET_CODE (tgt) == CONST_INT)
+- sprintf (result, "call%d\t0x%lx", WINDOW_SIZE, INTVAL (tgt));
++ sprintf (result, "call%d\t" HOST_WIDE_INT_PRINT_HEX,
++ WINDOW_SIZE, INTVAL (tgt));
+ else if (register_operand (tgt, VOIDmode))
+ sprintf (result, "callx%d\t%%%d", WINDOW_SIZE, callop);
+ else
+@@ -2351,14 +2352,14 @@ print_operand (FILE *file, rtx x, int letter)
+
+ case 'L':
+ if (GET_CODE (x) == CONST_INT)
+- fprintf (file, "%ld", (32 - INTVAL (x)) & 0x1f);
++ fprintf (file, HOST_WIDE_INT_PRINT_DEC, (32 - INTVAL (x)) & 0x1f);
+ else
+ output_operand_lossage ("invalid %%L value");
+ break;
+
+ case 'R':
+ if (GET_CODE (x) == CONST_INT)
+- fprintf (file, "%ld", INTVAL (x) & 0x1f);
++ fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x) & 0x1f);
+ else
+ output_operand_lossage ("invalid %%R value");
+ break;
+@@ -2372,7 +2373,7 @@ print_operand (FILE *file, rtx x, int letter)
+
+ case 'd':
+ if (GET_CODE (x) == CONST_INT)
+- fprintf (file, "%ld", INTVAL (x));
++ fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x));
+ else
+ output_operand_lossage ("invalid %%d value");
+ break;
+@@ -2437,7 +2438,7 @@ print_operand (FILE *file, rtx x, int letter)
+ else if (GET_CODE (x) == MEM)
+ output_address (GET_MODE (x), XEXP (x, 0));
+ else if (GET_CODE (x) == CONST_INT)
+- fprintf (file, "%ld", INTVAL (x));
++ fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x));
+ else
+ output_addr_const (file, x);
+ }
-From c7162b8a3db42e7faf47606d3aa3dd61e64aea17 Mon Sep 17 00:00:00 2001
-From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
-Date: Mon, 7 Jan 2013 16:06:28 +0530
-Subject: [PATCH] gcc: AR9271/AR7010 config
-
-Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
----
- include/xtensa-config.h | 36 +++++++++++++++++-------------------
- 1 file changed, 17 insertions(+), 19 deletions(-)
-
diff --git a/include/xtensa-config.h b/include/xtensa-config.h
-index 30f4f41..fe9b051 100644
+index 5ae4c80..8397564 100644
--- a/include/xtensa-config.h
+++ b/include/xtensa-config.h
-@@ -1,7 +1,7 @@
- /* Xtensa configuration settings.
-- Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010
-+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
- Free Software Foundation, Inc.
-- Contributed by Bob Wilson (bob.wilson@acm.org) at Tensilica.
-+ Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.
-
- 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
-@@ -44,10 +44,7 @@
+@@ -43,10 +43,7 @@
#define XCHAL_HAVE_L32R 1
#undef XSHAL_USE_ABSOLUTE_LITERALS
#undef XCHAL_HAVE_MAC16
#define XCHAL_HAVE_MAC16 0
-@@ -59,10 +56,10 @@
+@@ -58,10 +55,10 @@
#define XCHAL_HAVE_MUL32 1
#undef XCHAL_HAVE_MUL32_HIGH
#undef XCHAL_HAVE_NSA
#define XCHAL_HAVE_NSA 1
-@@ -103,8 +100,6 @@
+@@ -102,8 +99,6 @@
#undef XCHAL_HAVE_FP_RSQRT
#define XCHAL_HAVE_FP_RSQRT 0
#undef XCHAL_HAVE_WINDOWED
#define XCHAL_HAVE_WINDOWED 1
-@@ -119,32 +114,32 @@
+@@ -118,32 +113,32 @@
#undef XCHAL_ICACHE_SIZE
#undef XCHAL_HAVE_DEBUG
-@@ -157,8 +152,11 @@
+@@ -156,8 +151,11 @@
#define XCHAL_NUM_DBREAK 2
#undef XCHAL_DEBUGLEVEL
#undef XCHAL_MAX_INSTRUCTION_SIZE
#define XCHAL_MAX_INSTRUCTION_SIZE 3
---
-1.8.1
-
+##
+ # Copyright (c) 2013 Qualcomm Atheros, Inc.
+ #
+ # All rights reserved.
+ #
+ # Redistribution and use in source and binary forms, with or without
+ # modification, are permitted (subject to the limitations in the
+ # disclaimer below) provided that the following conditions are met:
+ #
+ # * 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 name of Qualcomm Atheros nor the names of its
+ # contributors may be used to endorse or promote products derived
+ # from this software without specific prior written permission.
+ #
+ # NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ # GRANTED BY THIS LICENSE. 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 OWNER 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.
+ ##
+
SET(CMAKE_C_COMPILER_WORKS 1)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(ath9k_firmware NONE)
ENABLE_LANGUAGE(C)
-ADD_DEFINITIONS(-g -Os -Wunused-label -Wunused-variable -Wunused-value -Wpointer-arith -Wundef -nostdlib -Wundef)
+ADD_DEFINITIONS(
+ -g -Os
+ -Wunused-label
+ -Wunused-variable
+ -Wunused-value
+ -Wpointer-arith
+ -nostdlib
+ -Wundef
+ -Wunused-but-set-variable
+ -Wmaybe-uninitialized
+)
ADD_DEFINITIONS(
-D_RAM_
-DBIG_ENDIAN -D_BYTE_ORDER=_BIG_ENDIAN
ENDIF()
INCLUDE_DIRECTORIES(
+ ${CMAKE_SOURCE_DIR}/include
+ ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/
${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/inc
${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/inc/xtensa-elf
${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/inc/${PLATFORM_NAME}
DEPENDS firmware
COMMAND ${CMAKE_C_COMPILER}
-nostdlib
+ -fno-lto
-Wl,--start-group
${CMAKE_BINARY_DIR}/libfirmware.a
-Wl,--end-group
+##
+ # Copyright (c) 2013 Qualcomm Atheros, Inc.
+ #
+ # All rights reserved.
+ #
+ # Redistribution and use in source and binary forms, with or without
+ # modification, are permitted (subject to the limitations in the
+ # disclaimer below) provided that the following conditions are met:
+ #
+ # * 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 name of Qualcomm Atheros nor the names of its
+ # contributors may be used to endorse or promote products derived
+ # from this software without specific prior written permission.
+ #
+ # NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ # GRANTED BY THIS LICENSE. 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 OWNER 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.
+ ##
+
all:
[ -d build ] || ./configure || { rm -rf build; false; }
+$(MAKE) -C build/k2
#!/bin/sh
-TOOLCHAIN=$PWD/../toolchain/inst
+##
+ # Copyright (c) 2013 Qualcomm Atheros, Inc.
+ #
+ # All rights reserved.
+ #
+ # Redistribution and use in source and binary forms, with or without
+ # modification, are permitted (subject to the limitations in the
+ # disclaimer below) provided that the following conditions are met:
+ #
+ # * 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 name of Qualcomm Atheros nor the names of its
+ # contributors may be used to endorse or promote products derived
+ # from this software without specific prior written permission.
+ #
+ # NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ # GRANTED BY THIS LICENSE. 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 OWNER 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.
+ ##
+
TARGET=xtensa-elf
-PREFIX="$TOOLCHAIN/bin/$TARGET-"
-TOOLCHAIN_FILE=$PWD/build/toolchain.cmake
+
+[ -z "$CROSS_COMPILE" ] &&
+ CROSS_COMPILE="$PWD/../toolchain/inst/bin/$TARGET-"
+
+TOOLCHAIN_FILE="$PWD/build/toolchain.cmake"
set -e
rm -rf build
mkdir -p build
cat > "$TOOLCHAIN_FILE" <<EOF
-INCLUDE(CMakeForceCompiler)
-
-SET(CMAKE_SYSTEM_PROCESSOR xtensa)
-SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/$TARGET)
-SET(CMAKE_STRIP :)
-
-CMAKE_FORCE_C_COMPILER(${PREFIX}gcc GNU)
+SET(CMAKE_SYSTEM_NAME Generic)
+SET(CMAKE_C_COMPILER "${CROSS_COMPILE}gcc")
EOF
do_cmake() {
- cmake -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_FILE "$@"
+ cmake -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE" "$@"
}
mkdir -p build/k2 build/magpie
#!/usr/bin/env perl
+##
+ # Copyright (c) 2013 Qualcomm Atheros, Inc.
+ #
+ # All rights reserved.
+ #
+ # Redistribution and use in source and binary forms, with or without
+ # modification, are permitted (subject to the limitations in the
+ # disclaimer below) provided that the following conditions are met:
+ #
+ # * 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 name of Qualcomm Atheros nor the names of its
+ # contributors may be used to endorse or promote products derived
+ # from this software without specific prior written permission.
+ #
+ # NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ # GRANTED BY THIS LICENSE. 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 OWNER 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.
+ ##
+
use strict;
my $crc = 0;
my $bytes;
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * Copyright (c) 2016 Oleksij Rempel <linux@rempel-privat.de>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+
+#ifndef _ATH_ROM_H_
+#define _ATH_ROM_H_
+
+#include <dt_defs.h>
+#include <hif_api.h>
+#include <htc.h>
+
+int strcmp(const char *s1, const char *s2);
+
+LOCAL BOOLEAN bSet_configuration(void);
+LOCAL void HTCControlSvcProcessMsg(HTC_ENDPOINT_ID EndpointID,
+ adf_nbuf_t hdr_buf, adf_nbuf_t pBuffers, void *arg);
+LOCAL void HTCMsgRecvHandler(adf_nbuf_t hdr_buf,
+ adf_nbuf_t buffer, void *context);
+
+void athos_indirection_table_install(void);
+
+void HIFusb_DescTraceDump(void);
+void _HIFusb_isr_handler(hif_handle_t);
+void _HIFusb_start(hif_handle_t);
+void mUsbEPinHighBandSet(uint8_t EPn, uint8_t dir, uint16_t size);
+void mUsbEPMap(uint8_t EPn, uint8_t MAP);
+void mUsbEPMxPtSzHigh(uint8_t EPn, uint8_t dir, uint16_t size);
+void mUsbEPMxPtSzLow(uint8_t EPn, uint8_t dir, uint16_t size);
+void mUsbFIFOConfig(uint8_t FIFOn, uint8_t cfg);
+void mUsbFIFOMap(uint8_t FIFOn, uint8_t MAP);
+
+#endif /* _ATH_ROM_H_ */
* user,hence these routines should be called to manipulate
* anything inside it.
*/
-#include <adf_net.h>
#include <osapi.h>
#include "cmnos_api.h"
#include <Magpie_api.h>
// #############################################################################
/**
- *
+ *
* @brief allocate a new nbuf,
- *
+ *
* @param hdl (adf_net handle)
* @param size (size of the new buf)
* @param reserve (amount of space to reserve in the head)
- *
+ *
* @return newly allocated nbuf
*/
-__adf_nbuf_t
-__adf_nbuf_alloc(adf_os_size_t size, a_uint32_t reserve,
+__adf_nbuf_t
+__adf_nbuf_alloc(adf_os_size_t size, a_uint32_t reserve,
a_uint32_t align)
{
VBUF *buf = NULL;
VDESC *desc;
-
+
buf = VBUF_alloc_vbuf();
if ( buf != NULL ) {
desc = VDESC_alloc_vdesc();
desc->next_desc = NULL;
desc->data_offset = reserve;
desc->data_size = 0;
- desc->control = 0;
-
+ desc->control = 0;
+
buf->desc_list = desc;
- buf->buf_length = 0;
+ buf->buf_length = 0;
}
-
+
return buf;
-}
-
+}
+
/**
* @brief Free the nbuf
* function to be called in
* @param hdl
* @param adf_nbuf
- *
+ *
*/
void __adf_nbuf_free(__adf_nbuf_t buf)
{
/**
* @brief reallocate the head space, call it only after the you
* have called headroom
- *
+ *
* @param adf_nbuf
- * @param headroom
- *
+ * @param headroom
+ *
* @return new nbuf
*/
-__adf_nbuf_t
+__adf_nbuf_t
__adf_nbuf_realloc_headroom(__adf_nbuf_t buf, a_uint32_t headroom)
{
adf_os_assert(0);
/**
* @brief expand the tailroom, mostly by adding the new tail
* buffer, also take care of the priv
- *
+ *
* @param buf
* @param tailroom
- *
+ *
* @return struct mbuf * (buffer with the new tailroom)
*/
-__adf_nbuf_t
+__adf_nbuf_t
__adf_nbuf_realloc_tailroom(__adf_nbuf_t buf, a_uint32_t tailroom)
{
adf_os_assert(0);
/**
* @brief expand the headroom or tailroom or both
- *
+ *
* @param buf
* @param headroom ( 0 if no headroom expansion req)
* @param tailroom ( 0 if no tailroom expansion req)
- *
+ *
* @return struct mbuf* (NULL if something goofed up)
*/
-__adf_nbuf_t
+__adf_nbuf_t
__adf_nbuf_expand(__adf_nbuf_t buf, a_uint32_t headroom, a_uint32_t tailroom)
{
adf_os_assert(0);
/**
* @brief put data in the head
- *
+ *
* @param buf
* @param len (how much data to put)
- *
+ *
* @return new data pointer ,NULL if the len is more than the
* space available in the head frag.
*/
-a_uint8_t *
+a_uint8_t *
__adf_nbuf_push_head(__adf_nbuf_t buf, adf_os_size_t len)
{
- a_uint8_t *ptr = NULL;
+ a_uint8_t *ptr = NULL;
VDESC *desc = buf->desc_list;
-
+
desc->data_offset -= len;
desc->data_size += len;
buf->buf_length += len;
}
/**
- *
+ *
* @brief add data in the end of tail
- *
+ *
* @param buf
* @param len (how much data to put)
- *
+ *
* @return previous tail (data+len),NULL if the len is more than
* space available
*/
{
a_uint8_t *tail = NULL;
VDESC *last_desc = __adf_nbuf_last(buf);
-
+
tail = last_desc->buf_addr + last_desc->data_offset + last_desc->data_size;
last_desc->data_size += len;
buf->buf_length += len;
-
+
return tail;
}
/**
* @brief strip data from head
- *
+ *
* @param adf_nbuf
* @param len (how much data to rip)
- *
+ *
* @return new data pointer
*/
-a_uint8_t *
+a_uint8_t *
__adf_nbuf_pull_head(__adf_nbuf_t buf, adf_os_size_t len)
{
a_uint8_t *ptr = NULL;
VDESC *desc = buf->desc_list;
-
+
desc->data_offset += len;
desc->data_size -= len;
buf->buf_length -= len;
ptr = desc->buf_addr + desc->data_offset;
-
+
return ptr;
}
/**
* @brief strip data from tail, priv safe
- *
+ *
* @param buf
* @param len (how much to strip down)
- *
+ *
*/
-void
+void
__adf_nbuf_trim_tail(__adf_nbuf_t buf, adf_os_size_t len)
{
VDESC *last_desc = __adf_nbuf_last(buf);
-
+
adf_os_assert(buf != NULL);
last_desc->data_size -= len;
buf->buf_length -= len;
-
+
//adf_os_assert(0); //0820
}
/**
* @brief Copy assumes that we create a writeable copy of the
* nbuf which is equivalent in FreeBSD as duping the
* mbuf.
- *
+ *
* @param src
- *
+ *
* @return struct mbuf * (newly allocated buffer)
*/
-__adf_nbuf_t
+__adf_nbuf_t
__adf_nbuf_copy(__adf_nbuf_t src)
{
- __adf_nbuf_t buf = NULL;
+ __adf_nbuf_t buf = NULL;
adf_os_assert(src != NULL);
-
+
return buf;
}
/**
* @brief make the writable copy of the nbuf
- *
+ *
* @param adf_nbuf
- *
+ *
* @return new nbuf
*/
-__adf_nbuf_t
+__adf_nbuf_t
__adf_nbuf_unshare(__adf_nbuf_t src)
{
__adf_nbuf_t buf = NULL;
/**
* @brief return the frag data & len, where frag no. is
* specified by the index
- *
+ *
* @param[in] buf
* @param[out] sg (scatter/gather list of all the frags)
- *
+ *
*/
-void
+void
__adf_nbuf_frag_info(__adf_nbuf_t buf, adf_os_sglist_t *sg)
{
VDESC *desc = buf->desc_list;
int count = 0;
-
+
while( desc != NULL ) {
sg->sg_segs[count].vaddr = desc->buf_addr + desc->data_offset;
sg->sg_segs[count].len = desc->data_size;
-
- count++;
+
+ count++;
desc = desc->next_desc;
}
-
+
sg->nsegs = count;
}
/**
* @brief retrieve the priv space pointer from nbuf
- *
+ *
* @param buf (nbuf to attach the priv space)
- *
+ *
* @return uint8_t* ( pointer to the data )
*/
a_uint8_t *
}
/**
- *
+ *
* @brief append the nbuf to the queue
- *
+ *
* @param adf_qhead
* @param adf_nbuf
- *
+ *
*/
-void
-__adf_nbuf_queue_add(__adf_nbuf_qhead_t *qhead,
+void
+__adf_nbuf_queue_add(__adf_nbuf_qhead_t *qhead,
__adf_nbuf_t buf)
{
qhead->qlen++;
/**
* @brief dequeue an nbuf
- *
+ *
* @param adf_qhead
- *
+ *
* @return the nbuf
*/
-__adf_nbuf_t
+__adf_nbuf_t
__adf_nbuf_queue_remove(__adf_nbuf_qhead_t *qhead)
{
__adf_nbuf_t b0 = NULL;
} else {
qhead->head = qhead->head->next_buf;
}
-
+
b0->next_buf = NULL;
}
return b0;
/**
* @brief creates a streaming mapping (takes a pre allocated
* global tag for 4K mbuf sizes)
- *
+ *
* @param hdl
* @param max_sz
* @param dmap
- *
+ *
* @return a_status_t
*/
-a_status_t
+a_status_t
__adf_nbuf_dmamap_create(__adf_os_device_t osdev, __adf_os_dma_map_t *dmap)
{
a_status_t retval = A_STATUS_OK;
-
+
(*dmap) = A_ALLOCRAM(sizeof(struct __adf_dma_map));
if(*dmap == NULL)
return A_STATUS_ENOMEM;
-
+
(*dmap)->buf = NULL;
return retval;
}
-a_status_t
-__adf_nbuf_map(__adf_os_device_t osdev, __adf_os_dma_map_t bmap,
+a_status_t
+__adf_nbuf_map(__adf_os_device_t osdev, __adf_os_dma_map_t bmap,
__adf_nbuf_t buf, adf_os_dma_dir_t dir)
-{
+{
bmap->buf = buf;
-
+
return A_STATUS_OK;
}
-void
-__adf_nbuf_unmap(__adf_os_device_t osdev, __adf_os_dma_map_t bmap,
+void
+__adf_nbuf_unmap(__adf_os_device_t osdev, __adf_os_dma_map_t bmap,
adf_os_dma_dir_t dir)
{
bmap->buf = NULL;
-
+
return;
}
void
-__adf_nbuf_dmamap_destroy(__adf_os_device_t osdev,
+__adf_nbuf_dmamap_destroy(__adf_os_device_t osdev,
__adf_os_dma_map_t dmap)
{
//dmap->buf = NULL;
-
+
// Should not be called in FW!
//return A_STATUS_OK;
}
/**
- * @brief return the dma map info
- *
+ * @brief return the dma map info
+ *
* @param[in] bmap
* @param[out] sg (map_info ptr)
*/
-void
+void
__adf_nbuf_dmamap_info(__adf_os_dma_map_t bmap, adf_os_dmamap_info_t *sg)
{
VDESC *desc = bmap->buf->desc_list;
int count = 0;
-
+
while( desc != NULL ) {
sg->dma_segs[count].paddr = (adf_os_dma_addr_t)(desc->buf_addr + desc->data_offset);
sg->dma_segs[count].len = desc->data_size;
-
- count++;
+
+ count++;
desc = desc->next_desc;
}
-
- sg->nsegs = count;
+
+ sg->nsegs = count;
}
/**
/**
* @brief sets the cksum type & value for nbuf
* XXX: not fully implemented
- *
+ *
* @param buf
* @param cksum
*/
-void
+void
__adf_nbuf_set_rx_cksum(__adf_nbuf_t buf, adf_nbuf_rx_cksum_t *cksum)
{
}
-a_status_t
-__adf_nbuf_get_vlan_info(adf_net_handle_t hdl, __adf_nbuf_t buf,
+a_status_t
+__adf_nbuf_get_vlan_info(adf_net_handle_t hdl, __adf_nbuf_t buf,
adf_net_vlanhdr_t *vlan)
{
return A_STATUS_OK;
}
if (cnt != len) {
- //adf_os_print("cnt: %x, len: %x, __adf_nbuf_queue_len: %x\n", cnt, len,
+ //adf_os_print("cnt: %x, len: %x, __adf_nbuf_queue_len: %x\n", cnt, len,
// __adf_nbuf_queue_len(qhead));
adf_os_assert(0);
}
buf->desc_list = NULL;
buf->buf_length = 0;
VBUF_free_vbuf(buf);
-
+
}
/**
* @brief return the last mbuf
- *
+ *
* @param m0
- *
+ *
* @return struct mbuf*
*/
-VDESC *
+VDESC *
__adf_nbuf_last(VBUF *buf)
{
VDESC *desc = buf->desc_list;
-
+
//for(; desc->next_desc != NULL; desc = desc->next_desc)
// ;
while(desc->next_desc != NULL)
{
desc = desc->next_desc;
}
-
+
return desc;
}
/**
* @brief num bytes in the head
- *
+ *
* @param adf_nbuf
- *
+ *
* @return num of bytes available
*/
a_uint32_t
/**
* @brief num of bytes available in the tail excluding the priv
* portion
- *
+ *
* @param adf_nbuf
- *
+ *
* @return num of bytes
*/
-a_uint32_t
+a_uint32_t
__adf_nbuf_tailroom(__adf_nbuf_t buf)
{
VDESC *last_desc = __adf_nbuf_last(buf);
-
+
return last_desc->buf_size - last_desc->data_offset - last_desc->data_size;
}
/**
* @brief get the entire packet length
- *
+ *
* @param adf_nbuf
- *
+ *
* @return total length of packet (sum of all frag lengths)
- */
+ */
a_uint32_t
__adf_nbuf_len(__adf_nbuf_t buf)
{
- return buf->buf_length;
+ return buf->buf_length;
}
/**
* @brief Clone the nbuf (will not create writeable copies)
- *
+ *
* @param adf_nbuf
- *
+ *
* @return Read-only copy of the nbuf (including clusters)
*/
-__adf_nbuf_t
+__adf_nbuf_t
__adf_nbuf_clone(__adf_nbuf_t src)
{
__adf_nbuf_t buf = NULL;
-
+
return buf;
}
/*
* @brief check if the mbuf is cloned or not
- *
+ *
* @param buf
- *
+ *
* @return a_bool_t
*/
a_bool_t
* @brief This will return the header's addr & m_len
*/
void
-__adf_nbuf_peek_header(__adf_nbuf_t buf, a_uint8_t **addr,
+__adf_nbuf_peek_header(__adf_nbuf_t buf, a_uint8_t **addr,
a_uint32_t *len)
{
VDESC *desc = buf->desc_list;
-
+
*addr = desc->buf_addr + desc->data_offset;
- *len = desc->data_size;
+ *len = desc->data_size;
}
/**
* @brief init the queue
* @param qhead
*/
-void
+void
__adf_nbuf_queue_init(__adf_nbuf_qhead_t *qhead)
{
qhead->qlen = 0;
/**
* @brief return the length of queue
* @param adf_qhead
- *
+ *
* @return length
- *
+ *
*/
-a_uint32_t
+a_uint32_t
__adf_nbuf_queue_len(__adf_nbuf_qhead_t *qhead)
{
return qhead->qlen;
/**
* @brief returns the first guy in the Q
* @param qhead
- *
+ *
* @return (NULL if the Q is empty)
*/
-__adf_nbuf_t
+__adf_nbuf_t
__adf_nbuf_queue_first(__adf_nbuf_queue_t *qhead)
{
return qhead->head;
}
/**
* @brief return the next packet from packet chain
- *
+ *
* @param buf (packet)
- *
+ *
* @return (NULL if no packets are there)
*/
-__adf_nbuf_t
+__adf_nbuf_t
__adf_nbuf_queue_next(__adf_nbuf_t buf)
{
return buf->next_buf;
}
/**
* @brief check if the queue is empty or not
- *
+ *
* @param qhead
- *
+ *
* @return a_bool_t
*/
-a_bool_t
+a_bool_t
__adf_nbuf_is_queue_empty(__adf_nbuf_qhead_t *qhead)
{
return ((qhead->qlen == 0));
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
- * FreeBSD specific prototypes
+ * FreeBSD specific prototypes
*/
#ifndef _ADF_NBUF_PVT_H
#define _ADF_NBUF_PVT_H
//#include <adf_nbuf_api.h>
#define __ADF_NBUF_NULL NULL
-#define __ADF_NBUF_CTX_BUF
+#define __ADF_NBUF_CTX_BUF
typedef VBUF * __adf_nbuf_t;
*/
typedef struct __adf_nbuf_qhead {
VBUF *head;
- VBUF *tail;
+ VBUF *tail;
a_uint32_t qlen;
}__adf_nbuf_qhead_t;
typedef __adf_nbuf_qhead_t __adf_nbuf_queue_t;
-__adf_nbuf_t
-__adf_nbuf_alloc(adf_os_size_t size,
- a_uint32_t reserve, a_uint32_t align);
+__adf_nbuf_t
+__adf_nbuf_alloc(adf_os_size_t size,
+ a_uint32_t reserve, a_uint32_t align);
-void
+void
__adf_nbuf_free(__adf_nbuf_t buf);
-a_uint8_t *
+a_uint8_t *
__adf_nbuf_push_head(__adf_nbuf_t buf, adf_os_size_t size);
-
-a_uint8_t *
+
+a_uint8_t *
__adf_nbuf_pull_head(__adf_nbuf_t buf, adf_os_size_t size);
-a_uint8_t *
+a_uint8_t *
__adf_nbuf_put_tail(__adf_nbuf_t buf, adf_os_size_t size);
-void
+void
__adf_nbuf_trim_tail(__adf_nbuf_t buf, adf_os_size_t size);
-__adf_nbuf_t
+__adf_nbuf_t
__adf_nbuf_realloc_headroom(__adf_nbuf_t buf,
- a_uint32_t headroom);
-
-__adf_nbuf_t
-__adf_nbuf_realloc_tailroom(__adf_nbuf_t buf,
+ a_uint32_t headroom);
+
+__adf_nbuf_t
+__adf_nbuf_realloc_tailroom(__adf_nbuf_t buf,
a_uint32_t tailroom);
-
-__adf_nbuf_t
+
+__adf_nbuf_t
__adf_nbuf_expand(__adf_nbuf_t buf,
a_uint32_t headroom, a_uint32_t tailroom);
-
-__adf_nbuf_t
+
+__adf_nbuf_t
__adf_nbuf_copy(__adf_nbuf_t src);
-__adf_nbuf_t
+__adf_nbuf_t
__adf_nbuf_unshare(__adf_nbuf_t src);
-void
+void
__adf_nbuf_frag_info(__adf_nbuf_t buf, adf_os_sglist_t *sg);
-a_uint8_t *
+a_uint8_t *
__adf_nbuf_get_priv(__adf_nbuf_t buf);
-void
-__adf_nbuf_queue_add(__adf_nbuf_qhead_t *qhead,
+void
+__adf_nbuf_queue_add(__adf_nbuf_qhead_t *qhead,
__adf_nbuf_t buf);
-
-__adf_nbuf_t
+
+__adf_nbuf_t
__adf_nbuf_queue_remove(__adf_nbuf_qhead_t *qhead);
-a_uint32_t
-__adf_nbuf_tx_cksum_info(__adf_nbuf_t buf,
- a_uint8_t **hdr_off,
+a_uint32_t
+__adf_nbuf_tx_cksum_info(__adf_nbuf_t buf,
+ a_uint8_t **hdr_off,
a_uint8_t **where);
-
-void
+
+void
__adf_nbuf_set_rx_cksum(__adf_nbuf_t buf, adf_nbuf_rx_cksum_t *cksum);
-void
+void
__adf_nbuf_get_tso_info(__adf_nbuf_t buf, adf_nbuf_tso_t *tso);
-a_status_t
-__adf_nbuf_get_vlan_info(adf_net_handle_t hdl,
- __adf_nbuf_t buf,
- adf_net_vlanhdr_t *vlan);
-
-void
+a_status_t
+__adf_nbuf_get_vlan_info(adf_net_handle_t hdl,
+ __adf_nbuf_t buf,
+ adf_net_vlanhdr_t *vlan);
+
+void
__adf_nbuf_dmamap_info(__adf_os_dma_map_t bmap, adf_os_dmamap_info_t *sg);
/**
* @brief return the last mbuf
- *
+ *
* @param m0
- *
+ *
* @return struct mbuf*
*/
-VDESC *
+VDESC *
__adf_nbuf_last(VBUF *buf);
/**
* @brief num bytes in the head
- *
+ *
* @param adf_nbuf
- *
+ *
* @return num of bytes available
*/
a_uint32_t
/**
* @brief num of bytes available in the tail excluding the priv
* portion
- *
+ *
* @param adf_nbuf
- *
+ *
* @return num of bytes
*/
-a_uint32_t
+a_uint32_t
__adf_nbuf_tailroom(__adf_nbuf_t buf);
/**
* @brief get the entire packet length
- *
+ *
* @param adf_nbuf
- *
+ *
* @return total length of packet (sum of all frag lengths)
- */
+ */
a_uint32_t
__adf_nbuf_len(__adf_nbuf_t buf);
/**
* @brief Clone the nbuf (will not create writeable copies)
- *
+ *
* @param adf_nbuf
- *
+ *
* @return Read-only copy of the nbuf (including clusters)
*/
-__adf_nbuf_t
+__adf_nbuf_t
__adf_nbuf_clone(__adf_nbuf_t src);
void
/*
* @brief check if the mbuf is cloned or not
- *
+ *
* @param buf
- *
+ *
* @return a_bool_t
*/
a_bool_t
* @brief This will return the header's addr & m_len
*/
void
-__adf_nbuf_peek_header(__adf_nbuf_t buf, a_uint8_t **addr,
+__adf_nbuf_peek_header(__adf_nbuf_t buf, a_uint8_t **addr,
a_uint32_t *len);
/**
* @brief init the queue
* @param qhead
*/
-void
+void
__adf_nbuf_queue_init(__adf_nbuf_qhead_t *qhead);
/**
* @brief return the length of queue
* @param adf_qhead
- *
+ *
* @return length
- *
+ *
*/
-a_uint32_t
+a_uint32_t
__adf_nbuf_queue_len(__adf_nbuf_qhead_t *qhead);
/**
* @brief returns the first guy in the Q
* @param qhead
- *
+ *
* @return (NULL if the Q is empty)
*/
-__adf_nbuf_t
+__adf_nbuf_t
__adf_nbuf_queue_first(__adf_nbuf_queue_t *qhead);
/**
* @brief return the next packet from packet chain
- *
+ *
* @param buf (packet)
- *
+ *
* @return (NULL if no packets are there)
*/
-__adf_nbuf_t
+__adf_nbuf_t
__adf_nbuf_queue_next(__adf_nbuf_t buf);
/**
* @brief check if the queue is empty or not
- *
+ *
* @param qhead
- *
+ *
* @return a_bool_t
*/
-a_bool_t
+a_bool_t
__adf_nbuf_is_queue_empty(__adf_nbuf_qhead_t *qhead);
__adf_nbuf_t
void
__adf_nbuf_split_to_frag(__adf_nbuf_t buf, __adf_nbuf_queue_t *qhead);
-a_status_t __adf_nbuf_dmamap_create(__adf_os_device_t osdev,
+a_status_t __adf_nbuf_dmamap_create(__adf_os_device_t osdev,
__adf_os_dma_map_t *dmap);
-void __adf_nbuf_dmamap_destroy(__adf_os_device_t osdev,
+void __adf_nbuf_dmamap_destroy(__adf_os_device_t osdev,
__adf_os_dma_map_t dmap);
a_status_t __adf_nbuf_map(__adf_os_device_t osdev, __adf_os_dma_map_t dmap,
* @module_desc Magpie Network Shim
*/
-#include <adf_net.h>
-//#include <asf_queue.h>
-//#include "adf_net_wcmd_pvt.h"
#include <wlan_pci.h>
/**
/**
* @brief register the driver into the shim
* @param[in] drv
- *
+ *
* @return a_status_t
*/
a_status_t
__adf_net_register_drv(adf_drv_info_t *drv)
{
- wlan_pci_register_drv(drv);
+ wlan_pci_register_drv(drv);
return A_STATUS_OK;
}
#define __ADF_PCI_BAR0 0x10
-a_status_t
+a_status_t
__adf_net_register_drv(adf_drv_info_t *drv);
void
static inline void
__adf_net_start_queue(adf_net_handle_t hdl)
-{
+{
}
return NULL;
}
-static inline adf_net_handle_t __adf_net_vdev_create(adf_net_handle_t dev_hdl,
- adf_drv_handle_t hdl, adf_vdev_sw_t *op,
+static inline adf_net_handle_t __adf_net_vdev_create(adf_net_handle_t dev_hdl,
+ adf_drv_handle_t hdl, adf_vdev_sw_t *op,
adf_net_dev_info_t *info)
{
return NULL;
__adf_net_hdl_to_os(adf_net_handle_t hdl)
{
return NULL;
-}
+}
#endif
#ifndef __ADF_OS_ATOMIC_PVT_H
#define __ADF_OS_ATOMIC_PVT_H
-//#include <sys/types.h>
-//#include <machine/atomic.h>
-
-#include <adf_os_types.h>
-
typedef a_uint32_t __adf_os_atomic_t;
/**
* @brief This initiallizes the varriable to zero
- *
+ *
* @param __adf_os_atomic_t (int pointer)
- *
+ *
*/
static inline void
__adf_os_atomic_init(__adf_os_atomic_t *v)
__adf_os_atomic_write(__adf_os_atomic_t *v,a_uint32_t p)
{
atomic_store_rel_int(v,(int)p);
-}
+}
*/
#endif
*/
#include "adf_os_defer_pvt.h"
-void
+void
__adf_os_defer_func(void *arg, int pending)
{
__adf_os_defer_ctx_t *ctx = (__adf_os_defer_ctx_t *)arg;
/**
* @brief initiallize the defer function (work or bh)
- *
+ *
* @param defer
* @param func
* @param arg
*/
static inline void __adf_os_init_defer(__adf_os_defer_t *defer,
- adf_os_defer_fn_t func,
+ adf_os_defer_fn_t func,
void *arg)
{
defer->ctx.caller_fn = func;
//__adf_os_init_defer(bh, func, arg);
A_TASKLET_INIT_TASK(func, arg, bh);
}
-static inline void __adf_os_sched_work(adf_os_handle_t hdl,
+static inline void __adf_os_sched_work(adf_os_handle_t hdl,
__adf_os_work_t * work)
{
//taskqueue_enqueue(taskqueue_thread, &work->tsk);
}
-static inline void __adf_os_disable_work(adf_os_handle_t hdl,
+static inline void __adf_os_disable_work(adf_os_handle_t hdl,
__adf_os_work_t * work)
{
//taskqueue_drain(taskqueue_thread, &work->tsk);
}
-static inline void __adf_os_sched_bh(adf_os_handle_t hdl,
+static inline void __adf_os_sched_bh(adf_os_handle_t hdl,
__adf_os_bh_t * bh)
{
A_TASKLET_SCHEDULE(bh);
}
-static inline void __adf_os_disable_bh(adf_os_handle_t hdl,
+static inline void __adf_os_disable_bh(adf_os_handle_t hdl,
__adf_os_bh_t * bh)
{
A_TASKLET_DISABLE(bh);
}
-#endif
+#endif
adf_os_assert(nseg == 1);
((bus_dma_segment_t *)arg)[0].ds_addr = dseg[0].ds_addr;
- ((bus_dma_segment_t *)arg)[0].ds_len = dseg[0].ds_len;
+ ((bus_dma_segment_t *)arg)[0].ds_len = dseg[0].ds_len;
}
#endif
* @brief Allocates a DMA region, uses the tag elem to store the
* tag value which constant for all the mappings done
* through this API.
- *
+ *
* @param osdev
* @param size
* @param coherent
* @param dmap
- *
+ *
* @return void* (Virtual address)
*/
inline void*
-__adf_os_dmamem_alloc(__adf_os_device_t osdev, adf_os_size_t size,
+__adf_os_dmamem_alloc(__adf_os_device_t osdev, adf_os_size_t size,
a_bool_t coherent, __adf_os_dma_map_t *dmap)
-{
+{
(*dmap) = A_ALLOCRAM(sizeof(struct __adf_dma_map));
-
+
if((*dmap) == NULL){
goto fail_malloc;
}
-
+
(*dmap)->ds_addr = A_ALLOCRAM(size);
(*dmap)->ds_len = size;
-
+
return (*dmap)->ds_addr;
-
-fail_malloc:
- return NULL;
+
+fail_malloc:
+ return NULL;
}
#include <adf_os_util.h>
inline void*
-__adf_os_dmamem_alloc(__adf_os_device_t osdev, adf_os_size_t size,
+__adf_os_dmamem_alloc(__adf_os_device_t osdev, adf_os_size_t size,
a_bool_t coherent, __adf_os_dma_map_t *dmap);
-/*
- * Free a previously mapped DMA buffer
+/*
+ * Free a previously mapped DMA buffer
* Direction doesnt matter, since this API is called at closing time.
*/
static inline void
__adf_os_dmamem_free(adf_os_device_t osdev, __adf_os_size_t size, a_bool_t coherent,
void *vaddr, __adf_os_dma_map_t dmap)
-{
+{
}
//#define __adf_os_dmamem_map2addr(_dmap) ((_dmap)->seg[0].ds_addr)
#define __adf_os_dmamem_map2addr(_dmap) ((adf_os_dma_addr_t)(_dmap)->ds_addr)
-static inline void
+static inline void
__adf_os_dmamem_cache_sync(__adf_os_device_t osdev, __adf_os_dma_map_t dmap, adf_os_cache_sync_t sync)
{
#define __adf_os_htons(x) x
#define __adf_os_htonl(x) x
-#define __adf_os_cpu_to_le16(x) __bswap16(x)
+#define __adf_os_cpu_to_le16(x) __bswap16(x)
#endif
* @brief setup the Interrupt handler for the driver
* @param[in] dev
* @param[in] sc
- *
+ *
* @return int
*/
__adf_os_setup_intr(__adf_os_device_t osdev, adf_os_drv_intr fn)
{
g_wlan_intr = fn;
-
- return 0;
+
+ return 0;
}
/**
void
__adf_os_free_intr(__adf_os_device_t osdev)
{
- g_wlan_intr = NULL;
+ g_wlan_intr = NULL;
}
static inline void __adf_os_init_mutex(__adf_os_mutex_t *mtx)
{
-
+
}
static inline int __adf_os_mutex_acquire(__adf_os_mutex_t *mtx)
{
//mtx_unlock_spin(lock);
}
-static inline a_bool_t __adf_os_spinlock_irq_exec(adf_os_handle_t hdl, __adf_os_spinlock_t *lock,
+static inline a_bool_t __adf_os_spinlock_irq_exec(adf_os_handle_t hdl, __adf_os_spinlock_t *lock,
adf_os_irqlocked_func_t func, void *arg)
{
return 0;
/* move a memory buffer */
static inline void __adf_os_mem_copy(void *dst, const void *src, adf_os_size_t size)
{
- A_MEMCPY(dst,src,size);
+ A_MEMCPY(dst,src,size);
}
/* set a memory buffer */
/**
* @brief generic driver /module init function
- *
+ *
* @param mod (module data)
* @param event (LOAD or UNLOAD)
* @param arg (any extra argument needed if
- *
+ *
* @return int
*/
/**
* exit module macro
*/
-#define __adf_os_virt_module_exit(_fn)
+#define __adf_os_virt_module_exit(_fn)
-#define __adf_os_module_dep(_name, _dep)
+#define __adf_os_module_dep(_name, _dep)
#endif
/**
* exit module macro
*/
-#define __adf_os_pci_module_exit(_fn)
+#define __adf_os_pci_module_exit(_fn)
/**
* initiallize the PCI driver structure
* @param osdev
* @param offset
* @param val
- *
+ *
* @return int
*/
-static inline int
+static inline int
__adf_os_pci_config_read8(adf_os_device_t osdev, int offset, a_uint8_t *val)
{
(*val) = wlan_pci_config_read(offset, 1);
*/
}
-static inline int
+static inline int
__adf_os_pci_config_write8(adf_os_device_t osdev, int offset, a_uint8_t val)
{
wlan_pci_config_write(offset, val, 1);
- return 0;
+ return 0;
}
-static inline int
+static inline int
__adf_os_pci_config_read16(adf_os_device_t osdev, int offset, a_uint16_t *val)
{
(*val) = wlan_pci_config_read(offset, 2);
return 0;
}
-static inline int
+static inline int
__adf_os_pci_config_write16(adf_os_device_t osdev, int offset, a_uint16_t val)
{
wlan_pci_config_write(offset, val, 2);
- return 0;
+ return 0;
}
-static inline int
+static inline int
__adf_os_pci_config_read32(adf_os_device_t osdev, int offset, a_uint32_t *val)
{
(*val) = wlan_pci_config_read(offset, 4);
return 0;
}
-static inline int
+static inline int
__adf_os_pci_config_write32(adf_os_device_t osdev, int offset, a_uint32_t val)
{
wlan_pci_config_write(offset, val, 4);
- return 0;
+ return 0;
}
#endif
* @brief this code is modified version of tvtohz(9) which
* returns signed int which we don't require, hence we
* got rid of the type casting thing
- *
+ *
* @return unsigned long
*/
static inline unsigned long
static inline unsigned long
__adf_os_getuptime(void)
{
- return MSEC_TO_TICK(A_MILLISECONDS());;
+ return MSEC_TO_TICK(A_MILLISECONDS());;
}
static inline void
#include "Magpie_api.h"
-typedef struct
+typedef struct
{
A_timer_t *magpie_timer;
adf_os_timer_func_t timer_func;
void
__adf_os_timer_func(A_HANDLE timer_handle, void *arg);
-/*
+/*
* Initialize a timer
*/
static inline void
A_INIT_TIMER(timer->magpie_timer, __adf_os_timer_func, arg);
}
-/*
- * start a timer
+/*
+ * start a timer
*/
static inline void
__adf_os_timer_start(__adf_os_timer_t *timer, int msec)
/**
* CACHE-SYNC (DMA)
*/
-#define __ADF_SYNC_PREREAD 0
+#define __ADF_SYNC_PREREAD 0
#define __ADF_SYNC_POSTREAD 1
#define __ADF_SYNC_PREWRITE 2
#define __ADF_SYNC_POSTWRITE 3
#define __ADF_OS_DMA_TO_DEVICE 0
-#define __ADF_OS_DMA_FROM_DEVICE 1
-
+#define __ADF_OS_DMA_FROM_DEVICE 1
+
struct __adf_softc;
__ADF_IEEE80211_SCAN = 105,
__ADF_IEEE80211_REPLAY = 106,
__ADF_IEEE80211_MICHAEL = 107,
- __ADF_IEEE80211_REJOIN = 108,
+ __ADF_IEEE80211_REJOIN = 108,
__ADF_CUSTOM_PUSH_BUTTON = 109,
};
/* generic data types */
struct __adf_device {
-int dummy;
-};
+int dummy;
+};
typedef struct __adf_device *__adf_os_device_t;
struct __adf_dma_map {
VBUF *buf;
-
+
A_UINT32 *ds_addr;
A_UINT16 ds_len;
-};
+};
typedef struct __adf_dma_map *__adf_os_dma_map_t;
#define __adf_os_iomem_t
#if 0
-typedef int __a_uint8_t;
-typedef int __a_int8_t;
-typedef int __a_uint16_t;
-typedef int __a_int16_t;
-typedef int __a_uint32_t;
-typedef int __a_int32_t;
-typedef int __a_uint64_t;
-typedef int __a_int64_t;
+typedef int __a_uint8_t;
+typedef int __a_int8_t;
+typedef int __a_uint16_t;
+typedef int __a_int16_t;
+typedef int __a_uint32_t;
+typedef int __a_int32_t;
+typedef int __a_uint64_t;
+typedef int __a_int64_t;
#else
typedef A_UINT8 __a_uint8_t;
-typedef A_INT8 __a_int8_t;
-typedef A_UINT16 __a_uint16_t;
-typedef A_INT16 __a_int16_t;
-typedef A_UINT32 __a_uint32_t;
-typedef A_INT32 __a_int32_t;
-typedef A_UINT64 __a_uint64_t;
-typedef A_INT64 __a_int64_t;
+typedef A_INT8 __a_int8_t;
+typedef A_UINT16 __a_uint16_t;
+typedef A_INT16 __a_int16_t;
+typedef A_UINT32 __a_uint32_t;
+typedef A_INT32 __a_int32_t;
+typedef A_UINT64 __a_uint64_t;
+typedef A_INT64 __a_int64_t;
typedef A_UINT32 u_int32_t;
typedef A_UINT16 u_int16_t;
//#define __adf_os_print my_printf
#define __adf_os_print A_PRINTF
-#if 1
+#if 1
#if defined(__XCC__)
#include "stdarg.h"
#define __va_list __gnuc_va_list
#include <adf_os_types.h>
-#define __adf_os_unlikely(_expr)
-#define __adf_os_likely(_expr)
+#define __adf_os_unlikely(_expr)
+#define __adf_os_likely(_expr)
/**
- * @brief memory barriers.
+ * @brief memory barriers.
*/
#define __adf_os_wmb() oops no implementation...
#define __adf_os_rmb() oops no implementation...
#define __adf_os_mb() oops no implementation...
-#define __adf_os_min(_a, _b) ((_a < _b) ? _a : _b)
-#define __adf_os_max(_a, _b) ((_a > _b) ? _a : _b)
+#define __adf_os_min(_a, _b) ((_a < _b) ? _a : _b)
+#define __adf_os_max(_a, _b) ((_a > _b) ? _a : _b)
#ifdef _DEBUG_BUILD_
#define __adf_os_assert(expr) do {\
#define inline
#endif
-static void inline
+static void inline
__adf_os_get_rand(adf_os_handle_t hdl,__a_uint8_t *ptr, __a_uint32_t len)
{
-#if 0
+#if 0
u_int8_t *dp = ptr;
u_int32_t v;
size_t nb;
dp += sizeof(u_int32_t);
len -= nb;
}
-#endif
+#endif
}
*/
/*
* @File: buf_pool_api.h
- *
+ *
* @Abstract: BUF Pool api
- *
+ *
* @Notes:
*/
/* endpoint defines */
typedef enum
{
- POOL_ID_HTC_CONTROL = 0,
- POOL_ID_WMI_SVC_CMD_REPLY = 1,
+ POOL_ID_HTC_CONTROL = 0,
+ POOL_ID_WMI_SVC_CMD_REPLY = 1,
POOL_ID_WMI_SVC_EVENT = 2,
POOL_ID_WLAN_RX_BUF = 3,
- POOL_ID_MAX = 10
+ POOL_ID_MAX = 10
} BUF_POOL_ID;
typedef void* pool_handle_t;
/* hardware API table structure (API descriptions below) */
struct buf_pool_api {
pool_handle_t (*_init)(adf_os_handle_t handle);
-
+
void (*_shutdown)(pool_handle_t handle);
-
+
void (*_create_pool)(pool_handle_t handle, BUF_POOL_ID poolId, int nItems, int nSize);
-
+
adf_nbuf_t (*_alloc_buf)(pool_handle_t handle, BUF_POOL_ID poolId, int reserve);
-
+
adf_nbuf_t (*_alloc_buf_align)(pool_handle_t handle, BUF_POOL_ID poolId, int reserve, int align);
-
+
void (*_free_buf)(pool_handle_t handle, BUF_POOL_ID poolId, adf_nbuf_t buf);
-
+
/* room to expand this table by another table */
- void *pReserved;
+ void *pReserved;
};
extern void buf_pool_module_install(struct buf_pool_api *apis);
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-/*
- * @File:
- *
- * @Abstract: Buf pool implementation: Dynamic version
- *
- * @Notes:
- */
-#include <adf_os_mem.h>
-#include <adf_os_module.h>
-#include <osapi.h>
-#include <Magpie_api.h>
-//#include <os/cmnos_api.h>
-#include <buf_pool_api.h>
-
-LOCAL htc_handle_t _buf_pool_dynamic_init(adf_os_handle_t handle);
-LOCAL void _buf_pool_dynamic_create_pool(pool_handle_t handle, BUF_POOL_ID poolId, int nItems, int nSize);
-LOCAL adf_nbuf_t _buf_pool_dynamic_alloc_buf(pool_handle_t handle, BUF_POOL_ID poolId, int reserve);
-LOCAL adf_nbuf_t _buf_pool_dynamic_alloc_buf_align(pool_handle_t handle, BUF_POOL_ID poolId, int reserve, int align);
-LOCAL void _buf_pool_dynamic_free_buf(pool_handle_t handle, BUF_POOL_ID poolId, adf_nbuf_t buf);
-LOCAL void _buf_pool_dynamic_shutdown(pool_handle_t handle);
-
-typedef struct _POOL_CONFIG {
- int nSize;
-} POOL_CONFIG;
-
-typedef struct _BUF_POOL_DYNAMIC_CONTEXT {
- adf_os_handle_t OSHandle;
- POOL_CONFIG poolConf[POOL_ID_MAX];
-} BUF_POOL_DYNAMIC_CONTEXT;
-
-void buf_pool_module_install(struct buf_pool_api *pAPIs)
-{
- pAPIs->_init = _buf_pool_dynamic_init;
- pAPIs->_create_pool = _buf_pool_dynamic_create_pool;
- pAPIs->_alloc_buf = _buf_pool_dynamic_alloc_buf;
- pAPIs->_alloc_buf_align = _buf_pool_dynamic_alloc_buf_align;
- pAPIs->_free_buf = _buf_pool_dynamic_free_buf;
- pAPIs->_shutdown = _buf_pool_dynamic_shutdown;
-}
-
-LOCAL pool_handle_t _buf_pool_dynamic_init(adf_os_handle_t handle)
-{
- BUF_POOL_DYNAMIC_CONTEXT *ctx;
-
- ctx = (BUF_POOL_DYNAMIC_CONTEXT *)adf_os_mem_alloc(sizeof(BUF_POOL_DYNAMIC_CONTEXT));
- ctx->OSHandle = handle;
-
- return ctx;
-}
-
-LOCAL void _buf_pool_dynamic_shutdown(pool_handle_t handle)
-{
- BUF_POOL_DYNAMIC_CONTEXT *ctx = (BUF_POOL_DYNAMIC_CONTEXT *)handle;
-
- adf_os_mem_free(ctx);
-}
-
-LOCAL void _buf_pool_dynamic_create_pool(pool_handle_t handle, BUF_POOL_ID poolId, int nItems, int nSize)
-{
- BUF_POOL_DYNAMIC_CONTEXT *ctx = (BUF_POOL_DYNAMIC_CONTEXT *)handle;
-
- ctx->poolConf[poolId].nSize = nSize;
-}
-
-LOCAL adf_nbuf_t _buf_pool_dynamic_alloc_buf(pool_handle_t handle, BUF_POOL_ID poolId, int reserve)
-{
- BUF_POOL_DYNAMIC_CONTEXT *ctx = (BUF_POOL_DYNAMIC_CONTEXT *)handle;
- POOL_CONFIG *poolConf = &ctx->poolConf[poolId];
-
- return adf_nbuf_alloc(poolConf->nSize,
- reserve, 0);
-
-}
-
-LOCAL adf_nbuf_t _buf_pool_dynamic_alloc_buf_align(pool_handle_t handle, BUF_POOL_ID poolId, int reserve, int align)
-{
- BUF_POOL_DYNAMIC_CONTEXT *ctx = (BUF_POOL_DYNAMIC_CONTEXT *)handle;
- POOL_CONFIG *poolConf = &ctx->poolConf[poolId];
-
- return adf_nbuf_alloc(poolConf->nSize,
- reserve, align);
-
-}
-
-LOCAL void _buf_pool_dynamic_free_buf(pool_handle_t handle, BUF_POOL_ID poolId, adf_nbuf_t buf)
-{
- //BUF_POOL_DYNAMIC_CONTEXT *ctx = (BUF_POOL_DYNAMIC_CONTEXT *)handle;
-
- adf_nbuf_free(buf);
-}
-
-adf_os_export_symbol(buf_pool_module_install);
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
- * @File:
- *
+ * @File:
+ *
* @Abstract: Buf pool implementation: static version
- *
- * @Notes:
+ *
+ * @Notes:
*/
#include <osapi.h>
-#include <Magpie_api.h>
+#include <Magpie_api.h>
#include <cmnos_api.h>
#include <buf_pool_api.h>
#include <vbuf_api.h>
#include <vdesc_api.h>
-#include <adf_os_mem.h>
+#include <adf_os_mem.h>
#include "buf_pool_static.h"
LOCAL adf_nbuf_t _buf_pool_static_alloc_buf(pool_handle_t handle, BUF_POOL_ID poolId, int reserve);
LOCAL adf_nbuf_t _buf_pool_static_alloc_buf_align(pool_handle_t handle, BUF_POOL_ID poolId, int reserve, int align);
LOCAL void _buf_pool_static_free_buf(pool_handle_t handle, BUF_POOL_ID poolId, adf_nbuf_t buf);
-LOCAL void _buf_pool_static_shutdown(pool_handle_t handle);
+LOCAL void _buf_pool_static_shutdown(pool_handle_t handle);
BUF_POOL_STATIC_CONTEXT g_poolCtx;
void buf_pool_module_install(struct buf_pool_api *pAPIs)
-{
+{
pAPIs->_init = _buf_pool_static_init;
pAPIs->_create_pool = _buf_pool_static_create_pool;
pAPIs->_alloc_buf = _buf_pool_static_alloc_buf;
pAPIs->_free_buf = _buf_pool_static_free_buf;
pAPIs->_shutdown = _buf_pool_static_shutdown;
}
-
+
LOCAL pool_handle_t _buf_pool_static_init(adf_os_handle_t handle)
{
#if 1
int i;
-
+
for(i=0; i < POOL_ID_MAX; i++) {
g_poolCtx.bufQ[i] = NULL;
}
-
+
return &g_poolCtx;
-#else
+#else
BUF_POOL_STATIC_CONTEXT *ctx;
-
+
//ctx = (BUF_POOL_static_CONTEXT *)A_ALLOCRAM(sizeof(BUF_POOL_static_CONTEXT));
ctx = (BUF_POOL_STATIC_CONTEXT *)adf_os_mem_alloc(sizeof(BUF_POOL_STATIC_CONTEXT));
ctx->NetHandle = handle;
-
- return ctx;
-#endif
-}
-
-LOCAL void _buf_pool_static_shutdown(pool_handle_t handle)
+
+ return ctx;
+#endif
+}
+
+LOCAL void _buf_pool_static_shutdown(pool_handle_t handle)
{
// SHALL NOT BE USED in FW
}
int i;
VBUF *buf;
VDESC *desc;
-
+
//BUF_POOL_STATIC_CONTEXT *ctx = (BUF_POOL_STATIC_CONTEXT *)handle;
-
+
for ( i = 0; i < nItems; i++) {
buf = VBUF_alloc_vbuf();
desc = VDESC_alloc_vdesc();
desc->buf_size = nSize;
desc->data_offset = 0;
desc->data_size = 0;
-
- buf->buf_length = 0;
+
+ buf->buf_length = 0;
buf->desc_list = desc;
-
+
if ( g_poolCtx.bufQ[poolId] == NULL ) {
g_poolCtx.bufQ[poolId] = buf;
} else {
}
}
}
-
+
LOCAL adf_nbuf_t _buf_pool_static_alloc_buf(pool_handle_t handle, BUF_POOL_ID poolId, int reserve)
{
VBUF *buf;
-
+
buf = g_poolCtx.bufQ[poolId];
if ( buf != NULL ) {
g_poolCtx.bufQ[poolId] = buf->next_buf;
-
+
buf->next_buf = NULL;
buf->desc_list->data_offset = reserve;
buf->desc_list->data_size = 0;
buf->buf_length = 0;
}
-
+
return buf;
}
{
return _buf_pool_static_alloc_buf(handle, poolId, reserve);
}
-
+
LOCAL void _buf_pool_static_free_buf(pool_handle_t handle, BUF_POOL_ID poolId, adf_nbuf_t buf)
{
if ( g_poolCtx.bufQ[poolId] == NULL ) {
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
- * @File:
- *
- * @Abstract:
- *
- * @Notes:
+ * @File:
+ *
+ * @Abstract:
+ *
+ * @Notes:
*/
#ifndef BUF_POOL_STATIC_H_
typedef struct _BUF_POOL_STATIC_CONTEXT {
VBUF *bufQ[POOL_ID_MAX];
-
+
// Left a door for extension the structure
void *pReserved;
} BUF_POOL_STATIC_CONTEXT;
#define MSEC_TO_TICK(msec) ((msec)* TICK_MSEC_RATIO)
struct clock_api {
- void (* _clock_init)(A_UINT32 ref_clk);
- void (* _clockregs_init)(void);
- A_UINT32 (* _uart_frequency)(void);
- void (* _delay_us)(int);
- void (* _wlan_band_set)(int);
- A_UINT32 (* _refclk_speed_get)(void);
- A_UINT32 (* _milliseconds)(void);
- void (* _sysclk_change)(void);
-
- void (* _clock_tick)(void);
+ void (* _clock_init)(A_UINT32 ref_clk);
+ void (* _clockregs_init)(void);
+ A_UINT32 (* _uart_frequency)(void);
+ void (* _delay_us)(int);
+ void (* _wlan_band_set)(int);
+ A_UINT32 (* _refclk_speed_get)(void);
+ A_UINT32 (* _milliseconds)(void);
+ void (* _sysclk_change)(void);
+
+#if defined(PROJECT_K2)
+ A_UINT32 (* _sysclk_get)(void);
+#endif
+
+ void (* _clock_tick)(void);
};
#endif /* __CLOCK_API_H__ */
#if defined(PROJECT_K2)
#if SYSTEM_MODULE_SFLASH
-#include "sflash_api.h"
+#include "cmnos/sflash_api.h"
#endif
#endif
asm volatile("rsr %0,%1" : "=r" (epc3) : "n" (EPC_3)); \
asm volatile("rsr %0,%1" : "=r" (epc4) : "n" (EPC_4)); \
\
- A_PRINTF("\tepc1=0x%x, epc2=0x%x, epc3=0x%x, epc4=0x%x\n", \
+ A_PRINTF("\tepc1=0x%x, epc2=0x%x, epc3=0x%x, epc4=0x%x\n", \
epc1, epc2, epc3, epc4); \
A_PRINTF("0x%08x, 0x%08x, 0x%08x, \n\r", \
DEBUG_SYSTEM_STATE, WATCH_DOG_RESET_COUNTER, \
#define A_MEMMOVE(dst, src, size)
#define A_MEMCMP(p1, p2, nbytes)
-#endif
+#endif
#if 1
#if SYSTEM_MODULE_UART
/* Serial port support */
-#define A_UART_INIT() A_CMN(uart._uart_init())
+#define A_UART_INIT() A_CMN(uart._uart_init())
#define A_UART_HWINIT(freq, baud) \
A_CMN(uart._uart_hwinit((freq), (baud)))
-#define A_UART_ENABLED() (HOST_INTEREST->hi_uart_enable)
+#define A_UART_ENABLED() (HOST_INTEREST->hi_uart_enable)
-#define A_PUTS(str) A_CMN(uart._uart_str_out(str))
+#define A_PUTS(str) A_CMN(uart._uart_str_out(str))
-#define A_PUTC(ch) A_CMN(uart._uart_char_put(ch))
-#define A_GETC(pCh) A_CMN(uart._uart_char_get(pCh))
+#define A_PUTC(ch) A_CMN(uart._uart_char_put(ch))
+#define A_GETC(pCh) A_CMN(uart._uart_char_get(pCh))
-#define A_UART_TASK() A_CMN(uart._uart_task())
-#define A_UART_CONFIG(x) A_CMN(uart._uart_config(x))
+#define A_UART_TASK() A_CMN(uart._uart_task())
+#define A_UART_CONFIG(x) A_CMN(uart._uart_config(x))
#else
#define A_UART_HWINIT(freq, baud)
-#define A_UART_ENABLED()
+#define A_UART_ENABLED()
-#define A_PUTS(str)
+#define A_PUTS(str)
#define A_PUTC(ch)
#define A_GETC(pCh)
#define A_MISALIGNED_LOAD_HANDLER(dump) A_CMN(misc._misaligned_load_handler(dump))
/* reture the host interface type */
-#define A_IS_HOST_PRESENT() A_CMN(misc._is_host_present())
+#define A_IS_HOST_PRESENT() A_CMN(misc._is_host_present())
#define A_KBHIT(delay) A_CMN(misc._kbhit(delay))
#define A_GET_ROM_VER() A_CMN(misc._rom_version_get())
#else
#define A_IS_HOST_PRESENT()
#define A_KBHIT(delay)
#define A_GET_ROM_VER()
-#endif
+#endif
//#if SYSTEM_MODULE_DBG
/* debug Support */
#define A_USB_EP0_SETUP() A_CMN(usb._usb_ep0_setup())
#define A_USB_EP0_TX_DATA() A_CMN(usb._usb_ep0_tx_data())
#define A_USB_EP0_RX_DATA() A_CMN(usb._usb_ep0_rx_data())
-
+
#define A_USB_GET_CONFIG() A_CMN(usb._usb_get_configuration())
#define A_USB_SET_CONFIG() A_CMN(usb._usb_set_configuration())
-
+
#define A_USB_GET_INTERFACE() A_CMN(usb._usb_get_interface())
#define A_USB_SET_INTERFACE() A_CMN(usb._usb_set_interface())
-
+
#define A_USB_STANDARD_CMD() A_CMN(usb._usb_standard_cmd())
#define A_USB_VENDOR_CMD() A_CMN(usb._usb_vendor_cmd())
-
+
#define A_USB_POWER_OFF() A_CMN(usb._usb_power_off())
#define A_USB_RESET_FIFO() A_CMN(usb._usb_reset_fifo())
#define A_USB_GEN_WDT() A_CMN(usb._usb_gen_wdt())
#else
#define A_USB_INIT()
-#define A_USB_TASK()
+#define A_USB_TASK()
#define A_USB_INIT_PHY()
-#define A_USB_EP0_SETUP()
-#define A_USB_EP0_TX()
-#define A_USB_EP0_RX()
-
-#define A_USB_GET_CONFIG()
-#define A_USB_SET_CONFIG()
-
-#define A_USB_GET_INTERFACE()
-#define A_USB_SET_INTERFACE()
-
-#define A_USB_STANDARD_CMD()
-#define A_USB_VENDOR_CMD()
-
+#define A_USB_EP0_SETUP()
+#define A_USB_EP0_TX()
+#define A_USB_EP0_RX()
+
+#define A_USB_GET_CONFIG()
+#define A_USB_SET_CONFIG()
+
+#define A_USB_GET_INTERFACE()
+#define A_USB_SET_INTERFACE()
+
+#define A_USB_STANDARD_CMD()
+#define A_USB_VENDOR_CMD()
+
#define A_USB_POWER_OFF()
#define A_USB_RESET_FIFO()
#define A_USB_GEN_WDT()
#define A_USB_JUMP_BOOT()
#define A_USB_GET_DESCRIPTOR()
-#define A_USB_SET_ADDRESS()
-#define A_USB_SET_FEATURE()
-#define A_USB_CLEAR_FEATURE()
+#define A_USB_SET_ADDRESS()
+#define A_USB_SET_FEATURE()
+#define A_USB_CLEAR_FEATURE()
#define A_USB_GET_STATUS()
#define A_USB_SETUP_DESC()
#if SYSTEM_MODULE_CLOCK
-#define A_CLOCK_INIT(refclk_guess) A_CMN(clock._clock_init(refclk_guess))
-#define A_CLOCK_TICK() A_CMN(clock._clock_tick())
-#define A_CLOCK_GET_TICK() A_CMN(clock._clock_get_tick())
+#define A_CLOCK_INIT(refclk_guess) A_CMN(clock._clock_init(refclk_guess))
+#define A_CLOCK_TICK() A_CMN(clock._clock_tick())
+#define A_CLOCK_GET_TICK() A_CMN(clock._clock_get_tick())
/*
* Get the number of millisecond ticks since the system was started.
#define A_TIMER_RUN() \
A_CMN(timer._timer_run())
-#define A_PCI_BOOT_INIT() \
- A_CMN(pci.pci_boot_init())
-
#define A_GMAC_BOOT_INIT() \
- A_CMN(gmac.gmac_boot_init())
+ A_CMN(gmac.gmac_boot_init())
#if SYSTEM_MODULE_ALLOCRAM
/* Default size of ALLOCRAM area */
A_CMN(allocram.cmnos_allocram_init((astart), (asize))); \
} while (0)
-#define A_ALLOCRAM(nbytes) A_CMN(allocram.cmnos_allocram(0, (nbytes)))
+#define A_ALLOCRAM(nbytes) A_CMN(allocram.cmnos_allocram(0, (nbytes)))
#define A_ALLOCRAM_DEBUG() A_CMN(allocram.cmnos_allocram_debug())
int (* hal_linkage_check)(int sz, struct _A_os_linkage_check *);
unsigned int *start_bss;
void (* app_start)(void);
-
+
#if SYSTEM_MODULE_MEM
struct mem_api mem;
#endif
// struct dbg_api dbg;
//#endif
-#if SYSTEM_MODULE_PCI
- struct pci_api pci;
-#endif
#if SYSTEM_MODULE_GMAC
struct gmac_api gmac;
extern void cmnos_eep_module_install(struct eep_api *);
#endif
-#if SYSTEM_MODULE_PCI
-extern void cmnos_pci_module_install(struct pci_api *);
-#endif
-
extern void cmnos_tasklet_module_install(struct tasklet_api *);
extern void cmnos_string_module_install(struct string_api *tbl);
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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 "sys_cfg.h"
-
-#if SYSTEM_MODULE_CLOCK
-#include "athos_api.h"
-
-LOCAL A_UINT32 cticks = 0;
-
-#define A_BAND_DEFAULT 0 // not ust now, avoiding compile error/warning, Ryan
-
-LOCAL int curr_band = A_BAND_DEFAULT;
-LOCAL void cmnos_pll_init(void);
-
-/* We accept frequencies within this deviation from an expected frequency. */
-#define A_REFCLK_DEVIATION 800000
-
-#define A_REFCLK_UNKNOWN SYS_CFG_REFCLK_UNKNOWN
-#define A_REFCLK_10_MHZ SYS_CFG_REFCLK_10_MHZ
-#define A_REFCLK_20_MHZ SYS_CFG_REFCLK_20_MHZ
-#define A_REFCLK_40_MHZ SYS_CFG_REFCLK_40_MHZ
-
-LOCAL const struct cmnos_clock_s {
- A_refclk_speed_t refclk_speed;
- A_UINT32 ticks_per_sec;
- // below are useless so far, ryan
- A_UINT32 pll_ctrl_5ghz;
- A_UINT32 pll_ctrl_24ghz;
- A_UINT32 pll_settling_time; /* 50us */
-} cmnos_clocking_table[] = {
- {A_REFCLK_10_MHZ,
- //10485760,
- 10000000,
- 0x0,
- 0x0,
- 0x0},
-
- {A_REFCLK_20_MHZ,
- //20971520,
- 20000000,
- 0x0,
- 0x0,
- 0x0},
-
- {A_REFCLK_40_MHZ,
- //41943040,
- 40000000,
- 0x0,
- 0x0,
- 0x0},
-
- {A_REFCLK_UNKNOWN,
- 0,
- 0x0,
- 0x0,
- 0x0},
-};
-
-
-#define CMNOS_CLOCKING_TABLE_NUM_ENTRIES \
- (sizeof(cmnos_clocking_table)/sizeof(cmnos_clocking_table[0]))
-
-LOCAL struct cmnos_clock_s *clock_info;
-
-
-LOCAL void cmnos_tick(void);
-
-/*
- * In case we have PLL initialization problems, software can arrange
- * (e.g. through BMI) to skip PLL initialization, and other software
- * can handle it.
- */
-int cmnos_skip_pll_init = 0;
-A_UINT32 pll_ctrl_setting_24ghz = 0;
-A_UINT32 pll_ctrl_setting_5ghz = 0;
-
-/*
- * Use default hardware values for clock-related registers.
- * The defaults can be overridden through BMI, EJTAG, or patches.
- *
- * CPU clock frequencies depend on what mode we're in (2.4GHz or 5GHz):
- * NB: AR6001 has a "reduced power" mode, but we don't use it.
- *
- * AR6001/AR6002 FPGA CPU clock is always at 40MHz
- *
- * AR6001 Rev 2.x supports 4 CPU speed selections:
- * selector: 0 1 2 3
- * 2.4GHz: 44, 88, 141, refclk
- * 5 GHz: 40, 80, 128, refclk
- *
- * AR6002 supports 7 CPU/SoC speed selections via CORE_CLK:
- * CORE_CLK.DIV setting: 6,7 5 4 3 2 1 0
- * divisor: 16 14 12 10 8 6 4
- * 2.4GHz (pll at 352MHz): 22 25.1, 29.3, 35.2, 44, 58.7, 88
- * 5 GHz (pll at 320MHz): 20 22.9, 26.7, 32, 40, 53.3, 80
- */
-
-#if defined(DISABLE_SYNC_DURING_PLL_UPDATE_WAR)
-A_UINT32 cpu_clock_setting;
-#endif
-
-//A_COMPILE_TIME_ASSERT(verify_host_interest_small_enough,
-// (sizeof(struct host_interest_s) <= HOST_INTEREST_MAX_SIZE))
-
-//A_COMPILE_TIME_ASSERT(verify_flash_is_present_addr,
-// ((A_UINT32)&HOST_INTEREST->hi_flash_is_present) == FLASH_IS_PRESENT_TARGADDR)
-
-
-LOCAL void
-cmnos_delay_us(int us)
-{
-// A_UINT32 start_time = A_RTC_REG_READ(LF_TIMER_COUNT0_ADDRESS);
-// unsigned int num_LF_ticks = (us+29) / 30 + 1; /* ~30.5us per LF tick */
- //A_UINT32 ref_clk = (clock_info->ticks_per_sec)/1000/1000;
- A_UINT32 ref_clk = (clock_info->ticks_per_sec) >> 20;
- A_UINT32 start_time = NOW();
- unsigned int num_ticks = us*ref_clk; // system_freq == number of ticks per 1us
-
- while ( (NOW() - start_time) < num_ticks) {
- /* busy spin */;
- }
-}
-
-/*
- * Return the number of milliseconds since startup.
- * For this purpose, a "millisecond" is approximated by
- * 1/32 of a 32KHz clock.
- */
-LOCAL A_UINT32
-cmnos_milliseconds(void)
-{
- //unsigned int lowfreq_timer;
-
- //lowfreq_timer = A_RTC_REG_READ(LF_TIMER_COUNT0_ADDRESS);
- //lowfreq_timer = NOW();
-
- /* LF0 timer counts at 32KHz, so adjust to approximate Ms with >> 5. */
- //lowfreq_timer = lowfreq_timer;
-
- /*
- * NB: We do not account for wrap, which occurs every 36
- * hours when the 32768Hz low frequency timer wraps the
- * 32 bit counter.
- */
- cmnos_tick();
-
- return cticks;
-}
-
-
-/* Expect 40MHz on AR6001 and 26MHz on AR6002 */
-//LOCAL A_refclk_speed_t cmnos_refclk_speed;
-
-LOCAL A_UINT32
-cmnos_refclk_speed_get(void)
-{
- return clock_info->ticks_per_sec;
-}
-
-/* The UART is clocked at the reference clock frequency. */
-LOCAL A_UINT32
-cmnos_uart_frequency(void)
-{
-#if 0
-#if defined(FPGA)
- return clock_info->ticks_per_sec;
-#else
- return clock_info->ticks_per_sec;
-#endif
-#else
- /* TBD */
- /* do we need keep a struct to hold the data ?*/
-#endif
-}
-
-
-/*
- * Adjust any state that needs adjusting when the clock
- * speed changes.
- */
-LOCAL void
-cmnos_sysclk_change(void)
-{
- /* OS may override this function */
-}
-
-
-LOCAL void
-cmnos_clockregs_init(void)
-{
- /* TBD */
- /* we might don't need this init() */
-}
-
-/*
- * Make whatever system-level changes are needed in order to operate
- * in the specified wireless band.
- *
- * For AR6K, we just need to set the PLL appropriately.
- */
-LOCAL void
-cmnos_wlan_band_set(int which_band)
-{
- /* TBD */
- /* we don't have wlan need to config */
-}
-
-LOCAL void
-cmnos_pll_init(void)
-{
- /* TBD */
- /* we don't have pll now, */
-}
-
-LOCAL void
-cmnos_clock_init(A_UINT32 ref_clk)
-{
-#if 1
- unsigned int i;
-
- /* Look up the nearest supported frequency. */
- for (i = 0;
- i < CMNOS_CLOCKING_TABLE_NUM_ENTRIES-1;
- i++)
- {
- A_UINT32 ticks_per_sec;
-
- ticks_per_sec = cmnos_clocking_table[i].ticks_per_sec;
- if ((ref_clk > ticks_per_sec - A_REFCLK_DEVIATION) &&
- (ref_clk < ticks_per_sec + A_REFCLK_DEVIATION))
- {
- break;
- }
- }
-
- clock_info = (struct cmnos_clock_s *)&cmnos_clocking_table[i];
-// HOST_INTEREST->hi_clock_info = (A_UINT32)clock_info;
-
-#endif
-}
-
-////////////////////////////////////////////////////////////////////////
-// software emulate ticks on millisecond based
-LOCAL void
-cmnos_tick(void)
-{
-#if 0
-
- set_ccompare0(xthal_get_ccompare(XTENSA_TIMER_0)+ONE_MSEC);
-
- cticks++;
-
-#else
- static A_UINT32 last_tick = 0;
- A_UINT32 current_tick = NOW();
- A_UINT32 delta_tick;
-
- // tick is 32 bit register, will overflow soon
- if( current_tick < last_tick )
- {
- delta_tick = (A_UINT32 )((0xffffffff-last_tick)+current_tick+1)/(1000);
- }
- else
- {
- delta_tick = (A_UINT32 ) (current_tick - last_tick)/(1000);
- }
-
- if( delta_tick > 0 )
- last_tick = current_tick;
-
- cticks += delta_tick;
-#endif
-}
-
-////////////////////////////////////////////////////////////////////////
-
-void
-cmnos_clock_module_install(struct clock_api *tbl)
-{
- tbl->_clock_init = cmnos_clock_init;
- tbl->_clockregs_init = cmnos_clockregs_init;
- tbl->_delay_us = cmnos_delay_us;
- tbl->_wlan_band_set = cmnos_wlan_band_set;
- tbl->_refclk_speed_get = cmnos_refclk_speed_get;
- tbl->_milliseconds = cmnos_milliseconds;
- tbl->_uart_frequency = cmnos_uart_frequency;
- tbl->_sysclk_change = cmnos_sysclk_change;
-
- tbl->_clock_tick = cmnos_tick;
-}
-#endif /* SYSTEM_MODULE_CLOCK */
-
+++ /dev/null
-//####ECOSGPLCOPYRIGHTBEGIN####
-// -------------------------------------------
-// This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-// Copyright (C) 2002 Gary Thomas
-//
-// eCos 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 or (at your option) any later version.
-//
-// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
-// WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with eCos; if not, write to the Free Software Foundation, Inc.,
-// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-//
-// As a special exception, if other files instantiate templates or use macros
-// or inline functions from this file, or you compile this file and link it
-// with other works to produce a work based on this file, this file does not
-// by itself cause the resulting work to be covered by the GNU General Public
-// License. However the source code for this file must still be made available
-// in accordance with section (3) of the GNU General Public License.
-//
-// This exception does not invalidate any other reasons why a work based on
-// this file might be covered by the GNU General Public License.
-//
-// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
-// at http://sources.redhat.com/ecos/ecos-license/
-// -------------------------------------------
-//####ECOSGPLCOPYRIGHTEND####
-
-#include "dt_defs.h"
-#include "sys_cfg.h"
-
-#if SYSTEM_MODULE_PRINT
-
-#include "athos_api.h"
-
-#define is_digit(c) ((c >= '0') && (c <= '9'))
-
-#if defined(__GNUC__) && defined(__mips__)
-#define va_list __builtin_va_list
-#define va_arg __builtin_va_arg
-#define va_start __builtin_va_start
-#define va_end __builtin_va_end
-#define va_copy __builtin_va_copy
-#endif
-
-#if defined(__XCC__)
-#include "stdarg.h"
-#define va_list __gnuc_va_list
-#endif
-
-void
-cmnos_write_char(char c)
-{
- if (c == '\n') {
- A_PUTC('\r');
- A_PUTC('\n');
- } else if (c == '\r') {
- } else {
- A_PUTC(c);
- }
-}
-
-void (*_putc)(char c) = cmnos_write_char;
-
-static int _cvt(unsigned long val, char *buf, long radix, char *digits)
-{
- char temp[80];
- char *cp = temp;
- int length = 0;
-
- if (val == 0) {
- /* Special case */
- *cp++ = '0';
- } else {
- while (val) {
- *cp++ = digits[val % radix];
- val /= radix;
- }
- }
- while (cp != temp) {
- *buf++ = *--cp;
- length++;
- }
- *buf = '\0';
- return (length);
-}
-
-
-static int cmnos_vprintf(void (*putc)(char c), const char *fmt, va_list ap)
-{
- char buf[sizeof(long)*8];
- char c, sign, *cp=buf;
- int left_prec, right_prec, zero_fill, pad, pad_on_right,
- i, islong, islonglong;
- long val = 0;
- int res = 0, length = 0;
-
- while ((c = *fmt++) != '\0') {
- if (c == '%') {
- c = *fmt++;
- left_prec = right_prec = pad_on_right = islong = islonglong = 0;
- if (c == '-') {
- c = *fmt++;
- pad_on_right++;
- }
- if (c == '0') {
- zero_fill = TRUE;
- c = *fmt++;
- } else {
- zero_fill = FALSE;
- }
- while (is_digit(c)) {
- left_prec = (left_prec * 10) + (c - '0');
- c = *fmt++;
- }
- if (c == '.') {
- c = *fmt++;
- zero_fill++;
- while (is_digit(c)) {
- right_prec = (right_prec * 10) + (c - '0');
- c = *fmt++;
- }
- } else {
- right_prec = left_prec;
- }
- sign = '\0';
- if (c == 'l') {
- // 'long' qualifier
- c = *fmt++;
- islong = 1;
- if (c == 'l') {
- // long long qualifier
- c = *fmt++;
- islonglong = 1;
- }
- }
- // Fetch value [numeric descriptors only]
- switch (c) {
- case 'p':
- islong = 1;
- case 'd':
- case 'D':
- case 'x':
- case 'X':
- case 'u':
- case 'U':
- case 'b':
- case 'B':
- if (islonglong) {
- val = va_arg(ap, long);
- } else if (islong) {
- val = (long)va_arg(ap, long);
- } else{
- val = (long)va_arg(ap, int);
- }
- if ((c == 'd') || (c == 'D')) {
- if (val < 0) {
- sign = '-';
- val = -val;
- }
- } else {
- // Mask to unsigned, sized quantity
- if (islong) {
- val &= (1ULL << (sizeof(long) * 8)) - 1;
- } else{
- val &= (1ULL << (sizeof(int) * 8)) - 1;
- }
- }
- break;
- default:
- break;
- }
- // Process output
- switch (c) {
- case 'p': // Pointer
- (*putc)('0');
- (*putc)('x');
- zero_fill = TRUE;
- left_prec = sizeof(unsigned long)*2;
- case 'd':
- case 'D':
- case 'u':
- case 'U':
- case 'x':
- case 'X':
- switch (c) {
- case 'd':
- case 'D':
- case 'u':
- case 'U':
- length = _cvt(val, buf, 10, "0123456789");
- break;
- case 'p':
- case 'x':
- length = _cvt(val, buf, 16, "0123456789abcdef");
- break;
- case 'X':
- length = _cvt(val, buf, 16, "0123456789ABCDEF");
- break;
- }
- cp = buf;
- break;
- case 's':
- case 'S':
- cp = va_arg(ap, char *);
- if (cp == NULL) {
- cp = "<null>";
- }
- length = 0;
- while (cp[length] != '\0') length++;
- break;
- case 'c':
- case 'C':
- c = va_arg(ap, int /*char*/);
- (*putc)(c);
- res++;
- continue;
- case 'b':
- case 'B':
- length = left_prec;
- if (left_prec == 0) {
- if (islonglong)
- length = sizeof(long)*8;
- else if (islong)
- length = sizeof(long)*8;
- else
- length = sizeof(int)*8;
- }
- for (i = 0; i < length-1; i++) {
- buf[i] = ((val & ((long)1<<i)) ? '1' : '.');
- }
- cp = buf;
- break;
- case '%':
- (*putc)('%');
- break;
- default:
- (*putc)('%');
- (*putc)(c);
- res += 2;
- }
- pad = left_prec - length;
- if (sign != '\0') {
- pad--;
- }
- if (zero_fill) {
- c = '0';
- if (sign != '\0') {
- (*putc)(sign);
- res++;
- sign = '\0';
- }
- } else {
- c = ' ';
- }
- if (!pad_on_right) {
- while (pad-- > 0) {
- (*putc)(c);
- res++;
- }
- }
- if (sign != '\0') {
- (*putc)(sign);
- res++;
- }
- while (length-- > 0) {
- c = *cp++;
- (*putc)(c);
- res++;
- }
- if (pad_on_right) {
- while (pad-- > 0) {
- (*putc)(' ');
- res++;
- }
- }
- } else {
- (*putc)(c);
- res++;
- }
- }
- return (res);
-}
-
-int cmnos_printf(const char *fmt, ...)
-{
- va_list ap;
- int ret;
-
- va_start(ap, fmt);
-
- //if (A_SERIAL_ENABLED()) {
- if (1) {
- ret = cmnos_vprintf(_putc, fmt, ap);
- } else {
- ret = 0;
- }
-
- va_end(ap);
-
- return (ret);
-}
-
-void
-cmnos_printf_init(void)
-{
-}
-
-void cmnos_printf_module_install(struct printf_api *tbl)
-{
- tbl->_printf_init = cmnos_printf_init;
- tbl->_printf = cmnos_printf;
-}
-
-#endif /* SYSTEM_MODULE_PRINT */
-
/* "Autosize-determination of the address size of serial flash" is obsolete according to Brian Yang's mail :
* The designers reached an conclusion that the spi master (the apb_spi interface control) will be
- * modified as ¡§presuming the attached flash model to be 24-bit addressing¡¨, i.e., no more
+ * modified as presuming the attached flash model to be 24-bit addressing, i.e., no more
* auto-size detection!
* Hence you are free to force the 24-bit addressing in the *.c test code.
*/
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
+#include <rom.h>
+
#include "sys_cfg.h"
#include "athos_api.h"
static int db_ldr_cmd(char *cmd, char *param1, char *param2, char *param3)
{
- unsigned long val;
+ unsigned long val = 0;
unsigned long addr;
char val_str[20];
char addr_str[20];
pending_intrs = A_INTR_GET_INTRENABLE()&(~CMNOS_IMASK_XTTIMER);
A_INTR_SET_INTRENABLE(pending_intrs);
A_PRINTF("- intr [0x%08x]\n\r", pending_intrs);
-
+
}
else if( db_ascii_to_hex(param2, &data)==0 )
{
delay = data;
else
delay = 3;
-
+
A_PRINTF("==>set cb to %d seconds \n\r", delay);
}
clk_sel = 4;
break;
case 40:
- clk_sel = 6;
+ clk_sel = 6;
break;
default:
clk_sel = 6;
uint32_t ratio = 1;
uint32_t baud = 19200;
uint32_t clk = 0;
-
+
if( db_ascii_to_int(param1, &clk) != -1 )
{
A_PRINTF("changing clock to %d\n", clk);
return 1;
#else
-
+
{
uint32_t ccount1;
uint32_t ccount2;
void (*_dbg_task)(void);
};
+void cmnos_dbg_module_install(struct dbg_api *apis);
#endif
a_uint32_t ref_clk = 0;
extern a_uint32_t cticks;
-// clock change
+// clock change
//
void cmnos_clock_init_patch(a_uint32_t refclk)
{
}
// retrieve current clock setting
-//
+//
a_uint32_t cmnos_refclk_speed_get_patch(void)
{
return ref_clk;
{
a_uint32_t start_time = NOW();
unsigned int num_ticks = us*ref_clk; // system_freq == number of ticks per 1us
-
+
while ( (NOW() - start_time) < num_ticks) {
/* busy spin */
;
}
// get current sysmem up time in milliseconds based
-//
+//
a_uint32_t cmnos_milliseconds_patch(void)
{
cmnos_tick_patch();
-
+
return (cticks);
}
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
-// You should have received a copy of the GNU General Public License along
-// with eCos; if not, write to the Free Software Foundation, Inc.,
-// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
#include <hif_api.h>
#include <Magpie_api.h>
#include <vdesc_api.h>
-#include <adf_os_mem.h>
+#include <adf_os_mem.h>
#include <adf_os_io.h>
+#include <rom.h>
#include "hif_usb.h"
/*
- * -- support more than 64 bytes command on ep4 --
+ * -- support more than 64 bytes command on ep4 --
*/
int _HIFusb_get_max_msg_len_patch(hif_handle_t handle, int pipe)
{
case HIF_USB_PIPE_INTERRUPT:
case HIF_USB_PIPE_COMMAND:
return 512;
-
+
default:
return 1600;
}
{
A_USB_FW_TASK();
- _HIFusb_isr_handler();
+ _HIFusb_isr_handler(h);
}
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
+#include <init/app_start.h>
+
#include "usb_defs.h"
#include "usb_type.h"
#include "usb_pre.h"
default_data[6] = 0x1aaabe40;
default_data[7] = 0xbe105554;
default_data[8] = 0x00043007;
-
+
for(i=0; i<9; i++)
{
A_DELAY_USECS(10);
-
+
iowrite32(0x10ff4040, default_data[i]);
}
A_DELAY_USECS(10);
* -- turn_off_phy --
*
* . write shift register to both pcie ep and rc
- * .
+ * .
*/
static void turn_off_phy()
for(i=0; i<9; i++)
{
- // check for the done bit to be set
+ // check for the done bit to be set
while (1)
{
if (ioread32(0x40028) & BIT31)
break;
}
-
+
A_DELAY_USECS(1);
-
+
iowrite32(0x40024, default_data[i]);
}
iowrite32(0x40028, BIT0);
static void turn_off_phy_rc()
{
-
+
volatile uint32_t default_data[9];
uint32_t i=0;
-
+
A_PRINTF("turn_off_phy_rc\n");
-
+
default_data[0] = 0x9248fd00;
default_data[1] = 0x24924924;
default_data[2] = 0xa8000019;
default_data[6] = 0x1aaabe40;
default_data[7] = 0xbe105554;
default_data[8] = 0x00043007;
-
+
for(i=0; i<9; i++)
{
- // check for the done bit to be set
-
+ // check for the done bit to be set
+
while (1)
{
if (ioread32(0x40028) & BIT31)
* -- patch zfTurnOffPower --
*
* . set suspend counter to non-zero value
- * .
+ * .
*/
void zfTurnOffPower_patch(void)
{
//32clk wait for External ETH PLL stable
A_DELAY_USECS(100);
-
+
iowrite32(0x52000, 0x70303); /* read back 0x703f7 */
iowrite32(0x52008, 0x0e91c); /* read back 0x1e948 */
-
+
io32_set(MAGPIE_REG_SUSPEND_ENABLE_ADDR, BIT0);
- // wake up, and turn on cpu, eth, pcie and usb pll
+ // wake up, and turn on cpu, eth, pcie and usb pll
_fw_power_on();
// restore gpio and other settings
_fw_restore_dma_fifo();
A_PRINTF("0x4048 0x%x ......\n", ioread32(0x10ff4048));
A_PRINTF("0x404C 0x%x ......\n", ioread32(0x10ff404C));
A_PRINTF("0x4088 0x%x ......\n", ioread32(0x10ff4088));
-
+
// turn off merlin
turn_off_merlin();
// pcie ep
io32_clr(0x40040, BIT0 | BIT1);
A_PRINTF("turn_off_magpie_ep_end ......\n");
- // pcie rc
+ // pcie rc
A_PRINTF("turn_off_magpie_rc_start ......\n");
A_DELAY_USECS(measure_time);
io32_clr(0x40040, BIT0);
A_PRINTF("0x4001C %p ......\n", ioread32(0x4001c));
A_PRINTF("0x40040 %p ......\n", ioread32(0x40040));
-
+
/* turn off pcie_pll - power down (bit16) */
A_PRINTF(" before pwd PCIE PLL CFG:0x5601C: 0x%08x\n",
ioread32(0x5601C));
* 2. turn off CPU PLL
* 3. turn off ETH PLL
* 4. disable ETH PLL bypass and update
- * 4.1 set suspend timeout
+ * 4.1 set suspend timeout
* 5. set SUSPEND_ENABLE
*/
}
static void _fw_power_on()
-{
+{
/*
* 1. turn on CPU PLL
* 2. disable CPU bypass
* 3. turn on ETH PLL
* 4. disable ETH PLL bypass and update
* 5. turn on pcie pll
- */
+ */
io32_clr(MAGPIE_REG_ETH_PLL_ADDR, BIT16);
static void _fw_restore_dma_fifo(void)
{
io32_clr(0x5601C, BIT18);
-
+
/* reset pcie_rc shift */
io32_clr(0x50010, BIT10 | BIT8 | BIT7);
A_DELAY_USECS(1);
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * Copyright (c) 2016 Oleksij Rempel <linux@rempel-privat.de>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+
/* shared patches for k2 and magpie */
+#include <ah_osdep.h>
+#include <rom.h>
+
#include "usb_defs.h"
#include "usb_type.h"
#include "usb_pre.h"
}
/*
- * support more than 64 bytes command on ep4
+ * support more than 64 bytes command on ep4
*/
void usb_reg_out_patch(void)
{
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
- * @File:
- *
+ * @File:
+ *
* @Abstract: host target communications
- *
- * @Notes:
+ *
+ * @Notes:
*/
#include <osapi.h>
-#include <Magpie_api.h>
+#include <Magpie_api.h>
#include <htc.h>
#include <htc_api.h>
#include <hif_api.h>
-#include <adf_os_mem.h>
-#include <adf_os_io.h>
+#include <adf_os_mem.h>
+#include <adf_os_io.h>
-#include "htc_internal.h"
+#include "htc_internal.h"
#define A_UNCACHED_ADDR(addr) addr
void _HTC_ResumeRecv(HTC_ENDPOINT_ID EndpointID);
LOCAL void HTCProcessConnectMsg(HTC_CONTEXT *pHTC, HTC_CONNECT_SERVICE_MSG *pMsg);
LOCAL void HTCProcessConfigPipeMsg(HTC_CONTEXT *pHTC, HTC_CONFIG_PIPE_MSG *pMsg);
-LOCAL void RedistributeCredit(adf_nbuf_t buf, int toPipeId);
+LOCAL void RedistributeCredit(adf_nbuf_t buf, int toPipeId);
LOCAL void _HTC_Shutdown(htc_handle_t htcHandle);
-/* macro to check if the service wants to prevent credit dribbling by using
+/* macro to check if the service wants to prevent credit dribbling by using
a dynamic threshold */
#define CHECK_AND_ADJUST_CREDIT_THRESHOLD(pEndpoint) \
if ((pEndpoint)->ConnectionFlags & HTC_CONNECT_FLAGS_REDUCE_CREDIT_DRIBBLE) { \
AdjustCreditThreshold((pEndpoint)); \
- }
+ }
LOCAL void HTC_AssembleBuffers(HTC_CONTEXT *pHTC, int Count, int Size)
{
- BUF_Pool_create_pool(pHTC->PoolHandle, POOL_ID_HTC_CONTROL, Count, Size);
+ BUF_Pool_create_pool(pHTC->PoolHandle, POOL_ID_HTC_CONTROL, Count, Size);
}
LOCAL htc_handle_t _HTC_Init(HTC_SETUP_COMPLETE_CB SetupComplete,
HTC_CONFIG *pConfig)
{
HIF_CALLBACK hifCBConfig;
- HTC_CONTEXT *pHTC;
-
+ HTC_CONTEXT *pHTC;
+
pHTC = (HTC_CONTEXT *)adf_os_mem_alloc(sizeof(HTC_CONTEXT));
-
+
adf_os_mem_zero(pHTC, sizeof(HTC_CONTEXT));
pHTC->OSHandle = pConfig->OSHandle;
pHTC->PoolHandle = pConfig->PoolHandle;
pHTC->hifHandle = pConfig->HIFHandle;
-
+
hifCBConfig.send_buf_done = A_INDIR(htc._HTC_SendDoneHandler);
hifCBConfig.recv_buf = A_INDIR(htc._HTC_MsgRecvHandler);
hifCBConfig.context = pHTC;
-
+
/* initialize hardware layer */
HIF_register_callback(pConfig->HIFHandle, &hifCBConfig);
-
+
/* see if the host wants us to override the number of ctrl buffers */
pHTC->NumBuffersForCreditRpts = 0;
-
+
if (0 == pHTC->NumBuffersForCreditRpts) {
/* nothing to override, simply set default */
- pHTC->NumBuffersForCreditRpts = HTC_DEFAULT_NUM_CTRL_BUFFERS;
- }
-
+ pHTC->NumBuffersForCreditRpts = HTC_DEFAULT_NUM_CTRL_BUFFERS;
+ }
+
pHTC->MaxEpPendingCreditRpts = 0;
-
+
if (0 == pHTC->MaxEpPendingCreditRpts) {
- pHTC->MaxEpPendingCreditRpts = HTC_DEFAULT_MAX_EP_PENDING_CREDIT_REPORTS;
+ pHTC->MaxEpPendingCreditRpts = HTC_DEFAULT_MAX_EP_PENDING_CREDIT_REPORTS;
}
/* calculate the total allocation size based on the number of credit report buffers */
pHTC->CtrlBufferAllocSize = MIN_CREDIT_BUFFER_ALLOC_SIZE * pHTC->NumBuffersForCreditRpts;
/* we need at least enough buffer space for 1 ctrl message */
pHTC->CtrlBufferAllocSize = A_MAX(pHTC->CtrlBufferAllocSize,MAX_HTC_SETUP_MSG_SIZE);
-
+
/* save the size of each buffer/credit we will receive */
pHTC->RecvBufferSize = pConfig->CreditSize; //RecvBufferSize;
pHTC->TotalCredits = pConfig->CreditNumber;
pHTC->TotalCreditsAssigned = 0;
-
+
/* setup the pseudo service that handles HTC control messages */
pHTC->HTCControlService.ProcessRecvMsg = A_INDIR(htc._HTC_ControlSvcProcessMsg);
pHTC->HTCControlService.ProcessSendBufferComplete = A_INDIR(htc._HTC_ControlSvcProcessSendComplete);
pHTC->HTCControlService.TrailerSpcCheckLimit = HTC_CTRL_BUFFER_CHECK_SIZE;
pHTC->HTCControlService.MaxSvcMsgSize = MAX_HTC_SETUP_MSG_SIZE;
pHTC->HTCControlService.ServiceCtx = pHTC;
-
+
/* automatically register this pseudo service to endpoint 1 */
pHTC->Endpoints[ENDPOINT0].pService = &pHTC->HTCControlService;
- HIF_get_default_pipe(pHTC->hifHandle, &pHTC->Endpoints[ENDPOINT0].UpLinkPipeID,
+ HIF_get_default_pipe(pHTC->hifHandle, &pHTC->Endpoints[ENDPOINT0].UpLinkPipeID,
&pHTC->Endpoints[ENDPOINT0].DownLinkPipeID);
-
+
/* Initialize control pipe so we could receive the HTC control packets */
// @TODO: msg size!
- HIF_config_pipe(pHTC->hifHandle, pHTC->Endpoints[ENDPOINT0].UpLinkPipeID, 1);
-
+ HIF_config_pipe(pHTC->hifHandle, pHTC->Endpoints[ENDPOINT0].UpLinkPipeID, 1);
+
/* set the first free endpoint */
pHTC->CurrentEpIndex = ENDPOINT1;
pHTC->SetupCompleteCb = SetupComplete;
-
+
/* setup buffers for just the setup phase, we only need 1 buffer to handle
* setup */
HTC_AssembleBuffers(pHTC, 4, MAX_HTC_SETUP_MSG_SIZE);
-
+
/* start hardware layer so that we can queue buffers */
HIF_start(pHTC->hifHandle);
-
+
return pHTC;
}
LOCAL void _HTC_Shutdown(htc_handle_t htcHandle)
{
HTC_CONTEXT *pHTC = (HTC_CONTEXT *)htcHandle;
-
+
adf_os_mem_free(pHTC);
}
LOCAL void _HTC_RegisterService(htc_handle_t htcHandle, HTC_SERVICE *pService)
{
HTC_CONTEXT *pHTC = (HTC_CONTEXT *)htcHandle;
-
+
/* add it to the list */
pService->pNext = pHTC->pServiceList;
pHTC->pServiceList = pService;
HTC_READY_MSG *pReady;
a_uint8_t *addr;
HTC_CONTEXT *pHTC = (HTC_CONTEXT *)htcHandle;
-
+
pBuffer = HTCAllocMsgBuffer(pHTC);
-
+
/* an optimization... the header length is chosen to
* be aligned on a 16 bit bounday, the fields in the message are designed to
* be aligned */
- addr = adf_nbuf_put_tail(pBuffer, sizeof(HTC_READY_MSG));
- pReady = (HTC_READY_MSG *)addr;
- A_MEMZERO(pReady,sizeof(HTC_READY_MSG));
+ addr = adf_nbuf_put_tail(pBuffer, sizeof(HTC_READY_MSG));
+ pReady = (HTC_READY_MSG *)addr;
+ A_MEMZERO(pReady,sizeof(HTC_READY_MSG));
pReady->MessageID = adf_os_htons(HTC_MSG_READY_ID);
pReady->CreditSize = adf_os_htons((A_UINT16)pHTC->RecvBufferSize);
pReady->CreditCount = adf_os_htons((A_UINT16)pHTC->TotalCredits);
pReady->MaxEndpoints = ENDPOINT_MAX;
-
+
/* send out the message */
HTC_SendMsg(pHTC, ENDPOINT0, pBuffer);
/* now we need to wait for service connection requests */
LOCAL void ReturnBuffers(htc_handle_t htcHandle, HTC_ENDPOINT_ID EndpointID,
adf_nbuf_t pBuffers, A_BOOL sendCreditFlag)
-{
+{
int nbufs = 1;
HTC_CONTEXT *pHTC = (HTC_CONTEXT *)htcHandle;
-
+
/* supply some head-room again */
adf_nbuf_push_head(pBuffers, HTC_HDR_LENGTH);
-
+
/* enqueue all buffers to the single mailbox */
- HIF_return_recv_buf(pHTC->hifHandle, pHTC->Endpoints[EndpointID].UpLinkPipeID, pBuffers);
-
- if (pHTC->StateFlags & HTC_STATE_SETUP_COMPLETE) {
+ HIF_return_recv_buf(pHTC->hifHandle, pHTC->Endpoints[EndpointID].UpLinkPipeID, pBuffers);
+
+ if (pHTC->StateFlags & HTC_STATE_SETUP_COMPLETE) {
A_UINT32 epCreditMask = (1 << EndpointID);
/* we are running normally */
/* update pending credit counts with the number of buffers that were added */
pHTC->Endpoints[EndpointID].CreditsToReturn += (A_INT16)nbufs;
- pHTC->Endpoints[EndpointID].CreditsConsumed -= (A_INT16)nbufs;
+ pHTC->Endpoints[EndpointID].CreditsConsumed -= (A_INT16)nbufs;
/* update bit map that this endpoint has non-zero credits */
- pHTC->EpCreditPendingMap |= epCreditMask;
+ pHTC->EpCreditPendingMap |= epCreditMask;
if (sendCreditFlag) {
HTCCheckAndSendCreditReport(pHTC, epCreditMask,&pHTC->Endpoints[EndpointID],EndpointID);
} else {
/* we have not started yet so all return operations are simply adding buffers
- * to the interface at startup, so we can keep track of how many total
+ * to the interface at startup, so we can keep track of how many total
* credits we get */
/* update global count that will be returned to the host */
pHTC->TotalCredits += nbufs;
- }
+ }
}
LOCAL void _HTC_ReturnBuffersList(htc_handle_t htcHandle,
{
ReturnBuffers(htcHandle, EndpointID, pBuffers, TRUE);
}
-
+
LOCAL void _HTC_SendMsg(htc_handle_t htcHandle, HTC_ENDPOINT_ID EndpointID,
adf_nbuf_t pBuffers)
{
HTC_FRAME_HDR *pHTCHdr;
int totsz;
- HTC_CONTEXT *pHTC = (HTC_CONTEXT *)htcHandle;
+ HTC_CONTEXT *pHTC = (HTC_CONTEXT *)htcHandle;
HTC_BUF_CONTEXT *ctx;
-
+
ctx = (HTC_BUF_CONTEXT *)adf_nbuf_get_priv(pBuffers);
-
+
/* init total size (this does not include the space we will put in for the HTC header) */
totsz = adf_nbuf_len(pBuffers);
-
+
/* the first buffer stores the header */
/* back up buffer by a header size when we pass it down, by agreed upon convention the caller
- * points the buffer to it's payload and leaves head room for the HTC header
+ * points the buffer to it's payload and leaves head room for the HTC header
* Note: in HTCSendDoneHandler(), we undo this so that the caller get's it's buffer
- * back untainted */
+ * back untainted */
pHTCHdr = (HTC_FRAME_HDR *)adf_nbuf_push_head(pBuffers, HTC_HDR_LENGTH);
-
+
/* flag that this is the header buffer that was modified */
- ctx->htc_flags |= HTC_FLAGS_BUF_HDR;
+ ctx->htc_flags |= HTC_FLAGS_BUF_HDR;
/* mark where this buffer came from */
- ctx->end_point = EndpointID;
+ ctx->end_point = EndpointID;
/* the header start is ALWAYS aligned since we DMA it directly */
/* set some fields, the rest of them will be filled below when we check for
* trailer space */
pHTCHdr->Flags = 0;
- pHTCHdr->EndpointID = EndpointID;
-
+ pHTCHdr->EndpointID = EndpointID;
+
/* check opportunistically if we can return any reports via a trailer */
do {
int room,i,totalReportBytes;
HTC_RECORD_HDR *pRecHdr;
int pipeMaxLen;
A_UINT32 roomForPipeMaxLen;
-
+
/* figure out how much room the last buffer can spare */
pipeMaxLen = HIF_get_max_msg_len(pHTC->hifHandle,
pHTC->Endpoints[EndpointID].DownLinkPipeID);
if ( roomForPipeMaxLen < 0 ) {
roomForPipeMaxLen = 0;
}
-
+
room = adf_os_min( adf_nbuf_tailroom(pBuffers), roomForPipeMaxLen);
if (room < (int)(sizeof(HTC_CREDIT_REPORT) + sizeof(HTC_RECORD_HDR))) {
/* no room for any reports */
- break;
- }
+ break;
+ }
/* note, a record header only has 8 bit fields, so this is safe.
- * we need an uncached pointer here too */
+ * we need an uncached pointer here too */
totalReportBytes = 0;
-
- /* get a copy */
- creditsPendingMap = pHTC->EpCreditPendingMap;
-
+
+ /* get a copy */
+ creditsPendingMap = pHTC->EpCreditPendingMap;
+
/* test pending map to see if we can send a report , if any
- * credits are available, we might as well send them on the
+ * credits are available, we might as well send them on the
* unused space in the buffer */
- if (creditsPendingMap) {
-
+ if (creditsPendingMap) {
+
pRecHdr = (HTC_RECORD_HDR *)adf_nbuf_put_tail(pBuffers,
sizeof(HTC_RECORD_HDR));
-
+
/* set the ID, the length will be updated with the number of credit reports we
* can fit (see below) */
pRecHdr->RecordID = HTC_RECORD_CREDITS;
pRecHdr->Length = 0;
- /* the credit report follows the record header */
+ /* the credit report follows the record header */
totalReportBytes += sizeof(HTC_RECORD_HDR);
room -= sizeof(HTC_RECORD_HDR);
-
+
/* walkthrough pending credits map and build the records */
- for (i = 0;
- (creditsPendingMap != 0) && (room >= (int)sizeof(HTC_CREDIT_REPORT));
- i++) {
+ for (i = 0;
+ (creditsPendingMap != 0) && (room >= (int)sizeof(HTC_CREDIT_REPORT));
+ i++) {
compareMask = (1 << i);
if (compareMask & creditsPendingMap) {
-
+
pCreditRpt = (HTC_CREDIT_REPORT *)adf_nbuf_put_tail(pBuffers,
sizeof(HTC_CREDIT_REPORT));
-
+
/* clear pending mask, we are going to return all these credits */
creditsPendingMap &= ~(compareMask);
/* add this record */
pCreditRpt->EndpointID = i;
pCreditRpt->Credits = (A_UINT8)pHTC->Endpoints[i].CreditsToReturn;
/* remove pending credits, we always send deltas */
- pHTC->Endpoints[i].CreditsToReturn = 0;
+ pHTC->Endpoints[i].CreditsToReturn = 0;
/* adjust new threshold for this endpoint if needed */
CHECK_AND_ADJUST_CREDIT_THRESHOLD(&pHTC->Endpoints[i]);
/* update this record length */
}
}
}
-
- /* update new pending credits map */
+
+ /* update new pending credits map */
pHTC->EpCreditPendingMap = creditsPendingMap;
}
-
+
if (totalReportBytes <= 0) {
break;
}
-
+
/* must fit into a byte, this should never actually happen since
- * the maximum possible number of endpoints is 32.
+ * the maximum possible number of endpoints is 32.
* The trailer can have at most 1 credit record with up to 32 reports in the record.
* The trailer can have at most 1 lookahead record with only 1 lookahead report in the record.
*/
-
- /* set header option bytes */
+
+ /* set header option bytes */
pHTCHdr->ControlBytes[0] = totalReportBytes;
/* HTC frame contains a trailer */
pHTCHdr->Flags |= HTC_FLAGS_RECV_TRAILER;
/* increment total size by the reports we added */
totsz += totalReportBytes;
- /* adjust the last buffer we used for adding on the trailer */
+ /* adjust the last buffer we used for adding on the trailer */
} while (FALSE);
-
+
if (totsz == 0) {
}
-
+
/* set length for message (this includes any reports that were added above) */
- pHTCHdr->PayloadLen = adf_os_htons(totsz);
- HIF_send_buffer(pHTC->hifHandle, pHTC->Endpoints[EndpointID].DownLinkPipeID, pBuffers);
+ pHTCHdr->PayloadLen = adf_os_htons(totsz);
+ HIF_send_buffer(pHTC->hifHandle, pHTC->Endpoints[EndpointID].DownLinkPipeID, pBuffers);
}
void _HTC_PauseRecv(HTC_ENDPOINT_ID EndpointID)
int _HTC_GetReservedHeadroom(htc_handle_t htcHandle)
{
- HTC_CONTEXT *pHTC = (HTC_CONTEXT *)htcHandle;
-
+ HTC_CONTEXT *pHTC = (HTC_CONTEXT *)htcHandle;
+
return HTC_HDR_LENGTH + HIF_get_reserved_headroom(pHTC->hifHandle);
}
void htc_module_install(struct htc_apis *pAPIs)
-{
+{
pAPIs->_HTC_Init = _HTC_Init;
pAPIs->_HTC_ReturnBuffers = _HTC_ReturnBuffers;
pAPIs->_HTC_ReturnBuffersList = _HTC_ReturnBuffersList;
pAPIs->_HTC_Ready = _HTC_Ready;
pAPIs->_HTC_RegisterService = _HTC_RegisterService;
- pAPIs->_HTC_SendMsg = _HTC_SendMsg;
+ pAPIs->_HTC_SendMsg = _HTC_SendMsg;
pAPIs->_HTC_Shutdown = _HTC_Shutdown;
pAPIs->_HTC_GetReservedHeadroom = _HTC_GetReservedHeadroom;
pAPIs->_HTC_MsgRecvHandler = HTCMsgRecvHandler;
}
/* free message to the free list */
-LOCAL void HTCFreeMsgBuffer(HTC_CONTEXT *pHTC, adf_nbuf_t buf)
+LOCAL void HTCFreeMsgBuffer(HTC_CONTEXT *pHTC, adf_nbuf_t buf)
{
- BUF_Pool_free_buf(pHTC->PoolHandle, POOL_ID_HTC_CONTROL, buf);
+ BUF_Pool_free_buf(pHTC->PoolHandle, POOL_ID_HTC_CONTROL, buf);
}
/* HTC control message allocator (also used for empty frames to send trailer options) */
{
return BUF_Pool_alloc_buf(pHTC->PoolHandle,
POOL_ID_HTC_CONTROL,
- HTC_GetReservedHeadroom(pHTC));
+ HTC_GetReservedHeadroom(pHTC));
}
LOCAL void HTCCheckAndSendCreditReport(HTC_CONTEXT *pHTC, A_UINT32 EpMask,
HTC_ENDPOINT *pEndpoint, HTC_ENDPOINT_ID Eid)
{
adf_nbuf_t pCredBuffer;
- HTC_BUF_CONTEXT *ctx;
-
+ HTC_BUF_CONTEXT *ctx;
+
do {
/* check if host needs credits */
if (!(pHTC->EpHostNeedsCreditMap & EpMask)) {
/* host does not need any credits for this set */
- break;
+ break;
}
/* check if any are pending */
if (!(pHTC->EpCreditPendingMap & EpMask)) {
/* nothing to send up */
- break;
- }
+ break;
+ }
/* was an endpoint specified? */
if (pEndpoint != NULL) {
/* see if a threshold is in effect for this endpoint */
break;
}
}
-
+
if (pEndpoint->PendingCreditReports >= pHTC->MaxEpPendingCreditRpts) {
/* this endpoint already has some reports outstanding */
/* flag that as soon as a buffer is reaped, we issue a credit update to
* pick up this credit that is being held up because the endpoint has already
- * exceeded the max outstanding credit report limit */
+ * exceeded the max outstanding credit report limit */
pHTC->StateFlags |= HTC_SEND_CREDIT_UPDATE_SOON;
- break;
- }
+ break;
+ }
}
-
+
/* if we get here we have some credits to send up */
-
+
/* allocate a message buffer for the trailer */
pCredBuffer = HTCAllocMsgBuffer(pHTC);
if (NULL == pCredBuffer) {
* have to wait until we get our endpoint 0 messages back.. */
/* mark that we need to send an update as soon as we can get a buffer back */
pHTC->StateFlags |= HTC_SEND_CREDIT_UPDATE_SOON;
- break;
+ break;
}
-
+
ctx = (HTC_BUF_CONTEXT *)adf_nbuf_get_priv(pCredBuffer);
if (pEndpoint != NULL) {
/* keep track of pending reports */
- pEndpoint->PendingCreditReports++;
+ pEndpoint->PendingCreditReports++;
/* save the endpoint in order to decrement the count when the send completes */
ctx->htc_flags = Eid | HTC_FLAGS_CREDIT_RPT;
- }
-
+ }
+
/* this is an empty message, the HTC_SendMsg will tack on a trailer in the remaining
* space, NOTE: no need to flush the cache, the header and trailers are assembled
* using uncached addresses */
- HTC_SendMsg(pHTC, ENDPOINT0, pCredBuffer);
-
- } while (FALSE);
+ HTC_SendMsg(pHTC, ENDPOINT0, pCredBuffer);
+
+ } while (FALSE);
}
-
+
/* called in response to the arrival of a service connection message */
LOCAL void HTCProcessConnectMsg(HTC_CONTEXT *pHTC, HTC_CONNECT_SERVICE_MSG *pMsg)
{
HTC_CONNECT_SERVICE_RESPONSE_MSG *pRspMsg;
int metaDataOutLen = 0;
A_UINT16 serviceId = adf_os_ntohs(pMsg->ServiceID);
-
+
pBuffer = HTCAllocMsgBuffer(pHTC);
/* note : this will be aligned */
pRspMsg = (HTC_CONNECT_SERVICE_RESPONSE_MSG *)
adf_nbuf_put_tail(pBuffer, sizeof(HTC_CONNECT_SERVICE_RESPONSE_MSG));
-
+
A_MEMZERO(pRspMsg,sizeof(HTC_CONNECT_SERVICE_RESPONSE_MSG));
pRspMsg->MessageID = adf_os_htons(HTC_MSG_CONNECT_SERVICE_RESPONSE_ID);
/* reflect the service ID for this connect attempt */
pRspMsg->ServiceID = adf_os_htons(serviceId);
while (pService) {
-
+
if (pHTC->CurrentEpIndex >= ENDPOINT_MAX) {
/* no more endpoints */
connectStatus = HTC_SERVICE_NO_RESOURCES;
- break;
+ break;
}
if (serviceId == pService->ServiceID) {
- /* we found a match */
- A_UINT8 *pMetaDataIN = NULL;
+ /* we found a match */
+ A_UINT8 *pMetaDataIN = NULL;
A_UINT8 *pMetaDataOut;
-
+
/* outgoing meta data resides in the space after the response message */
pMetaDataOut = ((A_UINT8 *)pRspMsg) + sizeof(HTC_CONNECT_SERVICE_RESPONSE_MSG);
-
+
if (pMsg->ServiceMetaLength != 0) {
/* the meta data follows the connect service message */
pMetaDataIN = ((A_UINT8 *)pMsg) + sizeof(HTC_CONNECT_SERVICE_MSG);
pMsg->ServiceMetaLength,
pMetaDataOut,
&metaDataOutLen);
-
+
/* check if the service accepted this connection request */
if (HTC_SERVICE_SUCCESS == connectStatus) {
/* set the length of the response meta data going back to the host */
pHTC->Endpoints[pHTC->CurrentEpIndex].pService = pService;
/* set connection flags */
pHTC->Endpoints[pHTC->CurrentEpIndex].ConnectionFlags = pMsg->ConnectionFlags;
-
+
pHTC->Endpoints[pHTC->CurrentEpIndex].DownLinkPipeID = pMsg->DownLinkPipeID;
pHTC->Endpoints[pHTC->CurrentEpIndex].UpLinkPipeID = pMsg->UpLinkPipeID;
-
+
/* mark that we are now connected */
pService->ServiceFlags |= HTC_SERVICE_FLAGS_CONNECTED;
/* bump up our index, this EP is now in use */
- pHTC->CurrentEpIndex++;
+ pHTC->CurrentEpIndex++;
}
break;
- }
-
- pService = pService->pNext;
+ }
+
+ pService = pService->pNext;
}
-
- pRspMsg->Status = connectStatus;
-
+
+ pRspMsg->Status = connectStatus;
+
/* send out the response message */
- HTC_SendMsg(pHTC, ENDPOINT0, pBuffer);
+ HTC_SendMsg(pHTC, ENDPOINT0, pBuffer);
}
LOCAL void HTCProcessConfigPipeMsg(HTC_CONTEXT *pHTC, HTC_CONFIG_PIPE_MSG *pMsg)
{
adf_nbuf_t pBuffer;
HTC_CONFIG_PIPE_RESPONSE_MSG *pRspMsg;
-
+
pBuffer = HTCAllocMsgBuffer(pHTC);
-
+
/* note : this will be aligned */
pRspMsg = (HTC_CONFIG_PIPE_RESPONSE_MSG *)
- adf_nbuf_put_tail(pBuffer, sizeof(HTC_CONFIG_PIPE_RESPONSE_MSG));
-
+ adf_nbuf_put_tail(pBuffer, sizeof(HTC_CONFIG_PIPE_RESPONSE_MSG));
+
A_MEMZERO(pRspMsg,sizeof(HTC_CONFIG_PIPE_RESPONSE_MSG));
-
+
pRspMsg->MessageID = adf_os_htons(HTC_MSG_CONFIG_PIPE_RESPONSE_ID);
/* reflect the service ID for this connect attempt */
pRspMsg->PipeID = pMsg->PipeID;
if ( HIF_is_pipe_supported(pHTC->hifHandle, pMsg->PipeID) ) {
- pRspMsg->Status = 0;
+ pRspMsg->Status = 0;
} else {
- pRspMsg->Status = 1;
+ pRspMsg->Status = 1;
goto config_done;
}
pRspMsg->Status = 2;
goto config_done;
}
-
+
HIF_config_pipe(pHTC->hifHandle, pMsg->PipeID, pMsg->CreditCount);
-
-config_done:
+
+config_done:
/* send out the response message */
- HTC_SendMsg(pHTC, ENDPOINT0, pBuffer);
+ HTC_SendMsg(pHTC, ENDPOINT0, pBuffer);
}
/* process an incomming control message from the host */
LOCAL void HTCControlSvcProcessMsg(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t hdr_buf,
adf_nbuf_t pBuffers, void *arg)
-{
+{
A_BOOL setupComplete = FALSE;
a_uint8_t *anbdata;
a_uint32_t anblen;
HTC_CONTEXT *pHTC = (HTC_CONTEXT *)arg;
HTC_UNKNOWN_MSG *pMsg;
-
+
adf_os_assert(hdr_buf == ADF_NBUF_NULL);
/* we assume buffers are aligned such that we can access the message
* parameters directly*/
adf_nbuf_peek_header(pBuffers, &anbdata, &anblen);
pMsg = (HTC_UNKNOWN_MSG *)anbdata;
-
+
/* we cannot handle fragmented messages across buffers */
-
- switch ( adf_os_ntohs(pMsg->MessageID) ) {
+
+ switch ( adf_os_ntohs(pMsg->MessageID) ) {
case HTC_MSG_CONNECT_SERVICE_ID:
- HTCProcessConnectMsg(pHTC, (HTC_CONNECT_SERVICE_MSG *)pMsg);
+ HTCProcessConnectMsg(pHTC, (HTC_CONNECT_SERVICE_MSG *)pMsg);
break;
case HTC_MSG_CONFIG_PIPE_ID:
- HTCProcessConfigPipeMsg(pHTC, (HTC_CONFIG_PIPE_MSG *)pMsg);
- break;
+ HTCProcessConfigPipeMsg(pHTC, (HTC_CONFIG_PIPE_MSG *)pMsg);
+ break;
case HTC_MSG_SETUP_COMPLETE_ID:
/* the host has indicated that it has completed all
setup tasks and we can now let the services take over to
run the rest of the application */
- setupComplete = TRUE;
+ setupComplete = TRUE;
/* can't get this more than once */
break;
default:
;
- }
-
+ }
+
if (pHTC->StateFlags & HTC_STATE_SETUP_COMPLETE) {
/* recycle buffer only if we are fully running */
HTC_ReturnBuffers(pHTC, ENDPOINT0,pBuffers);
} else {
/* supply some head-room again */
adf_nbuf_push_head(pBuffers, HTC_HDR_LENGTH);
-
+
/* otherwise return the packet back to mbox */
- HIF_return_recv_buf(pHTC->hifHandle, pHTC->Endpoints[EndpointID].UpLinkPipeID, pBuffers);
+ HIF_return_recv_buf(pHTC->hifHandle, pHTC->Endpoints[EndpointID].UpLinkPipeID, pBuffers);
}
- if (setupComplete) {
+ if (setupComplete) {
/* mark that setup has completed */
- pHTC->StateFlags |= HTC_STATE_SETUP_COMPLETE;
+ pHTC->StateFlags |= HTC_STATE_SETUP_COMPLETE;
if (pHTC->SetupCompleteCb != NULL) {
pHTC->SetupCompleteCb();
}
HTC_CONTEXT *pHTC = (HTC_CONTEXT *)arg;
HTC_BUF_CONTEXT *ctx;
HTC_ENDPOINT_ID creditRptEndpoint;
-
- ctx = (HTC_BUF_CONTEXT *)adf_nbuf_get_priv(pBuffers);
-
+
+ ctx = (HTC_BUF_CONTEXT *)adf_nbuf_get_priv(pBuffers);
+
/* put them back into the pool */
- if ( ctx->htc_flags & HTC_FLAGS_CREDIT_RPT ) {
- /* extract the endpoint number that requested this credit report */
- creditRptEndpoint = ctx->htc_flags & HTC_FLAGS_CRPT_EP_MASK;
- pHTC->Endpoints[creditRptEndpoint].PendingCreditReports--;
+ if ( ctx->htc_flags & HTC_FLAGS_CREDIT_RPT ) {
+ /* extract the endpoint number that requested this credit report */
+ creditRptEndpoint = ctx->htc_flags & HTC_FLAGS_CRPT_EP_MASK;
+ pHTC->Endpoints[creditRptEndpoint].PendingCreditReports--;
}
-
+
HTCFreeMsgBuffer(pHTC, pBuffers);
-
+
if (pHTC->StateFlags & HTC_SEND_CREDIT_UPDATE_SOON) {
/* this flag is set when the host could not send a credit report
* because we ran out of HTC control buffers */
pHTC->StateFlags &= ~HTC_SEND_CREDIT_UPDATE_SOON;
/* send out a report if anything is pending */
HTCCheckAndSendCreditReport(pHTC, HTC_ANY_ENDPOINT_MASK,NULL,ENDPOINT_MAX);
- }
+ }
}
LOCAL void HTCSendDoneHandler(adf_nbuf_t buf, void *context)
A_UINT8 current_eid;
HTC_CONTEXT *pHTC = (HTC_CONTEXT *)context;
HTC_BUF_CONTEXT *ctx;
-
+
ctx = (HTC_BUF_CONTEXT *)adf_nbuf_get_priv(buf);
current_eid = ctx->end_point;
-
+
/* Walk through the buffers and fixup the ones we used for HTC headers.
* The buffer list may contain more than one string of HTC buffers comprising of an
- * HTC message so we need to check every buffer */
+ * HTC message so we need to check every buffer */
adf_nbuf_pull_head(buf, HTC_HDR_LENGTH);
-
+
pHTC->Endpoints[current_eid].pService->
- ProcessSendBufferComplete(current_eid,
- buf,
+ ProcessSendBufferComplete(current_eid,
+ buf,
pHTC->Endpoints[current_eid].pService->ServiceCtx);
}
A_INT16 creditsOutstanding = pEndpoint->CreditsToReturn + pEndpoint->CreditsConsumed;
/* set the new threshold based on the number of credits that have been consumed
* and which have not been returned by the app.
- * Note: it is okay for this threshold to be zero which indicates no threshold
- * is in use */
+ * Note: it is okay for this threshold to be zero which indicates no threshold
+ * is in use */
switch (pEndpoint->ConnectionFlags & HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_MASK) {
case HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_ONE_FOURTH :
creditsOutstanding >>= 2;
- break;
+ break;
case HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_ONE_HALF :
creditsOutstanding >>= 1;
break;
- case HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_THREE_FOURTHS :
- creditsOutstanding = (creditsOutstanding * 3) >> 2;
+ case HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_THREE_FOURTHS :
+ creditsOutstanding = (creditsOutstanding * 3) >> 2;
break;
- /* default case is unity */
+ /* default case is unity */
}
-
+
pEndpoint->CreditReturnThreshhold = creditsOutstanding;
-
+
}
LOCAL void RedistributeCredit(adf_nbuf_t buf, int toPipeId)
{
}
-
+
/* callback from the mailbox hardware layer when a full message arrives */
LOCAL void HTCMsgRecvHandler(adf_nbuf_t hdr_buf, adf_nbuf_t buffer, void *context)
{
- A_UINT16 totsz;
HTC_ENDPOINT *pEndpoint;
A_UINT32 eidMask;
- int eid;
+ int eid;
a_uint8_t *anbdata;
a_uint32_t anblen;
HTC_FRAME_HDR *pHTCHdr;
HTC_CONTEXT *pHTC = (HTC_CONTEXT *)context;
adf_nbuf_t tmp_nbuf;
-
+
if (hdr_buf == ADF_NBUF_NULL) {
/* HTC hdr is not in the hdr_buf */
tmp_nbuf = buffer;
else {
tmp_nbuf = hdr_buf;
}
-
- adf_nbuf_peek_header(tmp_nbuf, &anbdata, &anblen);
- pHTCHdr = (HTC_FRAME_HDR *)anbdata;
-
- totsz = adf_os_ntohs(pHTCHdr->PayloadLen);
-
- eid = pHTCHdr->EndpointID;
-
+
+ adf_nbuf_peek_header(tmp_nbuf, &anbdata, &anblen);
+ pHTCHdr = (HTC_FRAME_HDR *)anbdata;
+
+ eid = pHTCHdr->EndpointID;
+
pEndpoint = &pHTC->Endpoints[eid];
eidMask = 1 << eid;
if (pHTC->StateFlags & HTC_STATE_SETUP_COMPLETE) {
/* after setup we keep track of credit consumption to allow us to
- * adjust thresholds to reduce credit dribbling */
+ * adjust thresholds to reduce credit dribbling */
pEndpoint->CreditsConsumed ++;
}
* when we receive a frame with the NEED_CREDIT_UPDATE flag set .
* if the host received credits through an opportunistic path, then it can
* issue a another frame with this bit cleared, this signals the target to clear
- * the "host-needs-credit" state */
+ * the "host-needs-credit" state */
if (pHTCHdr->Flags & HTC_FLAGS_NEED_CREDIT_UPDATE) {
/* the host is running low (or is out) of credits on this
* endpoint, update mask */
- pHTC->EpHostNeedsCreditMap |= eidMask;
+ pHTC->EpHostNeedsCreditMap |= eidMask;
/* check and set new threshold since host has reached a low credit situation */
- CHECK_AND_ADJUST_CREDIT_THRESHOLD(pEndpoint);
+ CHECK_AND_ADJUST_CREDIT_THRESHOLD(pEndpoint);
} else {
/* clear the flag */
- pHTC->EpHostNeedsCreditMap &= ~(eidMask);
- pEndpoint->CreditReturnThreshhold = 0;
+ pHTC->EpHostNeedsCreditMap &= ~(eidMask);
+ pEndpoint->CreditReturnThreshhold = 0;
}
- /* Adjust the first buffer to point to the start of the actual
+ /* Adjust the first buffer to point to the start of the actual
payload, the first buffer contains the header */
adf_nbuf_pull_head(tmp_nbuf, HTC_HDR_LENGTH);
-
+
/* NOTE : This callback could re-queue the recv buffers within this calling context.
* The callback could also send a response message within the context of this callback
* as the result of parsing this message. In either case, if there are
- * pending credits and the host needs them, a credit report will be sent either through
+ * pending credits and the host needs them, a credit report will be sent either through
* the response message trailer or a NULL message through HTC_ReturnBuffers().
- */
-
+ */
+
pEndpoint->pService->ProcessRecvMsg(eid, hdr_buf, buffer, pEndpoint->pService->ServiceCtx);
- /* Calls to HTC_ReturnBuffers drives the endpoint credit reporting state machine.
- * We do not want to delay credits for too long in the event that the application is
+ /* Calls to HTC_ReturnBuffers drives the endpoint credit reporting state machine.
+ * We do not want to delay credits for too long in the event that the application is
* holding onto buffers for excessive periods of time. This gives us "some" better
* opportunities to send up credits. */
- HTCCheckAndSendCreditReport(pHTC, eidMask, pEndpoint, eid);
+ HTCCheckAndSendCreditReport(pHTC, eidMask, pEndpoint, eid);
}
*/
/*
* @File: htc_api.h
- *
+ *
* @Abstract: host-target communications API
- *
- * @Notes:
+ *
+ * @Notes:
*/
#ifndef __HTC_API_H__
typedef void (* HTC_SERVICE_ProcessRecvMsg)(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t, adf_nbuf_t, void *ServiceCtx);
typedef void (* HTC_SERVICE_ProcessSendBufferComplete)(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t, void *ServiceCtx);
-
+
/* HTC service structure :
* the caller is required to allocate storage for the service structure and register the
* structure using HTC_RegisterService() The service must set the following fields:
* */
typedef struct _HTC_SERVICE {
struct _HTC_SERVICE *pNext;
- /* Callback for processing receive messages. HTC calls this callback whenever a
+ /* Callback for processing receive messages. HTC calls this callback whenever a
* message arrives on the endpoint assigned to this service.
* HTC_BUFFER is a chain of buffers containing a full application message.
* HTC_BUFFER->buffer points to the start of the msg buffer (past the HTC header) */
- void (* ProcessRecvMsg)(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t, adf_nbuf_t, void *ServiceCtx);
+ void (* ProcessRecvMsg)(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t, adf_nbuf_t, void *ServiceCtx);
/* callback to process completed send buffers */
- void (* ProcessSendBufferComplete)(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t, void *ServiceCtx);
+ void (* ProcessSendBufferComplete)(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t, void *ServiceCtx);
/* optional callback when a connection request occurs.
- * The EndpointID is the assigned endpoint, the callback returns a connect
+ * The EndpointID is the assigned endpoint, the callback returns a connect
* response status code to allow or disallow the connection.
* pDataIn points to the optional meta data supplied in the connection request
- * pDataOut points to a buffer to send back meta data
+ * pDataOut points to a buffer to send back meta data
* If no callback is supplied, HTC assumes the connect is allowed */
A_UINT8 (* ProcessConnect)(struct _HTC_SERVICE *pService,
- HTC_ENDPOINT_ID EndpointID,
- A_UINT8 *pDataIn,
+ HTC_ENDPOINT_ID EndpointID,
+ A_UINT8 *pDataIn,
int LengthIn,
A_UINT8 *pDataOut,
- int *pLengthOut);
+ int *pLengthOut);
A_UINT16 ServiceID; /* service ID to match connection requests */
A_UINT16 ServiceFlags; /* service flags */
A_UINT16 MaxSvcMsgSize; /* maximum length of service-specific messages exchanged on the endpoint */
A_UINT16 TrailerSpcCheckLimit; /* amount of space in each send buffer that HTC can check for trailer
- data. This should be set to the smallest HTC buffer that can be sent
+ data. This should be set to the smallest HTC buffer that can be sent
through the service. The service can disable trailer data insertion
by setting this value to 0. */
void *ServiceCtx;
typedef struct _HTC_BUF_CONTEXT {
A_UINT8 end_point;
- A_UINT8 htc_flags; /* htc flags (used by HTC layer only) */
+ A_UINT8 htc_flags; /* htc flags (used by HTC layer only) */
} HTC_BUF_CONTEXT;
typedef void* htc_handle_t;
* setup complete function, supplied by HTC caller at HTC_init time.
* HTC calls this function after the host has indicated that the service connection
* phase is complete.
- *
+ *
*/
typedef void (* HTC_SETUP_COMPLETE_CB)(void);
struct htc_apis {
- htc_handle_t (* _HTC_Init)(HTC_SETUP_COMPLETE_CB, HTC_CONFIG *pConfig);
+ htc_handle_t (* _HTC_Init)(HTC_SETUP_COMPLETE_CB, HTC_CONFIG *pConfig);
void (* _HTC_Shutdown)(htc_handle_t);
void (* _HTC_RegisterService)(htc_handle_t, HTC_SERVICE *);
void (* _HTC_Ready)(htc_handle_t);
void (* _HTC_ReturnBuffers)(htc_handle_t handle, HTC_ENDPOINT_ID EndpointID, adf_nbuf_t);
void (* _HTC_ReturnBuffersList)(htc_handle_t handle, HTC_ENDPOINT_ID EndpointID, adf_nbuf_queue_t);
- void (* _HTC_SendMsg)(htc_handle_t handle, HTC_ENDPOINT_ID EndpointID, adf_nbuf_t);
+ void (* _HTC_SendMsg)(htc_handle_t handle, HTC_ENDPOINT_ID EndpointID, adf_nbuf_t);
int (* _HTC_GetReservedHeadroom)(htc_handle_t handle);
-
+
/* These APIs below are for patch purpose only */
void (*_HTC_MsgRecvHandler)(adf_nbuf_t hdr_buf, adf_nbuf_t buf, void *context);
void (*_HTC_SendDoneHandler)(adf_nbuf_t buf, void *context);
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
- * @File:
- *
+ * @File:
+ *
* @Abstract: internal data and structure definitions for HTC
- *
- * @Notes:
+ *
+ * @Notes:
*/
#ifndef HTC_INTERNAL_H_
(sizeof(HTC_RECORD_HDR)) * 2 ) + \
HTC_HDR_LENGTH, \
sizeof(A_UINT32)))
-/* minimum allocation for a credit message */
+/* minimum allocation for a credit message */
#define MIN_CREDIT_BUFFER_ALLOC_SIZE (MIN_BUF_SIZE_FOR_RPTS)
/* max ctrl buffers size for a setup message */
#define HTC_DEFAULT_MAX_EP_PENDING_CREDIT_REPORTS 3 /* an EP should not have more than this many outstanding reports */
-#define HTC_FLAGS_CRPT_EP_MASK 0x1F /* if the message is a credit report this is the endpoint
+#define HTC_FLAGS_CRPT_EP_MASK 0x1F /* if the message is a credit report this is the endpoint
that issued it */
#define HTC_FLAGS_CREDIT_RPT (1 << 5) /* the buffer was a credit report */
#define HTC_FLAGS_BUF_HDR (1 << 6) /* the buffer was manipulated and a header added */
#define HTC_FLAGS_RECV_END_MSG (1 << 7) /* this buffer is the last buffer for the recev
- message (used for recv pause logic) */
-
+ message (used for recv pause logic) */
+
#define HTC_MAILBOX 0 /* we use mailbox 0 for all communications */
#define HTC_ANY_ENDPOINT_MASK 0xFFFFFFFF
#define HTC_LOOKAHEAD_POST_VALID 0x55
typedef struct _HTC_ENDPOINT {
A_INT16 CreditsToReturn; /* credits that are ready to be returned to the host */
HTC_SERVICE *pService; /* service that is bound to this endpoint */
-#ifdef HTC_PAUSE_RESUME_REF_COUNTING
+#ifdef HTC_PAUSE_RESUME_REF_COUNTING
int PauseRefCount; /* reference count */
#endif
A_INT16 CreditReturnThreshhold; /* threshold before credits are returned via NULL pkts,
- this reduces dribbling effect */
- A_INT16 CreditsConsumed; /* number of credits consumed (outstanding) on the endpoint */
- A_UINT16 ConnectionFlags; /* HTC connection flags */
- int PendingCreditReports; /* no. of pending credit reports issued by this endpoint */
+ this reduces dribbling effect */
+ A_INT16 CreditsConsumed; /* number of credits consumed (outstanding) on the endpoint */
+ A_UINT16 ConnectionFlags; /* HTC connection flags */
+ int PendingCreditReports; /* no. of pending credit reports issued by this endpoint */
A_UINT8 DownLinkPipeID; /* The pipe ID to be use for the direction: target -> host */
A_UINT8 UpLinkPipeID; /* The pipe ID to be use for the direction: host -> target */
} HTC_ENDPOINT;
pool_handle_t PoolHandle;
// Left a door for extension the structure
- void *pReserved;
+ void *pReserved;
} HTC_CONTEXT;
#define HTC_STATE_SETUP_COMPLETE (1 << 0) /* HTC host-target setup is complete */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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 <adf_os_types.h>
-#include <adf_os_dma.h>
-#include <adf_os_timer.h>
-#include <adf_os_time.h>
-#include <adf_os_lock.h>
-#include <adf_os_io.h>
-#include <adf_os_mem.h>
-#include <adf_os_module.h>
-
-#include <osapi.h>
-#include <Magpie_api.h>
-
-_A_magpie_indirection_table_t _indir_tbl;
-
-int init_htc_tgt(void);
-
-int init_htc_tgt(void)
-{
- /* target-side HIF/HTC/WMI module installation */
- BUF_POOL_MODULE_INSTALL();
- HIF_MODULE_INSTALL();
- HTC_MODULE_INSTALL();
- WMI_SERVICE_MODULE_INSTALL();
-
- adf_os_print("HTC Target Version 1.xx Loaded...\n");
- return 0;
-}
-
-void exit_htc_tgt(void);
-
-void exit_htc_tgt(void)
-{
- adf_os_print("HTC Target UnLoaded...\n");
-}
-
-adf_os_export_symbol(_indir_tbl);
-
-adf_os_virt_module_init(init_htc_tgt);
-adf_os_virt_module_exit(exit_htc_tgt);
-adf_os_module_dep(htc_tgt, adf_net);
-adf_os_module_dep(htc_tgt, inproc_hif);
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __AR6K_HTC_H__
-#define __AR6K_HTC_H__
-
-/* Host/Target Communications for an AR6K Target */
-
-/* Number of mailboxes */
-#define AR6000_MBOX_COUNT 4
-
-/* ------ MBOX ID ------ */
-typedef enum
-{
- ENDPOINT_UNUSED = -1,
- ENDPOINT1 = 0,
- ENDPOINT2,
- ENDPOINT3,
- ENDPOINT4,
-} HTC_ENDPOINT_ID;
-
-
-/* An AR6000 DMA Descriptor. See HTC_descriptor(). */
-struct AR6000_DMA_desc_s {
- A_UINT32 dma_control;
- char *dma_data;
- struct AR6000_DMA_desc_s *dma_next;
-};
-
-
-/*
- * Make a Mailbox DMA descriptor available to HTC.
- *
- * Once made available, there is no way to reclaim this memory.
- * The caller must guarantee that a descriptor exists for each
- * buffer that is used to send or receive. It is expected that
- * the caller will supply a bunch of descriptors once during
- * initialization, and then forget about them. The number of
- * buffers given to HTC for send+recv must never exceed the
- * number of descriptors given to HTC.
- *
- * HTC accesses descriptors via uncached accesses. The caller
- * must guarantee not to place any other data in the same cache
- * line as a DMA descriptor! In practice, this means that the
- * caller should allocate a block of memory for descriptors,
- * and the block should include padding at the start and end
- * to guarantee there will be no other data in the same cache
- * line.
- *
- * It would be far preferable to bury descriptors in the bufinfo
- * structure; but there are practical issues that prevent this.
- * It turns out that the most efficient way to add descriptors
- * to an active DMA engine requires HTC to "own and actively
- * manage" the descriptors. HTC needs to make the association
- * between descriptors and buffers at the last possible moment.
- *
- * extern void _HTC_descriptor(struct AR6000_DMA_desc_s *descriptor);
- */
-
-/*
- * The following interfaces make it easy to allocate suitable
- * descriptors for HTC. During initialization, simply use the
- * HTC_DESCRIPTORS_INIT macro and specify the number of descriptors
- * desired. This number must be a constant, since it is used to
- * declare a static array!
- *
- * The descriptor array is padded with a cache line at the start
- * and another at the end. This avoids false sharing between adjacent
- * cached data and uncached descriptors.
- */
-#define HTC_DESCRIPTOR_SPACE_SIZE(ndescs) \
- (((ndescs) * sizeof(struct AR6000_DMA_desc_s)) + 2*A_CACHE_LINE_SIZE)
-
-#define HTC_DESCRIPTORS_INIT(ndescs) \
-{ \
- static A_UINT8 HTC_descriptor_space[HTC_DESCRIPTOR_SPACE_SIZE(ndescs)]; \
- struct AR6000_DMA_desc_s *desc; \
- int i; \
- \
- A_DATA_CACHE_FLUSH(HTC_descriptor_space, sizeof(HTC_descriptor_space)); \
- \
- desc = (struct AR6000_DMA_desc_s *) \
- A_ROUND_UP((A_UINT32)HTC_descriptor_space, A_CACHE_LINE_SIZE); \
- \
- for (i=0; i<(ndescs); i++) { \
- HTC_descriptor(desc); \
- desc++; \
- } \
-}
-
-#endif /* __AR6K_HTC_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __AR6K_MISC_H__
-#define __AR6K_MISC_H__
-
-/*
- * AR6001: CIS Tuple 0x82, "Board Hardware Configuration Information",
- * is set at chip reset according to board configuration. Bits in this
- * register indicate what type of Host connection is in use. We don't
- * have proper header files to describe tuples, so the offset and layout
- * for the one tuple that firmwware needs is defined here.
- *
- * AR6002: The RESET_TUPLE_STATUS register in the GPIO block holds
- * Board Hardware Configuration Information.
- *
- * If the interface is SDIO, then the "INFO_MASK" must be "SDIO_NORMAL".
- * For debug purposes, a Target with the KeepAlive jumper may be booted
- * before the Host. In this case, INFO_MASK is 0.
- *
- * For NON-SDIO Host interfaces, the INFO_MASK may hold board information.
- *
- * By convention, hostless boards set INTERFACE to SDIO, and INFO to
- * something OTHER than SDIO_NORMAL or 0.
- *
- * Layout of Board HW Cfg Info is below. These values are captured at
- * reset and made available to software.
- *
- * These 3 bits are available on AR6002 via RESET_TUPLE_STATUS_ADDRESS;
- * they are NOT available on AR6001.
- * bit 10: rftest ???
- * bit 9: cmode[1] Bits 9..8 indicate modes as follows:
- * bit 8: cmode[0] 0-->normal
- * 1-->rftest
- * 2-->functional test (ATE)
- * 3-->ATPG/MBIST
- *
- * These 8 bits are available on AR6002 through RESET_TUPLE_STATUS_ADDRESS
- * and on both AR6001 and AR6002 through CIS Tuple 0x82.
- * bit 7: gpio9 (aka hmode0) Bits 7..6 are the "Interface Config bits"
- * bit 6: tdo (aka hmode1)
- * bit 5: clk_req
- * bit 4: sdio_cmd
- * bit 3: sdio_dat[3]
- * bit 2: sdio_dat[2]
- * bit 1: sdio_dat[1]
- * bit 0: sdio_dat[0]
- */
-
-#if defined(RESET_TUPLE_STATUS_ADDRESS)
-#define AR6K_BOARD_HWCFG_CMODE_MASK 0x300
-#define AR6K_BOARD_HWCFG_CMODE_ATE 0x200
-#else
-/*
- * CIS Tuple 0x82 happens to be located at offset 0x13c into CIS registers.
- * This may change across tapeouts, if CIS tuple information changes.
- */
-#define AR6K_BOARD_HWCFG_TUPLE_OFFSET 0x13c
-#endif
-
-#define AR6K_BOARD_HWCFG_INTERFACE_MASK 0xc0
-#define AR6K_BOARD_HWCFG_KEEP_ALIVE_MASK 0x20
-#define AR6K_BOARD_HWCFG_INFO_MASK 0x1f
-
-/* Values for INTERFACE_MASK indicate type of interface */
-#define AR6K_BOARD_HWCFG_SPI 0x00
-#define AR6K_BOARD_HWCFG_SDIO 0x40
-#define AR6K_BOARD_HWCFG_LBCF 0x80
-#define AR6K_BOARD_HWCFG_MSIO 0xc0
-
-#define AR6K_BOARD_HWCFG_SDIO_NORMAL 0x1f
-
-#endif /* __AR6K_MISC_H__ */
((void *)((((A_UINT32)(addr)) & ~A_MIPS_KSEG_MASK) | A_MIPS_KSEG_CACHED))
/* Read/Write a 32-bit AR6000 SOC register, specified by its physical address */
-#define A_SOC_ADDR_READ(addr) (*((volatile A_UINT32 *)A_UNCACHED_ADDR(addr)))
+#define A_SOC_ADDR_READ(addr) (*((volatile A_UINT32 *)A_UNCACHED_ADDR(addr)))
#define A_SOC_ADDR_WRITE(addr, val) \
do { \
#define A_UNCACHED_ADDR(addr) (addr)
#define A_CACHED_ADDR(addr) (addr)
-#define A_SOC_ADDR_READ(addr) (*((volatile A_UINT32 *)(addr)))
+#define A_SOC_ADDR_READ(addr) (*((volatile A_UINT32 *)(addr)))
#define A_SOC_ADDR_WRITE(addr, val) \
do { \
HF_TIMER_CONTROL_RESET_MASK); \
} while (0)
-/*
+/*
* Turn it OFF when you're done:
*/
#define A_TIMESTAMP_DISABLE() A_RTC_REG_WRITE(HF_TIMER_CONTROL_ADDRESS, 0)
*/
/**
* @defgroup adf_nbuf_public network buffer API
- */
+ */
/**
* @ingroup adf_nbuf_public
* @file adf_nbuf.h
* This file defines the network buffer abstraction.
- */
+ */
#ifndef _ADF_NBUF_H
#define _ADF_NBUF_H
* - need space in adf_drv's software descriptor
* - are typically created during adf_drv_create
* - need to be created before any API(adf_nbuf_map) that uses them
- *
+ *
* @param[in] osdev os device
* @param[out] dmap map handle
- *
+ *
* @return status of the operation
*/
static inline a_status_t
/**
* @brief Delete a dmap map
- *
+ *
* @param[in] osdev os device
* @param[in] dmap
*/
* @return status of the operation
*/
static inline a_status_t
-adf_nbuf_map(adf_os_device_t osdev,
- adf_os_dma_map_t bmap,
- adf_nbuf_t buf,
+adf_nbuf_map(adf_os_device_t osdev,
+ adf_os_dma_map_t bmap,
+ adf_nbuf_t buf,
adf_os_dma_dir_t dir)
{
return __adf_nbuf_map(osdev, bmap, buf, dir);
* @param[in] dir DMA direction
*/
static inline void
-adf_nbuf_unmap(adf_os_device_t osdev,
- adf_os_dma_map_t bmap,
+adf_nbuf_unmap(adf_os_device_t osdev,
+ adf_os_dma_map_t bmap,
adf_os_dma_dir_t dir)
{
__adf_nbuf_unmap(osdev, bmap, dir);
/**
* @brief returns information about the mapped buf
- *
+ *
* @param[in] bmap map handle
* @param[out] sg map info
*/
* The nbuf created is guarenteed to have only 1 physical segment
*
* @param[in] hdl platform device object
- * @param[in] size data buffer size for this adf_nbuf including max header
+ * @param[in] size data buffer size for this adf_nbuf including max header
* size
* @param[in] reserve headroom to start with.
* @param[in] align alignment for the start buffer.
*
* @return The new adf_nbuf instance or NULL if there's not enough memory.
*/
-static inline adf_nbuf_t
+static inline adf_nbuf_t
adf_nbuf_alloc(adf_os_size_t size,
int reserve,
int align)
* buf. Note that this can allocate a new buffer, or
* change geometry of the orignial buffer. The new buffer
* is returned in the (new_buf).
- *
+ *
* @param[in] buf (older buffer)
* @param[in] headroom
- *
+ *
* @return newly allocated buffer
*/
static inline adf_nbuf_t
/**
* @brief expand the tailroom to the new tailroom, but the buffer
* remains the same
- *
+ *
* @param[in] buf buffer
* @param[in] tailroom new tailroom
- *
+ *
* @return expanded buffer or NULL on failure
*/
static inline adf_nbuf_t
* having an extra API is that some OS do this in more
* optimized way, rather than calling realloc (head/tail)
* back to back.
- *
+ *
* @param[in] buf buffer
- * @param[in] headroom new headroom
+ * @param[in] headroom new headroom
* @param[in] tailroom new tailroom
- *
+ *
* @return expanded buffer
*/
static inline adf_nbuf_t
* effect, it also "linearizes" a buffer (which is
* perhaps why you'll use it mostly). It creates a
* writeable copy.
- *
+ *
* @param[in] buf source nbuf to copy from
- *
+ *
* @return the new nbuf
*/
static inline adf_nbuf_t
/**
* @brief link two nbufs, the new buf is piggybacked into the
* older one.
- *
+ *
* @param[in] dst buffer to piggyback into
* @param[in] src buffer to put
- *
+ *
* @return status of the call
*/
static inline void
/**
* @brief clone the nbuf (copy is readonly)
- *
+ *
* @param[in] buf nbuf to clone from
- *
+ *
* @return cloned buffer
*/
-static inline adf_nbuf_t
+static inline adf_nbuf_t
adf_nbuf_clone(adf_nbuf_t buf)
{
return(__adf_nbuf_clone(buf));
* other users.If the nbuf is a clone then this function
* creates a new copy of the data. If the buffer is not
* a clone the original buffer is returned.
- *
+ *
* @param[in] buf source nbuf to create a writable copy from
- *
+ *
* @return new buffer which is writeable
*/
-static inline adf_nbuf_t
+static inline adf_nbuf_t
adf_nbuf_unshare(adf_nbuf_t buf)
{
return(__adf_nbuf_unshare(buf));
/**
* @brief return the amount of headroom int the current nbuf
- *
+ *
* @param[in] buf buffer
- *
+ *
* @return amount of head room
*/
static inline a_uint32_t
/**
* @brief return the amount of tail space available
- *
+ *
* @param[in] buf buffer
- *
- * @return amount of tail room
+ *
+ * @return amount of tail room
*/
static inline a_uint32_t
adf_nbuf_tailroom(adf_nbuf_t buf)
/**
- *
+ *
* @brief trim data out from the end
*
* @param[in] buf buf instance
/**
* @brief test whether the nbuf is cloned or not
- *
+ *
* @param[in] buf buffer
- *
+ *
* @return TRUE if it is cloned, else FALSE
*/
static inline a_bool_t
/**
* @brief return the frag pointer & length of the frag
- *
+ *
* @param[in] buf buffer
* @param[out] sg this will return all the frags of the nbuf
- *
+ *
*/
-static inline void
-adf_nbuf_frag_info(adf_nbuf_t buf, adf_os_sglist_t *sg)
+static inline void
+adf_nbuf_frag_info(adf_nbuf_t buf, adf_os_sglist_t *sg)
{
__adf_nbuf_frag_info(buf, sg);
}
/**
* @brief return the data pointer & length of the header
- *
+ *
* @param[in] buf nbuf
* @param[out] addr data pointer
* @param[out] len length of the data
/**
* @brief get the priv pointer from the nbuf'f private space
- *
+ *
* @param[in] buf
- *
+ *
* @return data pointer to typecast into your priv structure
*/
static inline a_uint8_t *
/**
* @brief get the length of the queue
- *
+ *
* @param[in] head buf queue head
- *
+ *
* @return length of the queue
*/
static inline a_uint32_t
/**
* @brief get the first guy/packet in the queue
- *
+ *
* @param[in] head buf queue head
- *
+ *
* @return first buffer in queue
*/
-static inline adf_nbuf_t
+static inline adf_nbuf_t
adf_nbuf_queue_first(adf_nbuf_queue_t *head)
{
return (__adf_nbuf_queue_first(head));
/**
* @brief get the next guy/packet of the given buffer (or
* packet)
- *
+ *
* @param[in] buf buffer
- *
+ *
* @return next buffer/packet
*/
static inline adf_nbuf_t
/**
* @brief Check if the buf queue is empty
- *
+ *
* @param[in] nbq buf queue handle
*
* @return TRUE if queue is empty
/**
* @brief Gets the tx checksumming to be performed on this buf
- *
+ *
* @param[in] buf buffer
* @param[out] hdr_off the (tcp) header start
* @param[out] where the checksum offset
/**
* @brief Drivers that support hw checksumming use this to
* indicate checksum info to the stack.
- *
+ *
* @param[in] buf buffer
* @param[in] cksum checksum
*/
/**
* @brief Drivers that are capable of TCP Large segment offload
* use this to get the offload info out of an buf.
- *
+ *
* @param[in] buf buffer
* @param[out] tso offload info
*/
/**
* @brief This function extracts the vid & priority from an
* nbuf
- *
- *
+ *
+ *
* @param[in] hdl net handle
* @param[in] buf buffer
* @param[in] vlan vlan header
- *
+ *
* @return status of the operation
*/
static inline a_status_t
-adf_nbuf_get_vlan_info(adf_net_handle_t hdl, adf_nbuf_t buf,
+adf_nbuf_get_vlan_info(adf_net_handle_t hdl, adf_nbuf_t buf,
adf_net_vlanhdr_t *vlan)
{
return __adf_nbuf_get_vlan_info(hdl, buf, vlan);
*/
/**
- * @mainpage
+ * @mainpage
* @section Introduction
- * The Atheros Driver Framework provides a mechanism to run the Atheros
+ * The Atheros Driver Framework provides a mechanism to run the Atheros
* WLAN driver on a variety of Operating Systems and Platforms. It achieves
* this by abstracting all OS-specific and platform-specific functionality
* the driver requires. This ensures the core logic in the driver is OS-
* This component abstracts the OS network buffer. See @ref adf_nbuf_public for details.
* @subsection sec3 OS services
* This component abstracts any OS services. See @ref adf_os_public for details.
- */
+ */
#ifndef _ADF_NET_H
#define _ADF_NET_H
/*
* check for a NULL handle
* */
-#define ADF_NET_NULL __ADF_NET_NULL
+#define ADF_NET_NULL __ADF_NET_NULL
/**
* @brief this register the driver to the shim, but won't get
* any handle until create device is called.
- *
+ *
* @param[in] drv driver info structure
- *
+ *
* @return status of operation
*/
-static inline a_status_t
+static inline a_status_t
adf_net_register_drv(adf_drv_info_t *drv)
{
return(__adf_net_register_drv(drv));
/**
* @brief deregister the driver from the shim
- *
+ *
* @param[in] name driver name passed in adf_drv_info_t
*
* @see adf_net_register_drv()
/**
* @brief register a real device with the kernel
- *
+ *
* @param[in] hdl driver handle for this device
* @param[in] op per-device switch structure
* @param[in] info basic device information
- *
+ *
* @return opaque device handle
*/
-static inline adf_net_handle_t
-adf_net_dev_create(adf_drv_handle_t hdl,
- adf_dev_sw_t *op,
+static inline adf_net_handle_t
+adf_net_dev_create(adf_drv_handle_t hdl,
+ adf_dev_sw_t *op,
adf_net_dev_info_t *info)
{
return (__adf_net_dev_create(hdl, op, info));
}
-
-/**
- * @brief unregister a real device with the kernel
- *
- * @param[in] hdl opaque device handle returned by adf_net_dev_create()
- * @see adf_net_dev_create()
- */
-static inline void
-adf_net_dev_delete(adf_net_handle_t hdl)
-{
- __adf_net_dev_delete(hdl);
-}
-
-
/**
* @brief register a virtual device with the kernel.
* A virtual device is always backed by a real device.
- *
+ *
* @param[in] dev_hdl opaque device handle for the real device
* @param[in] hdl driver handle for this virtual device
* @param[in] op per-virtual-device switch structure
* @param[in] info basic virtual device information
- *
+ *
* @return opaque device handle
*
* @see adf_net_dev_create()
*/
-static inline adf_net_handle_t
-adf_net_vdev_create(adf_net_handle_t dev_hdl,
- adf_drv_handle_t hdl,
- adf_vdev_sw_t *op,
- adf_net_dev_info_t *info)
+static inline adf_net_handle_t
+adf_net_vdev_create(adf_net_handle_t dev_hdl,
+ adf_drv_handle_t hdl,
+ adf_vdev_sw_t *op,
+ adf_net_dev_info_t *info)
{
return (__adf_net_vdev_create(dev_hdl, hdl, op, info));
}
-
/**
- * @brief unregister the virtual device with the kernel.
- *
- * @param[in] hdl opaque device handle returned by adf_net_vdev_create()
+ * @brief Checks if the interface is running or not
*
- * @see adf_net_vdev_create()
- */
-static inline void
-adf_net_vdev_delete(adf_net_handle_t hdl)
-{
- __adf_net_vdev_delete(hdl);
-}
-
-
-/**
- * @brief open the real device
- *
* @param[in] hdl opaque device handle
- *
- * @return status of the operation
*
- * @see adf_net_dev_create()
- */
-static inline a_status_t
-adf_net_dev_open(adf_net_handle_t hdl)
-{
- return (__adf_net_dev_open(hdl));
-}
-
-
-/**
- * @brief close the real device
- *
- * @param[in] hdl opaque device handle
- *
- * @see adf_net_dev_open()
- */
-static inline void
-adf_net_dev_close(adf_net_handle_t hdl)
-{
- __adf_net_dev_close(hdl);
-}
-
-
-/**
- * @brief transmit a network buffer using a device
- *
- * @param[in] hdl opaque device handle
- * @param[in] pkt network buffer to transmit
- *
- * @return status of the operation
- */
-static inline a_status_t
-adf_net_dev_tx(adf_net_handle_t hdl, adf_nbuf_t pkt)
-{
- return (__adf_net_dev_tx(hdl,pkt));
-}
-
-
-/**
- * @brief Checks if the interface is running or not
- *
- * @param[in] hdl opaque device handle
- *
* @return true if running, false if not
*/
static inline a_bool_t
/**
* @brief Checks if the interface is up or not
- *
+ *
* @param[in] hdl opaque device handle
- *
+ *
* @return true if up, false if not
*/
static inline a_bool_t
/**
* @brief check whether the carrier is available or not
- *
+ *
* @param[in] hdl opaque device handle
- *
+ *
* @return a_bool_t true if available, false if not
*/
-static inline a_bool_t
+static inline a_bool_t
adf_net_carrier_ok(adf_net_handle_t hdl)
{
return(__adf_net_carrier_ok(hdl));
/**
* @brief inform the networking stack that the link is down
- *
+ *
* @param[in] hdl opaque device handle
*/
-static inline void
+static inline void
adf_net_carrier_off(adf_net_handle_t hdl)
{
__adf_net_carrier_off(hdl);
/**
* @brief inform the networking stack that the link is up
- *
+ *
* @param[in] hdl opaque device handle
- *
+ *
* @see adf_net_carrier_off()
*/
-static inline void
+static inline void
adf_net_carrier_on(adf_net_handle_t hdl)
{
__adf_net_carrier_on(hdl);
*/
/**
- * @brief inform the networking stack that the device is ready to receive
+ * @brief inform the networking stack that the device is ready to receive
* transmit packets. Typically called during init.
- *
+ *
* @param[in] hdl opaque device handle
*/
-static inline void
+static inline void
adf_net_start_queue(adf_net_handle_t hdl)
{
__adf_net_start_queue(hdl);
/**
* @brief inform the networking stack to stop sending transmit packets.
* Typically called if the driver runs out of resources for the device.
- *
+ *
* @param[in] hdl opaque device handle
*/
-static inline void
+static inline void
adf_net_stop_queue(adf_net_handle_t hdl)
{
__adf_net_stop_queue(hdl);
/**
* @brief inform the native stack to resume sending packets
* to transmit.Typically called when the driver has resources
- * available again for the device.
+ * available again for the device.
*
* @note adf_net_wake_queue() is the counterpart of adf_net_stop_queue()
*
* @param[in] hdl opaque device handle
*/
-static inline void
+static inline void
adf_net_wake_queue(adf_net_handle_t hdl)
{
__adf_net_wake_queue(hdl);
/**
* @brief Check the state of the queue
- *
+ *
* @param[in] hdl opaque device handle
- *
+ *
* @return true if stopped, false if not
*/
-static inline a_bool_t
+static inline a_bool_t
adf_net_queue_stopped(adf_net_handle_t hdl)
{
return(__adf_net_queue_stopped(hdl));
}
-
-/**
- * @brief This indicates a packet to the networking stack
- * (minus the FCS). The driver should just strip
- * the FCS and give the packet as a whole. This is
- * necessary because different native stacks have
- * different expectation of how they want to recv the
- * packet. This fucntion will strip off whatever is
- * required for the OS interface. The routine will also
- * figure out whether its being called in irq context and
- * call the appropriate OS API.
- *
- * @param[in] hdl opaque device handle
- * @param[in] pkt network buffer to indicate
- * @param[in] len length of buffer
- */
-static inline void
-adf_net_indicate_packet(adf_net_handle_t hdl, adf_nbuf_t pkt, a_uint32_t len)
-{
- __adf_net_indicate_packet(hdl, pkt, len);
-}
-
-/**
- * @brief use this when indicating a vlan tagged packet on RX
- *
- * @param[in] hdl opaque device handle
- * @param[in] pkt network buffer to indicate
- * @param[in] len length of buffer
- * @param[in] vid vlan id
- *
- * @return status of operation
- */
-static inline a_status_t
-adf_net_indicate_vlanpkt(adf_net_handle_t hdl, adf_nbuf_t pkt,
- a_uint32_t len, adf_net_vid_t *vid)
-{
- return (__adf_net_indicate_vlanpkt(hdl, pkt, len, vid));
-}
-
/**
* @brief get interface name
- *
+ *
* @param[in] hdl opaque device handle
- *
+ *
* @return name of interface
*/
static inline const a_uint8_t *
return (__adf_net_ifname(hdl));
}
-/**
- * @brief send management packets to apps (listener).
- * This is used for wireless applications.
- *
- * @param[in] hdl opaque device handle
- * @param[in] pkt network buffer to send
- * @param[in] len length of buffer
- */
-static inline void
-adf_net_fw_mgmt_to_app(adf_net_handle_t hdl, adf_nbuf_t pkt, a_uint32_t len)
-{
- __adf_net_fw_mgmt_to_app(hdl, pkt, len);
-}
-/**
- * @brief send wireless events to listening applications
- *
- * @param[in] hdl opaque device handle
- * @param[in] what event to send
- * @param[in] data information about event
- * @param[in] data_len length of accompanying information
- */
-static inline void
-adf_net_send_wireless_event(adf_net_handle_t hdl,
- adf_net_wireless_event_t what,
- void *data, adf_os_size_t data_len)
-{
- __adf_net_send_wireless_event(hdl, what, data, data_len);
-}
-
-/**
- * @brief schedule the poll controller.
- *
- * @param[in] hdl opaque device handle
- */
-static inline void
-adf_net_poll_schedule(adf_net_handle_t hdl)
-{
- __adf_net_poll_schedule(hdl);
-}
-
-
-/**
- * @brief per cpu deffered callback (e.g. for RSS)
- *
- * @param[in] hdl opaque device handle
- * @param[in] cpu_msk
- * @param[in] arg
- */
-static inline void
-adf_net_poll_schedule_cpu(adf_net_handle_t hdl, a_uint32_t cpu_msk, void *arg)
-{
- __adf_net_poll_schedule_cpu(hdl, cpu_msk, arg);
-}
-
/**
* @brief Get OS Handle from OS device object.
*
* @param[in] osdev OS device object
- *
+ *
* @return OS handle
- */
+ */
static inline adf_os_handle_t
adf_net_dev_to_os(adf_os_device_t osdev)
{
* @brief Get OS Handle from OS net handle.
*
* @param[in] osdev OS net handle
- *
+ *
* @return OS handle
- */
+ */
static inline adf_os_handle_t
adf_net_hdl_to_os(adf_net_handle_t hdl)
{
* @ingroup adf_net_public
* @file adf_net_sw.h
* This file defines the device and virtual device switch tables.
- */
+ */
#ifndef __ADF_NET_SW_H
#define __ADF_NET_SW_H
/**
* @brief Handler for device open - mandatory interface
*/
- a_status_t (*drv_open) (adf_drv_handle_t hdl);
+ a_status_t (*drv_open) (adf_drv_handle_t hdl);
/**
* @brief Handler for device close - mandatory interface
*/
/**
* @brief Handler for ioctl - mandatory interface
*/
- a_status_t (*drv_ioctl) (adf_drv_handle_t hdl, int num,
+ a_status_t (*drv_ioctl) (adf_drv_handle_t hdl, int num,
void *data);
/**
* @brief Handler for transmission timeout - mandatory interface
*/
a_status_t (*drv_wcmd) (adf_drv_handle_t hdl, adf_net_wcmd_type_t cmd,
adf_net_wcmd_data_t *data);
- /**
- * @brief Handler for polling if polling/deferred processing required -
+ /**
+ * @brief Handler for polling if polling/deferred processing required -
* optional interface
*/
- adf_net_poll_resp_t (*drv_poll) (adf_drv_handle_t hdl, int quota,
+ adf_net_poll_resp_t (*drv_poll) (adf_drv_handle_t hdl, int quota,
int *work_done);
/**
* @brief Handler for per cpu deffered callback (e.g. for RSS) - optional
* interface
*/
- adf_net_poll_resp_t (*drv_poll_cpu) (adf_drv_handle_t hdl, int quota,
+ adf_net_poll_resp_t (*drv_poll_cpu) (adf_drv_handle_t hdl, int quota,
int *work_done, void *arg);
/**
* @brief Handler for disabling receive interrupts for polling.
/**
- * @brief Indicates what features are supported by the interface.
+ * @brief Indicates what features are supported by the interface.
*/
#define ADF_NET_LINK_SUPP_10baseT_Half (1 << 0)
#define ADF_NET_LINK_SUPP_10baseT_Full (1 << 1)
ADF_NET_LINK_SUPP_1000baseT_Full)
/**
- * @brief Indicates what features are advertised by the interface.
+ * @brief Indicates what features are advertised by the interface.
*/
#define ADF_NET_LINK_ADV_10baseT_Half (1 << 0)
#define ADF_NET_LINK_ADV_10baseT_Full (1 << 1)
typedef struct adf_net_vid{
#if defined (ADF_LITTLE_ENDIAN_MACHINE)
a_uint16_t val:12;
- a_uint8_t res:4;
+ a_uint8_t res:4;
#elif defined (ADF_BIG_ENDIAN_MACHINE)
a_uint8_t res:4;
a_uint16_t val:12;
}adf_net_cmd_data_t;
/**
- * @brief For polled devices, adf_drv responds with one of the following status in
+ * @brief For polled devices, adf_drv responds with one of the following status in
* its poll function.
*/
typedef enum {
ADF_IEEE80211_SCAN = __ADF_IEEE80211_SCAN,
ADF_IEEE80211_REPLAY = __ADF_IEEE80211_REPLAY,
ADF_IEEE80211_MICHAEL = __ADF_IEEE80211_MICHAEL,
- ADF_IEEE80211_REJOIN = __ADF_IEEE80211_REJOIN,
+ ADF_IEEE80211_REJOIN = __ADF_IEEE80211_REJOIN,
ADF_CUSTOM_PUSH_BUTTON = __ADF_CUSTOM_PUSH_BUTTON
}adf_net_wireless_event_t;
*/
/**
* Copyright (c) Atheros Communications Inc. 2002-2008
- *
+ *
*/
#ifndef __ADF_NET_WCMD_H
* Defines
*/
#define ADF_NET_WCMD_NAME_SIZE __ADF_OS_NAME_SIZE
-#define ADF_NET_WCMD_NICK_NAME 32 /**< Max Device nick name size*/
-#define ADF_NET_WCMD_MODE_NAME_LEN 6
+#define ADF_NET_WCMD_NICK_NAME 32 /**< Max Device nick name size*/
+#define ADF_NET_WCMD_MODE_NAME_LEN 6
#define ADF_NET_WCMD_IE_MAXLEN 256 /** Max Len for IE */
#define ADF_NET_WCMD_MAX_BITRATES 32
* @brief key set/get info
*/
#define ADF_NET_WCMD_KEYBUF_SIZE 16
-#define ADF_NET_WCMD_MICBUF_SIZE 16/**< space for tx+rx keys */
+#define ADF_NET_WCMD_MICBUF_SIZE 16/**< space for tx+rx keys */
#define ADF_NET_WCMD_KEY_DEFAULT 0x80/**< default xmit key */
#define ADF_NET_WCMD_ADDR_LEN 6
#define ADF_NET_WCMD_KEYDATA_SZ \
*/
#define ADF_NET_WCMD_VAPKEY_XMIT 0x01/**< xmit */
#define ADF_NET_WCMD_VAPKEY_RECV 0x02/**< recv */
-#define ADF_NET_WCMD_VAPKEY_GROUP 0x04/**< WPA group*/
-#define ADF_NET_WCMD_VAPKEY_SWCRYPT 0x10/**< Encrypt/decrypt*/
+#define ADF_NET_WCMD_VAPKEY_GROUP 0x04/**< WPA group*/
+#define ADF_NET_WCMD_VAPKEY_SWCRYPT 0x10/**< Encrypt/decrypt*/
#define ADF_NET_WCMD_VAPKEY_SWMIC 0x20/**< Enmic/Demic */
#define ADF_NET_WCMD_VAPKEY_DEFAULT 0x80/**< Default key */
* @brief Ethtool specific
*/
#define ADF_NET_WCMD_BUSINFO_LEN 32
-#define ADF_NET_WCMD_DRIVSIZ 32
-#define ADF_NET_WCMD_VERSIZ 32
-#define ADF_NET_WCMD_FIRMSIZ 32
+#define ADF_NET_WCMD_DRIVSIZ 32
+#define ADF_NET_WCMD_VERSIZ 32
+#define ADF_NET_WCMD_FIRMSIZ 32
/**
* *******************************Enums******************
*/
*/
typedef enum adf_net_wcmd_type{
/* net80211 */
- ADF_NET_WCMD_GET_RTS_THRES,
- ADF_NET_WCMD_SET_RTS_THRES,
- ADF_NET_WCMD_GET_FRAGMENT,
- ADF_NET_WCMD_SET_FRAGMENT,
- ADF_NET_WCMD_GET_VAPMODE,
+ ADF_NET_WCMD_GET_RTS_THRES,
+ ADF_NET_WCMD_SET_RTS_THRES,
+ ADF_NET_WCMD_GET_FRAGMENT,
+ ADF_NET_WCMD_SET_FRAGMENT,
+ ADF_NET_WCMD_GET_VAPMODE,
ADF_NET_WCMD_SET_VAPMODE,
- ADF_NET_WCMD_GET_BSSID,
- ADF_NET_WCMD_SET_BSSID,
- ADF_NET_WCMD_GET_NICKNAME,
- ADF_NET_WCMD_SET_NICKNAME,
- ADF_NET_WCMD_GET_FREQUENCY,
- ADF_NET_WCMD_SET_FREQUENCY,
- ADF_NET_WCMD_GET_ESSID,
- ADF_NET_WCMD_SET_ESSID,
- ADF_NET_WCMD_GET_TX_POWER,
+ ADF_NET_WCMD_GET_BSSID,
+ ADF_NET_WCMD_SET_BSSID,
+ ADF_NET_WCMD_GET_NICKNAME,
+ ADF_NET_WCMD_SET_NICKNAME,
+ ADF_NET_WCMD_GET_FREQUENCY,
+ ADF_NET_WCMD_SET_FREQUENCY,
+ ADF_NET_WCMD_GET_ESSID,
+ ADF_NET_WCMD_SET_ESSID,
+ ADF_NET_WCMD_GET_TX_POWER,
ADF_NET_WCMD_SET_TX_POWER,
ADF_NET_WCMD_GET_PARAM,
ADF_NET_WCMD_SET_PARAM,
ADF_NET_WCMD_SET_ENC,
ADF_NET_WCMD_GET_KEY,
ADF_NET_WCMD_SET_KEY,
- ADF_NET_WCMD_GET_SCAN,
- ADF_NET_WCMD_SET_SCAN,
- ADF_NET_WCMD_GET_MODE,
- ADF_NET_WCMD_SET_MODE,
- ADF_NET_WCMD_GET_CHAN_LIST,
- ADF_NET_WCMD_SET_CHAN_LIST,
- ADF_NET_WCMD_GET_WMM_PARAM,
- ADF_NET_WCMD_SET_WMM_PARAM,
+ ADF_NET_WCMD_GET_SCAN,
+ ADF_NET_WCMD_SET_SCAN,
+ ADF_NET_WCMD_GET_MODE,
+ ADF_NET_WCMD_SET_MODE,
+ ADF_NET_WCMD_GET_CHAN_LIST,
+ ADF_NET_WCMD_SET_CHAN_LIST,
+ ADF_NET_WCMD_GET_WMM_PARAM,
+ ADF_NET_WCMD_SET_WMM_PARAM,
ADF_NET_WCMD_GET_VAPNAME,
ADF_NET_WCMD_GET_IC_CAPS,
ADF_NET_WCMD_GET_RETRIES,
ADF_NET_WCMD_GET_DEV_DIALOG,
ADF_NET_WCMD_GET_DEV_PHYERR,
ADF_NET_WCMD_GET_DEV_CWM,
- ADF_NET_WCMD_GET_DEV_ETHTOOL,
+ ADF_NET_WCMD_GET_DEV_ETHTOOL,
ADF_NET_WCMD_SET_DEV_MAC,
ADF_NET_WCMD_SET_DEV_CAP,/*ATH_CAP*/
/* Device write specific */
ADF_NET_WCMD_PARAM_FAST_CC,/**< fast channel change */
/**
* 11n A-MPDU, A-MSDU support
- */
+ */
ADF_NET_WCMD_PARAM_AMPDU,/**< 11n a-mpdu support */
ADF_NET_WCMD_PARAM_AMPDU_LIMIT,/**< a-mpdu length limit */
ADF_NET_WCMD_PARAM_AMPDU_DENSITY,/**< a-mpdu density */
ADF_NET_WCMD_PARAM_RB,/**< Switch in/out of RB */
/**
* RB Detection knobs.
- */
+ */
ADF_NET_WCMD_PARAM_RB_DETECT,/**< Do RB detection */
ADF_NET_WCMD_PARAM_RB_SKIP_THRESHOLD,/**< seqno-skip-by-1s to detect */
ADF_NET_WCMD_PARAM_RB_TIMEOUT,/**< (in ms) to restore non-RB */
ADF_NET_WCMD_WMMPARAMS_AIFS,
ADF_NET_WCMD_WMMPARAMS_TXOPLIMIT,
ADF_NET_WCMD_WMMPARAMS_ACM,
- ADF_NET_WCMD_WMMPARAMS_NOACKPOLICY,
+ ADF_NET_WCMD_WMMPARAMS_NOACKPOLICY,
}adf_net_wcmd_wmmparams_t;
/**
ADF_NET_WCMD_TXPOW_DBM = 0,/**< dBm */
ADF_NET_WCMD_TXPOW_MWATT = 0x1,/**< mW */
ADF_NET_WCMD_TXPOW_RELATIVE = 0x2,/**< Arbitrary units */
- ADF_NET_WCMD_TXPOW_TYPE = 0xFF,/**< Type of value */
- ADF_NET_WCMD_TXPOW_RANGE = 0x1000/**< Range (min - max) */
+ ADF_NET_WCMD_TXPOW_TYPE = 0xFF,/**< Type of value */
+ ADF_NET_WCMD_TXPOW_RANGE = 0x1000/**< Range (min - max) */
}adf_net_wcmd_txpow_flags_t;
/**
* @brief Retry flags
ADF_NET_WCMD_RETRY_MAX = 0x2,/**< Maximum */
ADF_NET_WCMD_RETRY_RELATIVE = 0x4,/**< Not in seconds/ms/us */
ADF_NET_WCMD_RETRY_SHORT = 0x10,/**< Short packets */
- ADF_NET_WCMD_RETRY_LONG = 0x20,/**< Long packets */
+ ADF_NET_WCMD_RETRY_LONG = 0x20,/**< Long packets */
ADF_NET_WCMD_RETRY_MODIFIER = 0xFF,/**< Modify a parameter */
ADF_NET_WCMD_RETRY_LIMIT = 0x1000,/**< Max retries*/
ADF_NET_WCMD_RETRY_LIFETIME = 0x2000,/**< Max retries us*/
ADF_NET_WCMD_CWMEVENT_EXTCHRESUME,/**< ext channel sensing resume */
ADF_NET_WCMD_CWMEVENT_DESTCW20, /**< dest channel width changed to 20 */
ADF_NET_WCMD_CWMEVENT_DESTCW40, /**< dest channel width changed to 40 */
- ADF_NET_WCMD_CWMEVENT_MAX
+ ADF_NET_WCMD_CWMEVENT_MAX
} adf_net_wcmd_cwm_event_t;
/**
ADF_NET_WCMD_ETHTOOL_SWOL,/**< Set wake-on-lan options. */
ADF_NET_WCMD_ETHTOOL_GMSGLVL,/**< Get driver message level */
ADF_NET_WCMD_ETHTOOL_SMSGLVL,/**< Set driver msg level */
- ADF_NET_WCMD_ETHTOOL_NWAY_RST,/**< Restart autonegotiation. */
+ ADF_NET_WCMD_ETHTOOL_NWAY_RST,/**< Restart autonegotiation. */
ADF_NET_WCMD_ETHTOOL_GEEPROM,/**< Get EEPROM data */
ADF_NET_WCMD_ETHTOOL_SEEPROM,/** < Set EEPROM data. */
ADF_NET_WCMD_ETHTOOL_GCOALESCE,/** < Get coalesce config */
* @brief Link quality info
*/
typedef struct adf_net_wcmd_linkqty{
- a_uint8_t qual;/*link quality(retries, SNR, missed beacons)*/
+ a_uint8_t qual;/*link quality(retries, SNR, missed beacons)*/
a_uint8_t level;/*Signal level (dBm) */
a_uint8_t noise;/*Noise level (dBm) */
a_uint8_t updated;/*Update flag*/
* @brief VAP parameter range info
*/
typedef struct adf_net_wcmd_vapparam_range{
-
+
/**
* @brief Informative stuff (to choose between different
* interface) In theory this value should be the maximum
* benchmark...
*/
a_uint32_t throughput;/**< To give an idea... */
-
+
/** @brief NWID (or domain id) */
a_uint32_t min_nwid;/**< Min NWID to set */
a_uint32_t max_nwid;/**< Max NWID to set */
* quality level (using a geometric subdivision centered on the
* average). I expect that people doing the user space apps will
* feedback us on which value we need to put in each
- * driver...
+ * driver...
*/
- adf_net_wcmd_linkqty_t avg_qual;
+ adf_net_wcmd_linkqty_t avg_qual;
/**@brief Rates */
a_uint8_t num_bitrates; /**< Number of entries in the list */
a_uint16_t txpower_capa;/**< options supported */
a_uint8_t num_txpower;/**< Number of entries in the list */
a_int32_t txpower[ADF_NET_WCMD_MAX_TXPOWER];/**< in bps */
-
+
/**@brief Wireless Extension version info */
a_uint8_t we_version_compiled;/**< Must be WIRELESS_EXT */
a_uint8_t we_version_source;/**< Last update of source */
-
+
/**@brief Retry limits and lifetime */
a_uint16_t retry_capa;/**< retry options supported */
a_uint16_t retry_flags;/**< decode max/min retry limit*/
a_int32_t max_retry;/**< Max retries */
a_int32_t min_r_time;/**< Min retry lifetime */
a_int32_t max_r_time;/**< Max retry lifetime */
-
+
/**@brief Frequency */
a_uint16_t num_channels;/**< Num channels [0 - (num - 1)] */
a_uint8_t num_frequency;/**< Num entries*/
* numbers, because each entry contain its channel index
*/
adf_net_wcmd_freq_t freq[ADF_NET_WCMD_MAX_FREQ];
-
+
a_uint32_t enc_capa; /**< IW_ENC_CAPA_* bit field */
}adf_net_wcmd_vapparam_range_t;
/**
typedef adf_net_ie_info_t adf_net_wcmd_optie_t;
/**
- * @brief status of VAP interface
- */
+ * @brief status of VAP interface
+ */
typedef struct adf_net_wcmd_vapstats{
a_uint8_t status;/**< Status*/
adf_net_wcmd_linkqty_t qual;/**< Quality of the link*/
- adf_net_wcmd_discard_t discard;/**< Packet discarded counts */
+ adf_net_wcmd_discard_t discard;/**< Packet discarded counts */
adf_net_wcmd_miss_t miss;/**< Packet missed counts */
} adf_net_wcmd_vapstats_t;
* @brief MLME
*/
typedef struct adf_net_wcmd_mlme{
- adf_net_wcmd_mlme_op_type_t op;/**< operation to perform */
+ adf_net_wcmd_mlme_op_type_t op;/**< operation to perform */
a_uint8_t reason;/**< 802.11 reason code */
//a_uint8_t macaddr[ADF_NET_WCMD_ADDR_LEN];
adf_net_ethaddr_t mac;
}adf_net_wcmd_chaninfo_t;
/**
- * @brief wmm-param info
- */
+ * @brief wmm-param info
+ */
typedef struct adf_net_wcmd_wmmparaminfo{
adf_net_wcmd_wmmparams_t cmd;
a_uint32_t ac;
}adf_net_wcmd_txpower_t;
/**
- * @brief tx-power-limit info
- */
+ * @brief tx-power-limit info
+ */
typedef a_uint32_t adf_net_wcmd_txpowlimit_t;
*/
typedef struct adf_net_wcmd_vaplist{
a_uint8_t list[ADF_NET_WCMD_MAX_AP];
- a_uint32_t len;
+ a_uint32_t len;
}adf_net_wcmd_vaplist_t;
/**
* @brief list of stations
/**
* @brief ath caps info
*/
-typedef struct adf_net_wcmd_devcap{
- a_int32_t cap;
- a_int32_t setting;
-}adf_net_wcmd_devcap_t;
+typedef struct adf_net_wcmd_devcap{
+ a_int32_t cap;
+ a_int32_t setting;
+}adf_net_wcmd_devcap_t;
/**
* @brief station stats
a_uint64_t ns_rx_bytes;/**< rx data count (bytes) */
a_uint64_t ns_rx_beacons;/**< rx beacon frames */
a_uint32_t ns_rx_proberesp;/**< rx probe response frames */
-
+
a_uint32_t ns_rx_dup;/**< rx discard 'cuz dup */
a_uint32_t ns_rx_noprivacy;/**< rx w/ wep but privacy off */
a_uint32_t ns_rx_wepfail;/**< rx wep processing failed */
a_uint32_t ns_rx_decryptcrc;/**< rx decrypt failed on crc */
a_uint32_t ns_rx_unauth;/**< rx on unauthorized port */
a_uint32_t ns_rx_unencrypted;/**< rx unecrypted w/ privacy */
-
+
a_uint32_t ns_tx_data;/**< tx data frames */
a_uint32_t ns_tx_mgmt;/**< tx management frames */
a_uint32_t ns_tx_ucast;/**< tx unicast frames */
a_uint64_t ns_tx_bytes;/**< tx data count (bytes) */
a_uint32_t ns_tx_probereq;/**< tx probe request frames */
a_uint32_t ns_tx_uapsd;/**< tx on uapsd queue */
-
+
a_uint32_t ns_tx_novlantag;/**< tx discard 'cuz no tag */
a_uint32_t ns_tx_vlanmismatch;/**< tx discard 'cuz bad tag */
-
+
a_uint32_t ns_tx_eosplost;/**< uapsd EOSP retried out */
-
+
a_uint32_t ns_ps_discard;/**< ps discard 'cuz of age */
-
+
a_uint32_t ns_uapsd_triggers;/**< uapsd triggers */
-
+
/* MIB-related state */
a_uint32_t ns_tx_assoc;/**< [re]associations */
a_uint32_t ns_tx_assoc_fail;/**< [re]association failures */
/**
- * @brief ampdu info
- */
+ * @brief ampdu info
+ */
typedef struct adf_net_wcmd_ampdu_trc {
a_uint32_t tr_head;
a_uint32_t tr_tail;
} adf_net_wcmd_ampdu_trc_t;
/**
- * @brief phy stats info
- */
+ * @brief phy stats info
+ */
typedef struct adf_net_wcmd_phystats{
a_uint32_t ast_watchdog;/**< device reset by watchdog */
a_uint32_t ast_hardware;/**< fatal hardware error interrupts */
} adf_net_wcmd_phystats_t;
/**
- * @brief diag info
- */
+ * @brief diag info
+ */
typedef struct adf_net_wcmd_diag{
a_int8_t ad_name[ADF_NET_WCMD_NAME_SIZE];/**< if name*/
a_uint16_t ad_id;
typedef struct adf_net_wcmd_cwmdbg{
adf_net_wcmd_cwm_cmd_t dc_cmd;/**< dbg commands*/
adf_net_wcmd_cwm_event_t dc_arg;/**< events*/
-} adf_net_wcmd_cwmdbg_t;
+} adf_net_wcmd_cwmdbg_t;
/**
* @brief device cwm info
a_int8_t driver[ADF_NET_WCMD_DRIVSIZ];/**< driver short name */
a_int8_t version[ADF_NET_WCMD_VERSIZ];/**< driver ver string */
a_int8_t fw_version[ADF_NET_WCMD_FIRMSIZ];/**< firmware ver string*/
- a_int8_t bus_info[ADF_NET_WCMD_BUSINFO_LEN];/**< Bus info */
+ a_int8_t bus_info[ADF_NET_WCMD_BUSINFO_LEN];/**< Bus info */
a_int8_t reserved1[32];
a_int8_t reserved2[16];
a_uint32_t n_stats;/**< number of u64's from ETHTOOL_GSTATS */
- a_uint32_t testinfo_len;
+ a_uint32_t testinfo_len;
a_uint32_t eedump_len;/**< Size of data from EEPROM(bytes) */
a_uint32_t regdump_len;/**< Size of data from REG(bytes) */
}adf_net_wcmd_ethtool_t ;
adf_net_wcmd_ethtool_t drv;
}adf_net_wcmd_ethtool_info_t;
-/**
- * @brief vap create flag info
- */
+/**
+ * @brief vap create flag info
+ */
typedef enum adf_net_wcmd_vapcreate_flags{
ADF_NET_WCMD_CLONE_BSSID=0x1,/**< allocate unique mac/bssid */
- ADF_NET_WCMD_NO_STABEACONS/**< Do not setup the sta beacon timers*/
+ ADF_NET_WCMD_NO_STABEACONS/**< Do not setup the sta beacon timers*/
}adf_net_wcmd_vapcreate_flags_t;
/**
a_uint64_t tx_dropped;/**< no space available in linux */
a_uint64_t multicast;/**< multicast packets received */
a_uint64_t collisions;
-
+
/* detailed rx_errors: */
a_uint64_t rx_length_errors;
a_uint64_t rx_over_errors;/**< receiver ring buff overflow */
a_uint64_t rx_frame_errors;/**< recv'd frame alignment error */
a_uint64_t rx_fifo_errors;/**< recv'r fifo overrun */
a_uint64_t rx_missed_errors;/**< receiver missed packet */
-
+
/* detailed tx_errors */
a_uint64_t tx_aborted_errors;
a_uint64_t tx_carrier_errors;
a_uint64_t tx_fifo_errors;
a_uint64_t tx_heartbeat_errors;
a_uint64_t tx_window_errors;
-
+
/* for cslip etc */
a_uint64_t rx_compressed;
a_uint64_t tx_compressed;
/**
* @brief ioctl structure to configure the wireless interface.
- */
+ */
typedef struct adf_net_wcmd{
char if_name[ADF_NET_WCMD_NAME_SIZE];/**< Iface name*/
adf_net_wcmd_type_t type; /**< Type of wcmd */
- adf_net_wcmd_data_t data; /**< Data */
+ adf_net_wcmd_data_t data; /**< Data */
} adf_net_wcmd_t;
/**
* @brief helper macros
a_uint8_t chan;
a_uint8_t ttbt;
}adf_net_wcmd_chansw_t;
-/**
+/**
* ***************************Unresoloved*******************
*/
// typedef struct adf_net_wcmd_chansw_info{
// a_uint8_t chan;
// a_uint8_t ttbt;
// }adf_net_wcmd_chansw_info_t;
-//
+//
/**
* @brief ath mac info
*/
// typedef struct {
// a_uint16_t sa_family;/**< address family, AF_xxx*/
-// a_int8_t sa_data[ADF_NET_WCMD_ADDR_LEN];/**< 14 bytes address */
+// a_int8_t sa_data[ADF_NET_WCMD_ADDR_LEN];/**< 14 bytes address */
// }adf_net_wcmd_ath_mac_info_t;
#endif
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/**
+/**
* @ingroup adf_os_public
* @file adf_os_atomic.h
* This file abstracts an atomic counter.
*/
-
+
#ifndef _ADF_OS_ATOMIC_H
#define _ADF_OS_ATOMIC_H
*/
typedef __adf_os_atomic_t adf_os_atomic_t;
-/**
+/**
* @brief Initialize an atomic type variable
* @param[in] v a pointer to an opaque atomic variable
*/
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-/**
- * @ingroup adf_os_public
- * @file adf_os_bitops.h
- * This file abstracts bit-level operations on a stream of bytes.
- */
-
-#ifndef _ADF_OS_BITOPS_H
-#define _ADF_OS_BITOPS_H
-
-#include <adf_os_types.h>
-
-/**
- * @brief Set a bit atomically
- * @param[in] nr Bit to change
- * @param[in] addr Address to start counting from
- *
- * @note its atomic and cannot be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_set_bit_a(a_uint32_t nr, volatile a_uint32_t *addr)
-{
- __adf_os_set_bit_a(nr, addr);
-}
-
-/**
- * @brief Set a bit
- * @param[in] nr Bit to change
- * @param[in] addr Address to start counting from
- *
- * @note its not atomic and can be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_set_bit(a_uint32_t nr, volatile a_uint32_t *addr)
-{
- __adf_os_set_bit(nr, addr);
-}
-
-/**
- * @brief Clear a bit atomically
- * @param[in] nr Bit to change
- * @param[in] addr Address to start counting from
- *
- * @note its atomic and cannot be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_clear_bit_a(a_uint32_t nr, volatile a_uint32_t *addr)
-{
- __adf_os_clear_bit_a(nr, addr);
-}
-
-/**
- * @brief Clear a bit
- * @param[in] nr Bit to change
- * @param[in] addr Address to start counting from
- *
- * @note its not atomic and can be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_clear_bit(a_uint32_t nr, volatile a_uint32_t *addr)
-{
- __adf_os_clear_bit(nr, addr);
-}
-
-/**
- * @brief Toggle a bit atomically
- * @param[in] nr Bit to change
- * @param[in] addr Address to start counting from
- *
- * @note its atomic and cannot be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_change_bit_a(a_uint32_t nr, volatile a_uint32_t *addr)
-{
- __adf_os_change_bit_a(nr, addr);
-}
-
-/**
- * @brief Toggle a bit
- * @param[in] nr Bit to change
- * @param[in] addr Address to start counting from
- *
- * @note its not atomic and can be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_change_bit(a_uint32_t nr, volatile a_uint32_t *addr)
-{
- __adf_os_change_bit(nr, addr);
-}
-
-/**
- * @brief Test and Set a bit atomically
- * @param[in] nr Bit to set
- * @param[in] addr Address to start counting from
- *
- * @note its atomic and cannot be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_test_and_set_bit_a(a_uint32_t nr,
- volatile a_uint32_t *addr)
-{
- __adf_os_test_and_set_bit_a(nr, addr);
-}
-
-/**
- * @brief Test and Set a bit
- * @param[in] nr Bit to set
- * @param[in] addr Address to start counting from
- *
- * @note its not atomic and can be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_test_and_set_bit(a_uint32_t nr,
- volatile a_uint32_t *addr)
-{
- __adf_os_test_and_set_bit(nr, addr);
-}
-
-/**
- * @brief Test and clear a bit atomically
- * @param[in] nr Bit to set
- * @param[in] addr Address to start counting from
- *
- * @note its atomic and cannot be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_test_and_clear_bit_a(a_uint32_t nr,
- volatile a_uint32_t *addr)
-{
- __adf_os_test_and_clear_bit_a(nr, addr);
-}
-
-/**
- * @brief Test and clear a bit
- * @param[in] nr Bit to set
- * @param[in] addr Address to start counting from
- *
- * @note its not atomic and can be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_test_and_clear_bit(a_uint32_t nr,
- volatile a_uint32_t *addr)
-{
- __adf_os_test_and_clear_bit(nr, addr);
-}
-
-/**
- * @brief Test and change a bit atomically
- * @param[in] nr Bit to set
- * @param[in] addr Address to start counting from
- *
- * @note its atomic and cannot be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_test_and_change_bit_a(a_uint32_t nr,
- volatile a_uint32_t *addr)
-{
- __adf_os_test_and_change_bit_a(nr, addr);
-}
-
-/**
- * @brief Test and clear a bit
- * @param[in] nr Bit to set
- * @param[in] addr Address to start counting from
- *
- * @note its not atomic and can be re-ordered.
- * Note that nr may be almost arbitrarily large; this function is not
- * restricted to acting on a single-word quantity.
- */
-static inline void adf_os_test_and_change_bit(a_uint32_t nr,
- volatile a_uint32_t *addr)
-{
- __adf_os_test_and_change_bit(nr, addr);
-}
-
-/**
- * @brief test_bit - Determine whether a bit is set
- * @param[in] nr bit number to test
- * @param[in] addr Address to start counting from
- *
- * @return 1 if set, 0 if not
- */
-static inline int adf_os_test_bit(a_uint32_t nr, volatile a_uint32_t *addr)
-{
- __adf_os_test_bit(nr, addr);
-}
-
-
-#endif /**_AOD_BITOPS_H*/
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-/**
- * @ingroup adf_os_public
- * @file adf_os_crypto.h
- * This file defines crypto APIs
- */
-
-#ifndef __ADF_OS_CRYPTO_H
-#define __ADF_OS_CRYPTO_H
-
-#include <adf_os_crypto_pvt.h>
-
-/**
- * @brief Representation of a cipher context.
- */
-typedef __adf_os_cipher_t adf_os_cipher_t;
-
-/**
- * @brief Types of crypto algorithms
- */
-typedef enum adf_os_crypto_alg{
- ADF_OS_CRYPTO_AES = __ADF_OS_CRYPTO_AES,
- ADF_OS_CRYPTO_OTHER = __ADF_OS_CRYPTO_OTHER,
-}adf_os_crypto_alg_t;
-
-
-/**
- * @brief allocate the cipher context
- * @param[in] type crypto algorithm
- *
- * @return the new cipher context
- */
-static inline adf_os_cipher_t
-adf_os_crypto_alloc_cipher(adf_os_crypto_alg_t type)
-{
- return __adf_os_crypto_alloc_cipher(type);
-}
-
-/**
- * @brief free the cipher context
- *
- * @param[in] cipher cipher context
- */
-static inline void
-adf_os_crypto_free_cipher(adf_os_cipher_t cipher)
-{
- __adf_os_crypto_free_cipher(cipher);
-}
-
-/**
- * @brief set the key for cipher context with length keylen
- *
- * @param[in] cipher cipher context
- * @param[in] key key material
- * @param[in] keylen length of key material
- *
- * @return a_uint32_t
- */
-static inline a_uint32_t
-adf_os_crypto_cipher_setkey(adf_os_cipher_t cipher, const a_uint8_t *key, a_uint8_t keylen)
-{
- return __adf_os_crypto_cipher_setkey(cipher, key, keylen);
-}
-
-/**
- * @brief encrypt the data with AES
- *
- * @param[in] cipher cipher context
- * @param[in] src unencrypted data
- * @param[out] dst encrypted data
- */
-static inline void
-adf_os_crypto_rijndael_encrypt(adf_os_cipher_t cipher, const void *src, void *dst)
-{
- __adf_os_crypto_rijndael_encrypt(cipher, src, dst);
-}
-#endif
/**
* TODO This implements work queues (worker threads, kernel threads etc.).
- * Note that there is no cancel on a scheduled work. You cannot free a work
+ * Note that there is no cancel on a scheduled work. You cannot free a work
* item if its queued. You cannot know if a work item is queued or not unless
* its running, whence you know its not queued.
*
* so if, say, a module is asked to unload itself, how exactly will it make
- * sure that the work's not queued, for OS'es that dont provide such a
+ * sure that the work's not queued, for OS'es that dont provide such a
* mechanism??
*/
/**
* @brief Representation of a work queue.
- */
+ */
typedef __adf_os_work_t adf_os_work_t;
/**
* @brief Representation of a bottom half.
- */
+ */
typedef __adf_os_bh_t adf_os_bh_t;
/**
* @brief This initiallizes the Bottom half deferred handler
- *
+ *
* @param[in] hdl OS handle
* @param[in] bh bottom instance
* @param[in] func deferred function to run at bottom half interrupt
* context.
* @param[in] arg argument for the deferred function
*/
-static inline void
+static inline void
adf_os_init_bh(adf_os_handle_t hdl, adf_os_bh_t *bh,
adf_os_defer_fn_t func,void *arg)
{
/**
* @brief schedule a bottom half (DPC)
- *
+ *
* @param[in] hdl OS handle
* @param[in] bh bottom instance
*/
-static inline void
+static inline void
adf_os_sched_bh(adf_os_handle_t hdl, adf_os_bh_t *bh)
{
__adf_os_sched_bh(hdl, bh);
/**
* @brief disable the bh (synchronous)
- *
+ *
* @param[in] hdl OS handle
* @param[in] bh bottom instance
*/
-static inline void
+static inline void
adf_os_disable_bh(adf_os_handle_t hdl, adf_os_bh_t *bh)
{
__adf_os_disable_bh(hdl,bh);
/**
* @brief allocate a work/task queue, This runs in non-interrupt
* context, so can be preempted by H/W & S/W intr
- *
+ *
* @param[in] hdl OS handle
* @param[in] work work instance
* @param[in] func deferred function to run at bottom half non-interrupt
* context.
* @param[in] arg argument for the deferred function
*/
-static inline void
+static inline void
adf_os_init_work(adf_os_handle_t hdl, adf_os_work_t *work,
adf_os_defer_fn_t func, void *arg)
{
/**
* @brief Schedule a deferred task on non-interrupt context
- *
+ *
* @param[in] hdl OS handle
* @param[in] work work instance
*/
-static inline void
+static inline void
adf_os_sched_work(adf_os_handle_t hdl, adf_os_work_t *work)
{
__adf_os_sched_work(hdl, work);
*@param[in] hdl OS handle
*@param[in] work work instance
*/
-static inline void
-adf_os_disable_work(adf_os_handle_t hdl, adf_os_work_t *work)
+static inline void
+adf_os_disable_work(adf_os_handle_t hdl, adf_os_work_t *work)
{
__adf_os_disable_work(hdl, work);
}
* @param[in] size DMA buffer size
* @param[in] coherent 0 => cached.
* @param[out] dmap opaque coherent memory handle
- *
+ *
* @return returns the virtual address of the memory
*/
static inline void *
-adf_os_dmamem_alloc(adf_os_device_t osdev,
- adf_os_size_t size,
- a_bool_t coherent,
+adf_os_dmamem_alloc(adf_os_device_t osdev,
+ adf_os_size_t size,
+ a_bool_t coherent,
adf_os_dma_map_t *dmap)
{
return __adf_os_dmamem_alloc(osdev, size, coherent, dmap);
/**
* @brief Free a previously mapped DMA buffer
- *
+ *
* @param[in] osdev platform device instance
* @param[in] size DMA buffer size
* @param[in] coherent 0 => cached.
* @param[in] op op code for sync type, (see @ref adf_os_types.h)
*/
static inline void
-adf_os_dmamem_cache_sync(adf_os_device_t osdev,
- adf_os_dma_map_t dmap,
+adf_os_dmamem_cache_sync(adf_os_device_t osdev,
+ adf_os_dma_map_t dmap,
adf_os_cache_sync_t op)
{
__adf_os_dmamem_cache_sync(osdev, dmap, op);
/**
* @brief Get the cpu cache line size
- *
+ *
* @return The CPU cache line size in bytes.
*/
static inline adf_os_size_t
/**
* @brief locks the spinlock mutex in soft irq context
- *
+ *
* @param[in] lock spinlock object pointer
*/
static inline void
/**
* @brief unlocks the spinlock mutex in soft irq context
- *
+ *
* @param[in] lock spinlock object pointer
*/
static inline void
* @param[in] lock spinlock to be held for the critical region
* @param[in] func critical region function that to be executed
* @param[in] context context of the critical region function
- *
+ *
* @return Boolean status returned by the critical region function
*/
static inline a_bool_t
* @param[in] src source address
* @param[in] size buffer size
*/
-static inline void
+static inline void
adf_os_mem_move(void *dst, void *src, adf_os_size_t size)
{
__adf_os_mem_move(dst,src,size);
/**
* @brief Fill a memory buffer
- *
+ *
* @param[in] buf buffer to be filled
* @param[in] b byte to fill
* @param[in] size buffer size
/**
* @brief Zero a memory buffer
- *
+ *
* @param[in] buf buffer to be zeroed
* @param[in] size buffer size
*/
/**
* @brief Specify the module's entry point.
- */
+ */
#define adf_os_virt_module_init(_mod_init_func) __adf_os_virt_module_init(_mod_init_func)
/**
* @brief Specify the module's exit point.
- */
+ */
#define adf_os_virt_module_exit(_mod_exit_func) __adf_os_virt_module_exit(_mod_exit_func)
/**
* @brief Specify the module's dependency on another module.
- */
+ */
#define adf_os_module_dep(_name,_dep) __adf_os_module_dep(_name,_dep)
/**
* @brief Export a symbol from a module.
- */
+ */
#define adf_os_export_symbol(_sym) __adf_os_export_symbol(_sym)
-
+
/**
* @brief Module parameter of type integer.
- */
+ */
#define ADF_OS_PARAM_TYPE_INT32 __ADF_OS_PARAM_TYPE_INT32
/**
* @brief Module parameter of type string.
- */
+ */
#define ADF_OS_PARAM_TYPE_STRING __ADF_OS_PARAM_TYPE_STRING
/**
- * @brief Declare a module parameter.
+ * @brief Declare a module parameter.
*
* @param[in] name name of the parameter
* @param[in] type type of the parameter
* Only two types are supported
* ADF_OS_PARAM_TYPE_STRING
* ADF_OS_PARAM_TYPE_INT32
- * For example, say, the parameters name "my_int" and "my_name" are of
- * variables of type int and string respectively. Then you would declare them
+ * For example, say, the parameters name "my_int" and "my_name" are of
+ * variables of type int and string respectively. Then you would declare them
* as follows:
* @code
* adf_os_declare_param(my_int, ADF_OS_PARAM_TYPE_INT32);
* adf_os_read_param(my_name, &softc->sc_my_name);
* @endcode
*
- * or
+ * or
* @code
* st = adf_os_read_param(my_int, &softc->sc_my_int);
* @endcode
/**
* @brief Define the entry point for the PCI module.
- */
+ */
#define adf_os_pci_module_init(_fn) __adf_os_pci_module_init(_fn)
/**
* @brief Define the exit point for the PCI module.
- */
+ */
#define adf_os_pci_module_exit(_fn) __adf_os_pci_module_exit(_fn)
/**
* @brief Setup the following driver information: name, PCI IDs of devices
* supported and some device handlers.
- */
+ */
#define adf_os_pci_set_drv_info(_name, _pci_ids, _attach, _detach, _suspend, _resume) \
__adf_os_pci_set_drv_info(_name, _pci_ids, _attach, _detach, _suspend, _resume)
* @param[out] val value read
*
* @return status of operation
- */
-static inline int
+ */
+static inline int
adf_os_pci_config_read8(adf_os_device_t osdev, int offset, a_uint8_t *val)
{
return __adf_os_pci_config_read8(osdev, offset, val);
* @param[in] val value to write
*
* @return status of operation
- */
-static inline int
+ */
+static inline int
adf_os_pci_config_write8(adf_os_device_t osdev, int offset, a_uint8_t val)
{
return __adf_os_pci_config_write8(osdev, offset, val);
* @param[out] val value read
*
* @return status of operation
- */
-static inline int
+ */
+static inline int
adf_os_pci_config_read16(adf_os_device_t osdev, int offset, a_uint16_t *val)
{
return __adf_os_pci_config_read16(osdev, offset, val);
* @param[in] val value to write
*
* @return status of operation
- */
-static inline int
+ */
+static inline int
adf_os_pci_config_write16(adf_os_device_t osdev, int offset, a_uint16_t val)
{
return __adf_os_pci_config_write16(osdev, offset, val);
* @param[out] val value read
*
* @return status of operation
- */
-static inline int
+ */
+static inline int
adf_os_pci_config_read32(adf_os_device_t osdev, int offset, a_uint32_t *val)
{
return __adf_os_pci_config_read32(osdev, offset, val);
* @param[in] val value to write
*
* @return status of operation
- */
-static inline int
+ */
+static inline int
adf_os_pci_config_write32(adf_os_device_t osdev, int offset, a_uint32_t val)
{
return __adf_os_pci_config_write32(osdev, offset, val);
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-/**
- * @ingroup adf_os_public
- * @file adf_os_pseudo.h
- * This file abstracts "pseudo module" semantics.
- */
-#ifndef __ADF_OS_PSEUDO_H
-#define __ADF_OS_PSEUDO_H
-
-#include <adf_os_pseudo_pvt.h>
-
-/**
- * @brief Specify the module's entry point.
- */
-#define adf_os_pseudo_module_init(_fn) __adf_os_pseudo_module_init(_fn)
-
-/**
- * @brief Specify the module's exit point.
- */
-#define adf_os_pseudo_module_exit(_fn) __adf_os_pseudo_module_exit(_fn)
-
-/**
- * @brief Setup the following driver information: name, pseudo IDs of devices
- * supported and some device handlers.
- */
-#define adf_os_pseudo_set_drv_info(_name, _ifname, _pseudo_ids, _attach, _detach, \
- _suspend, _resume) \
- __adf_os_pseudo_set_drv_info(_name, _ifname, _pseudo_ids, \
- _attach, _detach, \
- _suspend, _resume)
-#endif
-
*/
/**
* @defgroup adf_os_public OS abstraction API
- */
+ */
/**
* @ingroup adf_os_public
#include <adf_os_types_pvt.h>
/**
- * @brief basic data types.
+ * @brief basic data types.
*/
typedef enum {
A_FALSE,
- A_TRUE
+ A_TRUE
}a_bool_t;
typedef __a_uint8_t a_uint8_t;
/**
* @brief count the number of ticks elapsed from the time when
* the system booted
- *
+ *
* @return ticks
*/
static inline unsigned long
*
* @param[in] ticks number of ticks
* @return time in milliseconds
- */
+ */
static inline a_uint32_t
adf_os_ticks_to_msecs(unsigned long ticks)
{
*
* @param[in] time in milliseconds
* @return number of ticks
- */
+ */
static inline unsigned long
adf_os_msecs_to_ticks(a_uint32_t msecs)
{
/**
* @brief Check if _a is later than _b.
- */
+ */
#define adf_os_time_after(_a, _b) __adf_os_time_after(_a, _b)
/**
* @brief Check if _a is prior to _b.
- */
+ */
#define adf_os_time_before(_a, _b) __adf_os_time_before(_a, _b)
/**
* @brief Check if _a atleast as recent as _b, if not later.
- */
+ */
#define adf_os_time_after_eq(_a, _b) __adf_os_time_after_eq(_a, _b)
#endif
-
+
/**
* @brief Initialize a timer
- *
+ *
* @param[in] hdl OS handle
* @param[in] timer timer object pointer
* @param[in] func timer function
/**
* @brief Start a one-shot timer
- *
+ *
* @param[in] timer timer object pointer
* @param[in] msec expiration period in milliseconds
*/
* @brief Cancel a timer
*
* @param[in] timer timer object pointer
- *
+ *
* @retval TRUE timer was cancelled and deactived
* @retval FALSE timer was cancelled but already got fired.
*/
#define ADF_OS_MAX_SCATTER __ADF_OS_MAX_SCATTER
/**
* @brief Max number of scatter-gather segments.
- */
+ */
#define ADF_OS_MAX_SGLIST 4
/**
* @brief denotes structure is packed.
- */
+ */
#define adf_os_packed __adf_os_packed
/**
/**
* @brief DMA mapping object.
- */
+ */
typedef __adf_os_dma_map_t adf_os_dma_map_t;
/**
* @brief DMA address.
- */
+ */
typedef __adf_os_dma_addr_t adf_os_dma_addr_t;
/**
* @brief DMA size.
- */
+ */
typedef __adf_os_dma_size_t adf_os_dma_size_t;
/**
* @brief Information inside a DMA map.
- */
+ */
typedef struct adf_os_dmamap_info{
a_uint32_t nsegs; /**< total number mapped segments*/
struct __dma_segs{
adf_os_dma_addr_t paddr; /**< physical(dma'able) address of the segment*/
adf_os_dma_size_t len; /**< length of the segment*/
- } dma_segs[ADF_OS_MAX_SCATTER];
+ } dma_segs[ADF_OS_MAX_SCATTER];
}adf_os_dmamap_info_t;
/**
* @brief Representation of a scatter-gather list.
- */
+ */
typedef struct adf_os_sglist{
a_uint32_t nsegs; /**< total number of segments*/
struct __sg_segs{
* operations, where reading a network packet or
* storage sector corresponds to a read operation in
* bus_dma.
- *
+ *
* ADF_SYNC_PREREAD Perform any synchronization
* required prior to an update
* of host memory by the DMA
} a_status_t;
/**
- * @brief An ecore needs to provide a table of all pci device/vendor id's it
+ * @brief An ecore needs to provide a table of all pci device/vendor id's it
* supports
*
* This table should be terminated by a NULL entry , i.e. {0}
/**
* @brief Representation of a h/w resource.
- */
+ */
typedef struct {
a_uint64_t start;
a_uint64_t end;
/**
* @brief Representation of bus registration data.
- */
+ */
typedef union {
adf_os_pci_dev_id_t *pci;
void *raw;
/**
* @brief Representation of data required for attach.
- */
+ */
typedef union {
adf_os_pci_dev_id_t pci;
void *raw;
/**
* @brief Types of buses.
- */
+ */
typedef enum {
ADF_OS_BUS_TYPE_PCI = 1,
ADF_OS_BUS_TYPE_GENERIC,
/**
* @brief IRQ handler response codes.
- */
+ */
typedef enum {
ADF_OS_IRQ_NONE,
ADF_OS_IRQ_HANDLED,
/**
* @brief DMA mask types.
- */
+ */
typedef enum {
ADF_OS_DMA_MASK_32BIT,
ADF_OS_DMA_MASK_64BIT,
* ADF_OS_DMA_FROM_DEVICE (data going from memory to device)
*/
typedef enum {
- ADF_OS_DMA_TO_DEVICE = __ADF_OS_DMA_TO_DEVICE,
- ADF_OS_DMA_FROM_DEVICE = __ADF_OS_DMA_FROM_DEVICE,
+ ADF_OS_DMA_TO_DEVICE = __ADF_OS_DMA_TO_DEVICE,
+ ADF_OS_DMA_FROM_DEVICE = __ADF_OS_DMA_FROM_DEVICE,
} adf_os_dma_dir_t;
/*
/**
* @brief Prototype of IRQ function.
- */
-typedef adf_os_irq_resp_t (*adf_os_drv_intr)(adf_drv_handle_t hdl);
+ */
+typedef adf_os_irq_resp_t (*adf_os_drv_intr)(adf_drv_handle_t hdl);
/**
* @brief The OS print routine.
- */
+ */
#define adf_os_print __adf_os_print
/**
/**
* @brief driver specific functions
*/
- adf_drv_handle_t (*drv_attach) (adf_os_resource_t *res, int count,
- adf_os_attach_data_t *data,
+ adf_drv_handle_t (*drv_attach) (adf_os_resource_t *res, int count,
+ adf_os_attach_data_t *data,
adf_os_device_t osdev);
void (*drv_detach) (adf_drv_handle_t hdl);
void (*drv_suspend) (adf_drv_handle_t hdl, adf_os_pm_t pm);
#define adf_os_likely(_expr) __adf_os_likely(_expr)
/**
- * @brief read memory barrier.
+ * @brief read memory barrier.
*/
#define adf_os_wmb() __adf_os_wmb()
/**
- * @brief write memory barrier.
+ * @brief write memory barrier.
*/
#define adf_os_rmb() __adf_os_rmb()
/**
- * @brief read + write memory barrier.
+ * @brief read + write memory barrier.
*/
#define adf_os_mb() __adf_os_mb()
/**
* @brief return the lesser of a, b
- */
+ */
#define adf_os_min(_a, _b) __adf_os_min(_a, _b)
/**
* @brief return the larger of a, b
- */
+ */
#define adf_os_max(_a, _b) __adf_os_max(_a, _b)
/**
* @brief assert "expr" evaluates to true.
- */
+ */
#define adf_os_assert(expr) __adf_os_assert(expr)
/**
* @brief supply pseudo-random numbers
*/
-static inline void adf_os_get_rand(adf_os_handle_t hdl,
- a_uint8_t *ptr,
+static inline void adf_os_get_rand(adf_os_handle_t hdl,
+ a_uint8_t *ptr,
a_uint32_t len)
{
__adf_os_get_rand(hdl, ptr, len);
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+#ifndef __ALLOCRAM_API_H__
+#define __ALLOCRAM_API_H__
+
+/* API for Target-side startup-time RAM allocations */
+
+struct allocram_api {
+ /*
+ * Initialize allocram, providing it with a block of RAM
+ * (an "arena") from which to allocate.
+ *
+ * If arena_start is 0, a default start -- the end of
+ * the application's text & data -- is used.
+ *
+ * If arena_sz is 0, a default size -- which uses most
+ * of physical RAM beyond arena_start -- is used.
+ *
+ * Return value is reserved for future use -- it's an arena handle.
+ */
+ void *(* cmnos_allocram_init)(void *arena_start, A_UINT32 arena_sz);
+
+ /*
+ * Allocate nbytes of memory, returning a pointer to the start
+ * of the allocated block. Allocation size is rounded up to the
+ * nearest A_CACHE_LINE_SIZE and the returned address similarly
+ * aligned.
+ *
+ * There is no need to check the return value from this function.
+ * A failure to satisfy a RAM allocation request is treated as a
+ * fatal error.
+ *
+ * Allocations are expected to occur only during startup; this
+ * API does not, for instance, guarantee atomicity with respect
+ * to allocations that might (foolishly) be attempted from
+ * interrupt handlers.
+ *
+ * The "which_arena" parameter is currently unused, and should
+ * be set to 0 -- only a single arena is currently supported.
+ */
+ void *(* cmnos_allocram)(void *which_arena, A_UINT32 nbytes);
+
+ void (* cmnos_allocram_debug)(void);
+};
+
+extern void allocram_module_install(struct allocram_api *api);
+
+
+#endif /* __ALLOCRAM_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef _ASF_SM_H_
-#define _ASF_SM_H_
-
-typedef void (*asf_sm_fn_t)(void *object, int event);
-
-typedef struct asf_sm_s {
- void * object;
- asf_sm_fn_t fn;
- void * event_arg;
-} asf_sm_t;
-
-static inline void
-asf_sm_init(asf_sm_t *sm, void *object)
-{
- sm->object = object;
-}
-
-static inline void
-asf_sm_set_state(asf_sm_t *sm, asf_sm_fn_t fn)
-{
- sm->fn = fn;
-}
-
-static inline void
-asf_sm_send_event(asf_sm_t *sm, int event)
-{
- sm->fn(sm->object, event);
-}
-
-static inline void
-asf_sm_set_event_arg(asf_sm_t *sm, void *arg)
-{
- sm->event_arg = arg;
-}
-
-static inline void *
-asf_sm_get_event_arg(asf_sm_t *sm)
-{
- return sm->event_arg;
-}
-
-#endif /* _ASF_SM_H_ */
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+#ifndef __ATHOS_API_H__
+#define __ATHOS_API_H__
+
+/*
+ * This file contains wrappers to OS operating system functions
+ * that are available in the Athos version of the operating system.
+ *
+ * Target software must always use these wrappers to access OS
+ * services -- it may not access any OS services directly.
+ *
+ * These wrappers are intended to provide OS-independence for applications.
+ * Using this header file, an application should be able to compile and
+ * fully link without any other OS header files, source files, or
+ * binary files.
+ */
+
+#include <osapi.h>
+#include "dt_defs.h"
+#include "cmnos_api.h"
+#include "Magpie_api.h"
+
+/* ROM Patch API */
+
+/* save the ROM printf function point */
+extern int (* save_cmnos_printf)(const char * fmt, ...);
+
+extern unsigned int _data_start_in_rom;
+extern unsigned int _data_start;
+extern unsigned int _data_end;
+extern unsigned int _bss_start;
+extern unsigned int _bss_end;
+extern unsigned int _stack_sentry;
+extern unsigned int __stack;
+extern unsigned int _fw_image_end;
+
+#if defined(__XTENSA__)
+#define START_DATA _data_start
+#define END_DATA _data_end
+#define START_BSS _bss_start
+#define END_BSS _bss_end
+
+#define STACK_START _stack_sentry
+#define STACK_END __stack
+#endif
+
+struct _A_os_linkage_check {
+ int version;
+ int table;
+};
+
+/*
+ * A_INIT() handles any initialization needed by the OS abstraction,
+ * and it clears the application's BSS, if necessary. (Application BSS
+ * is not cleared if the application is linked into a single image that
+ * includes AthOS.)
+ *
+ * A_INIT() must be called first thing in the application (from app_start)
+ * in order to guarantee that BSS has been cleared properly.
+ */
+static INLINE int
+A_INIT(void)
+{
+ struct _A_os_linkage_check link_check;
+ unsigned int *clrptr;
+
+ if (&START_BSS != _A_MAGPIE_INDIRECTION_TABLE->cmnos.start_bss) {
+ /* Clear BSS */
+ for (clrptr = &START_BSS; clrptr < &END_BSS; clrptr++) {
+ *clrptr = 0;
+ }
+ }
+
+ /* Copy writable data from flash to RAM. */
+ unsigned int *srcptr, *destptr;
+
+ /*
+ * The _data_start symbol points to the start of data IN FLASH.
+ * It is defined by flash.ld at application link time. If flash.ld
+ * is not used, it is defined (on the link line) as 0.
+ */
+ static int *data_start_addr = &_data_start;
+
+ if (data_start_addr != 0) {
+ for (srcptr = &_data_start, destptr = &START_DATA;
+ destptr < &END_DATA;
+ srcptr++, destptr++) {
+ *destptr = *srcptr;
+ }
+ }
+
+#define OS_LINKAGE_VERSION 4
+ link_check.version = OS_LINKAGE_VERSION;
+ link_check.table = _A_MAGPIE_INDIRECTION_TABLE_SIZE;
+
+ return A_CMN(hal_linkage_check(sizeof(link_check), &link_check));
+}
+
+#endif /* __ATHOS_API_H__ */
+
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+/*
+ * @File: dma_engine_api.h
+ *
+ * @Abstract: DMA Engine api
+ *
+ * @Notes:
+ */
+
+#ifndef _DMA_ENGINE_API_H
+#define _DMA_ENGINE_API_H
+
+#include <vbuf_api.h>
+#include <vdesc_api.h>
+
+struct zsDmaDesc
+{
+#if 1 // BIG_ENDIAN
+ volatile u16_t ctrl; // Descriptor control
+ volatile u16_t status; // Descriptor status
+ volatile u16_t totalLen; // Total length
+ volatile u16_t dataSize; // Data size
+#else
+ volatile u16_t status; // Descriptor status
+ volatile u16_t ctrl; // Descriptor control
+ volatile u16_t dataSize; // Data size
+ volatile u16_t totalLen; // Total length
+#endif
+ struct zsDmaDesc* lastAddr; // Last address of this chain
+ volatile u32_t dataAddr; // Data buffer address
+ struct zsDmaDesc* nextAddr; // Next TD address
+};
+
+struct zsDmaQueue
+{
+ struct zsDmaDesc* head;
+ struct zsDmaDesc* terminator;
+};
+
+// Subclass of zsDmaQueue for TX
+struct zsTxDmaQueue
+{
+ struct zsDmaDesc* head;
+ struct zsDmaDesc* terminator;
+
+ /* Below are fields specific to TX */
+ VBUF *xmited_buf_head;
+ VBUF *xmited_buf_tail;
+};
+
+/* hardware API table structure (API descriptions below) */
+struct dma_engine_api
+{
+ void (*_init)();
+
+ void (*_init_rx_queue)(struct zsDmaQueue *q);
+
+ void (*_init_tx_queue)(struct zsTxDmaQueue *q);
+
+ void (*_config_rx_queue)(struct zsDmaQueue *q, int num_desc, int buf_size);
+
+ void (*_xmit_buf)(struct zsTxDmaQueue *q, VBUF *buf);
+
+ void (*_flush_xmit)(struct zsDmaQueue *q);
+
+ VBUF* (*_reap_recv_buf)(struct zsDmaQueue *q);
+
+ void (*_return_recv_buf)(struct zsDmaQueue *q, VBUF *buf);
+
+ VBUF* (*_reap_xmited_buf)(struct zsTxDmaQueue *q);
+
+ void (*_swap_data)(struct zsDmaDesc* desc);
+
+ int (*_has_compl_packets)(struct zsDmaQueue *q);
+
+ void (*_desc_dump)(struct zsDmaQueue *q);
+
+ /* The functions below are for patchable */
+ struct zsDmaDesc* (*_get_packet)(struct zsDmaQueue* q);
+ void (*_reclaim_packet)(struct zsDmaQueue* q, struct zsDmaDesc* desc);
+ void (*_put_packet)(struct zsDmaQueue* q, struct zsDmaDesc* desc);
+
+ /* room to expand this table by another table */
+ void *pReserved;
+};
+
+extern void dma_engine_module_install(struct dma_engine_api *apis);
+
+#endif /* #ifndef _DMA_ENGINE_API_H */
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+#ifndef __DMA_LIB_H
+#define __DMA_LIB_H
+
+
+/***********************External***************************/
+
+/**
+ * @brief DMA engine numbers, HIF need to map them to there
+ * respective order
+ */
+typedef enum dma_engine{
+ DMA_ENGINE_RX0,
+ DMA_ENGINE_RX1,
+ DMA_ENGINE_RX2,
+ DMA_ENGINE_RX3,
+ DMA_ENGINE_TX0,
+ DMA_ENGINE_TX1,
+ DMA_ENGINE_MAX
+}dma_engine_t;
+
+/**
+ * @brief Interface type, each HIF should call with its own interface type
+ */
+typedef enum dma_iftype{
+ DMA_IF_GMAC = 0x0,/* GMAC */
+ DMA_IF_PCI = 0x1,/*PCI */
+ DMA_IF_PCIE = 0x2 /*PCI Express */
+}dma_iftype_t;
+
+
+struct dma_lib_api{
+ A_UINT16 (*tx_init)(dma_engine_t eng_no, dma_iftype_t if_type);
+ void (*tx_start)(dma_engine_t eng_no);
+ A_UINT16 (*rx_init)(dma_engine_t eng_no, dma_iftype_t if_type);
+ void (*rx_config)(dma_engine_t eng_no, a_uint16_t num_desc,
+ a_uint16_t gran);
+ void (*rx_start)(dma_engine_t eng_no);
+ A_UINT32 (*intr_status)(dma_iftype_t if_type);
+ A_UINT16 (*hard_xmit)(dma_engine_t eng_no, VBUF *buf);
+ void (*flush_xmit)(dma_engine_t eng_no);
+ A_UINT16 (*xmit_done)(dma_engine_t eng_no);
+ VBUF * (*reap_xmitted)(dma_engine_t eng_no);
+ VBUF * (*reap_recv)(dma_engine_t eng_no);
+ void (*return_recv)(dma_engine_t eng_no, VBUF *buf);
+ A_UINT16 (*recv_pkt)(dma_engine_t eng_no);
+};
+
+
+/**
+ * @brief Install the DMA lib api's this for ROM patching
+ * support
+ *
+ * @param apis
+ */
+void dma_lib_module_install(struct dma_lib_api *apis);
+
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+#ifndef __EEPROM_API_H__
+#define __EEPROM_API_H__
+
+typedef enum {
+ RET_SUCCESS = 0,
+ RET_NOT_INIT,
+ RET_NOT_EXIST,
+ RET_EEP_CORRUPT,
+ RET_EEP_OVERFLOW,
+
+ // add return code from here
+ RET_UNKNOWN
+} T_EEP_RET;
+
+
+/*!- interface of eeprom access
+ *
+ */
+struct eep_api {
+ void (* _eep_init)(void);
+ T_EEP_RET (* _eep_read)(uint16_t, uint16_t, uint16_t *);
+ T_EEP_RET (* _eep_write)(uint16_t, uint16_t, uint16_t *);
+ T_EEP_RET (*_eep_is_exist)(void);
+};
+
+#endif /* __EEPROM_API_H__ */
+
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+/*
+ * @File: HIF_api.h
+ *
+ * @Abstract: Host Interface api
+ *
+ * @Notes:
+ */
+
+#ifndef _HIF_API_H
+#define _HIF_API_H
+
+#include <adf_nbuf.h>
+
+/* mailbox hw module configuration structure */
+typedef struct _HIF_CONFIG {
+ int dummy;
+} HIF_CONFIG;
+
+typedef struct _HIF_CALLBACK {
+ /* callback when a buffer has be sent to the host*/
+ void (*send_buf_done)(adf_nbuf_t buf, void *context);
+ /* callback when a receive message is received */
+ void (*recv_buf)(adf_nbuf_t hdr_buf, adf_nbuf_t buf, void *context);
+ /* context used for all callbacks */
+ void *context;
+} HIF_CALLBACK;
+
+typedef void* hif_handle_t;
+
+/* hardware API table structure (API descriptions below) */
+struct hif_api {
+ hif_handle_t (*_init)(HIF_CONFIG *pConfig);
+
+ void (* _shutdown)(hif_handle_t);
+
+ void (*_register_callback)(hif_handle_t, HIF_CALLBACK *);
+
+ int (*_get_total_credit_count)(hif_handle_t);
+
+ void (*_start)(hif_handle_t);
+
+ void (*_config_pipe)(hif_handle_t handle, int pipe, int creditCount);
+
+ int (*_send_buffer)(hif_handle_t handle, int pipe, adf_nbuf_t buf);
+
+ void (*_return_recv_buf)(hif_handle_t handle, int pipe, adf_nbuf_t buf);
+ //void (*_set_recv_bufsz)(int pipe, int bufsz);
+ //void (*_pause_recv)(int pipe);
+ //void (*_resume_recv)(int pipe);
+ int (*_is_pipe_supported)(hif_handle_t handle, int pipe);
+
+ int (*_get_max_msg_len)(hif_handle_t handle, int pipe);
+
+ int (*_get_reserved_headroom)(hif_handle_t handle);
+
+ void (*_isr_handler)(hif_handle_t handle);
+
+ void (*_get_default_pipe)(hif_handle_t handle, A_UINT8 *pipe_uplink, A_UINT8 *pipe_downlink);
+
+ /* room to expand this table by another table */
+ void *pReserved;
+};
+
+extern void hif_module_install(struct hif_api *apis);
+extern void generic_hif_module_install(struct hif_api *apis);
+
+#endif /* #ifndef _HIF_API_H */
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+#ifndef __HIF_GMAC_H
+#define __HIF_GMAC_H
+
+#include <adf_os_types.h>
+#include <hif_api.h>
+
+
+#define ETH_ALEN 6
+#define GMAC_MAX_PKT_LEN 1600
+#define GMAC_MAX_DESC 5
+
+#define GMAC_DISCV_PKT_SZ 60
+#define GMAC_DISCV_WAIT 2000
+
+#define ATH_P_MAGBOOT 0x12 /*Magpie GMAC 18 for boot downloader*/
+#define ATH_P_MAGNORM 0x13 /*Magpie GMAC 19 for HTC & others*/
+
+#define ETH_P_ATH 0x88bd
+
+typedef enum hif_gmac_pipe{
+ HIF_GMAC_PIPE_RX = 1, /*Normal Priority RX*/
+ HIF_GMAC_PIPE_TX = 2, /*Normal Priority TX*/
+}hif_gmac_pipe_t;
+
+struct gmac_api{
+ void (*gmac_boot_init)(void);
+};
+
+void cmnos_gmac_module_install(struct gmac_api *boot_apis);
+void hif_gmac_module_install(struct hif_api *apis);
+
+
+#endif
+
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+
+#ifndef __HIF_PCI_H
+#define __HIF_PCI_H
+
+#include <hif_api.h>
+#include <dma_lib.h>
+
+
+#define PCI_MAX_DATA_PKT_LEN 1664
+#define PCI_MAX_CMD_PKT_LEN 512
+#define PCI_MAX_BOOT_DESC 2
+
+typedef enum hif_pci_pipe_rx{
+ HIF_PCI_PIPE_RX0, /*Normal Priority RX*/
+ HIF_PCI_PIPE_RX1,
+ HIF_PCI_PIPE_RX2,
+ HIF_PCI_PIPE_RX3,
+ HIF_PCI_PIPE_RX_MAX
+}hif_pci_pipe_rx_t;
+
+typedef enum hif_pci_pipe_tx{
+ HIF_PCI_PIPE_TX0, /*Normal Priority TX*/
+ HIF_PCI_PIPE_TX1,
+ HIF_PCI_PIPE_TX_MAX
+}hif_pci_pipe_tx_t;
+
+typedef struct __pci_softc{
+ HIF_CALLBACK sw;
+}__pci_softc_t;
+
+struct hif_pci_api{
+ void (*pci_boot_init)(void);
+ hif_handle_t (*pci_init)(HIF_CONFIG *pConfig);
+ void (*pci_reset)(void);
+ void (*pci_enable)(void);
+ void (*pci_reap_xmitted)(__pci_softc_t *sc,
+ dma_engine_t eng_no);
+ void (*pci_reap_recv)(__pci_softc_t *sc, dma_engine_t eng_no);
+ A_UINT8 (*pci_get_pipe)(dma_engine_t eng);
+ dma_engine_t (*pci_get_tx_eng)(hif_pci_pipe_tx_t pipe);
+ dma_engine_t (*pci_get_rx_eng)(hif_pci_pipe_rx_t pipe);
+
+};
+
+void hif_pci_api_install(struct hif_pci_api *apis);
+void hif_pci_module_install(struct hif_api *apis);
+#endif
+
+
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+/*
+ * @File: mbox_hw.h
+ *
+ * @Abstract: mailbox hardware definitions
+ *
+ * @Notes:
+ */
+
+#ifndef __HIF_USB_H__
+#define __HIF_USB_H__
+
+#include <sys_cfg.h>
+#include <vdesc_api.h>
+//#include <desc.h>
+#include <dma_engine_api.h>
+
+#define HIF_USB_PIPE_TX 1
+#define HIF_USB_PIPE_RX 2
+#define HIF_USB_PIPE_INTERRUPT 3
+#define HIF_USB_PIPE_COMMAND 4
+#define HIF_USB_PIPE_HP_TX 5
+#define HIF_USB_PIPE_MP_TX 6
+
+struct VBUF_QUEUE
+{
+ VBUF *head;
+ VBUF *tail;
+};
+
+ /* the mailbox hardware layer context */
+typedef struct _HIF_USB_CONTEXT {
+ HIF_CALLBACK hifCb;
+ struct zsDmaQueue dnQ;
+ struct zsTxDmaQueue upQ;
+#if SYSTEM_MODULE_HP_EP5
+ struct zsDmaQueue hpdnQ; // high priority
+#endif
+#if SYSTEM_MODULE_HP_EP6
+ struct zsDmaQueue mpdnQ; // medium priority
+#endif
+ //struct VBUF_QUEUE upVbufQ;
+ VBUF *cmdQueue;
+ struct VBUF_QUEUE eventBufQ;
+
+ // Left a door for extension the structure
+ void *pReserved;
+} HIF_USB_CONTEXT;
+
+
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+#ifndef __INTR_API_H__
+#define __INTR_API_H__
+
+/*
+ * Interrupt handler, for application-managed interrupts.
+ * When an interrupt occurs, it is automatically disabled.
+ * See A_WMAC_INTR_ATTACH() and A_MBOX_INTR_ATTACH().
+ *
+ * If a handler returns A_HANDLER_DONE, the interrupt is
+ * re-enabled. The OS calls the handler next time service
+ * is required. This is the normal case for a handler.
+ *
+ * If a handler returns A_HANDLER_YIELD, the interrupt
+ * remains masked. The handler is called again when
+ * it is "convenient". This gives the OS an opportunity
+ * to run other code/handlers. A handler should return
+ * A_HANDLER_YIELD if it might dominate the CPU for too
+ * long.
+ *
+ * If a handler returns A_HANDLER_NOENABLE, the interrupt
+ * remains disabled. It is up to the application to re-enable
+ * the interrupt (via A_*_INTR_UNMASK) when it's appropriate.
+ *
+ * Note that many combinations of interrupt functions and
+ * interrupt vectors are NOT supported: Callers should use
+ * only the macros defined in cmnos_api.h to access the
+ * interrupt API.
+ */
+#include "cmnos_api.h"
+
+typedef uint32_t A_old_intr_t;
+
+//////////////////////////////////////////////////////////////////
+// this is copied from mercury/cmnos_xtensa.h
+/*
+ * These are CMNOS interrupt manifest constants.
+ * They have specially-chosen values that align with hardware and or
+ * operating system values (see cmnos_interrupt_info).
+ */
+#if defined(__XTENSA__)
+/*
+ * Enumeration of low and medium priority interrupt numbers
+ * which match the CPU hardware configuration:
+ */
+
+/* XTensa Level 1 interrupt */
+#define A_INUM_SOFTWARE 0 /* currently unused */
+
+/* XTensa Level2 interrupts */
+#define A_INUM_XTTIMER 1 /* Tensilica timer */
+#define A_INUM_TBD_2 2 /* TBD */
+#define A_INUM_CPU_WDT 3 /* RST_CPU watchodg interrupt */
+#define A_INUM_TBD_4 4 /* TBD */
+#define A_INUM_TBD_5 5 /* TBD */
+#define A_INUM_TBD_6 6 /* TBD */
+#define A_INUM_CPU_GEN_TIMER 7 /* CPU general timer */
+#define A_INUM_TBD_8 8 /* TBD */
+#define A_INUM_TBD_9 9 /* TBD */
+#define A_INUM_USB_CTRL 10 /* USB core control */
+#define A_INUM_USB_DMA 11 /* USB DMA */
+#define A_INUM_TBD_12 12 /* TBD */
+#define A_INUM_TBD_13 13 /* TBD */
+#define A_INUM_TBD_14 14 /* TBD */
+
+/* Level 3 interrupts */
+#define A_INUM_ERROR 15 /* Errors (e.g. access illegal address) */
+#define A_INUM_TBD_16 16 /* TBD */
+#define A_INUM_MAC 17 /* MAC */
+
+/* Level 5 interrupts */
+#define A_INUM_CPU_NMI 18 /* CPU NMI */
+
+/* Number of interrupts that map directly into CPU/hal interrupt bits. */
+#define NUM_DIRECT_INTR 19
+
+#endif
+//////////////////////////////////////////////////////////////////
+
+#define CMNOS_IMASK_XTTIMER (1<<A_INUM_XTTIMER)
+#define CMNOS_IMASK_CPU_WDT (1<<A_INUM_CPU_WDT)
+#define CMNOS_IMASK_CPU_GEN_TIMER (1<<A_INUM_CPU_GEN_TIMER)
+#define CMNOS_IMASK_USB_CTRL (1<<A_INUM_USB_CTRL)
+#define CMNOS_IMASK_USB_DMA (1<<A_INUM_USB_DMA)
+#define CMNOS_IMASK_ERROR (1<<A_INUM_ERROR)
+#define CMNOS_IMASK_MAC (1<<A_INUM_MAC)
+#define CMNOS_IMASK_CPU_NMI (1<<A_INUM_CPU_NMI)
+
+typedef enum inum_intr {
+ A_INTR_TIMER = 0,
+ A_INTR_USB_CTRL,
+ A_INTR_USB_DMA,
+ A_INTR_ERROR,
+ /* add intr above here */
+ A_INTR_NUM
+} A_INUM_INTR_T;
+
+//////////////////////////////////////////////////////////////////
+
+/*
+ * An interrupt handler, which is a function called in response
+ * to a hardware interrupt, possibly as a Delayed Service Routine.
+ */
+typedef int (* A_handler_t)(void *);
+/* Return values from a handler/DSR, A_handler_t */
+#define A_HANDLER_NOENABLE 0 /* do not re-enable interrupts */
+#define A_HANDLER_DONE 1 /* all intrs handled, call on next intr */
+#define A_HANDLER_YIELD 2 /* leave intrs disabled and
+ call back later regardless of intr state */
+
+/*
+ * An Interrupt Service Routine, which must be called
+ * directly in interrupt context (not delayed), and which
+ * must be very small and may not have access to all OS
+ * functions. These are for use only when interrupt
+ * latency is critical; otherwise, an A_handler_t ("dsr")
+ * is preferable.
+ */
+typedef uint32_t (* A_isr_t)(void *);
+/* Return values from an ISR */
+#if defined(CYG_ISR_HANDLED)
+#define A_ISR_HANDLED CYG_ISR_HANDLED
+#define A_ISR_CALL_DSR CYG_ISR_CALL_DSR
+#else
+#define A_ISR_HANDLED 1
+#define A_ISR_CALL_DSR 2
+#endif
+
+struct intr_api {
+ void (*_intr_init)(void);
+ uint32_t (* _intr_invoke_isr)(uint32_t inum);
+ A_old_intr_t(* _intr_disable)(void);
+ void (* _intr_restore)(A_old_intr_t);
+
+ void (* _intr_mask_inum)(uint32_t inum);
+ void (* _intr_unmask_inum)(uint32_t inum);
+ void (* _intr_attach_isr)(uint32_t inum, A_isr_t isr, void *arg);
+ /* Low-level interrupt access, intended for use by OS modules */
+ unsigned int (* _get_intrenable)(void);
+ void (* _set_intrenable)(unsigned int);
+ unsigned int (* _get_intrpending)(void);
+ void (* _unblock_all_intrlvl)(void);
+};
+
+#endif /* __INTR_API_H__ */
*/
/*
* @File: Magpie_api.h
- *
+ *
* @Abstract: Magpie FW api
- *
+ *
* @Notes:
*/
#ifndef _MAGPIE_API_H
#define _MAGPIE_API_H
+#include <dbg_api.h>
#include <sys_cfg.h>
+
#include "cmnos_api.h"
#include "vbuf_api.h"
#include "vdesc_api.h"
#define dma_lib_tx_init(eng_no, if_type) A_INDIR(dma_lib.tx_init(eng_no, if_type))
#define dma_lib_rx_init(eng_no, if_type) A_INDIR(dma_lib.rx_init(eng_no, if_type))
#define dma_lib_rx_config(eng_no, desc, gran) A_INDIR(dma_lib.rx_config(eng_no, desc, gran))
-#define dma_lib_tx_start(eng_no) A_INDIR(dma_lib.tx_start(eng_no))
-#define dma_lib_rx_start(eng_no) A_INDIR(dma_lib.rx_start(eng_no))
+#define dma_lib_tx_start(eng_no) A_INDIR(dma_lib.tx_start(eng_no))
+#define dma_lib_rx_start(eng_no) A_INDIR(dma_lib.rx_start(eng_no))
#define dma_lib_intr_status(if_type) A_INDIR(dma_lib.intr_status(if_type))
#define dma_lib_hard_xmit(eng_no, buf) A_INDIR(dma_lib.hard_xmit(eng_no, buf))
#define dma_lib_flush_xmit(eng_no) A_INDIR(dma_lib.flush_xmit(eng_no))
#define HIF_init(pConfig) A_INDIR(hif._init(pConfig))
#define HIF_shutdown(h) A_INDIR(hif._shutdown(h))
#define HIF_register_callback(h, pConfig) A_INDIR(hif._register_callback(h, pConfig))
-#define HIF_start(h) A_INDIR(hif._start(h))
-#define HIF_config_pipe(h, pipe, desc_list) A_INDIR(hif._config_pipe(h, pipe, desc_list))
-#define HIF_send_buffer(h, pipe, buf) A_INDIR(hif._send_buffer(h, pipe, buf))
-#define HIF_return_recv_buf(h, pipe, buf) A_INDIR(hif._return_recv_buf(h, pipe, buf))
-#define HIF_isr_handler(h) A_INDIR(hif._isr_handler(h))
+#define HIF_start(h) A_INDIR(hif._start(h))
+#define HIF_config_pipe(h, pipe, desc_list) A_INDIR(hif._config_pipe(h, pipe, desc_list))
+#define HIF_send_buffer(h, pipe, buf) A_INDIR(hif._send_buffer(h, pipe, buf))
+#define HIF_return_recv_buf(h, pipe, buf) A_INDIR(hif._return_recv_buf(h, pipe, buf))
+#define HIF_isr_handler(h) A_INDIR(hif._isr_handler(h))
#define HIF_is_pipe_supported(h, pipe) A_INDIR(hif._is_pipe_supported(h, pipe))
#define HIF_get_max_msg_len(h, pipe) A_INDIR(hif._get_max_msg_len(h, pipe))
#define HIF_get_reserved_headroom(h) A_INDIR(hif._get_reserved_headroom(h))
#define HTC_GetReservedHeadroom(h) A_INDIR(htc._HTC_GetReservedHeadroom(h))
#define HTC_NotifyTargetInserted(h)
-#define HTC_NotifyTargetDetached(h)
+#define HTC_NotifyTargetDetached(h)
/* WMI SVC module */
#define WMI_SERVICE_MODULE_INSTALL() WMI_service_module_install(&_A_MAGPIE_INDIRECTION_TABLE->wmi_svc_api)
struct sflash_api sflash;
struct hif_api hif;
struct htc_apis htc;
- WMI_SVC_APIS wmi_svc_api;
+ WMI_SVC_APIS wmi_svc_api;
struct usbfifo_api usbfifo_api;
struct buf_pool_api buf_pool;
struct vbuf_api vbuf;
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __ALLOCRAM_API_H__
-#define __ALLOCRAM_API_H__
-
-/* API for Target-side startup-time RAM allocations */
-
-struct allocram_api {
- /*
- * Initialize allocram, providing it with a block of RAM
- * (an "arena") from which to allocate.
- *
- * If arena_start is 0, a default start -- the end of
- * the application's text & data -- is used.
- *
- * If arena_sz is 0, a default size -- which uses most
- * of physical RAM beyond arena_start -- is used.
- *
- * Return value is reserved for future use -- it's an arena handle.
- */
- void *(* cmnos_allocram_init)(void *arena_start, A_UINT32 arena_sz);
-
- /*
- * Allocate nbytes of memory, returning a pointer to the start
- * of the allocated block. Allocation size is rounded up to the
- * nearest A_CACHE_LINE_SIZE and the returned address similarly
- * aligned.
- *
- * There is no need to check the return value from this function.
- * A failure to satisfy a RAM allocation request is treated as a
- * fatal error.
- *
- * Allocations are expected to occur only during startup; this
- * API does not, for instance, guarantee atomicity with respect
- * to allocations that might (foolishly) be attempted from
- * interrupt handlers.
- *
- * The "which_arena" parameter is currently unused, and should
- * be set to 0 -- only a single arena is currently supported.
- */
- void *(* cmnos_allocram)(void *which_arena, A_UINT32 nbytes);
-
- void (* cmnos_allocram_debug)(void);
-};
-
-extern void allocram_module_install(struct allocram_api *api);
-
-
-#endif /* __ALLOCRAM_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __ATHOS_API_H__
-#define __ATHOS_API_H__
-
-/*
- * This file contains wrappers to OS operating system functions
- * that are available in the Athos version of the operating system.
- *
- * Target software must always use these wrappers to access OS
- * services -- it may not access any OS services directly.
- *
- * These wrappers are intended to provide OS-independence for applications.
- * Using this header file, an application should be able to compile and
- * fully link without any other OS header files, source files, or
- * binary files.
- */
-
-#include <osapi.h>
-#include "dt_defs.h"
-#include "cmnos_api.h"
-#include "Magpie_api.h"
-
-/* ROM Patch API */
-
-/* save the ROM printf function point */
-extern int (* save_cmnos_printf)(const char * fmt, ...);
-
-extern unsigned int _data_start_in_rom;
-extern unsigned int _data_start;
-extern unsigned int _data_end;
-extern unsigned int _bss_start;
-extern unsigned int _bss_end;
-extern unsigned int _stack_sentry;
-extern unsigned int __stack;
-extern unsigned int _fw_image_end;
-
-#if defined(__XTENSA__)
-#define START_DATA _data_start
-#define END_DATA _data_end
-#define START_BSS _bss_start
-#define END_BSS _bss_end
-
-#define STACK_START _stack_sentry
-#define STACK_END __stack
-#endif
-
-struct _A_os_linkage_check {
- int version;
- int table;
-};
-
-/*
- * A_INIT() handles any initialization needed by the OS abstraction,
- * and it clears the application's BSS, if necessary. (Application BSS
- * is not cleared if the application is linked into a single image that
- * includes AthOS.)
- *
- * A_INIT() must be called first thing in the application (from app_start)
- * in order to guarantee that BSS has been cleared properly.
- */
-static INLINE int
-A_INIT(void)
-{
- struct _A_os_linkage_check link_check;
- unsigned int *clrptr;
-
- if (&START_BSS != _A_MAGPIE_INDIRECTION_TABLE->cmnos.start_bss) {
- /* Clear BSS */
- for (clrptr = &START_BSS; clrptr < &END_BSS; clrptr++) {
- *clrptr = 0;
- }
- }
-
- /* Copy writable data from flash to RAM. */
- unsigned int *srcptr, *destptr;
-
- /*
- * The _data_start symbol points to the start of data IN FLASH.
- * It is defined by flash.ld at application link time. If flash.ld
- * is not used, it is defined (on the link line) as 0.
- */
- static int *data_start_addr = &_data_start;
-
- if (data_start_addr != 0) {
- for (srcptr = &_data_start, destptr = &START_DATA;
- destptr < &END_DATA;
- srcptr++, destptr++) {
- *destptr = *srcptr;
- }
- }
-
-#define OS_LINKAGE_VERSION 4
- link_check.version = OS_LINKAGE_VERSION;
- link_check.table = _A_MAGPIE_INDIRECTION_TABLE_SIZE;
-
- return A_CMN(hal_linkage_check(sizeof(link_check), &link_check));
-}
-
-#endif /* __ATHOS_API_H__ */
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __CLOCK_API_H__
-#define __CLOCK_API_H__
-
-#define TICK_MSEC_RATIO 1
-#define TICK_TO_MSEC(tick) ((tick)/TICK_MSEC_RATIO)
-#define MSEC_TO_TICK(msec) ((msec)* TICK_MSEC_RATIO)
-
-typedef struct date_s {
- uint16_t miliseconds;
- uint16_t seconds;
- uint16_t minutes;
- uint16_t hours;
-} A_DATE_T;
-
-struct clock_api {
- void (* _clock_init)(A_UINT32 ref_clk);
- void (* _clockregs_init)(void);
- A_UINT32 (* _uart_frequency)(void);
- void (* _delay_us)(int);
- void (* _wlan_band_set)(int);
- A_UINT32 (* _refclk_speed_get)(void);
- A_UINT32 (* _milliseconds)(void);
- void (* _sysclk_change)(uint32_t sys_clk);
- A_UINT32 (* _sysclk_get)(void);
-
- void (* _clock_tick)(void);
-};
-
-#endif /* __CLOCK_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __CMNOS_API_H__
-#define __CMNOS_API_H__
-
-/*
- * This file contains wrappers to OS operating system functions
- * that are available in all versions of the operating system.
- *
- * Target software must always use these wrappers to access OS
- * services -- it may not access any OS services directly.
- */
-
-#include "xtensa/config/core.h"
-#include "xtensa/hal.h"
-#include "xtensa/xtruntime.h"
-#include "sys_cfg.h"
-
-/* cmnos interface */
-#include "printf_api.h"
-#include "uart_api.h"
-#include "dbg_api.h"
-#include "mem_api.h"
-#include "misc_api.h"
-#include "string_api.h"
-#include "timer_api.h"
-#include "romp_api.h"
-#include "allocram_api.h"
-#include "tasklet_api.h"
-#include "clock_api.h"
-#include "intr_api.h"
-#include "wdt_api.h"
-#include "eeprom_api.h"
-#include "usb_api.h"
-
-#if defined(PROJECT_K2)
-#if SYSTEM_MODULE_SFLASH
-#include "sflash_api.h"
-#endif
-#endif
-
-#define AR6K_ROM_START 0x004e0000
-#define AR6K_ROM_ADDR(byte_offset) (AR6K_ROM_START+(byte_offset))
-#define TARG_ROM_ADDRS(byte_offset) AR6K_ROM_ADDR(byte_offset)
-
-#define IML_SIGNAL_UNUSED0_ADDR TARG_ROM_ADDRS(0) /* Cannot be used -- aligned */
-#define IML_SIGNAL_ASSERT_ADDR TARG_ROM_ADDRS(1) /* Signal an assertion failure */
-#define IML_SIGNAL_PRINTF_ADDR TARG_ROM_ADDRS(2) /* Signal a printf request */
-#define IML_SIGNAL_UNUSED4_ADDR TARG_ROM_ADDRS(4) /* Cannot be used -- aligned */
-#define IML_SIGNAL_UNUSED8_ADDR TARG_ROM_ADDRS(8) /* Cannot be used -- aligned */
-#define IML_SIGNAL_UNUSEDC_ADDR TARG_ROM_ADDRS(0xc) /* Cannot be used -- aligned */
-#define IML_SIGNAL_MASK 0xfffe000f
-#define IML_LINENUM_SHIFT 4
-
-#define NOW() xthal_get_ccount()
-
-#if defined(__XTENSA__)
-#define _A_BARRIER asm volatile("memw")
-#else
-#define _A_BARRIER
-#endif
-
-#define A_ASSERT( __bool ) \
- do { \
- if (0 == (__bool)) { \
- (void)*((volatile int *)(IML_SIGNAL_ASSERT_ADDR+(__LINE__<<4)));\
- _A_BARRIER; \
- } \
- } while (0)
-
-
-#define A_IML_IS_ASSERT(vaddr) \
- (((vaddr) & IML_SIGNAL_MASK) == (IML_SIGNAL_ASSERT_ADDR & IML_SIGNAL_MASK))
-
-
-#define PRINT_FAILURE_STATE() \
-do { \
- uint32_t epc1, epc2, epc3, epc4; \
- \
- asm volatile("rsr %0,%1" : "=r" (epc1) : "n" (EPC_1)); \
- asm volatile("rsr %0,%1" : "=r" (epc2) : "n" (EPC_2)); \
- asm volatile("rsr %0,%1" : "=r" (epc3) : "n" (EPC_3)); \
- asm volatile("rsr %0,%1" : "=r" (epc4) : "n" (EPC_4)); \
- \
- A_PRINTF("\tepc1=0x%x, epc2=0x%x, epc3=0x%x, epc4=0x%x\n", \
- epc1, epc2, epc3, epc4); \
- A_PRINTF("0x%08x, 0x%08x, 0x%08x, \n\r", \
- DEBUG_SYSTEM_STATE, WATCH_DOG_RESET_COUNTER, \
- WATCH_DOG_MAGIC_PATTERN); \
-} while(0)
-////////////////////////////////////////////////////////////////////////////////////
-
-
-//#define A_CMN(sym) _A_OS_INDIRECTION_TABLE->cmnos.sym
-#define A_CMN(sym) _A_MAGPIE_INDIRECTION_TABLE->cmnos.sym
-
-#if SYSTEM_MODULE_MEM
-/* Mem interfaces */
-#define A_MEMSET(addr, value, size) \
- A_CMN(mem._memset((char *)(addr), (int)(value), (int)(size)))
-
-#define A_MEMZERO(addr, size) \
- A_CMN(mem._memset((char *)(addr), (int)0, (int)(size)))
-
-#define A_MEMCPY(dst, src, size) \
- A_CMN(mem._memcpy((char *)(dst), (char *)(src), (int)(size)))
-
-#define A_MEMMOVE(dst, src, size) \
- A_CMN(mem._memmove((char *)(dst), (char *)(src), (int)(size)))
-
-#define A_MEMCMP(p1, p2, nbytes) \
- A_CMN(mem._memcmp)((void *)(p1), (void *)(p2), (int)(nbytes))
-#else
-/* Mem interfaces */
-#define A_MEMSET(addr, value, size)
-
-#define A_MEMZERO(addr, size)
-
-#define A_MEMCPY(dst, src, size)
-
-#define A_MEMMOVE(dst, src, size)
-
-#define A_MEMCMP(p1, p2, nbytes)
-#endif
-
-
-#if 1
- /* String interfaces */
- #define A_STRCPY(dst, src) A_CMN(string._strcpy((dst), (src)))
- #define A_STRNCPY(dst, src, n) A_CMN(string._strncpy((dst), (src), (n)))
- #define A_STRLEN(str) A_CMN(string._strlen(str))
- #define A_STRCMP(str1, str2) A_CMN(string._strcmp((str1), (str2)))
- #define A_STRNCMP(str1, str2, n) A_CMN(string._strncmp((str1), (str2), (n)))
-#endif
-
-#if SYSTEM_MODULE_PRINT
-/* Printf support */
-#define A_PRINTF_INIT() A_CMN(printf._printf_init())
-#define A_PRINTF A_CMN(printf._printf)
-#else
-#define A_PRINTF_INIT()
-#define A_PRINTF
-#endif /* SYSTEM_MODULE_PRINT */
-
-#if SYSTEM_MODULE_UART
-/* Serial port support */
-#define A_UART_INIT() A_CMN(uart._uart_init())
-
-#define A_UART_HWINIT(freq, baud) \
- A_CMN(uart._uart_hwinit((freq), (baud)))
-
-#define A_UART_ENABLED() (HOST_INTEREST->hi_uart_enable)
-
-#define A_PUTS(str) A_CMN(uart._uart_str_out(str))
-
-#define A_PUTC(ch) A_CMN(uart._uart_char_put(ch))
-#define A_GETC(pCh) A_CMN(uart._uart_char_get(pCh))
-
-#define A_UART_TASK() A_CMN(uart._uart_task())
-#define A_UART_CONFIG(x) A_CMN(uart._uart_config(x))
-
-#else
-
-#define A_UART_INIT()
-
-#define A_UART_HWINIT(freq, baud)
-
-#define A_UART_ENABLED()
-
-#define A_PUTS(str)
-
-#define A_PUTC(ch)
-#define A_GETC(pCh)
-
-#define A_UART_TASK()
-#define A_UART_CONFIG(x)
-
-#endif
-
-#if SYSTEM_MODULE_MISC
-/* Reset Support */
-#define A_RESET() A_CMN(misc._system_reset())
-#define A_RESET_MAC() A_CMN(misc._mac_reset())
-
-/* Assertion failure */
-#define A_ASSFAIL(regdump) A_CMN(misc._assfail((regdump)))
-
-/* Report a failure to the Host */
-#define A_REPORT_FAILURE(data, len) \
- A_CMN(misc._report_failure_to_host((data), (len)))
-
-/* UNALIGNED references are used for ASSERTs */
-#define A_MISALIGNED_LOAD_HANDLER(dump) A_CMN(misc._misaligned_load_handler(dump))
-
-/* reture the host interface type */
-#define A_IS_HOST_PRESENT() A_CMN(misc._is_host_present())
-#define A_KBHIT(delay) A_CMN(misc._kbhit(delay))
-#define A_GET_ROM_VER() A_CMN(misc._rom_version_get())
-#else
-/* Reset Support */
-#define A_RESET()
-#define A_RESET_MAC()
-
-/* Assertion failure */
-#define A_ASSFAIL(regdump)
-
-#define A_MISALIGNED_LOAD_HANDLER(dump)
-
-/* Report a failure to the Host */
-#define A_REPORT_FAILURE(data, len)
-
-#define A_IS_HOST_PRESENT()
-#define A_KBHIT(delay)
-#define A_GET_ROM_VER()
-#endif
-
-#if SYSTEM_MODULE_USB
-/* debug Support */
-#define A_USB_INIT() A_CMN(usb._usb_init())
-#define A_USB_ROM_TASK() A_CMN(usb._usb_rom_task())
-#define A_USB_FW_TASK() A_CMN(usb._usb_fw_task())
-#define A_USB_INIT_PHY() A_CMN(usb._usb_init_phy())
-
-#define A_USB_EP0_SETUP() A_CMN(usb._usb_ep0_setup())
-#define A_USB_EP0_TX_DATA() A_CMN(usb._usb_ep0_tx_data())
-#define A_USB_EP0_RX_DATA() A_CMN(usb._usb_ep0_rx_data())
-
-#define A_USB_GET_CONFIG() A_CMN(usb._usb_get_configuration())
-#define A_USB_SET_CONFIG() A_CMN(usb._usb_set_configuration())
-
-#define A_USB_GET_INTERFACE() A_CMN(usb._usb_get_interface())
-#define A_USB_SET_INTERFACE() A_CMN(usb._usb_set_interface())
-
-#define A_USB_STANDARD_CMD() A_CMN(usb._usb_standard_cmd())
-#define A_USB_VENDOR_CMD() A_CMN(usb._usb_vendor_cmd())
-
-#define A_USB_POWER_OFF() A_CMN(usb._usb_power_off())
-#define A_USB_RESET_FIFO() A_CMN(usb._usb_reset_fifo())
-#define A_USB_GEN_WDT() A_CMN(usb._usb_gen_wdt())
-#define A_USB_JUMP_BOOT() A_CMN(usb._usb_jump_boot())
-
-#define A_USB_GET_DESCRIPTOR() A_CMN(usb._usb_get_descriptor())
-#define A_USB_SET_ADDRESS() A_CMN(usb._usb_set_address())
-#define A_USB_SET_FEATURE() A_CMN(usb._usb_set_feature())
-#define A_USB_CLEAR_FEATURE() A_CMN(usb._usb_clr_feature())
-
-#define A_USB_GET_STATUS() A_CMN(usb._usb_get_status())
-#define A_USB_SETUP_DESC() A_CMN(usb._usb_setup_desc())
-#define A_USB_STATUS_IN() A_CMN(usb._usb_status_in())
-#define A_USB_REG_OUT() A_CMN(usb._usb_reg_out())
-
-#define A_USB_EP0_TX() A_CMN(usb._usb_ep0_tx())
-#define A_USB_EP0_RX() A_CMN(usb._usb_ep0_rx())
-#define A_USB_CLK_INIT() A_CMN(usb._usb_clk_init())
-
-#else
-#define A_USB_INIT()
-#define A_USB_TASK()
-#define A_USB_INIT_PHY()
-
-#define A_USB_EP0_SETUP()
-#define A_USB_EP0_TX()
-#define A_USB_EP0_RX()
-
-#define A_USB_GET_CONFIG()
-#define A_USB_SET_CONFIG()
-
-#define A_USB_GET_INTERFACE()
-#define A_USB_SET_INTERFACE()
-
-#define A_USB_STANDARD_CMD()
-#define A_USB_VENDOR_CMD()
-
-#define A_USB_POWER_OFF()
-#define A_USB_RESET_FIFO()
-#define A_USB_GEN_WDT()
-#define A_USB_JUMP_BOOT()
-
-#define A_USB_GET_DESCRIPTOR()
-#define A_USB_SET_ADDRESS()
-#define A_USB_SET_FEATURE()
-#define A_USB_CLEAR_FEATURE()
-
-#define A_USB_GET_STATUS()
-#define A_USB_SETUP_DESC()
-
-
-#define A_USB_STATUS_IN()
-#define A_USB_REG_OUT()
-
-#define A_USB_EP0_TX()
-#define A_USB_EP0_RX()
-
-#define A_USB_CLK_INIT()
-#endif
-
-#if SYSTEM_MODULE_INTR
-/* Low-level interrupt support intended for use by OS modules */
-#define A_INTR_GET_INTRENABLE() A_CMN(intr._get_intrenable())
-#define A_INTR_SET_INTRENABLE(val) A_CMN(intr._set_intrenable(val))
-#define A_INTR_GET_INTRPENDING() A_CMN(intr._get_intrpending())
-#define A_INTR_UNBLOCK_ALL_INTRLVL() A_CMN(intr._unblock_all_intrlvl())
-
-/* Interrupt support */
-#define A_INTR_INIT() A_CMN(intr._intr_init())
-
-#define A_INTR_DISABLE(pOld) \
- do { \
- *(pOld) = A_CMN(intr._intr_disable()); \
- } while (0)
-
-#define A_INTR_RESTORE(old) A_CMN(intr._intr_restore((old)))
-
-#define A_INVOKE_ISR(inum) A_CMN(intr._intr_invoke_isr(inum))
-
-#define A_INTR_MASK(inum) A_CMN(intr._intr_mask_inum(inum))
-#define A_INTR_UNMASK(inum) A_CMN(intr._intr_unmask_inum(inum))
-
-#define A_ATTACH_ISR(inum, isr, arg) A_CMN(intr._intr_attach_isr(inum, isr, arg))
-#else
-#define A_INTR_INIT()
-#define A_INTR_DISABLE(pOld)
-#define A_INTR_RESTORE(old)
-
-#define A_INTR_GET_INTRENABLE()
-#define A_INTR_SET_INTRENABLE(val)
-#define A_INTR_GET_INTRPENDING()
-#define A_INTR_UNBLOCK_ALL_INTRLVL()
-#define A_INVOKE_ISR(inum)
-#define A_INTR_MASK(inum)
-#define A_INTR_UNMASK(inum)
-#define A_ATTACH_ISR(inum, isr, arg)
-
-#endif
-
-/* Tasklet Support */
-#define A_TASKLET_INIT() A_CMN(tasklet._tasklet_init())
-#define A_TASKLET_INIT_TASK(f, arg, t) A_CMN(tasklet._tasklet_init_task(f, arg, t))
-#define A_TASKLET_DISABLE(t) A_CMN(tasklet._tasklet_disable(t))
-#define A_TASKLET_SCHEDULE(t) A_CMN(tasklet._tasklet_schedule(t))
-#define A_TASKLET_RUN() A_CMN(tasklet._tasklet_run())
-
-
-/* RAM Allocation Support */
-#if defined(__mips__)
-#define alloc_arena_start _end
-#endif
-#if defined(__XTENSA__)
-#define alloc_arena_start _end
-#endif
-
-#if SYSTEM_MODULE_CLOCK
-
-#define A_CLOCK_INIT(refclk_guess) A_CMN(clock._clock_init(refclk_guess))
-#define A_CLOCK_TICK() A_CMN(clock._clock_tick())
-#define A_CLOCK_GET_TICK() A_CMN(clock._clock_get_tick())
-
-/*
- * Get the number of millisecond ticks since the system was started.
- * Note that this only approximates 1Ms. It's actually 32 ticks of
- * a 32KHz clock.
- *
- * Returns a A_UINT32 value.
- */
-#define A_MILLISECONDS() A_CMN(clock._milliseconds())
-
-/*
- * Get the frequency of the reference clock, expressed as
- * an A_refclk_speed_t.
- */
-#define A_REFCLK_SPEED_GET() A_CMN(clock._refclk_speed_get())
-
-/* Spin delay */
-#define A_DELAY_USECS(us) A_CMN(clock._delay_us(us))
-
-#define A_UART_FREQUENCY() A_CMN(clock._uart_frequency())
-
-#define A_CLOCKREGS_INIT() A_CMN(clock._clockregs_init())
-
-/* which_band is either A_BAND_24GHZ or A_BAND_5GHZ */
-#define A_WLAN_BAND_SET(which_band) \
- A_CMN(clock._wlan_band_set(which_band))
-
-/* Called whenever the system clock changes speed */
-#define A_SYSCLK_CHANGE(mhz) A_CMN(clock._sysclk_change(mhz))
-
-#define A_SYSCLK_GET() A_CMN(clock._sysclk_get())
-
-#else
-
-#define A_CLOCK_INIT(refclk_guess)
-#define A_CLOCK_TICK()
-#define A_CLOCK_GET_TICK()
-#define A_MILLISECONDS()
-#define A_REFCLK_SPEED_GET()
-#define A_DELAY_USECS(us)
-#define A_UART_FREQUENCY()
-#define A_CLOCKREGS_INIT()
-#define A_WLAN_BAND_SET(which_band)
-#define A_SYSCLK_CHANGE(mhz)
-#define A_SYSCLK_GET()
-
-#endif
-
-// Timer
-#define A_INIT_TIMER(pTimer, pFunction, pArg) \
- A_CMN(timer._timer_setfn((pTimer), (pFunction), (pArg)))
-
-/* Set a (possibly periodic) timer for "period" Milliseconds. */
-#define A_TIMEOUT_MS(pTimer, period) \
- A_CMN(timer._timer_arm((pTimer), (period)))
-
-#define A_UNTIMEOUT(pTimer) \
- A_CMN(timer._timer_disarm(pTimer))
-
-#define A_TIMER_RUN() \
- A_CMN(timer._timer_run())
-
-#define A_PCI_BOOT_INIT() \
- A_CMN(pci.pci_boot_init())
-
-#define A_GMAC_BOOT_INIT() \
- A_CMN(gmac.gmac_boot_init())
-
-#if SYSTEM_MODULE_ALLOCRAM
-/* Default size of ALLOCRAM area */
-#define ARENA_SZ_DEFAULT 12000
-
-#define A_ALLOCRAM_INIT(arena_start, arena_size) \
- do { \
- extern unsigned int alloc_arena_start; \
- void *astart; \
- int asize; \
- astart = (arena_start) ? (void *)(arena_start) : &alloc_arena_start; \
- asize = (arena_size) ? (arena_size) : (ARENA_SZ_DEFAULT); \
- A_CMN(allocram.cmnos_allocram_init((astart), (asize))); \
- } while (0)
-
-#define A_ALLOCRAM(nbytes) A_CMN(allocram.cmnos_allocram(0, (nbytes)))
-
-#define A_ALLOCRAM_DEBUG() A_CMN(allocram.cmnos_allocram_debug())
-
-#else
-#define A_ALLOCRAM_INIT(arena_start, arena_size)
-#define A_ALLOCRAM(nbytes)
-#define A_ALLOCRAM_DEBUG()
-#endif
-
-#if SYSTEM_MODULE_ROM_PATCH
-
-#define A_ROMP_INIT() A_CMN(romp._romp_init())
-#define A_ROMP_DOWNLOAD(x) A_CMN(romp._romp_download(x))
-#define A_ROMP_DECODE(addr) A_CMN(romp._romp_decode(addr))
-#define A_ROMP_INSTALL() A_CMN(romp._romp_install())
-#else
-#define A_ROMP_INIT()
-#define A_ROMP_DOWNLOAD(x)
-#define A_ROMP_DECODE(addr)
-#define A_ROMP_INSTALL()
-#endif
-
-#if SYSTEM_MODULE_WDT
-
-#define A_WDT_INIT() A_CMN(wdt_timer._wdt_init())
-#define A_WDT_ENABLE() A_CMN(wdt_timer._wdt_enable())
-#define A_WDT_DISABLE() A_CMN(wdt_timer._wdt_disable())
-#define A_WDT_SET(t) A_CMN(wdt_timer._wdt_set(t))
-#define A_WDT_TASK() A_CMN(wdt_timer._wdt_task())
-#define A_WDT_LASTBOOT() A_CMN(wdt_timer._wdt_last_boot())
-#define A_WDT_RESET() A_CMN(wdt_timer._wdt_reset())
-
-#else
-#define A_WDT_INIT()
-#define A_WDT_ENABLE()
-#define A_WDT_DISABLE()
-#define A_WDT_SET(t)
-#define A_WDT_TASK()
-#define A_WDT_LASTBOOT()
-#define A_WDT_RESET()
-#endif
-
-
-#if SYSTEM_MODULE_EEPROM
-#define A_EEP_INIT() A_CMN(eep._eep_init())
-#define A_EEP_READ(off, len, buf) A_CMN(eep._eep_read(off, len, buf))
-#define A_EEP_WRITE(off, len, buf) A_CMN(eep._eep_write(off, len, buf))
-#define A_EEP_IS_EXIST() A_CMN(eep._eep_is_exist())
-#else
-#define A_EEP_INIT()
-#define A_EEP_READ(off, len, buf)
-#define A_EEP_WRITE(off, len, buf)
-#define A_EEP_IS_EXIST()
-#endif
-
-
-
-struct _A_os_linkage_check; /* OS-dependent */
-
-typedef struct _A_cmnos_indirection_table {
- int (* hal_linkage_check)(int sz, struct _A_os_linkage_check *);
- unsigned int *start_bss;
- void (* app_start)(void);
-
-#if SYSTEM_MODULE_MEM
- struct mem_api mem;
-#endif
-
-#if SYSTEM_MODULE_MISC
- struct misc_api misc;
-#endif
-
-#if SYSTEM_MODULE_PRINT
- struct printf_api printf;
-#endif
-
-#if SYSTEM_MODULE_UART
- struct uart_api uart;
-#endif
-
-#if SYSTEM_MODULE_DBG
-#if !MOVE_DBG_TO_RAM // move to firmware not in cmnos
- struct dbg_api dbg;
-#endif
-#endif
-#if SYSTEM_MODULE_PCI
- struct pci_api pci;
-#endif
-
-#if SYSTEM_MODULE_GMAC
- struct gmac_api gmac;
-#endif
-
-#if SYSTEM_MODULE_USB
- struct usb_api usb;
-#endif
-
-#if SYSTEM_MODULE_CLOCK
- struct clock_api clock;
-#endif
-
-#if SYSTEM_MODULE_TIMER
- struct timer_api timer;
-#endif
-
-#if SYSTEM_MODULE_INTR
- struct intr_api intr;
-#endif
-
-#if SYSTEM_MODULE_ALLOCRAM
- struct allocram_api allocram;
-#endif
-
-#if SYSTEM_MODULE_ROM_PATCH
- struct romp_api romp;
-#endif
-
-#if SYSTEM_MODULE_WDT
- struct wdt_api wdt_timer;
-#endif
-
-#if SYSTEM_MODULE_EEPROM
- struct eep_api eep;
-#endif
-
- struct string_api string;
- struct tasklet_api tasklet;
-
-} _A_cmnos_indirection_table_t;
-
-/* Module installation for cmnos modules */
-
-#if SYSTEM_MODULE_MEM
-extern void cmnos_mem_module_install(struct mem_api *);
-#endif
-
-#if SYSTEM_MODULE_MISC
-extern void cmnos_misc_module_install(struct misc_api *);
-#endif
-
-#if SYSTEM_MODULE_PRINT
-extern void cmnos_printf_module_install(struct printf_api *);
-#endif
-
-#if SYSTEM_MODULE_UART
-extern void cmnos_uart_module_install(struct uart_api *);
-#endif
-
-#if SYSTEM_MODULE_DBG
-extern void cmnos_dbg_module_install(struct dbg_api *);
-#endif
-
-#if SYSTEM_MODULE_USB
-extern void cmnos_usb_module_install(struct usb_api *);
-#endif
-
-#if SYSTEM_MODULE_INTR
-extern void cmnos_intr_module_install(struct intr_api *);
-#endif
-
-#if SYSTEM_MODULE_CLOCK
-extern void cmnos_clock_module_install(struct clock_api *);
-#endif
-
-#if SYSTEM_MODULE_TIMER
-extern void cmnos_timer_module_install(struct timer_api *);
-#endif
-
-#if SYSTEM_MODULE_ALLOCRAM
-extern void cmnos_allocram_module_install(struct allocram_api *);
-#endif
-
-#if SYSTEM_MODULE_ROM_PATCH
-extern void cmnos_romp_module_install(struct romp_api *);
-#endif
-
-#if SYSTEM_MODULE_WDT
-extern void cmnos_wdt_module_install(struct wdt_api *);
-#endif
-
-#if SYSTEM_MODULE_EEPROM
-extern void cmnos_eep_module_install(struct eep_api *);
-#endif
-
-#if SYSTEM_MODULE_PCI
-extern void cmnos_pci_module_install(struct pci_api *);
-#endif
-
-extern void cmnos_tasklet_module_install(struct tasklet_api *);
-
-extern void cmnos_string_module_install(struct string_api *tbl);
-
-#endif /* __CMNOS_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-/*
- * @File: dma_engine_api.h
- *
- * @Abstract: DMA Engine api
- *
- * @Notes:
- */
-
-#ifndef _DMA_ENGINE_API_H
-#define _DMA_ENGINE_API_H
-
-#include <vbuf_api.h>
-#include <vdesc_api.h>
-
-struct zsDmaDesc
-{
-#if 1 // BIG_ENDIAN
- volatile u16_t ctrl; // Descriptor control
- volatile u16_t status; // Descriptor status
- volatile u16_t totalLen; // Total length
- volatile u16_t dataSize; // Data size
-#else
- volatile u16_t status; // Descriptor status
- volatile u16_t ctrl; // Descriptor control
- volatile u16_t dataSize; // Data size
- volatile u16_t totalLen; // Total length
-#endif
- struct zsDmaDesc* lastAddr; // Last address of this chain
- volatile u32_t dataAddr; // Data buffer address
- struct zsDmaDesc* nextAddr; // Next TD address
-};
-
-struct zsDmaQueue
-{
- struct zsDmaDesc* head;
- struct zsDmaDesc* terminator;
-};
-
-// Subclass of zsDmaQueue for TX
-struct zsTxDmaQueue
-{
- struct zsDmaDesc* head;
- struct zsDmaDesc* terminator;
-
- /* Below are fields specific to TX */
- VBUF *xmited_buf_head;
- VBUF *xmited_buf_tail;
-};
-
-/* hardware API table structure (API descriptions below) */
-struct dma_engine_api
-{
- void (*_init)();
-
- void (*_init_rx_queue)(struct zsDmaQueue *q);
-
- void (*_init_tx_queue)(struct zsTxDmaQueue *q);
-
- void (*_config_rx_queue)(struct zsDmaQueue *q, int num_desc, int buf_size);
-
- void (*_xmit_buf)(struct zsTxDmaQueue *q, VBUF *buf);
-
- void (*_flush_xmit)(struct zsDmaQueue *q);
-
- VBUF* (*_reap_recv_buf)(struct zsDmaQueue *q);
-
- void (*_return_recv_buf)(struct zsDmaQueue *q, VBUF *buf);
-
- VBUF* (*_reap_xmited_buf)(struct zsTxDmaQueue *q);
-
- void (*_swap_data)(struct zsDmaDesc* desc);
-
- int (*_has_compl_packets)(struct zsDmaQueue *q);
-
- void (*_desc_dump)(struct zsDmaQueue *q);
-
- /* The functions below are for patchable */
- struct zsDmaDesc* (*_get_packet)(struct zsDmaQueue* q);
- void (*_reclaim_packet)(struct zsDmaQueue* q, struct zsDmaDesc* desc);
- void (*_put_packet)(struct zsDmaQueue* q, struct zsDmaDesc* desc);
-
- /* room to expand this table by another table */
- void *pReserved;
-};
-
-extern void dma_engine_module_install(struct dma_engine_api *apis);
-
-#endif /* #ifndef _DMA_ENGINE_API_H */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __DMA_LIB_H
-#define __DMA_LIB_H
-
-
-/***********************External***************************/
-
-/**
- * @brief DMA engine numbers, HIF need to map them to there
- * respective order
- */
-typedef enum dma_engine{
- DMA_ENGINE_RX0,
- DMA_ENGINE_RX1,
- DMA_ENGINE_RX2,
- DMA_ENGINE_RX3,
- DMA_ENGINE_TX0,
- DMA_ENGINE_TX1,
- DMA_ENGINE_MAX
-}dma_engine_t;
-
-/**
- * @brief Interface type, each HIF should call with its own interface type
- */
-typedef enum dma_iftype{
- DMA_IF_GMAC = 0x0,/* GMAC */
- DMA_IF_PCI = 0x1,/*PCI */
- DMA_IF_PCIE = 0x2 /*PCI Express */
-}dma_iftype_t;
-
-
-struct dma_lib_api{
- A_UINT16 (*tx_init)(dma_engine_t eng_no, dma_iftype_t if_type);
- void (*tx_start)(dma_engine_t eng_no);
- A_UINT16 (*rx_init)(dma_engine_t eng_no, dma_iftype_t if_type);
- void (*rx_config)(dma_engine_t eng_no, a_uint16_t num_desc,
- a_uint16_t gran);
- void (*rx_start)(dma_engine_t eng_no);
- A_UINT32 (*intr_status)(dma_iftype_t if_type);
- A_UINT16 (*hard_xmit)(dma_engine_t eng_no, VBUF *buf);
- void (*flush_xmit)(dma_engine_t eng_no);
- A_UINT16 (*xmit_done)(dma_engine_t eng_no);
- VBUF * (*reap_xmitted)(dma_engine_t eng_no);
- VBUF * (*reap_recv)(dma_engine_t eng_no);
- void (*return_recv)(dma_engine_t eng_no, VBUF *buf);
- A_UINT16 (*recv_pkt)(dma_engine_t eng_no);
-};
-
-
-/**
- * @brief Install the DMA lib api's this for ROM patching
- * support
- *
- * @param apis
- */
-void dma_lib_module_install(struct dma_lib_api *apis);
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __EEPROM_API_H__
-#define __EEPROM_API_H__
-
-typedef enum {
- RET_SUCCESS = 0,
- RET_NOT_INIT,
- RET_NOT_EXIST,
- RET_EEP_CORRUPT,
- RET_EEP_OVERFLOW,
-
- // add return code from here
- RET_UNKNOWN
-} T_EEP_RET;
-
-
-/*!- interface of eeprom access
- *
- */
-struct eep_api {
- void (* _eep_init)(void);
- T_EEP_RET (* _eep_read)(uint16_t, uint16_t, uint16_t *);
- T_EEP_RET (* _eep_write)(uint16_t, uint16_t, uint16_t *);
- T_EEP_RET (*_eep_is_exist)(void);
-};
-
-#endif /* __EEPROM_API_H__ */
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-/*
- * @File: HIF_api.h
- *
- * @Abstract: Host Interface api
- *
- * @Notes:
- */
-
-#ifndef _HIF_API_H
-#define _HIF_API_H
-
-#include <adf_nbuf.h>
-
-/* mailbox hw module configuration structure */
-typedef struct _HIF_CONFIG {
- int dummy;
-} HIF_CONFIG;
-
-typedef struct _HIF_CALLBACK {
- /* callback when a buffer has be sent to the host*/
- void (*send_buf_done)(adf_nbuf_t buf, void *context);
- /* callback when a receive message is received */
- void (*recv_buf)(adf_nbuf_t hdr_buf, adf_nbuf_t buf, void *context);
- /* context used for all callbacks */
- void *context;
-} HIF_CALLBACK;
-
-typedef void* hif_handle_t;
-
-/* hardware API table structure (API descriptions below) */
-struct hif_api {
- hif_handle_t (*_init)(HIF_CONFIG *pConfig);
-
- void (* _shutdown)(hif_handle_t);
-
- void (*_register_callback)(hif_handle_t, HIF_CALLBACK *);
-
- int (*_get_total_credit_count)(hif_handle_t);
-
- void (*_start)(hif_handle_t);
-
- void (*_config_pipe)(hif_handle_t handle, int pipe, int creditCount);
-
- int (*_send_buffer)(hif_handle_t handle, int pipe, adf_nbuf_t buf);
-
- void (*_return_recv_buf)(hif_handle_t handle, int pipe, adf_nbuf_t buf);
- //void (*_set_recv_bufsz)(int pipe, int bufsz);
- //void (*_pause_recv)(int pipe);
- //void (*_resume_recv)(int pipe);
- int (*_is_pipe_supported)(hif_handle_t handle, int pipe);
-
- int (*_get_max_msg_len)(hif_handle_t handle, int pipe);
-
- int (*_get_reserved_headroom)(hif_handle_t handle);
-
- void (*_isr_handler)(hif_handle_t handle);
-
- void (*_get_default_pipe)(hif_handle_t handle, A_UINT8 *pipe_uplink, A_UINT8 *pipe_downlink);
-
- /* room to expand this table by another table */
- void *pReserved;
-};
-
-extern void hif_module_install(struct hif_api *apis);
-
-#endif /* #ifndef _HIF_API_H */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __HIF_GMAC_H
-#define __HIF_GMAC_H
-
-#include <adf_os_types.h>
-#include <hif_api.h>
-
-
-#define ETH_ALEN 6
-#define GMAC_MAX_PKT_LEN 1600
-#define GMAC_MAX_DESC 5
-
-#define GMAC_DISCV_PKT_SZ 60
-#define GMAC_DISCV_WAIT 2000
-
-#define ATH_P_MAGBOOT 0x12 /*Magpie GMAC 18 for boot downloader*/
-#define ATH_P_MAGNORM 0x13 /*Magpie GMAC 19 for HTC & others*/
-
-#define ETH_P_ATH 0x88bd
-
-typedef enum hif_gmac_pipe{
- HIF_GMAC_PIPE_RX = 1, /*Normal Priority RX*/
- HIF_GMAC_PIPE_TX = 2, /*Normal Priority TX*/
-}hif_gmac_pipe_t;
-
-struct gmac_api{
- void (*gmac_boot_init)(void);
-};
-
-void cmnos_gmac_module_install(struct gmac_api *boot_apis);
-void hif_gmac_module_install(struct hif_api *apis);
-
-
-#endif
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __HIF_PCI_H
-#define __HIF_PCI_H
-
-#include <hif_api.h>
-
-
-#define PCI_MAX_PKT_LEN 1600
-#define PCI_MAX_DESC 2
-
-typedef enum hif_pci_pipe_rx{
- HIF_PCI_PIPE_RX0, /*Normal Priority RX*/
- HIF_PCI_PIPE_RX1,
- HIF_PCI_PIPE_RX2,
- HIF_PCI_PIPE_RX3,
- HIF_PCI_PIPE_RX_MAX
-}hif_pci_pipe_rx_t;
-
-typedef enum hif_pci_pipe_tx{
- HIF_PCI_PIPE_TX0, /*Normal Priority TX*/
- HIF_PCI_PIPE_TX1,
- HIF_PCI_PIPE_TX_MAX
-}hif_pci_pipe_tx_t;
-
-struct pci_api{
- void (*pci_boot_init)(void);
-};
-
-void cmnos_pci_module_install(struct pci_api *apis);
-void hif_pci_module_install(struct hif_api *apis);
-#endif
-
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-/*
- * @File: mbox_hw.h
- *
- * @Abstract: mailbox hardware definitions
- *
- * @Notes:
- */
-
-#ifndef __HIF_USB_H__
-#define __HIF_USB_H__
-
-#include <sys_cfg.h>
-#include <vdesc_api.h>
-//#include <desc.h>
-#include <dma_engine_api.h>
-
-#define HIF_USB_PIPE_TX 1
-#define HIF_USB_PIPE_RX 2
-#define HIF_USB_PIPE_INTERRUPT 3
-#define HIF_USB_PIPE_COMMAND 4
-#define HIF_USB_PIPE_HP_TX 5
-#define HIF_USB_PIPE_MP_TX 6
-
-struct VBUF_QUEUE
-{
- VBUF *head;
- VBUF *tail;
-};
-
- /* the mailbox hardware layer context */
-typedef struct _HIF_USB_CONTEXT {
- HIF_CALLBACK hifCb;
- struct zsDmaQueue dnQ;
- struct zsTxDmaQueue upQ;
-#if SYSTEM_MODULE_HP_EP5
- struct zsDmaQueue hpdnQ; // high priority
-#endif
-#if SYSTEM_MODULE_HP_EP6
- struct zsDmaQueue mpdnQ; // medium priority
-#endif
- //struct VBUF_QUEUE upVbufQ;
- VBUF *cmdQueue;
- struct VBUF_QUEUE eventBufQ;
-
- // Left a door for extension the structure
- void *pReserved;
-} HIF_USB_CONTEXT;
-
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __INTR_API_H__
-#define __INTR_API_H__
-
-/*
- * Interrupt handler, for application-managed interrupts.
- * When an interrupt occurs, it is automatically disabled.
- * See A_WMAC_INTR_ATTACH() and A_MBOX_INTR_ATTACH().
- *
- * If a handler returns A_HANDLER_DONE, the interrupt is
- * re-enabled. The OS calls the handler next time service
- * is required. This is the normal case for a handler.
- *
- * If a handler returns A_HANDLER_YIELD, the interrupt
- * remains masked. The handler is called again when
- * it is "convenient". This gives the OS an opportunity
- * to run other code/handlers. A handler should return
- * A_HANDLER_YIELD if it might dominate the CPU for too
- * long.
- *
- * If a handler returns A_HANDLER_NOENABLE, the interrupt
- * remains disabled. It is up to the application to re-enable
- * the interrupt (via A_*_INTR_UNMASK) when it's appropriate.
- *
- * Note that many combinations of interrupt functions and
- * interrupt vectors are NOT supported: Callers should use
- * only the macros defined in cmnos_api.h to access the
- * interrupt API.
- */
-#include "cmnos_api.h"
-
-typedef uint32_t A_old_intr_t;
-
-//////////////////////////////////////////////////////////////////
-// this is copied from mercury/cmnos_xtensa.h
-/*
- * These are CMNOS interrupt manifest constants.
- * They have specially-chosen values that align with hardware and or
- * operating system values (see cmnos_interrupt_info).
- */
-#if defined(__XTENSA__)
-/*
- * Enumeration of low and medium priority interrupt numbers
- * which match the CPU hardware configuration:
- */
-
-/* XTensa Level 1 interrupt */
-#define A_INUM_SOFTWARE 0 /* currently unused */
-
-/* XTensa Level2 interrupts */
-#define A_INUM_XTTIMER 1 /* Tensilica timer */
-#define A_INUM_TBD_2 2 /* TBD */
-#define A_INUM_CPU_WDT 3 /* RST_CPU watchodg interrupt */
-#define A_INUM_TBD_4 4 /* TBD */
-#define A_INUM_TBD_5 5 /* TBD */
-#define A_INUM_TBD_6 6 /* TBD */
-#define A_INUM_CPU_GEN_TIMER 7 /* CPU general timer */
-#define A_INUM_TBD_8 8 /* TBD */
-#define A_INUM_TBD_9 9 /* TBD */
-#define A_INUM_USB_CTRL 10 /* USB core control */
-#define A_INUM_USB_DMA 11 /* USB DMA */
-#define A_INUM_TBD_12 12 /* TBD */
-#define A_INUM_TBD_13 13 /* TBD */
-#define A_INUM_TBD_14 14 /* TBD */
-
-/* Level 3 interrupts */
-#define A_INUM_ERROR 15 /* Errors (e.g. access illegal address) */
-#define A_INUM_TBD_16 16 /* TBD */
-#define A_INUM_MAC 17 /* MAC */
-
-/* Level 5 interrupts */
-#define A_INUM_CPU_NMI 18 /* CPU NMI */
-
-/* Number of interrupts that map directly into CPU/hal interrupt bits. */
-#define NUM_DIRECT_INTR 19
-
-#endif
-//////////////////////////////////////////////////////////////////
-
-#define CMNOS_IMASK_XTTIMER (1<<A_INUM_XTTIMER)
-#define CMNOS_IMASK_CPU_WDT (1<<A_INUM_CPU_WDT)
-#define CMNOS_IMASK_CPU_GEN_TIMER (1<<A_INUM_CPU_GEN_TIMER)
-#define CMNOS_IMASK_USB_CTRL (1<<A_INUM_USB_CTRL)
-#define CMNOS_IMASK_USB_DMA (1<<A_INUM_USB_DMA)
-#define CMNOS_IMASK_ERROR (1<<A_INUM_ERROR)
-#define CMNOS_IMASK_MAC (1<<A_INUM_MAC)
-#define CMNOS_IMASK_CPU_NMI (1<<A_INUM_CPU_NMI)
-
-typedef enum inum_intr {
- A_INTR_TIMER = 0,
- A_INTR_USB_CTRL,
- A_INTR_USB_DMA,
- A_INTR_ERROR,
- /* add intr above here */
- A_INTR_NUM
-} A_INUM_INTR_T;
-
-//////////////////////////////////////////////////////////////////
-
-/*
- * An interrupt handler, which is a function called in response
- * to a hardware interrupt, possibly as a Delayed Service Routine.
- */
-typedef int (* A_handler_t)(void *);
-/* Return values from a handler/DSR, A_handler_t */
-#define A_HANDLER_NOENABLE 0 /* do not re-enable interrupts */
-#define A_HANDLER_DONE 1 /* all intrs handled, call on next intr */
-#define A_HANDLER_YIELD 2 /* leave intrs disabled and
- call back later regardless of intr state */
-
-/*
- * An Interrupt Service Routine, which must be called
- * directly in interrupt context (not delayed), and which
- * must be very small and may not have access to all OS
- * functions. These are for use only when interrupt
- * latency is critical; otherwise, an A_handler_t ("dsr")
- * is preferable.
- */
-typedef uint32_t (* A_isr_t)(void *);
-/* Return values from an ISR */
-#if defined(CYG_ISR_HANDLED)
-#define A_ISR_HANDLED CYG_ISR_HANDLED
-#define A_ISR_CALL_DSR CYG_ISR_CALL_DSR
-#else
-#define A_ISR_HANDLED 1
-#define A_ISR_CALL_DSR 2
-#endif
-
-struct intr_api {
- void (*_intr_init)(void);
- uint32_t (* _intr_invoke_isr)(uint32_t inum);
- A_old_intr_t(* _intr_disable)(void);
- void (* _intr_restore)(A_old_intr_t);
-
- void (* _intr_mask_inum)(uint32_t inum);
- void (* _intr_unmask_inum)(uint32_t inum);
- void (* _intr_attach_isr)(uint32_t inum, A_isr_t isr, void *arg);
- /* Low-level interrupt access, intended for use by OS modules */
- unsigned int (* _get_intrenable)(void);
- void (* _set_intrenable)(unsigned int);
- unsigned int (* _get_intrpending)(void);
- void (* _unblock_all_intrlvl)(void);
-};
-
-#endif /* __INTR_API_H__ */
#define _ROM_CFG_H_
/************************** FPGA version **************************/
-#define MAGPIE_FPGA_RAM_256K 0
+#define MAGPIE_FPGA_RAM_256K 0
/************************** SYSTEM WIDE ***************************/
/* Release Code :
#define ATH_VER_MINOR_NUMBER "0"
#define ATH_VER_BUILD_NUMBER "3"
-#define ATH_VER_DATES __DATE__" "__TIME__
-
#define ATH_VERSION_STR "["ATH_VER_RELEASE_CODE "." \
ATH_VER_PLATFORM_NUMBER "." \
ATH_VER_MAJOR_NUMBER "." \
ATH_VER_MINOR_NUMBER "." \
- ATH_VER_BUILD_NUMBER "] " \
- ATH_VER_DATES
+ ATH_VER_BUILD_NUMBER "]"
/* ROM Code Version (16 bit)
* Bit 15 : 0 means ASIC, 1 means FPGA
#define WATCH_DOG_MAGIC_PATTERN_ADDR (SYS_D_RAM_REGION_0_BASE+SYS_RAM_SZIE-0x4) // 0x53fffc,magic pattern address
#define WATCH_DOG_RESET_COUNTER_ADDR (SYS_D_RAM_REGION_0_BASE+SYS_RAM_SZIE-0x8) // 0x53fff8,record the reset counter
#define DEBUG_SYSTEM_STATE_ADDR (SYS_D_RAM_REGION_0_BASE+SYS_RAM_SZIE-0xc) // 0x53fff4,record the state of system
-#define CURRENT_PROGRAM_ADDR (SYS_D_RAM_REGION_0_BASE+SYS_RAM_SZIE-0x10) // 0x53fff0,reserved
+#define CURRENT_PROGRAM_ADDR (SYS_D_RAM_REGION_0_BASE+SYS_RAM_SZIE-0x10) // 0x53fff0,reserved
#define WATCH_DOG_MAGIC_PATTERN (*((volatile u32_t*)(WATCH_DOG_MAGIC_PATTERN_ADDR)))
#define WATCH_DOG_RESET_COUNTER (*((volatile u32_t*)(WATCH_DOG_RESET_COUNTER_ADDR)))
/* instruction port area */
#define SYS_I_R0M_REGION_0_BASE 0x8e0000
-
+
#define SYS_I_RAM_REGION_0_BASE 0x900000
#define SYS_I_RAM_REGION_1_BASE (SYS_I_RAM_REGION_0_BASE+SYS_RAM_BLOCK_SIZE)
#define SYS_I_RAM_REGION_2_BASE (SYS_I_RAM_REGION_1_BASE+SYS_RAM_BLOCK_SIZE)
#define SYS_I_RAM_REGION_3_BASE (SYS_I_RAM_REGION_2_BASE+SYS_RAM_BLOCK_SIZE)
-
-/* data port area */
+
+/* data port area */
#define SYS_D_R0M_REGION_0_BASE 0x4e0000
-
+
#define SYS_D_RAM_REGION_0_BASE 0x500000
#define SYS_D_RAM_REGION_1_BASE (SYS_D_RAM_REGION_0_BASE+SYS_RAM_BLOCK_SIZE)
#define SYS_D_RAM_REGION_2_BASE (SYS_D_RAM_REGION_1_BASE+SYS_RAM_BLOCK_SIZE)
#define USB_DEVICE_PID_SIZE 1 // PID SIZE, 1 halfword offset
#define USB_DEVICE_VID_SIZE 1 // VID SIZE, 1 halfword offset
-
+
#define USB_DESC_IN_EEPROM_FLAG_OFFSET USB_DESCRIPTOR_ADDR
#define USB_DEVICE_DESCRIPTOR_OFFSET (USB_DESC_IN_EEPROM_FLAG_OFFSET+USB_DESC_IN_EEPROM_SIZE)
#define USB_STRING00_DESCRIPTOR_OFFSET (USB_DEVICE_DESCRIPTOR_OFFSET+USB_DEVICE_DESCRIPTOR_SIZE)
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-/*************************************************************************/
-/* Copyright (c) 2006 Atheros Communications, Inc., All Rights Reserved */
-/* */
-/* Module Name : mem_addrs.h */
-/* */
-/* Abstract */
-/* This file contains definition of the memory related information. */
-/* */
-/* NOTES */
-/* None */
-/* */
-/*************************************************************************/
-
-#ifndef _MEM_ADDRS_H_
-#define _MEM_ADDRS_H_
-
-#define SYS_ROM_BLOCK_SIZE (32*1024)
-#if MAGPIE_FPGA_RAM_256K == 1
-#define SYS_ROM_BLOCK_NUM 2 //ram 256K version is also rom 64k version
-#else
-#define SYS_ROM_BLOCK_NUM 3
-#endif
-#define SYS_ROM_SIZE (SYS_ROM_BLOCK_SIZE*SYS_ROM_BLOCK_NUM)
-
-#if MAGPIE_FPGA_RAM_256K == 1
-#define SYS_RAM_BLOCK_SIZE 64*1024
-#else
-#define SYS_RAM_BLOCK_SIZE 40*1024
-#endif
-
-#define SYS_RAM_BLOCK_NUM 4
-#define SYS_RAM_SZIE (SYS_RAM_BLOCK_SIZE*SYS_RAM_BLOCK_NUM)
-
-/* instruction port area */
-#define SYS_I_R0M_REGION_0_BASE 0x8e0000
-
-#define SYS_I_RAM_REGION_0_BASE 0x900000
-#define SYS_I_RAM_REGION_1_BASE (SYS_I_RAM_REGION_0_BASE+SYS_RAM_BLOCK_SIZE)
-#define SYS_I_RAM_REGION_2_BASE (SYS_I_RAM_REGION_1_BASE+SYS_RAM_BLOCK_SIZE)
-#define SYS_I_RAM_REGION_3_BASE (SYS_I_RAM_REGION_2_BASE+SYS_RAM_BLOCK_SIZE)
-
-/* data port area */
-#define SYS_D_R0M_REGION_0_BASE 0x4e0000
-
-#define SYS_D_RAM_REGION_0_BASE 0x500000
-#define SYS_D_RAM_REGION_1_BASE (SYS_D_RAM_REGION_0_BASE+SYS_RAM_BLOCK_SIZE)
-#define SYS_D_RAM_REGION_2_BASE (SYS_D_RAM_REGION_1_BASE+SYS_RAM_BLOCK_SIZE)
-#define SYS_D_RAM_REGION_3_BASE (SYS_D_RAM_REGION_2_BASE+SYS_RAM_BLOCK_SIZE)
-
-/* data and bss section */
-
-#define SYS_D_RAM_DATA_BSS SYS_D_RAM_REGION_0_BASE
-#define SYS_D_RAM_DATA_BSS_SZ SYS_RAM_BLOCK_SIZE
-#define SYS_D_RAM_STACK_SIZE (2*1024)
-
-/////////////////////////////////////////////////////////////////////////////////////
-#define EEPROM_CTRL_BASE 0x10ff0000
-#define EEPROM_ADDR_BASE (EEPROM_CTRL_BASE+0x2000)
-
-#define EEPROM_SIZE 0xfff // 4K addressing space, each has 2 bytes, (a half word)
-#define EEPROM_START_OFFSET 0 // THIS SHOULD NOT MODIFY
-#define EEPROM_END_OFFSET (EEPROM_START_OFFSET+EEPROM_SIZE) // end of the eeprom offset
-
-/////////////////////////////////////////////////////////////////////////////////////
-#define EEPROM_USB_DESCRIPTOR_ADDR ((uint32_t)&_bss_end) // address at RAM to put descriptor data
-#define USB_DESC_START_ADDR 0x780
-#define USB_DESCRIPTOR_ADDR USB_DESC_START_ADDR // eeprom offset to sotre the descriptor data
-
-#define USB_DESC_IN_EEPROM_SIZE 2 // indicate eeprom is exist in eeprom
-#define USB_DEVICE_DESCRIPTOR_SIZE 16 // Device Descriptor
-#define USB_STRING00_DESCRIPTOR_SIZE 6 // 16 half word
-#define USB_STRING10_DESCRIPTOR_SIZE 12 // Manufacture data
-#define USB_STRING20_DESCRIPTOR_SIZE 16 // Product/Company data
-#define USB_STRING30_DESCRIPTOR_SIZE 8 // Serial Number
-
-#define USB_DEVICE_PID_SIZE 1 // PID SIZE, 1 halfword offset
-#define USB_DEVICE_VID_SIZE 1 // VID SIZE, 1 halfword offset
-
-#define USB_DESC_IN_EEPROM_FLAG_OFFSET USB_DESCRIPTOR_ADDR
-#define USB_DEVICE_DESCRIPTOR_OFFSET (USB_DESC_IN_EEPROM_FLAG_OFFSET+USB_DESC_IN_EEPROM_SIZE)
-#define USB_STRING00_DESCRIPTOR_OFFSET (USB_DEVICE_DESCRIPTOR_OFFSET+USB_DEVICE_DESCRIPTOR_SIZE)
-#define USB_STRING10_DESCRIPTOR_OFFSET (USB_STRING00_DESCRIPTOR_OFFSET+USB_STRING00_DESCRIPTOR_SIZE)
-#define USB_STRING20_DESCRIPTOR_OFFSET (USB_STRING10_DESCRIPTOR_OFFSET+USB_STRING10_DESCRIPTOR_SIZE)
-#define USB_STRING30_DESCRIPTOR_OFFSET (USB_STRING20_DESCRIPTOR_OFFSET+USB_STRING20_DESCRIPTOR_SIZE)
-
-#define USB_DEVICE_VID_OFFSET (USB_DEVICE_DESCRIPTOR_OFFSET+4)
-#define USB_DEVICE_PID_OFFSET (USB_DEVICE_VID_OFFSET+USB_DEVICE_VID_SIZE)
-
-#define USB_DESC_IN_EEPROM_FLAG_ADDR EEPROM_USB_DESCRIPTOR_ADDR
-#define USB_DEVICE_DESCRIPTOR_ADDR (USB_DESC_IN_EEPROM_FLAG_ADDR+(USB_DESC_IN_EEPROM_SIZE*2))
-#define USB_STRING00_DESCRIPTOR_ADDR (USB_DEVICE_DESCRIPTOR_ADDR+(USB_DEVICE_DESCRIPTOR_SIZE*2))
-#define USB_STRING10_DESCRIPTOR_ADDR (USB_STRING00_DESCRIPTOR_ADDR+(USB_STRING00_DESCRIPTOR_SIZE*2))
-#define USB_STRING20_DESCRIPTOR_ADDR (USB_STRING10_DESCRIPTOR_ADDR+(USB_STRING10_DESCRIPTOR_SIZE*2))
-#define USB_STRING30_DESCRIPTOR_ADDR (USB_STRING20_DESCRIPTOR_ADDR+(USB_STRING20_DESCRIPTOR_SIZE*2))
-
-#define USB_DEVICE_VID_ADDR (USB_DEVICE_DESCRIPTOR_ADDR+4)
-#define USB_DEVICE_PID_ADDR (USB_DEVICE_VID_ADDR+USB_DEVICE_VID_SIZE)
-
-#define USB_DESC_IN_EEP_PATTERN 0x41544852 //ATHR
-
-/****************************** patch in eeprom *****************************************/
-#define ROM_PATCH_EEPROM_SIZE 2 // 4 bytes
-
-#define ROM_PATCH_EEPROM_OFFSET 0xfc
-#define ROM_PATCH_BUF_ADDR SYS_D_RAM_REGION_3_BASE
-
-#endif /* _MEM_ADDRS_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __MAGPIE_REGDUMP_H__
-#define __MAGPIE_REGDUMP_H__
-
-#if !defined(__ASSEMBLER__)
-/*
- * XTensa CPU state
- * This must match the state saved by the target exception handler.
- */
-struct XTensa_exception_frame_s {
- uint32_t xt_pc;
- uint32_t xt_ps;
- uint32_t xt_sar;
- uint32_t xt_vpri;
- uint32_t xt_a2;
- uint32_t xt_a3;
- uint32_t xt_a4;
- uint32_t xt_a5;
- uint32_t xt_exccause;
- uint32_t xt_lcount;
- uint32_t xt_lbeg;
- uint32_t xt_lend;
-
- /* Extra info to simplify post-mortem stack walkback */
-#define MAGPIE_REGDUMP_FRAMES 5
- struct {
- uint32_t a0; /* pc */
- uint32_t a1; /* sp */
- uint32_t a2;
- uint32_t a3;
- } wb[MAGPIE_REGDUMP_FRAMES];
-};
-
-typedef struct XTensa_exception_frame_s CPU_exception_frame_t;
-#define RD_SIZE sizeof(CPU_exception_frame_t)
-
-#endif
-#endif /* __MAGPIE_REGDUMP_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __MEM_API_H__
-#define __MEM_API_H__
-
-struct mem_api {
- void (* _mem_init)(void);
- void *(* _memset)(void *, int, unsigned int);
- void *(* _memcpy)(void *, const void *, unsigned int);
- void *(* _memmove)(void *, const void *, unsigned int);
- int (* _memcmp)(const void *, const void *, unsigned int);
-};
-
-#endif /* __MEM_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __MISC_API_H__
-#define __MISC_API_H__
-
-enum hostif_s{
- HIF_USB = 0,
- HIF_PCIE,
- HIF_GMAC,
- HIF_PCI,
-
- // HIF should be added above here
- HIF_NUM,
- HIF_NONE
-
-};
-
-typedef enum hostif_s A_HOSTIF;
-
-struct register_dump_s;
-
-struct misc_api {
- void (* _system_reset)(void);
- void (* _mac_reset)(void);
- void (* _assfail)(struct register_dump_s *);
- void (* _misaligned_load_handler)(struct register_dump_s *);
-
- void (* _report_failure_to_host)(struct register_dump_s *, int);
- int (* _target_id_get)(void);
- A_HOSTIF (* _is_host_present)(void);
-
- uint8_t (*_kbhit)(uint8_t);
-
- uint16_t (* _rom_version_get)(void);
-};
-
-#endif /* __MISC_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#define AH_SUPPORT_AR5416 1
-#define AH_SUPPORT_2133 1
-#define AH_SUPPORT_5413 1
-#define AH_DEBUG 1
-#define AR5416_EMULATION 1
-#define ATH_FORCE_PPM 1
-#define ATH_FORCE_BIAS 1
-#define AH_SUPPORT_DFS 1
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __PRINTF_API_H__
-#define __PRINTF_API_H__
-
-struct printf_api {
- void (* _printf_init)(void);
- int (* _printf)(const char * fmt, ...);
-};
-
-/* NB: The printf module requires the serial module. */
-void cmnos_printf_module_install(struct printf_api *tbl);
-
-
-#endif /* __PRINTF_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __REGDUMP_H__
-#define __REGDUMP_H__
-
-#include "magpie_regdump.h"
-
-
-#if !defined(__ASSEMBLER__)
-
-/*
- * XTensa CPU state
- * This must match the state saved by the target exception handler.
- */
-
-#define RD_SIZE sizeof(CPU_exception_frame_t)
-
-/*
- * Target CPU state at the time of failure is reflected
- * in a register dump, which the Host can fetch through
- * the diagnostic window.
- */
-struct register_dump_s {
- uint32_t target_id; /* Target ID */
- uint32_t assline; /* Line number (if assertion failure) */
- uint32_t pc; /* Program Counter at time of exception */
- uint32_t badvaddr; /* Virtual address causing exception */
- CPU_exception_frame_t exc_frame; /* CPU-specific exception info */
-
- /* Could copy top of stack here, too.... */
-};
-
-#endif /* __ASSEMBLER__ */
-#endif /* __REGDUMP_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-/*************************************************************************/
-/* Copyright (c) 2008 Atheros Communications, Inc., All Rights Reserved */
-/* */
-/* Module Name : romp_api.h */
-/* */
-/* Abstract */
-/* This file contains definition of data structure and interface */
-/* */
-/* NOTES */
-/* None */
-/* */
-/*************************************************************************/
-
-#ifndef _ROMP_API_H_
-#define _ROMP_API_H_
-
-#include "dt_defs.h"
-
-/******** hardware API table structure (API descriptions below) *************/
-
-struct romp_api {
- void (*_romp_init)(void);
- BOOLEAN (*_romp_download)(uint16_t );
- BOOLEAN (*_romp_install)(void);
- BOOLEAN (*_romp_decode)(uint32_t );
-};
-
-#define _ROMP_MAGIC_ "[PaTcH]"
-
-struct rom_patch_st {
- uint16_t crc16; // crc filed to maintain the integrity
- uint16_t len; // length of the patch code
- uint32_t ld_addr; // load address of the patch code
- uint32_t fun_addr; // entry address of the patch code
- uint8_t *pfun; // patch code
-};
-
-
-struct eep_redir_addr {
- uint16_t offset;
- uint16_t size;
-};
-
-/************************* EXPORT function ***************************/
-uint16_t cal_crc16(uint32_t sz, uint8_t *p);
-
-#endif // end of _UART_API_H_
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __STRING_API_H__
-#define __STRING_API_H__
-
-struct string_api {
- void (* _string_init)(void);
- char *(* _strcpy)(char *, const char *);
- char *(* _strncpy)(char *, const char *, unsigned int);
- int (* _strlen)(const char *);
- int (* _strcmp)(const char *, const char *);
- int (* _strncmp)(const char *, const char *, unsigned int);
-};
-
-#endif /* __STRING_API_H__ */
#if defined(_ROM_)
#include "rom_cfg.h"
-#if MAGPIE_FPGA_RAM_256K == 1
-#undef MAX_BUF_NUM
+#if MAGPIE_FPGA_RAM_256K == 1
+#undef MAX_BUF_NUM
#define MAX_BUF_NUM 100
#endif
#endif
#undef SYSTEM_MODULE_DBG
-#undef MOVE_PRINT_TO_RAM
+#undef MOVE_PRINT_TO_RAM
#ifdef _DEBUG_BUILD_
#define SYSTEM_MODULE_DBG 1
#define MOVE_PRINT_TO_RAM 1
#else
#define SYSTEM_MODULE_DBG 0
-#define MOVE_PRINT_TO_RAM 1
+#define MOVE_PRINT_TO_RAM 1
#endif
#undef SYSTEM_MODULE_SFLASH
#define SYSTEM_MODULE_SFLASH 0
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __TASKLET_API_H__
-#define __TASKLET_API_H__
-
-typedef void (*A_TASKLET_FUNC)(void *arg);
-
-#define A_TASKLET_STATE_DISABLE 0
-#define A_TASKLET_STATE_SCHEDULED 1
-#define A_TASKLET_STATE_RUNNING 2
-
-struct _tasklet {
- A_TASKLET_FUNC func;
- void *arg;
- int state;
- struct _tasklet *next;
-};
-
-typedef struct _tasklet A_tasklet_t;
-
-struct tasklet_api {
- void (* _tasklet_init)(void);
- void (* _tasklet_init_task)(A_TASKLET_FUNC, void * arg, A_tasklet_t *);
- void (* _tasklet_disable)(A_tasklet_t *);
- void (* _tasklet_schedule)(A_tasklet_t *);
- void (* _tasklet_run)(void);
-};
-#endif /* __TASKLET_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __TIMER_API_H__
-#define __TIMER_API_H__
-/*
- * In order to remain completely independent of OS header files,
- * "_SPACE" structures are declared with sufficient room to hold
- * corresponding OS structures.
- */
-typedef unsigned int _A_TIMER_SPACE[5];
-typedef _A_TIMER_SPACE A_timer_t;
-#define A_TIMER A_timer_t /* historical */
-
-typedef unsigned int A_HANDLE; /* historical */
-typedef void A_TIMER_FUNC(A_HANDLE timer_handle, void *arg);
-
-struct timer_api {
- void (* _timer_init)(void);
- void (* _timer_arm)(A_timer_t *, unsigned int);
- void (* _timer_disarm)(A_timer_t *);
- void (* _timer_setfn)(A_timer_t *, A_TIMER_FUNC, void *);
- void (* _timer_run)(void);
-};
-#endif /* __TIMER_API_H__ */
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-/*************************************************************************/
-/* Copyright (c) 2006 Atheros Communications, Inc., All Rights Reserved */
-/* */
-/* Module Name : uart.h */
-/* */
-/* Abstract */
-/* This file contains definition of uart registers, marco and api. */
-/* */
-/* NOTES */
-/* None */
-/* */
-/*************************************************************************/
-
-#ifndef _UART_API_H_
-#define _UART_API_H_
-
-#include "k2/reg_defs.h"
-
-/************************** Register deinition ***************************/
-#define RBR_ADDRESS 0x00051000
-#define RBR_OFFSET 0x00000000
-#define RBR_RBR_MSB 7
-#define RBR_RBR_LSB 0
-#define RBR_RBR_MASK 0x000000ff
-#define RBR_RBR_GET(x) (((x) & RBR_RBR_MASK) >> RBR_RBR_LSB)
-#define RBR_RBR_SET(x) (((x) << RBR_RBR_LSB) & RBR_RBR_MASK)
-
-#define THR_ADDRESS 0x00051000
-#define THR_OFFSET 0x00000000
-#define THR_THR_MSB 7
-#define THR_THR_LSB 0
-#define THR_THR_MASK 0x000000ff
-#define THR_THR_GET(x) (((x) & THR_THR_MASK) >> THR_THR_LSB)
-#define THR_THR_SET(x) (((x) << THR_THR_LSB) & THR_THR_MASK)
-
-#define DLL_ADDRESS 0x00051000
-#define DLL_OFFSET 0x00000000
-#define DLL_DLL_MSB 7
-#define DLL_DLL_LSB 0
-#define DLL_DLL_MASK 0x000000ff
-#define DLL_DLL_GET(x) (((x) & DLL_DLL_MASK) >> DLL_DLL_LSB)
-#define DLL_DLL_SET(x) (((x) << DLL_DLL_LSB) & DLL_DLL_MASK)
-
-#define DLH_ADDRESS 0x00051004
-#define DLH_OFFSET 0x00000004
-#define DLH_DLH_MSB 7
-#define DLH_DLH_LSB 0
-#define DLH_DLH_MASK 0x000000ff
-#define DLH_DLH_GET(x) (((x) & DLH_DLH_MASK) >> DLH_DLH_LSB)
-#define DLH_DLH_SET(x) (((x) << DLH_DLH_LSB) & DLH_DLH_MASK)
-
-#define IER_ADDRESS 0x00051004
-#define IER_OFFSET 0x00000004
-#define IER_EDDSI_MSB 3
-#define IER_EDDSI_LSB 3
-#define IER_EDDSI_MASK 0x00000008
-#define IER_EDDSI_GET(x) (((x) & IER_EDDSI_MASK) >> IER_EDDSI_LSB)
-#define IER_EDDSI_SET(x) (((x) << IER_EDDSI_LSB) & IER_EDDSI_MASK)
-#define IER_ELSI_MSB 2
-#define IER_ELSI_LSB 2
-#define IER_ELSI_MASK 0x00000004
-#define IER_ELSI_GET(x) (((x) & IER_ELSI_MASK) >> IER_ELSI_LSB)
-#define IER_ELSI_SET(x) (((x) << IER_ELSI_LSB) & IER_ELSI_MASK)
-#define IER_ETBEI_MSB 1
-#define IER_ETBEI_LSB 1
-#define IER_ETBEI_MASK 0x00000002
-#define IER_ETBEI_GET(x) (((x) & IER_ETBEI_MASK) >> IER_ETBEI_LSB)
-#define IER_ETBEI_SET(x) (((x) << IER_ETBEI_LSB) & IER_ETBEI_MASK)
-#define IER_ERBFI_MSB 0
-#define IER_ERBFI_LSB 0
-#define IER_ERBFI_MASK 0x00000001
-#define IER_ERBFI_GET(x) (((x) & IER_ERBFI_MASK) >> IER_ERBFI_LSB)
-#define IER_ERBFI_SET(x) (((x) << IER_ERBFI_LSB) & IER_ERBFI_MASK)
-
-#define IIR_ADDRESS 0x00051008
-#define IIR_OFFSET 0x00000008
-#define IIR_FIFO_STATUS_MSB 7
-#define IIR_FIFO_STATUS_LSB 6
-#define IIR_FIFO_STATUS_MASK 0x000000c0
-#define IIR_FIFO_STATUS_GET(x) (((x) & IIR_FIFO_STATUS_MASK) >> IIR_FIFO_STATUS_LSB)
-#define IIR_FIFO_STATUS_SET(x) (((x) << IIR_FIFO_STATUS_LSB) & IIR_FIFO_STATUS_MASK)
-#define IIR_IID_MSB 3
-#define IIR_IID_LSB 0
-#define IIR_IID_MASK 0x0000000f
-#define IIR_IID_GET(x) (((x) & IIR_IID_MASK) >> IIR_IID_LSB)
-#define IIR_IID_SET(x) (((x) << IIR_IID_LSB) & IIR_IID_MASK)
-
-#define FCR_ADDRESS 0x00051008
-#define FCR_OFFSET 0x00000008
-#define FCR_RCVR_TRIG_MSB 7
-#define FCR_RCVR_TRIG_LSB 6
-#define FCR_RCVR_TRIG_MASK 0x000000c0
-#define FCR_RCVR_TRIG_GET(x) (((x) & FCR_RCVR_TRIG_MASK) >> FCR_RCVR_TRIG_LSB)
-#define FCR_RCVR_TRIG_SET(x) (((x) << FCR_RCVR_TRIG_LSB) & FCR_RCVR_TRIG_MASK)
-#define FCR_DMA_MODE_MSB 3
-#define FCR_DMA_MODE_LSB 3
-#define FCR_DMA_MODE_MASK 0x00000008
-#define FCR_DMA_MODE_GET(x) (((x) & FCR_DMA_MODE_MASK) >> FCR_DMA_MODE_LSB)
-#define FCR_DMA_MODE_SET(x) (((x) << FCR_DMA_MODE_LSB) & FCR_DMA_MODE_MASK)
-#define FCR_XMIT_FIFO_RST_MSB 2
-#define FCR_XMIT_FIFO_RST_LSB 2
-#define FCR_XMIT_FIFO_RST_MASK 0x00000004
-#define FCR_XMIT_FIFO_RST_GET(x) (((x) & FCR_XMIT_FIFO_RST_MASK) >> FCR_XMIT_FIFO_RST_LSB)
-#define FCR_XMIT_FIFO_RST_SET(x) (((x) << FCR_XMIT_FIFO_RST_LSB) & FCR_XMIT_FIFO_RST_MASK)
-#define FCR_RCVR_FIFO_RST_MSB 1
-#define FCR_RCVR_FIFO_RST_LSB 1
-#define FCR_RCVR_FIFO_RST_MASK 0x00000002
-#define FCR_RCVR_FIFO_RST_GET(x) (((x) & FCR_RCVR_FIFO_RST_MASK) >> FCR_RCVR_FIFO_RST_LSB)
-#define FCR_RCVR_FIFO_RST_SET(x) (((x) << FCR_RCVR_FIFO_RST_LSB) & FCR_RCVR_FIFO_RST_MASK)
-#define FCR_FIFO_EN_MSB 0
-#define FCR_FIFO_EN_LSB 0
-#define FCR_FIFO_EN_MASK 0x00000001
-#define FCR_FIFO_EN_GET(x) (((x) & FCR_FIFO_EN_MASK) >> FCR_FIFO_EN_LSB)
-#define FCR_FIFO_EN_SET(x) (((x) << FCR_FIFO_EN_LSB) & FCR_FIFO_EN_MASK)
-
-#define LCR_ADDRESS 0x0005100c
-#define LCR_OFFSET 0x0000000c
-#define LCR_DLAB_MSB 7
-#define LCR_DLAB_LSB 7
-#define LCR_DLAB_MASK 0x00000080
-#define LCR_DLAB_GET(x) (((x) & LCR_DLAB_MASK) >> LCR_DLAB_LSB)
-#define LCR_DLAB_SET(x) (((x) << LCR_DLAB_LSB) & LCR_DLAB_MASK)
-#define LCR_BREAK_MSB 6
-#define LCR_BREAK_LSB 6
-#define LCR_BREAK_MASK 0x00000040
-#define LCR_BREAK_GET(x) (((x) & LCR_BREAK_MASK) >> LCR_BREAK_LSB)
-#define LCR_BREAK_SET(x) (((x) << LCR_BREAK_LSB) & LCR_BREAK_MASK)
-#define LCR_EPS_MSB 4
-#define LCR_EPS_LSB 4
-#define LCR_EPS_MASK 0x00000010
-#define LCR_EPS_GET(x) (((x) & LCR_EPS_MASK) >> LCR_EPS_LSB)
-#define LCR_EPS_SET(x) (((x) << LCR_EPS_LSB) & LCR_EPS_MASK)
-#define LCR_PEN_MSB 3
-#define LCR_PEN_LSB 3
-#define LCR_PEN_MASK 0x00000008
-#define LCR_PEN_GET(x) (((x) & LCR_PEN_MASK) >> LCR_PEN_LSB)
-#define LCR_PEN_SET(x) (((x) << LCR_PEN_LSB) & LCR_PEN_MASK)
-#define LCR_STOP_MSB 2
-#define LCR_STOP_LSB 2
-#define LCR_STOP_MASK 0x00000004
-#define LCR_STOP_GET(x) (((x) & LCR_STOP_MASK) >> LCR_STOP_LSB)
-#define LCR_STOP_SET(x) (((x) << LCR_STOP_LSB) & LCR_STOP_MASK)
-#define LCR_CLS_MSB 1
-#define LCR_CLS_LSB 0
-#define LCR_CLS_MASK 0x00000003
-#define LCR_CLS_GET(x) (((x) & LCR_CLS_MASK) >> LCR_CLS_LSB)
-#define LCR_CLS_SET(x) (((x) << LCR_CLS_LSB) & LCR_CLS_MASK)
-
-#define MCR_ADDRESS 0x00051010
-#define MCR_OFFSET 0x00000010
-#define MCR_LOOPBACK_MSB 5
-#define MCR_LOOPBACK_LSB 5
-#define MCR_LOOPBACK_MASK 0x00000020
-#define MCR_LOOPBACK_GET(x) (((x) & MCR_LOOPBACK_MASK) >> MCR_LOOPBACK_LSB)
-#define MCR_LOOPBACK_SET(x) (((x) << MCR_LOOPBACK_LSB) & MCR_LOOPBACK_MASK)
-#define MCR_OUT2_MSB 3
-#define MCR_OUT2_LSB 3
-#define MCR_OUT2_MASK 0x00000008
-#define MCR_OUT2_GET(x) (((x) & MCR_OUT2_MASK) >> MCR_OUT2_LSB)
-#define MCR_OUT2_SET(x) (((x) << MCR_OUT2_LSB) & MCR_OUT2_MASK)
-#define MCR_OUT1_MSB 2
-#define MCR_OUT1_LSB 2
-#define MCR_OUT1_MASK 0x00000004
-#define MCR_OUT1_GET(x) (((x) & MCR_OUT1_MASK) >> MCR_OUT1_LSB)
-#define MCR_OUT1_SET(x) (((x) << MCR_OUT1_LSB) & MCR_OUT1_MASK)
-#define MCR_RTS_MSB 1
-#define MCR_RTS_LSB 1
-#define MCR_RTS_MASK 0x00000002
-#define MCR_RTS_GET(x) (((x) & MCR_RTS_MASK) >> MCR_RTS_LSB)
-#define MCR_RTS_SET(x) (((x) << MCR_RTS_LSB) & MCR_RTS_MASK)
-#define MCR_DTR_MSB 0
-#define MCR_DTR_LSB 0
-#define MCR_DTR_MASK 0x00000001
-#define MCR_DTR_GET(x) (((x) & MCR_DTR_MASK) >> MCR_DTR_LSB)
-#define MCR_DTR_SET(x) (((x) << MCR_DTR_LSB) & MCR_DTR_MASK)
-
-#define LSR_ADDRESS 0x00051014
-#define LSR_OFFSET 0x00000014
-#define LSR_FERR_MSB 7
-#define LSR_FERR_LSB 7
-#define LSR_FERR_MASK 0x00000080
-#define LSR_FERR_GET(x) (((x) & LSR_FERR_MASK) >> LSR_FERR_LSB)
-#define LSR_FERR_SET(x) (((x) << LSR_FERR_LSB) & LSR_FERR_MASK)
-#define LSR_TEMT_MSB 6
-#define LSR_TEMT_LSB 6
-#define LSR_TEMT_MASK 0x00000040
-#define LSR_TEMT_GET(x) (((x) & LSR_TEMT_MASK) >> LSR_TEMT_LSB)
-#define LSR_TEMT_SET(x) (((x) << LSR_TEMT_LSB) & LSR_TEMT_MASK)
-#define LSR_THRE_MSB 5
-#define LSR_THRE_LSB 5
-#define LSR_THRE_MASK 0x00000020
-#define LSR_THRE_GET(x) (((x) & LSR_THRE_MASK) >> LSR_THRE_LSB)
-#define LSR_THRE_SET(x) (((x) << LSR_THRE_LSB) & LSR_THRE_MASK)
-#define LSR_BI_MSB 4
-#define LSR_BI_LSB 4
-#define LSR_BI_MASK 0x00000010
-#define LSR_BI_GET(x) (((x) & LSR_BI_MASK) >> LSR_BI_LSB)
-#define LSR_BI_SET(x) (((x) << LSR_BI_LSB) & LSR_BI_MASK)
-#define LSR_FE_MSB 3
-#define LSR_FE_LSB 3
-#define LSR_FE_MASK 0x00000008
-#define LSR_FE_GET(x) (((x) & LSR_FE_MASK) >> LSR_FE_LSB)
-#define LSR_FE_SET(x) (((x) << LSR_FE_LSB) & LSR_FE_MASK)
-#define LSR_PE_MSB 2
-#define LSR_PE_LSB 2
-#define LSR_PE_MASK 0x00000004
-#define LSR_PE_GET(x) (((x) & LSR_PE_MASK) >> LSR_PE_LSB)
-#define LSR_PE_SET(x) (((x) << LSR_PE_LSB) & LSR_PE_MASK)
-#define LSR_OE_MSB 1
-#define LSR_OE_LSB 1
-#define LSR_OE_MASK 0x00000002
-#define LSR_OE_GET(x) (((x) & LSR_OE_MASK) >> LSR_OE_LSB)
-#define LSR_OE_SET(x) (((x) << LSR_OE_LSB) & LSR_OE_MASK)
-#define LSR_DR_MSB 0
-#define LSR_DR_LSB 0
-#define LSR_DR_MASK 0x00000001
-#define LSR_DR_GET(x) (((x) & LSR_DR_MASK) >> LSR_DR_LSB)
-#define LSR_DR_SET(x) (((x) << LSR_DR_LSB) & LSR_DR_MASK)
-
-#define MSR_ADDRESS 0x00051018
-#define MSR_OFFSET 0x00000018
-#define MSR_DCD_MSB 7
-#define MSR_DCD_LSB 7
-#define MSR_DCD_MASK 0x00000080
-#define MSR_DCD_GET(x) (((x) & MSR_DCD_MASK) >> MSR_DCD_LSB)
-#define MSR_DCD_SET(x) (((x) << MSR_DCD_LSB) & MSR_DCD_MASK)
-#define MSR_RI_MSB 6
-#define MSR_RI_LSB 6
-#define MSR_RI_MASK 0x00000040
-#define MSR_RI_GET(x) (((x) & MSR_RI_MASK) >> MSR_RI_LSB)
-#define MSR_RI_SET(x) (((x) << MSR_RI_LSB) & MSR_RI_MASK)
-#define MSR_DSR_MSB 5
-#define MSR_DSR_LSB 5
-#define MSR_DSR_MASK 0x00000020
-#define MSR_DSR_GET(x) (((x) & MSR_DSR_MASK) >> MSR_DSR_LSB)
-#define MSR_DSR_SET(x) (((x) << MSR_DSR_LSB) & MSR_DSR_MASK)
-#define MSR_CTS_MSB 4
-#define MSR_CTS_LSB 4
-#define MSR_CTS_MASK 0x00000010
-#define MSR_CTS_GET(x) (((x) & MSR_CTS_MASK) >> MSR_CTS_LSB)
-#define MSR_CTS_SET(x) (((x) << MSR_CTS_LSB) & MSR_CTS_MASK)
-#define MSR_DDCD_MSB 3
-#define MSR_DDCD_LSB 3
-#define MSR_DDCD_MASK 0x00000008
-#define MSR_DDCD_GET(x) (((x) & MSR_DDCD_MASK) >> MSR_DDCD_LSB)
-#define MSR_DDCD_SET(x) (((x) << MSR_DDCD_LSB) & MSR_DDCD_MASK)
-#define MSR_TERI_MSB 2
-#define MSR_TERI_LSB 2
-#define MSR_TERI_MASK 0x00000004
-#define MSR_TERI_GET(x) (((x) & MSR_TERI_MASK) >> MSR_TERI_LSB)
-#define MSR_TERI_SET(x) (((x) << MSR_TERI_LSB) & MSR_TERI_MASK)
-#define MSR_DDSR_MSB 1
-#define MSR_DDSR_LSB 1
-#define MSR_DDSR_MASK 0x00000002
-#define MSR_DDSR_GET(x) (((x) & MSR_DDSR_MASK) >> MSR_DDSR_LSB)
-#define MSR_DDSR_SET(x) (((x) << MSR_DDSR_LSB) & MSR_DDSR_MASK)
-#define MSR_DCTS_MSB 0
-#define MSR_DCTS_LSB 0
-#define MSR_DCTS_MASK 0x00000001
-#define MSR_DCTS_GET(x) (((x) & MSR_DCTS_MASK) >> MSR_DCTS_LSB)
-#define MSR_DCTS_SET(x) (((x) << MSR_DCTS_LSB) & MSR_DCTS_MASK)
-
-
-/************************** config definition ***************************/
-#define UART_FIFO_SIZE 512 //Must be 2^N
-
-#define USE_POST_BUFFER 0 // ENABLE a tx buffer for post processing,
-/*********************** data struction definition ************************/
-// data struction definition
-struct uart_fifo {
-#if USE_POST_BUFFER
- uint8_t buf[UART_FIFO_SIZE];
-#endif
- uint16_t start_index;
- uint16_t end_index;
- uint32_t overrun_err;
-};
-
-
-struct uart_blk {
- uint16_t debug_mode;
- uint16_t baud;
- struct uart_api *_uart;
- struct uart_fifo _tx;
-};
-
-/******** hardware API table structure (API descriptions below) *************/
-struct uart_api {
- uint32_t (*_uart_init)(void);
- void (*_uart_char_put)(uint8_t ch);
- uint16_t (*_uart_char_get)(uint8_t* ch);
- void (*_uart_str_out)(uint8_t* str);
- void (*_uart_task)(void);
- uint32_t (*_uart_status)(void);
- void (*_uart_config)(uint16_t flag);
- void (*_uart_hwinit)(uint32_t freq, uint32_t baud);
-};
-
-#endif // end of _UART_API_H_
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef _USB_TABLE_H_
-#define _USB_TABLE_H_
-
-#include "sys_cfg.h"
-// UsbDeviceDescriptor
-#define USB_DEVICE_DESC_TYPE 0x01
-#define USB_DEVICE_DESC_LEN 0x12
-#define USB_SPEC_VERSION 0x0200
-#define USB_DEVICE_CLASS 0xFF
-#define USB_DEVICE_SUB_CLASS 0xFF
-#define USB_DEVICE_PROTOCOL 0xFF
-#define USB_MAX_PKT_SIZE 0x40
-#define USB_VENDOR_ID 0x0CF3
-#define USB_PRODUCT_ID 0x9271
-
-#if 1 /* USB Device Descriptor : byte 12, 13 Device BCD -> Device release number in binary-coded decimal. */
-#define USB_DEVICE_BCD BOOTROM_VER
-#else
-#define USB_DEVICE_BCD 0x0106
-#endif
-
-#define USB_MANUFACTURER_INDEX 0x10
-#define USB_PRODUCT_INDEX 0x20
-#define USB_SERIAL_INDEX 0x30
-#define USB_CONFIGURATION_NUM 0x01
-// end UsbDeviceDescriptor
-
-#define USB_CONFIG_DESC_TYPE 0x02
-#define USB_CONFIG_DESC_LEN 0x09
-//#define USB_TOTAL_DESC_LEN 0x002E // 4 ep
-//#define USB_TOTAL_DESC_LEN 0x0035 // 5 ep
-#define USB_TOTAL_DESC_LEN 0x003C // 6 ep
-#define USB_INTERFACE_NUM 0x01
-#define USB_CONFIG_NUM 0x01
-#define USB_STRING_INDEX 0x00
-#define USB_ATTRIBUTE 0x80
-#define USB_MAX_POWER 0xFA
-
-#define USB_INTERFACE_DESC_TYPE 0x04
-#define USB_INTERFACE_DESC_LEN 0x09
-#define USB_INTERFACE_INDEX_NUM 0x00
-#define USB_INTERFACE_ALT_SETTING 0x00
-//#define USB_INTERFACE_EP_NUM 0x04
-//#define USB_INTERFACE_EP_NUM 0x05
-#define USB_INTERFACE_EP_NUM 0x06
-#define USB_INTERFACE_CLASS 0xFF
-#define USB_INTERFACE_SUB_CLASS 0x00
-#define USB_INTERFACE_PROTOCOL 0x00
-#define USB_INTERFACE_STRING_INDEX 0x00
-
-#define USB_EP_DESC_TYPE 0x05
-#define USB_EP_DESC_LEN 0x07
-
-/* USB Endpoint attribute */
-#define bUSB_EP1_NUM 0x01
-#define bUSB_EP2_NUM 0x02
-#define bUSB_EP3_NUM 0x03
-#define bUSB_EP4_NUM 0x04
-#define bUSB_EP5_NUM 0x05
-#define bUSB_EP6_NUM 0x06
-
-#define bUSB_EP_DIRECTION_IN 0x80
-#define bUSB_EP_DIRECTION_OUT 0x00
-
-#define bUSB_EP_TYPE_CONTROL 0x00
-#define bUSB_EP_TYPE_ISOCHRONOUS 0x01
-#define bUSB_EP_TYPE_BULK 0x02
-#define bUSB_EP_TYPE_INTERRUPT 0x03
-
-#define bUSB_EP_MAX_PKT_SIZE_64 0x0040
-#define bUSB_EP_MAX_PKT_SIZE_512 0x0200
-
-/* High Speed Endpoint */
-#define USB_HS_EP1_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP1_NUM)
-#define USB_HS_EP1_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_HS_EP1_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
-#define USB_HS_EP1_INTERVAL 0x00
-
-#define USB_HS_EP2_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP2_NUM)
-#define USB_HS_EP2_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_HS_EP2_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
-#define USB_HS_EP2_INTERVAL 0x00
-
-#define USB_HS_EP3_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP3_NUM)
-#define USB_HS_EP3_ATTRIBUTE bUSB_EP_TYPE_INTERRUPT
-#define USB_HS_EP3_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_HS_EP3_INTERVAL 0x01
-
-#define USB_HS_EP4_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP4_NUM)
-#define USB_HS_EP4_ATTRIBUTE bUSB_EP_TYPE_INTERRUPT //bUSB_EP_TYPE_BULK
-#define USB_HS_EP4_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_HS_EP4_INTERVAL 0x01 //0x00
-
-#define USB_HS_EP5_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP5_NUM)
-#define USB_HS_EP5_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_HS_EP5_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
-#define USB_HS_EP5_INTERVAL 0x00
-
-#define USB_HS_EP6_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP6_NUM)
-#define USB_HS_EP6_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_HS_EP6_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
-#define USB_HS_EP6_INTERVAL 0x00
-
-/* Full Speed Endpoint */
-#define USB_FS_EP1_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP1_NUM)
-#define USB_FS_EP1_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP1_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP1_INTERVAL 0x00
-
-#define USB_FS_EP2_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP2_NUM)
-#define USB_FS_EP2_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP2_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP2_INTERVAL 0x00
-
-#define USB_FS_EP3_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP3_NUM)
-#define USB_FS_EP3_ATTRIBUTE bUSB_EP_TYPE_INTERRUPT
-#define USB_FS_EP3_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP3_INTERVAL 0x01
-
-#define USB_FS_EP4_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP4_NUM)
-#define USB_FS_EP4_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP4_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP4_INTERVAL 0x00
-
-#define USB_FS_EP5_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP5_NUM)
-#define USB_FS_EP5_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP5_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP5_INTERVAL 0x00
-
-#define USB_FS_EP6_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP6_NUM)
-#define USB_FS_EP6_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP6_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP6_INTERVAL 0x00
-
-//#define USB_QUALIFIER_DESC_ADDR 0x8cff00
-//#define USB_OTHER_SPEED_DESC_ADDR 0x8cffA
-
-#endif // end of _USB_TABLE_H_
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-/*
- * @File: VBUF_api.h
- *
- * @Abstract: Host Interface api
- *
- * @Notes:
- */
-
-#ifndef _VBUF_API_H
-#define _VBUF_API_H
-
-#include <vdesc_api.h>
-
-#define MAX_BUF_CTX_LEN 20
-
-typedef struct _VBUF
-{
- VDESC *desc_list;
- struct _VBUF *next_buf;
- A_UINT16 buf_length;
- A_UINT8 reserved[2];
- A_UINT8 ctx[MAX_BUF_CTX_LEN];
-} VBUF;
-
-#define VBUF_GET_DATA_ADDR(vbuf) (vbuf->desc_list->buf_addr + vbuf->desc_list->data_offset)
-
-/* hardware API table structure (API descriptions below) */
-struct vbuf_api {
- void (*_init)(int nBuf);
- VBUF* (*_alloc_vbuf)(void);
- VBUF* (*_alloc_vbuf_with_size)(int size, int reserve);
- void (*_free_vbuf)(VBUF *buf);
-
- /* room to expand this table by another table */
- void *pReserved;
-};
-
-extern void vbuf_module_install(struct vbuf_api *apis);
-
-#endif /* #ifndef _HIF_API_H */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-/*
- * @File: VBUF_api.h
- *
- * @Abstract: Host Interface api
- *
- * @Notes:
- */
-
-#ifndef _VDESC_API_H
-#define _VDESC_API_H
-
-#define MAX_HW_DESC_SIZE 20
-
-typedef struct _VDESC
-{
- struct _VDESC *next_desc;
- A_UINT8 *buf_addr;
- A_UINT16 buf_size;
- A_UINT16 data_offset;
- A_UINT16 data_size;
- A_UINT16 control;
- A_UINT8 hw_desc_buf[MAX_HW_DESC_SIZE];
-} VDESC;
-
-#define VDESC_HW_TO_VDESC(hwdesc) ((VDESC *)(((A_UINT32 *)hwdesc - 4)))
-
-struct vdesc_api {
- void (*_init)(int nDesc);
- VDESC* (*_alloc_vdesc)();
- A_UINT8* (*_get_hw_desc)(VDESC *desc);
- void (*_swap_vdesc)(VDESC *dest, VDESC *src);
-
- /* room to expand this table by another table */
- void *pReserved;
-};
-
-extern void vdesc_module_install(struct vdesc_api *apis);
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __WDT_API_H__
-#define __WDT_API_H__
-
-typedef enum {
- WDT_ACTION_NO = 0, // bit1, bit0: 00
- WDT_ACTION_INTR, // bit1, bit0: 01
- WDT_ACTION_NMI, // bit1, bit0: 10
- WDT_ACTION_RESET, // bit1, bit0: 11
-
- WDT_ACTION_UNKNOWN
-} T_WDT_ACTION_TYPE;
-
-typedef enum {
- WDT_TIMEOUT = 1,
- WDT_ACTION,
-
- WDT_UNKNOWN
-} T_WDT_CMD_TYPE;
-
-typedef struct {
- uint32_t cmd;
- union {
- uint32_t timeout;
- uint32_t action;
- };
-}T_WDT_CMD;
-
-typedef enum {
- ENUM_WDT_BOOT = 1,
- ENUM_COLD_BOOT,
- ENUM_SUSP_BOOT,
-
- // add above here
- ENUM_UNKNOWN_BOOT
-} T_BOOT_TYPE;
-
-
-/*!- interface of watchdog timer
- *
- */
-struct wdt_api {
- void (* _wdt_init)(void);
- void (* _wdt_enable)(void);
- void (* _wdt_disable)(void);
- void (* _wdt_set)(T_WDT_CMD);
- void (* _wdt_task)(void);
- void (* _wdt_reset)(void);
- T_BOOT_TYPE (*_wdt_last_boot)(void);
-};
-#endif /* __WDT_API_H__ */
-
+++ /dev/null
-/*
- * 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __SHARED_COMPILER_H
-#define __SHARED_COMPILER_H
-
-#define __noinline __attribute__((noinline))
-#define __noreturn __attribute__((noreturn))
-#define __inline __attribute__((always_inline))
-#define __hot __attribute__((hot))
-#define __cold __attribute__((cold))
-#define __unused __attribute__((unused))
-#define __force __attribute__((force))
-#define __section(s) __attribute__((section("." # s)))
-#define __aligned(a) __attribute__((aligned(a)))
-#define __packed __attribute__((packed))
-#define __visible __attribute__((externally_visible))
-
-#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
-#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
-
-#define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a) - 1)
-#define __ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask))
-
-#define __roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
-
-#define __must_be_array(a) \
- BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
-#define ARRAY_SIZE(arr) (sizeof((arr)) / sizeof((arr)[0]) + __must_be_array(arr))
-
-#define BIT(b) (1 << (b))
-#define MASK(w) (BIT(w) - 1)
-
-#undef offsetof
-#ifdef __compiler_offsetof
-# define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
-#else
-# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-
-#define likely(x) __builtin_expect(!!(x), 1)
-#define unlikely(x) __builtin_expect(!!(x), 0)
-
-#define min(x, y) ({ \
- typeof(x) _min1 = (x); \
- typeof(y) _min2 = (y); \
- (void) (&_min1 == &_min2); \
- _min1 < _min2 ? _min1 : _min2; })
-
-#define max(x, y) ({ \
- typeof(x) _max1 = (x); \
- typeof(y) _max2 = (y); \
- (void) (&_max1 == &_max2); \
- _max1 > _max2 ? _max1 : _max2; })
-
-#define min_t(type, x, y) ({ \
- type __min1 = (x); \
- type __min2 = (y); \
- __min1 < __min2 ? __min1 : __min2; })
-
-#define max_t(type, x, y) ({ \
- type __max1 = (x); \
- type __max2 = (y); \
- __max1 > __max2 ? __max1 : __max2; })
-
-
-#define container_of(ptr, type, member) ({ \
- const typeof(((type *)0)->member) * __mptr = (ptr); \
- (type *)(((unsigned long)__mptr - offsetof(type, member))); })
-
-#define MAX_ERRNO 4095
-
-#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
-
-static inline void *ERR_PTR(long errornr)
-{
- return (void *) errornr;
-}
-
-static inline long PTR_ERR(const void *ptr)
-{
- return (long) ptr;
-}
-
-static inline long IS_ERR(const void *ptr)
-{
- return IS_ERR_VALUE((unsigned long)ptr);
-}
-
-static inline long IS_ERR_OR_NULL(const void *ptr)
-{
- return !ptr || IS_ERR_VALUE((unsigned long)ptr);
-}
-#endif /* __SHARED_COMPILER_H */
*/
/*
* @File: Magpie_api.h
- *
+ *
* @Abstract: Magpie FW api
- *
+ *
* @Notes:
*/
#define dma_lib_tx_init(eng_no, if_type) A_INDIR(dma_lib.tx_init(eng_no, if_type))
#define dma_lib_rx_init(eng_no, if_type) A_INDIR(dma_lib.rx_init(eng_no, if_type))
#define dma_lib_rx_config(eng_no, desc, gran) A_INDIR(dma_lib.rx_config(eng_no, desc, gran))
-#define dma_lib_tx_start(eng_no) A_INDIR(dma_lib.tx_start(eng_no))
-#define dma_lib_rx_start(eng_no) A_INDIR(dma_lib.rx_start(eng_no))
+#define dma_lib_tx_start(eng_no) A_INDIR(dma_lib.tx_start(eng_no))
+#define dma_lib_rx_start(eng_no) A_INDIR(dma_lib.rx_start(eng_no))
#define dma_lib_intr_status(if_type) A_INDIR(dma_lib.intr_status(if_type))
#define dma_lib_hard_xmit(eng_no, buf) A_INDIR(dma_lib.hard_xmit(eng_no, buf))
#define dma_lib_flush_xmit(eng_no) A_INDIR(dma_lib.flush_xmit(eng_no))
#define HIF_init(pConfig) A_INDIR(hif._init(pConfig))
#define HIF_shutdown(h) A_INDIR(hif._shutdown(h))
#define HIF_register_callback(h, pConfig) A_INDIR(hif._register_callback(h, pConfig))
-#define HIF_start(h) A_INDIR(hif._start(h))
-#define HIF_config_pipe(h, pipe, desc_list) A_INDIR(hif._config_pipe(h, pipe, desc_list))
-#define HIF_send_buffer(h, pipe, buf) A_INDIR(hif._send_buffer(h, pipe, buf))
-#define HIF_return_recv_buf(h, pipe, buf) A_INDIR(hif._return_recv_buf(h, pipe, buf))
-#define HIF_isr_handler(h) A_INDIR(hif._isr_handler(h))
+#define HIF_start(h) A_INDIR(hif._start(h))
+#define HIF_config_pipe(h, pipe, desc_list) A_INDIR(hif._config_pipe(h, pipe, desc_list))
+#define HIF_send_buffer(h, pipe, buf) A_INDIR(hif._send_buffer(h, pipe, buf))
+#define HIF_return_recv_buf(h, pipe, buf) A_INDIR(hif._return_recv_buf(h, pipe, buf))
+#define HIF_isr_handler(h) A_INDIR(hif._isr_handler(h))
#define HIF_is_pipe_supported(h, pipe) A_INDIR(hif._is_pipe_supported(h, pipe))
#define HIF_get_max_msg_len(h, pipe) A_INDIR(hif._get_max_msg_len(h, pipe))
#define HIF_get_reserved_headroom(h) A_INDIR(hif._get_reserved_headroom(h))
#define HTC_GetReservedHeadroom(h) A_INDIR(htc._HTC_GetReservedHeadroom(h))
#define HTC_NotifyTargetInserted(h)
-#define HTC_NotifyTargetDetached(h)
+#define HTC_NotifyTargetDetached(h)
/* WMI SVC module */
#define WMI_SERVICE_MODULE_INSTALL() WMI_service_module_install(&_A_MAGPIE_INDIRECTION_TABLE->wmi_svc_api)
//#endif
struct hif_api hif;
struct htc_apis htc;
- WMI_SVC_APIS wmi_svc_api;
+ WMI_SVC_APIS wmi_svc_api;
struct usbfifo_api usbfifo_api;
struct buf_pool_api buf_pool;
-#ifdef MAGPIE_FW_BUILD
+#ifdef MAGPIE_FW_BUILD
struct vbuf_api vbuf;
struct vdesc_api vdesc;
struct allocram_api allocram;
-#endif
+#endif
struct dma_engine_api dma_engine;
struct dma_lib_api dma_lib;
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-/*
- * (c) Copyright Atheros Communications
- * FreeBSD specific prototypes
- */
-#ifndef _ADF_NBUF_PVT_H
-#define _ADF_NBUF_PVT_H
-
-#include <osapi.h>
-//#include <Magpie_api.h>
-#include <vbuf_api.h>
-//#include <adf_nbuf_api.h>
-
-#define __ADF_NBUF_NULL NULL
-#define __ADF_NBUF_CTX_BUF
-
-typedef VBUF * __adf_nbuf_t;
-
-/**
- * queue head
- */
-typedef struct __adf_nbuf_qhead {
- VBUF *head;
- VBUF *tail;
- a_uint32_t qlen;
-}__adf_nbuf_qhead_t;
-
-typedef __adf_nbuf_qhead_t __adf_nbuf_queue_t;
-
-__adf_nbuf_t
-__adf_nbuf_alloc(adf_os_size_t size,
- a_uint32_t reserve, a_uint32_t align);
-
-void
-__adf_nbuf_free(__adf_nbuf_t buf);
-
-#ifndef _ROM_
-a_uint8_t *
-__adf_nbuf_push_head(__adf_nbuf_t buf, adf_os_size_t size);
-
-a_uint8_t *
-__adf_nbuf_pull_head(__adf_nbuf_t buf, adf_os_size_t size);
-
-a_uint8_t *
-__adf_nbuf_put_tail(__adf_nbuf_t buf, adf_os_size_t size);
-#endif
-
-void
-__adf_nbuf_trim_tail(__adf_nbuf_t buf, adf_os_size_t size);
-
-__adf_nbuf_t
-__adf_nbuf_realloc_headroom(__adf_nbuf_t buf,
- a_uint32_t headroom);
-
-__adf_nbuf_t
-__adf_nbuf_realloc_tailroom(__adf_nbuf_t buf,
- a_uint32_t tailroom);
-
-__adf_nbuf_t
-__adf_nbuf_expand(__adf_nbuf_t buf,
- a_uint32_t headroom, a_uint32_t tailroom);
-
-__adf_nbuf_t
-__adf_nbuf_copy(__adf_nbuf_t src);
-
-__adf_nbuf_t
-__adf_nbuf_unshare(__adf_nbuf_t src);
-
-void
-__adf_nbuf_frag_info(__adf_nbuf_t buf, adf_os_sglist_t *sg);
-
-#ifndef _ROM_
-a_uint8_t *
-__adf_nbuf_get_priv(__adf_nbuf_t buf);
-#endif
-
-void
-__adf_nbuf_queue_add(__adf_nbuf_qhead_t *qhead,
- __adf_nbuf_t buf);
-
-__adf_nbuf_t
-__adf_nbuf_queue_remove(__adf_nbuf_qhead_t *qhead);
-
-a_uint32_t
-__adf_nbuf_tx_cksum_info(__adf_nbuf_t buf,
- a_uint8_t **hdr_off,
- a_uint8_t **where);
-
-void
-__adf_nbuf_set_rx_cksum(__adf_nbuf_t buf, adf_nbuf_rx_cksum_t *cksum);
-void
-__adf_nbuf_get_tso_info(__adf_nbuf_t buf, adf_nbuf_tso_t *tso);
-
-a_status_t
-__adf_nbuf_get_vlan_info(adf_net_handle_t hdl,
- __adf_nbuf_t buf,
- adf_net_vlanhdr_t *vlan);
-
-void
-__adf_nbuf_dmamap_info(__adf_os_dma_map_t bmap, adf_os_dmamap_info_t *sg);
-
-/**
- * @brief return the last mbuf
- *
- * @param m0
- *
- * @return struct mbuf*
- */
-#ifndef _ROM_
-VDESC *
-__adf_nbuf_last(VBUF *buf);
-#endif
-
-/**
- * @brief num bytes in the head
- *
- * @param adf_nbuf
- *
- * @return num of bytes available
- */
-#ifndef _ROM_
-a_uint32_t
-__adf_nbuf_headroom(__adf_nbuf_t buf);
-#endif
-
-/**
- * @brief num of bytes available in the tail excluding the priv
- * portion
- *
- * @param adf_nbuf
- *
- * @return num of bytes
- */
-#ifndef _ROM_
-a_uint32_t
-__adf_nbuf_tailroom(__adf_nbuf_t buf);
-#endif
-
-/**
- * @brief get the entire packet length
- *
- * @param adf_nbuf
- *
- * @return total length of packet (sum of all frag lengths)
- */
-#ifndef _ROM_
-a_uint32_t
-__adf_nbuf_len(__adf_nbuf_t buf);
-#endif
-
-/**
- * @brief Clone the nbuf (will not create writeable copies)
- *
- * @param adf_nbuf
- *
- * @return Read-only copy of the nbuf (including clusters)
- */
-__adf_nbuf_t
-__adf_nbuf_clone(__adf_nbuf_t src);
-
-void
-__adf_nbuf_cat(__adf_nbuf_t dst, __adf_nbuf_t src);
-
-
-/*
- * @brief check if the mbuf is cloned or not
- *
- * @param buf
- *
- * @return a_bool_t
- */
-a_bool_t
-__adf_nbuf_is_cloned(__adf_nbuf_t buf);
-
-/**
- * @brief This will return the header's addr & m_len
- */
-#ifndef _ROM_
-void
-__adf_nbuf_peek_header(__adf_nbuf_t buf, a_uint8_t **addr,
- a_uint32_t *len);
-#endif
-
-/**
- * @brief init the queue
- * @param qhead
- */
-void
-__adf_nbuf_queue_init(__adf_nbuf_qhead_t *qhead);
-
-/**
- * @brief return the length of queue
- * @param adf_qhead
- *
- * @return length
- *
- */
-a_uint32_t
-__adf_nbuf_queue_len(__adf_nbuf_qhead_t *qhead);
-
-/**
- * @brief returns the first guy in the Q
- * @param qhead
- *
- * @return (NULL if the Q is empty)
- */
-#ifndef _ROM_
-__adf_nbuf_t
-__adf_nbuf_queue_first(__adf_nbuf_queue_t *qhead);
-
-/**
- * @brief return the next packet from packet chain
- *
- * @param buf (packet)
- *
- * @return (NULL if no packets are there)
- */
-__adf_nbuf_t
-__adf_nbuf_queue_next(__adf_nbuf_t buf);
-#endif
-
-/**
- * @brief check if the queue is empty or not
- *
- * @param qhead
- *
- * @return a_bool_t
- */
-a_bool_t
-__adf_nbuf_is_queue_empty(__adf_nbuf_qhead_t *qhead);
-
-__adf_nbuf_t
-__adf_nbuf_create_frm_frag(__adf_nbuf_queue_t *head);
-void
-__adf_nbuf_split_to_frag(__adf_nbuf_t buf, __adf_nbuf_queue_t *qhead);
-
-#ifdef _ROM_
-
-/**
- * @brief This will return the header's addr & m_len
- */
-static inline void
-__adf_nbuf_peek_header(__adf_nbuf_t buf, a_uint8_t **addr,
- a_uint32_t *len)
-{
- VDESC *desc = buf->desc_list;
-
- *addr = desc->buf_addr + desc->data_offset;
- *len = desc->data_size;
-}
-
-/**
- * @brief return the last mbuf
- *
- * @param m0
- *
- * @return struct mbuf*
- */
-static inline VDESC *
-__adf_nbuf_last(VBUF *buf)
-{
- VDESC *desc = buf->desc_list;
-
- //for(; desc->next_desc != NULL; desc = desc->next_desc)
- // ;
- while(desc->next_desc != NULL)
- {
- desc = desc->next_desc;
- }
-
- return desc;
-}
-
-/**
- * @brief num bytes in the head
- *
- * @param adf_nbuf
- *
- * @return num of bytes available
- */
-static inline a_uint32_t
-__adf_nbuf_headroom(__adf_nbuf_t buf)
-{
- return buf->desc_list->data_offset;
-}
-
-/**
- * @brief num of bytes available in the tail excluding the priv
- * portion
- *
- * @param adf_nbuf
- *
- * @return num of bytes
- */
-
-static inline a_uint32_t
-__adf_nbuf_tailroom(__adf_nbuf_t buf)
-{
- VDESC *last_desc = __adf_nbuf_last(buf);
-
- return last_desc->buf_size - last_desc->data_offset - last_desc->data_size;
-}
-
-/**
- * @brief get the entire packet length
- *
- * @param adf_nbuf
- *
- * @return total length of packet (sum of all frag lengths)
- */
-static inline a_uint32_t
-__adf_nbuf_len(__adf_nbuf_t buf)
-{
- return buf->buf_length;
-}
-
-/**
- * @brief put data in the head
- *
- * @param buf
- * @param len (how much data to put)
- *
- * @return new data pointer ,NULL if the len is more than the
- * space available in the head frag.
- */
-static inline a_uint8_t *
-__adf_nbuf_push_head(__adf_nbuf_t buf, adf_os_size_t len)
-{
- a_uint8_t *ptr = NULL;
- VDESC *desc = buf->desc_list;
-
- desc->data_offset -= len;
- desc->data_size += len;
- buf->buf_length += len;
- ptr = desc->buf_addr + desc->data_offset;
- return(ptr);
-}
-
-/**
- *
- * @brief add data in the end of tail
- *
- * @param buf
- * @param len (how much data to put)
- *
- * @return previous tail (data+len),NULL if the len is more than
- * space available
- */
-static inline a_uint8_t *
-__adf_nbuf_put_tail(__adf_nbuf_t buf, adf_os_size_t len)
-{
- a_uint8_t *tail = NULL;
- VDESC *last_desc = __adf_nbuf_last(buf);
-
- tail = last_desc->buf_addr + last_desc->data_offset + last_desc->data_size;
- last_desc->data_size += len;
- buf->buf_length += len;
-
- return tail;
-}
-
-/**
- * @brief strip data from head
- *
- * @param adf_nbuf
- * @param len (how much data to rip)
- *
- * @return new data pointer
- */
-static inline a_uint8_t *
-__adf_nbuf_pull_head(__adf_nbuf_t buf, adf_os_size_t len)
-{
- a_uint8_t *ptr = NULL;
- VDESC *desc = buf->desc_list;
-
- desc->data_offset += len;
- desc->data_size -= len;
- buf->buf_length -= len;
- ptr = desc->buf_addr + desc->data_offset;
-
- return ptr;
-}
-
-/**
- * @brief retrieve the priv space pointer from nbuf
- *
- * @param buf (nbuf to attach the priv space)
- *
- * @return uint8_t* ( pointer to the data )
- */
-static inline a_uint8_t *
-__adf_nbuf_get_priv(__adf_nbuf_t buf)
-{
- //adf_os_assert(buf != NULL);
-
- return buf->ctx;
-}
-
-/**
- * @brief returns the first guy in the Q
- * @param qhead
- *
- * @return (NULL if the Q is empty)
- */
-static inline __adf_nbuf_t
-__adf_nbuf_queue_first(__adf_nbuf_queue_t *qhead)
-{
- return qhead->head;
-}
-/**
- * @brief return the next packet from packet chain
- *
- * @param buf (packet)
- *
- * @return (NULL if no packets are there)
- */
-static inline __adf_nbuf_t
-__adf_nbuf_queue_next(__adf_nbuf_t buf)
-{
- return buf->next_buf;
-}
-
-#endif
-
-#endif
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __ALLOCRAM_API_H__
-#define __ALLOCRAM_API_H__
-
-/* API for Target-side startup-time RAM allocations */
-
-struct allocram_api {
- /*
- * Initialize allocram, providing it with a block of RAM
- * (an "arena") from which to allocate.
- *
- * If arena_start is 0, a default start -- the end of
- * the application's text & data -- is used.
- *
- * If arena_sz is 0, a default size -- which uses most
- * of physical RAM beyond arena_start -- is used.
- *
- * Return value is reserved for future use -- it's an arena handle.
- */
- void *(* cmnos_allocram_init)(void *arena_start, A_UINT32 arena_sz);
-
- /*
- * Allocate nbytes of memory, returning a pointer to the start
- * of the allocated block. Allocation size is rounded up to the
- * nearest A_CACHE_LINE_SIZE and the returned address similarly
- * aligned.
- *
- * There is no need to check the return value from this function.
- * A failure to satisfy a RAM allocation request is treated as a
- * fatal error.
- *
- * Allocations are expected to occur only during startup; this
- * API does not, for instance, guarantee atomicity with respect
- * to allocations that might (foolishly) be attempted from
- * interrupt handlers.
- *
- * The "which_arena" parameter is currently unused, and should
- * be set to 0 -- only a single arena is currently supported.
- */
- void *(* cmnos_allocram)(void *which_arena, A_UINT32 nbytes);
-
- void (* cmnos_allocram_debug)(void);
-};
-
-extern void allocram_module_install(struct allocram_api *api);
-
-
-#endif /* __ALLOCRAM_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __ATHOS_API_H__
-#define __ATHOS_API_H__
-
-/*
- * This file contains wrappers to OS operating system functions
- * that are available in the Athos version of the operating system.
- *
- * Target software must always use these wrappers to access OS
- * services -- it may not access any OS services directly.
- *
- * These wrappers are intended to provide OS-independence for applications.
- * Using this header file, an application should be able to compile and
- * fully link without any other OS header files, source files, or
- * binary files.
- */
-
-#include <osapi.h>
-#include "dt_defs.h"
-#include "cmnos_api.h"
-//#include "HIF_api.h"
-//#include "vbuf_api.h"
-//#include "vdesc_api.h"
-//#include "htc_api.h"
-#include "Magpie_api.h"
-
-/* ROM Patch API */
-
-
-/* HTC API */
-
-
-/* WMI Adaptive API - required for WMI SVCs as they refer some of them*/
-
-
-/* WLAN WMI API - required for WMI SVCs and others...*/
-
-#if 0
-#define A_INDIR(sym) _A_OS_INDIRECTION_TABLE->sym
-
-/* HIF support */
-#define HIF_MODULE_INSTALL() hif_module_install(&_A_OS_INDIRECTION_TABLE->hif)
-#define HIF_init(pConfig) A_INDIR(hif._init(pConfig))
-#define HIF_start() A_INDIR(hif._start())
-#define HIF_config_pipe(pipe, desc_list) A_INDIR(hif._config_pipe(pipe, desc_list))
-#define HIF_send_buffer(pipe, buf) A_INDIR(hif._send_buffer(pipe, buf))
-#define HIF_return_recv_buf(pipe, buf) A_INDIR(hif._return_recv_buf(pipe, buf))
-#define HIF_isr_handler() A_INDIR(hif._isr_handler())
-#define HIF_is_pipe_supported(pipe) A_INDIR(hif._is_pipe_supported(pipe))
-
-/* VBUF APIs */
-#define VBUF_MODULE_INSTALL() vbuf_module_install(&_A_OS_INDIRECTION_TABLE->vbuf)
-#define VBUF_init(dataAddr, nBuf) A_INDIR(vbuf._init(dataAddr, nBuf))
-#define VBUF_alloc_vbuf() A_INDIR(vbuf._alloc_vbuf())
-#define VBUF_free_vbuf(buf) A_INDIR(vbuf._free_vbuf(buf))
-
-/* VDESC APIs */
-#define VDESC_MODULE_INSTALL() vdesc_module_install(&_A_OS_INDIRECTION_TABLE->vdesc)
-#define VDESC_init(dataAddr, nTxDesc, nRxDesc) A_INDIR(vdesc._init(dataAddr, nTxDesc, nRxDesc))
-#define VDESC_alloc_vdesc(type) A_INDIR(vdesc._alloc_vdesc(type))
-#define VDESC_get_hw_desc(type, desc) A_INDIR(vdesc._get_hw_desc(type, desc))
-//#define VDESC_free_vdesc(buf) A_INDIR(vdesc._free_vdesc(buf))
-
-#define HTC_MODULE_INSTALL() htc_module_install(&_A_OS_INDIRECTION_TABLE->htc)
-//#define HTC_init(dataAddr, SetupComplete, RecvBufferSize) A_INDIR(htc._HTC_Init(dataAddr, SetupComplete, RecvBufferSize))
-#define HTC_init(dataAddr, SetupComplete, pConfig) A_INDIR(htc._HTC_Init(dataAddr, SetupComplete, pConfig))
-#define HTC_RegisterService(s) A_INDIR(htc._HTC_RegisterService(s))
-#define HTC_Ready() A_INDIR(htc._HTC_Ready())
-#define HTC_SendMsg(endpt, buf) A_INDIR(htc._HTC_SendMsg(endpt, buf))
-#define HTC_ReturnBuffers(endpt, buf) A_INDIR(htc._HTC_ReturnBuffers(endpt, buf))
-
-#if 0
-/* WMI SVC module */
-#define WMI_SERVICE_MODULE_INSTALL() WMI_service_module_install(&_A_OS_INDIRECTION_TABLE->wmi_svc_api)
-#define WMI_Init(dataAddr, pCfg) A_INDIR(wmi_svc_api._WMI_Init(dataAddr, pCfg))
-#define WMI_RegisterDispatchTable(pT) A_INDIR(wmi_svc_api._WMI_RegisterDispatchTable(pT))
-#define WMI_AllocEvent(ec,len) A_INDIR(wmi_svc_api._WMI_AllocEvent(ec, len))
-#define WMI_SendEvent(ev,id,seq,len) A_INDIR(wmi_svc_api._WMI_SendEvent(ev, id, seq, len))
-#define WMI_GetPendingEventsCount() A_INDIR(wmi_svc_api._WMI_GetPendingEventsCount())
-#define WMI_GetControlEp() A_INDIR(wmi_svc_api._WMI_GetControlEp())
-#define WMI_SendCompleteHandler(ep, buf) A_INDIR(wmi_svc_api._WMI_SendCompleteHandler(ep, buf))
-#endif
-
-/*
- * This defines the layout of the indirection table, which
- * is used to access exported APIs of various modules. The
- * layout is shared across ROM and RAM code. RAM code may
- * call into ROM and ROM code may call into RAM. Because
- * of the latter, existing offsets must not change for the
- * lifetime of a revision of ROM; but new members may be
- * added at the end.
- */
-typedef struct _A_athos_indirection_table {
- _A_cmnos_indirection_table_t cmnos;
-
- /* TBD: to be added */
- struct hif_api hif;
- struct vbuf_api vbuf;
- struct vdesc_api vdesc;
- struct htc_apis htc;
- //WMI_SVC_APIS wmi_svc_api;
-} _A_athos_indirection_table_t;
-
-#if 1
-extern _A_athos_indirection_table_t _indir_tbl;
-#define _A_OS_INDIRECTION_TABLE_SIZE sizeof(_A_athos_indirection_table_t)
-#define _A_OS_INDIRECTION_TABLE (&_indir_tbl)
-#endif
-#endif
-
-extern unsigned int _data_start_in_rom;
-extern unsigned int _data_start;
-extern unsigned int _data_end;
-extern unsigned int _bss_start;
-extern unsigned int _bss_end;
-extern unsigned int _stack_sentry;
-extern unsigned int __stack;
-extern unsigned int _fw_image_end;
-
-#if defined(__XTENSA__)
-#define START_DATA _data_start
-#define END_DATA _data_end
-#define START_BSS _bss_start
-#define END_BSS _bss_end
-
-#define STACK_START _stack_sentry
-#define STACK_END __stack
-#endif
-
-
-struct _A_os_linkage_check {
- int version;
- int table;
-};
-
-
-/*
- * A_INIT() handles any initialization needed by the OS abstraction,
- * and it clears the application's BSS, if necessary. (Application BSS
- * is not cleared if the application is linked into a single image that
- * includes AthOS.)
- *
- * A_INIT() must be called first thing in the application (from app_start)
- * in order to guarantee that BSS has been cleared properly.
- */
-static INLINE int
-A_INIT(void)
-{
- struct _A_os_linkage_check link_check;
- unsigned int *clrptr;
-
- if (&START_BSS != _A_MAGPIE_INDIRECTION_TABLE->cmnos.start_bss) {
- /* Clear BSS */
- for (clrptr = &START_BSS; clrptr < &END_BSS; clrptr++) {
- *clrptr = 0;
- }
- }
-
- {
- /* Copy writable data from flash to RAM. */
- unsigned int *srcptr, *destptr;
-
- /*
- * The _data_start symbol points to the start of data IN FLASH.
- * It is defined by flash.ld at application link time. If flash.ld
- * is not used, it is defined (on the link line) as 0.
- */
- static int *data_start_addr = &_data_start;
-
- if (data_start_addr != 0) {
- for (srcptr = &_data_start, destptr = &START_DATA;
- destptr < &END_DATA;
- srcptr++, destptr++)
- {
- *destptr = *srcptr;
- }
- }
- }
-
-#define OS_LINKAGE_VERSION 4
- link_check.version = OS_LINKAGE_VERSION;
- link_check.table = _A_MAGPIE_INDIRECTION_TABLE_SIZE;
-
- return A_CMN(hal_linkage_check(sizeof(link_check), &link_check));
-}
-
-
-#endif /* __ATHOS_API_H__ */
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-/*
- * @File: buf_pool_api.h
- *
- * @Abstract: BUF Pool api
- *
- * @Notes:
- */
-
-#ifndef _BUF_POOL_API_H
-#define _BUF_POOL_API_H
-
-#include <adf_nbuf.h>
-
-/* endpoint defines */
-typedef enum
-{
- POOL_ID_HTC_CONTROL = 0,
- POOL_ID_WMI_SVC_CMD_REPLY = 1,
- POOL_ID_WMI_SVC_EVENT = 2,
- POOL_ID_WLAN_RX_BUF = 3,
- POOL_ID_MAX = 10
-} BUF_POOL_ID;
-
-typedef void* pool_handle_t;
-
-/* hardware API table structure (API descriptions below) */
-struct buf_pool_api {
- pool_handle_t (*_init)(adf_os_handle_t handle);
-
- void (*_shutdown)(pool_handle_t handle);
-
- void (*_create_pool)(pool_handle_t handle, BUF_POOL_ID poolId, int nItems, int nSize);
-
- adf_nbuf_t (*_alloc_buf)(pool_handle_t handle, BUF_POOL_ID poolId, int reserve);
-
- adf_nbuf_t (*_alloc_buf_align)(pool_handle_t handle, BUF_POOL_ID poolId, int reserve, int align);
-
- void (*_free_buf)(pool_handle_t handle, BUF_POOL_ID poolId, adf_nbuf_t buf);
-
- /* room to expand this table by another table */
- void *pReserved;
-};
-
-extern void buf_pool_module_install(struct buf_pool_api *apis);
-
-#endif /* #ifndef _BUF_POOL_API_H */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __CLOCK_API_H__
-#define __CLOCK_API_H__
-
-#define TICK_MSEC_RATIO 1
-#define TICK_TO_MSEC(tick) ((tick)/TICK_MSEC_RATIO)
-#define MSEC_TO_TICK(msec) ((msec)* TICK_MSEC_RATIO)
-
-struct clock_api {
- void (* _clock_init)(A_UINT32 ref_clk);
- void (* _clockregs_init)(void);
- A_UINT32 (* _uart_frequency)(void);
- void (* _delay_us)(int);
- void (* _wlan_band_set)(int);
- A_UINT32 (* _refclk_speed_get)(void);
- A_UINT32 (* _milliseconds)(void);
- void (* _sysclk_change)(void);
-
- void (* _clock_tick)(void);
-};
-
-#endif /* __CLOCK_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __CMNOS_API_H__
-#define __CMNOS_API_H__
-
-/*
- * This file contains wrappers to OS operating system functions
- * that are available in all versions of the operating system.
- *
- * Target software must always use these wrappers to access OS
- * services -- it may not access any OS services directly.
- */
-
-#include "sys_cfg.h"
-
-#include "xtensa/config/core.h"
-#include "xtensa/hal.h"
-#include "xtensa/xtruntime.h"
-
-/* cmnos interface */
-#include "printf_api.h"
-#include "uart_api.h"
-#include "dbg_api.h"
-#include "mem_api.h"
-#include "misc_api.h"
-#include "string_api.h"
-#include "timer_api.h"
-#include "romp_api.h"
-#include "allocram_api.h"
-#include "tasklet_api.h"
-#include "clock_api.h"
-#include "intr_api.h"
-#include "wdt_api.h"
-#include "eeprom_api.h"
-#include "usb_api.h"
-#include <hif_pci.h>
-#include <hif_gmac.h>
-
-#if defined(PROJECT_K2)
-#if SYSTEM_MODULE_SFLASH
-#include "cmnos/sflash_api.h"
-#endif
-#endif
-
-#define AR6K_ROM_START 0x004e0000
-#define AR6K_ROM_ADDR(byte_offset) (AR6K_ROM_START+(byte_offset))
-#define TARG_ROM_ADDRS(byte_offset) AR6K_ROM_ADDR(byte_offset)
-
-#define IML_SIGNAL_UNUSED0_ADDR TARG_ROM_ADDRS(0) /* Cannot be used -- aligned */
-#define IML_SIGNAL_ASSERT_ADDR TARG_ROM_ADDRS(1) /* Signal an assertion failure */
-#define IML_SIGNAL_PRINTF_ADDR TARG_ROM_ADDRS(2) /* Signal a printf request */
-#define IML_SIGNAL_UNUSED4_ADDR TARG_ROM_ADDRS(4) /* Cannot be used -- aligned */
-#define IML_SIGNAL_UNUSED8_ADDR TARG_ROM_ADDRS(8) /* Cannot be used -- aligned */
-#define IML_SIGNAL_UNUSEDC_ADDR TARG_ROM_ADDRS(0xc) /* Cannot be used -- aligned */
-#define IML_SIGNAL_MASK 0xfffe000f
-#define IML_LINENUM_SHIFT 4
-
-#define NOW() xthal_get_ccount()
-
-#if defined(__XTENSA__)
-#define _A_BARRIER asm volatile("memw")
-#else
-#define _A_BARRIER
-#endif
-
-#define A_ASSERT( __bool ) \
- do { \
- if (0 == (__bool)) { \
- (void)*((volatile int *)(IML_SIGNAL_ASSERT_ADDR+(__LINE__<<4)));\
- _A_BARRIER; \
- } \
- } while (0)
-
-
-#define A_IML_IS_ASSERT(vaddr) \
- (((vaddr) & IML_SIGNAL_MASK) == (IML_SIGNAL_ASSERT_ADDR & IML_SIGNAL_MASK))
-
-
-#define PRINT_FAILURE_STATE() \
-do { \
- uint32_t epc1, epc2, epc3, epc4; \
- \
- asm volatile("rsr %0,%1" : "=r" (epc1) : "n" (EPC_1)); \
- asm volatile("rsr %0,%1" : "=r" (epc2) : "n" (EPC_2)); \
- asm volatile("rsr %0,%1" : "=r" (epc3) : "n" (EPC_3)); \
- asm volatile("rsr %0,%1" : "=r" (epc4) : "n" (EPC_4)); \
- \
- A_PRINTF("\tepc1=0x%x, epc2=0x%x, epc3=0x%x, epc4=0x%x\n", \
- epc1, epc2, epc3, epc4); \
- A_PRINTF("0x%08x, 0x%08x, 0x%08x, \n\r", \
- DEBUG_SYSTEM_STATE, WATCH_DOG_RESET_COUNTER, \
- WATCH_DOG_MAGIC_PATTERN); \
-} while(0)
-////////////////////////////////////////////////////////////////////////////////////
-
-
-//#define A_CMN(sym) _A_OS_INDIRECTION_TABLE->cmnos.sym
-#define A_CMN(sym) _A_MAGPIE_INDIRECTION_TABLE->cmnos.sym
-
-#if SYSTEM_MODULE_MEM
-/* Mem interfaces */
-#define A_MEMSET(addr, value, size) \
- A_CMN(mem._memset((char *)(addr), (int)(value), (int)(size)))
-
-#define A_MEMZERO(addr, size) \
- A_CMN(mem._memset((char *)(addr), (int)0, (int)(size)))
-
-#define A_MEMCPY(dst, src, size) \
- A_CMN(mem._memcpy((char *)(dst), (char *)(src), (int)(size)))
-
-#define A_MEMMOVE(dst, src, size) \
- A_CMN(mem._memmove((char *)(dst), (char *)(src), (int)(size)))
-
-#define A_MEMCMP(p1, p2, nbytes) \
- A_CMN(mem._memcmp)((void *)(p1), (void *)(p2), (int)(nbytes))
-#else
-/* Mem interfaces */
-#define A_MEMSET(addr, value, size)
-
-#define A_MEMZERO(addr, size)
-
-#define A_MEMCPY(dst, src, size)
-
-#define A_MEMMOVE(dst, src, size)
-
-#define A_MEMCMP(p1, p2, nbytes)
-#endif
-
-
-#if 1
- /* String interfaces */
- #define A_STRCPY(dst, src) A_CMN(string._strcpy((dst), (src)))
- #define A_STRNCPY(dst, src, n) A_CMN(string._strncpy((dst), (src), (n)))
- #define A_STRLEN(str) A_CMN(string._strlen(str))
- #define A_STRCMP(str1, str2) A_CMN(string._strcmp((str1), (str2)))
- #define A_STRNCMP(str1, str2, n) A_CMN(string._strncmp((str1), (str2), (n)))
-#endif
-
-#if SYSTEM_MODULE_PRINT
-/* Printf support */
-#define A_PRINTF_INIT() A_CMN(printf._printf_init())
-#define A_PRINTF A_CMN(printf._printf)
-#else
-#define A_PRINTF_INIT()
-#define A_PRINTF
-#endif /* SYSTEM_MODULE_PRINT */
-
-#if SYSTEM_MODULE_UART
-/* Serial port support */
-#define A_UART_INIT() A_CMN(uart._uart_init())
-
-#define A_UART_HWINIT(freq, baud) \
- A_CMN(uart._uart_hwinit((freq), (baud)))
-
-#define A_UART_ENABLED() (HOST_INTEREST->hi_uart_enable)
-
-#define A_PUTS(str) A_CMN(uart._uart_str_out(str))
-
-#define A_PUTC(ch) A_CMN(uart._uart_char_put(ch))
-#define A_GETC(pCh) A_CMN(uart._uart_char_get(pCh))
-
-#define A_UART_TASK() A_CMN(uart._uart_task())
-#define A_UART_CONFIG(x) A_CMN(uart._uart_config(x))
-
-#else
-
-#define A_UART_INIT()
-
-#define A_UART_HWINIT(freq, baud)
-
-#define A_UART_ENABLED()
-
-#define A_PUTS(str)
-
-#define A_PUTC(ch)
-#define A_GETC(pCh)
-
-#define A_UART_TASK()
-#define A_UART_CONFIG(x)
-
-#endif
-
-#if SYSTEM_MODULE_MISC
-/* Reset Support */
-#define A_RESET() A_CMN(misc._system_reset())
-#define A_RESET_MAC() A_CMN(misc._mac_reset())
-
-/* Assertion failure */
-#define A_ASSFAIL(regdump) A_CMN(misc._assfail((regdump)))
-
-/* Report a failure to the Host */
-#define A_REPORT_FAILURE(data, len) \
- A_CMN(misc._report_failure_to_host((data), (len)))
-
-/* UNALIGNED references are used for ASSERTs */
-#define A_MISALIGNED_LOAD_HANDLER(dump) A_CMN(misc._misaligned_load_handler(dump))
-
-/* reture the host interface type */
-#define A_IS_HOST_PRESENT() A_CMN(misc._is_host_present())
-#define A_KBHIT(delay) A_CMN(misc._kbhit(delay))
-#define A_GET_ROM_VER() A_CMN(misc._rom_version_get())
-#else
-/* Reset Support */
-#define A_RESET()
-#define A_RESET_MAC()
-
-/* Assertion failure */
-#define A_ASSFAIL(regdump)
-
-#define A_MISALIGNED_LOAD_HANDLER(dump)
-
-/* Report a failure to the Host */
-#define A_REPORT_FAILURE(data, len)
-
-#define A_IS_HOST_PRESENT()
-#define A_KBHIT(delay)
-#define A_GET_ROM_VER()
-#endif
-
-//#if SYSTEM_MODULE_DBG
-/* debug Support */
-//#define A_DBG_INIT() A_CMN(dbg._dbg_init())
-//#define A_DBG_TASK() A_CMN(dbg._dbg_task())
-//#else
-//#define A_DBG_INIT()
-//#define A_DBG_TASK()
-//#endif
-
-#if SYSTEM_MODULE_USB
-/* debug Support */
-#define A_USB_INIT() A_CMN(usb._usb_init())
-#define A_USB_ROM_TASK() A_CMN(usb._usb_rom_task())
-#define A_USB_FW_TASK() A_CMN(usb._usb_fw_task())
-#define A_USB_INIT_PHY() A_CMN(usb._usb_init_phy())
-
-#define A_USB_EP0_SETUP() A_CMN(usb._usb_ep0_setup())
-#define A_USB_EP0_TX_DATA() A_CMN(usb._usb_ep0_tx_data())
-#define A_USB_EP0_RX_DATA() A_CMN(usb._usb_ep0_rx_data())
-
-#define A_USB_GET_CONFIG() A_CMN(usb._usb_get_configuration())
-#define A_USB_SET_CONFIG() A_CMN(usb._usb_set_configuration())
-
-#define A_USB_GET_INTERFACE() A_CMN(usb._usb_get_interface())
-#define A_USB_SET_INTERFACE() A_CMN(usb._usb_set_interface())
-
-#define A_USB_STANDARD_CMD() A_CMN(usb._usb_standard_cmd())
-#define A_USB_VENDOR_CMD() A_CMN(usb._usb_vendor_cmd())
-
-#define A_USB_POWER_OFF() A_CMN(usb._usb_power_off())
-#define A_USB_RESET_FIFO() A_CMN(usb._usb_reset_fifo())
-#define A_USB_GEN_WDT() A_CMN(usb._usb_gen_wdt())
-#define A_USB_JUMP_BOOT() A_CMN(usb._usb_jump_boot())
-
-#define A_USB_GET_DESCRIPTOR() A_CMN(usb._usb_get_descriptor())
-#define A_USB_SET_ADDRESS() A_CMN(usb._usb_set_address())
-#define A_USB_SET_FEATURE() A_CMN(usb._usb_set_feature())
-#define A_USB_CLEAR_FEATURE() A_CMN(usb._usb_clr_feature())
-
-#define A_USB_GET_STATUS() A_CMN(usb._usb_get_status())
-#define A_USB_SETUP_DESC() A_CMN(usb._usb_setup_desc())
-#define A_USB_STATUS_IN() A_CMN(usb._usb_status_in())
-#define A_USB_REG_OUT() A_CMN(usb._usb_reg_out())
-
-#define A_USB_EP0_TX() A_CMN(usb._usb_ep0_tx())
-#define A_USB_EP0_RX() A_CMN(usb._usb_ep0_rx())
-#define A_USB_CLK_INIT() A_CMN(usb._usb_clk_init())
-
-#else
-#define A_USB_INIT()
-#define A_USB_TASK()
-#define A_USB_INIT_PHY()
-
-#define A_USB_EP0_SETUP()
-#define A_USB_EP0_TX()
-#define A_USB_EP0_RX()
-
-#define A_USB_GET_CONFIG()
-#define A_USB_SET_CONFIG()
-
-#define A_USB_GET_INTERFACE()
-#define A_USB_SET_INTERFACE()
-
-#define A_USB_STANDARD_CMD()
-#define A_USB_VENDOR_CMD()
-
-#define A_USB_POWER_OFF()
-#define A_USB_RESET_FIFO()
-#define A_USB_GEN_WDT()
-#define A_USB_JUMP_BOOT()
-
-#define A_USB_GET_DESCRIPTOR()
-#define A_USB_SET_ADDRESS()
-#define A_USB_SET_FEATURE()
-#define A_USB_CLEAR_FEATURE()
-
-#define A_USB_GET_STATUS()
-#define A_USB_SETUP_DESC()
-
-
-#define A_USB_STATUS_IN()
-#define A_USB_REG_OUT()
-
-#define A_USB_EP0_TX()
-#define A_USB_EP0_RX()
-
-#define A_USB_CLK_INIT()
-#endif
-
-#if SYSTEM_MODULE_INTR
-/* Low-level interrupt support intended for use by OS modules */
-#define A_INTR_GET_INTRENABLE() A_CMN(intr._get_intrenable())
-#define A_INTR_SET_INTRENABLE(val) A_CMN(intr._set_intrenable(val))
-#define A_INTR_GET_INTRPENDING() A_CMN(intr._get_intrpending())
-#define A_INTR_UNBLOCK_ALL_INTRLVL() A_CMN(intr._unblock_all_intrlvl())
-
-/* Interrupt support */
-#define A_INTR_INIT() A_CMN(intr._intr_init())
-
-#define A_INTR_DISABLE(pOld) \
- do { \
- *(pOld) = A_CMN(intr._intr_disable()); \
- } while (0)
-
-#define A_INTR_RESTORE(old) A_CMN(intr._intr_restore((old)))
-
-#define A_INVOKE_ISR(inum) A_CMN(intr._intr_invoke_isr(inum))
-
-#define A_INTR_MASK(inum) A_CMN(intr._intr_mask_inum(inum))
-#define A_INTR_UNMASK(inum) A_CMN(intr._intr_unmask_inum(inum))
-
-#define A_ATTACH_ISR(inum, isr, arg) A_CMN(intr._intr_attach_isr(inum, isr, arg))
-#else
-#define A_INTR_INIT()
-#define A_INTR_DISABLE(pOld)
-#define A_INTR_RESTORE(old)
-
-#define A_INTR_GET_INTRENABLE()
-#define A_INTR_SET_INTRENABLE(val)
-#define A_INTR_GET_INTRPENDING()
-#define A_INTR_UNBLOCK_ALL_INTRLVL()
-#define A_INVOKE_ISR(inum)
-#define A_INTR_MASK(inum)
-#define A_INTR_UNMASK(inum)
-#define A_ATTACH_ISR(inum, isr, arg)
-
-#endif
-
-/* Tasklet Support */
-#define A_TASKLET_INIT() A_CMN(tasklet._tasklet_init())
-#define A_TASKLET_INIT_TASK(f, arg, t) A_CMN(tasklet._tasklet_init_task(f, arg, t))
-#define A_TASKLET_DISABLE(t) A_CMN(tasklet._tasklet_disable(t))
-#define A_TASKLET_SCHEDULE(t) A_CMN(tasklet._tasklet_schedule(t))
-#define A_TASKLET_RUN() A_CMN(tasklet._tasklet_run())
-
-
-/* RAM Allocation Support */
-#if defined(__mips__)
-#define alloc_arena_start _end
-#endif
-#if defined(__XTENSA__)
-#define alloc_arena_start _end
-#endif
-
-#if SYSTEM_MODULE_CLOCK
-
-#define A_CLOCK_INIT(refclk_guess) A_CMN(clock._clock_init(refclk_guess))
-#define A_CLOCK_TICK() A_CMN(clock._clock_tick())
-#define A_CLOCK_GET_TICK() A_CMN(clock._clock_get_tick())
-
-/*
- * Get the number of millisecond ticks since the system was started.
- * Note that this only approximates 1Ms. It's actually 32 ticks of
- * a 32KHz clock.
- *
- * Returns a A_UINT32 value.
- */
-#define A_MILLISECONDS() A_CMN(clock._milliseconds())
-
-/*
- * Get the frequency of the reference clock, expressed as
- * an A_refclk_speed_t.
- */
-#define A_REFCLK_SPEED_GET() A_CMN(clock._refclk_speed_get())
-
-/* Spin delay */
-#define A_DELAY_USECS(us) A_CMN(clock._delay_us(us))
-
-#define A_UART_FREQUENCY() A_CMN(clock._uart_frequency())
-
-#define A_CLOCKREGS_INIT() A_CMN(clock._clockregs_init())
-
-/* which_band is either A_BAND_24GHZ or A_BAND_5GHZ */
-#define A_WLAN_BAND_SET(which_band) \
- A_CMN(clock._wlan_band_set(which_band))
-
-/* Called whenever the system clock changes speed */
-#define A_SYSCLK_CHANGE() A_CMN(clock._sysclk_change())
-
-#else
-
-#define A_CLOCK_INIT(refclk_guess)
-#define A_CLOCK_TICK()
-#define A_CLOCK_GET_TICK()
-#define A_MILLISECONDS()
-#define A_REFCLK_SPEED_GET()
-#define A_DELAY_USECS(us)
-#define A_UART_FREQUENCY()
-#define A_CLOCKREGS_INIT()
-#define A_WLAN_BAND_SET(which_band)
-#define A_SYSCLK_CHANGE()
-
-#endif
-
-// Timer
-#define A_INIT_TIMER(pTimer, pFunction, pArg) \
- A_CMN(timer._timer_setfn((pTimer), (pFunction), (pArg)))
-
-/* Set a (possibly periodic) timer for "period" Milliseconds. */
-#define A_TIMEOUT_MS(pTimer, period) \
- A_CMN(timer._timer_arm((pTimer), (period)))
-
-#define A_UNTIMEOUT(pTimer) \
- A_CMN(timer._timer_disarm(pTimer))
-
-#define A_TIMER_RUN() \
- A_CMN(timer._timer_run())
-
-#define A_GMAC_BOOT_INIT() \
- A_CMN(gmac.gmac_boot_init())
-
-#if SYSTEM_MODULE_ALLOCRAM
-/* Default size of ALLOCRAM area */
-#define ARENA_SZ_DEFAULT 12000
-
-#define A_ALLOCRAM_INIT(arena_start, arena_size) \
-do { \
- extern unsigned int alloc_arena_start; \
- void *astart; \
- int asize; \
- astart = (arena_start) ? (void *)(arena_start) : &alloc_arena_start; \
- asize = (arena_size) ? (arena_size) : (ARENA_SZ_DEFAULT); \
- A_CMN(allocram.cmnos_allocram_init((astart), (asize))); \
-} while (0)
-
-#define A_ALLOCRAM(nbytes) A_CMN(allocram.cmnos_allocram(0, (nbytes)))
-
-#define A_ALLOCRAM_DEBUG() A_CMN(allocram.cmnos_allocram_debug())
-
-#else
-#define A_ALLOCRAM_INIT(arena_start, arena_size)
-#define A_ALLOCRAM(nbytes)
-#define A_ALLOCRAM_DEBUG()
-#endif
-
-#if SYSTEM_MODULE_ROM_PATCH
-
-#define A_ROMP_INIT() A_CMN(romp._romp_init())
-#define A_ROMP_DOWNLOAD(x) A_CMN(romp._romp_download(x))
-#define A_ROMP_DECODE(addr) A_CMN(romp._romp_decode(addr))
-#define A_ROMP_INSTALL() A_CMN(romp._romp_install())
-#else
-#define A_ROMP_INIT()
-#define A_ROMP_DOWNLOAD(x)
-#define A_ROMP_DECODE(addr)
-#define A_ROMP_INSTALL()
-#endif
-
-#if SYSTEM_MODULE_WDT
-
-#define A_WDT_INIT() A_CMN(wdt_timer._wdt_init())
-#define A_WDT_ENABLE() A_CMN(wdt_timer._wdt_enable())
-#define A_WDT_DISABLE() A_CMN(wdt_timer._wdt_disable())
-#define A_WDT_SET(t) A_CMN(wdt_timer._wdt_set(t))
-#define A_WDT_TASK() A_CMN(wdt_timer._wdt_task())
-#define A_WDT_LASTBOOT() A_CMN(wdt_timer._wdt_last_boot())
-#define A_WDT_RESET() A_CMN(wdt_timer._wdt_reset())
-
-#else
-#define A_WDT_INIT()
-#define A_WDT_ENABLE()
-#define A_WDT_DISABLE()
-#define A_WDT_SET(t)
-#define A_WDT_TASK()
-#define A_WDT_LASTBOOT()
-#define A_WDT_RESET()
-#endif
-
-
-#if SYSTEM_MODULE_EEPROM
-#define A_EEP_INIT() A_CMN(eep._eep_init())
-#define A_EEP_READ(off, len, buf) A_CMN(eep._eep_read(off, len, buf))
-#define A_EEP_WRITE(off, len, buf) A_CMN(eep._eep_write(off, len, buf))
-#define A_EEP_IS_EXIST() A_CMN(eep._eep_is_exist())
-#else
-#define A_EEP_INIT()
-#define A_EEP_READ(off, len, buf)
-#define A_EEP_WRITE(off, len, buf)
-#define A_EEP_IS_EXIST()
-#endif
-
-
-
-struct _A_os_linkage_check; /* OS-dependent */
-
-typedef struct _A_cmnos_indirection_table {
- int (* hal_linkage_check)(int sz, struct _A_os_linkage_check *);
- unsigned int *start_bss;
- void (* app_start)(void);
-
-#if SYSTEM_MODULE_MEM
- struct mem_api mem;
-#endif
-
-#if SYSTEM_MODULE_MISC
- struct misc_api misc;
-#endif
-
-#if SYSTEM_MODULE_PRINT
- struct printf_api printf;
-#endif
-
-#if SYSTEM_MODULE_UART
- struct uart_api uart;
-#endif
-
-//#if SYSTEM_MODULE_DBG
-// struct dbg_api dbg;
-//#endif
-
-
-#if SYSTEM_MODULE_GMAC
- struct gmac_api gmac;
-#endif
-
-#if SYSTEM_MODULE_USB
- struct usb_api usb;
-#endif
-
-#if SYSTEM_MODULE_CLOCK
- struct clock_api clock;
-#endif
-
-#if SYSTEM_MODULE_TIMER
- struct timer_api timer;
-#endif
-
-#if SYSTEM_MODULE_INTR
- struct intr_api intr;
-#endif
-
-#if SYSTEM_MODULE_ALLOCRAM
- struct allocram_api allocram;
-#endif
-
-#if SYSTEM_MODULE_ROM_PATCH
- struct romp_api romp;
-#endif
-
-#if SYSTEM_MODULE_WDT
- struct wdt_api wdt_timer;
-#endif
-
-#if SYSTEM_MODULE_EEPROM
- struct eep_api eep;
-#endif
-
- struct string_api string;
- struct tasklet_api tasklet;
-
-} _A_cmnos_indirection_table_t;
-
-/* Module installation for cmnos modules */
-
-#if SYSTEM_MODULE_MEM
-extern void cmnos_mem_module_install(struct mem_api *);
-#endif
-
-#if SYSTEM_MODULE_MISC
-extern void cmnos_misc_module_install(struct misc_api *);
-#endif
-
-#if SYSTEM_MODULE_PRINT
-extern void cmnos_printf_module_install(struct printf_api *);
-#endif
-
-#if SYSTEM_MODULE_UART
-extern void cmnos_uart_module_install(struct uart_api *);
-#endif
-
-//#if SYSTEM_MODULE_DBG
-//extern void cmnos_dbg_module_install(struct dbg_api *);
-//#endif
-
-#if SYSTEM_MODULE_USB
-extern void cmnos_usb_module_install(struct usb_api *);
-#endif
-
-#if SYSTEM_MODULE_INTR
-extern void cmnos_intr_module_install(struct intr_api *);
-#endif
-
-#if SYSTEM_MODULE_CLOCK
-extern void cmnos_clock_module_install(struct clock_api *);
-#endif
-
-#if SYSTEM_MODULE_TIMER
-extern void cmnos_timer_module_install(struct timer_api *);
-#endif
-
-#if SYSTEM_MODULE_ALLOCRAM
-extern void cmnos_allocram_module_install(struct allocram_api *);
-#endif
-
-#if SYSTEM_MODULE_ROM_PATCH
-extern void cmnos_romp_module_install(struct romp_api *);
-#endif
-
-#if SYSTEM_MODULE_WDT
-extern void cmnos_wdt_module_install(struct wdt_api *);
-#endif
-
-#if SYSTEM_MODULE_EEPROM
-extern void cmnos_eep_module_install(struct eep_api *);
-#endif
-
-extern void cmnos_tasklet_module_install(struct tasklet_api *);
-
-extern void cmnos_string_module_install(struct string_api *tbl);
-
-#endif /* __CMNOS_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-/*
- * @File: dma_engine_api.h
- *
- * @Abstract: DMA Engine api
- *
- * @Notes:
- */
-
-#ifndef _DMA_ENGINE_API_H
-#define _DMA_ENGINE_API_H
-
-#include <vbuf_api.h>
-#include <vdesc_api.h>
-
-struct zsDmaDesc
-{
-#if 1 // BIG_ENDIAN
- volatile u16_t ctrl; // Descriptor control
- volatile u16_t status; // Descriptor status
- volatile u16_t totalLen; // Total length
- volatile u16_t dataSize; // Data size
-#else
- volatile u16_t status; // Descriptor status
- volatile u16_t ctrl; // Descriptor control
- volatile u16_t dataSize; // Data size
- volatile u16_t totalLen; // Total length
-#endif
- struct zsDmaDesc* lastAddr; // Last address of this chain
- volatile u32_t dataAddr; // Data buffer address
- struct zsDmaDesc* nextAddr; // Next TD address
-};
-
-struct zsDmaQueue
-{
- struct zsDmaDesc* head;
- struct zsDmaDesc* terminator;
-};
-
-// Subclass of zsDmaQueue for TX
-struct zsTxDmaQueue
-{
- struct zsDmaDesc* head;
- struct zsDmaDesc* terminator;
-
- /* Below are fields specific to TX */
- VBUF *xmited_buf_head;
- VBUF *xmited_buf_tail;
-};
-
-/* hardware API table structure (API descriptions below) */
-struct dma_engine_api
-{
- void (*_init)();
-
- void (*_init_rx_queue)(struct zsDmaQueue *q);
-
- void (*_init_tx_queue)(struct zsTxDmaQueue *q);
-
- void (*_config_rx_queue)(struct zsDmaQueue *q, int num_desc, int buf_size);
-
- void (*_xmit_buf)(struct zsTxDmaQueue *q, VBUF *buf);
-
- void (*_flush_xmit)(struct zsDmaQueue *q);
-
- VBUF* (*_reap_recv_buf)(struct zsDmaQueue *q);
-
- void (*_return_recv_buf)(struct zsDmaQueue *q, VBUF *buf);
-
- VBUF* (*_reap_xmited_buf)(struct zsTxDmaQueue *q);
-
- void (*_swap_data)(struct zsDmaDesc* desc);
-
- int (*_has_compl_packets)(struct zsDmaQueue *q);
-
- void (*_desc_dump)(struct zsDmaQueue *q);
-
- /* The functions below are for patchable */
- struct zsDmaDesc* (*_get_packet)(struct zsDmaQueue* q);
- void (*_reclaim_packet)(struct zsDmaQueue* q, struct zsDmaDesc* desc);
- void (*_put_packet)(struct zsDmaQueue* q, struct zsDmaDesc* desc);
-
- /* room to expand this table by another table */
- void *pReserved;
-};
-
-extern void dma_engine_module_install(struct dma_engine_api *apis);
-
-#endif /* #ifndef _DMA_ENGINE_API_H */
+++ /dev/null
-#ifndef __DMA_LIB_H
-#define __DMA_LIB_H
-
-
-/***********************External***************************/
-
-/**
- * @brief DMA engine numbers, HIF need to map them to there
- * respective order
- */
-typedef enum dma_engine{
- DMA_ENGINE_RX0,
- DMA_ENGINE_RX1,
- DMA_ENGINE_RX2,
- DMA_ENGINE_RX3,
- DMA_ENGINE_TX0,
- DMA_ENGINE_TX1,
- DMA_ENGINE_MAX
-}dma_engine_t;
-
-/**
- * @brief Interface type, each HIF should call with its own interface type
- */
-typedef enum dma_iftype{
- DMA_IF_GMAC = 0x0,/* GMAC */
- DMA_IF_PCI = 0x1,/*PCI */
- DMA_IF_PCIE = 0x2 /*PCI Express */
-}dma_iftype_t;
-
-
-struct dma_lib_api{
- A_UINT16 (*tx_init)(dma_engine_t eng_no, dma_iftype_t if_type);
- void (*tx_start)(dma_engine_t eng_no);
- A_UINT16 (*rx_init)(dma_engine_t eng_no, dma_iftype_t if_type);
- void (*rx_config)(dma_engine_t eng_no, a_uint16_t num_desc,
- a_uint16_t gran);
- void (*rx_start)(dma_engine_t eng_no);
- A_UINT32 (*intr_status)(dma_iftype_t if_type);
- A_UINT16 (*hard_xmit)(dma_engine_t eng_no, VBUF *buf);
- void (*flush_xmit)(dma_engine_t eng_no);
- A_UINT16 (*xmit_done)(dma_engine_t eng_no);
- VBUF * (*reap_xmitted)(dma_engine_t eng_no);
- VBUF * (*reap_recv)(dma_engine_t eng_no);
- void (*return_recv)(dma_engine_t eng_no, VBUF *buf);
- A_UINT16 (*recv_pkt)(dma_engine_t eng_no);
-};
-
-
-/**
- * @brief Install the DMA lib api's this for ROM patching
- * support
- *
- * @param apis
- */
-void dma_lib_module_install(struct dma_lib_api *apis);
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __EEPROM_API_H__
-#define __EEPROM_API_H__
-/*
- *
- */
-
-
-typedef enum {
- RET_SUCCESS = 0,
- RET_NOT_INIT,
- RET_NOT_EXIST,
- RET_EEP_CORRUPT,
- RET_EEP_OVERFLOW,
-
- // add return code from here
- RET_UNKNOWN
-}T_EEP_RET;
-
-
-/*!- interface of eeprom access
- *
- */
-struct eep_api {
- void (* _eep_init)(void);
- T_EEP_RET (* _eep_read)(uint16_t, uint16_t, uint16_t *);
- T_EEP_RET (* _eep_write)(uint16_t, uint16_t, uint16_t *);
- T_EEP_RET (*_eep_is_exist)(void);
-
-};
-
-#endif /* __EEPROM_API_H__ */
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-/*
- * @File: HIF_api.h
- *
- * @Abstract: Host Interface api
- *
- * @Notes:
- */
-
-#ifndef _HIF_API_H
-#define _HIF_API_H
-
-#include <adf_nbuf.h>
-
-/* mailbox hw module configuration structure */
-typedef struct _HIF_CONFIG {
- int dummy;
-} HIF_CONFIG;
-
-typedef struct _HIF_CALLBACK {
- /* callback when a buffer has be sent to the host*/
- void (*send_buf_done)(adf_nbuf_t buf, void *context);
- /* callback when a receive message is received */
- void (*recv_buf)(adf_nbuf_t hdr_buf, adf_nbuf_t buf, void *context);
- /* context used for all callbacks */
- void *context;
-} HIF_CALLBACK;
-
-typedef void* hif_handle_t;
-
-/* hardware API table structure (API descriptions below) */
-struct hif_api {
- hif_handle_t (*_init)(HIF_CONFIG *pConfig);
-
- void (* _shutdown)(hif_handle_t);
-
- void (*_register_callback)(hif_handle_t, HIF_CALLBACK *);
-
- int (*_get_total_credit_count)(hif_handle_t);
-
- void (*_start)(hif_handle_t);
-
- void (*_config_pipe)(hif_handle_t handle, int pipe, int creditCount);
-
- int (*_send_buffer)(hif_handle_t handle, int pipe, adf_nbuf_t buf);
-
- void (*_return_recv_buf)(hif_handle_t handle, int pipe, adf_nbuf_t buf);
- //void (*_set_recv_bufsz)(int pipe, int bufsz);
- //void (*_pause_recv)(int pipe);
- //void (*_resume_recv)(int pipe);
- int (*_is_pipe_supported)(hif_handle_t handle, int pipe);
-
- int (*_get_max_msg_len)(hif_handle_t handle, int pipe);
-
- int (*_get_reserved_headroom)(hif_handle_t handle);
-
- void (*_isr_handler)(hif_handle_t handle);
-
- void (*_get_default_pipe)(hif_handle_t handle, A_UINT8 *pipe_uplink, A_UINT8 *pipe_downlink);
-
- /* room to expand this table by another table */
- void *pReserved;
-};
-
-extern void generic_hif_module_install(struct hif_api *apis);
-
-#endif /* #ifndef _HIF_API_H */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __HIF_GMAC_H
-#define __HIF_GMAC_H
-
-#include <adf_os_types.h>
-#include <hif_api.h>
-
-
-#define ETH_ALEN 6
-#define GMAC_MAX_PKT_LEN 1600
-#define GMAC_MAX_DESC 5
-
-#define GMAC_DISCV_PKT_SZ 1024
-#define GMAC_DISCV_WAIT 2000
-
-#define ATH_P_MAGBOOT 0x12 /*Magpie GMAC 18 for boot downloader*/
-#define ATH_P_MAGNORM 0x13 /*Magpie GMAC 19 for HTC & others*/
-
-#define ETH_P_ATH 0x88bd
-
-typedef enum hif_gmac_pipe{
- HIF_GMAC_PIPE_RX = 1, /*Normal Priority RX*/
- HIF_GMAC_PIPE_TX = 2, /*Normal Priority TX*/
-}hif_gmac_pipe_t;
-
-struct gmac_api{
- void (*gmac_boot_init)(void);
-};
-
-void cmnos_gmac_module_install(struct gmac_api *boot_apis);
-void hif_gmac_module_install(struct hif_api *apis);
-
-enum __gmac_mii_mode {
- GMAC_MIIMODE_NONE=0,
- GMAC_MIIMODE_MII=1,
- GMAC_MIIMODE_RMII=2,
- GMAC_MIIMODE_GMII=3,
- GMAC_MIIMODE_RGMII=4,
- GMAC_MIIMODE_MAX=5
-};
-enum __gmac_msg_type{
- GMAC_HST_QUERY = 0x0001,
- GMAC_HST_REPLY = 0x0002,
- GMAC_TGT_QUERY = 0x0003,
- GMAC_TGT_REPLY = 0x0004
-};
-
-enum __magpie_regs{
- MAG_REG_GPIO_OE = 0x00052000,/*GPIO Output Enable*/
- MAG_REG_RST = 0x00050010,/*Magpie reset reg*/
- MAG_REG_RST_AHB = 0x00050018,/*Magpie AHB_ARB reset reg*/
- MAG_REG_MII0_CTRL = 0x00054100,/*Magpie MII0 Control reg*/
- MAG_REG_STAT_CTRL = 0x00054104,/*Magpie Status reg*/
-
- MAG_REG_ETH_PLL = 0x5600c,
- MAG_REG_ETHPLL_BYPASS = 0x56010,
-};
-
-enum __gmac_regs{
- GMAC_REG_BASE = 0x00060000,
- GMAC_REG_MAC_CFG1 = 0x00 + GMAC_REG_BASE,/*MAC config 1*/
- GMAC_REG_MAC_CFG2 = 0x04 + GMAC_REG_BASE,/*MAC config 2*/
- GMAC_REG_IPG_IFG = 0x08 + GMAC_REG_BASE,/*Inter-packet-gap*/
- GMAC_REG_HALF_DPLX = 0x0c + GMAC_REG_BASE,/*Half duplex*/
- GMAC_REG_MAX_FRAME = 0x10 + GMAC_REG_BASE,/*Max frame length*/
- GMAC_REG_MII_CFG = 0x20 + GMAC_REG_BASE,/*MII mgmt config*/
- GMAC_REG_MII_CMD = 0x24 + GMAC_REG_BASE,/*MII mgmt command*/
- GMAC_REG_MII_ADDR = 0x28 + GMAC_REG_BASE,/*MII mgmt address*/
- GMAC_REG_MII_CTRL = 0x2c + GMAC_REG_BASE,/*MII mgmt control*/
- GMAC_REG_MII_STAT = 0x30 + GMAC_REG_BASE,/*MII mgmt status*/
- GMAC_REG_MII_PSTAT = 0x34 + GMAC_REG_BASE,/*MII mgmt Phy status/ind*/
- GMAC_REG_IF_CTRL = 0x38 + GMAC_REG_BASE,/*Interface control*/
- GMAC_REG_IF_STAT = 0x3c + GMAC_REG_BASE,/*Interface status*/
- GMAC_REG_MAC_ADDR1 = 0x40 + GMAC_REG_BASE,/*MAC address 1*/
- GMAC_REG_MAC_ADDR2 = 0x44 + GMAC_REG_BASE,/*MAC address 2*/
- GMAC_REG_FIFO_CFG0 = 0x48 + GMAC_REG_BASE,/*FIFO config reg0*/
- GMAC_REG_FIFO_CFG1 = 0x4c + GMAC_REG_BASE,/*FIFO config reg1*/
- GMAC_REG_FIFO_CFG2 = 0x50 + GMAC_REG_BASE,/*FIFO config reg2*/
- GMAC_REG_FIFO_CFG3 = 0x54 + GMAC_REG_BASE,/*FIFO config reg3*/
- GMAC_REG_FIFO_CFG4 = 0x58 + GMAC_REG_BASE,/*FIFO config reg4*/
- GMAC_REG_FIFO_CFG5 = 0x5c + GMAC_REG_BASE,/*FIFO config reg5*/
- GMAC_REG_FIFO_RAM0 = 0x60 + GMAC_REG_BASE,/*FIFO RAM access reg0*/
- GMAC_REG_FIFO_RAM1 = 0x64 + GMAC_REG_BASE,/*FIFO RAM access reg1*/
- GMAC_REG_FIFO_RAM2 = 0x68 + GMAC_REG_BASE,/*FIFO RAM access reg2*/
- GMAC_REG_FIFO_RAM3 = 0x6c + GMAC_REG_BASE,/*FIFO RAM access reg3*/
- GMAC_REG_FIFO_RAM4 = 0x70 + GMAC_REG_BASE,/*FIFO RAM access reg4*/
- GMAC_REG_FIFO_RAM5 = 0x74 + GMAC_REG_BASE,/*FIFO RAM access reg5*/
- GMAC_REG_FIFO_RAM6 = 0x78 + GMAC_REG_BASE,/*FIFO RAM access reg6*/
- GMAC_REG_FIFO_RAM7 = 0x7c + GMAC_REG_BASE,/*FIFO RAM access reg7*/
-};
-
-enum __mag_reg_rst{
- RST_GMAC = (1 << 9),/*Reset the GMAC */
- RST_MII = (3 << 11),/*Reset the MII*/
- RST_OTHERS = 0x5df,/*Reset everybody other than GMAC & MII*/
-};
-
-enum __mag_reg_rst_ahb{
- RST_AHB_GMAC = 0x1
-};
-enum __mag_mii0_ctrl_mode{
- MII0_CTRL_MODE_GMII = 0x00, /* GMII*/
- MII0_CTRL_MODE_MII = 0x01, /*MII*/
- MII0_CTRL_MODE_RGMII = 0x02,/* RGMII */
- MII0_CTRL_MODE_RMII = 0x03, /* RMII */
- MII0_CTRL_MASTER_MODE = 0x04 /* master mode */
-};
-enum __mag_mii0_ctrl_speed {
- MII0_CTLR_SPEED_10 = 0x00, /* 10 mbps*/
- MII0_CTRL_SPEED_100 = 0x10, /*MII control address 100 Mbps*/
- MII0_CTRL_SPEED_1000 = 0x20 /* 1000 */
-};
-
-
-enum __gmac_reg_mac_cfg1{
- MAC_CFG1_TX_EN = (1 << 0),/*TX enable*/
- MAC_CFG1_RX_EN = (1 << 2),/*RX enable*/
- MAC_CFG1_TX_FLOW = (1 << 4),/*TX Flow control enable*/
- MAC_CFG1_RX_FLOW = (1 << 5),/*RX Flow control enable*/
- MAC_CFG1_LOOP_EN = (1 << 8),/*Enable loopback*/
-};
-enum __gmac_reg_mac_cfg2{
- MAC_CFG2_FULL_DUP = (1 << 0),/*Enable Full Duplex*/
- MAC_CFG2_PAD_CRC = (1 << 2),/*Enable MAC based CRC insertion*/
- MAC_CFG2_CHK_LEN = (1 << 4),/*Check Length field*/
- MAC_CFG2_HUGE_FRM = (1 << 5),/*Allow sending huge frames*/
- MAC_CFG2_MII = (1 << 8),/*MAC is MII in mode*/
- MAC_CFG2_GMII = (1 << 9),/*MAC is in GMII mode*/
- MAC_CFG2_PREAMBLE = (7 << 12),/*Default Preamble Length*/
-};
-enum __gmac_reg_mii_cfg{
- MII_CFG_CLK_2MHZ = 0x0006,/*Clock is 2Mhz*/
-};
-
-
-/* following are only for F1 phy on emulation board.*/
-enum __gmac_reg_mii_addr{
- MII_ADDR_RESET = 0x000,/*Flush the MII address register*/
- MII_ADDR_STATS = 0x001,/* Stauts register*/
- MII_ADDR_PHY_IDENT_1 = 0x002,/* phy identifier [18:3]*/
- MII_ADDR_PHY_IDENT_2 = 0x003,/* phy identifier [19:24]*/
- MII_ADDR_AUTONEG_ADV = 0x004,/* Autonegotiaion advertise*/
- MII_ADDR_LINKPART_ABILITY = 0x0005,/* link partner ability*/
- MII_ADDR_AUTONEG_EXP = 0x0006,/* Autonegotiation expansion*/
- MII_ADDR_NEXTPG_TX = 0x0007,/* Next page transmit*/
- MII_ADDR_LINKPART_NEXTPG = 0x0008,/* Link partnet next page*/
- MII_ADDR_1000BASET_CNTRL = 0x0009,/* 1000 base-t control*/
- MII_ADDR_1000BSAET_STATUS = 0x000a,/* 1000 base-t status*/
- MII_ADDR_EXTENDED_STATUS = 0x000f,/* extended status*/
- MII_ADDR_FUNCTION_CTRL = 0x0010,/* function control*/
- MII_ADDR_PHY_REG = 0x0011,/*Phy Status Reg*/
- MII_ADDR_INTERRUPT_ENA = 0x0012,/* interrupt enable*/
- MII_ADDR_INTERRUPT_STATUS = 0x0013,/* interrupt status*/
- MII_ADDR_EXTPHY_CTRL = 0x0014,/* extemded phy specific control*/
- MII_ADDR_CABDET_CTRL = 0x0016,/* cable detect testser control*/
- MII_ADDR_LED_CTRL = 0x0018,/* LED control*/
- MII_ADDR_MANLED_OVER = 0x0019,/* Manual LED override*/
- MII_ADDR_CABDET_STAT = 0x001c,/* cable detect tester status*/
- MII_ADDR_DEBUGPORT_OFF = 0x001d,/* Debug port address offset*/
- MII_ADDR_DEBUGPORT_DATA = 0x001e,/* Debug port data */
-};
-
-/* definitions for MII_ADDR_RESET register definitions*/
-#define MII_ADDR_RESET_RESTART_AUTONEG (1 << 9)
-#define MII_ADDR_RESET_ENABLE_AUTONEG (1 << 12)
-#define MII_ADDR_RESET_ENABLE_LOOPBACK (1<<14)
-#define MII_ADDR_RESET_SOFT_RESET (1<<15)
-/* flags for autonegotiaion register MII_ADDR_AUTONEG_ADV,
- All writes to this register should be followed by a soft
- reset on the phy
- The list is not exhaustive, only required fields added
- */
-#define MII_AUTONEG_10BT_HALF (1<<5)
-#define MII_AUTONEG_10BT_FULL (1<<6)
-#define MII_AUTONEG_100BT_HALF (1<<7)
-#define MII_AUTONEG_100BT_FULL (1<<8)
-#define MII_AUTONEG_PAUSE (1<<9)
-#define MII_1000BASET_1000BT_HALF (1<<8)
-#define MII_1000BASET_1000BT_FULL (1<<9)
-enum __gmac_reg_mii_ctrl{
- MII_CTRL_FULL_DPLX = 0x0100,/*Full Duplex mode*/
- MII_CTRL_SPEED_100 = 0x2000,/*Link Speed 100 Mbps*/
- MII_CTRL_LOOPBACK = 0x4000,/*Enable Loopback mode at PHY*/
- MII_CTRL_RESET = 0x8000,/*BMCR reset*/
-};
-enum __gma_reg_mii_cmd{
- MII_CMD_WRITE = 0x0,
- MII_CMD_READ = 0x1,/*Perform a Read cycle*/
-};
-enum __gmac_reg_fifo_cfg0{
- FIFO_CFG0_EN = 0x1f00,/*Enable all the Fifo module*/
-};
-enum __gmac_reg_fifo_cfg1{
- FIFO_CFG1_SIZE_2K = (0x7ff << 16),/*Fifo size is 2K*/
-};
-enum __gmac_reg_fifo_cfg4{
- FIFO_CFG4_RX_ALL = 0x3ffff,/*receive all frames*/
-};
-enum __gmac_reg_if_ctrl{
- IF_CTRL_SPEED_100 = (1 << 16),/*Interface speed 100 Mbps for MII*/
-};
-
-
-#define MAX_MDIO_IO_LEN 14
-#define MDIO_REG_WIDTH 4
-#define MDIO_REG_BASE 0x54200
-#define MDIO_REG_TO_OFFSET( __reg_number__)\
- (MDIO_REG_BASE + (MDIO_REG_WIDTH * (__reg_number__)))
-
-#define MDIO_OWN_TGT 0x01
-#define MDIO_OWN_HST 0x02
-#define MDIO_REG_WRITE_DELAY 5 /* 5 micro seconds */
-
-/*************************GMAC Data types*******************************/
-typedef enum __gmac_pkt_type{
- GMAC_PKT_IS_BCAST,
- GMAC_PKT_IS_UCAST
-}__gmac_pkt_type_t;
-
-struct __ethhdr{
- unsigned char dst[ETH_ALEN];/*destination eth addr */
- unsigned char src[ETH_ALEN]; /*source ether addr*/
- A_UINT16 etype;/*ether type*/
-}__attribute__((packed));
-/**
- * @brief this is will be in big endian format
- */
-struct __athhdr{
-#ifdef LITTLE_ENDIAN
- A_UINT8 proto:6,
- res:2;
-#else
- A_UINT8 res:2,
- proto:6;
-#endif
- A_UINT8 res_lo;
- A_UINT16 res_hi;
-}__attribute__((packed));
-
-typedef struct __gmac_hdr{
- struct __ethhdr eth;
- struct __athhdr ath;
- A_UINT16 align_pad;/*pad it for 4 byte boundary*/
-}__attribute__((packed)) __gmac_hdr_t;
-
-/*********************************GMAC softC************************/
-
-typedef struct __gmac_softc{
- __gmac_hdr_t hdr;
- A_UINT16 gran;
- HIF_CALLBACK sw;
-}__gmac_softc_t;
-
-
-
-#endif
-
+++ /dev/null
-
-#ifndef __HIF_PCI_H
-#define __HIF_PCI_H
-
-#include <hif_api.h>
-#include <dma_lib.h>
-
-
-#define PCI_MAX_DATA_PKT_LEN 1664
-#define PCI_MAX_CMD_PKT_LEN 512
-#define PCI_MAX_BOOT_DESC 2
-
-typedef enum hif_pci_pipe_rx{
- HIF_PCI_PIPE_RX0, /*Normal Priority RX*/
- HIF_PCI_PIPE_RX1,
- HIF_PCI_PIPE_RX2,
- HIF_PCI_PIPE_RX3,
- HIF_PCI_PIPE_RX_MAX
-}hif_pci_pipe_rx_t;
-
-typedef enum hif_pci_pipe_tx{
- HIF_PCI_PIPE_TX0, /*Normal Priority TX*/
- HIF_PCI_PIPE_TX1,
- HIF_PCI_PIPE_TX_MAX
-}hif_pci_pipe_tx_t;
-
-typedef struct __pci_softc{
- HIF_CALLBACK sw;
-}__pci_softc_t;
-
-struct hif_pci_api{
- void (*pci_boot_init)(void);
- hif_handle_t (*pci_init)(HIF_CONFIG *pConfig);
- void (*pci_reset)(void);
- void (*pci_enable)(void);
- void (*pci_reap_xmitted)(__pci_softc_t *sc,
- dma_engine_t eng_no);
- void (*pci_reap_recv)(__pci_softc_t *sc, dma_engine_t eng_no);
- A_UINT8 (*pci_get_pipe)(dma_engine_t eng);
- dma_engine_t (*pci_get_tx_eng)(hif_pci_pipe_tx_t pipe);
- dma_engine_t (*pci_get_rx_eng)(hif_pci_pipe_rx_t pipe);
-
-};
-
-void hif_pci_api_install(struct hif_pci_api *apis);
-void hif_pci_module_install(struct hif_api *apis);
-#endif
-
-
+++ /dev/null
-/*
- * @File: mbox_hw.h
- *
- * @Abstract: mailbox hardware definitions
- *
- * @Notes:
- * *
- * Copyright (c) 2008 Atheros Communications Inc.
- * All rights reserved.
- *
- */
-
-#ifndef __HIF_USB_H__
-#define __HIF_USB_H__
-
-#include <hif_api.h>
-
-#include <sys_cfg.h>
-#include <vdesc_api.h>
-#include <vbuf_api.h>
-//#include <desc.h>
-//#include <dma_engine_api.h>
-
-#define HIF_USB_PIPE_TX 1
-#define HIF_USB_PIPE_RX 2
-#define HIF_USB_PIPE_INTERRUPT 3
-#define HIF_USB_PIPE_COMMAND 4
-#define HIF_USB_PIPE_HP_TX 5
-#define HIF_USB_PIPE_MP_TX 6
-
-struct VBUF_QUEUE
-{
- VBUF *head;
- VBUF *tail;
-};
-
- /* the mailbox hardware layer context */
-typedef struct _HIF_USB_CONTEXT {
- HIF_CALLBACK hifCb;
- struct zsDmaQueue dnQ;
- struct zsTxDmaQueue upQ;
-#if SYSTEM_MODULE_HP_EP5
- struct zsDmaQueue hpdnQ; // high priority
-#endif
-#if SYSTEM_MODULE_HP_EP6
- struct zsDmaQueue mpdnQ; // medium priority
-#endif
- //struct VBUF_QUEUE upVbufQ;
- VBUF *cmdQueue;
- struct VBUF_QUEUE eventBufQ;
-
- // Left a door for extension the structure
- void *pReserved;
-} HIF_USB_CONTEXT;
-
-void hif_usb_module_install(struct hif_api *apis);
-
-#endif
+++ /dev/null
-/*\r
- * @File: htc_api.h\r
- * \r
- * @Abstract: host-target communications API\r
- * \r
- * @Notes: \r
- * \r
- * Copyright (c) 2008 Atheros Communications Inc.\r
- * All rights reserved.\r
- *\r
- */\r
-\r
-#ifndef __HTC_API_H__\r
-#define __HTC_API_H__\r
-\r
-#include <osapi.h>\r
-#include <htc.h>\r
-//#include <htc_buf.h>\r
-//#include <htc_services.h>\r
-#include <adf_nbuf.h>\r
-#include <buf_pool_api.h>\r
-\r
-#define HTC_HDR_SZ HTC_HDR_LENGTH\r
-#define HTC_BUFSZ_MAX_SEND 2048\r
-\r
-typedef void (* HTC_SERVICE_ProcessRecvMsg)(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t, adf_nbuf_t, void *ServiceCtx);\r
-typedef void (* HTC_SERVICE_ProcessSendBufferComplete)(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t, void *ServiceCtx);\r
- \r
-/* HTC service structure :\r
- * the caller is required to allocate storage for the service structure and register the\r
- * structure using HTC_RegisterService() The service must set the following fields:\r
- * ProcessRecvMsg\r
- * ProcessSendBufferComplete\r
- * ProcessConnect\r
- * ServiceID\r
- * MaxSvcMsgSize (for message validation)\r
- * */\r
-typedef struct _HTC_SERVICE {\r
- struct _HTC_SERVICE *pNext;\r
- /* Callback for processing receive messages. HTC calls this callback whenever a \r
- * message arrives on the endpoint assigned to this service.\r
- * HTC_BUFFER is a chain of buffers containing a full application message.\r
- * HTC_BUFFER->buffer points to the start of the msg buffer (past the HTC header) */\r
- //void (* ProcessRecvMsg)(HTC_ENDPOINT_ID EndpointID, HTC_BUFFER *); \r
- void (* ProcessRecvMsg)(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t, adf_nbuf_t, void *ServiceCtx); \r
- /* callback to process completed send buffers */\r
- //void (* ProcessSendBufferComplete)(HTC_ENDPOINT_ID EndpointID, HTC_BUFFER *); \r
- void (* ProcessSendBufferComplete)(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t, void *ServiceCtx); \r
- /* optional callback when a connection request occurs.\r
- * The EndpointID is the assigned endpoint, the callback returns a connect \r
- * response status code to allow or disallow the connection.\r
- * pDataIn points to the optional meta data supplied in the connection request\r
- * pDataOut points to a buffer to send back meta data \r
- * If no callback is supplied, HTC assumes the connect is allowed */\r
- A_UINT8 (* ProcessConnect)(struct _HTC_SERVICE *pService,\r
- HTC_ENDPOINT_ID EndpointID, \r
- A_UINT8 *pDataIn, \r
- int LengthIn,\r
- A_UINT8 *pDataOut,\r
- int *pLengthOut); \r
- A_UINT16 ServiceID; /* service ID to match connection requests */\r
- A_UINT16 ServiceFlags; /* service flags */\r
- A_UINT16 MaxSvcMsgSize; /* maximum length of service-specific messages exchanged on the endpoint */\r
- A_UINT16 TrailerSpcCheckLimit; /* amount of space in each send buffer that HTC can check for trailer\r
- data. This should be set to the smallest HTC buffer that can be sent \r
- through the service. The service can disable trailer data insertion\r
- by setting this value to 0. */\r
- void *ServiceCtx;\r
-} HTC_SERVICE;\r
-\r
-#define HTC_SERVICE_FLAGS_CONNECTED (1 << 0) /* service has at least 1 connection */\r
-\r
-#define IS_SERVICE_CONNECTED(s) ((s)->ServiceFlags & HTC_SERVICE_FLAGS_CONNECTED)\r
-\r
- /* configuration settings for the WMI service */\r
-typedef struct _HTC_CONFIG {\r
- int CreditSize; /* */\r
- int CreditNumber;\r
- //int ControlDownLinkPipeID;\r
- //int ControlUpLinkPipeID;\r
- adf_os_handle_t OSHandle;\r
- hif_handle_t HIFHandle;\r
- pool_handle_t PoolHandle;\r
-} HTC_CONFIG;\r
-\r
-typedef struct _HTC_BUF_CONTEXT {\r
- A_UINT8 end_point;\r
- A_UINT8 htc_flags; /* htc flags (used by HTC layer only) */ \r
-} HTC_BUF_CONTEXT;\r
-\r
-typedef void* htc_handle_t;\r
-\r
-/*\r
- * setup complete function, supplied by HTC caller at HTC_init time.\r
- * HTC calls this function after the host has indicated that the service connection\r
- * phase is complete.\r
- * \r
- */\r
-typedef void (* HTC_SETUP_COMPLETE_CB)(void);\r
-\r
-struct htc_apis {\r
- htc_handle_t (* _HTC_Init)(HTC_SETUP_COMPLETE_CB, HTC_CONFIG *pConfig); \r
- void (* _HTC_Shutdown)(htc_handle_t);\r
- void (* _HTC_RegisterService)(htc_handle_t, HTC_SERVICE *);\r
- void (* _HTC_Ready)(htc_handle_t);\r
- void (* _HTC_ReturnBuffers)(htc_handle_t handle, HTC_ENDPOINT_ID EndpointID, adf_nbuf_t);\r
- void (* _HTC_ReturnBuffersList)(htc_handle_t handle, HTC_ENDPOINT_ID EndpointID, adf_nbuf_queue_t);\r
- void (* _HTC_SendMsg)(htc_handle_t handle, HTC_ENDPOINT_ID EndpointID, adf_nbuf_t); \r
- int (* _HTC_GetReservedHeadroom)(htc_handle_t handle);\r
- \r
- //void (* _HTC_PauseRecv)(HTC_ENDPOINT_ID EndpointID);\r
- //void (* _HTC_ResumeRecv)(HTC_ENDPOINT_ID EndpointID);\r
- //void (* _HTC_AddBufferResources)(int buffers);\r
- \r
- /* These APIs below are for patch purpose only */\r
- void (*_HTC_MsgRecvHandler)(adf_nbuf_t hdr_buf, adf_nbuf_t buf, void *context);\r
- void (*_HTC_SendDoneHandler)(adf_nbuf_t buf, void *context);\r
- void (*_HTC_ControlSvcProcessMsg)(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t hdr_buf, adf_nbuf_t buf, void *arg);\r
- void (*_HTC_ControlSvcProcessSendComplete)(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t pBuffers, void *arg);\r
- \r
- void *pReserved; /* for expansion if need be */\r
-};\r
-\r
-extern void htc_module_install(struct htc_apis *pAPIs);\r
-\r
-#endif /* _HTC_API_H__ */\r
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __INTR_API_H__
-#define __INTR_API_H__
-
-/*
- * Interrupt handler, for application-managed interrupts.
- * When an interrupt occurs, it is automatically disabled.
- * See A_WMAC_INTR_ATTACH() and A_MBOX_INTR_ATTACH().
- *
- * If a handler returns A_HANDLER_DONE, the interrupt is
- * re-enabled. The OS calls the handler next time service
- * is required. This is the normal case for a handler.
- *
- * If a handler returns A_HANDLER_YIELD, the interrupt
- * remains masked. The handler is called again when
- * it is "convenient". This gives the OS an opportunity
- * to run other code/handlers. A handler should return
- * A_HANDLER_YIELD if it might dominate the CPU for too
- * long.
- *
- * If a handler returns A_HANDLER_NOENABLE, the interrupt
- * remains disabled. It is up to the application to re-enable
- * the interrupt (via A_*_INTR_UNMASK) when it's appropriate.
- *
- * Note that many combinations of interrupt functions and
- * interrupt vectors are NOT supported: Callers should use
- * only the macros defined in cmnos_api.h to access the
- * interrupt API.
- */
-#include "cmnos_api.h"
-
-typedef uint32_t A_old_intr_t;
-
-//////////////////////////////////////////////////////////////////
-// this is copied from mercury/cmnos_xtensa.h
-/*
- * These are CMNOS interrupt manifest constants.
- * They have specially-chosen values that align with hardware and or
- * operating system values (see cmnos_interrupt_info).
- */
-#if defined(__XTENSA__)
-/*
- * Enumeration of low and medium priority interrupt numbers
- * which match the CPU hardware configuration:
- */
-
-/* XTensa Level 1 interrupt */
-#define A_INUM_SOFTWARE 0 /* currently unused */
-
-/* XTensa Level2 interrupts */
-#define A_INUM_XTTIMER 1 /* currently unused */
-
-#define A_INUM_TBD_0 2 /* TBD */
-#define A_INUM_CPU_WDT 3 /* RST_CPU watchodg interrupt */
-#define A_INUM_GMAC_DMA 4 /* GMAC DMA interrupt */
-#define A_INUM_GMAC_MDIO 5 /* GMAC MDIO interrupt */
-#define A_INUM_HOST_DMA 6 /* HOST DMA */
-#define A_INUM_CPU_GEN_TIMER 7 /* CPU general timer */
-#define A_INUM_TBD_8 8 /* TBD */
-#define A_INUM_TBD_9 9 /* TBD */
-#define A_INUM_USB_CTRL 10 /* USB core control */
-#define A_INUM_USB_DMA 11 /* USB DMA */
-#define A_INUM_TBD_12 12 /* TBD */
-#define A_INUM_TBD_13 13 /* TBD */
-#define A_INUM_EMUX_CPU 14 /* EMUX CPU */
-#define A_INUM_GPIO_CPU 15 /* GPIO CPU interrupt */
-#define A_INUM_TBD_16 16 /* TBD */
-#define A_INUM_PCIE_CPU 17 /* CPU PCIE interrupt */
-#define A_INUM_RST_CPU_NMI 18 /* RST CPU nmi interrupt */
-
-/* Number of interrupts that map directly into CPU/hal interrupt bits. */
-#define NUM_DIRECT_INTR 19
-
-#endif
-//////////////////////////////////////////////////////////////////
-
-#define CMNOS_IMASK_XTTIMER (1<<A_INUM_XTTIMER)
-#define CMNOS_IMASK_USB_CTRL (1<<A_INUM_USB_CTRL)
-#define CMNOS_IMASK_GMAC_DMA (1<<A_INUM_GMAC_DMA)
-#define CMNOS_IMASK_GMAC_MDIO (1<<A_INUM_GMAC_MDIO)
-#define CMNOS_IMASK_HOST_DMA (1<<A_INUM_HOST_DMA)
-#define CMNOS_IMASK_CPU_GEN_TIMER (1<<A_INUM_CPU_GEN_TIMER)
-
-#define CMNOS_IMASK_EMUX_CPU (1<<A_INUM_EMUX_CPU)
-#define CMNOS_IMASK_GPIO_CPU (1<<A_INUM_GPIO_CPU)
-#define CMNOS_IMASK_PCIE_CPU (1<<A_INUM_PCIE_CPU)
-#define CMNOS_IMASK_RST_CPU_NMI (1<<A_INUM_RST_CPU_NMI)
-
-
-
-typedef enum inum_intr {
- A_INTR_TIMER = 0,
- A_INTR_USB_CTRL,
- A_INTR_USB_DMA,
- A_INTR_ERROR,
- /* add intr above here */
- A_INTR_NUM
-}A_INUM_INTR_T;
-
-//////////////////////////////////////////////////////////////////
-
-/*
- * An interrupt handler, which is a function called in response
- * to a hardware interrupt, possibly as a Delayed Service Routine.
- */
-typedef int (* A_handler_t)(void *);
-/* Return values from a handler/DSR, A_handler_t */
-#define A_HANDLER_NOENABLE 0 /* do not re-enable interrupts */
-#define A_HANDLER_DONE 1 /* all intrs handled, call on next intr */
-#define A_HANDLER_YIELD 2 /* leave intrs disabled and
- call back later regardless of intr state */
-
-/*
- * An Interrupt Service Routine, which must be called
- * directly in interrupt context (not delayed), and which
- * must be very small and may not have access to all OS
- * functions. These are for use only when interrupt
- * latency is critical; otherwise, an A_handler_t ("dsr")
- * is preferable.
- */
-typedef uint32_t (* A_isr_t)(void *);
-/* Return values from an ISR */
-#if defined(CYG_ISR_HANDLED)
-#define A_ISR_HANDLED CYG_ISR_HANDLED
-#define A_ISR_CALL_DSR CYG_ISR_CALL_DSR
-#else
-#define A_ISR_HANDLED 1
-#define A_ISR_CALL_DSR 2
-#endif
-
-struct intr_api {
- void (*_intr_init)(void);
- uint32_t (* _intr_invoke_isr)(uint32_t inum);
- A_old_intr_t(* _intr_disable)(void);
- void (* _intr_restore)(A_old_intr_t);
-
- void (* _intr_mask_inum)(uint32_t inum);
- void (* _intr_unmask_inum)(uint32_t inum);
- void (* _intr_attach_isr)(uint32_t inum, A_isr_t isr, void *arg);
-/*
- BOOLEAN (*_intr_dsrs_pending)(void);
- void (* _intr_handle_pending_dsrs)(void);
- uint32_t (* _intr_nmi)(void *);
-*/
- /* Low-level interrupt access, intended for use by OS modules */
- unsigned int (* _get_intrenable)(void);
- void (* _set_intrenable)(unsigned int);
- unsigned int (* _get_intrpending)(void);
- void (* _unblock_all_intrlvl)(void);
-};
-#endif /* __INTR_API_H__ */
-/*\r
- * Copyright (c) 2013 Qualcomm Atheros, Inc.\r
- * All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted (subject to the limitations in the\r
- * disclaimer below) provided that the following conditions are met:\r
- *\r
- * * Redistributions of source code must retain the above copyright\r
- * notice, this list of conditions and the following disclaimer.\r
- *\r
- * * Redistributions in binary form must reproduce the above copyright\r
- * notice, this list of conditions and the following disclaimer in the\r
- * documentation and/or other materials provided with the\r
- * distribution.\r
- *\r
- * * Neither the name of Qualcomm Atheros nor the names of its\r
- * contributors may be used to endorse or promote products derived\r
- * from this software without specific prior written permission.\r
- *\r
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE\r
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT\r
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED\r
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\r
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\r
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\r
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
- */\r
-/*************************************************************************/\r
-/* Copyright (c) 2006 Atheros Communications, Inc., All Rights Reserved */\r
-/* */\r
-/* Module Name : reg_defs.h */\r
-/* */\r
-/* Abstract */\r
-/* This file contains the register addr and marco definition. */\r
-/* */\r
-/* NOTES */\r
-/* None */\r
-/* */\r
-/*************************************************************************/\r
-#ifndef _REG_DEFS_H_\r
-#define _REG_DEFS_H_\r
-\r
-#include "dt_defs.h"\r
-\r
-#define BIT_SET(bit) (1<<bit)\r
-#define BIT_CLR(bit) (0<<bit)\r
-\r
-/***** REGISTER BASE ADDRESS DEFINITION *****/\r
-#define RESET_VECTOR_ADDRESS 0x8e0000\r
-/********************************************/\r
-\r
-/***** REGISTER BASE ADDRESS DEFINITION *****/\r
-#define USB_CTRL_BASE_ADDRESS 0x00010000\r
-//#define PCIE_BASE_ADDRESS 0x00020000\r
-#define RST_BASE_ADDRESS 0x00050000\r
-#define UART_BASE_ADDRESS 0x00051000\r
-#define GPIO_BASE_ADDRESS 0x00052000\r
-#define HOST_DMA_BASE_ADDRESS 0x00053000\r
-#define GMAC_BASE_ADDRESS 0x00054000\r
-#define USB_DMA_BASE_ADDRESS 0x00055000\r
-#define CPU_PLL_BASE_ADDRESS 0x00056000\r
-#define SPI_REG_BASE_ADDRESS 0x0005B000\r
-#define EEPROM_BASE_ADDRESS 0x1f000000\r
-#define WLAN_BASE_ADDRESS 0x10ff0000\r
-/*******************************************************************************/\r
-/* Reset Register*/\r
-#define MAGPEI_REG_RST_BASE_ADDR RST_BASE_ADDRESS\r
-\r
-#define REG_GENERAL_TIMER_OFFSET 0x0\r
-#define REG_GENERAL_TIMER_RELOAD_OFFSET 0x4\r
-#define REG_WATCHDOG_TIMER_CONTROL_OFFSET 0x8\r
-#define REG_WATCHDOG_TIMER_OFFSET 0xC\r
-#define REG_RESET_OFFSET 0x10\r
-#define REG_BOOTSTRAP 0x14\r
-#define REG_AHB_ARB 0x18\r
-#define REG_REVISION_ID 0x90\r
-\r
-\r
-#define MAGPEI_REG_RST_GENERAL_TIMER_ADDR (RST_BASE_ADDRESS+REG_GENERAL_TIMER_OFFSET)\r
-#define MAGPIE_REG_RST_GENERAL_TIMER_RLD_ADDR (RST_BASE_ADDRESS+REG_GENERAL_TIMER_RELOAD_OFFSET)\r
-#define MAGPIE_REG_RST_WDT_TIMER_CTRL_ADDR (RST_BASE_ADDRESS+REG_WATCHDOG_TIMER_CONTROL_OFFSET)\r
-#define MAGPIE_REG_RST_WDT_TIMER_ADDR (RST_BASE_ADDRESS+REG_WATCHDOG_TIMER_OFFSET)\r
-#define MAGPIE_REG_RST_RESET_ADDR (RST_BASE_ADDRESS+REG_RESET_OFFSET)\r
-#define MAGPIE_REG_RST_BOOTSTRAP_ADDR (RST_BASE_ADDRESS+REG_BOOTSTRAP)\r
-#define MAGPIE_REG_AHB_ARB_ADDR (RST_BASE_ADDRESS+REG_AHB_ARB)\r
-#define MAGPIE_REG_REVISION_ID_ADDR (RST_BASE_ADDRESS+REG_REVISION_ID)\r
-\r
-#define MAGPEI_REG_RST_GENERAL_TIMER (*((volatile u32_t*)(MAGPEI_REG_RST_GENERAL_TIMER_ADDR)))\r
-#define MAGPIE_REG_RST_GENERAL_TIMER_RLD (*((volatile u32_t*)(MAGPIE_REG_RST_GENERAL_TIMER_RLD_ADDR)))\r
-#define MAGPIE_REG_RST_WDT_TIMER_CTRL (*((volatile u32_t*)(MAGPIE_REG_RST_WDT_TIMER_CTRL_ADDR)))\r
-#define MAGPIE_REG_RST_WDT_TIMER (*((volatile u32_t*)(MAGPIE_REG_RST_WDT_TIMER_ADDR)))\r
-#define MAGPIE_REG_RST_RESET (*((volatile u32_t*)(MAGPIE_REG_RST_RESET_ADDR)))\r
-#define MAGPIE_REG_RST_BOOTSTRAP (*((volatile u32_t*)(MAGPIE_REG_RST_BOOTSTRAP_ADDR)))\r
-#define MAGPIE_REG_AHB_ARB (*((volatile u32_t*)(MAGPIE_REG_AHB_ARB_ADDR)))\r
-#define MAGPIE_REG_REVISION_ID (*((volatile u32_t*)(MAGPIE_REG_REVISION_ID_ADDR)))\r
-\r
-\r
-/*******************************************************************************/\r
-/* USB DMA Register*/\r
-\r
-#define MAGPIE_REG_USB_INTERRUPT_ADDR USB_DMA_BASE_ADDRESS\r
-#define MAGPIE_REG_USB_INTERRUPT_MASK_ADDR (USB_DMA_BASE_ADDRESS + 0x4)\r
-\r
-#define MAGPIE_REG_USB_RX0_DESC_START_ADDR (USB_DMA_BASE_ADDRESS + 0x800)\r
-#define MAGPIE_REG_USB_RX0_DMA_START_ADDR (USB_DMA_BASE_ADDRESS + 0x804)\r
-#define MAGPIE_REG_USB_RX0_BURST_SIZE_ADDR (USB_DMA_BASE_ADDRESS + 0x808)\r
-#define MAGPIE_REG_USB_RX0_STATE_ADDR (USB_DMA_BASE_ADDRESS + 0x814)\r
-#define MAGPIE_REG_USB_RX0_CUR_TRACE_ADDR (USB_DMA_BASE_ADDRESS + 0x818)\r
-#define MAGPIE_REG_USB_RX0_SWAP_DATA_ADDR (USB_DMA_BASE_ADDRESS + 0x81C)\r
-\r
-#define MAGPIE_REG_USB_RX1_DESC_START_ADDR (USB_DMA_BASE_ADDRESS + 0x900)\r
-#define MAGPIE_REG_USB_RX1_DMA_START_ADDR (USB_DMA_BASE_ADDRESS + 0x904)\r
-#define MAGPIE_REG_USB_RX1_BURST_SIZE_ADDR (USB_DMA_BASE_ADDRESS + 0x908)\r
-#define MAGPIE_REG_USB_RX1_STATE_ADDR (USB_DMA_BASE_ADDRESS + 0x914)\r
-#define MAGPIE_REG_USB_RX1_CUR_TRACE_ADDR (USB_DMA_BASE_ADDRESS + 0x918)\r
-#define MAGPIE_REG_USB_RX1_SWAP_DATA_ADDR (USB_DMA_BASE_ADDRESS + 0x91C)\r
-\r
-#define MAGPIE_REG_USB_RX2_DESC_START_ADDR (USB_DMA_BASE_ADDRESS + 0xa00)\r
-#define MAGPIE_REG_USB_RX2_DMA_START_ADDR (USB_DMA_BASE_ADDRESS + 0xa04)\r
-#define MAGPIE_REG_USB_RX2_BURST_SIZE_ADDR (USB_DMA_BASE_ADDRESS + 0xa08)\r
-#define MAGPIE_REG_USB_RX2_STATE_ADDR (USB_DMA_BASE_ADDRESS + 0xa14)\r
-#define MAGPIE_REG_USB_RX2_CUR_TRACE_ADDR (USB_DMA_BASE_ADDRESS + 0xa18)\r
-#define MAGPIE_REG_USB_RX2_SWAP_DATA_ADDR (USB_DMA_BASE_ADDRESS + 0xa1C)\r
-\r
-#define MAGPIE_REG_USB_TX0_DESC_START_ADDR (USB_DMA_BASE_ADDRESS + 0xC00)\r
-#define MAGPIE_REG_USB_TX0_DMA_START_ADDR (USB_DMA_BASE_ADDRESS + 0xC04)\r
-#define MAGPIE_REG_USB_TX0_BURST_SIZE_ADDR (USB_DMA_BASE_ADDRESS + 0xC08)\r
-#define MAGPIE_REG_USB_TX0_STATE_ADDR (USB_DMA_BASE_ADDRESS + 0xC10)\r
-#define MAGPIE_REG_USB_TX0_CUR_TRACE_ADDR (USB_DMA_BASE_ADDRESS + 0xC14)\r
-#define MAGPIE_REG_USB_TX0_SWAP_DATA_ADDR (USB_DMA_BASE_ADDRESS + 0xC18)\r
-\r
-#define MAGPIE_REG_USB_INTERRUPT_TX0_END (1<<24) //0x1000000\r
-#define MAGPIE_REG_USB_INTERRUPT_TX0_COMPL (1<<16) //0x10000\r
-#define MAGPIE_REG_USB_INTERRUPT_RX2_END (1<<10) //0x00400\r
-#define MAGPIE_REG_USB_INTERRUPT_RX1_END (1<<9) //0x00200\r
-#define MAGPIE_REG_USB_INTERRUPT_RX0_END (1<<8) //0x0100\r
-#define MAGPIE_REG_USB_INTERRUPT_RX2_COMPL (1<<2) //0x00004\r
-\r
-#define MAGPIE_REG_USB_INTERRUPT_RX1_COMPL (1<<1) //0x00002\r
-#define MAGPIE_REG_USB_INTERRUPT_RX0_COMPL (1<<0) //0x00001\r
-\r
-\r
-#define MAGPIE_REG_USB_INTERRUPT (*((volatile u32_t*)(MAGPIE_REG_USB_INTERRUPT_ADDR)))\r
-#define MAGPIE_REG_USB_INTERRUPT_MASK (*((volatile u32_t*)(MAGPIE_REG_USB_INTERRUPT_MASK_ADDR)))\r
-\r
-#define MAGPIE_REG_USB_RX0_DESC_START (*((volatile u32_t*)(MAGPIE_REG_USB_RX0_DESC_START_ADDR)))\r
-#define MAGPIE_REG_USB_RX0_DMA_START (*((volatile u32_t*)(MAGPIE_REG_USB_RX0_DMA_START_ADDR)))\r
-#define MAGPIE_REG_USB_RX0_BURST_SIZE (*((volatile u32_t*)(MAGPIE_REG_USB_RX0_BURST_SIZE_ADDR)))\r
-#define MAGPIE_REG_USB_RX0_STATE (*((volatile u32_t*)(MAGPIE_REG_USB_RX0_STATE_ADDR)))\r
-#define MAGPIE_REG_USB_RX0_CUR_TRACE (*((volatile u32_t*)(MAGPIE_REG_USB_RX0_CUR_TRACE_ADDR)))\r
-#define MAGPIE_REG_USB_RX0_SWAP_DATA (*((volatile u32_t*)(MAGPIE_REG_USB_RX0_SWAP_DATA_ADDR)))\r
-\r
-\r
-#define MAGPIE_REG_USB_RX1_DESC_START (*((volatile u32_t*)(MAGPIE_REG_USB_RX1_DESC_START_ADDR)))\r
-#define MAGPIE_REG_USB_RX1_DMA_START (*((volatile u32_t*)(MAGPIE_REG_USB_RX1_DMA_START_ADDR)))\r
-#define MAGPIE_REG_USB_RX1_BURST_SIZE (*((volatile u32_t*)(MAGPIE_REG_USB_RX1_BURST_SIZE_ADDR)))\r
-#define MAGPIE_REG_USB_RX1_STATE (*((volatile u32_t*)(MAGPIE_REG_USB_RX1_STATE_ADDR)))\r
-#define MAGPIE_REG_USB_RX1_CUR_TRACE (*((volatile u32_t*)(MAGPIE_REG_USB_RX1_CUR_TRACE_ADDR)))\r
-#define MAGPIE_REG_USB_RX1_SWAP_DATA (*((volatile u32_t*)(MAGPIE_REG_USB_RX1_SWAP_DATA_ADDR)))\r
-\r
-#define MAGPIE_REG_USB_RX2_DESC_START (*((volatile u32_t*)(MAGPIE_REG_USB_RX2_DESC_START_ADDR)))\r
-#define MAGPIE_REG_USB_RX2_DMA_START (*((volatile u32_t*)(MAGPIE_REG_USB_RX2_DMA_START_ADDR)))\r
-#define MAGPIE_REG_USB_RX2_BURST_SIZE (*((volatile u32_t*)(MAGPIE_REG_USB_RX2_BURST_SIZE_ADDR)))\r
-#define MAGPIE_REG_USB_RX2_STATE (*((volatile u32_t*)(MAGPIE_REG_USB_RX2_STATE_ADDR)))\r
-#define MAGPIE_REG_USB_RX2_CUR_TRACE (*((volatile u32_t*)(MAGPIE_REG_USB_RX2_CUR_TRACE_ADDR)))\r
-#define MAGPIE_REG_USB_RX2_SWAP_DATA (*((volatile u32_t*)(MAGPIE_REG_USB_RX2_SWAP_DATA_ADDR)))\r
-\r
-\r
-#define MAGPIE_REG_USB_TX0_DESC_START (*((volatile u32_t*)(MAGPIE_REG_USB_TX0_DESC_START_ADDR)))\r
-#define MAGPIE_REG_USB_TX0_DMA_START (*((volatile u32_t*)(MAGPIE_REG_USB_TX0_DMA_START_ADDR)))\r
-#define MAGPIE_REG_USB_TX0_BURST_SIZE (*((volatile u32_t*)(MAGPIE_REG_USB_TX0_BURST_SIZE_ADDR)))\r
-#define MAGPIE_REG_USB_TX0_STATE (*((volatile u32_t*)(MAGPIE_REG_USB_TX0_STATE_ADDR)))\r
-#define MAGPIE_REG_USB_TX0_CUR_TRACE (*((volatile u32_t*)(MAGPIE_REG_USB_TX0_CUR_TRACE_ADDR)))\r
-#define MAGPIE_REG_USB_TX0_SWAP_DATA (*((volatile u32_t*)(MAGPIE_REG_USB_TX0_SWAP_DATA_ADDR)))\r
-\r
-\r
-\r
-/*******************************************************************************/\r
-/* CPU PLL Register*/\r
-\r
-#define REG_CPU_PLL_OFFSET 0x0\r
-#define REG_CPU_PLL_BYPASS_OFFSET 0x4\r
-#define REG_USB_DIVIDE_OFFSET 0x8\r
-#define REG_ETH_PLL_OFFSET 0xC\r
-#define REG_ETH_PLL_BYPASS_OFFSET 0x10\r
-#define REG_ETH_TXRX_DIVIDE_OFFSET 0x14\r
-#define REG_ETH_XTAL_DIVIDE_OFFSET 0x18\r
-#define REG_PCIE_PLL_CONFIG_OFFSET 0x1C\r
-#define REG_PCIE_DITHER_DIV_MAX_OFFSET 0x20\r
-#define REG_PCIE_PLL_DITHER_DIV_MIN_OFFSET 0x24\r
-#define REG_PCIE_PLL_DITHER_STEP_OFFSET 0x28\r
-#define REG_CURRENT_PCIE_PLL_DITHER_OFFSET 0x2c\r
-#define REG_USB_SUSPEND_ENABLE_OFFSET 0x30\r
-\r
-\r
-#define MAGPIE_REG_CPU_PLL_ADDR (CPU_PLL_BASE_ADDRESS + REG_CPU_PLL_OFFSET)\r
-#define MAGPIE_REG_CPU_PLL_BYPASS_ADDR (CPU_PLL_BASE_ADDRESS + REG_CPU_PLL_BYPASS_OFFSET)\r
-#define MAGPIE_REG_USB_DIVIDE_ADDR (CPU_PLL_BASE_ADDRESS + REG_USB_DIVIDE_OFFSET)\r
-#define MAGPIE_REG_ETH_PLL_ADDR (CPU_PLL_BASE_ADDRESS + REG_ETH_PLL_OFFSET)\r
-#define MAGPIE_REG_ETH_PLL_BYPASS_ADDR (CPU_PLL_BASE_ADDRESS + REG_ETH_PLL_BYPASS_OFFSET)\r
-#define MAGPIE_REG_ETH_TXRX_DIVIDE_ADDR (CPU_PLL_BASE_ADDRESS + REG_ETH_TXRX_DIVIDE_OFFSET)\r
-#define MAGPIE_REG_ETH_XTAL_DIVIDE_ADDR (CPU_PLL_BASE_ADDRESS + REG_ETH_XTAL_DIVIDE_OFFSET)\r
-#define MAGPIE_REG_PCIE_PLL_CONFIG_ADDR (CPU_PLL_BASE_ADDRESS + REG_PCIE_PLL_CONFIG_OFFSET)\r
-#define MAGPIE_REG_PCIE_DITHER_DIV_MAX_ADDR (CPU_PLL_BASE_ADDRESS + REG_PCIE_DITHER_DIV_MAX_OFFSET)\r
-#define MAGPIE_REG_PCIE_PLL_DITHER_DIV_MIN_ADDR (CPU_PLL_BASE_ADDRESS + REG_PCIE_PLL_DITHER_DIV_MIN_OFFSET)\r
-#define MAGPIE_REG_PCIE_PLL_DITHER_STEP_ADDR (CPU_PLL_BASE_ADDRESS + REG_PCIE_PLL_DITHER_STEP_OFFSET)\r
-#define MAGPIE_REG_CURRENT_PCIE_PLL_DITHER_ADDR (CPU_PLL_BASE_ADDRESS + REG_CURRENT_PCIE_PLL_DITHER_OFFSET)\r
-#define MAGPIE_REG_SUSPEND_ENABLE_ADDR (CPU_PLL_BASE_ADDRESS + REG_USB_SUSPEND_ENABLE_OFFSET)\r
-\r
-\r
-/*******************************************************************************/\r
-/* GPIO Register*/\r
-\r
-#define REG_GPIO_OE 0x0\r
-#define REG_GPIO_IN 0x4\r
-#define REG_GPIO_OUT 0x8\r
-#define REG_GPIO_SET 0xC\r
-#define REG_GPIO_CLEAR 0x10\r
-#define REG_GPIO_INT 0x14\r
-#define REG_GPIO_INT_TYPE 0x18\r
-#define REG_GPIO_INT_POLARITY 0x1C\r
-#define REG_GPIO_PENDING 0x20\r
-#define REG_GPIO_INT_MASK 0x24\r
-#define REG_GPIO_FUNCTION 0x28\r
-\r
-\r
-#define MAGPIE_REG_GPIO_OE (GPIO_BASE_ADDRESS + REG_GPIO_OE)\r
-#define MAGPIE_REG_GPIO_IN (GPIO_BASE_ADDRESS + REG_GPIO_IN)\r
-#define MAGPIE_REG_GPIO_OUT (GPIO_BASE_ADDRESS + REG_GPIO_OUT)\r
-#define MAGPIE_REG_GPIO_SET (GPIO_BASE_ADDRESS + REG_GPIO_SET)\r
-#define MAGPIE_REG_GPIO_CLEAR (GPIO_BASE_ADDRESS + REG_GPIO_CLEAR)\r
-#define MAGPIE_REG_GPIO_INT (GPIO_BASE_ADDRESS + REG_GPIO_INT)\r
-#define MAGPIE_REG_GPIO_INT_TYPE (GPIO_BASE_ADDRESS + REG_GPIO_INT_TYPE)\r
-#define MAGPIE_REG_GPIO_INT_POLARITY (GPIO_BASE_ADDRESS + REG_GPIO_INT_POLARITY)\r
-#define MAGPIE_REG_GPIO_PENDING (GPIO_BASE_ADDRESS + REG_GPIO_PENDING)\r
-#define MAGPIE_REG_GPIO_INT_MASK (GPIO_BASE_ADDRESS + REG_GPIO_INT_MASK)\r
-#define MAGPIE_REG_GPIO_FUNCTION (GPIO_BASE_ADDRESS + REG_GPIO_FUNCTION)\r
-\r
-\r
-/*******************************************************************************/\r
-/* SPI Flash Register*/\r
-#define MAGPEI_REG_SPI_BASE_ADDR SPI_REG_BASE_ADDRESS\r
-\r
-#define REG_SPI_CS_OFFSET 0x0\r
-#define REG_SPI_AO_OFFSET 0x4\r
-#define REG_SPI_D_OFFSET 0x8\r
-#define REG_SPI_CLKDIV_OFFSET 0x1C\r
-\r
-#define MAGPIE_REG_SPI_CS_ADDR (MAGPEI_REG_SPI_BASE_ADDR + REG_SPI_CS_OFFSET)\r
-#define MAGPIE_REG_SPI_AO_ADDR (MAGPEI_REG_SPI_BASE_ADDR + REG_SPI_AO_OFFSET)\r
-#define MAGPIE_REG_SPI_D_ADDR (MAGPEI_REG_SPI_BASE_ADDR + REG_SPI_D_OFFSET)\r
-#define MAGPIE_REG_SPI_CLKDIV_ADDR (MAGPEI_REG_SPI_BASE_ADDR + REG_SPI_CLKDIV_OFFSET)\r
-\r
-#endif\r
-\r
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+/*************************************************************************/
+/* Copyright (c) 2006 Atheros Communications, Inc., All Rights Reserved */
+/* */
+/* Module Name : reg_defs.h */
+/* */
+/* Abstract */
+/* This file contains the register addr and marco definition. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/*************************************************************************/
+#ifndef _REG_DEFS_H_
+#define _REG_DEFS_H_
+
+#include "dt_defs.h"
+
+#define BIT_SET(bit) (1<<bit)
+#define BIT_CLR(bit) (0<<bit)
+
+/***** REGISTER BASE ADDRESS DEFINITION *****/
+#define RESET_VECTOR_ADDRESS 0x8e0000
+/********************************************/
+
+/***** REGISTER BASE ADDRESS DEFINITION *****/
+#define USB_CTRL_BASE_ADDRESS 0x00010000
+//#define PCIE_BASE_ADDRESS 0x00020000
+#define RST_BASE_ADDRESS 0x00050000
+#define UART_BASE_ADDRESS 0x00051000
+#define GPIO_BASE_ADDRESS 0x00052000
+#define HOST_DMA_BASE_ADDRESS 0x00053000
+#define GMAC_BASE_ADDRESS 0x00054000
+#define USB_DMA_BASE_ADDRESS 0x00055000
+#define CPU_PLL_BASE_ADDRESS 0x00056000
+#define SPI_REG_BASE_ADDRESS 0x0005B000
+#define EEPROM_BASE_ADDRESS 0x1f000000
+#define WLAN_BASE_ADDRESS 0x10ff0000
+/*******************************************************************************/
+/* Reset Register*/
+#define MAGPEI_REG_RST_BASE_ADDR RST_BASE_ADDRESS
+
+#define REG_GENERAL_TIMER_OFFSET 0x0
+#define REG_GENERAL_TIMER_RELOAD_OFFSET 0x4
+#define REG_WATCHDOG_TIMER_CONTROL_OFFSET 0x8
+#define REG_WATCHDOG_TIMER_OFFSET 0xC
+#define REG_RESET_OFFSET 0x10
+#define REG_BOOTSTRAP 0x14
+#define REG_AHB_ARB 0x18
+#define REG_REVISION_ID 0x90
+
+
+#define MAGPEI_REG_RST_GENERAL_TIMER_ADDR (RST_BASE_ADDRESS+REG_GENERAL_TIMER_OFFSET)
+#define MAGPIE_REG_RST_GENERAL_TIMER_RLD_ADDR (RST_BASE_ADDRESS+REG_GENERAL_TIMER_RELOAD_OFFSET)
+#define MAGPIE_REG_RST_WDT_TIMER_CTRL_ADDR (RST_BASE_ADDRESS+REG_WATCHDOG_TIMER_CONTROL_OFFSET)
+#define MAGPIE_REG_RST_WDT_TIMER_ADDR (RST_BASE_ADDRESS+REG_WATCHDOG_TIMER_OFFSET)
+#define MAGPIE_REG_RST_RESET_ADDR (RST_BASE_ADDRESS+REG_RESET_OFFSET)
+#define MAGPIE_REG_RST_BOOTSTRAP_ADDR (RST_BASE_ADDRESS+REG_BOOTSTRAP)
+#define MAGPIE_REG_AHB_ARB_ADDR (RST_BASE_ADDRESS+REG_AHB_ARB)
+#define MAGPIE_REG_REVISION_ID_ADDR (RST_BASE_ADDRESS+REG_REVISION_ID)
+
+#define MAGPEI_REG_RST_GENERAL_TIMER (*((volatile u32_t*)(MAGPEI_REG_RST_GENERAL_TIMER_ADDR)))
+#define MAGPIE_REG_RST_GENERAL_TIMER_RLD (*((volatile u32_t*)(MAGPIE_REG_RST_GENERAL_TIMER_RLD_ADDR)))
+#define MAGPIE_REG_RST_WDT_TIMER_CTRL (*((volatile u32_t*)(MAGPIE_REG_RST_WDT_TIMER_CTRL_ADDR)))
+#define MAGPIE_REG_RST_WDT_TIMER (*((volatile u32_t*)(MAGPIE_REG_RST_WDT_TIMER_ADDR)))
+#define MAGPIE_REG_RST_RESET (*((volatile u32_t*)(MAGPIE_REG_RST_RESET_ADDR)))
+#define MAGPIE_REG_RST_BOOTSTRAP (*((volatile u32_t*)(MAGPIE_REG_RST_BOOTSTRAP_ADDR)))
+#define MAGPIE_REG_AHB_ARB (*((volatile u32_t*)(MAGPIE_REG_AHB_ARB_ADDR)))
+#define MAGPIE_REG_REVISION_ID (*((volatile u32_t*)(MAGPIE_REG_REVISION_ID_ADDR)))
+
+
+/*******************************************************************************/
+/* USB DMA Register*/
+
+#define MAGPIE_REG_USB_INTERRUPT_ADDR USB_DMA_BASE_ADDRESS
+#define MAGPIE_REG_USB_INTERRUPT_MASK_ADDR (USB_DMA_BASE_ADDRESS + 0x4)
+
+#define MAGPIE_REG_USB_RX0_DESC_START_ADDR (USB_DMA_BASE_ADDRESS + 0x800)
+#define MAGPIE_REG_USB_RX0_DMA_START_ADDR (USB_DMA_BASE_ADDRESS + 0x804)
+#define MAGPIE_REG_USB_RX0_BURST_SIZE_ADDR (USB_DMA_BASE_ADDRESS + 0x808)
+#define MAGPIE_REG_USB_RX0_STATE_ADDR (USB_DMA_BASE_ADDRESS + 0x814)
+#define MAGPIE_REG_USB_RX0_CUR_TRACE_ADDR (USB_DMA_BASE_ADDRESS + 0x818)
+#define MAGPIE_REG_USB_RX0_SWAP_DATA_ADDR (USB_DMA_BASE_ADDRESS + 0x81C)
+
+#define MAGPIE_REG_USB_RX1_DESC_START_ADDR (USB_DMA_BASE_ADDRESS + 0x900)
+#define MAGPIE_REG_USB_RX1_DMA_START_ADDR (USB_DMA_BASE_ADDRESS + 0x904)
+#define MAGPIE_REG_USB_RX1_BURST_SIZE_ADDR (USB_DMA_BASE_ADDRESS + 0x908)
+#define MAGPIE_REG_USB_RX1_STATE_ADDR (USB_DMA_BASE_ADDRESS + 0x914)
+#define MAGPIE_REG_USB_RX1_CUR_TRACE_ADDR (USB_DMA_BASE_ADDRESS + 0x918)
+#define MAGPIE_REG_USB_RX1_SWAP_DATA_ADDR (USB_DMA_BASE_ADDRESS + 0x91C)
+
+#define MAGPIE_REG_USB_RX2_DESC_START_ADDR (USB_DMA_BASE_ADDRESS + 0xa00)
+#define MAGPIE_REG_USB_RX2_DMA_START_ADDR (USB_DMA_BASE_ADDRESS + 0xa04)
+#define MAGPIE_REG_USB_RX2_BURST_SIZE_ADDR (USB_DMA_BASE_ADDRESS + 0xa08)
+#define MAGPIE_REG_USB_RX2_STATE_ADDR (USB_DMA_BASE_ADDRESS + 0xa14)
+#define MAGPIE_REG_USB_RX2_CUR_TRACE_ADDR (USB_DMA_BASE_ADDRESS + 0xa18)
+#define MAGPIE_REG_USB_RX2_SWAP_DATA_ADDR (USB_DMA_BASE_ADDRESS + 0xa1C)
+
+#define MAGPIE_REG_USB_TX0_DESC_START_ADDR (USB_DMA_BASE_ADDRESS + 0xC00)
+#define MAGPIE_REG_USB_TX0_DMA_START_ADDR (USB_DMA_BASE_ADDRESS + 0xC04)
+#define MAGPIE_REG_USB_TX0_BURST_SIZE_ADDR (USB_DMA_BASE_ADDRESS + 0xC08)
+#define MAGPIE_REG_USB_TX0_STATE_ADDR (USB_DMA_BASE_ADDRESS + 0xC10)
+#define MAGPIE_REG_USB_TX0_CUR_TRACE_ADDR (USB_DMA_BASE_ADDRESS + 0xC14)
+#define MAGPIE_REG_USB_TX0_SWAP_DATA_ADDR (USB_DMA_BASE_ADDRESS + 0xC18)
+
+#define MAGPIE_REG_USB_INTERRUPT_TX0_END (1<<24) //0x1000000
+#define MAGPIE_REG_USB_INTERRUPT_TX0_COMPL (1<<16) //0x10000
+#define MAGPIE_REG_USB_INTERRUPT_RX2_END (1<<10) //0x00400
+#define MAGPIE_REG_USB_INTERRUPT_RX1_END (1<<9) //0x00200
+#define MAGPIE_REG_USB_INTERRUPT_RX0_END (1<<8) //0x0100
+#define MAGPIE_REG_USB_INTERRUPT_RX2_COMPL (1<<2) //0x00004
+
+#define MAGPIE_REG_USB_INTERRUPT_RX1_COMPL (1<<1) //0x00002
+#define MAGPIE_REG_USB_INTERRUPT_RX0_COMPL (1<<0) //0x00001
+
+
+#define MAGPIE_REG_USB_INTERRUPT (*((volatile u32_t*)(MAGPIE_REG_USB_INTERRUPT_ADDR)))
+#define MAGPIE_REG_USB_INTERRUPT_MASK (*((volatile u32_t*)(MAGPIE_REG_USB_INTERRUPT_MASK_ADDR)))
+
+#define MAGPIE_REG_USB_RX0_DESC_START (*((volatile u32_t*)(MAGPIE_REG_USB_RX0_DESC_START_ADDR)))
+#define MAGPIE_REG_USB_RX0_DMA_START (*((volatile u32_t*)(MAGPIE_REG_USB_RX0_DMA_START_ADDR)))
+#define MAGPIE_REG_USB_RX0_BURST_SIZE (*((volatile u32_t*)(MAGPIE_REG_USB_RX0_BURST_SIZE_ADDR)))
+#define MAGPIE_REG_USB_RX0_STATE (*((volatile u32_t*)(MAGPIE_REG_USB_RX0_STATE_ADDR)))
+#define MAGPIE_REG_USB_RX0_CUR_TRACE (*((volatile u32_t*)(MAGPIE_REG_USB_RX0_CUR_TRACE_ADDR)))
+#define MAGPIE_REG_USB_RX0_SWAP_DATA (*((volatile u32_t*)(MAGPIE_REG_USB_RX0_SWAP_DATA_ADDR)))
+
+
+#define MAGPIE_REG_USB_RX1_DESC_START (*((volatile u32_t*)(MAGPIE_REG_USB_RX1_DESC_START_ADDR)))
+#define MAGPIE_REG_USB_RX1_DMA_START (*((volatile u32_t*)(MAGPIE_REG_USB_RX1_DMA_START_ADDR)))
+#define MAGPIE_REG_USB_RX1_BURST_SIZE (*((volatile u32_t*)(MAGPIE_REG_USB_RX1_BURST_SIZE_ADDR)))
+#define MAGPIE_REG_USB_RX1_STATE (*((volatile u32_t*)(MAGPIE_REG_USB_RX1_STATE_ADDR)))
+#define MAGPIE_REG_USB_RX1_CUR_TRACE (*((volatile u32_t*)(MAGPIE_REG_USB_RX1_CUR_TRACE_ADDR)))
+#define MAGPIE_REG_USB_RX1_SWAP_DATA (*((volatile u32_t*)(MAGPIE_REG_USB_RX1_SWAP_DATA_ADDR)))
+
+#define MAGPIE_REG_USB_RX2_DESC_START (*((volatile u32_t*)(MAGPIE_REG_USB_RX2_DESC_START_ADDR)))
+#define MAGPIE_REG_USB_RX2_DMA_START (*((volatile u32_t*)(MAGPIE_REG_USB_RX2_DMA_START_ADDR)))
+#define MAGPIE_REG_USB_RX2_BURST_SIZE (*((volatile u32_t*)(MAGPIE_REG_USB_RX2_BURST_SIZE_ADDR)))
+#define MAGPIE_REG_USB_RX2_STATE (*((volatile u32_t*)(MAGPIE_REG_USB_RX2_STATE_ADDR)))
+#define MAGPIE_REG_USB_RX2_CUR_TRACE (*((volatile u32_t*)(MAGPIE_REG_USB_RX2_CUR_TRACE_ADDR)))
+#define MAGPIE_REG_USB_RX2_SWAP_DATA (*((volatile u32_t*)(MAGPIE_REG_USB_RX2_SWAP_DATA_ADDR)))
+
+
+#define MAGPIE_REG_USB_TX0_DESC_START (*((volatile u32_t*)(MAGPIE_REG_USB_TX0_DESC_START_ADDR)))
+#define MAGPIE_REG_USB_TX0_DMA_START (*((volatile u32_t*)(MAGPIE_REG_USB_TX0_DMA_START_ADDR)))
+#define MAGPIE_REG_USB_TX0_BURST_SIZE (*((volatile u32_t*)(MAGPIE_REG_USB_TX0_BURST_SIZE_ADDR)))
+#define MAGPIE_REG_USB_TX0_STATE (*((volatile u32_t*)(MAGPIE_REG_USB_TX0_STATE_ADDR)))
+#define MAGPIE_REG_USB_TX0_CUR_TRACE (*((volatile u32_t*)(MAGPIE_REG_USB_TX0_CUR_TRACE_ADDR)))
+#define MAGPIE_REG_USB_TX0_SWAP_DATA (*((volatile u32_t*)(MAGPIE_REG_USB_TX0_SWAP_DATA_ADDR)))
+
+
+
+/*******************************************************************************/
+/* CPU PLL Register*/
+
+#define REG_CPU_PLL_OFFSET 0x0
+#define REG_CPU_PLL_BYPASS_OFFSET 0x4
+#define REG_USB_DIVIDE_OFFSET 0x8
+#define REG_ETH_PLL_OFFSET 0xC
+#define REG_ETH_PLL_BYPASS_OFFSET 0x10
+#define REG_ETH_TXRX_DIVIDE_OFFSET 0x14
+#define REG_ETH_XTAL_DIVIDE_OFFSET 0x18
+#define REG_PCIE_PLL_CONFIG_OFFSET 0x1C
+#define REG_PCIE_DITHER_DIV_MAX_OFFSET 0x20
+#define REG_PCIE_PLL_DITHER_DIV_MIN_OFFSET 0x24
+#define REG_PCIE_PLL_DITHER_STEP_OFFSET 0x28
+#define REG_CURRENT_PCIE_PLL_DITHER_OFFSET 0x2c
+#define REG_USB_SUSPEND_ENABLE_OFFSET 0x30
+
+
+#define MAGPIE_REG_CPU_PLL_ADDR (CPU_PLL_BASE_ADDRESS + REG_CPU_PLL_OFFSET)
+#define MAGPIE_REG_CPU_PLL_BYPASS_ADDR (CPU_PLL_BASE_ADDRESS + REG_CPU_PLL_BYPASS_OFFSET)
+#define MAGPIE_REG_USB_DIVIDE_ADDR (CPU_PLL_BASE_ADDRESS + REG_USB_DIVIDE_OFFSET)
+#define MAGPIE_REG_ETH_PLL_ADDR (CPU_PLL_BASE_ADDRESS + REG_ETH_PLL_OFFSET)
+#define MAGPIE_REG_ETH_PLL_BYPASS_ADDR (CPU_PLL_BASE_ADDRESS + REG_ETH_PLL_BYPASS_OFFSET)
+#define MAGPIE_REG_ETH_TXRX_DIVIDE_ADDR (CPU_PLL_BASE_ADDRESS + REG_ETH_TXRX_DIVIDE_OFFSET)
+#define MAGPIE_REG_ETH_XTAL_DIVIDE_ADDR (CPU_PLL_BASE_ADDRESS + REG_ETH_XTAL_DIVIDE_OFFSET)
+#define MAGPIE_REG_PCIE_PLL_CONFIG_ADDR (CPU_PLL_BASE_ADDRESS + REG_PCIE_PLL_CONFIG_OFFSET)
+#define MAGPIE_REG_PCIE_DITHER_DIV_MAX_ADDR (CPU_PLL_BASE_ADDRESS + REG_PCIE_DITHER_DIV_MAX_OFFSET)
+#define MAGPIE_REG_PCIE_PLL_DITHER_DIV_MIN_ADDR (CPU_PLL_BASE_ADDRESS + REG_PCIE_PLL_DITHER_DIV_MIN_OFFSET)
+#define MAGPIE_REG_PCIE_PLL_DITHER_STEP_ADDR (CPU_PLL_BASE_ADDRESS + REG_PCIE_PLL_DITHER_STEP_OFFSET)
+#define MAGPIE_REG_CURRENT_PCIE_PLL_DITHER_ADDR (CPU_PLL_BASE_ADDRESS + REG_CURRENT_PCIE_PLL_DITHER_OFFSET)
+#define MAGPIE_REG_SUSPEND_ENABLE_ADDR (CPU_PLL_BASE_ADDRESS + REG_USB_SUSPEND_ENABLE_OFFSET)
+
+
+/*******************************************************************************/
+/* GPIO Register*/
+
+#define REG_GPIO_OE 0x0
+#define REG_GPIO_IN 0x4
+#define REG_GPIO_OUT 0x8
+#define REG_GPIO_SET 0xC
+#define REG_GPIO_CLEAR 0x10
+#define REG_GPIO_INT 0x14
+#define REG_GPIO_INT_TYPE 0x18
+#define REG_GPIO_INT_POLARITY 0x1C
+#define REG_GPIO_PENDING 0x20
+#define REG_GPIO_INT_MASK 0x24
+#define REG_GPIO_FUNCTION 0x28
+
+
+#define MAGPIE_REG_GPIO_OE (GPIO_BASE_ADDRESS + REG_GPIO_OE)
+#define MAGPIE_REG_GPIO_IN (GPIO_BASE_ADDRESS + REG_GPIO_IN)
+#define MAGPIE_REG_GPIO_OUT (GPIO_BASE_ADDRESS + REG_GPIO_OUT)
+#define MAGPIE_REG_GPIO_SET (GPIO_BASE_ADDRESS + REG_GPIO_SET)
+#define MAGPIE_REG_GPIO_CLEAR (GPIO_BASE_ADDRESS + REG_GPIO_CLEAR)
+#define MAGPIE_REG_GPIO_INT (GPIO_BASE_ADDRESS + REG_GPIO_INT)
+#define MAGPIE_REG_GPIO_INT_TYPE (GPIO_BASE_ADDRESS + REG_GPIO_INT_TYPE)
+#define MAGPIE_REG_GPIO_INT_POLARITY (GPIO_BASE_ADDRESS + REG_GPIO_INT_POLARITY)
+#define MAGPIE_REG_GPIO_PENDING (GPIO_BASE_ADDRESS + REG_GPIO_PENDING)
+#define MAGPIE_REG_GPIO_INT_MASK (GPIO_BASE_ADDRESS + REG_GPIO_INT_MASK)
+#define MAGPIE_REG_GPIO_FUNCTION (GPIO_BASE_ADDRESS + REG_GPIO_FUNCTION)
+
+
+/*******************************************************************************/
+/* SPI Flash Register*/
+#define MAGPEI_REG_SPI_BASE_ADDR SPI_REG_BASE_ADDRESS
+
+#define REG_SPI_CS_OFFSET 0x0
+#define REG_SPI_AO_OFFSET 0x4
+#define REG_SPI_D_OFFSET 0x8
+#define REG_SPI_CLKDIV_OFFSET 0x1C
+
+#define MAGPIE_REG_SPI_CS_ADDR (MAGPEI_REG_SPI_BASE_ADDR + REG_SPI_CS_OFFSET)
+#define MAGPIE_REG_SPI_AO_ADDR (MAGPEI_REG_SPI_BASE_ADDR + REG_SPI_AO_OFFSET)
+#define MAGPIE_REG_SPI_D_ADDR (MAGPEI_REG_SPI_BASE_ADDR + REG_SPI_D_OFFSET)
+#define MAGPIE_REG_SPI_CLKDIV_ADDR (MAGPEI_REG_SPI_BASE_ADDR + REG_SPI_CLKDIV_OFFSET)
+
+#endif
+
#define ATH_VER_MINOR_NUMBER "0"
#define ATH_VER_BUILD_NUMBER "3"
-#define ATH_VER_DATES __DATE__" "__TIME__
-
#define ATH_VERSION_STR "["ATH_VER_RELEASE_CODE "." \
ATH_VER_PLATFORM_NUMBER "." \
ATH_VER_MAJOR_NUMBER "." \
ATH_VER_MINOR_NUMBER "." \
- ATH_VER_BUILD_NUMBER "] " \
- ATH_VER_DATES
+ ATH_VER_BUILD_NUMBER "]"
/* ROM Code Version (16 bit)
* Bit 15 : 0 means ASIC, 1 means FPGA
/****************************** UART ******************************/
#define UART_INPUT_CLK SYSTEM_CLK
-#define UART_DEFAULT_BAUD 19200
+#define UART_DEFAULT_BAUD 19200
#define UART_RETRY_COUNT 10000
/****************************** USB *******************************/
#define WATCH_DOG_MAGIC_PATTERN_ADDR (SYS_D_RAM_REGION_0_BASE+SYS_RAM_SZIE-0x4) // 0x53fffc,magic pattern address
#define WATCH_DOG_RESET_COUNTER_ADDR (SYS_D_RAM_REGION_0_BASE+SYS_RAM_SZIE-0x8) // 0x53fff8,record the reset counter
#define DEBUG_SYSTEM_STATE_ADDR (SYS_D_RAM_REGION_0_BASE+SYS_RAM_SZIE-0xc) // 0x53fff4,record the state of system
-#define CURRENT_PROGRAM_ADDR (SYS_D_RAM_REGION_0_BASE+SYS_RAM_SZIE-0x10) // 0x53fff0,reserved
+#define CURRENT_PROGRAM_ADDR (SYS_D_RAM_REGION_0_BASE+SYS_RAM_SZIE-0x10) // 0x53fff0,reserved
#define WATCH_DOG_MAGIC_PATTERN (*((volatile u32_t*)(WATCH_DOG_MAGIC_PATTERN_ADDR)))
#define WATCH_DOG_RESET_COUNTER (*((volatile u32_t*)(WATCH_DOG_RESET_COUNTER_ADDR)))
#define _MEM_ADDRS_H_
#define SYS_ROM_BLOCK_SIZE (32*1024)
-#if MAGPIE_FPGA_RAM_256K == 1
+#if MAGPIE_FPGA_RAM_256K == 1
#define SYS_ROM_BLOCK_NUM 2 //ram 256K version is also rom 64k version
#else
#define SYS_ROM_BLOCK_NUM 3
#endif
#define SYS_ROM_SIZE (SYS_ROM_BLOCK_SIZE*SYS_ROM_BLOCK_NUM)
-
+
#if MAGPIE_FPGA_RAM_256K == 1
#define SYS_RAM_BLOCK_SIZE 64*1024
-#else
+#else
#define SYS_RAM_BLOCK_SIZE 40*1024
#endif
/* instruction port area */
#define SYS_I_R0M_REGION_0_BASE 0x8e0000
-
+
#define SYS_I_RAM_REGION_0_BASE 0x900000
#define SYS_I_RAM_REGION_1_BASE (SYS_I_RAM_REGION_0_BASE+SYS_RAM_BLOCK_SIZE)
#define SYS_I_RAM_REGION_2_BASE (SYS_I_RAM_REGION_1_BASE+SYS_RAM_BLOCK_SIZE)
#define SYS_I_RAM_REGION_3_BASE (SYS_I_RAM_REGION_2_BASE+SYS_RAM_BLOCK_SIZE)
-
-/* data port area */
+
+/* data port area */
#define SYS_D_R0M_REGION_0_BASE 0x4e0000
-
+
#define SYS_D_RAM_REGION_0_BASE 0x500000
#define SYS_D_RAM_REGION_1_BASE (SYS_D_RAM_REGION_0_BASE+SYS_RAM_BLOCK_SIZE)
#define SYS_D_RAM_REGION_2_BASE (SYS_D_RAM_REGION_1_BASE+SYS_RAM_BLOCK_SIZE)
#define USB_DEVICE_PID_SIZE 1 // PID SIZE, 1 halfword offset
#define USB_DEVICE_VID_SIZE 1 // VID SIZE, 1 halfword offset
-
+
#define USB_DESC_IN_EEPROM_FLAG_OFFSET USB_DESCRIPTOR_ADDR
#define USB_DEVICE_DESCRIPTOR_OFFSET (USB_DESC_IN_EEPROM_FLAG_OFFSET+USB_DESC_IN_EEPROM_SIZE)
#define USB_STRING00_DESCRIPTOR_OFFSET (USB_DEVICE_DESCRIPTOR_OFFSET+USB_DEVICE_DESCRIPTOR_SIZE)
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __MAGPIE_REGDUMP_H__
-#define __MAGPIE_REGDUMP_H__
-
-#if !defined(__ASSEMBLER__)
-/*
- * XTensa CPU state
- * This must match the state saved by the target exception handler.
- */
-struct XTensa_exception_frame_s {
- uint32_t xt_pc;
- uint32_t xt_ps;
- uint32_t xt_sar;
- uint32_t xt_vpri;
- uint32_t xt_a2;
- uint32_t xt_a3;
- uint32_t xt_a4;
- uint32_t xt_a5;
- uint32_t xt_exccause;
- uint32_t xt_lcount;
- uint32_t xt_lbeg;
- uint32_t xt_lend;
-
- /* Extra info to simplify post-mortem stack walkback */
-#define MAGPIE_REGDUMP_FRAMES 5
- struct {
- uint32_t a0; /* pc */
- uint32_t a1; /* sp */
- uint32_t a2;
- uint32_t a3;
- } wb[MAGPIE_REGDUMP_FRAMES];
-};
-
-typedef struct XTensa_exception_frame_s CPU_exception_frame_t;
-#define RD_SIZE sizeof(CPU_exception_frame_t)
-
-#endif
-#endif /* __MAGPIE_REGDUMP_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __MEM_API_H__
-#define __MEM_API_H__
-struct mem_api {
- void (* _mem_init)(void);
- void *(* _memset)(void *, int, unsigned int);
- void *(* _memcpy)(void *, const void *, unsigned int);
- void *(* _memmove)(void *, const void *, unsigned int);
- int (* _memcmp)(const void *, const void *, unsigned int);
-};
-#endif /* __MEM_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __MISC_API_H__
-#define __MISC_API_H__
-
-enum hostif_s{
- HIF_USB = 0,
- HIF_PCIE,
- HIF_GMAC,
- HIF_PCI,
-
- // HIF should be added above here
- HIF_NUM,
- HIF_NONE
-
-};
-
-typedef enum hostif_s A_HOSTIF;
-
-struct register_dump_s;
-
-struct misc_api {
- void (* _system_reset)(void);
- void (* _mac_reset)(void);
- void (* _assfail)(struct register_dump_s *);
- void (* _misaligned_load_handler)(struct register_dump_s *);
-
- void (* _report_failure_to_host)(struct register_dump_s *, int);
- int (* _target_id_get)(void);
- A_HOSTIF (* _is_host_present)(void);
-
- uint8_t (*_kbhit)(uint8_t);
-
- uint16_t (* _rom_version_get)(void);
-};
-#endif /* __MISC_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#define AH_SUPPORT_AR5416 1
-#define AH_SUPPORT_2133 1
-#define AH_SUPPORT_5413 1
-//#define AH_DEBUG 1
-//#define AR5416_EMULATION 1
-#define ATH_FORCE_PPM 1
-#define ATH_FORCE_BIAS 1
-#define AH_SUPPORT_DFS 1
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __PRINTF_API_H__
-#define __PRINTF_API_H__
-
-struct printf_api {
- void (* _printf_init)(void);
- int (* _printf)(const char * fmt, ...);
-};
-
-/* NB: The printf module requires the serial module. */
-void cmnos_printf_module_install(struct printf_api *tbl);
-int cmnos_printf(const char *fmt, ...);
-
-
-
-#endif /* __PRINTF_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __REGDUMP_H__
-#define __REGDUMP_H__
-
-#include "magpie_regdump.h"
-
-
-#if !defined(__ASSEMBLER__)
-
-/*
- * XTensa CPU state
- * This must match the state saved by the target exception handler.
- */
-
-#define RD_SIZE sizeof(CPU_exception_frame_t)
-
-/*
- * Target CPU state at the time of failure is reflected
- * in a register dump, which the Host can fetch through
- * the diagnostic window.
- */
-struct register_dump_s {
- uint32_t target_id; /* Target ID */
- uint32_t assline; /* Line number (if assertion failure) */
- uint32_t pc; /* Program Counter at time of exception */
- uint32_t badvaddr; /* Virtual address causing exception */
- CPU_exception_frame_t exc_frame; /* CPU-specific exception info */
-
- /* Could copy top of stack here, too.... */
-};
-
-
-#endif /* __ASSEMBLER__ */
-#endif /* __REGDUMP_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-/*************************************************************************/
-/* Copyright (c) 2008 Atheros Communications, Inc., All Rights Reserved */
-/* */
-/* Module Name : romp_api.h */
-/* */
-/* Abstract */
-/* This file contains definition of data structure and interface */
-/* */
-/* NOTES */
-/* None */
-/* */
-/*************************************************************************/
-
-#ifndef _ROMP_API_H_
-#define _ROMP_API_H_
-
-#include "dt_defs.h"
-
-/******** hardware API table structure (API descriptions below) *************/
-struct romp_api {
- void (*_romp_init)(void);
- BOOLEAN (*_romp_download)(uint16_t );
- BOOLEAN (*_romp_install)(void);
- BOOLEAN (*_romp_decode)(uint32_t );
-};
-
-#define _ROMP_MAGIC_ "[PaTcH]"
-
-struct rom_patch_st {
- uint16_t crc16; // crc filed to maintain the integrity
- uint16_t len; // length of the patch code
- uint32_t ld_addr; // load address of the patch code
- uint32_t fun_addr; // entry address of the patch code
- uint8_t *pfun; // patch code
-};
-
-
-struct eep_redir_addr {
- uint16_t offset;
- uint16_t size;
-};
-
-
-/************************* EXPORT function ***************************/
-uint16_t cal_crc16(uint32_t sz, uint8_t *p);
-
-#endif // end of _UART_API_H_
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __STRING_API_H__
-#define __STRING_API_H__
-struct string_api {
- void (* _string_init)(void);
- char *(* _strcpy)(char *, const char *);
- char *(* _strncpy)(char *, const char *, unsigned int);
- int (* _strlen)(const char *);
- int (* _strcmp)(const char *, const char *);
- int (* _strncmp)(const char *, const char *, unsigned int);
-};
-#endif /* __STRING_API_H__ */
-/*\r
- * Copyright (c) 2013 Qualcomm Atheros, Inc.\r
- * All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted (subject to the limitations in the\r
- * disclaimer below) provided that the following conditions are met:\r
- *\r
- * * Redistributions of source code must retain the above copyright\r
- * notice, this list of conditions and the following disclaimer.\r
- *\r
- * * Redistributions in binary form must reproduce the above copyright\r
- * notice, this list of conditions and the following disclaimer in the\r
- * documentation and/or other materials provided with the\r
- * distribution.\r
- *\r
- * * Neither the name of Qualcomm Atheros nor the names of its\r
- * contributors may be used to endorse or promote products derived\r
- * from this software without specific prior written permission.\r
- *\r
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE\r
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT\r
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED\r
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\r
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\r
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\r
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
- */\r
-/*************************************************************************/\r
-/* Copyright (c) 2006 Atheros Communications, Inc., All Rights Reserved */\r
-/* */\r
-/* Module Name : sys_cfg.h */\r
-/* */\r
-/* Abstract */\r
-/* This file contains definition of platform and sysmte config . */\r
-/* */\r
-/* NOTES */\r
-/* None */\r
-/* */\r
-/*************************************************************************/\r
-\r
-#ifndef _SYS_CFG_H_\r
-#define _SYS_CFG_H_\r
-\r
-/************************** FPGA version **************************/\r
-#define MAGPIE_FPGA_RAM_256K 1\r
-\r
-/************************** ROM DEFINE ***************************/\r
-\r
-#if defined(_ROM_)\r
-#include "rom_cfg.h"\r
-\r
-#if MAGPIE_FPGA_RAM_256K == 1 \r
-#undef MAX_BUF_NUM \r
-#define MAX_BUF_NUM 100\r
-#endif\r
-\r
-#elif defined(_RAM_)\r
-\r
-#include "rom_cfg.h"\r
-#include "magpie_mem.h"\r
-\r
-/************************* Resource DEFS ***********************/\r
-#define MAX_DESC_NUM 100\r
-\r
-#ifdef RX_SCATTER\r
-#define MAX_BUF_NUM 60\r
-#else\r
-#define MAX_BUF_NUM 40\r
-#endif\r
-\r
-#if MAGPIE_FPGA_RAM_256K == 1 \r
-#undef MAX_BUF_NUM \r
-#define MAX_BUF_NUM 100\r
-#endif\r
-\r
-#undef SYSTEM_MODULE_DBG\r
-#define SYSTEM_MODULE_DBG 1\r
-\r
-/************************* WLAN DEFS ***************************/\r
-#define MAGPIE_ENABLE_WLAN 1\r
-#define MAGPIE_ENABLE_PCIE 1\r
-#define MAGPIE_ENABLE_WLAN_IN_TARGET 0\r
-#define MAGPIE_ENABLE_WLAN_SELF_TX 0\r
-#define MAGPIE_ENABLE_WLAN_RATE_CTRL 1\r
-#define WLAN_MAX_RXBUF 15\r
-#define WLAN_MAX_TXBUF 10\r
-\r
-/****************************** WATCH DOG *******************************/\r
-#define WDT_DEFAULT_TIMEOUT_VALUE 3*ONE_MSEC*1000 // Initial value is 3 seconds, firmware changes it to 65 milliseconds\r
-\r
-#endif\r
-\r
-\r
-#endif /* _SYS_CFG_H_ */\r
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+/*************************************************************************/
+/* Copyright (c) 2006 Atheros Communications, Inc., All Rights Reserved */
+/* */
+/* Module Name : sys_cfg.h */
+/* */
+/* Abstract */
+/* This file contains definition of platform and sysmte config . */
+/* */
+/* NOTES */
+/* None */
+/* */
+/*************************************************************************/
+
+#ifndef _SYS_CFG_H_
+#define _SYS_CFG_H_
+
+/************************** FPGA version **************************/
+#define MAGPIE_FPGA_RAM_256K 1
+
+/************************** ROM DEFINE ***************************/
+
+#if defined(_ROM_)
+#include "rom_cfg.h"
+
+#if MAGPIE_FPGA_RAM_256K == 1
+#undef MAX_BUF_NUM
+#define MAX_BUF_NUM 100
+#endif
+
+#elif defined(_RAM_)
+
+#include "rom_cfg.h"
+#include "magpie_mem.h"
+
+/************************* Resource DEFS ***********************/
+#define MAX_DESC_NUM 100
+
+#ifdef RX_SCATTER
+#define MAX_BUF_NUM 60
+#else
+#define MAX_BUF_NUM 40
+#endif
+
+#if MAGPIE_FPGA_RAM_256K == 1
+#undef MAX_BUF_NUM
+#define MAX_BUF_NUM 100
+#endif
+
+#undef SYSTEM_MODULE_DBG
+#define SYSTEM_MODULE_DBG 1
+
+/************************* WLAN DEFS ***************************/
+#define MAGPIE_ENABLE_WLAN 1
+#define MAGPIE_ENABLE_PCIE 1
+#define MAGPIE_ENABLE_WLAN_IN_TARGET 0
+#define MAGPIE_ENABLE_WLAN_SELF_TX 0
+#define MAGPIE_ENABLE_WLAN_RATE_CTRL 1
+#define WLAN_MAX_RXBUF 15
+#define WLAN_MAX_TXBUF 10
+
+/****************************** WATCH DOG *******************************/
+#define WDT_DEFAULT_TIMEOUT_VALUE 3*ONE_MSEC*1000 // Initial value is 3 seconds, firmware changes it to 65 milliseconds
+
+#endif
+
+
+#endif /* _SYS_CFG_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __TASKLET_API_H__
-#define __TASKLET_API_H__
-
-//typedef int A_tasklet_t;
-
-typedef void (*A_TASKLET_FUNC)(void *arg);
-
-#define A_TASKLET_STATE_DISABLE 0
-#define A_TASKLET_STATE_SCHEDULED 1
-#define A_TASKLET_STATE_RUNNING 2
-
-struct _tasklet {
- A_TASKLET_FUNC func;
- void *arg;
- int state;
- struct _tasklet *next;
-};
-
-typedef struct _tasklet A_tasklet_t;
-
-struct tasklet_api {
- void (* _tasklet_init)(void);
- void (* _tasklet_init_task)(A_TASKLET_FUNC, void * arg, A_tasklet_t *);
- void (* _tasklet_disable)(A_tasklet_t *);
- void (* _tasklet_schedule)(A_tasklet_t *);
- void (* _tasklet_run)(void);
-};
-#endif /* __TASKLET_API_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __TIMER_API_H__
-#define __TIMER_API_H__
-/*
- * In order to remain completely independent of OS header files,
- * "_SPACE" structures are declared with sufficient room to hold
- * corresponding OS structures.
- */
-typedef unsigned int _A_TIMER_SPACE[5];
-typedef _A_TIMER_SPACE A_timer_t;
-#define A_TIMER A_timer_t /* historical */
-
-typedef unsigned int A_HANDLE; /* historical */
-typedef void A_TIMER_FUNC(A_HANDLE timer_handle, void *arg);
-
-struct timer_api {
- void (* _timer_init)(void);
- void (* _timer_arm)(A_timer_t *, unsigned int);
- void (* _timer_disarm)(A_timer_t *);
- void (* _timer_setfn)(A_timer_t *, A_TIMER_FUNC, void *);
- void (* _timer_run)(void);
-};
-#endif /* __TIMER_API_H__ */
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-/*************************************************************************/
-/* Copyright (c) 2006 Atheros Communications, Inc., All Rights Reserved */
-/* */
-/* Module Name : uart.h */
-/* */
-/* Abstract */
-/* This file contains definition of uart registers, marco and api. */
-/* */
-/* NOTES */
-/* None */
-/* */
-/*************************************************************************/
-
-#ifndef _UART_API_H_
-#define _UART_API_H_
-
-#include "reg_defs.h"
-
-/************************** Register deinition ***************************/
-#define RBR_ADDRESS 0x00051000
-#define RBR_OFFSET 0x00000000
-#define RBR_RBR_MSB 7
-#define RBR_RBR_LSB 0
-#define RBR_RBR_MASK 0x000000ff
-#define RBR_RBR_GET(x) (((x) & RBR_RBR_MASK) >> RBR_RBR_LSB)
-#define RBR_RBR_SET(x) (((x) << RBR_RBR_LSB) & RBR_RBR_MASK)
-
-#define THR_ADDRESS 0x00051000
-#define THR_OFFSET 0x00000000
-#define THR_THR_MSB 7
-#define THR_THR_LSB 0
-#define THR_THR_MASK 0x000000ff
-#define THR_THR_GET(x) (((x) & THR_THR_MASK) >> THR_THR_LSB)
-#define THR_THR_SET(x) (((x) << THR_THR_LSB) & THR_THR_MASK)
-
-#define DLL_ADDRESS 0x00051000
-#define DLL_OFFSET 0x00000000
-#define DLL_DLL_MSB 7
-#define DLL_DLL_LSB 0
-#define DLL_DLL_MASK 0x000000ff
-#define DLL_DLL_GET(x) (((x) & DLL_DLL_MASK) >> DLL_DLL_LSB)
-#define DLL_DLL_SET(x) (((x) << DLL_DLL_LSB) & DLL_DLL_MASK)
-
-#define DLH_ADDRESS 0x00051004
-#define DLH_OFFSET 0x00000004
-#define DLH_DLH_MSB 7
-#define DLH_DLH_LSB 0
-#define DLH_DLH_MASK 0x000000ff
-#define DLH_DLH_GET(x) (((x) & DLH_DLH_MASK) >> DLH_DLH_LSB)
-#define DLH_DLH_SET(x) (((x) << DLH_DLH_LSB) & DLH_DLH_MASK)
-
-#define IER_ADDRESS 0x00051004
-#define IER_OFFSET 0x00000004
-#define IER_EDDSI_MSB 3
-#define IER_EDDSI_LSB 3
-#define IER_EDDSI_MASK 0x00000008
-#define IER_EDDSI_GET(x) (((x) & IER_EDDSI_MASK) >> IER_EDDSI_LSB)
-#define IER_EDDSI_SET(x) (((x) << IER_EDDSI_LSB) & IER_EDDSI_MASK)
-#define IER_ELSI_MSB 2
-#define IER_ELSI_LSB 2
-#define IER_ELSI_MASK 0x00000004
-#define IER_ELSI_GET(x) (((x) & IER_ELSI_MASK) >> IER_ELSI_LSB)
-#define IER_ELSI_SET(x) (((x) << IER_ELSI_LSB) & IER_ELSI_MASK)
-#define IER_ETBEI_MSB 1
-#define IER_ETBEI_LSB 1
-#define IER_ETBEI_MASK 0x00000002
-#define IER_ETBEI_GET(x) (((x) & IER_ETBEI_MASK) >> IER_ETBEI_LSB)
-#define IER_ETBEI_SET(x) (((x) << IER_ETBEI_LSB) & IER_ETBEI_MASK)
-#define IER_ERBFI_MSB 0
-#define IER_ERBFI_LSB 0
-#define IER_ERBFI_MASK 0x00000001
-#define IER_ERBFI_GET(x) (((x) & IER_ERBFI_MASK) >> IER_ERBFI_LSB)
-#define IER_ERBFI_SET(x) (((x) << IER_ERBFI_LSB) & IER_ERBFI_MASK)
-
-#define IIR_ADDRESS 0x00051008
-#define IIR_OFFSET 0x00000008
-#define IIR_FIFO_STATUS_MSB 7
-#define IIR_FIFO_STATUS_LSB 6
-#define IIR_FIFO_STATUS_MASK 0x000000c0
-#define IIR_FIFO_STATUS_GET(x) (((x) & IIR_FIFO_STATUS_MASK) >> IIR_FIFO_STATUS_LSB)
-#define IIR_FIFO_STATUS_SET(x) (((x) << IIR_FIFO_STATUS_LSB) & IIR_FIFO_STATUS_MASK)
-#define IIR_IID_MSB 3
-#define IIR_IID_LSB 0
-#define IIR_IID_MASK 0x0000000f
-#define IIR_IID_GET(x) (((x) & IIR_IID_MASK) >> IIR_IID_LSB)
-#define IIR_IID_SET(x) (((x) << IIR_IID_LSB) & IIR_IID_MASK)
-
-#define FCR_ADDRESS 0x00051008
-#define FCR_OFFSET 0x00000008
-#define FCR_RCVR_TRIG_MSB 7
-#define FCR_RCVR_TRIG_LSB 6
-#define FCR_RCVR_TRIG_MASK 0x000000c0
-#define FCR_RCVR_TRIG_GET(x) (((x) & FCR_RCVR_TRIG_MASK) >> FCR_RCVR_TRIG_LSB)
-#define FCR_RCVR_TRIG_SET(x) (((x) << FCR_RCVR_TRIG_LSB) & FCR_RCVR_TRIG_MASK)
-#define FCR_DMA_MODE_MSB 3
-#define FCR_DMA_MODE_LSB 3
-#define FCR_DMA_MODE_MASK 0x00000008
-#define FCR_DMA_MODE_GET(x) (((x) & FCR_DMA_MODE_MASK) >> FCR_DMA_MODE_LSB)
-#define FCR_DMA_MODE_SET(x) (((x) << FCR_DMA_MODE_LSB) & FCR_DMA_MODE_MASK)
-#define FCR_XMIT_FIFO_RST_MSB 2
-#define FCR_XMIT_FIFO_RST_LSB 2
-#define FCR_XMIT_FIFO_RST_MASK 0x00000004
-#define FCR_XMIT_FIFO_RST_GET(x) (((x) & FCR_XMIT_FIFO_RST_MASK) >> FCR_XMIT_FIFO_RST_LSB)
-#define FCR_XMIT_FIFO_RST_SET(x) (((x) << FCR_XMIT_FIFO_RST_LSB) & FCR_XMIT_FIFO_RST_MASK)
-#define FCR_RCVR_FIFO_RST_MSB 1
-#define FCR_RCVR_FIFO_RST_LSB 1
-#define FCR_RCVR_FIFO_RST_MASK 0x00000002
-#define FCR_RCVR_FIFO_RST_GET(x) (((x) & FCR_RCVR_FIFO_RST_MASK) >> FCR_RCVR_FIFO_RST_LSB)
-#define FCR_RCVR_FIFO_RST_SET(x) (((x) << FCR_RCVR_FIFO_RST_LSB) & FCR_RCVR_FIFO_RST_MASK)
-#define FCR_FIFO_EN_MSB 0
-#define FCR_FIFO_EN_LSB 0
-#define FCR_FIFO_EN_MASK 0x00000001
-#define FCR_FIFO_EN_GET(x) (((x) & FCR_FIFO_EN_MASK) >> FCR_FIFO_EN_LSB)
-#define FCR_FIFO_EN_SET(x) (((x) << FCR_FIFO_EN_LSB) & FCR_FIFO_EN_MASK)
-
-#define LCR_ADDRESS 0x0005100c
-#define LCR_OFFSET 0x0000000c
-#define LCR_DLAB_MSB 7
-#define LCR_DLAB_LSB 7
-#define LCR_DLAB_MASK 0x00000080
-#define LCR_DLAB_GET(x) (((x) & LCR_DLAB_MASK) >> LCR_DLAB_LSB)
-#define LCR_DLAB_SET(x) (((x) << LCR_DLAB_LSB) & LCR_DLAB_MASK)
-#define LCR_BREAK_MSB 6
-#define LCR_BREAK_LSB 6
-#define LCR_BREAK_MASK 0x00000040
-#define LCR_BREAK_GET(x) (((x) & LCR_BREAK_MASK) >> LCR_BREAK_LSB)
-#define LCR_BREAK_SET(x) (((x) << LCR_BREAK_LSB) & LCR_BREAK_MASK)
-#define LCR_EPS_MSB 4
-#define LCR_EPS_LSB 4
-#define LCR_EPS_MASK 0x00000010
-#define LCR_EPS_GET(x) (((x) & LCR_EPS_MASK) >> LCR_EPS_LSB)
-#define LCR_EPS_SET(x) (((x) << LCR_EPS_LSB) & LCR_EPS_MASK)
-#define LCR_PEN_MSB 3
-#define LCR_PEN_LSB 3
-#define LCR_PEN_MASK 0x00000008
-#define LCR_PEN_GET(x) (((x) & LCR_PEN_MASK) >> LCR_PEN_LSB)
-#define LCR_PEN_SET(x) (((x) << LCR_PEN_LSB) & LCR_PEN_MASK)
-#define LCR_STOP_MSB 2
-#define LCR_STOP_LSB 2
-#define LCR_STOP_MASK 0x00000004
-#define LCR_STOP_GET(x) (((x) & LCR_STOP_MASK) >> LCR_STOP_LSB)
-#define LCR_STOP_SET(x) (((x) << LCR_STOP_LSB) & LCR_STOP_MASK)
-#define LCR_CLS_MSB 1
-#define LCR_CLS_LSB 0
-#define LCR_CLS_MASK 0x00000003
-#define LCR_CLS_GET(x) (((x) & LCR_CLS_MASK) >> LCR_CLS_LSB)
-#define LCR_CLS_SET(x) (((x) << LCR_CLS_LSB) & LCR_CLS_MASK)
-
-#define MCR_ADDRESS 0x00051010
-#define MCR_OFFSET 0x00000010
-#define MCR_LOOPBACK_MSB 5
-#define MCR_LOOPBACK_LSB 5
-#define MCR_LOOPBACK_MASK 0x00000020
-#define MCR_LOOPBACK_GET(x) (((x) & MCR_LOOPBACK_MASK) >> MCR_LOOPBACK_LSB)
-#define MCR_LOOPBACK_SET(x) (((x) << MCR_LOOPBACK_LSB) & MCR_LOOPBACK_MASK)
-#define MCR_OUT2_MSB 3
-#define MCR_OUT2_LSB 3
-#define MCR_OUT2_MASK 0x00000008
-#define MCR_OUT2_GET(x) (((x) & MCR_OUT2_MASK) >> MCR_OUT2_LSB)
-#define MCR_OUT2_SET(x) (((x) << MCR_OUT2_LSB) & MCR_OUT2_MASK)
-#define MCR_OUT1_MSB 2
-#define MCR_OUT1_LSB 2
-#define MCR_OUT1_MASK 0x00000004
-#define MCR_OUT1_GET(x) (((x) & MCR_OUT1_MASK) >> MCR_OUT1_LSB)
-#define MCR_OUT1_SET(x) (((x) << MCR_OUT1_LSB) & MCR_OUT1_MASK)
-#define MCR_RTS_MSB 1
-#define MCR_RTS_LSB 1
-#define MCR_RTS_MASK 0x00000002
-#define MCR_RTS_GET(x) (((x) & MCR_RTS_MASK) >> MCR_RTS_LSB)
-#define MCR_RTS_SET(x) (((x) << MCR_RTS_LSB) & MCR_RTS_MASK)
-#define MCR_DTR_MSB 0
-#define MCR_DTR_LSB 0
-#define MCR_DTR_MASK 0x00000001
-#define MCR_DTR_GET(x) (((x) & MCR_DTR_MASK) >> MCR_DTR_LSB)
-#define MCR_DTR_SET(x) (((x) << MCR_DTR_LSB) & MCR_DTR_MASK)
-
-#define LSR_ADDRESS 0x00051014
-#define LSR_OFFSET 0x00000014
-#define LSR_FERR_MSB 7
-#define LSR_FERR_LSB 7
-#define LSR_FERR_MASK 0x00000080
-#define LSR_FERR_GET(x) (((x) & LSR_FERR_MASK) >> LSR_FERR_LSB)
-#define LSR_FERR_SET(x) (((x) << LSR_FERR_LSB) & LSR_FERR_MASK)
-#define LSR_TEMT_MSB 6
-#define LSR_TEMT_LSB 6
-#define LSR_TEMT_MASK 0x00000040
-#define LSR_TEMT_GET(x) (((x) & LSR_TEMT_MASK) >> LSR_TEMT_LSB)
-#define LSR_TEMT_SET(x) (((x) << LSR_TEMT_LSB) & LSR_TEMT_MASK)
-#define LSR_THRE_MSB 5
-#define LSR_THRE_LSB 5
-#define LSR_THRE_MASK 0x00000020
-#define LSR_THRE_GET(x) (((x) & LSR_THRE_MASK) >> LSR_THRE_LSB)
-#define LSR_THRE_SET(x) (((x) << LSR_THRE_LSB) & LSR_THRE_MASK)
-#define LSR_BI_MSB 4
-#define LSR_BI_LSB 4
-#define LSR_BI_MASK 0x00000010
-#define LSR_BI_GET(x) (((x) & LSR_BI_MASK) >> LSR_BI_LSB)
-#define LSR_BI_SET(x) (((x) << LSR_BI_LSB) & LSR_BI_MASK)
-#define LSR_FE_MSB 3
-#define LSR_FE_LSB 3
-#define LSR_FE_MASK 0x00000008
-#define LSR_FE_GET(x) (((x) & LSR_FE_MASK) >> LSR_FE_LSB)
-#define LSR_FE_SET(x) (((x) << LSR_FE_LSB) & LSR_FE_MASK)
-#define LSR_PE_MSB 2
-#define LSR_PE_LSB 2
-#define LSR_PE_MASK 0x00000004
-#define LSR_PE_GET(x) (((x) & LSR_PE_MASK) >> LSR_PE_LSB)
-#define LSR_PE_SET(x) (((x) << LSR_PE_LSB) & LSR_PE_MASK)
-#define LSR_OE_MSB 1
-#define LSR_OE_LSB 1
-#define LSR_OE_MASK 0x00000002
-#define LSR_OE_GET(x) (((x) & LSR_OE_MASK) >> LSR_OE_LSB)
-#define LSR_OE_SET(x) (((x) << LSR_OE_LSB) & LSR_OE_MASK)
-#define LSR_DR_MSB 0
-#define LSR_DR_LSB 0
-#define LSR_DR_MASK 0x00000001
-#define LSR_DR_GET(x) (((x) & LSR_DR_MASK) >> LSR_DR_LSB)
-#define LSR_DR_SET(x) (((x) << LSR_DR_LSB) & LSR_DR_MASK)
-
-#define MSR_ADDRESS 0x00051018
-#define MSR_OFFSET 0x00000018
-#define MSR_DCD_MSB 7
-#define MSR_DCD_LSB 7
-#define MSR_DCD_MASK 0x00000080
-#define MSR_DCD_GET(x) (((x) & MSR_DCD_MASK) >> MSR_DCD_LSB)
-#define MSR_DCD_SET(x) (((x) << MSR_DCD_LSB) & MSR_DCD_MASK)
-#define MSR_RI_MSB 6
-#define MSR_RI_LSB 6
-#define MSR_RI_MASK 0x00000040
-#define MSR_RI_GET(x) (((x) & MSR_RI_MASK) >> MSR_RI_LSB)
-#define MSR_RI_SET(x) (((x) << MSR_RI_LSB) & MSR_RI_MASK)
-#define MSR_DSR_MSB 5
-#define MSR_DSR_LSB 5
-#define MSR_DSR_MASK 0x00000020
-#define MSR_DSR_GET(x) (((x) & MSR_DSR_MASK) >> MSR_DSR_LSB)
-#define MSR_DSR_SET(x) (((x) << MSR_DSR_LSB) & MSR_DSR_MASK)
-#define MSR_CTS_MSB 4
-#define MSR_CTS_LSB 4
-#define MSR_CTS_MASK 0x00000010
-#define MSR_CTS_GET(x) (((x) & MSR_CTS_MASK) >> MSR_CTS_LSB)
-#define MSR_CTS_SET(x) (((x) << MSR_CTS_LSB) & MSR_CTS_MASK)
-#define MSR_DDCD_MSB 3
-#define MSR_DDCD_LSB 3
-#define MSR_DDCD_MASK 0x00000008
-#define MSR_DDCD_GET(x) (((x) & MSR_DDCD_MASK) >> MSR_DDCD_LSB)
-#define MSR_DDCD_SET(x) (((x) << MSR_DDCD_LSB) & MSR_DDCD_MASK)
-#define MSR_TERI_MSB 2
-#define MSR_TERI_LSB 2
-#define MSR_TERI_MASK 0x00000004
-#define MSR_TERI_GET(x) (((x) & MSR_TERI_MASK) >> MSR_TERI_LSB)
-#define MSR_TERI_SET(x) (((x) << MSR_TERI_LSB) & MSR_TERI_MASK)
-#define MSR_DDSR_MSB 1
-#define MSR_DDSR_LSB 1
-#define MSR_DDSR_MASK 0x00000002
-#define MSR_DDSR_GET(x) (((x) & MSR_DDSR_MASK) >> MSR_DDSR_LSB)
-#define MSR_DDSR_SET(x) (((x) << MSR_DDSR_LSB) & MSR_DDSR_MASK)
-#define MSR_DCTS_MSB 0
-#define MSR_DCTS_LSB 0
-#define MSR_DCTS_MASK 0x00000001
-#define MSR_DCTS_GET(x) (((x) & MSR_DCTS_MASK) >> MSR_DCTS_LSB)
-#define MSR_DCTS_SET(x) (((x) << MSR_DCTS_LSB) & MSR_DCTS_MASK)
-
-
-/************************** config definition ***************************/
-#define UART_FIFO_SIZE 512 //Must be 2^N
-
-#define USE_POST_BUFFER 0 // ENABLE a tx buffer for post processing,
-/*********************** data struction definition ************************/
-// data struction definition
-struct uart_fifo {
-#if USE_POST_BUFFER
- uint8_t buf[UART_FIFO_SIZE];
-#endif
- uint16_t start_index;
- uint16_t end_index;
- uint32_t overrun_err;
-};
-
-
-struct uart_blk {
- uint16_t debug_mode;
- uint16_t baud;
- struct uart_api *_uart;
- struct uart_fifo _tx;
-};
-
-
-/******** hardware API table structure (API descriptions below) *************/
-struct uart_api {
- uint32_t (*_uart_init)(void);
- void (*_uart_char_put)(uint8_t ch);
- uint16_t (*_uart_char_get)(uint8_t* ch);
- void (*_uart_str_out)(uint8_t* str);
- void (*_uart_task)(void);
- uint32_t (*_uart_status)(void);\r
- void (*_uart_config)(uint16_t flag);
- void (*_uart_hwinit)(uint32_t freq, uint32_t baud);
- //void (*_uart_config)(uint8_t cmd, void *pData);
-};
-
-/************************* EXPORT function ***************************/
-
-
-#endif // end of _UART_API_H_
-
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef _USB_TABLE_H_
-#define _USB_TABLE_H_
-
-// UsbDeviceDescriptor
-#define USB_DEVICE_DESC_TYPE 0x01
-#define USB_DEVICE_DESC_LEN 0x12
-#define USB_SPEC_VERSION 0x0200
-#define USB_DEVICE_CLASS 0xFF
-#define USB_DEVICE_SUB_CLASS 0xFF
-#define USB_DEVICE_PROTOCOL 0xFF
-#define USB_MAX_PKT_SIZE 0x40
-#define USB_VENDOR_ID 0x0CF3
-#define USB_PRODUCT_ID 0x7010
-#define USB_DEVICE_BCD BOOTROM_VER
-#define USB_MANUFACTURER_INDEX 0x10
-#define USB_PRODUCT_INDEX 0x20
-#define USB_SERIAL_INDEX 0x30
-#define USB_CONFIGURATION_NUM 0x01
-// end UsbDeviceDescriptor
-
-#define USB_CONFIG_DESC_TYPE 0x02
-#define USB_CONFIG_DESC_LEN 0x09
-//#define USB_TOTAL_DESC_LEN 0x002E // 4 ep
-//#define USB_TOTAL_DESC_LEN 0x0035 // 5 ep
-#define USB_TOTAL_DESC_LEN 0x003C // 6 ep
-#define USB_INTERFACE_NUM 0x01
-#define USB_CONFIG_NUM 0x01
-#define USB_STRING_INDEX 0x00
-#define USB_ATTRIBUTE 0x80
-#define USB_MAX_POWER 0xFA
-
-#define USB_INTERFACE_DESC_TYPE 0x04
-#define USB_INTERFACE_DESC_LEN 0x09
-#define USB_INTERFACE_INDEX_NUM 0x00
-#define USB_INTERFACE_ALT_SETTING 0x00
-//#define USB_INTERFACE_EP_NUM 0x04
-//#define USB_INTERFACE_EP_NUM 0x05
-#define USB_INTERFACE_EP_NUM 0x06
-#define USB_INTERFACE_CLASS 0xFF
-#define USB_INTERFACE_SUB_CLASS 0x00
-#define USB_INTERFACE_PROTOCOL 0x00
-#define USB_INTERFACE_STRING_INDEX 0x00
-
-#define USB_EP_DESC_TYPE 0x05
-#define USB_EP_DESC_LEN 0x07
-
-/* USB Endpoint attribute */
-#define bUSB_EP1_NUM 0x01
-#define bUSB_EP2_NUM 0x02
-#define bUSB_EP3_NUM 0x03
-#define bUSB_EP4_NUM 0x04
-#define bUSB_EP5_NUM 0x05
-#define bUSB_EP6_NUM 0x06
-
-#define bUSB_EP_DIRECTION_IN 0x80
-#define bUSB_EP_DIRECTION_OUT 0x00
-
-#define bUSB_EP_TYPE_CONTROL 0x00
-#define bUSB_EP_TYPE_ISOCHRONOUS 0x01
-#define bUSB_EP_TYPE_BULK 0x02
-#define bUSB_EP_TYPE_INTERRUPT 0x03
-
-#define bUSB_EP_MAX_PKT_SIZE_64 0x0040
-#define bUSB_EP_MAX_PKT_SIZE_512 0x0200
-
-/* High Speed Endpoint */
-#define USB_HS_EP1_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP1_NUM)
-#define USB_HS_EP1_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_HS_EP1_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
-#define USB_HS_EP1_INTERVAL 0x00
-
-#define USB_HS_EP2_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP2_NUM)
-#define USB_HS_EP2_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_HS_EP2_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
-#define USB_HS_EP2_INTERVAL 0x00
-
-#define USB_HS_EP3_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP3_NUM)
-#define USB_HS_EP3_ATTRIBUTE bUSB_EP_TYPE_INTERRUPT
-#define USB_HS_EP3_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_HS_EP3_INTERVAL 0x01
-
-#define USB_HS_EP4_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP4_NUM)
-#define USB_HS_EP4_ATTRIBUTE bUSB_EP_TYPE_INTERRUPT //bUSB_EP_TYPE_BULK
-#define USB_HS_EP4_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_HS_EP4_INTERVAL 0x01 //0x00
-
-#define USB_HS_EP5_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP5_NUM)
-#define USB_HS_EP5_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_HS_EP5_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
-#define USB_HS_EP5_INTERVAL 0x00
-
-#define USB_HS_EP6_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP6_NUM)
-#define USB_HS_EP6_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_HS_EP6_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
-#define USB_HS_EP6_INTERVAL 0x00
-
-/* Full Speed Endpoint */
-#define USB_FS_EP1_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP1_NUM)
-#define USB_FS_EP1_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP1_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP1_INTERVAL 0x00
-
-#define USB_FS_EP2_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP2_NUM)
-#define USB_FS_EP2_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP2_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP2_INTERVAL 0x00
-
-#define USB_FS_EP3_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP3_NUM)
-#define USB_FS_EP3_ATTRIBUTE bUSB_EP_TYPE_INTERRUPT
-#define USB_FS_EP3_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP3_INTERVAL 0x01
-
-#define USB_FS_EP4_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP4_NUM)
-#define USB_FS_EP4_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP4_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP4_INTERVAL 0x00
-
-#define USB_FS_EP5_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP5_NUM)
-#define USB_FS_EP5_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP5_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP5_INTERVAL 0x00
-
-#define USB_FS_EP6_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP6_NUM)
-#define USB_FS_EP6_ATTRIBUTE bUSB_EP_TYPE_BULK
-#define USB_FS_EP6_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
-#define USB_FS_EP6_INTERVAL 0x00
-
-//#define USB_QUALIFIER_DESC_ADDR 0x8cff00
-//#define USB_OTHER_SPEED_DESC_ADDR 0x8cffA
-
-#endif // end of _USB_TABLE_H_
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-/*
- * @File: VBUF_api.h
- *
- * @Abstract: Host Interface api
- *
- * @Notes:
- */
-
-#ifndef _VBUF_API_H
-#define _VBUF_API_H
-
-#include <vdesc_api.h>
-
-#define MAX_BUF_CTX_LEN 20
-
-typedef struct _VBUF
-{
- VDESC *desc_list;
- struct _VBUF *next_buf;
- A_UINT16 buf_length;
- A_UINT8 reserved[2];
- A_UINT8 ctx[MAX_BUF_CTX_LEN];
- //A_UINT8 end_point;
- //A_UINT8 reserved[1];
-} VBUF;
-
-#define VBUF_GET_DATA_ADDR(vbuf) (vbuf->desc_list->buf_addr + vbuf->desc_list->data_offset)
-
-/* hardware API table structure (API descriptions below) */
-struct vbuf_api {
- void (*_init)(int nBuf);
- VBUF* (*_alloc_vbuf)(void);
- VBUF* (*_alloc_vbuf_with_size)(int size, int reserve);
- void (*_free_vbuf)(VBUF *buf);
-
- /* room to expand this table by another table */
- void *pReserved;
-};
-
-extern void vbuf_module_install(struct vbuf_api *apis);
-
-#endif /* #ifndef _HIF_API_H */
+++ /dev/null
-/*
- * @File: VBUF_api.h
- *
- * @Abstract: Host Interface api
- *
- * @Notes:
- *
- * Copyright (c) 2008 Atheros Communications Inc.
- * All rights reserved.
- *
- */
-
-#ifndef _VDESC_API_H
-#define _VDESC_API_H
-
-//#define VDESC_CONTROL_BUF_HDR (1 << 6) /* the buffer was manipulated and a header added */
-
-#define MAX_HW_DESC_SIZE 20
-
-typedef struct _VDESC
-{
- struct _VDESC *next_desc;
- A_UINT8 *buf_addr;
- A_UINT16 buf_size;
- A_UINT16 data_offset;
- A_UINT16 data_size;
- A_UINT16 control;
- A_UINT8 hw_desc_buf[MAX_HW_DESC_SIZE];
-} VDESC;
-
-//#define VDESC_HW_TO_VDESC(hwdesc) ((VDESC *)(((A_UINT32 *)hwdesc - 4)))
-#define VDESC_HW_TO_VDESC(hwdesc) ((VDESC *)(((A_UINT32 *)hwdesc - 4)))
-
-struct vdesc_api {
- void (*_init)(int nDesc);
- VDESC* (*_alloc_vdesc)();
- A_UINT8* (*_get_hw_desc)(VDESC *desc);
- void (*_swap_vdesc)(VDESC *dest, VDESC *src);
- //void (*_free_vdesc)(void);
- /* room to expand this table by another table */
- void *pReserved;
-};
-
-extern void vdesc_module_install(struct vdesc_api *apis);
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2013 Qualcomm Atheros, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted (subject to the limitations in the
- * disclaimer below) provided that the following conditions are met:
- *
- * * 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 name of Qualcomm Atheros nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
- * GRANTED BY THIS LICENSE. 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 OWNER 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.
- */
-#ifndef __WDT_API_H__
-#define __WDT_API_H__
-/*
- *
- */
-
-typedef enum {
- WDT_ACTION_NO = 0, // bit1, bit0: 00
- WDT_ACTION_INTR, // bit1, bit0: 01
- WDT_ACTION_NMI, // bit1, bit0: 10
- WDT_ACTION_RESET, // bit1, bit0: 11
-
- WDT_ACTION_UNKNOWN
-}T_WDT_ACTION_TYPE;
-
-
-typedef enum {
- WDT_TIMEOUT = 1,
- WDT_ACTION,
-
- WDT_UNKNOWN
-}T_WDT_CMD_TYPE;
-
-typedef struct {
- uint32_t cmd;
- union {
- uint32_t timeout;
- uint32_t action;
- };
-}T_WDT_CMD;
-
-
-typedef enum{
- ENUM_WDT_BOOT = 1,
- ENUM_COLD_BOOT,
- ENUM_SUSP_BOOT,
-
- // add above here
- ENUM_UNKNOWN_BOOT
-}T_BOOT_TYPE;
-
-
-/*!- interface of watchdog timer
- *
- */
-struct wdt_api {
- void (* _wdt_init)(void);
- void (* _wdt_enable)(void);
- void (* _wdt_disable)(void);
- void (* _wdt_set)(T_WDT_CMD);
- void (* _wdt_task)(void);
- void (* _wdt_reset)(void);
- T_BOOT_TYPE (*_wdt_last_boot)(void);
-};
-#endif /* __WDT_API_H__ */
-
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+#ifndef __MAGPIE_REGDUMP_H__
+#define __MAGPIE_REGDUMP_H__
+
+#if !defined(__ASSEMBLER__)
+/*
+ * XTensa CPU state
+ * This must match the state saved by the target exception handler.
+ */
+struct XTensa_exception_frame_s {
+ uint32_t xt_pc;
+ uint32_t xt_ps;
+ uint32_t xt_sar;
+ uint32_t xt_vpri;
+ uint32_t xt_a2;
+ uint32_t xt_a3;
+ uint32_t xt_a4;
+ uint32_t xt_a5;
+ uint32_t xt_exccause;
+ uint32_t xt_lcount;
+ uint32_t xt_lbeg;
+ uint32_t xt_lend;
+
+ /* Extra info to simplify post-mortem stack walkback */
+#define MAGPIE_REGDUMP_FRAMES 5
+ struct {
+ uint32_t a0; /* pc */
+ uint32_t a1; /* sp */
+ uint32_t a2;
+ uint32_t a3;
+ } wb[MAGPIE_REGDUMP_FRAMES];
+};
+
+typedef struct XTensa_exception_frame_s CPU_exception_frame_t;
+#define RD_SIZE sizeof(CPU_exception_frame_t)
+
+#endif
+#endif /* __MAGPIE_REGDUMP_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+#ifndef __MEM_API_H__
+#define __MEM_API_H__
+
+struct mem_api {
+ void (* _mem_init)(void);
+ void *(* _memset)(void *, int, unsigned int);
+ void *(* _memcpy)(void *, const void *, unsigned int);
+ void *(* _memmove)(void *, const void *, unsigned int);
+ int (* _memcmp)(const void *, const void *, unsigned int);
+};
+
+#endif /* __MEM_API_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+#ifndef __MISC_API_H__
+#define __MISC_API_H__
+
+enum hostif_s{
+ HIF_USB = 0,
+ HIF_PCIE,
+ HIF_GMAC,
+ HIF_PCI,
+
+ // HIF should be added above here
+ HIF_NUM,
+ HIF_NONE
+
+};
+
+typedef enum hostif_s A_HOSTIF;
+
+struct register_dump_s;
+
+struct misc_api {
+ void (* _system_reset)(void);
+ void (* _mac_reset)(void);
+ void (* _assfail)(struct register_dump_s *);
+ void (* _misaligned_load_handler)(struct register_dump_s *);
+
+ void (* _report_failure_to_host)(struct register_dump_s *, int);
+ int (* _target_id_get)(void);
+ A_HOSTIF (* _is_host_present)(void);
+
+ uint8_t (*_kbhit)(uint8_t);
+
+ uint16_t (* _rom_version_get)(void);
+};
+
+#endif /* __MISC_API_H__ */
/*
* Intentional Misaligned Load special "addresses".
- * Loads from misaligned addresses have special semantics,
+ * Loads from misaligned addresses have special semantics,
* handled by the OS, depending on the lower nibble.
*
* NOTE1: word-aligned nibbles will not cause any exception,
#endif
#ifdef HTC_TRACE_MBOX_PAUSE
-#define A_ASSERT( __bool )
+#define A_ASSERT( __bool )
#else
/*
* Code space dedicated to asserts is minimal. We use an Intentional
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+#ifndef __REGDUMP_H__
+#define __REGDUMP_H__
+
+#include "magpie_regdump.h"
+
+
+#if !defined(__ASSEMBLER__)
+
+/*
+ * XTensa CPU state
+ * This must match the state saved by the target exception handler.
+ */
+
+#define RD_SIZE sizeof(CPU_exception_frame_t)
+
+/*
+ * Target CPU state at the time of failure is reflected
+ * in a register dump, which the Host can fetch through
+ * the diagnostic window.
+ */
+struct register_dump_s {
+ uint32_t target_id; /* Target ID */
+ uint32_t assline; /* Line number (if assertion failure) */
+ uint32_t pc; /* Program Counter at time of exception */
+ uint32_t badvaddr; /* Virtual address causing exception */
+ CPU_exception_frame_t exc_frame; /* CPU-specific exception info */
+
+ /* Could copy top of stack here, too.... */
+};
+
+#endif /* __ASSEMBLER__ */
+#endif /* __REGDUMP_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+/*************************************************************************/
+/* Copyright (c) 2008 Atheros Communications, Inc., All Rights Reserved */
+/* */
+/* Module Name : romp_api.h */
+/* */
+/* Abstract */
+/* This file contains definition of data structure and interface */
+/* */
+/* NOTES */
+/* None */
+/* */
+/*************************************************************************/
+
+#ifndef _ROMP_API_H_
+#define _ROMP_API_H_
+
+#include "dt_defs.h"
+
+/******** hardware API table structure (API descriptions below) *************/
+
+struct romp_api {
+ void (*_romp_init)(void);
+ BOOLEAN (*_romp_download)(uint16_t );
+ BOOLEAN (*_romp_install)(void);
+ BOOLEAN (*_romp_decode)(uint32_t );
+};
+
+#define _ROMP_MAGIC_ "[PaTcH]"
+
+struct rom_patch_st {
+ uint16_t crc16; // crc filed to maintain the integrity
+ uint16_t len; // length of the patch code
+ uint32_t ld_addr; // load address of the patch code
+ uint32_t fun_addr; // entry address of the patch code
+ uint8_t *pfun; // patch code
+};
+
+
+struct eep_redir_addr {
+ uint16_t offset;
+ uint16_t size;
+};
+
+/************************* EXPORT function ***************************/
+uint16_t cal_crc16(uint32_t sz, uint8_t *p);
+
+#endif // end of _UART_API_H_
+
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+#ifndef __STRING_API_H__
+#define __STRING_API_H__
+
+struct string_api {
+ void (* _string_init)(void);
+ char *(* _strcpy)(char *, const char *);
+ char *(* _strncpy)(char *, const char *, unsigned int);
+ int (* _strlen)(const char *);
+ int (* _strcmp)(const char *, const char *);
+ int (* _strncmp)(const char *, const char *, unsigned int);
+};
+
+#endif /* __STRING_API_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+#ifndef __TASKLET_API_H__
+#define __TASKLET_API_H__
+
+typedef void (*A_TASKLET_FUNC)(void *arg);
+
+#define A_TASKLET_STATE_DISABLE 0
+#define A_TASKLET_STATE_SCHEDULED 1
+#define A_TASKLET_STATE_RUNNING 2
+
+struct _tasklet {
+ A_TASKLET_FUNC func;
+ void *arg;
+ int state;
+ struct _tasklet *next;
+};
+
+typedef struct _tasklet A_tasklet_t;
+
+struct tasklet_api {
+ void (* _tasklet_init)(void);
+ void (* _tasklet_init_task)(A_TASKLET_FUNC, void * arg, A_tasklet_t *);
+ void (* _tasklet_disable)(A_tasklet_t *);
+ void (* _tasklet_schedule)(A_tasklet_t *);
+ void (* _tasklet_run)(void);
+};
+#endif /* __TASKLET_API_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+#ifndef __TIMER_API_H__
+#define __TIMER_API_H__
+/*
+ * In order to remain completely independent of OS header files,
+ * "_SPACE" structures are declared with sufficient room to hold
+ * corresponding OS structures.
+ */
+typedef unsigned int _A_TIMER_SPACE[5];
+typedef _A_TIMER_SPACE A_timer_t;
+#define A_TIMER A_timer_t /* historical */
+
+typedef unsigned int A_HANDLE; /* historical */
+typedef void A_TIMER_FUNC(A_HANDLE timer_handle, void *arg);
+
+struct timer_api {
+ void (* _timer_init)(void);
+ void (* _timer_arm)(A_timer_t *, unsigned int);
+ void (* _timer_disarm)(A_timer_t *);
+ void (* _timer_setfn)(A_timer_t *, A_TIMER_FUNC, void *);
+ void (* _timer_run)(void);
+};
+#endif /* __TIMER_API_H__ */
+
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+/*************************************************************************/
+/* Copyright (c) 2006 Atheros Communications, Inc., All Rights Reserved */
+/* */
+/* Module Name : uart.h */
+/* */
+/* Abstract */
+/* This file contains definition of uart registers, marco and api. */
+/* */
+/* NOTES */
+/* None */
+/* */
+/*************************************************************************/
+
+#ifndef _UART_API_H_
+#define _UART_API_H_
+
+#include "reg_defs.h"
+
+/************************** Register deinition ***************************/
+#define RBR_ADDRESS 0x00051000
+#define RBR_OFFSET 0x00000000
+#define RBR_RBR_MSB 7
+#define RBR_RBR_LSB 0
+#define RBR_RBR_MASK 0x000000ff
+#define RBR_RBR_GET(x) (((x) & RBR_RBR_MASK) >> RBR_RBR_LSB)
+#define RBR_RBR_SET(x) (((x) << RBR_RBR_LSB) & RBR_RBR_MASK)
+
+#define THR_ADDRESS 0x00051000
+#define THR_OFFSET 0x00000000
+#define THR_THR_MSB 7
+#define THR_THR_LSB 0
+#define THR_THR_MASK 0x000000ff
+#define THR_THR_GET(x) (((x) & THR_THR_MASK) >> THR_THR_LSB)
+#define THR_THR_SET(x) (((x) << THR_THR_LSB) & THR_THR_MASK)
+
+#define DLL_ADDRESS 0x00051000
+#define DLL_OFFSET 0x00000000
+#define DLL_DLL_MSB 7
+#define DLL_DLL_LSB 0
+#define DLL_DLL_MASK 0x000000ff
+#define DLL_DLL_GET(x) (((x) & DLL_DLL_MASK) >> DLL_DLL_LSB)
+#define DLL_DLL_SET(x) (((x) << DLL_DLL_LSB) & DLL_DLL_MASK)
+
+#define DLH_ADDRESS 0x00051004
+#define DLH_OFFSET 0x00000004
+#define DLH_DLH_MSB 7
+#define DLH_DLH_LSB 0
+#define DLH_DLH_MASK 0x000000ff
+#define DLH_DLH_GET(x) (((x) & DLH_DLH_MASK) >> DLH_DLH_LSB)
+#define DLH_DLH_SET(x) (((x) << DLH_DLH_LSB) & DLH_DLH_MASK)
+
+#define IER_ADDRESS 0x00051004
+#define IER_OFFSET 0x00000004
+#define IER_EDDSI_MSB 3
+#define IER_EDDSI_LSB 3
+#define IER_EDDSI_MASK 0x00000008
+#define IER_EDDSI_GET(x) (((x) & IER_EDDSI_MASK) >> IER_EDDSI_LSB)
+#define IER_EDDSI_SET(x) (((x) << IER_EDDSI_LSB) & IER_EDDSI_MASK)
+#define IER_ELSI_MSB 2
+#define IER_ELSI_LSB 2
+#define IER_ELSI_MASK 0x00000004
+#define IER_ELSI_GET(x) (((x) & IER_ELSI_MASK) >> IER_ELSI_LSB)
+#define IER_ELSI_SET(x) (((x) << IER_ELSI_LSB) & IER_ELSI_MASK)
+#define IER_ETBEI_MSB 1
+#define IER_ETBEI_LSB 1
+#define IER_ETBEI_MASK 0x00000002
+#define IER_ETBEI_GET(x) (((x) & IER_ETBEI_MASK) >> IER_ETBEI_LSB)
+#define IER_ETBEI_SET(x) (((x) << IER_ETBEI_LSB) & IER_ETBEI_MASK)
+#define IER_ERBFI_MSB 0
+#define IER_ERBFI_LSB 0
+#define IER_ERBFI_MASK 0x00000001
+#define IER_ERBFI_GET(x) (((x) & IER_ERBFI_MASK) >> IER_ERBFI_LSB)
+#define IER_ERBFI_SET(x) (((x) << IER_ERBFI_LSB) & IER_ERBFI_MASK)
+
+#define IIR_ADDRESS 0x00051008
+#define IIR_OFFSET 0x00000008
+#define IIR_FIFO_STATUS_MSB 7
+#define IIR_FIFO_STATUS_LSB 6
+#define IIR_FIFO_STATUS_MASK 0x000000c0
+#define IIR_FIFO_STATUS_GET(x) (((x) & IIR_FIFO_STATUS_MASK) >> IIR_FIFO_STATUS_LSB)
+#define IIR_FIFO_STATUS_SET(x) (((x) << IIR_FIFO_STATUS_LSB) & IIR_FIFO_STATUS_MASK)
+#define IIR_IID_MSB 3
+#define IIR_IID_LSB 0
+#define IIR_IID_MASK 0x0000000f
+#define IIR_IID_GET(x) (((x) & IIR_IID_MASK) >> IIR_IID_LSB)
+#define IIR_IID_SET(x) (((x) << IIR_IID_LSB) & IIR_IID_MASK)
+
+#define FCR_ADDRESS 0x00051008
+#define FCR_OFFSET 0x00000008
+#define FCR_RCVR_TRIG_MSB 7
+#define FCR_RCVR_TRIG_LSB 6
+#define FCR_RCVR_TRIG_MASK 0x000000c0
+#define FCR_RCVR_TRIG_GET(x) (((x) & FCR_RCVR_TRIG_MASK) >> FCR_RCVR_TRIG_LSB)
+#define FCR_RCVR_TRIG_SET(x) (((x) << FCR_RCVR_TRIG_LSB) & FCR_RCVR_TRIG_MASK)
+#define FCR_DMA_MODE_MSB 3
+#define FCR_DMA_MODE_LSB 3
+#define FCR_DMA_MODE_MASK 0x00000008
+#define FCR_DMA_MODE_GET(x) (((x) & FCR_DMA_MODE_MASK) >> FCR_DMA_MODE_LSB)
+#define FCR_DMA_MODE_SET(x) (((x) << FCR_DMA_MODE_LSB) & FCR_DMA_MODE_MASK)
+#define FCR_XMIT_FIFO_RST_MSB 2
+#define FCR_XMIT_FIFO_RST_LSB 2
+#define FCR_XMIT_FIFO_RST_MASK 0x00000004
+#define FCR_XMIT_FIFO_RST_GET(x) (((x) & FCR_XMIT_FIFO_RST_MASK) >> FCR_XMIT_FIFO_RST_LSB)
+#define FCR_XMIT_FIFO_RST_SET(x) (((x) << FCR_XMIT_FIFO_RST_LSB) & FCR_XMIT_FIFO_RST_MASK)
+#define FCR_RCVR_FIFO_RST_MSB 1
+#define FCR_RCVR_FIFO_RST_LSB 1
+#define FCR_RCVR_FIFO_RST_MASK 0x00000002
+#define FCR_RCVR_FIFO_RST_GET(x) (((x) & FCR_RCVR_FIFO_RST_MASK) >> FCR_RCVR_FIFO_RST_LSB)
+#define FCR_RCVR_FIFO_RST_SET(x) (((x) << FCR_RCVR_FIFO_RST_LSB) & FCR_RCVR_FIFO_RST_MASK)
+#define FCR_FIFO_EN_MSB 0
+#define FCR_FIFO_EN_LSB 0
+#define FCR_FIFO_EN_MASK 0x00000001
+#define FCR_FIFO_EN_GET(x) (((x) & FCR_FIFO_EN_MASK) >> FCR_FIFO_EN_LSB)
+#define FCR_FIFO_EN_SET(x) (((x) << FCR_FIFO_EN_LSB) & FCR_FIFO_EN_MASK)
+
+#define LCR_ADDRESS 0x0005100c
+#define LCR_OFFSET 0x0000000c
+#define LCR_DLAB_MSB 7
+#define LCR_DLAB_LSB 7
+#define LCR_DLAB_MASK 0x00000080
+#define LCR_DLAB_GET(x) (((x) & LCR_DLAB_MASK) >> LCR_DLAB_LSB)
+#define LCR_DLAB_SET(x) (((x) << LCR_DLAB_LSB) & LCR_DLAB_MASK)
+#define LCR_BREAK_MSB 6
+#define LCR_BREAK_LSB 6
+#define LCR_BREAK_MASK 0x00000040
+#define LCR_BREAK_GET(x) (((x) & LCR_BREAK_MASK) >> LCR_BREAK_LSB)
+#define LCR_BREAK_SET(x) (((x) << LCR_BREAK_LSB) & LCR_BREAK_MASK)
+#define LCR_EPS_MSB 4
+#define LCR_EPS_LSB 4
+#define LCR_EPS_MASK 0x00000010
+#define LCR_EPS_GET(x) (((x) & LCR_EPS_MASK) >> LCR_EPS_LSB)
+#define LCR_EPS_SET(x) (((x) << LCR_EPS_LSB) & LCR_EPS_MASK)
+#define LCR_PEN_MSB 3
+#define LCR_PEN_LSB 3
+#define LCR_PEN_MASK 0x00000008
+#define LCR_PEN_GET(x) (((x) & LCR_PEN_MASK) >> LCR_PEN_LSB)
+#define LCR_PEN_SET(x) (((x) << LCR_PEN_LSB) & LCR_PEN_MASK)
+#define LCR_STOP_MSB 2
+#define LCR_STOP_LSB 2
+#define LCR_STOP_MASK 0x00000004
+#define LCR_STOP_GET(x) (((x) & LCR_STOP_MASK) >> LCR_STOP_LSB)
+#define LCR_STOP_SET(x) (((x) << LCR_STOP_LSB) & LCR_STOP_MASK)
+#define LCR_CLS_MSB 1
+#define LCR_CLS_LSB 0
+#define LCR_CLS_MASK 0x00000003
+#define LCR_CLS_GET(x) (((x) & LCR_CLS_MASK) >> LCR_CLS_LSB)
+#define LCR_CLS_SET(x) (((x) << LCR_CLS_LSB) & LCR_CLS_MASK)
+
+#define MCR_ADDRESS 0x00051010
+#define MCR_OFFSET 0x00000010
+#define MCR_LOOPBACK_MSB 5
+#define MCR_LOOPBACK_LSB 5
+#define MCR_LOOPBACK_MASK 0x00000020
+#define MCR_LOOPBACK_GET(x) (((x) & MCR_LOOPBACK_MASK) >> MCR_LOOPBACK_LSB)
+#define MCR_LOOPBACK_SET(x) (((x) << MCR_LOOPBACK_LSB) & MCR_LOOPBACK_MASK)
+#define MCR_OUT2_MSB 3
+#define MCR_OUT2_LSB 3
+#define MCR_OUT2_MASK 0x00000008
+#define MCR_OUT2_GET(x) (((x) & MCR_OUT2_MASK) >> MCR_OUT2_LSB)
+#define MCR_OUT2_SET(x) (((x) << MCR_OUT2_LSB) & MCR_OUT2_MASK)
+#define MCR_OUT1_MSB 2
+#define MCR_OUT1_LSB 2
+#define MCR_OUT1_MASK 0x00000004
+#define MCR_OUT1_GET(x) (((x) & MCR_OUT1_MASK) >> MCR_OUT1_LSB)
+#define MCR_OUT1_SET(x) (((x) << MCR_OUT1_LSB) & MCR_OUT1_MASK)
+#define MCR_RTS_MSB 1
+#define MCR_RTS_LSB 1
+#define MCR_RTS_MASK 0x00000002
+#define MCR_RTS_GET(x) (((x) & MCR_RTS_MASK) >> MCR_RTS_LSB)
+#define MCR_RTS_SET(x) (((x) << MCR_RTS_LSB) & MCR_RTS_MASK)
+#define MCR_DTR_MSB 0
+#define MCR_DTR_LSB 0
+#define MCR_DTR_MASK 0x00000001
+#define MCR_DTR_GET(x) (((x) & MCR_DTR_MASK) >> MCR_DTR_LSB)
+#define MCR_DTR_SET(x) (((x) << MCR_DTR_LSB) & MCR_DTR_MASK)
+
+#define LSR_ADDRESS 0x00051014
+#define LSR_OFFSET 0x00000014
+#define LSR_FERR_MSB 7
+#define LSR_FERR_LSB 7
+#define LSR_FERR_MASK 0x00000080
+#define LSR_FERR_GET(x) (((x) & LSR_FERR_MASK) >> LSR_FERR_LSB)
+#define LSR_FERR_SET(x) (((x) << LSR_FERR_LSB) & LSR_FERR_MASK)
+#define LSR_TEMT_MSB 6
+#define LSR_TEMT_LSB 6
+#define LSR_TEMT_MASK 0x00000040
+#define LSR_TEMT_GET(x) (((x) & LSR_TEMT_MASK) >> LSR_TEMT_LSB)
+#define LSR_TEMT_SET(x) (((x) << LSR_TEMT_LSB) & LSR_TEMT_MASK)
+#define LSR_THRE_MSB 5
+#define LSR_THRE_LSB 5
+#define LSR_THRE_MASK 0x00000020
+#define LSR_THRE_GET(x) (((x) & LSR_THRE_MASK) >> LSR_THRE_LSB)
+#define LSR_THRE_SET(x) (((x) << LSR_THRE_LSB) & LSR_THRE_MASK)
+#define LSR_BI_MSB 4
+#define LSR_BI_LSB 4
+#define LSR_BI_MASK 0x00000010
+#define LSR_BI_GET(x) (((x) & LSR_BI_MASK) >> LSR_BI_LSB)
+#define LSR_BI_SET(x) (((x) << LSR_BI_LSB) & LSR_BI_MASK)
+#define LSR_FE_MSB 3
+#define LSR_FE_LSB 3
+#define LSR_FE_MASK 0x00000008
+#define LSR_FE_GET(x) (((x) & LSR_FE_MASK) >> LSR_FE_LSB)
+#define LSR_FE_SET(x) (((x) << LSR_FE_LSB) & LSR_FE_MASK)
+#define LSR_PE_MSB 2
+#define LSR_PE_LSB 2
+#define LSR_PE_MASK 0x00000004
+#define LSR_PE_GET(x) (((x) & LSR_PE_MASK) >> LSR_PE_LSB)
+#define LSR_PE_SET(x) (((x) << LSR_PE_LSB) & LSR_PE_MASK)
+#define LSR_OE_MSB 1
+#define LSR_OE_LSB 1
+#define LSR_OE_MASK 0x00000002
+#define LSR_OE_GET(x) (((x) & LSR_OE_MASK) >> LSR_OE_LSB)
+#define LSR_OE_SET(x) (((x) << LSR_OE_LSB) & LSR_OE_MASK)
+#define LSR_DR_MSB 0
+#define LSR_DR_LSB 0
+#define LSR_DR_MASK 0x00000001
+#define LSR_DR_GET(x) (((x) & LSR_DR_MASK) >> LSR_DR_LSB)
+#define LSR_DR_SET(x) (((x) << LSR_DR_LSB) & LSR_DR_MASK)
+
+#define MSR_ADDRESS 0x00051018
+#define MSR_OFFSET 0x00000018
+#define MSR_DCD_MSB 7
+#define MSR_DCD_LSB 7
+#define MSR_DCD_MASK 0x00000080
+#define MSR_DCD_GET(x) (((x) & MSR_DCD_MASK) >> MSR_DCD_LSB)
+#define MSR_DCD_SET(x) (((x) << MSR_DCD_LSB) & MSR_DCD_MASK)
+#define MSR_RI_MSB 6
+#define MSR_RI_LSB 6
+#define MSR_RI_MASK 0x00000040
+#define MSR_RI_GET(x) (((x) & MSR_RI_MASK) >> MSR_RI_LSB)
+#define MSR_RI_SET(x) (((x) << MSR_RI_LSB) & MSR_RI_MASK)
+#define MSR_DSR_MSB 5
+#define MSR_DSR_LSB 5
+#define MSR_DSR_MASK 0x00000020
+#define MSR_DSR_GET(x) (((x) & MSR_DSR_MASK) >> MSR_DSR_LSB)
+#define MSR_DSR_SET(x) (((x) << MSR_DSR_LSB) & MSR_DSR_MASK)
+#define MSR_CTS_MSB 4
+#define MSR_CTS_LSB 4
+#define MSR_CTS_MASK 0x00000010
+#define MSR_CTS_GET(x) (((x) & MSR_CTS_MASK) >> MSR_CTS_LSB)
+#define MSR_CTS_SET(x) (((x) << MSR_CTS_LSB) & MSR_CTS_MASK)
+#define MSR_DDCD_MSB 3
+#define MSR_DDCD_LSB 3
+#define MSR_DDCD_MASK 0x00000008
+#define MSR_DDCD_GET(x) (((x) & MSR_DDCD_MASK) >> MSR_DDCD_LSB)
+#define MSR_DDCD_SET(x) (((x) << MSR_DDCD_LSB) & MSR_DDCD_MASK)
+#define MSR_TERI_MSB 2
+#define MSR_TERI_LSB 2
+#define MSR_TERI_MASK 0x00000004
+#define MSR_TERI_GET(x) (((x) & MSR_TERI_MASK) >> MSR_TERI_LSB)
+#define MSR_TERI_SET(x) (((x) << MSR_TERI_LSB) & MSR_TERI_MASK)
+#define MSR_DDSR_MSB 1
+#define MSR_DDSR_LSB 1
+#define MSR_DDSR_MASK 0x00000002
+#define MSR_DDSR_GET(x) (((x) & MSR_DDSR_MASK) >> MSR_DDSR_LSB)
+#define MSR_DDSR_SET(x) (((x) << MSR_DDSR_LSB) & MSR_DDSR_MASK)
+#define MSR_DCTS_MSB 0
+#define MSR_DCTS_LSB 0
+#define MSR_DCTS_MASK 0x00000001
+#define MSR_DCTS_GET(x) (((x) & MSR_DCTS_MASK) >> MSR_DCTS_LSB)
+#define MSR_DCTS_SET(x) (((x) << MSR_DCTS_LSB) & MSR_DCTS_MASK)
+
+
+/************************** config definition ***************************/
+#define UART_FIFO_SIZE 512 //Must be 2^N
+
+#define USE_POST_BUFFER 0 // ENABLE a tx buffer for post processing,
+/*********************** data struction definition ************************/
+// data struction definition
+struct uart_fifo {
+#if USE_POST_BUFFER
+ uint8_t buf[UART_FIFO_SIZE];
+#endif
+ uint16_t start_index;
+ uint16_t end_index;
+ uint32_t overrun_err;
+};
+
+
+struct uart_blk {
+ uint16_t debug_mode;
+ uint16_t baud;
+ struct uart_api *_uart;
+ struct uart_fifo _tx;
+};
+
+
+/******** hardware API table structure (API descriptions below) *************/
+struct uart_api {
+ uint32_t (*_uart_init)(void);
+ void (*_uart_char_put)(uint8_t ch);
+ uint16_t (*_uart_char_get)(uint8_t* ch);
+ void (*_uart_str_out)(uint8_t* str);
+ void (*_uart_task)(void);
+ uint32_t (*_uart_status)(void);
+ void (*_uart_config)(uint16_t flag);
+ void (*_uart_hwinit)(uint32_t freq, uint32_t baud);
+ //void (*_uart_config)(uint8_t cmd, void *pData);
+};
+
+/************************* EXPORT function ***************************/
+
+
+#endif // end of _UART_API_H_
+
// ep0 operation
void (*_usb_ep0_setup)(void);
-
+
void (*_usb_ep0_tx)(void);
void (*_usb_ep0_rx)(void);
BOOLEAN (*_usb_set_configuration)(void);
// standard/vendor command
- BOOLEAN (*_usb_standard_cmd)(void);
+ BOOLEAN (*_usb_standard_cmd)(void);
void (*_usb_vendor_cmd)(void);
void (*_usb_power_off)(void);
void (*_usb_reset_fifo)(void);
void (*_usb_gen_wdt)(void);
void (*_usb_jump_boot)(void);
-
+
BOOLEAN (*_usb_clr_feature)(void);
- BOOLEAN (*_usb_set_feature)(void);
+ BOOLEAN (*_usb_set_feature)(void);
BOOLEAN (*_usb_set_address)(void);
BOOLEAN (*_usb_get_descriptor)(void);
#define ZM_ADDR_CONV 0x0
#define ZM_CBUS_FIFO_SIZE_REG (ZM_CBUS_FIFO_SIZE_OFFSET^ZM_ADDR_CONV)
-
+
#define ZM_CBUS_CTRL_REG (cSOC_USB_OFST+cSOC_CBUS_CTL_OFFSET^ZM_ADDR_CONV)
#define ZM_MAIN_CTRL_REG (ZM_MAIN_CTRL_OFFSET^ZM_ADDR_CONV)
#define ZM_INTR_SOURCE_2_REG (ZM_INTR_SOURCE_2_OFFSET^ZM_ADDR_CONV)
#define ZM_INTR_SOURCE_3_REG (ZM_INTR_SOURCE_3_OFFSET^ZM_ADDR_CONV)
-
+
#define ZM_INTR_SOURCE_4_REG (ZM_INTR_SOURCE_4_OFFSET^ZM_ADDR_CONV)
#define ZM_INTR_SOURCE_5_REG (ZM_INTR_SOURCE_5_OFFSET^ZM_ADDR_CONV)
USB_BYTE_REG_READ(ZM_MAIN_CTRL_OFFSET)&~BIT0)
#define mUsbRmWkupSet() USB_BYTE_REG_WRITE(ZM_MAIN_CTRL_OFFSET, \
USB_BYTE_REG_READ(ZM_MAIN_CTRL_OFFSET)|BIT0)
-
+
#define mUsbGlobIntEnable() USB_BYTE_REG_WRITE(ZM_MAIN_CTRL_OFFSET, \
USB_BYTE_REG_READ(ZM_MAIN_CTRL_OFFSET)|BIT2)
#if (HS_C1_INTERFACE_NUMBER >= 1)
// Interface 0
#define HS_C1_I0_ALT_NUMBER 0X01
- #if (HS_C1_I0_ALT_NUMBER >= 1)
+ #if (HS_C1_I0_ALT_NUMBER >= 1)
// AlternateSetting 0X00
#define HS_C1_I0_A0_bInterfaceNumber 0X00
#define HS_C1_I0_A0_bAlternateSetting 0X00
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define USB_ENABLE_UP_DMA() USB_WORD_REG_WRITE(ZM_SOC_USB_MODE_CTRL_OFFSET, \
(USB_WORD_REG_READ(ZM_SOC_USB_MODE_CTRL_OFFSET)|BIT0)) // upstream DMA enable
-
+
#define USB_DISABLE_UP_DMA() USB_WORD_REG_WRITE(ZM_SOC_USB_MODE_CTRL_OFFSET, \
(USB_WORD_REG_READ(ZM_SOC_USB_MODE_CTRL_OFFSET)&(~BIT0))) // upstream DMA disable
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define USB_ENABLE_HP_DN_DMA() USB_WORD_REG_WRITE(ZM_SOC_USB_MODE_CTRL_OFFSET, \
- (USB_WORD_REG_READ(ZM_SOC_USB_MODE_CTRL_OFFSET)|BIT8)) // hp downstream DMA enable
+ (USB_WORD_REG_READ(ZM_SOC_USB_MODE_CTRL_OFFSET)|BIT8)) // hp downstream DMA enable
#define USB_DISABLE_HP_DN_DMA() USB_WORD_REG_WRITE(ZM_SOC_USB_MODE_CTRL_OFFSET, \
- (USB_WORD_REG_READ(ZM_SOC_USB_MODE_CTRL_OFFSET)&(~BIT8))) // hp downstream DMA disable
+ (USB_WORD_REG_READ(ZM_SOC_USB_MODE_CTRL_OFFSET)&(~BIT8))) // hp downstream DMA disable
#define USB_HP_DN_PACKET_MODE() USB_WORD_REG_WRITE(ZM_SOC_USB_MODE_CTRL_OFFSET, \
(USB_WORD_REG_READ(ZM_SOC_USB_MODE_CTRL_OFFSET)&(~BIT7))) // hpQ packet mode
(USB_WORD_REG_READ(ZM_SOC_USB_MODE_CTRL_OFFSET)|BIT7)) // hpQ stream mode
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#define USB_ENABLE_MP_DN_DMA() USB_WORD_REG_WRITE(ZM_SOC_USB_MODE_CTRL_OFFSET, (USB_WORD_REG_READ(ZM_SOC_USB_MODE_CTRL_OFFSET)|BIT9)) // mp downstream DMA enable
+#define USB_ENABLE_MP_DN_DMA() USB_WORD_REG_WRITE(ZM_SOC_USB_MODE_CTRL_OFFSET, (USB_WORD_REG_READ(ZM_SOC_USB_MODE_CTRL_OFFSET)|BIT9)) // mp downstream DMA enable
-#define USB_DISABLE_MP_DN_DMA() USB_WORD_REG_WRITE(ZM_SOC_USB_MODE_CTRL_OFFSET, (USB_WORD_REG_READ(ZM_SOC_USB_MODE_CTRL_OFFSET)&(~BIT9))) // mp downstream DMA disable
+#define USB_DISABLE_MP_DN_DMA() USB_WORD_REG_WRITE(ZM_SOC_USB_MODE_CTRL_OFFSET, (USB_WORD_REG_READ(ZM_SOC_USB_MODE_CTRL_OFFSET)&(~BIT9))) // mp downstream DMA disable
#define USB_MP_DN_PACKET_MODE() USB_WORD_REG_WRITE(ZM_SOC_USB_MODE_CTRL_OFFSET, (USB_WORD_REG_READ(ZM_SOC_USB_MODE_CTRL_OFFSET)&(~BIT10))) // hpQ packet mode
USB_ENABLE_HP_DN_DMA();
#define USB_STREAM_HOST_BUF_SIZE(size) USB_WORD_REG_WRITE(ZM_SOC_USB_MODE_CTRL_OFFSET, \
- (USB_WORD_REG_READ(ZM_SOC_USB_MODE_CTRL_OFFSET)|(size)));
+ (USB_WORD_REG_READ(ZM_SOC_USB_MODE_CTRL_OFFSET)|(size)));
#define USB_STREAM_TIMEOUT(time_cnt) USB_WORD_REG_WRITE(ZM_SOC_USB_TIME_CTRL_OFFSET, time_cnt); // set stream mode timeout critirea
#define USB_STREAM_AGG_PKT_CNT(cnt) USB_WORD_REG_WRITE(ZM_SOC_USB_MAX_AGGREGATE_OFFSET, cnt); // set stream mode packet buffer critirea
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+#ifndef _USB_TABLE_H_
+#define _USB_TABLE_H_
+
+#include "sys_cfg.h"
+// UsbDeviceDescriptor
+#define USB_DEVICE_DESC_TYPE 0x01
+#define USB_DEVICE_DESC_LEN 0x12
+#define USB_SPEC_VERSION 0x0200
+#define USB_DEVICE_CLASS 0xFF
+#define USB_DEVICE_SUB_CLASS 0xFF
+#define USB_DEVICE_PROTOCOL 0xFF
+#define USB_MAX_PKT_SIZE 0x40
+#define USB_VENDOR_ID 0x0CF3
+#define USB_PRODUCT_ID 0x9271
+
+#if 1 /* USB Device Descriptor : byte 12, 13 Device BCD -> Device release number in binary-coded decimal. */
+#define USB_DEVICE_BCD BOOTROM_VER
+#else
+#define USB_DEVICE_BCD 0x0106
+#endif
+
+#define USB_MANUFACTURER_INDEX 0x10
+#define USB_PRODUCT_INDEX 0x20
+#define USB_SERIAL_INDEX 0x30
+#define USB_CONFIGURATION_NUM 0x01
+// end UsbDeviceDescriptor
+
+#define USB_CONFIG_DESC_TYPE 0x02
+#define USB_CONFIG_DESC_LEN 0x09
+//#define USB_TOTAL_DESC_LEN 0x002E // 4 ep
+//#define USB_TOTAL_DESC_LEN 0x0035 // 5 ep
+#define USB_TOTAL_DESC_LEN 0x003C // 6 ep
+#define USB_INTERFACE_NUM 0x01
+#define USB_CONFIG_NUM 0x01
+#define USB_STRING_INDEX 0x00
+#define USB_ATTRIBUTE 0x80
+#define USB_MAX_POWER 0xFA
+
+#define USB_INTERFACE_DESC_TYPE 0x04
+#define USB_INTERFACE_DESC_LEN 0x09
+#define USB_INTERFACE_INDEX_NUM 0x00
+#define USB_INTERFACE_ALT_SETTING 0x00
+//#define USB_INTERFACE_EP_NUM 0x04
+//#define USB_INTERFACE_EP_NUM 0x05
+#define USB_INTERFACE_EP_NUM 0x06
+#define USB_INTERFACE_CLASS 0xFF
+#define USB_INTERFACE_SUB_CLASS 0x00
+#define USB_INTERFACE_PROTOCOL 0x00
+#define USB_INTERFACE_STRING_INDEX 0x00
+
+#define USB_EP_DESC_TYPE 0x05
+#define USB_EP_DESC_LEN 0x07
+
+/* USB Endpoint attribute */
+#define bUSB_EP1_NUM 0x01
+#define bUSB_EP2_NUM 0x02
+#define bUSB_EP3_NUM 0x03
+#define bUSB_EP4_NUM 0x04
+#define bUSB_EP5_NUM 0x05
+#define bUSB_EP6_NUM 0x06
+
+#define bUSB_EP_DIRECTION_IN 0x80
+#define bUSB_EP_DIRECTION_OUT 0x00
+
+#define bUSB_EP_TYPE_CONTROL 0x00
+#define bUSB_EP_TYPE_ISOCHRONOUS 0x01
+#define bUSB_EP_TYPE_BULK 0x02
+#define bUSB_EP_TYPE_INTERRUPT 0x03
+
+#define bUSB_EP_MAX_PKT_SIZE_64 0x0040
+#define bUSB_EP_MAX_PKT_SIZE_512 0x0200
+
+/* High Speed Endpoint */
+#define USB_HS_EP1_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP1_NUM)
+#define USB_HS_EP1_ATTRIBUTE bUSB_EP_TYPE_BULK
+#define USB_HS_EP1_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
+#define USB_HS_EP1_INTERVAL 0x00
+
+#define USB_HS_EP2_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP2_NUM)
+#define USB_HS_EP2_ATTRIBUTE bUSB_EP_TYPE_BULK
+#define USB_HS_EP2_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
+#define USB_HS_EP2_INTERVAL 0x00
+
+#define USB_HS_EP3_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP3_NUM)
+#define USB_HS_EP3_ATTRIBUTE bUSB_EP_TYPE_INTERRUPT
+#define USB_HS_EP3_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
+#define USB_HS_EP3_INTERVAL 0x01
+
+#define USB_HS_EP4_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP4_NUM)
+#define USB_HS_EP4_ATTRIBUTE bUSB_EP_TYPE_INTERRUPT //bUSB_EP_TYPE_BULK
+#define USB_HS_EP4_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
+#define USB_HS_EP4_INTERVAL 0x01 //0x00
+
+#define USB_HS_EP5_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP5_NUM)
+#define USB_HS_EP5_ATTRIBUTE bUSB_EP_TYPE_BULK
+#define USB_HS_EP5_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
+#define USB_HS_EP5_INTERVAL 0x00
+
+#define USB_HS_EP6_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP6_NUM)
+#define USB_HS_EP6_ATTRIBUTE bUSB_EP_TYPE_BULK
+#define USB_HS_EP6_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_512
+#define USB_HS_EP6_INTERVAL 0x00
+
+/* Full Speed Endpoint */
+#define USB_FS_EP1_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP1_NUM)
+#define USB_FS_EP1_ATTRIBUTE bUSB_EP_TYPE_BULK
+#define USB_FS_EP1_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
+#define USB_FS_EP1_INTERVAL 0x00
+
+#define USB_FS_EP2_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP2_NUM)
+#define USB_FS_EP2_ATTRIBUTE bUSB_EP_TYPE_BULK
+#define USB_FS_EP2_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
+#define USB_FS_EP2_INTERVAL 0x00
+
+#define USB_FS_EP3_ADDRESS (bUSB_EP_DIRECTION_IN | bUSB_EP3_NUM)
+#define USB_FS_EP3_ATTRIBUTE bUSB_EP_TYPE_INTERRUPT
+#define USB_FS_EP3_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
+#define USB_FS_EP3_INTERVAL 0x01
+
+#define USB_FS_EP4_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP4_NUM)
+#define USB_FS_EP4_ATTRIBUTE bUSB_EP_TYPE_BULK
+#define USB_FS_EP4_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
+#define USB_FS_EP4_INTERVAL 0x00
+
+#define USB_FS_EP5_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP5_NUM)
+#define USB_FS_EP5_ATTRIBUTE bUSB_EP_TYPE_BULK
+#define USB_FS_EP5_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
+#define USB_FS_EP5_INTERVAL 0x00
+
+#define USB_FS_EP6_ADDRESS (bUSB_EP_DIRECTION_OUT | bUSB_EP6_NUM)
+#define USB_FS_EP6_ATTRIBUTE bUSB_EP_TYPE_BULK
+#define USB_FS_EP6_MAX_PACKET_SIZE bUSB_EP_MAX_PKT_SIZE_64
+#define USB_FS_EP6_INTERVAL 0x00
+
+//#define USB_QUALIFIER_DESC_ADDR 0x8cff00
+//#define USB_OTHER_SPEED_DESC_ADDR 0x8cffA
+
+#endif // end of _USB_TABLE_H_
*/
/*
* @File: HIF_api.h
- *
+ *
* @Abstract: Host Interface api
- *
+ *
* @Notes:
*/
/* callback to get the buf for receiving commands from USB FIFO */
VBUF* (*get_command_buf)(void);
/* callback when receiving a command */
- void (*recv_command)(VBUF *cmd);
+ void (*recv_command)(VBUF *cmd);
/* callback to get the buf for event to send to the host */
VBUF* (*get_event_buf)(void);
/* callback to indicate the event has been sent to the host */
void (*send_event_done)(VBUF *buf);
-
+
/* context used for all callbacks */
//void *context;
} USB_FIFO_CONFIG;
void (*_enable_event_isr)(void);
/* room to expand this table by another table */
- void *pReserved;
+ void *pReserved;
};
extern void usbfifo_module_install(struct usbfifo_api *apis);
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+/*
+ * @File: VBUF_api.h
+ *
+ * @Abstract: Host Interface api
+ *
+ * @Notes:
+ */
+
+#ifndef _VBUF_API_H
+#define _VBUF_API_H
+
+#include <vdesc_api.h>
+
+#define MAX_BUF_CTX_LEN 20
+
+typedef struct _VBUF
+{
+ VDESC *desc_list;
+ struct _VBUF *next_buf;
+ A_UINT16 buf_length;
+ A_UINT8 reserved[2];
+ A_UINT8 ctx[MAX_BUF_CTX_LEN];
+} VBUF;
+
+#define VBUF_GET_DATA_ADDR(vbuf) (vbuf->desc_list->buf_addr + vbuf->desc_list->data_offset)
+
+/* hardware API table structure (API descriptions below) */
+struct vbuf_api {
+ void (*_init)(int nBuf);
+ VBUF* (*_alloc_vbuf)(void);
+ VBUF* (*_alloc_vbuf_with_size)(int size, int reserve);
+ void (*_free_vbuf)(VBUF *buf);
+
+ /* room to expand this table by another table */
+ void *pReserved;
+};
+
+extern void vbuf_module_install(struct vbuf_api *apis);
+
+#endif /* #ifndef _HIF_API_H */
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+/*
+ * @File: VBUF_api.h
+ *
+ * @Abstract: Host Interface api
+ *
+ * @Notes:
+ */
+
+#ifndef _VDESC_API_H
+#define _VDESC_API_H
+
+#define MAX_HW_DESC_SIZE 20
+
+typedef struct _VDESC
+{
+ struct _VDESC *next_desc;
+ A_UINT8 *buf_addr;
+ A_UINT16 buf_size;
+ A_UINT16 data_offset;
+ A_UINT16 data_size;
+ A_UINT16 control;
+ A_UINT8 hw_desc_buf[MAX_HW_DESC_SIZE];
+} VDESC;
+
+#define VDESC_HW_TO_VDESC(hwdesc) ((VDESC *)(((A_UINT32 *)hwdesc - 4)))
+
+struct vdesc_api {
+ void (*_init)(int nDesc);
+ VDESC* (*_alloc_vdesc)();
+ A_UINT8* (*_get_hw_desc)(VDESC *desc);
+ void (*_swap_vdesc)(VDESC *dest, VDESC *src);
+
+ /* room to expand this table by another table */
+ void *pReserved;
+};
+
+extern void vdesc_module_install(struct vdesc_api *apis);
+
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+#ifndef __WDT_API_H__
+#define __WDT_API_H__
+
+typedef enum {
+ WDT_ACTION_NO = 0, // bit1, bit0: 00
+ WDT_ACTION_INTR, // bit1, bit0: 01
+ WDT_ACTION_NMI, // bit1, bit0: 10
+ WDT_ACTION_RESET, // bit1, bit0: 11
+
+ WDT_ACTION_UNKNOWN
+} T_WDT_ACTION_TYPE;
+
+typedef enum {
+ WDT_TIMEOUT = 1,
+ WDT_ACTION,
+
+ WDT_UNKNOWN
+} T_WDT_CMD_TYPE;
+
+typedef struct {
+ uint32_t cmd;
+ union {
+ uint32_t timeout;
+ uint32_t action;
+ };
+}T_WDT_CMD;
+
+typedef enum {
+ ENUM_WDT_BOOT = 1,
+ ENUM_COLD_BOOT,
+ ENUM_SUSP_BOOT,
+
+ // add above here
+ ENUM_UNKNOWN_BOOT
+} T_BOOT_TYPE;
+
+
+/*!- interface of watchdog timer
+ *
+ */
+struct wdt_api {
+ void (* _wdt_init)(void);
+ void (* _wdt_enable)(void);
+ void (* _wdt_disable)(void);
+ void (* _wdt_set)(T_WDT_CMD);
+ void (* _wdt_task)(void);
+ void (* _wdt_reset)(void);
+ T_BOOT_TYPE (*_wdt_last_boot)(void);
+};
+#endif /* __WDT_API_H__ */
+
+/*
+ * Copyright (c) 2013 Tensilica Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
/*
* xtensa/config/core.h -- HAL definitions dependent on CORE configuration
*
* It is normal for the HAL library source itself to include this file.
*/
-/*
- * Copyright (c) 2005-2007 by Tensilica Inc. ALL RIGHTS RESERVED.
- * These coded instructions, statements, and computer programs are the
- * copyrighted works and confidential proprietary information of Tensilica Inc.
- * They may not be modified, copied, reproduced, distributed, or disclosed to
- * third parties in any manner, medium, or form, in whole or in part, without
- * the prior written consent of Tensilica Inc.
- */
-
-
#ifndef XTENSA_CONFIG_CORE_H
#define XTENSA_CONFIG_CORE_H
/*
- * xtensa/corebits.h - Xtensa Special Register field positions, masks, values.
+ * Copyright (c) 2013 Tensilica Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
*
- * (In previous releases, these were defined in specreg.h, a generated file.
- * This file is not generated, ie. it is processor configuration independent.)
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
-/* $Id: //depot/rel/BadgerPass/Xtensa/OS/include/xtensa/corebits.h#3 $ */
-
/*
- * Copyright (c) 2005-2007 by Tensilica Inc. ALL RIGHTS RESERVED.
- * These coded instructions, statements, and computer programs are the
- * copyrighted works and confidential proprietary information of Tensilica Inc.
- * They may not be modified, copied, reproduced, distributed, or disclosed to
- * third parties in any manner, medium, or form, in whole or in part, without
- * the prior written consent of Tensilica Inc.
+ * xtensa/corebits.h - Xtensa Special Register field positions, masks, values.
*/
#ifndef XTENSA_COREBITS_H
+/*
+ * Copyright (c) 2013 Tensilica Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
/*
xtensa/hal.h -- contains a definition of the Core HAL interface
Certain definitions, however, are release/version-specific -- such as
the XTHAL_RELEASE_xxx macros (or additions made in later versions).
-
-
- $Id: //depot/rel/BadgerPass/Xtensa/OS/target-os-src/hal.h.tpp#2 $
-
- Copyright (c) 1999-2007 by Tensilica Inc. ALL RIGHTS RESERVED.
- These coded instructions, statements, and computer programs are the
- copyrighted works and confidential proprietary information of Tensilica Inc.
- They may not be modified, copied, reproduced, distributed, or disclosed to
- third parties in any manner, medium, or form, in whole or in part, without
- the prior written consent of Tensilica Inc.
*/
#ifndef XTENSA_HAL_H
/*
- * xtruntime.h -- general C definitions for single-threaded run-time
+ * Copyright (c) 2013 Tensilica Inc.
*
- * Copyright (c) 2002-2006 by Tensilica Inc. ALL RIGHTS RESERVED.
- * These coded instructions, statements, and computer programs are the
- * copyrighted works and confidential proprietary information of Tensilica Inc.
- * They may not be modified, copied, reproduced, distributed, or disclosed to
- * third parties in any manner, medium, or form, in whole or in part, without
- * the prior written consent of Tensilica Inc.
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef XTRUNTIME_H
/*
- * xtensa/config/core-isa.h -- HAL definitions that are dependent on Xtensa
- * processor CORE configuration
+ * Copyright (c) 2013 Tensilica Inc.
*
- * See <xtensa/config/core.h>, which includes this file, for more details.
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
/*
- * Xtensa processor core configuration information.
+ * xtensa/config/core-isa.h -- HAL definitions that are dependent on Xtensa
+ * processor CORE configuration
*
- * Customer ID=4748; Build=0x2230f; Copyright (c) 1999-2008 by Tensilica Inc. ALL RIGHTS RESERVED.
- * These coded instructions, statements, and computer programs are the
- * copyrighted works and confidential proprietary information of Tensilica Inc.
- * They may not be modified, copied, reproduced, distributed, or disclosed to
- * third parties in any manner, medium, or form, in whole or in part, without
- * the prior written consent of Tensilica Inc.
+ * See <xtensa/config/core.h>, which includes this file, for more details.
*/
#ifndef _XTENSA_CORE_CONFIGURATION_H
+/*
+ * Copyright (c) 2013 Tensilica Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
/*
* xtensa/config/core-matmap.h -- Memory access and translation mapping
* parameters (CHAL) of the Xtensa processor core configuration.
* XCHAL_HW_VERSION_MINOR
*/
-/*
- * Customer ID=4748; Build=0x2230f; Copyright (c) 1999-2008 by Tensilica Inc. ALL RIGHTS RESERVED.
- * These coded instructions, statements, and computer programs are the
- * copyrighted works and confidential proprietary information of Tensilica Inc.
- * They may not be modified, copied, reproduced, distributed, or disclosed to
- * third parties in any manner, medium, or form, in whole or in part, without
- * the prior written consent of Tensilica Inc.
- */
-
#ifndef XTENSA_CONFIG_CORE_MATMAP_H
#define XTENSA_CONFIG_CORE_MATMAP_H
/*
- * Xtensa Special Register symbolic names
+ * Copyright (c) 2013 Tensilica Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-/* $Id: //depot/rel/BadgerPass/Xtensa/SWConfig/hal/specreg.h.tpp#1 $ */
-
/*
- * Customer ID=4748; Build=0x2230f; Copyright (c) 1998-2002 by Tensilica Inc. ALL RIGHTS RESERVED.
- * These coded instructions, statements, and computer programs are the
- * copyrighted works and confidential proprietary information of Tensilica Inc.
- * They may not be modified, copied, reproduced, distributed, or disclosed to
- * third parties in any manner, medium, or form, in whole or in part, without
- * the prior written consent of Tensilica Inc.
+ * Xtensa Special Register symbolic names
*/
#ifndef XTENSA_SPECREG_H
+/*
+ * Copyright (c) 2013 Tensilica Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
/*
* tie.h -- compile-time HAL definitions dependent on CORE & TIE configuration
*
* This header file describes this specific Xtensa processor's TIE extensions
* that extend basic Xtensa core functionality. It is customized to this
* Xtensa processor configuration.
- *
- * Customer ID=4748; Build=0x2230f; Copyright (C) 1999-2008 by Tensilica Inc. ALL RIGHTS RESERVED.
- * These coded instructions, statements, and computer programs are the
- * copyrighted works and confidential proprietary information of Tensilica Inc.
- * They may not be modified, copied, reproduced, distributed, or disclosed to
- * third parties in any manner, medium, or form, in whole or in part, without
- * the prior written consent of Tensilica Inc.
*/
#ifndef _XTENSA_CORE_TIE_H
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
+#include <wlan_pci.h>
+#include <Magpie_api.h>
+#include <rom.h>
+
#include "dt_defs.h"
#include "athos_api.h"
#include "adf_os_io.h"
#include "init.h"
-#include <linux/compiler.h>
+#include "app_start.h"
// @TODO: Should define the memory region later~
#define ALLOCRAM_START ( ((unsigned int)&_fw_image_end) + 4)
--- /dev/null
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * Copyright (c) 2016 Oleksij Rempel <linux@rempel-privat.de>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+#ifndef _ATH_APP_START_H_
+#define _ATH_APP_START_H_
+
+#define __noreturn __attribute__((noreturn))
+#define __section(s) __attribute__((section("." # s)))
+#define __visible __attribute__((externally_visible))
+
+void __section(boot) __noreturn __visible app_start(void);
+void Magpie_init(void);
+
+#endif /* _ATH_APP_START_H_ */
*/
#if defined(_RAM_)
+#include <wlan_pci.h>
+#include <rom.h>
+
#include "athos_api.h"
#include "usb_defs.h"
int (* save_cmnos_printf)(const char * fmt, ...);
#endif
-#define ATH_DATE_STRING __DATE__" "__TIME__
-
static void idle_task();
#if defined(PROJECT_MAGPIE)
A_DELAY_USECS(60); // wait for stable
- /* CPU & AHB settings */
+ /* CPU & AHB settings */
/*
* AHB clk = ( CPU clk / 2 )
*/
iowrite32_usb(ZM_EP3_DATA_OFFSET, exccause);
iowrite32_usb(ZM_EP3_DATA_OFFSET, pc);
iowrite32_usb(ZM_EP3_DATA_OFFSET, badvaddr);
-
+
mUSB_EP3_XFER_DONE();
}
#endif
A_ASSFAIL(&dump);
-#if defined(_ROM_)
+#if defined(_ROM_)
A_WDT_ENABLE();
#endif
while(1) ;
}
-void
+void
HTCControlSvcProcessMsg_patch(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t hdr_buf,
adf_nbuf_t pBuffers, void *arg)
{
}
/* Patch callback for check the endpoint ID is correct or not */
-void
+void
HTCMsgRecvHandler_patch(adf_nbuf_t hdr_buf, adf_nbuf_t buffer, void *context)
{
int eid;
a_uint32_t anblen;
adf_nbuf_t tmp_nbuf;
HTC_FRAME_HDR *pHTCHdr;
-
+
if (hdr_buf == ADF_NBUF_NULL) {
/* HTC hdr is not in the hdr_buf */
tmp_nbuf = buffer;
} else {
tmp_nbuf = hdr_buf;
}
-
- adf_nbuf_peek_header(tmp_nbuf, &anbdata, &anblen);
- pHTCHdr = (HTC_FRAME_HDR *)anbdata;
-
+
+ adf_nbuf_peek_header(tmp_nbuf, &anbdata, &anblen);
+ pHTCHdr = (HTC_FRAME_HDR *)anbdata;
+
eid = pHTCHdr->EndpointID;
-
+
if ((eid != 0) && (htc_complete_setup == 0)) {
A_PRINTF("\nHTC Hdr EndpointID = %d, anblen = %d\n", pHTCHdr->EndpointID, anblen);
A_PRINTF("HTC Hder : %2x-%2x-%2x-%2x-%2x-%2x-%2x-%2x-%2x-%2x-%2x-%2x\n",
- *anbdata, *(anbdata+1), *(anbdata+2), *(anbdata+3),
+ *anbdata, *(anbdata+1), *(anbdata+2), *(anbdata+3),
*(anbdata+4), *(anbdata+5), *(anbdata+6), *(anbdata+7),
- *(anbdata+8), *(anbdata+9), *(anbdata+10), *(anbdata+11));
+ *(anbdata+8), *(anbdata+9), *(anbdata+10), *(anbdata+11));
A_PRINTF("init_htc_handle = 0x%8x\n", init_htc_handle);
-
+
if (pHTCHdr->EndpointID == 1) {
A_PRINTF("Return WMI Command buffer\n");
HTC_ReturnBuffers(init_htc_handle, 1, tmp_nbuf);
} else {
if ((pHTCHdr->EndpointID < 0) || (pHTCHdr->EndpointID >= ENDPOINT_MAX)) {
A_PRINTF("HTC Hdr EndpointID = %d, anblen = %d\n", pHTCHdr->EndpointID, anblen);
- A_PRINTF("HTC Hder : %2x-%2x-%2x-%2x-%2x-%2x-%2x-%2x\n",
- *anbdata, *(anbdata+1), *(anbdata+2), *(anbdata+3),
+ A_PRINTF("HTC Hder : %2x-%2x-%2x-%2x-%2x-%2x-%2x-%2x\n",
+ *anbdata, *(anbdata+1), *(anbdata+2), *(anbdata+3),
*(anbdata+4), *(anbdata+5), *(anbdata+6), *(anbdata+7));
if (anblen > 64) {
#define ALLOCRAM_START ( ((unsigned int)&_fw_image_end) + 4)
#define ALLOCRAM_SIZE ( SYS_RAM_SZIE - ( ALLOCRAM_START - SYS_D_RAM_REGION_0_BASE) - SYS_D_RAM_STACK_SIZE)
+#include "app_start.h"
#include "regdump.h"
-#include <linux/compiler.h>
#define SBOOT_PATTERN 0x5342
#define IS_FLASHBOOT() (((DEBUG_SYSTEM_STATE&~(0x0000ffff))>>16==SBOOT_PATTERN))
#endif
+#if defined(PROJECT_MAGPIE)
+void change_magpie_clk(void);
+#endif
void fatal_exception_func();
void init_mem();
void __noreturn wlan_task();
+void reset_EP4_FIFO(void);
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "sys_cfg.h"
+#include "app_start.h"
#if defined(_RAM_)
A_UINT8 *pData;
netbuf = WMI_AllocEvent(pContext, WMI_EVT_CLASS_CMD_REPLY, sizeof(WMI_CMD_HDR) + Length);
-
+
if (netbuf == ADF_NBUF_NULL) {
adf_os_print("%s: buffer allocation for event_id %x failed!\n", __FUNCTION__, cmd_id);
adf_os_assert(0);
void Magpie_init(void)
{
A_PRINTF("[+++Magpie_init]\n\r");
-
+
A_PRINTF("[+++VBUF_init(%d)]\n\r", MAX_BUF_NUM);
VBUF_init(MAX_BUF_NUM);
-
+
A_PRINTF("[+++VBUF_init(%d)]\n\r", MAX_DESC_NUM);
VDESC_init(MAX_DESC_NUM);
#if SYSTEM_MODULE_HP_EP6
HIF_config_pipe(hif_handle, HIF_USB_PIPE_MP_TX, 3);
#endif
-
+
A_PRINTF("[+++HIF_init(0)]\n\r");
HIF_start(hif_handle);
WMI_RegisterDispatchTable(Magpie_Sys_Commands_Tbl.pContext, &Magpie_Sys_Commands_Tbl);
#endif/* ZM_FM_LOOPBACK == 0 */
-#endif /* MAGPIE_ENABLE_WLAN */
+#endif /* MAGPIE_ENABLE_WLAN */
}
#endif /* #if MAGPIE==1 */
-/*\r
- * Copyright (c) 2013 Qualcomm Atheros, Inc.\r
- * All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted (subject to the limitations in the\r
- * disclaimer below) provided that the following conditions are met:\r
- *\r
- * * Redistributions of source code must retain the above copyright\r
- * notice, this list of conditions and the following disclaimer.\r
- *\r
- * * Redistributions in binary form must reproduce the above copyright\r
- * notice, this list of conditions and the following disclaimer in the\r
- * documentation and/or other materials provided with the\r
- * distribution.\r
- *\r
- * * Neither the name of Qualcomm Atheros nor the names of its\r
- * contributors may be used to endorse or promote products derived\r
- * from this software without specific prior written permission.\r
- *\r
- * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE\r
- * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT\r
- * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED\r
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\r
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\r
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\r
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
- */\r
-#include "sys_cfg.h"\r
-#include "dt_defs.h"\r
-#include "reg_defs.h"\r
-\r
-#include <osapi.h>\r
-#include <hif_api.h>\r
-#include <Magpie_api.h>\r
-#include <vdesc_api.h>\r
-#include <adf_os_mem.h> \r
-#include <adf_os_io.h>\r
-\r
-#include "hif_usb.h"\r
-\r
-/*\r
- * -- support more than 64 bytes command on ep4 -- \r
- */\r
-int _HIFusb_get_max_msg_len_patch(hif_handle_t handle, int pipe)\r
-{\r
- switch(pipe) {\r
- case HIF_USB_PIPE_INTERRUPT:\r
- case HIF_USB_PIPE_COMMAND:\r
- return 512;\r
- \r
- default:\r
- return 1600;\r
- }\r
-}\r
-\r
-/*\r
- * -- move the usb_task to here --\r
- */\r
-void _HIFusb_isr_handler_patch(hif_handle_t h)\r
-{\r
- A_USB_FW_TASK();\r
-\r
- _HIFusb_isr_handler();\r
-}\r
-\r
-\r
-/*\r
- * -- reset usb dma --\r
- *\r
- * - make sure DMA_START bit0 is zero\r
- * - update DMA_START bit4 to 1\r
- * - update DESC_START_ADDR\r
- * - update DMA_START bit 0\r
- */\r
-void _HIFusb_start_patch(hif_handle_t handle) \r
-{\r
- MAGPIE_REG_USB_TX0_DMA_START = 0x0;\r
- MAGPIE_REG_USB_RX0_DMA_START = 0x0;\r
- MAGPIE_REG_USB_RX1_DMA_START = 0x0;\r
- MAGPIE_REG_USB_RX2_DMA_START = 0x0;\r
- \r
- while( 1 )\r
- {\r
- if(!MAGPIE_REG_USB_TX0_DMA_START &&\r
- !MAGPIE_REG_USB_RX0_DMA_START &&\r
- !MAGPIE_REG_USB_RX1_DMA_START &&\r
- !MAGPIE_REG_USB_RX2_DMA_START )\r
- {\r
- MAGPIE_REG_USB_TX0_DMA_START = MAGPIE_REG_USB_TX0_DMA_START|BIT4; \r
- MAGPIE_REG_USB_RX0_DMA_START = MAGPIE_REG_USB_RX0_DMA_START|BIT4;\r
- MAGPIE_REG_USB_RX1_DMA_START = MAGPIE_REG_USB_RX1_DMA_START|BIT4;\r
- MAGPIE_REG_USB_RX2_DMA_START = MAGPIE_REG_USB_RX2_DMA_START|BIT4;\r
- break;\r
- }\r
- }\r
- _HIFusb_start();\r
-}\r
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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 "sys_cfg.h"
+#include "dt_defs.h"
+#include "reg_defs.h"
+
+#include <rom.h>
+#include <osapi.h>
+#include <hif_api.h>
+#include <Magpie_api.h>
+#include <vdesc_api.h>
+#include <adf_os_mem.h>
+#include <adf_os_io.h>
+
+#include "hif_usb.h"
+
+/*
+ * -- support more than 64 bytes command on ep4 --
+ */
+int _HIFusb_get_max_msg_len_patch(hif_handle_t handle, int pipe)
+{
+ switch(pipe) {
+ case HIF_USB_PIPE_INTERRUPT:
+ case HIF_USB_PIPE_COMMAND:
+ return 512;
+
+ default:
+ return 1600;
+ }
+}
+
+/*
+ * -- move the usb_task to here --
+ */
+void _HIFusb_isr_handler_patch(hif_handle_t h)
+{
+ A_USB_FW_TASK();
+
+ _HIFusb_isr_handler(h);
+}
+
+
+/*
+ * -- reset usb dma --
+ *
+ * - make sure DMA_START bit0 is zero
+ * - update DMA_START bit4 to 1
+ * - update DESC_START_ADDR
+ * - update DMA_START bit 0
+ */
+void _HIFusb_start_patch(hif_handle_t handle)
+{
+ MAGPIE_REG_USB_TX0_DMA_START = 0x0;
+ MAGPIE_REG_USB_RX0_DMA_START = 0x0;
+ MAGPIE_REG_USB_RX1_DMA_START = 0x0;
+ MAGPIE_REG_USB_RX2_DMA_START = 0x0;
+
+ while( 1 )
+ {
+ if(!MAGPIE_REG_USB_TX0_DMA_START &&
+ !MAGPIE_REG_USB_RX0_DMA_START &&
+ !MAGPIE_REG_USB_RX1_DMA_START &&
+ !MAGPIE_REG_USB_RX2_DMA_START )
+ {
+ MAGPIE_REG_USB_TX0_DMA_START = MAGPIE_REG_USB_TX0_DMA_START|BIT4;
+ MAGPIE_REG_USB_RX0_DMA_START = MAGPIE_REG_USB_RX0_DMA_START|BIT4;
+ MAGPIE_REG_USB_RX1_DMA_START = MAGPIE_REG_USB_RX1_DMA_START|BIT4;
+ MAGPIE_REG_USB_RX2_DMA_START = MAGPIE_REG_USB_RX2_DMA_START|BIT4;
+ break;
+ }
+ }
+ _HIFusb_start(handle);
+}
a_uint32_t ref_clk = 0;
extern a_uint32_t cticks;
-// clock change
+// clock change
//
void cmnos_clock_init_patch(a_uint32_t refclk)
{
{
a_uint32_t start_time = NOW();
unsigned int num_ticks = us*ref_clk; // system_freq == number of ticks per 1us
-
+
while ( (NOW() - start_time) < num_ticks) {
/* busy spin */
;
a_uint32_t cmnos_milliseconds_patch(void)
{
cmnos_tick_patch();
-
+
return (cticks);
}
#define EMULATE_PCI_CONFIG
#endif
-#define PCI_CONFIG_BASE_ADDR 0x14000000
+#define PCI_CONFIG_BASE_ADDR 0x14000000
extern A_PCI_INIT_FUNC g_pci_init_func;
adf_drv_info_t* g_wlan_drv = NULL;
}
#define ATHEROS_VENDOR_ID 0x168c
-#define AR5416_DEVID_PCIE 0x24
+#define AR5416_DEVID_PCIE 0x24
void wlan_pci_probe(void)
{
__adf_softc_t *sc;
adf_os_resource_t drv_res = {0};
- adf_os_attach_data_t drv_data = {{0}};
+ adf_os_attach_data_t drv_data = {{0}};
int vendor_id;
int device_id;
#if MAGPIE_ENABLE_PCIE == 0
vendor_id = ATHEROS_VENDOR_ID;
device_id = AR5416_DEVID_PCIE;
-#else
+#else
vendor_id = wlan_pci_config_read(0, 2);
device_id = wlan_pci_config_read(2, 2);
-#endif
- A_PRINTF("<wlan_pci_probe>: Vendor id 0x%x Dev id 0x%x\n", vendor_id, device_id);
-
+#endif
+ A_PRINTF("<wlan_pci_probe>: Vendor id 0x%x Dev id 0x%x\n", vendor_id, device_id);
+
if (vendor_id != ATHEROS_VENDOR_ID) {
- A_PRINTF("<wlan_pci_probe>: Atheros card not found\n");
+ A_PRINTF("<wlan_pci_probe>: Atheros card not found\n");
return;
}
-
+
/**
* Allocate the sc & zero down
*/
A_PRINTF("Cannot malloc softc\n");
goto mem_fail;
}
-
-#define AR5416_DEVID_PCIE 0x24
+
+#define AR5416_DEVID_PCIE 0x24
drv_data.pci.device = AR5416_DEVID_PCIE;
drv_data.pci.vendor = 0x168c;
drv_data.pci.subvendor = 0;
drv_data.pci.subdevice = 0;
-
+
drv_res.start = (a_uint32_t) 0;
drv_res.end = 0;
drv_res.type = ADF_OS_RESOURCE_TYPE_MEM;
-
+
g_wlan_drv_handle = g_wlan_drv->drv_attach(&drv_res, 1, &drv_data, NULL);
-
+
return;
mem_fail:
- return;
+ return;
}
int wlan_pci_config_write(int offset, a_uint32_t val, int width)
{
-#if MAGPIE_ENABLE_PCIE == 1
+#if MAGPIE_ENABLE_PCIE == 1
unsigned long addr = ( PCI_CONFIG_BASE_ADDR + offset ) & 0xfffffffc;
- A_UINT8 *ptr = (A_UINT8 *)addr;
- A_UINT8 *valptr = (A_UINT8 *)&val;
+ A_UINT8 *ptr = (A_UINT8 *)addr;
+ A_UINT8 *valptr = (A_UINT8 *)&val;
int idx = offset & 0x3;
int i;
-
+
for (i = 0; i < width; i++) {
ptr[idx + i] = valptr[3-i];
- }
+ }
#endif
-
- return 0;
+
+ return 0;
}
int wlan_pci_config_read(int offset, int width)
{
-#if MAGPIE_ENABLE_PCIE == 0
- return 0;
+#if MAGPIE_ENABLE_PCIE == 0
+ return 0;
#else
unsigned long addr = ( PCI_CONFIG_BASE_ADDR + offset ) & 0xfffffffc;
unsigned long value = *((unsigned long *)addr);
- A_UINT8 *ptr = (A_UINT8 *)&value;
+ A_UINT8 *ptr = (A_UINT8 *)&value;
int idx = offset & 0x3;
int result = 0;
int i;
-
+
for (i = 0; i < width; i++) {
result |= (ptr[ 3 - (idx + i)] << (8*i));
- }
-
- return result;
-#endif
+ }
+
+ return result;
+#endif
}
void wlan_pci_isr()
*/
/*
* @File: wlan_pci.h
- *
- * @Abstract:
- *
+ *
+ * @Abstract:
+ *
* @Notes:
*/
#ifndef _WLAN_PCI_H
#define _WLAN_PCI_H
+#include <adf_os_stdtypes.h>
+#include <adf_os_types.h>
+
typedef int (*A_PCI_INIT_FUNC)(void);
//extern A_PCI_INIT_FUNC g_pci_init_func;
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
- * @File:
- *
+ * @File:
+ *
* @Abstract: internal data and structure definitions for WMI service
- *
- * @Notes:
+ *
+ * @Notes:
*/
#ifndef WMI_INTERNAL_H_
#endif /* WMI_DEBUG */
#define EVT_PKT_IN_USE (1 << 0)
-#define EVT_PKT_IS_FREE(e) !((e)->Flags & EVT_PKT_IN_USE)
+#define EVT_PKT_IS_FREE(e) !((e)->Flags & EVT_PKT_IN_USE)
#define EVT_MARK_FREE(e) (e)->Flags &= ~EVT_PKT_IN_USE;
#define EVT_MARK_INUSE(e) (e)->Flags |= EVT_PKT_IN_USE
#define IS_EVT_CLASS_BUFFERED(ec) ((ec) != WMI_EVT_CLASS_DIRECT_BUFFER)
typedef struct _WMI_POOL_STATE {
int MaxAllocation; /* maximum allocations allowed for this pool */
int CurrentAllocation; /* current allocations outstanding */
-} WMI_POOL_STATE;
+} WMI_POOL_STATE;
typedef struct _WMI_SVC_CONTEXT {
htc_handle_t HtcHandle;
- pool_handle_t PoolHandle;
+ pool_handle_t PoolHandle;
int PendingEvents; /* no. of pending events */
HTC_SERVICE WMIControlService; /* registered control service */
HTC_ENDPOINT_ID ControlEp; /* endpoint assigned to us */
WMI_DISPATCH_TABLE *pDispatchHead; /* dispatch list head ptr */
- WMI_DISPATCH_TABLE *pDispatchTail; /* dispatch list tail ptr */
+ WMI_DISPATCH_TABLE *pDispatchTail; /* dispatch list tail ptr */
// Left a door for extension the structure
void *pReserved;
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
- * @File:
- *
+ * @File:
+ *
* @Abstract: Wireless Module Interface Service Implementation
- *
- * @Notes:
+ *
+ * @Notes:
*/
#include <osapi.h>
#include <Magpie_api.h>
#include <htc.h>
#include <htc_services.h>
#include <wmi_svc_api.h>
-#include <adf_os_mem.h>
+#include <adf_os_mem.h>
#include <adf_os_io.h>
#include "wmi_internal.h"
void *pContext;
WMI_SVC_CONTEXT *pWMI = (WMI_SVC_CONTEXT *)arg;
WMI_DISPATCH_TABLE *pCurrentTable;
- WMI_DISPATCH_ENTRY*pCurrentEntry;
+ WMI_DISPATCH_ENTRY*pCurrentEntry;
WMI_CMD_HANDLER pCmdHandler;
- A_UINT8* pCmdBuffer;
+ A_UINT8* pCmdBuffer;
int i;
A_UINT16 cmd;
A_UINT16 seq;
a_uint8_t *anbdata;
a_uint32_t anblen;
WMI_CMD_HDR *cmdHdr;
-
+
adf_os_assert(hdr_buf == ADF_NBUF_NULL);
do {
length = adf_nbuf_len(pHTCBuf);
if (length < sizeof(WMI_CMD_HDR)) {
- break;
+ break;
}
adf_nbuf_peek_header(pHTCBuf, &anbdata, &anblen);
-
+
pCurrentTable = pWMI->pDispatchHead;
length = length - sizeof(WMI_CMD_HDR);
-
+
cmdHdr = (WMI_CMD_HDR *)anbdata;
cmd = adf_os_ntohs(cmdHdr->commandId);
seq = adf_os_ntohs(cmdHdr->seqNo);
-
- pCmdBuffer = anbdata + sizeof(WMI_CMD_HDR);
+
+ pCmdBuffer = anbdata + sizeof(WMI_CMD_HDR);
pCmdHandler = NULL;
-
+
while (pCurrentTable != NULL) {
-
+
pContext = pCurrentTable->pContext;
pCurrentEntry = pCurrentTable->pTable;
-
+
/* scan table entries */
for (i = 0; i < pCurrentTable->NumberOfEntries; i++, pCurrentEntry++) {
if (pCurrentEntry->CmdID == cmd) {
/* found a match */
pCmdHandler = pCurrentEntry->pCmdHandler;
-
+
/* optionally check length */
if ((pCurrentEntry->CheckLength != 0) &&
(length < pCurrentEntry->CheckLength)) {
/* do not process command */
pCmdHandler = NULL;
}
- /* end search */
- break;
- }
- }
-
+ /* end search */
+ break;
+ }
+ }
+
if (pCmdHandler != NULL) {
/* found a handler */
break;
}
-
+
/* scan next table */
pCurrentTable = pCurrentTable->pNext;
}
-
+
if (NULL == pCmdHandler) {
- break;
+ break;
}
-
+
/* if we get here, we have a command handler to dispatch */
-
+
/* call dispatch function */
pCmdHandler(pContext, cmd, seq, pCmdBuffer, length);
-
+
} while (FALSE);
-
-
+
+
/* Invalidate the buffer (including HTC header). Note : we only need to invalidate up to the portion
- * that was used (cache invalidate will also round up to the nearest cache line).
+ * that was used (cache invalidate will also round up to the nearest cache line).
* The rest of the buffer should still be coherent.
* */
- HTC_ReturnBuffers(pWMI->HtcHandle, EndPt, pHTCBuf);
+ HTC_ReturnBuffers(pWMI->HtcHandle, EndPt, pHTCBuf);
}
/* send completion handler when any HTC buffers are returned */
WMI_SVC_CONTEXT *pWMI = (WMI_SVC_CONTEXT *)arg;
WMI_BUF_CONTEXT *ctx;
BUF_POOL_ID poolId;
-
+
ctx = (WMI_BUF_CONTEXT *)adf_nbuf_get_priv(pHTCBuf);
-
+
if ( ctx->EventClass == WMI_EVT_CLASS_CMD_EVENT ) {
poolId = POOL_ID_WMI_SVC_EVENT;
} else {
poolId = POOL_ID_WMI_SVC_CMD_REPLY;
}
-
+
BUF_Pool_free_buf(pWMI->PoolHandle, poolId, pHTCBuf);
}
static A_UINT8 WMIServiceConnect(HTC_SERVICE *pService,
- HTC_ENDPOINT_ID eid,
- A_UINT8 *pDataIn,
+ HTC_ENDPOINT_ID eid,
+ A_UINT8 *pDataIn,
int LengthIn,
A_UINT8 *pDataOut,
int *pLengthOut)
{
WMI_SVC_CONTEXT *pWMI = (WMI_SVC_CONTEXT *)pService->ServiceCtx;
-
+
/* save the eid to use */
pWMI->ControlEp = eid;
return HTC_SERVICE_SUCCESS;
}
/************** public APIS ********************************************/
-
+
static wmi_handle_t _WMI_Init(WMI_SVC_CONFIG *pWmiConfig)
{
WMI_SVC_CONTEXT *pWMI = NULL;
int eventSize = WMI_SVC_MAX_BUFFERED_EVENT_SIZE + sizeof(WMI_CMD_HDR) + HTC_HDR_SZ;
-
+
pWMI = (WMI_SVC_CONTEXT *)adf_os_mem_alloc(sizeof(WMI_SVC_CONTEXT));
if (pWMI == NULL) {
- return NULL;
+ return NULL;
}
-
+
pWMI->pDispatchHead = NULL;
pWMI->PoolHandle = pWmiConfig->PoolHandle;
- pWMI->HtcHandle = pWmiConfig->HtcHandle;
-
- BUF_Pool_create_pool(pWmiConfig->PoolHandle, POOL_ID_WMI_SVC_CMD_REPLY,
+ pWMI->HtcHandle = pWmiConfig->HtcHandle;
+
+ BUF_Pool_create_pool(pWmiConfig->PoolHandle, POOL_ID_WMI_SVC_CMD_REPLY,
pWmiConfig->MaxCmdReplyEvts, eventSize);
-
- BUF_Pool_create_pool(pWmiConfig->PoolHandle, POOL_ID_WMI_SVC_EVENT,
+
+ BUF_Pool_create_pool(pWmiConfig->PoolHandle, POOL_ID_WMI_SVC_EVENT,
pWmiConfig->MaxEventEvts, eventSize);
-
- /* NOTE: since RAM allocation is zero-initialized, there is nothing to do for the
+
+ /* NOTE: since RAM allocation is zero-initialized, there is nothing to do for the
* direct event pool */
-
+
/* register the WMI control service */
pWMI->WMIControlService.ProcessRecvMsg = A_INDIR(wmi_svc_api._WMI_RecvMessageHandler);
pWMI->WMIControlService.ProcessSendBufferComplete = A_INDIR(wmi_svc_api._WMI_SendCompleteHandler);
pWMI->WMIControlService.ProcessConnect = A_INDIR(wmi_svc_api._WMI_ServiceConnect);
pWMI->WMIControlService.MaxSvcMsgSize = WMI_SVC_MSG_SIZE + sizeof(WMI_CMD_HDR);
- /* all buffers that are sent through the control endpoint are at least WMI_SVC_MAX_BUFFERED_EVENT_SIZE
+ /* all buffers that are sent through the control endpoint are at least WMI_SVC_MAX_BUFFERED_EVENT_SIZE
* in size. Any WMI event that supplies a data buffer must insure that the space in the buffer
* is at least this size. */
- pWMI->WMIControlService.TrailerSpcCheckLimit = WMI_SVC_MAX_BUFFERED_EVENT_SIZE;
+ pWMI->WMIControlService.TrailerSpcCheckLimit = WMI_SVC_MAX_BUFFERED_EVENT_SIZE;
pWMI->WMIControlService.ServiceID = WMI_CONTROL_SVC;
pWMI->WMIControlService.ServiceCtx = pWMI;
HTC_RegisterService(pWmiConfig->HtcHandle, &pWMI->WMIControlService);
-
+
return pWMI;
}
WMI_DISPATCH_TABLE *pDispatchTable)
{
WMI_SVC_CONTEXT *pWMI = (WMI_SVC_CONTEXT *)handle;
-
+
if (NULL == pWMI->pDispatchHead) {
pWMI->pDispatchHead = pDispatchTable;
- pWMI->pDispatchTail = pDispatchTable;
+ pWMI->pDispatchTail = pDispatchTable;
} else {
/* link to the tail */
pWMI->pDispatchTail->pNext = pDispatchTable;
- pWMI->pDispatchTail = pDispatchTable;
+ pWMI->pDispatchTail = pDispatchTable;
}
}
static adf_nbuf_t _WMI_AllocEvent(wmi_handle_t handle, WMI_EVT_CLASS EventClass,
int Length)
-{
+{
BUF_POOL_ID poolId;
WMI_SVC_CONTEXT *pWMI = (WMI_SVC_CONTEXT *)handle;
adf_nbuf_t buf;
WMI_BUF_CONTEXT *ctx;
-
+
if ( EventClass == WMI_EVT_CLASS_CMD_EVENT ) {
poolId = POOL_ID_WMI_SVC_EVENT;
} else {
poolId = POOL_ID_WMI_SVC_CMD_REPLY;
}
-
- buf = BUF_Pool_alloc_buf(pWMI->PoolHandle,
- poolId,
+
+ buf = BUF_Pool_alloc_buf(pWMI->PoolHandle,
+ poolId,
sizeof(WMI_CMD_HDR) + HTC_GetReservedHeadroom(pWMI->HtcHandle));
-
+
if ( buf != NULL ) {
ctx = (WMI_BUF_CONTEXT *)adf_nbuf_get_priv(buf);
ctx->EventClass = EventClass;
return buf;
}
-static void _WMI_SendEvent(wmi_handle_t handle, adf_nbuf_t pEvt,
+static void _WMI_SendEvent(wmi_handle_t handle, adf_nbuf_t pEvt,
A_UINT16 EventId, A_UINT16 SeqNo, int Length)
{
WMI_SVC_CONTEXT *pWMI = (WMI_SVC_CONTEXT *)handle;
A_UINT8 *pBuffer;
-
+
pBuffer = adf_nbuf_push_head(pEvt, sizeof(WMI_CMD_HDR));
- A_SET_UINT16_FIELD(pBuffer, WMI_CMD_HDR, commandId, adf_os_htons(EventId));
+ A_SET_UINT16_FIELD(pBuffer, WMI_CMD_HDR, commandId, adf_os_htons(EventId));
A_SET_UINT16_FIELD(pBuffer, WMI_CMD_HDR, seqNo, adf_os_htons(SeqNo));
-
- HTC_SendMsg(pWMI->HtcHandle, pWMI->ControlEp, pEvt);
+
+ HTC_SendMsg(pWMI->HtcHandle, pWMI->ControlEp, pEvt);
}
static void _WMI_Shutdown(wmi_handle_t handle)
typedef enum WMI_EVT_CLASS {
WMI_EVT_CLASS_NONE = -1,
WMI_EVT_CLASS_CMD_EVENT = 0,
- WMI_EVT_CLASS_CMD_REPLY = 1,
+ WMI_EVT_CLASS_CMD_REPLY = 1,
WMI_EVT_CLASS_MAX
} WMI_EVT_CLASS;
int MaxCmdReplyEvts; /* total buffers for command replies */
int MaxEventEvts; /* total buffers for low priority events */
} WMI_SVC_CONFIG;
-
+
/* command dispatch entry */
typedef struct _WMI_DISPATCH_ENTRY {
WMI_CMD_HANDLER pCmdHandler; /* dispatch function */
A_UINT16 CmdID; /* WMI command to dispatch from */
- A_UINT16 CheckLength; /* expected length of command, set to 0 to bypass check */
+ A_UINT16 CheckLength; /* expected length of command, set to 0 to bypass check */
} WMI_DISPATCH_ENTRY;
/* dispatch table that is used to register a set of dispatch entries */
typedef struct _WMI_DISPATCH_TABLE {
struct _WMI_DISPATCH_TABLE *pNext; /* next dispatch, WMI-reserved */
- void *pContext; /* optional context that is passed to command handlers
+ void *pContext; /* optional context that is passed to command handlers
assigned to this dispatch table */
int NumberOfEntries; /* number of elements pointed to by pTable */
WMI_DISPATCH_ENTRY *pTable; /* start of table */
} WMI_DISPATCH_TABLE;
#define WMI_DISPATCH_ENTRY_COUNT(table) \
- (sizeof((table)) / sizeof(WMI_DISPATCH_ENTRY))
+ (sizeof((table)) / sizeof(WMI_DISPATCH_ENTRY))
/* handy macro to declare a dispatch table */
#define WMI_DECLARE_DISPATCH_TABLE(name,dispatchEntries) \
typedef struct _WMI_BUF_CONTEXT {
HTC_BUF_CONTEXT HtcBufCtx;
-
- WMI_EVT_CLASS EventClass; /* the event class this packet belongs to */
- A_UINT16 Flags; /* internal flags reserved for WMI */
+
+ WMI_EVT_CLASS EventClass; /* the event class this packet belongs to */
+ A_UINT16 Flags; /* internal flags reserved for WMI */
} WMI_BUF_CONTEXT;
/* ROM-version, eventually. For now, in RAM */
-
+
typedef void* wmi_handle_t;
-
+
/* the API table */
typedef struct _wmi_svc_apis {
wmi_handle_t (* _WMI_Init)(WMI_SVC_CONFIG *pWmiConfig);
void (* _WMI_SendCompleteHandler)(HTC_ENDPOINT_ID Endpt, adf_nbuf_t pHTCBuf, void *arg);
int (* _WMI_GetControlEp)(wmi_handle_t h);
void (* _WMI_Shutdown)(wmi_handle_t h);
-
+
/* */
void (*_WMI_RecvMessageHandler)(HTC_ENDPOINT_ID EndPt, adf_nbuf_t hdr_buf, adf_nbuf_t pHTCBuf, void *arg);
- A_UINT8 (*_WMI_ServiceConnect)(HTC_SERVICE *pService, HTC_ENDPOINT_ID eid,
- A_UINT8 *pDataIn,
+ A_UINT8 (*_WMI_ServiceConnect)(HTC_SERVICE *pService, HTC_ENDPOINT_ID eid,
+ A_UINT8 *pDataIn,
int LengthIn,
A_UINT8 *pDataOut,
int *pLengthOut);
-
+
void *pReserved; /* for expansion if need be */
} WMI_SVC_APIS;
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
/* Linker script for Magpie RAM-based applications */
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
/* Linker script for Magpie RAM-based applications */
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+
PROVIDE ( _indir_tbl = 0x00500000 );
PROVIDE (athos_indirection_table_install = 0x008e1548);
PROVIDE ( memcpy = 0x008e4eb8 );
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
+ */
+
PROVIDE ( _indir_tbl = 0x00500000 );
PROVIDE ( memcpy = 0x008e6b64 );
PROVIDE ( memset = 0x008e6e48 );
*/
#define IEEE80211_AMPDU_LIMIT_MIN (1 * 1024)
#define IEEE80211_AMPDU_LIMIT_MAX (64 * 1024 - 1)
-#define IEEE80211_AMPDU_SUBFRAME_MIN 2
-#define IEEE80211_AMPDU_SUBFRAME_MAX 64
-#define IEEE80211_AMPDU_SUBFRAME_DEFAULT 32
+#define IEEE80211_AMPDU_SUBFRAME_MIN 2
+#define IEEE80211_AMPDU_SUBFRAME_MAX 64
+#define IEEE80211_AMPDU_SUBFRAME_DEFAULT 32
#define IEEE80211_AMSDU_LIMIT_MAX 4096
struct ieee80211_rateset {
#undef OFDM_SYMBOL_TIME
#ifdef MAGPIE_MERLIN
-a_uint32_t
+a_uint32_t
ath_hal_get_curmode(struct ath_hal *ah, HAL_CHANNEL_INTERNAL *chan)
{
if (!chan)
return HAL_MODE_11NG;
if (IS_CHAN_NA(chan))
- return HAL_MODE_11NA;
+ return HAL_MODE_11NA;
if (IS_CHAN_A(chan))
return HAL_MODE_11A;
a_uint32_t ah_magic;
HAL_SOFTC ah_sc;
adf_os_device_t ah_dev;
-
+
a_uint32_t ah_macVersion;
a_uint16_t ah_macRev;
a_uint16_t ah_phyRev;
void __ahdecl(*ah_detach)(struct ath_hal*);
HAL_BOOL __ahdecl(*ah_updateTxTrigLevel)(struct ath_hal*,
HAL_BOOL incTrigLevel);
-
+
/* Misc Functions */
- void __ahdecl(*ah_setDefAntenna)(struct ath_hal*, a_uint32_t);
+ void __ahdecl(*ah_setDefAntenna)(struct ath_hal*, a_uint32_t);
void __ahdecl(*ah_setRxFilter)(struct ath_hal*, a_uint32_t);
-
-
+
+
/* Target Transmit Functions */
HAL_BOOL __ahdecl(*ah_setTxDP)(struct ath_hal*, a_uint32_t, a_uint32_t txdp);
- a_uint32_t __ahdecl(*ah_numTxPending)(struct ath_hal *, a_uint32_t q);
+ a_uint32_t __ahdecl(*ah_numTxPending)(struct ath_hal *, a_uint32_t q);
HAL_BOOL __ahdecl(*ah_startTxDma)(struct ath_hal*, a_uint32_t);
HAL_BOOL __ahdecl(*ah_stopTxDma)(struct ath_hal*, a_uint32_t);
-
+
HAL_BOOL __ahdecl(*ah_abortTxDma)(struct ath_hal *);
-
+
void __ahdecl(*ah_set11nTxDesc)(struct ath_tx_desc *ds,
a_uint32_t pktLen, HAL_PKT_TYPE type,
a_uint32_t txPower, a_uint32_t keyIx,
void __ahdecl(*ah_set11nBurstDuration)(struct ath_tx_desc *ds,
a_uint32_t burstDuration);
void __ahdecl(*ah_set11nVirtualMoreFrag)(struct ath_tx_desc *ds, a_uint32_t vmf);
-
+
HAL_BOOL __ahdecl(*ah_setupTxDesc)(struct ath_tx_desc *,
a_uint32_t pktLen, a_uint32_t hdrLen,
HAL_PKT_TYPE type, a_uint32_t txPower,
a_uint32_t filter0, a_uint32_t filter1);
u_int64_t __ahdecl(*ah_getTsf64)(struct ath_hal*);
-
+
/* Target receive Functions */
void __ahdecl(*ah_setRxDP)(struct ath_hal*, a_uint32_t rxdp);
HAL_BOOL __ahdecl(*ah_setupRxDesc)(struct ath_rx_desc *,
a_uint32_t size, a_uint32_t flags);
HAL_STATUS __ahdecl(*ah_procRxDesc)(struct ath_hal *, struct ath_desc *,
a_uint32_t phyAddr, struct ath_desc *next, u_int64_t tsf);
- HAL_STATUS __ahdecl(*ah_procRxDescFast)(struct ath_hal *ah,
+ HAL_STATUS __ahdecl(*ah_procRxDescFast)(struct ath_hal *ah,
struct ath_rx_desc *ds, a_uint32_t pa,
- struct ath_desc *nds,
+ struct ath_desc *nds,
struct ath_rx_status *rx_stats);
HAL_BOOL __ahdecl(*ah_stopDmaReceive)(struct ath_hal*);
void __ahdecl(*ah_stopPcuReceive)(struct ath_hal*);
void __ahdecl(*ah_enableReceive)(struct ath_hal*);
-
+
/* Interrupt functions */
HAL_BOOL __ahdecl(*ah_isInterruptPending)(struct ath_hal*);
HAL_BOOL __ahdecl(*ah_getPendingInterrupts)(struct ath_hal*, HAL_INT*);
-/*-
+/*
* Copyright (c) 2002-2004 Sam Leffler, Errno Consulting, Atheros
- * Communications, Inc. All rights reserved.
+ * Communications, Inc. All rights reserved.
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
*
- * Redistribution and use in source and binary forms are permitted
- * provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following NO
- * ''WARRANTY'' disclaimer below (''Disclaimer''), without
- * modification.
- * 2. Redistributions in binary form must reproduce at minimum a
- * disclaimer similar to the Disclaimer below and any redistribution
- * must be conditioned upon including a substantially similar
- * Disclaimer requirement for further binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the
- * names of any contributors may be used to endorse or promote
- * product derived from this software without specific prior written
- * permission.
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
*
- * NO WARRANTY
- * 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 NONINFRINGEMENT,
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
- * FOR 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 DAMAGES.
+ * * 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.
*
- * $Id: //depot/sw/branches/fusion_usb/target_firmware/wlan/target/hal/main/linux/ah_osdep.h#1 $
+ * * Neither the name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
*/
+
#ifndef _ATH_AH_OSDEP_H_
#define _ATH_AH_OSDEP_H_
/*
#define AR5416_PWR_TABLE_OFFSET -5
#define AR5416_LEGACY_CHAINMASK 1
#define AR5416_1_CHAINMASK 1
-#define AR5416_2LOHI_CHAINMASK 5
-#define AR5416_2LOMID_CHAINMASK 3
+#define AR5416_2LOHI_CHAINMASK 5
+#define AR5416_2LOMID_CHAINMASK 3
#define AR5416_3_CHAINMASK 7
#define AH5416(_ah) ((struct ath_hal_5416 *)(_ah))
struct ath_hal_private ah_priv; /* base class */
a_uint16_t ah_antennaSwitchSwap; /* Controls mapping of OID request */
a_uint32_t ah_maskReg; /* copy of AR_IMR */
-
+
a_uint32_t ah_slottime; /* user-specified slot time */
a_int16_t ah_txPowerIndexOffset;
-
+
a_uint32_t ah_intrTxqs;
void *ah_cal_mem;
a_uint16_t ah_ratesArray[Ar5416RateSize];
/*
- * Copyright (c) 2000-2002 Atheros Communications, Inc., All Rights Reserved
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
*
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
*/
#ident "$Id: //depot/sw/branches/fusion_usb/target_firmware/wlan/target/ratectrl11n/ar5416Phy.c#5 $"
/* TRUE_ALL_11N - valid for 20/40/Legacy, TRUE - Legacy only, TRUE_20 - HT 20 only, TRUE_40 - HT 40 only */
/* 4ms frame limit not used for NG mode. The values filled for HT are the 64K max aggregate limit */
-#ifndef MAGPIE_MERLIN // K2
+#ifndef MAGPIE_MERLIN // K2
RATE_TABLE_11N ar5416_11ngRateTable = {
- 54, /* number of rates - should match the no. of rows below */
- 100, /* probe interval */
- 50, /* rssi reduce interval */
+ 54, /* number of rates - should match the no. of rows below */
+ 100, /* probe interval */
+ 50, /* rssi reduce interval */
WLAN_RC_HT_FLAG, /* Phy rates allowed initially */
{/* Multiple Single */
/* stream stream short dot11 ctrl RssiAck RssiAck Base CW40 SGI Ht tx chain 4ms tx valid for*/
/* 121.5Mb [41] */ { FALSE, TRUE_40, WLAN_PHY_HT_40_SS,121500,102700,0x86, 0x00, 6, 8, 23, 3, 20, 41, 42, 42, 1, 1, 60156, FALSE},
/* 135 Mb [42] */ { FALSE, TRUE_40, WLAN_PHY_HT_40_SS_HGI,135000,111900,0x86, 0x00, 6, 8, 23, 3, 20, 41, 42, 42, 1, 1, 66840, FALSE},
/* 135 Mb [43] */ { FALSE, TRUE_40, WLAN_PHY_HT_40_SS,135000,112000,0x87, 0x00, 7, 8, 25, 3, 22, 43, 44, 44, 1, 1, 66840, TRUE},
- /* 150 Mb [44] */ { FALSE, TRUE_40, WLAN_PHY_HT_40_SS_HGI,150000,122000,0x87, 0x00, 7, 8, 25, 3, 22, 43, 44, 44, 1, 1, 74200, TRUE},
+ /* 150 Mb [44] */ { FALSE, TRUE_40, WLAN_PHY_HT_40_SS_HGI,150000,122000,0x87, 0x00, 7, 8, 25, 3, 22, 43, 44, 44, 1, 1, 74200, TRUE},
/* 108 Mb [45] */ { TRUE_40, FALSE, WLAN_PHY_HT_40_DS,108000,92500, 0x8b, 0x00, 11, 8, 10, 3, 24, 45, 45, 45, 3, 7, 53440, FALSE},
/* 162 Mb [46] */ { TRUE_40, FALSE, WLAN_PHY_HT_40_DS,162000,130300,0x8c, 0x00, 12, 8, 14, 3, 25, 46, 47, 47, 3, 7, 80160, TRUE},
/* 180 Mb [47] */ { FALSE, FALSE, WLAN_PHY_HT_40_DS_HGI,180000,156900,0x8c, 0x00, 12, 8, 14, 3, 25, 46, 47, 47, 3, 7, 89090, TRUE},
/* 300 Mb [53] */ { TRUE_40, FALSE, WLAN_PHY_HT_40_DS_HGI,300000,207000,0x8f, 0x00, 15, 8, 25, 3, 31, 52, 53, 53, 3, 5, 148400, TRUE},
/* Multiple Single */
/* stream stream short dot11 ctrl RssiAck RssiAck Base CW40 SGI Ht tx chain 4ms tx valid for*/
- /* valid valid Kbps uKbps RC Preamble Rate Rate ValidMin DeltaMin Idx Idx Idx Idx mask limit UAPSD */
+ /* valid valid Kbps uKbps RC Preamble Rate Rate ValidMin DeltaMin Idx Idx Idx Idx mask limit UAPSD */
},
};
RATE_TABLE_11N ar5416_11ngRateTable = {
- 46, /* number of rates - should match the no. of rows below */
- 50, /* probe interval */
- 50, /* rssi reduce interval */
+ 46, /* number of rates - should match the no. of rows below */
+ 50, /* probe interval */
+ 50, /* rssi reduce interval */
WLAN_RC_HT_FLAG, /* Phy rates allowed initially */
{/* Multiple Single Single */
/* stream stream stream short dot11 ctrl RssiAck RssiAck Base CW40 SGI Ht tx chain 4ms tx valid for*/
/* 108 Mb [33] */ { FALSE, TRUE_40, TRUE_40, WLAN_PHY_HT_40_SS,108000,92900, 0x85, 0x00, 5, 8, 20, 3, 17, 33, 33, 33, 1, 1, 53476, FALSE},
/* 121.5Mb [34] */ { FALSE, TRUE_40, TRUE_40, WLAN_PHY_HT_40_SS,121500,102700,0x86, 0x00, 6, 8, 23, 3, 18, 34, 34, 34, 1, 1, 60156, FALSE},
/* 135 Mb [35] */ { FALSE, TRUE_40, FALSE, WLAN_PHY_HT_40_SS,135000,112000,0x87, 0x00, 7, 8, 25, 3, 19, 35, 36, 36, 1, 1, 66840, TRUE},
- /* 150 Mb [36] */ { FALSE, TRUE_40, FALSE, WLAN_PHY_HT_40_SS_HGI,150000,122000,0x87, 0x00, 7, 8, 25, 3, 19, 35, 36, 36, 1, 1, 74200, TRUE},
+ /* 150 Mb [36] */ { FALSE, TRUE_40, FALSE, WLAN_PHY_HT_40_SS_HGI,150000,122000,0x87, 0x00, 7, 8, 25, 3, 19, 35, 36, 36, 1, 1, 74200, TRUE},
/* 27 Mb [37] */ { FALSE, FALSE, FALSE, WLAN_PHY_HT_40_DS,27000, 25800, 0x88, 0x00, 8, 8, 2, 3, 20, 37, 37, 37, 3, 7, 13360, TRUE},
/* 54 Mb [38] */ { FALSE, FALSE, FALSE, WLAN_PHY_HT_40_DS,54000, 49800, 0x89, 0x00, 9, 8, 4, 3, 21, 38, 38, 38, 3, 7, 26720, FALSE},
/* 81 Mb [39] */ { FALSE, FALSE, FALSE, WLAN_PHY_HT_40_DS,81000, 71900, 0x8a, 0x00, 10, 8, 6, 3, 22, 39, 39, 39, 3, 7, 40080, TRUE},
/* 300 Mb [45] */ { TRUE_40, FALSE, TRUE_40, WLAN_PHY_HT_40_DS_HGI,300000,207000,0x8f, 0x00, 15, 8, 25, 3, 27, 44, 45, 45, 3, 5, 148400, TRUE},
/* Multiple Single */
/* stream stream short dot11 ctrl RssiAck RssiAck Base CW40 SGI Ht tx chain 4ms tx valid for*/
- /* valid valid Kbps uKbps RC Preamble Rate Rate ValidMin DeltaMin Idx Idx Idx Idx mask limit UAPSD */
+ /* valid valid Kbps uKbps RC Preamble Rate Rate ValidMin DeltaMin Idx Idx Idx Idx mask limit UAPSD */
},
};
//static RATE_TABLE_11N ar5416_11naRateTable = {
RATE_TABLE_11N ar5416_11naRateTable = {
- 42, /* number of rates */
- 50, /* probe interval */
- 50, /* rssi reduce interval */
+ 42, /* number of rates */
+ 50, /* probe interval */
+ 50, /* rssi reduce interval */
WLAN_RC_HT_FLAG, /* Phy rates allowed initially */
{/* Multiple Single Single*/
/* stream stream stream rate short dot11 ctrl RssiAck RssiAck Base CW40 SGI Ht tx chain 4ms tx valid for */
/* 108 Mb [29] */ { FALSE, TRUE_40, TRUE_40, WLAN_PHY_HT_40_SS,108000,92900, 0x85, 0x00, 5, 4, 20, 3, 13, 29, 29, 29, 1, 1, 53476, FALSE},
/* 121.5Mb [30] */ { FALSE, TRUE_40, TRUE_40, WLAN_PHY_HT_40_SS,121500,102700,0x86, 0x00, 6, 4, 23, 3, 14, 30, 30, 30, 1, 1, 60156, FALSE},
/* 135 Mb [31] */ { FALSE, TRUE_40, FALSE, WLAN_PHY_HT_40_SS,135000,112000,0x87, 0x00, 7, 4, 25, 3, 15, 31, 32, 32, 1, 1, 66840, TRUE},
- /* 150 Mb [32] */ { FALSE, TRUE_40, FALSE, WLAN_PHY_HT_40_SS_HGI,150000,122000,0x87, 0x00, 7, 8, 25, 3, 15, 31, 32, 32, 1, 1, 65535, TRUE},
+ /* 150 Mb [32] */ { FALSE, TRUE_40, FALSE, WLAN_PHY_HT_40_SS_HGI,150000,122000,0x87, 0x00, 7, 8, 25, 3, 15, 31, 32, 32, 1, 1, 65535, TRUE},
/* 27 Mb [33] */ { FALSE, FALSE, FALSE, WLAN_PHY_HT_40_DS,27000, 25800, 0x88, 0x00, 8, 0, 2, 3, 16, 33, 33, 33, 3, 7, 13360, TRUE},
/* 54 Mb [34] */ { FALSE, FALSE, FALSE, WLAN_PHY_HT_40_DS,54000, 49800, 0x89, 0x00, 9, 2, 4, 3, 17, 34, 34, 34, 3, 7, 26720, FALSE},
/* 81 Mb [35] */ { FALSE, FALSE, FALSE, WLAN_PHY_HT_40_DS,81000, 71900, 0x8a, 0x00, 10, 2, 6, 3, 18, 35, 35, 35, 3, 7, 40080, TRUE},
/* 270 Mb [40] */ { TRUE_40, FALSE, TRUE_40, WLAN_PHY_HT_40_DS,270000,192100,0x8f, 0x00, 15, 4, 25, 3, 23, 40, 41, 41, 3, 5, 133600, TRUE},
/* 300 Mb [41] */ { TRUE_40, FALSE, TRUE_40, WLAN_PHY_HT_40_DS_HGI,300000,207000,0x8f, 0x00, 15, 4, 25, 3, 23, 40, 41, 41, 3, 5, 148400, TRUE},
/* stream stream rate short dot11 ctrl RssiAck RssiAck Base CW40 SGI Ht tx chain 4ms tx valid for */
- /* valid valid Kbps uKbps Code Preamble Rate Rate ValidMin DeltaMin Idx Idx Idx Idx mask limit UAPSD */
+ /* valid valid Kbps uKbps Code Preamble Rate Rate ValidMin DeltaMin Idx Idx Idx Idx mask limit UAPSD */
},
};
#endif //ATH_SUPPORT_A_MODE
-#endif //#ifdef MAGPIE_MERLIN // MAGPIE_MERLIN
+#endif //#ifdef MAGPIE_MERLIN // MAGPIE_MERLIN
void
ar5416AttachRateTables(struct atheros_softc *sc)
/* Transmit functions */
.ah_updateTxTrigLevel = ar5416UpdateTxTrigLevel,
.ah_setTxDP = ar5416SetTxDP,
- .ah_numTxPending = ar5416NumTxPending,
+ .ah_numTxPending = ar5416NumTxPending,
.ah_startTxDma = ar5416StartTxDma,
.ah_stopTxDma = ar5416StopTxDma,
void ar5416SetRxFilter(struct ath_hal *ah, a_uint32_t bits)
{
a_uint32_t phybits;
-
+
iowrite32_mac(AR_RX_FILTER, (bits & 0xff) | AR_RX_COMPR_BAR);
phybits = 0;
if (bits & HAL_RX_FILTER_PHYRADAR)
return HAL_EINPROGRESS;
/*
- * Now we need to get the stats from the descriptor. Since desc are
+ * Now we need to get the stats from the descriptor. Since desc are
* uncached, lets make a copy of the stats first. Note that, since we
* touch most of the rx stats, a memcpy would always be more efficient
*
rx_stats->rs_tstamp = ads.AR_RcvTimestamp;
/* XXX what about KeyCacheMiss? */
- rx_stats->rs_rssi_combined =
+ rx_stats->rs_rssi_combined =
MS(ads.ds_rxstatus4, AR_RxRSSICombined);
rx_stats->rs_rssi_ctl0 = MS(ads.ds_rxstatus0, AR_RxRSSIAnt00);
rx_stats->rs_rssi_ctl1 = MS(ads.ds_rxstatus0, AR_RxRSSIAnt01);
HAL_BOOL ar5416StopTxDma(struct ath_hal*ah, a_uint32_t q)
{
a_uint32_t i;
-
+
HALASSERT(q < AH_PRIVATE(ah)->ah_caps.halTotalQueues);
HALASSERT(AH5416(ah)->ah_txq[q].tqi_type != HAL_TX_QUEUE_INACTIVE);
ads->ds_ctl2 = SM(txTries0, AR_XmitDataTries0);
ads->ds_ctl3 = (txRate0 << AR_XmitRate0_S);
- ads->ds_ctl7 = SM(AR5416_LEGACY_CHAINMASK, AR_ChainSel0)
+ ads->ds_ctl7 = SM(AR5416_LEGACY_CHAINMASK, AR_ChainSel0)
| SM(AR5416_LEGACY_CHAINMASK, AR_ChainSel1)
- | SM(AR5416_LEGACY_CHAINMASK, AR_ChainSel2)
+ | SM(AR5416_LEGACY_CHAINMASK, AR_ChainSel2)
| SM(AR5416_LEGACY_CHAINMASK, AR_ChainSel3);
if (keyIx != HAL_TXKEYIX_INVALID) {
{
struct ar5416_desc *ads = AR5416DESC(gds);
struct ath_tx_desc *ds = (struct ath_tx_desc *)gds;
-
+
if ((ads->ds_txstatus9 & AR_TxDone) == 0)
return HAL_EINPROGRESS;
* ``alternate'' if it wasn't the series 0 rate.
*/
ds->ds_txstat.ts_rate = MS(ads->ds_txstatus9, AR_FinalTxIdx);
- ds->ds_txstat.ts_rssi_combined =
+ ds->ds_txstat.ts_rssi_combined =
MS(ads->ds_txstatus5, AR_TxRSSICombined);
ds->ds_txstat.ts_rssi_ctl0 = MS(ads->ds_txstatus0, AR_TxRSSIAnt00);
ds->ds_txstat.ts_rssi_ctl1 = MS(ads->ds_txstatus0, AR_TxRSSIAnt01);
ads->ds_ctl1 |= (AR_IsAggr | AR_MoreAggr);
/*
- * We use a stack variable to manipulate ctl6 to reduce uncached
+ * We use a stack variable to manipulate ctl6 to reduce uncached
* read modify, modfiy, write.
*/
ctl6 = ads->ds_ctl6;
a_uint32_t pktLen, HAL_PKT_TYPE type, a_uint32_t txPower,
a_uint32_t keyIx, HAL_KEY_TYPE keyType, a_uint32_t flags);
extern void ar5416Set11nRateScenario_20(struct ath_tx_desc *ds,
- a_uint32_t durUpdateEn, a_uint32_t rtsctsRate, HAL_11N_RATE_SERIES series[],
+ a_uint32_t durUpdateEn, a_uint32_t rtsctsRate, HAL_11N_RATE_SERIES series[],
a_uint32_t nseries, a_uint32_t flags);
extern void ar5416Set11nAggrFirst_20(struct ath_tx_desc *ds,
a_uint32_t aggrLen, a_uint32_t numDelims);
a_uint32_t vmf);
extern HAL_BOOL ar5416SetupRxDesc_20(struct ath_rx_desc *,
a_uint32_t size, a_uint32_t flags);
-extern HAL_STATUS ar5416ProcRxDescFast_20(struct ath_hal *ah,
+extern HAL_STATUS ar5416ProcRxDescFast_20(struct ath_hal *ah,
struct ath_rx_desc *, a_uint32_t,
struct ath_desc *,
struct ath_rx_status *);
#define AR_SREV_VERSION_HOWL 0x014
#define AR_SREV_5416_V20_OR_LATER(_ah) (AR_SREV_HOWL((_ah)) || AR_SREV_OWL_20_OR_LATER(_ah))
-#define AR_SREV_5416_V22_OR_LATER(_ah) (AR_SREV_HOWL((_ah)) || AR_SREV_OWL_22_OR_LATER(_ah))
+#define AR_SREV_5416_V22_OR_LATER(_ah) (AR_SREV_HOWL((_ah)) || AR_SREV_OWL_22_OR_LATER(_ah))
#ifdef AR5416_EMULATION
/* XXX - AR5416 Emulation only
((AH_PRIVATE((_ah))->ah_macVersion == AR_SREV_VERSION_MERLIN) && \
(AH_PRIVATE((_ah))->ah_macRev >= AR_SREV_REVISION_MERLIN_20)))
-#define AR_SREV_SOWL(_ah) ((AH_PRIVATE((_ah))->ah_macVersion == AR_SREV_VERSION_SOWL))
+#define AR_SREV_SOWL(_ah) ((AH_PRIVATE((_ah))->ah_macVersion == AR_SREV_VERSION_SOWL))
#define AR_SREV_SOWL_11(_ah) (AR_SREV_SOWL(_ah) && (AH_PRIVATE((_ah))->ah_macRev == AR_SREV_REVISION_SOWL_11))
#define AR_RADIO_SREV_MAJOR 0xf0
/* is 802.11 address multicast/broadcast? */
#define IEEE80211_IS_MULTICAST(_a) (*(_a) & 0x01)
-#ifdef __CARRIER_PLATFORM__
+#ifdef __CARRIER_PLATFORM__
#include <ath_carr_pltfrm.h>
#endif
a_uint16_t i_crc;
} adf_os_packed;
-#define IEEE80211_PLCP_SFD 0xF3A0
+#define IEEE80211_PLCP_SFD 0xF3A0
#define IEEE80211_PLCP_SERVICE 0x00
/*
CTRY_CANADA2 = 5001 /* Canada */
};
-/*
+/*
* Country information element.
*/
#define IEEE80211_COUNTRY_MAX_TRIPLETS (83)
} adf_os_packed;
/*
- * Management Action Frames
+ * Management Action Frames
*/
/* generic frame format */
/* HT - recommended transmission channel width */
struct ieee80211_action_ht_txchwidth {
struct ieee80211_action at_header;
- a_uint8_t at_chwidth;
+ a_uint8_t at_chwidth;
} adf_os_packed;
#define IEEE80211_A_HT_TXCHWIDTH_20 0
struct ieee80211_action_ba_addbarequest {
struct ieee80211_action rq_header;
a_uint8_t rq_dialogtoken;
- struct ieee80211_ba_parameterset rq_baparamset;
+ struct ieee80211_ba_parameterset rq_baparamset;
a_uint16_t rq_batimeout; /* in TUs */
struct ieee80211_ba_seqctrl rq_basequencectrl;
} adf_os_packed;
struct ieee80211_action rs_header;
a_uint8_t rs_dialogtoken;
a_uint16_t rs_statuscode;
- struct ieee80211_ba_parameterset rs_baparamset;
+ struct ieee80211_ba_parameterset rs_baparamset;
a_uint16_t rs_batimeout; /* in TUs */
} adf_os_packed;
/* HT capability flags */
#define IEEE80211_HTCAP_C_ADVCODING 0x0001
-#define IEEE80211_HTCAP_C_CHWIDTH40 0x0002
+#define IEEE80211_HTCAP_C_CHWIDTH40 0x0002
#define IEEE80211_HTCAP_C_SMPOWERSAVE_STATIC 0x0000 /* Capable of SM Power Save (Static) */
#define IEEE80211_HTCAP_C_SMPOWERSAVE_DYNAMIC 0x0004 /* Capable of SM Power Save (Dynamic) */
#define IEEE80211_HTCAP_C_SM_RESERVED 0x0008 /* Reserved */
#define IEEE80211_HTCAP_C_RXSTBC 0x0100 /* 2 bits */
#define IEEE80211_HTCAP_C_DELAYEDBLKACK 0x0400
#define IEEE80211_HTCAP_C_MAXAMSDUSIZE 0x0800 /* 1 = 8K, 0 = 3839B */
-#define IEEE80211_HTCAP_C_DSSSCCK40 0x1000
-#define IEEE80211_HTCAP_C_PSMP 0x2000
-#define IEEE80211_HTCAP_C_INTOLERANT40 0x4000
-#define IEEE80211_HTCAP_C_LSIGTXOPPROT 0x8000
+#define IEEE80211_HTCAP_C_DSSSCCK40 0x1000
+#define IEEE80211_HTCAP_C_PSMP 0x2000
+#define IEEE80211_HTCAP_C_INTOLERANT40 0x4000
+#define IEEE80211_HTCAP_C_LSIGTXOPPROT 0x8000
#define IEEE80211_HTCAP_C_SM_MASK 0x000c /* Spatial Multiplexing (SM) capabitlity bitmask */
/* HT extended capability flags */
#define IEEE80211_HTCAP_EXTC_PCO 0x0001
-#define IEEE80211_HTCAP_EXTC_TRANS_TIME_RSVD 0x0000
+#define IEEE80211_HTCAP_EXTC_TRANS_TIME_RSVD 0x0000
#define IEEE80211_HTCAP_EXTC_TRANS_TIME_400 0x0002 /* 20-40 switch time */
#define IEEE80211_HTCAP_EXTC_TRANS_TIME_1500 0x0004 /* in us */
-#define IEEE80211_HTCAP_EXTC_TRANS_TIME_5000 0x0006
+#define IEEE80211_HTCAP_EXTC_TRANS_TIME_5000 0x0006
#define IEEE80211_HTCAP_EXTC_RSVD_1 0x00f8
#define IEEE80211_HTCAP_EXTC_MCS_FEEDBACK_NONE 0x0000
#define IEEE80211_HTCAP_EXTC_MCS_FEEDBACK_RSVD 0x0100
/* extension channel offset (2 bit signed number) */
enum {
- IEEE80211_HTINFO_EXTOFFSET_NA = 0, /* 0 no extension channel is present */
- IEEE80211_HTINFO_EXTOFFSET_ABOVE = 1, /* +1 extension channel above control channel */
- IEEE80211_HTINFO_EXTOFFSET_UNDEF = 2, /* -2 undefined */
+ IEEE80211_HTINFO_EXTOFFSET_NA = 0, /* 0 no extension channel is present */
+ IEEE80211_HTINFO_EXTOFFSET_ABOVE = 1, /* +1 extension channel above control channel */
+ IEEE80211_HTINFO_EXTOFFSET_UNDEF = 2, /* -2 undefined */
IEEE80211_HTINFO_EXTOFFSET_BELOW = 3 /* -1 extension channel below control channel*/
};
/* recommended transmission width set */
enum {
- IEEE80211_HTINFO_TXWIDTH_20,
- IEEE80211_HTINFO_TXWIDTH_2040
+ IEEE80211_HTINFO_TXWIDTH_20,
+ IEEE80211_HTINFO_TXWIDTH_2040
};
/* operating flags */
#define IEEE80211_HTINFO_OPMODE_PURE 0x00 /* no protection */
-#define IEEE80211_HTINFO_OPMODE_MIXED_PROT_OPT 0x01 /* prot optional (legacy device maybe present) */
-#define IEEE80211_HTINFO_OPMODE_MIXED_PROT_40 0x02 /* prot required (20 MHz) */
-#define IEEE80211_HTINFO_OPMODE_MIXED_PROT_ALL 0x03 /* prot required (legacy devices present) */
+#define IEEE80211_HTINFO_OPMODE_MIXED_PROT_OPT 0x01 /* prot optional (legacy device maybe present) */
+#define IEEE80211_HTINFO_OPMODE_MIXED_PROT_40 0x02 /* prot required (20 MHz) */
+#define IEEE80211_HTINFO_OPMODE_MIXED_PROT_ALL 0x03 /* prot required (legacy devices present) */
#define IEEE80211_HTINFO_OPMODE_MASK 0x03 /* For protection 0x00-0x03 */
/* Non-greenfield STAs present */
#define IEEE80211_WEP_EXTIV 0x20
#define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */
#define IEEE80211_WEP_MICLEN 8 /* trailing MIC */
-#define IEEE80211_WEP_ICVLEN 4
+#define IEEE80211_WEP_ICVLEN 4
#define IEEE80211_WAPI_MICLEN 16 /* trailing MIC */
#define IEEE80211_WAPI_IVLEN 16
#define IEEE80211_AID(b) ((b) &~ 0xc000)
-/*
+/*
* RTS frame length parameters. The default is specified in
* the 802.11 spec. The max may be wrong for jumbo frames.
*/
#define IEEE80211_RTS_MIN 1
#define IEEE80211_RTS_MAX 2346
-/*
+/*
* Regulatory extention identifier for country IE.
*/
#define IEEE80211_REG_EXT_ID 201
};
#define IEEE80211_KEYBUF_SIZE 16
-#define IEEE80211_TID_SIZE 17
+#define IEEE80211_TID_SIZE 17
#define IEEE80211_MICBUF_SIZE (8+8) /* space for both tx+rx keys */
struct ieee80211_key_target {
#undef CRYPTO_KEY_TYPE_WAPI
#undef IEEE80211_WLAN_HDR_LEN
}
-#undef IEEE80211_ADDR_LEN
+#undef IEEE80211_ADDR_LEN
/*
* Built-in implementation for local skb free. Only interesting for platforms
* that pass skbs between OS instances.
- */
+ */
#define ieee80211_tgt_free_local_nbuf( _nbuf) ieee80211_tgt_free_nbuf( _nbuf)
return ieee80211_hdrsize(data);
}
+a_status_t
+ieee80211_tgt_crypto_encap(struct ieee80211_frame *wh,
+ struct ieee80211_node_target *ni,
+ a_uint8_t keytype);
+
#endif
#include "if_athvar.h"
#include "ah_desc.h"
#include "ah.h"
+#include "ratectrl.h"
+#include "ah_internal.h"
static a_int32_t ath_numrxbufs = -1;
static a_int32_t ath_numrxdescs = -1;
a_int32_t retval;
a_uint32_t cnt = 0;
a_uint16_t frame_len = 0;
- a_uint64_t tsf;
#define PA2DESC(_sc, _pa) \
((struct ath_desc *)((caddr_t)(_sc)->sc_rxdma.dd_desc + \
((_pa) - (_sc)->sc_rxdma.dd_desc_paddr)))
- tsf = ah->ah_getTsf64(ah);
bf = asf_tailq_first(&sc->sc_rxbuf);
ds = asf_tailq_first(&sc->sc_rxdesc);
struct ath_hal *ah = sc->sc_ah;
struct ath_tx_buf *bf;
a_uint8_t vap_index, *anbdata;
- ath_beacon_hdr_t *bhdr;
- struct ieee80211vap_target *vap;
+ ath_beacon_hdr_t *bhdr = NULL;
a_uint32_t anblen;
- struct ieee80211_frame *wh;
if (!bc_hdr) {
adf_nbuf_peek_header(nbuf, &anbdata, &anblen);
bhdr = (ath_beacon_hdr_t *)anbdata;
} else {
adf_os_print("found bc_hdr! 0x%x\n", bc_hdr);
+ adf_os_assert(0);
}
vap_index = bhdr->vap_index;
adf_os_assert(vap_index < TARGET_VAP_MAX);
- vap = &sc->sc_vap[vap_index].av_vap;
- wh = (struct ieee80211_frame *)adf_nbuf_pull_head(nbuf,
- sizeof(ath_beacon_hdr_t));
+ adf_nbuf_pull_head(nbuf, sizeof(ath_beacon_hdr_t));
bf = sc->sc_vap[vap_index].av_bcbuf;
adf_os_assert(bf);
bf->bf_endpt = EndPt;
bf->bf_cookie = dh->cookie;
+ bf->vap_index = dh->vap_index;
if (tid->flag & TID_AGGR_ENABLED)
ath_tgt_handle_aggr(sc, bf);
ath_bufhead *head, a_int32_t dir)
{
struct ath_buf *bf;
- struct ieee80211_node_target *ni;
asf_tailq_foreach(bf, head, bf_list) {
if (adf_nbuf_queue_len(&bf->bf_skbhead) != 0) {
adf_nbuf_dmamap_destroy(sc->sc_dev, bf->bf_dmamap);
- ni = bf->bf_node;
bf->bf_node = NULL;
}
{
struct ath_softc_tgt *sc = (struct ath_softc_tgt *)Context;
struct ath_hal *ah = sc->sc_ah;
- a_uint32_t intr;
+ a_uint32_t intr = 0;
- if (data)
+ if (datalen == 4)
intr = (*(a_uint32_t *)data);
intr = adf_os_ntohl(intr);
struct ath_hal *ah = sc->sc_ah;
a_uint32_t q;
- if (data)
- q = *(a_uint32_t *)data;
+ if (!datalen)
+ goto done;
+
+ q = *(a_uint32_t *)data;
q = adf_os_ntohl(q);
ah->ah_stopTxDma(ah, q);
+done:
wmi_cmd_rsp(sc->tgt_wmi_handle, Command, SeqNo, NULL, 0);
}
/*-
* Copyright (c) 2002-2004 Sam Leffler, Errno Consulting
* Copyright (c) 2004 Atheros Communications, Inc.
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ *
* All rights reserved.
*
* 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 above copyright
- * notice, this list of conditions and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
- * redistribution must be conditioned upon including a substantially
- * similar Disclaimer requirement for further binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
- * NO WARRANTY
- * 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 NONINFRINGEMENT, MERCHANTIBILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
- *
- * $Id: //depot/sw/branches/fusion_usb/target_firmware/wlan/target/madwifi/ath/if_ath_pci.c#1 $
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
*/
#ifndef EXPORT_SYMTAB
/*-
* Copyright (c) 2002-2004 Sam Leffler, Errno Consulting
* Copyright (c) 2004 Atheros Communications, Inc.
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ *
* All rights reserved.
*
* 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 above copyright
- * notice, this list of conditions and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
- * redistribution must be conditioned upon including a substantially
- * similar Disclaimer requirement for further binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
- * NO WARRANTY
- * 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 NONINFRINGEMENT, MERCHANTIBILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
- *
- * $Id: //depot/sw/branches/fusion_usb/target_firmware/wlan/target/madwifi/ath/if_ath_pci.h#1 $
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
*/
-
+
#ifndef _DEV_ATH_PCI_H_
#define _DEV_ATH_PCI_H_
/*-
* Copyright (c) 2004 Sam Leffler, Errno Consulting
* Copyright (c) 2004 Video54 Technologies, Inc.
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ *
* All rights reserved.
*
* 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 above copyright
- * notice, this list of conditions and the following disclaimer,
- without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
- * redistribution must be conditioned upon including a substantially
- * similar Disclaimer requirement for further binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
- * NO WARRANTY
- * 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 NONINFRINGEMENT, MERCHANTIBILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
- *
- * $Id: //depot/sw/branches/fusion_usb/target_firmware/wlan/target/madwifi/ath/if_athrate.h#2 $
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
*/
#ifndef _ATH_RATECTRL_H_
#define _ATH_RATECTRL_H_
#define ATH_RC_RTSCTS_FLAG 0x10
#define ATH_RC_TX_STBC_FLAG 0x20 /* TX STBC */
#define ATH_RC_RX_STBC_FLAG 0xC0 /* RX STBC ,2 bits */
-#define ATH_RC_RX_STBC_FLAG_S 6
+#define ATH_RC_RX_STBC_FLAG_S 6
#define ATH_RC_WEP_TKIP_FLAG 0x100 /* WEP/TKIP encryption */
enum ath_rc_cwmode{
ATH_RC_CW20_MODE,
- ATH_RC_CW40_MODE,
+ ATH_RC_CW40_MODE,
};
#define ATH_RC_PROBE_ALLOWED 0x00000001
#define ATH_RC_MINRATE_LASTRATE 0x00000002
struct ath_rc_series {
- a_uint8_t rix;
- a_uint8_t tries;
+ a_uint8_t rix;
+ a_uint8_t tries;
u_int8_t tx_chainmask;
a_uint8_t flags;
a_uint32_t max4msframelen;
a_int32_t nframes, a_int32_t nbad);
-void ath_rate_stateupdate(struct ath_softc_tgt *sc, struct ath_node_target *an,
+void ath_rate_stateupdate(struct ath_softc_tgt *sc, struct ath_node_target *an,
enum ath_rc_cwmode cwmode);
+
+void ath_tx_status_update_rate(struct ath_softc_tgt *sc,
+ struct ath_rc_series rcs[],
+ int series,
+ WMI_TXSTATUS_EVENT *txs);
+
#endif /* _ATH_RATECTRL_H_ */
HTC_ENDPOINT_ID bf_endpt;
a_uint16_t al_delta;
a_uint8_t bf_cookie;
+ a_uint8_t vap_index;
};
struct ath_rx_buf
} owl_txq_state_t;
a_uint8_t ath_get_minrateidx(struct ath_softc_tgt *sc, struct ath_vap_target *avp);
+void ath_tgt_tx_cleanup(struct ath_softc_tgt *sc, struct ath_node_target *an,
+ ath_atx_tid_t *tid, a_uint8_t discard_all);
+void ath_tgt_handle_normal(struct ath_softc_tgt *sc, struct ath_tx_buf *bf);
+void ath_tgt_handle_aggr(struct ath_softc_tgt *sc, struct ath_tx_buf *bf);
+void ath_tgt_tid_drain(struct ath_softc_tgt *sc, struct ath_atx_tid *tid);
+void ath_tx_status_clear(struct ath_softc_tgt *sc);
+
+void wmi_event(wmi_handle_t handle, WMI_EVENT_ID evt_id,
+ void *buffer, a_int32_t Length);
#endif /* _DEV_ATH_ATHVAR_H */
/*-
* Copyright (c) 2002-2004 Sam Leffler, Errno Consulting
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ *
* All rights reserved.
*
* 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 above copyright
- * notice, this list of conditions and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
- * redistribution must be conditioned upon including a substantially
- * similar Disclaimer requirement for further binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * 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 name of Qualcomm Atheros nor the names of its
+ * contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
- * NO WARRANTY
- * 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 NONINFRINGEMENT, MERCHANTIBILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
- *
- * $Id: //depot/sw/branches/fusion_usb/target_firmware/wlan/target/madwifi/net80211/if_llc.h#1 $
- * $NetBSD: if_llc.h,v 1.12 1999/11/19 20:41:19 thorpej Exp $
- * $Id: //depot/sw/branches/fusion_usb/target_firmware/wlan/target/madwifi/net80211/if_llc.h#1 $
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. 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 OWNER 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.
*/
-
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
#include "if_athrate.h"
#include "if_athvar.h"
#include "ah_desc.h"
+#include "ah_internal.h"
#define ath_tgt_free_skb adf_nbuf_free
int ath_tgt_tx_add_to_aggr(struct ath_softc_tgt *sc,
struct ath_buf *bf,int datatype,
ath_atx_tid_t *tid, int is_burst);
+int ath_tgt_tx_form_aggr(struct ath_softc_tgt *sc, ath_atx_tid_t *tid,
+ ath_tx_bufhead *bf_q);
struct ieee80211_frame *ATH_SKB_2_WH(adf_nbuf_t skb)
{
static void ath_dma_unmap(struct ath_softc_tgt *sc, struct ath_tx_buf *bf)
{
- adf_nbuf_t skb = bf->bf_skb;
-
- skb = adf_nbuf_queue_first(&bf->bf_skbhead);
+ adf_nbuf_queue_first(&bf->bf_skbhead);
adf_nbuf_unmap( sc->sc_dev, bf->bf_dmamap, ADF_OS_DMA_TO_DEVICE);
}
{
struct ath_hal *ah = sc->sc_ah;
struct ath_txq *txq;
- HAL_STATUS status;
volatile a_int32_t txe_val;
adf_os_assert(bf);
txq = bf->bf_txq;
- status = ah->ah_procTxDesc(ah, bf->bf_lastds);
+ ah->ah_procTxDesc(ah, bf->bf_lastds);
ATH_TXQ_INSERT_TAIL(txq, bf, bf_list);
rcs, &isProbe);
ath_hal_memcpy(bf->bf_rcs, rcs, sizeof(rcs));
} else {
+ struct ath_vap_target *avp;
+
+ avp = &sc->sc_vap[bf->vap_index];
+
mrcs[1].tries = mrcs[2].tries = mrcs[3].tries = 0;
mrcs[1].rix = mrcs[2].rix = mrcs[3].rix = 0;
- mrcs[0].rix = 0;
+ mrcs[0].rix = ath_get_minrateidx(sc, avp);
mrcs[0].tries = 1;
mrcs[0].flags = 0;
ath_hal_memcpy(bf->bf_rcs, mrcs, sizeof(mrcs));
ath_update_stats(struct ath_softc_tgt *sc, struct ath_tx_buf *bf)
{
struct ath_tx_desc *ds = bf->bf_desc;
+ struct ieee80211_frame *wh = ATH_SKB2_WH(bf->bf_skb);
u_int32_t sr, lr;
if (ds->ds_txstat.ts_status == 0) {
if (ds->ds_txstat.ts_rate & HAL_TXSTAT_ALTRATE)
sc->sc_tx_stats.ast_tx_altrate++;
} else {
- if (ds->ds_txstat.ts_status & HAL_TXERR_XRETRY)
+ if (ds->ds_txstat.ts_status & HAL_TXERR_XRETRY &&
+ !IEEE80211_IS_MULTICAST(wh->i_addr1))
sc->sc_tx_stats.ast_tx_xretries++;
if (ds->ds_txstat.ts_status & HAL_TXERR_FIFO)
sc->sc_tx_stats.ast_tx_fifoerr++;
struct ath_tx_desc lastds;
struct ath_tx_desc *ds = &lastds;
struct ath_rc_series rcs[4];
- u_int16_t seq_st;
- u_int32_t *ba;
- int ba_index;
int nbad = 0;
int nframes = bf->bf_nframes;
struct ath_tx_buf *bf_next;
- int tx_ok = 1;
adf_os_mem_copy(ds, bf->bf_lastds, sizeof (struct ath_tx_desc));
adf_os_mem_copy(rcs, bf->bf_rcs, sizeof(rcs));
- seq_st = ATH_DS_BA_SEQ(ds);
- ba = ATH_DS_BA_BITMAP(ds);
- tx_ok = (ATH_DS_TX_STATUS(ds) == HAL_OK);
-
if (!bf->bf_isaggr) {
ath_update_stats(sc, bf);
}
while (bf) {
- ba_index = ATH_BA_INDEX(seq_st, SEQNO_FROM_BF_SEQNO(bf->bf_seqno));
bf_next = bf->bf_next;
ath_tx_status_update_aggr(sc, bf, ds, rcs, 0);
{
struct ath_tx_buf *bf;
struct ath_tx_buf *bf_next;
- struct ath_txq *txq;
-
- txq = TID_TO_ACTXQ(tid->tidno);
bf = asf_tailq_first(&tid->buf_q);
struct ath_tx_desc *ds = bf->bf_lastds;
struct ath_node_target *an;
ath_atx_tid_t *tid;
- struct ath_txq *txq;
an = (struct ath_node_target *)bf->bf_node;
tid = &an->tid[bf->bf_tidno];
- txq = TID_TO_ACTXQ(tid->tidno);
if (ATH_DS_TX_STATUS(ds) & HAL_TXERR_XRETRY) {
ath_bar_retry(sc, bf);
struct ath_hal *ah = sc->sc_ah;
HAL_11N_RATE_SERIES series[4];
int i = 0;
- adf_nbuf_queue_t skbhead;
a_uint8_t *anbdata;
a_uint32_t anblen;
| HAL_TXDESC_CLRDMASK
, 0, 0);
- skbhead = bf->bf_skbhead;
bf->bf_isaggr = 0;
bf->bf_next = NULL;
#define ASSEMBLE_UNALIGNED_UINT16(p,highbyte,lowbyte) \
(((a_uint16_t)(((a_uint8_t *)(p))[(highbyte)])) << 8 | (a_uint16_t)(((a_uint8_t *)(p))[(lowbyte)]))
-
-/* alignment independent macros (little-endian) to fetch UINT16s or UINT8s from a
+
+/* alignment independent macros (little-endian) to fetch UINT16s or UINT8s from a
* structure using only the type and field name.
* Use these macros if there is the potential for unaligned buffer accesses. */
#define A_GET_UINT16_FIELD(p,type,field) \
((a_uint8_t *)(p))[A_OFFSETOF(type,field)] = (a_uint8_t)((value) >> 8); \
((a_uint8_t *)(p))[A_OFFSETOF(type,field) + 1] = (a_uint8_t)(value); \
}
-
+
#define A_GET_UINT8_FIELD(p,type,field) \
((a_uint8_t *)(p))[A_OFFSETOF(type,field)]
-
+
#define A_SET_UINT8_FIELD(p,type,field,value) \
((a_uint8_t *)(p))[A_OFFSETOF(type,field)] = (value)
/****** DANGER DANGER ***************
- *
+ *
* The frame header length and message formats defined herein were
* selected to accommodate optimal alignment for target processing. This reduces code
* size and improves performance.
- *
+ *
* Any changes to the header length may alter the alignment and cause exceptions
* on the target. When adding to the message structures insure that fields are
* properly aligned.
- *
+ *
*/
/* endpoint defines */
{
ENDPOINT_UNUSED = -1,
ENDPOINT0 = 0, /* this is reserved for the control endpoint */
- ENDPOINT1 = 1,
- ENDPOINT2 = 2,
+ ENDPOINT1 = 1,
+ ENDPOINT2 = 2,
ENDPOINT3 = 3,
ENDPOINT4,
ENDPOINT5,
a_uint8_t EndpointID;
a_uint8_t Flags;
a_uint16_t PayloadLen; /* length of data (including trailer) that follows the header */
-
+
/***** end of 4-byte lookahead ****/
-
+
a_uint8_t ControlBytes[4];
-
+
/* message payload starts after the header */
-
+
} POSTPACK HTC_FRAME_HDR;
/* frame header flags */
typedef enum {
HTC_MSG_READY_ID = 1,
HTC_MSG_CONNECT_SERVICE_ID = 2,
- HTC_MSG_CONNECT_SERVICE_RESPONSE_ID = 3,
+ HTC_MSG_CONNECT_SERVICE_RESPONSE_ID = 3,
HTC_MSG_SETUP_COMPLETE_ID = 4,
HTC_MSG_CONFIG_PIPE_ID = 5,
HTC_MSG_CONFIG_PIPE_RESPONSE_ID = 6,
} HTC_MSG_IDS;
-
+
#define HTC_MAX_CONTROL_MESSAGE_LENGTH 256
-
+
/* base message ID header */
typedef PREPACK struct {
- a_uint16_t MessageID;
+ a_uint16_t MessageID;
} POSTPACK HTC_UNKNOWN_MSG;
-
+
/* HTC ready message
* direction : target-to-host */
typedef PREPACK struct {
a_uint16_t MessageID; /* ID */
- a_uint16_t CreditCount; /* number of credits the target can offer */
+ a_uint16_t CreditCount; /* number of credits the target can offer */
a_uint16_t CreditSize; /* size of each credit */
a_uint8_t MaxEndpoints; /* maximum number of endpoints the target has resources for */
a_uint8_t _Pad1;
* direction : host-to-target */
typedef PREPACK struct {
a_uint16_t MessageID;
- a_uint16_t ServiceID; /* service ID of the service to connect to */
+ a_uint16_t ServiceID; /* service ID of the service to connect to */
a_uint16_t ConnectionFlags; /* connection flags */
a_uint8_t DownLinkPipeID;
a_uint8_t UpLinkPipeID;
-#define HTC_CONNECT_FLAGS_REDUCE_CREDIT_DRIBBLE (1 << 2) /* reduce credit dribbling when
- the host needs credits */
-#define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_MASK (0x3)
+#define HTC_CONNECT_FLAGS_REDUCE_CREDIT_DRIBBLE (1 << 2) /* reduce credit dribbling when
+ the host needs credits */
+#define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_MASK (0x3)
#define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_ONE_FOURTH 0x0
#define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_ONE_HALF 0x1
#define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_THREE_FOURTHS 0x2
#define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_UNITY 0x3
-
+
a_uint8_t ServiceMetaLength; /* length of meta data that follows */
a_uint8_t _Pad1;
-
+
/* service-specific meta data starts after the header */
-
+
} POSTPACK HTC_CONNECT_SERVICE_MSG;
/* connect response
typedef PREPACK struct {
a_uint16_t MessageID;
a_uint16_t ServiceID; /* service ID that the connection request was made */
- a_uint8_t Status; /* service connection status */
+ a_uint8_t Status; /* service connection status */
a_uint8_t EndpointID; /* assigned endpoint ID */
a_uint16_t MaxMsgSize; /* maximum expected message size on this endpoint */
a_uint8_t ServiceMetaLength; /* length of meta data that follows */
- a_uint8_t _Pad1;
-
+ a_uint8_t _Pad1;
+
/* service-specific meta data starts after the header */
-
+
} POSTPACK HTC_CONNECT_SERVICE_RESPONSE_MSG;
typedef PREPACK struct {
* direction : host-to-target */
typedef PREPACK struct {
a_uint16_t MessageID;
- a_uint8_t PipeID; /* Pipe ID of the service to connect to */
- a_uint8_t CreditCount; /* CreditCount */
- //a_uint8_t _Pad1;
+ a_uint8_t PipeID; /* Pipe ID of the service to connect to */
+ a_uint8_t CreditCount; /* CreditCount */
+ //a_uint8_t _Pad1;
} POSTPACK HTC_CONFIG_PIPE_MSG;
/* config pipe
* direction : host-to-target */
typedef PREPACK struct {
a_uint16_t MessageID;
- a_uint8_t PipeID; /* Pipe ID of the service to connect to */
- a_uint8_t Status; /* status */
- //a_uint8_t _Pad1;
+ a_uint8_t PipeID; /* Pipe ID of the service to connect to */
+ a_uint8_t Status; /* status */
+ //a_uint8_t _Pad1;
} POSTPACK HTC_CONFIG_PIPE_RESPONSE_MSG;
/* connect response status codes */
#define HTC_SERVICE_SUCCESS 0 /* success */
#define HTC_SERVICE_NOT_FOUND 1 /* service could not be found */
#define HTC_SERVICE_FAILED 2 /* specific service failed the connect */
-#define HTC_SERVICE_NO_RESOURCES 3 /* no resources (i.e. no more endpoints) */
-#define HTC_SERVICE_NO_MORE_EP 4 /* specific service is not allowing any more
+#define HTC_SERVICE_NO_RESOURCES 3 /* no resources (i.e. no more endpoints) */
+#define HTC_SERVICE_NO_MORE_EP 4 /* specific service is not allowing any more
endpoints */
/* shihhung: config pipe response status code */
typedef enum {
HTC_RECORD_NULL = 0,
HTC_RECORD_CREDITS = 1,
- HTC_RECORD_LOOKAHEAD = 2,
+ HTC_RECORD_LOOKAHEAD = 2,
} HTC_RPT_IDS;
typedef PREPACK struct {
a_uint8_t Credits; /* credits to report since last report */
} POSTPACK HTC_CREDIT_REPORT;
-typedef PREPACK struct {
+typedef PREPACK struct {
a_uint8_t PreValid; /* pre valid guard */
a_uint8_t LookAhead[4]; /* 4 byte lookahead */
a_uint8_t PostValid; /* post valid guard */
-
+
/* NOTE: the LookAhead array is guarded by a PreValid and Post Valid guard bytes.
* The PreValid bytes must equal the inverse of the PostValid byte */
-
+
} POSTPACK HTC_LOOKAHEAD_REPORT;
#ifndef ATH_TARGET
typedef enum {
RSVD_SERVICE_GROUP = 0,
- WMI_SERVICE_GROUP = 1,
-
+ WMI_SERVICE_GROUP = 1,
+
HTC_TEST_GROUP = 254,
HTC_SERVICE_GROUP_LAST = 255
} HTC_SERVICE_GROUP_IDS;
#define HTC_LOOPBACK_RSVD_SVC MAKE_SERVICE_ID(RSVD_SERVICE_GROUP,2)
#define WMI_CONTROL_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP,0)
-#define WMI_BEACON_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP,1)
-#define WMI_CAB_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP,2)
+#define WMI_BEACON_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP,1)
+#define WMI_CAB_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP,2)
#define WMI_UAPSD_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP,3)
#define WMI_MGMT_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP,4)
#define ATH_VERSION_MAJOR 1
#define ATH_VERSION_MINOR 4
-
+
/************************** HAL configurations **************************/
#define HAL_DESC_OPTIMIZATION
#define ATH_NO_VIRTUAL_MEMORY
//#define ATH_SUPPORT_XB_ONLY
-#define ATH_SUPPORT_A_MODE
+#define ATH_SUPPORT_A_MODE
#define ATH_VERSION_MAJOR 1
#define ATH_VERSION_MINOR 4
} POSTPACK ath_mgt_hdr_t;
typedef struct _beacon_header {
- a_uint8_t vap_index;
- a_uint8_t len_changed;
+ a_uint8_t vap_index;
+ a_uint8_t len_changed;
a_uint16_t reserved;
} ath_beacon_hdr_t;
a_uint8_t ni_index;
a_uint8_t vap_index;
a_uint8_t tidno;
- a_uint32_t flags;
+ a_uint32_t flags;
a_int8_t keytype;
a_int8_t keyix;
a_uint8_t cookie;
#define VAP_TARGET_SIZE 12
-struct ieee80211vap_target
+struct ieee80211vap_target
{
a_uint8_t iv_vapindex;
a_uint8_t iv_opmode; /* enum ieee80211_opmode */
a_uint32_t ast_tx_altrate; /* tx frames with alternate rate */
a_uint32_t ast_tx_protect; /* tx frames with protection */
- a_uint32_t tx_tgt; /* tx data pkts recieved on target */
+ a_uint32_t tx_tgt; /* tx data pkts recieved on target */
a_uint32_t tx_qnull; /* txq empty occurences */
a_uint32_t txaggr_nframes; /* no. of frames aggregated */
- a_uint32_t tx_compunaggr; /* tx unaggregated frame completions */
+ a_uint32_t tx_compunaggr; /* tx unaggregated frame completions */
a_uint32_t tx_compaggr; /* tx aggregated completions */
a_uint32_t txaggr_retries; /* tx retries of sub frames */
a_uint32_t txaggr_single; /* tx frames not aggregated */
a_uint8_t tidno;
a_uint8_t aggr_enable;
a_uint8_t padding;
-};
+};
struct wmi_data_delba {
a_uint8_t ni_nodeindex;
a_uint16_t minor;
};
-#endif
+#endif
typedef PREPACK struct {
- a_int8_t rssi;
+ a_int8_t rssi;
a_uint8_t info; /* WMI_MSG_TYPE in lower 2 bits - b1b0 */
/* UP in next 3 bits - b4b3b2 */
#define WMI_DATA_HDR_MSG_TYPE_MASK 0x03
#define WMI_DATA_HDR_MSG_TYPE_SHIFT 0
#define WMI_DATA_HDR_UP_MASK 0x07
-#define WMI_DATA_HDR_UP_SHIFT 2
+#define WMI_DATA_HDR_UP_SHIFT 2
#define WMI_DATA_HDR_IS_MSG_TYPE(h, t) (((h)->info & (WMI_DATA_HDR_MSG_TYPE_MASK)) == (t))
} POSTPACK WMI_DATA_HDR;
WMI_FRAME_PROBE_RESP,
WMI_FRAME_ASSOC_REQ,
WMI_FRAME_ASSOC_RESP,
- WMI_NUM_MGMT_FRAME
+ WMI_NUM_MGMT_FRAME
} WMI_MGMT_FRAME_TYPE;
/*
} DOT11_AUTH_MODE;
typedef enum {
- NONE_AUTH = 0x01,
+ NONE_AUTH = 0x01,
WPA_AUTH = 0x02,
WPA_PSK_AUTH = 0x03,
WPA2_AUTH = 0x04,
#define RX_FLIP_THRESHOLD 3 /* XXX */
-#ifdef MAGPIE_MERLIN
+#ifdef MAGPIE_MERLIN
#define MAX_TX_RATE_TBL 46
#else
#define MAX_TX_RATE_TBL 54//46
typedef struct phy_rate_ctrl {
/* 11n state */
A_UINT8 validPhyRateCount[WLAN_RC_PHY_MAX]; /* valid rate count */
- A_UINT8 validPhyRateIndex[WLAN_RC_PHY_MAX][MAX_TX_RATE_TBL]; /* index */
+ A_UINT8 validPhyRateIndex[WLAN_RC_PHY_MAX][MAX_TX_RATE_TBL]; /* index */
}PHY_STATE_CTRL;
/* per-node state */
/*
* Determines and returns the new Tx rate index.
- */
+ */
A_UINT16 rcRateFind(struct ath_softc_tgt *, struct atheros_node *,
A_UINT32 frameLen,const RATE_TABLE *pRateTable);
void ar5416AttachRateTables(struct atheros_softc *sc);
+void ath_rate_node_update(struct ath_softc_tgt *sc,
+ struct ath_node_target *an,
+ a_int32_t isnew,
+ a_uint32_t capflag,
+ struct ieee80211_rate *rs);
+
+
+void ath_rate_newstate(struct ath_softc_tgt *sc,
+ struct ieee80211vap_target *vap,
+ enum ieee80211_state state,
+ a_uint32_t capflag,
+ struct ieee80211_rate *rs);
+
#endif /* _RATECTRL_H_ */
* used only in 20 mode. If both 20/40 bits are enabled
* then that rate can be used for both 20 and 40 mode */
-#define TRUE_20 0x2
-#define TRUE_40 0x4
+#define TRUE_20 0x2
+#define TRUE_40 0x4
#define TRUE_2040 (TRUE_20|TRUE_40)
#define TRUE_ALL_11N (TRUE_2040|TRUE)
#define WLAN_RC_PHY_DS(_phy) ((_phy == WLAN_RC_PHY_HT_20_DS) \
|| (_phy == WLAN_RC_PHY_HT_40_DS) \
|| (_phy == WLAN_RC_PHY_HT_20_DS_HGI) \
- || (_phy == WLAN_RC_PHY_HT_40_DS_HGI))
+ || (_phy == WLAN_RC_PHY_HT_40_DS_HGI))
#define WLAN_RC_PHY_40(_phy) ((_phy == WLAN_RC_PHY_HT_40_SS) \
|| (_phy == WLAN_RC_PHY_HT_40_DS) \
|| (_phy == WLAN_RC_PHY_HT_40_SS_HGI) \
- || (_phy == WLAN_RC_PHY_HT_40_DS_HGI))
+ || (_phy == WLAN_RC_PHY_HT_40_DS_HGI))
#define WLAN_RC_PHY_20(_phy) ((_phy == WLAN_RC_PHY_HT_20_SS) \
|| (_phy == WLAN_RC_PHY_HT_20_DS) \
|| (_phy == WLAN_RC_PHY_HT_20_SS_HGI) \
- || (_phy == WLAN_RC_PHY_HT_20_DS_HGI))
+ || (_phy == WLAN_RC_PHY_HT_20_DS_HGI))
#define WLAN_RC_PHY_SGI(_phy) ((_phy == WLAN_RC_PHY_HT_20_SS_HGI) \
|| (_phy == WLAN_RC_PHY_HT_20_DS_HGI) \
|| (_phy == WLAN_RC_PHY_HT_40_SS_HGI) \
- || (_phy == WLAN_RC_PHY_HT_40_DS_HGI))
+ || (_phy == WLAN_RC_PHY_HT_40_DS_HGI))
#define WLAN_RC_PHY_HT(_phy) (_phy >= WLAN_RC_PHY_HT_20_SS)
#define WLAN_RC_WEP_TKIP_FLAG (0x100)
/* Index into the rate table */
-#define INIT_RATE_MAX_20 23
+#define INIT_RATE_MAX_20 23
#define INIT_RATE_MAX_40 40
/*
A_BOOL validSingleStream;/* Valid for use in rate control for single stream operation */
#ifdef MAGPIE_MERLIN
A_BOOL validSTBC; /* Valid for use in rate control for single stream operation */
-#endif
+#endif
WLAN_PHY phy; /* CCK/OFDM/TURBO/XR */
A_UINT32 rateKbps; /* Rate in Kbits per second */
A_UINT32 userRateKbps; /* User rate in KBits per second */
/*
* Determines and returns the new Tx rate index.
- */
+ */
void rcRateFind_11n(struct ath_softc_tgt *sc,
struct ath_node_target *an,
int numTries,
int nBad,
int sh_lo_retry);
-void ath_tx_status_update_rate(struct ath_softc_tgt *sc,
- struct ath_rc_series rcs[],
- int series,
- WMI_TXSTATUS_EVENT *txs);
-
#endif /* _RATECTRL11N_H_ */
#include "ratectrl.h"
#include "ratectrl11n.h"
-static void ath_rate_newassoc_11n(struct ath_softc_tgt *sc, struct ath_node_target *an, int isnew,
+static void ath_rate_newassoc_11n(struct ath_softc_tgt *sc, struct ath_node_target *an, int isnew,
unsigned int capflag, struct ieee80211_rate *rs);
-static void ath_rate_tx_complete_11n(struct ath_softc_tgt *sc, struct ath_node_target *an,
+static void ath_rate_tx_complete_11n(struct ath_softc_tgt *sc, struct ath_node_target *an,
struct ath_tx_desc *ds,
- struct ath_rc_series rcs[], int nframes,
+ struct ath_rc_series rcs[], int nframes,
int nbad);
static void ath_rate_findrate_11n(struct ath_softc_tgt *sc,
for (i=pRc->maxValidRate-1; i > 0; i--) {
for (j=0; j <= i-1; j++) {
-#ifdef MAGPIE_MERLIN
+#ifdef MAGPIE_MERLIN
if (pRateTable->info[pRc->validRateIndex[j]].rateKbps >
pRateTable->info[pRc->validRateIndex[j+1]].rateKbps)
#else
/* Iterators for validTxRateMask */
static INLINE A_BOOL
-rcGetNextValidTxRate(const RATE_TABLE_11N *pRateTable, TX_RATE_CTRL *pRc,
+rcGetNextValidTxRate(const RATE_TABLE_11N *pRateTable, TX_RATE_CTRL *pRc,
A_UINT8 curValidTxRate, A_UINT8 *pNextIndex)
{
A_UINT8 i;
/* No more valid rates */
*pNextIndex = 0;
-
+
return FALSE;
}
static INLINE A_BOOL
-rcGetNextLowerValidTxRate(const RATE_TABLE_11N *pRateTable, TX_RATE_CTRL *pRc,
+rcGetNextLowerValidTxRate(const RATE_TABLE_11N *pRateTable, TX_RATE_CTRL *pRc,
A_UINT8 curValidTxRate, A_UINT8 *pNextIndex)
{
A_INT8 i;
return FALSE;
}
}
-
+
return TRUE;
}
-/*
- * Initialize the Valid Rate Index from valid entries in Rate Table
+/*
+ * Initialize the Valid Rate Index from valid entries in Rate Table
*/
static A_UINT8 rcSibInitValidRates(const RATE_TABLE_11N *pRateTable,
TX_RATE_CTRL *pRc,
A_UINT8 i, hi = 0;
A_UINT8 singleStream = (capflag & WLAN_RC_DS_FLAG) ? 0 : 1;
A_UINT8 valid;
-
+
for (i = 0; i < pRateTable->rateCount; i++) {
if (singleStream) {
valid = pRateTable->info[i].validSingleStream;
} else {
valid = pRateTable->info[i].valid;
}
-
+
if (valid == TRUE) {
A_UINT32 phy = pRateTable->info[i].phy;
- if (!rcIsValidPhyRate(phy, capflag, FALSE))
+ if (!rcIsValidPhyRate(phy, capflag, FALSE))
continue;
pPhyStateCtrl->validPhyRateIndex[phy][pPhyStateCtrl->validPhyRateCount[phy]] = i;
hi = A_MAX(hi, i);
}
- }
-
+ }
+
return hi;
}
-/*
- * Initialize the Valid Rate Index from Rate Set
+/*
+ * Initialize the Valid Rate Index from Rate Set
*/
static A_UINT8
rcSibSetValidRates(const RATE_TABLE_11N *pRateTable,
- TX_RATE_CTRL *pRc,
+ TX_RATE_CTRL *pRc,
struct ieee80211_rateset *pRateSet,
A_UINT32 capflag,
struct ath_node_target *an,
A_UINT8 i, j, hi = 0;
A_UINT8 singleStream = (capflag & WLAN_RC_DS_FLAG) ? 0 : 1;
A_UINT32 valid;
-
+
/* Use intersection of working rates and valid rates */
for (i = 0; i < pRateSet->rs_nrates; i++) {
for (j = 0; j < pRateTable->rateCount; j++) {
} else if (singleStream) {
#else
if (singleStream) {
-#endif
+#endif
valid = pRateTable->info[j].validSingleStream;
} else {
valid = pRateTable->info[j].valid;
}
-
+
/*
* We allow a rate only if its valid and the capflag matches one of
* the validity (TRUE/TRUE_20/TRUE_40) flags
*/
- if (((pRateSet->rs_rates[i] & 0x7F) ==
+ if (((pRateSet->rs_rates[i] & 0x7F) ==
(pRateTable->info[j].dot11Rate & 0x7F))
- && ((valid & WLAN_RC_CAP_MODE(capflag)) ==
+ && ((valid & WLAN_RC_CAP_MODE(capflag)) ==
WLAN_RC_CAP_MODE(capflag)) && !WLAN_RC_PHY_HT(phy)) {
- if (!rcIsValidPhyRate(phy, capflag, FALSE))
+ if (!rcIsValidPhyRate(phy, capflag, FALSE))
continue;
pPhyStateCtrl->validPhyRateIndex[phy][pPhyStateCtrl->validPhyRateCount[phy]] = j;
}
}
}
-
+
return hi;
}
static A_UINT8
rcSibSetValidHtRates(const RATE_TABLE_11N *pRateTable,
- TX_RATE_CTRL *pRc,
+ TX_RATE_CTRL *pRc,
A_UINT8 *pMcsSet,
A_UINT32 capflag,
struct ath_node_target *an,
A_UINT8 i, j, hi = 0;
A_UINT8 singleStream = (capflag & WLAN_RC_DS_FLAG) ? 0 : 1;
A_UINT8 valid;
-
+
/* Use intersection of working rates and valid rates */
for (i = 0; i < ((struct ieee80211_rateset *)pMcsSet)->rs_nrates; i++) {
for (j = 0; j < pRateTable->rateCount; j++) {
} else {
valid = pRateTable->info[j].valid;
}
-
- if (((((struct ieee80211_rateset *)pMcsSet)->rs_rates[i] & 0x7F)
- != (pRateTable->info[j].dot11Rate & 0x7F))
- || !WLAN_RC_PHY_HT(phy)
+
+ if (((((struct ieee80211_rateset *)pMcsSet)->rs_rates[i] & 0x7F)
+ != (pRateTable->info[j].dot11Rate & 0x7F))
+ || !WLAN_RC_PHY_HT(phy)
|| !WLAN_RC_PHY_HT_VALID(valid, capflag)
- || ((pRateTable->info[j].dot11Rate == 15) &&
- (valid & TRUE_20) &&
+ || ((pRateTable->info[j].dot11Rate == 15) &&
+ (valid & TRUE_20) &&
(capflag & WLAN_RC_WEP_TKIP_FLAG)) )
{
continue;
}
-
- if (!rcIsValidPhyRate(phy, capflag, FALSE))
+
+ if (!rcIsValidPhyRate(phy, capflag, FALSE))
continue;
-
+
pPhyStateCtrl->validPhyRateIndex[phy][pPhyStateCtrl->validPhyRateCount[phy]] = j;
pPhyStateCtrl->validPhyRateCount[phy] += 1;
struct atheros_softc *asc = (struct atheros_softc*)sc->sc_rc;
A_UINT8 *phtMcs = (A_UINT8*)&pRateSet->htrates;
TX_RATE_CTRL *pRc = (TX_RATE_CTRL *)(pSib);
- PHY_STATE_CTRL mPhyCtrlState;
+ PHY_STATE_CTRL mPhyCtrlState;
A_UINT8 i, j, k, hi = 0, htHi = 0;
for (i = 0; i < WLAN_RC_PHY_MAX; i++) {
for (j = 0; j < MAX_TX_RATE_TBL; j++) {
mPhyCtrlState.validPhyRateIndex[i][j] = 0;
- }
+ }
mPhyCtrlState.validPhyRateCount[i] = 0;
}
pRc->rateTableSize = hi + 1;
pRc->rateMaxPhy = 0;
-
+
ASSERT(pRc->rateTableSize <= MAX_TX_RATE_TBL);
for (i = 0, k = 0; i < WLAN_RC_PHY_MAX; i++) {
for (j = 0; j < mPhyCtrlState.validPhyRateCount[i]; j++) {
pRc->validRateIndex[k++] = mPhyCtrlState.validPhyRateIndex[i][j];
- }
+ }
if (!rcIsValidPhyRate(i, pRateTable->initialRateMax, TRUE) ||
- !mPhyCtrlState.validPhyRateCount[i])
+ !mPhyCtrlState.validPhyRateCount[i])
continue;
- pRc->rateMaxPhy = mPhyCtrlState.validPhyRateIndex[i][j-1];
+ pRc->rateMaxPhy = mPhyCtrlState.validPhyRateIndex[i][j-1];
}
-
+
ASSERT(pRc->rateTableSize <= MAX_TX_RATE_TBL);
ASSERT(k <= MAX_TX_RATE_TBL);
rcRateFind_ht(struct ath_softc_tgt *sc, struct atheros_node *pSib,
const RATE_TABLE_11N *pRateTable, A_BOOL probeAllowed, A_BOOL *isProbing)
{
- A_UINT32 dt;
A_UINT32 bestThruput, thisThruput;
A_UINT32 nowMsec;
A_UINT8 rate, nextRate, bestRate;
*/
nowMsec = A_MS_TICKGET();
- dt = nowMsec - pRc->rssiTime;
/*
* Now look up the rate in the rssi table and return it.
minIndex = 0;
bestRate = minIndex;
-
+
/*
* Try the higher rate first. It will reduce memory moving time
* if we have very good channel characteristics.
*/
for (index = maxIndex; index >= minIndex ; index--) {
A_UINT8 perThres;
-
+
rate = pRc->validRateIndex[index];
if (rate > pRc->rateMaxPhy) {
continue;
}
/* if the best throughput is already larger than the userRateKbps..
- * then we could skip of rest of calculation..
+ * then we could skip of rest of calculation..
*/
if( bestThruput >= pRateTable->info[rate].userRateKbps)
break;
/* Probe the next allowed phy state */
/* FIXME: Check to make sure ratMax is checked properly */
- if (rcGetNextValidTxRate( pRateTable, pRc, rate, &nextRate) &&
+ if (rcGetNextValidTxRate( pRateTable, pRc, rate, &nextRate) &&
(nowMsec - pRc->probeTime > pRateTable->probeInterval) &&
(pRc->hwMaxRetryPktCnt >= 1))
{
A_BOOL rtsctsenable, A_UINT32 chainmask,int stbc)
{
series->tries = tries;
- series->flags = (rtsctsenable? ATH_RC_RTSCTS_FLAG : 0) |
- (WLAN_RC_PHY_DS(pRateTable->info[rix].phy) ? ATH_RC_DS_FLAG : 0) |
- (WLAN_RC_PHY_40(pRateTable->info[rix].phy) ? ATH_RC_CW40_FLAG : 0) |
+ series->flags = (rtsctsenable? ATH_RC_RTSCTS_FLAG : 0) |
+ (WLAN_RC_PHY_DS(pRateTable->info[rix].phy) ? ATH_RC_DS_FLAG : 0) |
+ (WLAN_RC_PHY_40(pRateTable->info[rix].phy) ? ATH_RC_CW40_FLAG : 0) |
(WLAN_RC_PHY_SGI(pRateTable->info[rix].phy) ? ATH_RC_HT40_SGI_FLAG : 0);
#ifdef MAGPIE_MERLIN
if (stbc) {
/* For now, only single stream STBC is supported */
- if (pRateTable->info[rix].rateCode >= 0x80 &&
+ if (pRateTable->info[rix].rateCode >= 0x80 &&
pRateTable->info[rix].rateCode <= 0x87)
{
series->flags |= ATH_RC_TX_STBC_FLAG;
series->max4msframelen = pRateTable->info[rix].max4msframelen;
series->txrateKbps = pRateTable->info[rix].rateKbps;
- /* If the hardware is capable of multiple transmit chains (chainmask is 3, 5 or 7),
+ /* If the hardware is capable of multiple transmit chains (chainmask is 3, 5 or 7),
* then choose the number of transmit chains dynamically based on entries in the rate table.
*/
#ifndef ATH_ENABLE_WLAN_FOR_K2
if(chainmask == 7)
series->tx_chainmask = pRateTable->info[rix].txChainMask_3ch;
- else if(chainmask == 1)
+ else if(chainmask == 1)
series->tx_chainmask = 1;
- else
+ else
series->tx_chainmask = pRateTable->info[rix].txChainMask_2ch; /*Chainmask is 3 or 5*/
#else
series->tx_chainmask = 1;
#endif
}
-static A_UINT8
-rcRateGetIndex(struct ath_softc_tgt *sc, struct ath_node_target *an,
- const RATE_TABLE_11N *pRateTable ,
+static A_UINT8
+rcRateGetIndex(struct ath_softc_tgt *sc, struct ath_node_target *an,
+ const RATE_TABLE_11N *pRateTable ,
A_UINT8 rix, A_UINT16 stepDown, A_UINT16 minRate)
{
A_UINT32 j;
A_UINT8 nextIndex;
struct atheros_node *pSib = ATH_NODE_ATHEROS(an);
TX_RATE_CTRL *pRc = (TX_RATE_CTRL *)(pSib);
-
+
if (minRate) {
for (j = RATE_TABLE_11N_SIZE; j > 0; j-- ) {
if (rcGetNextLowerValidTxRate(pRateTable, pRc, rix, &nextIndex)) {
return rix;
}
-void rcRateFind_11n(struct ath_softc_tgt *sc, struct ath_node_target *an,
+void rcRateFind_11n(struct ath_softc_tgt *sc, struct ath_node_target *an,
int numTries, int numRates, int stepDnInc,
unsigned int rcflag, struct ath_rc_series series[], int *isProbe)
{
- A_UINT8 i = 0;
+ A_UINT8 i = 0;
A_UINT8 tryPerRate = 0;
struct atheros_softc *asc = (struct atheros_softc*)sc->sc_rc;
RATE_TABLE_11N *pRateTable = (RATE_TABLE_11N *)asc->hwRateTable[sc->sc_curmode];
A_UINT8 dot11Rate;
WLAN_PHY phy;
- rix = rcRateFind_ht(sc, asn, pRateTable, (rcflag & ATH_RC_PROBE_ALLOWED) ? 1 : 0,
+ rix = rcRateFind_ht(sc, asn, pRateTable, (rcflag & ATH_RC_PROBE_ALLOWED) ? 1 : 0,
isProbe);
nrix = rix;
/* set one try for probe rates. For the probes don't enable rts */
rcRateSetseries(pRateTable, &series[i++], 1, nrix,
FALSE, asc->tx_chainmask, asn->stbc);
-
+
/*
* Get the next tried/allowed rate. No RTS for the next series
* after the probe rate
/*
* BUG 26545:
- * Change rate series to enable aggregation when operating at lower MCS rates.
+ * Change rate series to enable aggregation when operating at lower MCS rates.
* When first rate in series is MCS2 in HT40 @ 2.4GHz, series should look like:
* {MCS2, MCS1, MCS0, MCS0}.
* When first rate in series is MCS3 in HT20 @ 2.4GHz, series should look like:
dot11Rate = pRateTable->info[rix].dot11Rate;
phy = pRateTable->info[rix].phy;
if (i == 4 &&
- ((dot11Rate == 2 && phy == WLAN_RC_PHY_HT_40_SS) ||
- (dot11Rate == 3 && phy == WLAN_RC_PHY_HT_20_SS)))
+ ((dot11Rate == 2 && phy == WLAN_RC_PHY_HT_40_SS) ||
+ (dot11Rate == 3 && phy == WLAN_RC_PHY_HT_20_SS)))
{
series[3].rix = series[2].rix;
series[3].flags = series[2].flags;
if (sc->sc_curmode == IEEE80211_MODE_11NG) {
dot11Rate = pRateTable->info[rix].dot11Rate;
if (dot11Rate <= 3 ) {
- series[0].flags |= ATH_RC_RTSCTS_FLAG;
+ series[0].flags |= ATH_RC_RTSCTS_FLAG;
}
}
}
static void
-rcUpdate_ht(struct ath_softc_tgt *sc, struct ath_node_target *an, int txRate,
- A_BOOL Xretries, int retries, A_UINT8 curTxAnt,
+rcUpdate_ht(struct ath_softc_tgt *sc, struct ath_node_target *an, int txRate,
+ A_BOOL Xretries, int retries, A_UINT8 curTxAnt,
A_UINT16 nFrames, A_UINT16 nBad)
{
TX_RATE_CTRL *pRc;
ASSERT(retries >= 0 && retries < MAX_TX_RETRIES);
ASSERT(txRate >= 0);
-
+
if (txRate < 0) {
return;
}
}
/* new_PER = 7/8*old_PER + 1/8*(currentPER) */
- pRc->state[txRate].per = (A_UINT8)(pRc->state[txRate].per -
+ pRc->state[txRate].per = (A_UINT8)(pRc->state[txRate].per -
(pRc->state[txRate].per / 8) + ((100) / 8));
}
* of the sum of these two terms.
*/
if (nFrames > 0)
- pRc->state[txRate].per = (A_UINT8)(pRc->state[txRate].per -
- (pRc->state[txRate].per / 8) +
+ pRc->state[txRate].per = (A_UINT8)(pRc->state[txRate].per -
+ (pRc->state[txRate].per / 8) +
((100*(retries*nFrames + nBad)/(nFrames*(retries+1))) / 8));
} else {
/* new_PER = 7/8*old_PER + 1/8*(currentPER) */
- pRc->state[txRate].per = (A_UINT8)(pRc->state[txRate].per -
+ pRc->state[txRate].per = (A_UINT8)(pRc->state[txRate].per -
(pRc->state[txRate].per / 8) + (nRetry2PerLookup[retries] / 8));
}
/* For all cases */
- ASSERT((pRc->rateMaxPhy >= 0 && pRc->rateMaxPhy <= pRc->rateTableSize &&
+ ASSERT((pRc->rateMaxPhy >= 0 && pRc->rateMaxPhy <= pRc->rateTableSize &&
pRc->rateMaxPhy != INVALID_RATE_MAX));
-
+
/*
* If this rate looks bad (high PER) then stop using it for
* a while (except if we are probing).
*/
if (pRc->state[txRate].per >= 55 && txRate > 0 &&
- pRateTable->info[txRate].rateKbps <=
+ pRateTable->info[txRate].rateKbps <=
pRateTable->info[pRc->rateMaxPhy].rateKbps)
{
- rcGetNextLowerValidTxRate(pRateTable, pRc, (A_UINT8) txRate,
+ rcGetNextLowerValidTxRate(pRateTable, pRc, (A_UINT8) txRate,
&pRc->rateMaxPhy);
/* Don't probe for a little while. */
* the status of previous frames.
*/
void rcUpdate_11n(struct ath_softc_tgt *sc, struct ath_node_target *an,
- A_UINT8 curTxAnt,
+ A_UINT8 curTxAnt,
int finalTSIdx, int Xretries,
- struct ath_rc_series rcs[], int nFrames,
+ struct ath_rc_series rcs[], int nFrames,
int nBad, int long_retry)
{
A_UINT32 series = 0;
if (rcs[series].tries != 0) {
flags = rcs[series].flags;
/* If HT40 and we have switched mode from 40 to 20 => don't update */
- if ((flags & ATH_RC_CW40_FLAG) &&
+ if ((flags & ATH_RC_CW40_FLAG) &&
(pRc->rcPhyMode != (flags & ATH_RC_CW40_FLAG))) {
return;
}
}
/* FIXME:XXXX, too many args! */
- rcUpdate_ht(sc, an, rix, Xretries? 1 : 2, rcs[series].tries,
+ rcUpdate_ht(sc, an, rix, Xretries? 1 : 2, rcs[series].tries,
curTxAnt, nFrames, nFrames);
}
}
flags = rcs[series].flags;
/* If HT40 and we have switched mode from 40 to 20 => don't update */
- if ((flags & ATH_RC_CW40_FLAG) &&
+ if ((flags & ATH_RC_CW40_FLAG) &&
(pRc->rcPhyMode != (flags & ATH_RC_CW40_FLAG))) {
return;
}
}
/* FIXME:XXXX, too many args! */
- rcUpdate_ht(sc, an, rix, Xretries, long_retry, curTxAnt,
+ rcUpdate_ht(sc, an, rix, Xretries, long_retry, curTxAnt,
nFrames, nBad);
}
ar5416AttachRateTables(asc);
asc->tx_chainmask = 1;
-
+
return &asc->arc;
}
ath_rate_tx_complete(struct ath_softc_tgt *sc,
struct ath_node_target *an,
struct ath_tx_desc *ds,
- struct ath_rc_series rcs[],
+ struct ath_rc_series rcs[],
int nframes, int nbad)
{
ath_rate_tx_complete_11n(sc, an, ds, rcs, nframes, nbad);
}
void
-ath_rate_newassoc(struct ath_softc_tgt *sc, struct ath_node_target *an, int isnew,
+ath_rate_newassoc(struct ath_softc_tgt *sc, struct ath_node_target *an, int isnew,
unsigned int capflag, struct ieee80211_rate *rs)
{
ath_rate_newassoc_11n(sc, an, isnew, capflag, rs);
{
struct ieee80211_node_target *ni = &an->ni;
- ath_rate_newassoc(sc, ATH_NODE_TARGET(ni), isnew, capflag, rs);
+ ath_rate_newassoc(sc, ATH_NODE_TARGET(ni), isnew, capflag, rs);
}
static int init_ath_rate_atheros(void);
ath_rate_tx_complete_11n(struct ath_softc_tgt *sc,
struct ath_node_target *an,
struct ath_tx_desc *ds,
- struct ath_rc_series rcs[],
+ struct ath_rc_series rcs[],
int nframes, int nbad)
{
int finalTSIdx = ds->ds_txstat.ts_rate;
int tx_status = 0;
if ((ds->ds_txstat.ts_status & HAL_TXERR_XRETRY) ||
- (ds->ds_txstat.ts_status & HAL_TXERR_FIFO) ||
+ (ds->ds_txstat.ts_status & HAL_TXERR_FIFO) ||
(ds->ds_txstat.ts_flags & HAL_TX_DATA_UNDERRUN) ||
(ds->ds_txstat.ts_flags & HAL_TX_DELIM_UNDERRUN)) {
tx_status = 1;
}
static void
-ath_rate_newassoc_11n(struct ath_softc_tgt *sc, struct ath_node_target *an, int isnew,
+ath_rate_newassoc_11n(struct ath_softc_tgt *sc, struct ath_node_target *an, int isnew,
unsigned int capflag, struct ieee80211_rate *rs)
{
if (isnew) {