[dahdi-commits] sruffell: branch linux/sruffell/dahdi-linux-vpmadt032 r6016 - in /linux/team/...

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Mon Feb 16 15:31:08 CST 2009


Author: sruffell
Date: Mon Feb 16 15:31:08 2009
New Revision: 6016

URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=6016
Log:
Move as much of the vpmadt032 interface as possible into a new voicebus.ko
module.

Added:
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/
      - copied from r6015, linux/team/sruffell/private/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/GpakApi.c
      - copied, made public unchanged from r6015, linux/team/sruffell/private/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/GpakApi.c
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/GpakApi.h
      - copied, made public unchanged from r6015, linux/team/sruffell/private/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/GpakApi.h
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/GpakCust.c
      - copied, made public, changed from r6015, linux/team/sruffell/private/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/GpakCust.c
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/GpakCust.h
      - copied, made public, changed from r6015, linux/team/sruffell/private/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/GpakCust.h
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/GpakHpi.h
      - copied, made public unchanged from r6015, linux/team/sruffell/private/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/GpakHpi.h
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/Kbuild
      - copied, made public unchanged from r6015, linux/team/sruffell/private/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/Kbuild
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/gpakErrs.h
      - copied, made public unchanged from r6015, linux/team/sruffell/private/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/gpakErrs.h
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/gpakenum.h
      - copied, made public unchanged from r6015, linux/team/sruffell/private/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/gpakenum.h
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/voicebus.c
      - copied, made public unchanged from r6015, linux/team/sruffell/private/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/voicebus.c
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/voicebus.h
      - copied, made public unchanged from r6015, linux/team/sruffell/private/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/voicebus.h
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/vpmadtreg.c
      - copied, made public unchanged from r6015, linux/team/sruffell/private/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/vpmadtreg.c
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/vpmadtreg.h
      - copied, made public unchanged from r6015, linux/team/sruffell/private/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/vpmadtreg.h
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/vpmadt032_loader/
      - copied from r6015, linux/team/sruffell/private/dahdi-linux-vpmadt032/drivers/dahdi/vpmadt032_loader/
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/vpmadt032_loader/dahdi_vpmadt032_loader.c
      - copied, made public unchanged from r6015, linux/team/sruffell/private/dahdi-linux-vpmadt032/drivers/dahdi/vpmadt032_loader/dahdi_vpmadt032_loader.c
Removed:
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/voicebus.c
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/voicebus.h
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wctdm24xxp/GpakApi.c
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wctdm24xxp/GpakApi.h
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wctdm24xxp/GpakCust.c
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wctdm24xxp/GpakCust.h
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wctdm24xxp/GpakHpi.h
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wctdm24xxp/gpakErrs.h
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wctdm24xxp/gpakenum.h
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wctdm24xxp/voicebus.c
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wcte12xp/GpakApi.c
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wcte12xp/GpakApi.h
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wcte12xp/GpakErrs.h
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wcte12xp/GpakHpi.h
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wcte12xp/gpakenum.h
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wcte12xp/voicebus.c
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wcte12xp/vpmadt032.c
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wcte12xp/vpmadt032.h
Modified:
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/Kbuild
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/Kconfig
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/adt_lec.c
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/firmware/Makefile
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wctdm24xxp/Kbuild
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wctdm24xxp/base.c
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wcte12xp/Kbuild
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wcte12xp/base.c
    linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/wcte12xp/wcte12xp.h

Modified: linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/Kbuild
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/Kbuild?view=diff&rev=6016&r1=6015&r2=6016
==============================================================================
--- linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/Kbuild (original)
+++ linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/Kbuild Mon Feb 16 15:31:08 2009
@@ -10,6 +10,7 @@
 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTDM24XXP)	+= wctdm24xxp/
 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTE12XP)		+= wcte12xp/
 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTDM)		+= wctdm.o
+obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_VOICEBUS)		+= voicebus/
 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCB4XXP)		+= wcb4xxp/
 
 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCT1XXP)		+= wct1xxp.o
@@ -64,6 +65,32 @@
 
 dahdi-objs := dahdi-base.o
 
+###############################################################################
+# VPMADT032 Loader
+###############################################################################
+
+dahdi_vpmadt032_loader-objs := vpmadt032_loader/dahdi_vpmadt032_loader.o 
+
+ifeq ($(ARCH),i386)
+  ifneq ($(wildcard $(src)/vpmadt032_loader/vpmadt032_x86_32.o_shipped),)
+    VPMADT032_LOADER_PRESENT=yes
+    dahdi_vpmadt032_loader-objs += vpmadt032_loader/vpmadt032_x86_32.o
+    obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_VPMADT032_LOADER)	+= dahdi_vpmadt032_loader.o
+  endif
+else
+  ifeq ($(ARCH),x86_64)
+    ifneq ($(wildcard $(src)/vpmadt032_loader/vpmadt032_x86_64.o_shipped),)
+       VPMADT032_LOADER_PRESENT=yes
+       dahdi_vpmadt032_loader-objs += vpmadt032_loader/vpmadt032_x86_64.o
+       obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_VPMADT032_LOADER)	+= dahdi_vpmadt032_loader.o
+    endif
+  endif
+endif
+
+###############################################################################
+# HPEC Support 
+###############################################################################
+
 dahdi_echocan_hpec-objs := hpec/dahdi_echocan_hpec.o
 CFLAGS_dahdi_echocan_hpec.o := -I$(src)/hpec
 

Modified: linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/Kconfig
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/Kconfig?view=diff&rev=6016&r1=6015&r2=6016
==============================================================================
--- linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/Kconfig (original)
+++ linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/Kconfig Mon Feb 16 15:31:08 2009
@@ -123,9 +123,24 @@
 
 	  If unsure, say Y.
 
+config DAHDI_VOICEBUS
+	tristate "VoiceBus(tm) Interface Library"
+	depends on PCI
+	default DAHDI
+	---help---
+	   This driver provides the common interface for telephony cards that
+	   use the VoiceBus(tm) interface.  It also contains common supporting
+	   libraries for the VPMADT032 hardware echo cancelation module that
+	   is available for the VoiceBus cards.
+
+	   To compile this driver as a module, choose M here: the module will
+	   be called voicebus.
+
+	   If unsure, say Y.
+
 config DAHDI_WCTDM24XXP
 	tristate "Digium Wildcard VoiceBus analog card Support"
-	depends on DAHDI && PCI
+	depends on DAHDI && DAHDI_VOICEBUS
 	default DAHDI
 	---help---
 	  This driver provides support for the following Digium
@@ -145,7 +160,7 @@
 
 config DAHDI_WCTE12XP
 	tristate "Digium Wildcard VoiceBus digital card Support"
-	depends on DAHDI && PCI
+	depends on DAHDI && DAHDI_VOICEBUS
 	default DAHDI
 	---help---
 	  This driver provides support for the following Digium

Modified: linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/adt_lec.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/adt_lec.c?view=diff&rev=6016&r1=6015&r2=6016
==============================================================================
--- linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/adt_lec.c (original)
+++ linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/adt_lec.c Mon Feb 16 15:31:08 2009
@@ -33,7 +33,8 @@
 	params->tap_length = tap_length;
 }
 
-static int adt_lec_parse_params(struct adt_lec_params *params, struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p)
+static int adt_lec_parse_params(struct adt_lec_params *params,
+	struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p)
 {
 	unsigned int x;
 	char *c;

Modified: linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/firmware/Makefile
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/firmware/Makefile?view=diff&rev=6016&r1=6015&r2=6016
==============================================================================
--- linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/firmware/Makefile (original)
+++ linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/firmware/Makefile Mon Feb 16 15:31:08 2009
@@ -11,16 +11,16 @@
 # the GNU General Public License
 #
 
-.PHONY: dist-clean clean all uninstall have_download install object-build hotplug-install hotplug-dirs hotplug-uninstall make_firmware_object
+.PHONY: dist-clean clean all uninstall have_download install object-build hotplug-install hotplug-dirs hotplug-uninstall make_firmware_object firmware-loaders
 
 OCT6114_064_VERSION:=1.05.01
 OCT6114_128_VERSION:=1.05.01
 TC400M_VERSION:=MR6.12
-VPMADT032_VERSION:=1.07
+VPMADT032_VERSION:=1.17.0
 
 FIRMWARE_URL:=http://downloads.digium.com/pub/telephony/firmware/releases
 
-ALL_FIRMWARE=FIRMWARE-OCT6114-064 FIRMWARE-OCT6114-128 FIRMWARE-TC400M FIRMWARE-VPMADT032
+ALL_FIRMWARE=FIRMWARE-OCT6114-064 FIRMWARE-OCT6114-128 FIRMWARE-TC400M
 
 # Firmware files should use the naming convention: dahdi-fw-<base name>-<sub name>-<version> or dahdi-fw-<base name>-<version>
 # First example: dahdi-fw-oct6114-064-1.05.01
@@ -32,13 +32,13 @@
 FIRMWARE:=$(ALL_FIRMWARE:FIRMWARE-OCT6114-064=dahdi-fw-oct6114-064-$(OCT6114_064_VERSION).tar.gz)
 FIRMWARE:=$(FIRMWARE:FIRMWARE-OCT6114-128=dahdi-fw-oct6114-128-$(OCT6114_128_VERSION).tar.gz)
 FIRMWARE:=$(FIRMWARE:FIRMWARE-TC400M=dahdi-fw-tc400m-$(TC400M_VERSION).tar.gz)
-FIRMWARE:=$(FIRMWARE:FIRMWARE-VPMADT032=dahdi-fw-vpmadt032-$(VPMADT032_VERSION).tar.gz)
+
+FWLOADERS:=dahdi-fwload-vpmadt032-$(VPMADT032_VERSION).tar.gz
 
 # Build a list of object files if hotplug will not be used
 OBJECT_FILES:=$(ALL_FIRMWARE:FIRMWARE-OCT6114-064=dahdi-fw-oct6114-064.o)
 OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-OCT6114-128=dahdi-fw-oct6114-128.o)
 OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-TC400M=dahdi-fw-tc400m.o)
-OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-VPMADT032=dahdi-fw-vpmadt032.o)
 
 # Force usage of wget, for now
 DOWNLOAD=wget
@@ -55,6 +55,7 @@
 dist-clean: clean
 	rm -f dahdi-fw-*.bin
 	rm -f dahdi-fw-*.tar.gz
+	rm -f dahdi-fwload-*.tar.gz
 	rm -f make_firmware_object
 
 # Clean up anything we built
@@ -69,6 +70,14 @@
 		if test ! -f $@; then exit 1; fi; \
 		(cat $@ | gzip -d | tar -xof -) \
 	fi
+
+firmware-loaders: $(FWLOADERS)
+
+.PHONY: dahdi-fwload-vpmadt032-$(VPMADT032_VERSION).tar.gz
+dahdi-fwload-vpmadt032-$(VPMADT032_VERSION).tar.gz:
+	@if test ! -f $@; then echo "Attempting to download $@"; $(DOWNLOAD) $(WGET_ARGS) $(FIRMWARE_URL)/$@; fi; \
+	if test ! -f $@; then exit 1; fi; \
+	(cd ../../..; cat drivers/dahdi/firmware/$@ | gzip -d | tar -xof -) 
 
 # Create object files suitable for linking against
 object-build: $(FIRMWARE) $(OBJECT_FILES)
@@ -111,17 +120,6 @@
 else
 	@echo "Firmware dahdi-fw-tc400m.bin is already installed with required version $(TC400M_VERSION)"
 endif
-ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-vpmadt032-$(VPMADT032_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-vpmadt032-$(VPMADT032_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
-	@echo "Installing dahdi-fw-vpmadt032.bin to hotplug firmware directories"
-	@install -m 644 dahdi-fw-vpmadt032.bin $(DESTDIR)/usr/lib/hotplug/firmware
-	@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-vpmadt032-*
-	@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-vpmadt032-$(VPMADT032_VERSION)
-	@install -m 644 dahdi-fw-vpmadt032.bin $(DESTDIR)/lib/firmware
-	@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-vpmadt032-*
-	@touch $(DESTDIR)/lib/firmware/.dahdi-fw-vpmadt032-$(VPMADT032_VERSION)
-else
-	@echo "Firmware dahdi-fw-vpmadt032.bin is already installed with required version $(VPMADT032_VERSION)"
-endif
 
 # Uninstall any installed dahdi firmware images from hotplug firmware directories
 hotplug-uninstall:
@@ -154,8 +152,3 @@
 dahdi-fw-tc400m.o: dahdi-fw-tc400m-$(TC400M_VERSION).tar.gz dahdi-fw-tc400m.bin make_firmware_object
 	@echo Making firmware object file for dahdi-fw-tc400m.bin
 	./make_firmware_object dahdi-fw-tc400m.bin $@
-
-# Build object file of a VPMADT032 firmware image for linking
-dahdi-fw-vpmadt032.o: dahdi-fw-vpmadt032-$(VPMADT032_VERSION).tar.gz dahdi-fw-vpmadt032.bin make_firmware_object
-	@echo Making firmware object file for dahdi-fw-vpmadt032.bin
-	./make_firmware_object dahdi-fw-vpmadt032.bin $@

Copied: linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/GpakApi.c (from r6015, linux/team/sruffell/private/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/GpakApi.c)
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/GpakApi.c?view=diff&rev=6016&p1=linux/team/sruffell/private/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/GpakApi.c&r1=6015&p2=linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/GpakApi.c&r2=6016
==============================================================================
--- linux/team/sruffell/private/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/GpakApi.c (original)
+++ linux/team/sruffell/dahdi-linux-vpmadt032/drivers/dahdi/voicebus/GpakApi.c Mon Feb 16 15:31:08 2009
@@ -1,0 +1,1590 @@
+/*
+ * Copyright (c) 2005, Adaptive Digital Technologies, Inc.
+ *
+ * File Name: GpakApi.c
+ *
+ * Description:
+ *   This file contains user API functions to communicate with DSPs executing
+ *   G.PAK software. The file is integrated into the host processor connected
+ *   to C55X G.PAK DSPs via a Host Port Interface.
+ *
+ * Version: 1.0
+ *
+ * Revision History:
+ *   06/15/05 - Initial release.
+ *   11/15/2006  - 24 TDM-TDM Channels EC release
+ *
+ * This program has been released under the terms of the GPL version 2 by
+ * permission of Adaptive Digital Technologies, Inc.
+ *
+ */
+
+/*
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2 as published by the
+ * Free Software Foundation. See the LICENSE file included with
+ * this program for more details.
+ */
+
+#include "GpakHpi.h"
+#include "GpakCust.h"
+#include "GpakApi.h"
+#include "gpakenum.h"
+
+/* DSP to Host interface block offsets. */
+#define REPLY_MSG_PNTR_OFFSET 0     /* I/F blk offset to Reply Msg Pointer */
+#define CMD_MSG_PNTR_OFFSET 2       /* I/F blk offset to Command Msg Pointer */
+#define EVENT_MSG_PNTR_OFFSET 4     /* I/F blk offset to Event Msg Pointer */
+#define PKT_BUFR_MEM_OFFSET 6       /* I/F blk offset to Packet Buffer memory */
+#define DSP_STATUS_OFFSET 8         /* I/F blk offset to DSP Status */
+#define VERSION_ID_OFFSET 9         /* I/F blk offset to G.PAK Version Id */
+#define MAX_CMD_MSG_LEN_OFFSET 10   /* I/F blk offset to Max Cmd Msg Length */
+#define CMD_MSG_LEN_OFFSET 11       /* I/F blk offset to Command Msg Length */
+#define REPLY_MSG_LEN_OFFSET 12     /* I/F blk offset to Reply Msg Length */
+#define NUM_CHANNELS_OFFSET 13      /* I/F blk offset to Num Built Channels */
+#define NUM_PKT_CHANNELS_OFFSET 14  /* I/F blk offset to Num Pkt Channels */
+#define NUM_CONFERENCES_OFFSET 15   /* I/F blk offset to Num Conferences */
+//#define CPU_USAGE_OFFSET_1MS 16     /* I/F blk offset to CPU Usage statistics */
+#define CPU_USAGE_OFFSET 18         /* I/F blk offset to CPU Usage statistics */
+//#define CPU_USAGE_OFFSET_10MS 20    /* I/F blk offset to CPU Usage statistics */
+#define FRAMING_STATS_OFFSET 22     /* I/F blk offset to Framing statistics */
+
+//#define GPAK_RELEASE_Rate rate10ms
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
+// Macro to reconstruct a 32-bit value from two 16-bit values.
+// Parameter p32: 32-bit-wide destination
+// Parameter p16: 16-bit-wide source array of length 2 words
+#define RECONSTRUCT_LONGWORD(p32, p16) p32 = (DSP_ADDRESS)p16[0]<<16; \
+								       p32 |= (unsigned long)p16[1]
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
+
+/* DSP Status value definitions. */
+#define DSP_INIT_STATUS 0x5555		/* DSP Initialized status value */
+#define HOST_INIT_STATUS 0xAAAA		/* Host Initialized status value */
+
+/* Circular packet buffer information structure offsets. */
+#define CB_BUFR_BASE 0              /* pointer to base of circular buffer */
+#define CB_BUFR_SIZE 2              /* size of buffer (words) */
+#define CB_BUFR_PUT_INDEX 3         /* offset in buffer for next write */
+#define CB_BUFR_TAKE_INDEX 4        /* offset in buffer for next read */
+#define CIRC_BUFFER_INFO_STRUCT_SIZE 6 
+
+/* Miscellaneous definitions. */
+#define MSG_BUFFER_SIZE 100 /* size (words) of Host msg buffer */
+#define WORD_BUFFER_SIZE 84  /* size of DSP Word buffer (words) */
+
+#ifdef __TMS320C55XX__ // debug sections if not on host
+#pragma DATA_SECTION(pDspIfBlk,"GPAKAPIDEBUG_SECT")
+#pragma DATA_SECTION(MaxCmdMsgLen,"GPAKAPIDEBUG_SECT")
+#pragma DATA_SECTION(MaxChannels,"GPAKAPIDEBUG_SECT")
+#pragma DATA_SECTION(DlByteBufr,"GPAKAPIDEBUG_SECT")
+#pragma DATA_SECTION(DlWordBufr,"GPAKAPIDEBUG_SECT")
+#pragma DATA_SECTION(pEventFifoAddress,"GPAKAPIDEBUG_SECT")
+#endif
+
+/* Host variables related to Host to DSP interface. */
+static DSP_ADDRESS pDspIfBlk[MAX_DSP_CORES];    /* DSP address of I/F block */
+static DSP_WORD MaxCmdMsgLen[MAX_DSP_CORES]; /* max Cmd msg length (octets) */
+static unsigned short int MaxChannels[MAX_DSP_CORES];    /* max num channels */
+
+//static unsigned short int MaxPktChannels[MAX_DSP_CORES]; /* max num pkt channels */
+//static unsigned short int MaxConfs[MAX_DSP_CORES];    /* max num conferences */
+//static DSP_ADDRESS pPktInBufr[MAX_DSP_CORES][MAX_PKT_CHANNELS];  /* Pkt In buffer */
+//static DSP_ADDRESS pPktOutBufr[MAX_DSP_CORES][MAX_PKT_CHANNELS]; /* Pkt Out buffer */
+static DSP_ADDRESS pEventFifoAddress[MAX_DSP_CORES]; /* event fifo */
+
+static unsigned char DlByteBufr[DOWNLOAD_BLOCK_SIZE * 2]; /* Dowload byte buf */
+static DSP_WORD DlWordBufr[DOWNLOAD_BLOCK_SIZE];      /* Dowload word buffer */
+
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * CheckDspReset - Check if the DSP was reset.
+ *
+ * FUNCTION
+ *  This function determines if the DSP was reset and is ready. If reset
+ *  occurred, it reads interface parameters and calculates DSP addresses.
+ *
+ * RETURNS
+ *  -1 = DSP is not ready.
+ *   0 = Reset did not occur.
+ *   1 = Reset occurred.
+ *
+ */
+static int CheckDspReset(
+    int DspId               /* DSP Identifier (0 to MaxDSPCores-1) */
+    )
+{
+    DSP_ADDRESS IfBlockPntr; /* Interface Block pointer */
+    DSP_WORD DspStatus;      /* DSP Status */
+    DSP_WORD DspChannels;    /* number of DSP channels */
+    DSP_WORD  Temp[2];
+
+    /* Read the pointer to the Interface Block. */
+    gpakReadDspMemory(DspId, DSP_IFBLK_ADDRESS, 2, Temp);
+    RECONSTRUCT_LONGWORD(IfBlockPntr, Temp);
+
+    /* If the pointer is zero, return with an indication the DSP is not
+       ready. */
+    if (IfBlockPntr == 0)
+        return (-1);
+
+    /* Read the DSP's Status. */
+    gpakReadDspMemory(DspId, IfBlockPntr + DSP_STATUS_OFFSET, 1, &DspStatus);
+
+    /* If status indicates the DSP was reset, read the DSP's interface
+       parameters and calculate DSP addresses. */
+    if (DspStatus == DSP_INIT_STATUS ||
+        ((DspStatus == HOST_INIT_STATUS) && (pDspIfBlk[DspId] == 0))) 
+    {
+        /* Save the address of the DSP's Interface Block. */
+        pDspIfBlk[DspId] = IfBlockPntr;
+
+        /* Read the DSP's interface parameters. */
+        gpakReadDspMemory(DspId, IfBlockPntr + MAX_CMD_MSG_LEN_OFFSET, 1,
+                          &(MaxCmdMsgLen[DspId]));
+
+        /* read the number of configured DSP channels */
+        gpakReadDspMemory(DspId, IfBlockPntr + NUM_CHANNELS_OFFSET, 1,
+                          &DspChannels);
+        if (DspChannels > MAX_CHANNELS)
+            MaxChannels[DspId] = MAX_CHANNELS;
+        else
+            MaxChannels[DspId] = (unsigned short int) DspChannels;
+
+        /* read the pointer to the event fifo info struct */
+        gpakReadDspMemory(DspId, IfBlockPntr + EVENT_MSG_PNTR_OFFSET, 2, Temp);
+        RECONSTRUCT_LONGWORD(pEventFifoAddress[DspId], Temp);
+
+        /* Set the DSP Status to indicate the host recognized the reset. */
+        DspStatus = HOST_INIT_STATUS;
+        gpakWriteDspMemory(DspId, IfBlockPntr + DSP_STATUS_OFFSET, 1,
+                           &DspStatus);
+
+        /* Return with an indication that a reset occurred. */
+        return (1);
+    }
+
+    /* If status doesn't indicate the host recognized a reset, return with an
+       indication the DSP is not ready. */
+    if ((DspStatus != HOST_INIT_STATUS) || (pDspIfBlk[DspId] == 0))
+        return (-1);
+
+    /* Return with an indication that a reset did not occur. */
+    return (0);
+}
+
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * WriteDspCmdMessage - Write a Host Command/Request message to DSP.
+ *
+ * FUNCTION
+ *  This function writes a Host Command/Request message into DSP memory and
+ *  informs the DSP of the presence of the message.
+ *
+ * RETURNS
+ *  -1 = Unable to write message (msg len or DSP Id invalid or DSP not ready)
+ *   0 = Temporarily unable to write message (previous Cmd Msg busy)
+ *   1 = Message written successfully
+ *
+ */
+static int WriteDspCmdMessage(
+    int DspId,                      /* DSP Identifier (0 to MaxDSPCores-1) */
+    DSP_WORD *pMessage,          /* pointer to Command message */
+    DSP_WORD MsgLength              /* length of message (octets) */
+    )
+{
+    DSP_WORD CmdMsgLength;      /* current Cmd message length */
+    DSP_WORD Temp[2];
+    DSP_ADDRESS BufferPointer;     /* message buffer pointer */
+
+    /* Check if the DSP was reset and is ready. */
+    if (CheckDspReset(DspId) == -1)
+        return (-1);
+
+    /* Make sure the message length is valid. */
+    if ((MsgLength < 1) || (MsgLength > MaxCmdMsgLen[DspId]))
+        return (-1);
+
+    /* Make sure a previous Command message is not in use by the DSP. */
+    gpakReadDspMemory(DspId, pDspIfBlk[DspId] + CMD_MSG_LEN_OFFSET, 1,
+                      &CmdMsgLength);
+    if (CmdMsgLength != 0)
+        return (0);
+
+    /* Purge any previous Reply message that wasn't read. */
+    gpakWriteDspMemory(DspId, pDspIfBlk[DspId] + REPLY_MSG_LEN_OFFSET, 1,
+                       &CmdMsgLength);
+
+    /* Copy the Command message into DSP memory. */
+    gpakReadDspMemory(DspId, pDspIfBlk[DspId] + CMD_MSG_PNTR_OFFSET, 2, Temp);
+    RECONSTRUCT_LONGWORD(BufferPointer, Temp);
+    gpakWriteDspMemory(DspId, BufferPointer, (MsgLength + 1) / 2, pMessage);
+
+    /* Store the message length in DSP's Command message length (flags DSP that
+       a Command message is ready). */
+    CmdMsgLength = MsgLength;
+    gpakWriteDspMemory(DspId, pDspIfBlk[DspId] + CMD_MSG_LEN_OFFSET, 1,
+                       &CmdMsgLength);
+
+    /* Return with an indication the message was written. */
+    return (1);
+}
+
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * ReadDspReplyMessage - Read a DSP Reply message from DSP.
+ *
+ * FUNCTION
+ *  This function reads a DSP Reply message from DSP memory.
+ *
+ * RETURNS
+ *  -1 = Unable to write message (msg len or DSP Id invalid or DSP not ready)
+ *   0 = No message available (DSP Reply message empty)
+ *   1 = Message read successfully (message and length stored in variables)
+ *
+ */
+static int ReadDspReplyMessage(
+    int DspId,                      /* DSP Identifier (0 to MaxDSPCores-1) */
+    DSP_WORD *pMessage,             /* pointer to Reply message buffer */
+    DSP_WORD *pMsgLength            /* pointer to msg length var (octets) */
+    )
+{
+    DSP_WORD MsgLength;         /* message length */
+    DSP_ADDRESS BufferPointer;  /* message buffer pointer */
+    DSP_WORD Temp[2];
+
+    /* Check if the DSP was reset and is ready. */
+    if (CheckDspReset(DspId) == -1)
+        return (-1);
+
+    /* Check if a Reply message is ready. */
+    gpakReadDspMemory(DspId, pDspIfBlk[DspId] + REPLY_MSG_LEN_OFFSET, 1,
+                      &MsgLength);
+    if (MsgLength == 0)
+        return (0);
+
+    /* Make sure the message length is valid. */
+    if (MsgLength > *pMsgLength)
+        return (-1);
+
+    /* Copy the Reply message from DSP memory. */
+    gpakReadDspMemory(DspId, pDspIfBlk[DspId] + REPLY_MSG_PNTR_OFFSET, 2, Temp);
+    RECONSTRUCT_LONGWORD(BufferPointer, Temp);
+    gpakReadDspMemory(DspId, BufferPointer, (MsgLength + 1) / 2, pMessage);
+
+    /* Store the message length in the message length variable. */
+    *pMsgLength = MsgLength;
+
+    /* Indicate a Reply message is not ready. */
+    MsgLength = 0;
+    gpakWriteDspMemory(DspId, pDspIfBlk[DspId] + REPLY_MSG_LEN_OFFSET, 1,
+                       &MsgLength);
+
+    /* Return with an indication the message was read. */
+    return (1);
+}
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * ReadCircBuffer - Read from a DSP circular buffer.
+ *
+ * FUNCTION
+ *  This function reads a block of words from a DSP circular buffer. The Take
+ *  address is incremented by the number of words read adjusting for buffer
+ *  wrap.
+ *
+ * RETURNS
+ *  nothing
+ *
+ */
+static void ReadCircBuffer(
+    int DspId,                  /* DSP Identifier (0 to MaxDSPCores-1) */
+    DSP_ADDRESS BufrBaseAddress,   /* address of base of circular buffer */
+    DSP_ADDRESS BufrLastAddress,   /* address of last word in buffer */
+    DSP_ADDRESS *TakeAddress,      /* pointer to address in buffer for read */
+    DSP_WORD *pWordBuffer,      /* pointer to buffer for words read */
+    DSP_WORD NumWords           /* number of words to read */
+    )
+{
+    DSP_WORD WordsTillEnd;      /* number of words until end of buffer */
+
+    /* Determine the number of words from the start address until the end of the
+       buffer. */
+    WordsTillEnd = BufrLastAddress - *TakeAddress + 1;
+
+    /* If a buffer wrap will occur, read the first part at the end of the
+       buffer followed by the second part at the beginning of the buffer. */
+    if (NumWords > WordsTillEnd)
+    {
+        gpakReadDspMemory(DspId, *TakeAddress, WordsTillEnd, pWordBuffer);
+        gpakReadDspMemory(DspId, BufrBaseAddress, NumWords - WordsTillEnd,
+                           &(pWordBuffer[WordsTillEnd]));
+        *TakeAddress = BufrBaseAddress + NumWords - WordsTillEnd;
+    }
+
+    /* If a buffer wrap will not occur, read all words starting at the current
+       take address in the buffer. */
+    else
+    {
+        gpakReadDspMemory(DspId, *TakeAddress, NumWords, pWordBuffer);
+        if (NumWords == WordsTillEnd)
+            *TakeAddress = BufrBaseAddress;
+        else
+            *TakeAddress = *TakeAddress + NumWords;
+    }
+    return;
+}
+
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * VerifyReply - Verify the reply message is correct for the command sent.
+ *
+ * FUNCTION
+ *  This function verifies correct reply message content for the command that
+ *  was just sent.
+ *
+ * RETURNS
+ *  0 = Incorrect
+ *  1 = Correct
+ *
+ */
+static int VerifyReply(
+    DSP_WORD *pMsgBufr,     /* pointer to Reply message buffer */
+    int CheckType,          /* reply check type */
+    DSP_WORD CheckValue     /* reply check value */
+    )
+{
+
+    /* Verify Channel or Conference Id. */
+    if (CheckType == 1)
+    {
+        if (((pMsgBufr[1] >> 8) & 0xFF) != CheckValue)
+            return (0);
+    }
+
+    /* Verify Test Mode Id. */
+    else if (CheckType == 2)
+    {
+        if (pMsgBufr[1] != CheckValue)
+            return (0);
+    }
+
+    /* Return with an indication of correct reply. */
+    return (1);
+}
+
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * TransactCmd - Send a command to the DSP and receive it's reply.
+ *
+ * FUNCTION
+ *  This function sends the specified command to the DSP and receives the DSP's
+ *  reply.
+ *
+ * RETURNS
+ *  Length of reply message (0 = Failure)
+ *
+ */
+static unsigned int TransactCmd(
+    int DspId,                  /* DSP Identifier (0 to MaxDSPCores-1) */
+    DSP_WORD *pMsgBufr,         /* pointer to Cmd/Reply message buffer */
+    DSP_WORD CmdLength,         /* length of command message (octets) */
+    DSP_WORD ReplyType,         /* required type of reply message */
+    DSP_WORD ReplyLength,       /* required length of reply message (octets) */
+    int ReplyCheckType,         /* reply check type */
+    DSP_WORD ReplyCheckValue    /* reply check value */
+    )
+{
+    int FuncStatus;             /* function status */
+    int LoopCount;              /* wait loop counter */
+    DSP_WORD RcvReplyLength;    /* received Reply message length */
+    DSP_WORD RcvReplyType;      /* received Reply message type code */
+    DSP_WORD RetValue;          /* return value */
+
+    /* Default the return value to indicate a failure. */
+    RetValue = 0;
+
+    /* Lock access to the DSP. */
+    gpakLockAccess(DspId);
+
+    /* Attempt to write the command message to the DSP. */
+    LoopCount = 0;
+    while ((FuncStatus = WriteDspCmdMessage(DspId, pMsgBufr, CmdLength)) != 1)
+    {
+        if (FuncStatus == -1)
+            break;
+        if (++LoopCount > MAX_WAIT_LOOPS)
+            break;
+        gpakHostDelay();
+    }
+
+    /* Attempt to read the reply message from the DSP if the command message was
+       sent successfully. */
+    if (FuncStatus == 1)
+    {
+        for (LoopCount = 0; LoopCount < MAX_WAIT_LOOPS; LoopCount++)
+        {
+            RcvReplyLength = MSG_BUFFER_SIZE * 2;
+            FuncStatus = ReadDspReplyMessage(DspId, pMsgBufr, &RcvReplyLength);
+            if (FuncStatus == 1)
+            {
+                RcvReplyType = (pMsgBufr[0] >> 8) & 0xFF;
+                if ((RcvReplyLength >= ReplyLength) &&
+                    (RcvReplyType == ReplyType) &&
+                    VerifyReply(pMsgBufr, ReplyCheckType, ReplyCheckValue))
+                {
+                    RetValue = RcvReplyLength;
+                    break;
+                }
+                else if (RcvReplyType == MSG_NULL_REPLY)
+                    break;
+            }
+            else if (FuncStatus == -1)
+                break;
+            gpakHostDelay();
+        }
+    }
+
+    /* Unlock access to the DSP. */
+    gpakUnlockAccess(DspId);
+
+    /* Return the length of the reply message (0 = failure). */
+    return (RetValue);
+}
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * gpakConfigurePorts - Configure a DSP's serial ports.
+ *
+ * FUNCTION
+ *  This function configures a DSP's serial ports.
+ *
+ * RETURNS
+ *  Status code indicating success or a specific error.
+ *
+ */
+gpakConfigPortStatus_t gpakConfigurePorts(
+    unsigned short int DspId,       /* DSP Id (0 to MaxDSPCores-1) */
+    const GpakPortConfig_t *pPortConfig,  /* pointer to Port Config info */
+    GPAK_PortConfigStat_t *pStatus  /* pointer to Port Config Status */
+    )
+{
+    DSP_WORD MsgBuffer[MSG_BUFFER_SIZE];    /* message buffer */
+
+    /* Make sure the DSP Id is valid. */
+    if (DspId >= MAX_DSP_CORES)
+        return (CpsInvalidDsp);
+
+    /* Build the Configure Serial Ports message. */
+    MsgBuffer[0] = MSG_CONFIGURE_PORTS << 8;
+    MsgBuffer[1] = (DSP_WORD)
+                   ((pPortConfig->SlotsSelect1 << 12) |
+                    ((pPortConfig->FirstBlockNum1 << 8) & 0x0F00) |
+                    ((pPortConfig->SecBlockNum1 << 4) & 0x00F0));
+    MsgBuffer[2] = (DSP_WORD) pPortConfig->FirstSlotMask1;
+    MsgBuffer[3] = (DSP_WORD) pPortConfig->SecSlotMask1;
+    MsgBuffer[4] = (DSP_WORD)
+                   ((pPortConfig->SlotsSelect2 << 12) |
+                    ((pPortConfig->FirstBlockNum2 << 8) & 0x0F00) |
+                    ((pPortConfig->SecBlockNum2 << 4) & 0x00F0));
+    MsgBuffer[5] = (DSP_WORD) pPortConfig->FirstSlotMask2;
+    MsgBuffer[6] = (DSP_WORD) pPortConfig->SecSlotMask2;
+    MsgBuffer[7] = (DSP_WORD)
+                   ((pPortConfig->SlotsSelect3 << 12) |
+                    ((pPortConfig->FirstBlockNum3 << 8) & 0x0F00) |
+                    ((pPortConfig->SecBlockNum3 << 4) & 0x00F0));
+    MsgBuffer[8] = (DSP_WORD) pPortConfig->FirstSlotMask3;
+    MsgBuffer[9] = (DSP_WORD) pPortConfig->SecSlotMask3;
+
+    MsgBuffer[10] = (DSP_WORD)
+                   (((pPortConfig->DxDelay1 << 11) & 0x0800) |
+                    ((pPortConfig->RxDataDelay1 << 9) & 0x0600) |
+                    ((pPortConfig->TxDataDelay1 << 7) & 0x0180) |
+                    ((pPortConfig->RxClockPolarity1 << 6) & 0x0040) |
+                    ((pPortConfig->TxClockPolarity1 << 5) & 0x0020) |
+                    ((pPortConfig->RxFrameSyncPolarity1 << 4) & 0x0010) |
+                    ((pPortConfig->TxFrameSyncPolarity1 << 3) & 0x0008) |
+                    ((pPortConfig->CompandingMode1 << 1) & 0x0006) |
+                    (pPortConfig->SerialWordSize1 & 0x0001));
+
+    MsgBuffer[11] = (DSP_WORD)
+                   (((pPortConfig->DxDelay2 << 11) & 0x0800) |
+                    ((pPortConfig->RxDataDelay2 << 9) & 0x0600) |
+                    ((pPortConfig->TxDataDelay2 << 7) & 0x0180) |
+                    ((pPortConfig->RxClockPolarity2 << 6) & 0x0040) |
+                    ((pPortConfig->TxClockPolarity2 << 5) & 0x0020) |
+                    ((pPortConfig->RxFrameSyncPolarity2 << 4) & 0x0010) |
+                    ((pPortConfig->TxFrameSyncPolarity2 << 3) & 0x0008) |
+                    ((pPortConfig->CompandingMode2 << 1) & 0x0006) |
+                    (pPortConfig->SerialWordSize2 & 0x0001));
+
+    MsgBuffer[12] = (DSP_WORD)
+                   (((pPortConfig->DxDelay3 << 11) & 0x0800) |
+                    ((pPortConfig->RxDataDelay3 << 9) & 0x0600) |
+                    ((pPortConfig->TxDataDelay3 << 7) & 0x0180) |
+                    ((pPortConfig->RxClockPolarity3 << 6) & 0x0040) |
+                    ((pPortConfig->TxClockPolarity3 << 5) & 0x0020) |
+                    ((pPortConfig->RxFrameSyncPolarity3 << 4) & 0x0010) |
+                    ((pPortConfig->TxFrameSyncPolarity3 << 3) & 0x0008) |
+                    ((pPortConfig->CompandingMode3 << 1) & 0x0006) |
+                    (pPortConfig->SerialWordSize3 & 0x0001));
+
+    MsgBuffer[13] = (DSP_WORD) pPortConfig->ThirdSlotMask1;
+    MsgBuffer[14] = (DSP_WORD) pPortConfig->FouthSlotMask1;
+    MsgBuffer[15] = (DSP_WORD) pPortConfig->FifthSlotMask1;
+    MsgBuffer[16] = (DSP_WORD) pPortConfig->SixthSlotMask1;
+    MsgBuffer[17] = (DSP_WORD) pPortConfig->SevenSlotMask1;
+    MsgBuffer[18] = (DSP_WORD) pPortConfig->EightSlotMask1;
+    
+    MsgBuffer[19] = (DSP_WORD) pPortConfig->ThirdSlotMask2;;
+    MsgBuffer[20] = (DSP_WORD) pPortConfig->FouthSlotMask2;            
+    MsgBuffer[21] = (DSP_WORD) pPortConfig->FifthSlotMask2;;             
+    MsgBuffer[22] = (DSP_WORD) pPortConfig->SixthSlotMask2;            
+    MsgBuffer[23] = (DSP_WORD) pPortConfig->SevenSlotMask2;;             
+    MsgBuffer[24] = (DSP_WORD) pPortConfig->EightSlotMask2;            
+
+    MsgBuffer[25] = (DSP_WORD) pPortConfig->ThirdSlotMask3;;
+    MsgBuffer[26] = (DSP_WORD) pPortConfig->FouthSlotMask3;            
+    MsgBuffer[27] = (DSP_WORD) pPortConfig->FifthSlotMask3;;             
+    MsgBuffer[28] = (DSP_WORD) pPortConfig->SixthSlotMask3;            
+    MsgBuffer[29] = (DSP_WORD) pPortConfig->SevenSlotMask3;;             
+    MsgBuffer[30] = (DSP_WORD) pPortConfig->EightSlotMask3;            
+
+
+    /* Attempt to send the Configure Serial Ports message to the DSP and receive
+       it's reply. */
+	if (!TransactCmd(DspId, MsgBuffer, 62, MSG_CONFIG_PORTS_REPLY, 4, 0, 0))
+        return (CpsDspCommFailure);
+
+    /* Return with an indication of success or failure based on the return
+       status in the reply message. */
+    *pStatus = (GPAK_PortConfigStat_t) (MsgBuffer[1] & 0xFF);
+    if (*pStatus == Pc_Success)
+        return (CpsSuccess);
+    else
+        return (CpsParmError);
+}
+EXPORT_SYMBOL(gpakConfigurePorts);
+
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * gpakConfigureChannel - Configure a DSP's Channel.
+ *
+ * FUNCTION
+ *  This function configures a DSP's Channel.
+ *
+ * RETURNS
+ *  Status code indicating success or a specific error.
+ *
+ */
+gpakConfigChanStatus_t gpakConfigureChannel(
+    unsigned short int DspId,           /* DSP Id (0 to MaxDSPCores-1) */
+    unsigned short int ChannelId,       /* Channel Id (0 to MaxChannels-1) */
+    GpakChanType ChannelType,           /* Channel Type */
+    GpakChannelConfig_t *pChanConfig,   /* pointer to Channel Config info */
+    GPAK_ChannelConfigStat_t *pStatus   /* pointer to Channel Config Status */
+    )
+{
+    DSP_WORD MsgBuffer[MSG_BUFFER_SIZE];    /* message buffer */
+    DSP_WORD MsgLength;                     /* message length */
+
+    /* Make sure the DSP Id is valid. */
+    if (DspId >= MAX_DSP_CORES)
+        return (CcsInvalidDsp);
+
+    /* Make sure the Channel Id is valid. */
+    if (ChannelId >= MaxChannels[DspId])
+        return (CcsInvalidChannel);
+
+    /* Build the Configure Channel message based on the Channel Type. */
+    switch (ChannelType)
+    {
+
+    /* PCM to Packet channel type. */
+    case tdmToTdm:
+
+        MsgBuffer[2] = (DSP_WORD)

[... 8010 lines stripped ...]



More information about the dahdi-commits mailing list