#!/usr/bin/python import sys import re import idl def libxl_C_instance_of(ty, instancename): if isinstance(ty, idl.Aggregate) and ty.typename is None: if instancename is None: return libxl_C_type_define(ty) else: return libxl_C_type_define(ty) + " " + instancename s = "" if isinstance(ty, idl.Array): s += libxl_C_instance_of(ty.lenvar.type, ty.lenvar.name) + ";\n" return s + ty.typename + " " + instancename def libxl_C_type_define(ty, indent = ""): s = "" if isinstance(ty, idl.Enumeration): if ty.typename is None: s += "enum {\n" else: s += "typedef enum %s {\n" % ty.typename for v in ty.values: x = "%s = %d" % (v.name, v.value) x = x.replace("\n", "\n ") s += " " + x + ",\n" if ty.typename is None: s += "}" else: s += "} %s" % ty.typename elif isinstance(ty, idl.Aggregate): if isinstance(ty, idl.KeyedUnion): s += libxl_C_instance_of(ty.keyvar.type, ty.keyvar.name) + ";\n" if ty.typename is None: s += "%s {\n" % ty.kind else: s += "typedef %s %s {\n" % (ty.kind, ty.typename) for f in ty.fields: x = libxl_C_instance_of(f.type, f.name) if f.const: x = "const " + x x = x.replace("\n", "\n ") s += " " + x + ";\n" if ty.typename is None: s += "}" else: s += "} %s" % ty.typename else: raise NotImplementedError("%s" % type(ty)) return s.replace("\n", "\n%s" % indent) def libxl_C_type_dispose(ty, v, indent = " ", parent = None): s = "" if isinstance(ty, idl.KeyedUnion): if parent is None: raise Exception("KeyedUnion type must have a parent") s += "switch (%s) {\n" % (parent + ty.keyvar.name) for f in ty.fields: (nparent,fexpr) = ty.member(v, f, parent is None) s += "case %s:\n" % f.enumname s += libxl_C_type_dispose(f.type, fexpr, indent + " ", nparent) s += " break;\n" s += "}\n" elif isinstance(ty, idl.Array): if parent is None: raise Exception("Array type must have a parent") if ty.elem_type.dispose_fn is not None: s += "{\n" s += " int i;\n" s += " for (i=0; i<%s; i++)\n" % (parent + ty.lenvar.name) s += libxl_C_type_dispose(ty.elem_type, v+"[i]", indent + " ", parent) if ty.dispose_fn is not None: if ty.elem_type.dispose_fn is not None: s += " " s += "%s(%s);\n" % (ty.dispose_fn, ty.pass_arg(v, parent is None)) if ty.elem_type.dispose_fn is not None: s += "}\n" elif isinstance(ty, idl.Struct) and (parent is None or ty.dispose_fn is None): for f in [f for f in ty.fields if not f.const]: (nparent,fexpr) = ty.member(v, f, parent is None) s += libxl_C_type_dispose(f.type, fexpr, "", nparent) else: if ty.dispose_fn is not None: s += "%s(%s);\n" % (ty.dispose_fn, ty.pass_arg(v, parent is None)) if s != "": s = indent + s return s.replace("\n", "\n%s" % indent).rstrip(indent) def libxl_init_members(ty, nesting = 0): """Returns a list of members of ty which require a separate init""" if isinstance(ty, idl.Aggregate): return [f for f in ty.fields if not f.const and isinstance(f.type,idl.KeyedUnion)] else: return [] def _libxl_C_type_init(ty, v, indent = " ", parent = None, subinit=False): s = "" if isinstance(ty, idl.KeyedUnion): if parent is None: raise Exception("KeyedUnion type must have a parent") if subinit: s += "switch (%s) {\n" % (parent + ty.keyvar.name) for f in ty.fields: (nparent,fexpr) = ty.member(v, f, parent is None) s += "case %s:\n" % f.enumname s += _libxl_C_type_init(f.type, fexpr, " ", nparent) s += " break;\n" s += "}\n" else: if ty.keyvar.init_val: s += "%s = %s;\n" % (parent + ty.keyvar.name, ty.keyvar.init_val) elif ty.keyvar.type.init_val: s += "%s = %s;\n" % (parent + ty.keyvar.name, ty.keyvar.type.init_val) elif isinstance(ty, idl.Struct) and (parent is None or ty.init_fn is None): for f in [f for f in ty.fields if not f.const]: (nparent,fexpr) = ty.member(v, f, parent is None) if f.init_val is not None: s += "%s = %s;\n" % (fexpr, f.init_val) else: s += _libxl_C_type_init(f.type, fexpr, "", nparent) else: if ty.init_val is not None: s += "%s = %s;\n" % (ty.pass_arg(v, parent is None), ty.init_val) elif ty.init_fn is not None: s += "%s(%s);\n" % (ty.init_fn, ty.pass_arg(v, parent is None)) if s != "": s = indent + s return s.replace("\n", "\n%s" % indent).rstrip(indent) def libxl_C_type_init(ty): s = "" s += "void %s(%s)\n" % (ty.init_fn, ty.make_arg("p", passby=idl.PASS_BY_REFERENCE)) s += "{\n" s += " memset(p, '\\0', sizeof(*p));\n" s += _libxl_C_type_init(ty, "p") s += "}\n" s += "\n" return s def libxl_C_type_member_init(ty, field): if not isinstance(field.type, idl.KeyedUnion): raise Exception("Only KeyedUnion is supported for member init") ku = field.type s = "" s += "void %s(%s, %s)\n" % (ty.init_fn + "_" + ku.keyvar.name, ty.make_arg("p", passby=idl.PASS_BY_REFERENCE), ku.keyvar.type.make_arg(ku.keyvar.name)) s += "{\n" if ku.keyvar.init_val is not None: init_val = ku.keyvar.init_val elif ku.keyvar.type.init_val is not None: init_val = ku.keyvar.type.init_val else: init_val = None (nparent,fexpr) = ty.member(ty.pass_arg("p"), ku.keyvar, isref=True) if init_val is not None: s += " assert(%s == %s);\n" % (fexpr, init_val) else: s += " assert(!%s);\n" % (fexpr) s += " %s = %s;\n" % (fexpr, ku.keyvar.name) (nparent,fexpr) = ty.member(ty.pass_arg("p"), field, isref=True) s += _libxl_C_type_init(ku, fexpr, parent=nparent, subinit=True) s += "}\n" s += "\n" return s def libxl_C_type_gen_json(ty, v, indent = " ", parent = None): s = "" if parent is None: s += "yajl_gen_status s;\n" if isinstance(ty, idl.Array): if parent is None: raise Exception("Array type must have a par
#
# Copyright (C) 2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ath10k-firmware
PKG_SOURCE_VERSION:=69f955c3dd95d97c7c30960aa5c9852c80b85cc3
PKG_VERSION:=2014-11-13-$(PKG_SOURCE_VERSION)
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git
PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
include $(INCLUDE_DIR)/package.mk
WMENU:=Wireless Drivers
define Package/ath10k-firmware-default
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=$(WMENU)
URL:=$(PKG_SOURCE_URL)
DEPENDS:=kmod-ath10k
endef
define Package/ath10k-firmware-qca988x
$(Package/ath10k-firmware-default)
DEFAULT:=PACKAGE_kmod-ath10k
TITLE:=ath10k firmware for QCA988x devices
endef
define Package/ath10k-firmware-qca99x0
$(Package/ath10k-firmware-default)
TITLE:=ath10k firmware for QCA99x0 devices
endef
define Package/ath10k-firmware-qca6174
$(Package/ath10k-firmware-default)
TITLE:=ath10k firmware for QCA6174 devices
endef
QCA99X0_BOARD_REV:=ddcec9efd245da9365c474f513a855a55f3ac7fe
QCA99X0_BOARD_FILE:=board-2.bin.$(QCA99X0_BOARD_REV)
define Download/qca99x0-board
URL:=https://www.codeaurora.org/cgit/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0
URL_FILE:=board-2.bin?id=ddcec9efd245da9365c474f513a855a55f3ac7fe
FILE:=$(QCA99X0_BOARD_FILE)
MD5SUM:=a2b3c653c2363a5641200051d6333d0a
endef
$(eval $(call Download,qca99x0-board))
define Build/Compile
endef
define Package/ath10k-firmware-qca988x/install
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
$(INSTALL_DATA) \
$(PKG_BUILD_DIR)/QCA988X/board.bin \
$(1)/lib/firmware/ath10k/QCA988X/hw2.0/
$(INSTALL_DATA) \
$(PKG_BUILD_DIR)/QCA988X/10.2.4/firmware-5.bin_10.2.4.70.12-2 \
$(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin
endef
define Package/ath10k-firmware-qca6174/install
$(INSTALL_DIR) $(1)/lib/firmware/ath10k
$(CP) $(PKG_BUILD_DIR)/QCA6174 $(1)/lib/firmware/ath10k/
endef
define Package/ath10k-firmware-qca99x0/install
$(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
$(INSTALL_DATA) \
$(DL_DIR)/$(QCA99X0_BOARD_FILE) \
$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
$(INSTALL_DATA) \
$(PKG_BUILD_DIR)/QCA99X0/hw2.0/boardData_AR900B_CUS239_5G_v2_001.bin \
$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
$(INSTALL_DATA) \
$(PKG_BUILD_DIR)/QCA99X0/hw2.0/firmware-5.bin_10.4.1.00030-1 \
$(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
endef
$(eval $(call BuildPackage,ath10k-firmware-qca988x))
$(eval $(call BuildPackage,ath10k-firmware-qca99x0))
$(eval $(call BuildPackage,ath10k-firmware-qca6174))