From 00cb9df7b817384bb9751fe6acaab29f0dd6a404 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Wed, 31 Mar 2010 11:12:33 +0000 Subject: [PATCH] adds voip support SVN-Revision: 20637 --- package/ifx-tapi/Config.in | 71 +++ package/ifx-tapi/Makefile | 70 +++ .../ifx-tapi/patches/001-portability.patch | 26 + package/ifx-tapi/patches/100-ifxmips.patch | 108 ++++ package/ifx-tapidemo/Config.in | 36 ++ package/ifx-tapidemo/Makefile | 70 +++ package/ifx-tapidemo/files/bringup_tapidemo | 89 ++++ .../ifx-tapidemo/patches/100-ifxmips.patch | 78 +++ .../patches/110-no_echo_cancelation.patch | 12 + package/ifx-vmmc/Config.in | 49 ++ package/ifx-vmmc/Makefile | 151 ++++++ package/ifx-vmmc/files/vmmc.init | 25 + .../ifx-vmmc/patches/001-portability.patch | 26 + package/ifx-vmmc/patches/100-ifxmips.patch | 491 ++++++++++++++++++ package/ifxos/Makefile | 2 +- 15 files changed, 1303 insertions(+), 1 deletion(-) create mode 100644 package/ifx-tapi/Config.in create mode 100644 package/ifx-tapi/Makefile create mode 100644 package/ifx-tapi/patches/001-portability.patch create mode 100644 package/ifx-tapi/patches/100-ifxmips.patch create mode 100644 package/ifx-tapidemo/Config.in create mode 100644 package/ifx-tapidemo/Makefile create mode 100644 package/ifx-tapidemo/files/bringup_tapidemo create mode 100644 package/ifx-tapidemo/patches/100-ifxmips.patch create mode 100644 package/ifx-tapidemo/patches/110-no_echo_cancelation.patch create mode 100644 package/ifx-vmmc/Config.in create mode 100644 package/ifx-vmmc/Makefile create mode 100644 package/ifx-vmmc/files/vmmc.init create mode 100644 package/ifx-vmmc/patches/001-portability.patch create mode 100644 package/ifx-vmmc/patches/100-ifxmips.patch diff --git a/package/ifx-tapi/Config.in b/package/ifx-tapi/Config.in new file mode 100644 index 0000000000..56defb3dd1 --- /dev/null +++ b/package/ifx-tapi/Config.in @@ -0,0 +1,71 @@ +config VOICE_CPE_TAPI_FAX + bool "fax relay and modem support" + default n + help + Option to enable fax/modem support in TAPI. + Note: Newer platforms as AR9 and VR9 support a T.38 fax relay stack + in FW while older platforms like Danube or VINETIC-CPE require a + separate SW stack executed as an application. + +config VOICE_CPE_TAPI_CID + bool "CID support" + default y + help + Option to enable Caller ID support. + +config VOICE_CPE_TAPI_LT_GR909 + bool "Linetesting GR-909 support" + default y + help + Option to enable linetesting GR-909. + +config VOICE_CPE_TAPI_DECT + bool "DECT encoding for COSIC modem" + default n + help + Option to enable DECT encoding for COSIC modem. + +config VOICE_CPE_TAPI_KPI + bool "KPI (Kernel Packet Interface)" + default y + help + Option to enable the generic kernel level packet interface + which allows accelerated packet transfer for various purposes. + The most important example is the QOS option, which allows + to redirect RTP packets directly into the IP stack. + Other options relying on KPI are DECT and HDLC. + +config VOICE_CPE_TAPI_QOS + bool "QOS for accelerated RTP packet handling" + default y + help + Option to enable an accelerated RTP packet transfer inside + the LINUX kernel space. This option requires the KPI2UDP + packet, which actually provides the OS specific hooks in + the IP stack. + +config VOICE_CPE_TAPI_STATISTICS + bool "TAPI statistics via /proc fs" + default y + help + Option to enable /proc fs statistics for packet counts etc. + +config VOICE_CPE_TAPI_METERING + bool "Metering (TTX) support" + default n + help + Option to enable metering (TTX) support. + +config VOICE_CPE_TAPI_HDLC + bool "PCM HDLC support, evaluation" + default n + help + Option to enable PCM HDLC framing inside the firmware, e.g. for + ISDN D-Channel access. + +config VOICE_CPE_TAPI_TRACES + bool "enable driver traces" + default y + help + enable driver traces with different trace levels to be + configured dynamically from the application or during insmod diff --git a/package/ifx-tapi/Makefile b/package/ifx-tapi/Makefile new file mode 100644 index 0000000000..fe91ad015c --- /dev/null +++ b/package/ifx-tapi/Makefile @@ -0,0 +1,70 @@ +# +# Copyright (C) 2008 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=drv_tapi +PKG_VERSION:=3.11.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=drv_tapi-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources +PKG_MD5SUM:=1ffee83ce69f55915468c309d8ae2138 + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/ifx-tapi + SUBMENU:=Voice over IP + TITLE:=Lantiq TAPI subsystem + URL:=http://www.lantiq.com/ + MAINTAINER:=Lantiq + DEPENDS:=+kmod-ifxos @BROKEN + FILES:=$(PKG_BUILD_DIR)/src/drv_tapi.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,20,drv_tapi) +endef + +define KernelPackage/ifx-tapi/description + Voice Subsystem Telephony API High Level Driver +endef + +define KernelPackage/ifx-tapi/config + if PACKAGE_kmod-ifx-tapi + source "$(SOURCE)/Config.in" + endif +endef + +CONFIGURE_ARGS += \ + ARCH=$(LINUX_KARCH) \ + --enable-linux-26 \ + --enable-kernelbuild="$(LINUX_DIR)" \ + --enable-kernelincl="$(LINUX_DIR)/include" \ + --with-ifxos-incl=$(STAGING_DIR)/usr/include/ifxos \ + $(call autoconf_bool,CONFIG_IFX_DRV_TAPI_EVENT_LOGGER,el-debug) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_FAX,fax t38) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_CID,cid) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_DECT,dect) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_KPI,kpi) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_QOS,qos) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_LT_GR909,lt) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_STATISTICS,statistics) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_METERING,metering) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_HDLC,hdlc) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_TRACES,trace) + +define Build/Configure + (cd $(PKG_BUILD_DIR); aclocal && autoconf && automake) + $(call Build/Configure/Default) +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include/drv_tapi + $(CP) --dereference $(PKG_BUILD_DIR)/include/* $(1)/usr/include/drv_tapi + (cd $(1)/usr/include/drv_tapi && ln -s . include && ln -s ../ifxos/ifx_types.h .) +endef + +$(eval $(call KernelPackage,ifx-tapi)) diff --git a/package/ifx-tapi/patches/001-portability.patch b/package/ifx-tapi/patches/001-portability.patch new file mode 100644 index 0000000000..807a64b125 --- /dev/null +++ b/package/ifx-tapi/patches/001-portability.patch @@ -0,0 +1,26 @@ +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -149,7 +149,7 @@ if KERNEL_2_6 + drv_tapi_OBJS = "$(subst .c,.o, $(drv_tapi_SOURCES))" + + drv_tapi.ko: $(drv_tapi_SOURCES) $(EXTRA_DIST) +- @echo -e "Making Linux 2.6.x kernel object" ++ @echo "Making Linux 2.6.x kernel object" + @for f in $(drv_tapi_SOURCES) ; do \ + if test ! -e $(PWD)/$$f; then \ + echo " LN $$f" ; \ +@@ -157,10 +157,10 @@ drv_tapi.ko: $(drv_tapi_SOURCES) $(EXTRA + ln -s @abs_srcdir@/$$f $(PWD)/$$f; \ + fi; \ + done; +- @echo -e "# drv_tapi: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild +- @echo -e "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild +- @echo -e "$(subst .ko,,$@)-y := $(drv_tapi_OBJS)" >> $(PWD)/Kbuild +- @echo -e "EXTRA_CFLAGS := -DHAVE_CONFIG_H $(CFLAGS) $(drv_tapi_CFLAGS) $(INCLUDES)" >> $(PWD)/Kbuild ++ @echo "# drv_tapi: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild ++ @echo "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild ++ @echo "$(subst .ko,,$@)-y := $(drv_tapi_OBJS)" >> $(PWD)/Kbuild ++ @echo "EXTRA_CFLAGS := -DHAVE_CONFIG_H $(CFLAGS) $(drv_tapi_CFLAGS) $(INCLUDES)" >> $(PWD)/Kbuild + $(MAKE) ARCH=@KERNEL_ARCH@ -C @KERNEL_BUILD_PATH@ O=@KERNEL_BUILD_PATH@ M=$(PWD) modules + + clean-generic: diff --git a/package/ifx-tapi/patches/100-ifxmips.patch b/package/ifx-tapi/patches/100-ifxmips.patch new file mode 100644 index 0000000000..bce831c080 --- /dev/null +++ b/package/ifx-tapi/patches/100-ifxmips.patch @@ -0,0 +1,108 @@ +--- a/src/drv_tapi_linux.c ++++ b/src/drv_tapi_linux.c +@@ -544,7 +544,7 @@ static ssize_t ifx_tapi_write (struct fi + IFX_uint8_t *pData; + IFX_size_t buf_size; + #endif /* TAPI_PACKET */ +- IFX_ssize_t size = 0; ++ ssize_t size = 0; + + #ifdef TAPI_PACKET + if (pTapiDev->bInitialized == IFX_FALSE) +@@ -3600,7 +3600,11 @@ IFX_void_t TAPI_OS_ThreadKill(IFXOS_Thre + flag and released after the down() call. */ + lock_kernel(); + mb(); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) + kill_proc(pThrCntrl->tid, SIGKILL, 1); ++#else ++ kill_pid(find_vpid(pThrCntrl->tid), SIGKILL, 1); ++#endif + /* release the big kernel lock */ + unlock_kernel(); + wait_for_completion (&pThrCntrl->thrCompletion); +--- a/src/drv_tapi_osmap.h ++++ b/src/drv_tapi_osmap.h +@@ -17,39 +17,6 @@ + */ + + #include "ifx_types.h" /* ifx type definitions */ +- +-#ifndef HAVE_IFX_ULONG_T +- #warning please update your ifx_types.h, using local definition of IFX_ulong_t +- /* unsigned long type - valid for 32bit systems only */ +- typedef unsigned long IFX_ulong_t; +- #define HAVE_IFX_ULONG_T +-#endif /* HAVE_IFX_ULONG_T */ +- +-#ifndef HAVE_IFX_LONG_T +- #warning please update your ifx_types.h, using local definition of IFX_long_t +- /* long type - valid for 32bit systems only */ +- typedef long IFX_long_t; +- #define HAVE_IFX_LONG_T +-#endif /* HAVE_IFX_LONG_T */ +- +-#ifndef HAVE_IFX_INTPTR_T +- #warning please update your ifx_types.h, using local definition of IFX_intptr_t +- typedef IFX_long_t IFX_intptr_t; +- #define HAVE_IFX_INTPTR_T +-#endif /* HAVE_IFX_INTPTR_T */ +- +-#ifndef HAVE_IFX_SIZE_T +- #warning please update your ifx_types.h, using local definition of IFX_size_t +- typedef IFX_ulong_t IFX_size_t; +- #define HAVE_IFX_SIZE_T +-#endif /* HAVE_IFX_SIZE_T */ +- +-#ifndef HAVE_IFX_SSIZE_T +- #warning please update your ifx_types.h, using local definition of IFX_ssize_t +- typedef IFX_long_t IFX_ssize_t; +- #define HAVE_IFX_SSIZE_T +-#endif /* HAVE_IFX_SSIZE_T */ +- + #include "ifxos_interrupt.h" + #include "ifxos_memory_alloc.h" + #include "ifxos_copy_user_space.h" +--- a/include/drv_tapi_ll_interface.h ++++ b/include/drv_tapi_ll_interface.h +@@ -40,13 +40,6 @@ + #include "ifxos_select.h" + #endif /* TAPI_PACKET */ + +-#ifndef HAVE_IFX_ULONG_T +- #warning please update your ifx_types.h, using local definition of IFX_ulong_t +- /* unsigned long type - valid for 32bit systems only */ +- typedef unsigned long IFX_ulong_t; +- #define HAVE_IFX_ULONG_T +-#endif /* HAVE_IFX_ULONG_T */ +- + /* ============================= */ + /* Local Macros Definitions */ + /* ============================= */ +--- a/src/lib/lib_bufferpool/lib_bufferpool.c ++++ b/src/lib/lib_bufferpool/lib_bufferpool.c +@@ -80,24 +80,6 @@ + #include + #endif /* LINUX */ + +- +-/* ============================= */ +-/* Extra type definitions */ +-/* ============================= */ +-#ifndef HAVE_IFX_ULONG_T +- #warning please update your ifx_types.h, using local definition of IFX_ulong_t +- /* unsigned long type - valid for 32bit systems only */ +- typedef unsigned long IFX_ulong_t; +- #define HAVE_IFX_ULONG_T +-#endif /* HAVE_IFX_ULONG_T */ +- +-#ifndef HAVE_IFX_UINTPTR_T +- #warning please update your ifx_types.h, using local definition of IFX_uintptr_t +- typedef IFX_ulong_t IFX_uintptr_t; +- #define HAVE_IFX_UINTPTR_T +-#endif /* HAVE_IFX_UINTPTR_T */ +- +- + /* ============================= */ + /* Local Macros & Definitions */ + /* ============================= */ diff --git a/package/ifx-tapidemo/Config.in b/package/ifx-tapidemo/Config.in new file mode 100644 index 0000000000..32594ba9cb --- /dev/null +++ b/package/ifx-tapidemo/Config.in @@ -0,0 +1,36 @@ +choice + prompt "board selection" + default VOICE_CPE_TAPIDEMO_BOARD_EASY50712_V3 if TARGET_ifxmips_platform_danube + default VOICE_CPE_TAPIDEMO_BOARD_EASY508xx if TARGET_ifxmips_platform_ar9 + default VOICE_CPE_TAPIDEMO_BOARD_EASY80910 if TARGET_ifxmips_platform_vr9 + default VOICE_CPE_TAPIDEMO_BOARD_EASY50812 + help + Select the target platform. + + config VOICE_CPE_TAPIDEMO_BOARD_EASY50712 + bool "Danube reference board" + + config VOICE_CPE_TAPIDEMO_BOARD_EASY50712_V3 + bool "Danube reference board V3" + + config VOICE_CPE_TAPIDEMO_BOARD_EASY508xx + bool "AR9/GR9 reference board" + + config VOICE_CPE_TAPIDEMO_BOARD_EASY80910 + bool "VR9 reference board" +endchoice + +config VOICE_CPE_TAPIDEMO_QOS + bool "enable QOS support" + default n + help + Option to enable the KPI2UDP RTP packet acceleration path + (highly recommended for VoIP). + +config VOICE_CPE_TAPIDEMO_FAX_T.38_FW + bool "enable T.38 fax relay" + depends on (TARGET_ifxmips_platform_ar9 || TARGET_ifxmips_platform_vr9) + default n + help + enable T.38 fax relay demo. + diff --git a/package/ifx-tapidemo/Makefile b/package/ifx-tapidemo/Makefile new file mode 100644 index 0000000000..217d4641a5 --- /dev/null +++ b/package/ifx-tapidemo/Makefile @@ -0,0 +1,70 @@ +# +# Copyright (C) 2008 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id: $ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=tapidemo +PKG_VERSION:=5.0.1.27 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources +PKG_MD5SUM:=a38a7bf3242aad607f50f57b988bc87c + +include $(INCLUDE_DIR)/package.mk + +define Package/ifx-tapidemo + SECTION:=utils + CATEGORY:=Utilities + TITLE:=TAPIdemo application for Lantiq boards + URL:=http://www.lantiq.com/ + MAINTAINER:=Lantiq + DEPENDS:=+kmod-ifx-tapi +kmod-ifx-vmmc @BROKEN +endef + +define Package/ifx-tapidemo/description + Voice Access mini-PBX Demo Application +endef + +define Package/ifx-tapidemo/config + if PACKAGE_ifx-tapidemo + source "$(SOURCE)/Config.in" + endif +endef + +CONFIGURE_ARGS += \ + ARCH=$(LINUX_KARCH) \ + --enable-linux-26 \ + --enable-kernelincl="$(LINUX_DIR)/include" \ + --with-drvincl="$(STAGING_DIR)/usr/include" \ + $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_QOS,qos) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_TAPIDEMO_FAX_T,fax-t38) \ + --enable-trace \ + --enable-fs + +ifeq ($(CONFIG_VOICE_CPE_TAPIDEMO_BOARD_EASY50712),y) + CONFIGURE_ARGS += --enable-boardname=EASY50712 +endif +ifeq ($(CONFIG_VOICE_CPE_TAPIDEMO_BOARD_EASY50712_V3),y) + CONFIGURE_ARGS += --enable-boardname=EASY50712_V3 +endif +ifeq ($(CONFIG_VOICE_CPE_TAPIDEMO_BOARD_EASY508xx),y) + CONFIGURE_ARGS += --enable-boardname=EASY508XX +endif +ifeq ($(CONFIG_VOICE_CPE_TAPIDEMO_BOARD_EASY80910),y) + CONFIGURE_ARGS += --enable-boardname=EASY508XX +endif + +define Package/ifx-tapidemo/install + $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/tapidemo $(1)/usr/sbin + $(INSTALL_BIN) ./files/bringup_tapidemo $(1)/etc/init.d/tapidemo +endef + +$(eval $(call BuildPackage,ifx-tapidemo)) diff --git a/package/ifx-tapidemo/files/bringup_tapidemo b/package/ifx-tapidemo/files/bringup_tapidemo new file mode 100644 index 0000000000..e3abd56390 --- /dev/null +++ b/package/ifx-tapidemo/files/bringup_tapidemo @@ -0,0 +1,89 @@ +#!/bin/sh /etc/rc.common +# (C) 2008 openwrt.org + +START=96 + +[ ! -f /dev/vmmc10 ] && { + mknod /dev/vmmc10 c 122 10 + mknod /dev/vmmc11 c 122 11 + mknod /dev/vmmc12 c 122 12 + mknod /dev/vmmc13 c 122 13 + mknod /dev/vmmc14 c 122 14 + mknod /dev/vmmc15 c 122 15 + mknod /dev/vmmc16 c 122 16 + mknod /dev/vmmc17 c 122 17 + mknod /dev/vmmc18 c 122 18 +} + +TD_EXTRA_FLAGS_FXO= +TD_EXTRA_FLAGS_KPI2UDP= +TD_DOWNLOAD_PATH=/opt/lantiq/downloads/ +DEV_NODE_TERIDIAN=ter10 + + # Show help +help() +{ + echo "Usage:" + echo " - $0 WAN-IF-NAME - start TAPIDEMO without FXO support" + echo " - $0 WAN-IF-NAME fxo - start TAPIDEMO with FXO support." + echo " - $0 stop - stop TAPIDEMO" +} + +# Check if device node for Teridian exists +checkFxoSupport() +{ + if [ ! -e /dev/$DEV_NODE_TERIDIAN ];then + echo "FXO support is disabled. Can not find required driver's device node." + else + TD_EXTRA_FLAGS_FXO="-x" + fi +} + +# Check if module drv_kpi2udp is loaded +checkKpi2UdpSupport() +{ + tmp=`cat /proc/modules | grep 'drv_kpi2udp '` + if [ "$tmp" != "" ]; then + TD_EXTRA_FLAGS_KPI2UDP="-q" + fi +} + +start() +{ + TD_WANIF=$1 + + TD_WANIF_IP=`ifconfig $TD_WANIF | grep 'inet addr:' | cut -f2 -d: | cut -f1 -d' '` + if [ "$TD_WANIF_IP" = "" ]; then + echo "Error, getting IP address for network device $TD_WANIF failed." + exit 1 + fi + + if [ "$2" = "" ];then + # FXO support is disabled. + continue + elif [ "$2" = "fxo" ];then + checkFxoSupport + else + echo "Error, unknown second parameter." + help + exit 1 + fi + + checkKpi2UdpSupport + + if [ -r /etc/rc.conf ]; then + . /etc/rc.conf + fi + + TD_DEBUG_LEVEL=$tapiDebugLevel + if [ "$TD_DEBUG_LEVEL" = "" ]; then + TD_DEBUG_LEVEL=3 + fi + + /usr/sbin/tapidemo -d $TD_DEBUG_LEVEL $TD_EXTRA_FLAGS_FXO $TD_EXTRA_FLAGS_KPI2UDP -i $TD_WANIF_IP -l $TD_DOWNLOAD_PATH & +} + +stop() +{ + killall tapidemo > /dev/null 2> /dev/null +} diff --git a/package/ifx-tapidemo/patches/100-ifxmips.patch b/package/ifx-tapidemo/patches/100-ifxmips.patch new file mode 100644 index 0000000000..43fa988ef7 --- /dev/null +++ b/package/ifx-tapidemo/patches/100-ifxmips.patch @@ -0,0 +1,78 @@ +--- a/src/board_easy50712.c Mon Mar 15 14:47:53 2010 +0300 ++++ b/src/board_easy50712.c Tue Mar 16 17:25:55 2010 +0300 +@@ -40,7 +40,9 @@ + #endif /* DUSLIC_FXO */ + #endif /* EASY50712_V3 */ + +-#include "asm/ifx/ifx_gpio.h" ++#ifdef FXO ++# include "asm/ifx/ifx_gpio.h" ++#endif + + /* ============================= */ + /* Defines */ +@@ -896,6 +898,7 @@ + /* Global function definition */ + /* ============================= */ + ++#ifdef FXO + /** + Set direction of GPIO pin to out which is used for set/clear reset. + +@@ -944,7 +947,7 @@ + return IFX_SUCCESS; + } + break; +- ++ + case GPIO_DUSLIC_EASY50510: + { + TRACE(TAPIDEMO, DBG_LEVEL_LOW, +@@ -982,8 +985,9 @@ + + return IFX_SUCCESS; + }; ++#endif + +- ++#ifdef FXO + /* + Set/Clear reset of device by using GPIO port. + +@@ -1086,7 +1090,9 @@ + /* usleep(100000); karol - workaround, */ + return ret; + } ++#endif + ++#ifdef EASY50510 + /** + Set PCM master mode. + +@@ -1178,15 +1184,16 @@ + + return ret; + } ++#endif + + /** + Register board. + + \param pBoard - pointer to board +- ++ + \return IFX_SUCCESS if successful, otherwise IFX_ERROR. + +- \remarks ++ \remarks + */ + IFX_return_t BOARD_Easy50712_Register(BOARD_t* pBoard) + { +@@ -1204,7 +1211,3 @@ + pBoard->RemoveBoard = BOARD_Easy50712_RemoveBoard; + return IFX_SUCCESS; + } +- +- +- +- diff --git a/package/ifx-tapidemo/patches/110-no_echo_cancelation.patch b/package/ifx-tapidemo/patches/110-no_echo_cancelation.patch new file mode 100644 index 0000000000..d424d48470 --- /dev/null +++ b/package/ifx-tapidemo/patches/110-no_echo_cancelation.patch @@ -0,0 +1,12 @@ +Index: tapidemo-5.0.1.27/src/device_vmmc.c +=================================================================== +--- tapidemo-5.0.1.27.orig/src/device_vmmc.c 2009-11-09 15:40:31.000000000 +0100 ++++ tapidemo-5.0.1.27/src/device_vmmc.c 2010-03-30 21:32:51.000000000 +0200 +@@ -240,7 +240,6 @@ + TRACE(TAPIDEMO, DBG_LEVEL_HIGH, + ("Error, BBD file %s is not found.\n(File: %s, line: %d)\n", + pCpuDevice->pszBBD_CRAM_File, __FILE__, __LINE__)); +- return IFX_ERROR; + } + + #endif /* USE_FILESYSTEM */ diff --git a/package/ifx-vmmc/Config.in b/package/ifx-vmmc/Config.in new file mode 100644 index 0000000000..bd3c032d3a --- /dev/null +++ b/package/ifx-vmmc/Config.in @@ -0,0 +1,49 @@ +choice + prompt "device selection" + default VOICE_CPE_VMMC_WITH_DEVICE_DANUBE_extract + help + Select the target device. + + config VOICE_CPE_VMMC_WITH_DEVICE_DANUBE_extract + bool "Danube, Twinpass, Vinax - extract binaries" + + config VOICE_CPE_VMMC_WITH_DEVICE_DANUBE + bool "Danube, Twinpass, Vinax" + + config VOICE_CPE_VMMC_WITH_DEVICE_AR9 + bool "AR9 family" + + config VOICE_CPE_VMMC_WITH_DEVICE_VR9 + bool "VR9 family" + +endchoice + +config VOICE_CPE_VMMC_PMC + depends on (VOICE_CPE_VMMC_WITH_DEVICE_AR9 || VOICE_CPE_VMMC_WITH_DEVICE_VR9) + bool "Power Management Control support" + default n + help + Option to enable Power Management Control on AR9, VR9. Not supported for Danube. + +config VOICE_CPE_VMMC_DISABLE_DECT_NIBBLE_SWAP + bool "Disable DECT nibble swap" + default n + help + Option to disable DECT nibble swap for COSIC modem (for backward compatibility only). + +config VOICE_CPE_VMMC_EVENT_LOGGER + depends on BROKEN + bool "Event logger support" + default n + help + Option to enable details traces between drv_vmmc and the voice FW + - for debugging only + - requires package ifx-evtlog + +config VOICE_CPE_VMMC_MPS_HISTORY_SIZE + int "MPS history buffer in words (0<=size<=512)" + default "128" + help + MPS history buffer (default=128 words, maximum=512 words, 0=disable) + To opimize the memory footprint in RAM, you might want to set the + buffer size to 0. diff --git a/package/ifx-vmmc/Makefile b/package/ifx-vmmc/Makefile new file mode 100644 index 0000000000..c1b9b00cb7 --- /dev/null +++ b/package/ifx-vmmc/Makefile @@ -0,0 +1,151 @@ +# +# Copyright (C) 2008 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=drv_vmmc +PKG_VERSION:=1.7.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=3f1b44e79408a3320aa9f8b21a260fd0 +PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/ifx-vmmc + SUBMENU:=Voice over IP + TITLE:=TAPI LL driver for Voice Macro + URL:=http://www.lantiq.com/ + MAINTAINER:=Lantiq + DEPENDS:=+kmod-ifx-tapi @BROKEN + FILES:=$(PKG_BUILD_DIR)/src/drv_vmmc.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,25,drv_vmmc) +endef + +define KernelPackage/ifx-vmmc/description + Voice Subsystem Low Level Driver for Danube, AR9, VR9 device families +endef + +define KernelPackage/ifx-vmmc/config + if PACKAGE_kmod-ifx-vmmc + source "$(SOURCE)/Config.in" + endif +endef + +CONFIGURE_ARGS += \ + ARCH=$(LINUX_KARCH) \ + --enable-linux-26 \ + --enable-kernelbuild="$(LINUX_DIR)" \ + --enable-kernelincl="$(LINUX_DIR)/include" \ + --enable-tapiincl="$(STAGING_DIR)/usr/include/drv_tapi" \ + --with-ifxos-incl=$(STAGING_DIR)/usr/include/ifxos \ + $(call autoconf_bool,CONFIG_VOICE_CPE_VMMC_EVENT_LOGGER,el-debug) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_VMMC_PMC,pmc) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_VMMC_DISABLE_DECT_NIBBLE_SWAP,dect-nibble-swap) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_FAX,fax t38) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_CID,cid) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_DECT,dect) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_KPI,kpi) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_LT_GR909,lt calibration) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_HDLC,hdlc) \ + $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_TRACES,trace) + +ifneq ($(CONFIG_VOICE_CPE_VMMC_MPS_HISTORY_SIZE),128) + CONFIGURE_ARGS += --enable-history-buf=$(CONFIG_VOICE_CPE_VMMC_MPS_HISTORY_SIZE) +endif + +#defaults +FW_URL:=http://localhost/ +FW_TARGET:=ifx_firmware.bin +FW_FILE:=fw_voip_ifx.tar.gz +COEF_TARGET:=ifx_bbd_fxs.bin +COEF_FILE:=coef_voip_ifx.tar.gz + +FW_DIR:=opt/lantiq/downloads +ifeq ($(CONFIG_VOICE_CPE_VMMC_WITH_DEVICE_DANUBE_extract),y) + CONFIGURE_ARGS += --with-device=DANUBE + FW_TARGET:=danube_firmware.bin + FW_URL:=http://www.arcor.de/hilfe/files/pdf/ + FW_FILE=arcor_A800_452CPW_FW_1.02.206(20081201).bin + FW_MD5SUM:=19d9af4e369287a0f0abaed415cdac10 + COEF_TARGET:=danube_bbd_fxs.bin + COEF_FILE:=arcor_A800_452CPW_FW_1.02.206(20081201).bin + COEF_MD5SUM:=19d9af4e369287a0f0abaed415cdac10 +endif + +ifeq ($(CONFIG_VOICE_CPE_VMMC_WITH_DEVICE_DANUBE),y) + CONFIGURE_ARGS += --with-device=DANUBE + FW_TARGET:=danube_firmware.bin + FW_FILE=fw_voip_danube-12.1.0.1.0.tar.gz + FW_MD5SUM:=51868b88dee9dbc65d3dbba355ded91c + COEF_TARGET:=danube_bbd_fxs.bin + COEF_FILE:=coef_voip_danube-0.9.0.tar.gz + COEF_MD5SUM:=c8ac6592b304b03829a8123560e15710 +endif + +ifeq ($(CONFIG_VOICE_CPE_VMMC_WITH_DEVICE_AR9),y) + CONFIGURE_ARGS += --with-device=AR9 + # TODO: add fw/coef +endif + +ifeq ($(CONFIG_VOICE_CPE_VMMC_WITH_DEVICE_VR9),y) + CONFIGURE_ARGS += --with-device=VR9 + # TODO: add fw/coef +endif + +define Download/firmware + FILE:=$(FW_FILE) + URL:=$(FW_URL) + MD5SUM:=$(FW_MD5SUM) +endef +$(eval $(call Download,firmware)) + +define Download/coef + FILE:=$(COEF_FILE) + URL:=$(FW_URL) + MD5SUM:=$(COEF_MD5SUM) +endef +$(eval $(call Download,coef)) + +define Build/Configure + rm -rf \ + $(PKG_BUILD_DIR)/coef \ + $(PKG_BUILD_DIR)/firmware + mkdir -p \ + $(PKG_BUILD_DIR)/coef \ + $(PKG_BUILD_DIR)/firmware +ifeq ($(CONFIG_VOICE_CPE_VMMC_WITH_DEVICE_DANUBE_extract),y) + $(PLATFORM_DIR)/extract.sh $(DL_DIR) '$(FW_FILE)' + $(CP) $(DL_DIR)/voip.bin $(PKG_BUILD_DIR)/firmware/$(FW_TARGET) + #$(CP) $(DL_DIR)/voip_bbd.bin $(PKG_BUILD_DIR)/firmware/$(COEF_TARGET) +else + $(TAR) -C $(PKG_BUILD_DIR)/firmware -xvzf $(DL_DIR)/$(FW_FILE) + $(TAR) -C $(PKG_BUILD_DIR)/coef -xvzf $(DL_DIR)/$(COEF_FILE) +endif + (cd $(PKG_BUILD_DIR); aclocal && autoconf && automake) + $(call Build/Configure/Default) +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + mkdir -p $(1)/usr/include/drv_vmmc + $(CP) -v --dereference $(PKG_BUILD_DIR)/include/* $(1)/usr/include/drv_vmmc + (cd $(1)/usr/include/drv_vmmc && ln -snf . include) +endef + +define KernelPackage/ifx-vmmc/install + $(INSTALL_DIR) $(1)/etc/init.d $(1)/$(FW_DIR) + $(INSTALL_BIN) ./files/vmmc.init $(1)/etc/init.d/vmmc + $(CP) $(PKG_BUILD_DIR)/firmware/*.bin $(1)/$(FW_DIR)/$(FW_TARGET) +ifneq ($(CONFIG_VOICE_CPE_VMMC_WITH_DEVICE_DANUBE_extract),y) + $(CP) $(PKG_BUILD_DIR)/coef/$(COEF_TARGET) $(1)/$(FW_DIR)/$(COEF_TARGET) +endif +endef + +$(eval $(call KernelPackage,ifx-vmmc)) diff --git a/package/ifx-vmmc/files/vmmc.init b/package/ifx-vmmc/files/vmmc.init new file mode 100644 index 0000000000..bae7badaf0 --- /dev/null +++ b/package/ifx-vmmc/files/vmmc.init @@ -0,0 +1,25 @@ +#!/bin/sh /etc/rc.common +# +# Activate Voice CPE TAPI subsystem LL driver for VMMC + +START=31 + +start() { + # TODO: clean up this mess + [ `cat /proc/cpuinfo | grep system | cut -f 3 -d ' '` = "Twinpass-VE" ] && { + [ ! -e /dev/danube-port ] && mknod /dev/danube-port c 254 0 + return; + } + [ `cat /proc/cpuinfo | grep system | cut -f 3 -d ' '` != "Danube" ] && { + [ ! -e /dev/amazon_s-port ] && mknod /dev/amazon_s-port c 240 1 + echo "INFO configuring HW scheduling 33/66" + echo "t0 0x0" > /proc/mips/mtsched + echo "t1 0x1" > /proc/mips/mtsched + echo "v0 0x0" > /proc/mips/mtsched + } + [ `cat /proc/cpuinfo | grep system | cut -f 3 -d ' '` = "Danube" ] && { + [ ! -e /dev/danube-port ] && mknod /dev/danube-port c 240 1 + # switch life-line relais + echo 1 > /sys/class/leds/fxs_relay/brightness + } +} diff --git a/package/ifx-vmmc/patches/001-portability.patch b/package/ifx-vmmc/patches/001-portability.patch new file mode 100644 index 0000000000..fb8ab68ed4 --- /dev/null +++ b/package/ifx-vmmc/patches/001-portability.patch @@ -0,0 +1,26 @@ +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -227,7 +227,7 @@ drv_vmmc_CFLAGS += -fno-common + drv_vmmc_OBJS = "$(subst .c,.o, $(drv_vmmc_SOURCES) $(nodist_drv_vmmc_SOURCES))" + + drv_vmmc.ko: $(drv_vmmc_SOURCES) $(EXTRA_DIST) +- @echo -e "Making Linux 2.6.x kernel object" ++ @echo "Making Linux 2.6.x kernel object" + @for f in $(drv_vmmc_SOURCES) $(nodist_drv_vmmc_SOURCES) ; do \ + if test ! -e $(PWD)/$$f; then \ + echo " LN $$f" ; \ +@@ -235,10 +235,10 @@ drv_vmmc.ko: $(drv_vmmc_SOURCES) $(EXTRA + ln -s @abs_srcdir@/$$f $(PWD)/$$f; \ + fi; \ + done; +- @echo -e "# drv_vmmc: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild +- @echo -e "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild +- @echo -e "$(subst .ko,,$@)-y := $(drv_vmmc_OBJS)" >> $(PWD)/Kbuild +- @echo -e "EXTRA_CFLAGS := -DHAVE_CONFIG_H $(CFLAGS) $(drv_vmmc_CFLAGS) $(INCLUDES)" >> $(PWD)/Kbuild ++ @echo "# drv_vmmc: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild ++ @echo "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild ++ @echo "$(subst .ko,,$@)-y := $(drv_vmmc_OBJS)" >> $(PWD)/Kbuild ++ @echo "EXTRA_CFLAGS := -DHAVE_CONFIG_H $(CFLAGS) $(drv_vmmc_CFLAGS) $(INCLUDES)" >> $(PWD)/Kbuild + $(MAKE) ARCH=@KERNEL_ARCH@ -C @KERNEL_BUILD_PATH@ O=@KERNEL_BUILD_PATH@ M=$(PWD) modules + + clean-generic: diff --git a/package/ifx-vmmc/patches/100-ifxmips.patch b/package/ifx-vmmc/patches/100-ifxmips.patch new file mode 100644 index 0000000000..6a4cc8d590 --- /dev/null +++ b/package/ifx-vmmc/patches/100-ifxmips.patch @@ -0,0 +1,491 @@ +--- a/src/drv_vmmc_access.h ++++ b/src/drv_vmmc_access.h +@@ -24,6 +24,10 @@ + #include "drv_mps_vmmc.h" + #endif + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)) ++# define IFX_MPS IFXMIPS_MPS_BASE_ADDR ++#endif ++ + /* ============================= */ + /* Global Defines */ + /* ============================= */ +--- a/src/drv_vmmc_bbd.c ++++ b/src/drv_vmmc_bbd.c +@@ -939,7 +939,11 @@ static IFX_int32_t vmmc_BBD_DownloadChCr + IFX_uint8_t padBytes = 0; + #endif + IFX_uint16_t cram_offset, cram_crc, +- pCmd [MAX_CMD_WORD] = {0}; ++ pCmd [MAX_CMD_WORD] ++#if defined (__GNUC__) || defined (__GNUG__) ++ __attribute__ ((aligned(4))) ++#endif ++ = {0}; + + /* read offset */ + cpb2w (&cram_offset, &bbd_cram->pData[0], sizeof (IFX_uint16_t)); +--- a/src/drv_vmmc_danube.h ++++ b/src/drv_vmmc_danube.h +@@ -15,12 +15,59 @@ + */ + + #if defined SYSTEM_DANUBE +-#include ++# if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)) ++# include ++ ++# define IFX_GPIO_PIN_NUMBER_PER_PORT 16 ++# define IFX_GPIO_PIN_ID(port, pin) ((port) \ ++ * IFX_GPIO_PIN_NUMBER_PER_PORT \ ++ + (pin)) ++# define IFX_GPIO_PIN_ID_TO_PORT(pin_id) (pin_id >> 4) ++# define IFX_GPIO_PIN_ID_TO_PIN(pin_id) (pin_id & 0x0F) ++ ++# define IFX_GPIO_MODULE_TAPI_VMMC 0 /* not used */ ++ ++# define ifx_gpio_pin_reserve(a,b) 0 /* obsolete */ ++ ++# define ifx_gpio_open_drain_set(a,b) ifxmips_port_set_open_drain( \ ++ IFX_GPIO_PIN_ID_TO_PORT(a), \ ++ IFX_GPIO_PIN_ID_TO_PIN(a)) ++ ++# define ifx_gpio_altsel0_set(a,b) ifxmips_port_set_altsel0( \ ++ IFX_GPIO_PIN_ID_TO_PORT(a), \ ++ IFX_GPIO_PIN_ID_TO_PIN(a)) ++ ++# define ifx_gpio_altsel1_set(a,b) ifxmips_port_set_altsel1( \ ++ IFX_GPIO_PIN_ID_TO_PORT(a), \ ++ IFX_GPIO_PIN_ID_TO_PIN(a)) ++ ++# define ifx_gpio_altsel0_clear(a,b) ifxmips_port_clear_altsel0( \ ++ IFX_GPIO_PIN_ID_TO_PORT(a), \ ++ IFX_GPIO_PIN_ID_TO_PIN(a)) ++ ++# define ifx_gpio_altsel1_clear(a,b) ifxmips_port_clear_altsel1( \ ++ IFX_GPIO_PIN_ID_TO_PORT(a), \ ++ IFX_GPIO_PIN_ID_TO_PIN(a)) ++ ++# define ifx_gpio_dir_in_set(a,b) ifxmips_port_set_dir_in( \ ++ IFX_GPIO_PIN_ID_TO_PORT(a), \ ++ IFX_GPIO_PIN_ID_TO_PIN(a)) ++ ++# define ifx_gpio_dir_out_set(a,b) ifxmips_port_set_dir_out( \ ++ IFX_GPIO_PIN_ID_TO_PORT(a), \ ++ IFX_GPIO_PIN_ID_TO_PIN(a)) ++ ++# define ifx_gpio_pin_free(a,b) ifxmips_port_free_pin( \ ++ IFX_GPIO_PIN_ID_TO_PORT(a), \ ++ IFX_GPIO_PIN_ID_TO_PIN(a)) ++# else ++# include ++# endif + #else + #error no system selected + #endif + +-#define VMMC_TAPI_GPIO_MODULE_ID IFX_GPIO_MODULE_TAPI_VMMC ++#define VMMC_TAPI_GPIO_MODULE_ID IFX_GPIO_MODULE_TAPI_VMMC + /** + + */ +--- a/src/drv_vmmc_init.c ++++ b/src/drv_vmmc_init.c +@@ -48,6 +48,14 @@ + #include "drv_vmmc_pmc.h" + #endif /* PMC_SUPPORTED */ + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)) ++# define IFX_MPS_CAD0SR IFXMIPS_MPS_CAD0SR ++# define IFX_MPS_CAD1SR IFXMIPS_MPS_CAD1SR ++# define IFX_MPS_CVC0SR IFXMIPS_MPS_CVC0SR ++# define IFX_MPS_CVC1SR IFXMIPS_MPS_CVC1SR ++# define IFX_MPS_CVC2SR IFXMIPS_MPS_CVC2SR ++# define IFX_MPS_CVC3SR IFXMIPS_MPS_CVC3SR ++#endif + + /* ============================= */ + /* Local Macros & Definitions */ +--- a/src/drv_vmmc_init_cap.c ++++ b/src/drv_vmmc_init_cap.c +@@ -22,6 +22,11 @@ + #include "drv_mps_vmmc.h" + #include "drv_mps_vmmc_device.h" + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)) ++# define IFX_MPS_CHIPID_VERSION_GET IFXMIPS_MPS_CHIPID_VERSION_GET ++# define IFX_MPS_CHIPID IFXMIPS_MPS_CHIPID ++#endif ++ + /* ============================= */ + /* Configuration defintions */ + /* ============================= */ +--- a/src/mps/drv_mps_vmmc_common.c ++++ b/src/mps/drv_mps_vmmc_common.c +@@ -35,8 +35,35 @@ + #include "ifxos_interrupt.h" + #include "ifxos_time.h" + +-#include +-#include ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)) ++# include ++# include ++# include ++ ++# define ifx_gptu_timer_request ifxmips_request_timer ++# define ifx_gptu_timer_start ifxmips_start_timer ++# define ifx_gptu_countvalue_get ifxmips_get_count_value ++# define ifx_gptu_timer_free ifxmips_free_timer ++ ++# define IFX_MPS_SRAM IFXMIPS_MPS_SRAM ++# define IFX_MPS_AD0ENR IFXMIPS_MPS_AD0ENR ++# define IFX_MPS_AD1ENR IFXMIPS_MPS_AD1ENR ++# define IFX_MPS_VC0ENR IFXMIPS_MPS_VC0ENR ++# define IFX_MPS_SAD0SR IFXMIPS_MPS_SAD0SR ++# define IFX_MPS_RAD0SR IFXMIPS_MPS_RAD0SR ++# define IFX_MPS_RAD1SR IFXMIPS_MPS_RAD1SR ++# define IFX_MPS_CAD0SR IFXMIPS_MPS_CAD0SR ++# define IFX_MPS_CAD1SR IFXMIPS_MPS_CAD1SR ++# define IFX_MPS_RVC0SR IFXMIPS_MPS_RVC0SR ++# define IFX_MPS_CVC0SR IFXMIPS_MPS_CVC0SR ++ ++# define INT_NUM_IM4_IRL14 (INT_NUM_IM4_IRL0 + 14) ++ ++# define bsp_mask_and_ack_irq ifxmips_mask_and_ack_irq ++#else ++# include ++# include ++#endif + + #include "drv_mps_vmmc.h" + #include "drv_mps_vmmc_dbg.h" +@@ -193,7 +220,8 @@ IFX_boolean_t ifx_mps_ext_bufman () + */ + IFX_void_t *ifx_mps_fastbuf_malloc (IFX_size_t size, IFX_int32_t priority) + { +- IFX_uint32_t ptr, flags; ++ unsigned long flags; ++ IFX_uint32_t ptr; + IFX_int32_t index = fastbuf_index; + + if (fastbuf_initialized == 0) +@@ -219,11 +247,11 @@ IFX_void_t *ifx_mps_fastbuf_malloc (IFX_ + if ((volatile IFX_uint32_t) fastbuf_pool[index] & FASTBUF_USED) + continue; + ptr = fastbuf_pool[index]; +- (volatile IFX_uint32_t) fastbuf_pool[index] |= FASTBUF_USED; ++ fastbuf_pool[index] = (volatile IFX_uint32_t) fastbuf_pool[index] | FASTBUF_USED; + if ((priority == FASTBUF_FW_OWNED) || (priority == FASTBUF_CMD_OWNED) || + (priority == FASTBUF_EVENT_OWNED) || + (priority == FASTBUF_WRITE_OWNED)) +- (volatile IFX_uint32_t) fastbuf_pool[index] |= priority; ++ fastbuf_pool[index] = (volatile IFX_uint32_t) fastbuf_pool[index] | priority; + fastbuf_index = index; + IFXOS_UNLOCKINT (flags); + return (IFX_void_t *) ptr; +@@ -247,7 +275,7 @@ IFX_void_t *ifx_mps_fastbuf_malloc (IFX_ + */ + IFX_void_t ifx_mps_fastbuf_free (const IFX_void_t * ptr) + { +- IFX_uint32_t flags; ++ unsigned long flags; + IFX_int32_t index = fastbuf_index; + + IFXOS_LOCKINT (flags); +@@ -261,8 +289,9 @@ IFX_void_t ifx_mps_fastbuf_free (const I + FASTBUF_EVENT_OWNED | FASTBUF_WRITE_OWNED)) + == ((IFX_uint32_t) ptr | FASTBUF_USED)) + { +- (volatile IFX_uint32_t) fastbuf_pool[index] &= ~FASTBUF_USED; +- (volatile IFX_uint32_t) fastbuf_pool[index] &= ++ fastbuf_pool[index] = (volatile IFX_uint32_t) fastbuf_pool[index] & ~FASTBUF_USED; ++ ++ fastbuf_pool[index] = (volatile IFX_uint32_t) fastbuf_pool[index] & + ~(FASTBUF_FW_OWNED | FASTBUF_CMD_OWNED | FASTBUF_EVENT_OWNED | + FASTBUF_WRITE_OWNED); + IFXOS_UNLOCKINT (flags); +@@ -444,7 +473,7 @@ static mps_buffer_state_e ifx_mps_bufman + */ + static IFX_int32_t ifx_mps_bufman_inc_level (IFX_uint32_t value) + { +- IFX_uint32_t flags; ++ unsigned long flags; + + if (mps_buffer.buf_level + value > MPS_BUFFER_MAX_LEVEL) + { +@@ -471,7 +500,7 @@ static IFX_int32_t ifx_mps_bufman_inc_le + */ + static IFX_int32_t ifx_mps_bufman_dec_level (IFX_uint32_t value) + { +- IFX_uint32_t flags; ++ unsigned long flags; + + if (mps_buffer.buf_level < value) + { +@@ -932,7 +961,7 @@ IFX_int32_t ifx_mps_common_open (mps_com + mps_mbx_dev * pMBDev, IFX_int32_t bcommand, + IFX_boolean_t from_kernel) + { +- IFX_uint32_t flags; ++ unsigned long flags; + + IFXOS_LOCKINT (flags); + +@@ -1048,7 +1077,7 @@ IFX_int32_t ifx_mps_common_close (mps_mb + IFX_void_t ifx_mps_release_structures (mps_comm_dev * pDev) + { + IFX_int32_t count; +- IFX_uint32_t flags; ++ unsigned long flags; + + IFXOS_LOCKINT (flags); + IFXOS_BlockFree (pFW_img_data); +@@ -1544,7 +1573,7 @@ IFX_int32_t ifx_mps_mbx_read_message (mp + IFX_uint32_t * bytes) + { + IFX_int32_t i, ret; +- IFX_uint32_t flags; ++ unsigned long flags; + + IFXOS_LOCKINT (flags); + +@@ -1751,7 +1780,7 @@ IFX_int32_t ifx_mps_mbx_write_message (m + { + mps_fifo *mbx; + IFX_uint32_t i; +- IFX_uint32_t flags; ++ unsigned long flags; + IFX_int32_t retval = -EAGAIN; + IFX_int32_t retries = 0; + IFX_uint32_t word = 0; +@@ -2138,6 +2167,7 @@ IFX_int32_t ifx_mps_mbx_write_cmd (mps_m + TRACE (MPS, DBG_LEVEL_HIGH, + ("%s(): Invalid device ID %d !\n", __FUNCTION__, pMBDev->devID)); + } ++ + return retval; + } + +@@ -2161,7 +2191,7 @@ IFX_void_t ifx_mps_mbx_data_upstream (IF + mps_mbx_dev *mbx_dev; + MbxMsg_s msg; + IFX_uint32_t bytes_read = 0; +- IFX_uint32_t flags; ++ unsigned long flags; + IFX_int32_t ret; + + /* set pointer to data upstream mailbox, no matter if 0,1,2 or 3 because +@@ -2252,7 +2282,7 @@ IFX_void_t ifx_mps_mbx_data_upstream (IF + { + ifx_mps_bufman_dec_level (1); + if ((ifx_mps_bufman_get_level () <= mps_buffer.buf_threshold) && +- (atomic_read (&pMPSDev->provide_buffer->object.count) == 0)) ++ ((volatile unsigned int)pMPSDev->provide_buffer->object.count == 0)) + { + IFXOS_LockRelease (pMPSDev->provide_buffer); + } +@@ -2295,7 +2325,7 @@ IFX_void_t ifx_mps_mbx_data_upstream (IF + #endif /* CONFIG_PROC_FS */ + ifx_mps_bufman_dec_level (1); + if ((ifx_mps_bufman_get_level () <= mps_buffer.buf_threshold) && +- (atomic_read (&pMPSDev->provide_buffer->object.count) == 0)) ++ ((volatile unsigned int)pMPSDev->provide_buffer->object.count == 0)) + { + IFXOS_LockRelease (pMPSDev->provide_buffer); + } +@@ -2325,7 +2355,7 @@ IFX_void_t ifx_mps_mbx_data_upstream (IF + IFX_void_t ifx_mps_mbx_cmd_upstream (IFX_ulong_t dummy) + { + mps_fifo *mbx; +- IFX_uint32_t flags; ++ unsigned long flags; + + /* set pointer to upstream command mailbox */ + mbx = &(pMPSDev->cmd_upstrm_fifo); +@@ -2373,7 +2403,7 @@ IFX_void_t ifx_mps_mbx_event_upstream (I + mps_event_msg msg; + IFX_int32_t length = 0; + IFX_int32_t read_length = 0; +- IFX_uint32_t flags; ++ unsigned long flags; + + /* set pointer to upstream event mailbox */ + mbx = &(pMPSDev->event_upstrm_fifo); +@@ -2616,7 +2646,7 @@ IFX_void_t ifx_mps_disable_mailbox_int ( + */ + IFX_void_t ifx_mps_dd_mbx_int_enable (IFX_void_t) + { +- IFX_uint32_t flags; ++ unsigned long flags; + MPS_Ad0Reg_u Ad0Reg; + + IFXOS_LOCKINT (flags); +@@ -2642,7 +2672,7 @@ IFX_void_t ifx_mps_dd_mbx_int_enable (IF + */ + IFX_void_t ifx_mps_dd_mbx_int_disable (IFX_void_t) + { +- IFX_uint32_t flags; ++ unsigned long flags; + MPS_Ad0Reg_u Ad0Reg; + + IFXOS_LOCKINT (flags); +@@ -2769,6 +2799,7 @@ irqreturn_t ifx_mps_ad0_irq (IFX_int32_t + } + } + ++ + if (MPS_Ad0StatusReg.fld.du_mbx) + { + #ifdef CONFIG_PROC_FS +@@ -3062,7 +3093,8 @@ IFX_int32_t ifx_mps_get_fw_version (IFX_ + */ + IFX_return_t ifx_mps_init_gpt () + { +- IFX_uint32_t flags, timer_flags, timer, loops = 0; ++ unsigned long flags; ++ IFX_uint32_t timer_flags, timer, loops = 0; + IFX_ulong_t count; + #if defined(SYSTEM_AR9) || defined(SYSTEM_VR9) + timer = TIMER1A; +--- a/src/mps/drv_mps_vmmc_danube.c ++++ b/src/mps/drv_mps_vmmc_danube.c +@@ -32,9 +32,22 @@ + #include "ifxos_select.h" + #include "ifxos_interrupt.h" + +-#include +-#include +-#include ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)) ++# include ++# include ++# include ++# include ++ ++# define IFX_RCU_RST_REQ IFXMIPS_RCU_RST ++# define IFX_RCU_RST_REQ_CPU1 IFXMIPS_RCU_RST_CPU1 ++ ++# define ifx_get_cp1_base prom_get_cp1_base ++# define ifx_get_cp1_size prom_get_cp1_size ++#else ++# include ++# include ++# include ++#endif + + #include "drv_mps_vmmc.h" + #include "drv_mps_vmmc_dbg.h" +@@ -119,6 +132,15 @@ IFX_int32_t ifx_mps_download_firmware (m + } + + /* check if FW image fits in available memory space */ ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)) ++ if (mem > ifx_get_cp1_size()<<20) ++ { ++ TRACE (MPS, DBG_LEVEL_HIGH, ++ ("[%s %s %d]: error, firmware memory exceeds reserved space (%i > %i)!\n", ++ __FILE__, __func__, __LINE__, mem, ifx_get_cp1_size()<<20)); ++ return IFX_ERROR; ++ } ++#else + if (mem > ifx_get_cp1_size()) + { + TRACE (MPS, DBG_LEVEL_HIGH, +@@ -126,6 +148,7 @@ IFX_int32_t ifx_mps_download_firmware (m + __FILE__, __func__, __LINE__, mem, ifx_get_cp1_size())); + return IFX_ERROR; + } ++#endif + + /* reset the driver */ + ifx_mps_reset (); +@@ -337,7 +360,7 @@ IFX_void_t ifx_mps_release (IFX_void_t) + */ + IFX_void_t ifx_mps_wdog_expiry() + { +- IFX_uint32_t flags; ++ unsigned long flags; + + IFXOS_LOCKINT (flags); + /* recalculate and compare the firmware checksum */ +--- a/src/mps/drv_mps_vmmc_device.h ++++ b/src/mps/drv_mps_vmmc_device.h +@@ -16,8 +16,15 @@ + declarations. + *******************************************************************************/ + +-#include +-#include ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)) ++# include ++# include ++# include ++# include ++#else ++# include ++# include ++#endif + + /* ============================= */ + /* MPS Common defines */ +--- a/src/mps/drv_mps_vmmc_linux.c ++++ b/src/mps/drv_mps_vmmc_linux.c +@@ -40,10 +40,26 @@ + #include + #endif /* */ + +- +-#include +-#include +-#include ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)) ++# include ++# include ++ ++# define IFX_MPS_AD0ENR IFXMIPS_MPS_AD0ENR ++# define IFX_MPS_AD1ENR IFXMIPS_MPS_AD1ENR ++# define IFX_MPS_RAD0SR IFXMIPS_MPS_RAD0SR ++# define IFX_MPS_RAD1SR IFXMIPS_MPS_RAD1SR ++# define IFX_MPS_VC0ENR IFXMIPS_MPS_VC0ENR ++# define IFX_MPS_RVC0SR IFXMIPS_MPS_RVC0SR ++ ++# define INT_NUM_IM4_IRL14 (INT_NUM_IM4_IRL0 + 14) ++# define INT_NUM_IM4_IRL18 (INT_NUM_IM4_IRL0 + 18) ++# define INT_NUM_IM4_IRL19 (INT_NUM_IM4_IRL0 + 19) ++# define IFX_ICU_IM4_IER IFXMIPS_ICU_IM4_IER ++#else ++# include ++# include ++# include ++#endif + + /* lib_ifxos headers */ + #include "ifx_types.h" +@@ -914,7 +930,7 @@ IFX_int32_t ifx_mps_ioctl (struct inode + #endif /* MPS_FIFO_BLOCKING_WRITE */ + case FIO_MPS_GET_STATUS: + { +- IFX_uint32_t flags; ++ unsigned long flags; + + IFXOS_LOCKINT (flags); + +@@ -949,7 +965,7 @@ IFX_int32_t ifx_mps_ioctl (struct inode + #if CONFIG_MPS_HISTORY_SIZE > 0 + case FIO_MPS_GET_CMD_HISTORY: + { +- IFX_uint32_t flags; ++ unsigned long flags; + + if (from_kernel) + { +@@ -1637,6 +1653,7 @@ IFX_int32_t ifx_mps_get_status_proc (IFX + sprintf (buf + len, " minLv: \t %8d\n", + ifx_mps_dev.voice_mb[i].upstrm_fifo->min_space); + } ++ + return len; + } + diff --git a/package/ifxos/Makefile b/package/ifxos/Makefile index de4da7de81..2a84eb53e4 100644 --- a/package/ifxos/Makefile +++ b/package/ifxos/Makefile @@ -23,7 +23,7 @@ define KernelPackage/ifxos TITLE:=Lantiq OS abstraction library URL:=http://www.lantiq.com/ MAINTAINER:=Lantiq - DEPENDS:=@TARGET_ifxmips + DEPENDS:=@TARGET_ifxmips @BROKEN FILES:=$(PKG_BUILD_DIR)/src/drv_ifxos.$(LINUX_KMOD_SUFFIX) AUTOLOAD:=$(call AutoLoad,10,drv_ifxos) endef -- 2.30.2