[ifxmips] adds voip support
[openwrt-10.03/.git] / package / ifx-vmmc / Makefile
1 #
2 # Copyright (C) 2008 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=drv_vmmc
12 PKG_VERSION:=1.7.0
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_MD5SUM:=3f1b44e79408a3320aa9f8b21a260fd0
17 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
18
19 include $(INCLUDE_DIR)/package.mk
20
21 define KernelPackage/ifx-vmmc
22   SUBMENU:=Voice over IP
23   TITLE:=TAPI LL driver for Voice Macro
24   URL:=http://www.lantiq.com/
25   MAINTAINER:=Lantiq
26   DEPENDS:=+kmod-ifx-tapi @BROKEN
27   FILES:=$(PKG_BUILD_DIR)/src/drv_vmmc.$(LINUX_KMOD_SUFFIX)
28   AUTOLOAD:=$(call AutoLoad,25,drv_vmmc)
29 endef
30
31 define KernelPackage/ifx-vmmc/description
32         Voice Subsystem Low Level Driver for Danube, AR9, VR9 device families
33 endef
34
35 define KernelPackage/ifx-vmmc/config
36         if PACKAGE_kmod-ifx-vmmc
37                 source "$(SOURCE)/Config.in"
38         endif
39 endef
40
41 CONFIGURE_ARGS += \
42         ARCH=$(LINUX_KARCH) \
43         --enable-linux-26 \
44         --enable-kernelbuild="$(LINUX_DIR)" \
45         --enable-kernelincl="$(LINUX_DIR)/include" \
46         --enable-tapiincl="$(STAGING_DIR)/usr/include/drv_tapi" \
47         --with-ifxos-incl=$(STAGING_DIR)/usr/include/ifxos \
48         $(call autoconf_bool,CONFIG_VOICE_CPE_VMMC_EVENT_LOGGER,el-debug) \
49         $(call autoconf_bool,CONFIG_VOICE_CPE_VMMC_PMC,pmc) \
50         $(call autoconf_bool,CONFIG_VOICE_CPE_VMMC_DISABLE_DECT_NIBBLE_SWAP,dect-nibble-swap) \
51         $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_FAX,fax t38) \
52         $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_CID,cid) \
53         $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_DECT,dect) \
54         $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_KPI,kpi) \
55         $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_LT_GR909,lt calibration) \
56         $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_HDLC,hdlc) \
57         $(call autoconf_bool,CONFIG_VOICE_CPE_TAPI_TRACES,trace)
58
59 ifneq ($(CONFIG_VOICE_CPE_VMMC_MPS_HISTORY_SIZE),128)
60   CONFIGURE_ARGS += --enable-history-buf=$(CONFIG_VOICE_CPE_VMMC_MPS_HISTORY_SIZE)
61 endif
62
63 #defaults 
64 FW_URL:=http://localhost/
65 FW_TARGET:=ifx_firmware.bin
66 FW_FILE:=fw_voip_ifx.tar.gz
67 COEF_TARGET:=ifx_bbd_fxs.bin
68 COEF_FILE:=coef_voip_ifx.tar.gz
69
70 FW_DIR:=opt/lantiq/downloads
71 ifeq ($(CONFIG_VOICE_CPE_VMMC_WITH_DEVICE_DANUBE_extract),y)
72   CONFIGURE_ARGS += --with-device=DANUBE
73   FW_TARGET:=danube_firmware.bin
74   FW_URL:=http://www.arcor.de/hilfe/files/pdf/
75   FW_FILE=arcor_A800_452CPW_FW_1.02.206(20081201).bin
76   FW_MD5SUM:=19d9af4e369287a0f0abaed415cdac10
77   COEF_TARGET:=danube_bbd_fxs.bin
78   COEF_FILE:=arcor_A800_452CPW_FW_1.02.206(20081201).bin
79   COEF_MD5SUM:=19d9af4e369287a0f0abaed415cdac10
80 endif
81
82 ifeq ($(CONFIG_VOICE_CPE_VMMC_WITH_DEVICE_DANUBE),y)
83   CONFIGURE_ARGS += --with-device=DANUBE
84   FW_TARGET:=danube_firmware.bin
85   FW_FILE=fw_voip_danube-12.1.0.1.0.tar.gz
86   FW_MD5SUM:=51868b88dee9dbc65d3dbba355ded91c
87   COEF_TARGET:=danube_bbd_fxs.bin
88   COEF_FILE:=coef_voip_danube-0.9.0.tar.gz
89   COEF_MD5SUM:=c8ac6592b304b03829a8123560e15710
90 endif
91
92 ifeq ($(CONFIG_VOICE_CPE_VMMC_WITH_DEVICE_AR9),y)
93   CONFIGURE_ARGS += --with-device=AR9
94   # TODO: add fw/coef
95 endif
96
97 ifeq ($(CONFIG_VOICE_CPE_VMMC_WITH_DEVICE_VR9),y)
98   CONFIGURE_ARGS += --with-device=VR9
99   # TODO: add fw/coef
100 endif
101
102 define Download/firmware
103   FILE:=$(FW_FILE)
104   URL:=$(FW_URL)
105   MD5SUM:=$(FW_MD5SUM)
106 endef
107 $(eval $(call Download,firmware))
108
109 define Download/coef
110   FILE:=$(COEF_FILE)
111   URL:=$(FW_URL)
112   MD5SUM:=$(COEF_MD5SUM)
113 endef
114 $(eval $(call Download,coef))
115
116 define Build/Configure
117         rm -rf \
118                 $(PKG_BUILD_DIR)/coef \
119                 $(PKG_BUILD_DIR)/firmware
120         mkdir -p \
121                 $(PKG_BUILD_DIR)/coef \
122                 $(PKG_BUILD_DIR)/firmware
123 ifeq ($(CONFIG_VOICE_CPE_VMMC_WITH_DEVICE_DANUBE_extract),y)
124         $(PLATFORM_DIR)/extract.sh $(DL_DIR) '$(FW_FILE)' 
125         $(CP) $(DL_DIR)/voip.bin $(PKG_BUILD_DIR)/firmware/$(FW_TARGET)
126         #$(CP) $(DL_DIR)/voip_bbd.bin $(PKG_BUILD_DIR)/firmware/$(COEF_TARGET)
127 else
128         $(TAR) -C $(PKG_BUILD_DIR)/firmware -xvzf $(DL_DIR)/$(FW_FILE)
129         $(TAR) -C $(PKG_BUILD_DIR)/coef -xvzf $(DL_DIR)/$(COEF_FILE)
130 endif
131         (cd $(PKG_BUILD_DIR); aclocal && autoconf && automake)
132         $(call Build/Configure/Default)
133 endef
134
135 define Build/InstallDev
136         $(INSTALL_DIR) $(1)/usr/include
137         mkdir -p $(1)/usr/include/drv_vmmc
138         $(CP) -v --dereference $(PKG_BUILD_DIR)/include/* $(1)/usr/include/drv_vmmc
139         (cd $(1)/usr/include/drv_vmmc && ln -snf . include)
140 endef
141
142 define KernelPackage/ifx-vmmc/install
143         $(INSTALL_DIR) $(1)/etc/init.d $(1)/$(FW_DIR)
144         $(INSTALL_BIN) ./files/vmmc.init $(1)/etc/init.d/vmmc
145         $(CP) $(PKG_BUILD_DIR)/firmware/*.bin $(1)/$(FW_DIR)/$(FW_TARGET)
146 ifneq ($(CONFIG_VOICE_CPE_VMMC_WITH_DEVICE_DANUBE_extract),y)
147         $(CP) $(PKG_BUILD_DIR)/coef/$(COEF_TARGET) $(1)/$(FW_DIR)/$(COEF_TARGET)
148 endif
149 endef
150
151 $(eval $(call KernelPackage,ifx-vmmc))