xpp: A copy of oct612x in dahdi-tools
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>
Sun, 10 Jul 2011 16:10:32 +0000 (16:10 +0000)
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>
Sun, 10 Jul 2011 16:10:32 +0000 (16:10 +0000)
Include a copy of the oct612x Octasic echo canceller interface to be used
by astribank_hexload to load the echo canceller firmware to a Xorcom
Astribank.

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/trunk@10030 17933a7a-c749-41c5-a318-cba88f637d49

96 files changed:
xpp/oct612x/Makefile [new file with mode: 0644]
xpp/oct612x/apilib/bt/octapi_bt0.c [new file with mode: 0644]
xpp/oct612x/apilib/bt/octapi_bt0_private.h [new file with mode: 0644]
xpp/oct612x/apilib/largmath/octapi_largmath.c [new file with mode: 0644]
xpp/oct612x/apilib/llman/octapi_llman.c [new file with mode: 0644]
xpp/oct612x/apilib/llman/octapi_llman_private.h [new file with mode: 0644]
xpp/oct612x/get_discards [new file with mode: 0755]
xpp/oct612x/include/apilib/octapi_bt0.h [new file with mode: 0644]
xpp/oct612x/include/apilib/octapi_largmath.h [new file with mode: 0644]
xpp/oct612x/include/apilib/octapi_llman.h [new file with mode: 0644]
xpp/oct612x/include/digium_unused.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_adpcm_chan_inst.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_adpcm_chan_pub.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_api.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_api_inst.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_apimi.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_apiud.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_channel_inst.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_channel_pub.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_chip_open_inst.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_chip_open_pub.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_chip_stats_inst.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_chip_stats_pub.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_conf_bridge_inst.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_conf_bridge_pub.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_debug_inst.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_debug_pub.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_defines.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_errors.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_events_inst.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_events_pub.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_interrupts_inst.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_interrupts_pub.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_mixer_inst.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_mixer_pub.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_phasing_tsst_inst.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_phasing_tsst_pub.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_playout_buf_inst.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_playout_buf_pub.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_remote_debug_inst.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_remote_debug_pub.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_tlv_inst.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_tone_detection_inst.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_tone_detection_pub.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_tsi_cnct_inst.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_tsi_cnct_pub.h [new file with mode: 0644]
xpp/oct612x/include/oct6100api/oct6100_tsst_inst.h [new file with mode: 0644]
xpp/oct612x/include/octdef.h [new file with mode: 0644]
xpp/oct612x/include/octmac.h [new file with mode: 0644]
xpp/oct612x/include/octosdependant.h [new file with mode: 0644]
xpp/oct612x/include/octrpc/oct6100_rpc_protocol.h [new file with mode: 0644]
xpp/oct612x/include/octrpc/rpc_protocol.h [new file with mode: 0644]
xpp/oct612x/include/octtype.h [new file with mode: 0644]
xpp/oct612x/include/octtypevx.h [new file with mode: 0644]
xpp/oct612x/include/octtypewin.h [new file with mode: 0644]
xpp/oct612x/octasic-helper [new file with mode: 0755]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_adpcm_chan_priv.h [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_events.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_user.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_apimi/oct6100_mask_interrupts.c [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_channel_priv.h [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_chip_open_priv.h [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_chip_stats_priv.h [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_conf_bridge_priv.h [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_debug_priv.h [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_events_priv.h [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_interrupts_priv.h [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_memory_priv.h [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_mixer_priv.h [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_phasing_tsst_priv.h [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_playout_buf_priv.h [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_remote_debug_priv.h [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_tlv_priv.h [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_tone_detection_priv.h [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_tsi_cnct_priv.h [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_tsst_priv.h [new file with mode: 0644]
xpp/oct612x/octdeviceapi/oct6100api/oct6100_version.h [new file with mode: 0644]
xpp/oct612x/test.c [new file with mode: 0644]

diff --git a/xpp/oct612x/Makefile b/xpp/oct612x/Makefile
new file mode 100644 (file)
index 0000000..e3e32e5
--- /dev/null
@@ -0,0 +1,38 @@
+CFLAGS=-V3.4 -ffunction-sections -I/lib/modules/$(shell uname -r)/build/include -Iinclude -Ioctdeviceapi -Ioctdeviceapi/oct6100api -DGFP_ATOMIC=0 -Dkmalloc=calloc -Dkfree=free
+LDFLAGS=-V3.4 -Wl,-Map -Wl,test.map -Wl,--gc-sections
+
+APIDIR=octdeviceapi/oct6100api/oct6100_api
+
+OCTASIC_OBJS=$(APIDIR)/oct6100_adpcm_chan.o \
+           $(APIDIR)/oct6100_channel.o \
+           $(APIDIR)/oct6100_chip_open.o \
+           $(APIDIR)/oct6100_chip_stats.o \
+           $(APIDIR)/oct6100_conf_bridge.o \
+           $(APIDIR)/oct6100_debug.o \
+           $(APIDIR)/oct6100_events.o \
+           $(APIDIR)/oct6100_interrupts.o \
+           $(APIDIR)/oct6100_memory.o \
+           $(APIDIR)/oct6100_miscellaneous.o \
+           $(APIDIR)/oct6100_mixer.o \
+           $(APIDIR)/oct6100_phasing_tsst.o \
+           $(APIDIR)/oct6100_playout_buf.o \
+           $(APIDIR)/oct6100_remote_debug.o \
+           $(APIDIR)/oct6100_tlv.o \
+           $(APIDIR)/oct6100_tone_detection.o \
+           $(APIDIR)/oct6100_tsi_cnct.o \
+           $(APIDIR)/oct6100_tsst.o \
+           $(APIDIR)/oct6100_user.o \
+           apilib/bt/octapi_bt0.o \
+           apilib/largmath/octapi_largmath.o \
+           apilib/llman/octapi_llman.o
+
+
+all: test
+
+test.o: test.c
+
+test: test.o $(OCTASIC_OBJS)
+
+clean:
+       rm -rf test test.o
+       rm -rf $(OCTASIC_OBJS)
diff --git a/xpp/oct612x/apilib/bt/octapi_bt0.c b/xpp/oct612x/apilib/bt/octapi_bt0.c
new file mode 100644 (file)
index 0000000..f9af44a
--- /dev/null
@@ -0,0 +1,1217 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+
+File:  octapi_bt0.c
+
+    Copyright (c) 2001-2007 Octasic Inc.
+    
+Description: 
+
+       Library used to manage a binary tree of variable max size.  Library is
+       made to use one block of contiguous memory to manage the tree.
+
+This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API  is 
+free software; you can redistribute it and/or modify it under the terms of 
+the GNU General Public License as published by the Free Software Foundation; 
+either version 2 of the License, or (at your option) any later version.
+
+The OCT6100 GPL API is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
+for more details. 
+
+You should have received a copy of the GNU General Public License 
+along with the OCT6100 GPL API; if not, write to the Free Software 
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+$Octasic_Release: OCT612xAPI-01.00-PR49 $
+
+$Octasic_Revision: 18 $
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#include "apilib/octapi_bt0.h"
+#include "octapi_bt0_private.h"
+
+
+
+#if !SKIP_OctApiBt0GetSize
+UINT32 OctApiBt0GetSize(UINT32 number_of_items,UINT32 key_size, UINT32 data_size, UINT32 * b_size)
+{
+       if ((key_size % 4) != 0) return(OCTAPI_BT0_KEY_SIZE_NOT_MUTLIPLE_OF_UINT32);
+       if ((data_size % 4) != 0) return(OCTAPI_BT0_DATA_SIZE_NOT_MUTLIPLE_OF_UINT32);
+
+       *b_size = 0;
+       *b_size += sizeof(OCTAPI_BT0);
+       *b_size += sizeof(OCTAPI_BT0_NODE) * number_of_items;
+       *b_size += key_size * number_of_items;
+       *b_size += data_size * number_of_items;
+
+       return(GENERIC_OK);
+}
+#endif
+
+#if !SKIP_OctApiBt0Init
+UINT32 OctApiBt0Init(void ** b,UINT32 number_of_items,UINT32 key_size, UINT32 data_size)
+{
+       UINT32 i;
+       OCTAPI_BT0 * bb;
+
+       /* Check input parameters.*/
+       if ((key_size % 4) != 0) return(OCTAPI_BT0_KEY_SIZE_NOT_MUTLIPLE_OF_UINT32);
+       if ((data_size % 4) != 0) return(OCTAPI_BT0_DATA_SIZE_NOT_MUTLIPLE_OF_UINT32);
+
+       /* If b is not already allocated.*/
+       if (*b == NULL) return(OCTAPI_BT0_MALLOC_FAILED);
+
+       bb = (OCTAPI_BT0 *)(*b);
+
+       /* Initialize the tree to an empty one!*/
+       bb->root_link.node_number = 0xFFFFFFFF;
+       bb->root_link.depth = 0;
+
+       /* Initialize tree parameters.*/
+       bb->number_of_items = number_of_items;
+       bb->key_size = key_size / 4;
+       bb->data_size = data_size / 4;
+
+       /* Initialize the next free node pointer.*/
+       if (number_of_items != 0)
+               bb->next_free_node = 0;
+       else
+               bb->next_free_node = 0xFFFFFFFF;
+
+       /* Setup the arrays.*/
+       OctApiBt0CorrectPointers(bb);
+
+       /* Initialize the Nodes to unused!*/
+       for(i=0;i<number_of_items;i++)
+       {
+               bb->node[i].next_free_node = i + 1;
+       }
+
+       /* Last empty node points to invalid node.*/
+       bb->node[number_of_items-1].next_free_node = 0xFFFFFFFF;
+
+       bb->invalid_value = 0xFFFFFFFF;
+       bb->no_smaller_key = OCTAPI_BT0_NO_SMALLER_KEY;
+
+       return(GENERIC_OK);
+}
+#endif
+
+
+#if !SKIP_OctApiBt0CorrectPointers
+void OctApiBt0CorrectPointers(OCTAPI_BT0 * bb)
+{
+       bb->node = (OCTAPI_BT0_NODE *)(((BYTE *)bb) + sizeof(OCTAPI_BT0));
+       bb->key = (UINT32 *)(((BYTE *)bb->node) + (sizeof(OCTAPI_BT0_NODE) * bb->number_of_items));
+       bb->data = (UINT32 *)(((BYTE *)bb->key) + (sizeof(UINT32) * bb->number_of_items * bb->key_size));
+}
+#endif
+
+
+#if !SKIP_OctApiBt0AddNode
+UINT32 OctApiBt0AddNode(void * b,void * key,void ** data)
+{
+       OCTAPI_BT0 * bb;
+       OCTAPI_BT0_NODE * new_node;
+       UINT32 * lkey;
+       UINT32 * nkey;
+       UINT32 i;
+       UINT32 new_node_number;
+       UINT32 result;
+
+       /* Load all!*/
+       bb = (OCTAPI_BT0 *)(b);
+       OctApiBt0CorrectPointers(bb);
+
+       /* Check that there is at least one block left.*/
+       if (bb->next_free_node == 0xFFFFFFFF) return(OCTAPI_BT0_NO_NODES_AVAILABLE);
+
+       /* Seize the node!*/
+       new_node_number = bb->next_free_node;
+       new_node = &(bb->node[new_node_number]);
+       bb->next_free_node = new_node->next_free_node;
+
+       /* Register in the key and the data.*/
+       lkey = ((UINT32 *)key);
+
+       /* Find the first UINT32 of the key.*/
+       nkey = &(bb->key[bb->key_size * new_node_number]);
+
+       /* Copy the key.*/
+       for(i=0;i<bb->key_size;i++)
+               nkey[i] = lkey[i];
+
+       /* Attempt to place the node. Only a "multiple hit" will cause an error.*/
+       result = OctApiBt0AddNode2(bb,&(bb->root_link), lkey, new_node_number);
+       if (result != GENERIC_OK) 
+       {
+               /* This attempt failed. Refree the node!*/
+               bb->next_free_node = new_node_number;
+
+               /* Return the error code.*/
+               return(result);
+       }
+
+       /* Return the address of the data to the user.*/
+       if ( bb->data_size > 0 )
+               *data = (void *)(&(bb->data[bb->data_size * new_node_number]));
+
+       return(GENERIC_OK);
+}
+#endif
+
+#if !SKIP_OctApiBt0AddNode2
+UINT32 OctApiBt0AddNode2(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,UINT32 new_node_number)
+{
+       UINT32 result;
+
+       if (link->node_number == 0xFFFFFFFF) /* We have an empty node. Here, we shall place the new node.*/
+       {
+               bb->node[new_node_number].l[0].node_number = 0xFFFFFFFF;
+               bb->node[new_node_number].l[0].depth = 0;
+               bb->node[new_node_number].l[1].node_number = 0xFFFFFFFF;
+               bb->node[new_node_number].l[1].depth = 0;
+
+               /* OCTAPI_BT0_LINK to parent!*/
+               link->node_number = new_node_number;
+               link->depth = 1;                                /* We are a leaf, last OCTAPI_BT0_LINK depth is 1.*/
+
+               return(GENERIC_OK);
+       }
+       else /* Current node is used, check for a match and a direction.*/
+       {
+               OCTAPI_BT0_NODE * this_node;
+               UINT32 compare;
+
+               /* Get a pointer to this node.*/
+               this_node = &(bb->node[link->node_number]);
+
+               /* Compare this node to the lkey.*/
+               compare = OctApiBt0KeyCompare(bb,link,lkey);
+
+               if (compare == OCTAPI_BT0_LKEY_SMALLER) /* Go left.*/
+               {
+                       result = OctApiBt0AddNode2(bb,&(this_node->l[0]), lkey, new_node_number);
+                       if (result != GENERIC_OK) return(result);
+               }
+               else if (compare == OCTAPI_BT0_LKEY_LARGER) /* Go right.*/
+               {
+                       result = OctApiBt0AddNode2(bb,&(this_node->l[1]), lkey, new_node_number);
+                       if (result != GENERIC_OK) return(result);
+               }
+               else
+               {
+                       return(OCTAPI_BT0_KEY_ALREADY_IN_TREE);
+               }
+
+               /* Check if this node is unbalanced by 2. If so, rebalance it:*/
+               if (this_node->l[0].depth > (this_node->l[1].depth + 1) || 
+                               this_node->l[1].depth > (this_node->l[0].depth + 1))
+               {
+                       OctApiBt0Rebalance(bb,link);
+               }
+
+               /* Always update the OCTAPI_BT0_LINK depth before exiting.*/
+               OctApiBt0UpdateLinkDepth(bb,link);
+
+               return(GENERIC_OK);
+       }
+}
+#endif
+
+
+#if !SKIP_OctApiBt0AddNode3
+UINT32 OctApiBt0AddNode3(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,UINT32 *p_new_node_number)
+{
+       UINT32 result;
+
+       if (link->node_number == 0xFFFFFFFF) /* We have an empty node. Here, we shall place the new node.*/
+       {
+               if ( *p_new_node_number == 0xFFFFFFFF )
+                       return(OCTAPI_BT0_NO_NODES_AVAILABLE);
+
+               bb->node[*p_new_node_number].l[0].node_number = 0xFFFFFFFF;
+               bb->node[*p_new_node_number].l[0].depth = 0;
+               bb->node[*p_new_node_number].l[1].node_number = 0xFFFFFFFF;
+               bb->node[*p_new_node_number].l[1].depth = 0;
+
+               /* OCTAPI_BT0_LINK to parent!*/
+               link->node_number = *p_new_node_number;
+               link->depth = 1;                                /* We are a leaf, last OCTAPI_BT0_LINK depth is 1.*/
+
+               return(GENERIC_OK);
+       }
+       else /* Current node is used, check for a match and a direction.*/
+       {
+               OCTAPI_BT0_NODE * this_node;
+               UINT32 compare;
+
+               /* Get a pointer to this node.*/
+               this_node = &(bb->node[link->node_number]);
+
+               /* Compare this node to the lkey.*/
+               compare = OctApiBt0KeyCompare(bb,link,lkey);
+
+               if (compare == OCTAPI_BT0_LKEY_SMALLER) /* Go left.*/
+               {
+                       result = OctApiBt0AddNode3(bb,&(this_node->l[0]), lkey, p_new_node_number);
+                       if (result != GENERIC_OK) return(result);
+               }
+               else if (compare == OCTAPI_BT0_LKEY_LARGER) /* Go right.*/
+               {
+                       result = OctApiBt0AddNode3(bb,&(this_node->l[1]), lkey, p_new_node_number);
+                       if (result != GENERIC_OK) return(result);
+               }
+               else
+               {
+                       *p_new_node_number = link->node_number;
+                       return(OCTAPI_BT0_KEY_ALREADY_IN_TREE);
+               }
+
+               /* Check if this node is unbalanced by 2. If so, rebalance it:*/
+               if (this_node->l[0].depth > (this_node->l[1].depth + 1) || 
+                               this_node->l[1].depth > (this_node->l[0].depth + 1))
+               {
+                       OctApiBt0Rebalance(bb,link);
+               }
+
+               /* Always update the OCTAPI_BT0_LINK depth before exiting.*/
+               OctApiBt0UpdateLinkDepth(bb,link);
+
+               return(GENERIC_OK);
+       }
+}
+#endif
+
+/* state 
+0 -> first call to the function.
+1 -> recursive call.*/
+#if !SKIP_OctApiBt0AddNode4
+UINT32 OctApiBt0AddNode4(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,UINT32 *p_new_node_number, UINT32 *p_prev_node_number, UINT32 state )
+{
+       UINT32 result;
+       UINT32 *nkey;
+       UINT32 *okey;
+
+       if (link->node_number == 0xFFFFFFFF) /* We have an empty node. Here, we shall place the new node.*/
+       {
+               bb->node[*p_new_node_number].l[0].node_number = 0xFFFFFFFF;
+               bb->node[*p_new_node_number].l[0].depth = 0;
+               bb->node[*p_new_node_number].l[1].node_number = 0xFFFFFFFF;
+               bb->node[*p_new_node_number].l[1].depth = 0;
+
+               /* OCTAPI_BT0_LINK to parent!*/
+               link->node_number = *p_new_node_number;
+               link->depth = 1;                                /* We are a leaf, last OCTAPI_BT0_LINK depth is 1.*/
+
+               if ( state == 0 )
+                       *p_prev_node_number = 0xFFFFFFFF;
+
+               return(GENERIC_OK);
+       }
+       else /* Current node is used, check for a match and a direction.*/
+       {
+               OCTAPI_BT0_NODE * this_node;
+               UINT32 compare;
+
+               /* Get a pointer to this node.*/
+               this_node = &(bb->node[link->node_number]);
+
+               /* Compare this node to the lkey.*/
+               compare = OctApiBt0KeyCompare(bb,link,lkey);
+
+               if (compare == OCTAPI_BT0_LKEY_SMALLER) /* Go left.*/
+               {
+                       if ( state == 0 )
+                               *p_prev_node_number = OCTAPI_BT0_NO_SMALLER_KEY;
+                       
+                       if ( *p_prev_node_number != OCTAPI_BT0_NO_SMALLER_KEY )
+                       {
+                               /* Check if the key is the smallest one encountered yet.*/
+                               okey = &(bb->key[bb->key_size * (*p_prev_node_number)]);
+                               nkey = &(bb->key[bb->key_size * link->node_number]);
+                               /* If the node is key smaller then the old small one, change the value.*/
+                               if ( *nkey > *okey )
+                               {
+                                       if ( *nkey < *lkey      )
+                                               *p_prev_node_number = link->node_number;
+                               }
+                       }
+
+                       result = OctApiBt0AddNode4(bb,&(this_node->l[0]), lkey, p_new_node_number, p_prev_node_number, 1);
+                       if (result != GENERIC_OK) return(result);
+               }
+               else if (compare == OCTAPI_BT0_LKEY_LARGER) /* Go right.*/
+               {
+                       if ( state == 0 )
+                               *p_prev_node_number = link->node_number;
+                       else
+                       {
+                               if ( *p_prev_node_number  == OCTAPI_BT0_NO_SMALLER_KEY )
+                                       *p_prev_node_number = link->node_number;
+                               else
+                               {
+                                       /* Check if the key is the smallest one encountered yet.*/
+                                       okey = &(bb->key[bb->key_size * (*p_prev_node_number)]);
+                                       nkey = &(bb->key[bb->key_size * link->node_number]);
+                                       /* If the node is key smaller then the old small one, change the value.*/
+                                       if ( *nkey > *okey )
+                                       {
+                                               if ( *nkey < *lkey      )
+                                                       *p_prev_node_number = link->node_number;
+                                       }
+                               }
+                       }
+
+                       result = OctApiBt0AddNode4(bb,&(this_node->l[1]), lkey, p_new_node_number, p_prev_node_number, 1);
+                       if (result != GENERIC_OK) return(result);
+               }
+               else
+               {
+                       *p_new_node_number = link->node_number;
+                       return(OCTAPI_BT0_KEY_ALREADY_IN_TREE);
+               }
+
+               /* Check if this node is unbalanced by 2. If so, rebalance it:*/
+               if (this_node->l[0].depth > (this_node->l[1].depth + 1) || 
+                               this_node->l[1].depth > (this_node->l[0].depth + 1))
+               {
+                       OctApiBt0Rebalance(bb,link);
+               }
+
+               /* Always update the OCTAPI_BT0_LINK depth before exiting.*/
+               OctApiBt0UpdateLinkDepth(bb,link);
+
+               return(GENERIC_OK);
+       }
+}
+#endif
+
+#if !SKIP_OctApiBt0KeyCompare
+UINT32 OctApiBt0KeyCompare(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link, UINT32 * lkey)
+{
+       UINT32 * nkey;
+       UINT32 i;
+
+       /* Find the first UINT32 of the key.*/
+       nkey = &(bb->key[bb->key_size * link->node_number]);
+
+       for(i=0;i<bb->key_size;i++)
+       {
+               if (lkey[i] < nkey[i])
+                       return(OCTAPI_BT0_LKEY_SMALLER);
+               else if (lkey[i] > nkey[i])
+                       return(OCTAPI_BT0_LKEY_LARGER);
+       }       
+       
+       return(OCTAPI_BT0_LKEY_EQUAL);
+}
+#endif
+
+
+#if !SKIP_OctApiBt0UpdateLinkDepth
+void OctApiBt0UpdateLinkDepth(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link)
+{
+       OCTAPI_BT0_NODE * this_node;
+
+       /* Get a pointer to this node.*/
+       this_node = &(bb->node[link->node_number]);
+
+       if (this_node->l[0].depth > this_node->l[1].depth)
+               link->depth = this_node->l[0].depth + 1;
+       else
+               link->depth = this_node->l[1].depth + 1;
+}
+#endif
+
+#if !SKIP_OctApiBt0Rebalance
+void OctApiBt0Rebalance(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * root_link)
+{
+       if (bb->node[root_link->node_number].l[0].depth > (bb->node[root_link->node_number].l[1].depth + 1))    /* Heavy to the left.*/
+       {
+               /* Check if the right child of the heavy child node is causing a problem.*/
+               /* If so, do a left rotate in order to make the left most child the longer one.*/
+               {
+                       OCTAPI_BT0_LINK * heavy_link;
+                       heavy_link = &(bb->node[root_link->node_number].l[0]);
+
+                       if (bb->node[heavy_link->node_number].l[1].depth > bb->node[heavy_link->node_number].l[0].depth)
+                       {
+                               OctApiBt0ExternalHeavy(bb,heavy_link);
+                       }
+               }
+
+               /* Ready to do super rotation!*/
+               {
+                       OCTAPI_BT0_LINK init_root_link;
+                       OCTAPI_BT0_LINK init_heavy_link;
+                       OCTAPI_BT0_LINK init_leaf_tree[3];
+
+                       /* Save pertinent initial OCTAPI_BT0_LINK information.*/
+                       init_root_link = *root_link;
+                       init_heavy_link = bb->node[root_link->node_number].l[0];
+                       init_leaf_tree[2] = bb->node[root_link->node_number].l[1];
+                       init_leaf_tree[0] = bb->node[bb->node[root_link->node_number].l[0].node_number].l[0];
+                       init_leaf_tree[1] = bb->node[bb->node[root_link->node_number].l[0].node_number].l[1];
+
+                       /* Restructure the tree.*/
+                       *root_link = init_heavy_link;
+                       bb->node[init_heavy_link.node_number].l[1] = init_root_link;
+                       bb->node[init_root_link.node_number].l[0] = init_leaf_tree[1];
+
+                       /* Reconstruct the depth of the branches.*/
+                       OctApiBt0UpdateLinkDepth(bb,&(bb->node[root_link->node_number].l[1]));
+                       OctApiBt0UpdateLinkDepth(bb,root_link);
+               }
+       }
+       else if (bb->node[root_link->node_number].l[1].depth > (bb->node[root_link->node_number].l[0].depth + 1))       /* Heavy to the right.*/
+       {
+               /* Check if the right child of the heavy child node is causing a problem.*/
+               /* If so, do a left rotate in order to make the left most child the longer one.*/
+               {
+                       OCTAPI_BT0_LINK * heavy_link;
+                       heavy_link = &(bb->node[root_link->node_number].l[1]);
+
+                       if (bb->node[heavy_link->node_number].l[0].depth > bb->node[heavy_link->node_number].l[1].depth)
+                       {
+                               OctApiBt0ExternalHeavy(bb,heavy_link);
+                       }
+               }
+
+               /* Ready to do super rotation!*/
+               {
+                       OCTAPI_BT0_LINK init_root_link;
+                       OCTAPI_BT0_LINK init_heavy_link;
+                       OCTAPI_BT0_LINK init_leaf_tree[3];
+
+                       /* Save pertinent initial OCTAPI_BT0_LINK information.*/
+                       init_root_link = *root_link;
+                       init_heavy_link = bb->node[root_link->node_number].l[1];
+                       init_leaf_tree[2] = bb->node[root_link->node_number].l[0];
+                       init_leaf_tree[0] = bb->node[bb->node[root_link->node_number].l[1].node_number].l[1];
+                       init_leaf_tree[1] = bb->node[bb->node[root_link->node_number].l[1].node_number].l[0];
+
+                       /* Restructure the tree.*/
+                       *root_link = init_heavy_link;
+                       bb->node[init_heavy_link.node_number].l[0] = init_root_link;
+                       bb->node[init_root_link.node_number].l[1] = init_leaf_tree[1];
+
+                       /* Reconstruct the depth of the branches.*/
+                       OctApiBt0UpdateLinkDepth(bb,&(bb->node[root_link->node_number].l[0]));
+                       OctApiBt0UpdateLinkDepth(bb,root_link);
+               }
+       }
+}
+#endif
+
+/* This function does a rotation towards the outside of the tree*/
+/* in order to keep the heavy branches towards the outside.*/
+#if !SKIP_OctApiBt0ExternalHeavy
+void OctApiBt0ExternalHeavy(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * root_link)
+{
+       if (bb->node[root_link->node_number].l[1].depth > bb->node[root_link->node_number].l[0].depth)  /* Exterior of tree is towards the left.*/
+       {
+               OCTAPI_BT0_LINK init_root_link;
+               OCTAPI_BT0_LINK init_heavy_link;
+               OCTAPI_BT0_LINK init_leaf_tree[3];
+
+               /* Save pertinent initial OCTAPI_BT0_LINK information.*/
+               init_root_link = *root_link;
+               init_leaf_tree[0] = bb->node[root_link->node_number].l[0];
+               init_heavy_link = bb->node[root_link->node_number].l[1];
+               init_leaf_tree[1] = bb->node[bb->node[root_link->node_number].l[1].node_number].l[0];
+               init_leaf_tree[2] = bb->node[bb->node[root_link->node_number].l[1].node_number].l[1];
+
+               /* Restructure the tree.*/
+               *root_link = init_heavy_link;
+               bb->node[init_heavy_link.node_number].l[0] = init_root_link;
+               bb->node[init_root_link.node_number].l[1] = init_leaf_tree[1];
+
+               /* Reconstruct the depth of the branches.*/
+               OctApiBt0UpdateLinkDepth(bb,&(bb->node[root_link->node_number].l[0]));
+               OctApiBt0UpdateLinkDepth(bb,root_link);
+       }
+       else if (bb->node[root_link->node_number].l[0].depth > bb->node[root_link->node_number].l[1].depth)     /* Exterior of tree is towards the right.*/
+       {
+               OCTAPI_BT0_LINK init_root_link;
+               OCTAPI_BT0_LINK init_heavy_link;
+               OCTAPI_BT0_LINK init_leaf_tree[3];
+
+               /* Save pertinent initial OCTAPI_BT0_LINK information.*/
+               init_root_link = *root_link;
+               init_leaf_tree[0] = bb->node[root_link->node_number].l[1];
+               init_heavy_link = bb->node[root_link->node_number].l[0];
+               init_leaf_tree[1] = bb->node[bb->node[root_link->node_number].l[0].node_number].l[1];
+               init_leaf_tree[2] = bb->node[bb->node[root_link->node_number].l[0].node_number].l[0];
+
+               /* Restructure the tree.*/
+               *root_link = init_heavy_link;
+               bb->node[init_heavy_link.node_number].l[1] = init_root_link;
+               bb->node[init_root_link.node_number].l[0] = init_leaf_tree[1];
+
+               /* Reconstruct the depth of the branches.*/
+               OctApiBt0UpdateLinkDepth(bb,&(bb->node[root_link->node_number].l[1]));
+               OctApiBt0UpdateLinkDepth(bb,root_link);
+       }
+}
+#endif
+
+
+/* State:*/
+/* 0 = seeking node to be removed.*/
+/* 1 = node found, left branch taken.*/
+/* 2 = node found, right branch taken.*/
+#if !SKIP_OctApiBt0RemoveNode2
+UINT32 OctApiBt0RemoveNode2(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link, UINT32 * lkey, OCTAPI_BT0_LINK * link_to_removed_node, UINT32 state, OCTAPI_BT0_LINK * volatile_grandparent_link)
+{
+       UINT32 result;
+       OCTAPI_BT0_NODE * this_node;
+
+       /* Get a pointer to this node.*/
+       this_node = &(bb->node[link->node_number]);
+
+       if (state == 0)
+       {
+               if (link->node_number == 0xFFFFFFFF) /* We have an empty node. The node we were looking for does not exist.*/
+               {
+                       return(OCTAPI_BT0_KEY_NOT_IN_TREE);
+               }
+               else /* Current node is used, check for a match and a direction.*/
+               {
+                       UINT32 compare;
+
+                       /* Compare this node to the lkey.*/
+                       compare = OctApiBt0KeyCompare(bb,link,lkey);
+
+                       if (compare == OCTAPI_BT0_LKEY_SMALLER) /* Go left.*/
+                       {
+                               result = OctApiBt0RemoveNode2(bb,&(bb->node[link->node_number].l[0]), lkey, link_to_removed_node, 0, NULL);
+                               if (result != GENERIC_OK) return(result);
+                       }
+                       else if (compare == OCTAPI_BT0_LKEY_LARGER) /* Go right.*/
+                       {
+                               result = OctApiBt0RemoveNode2(bb,&(bb->node[link->node_number].l[1]), lkey, link_to_removed_node, 0, NULL);
+                               if (result != GENERIC_OK) return(result);
+                       }
+                       else
+                       {
+                               link_to_removed_node = link;
+
+                               /* Keep on going down to find a replacement node.*/
+                               if (bb->node[link->node_number].l[0].node_number == 0xFFFFFFFF && bb->node[link->node_number].l[1].node_number == 0xFFFFFFFF)
+                               {
+                                       /* Doe! No tree left! WHAT TO DO?          */
+                                       /* Just delete the current node. That's it.*/
+
+                                       /* Release the current node (restore free node link-list)*/
+                                       bb->node[link->node_number].next_free_node = bb->next_free_node;
+                                       bb->next_free_node = link->node_number;
+
+                                       link->node_number = 0xFFFFFFFF;
+                                       link->depth = 0;
+
+                                       return(GENERIC_OK);
+                               }
+                               else if (bb->node[link->node_number].l[0].node_number != 0xFFFFFFFF)    /* Left node is present. Go left, then permanently right.*/
+                               {
+                                       OCTAPI_BT0_NODE * removed_node_pnt;
+                                       removed_node_pnt = &(bb->node[link->node_number]);
+
+                                       result = OctApiBt0RemoveNode2(bb,&(removed_node_pnt->l[0]), lkey, link_to_removed_node, 1, link);
+                                       if (result != GENERIC_OK) return(result);
+
+                                       /* Caution! Once we are here, the link->node_pnt->l[0] has been modified,*/
+                                       /* but is about to be discarded! Save it quickly!*/
+                                       /* bb->node[link->node_number].l[0] = removed_node_pnt->l[0];*/
+                               }
+                               else /* Right node is present. Go right, then permanently left.*/
+                               {
+                                       OCTAPI_BT0_NODE * removed_node_pnt;
+                                       removed_node_pnt = &(bb->node[link->node_number]);
+
+                                       result = OctApiBt0RemoveNode2(bb,&(removed_node_pnt->l[1]), lkey, link_to_removed_node, 2, link);
+                                       if (result != GENERIC_OK) return(result);
+
+                                       /* Caution! Once we are here, the link->node_pnt->l[0] has been modified,*/
+                                       /* but is about to be discarded! Save it quickly!*/
+                                       /* bb->node[link->node_number].l[1] = removed_node_pnt->l[1];*/
+                               }
+                       }
+               }
+       }
+       else
+       {
+               /* Left side, Right-most node found! OR*/
+               /* Right side, Left-most node found!*/
+               if ((state == 1 && bb->node[link->node_number].l[1].node_number == 0xFFFFFFFF) ||
+                       (state == 2 && bb->node[link->node_number].l[0].node_number == 0xFFFFFFFF))
+               {
+                       OCTAPI_BT0_LINK init_chosen_link;
+
+                       /* Release the current node (restore free node link-list)*/
+                       bb->node[link_to_removed_node->node_number].next_free_node = bb->next_free_node;
+                       bb->next_free_node = link_to_removed_node->node_number;
+
+                       /* Save the link to the chosen node, because it is about to be deleted.*/
+                       init_chosen_link = *link;
+
+                       /* Remove this node, and allow the tree to go on:*/
+                       {
+                               OCTAPI_BT0_LINK init_child_link[2];
+
+                               init_child_link[0] = bb->node[link->node_number].l[0];
+                               init_child_link[1] = bb->node[link->node_number].l[1];
+
+                               if (state == 1)
+                                       *link = init_child_link[0];
+                               else
+                                       *link = init_child_link[1];
+                       }
+
+                       /* Replace the removed node by this node.*/
+                       {
+                               OCTAPI_BT0_LINK init_removed_child_link[2];
+
+                               init_removed_child_link[0] = bb->node[link_to_removed_node->node_number].l[0];
+                               init_removed_child_link[1] = bb->node[link_to_removed_node->node_number].l[1];
+
+                               *link_to_removed_node = init_chosen_link;
+                               bb->node[init_chosen_link.node_number].l[0] = init_removed_child_link[0];
+                               bb->node[init_chosen_link.node_number].l[1] = init_removed_child_link[1];
+                       }
+
+                       return(GENERIC_OK);
+               }
+               else
+               {
+                       /* Keep on going, we have not found the center most node yet!*/
+                       if (state == 1)
+                       {
+                               result = OctApiBt0RemoveNode2(bb,&(bb->node[link->node_number].l[1]), lkey, link_to_removed_node, state, NULL);
+                               if (result != GENERIC_OK) return(result);
+
+                               /* Refresh the link if our link is volatile.*/
+                               if (volatile_grandparent_link != NULL)
+                               {
+                                       link = &(bb->node[volatile_grandparent_link->node_number].l[0]);
+                               }
+                       }
+                       else
+                       {
+                               result = OctApiBt0RemoveNode2(bb,&(bb->node[link->node_number].l[0]), lkey, link_to_removed_node, state, NULL);
+                               if (result != GENERIC_OK) return(result);
+
+                               /* Refresh the link if our link is volatile.*/
+                               if (volatile_grandparent_link != NULL)
+                               {
+                                       link = &(bb->node[volatile_grandparent_link->node_number].l[1]);
+                               }
+                       }
+               }
+       }
+
+       /* We may have messed up the tree. So patch it!*/
+       /* Check if this node is unbalanced by 2. If so, rebalance it:*/
+       if (this_node->l[0].depth > (this_node->l[1].depth + 1) || 
+                       this_node->l[1].depth > (this_node->l[0].depth + 1))
+       {
+               OctApiBt0Rebalance(bb,link);
+       }
+
+       /* Always update the OCTAPI_BT0_LINK depth before exiting.*/
+       OctApiBt0UpdateLinkDepth(bb,link);
+
+       return(GENERIC_OK);
+}
+#endif
+
+
+/* State:*/
+/* 0 = seeking node to be removed.*/
+/* 1 = node found, left branch taken.*/
+/* 2 = node found, right branch taken.*/
+#if !SKIP_OctApiBt0RemoveNode3
+UINT32 OctApiBt0RemoveNode3(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link, UINT32 * lkey, OCTAPI_BT0_LINK * link_to_removed_node, UINT32 state, OCTAPI_BT0_LINK * volatile_grandparent_link, UINT32 *p_prev_node_number )
+{
+       UINT32 result;
+       UINT32 *nkey;
+       UINT32 *okey;
+       OCTAPI_BT0_NODE * this_node;
+
+       /* Get a pointer to this node.*/
+       this_node = &(bb->node[link->node_number]);
+
+       if (state == 0)
+       {
+               if (link->node_number == 0xFFFFFFFF) /* We have an empty node. The node we were looking for does not exist.*/
+               {
+                       return(OCTAPI_BT0_KEY_NOT_IN_TREE);
+               }
+               else /* Current node is used, check for a match and a direction.*/
+               {
+                       UINT32 compare;
+
+                       /* Compare this node to the lkey.*/
+                       compare = OctApiBt0KeyCompare(bb,link,lkey);
+
+                       if (compare == OCTAPI_BT0_LKEY_SMALLER) /* Go left.*/
+                       {
+                               /* Check if the key is the biggest one encountered yet.*/
+                               okey = &(bb->key[bb->key_size * (*p_prev_node_number)]);
+                               nkey = &(bb->key[bb->key_size * link->node_number]);
+                               /* If the node is key bigger then the old one, change the value.*/
+                               if ( *nkey > *okey )
+                               {
+                                       if ( *nkey < *lkey      )
+                                               *p_prev_node_number = link->node_number;
+                               }
+       
+                               result = OctApiBt0RemoveNode2(bb,&(bb->node[link->node_number].l[0]), lkey, link_to_removed_node, 0, NULL);
+                               if (result != GENERIC_OK) return(result);
+                       }
+                       else if (compare == OCTAPI_BT0_LKEY_LARGER) /* Go right.*/
+                       {
+                               /* Check if the key is the biggest one encountered yet.*/
+                               okey = &(bb->key[bb->key_size * (*p_prev_node_number)]);
+                               nkey = &(bb->key[bb->key_size * link->node_number]);
+                               /* If the node is key bigger then the old one, change the value.*/
+                               if ( *nkey > *okey )
+                               {
+                                       if ( *nkey < *lkey      )
+                                               *p_prev_node_number = link->node_number;
+                               }
+
+                               result = OctApiBt0RemoveNode2(bb,&(bb->node[link->node_number].l[1]), lkey, link_to_removed_node, 0, NULL);
+                               if (result != GENERIC_OK) return(result);
+                       }
+                       else
+                       {
+                               link_to_removed_node = link;
+
+                               /* Keep on going down to find a replacement node.*/
+                               if (bb->node[link->node_number].l[0].node_number == 0xFFFFFFFF && bb->node[link->node_number].l[1].node_number == 0xFFFFFFFF)
+                               {
+                                       /* Doe! No tree left! WHAT TO DO?          */
+                                       /* Just delete the current node. That's it.*/
+
+                                       /* Release the current node (restore free node link-list)*/
+                                       bb->node[link->node_number].next_free_node = bb->next_free_node;
+                                       bb->next_free_node = link->node_number;
+
+                                       link->node_number = 0xFFFFFFFF;
+                                       link->depth = 0;
+
+                                       return(GENERIC_OK);
+                               }
+                               else if (bb->node[link->node_number].l[0].node_number != 0xFFFFFFFF)    /* Left node is present. Go left, then permanently right.*/
+                               {
+                                       OCTAPI_BT0_NODE * removed_node_pnt;
+                                       removed_node_pnt = &(bb->node[link->node_number]);
+
+                                       result = OctApiBt0RemoveNode2(bb,&(removed_node_pnt->l[0]), lkey, link_to_removed_node, 1, link);
+                                       if (result != GENERIC_OK) return(result);
+
+                                       /* Caution! Once we are here, the link->node_pnt->l[0] has been modified,*/
+                                       /* but is about to be discarded! Save it quickly!*/
+                                       /* bb->node[link->node_number].l[0] = removed_node_pnt->l[0];*/
+                               }
+                               else /* Right node is present. Go right, then permanently left.*/
+                               {
+                                       OCTAPI_BT0_NODE * removed_node_pnt;
+                                       removed_node_pnt = &(bb->node[link->node_number]);
+
+                                       result = OctApiBt0RemoveNode2(bb,&(removed_node_pnt->l[1]), lkey, link_to_removed_node, 2, link);
+                                       if (result != GENERIC_OK) return(result);
+
+                                       /* Caution! Once we are here, the link->node_pnt->l[0] has been modified,*/
+                                       /* but is about to be discarded! Save it quickly!*/
+                                       /* bb->node[link->node_number].l[1] = removed_node_pnt->l[1];*/
+                               }
+                       }
+               }
+       }
+       else
+       {               
+               /* Check if the key is the biggest one encountered yet.*/
+               okey = &(bb->key[bb->key_size * (*p_prev_node_number)]);
+               nkey = &(bb->key[bb->key_size * link->node_number]);
+               /* If the node is key bigger then the old one, change the value.*/
+               if ( *nkey > *okey )
+               {
+                       if ( *nkey < *lkey      )
+                               *p_prev_node_number = link->node_number;
+               }
+               
+               /* Left side, Right-most node found! OR*/
+               /* Right side, Left-most node found!*/
+               if ((state == 1 && bb->node[link->node_number].l[1].node_number == 0xFFFFFFFF) ||
+                       (state == 2 && bb->node[link->node_number].l[0].node_number == 0xFFFFFFFF))
+               {
+                       OCTAPI_BT0_LINK init_chosen_link;
+
+                       /* Release the current node (restore free node link-list)*/
+                       bb->node[link_to_removed_node->node_number].next_free_node = bb->next_free_node;
+                       bb->next_free_node = link_to_removed_node->node_number;
+
+                       /* Save the link to the chosen node, because it is about to be deleted.*/
+                       init_chosen_link = *link;
+
+                       /* Remove this node, and allow the tree to go on:*/
+                       {
+                               OCTAPI_BT0_LINK init_child_link[2];
+
+                               init_child_link[0] = bb->node[link->node_number].l[0];
+                               init_child_link[1] = bb->node[link->node_number].l[1];
+
+                               if (state == 1)
+                                       *link = init_child_link[0];
+                               else
+                                       *link = init_child_link[1];
+                       }
+
+                       /* Replace the removed node by this node.*/
+                       {
+                               OCTAPI_BT0_LINK init_removed_child_link[2];
+
+                               init_removed_child_link[0] = bb->node[link_to_removed_node->node_number].l[0];
+                               init_removed_child_link[1] = bb->node[link_to_removed_node->node_number].l[1];
+
+                               *link_to_removed_node = init_chosen_link;
+                               bb->node[init_chosen_link.node_number].l[0] = init_removed_child_link[0];
+                               bb->node[init_chosen_link.node_number].l[1] = init_removed_child_link[1];
+                       }
+
+                       return(GENERIC_OK);
+               }
+               else
+               {
+                       /* Keep on going, we have not found the center most node yet!*/
+                       if (state == 1)
+                       {
+                               result = OctApiBt0RemoveNode2(bb,&(bb->node[link->node_number].l[1]), lkey, link_to_removed_node, state, NULL);
+                               if (result != GENERIC_OK) return(result);
+
+                               /* Refresh the link if our link is volatile.*/
+                               if (volatile_grandparent_link != NULL)
+                               {
+                                       link = &(bb->node[volatile_grandparent_link->node_number].l[0]);
+                               }
+                       }
+                       else
+                       {
+                               result = OctApiBt0RemoveNode2(bb,&(bb->node[link->node_number].l[0]), lkey, link_to_removed_node, state, NULL);
+                               if (result != GENERIC_OK) return(result);
+
+                               /* Refresh the link if our link is volatile.*/
+                               if (volatile_grandparent_link != NULL)
+                               {
+                                       link = &(bb->node[volatile_grandparent_link->node_number].l[1]);
+                               }
+                       }
+               }
+       }
+
+       /* We may have messed up the tree. So patch it!*/
+       /* Check if this node is unbalanced by 2. If so, rebalance it:*/
+       if (this_node->l[0].depth > (this_node->l[1].depth + 1) || 
+                       this_node->l[1].depth > (this_node->l[0].depth + 1))
+       {
+               OctApiBt0Rebalance(bb,link);
+       }
+
+       /* Always update the OCTAPI_BT0_LINK depth before exiting.*/
+       OctApiBt0UpdateLinkDepth(bb,link);
+
+       return(GENERIC_OK);
+}
+#endif
+
+#if !SKIP_OctApiBt0RemoveNode
+UINT32 OctApiBt0RemoveNode(void * b,void * key)
+{
+       OCTAPI_BT0 * bb;
+       UINT32 result;
+       UINT32 * lkey;
+
+       /* Load all!*/
+       bb = (OCTAPI_BT0 *)(b);
+       OctApiBt0CorrectPointers(bb);
+
+       /* Register in the key and the data.*/
+       lkey = ((UINT32 *)key);
+
+       /* Attempt to remove the node. Only a "no hit" will cause an error.*/
+       result = OctApiBt0RemoveNode2(bb,&(bb->root_link), lkey, NULL, 0, NULL);
+       if (result != GENERIC_OK) return(result);
+
+       return(GENERIC_OK);
+}
+#endif
+
+#if !SKIP_OctApiBt0QueryNode2
+UINT32 OctApiBt0QueryNode2(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,UINT32 * node_number)
+{
+       UINT32 result;
+
+       if (link->node_number == 0xFFFFFFFF) /* We have an empty node. The node we were looking for does not exist.*/
+       {
+               return(OCTAPI_BT0_KEY_NOT_IN_TREE);
+       }
+       else /* Current node is used, check for a match and a direction.*/
+       {
+               UINT32 compare;
+
+               /* Compare this node to the lkey.*/
+               compare = OctApiBt0KeyCompare(bb,link,lkey);
+
+               if (compare == OCTAPI_BT0_LKEY_SMALLER) /* Go left.*/
+               {
+                       result = OctApiBt0QueryNode2(bb,&(bb->node[link->node_number].l[0]), lkey, node_number);
+                       if (result != GENERIC_OK) return(result);
+               }
+               else if (compare == OCTAPI_BT0_LKEY_LARGER) /* Go right.*/
+               {
+                       result = OctApiBt0QueryNode2(bb,&(bb->node[link->node_number].l[1]), lkey, node_number);
+                       if (result != GENERIC_OK) return(result);
+               }
+               else
+               {
+                       /* A match!*/
+                       *node_number = link->node_number;
+               }
+       }
+
+       return(GENERIC_OK);
+}
+#endif
+
+
+#if !SKIP_OctApiBt0QueryNode
+UINT32 OctApiBt0QueryNode(void * b,void * key,void ** data)
+{
+       OCTAPI_BT0 * bb;
+       UINT32 node_number;
+       UINT32 result;
+       UINT32 * lkey;
+
+       /* Load all!*/
+       bb = (OCTAPI_BT0 *)(b);
+       OctApiBt0CorrectPointers(bb);
+
+       /* Register in the key and the data.*/
+       lkey = ((UINT32 *)key);
+
+       /* Get the node number.*/
+       result = OctApiBt0QueryNode2(bb,&(bb->root_link),lkey,&node_number);
+       if (result != GENERIC_OK) return(result);
+
+       /* Return the address of the data to the user.*/
+       if ( bb->data_size > 0 )
+               *data = (void *)(&(bb->data[bb->data_size * node_number]));
+
+       return(GENERIC_OK);
+}
+#endif
+
+#if !SKIP_OctApiBt0GetFirstNode
+UINT32 OctApiBt0GetFirstNode(void * b,void ** key, void ** data)
+{
+       OCTAPI_BT0 * bb;
+       OCTAPI_BT0_NODE * node;
+       UINT32 node_number;
+       UINT32 * lkey;
+
+       /* Load all!*/
+       bb = (OCTAPI_BT0 *)(b);
+       OctApiBt0CorrectPointers(bb);
+
+       /* Register in the key and the data.*/
+       lkey = ((UINT32 *)key);
+
+       /* Check if there are any keys present in the tree. */
+       if (bb->root_link.node_number == 0xFFFFFFFF) return OCTAPI_BT0_NO_NODES_AVAILABLE;
+
+       node_number = bb->root_link.node_number;
+       node = &bb->node[node_number];
+
+       /* Make our way down to the left-most node. */
+       while (node->l[0].node_number != 0xFFFFFFFF)
+       {
+               node_number = node->l[0].node_number;
+               node = &bb->node[node_number];
+       }
+
+       /* Return the address of the data to the user.*/
+       if ( bb->key_size > 0 )
+               *key = (void *)(&(bb->key[bb->key_size * node_number]));
+
+       if ( bb->data_size > 0 )
+               *data = (void *)(&(bb->data[bb->data_size * node_number]));
+
+       return(GENERIC_OK);
+}
+#endif
+
+#if !SKIP_OctApiBt0FindOrAddNode
+UINT32 OctApiBt0FindOrAddNode(void * b,void * key,void ** data, UINT32 *fnct_result)
+{
+       OCTAPI_BT0 * bb;
+       OCTAPI_BT0_NODE * new_node;
+       UINT32 * lkey;
+       UINT32 * nkey;
+       UINT32 i;
+       UINT32 new_node_number;
+       UINT32 temp_node_number = 0;
+       UINT32 result;
+       UINT32 tree_already_full = FALSE;
+       
+       /* Load all!*/
+       bb = (OCTAPI_BT0 *)(b);
+       OctApiBt0CorrectPointers(bb);
+       
+       /* Seize the node!*/
+       new_node_number = bb->next_free_node;
+       /* Register in the key and the data.*/
+       lkey = ((UINT32 *)key);
+
+       /* Check that there is at least one block left.*/
+       if (bb->next_free_node != 0xFFFFFFFF) 
+       {
+
+               temp_node_number = new_node_number;
+               new_node = &(bb->node[new_node_number]);
+               bb->next_free_node = new_node->next_free_node;
+               
+               /* Find the first UINT32 of the key.*/
+               nkey = &(bb->key[bb->key_size * new_node_number]);
+       
+               /* Copy the key.*/
+               for(i=0;i<bb->key_size;i++)
+                       nkey[i] = lkey[i];
+       }
+       else
+               tree_already_full = TRUE;       /* Signal that the tree was already full when the function was called.*/
+
+       /* Attempt to place the node. Only a "multiple hit" will cause an error.*/
+       result = OctApiBt0AddNode3(bb,&(bb->root_link), lkey, &new_node_number); 
+       switch( result )
+       {
+       case GENERIC_OK:
+               *fnct_result = OCTAPI0_BT0_NODE_ADDDED;
+               break;
+       case OCTAPI_BT0_KEY_ALREADY_IN_TREE:
+               *fnct_result = OCTAPI0_BT0_NODE_FOUND;
+               /* This attempt did not add a new node. Refree the node!*/
+               if ( tree_already_full == FALSE )
+                       bb->next_free_node = temp_node_number;
+               result = GENERIC_OK;
+               break;
+       default:
+               break;
+       }
+
+       if (result != GENERIC_OK) 
+       {
+               /* This attempt failed. Refree the node!*/
+               if ( tree_already_full == FALSE )
+                       bb->next_free_node = new_node_number;
+               
+               /* Return the error code.*/
+               return(result);
+       }
+       
+       /* Return the address of the data to the user.*/
+       if ( bb->data_size > 0 )
+               *data = (void *)(&(bb->data[bb->data_size * new_node_number]));
+       
+       return(GENERIC_OK);
+}
+#endif
+
+
+#if !SKIP_OctApiBt0AddNodeReportPrevNodeData
+UINT32 OctApiBt0AddNodeReportPrevNodeData(void * b,void * key,void ** data, void ** prev_data, PUINT32 fnct_result )
+{
+       OCTAPI_BT0 * bb;
+       OCTAPI_BT0_NODE * new_node;
+       UINT32 * lkey;
+       UINT32 * nkey;
+       UINT32 i;
+       UINT32 new_node_number;
+       UINT32 temp_node_number;
+       UINT32 prev_node_number;
+       UINT32 result;
+
+       /* Load all!*/
+       bb = (OCTAPI_BT0 *)(b);
+       OctApiBt0CorrectPointers(bb);
+
+       /* Check that there is at least one block left.*/
+       if (bb->next_free_node == 0xFFFFFFFF) return(OCTAPI_BT0_NO_NODES_AVAILABLE);
+
+       /* Seize the node!*/
+       new_node_number = bb->next_free_node;
+       temp_node_number = new_node_number;
+       new_node = &(bb->node[new_node_number]);
+       bb->next_free_node = new_node->next_free_node;
+
+       /* Set the previous node value */
+       prev_node_number = 0xFFFFFFFF;
+
+       /* Register in the key and the data.*/
+       lkey = ((UINT32 *)key);
+
+       /* Find the first UINT32 of the key.*/
+       nkey = &(bb->key[bb->key_size * new_node_number]);
+
+       /* Copy the key.*/
+       for(i=0;i<bb->key_size;i++)
+               nkey[i] = lkey[i];
+
+       /* Attempt to place the node. Only a "multiple hit" will cause an error.*/
+       result = OctApiBt0AddNode4(bb,&(bb->root_link), lkey, &new_node_number, &prev_node_number, 0);
+       switch( result )
+       {
+       case GENERIC_OK:
+               *fnct_result = OCTAPI0_BT0_NODE_ADDDED;
+               break;
+       case OCTAPI_BT0_KEY_ALREADY_IN_TREE:
+               *fnct_result = OCTAPI0_BT0_NODE_FOUND;
+               /* This attempt did not add a new node. Refree the node!*/
+               bb->next_free_node = temp_node_number;
+               result = GENERIC_OK;
+               break;
+       default:
+               break;
+       }
+
+       if (result != GENERIC_OK)
+       {
+               /* This attempt failed. Refree the node!*/
+               bb->next_free_node = new_node_number;
+
+               /* Return the error code.*/
+               return(result);
+       }
+
+       /* Return the address of the data to the user.*/
+       if ( bb->data_size > 0 )
+               *data = (void *)(&(bb->data[bb->data_size * new_node_number]));
+
+       if ( bb->data_size > 0 )
+       {
+               if ( (prev_node_number != 0xFFFFFFFF) &&
+                        (prev_node_number != OCTAPI_BT0_NO_SMALLER_KEY) &&
+                        (*fnct_result == OCTAPI0_BT0_NODE_ADDDED))
+                       *prev_data = ( void* )(&(bb->data[bb->data_size * prev_node_number]));
+               else if ( prev_node_number == 0xFFFFFFFF )
+                       *prev_data = ( void* )(&bb->invalid_value);
+               else if ( prev_node_number == OCTAPI_BT0_NO_SMALLER_KEY )
+                       *prev_data = ( void* )(&bb->no_smaller_key);
+       }
+
+       return(GENERIC_OK);
+}
+#endif
+
diff --git a/xpp/oct612x/apilib/bt/octapi_bt0_private.h b/xpp/oct612x/apilib/bt/octapi_bt0_private.h
new file mode 100644 (file)
index 0000000..8c68c3e
--- /dev/null
@@ -0,0 +1,93 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+
+File:          octapi_bt0_private.h
+
+Copyright (c) 2001 Octasic Inc. All rights reserved.
+    
+Description: 
+
+       Library used to manage a binary tree of variable max size.  Library is
+       made to use one block of contiguous memory to manage the tree.
+
+This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API  is 
+free software; you can redistribute it and/or modify it under the terms of 
+the GNU General Public License as published by the Free Software Foundation; 
+either version 2 of the License, or (at your option) any later version.
+
+The OCT6100 GPL API is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
+for more details. 
+
+You should have received a copy of the GNU General Public License 
+along with the OCT6100 GPL API; if not, write to the Free Software 
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+$Octasic_Release: OCT612xAPI-01.00-PR49 $
+
+$Octasic_Revision: 11 $
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#ifndef __OCTAPI_BT0_PRIVATE_H__
+#define __OCTAPI_BT0_PRIVATE_H__
+
+
+
+#include "octdef.h"
+
+#define OCTAPI_BT0_LKEY_LARGER 0x0
+#define OCTAPI_BT0_LKEY_SMALLER        0x1
+#define OCTAPI_BT0_LKEY_EQUAL  0x2
+
+typedef struct __OCTAPI_BT0_LINK__
+{
+       UINT32 node_number;
+       UINT32 depth;
+} OCTAPI_BT0_LINK;
+
+typedef struct __OCTAPI_BT0_NODE__
+{
+       UINT32 next_free_node;  /* Number of the next node in the free node link-list.*/
+       OCTAPI_BT0_LINK l[2];   /* 0 = left link; 1 = right link.*/
+} OCTAPI_BT0_NODE;
+
+
+typedef struct __OCTAPI_BT0__ 
+{
+       UINT32 number_of_items; /* Number of items on total that can be allocated in the tree.*/
+       UINT32 key_size;                        /* Size is in UINT32s*/
+       UINT32 data_size;               /* Size is in UINT32s*/
+
+       /* Empty node linked-list:*/
+       UINT32 next_free_node;  /* 0xFFFFFFFF means that no nodes are free.*/
+
+       /* Tree as such:*/
+       OCTAPI_BT0_NODE * node; /* Array of nodes (number_of_items in size).*/
+
+       /* Tree root:*/
+       OCTAPI_BT0_LINK root_link;
+
+       /* Associated key structure*/
+       UINT32 * key;                   /* Array of keys associated to NODEs.*/
+
+       /* Associated data structure.*/
+       UINT32 * data;                  /* Array of data associated to NODEs.*/
+
+       UINT32 invalid_value;
+       UINT32 no_smaller_key;
+
+} OCTAPI_BT0;
+
+void OctApiBt0CorrectPointers( OCTAPI_BT0 * bb );
+UINT32 OctApiBt0AddNode2( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * link, UINT32 * lkey, UINT32 new_node_number );
+UINT32 OctApiBt0AddNode3( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * link, UINT32 * lkey, UINT32 *p_new_node_number );
+UINT32 OctApiBt0AddNode4(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,UINT32 *p_new_node_number, UINT32 *p_prev_node_number, UINT32 state );
+UINT32 OctApiBt0KeyCompare( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * link, UINT32 * lkey );
+void OctApiBt0UpdateLinkDepth( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * link );
+void OctApiBt0Rebalance( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * root_link );
+void OctApiBt0ExternalHeavy( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * root_link );
+UINT32 OctApiBt0RemoveNode2( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * link, UINT32 * lkey, OCTAPI_BT0_LINK * link_to_removed_node, UINT32 state, OCTAPI_BT0_LINK * volatile_grandparent_link );
+
+
+
+#endif /*__OCTAPI_BT0_PRIVATE_H__*/
diff --git a/xpp/oct612x/apilib/largmath/octapi_largmath.c b/xpp/oct612x/apilib/largmath/octapi_largmath.c
new file mode 100644 (file)
index 0000000..75153b8
--- /dev/null
@@ -0,0 +1,628 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+
+File:  octapi_largmath.h
+
+    Copyright (c) 2001-2007 Octasic Inc.
+    
+Description: 
+
+       Library used to perform arithmetic on integer values of an integer multiple
+       of 32-bits.
+
+This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API  is 
+free software; you can redistribute it and/or modify it under the terms of 
+the GNU General Public License as published by the Free Software Foundation; 
+either version 2 of the License, or (at your option) any later version.
+
+The OCT6100 GPL API is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
+for more details. 
+
+You should have received a copy of the GNU General Public License 
+along with the OCT6100 GPL API; if not, write to the Free Software 
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+$Octasic_Release: OCT612xAPI-01.00-PR49 $
+
+$Octasic_Revision: 10 $
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#include "apilib/octapi_largmath.h"
+
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLmAdd.
+|
+|      Description:    This function adds 2 numbers, a and b.  Number a is 
+|                                      (alen + 1) * 32 bits long; b is (blen + 1) * 32 bits long.  The
+|                                      result is (zlen + 1) * 32 bits long.  It the function succeeds it returns
+|                                      GENERIC_OK, else GENERIC_ERROR.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *a                                      UINT32                  The array containing the first number.
+|      alen                            USHORT                  The length of array a, minus 1 (0 - 99).
+|      *b                                      UINT32                  The array containing the second number.
+|      blen                            USHORT                  The length of array b, minus 1 (0 - 99).
+|      *z                                      UINT32                  The array containing the resulting number.
+|      zlen                            USHORT                  The length of array z, minus 1 (0 - 99).
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLmAdd
+UINT32 OctApiLmAdd(UINT32 * a,USHORT alen,UINT32 * b,USHORT blen,UINT32 * z, USHORT zlen)
+{
+       USHORT i;
+       UINT32 temp;
+       UINT32 carry=0;
+       UINT32 aprim;
+       UINT32 bprim;
+
+       /* Check for array lengths.*/
+       if (alen > zlen || blen > zlen) return(OCTAPI_LM_ARRAY_SIZE_MISMATCH);
+
+       for(i=0;i<=zlen;i++)
+       {
+               if (i <= alen) aprim = *(a+i); else aprim = 0;
+               if (i <= blen) bprim = *(b+i); else bprim = 0;
+               temp = aprim + bprim + carry;
+
+               /* Calculate carry for next time.*/
+               if (carry == 0)
+                       if (temp < aprim) carry = 1; else carry = 0;
+               else
+                       if (temp <= aprim) carry = 1; else carry = 0;
+
+               /* Write new value.*/
+               *(z+i) = temp;
+       }
+
+       /* Check for overflow.*/
+       if (carry == 1) return(OCTAPI_LM_OVERFLOW);
+
+       /* All is well.*/
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLmSubtract.
+|
+|      Description:    This function subtracts 2 numbers, a and b.  Number a is 
+|                                      (alen + 1) * 32 bits long; b is (blen + 1) * 32 bits long.  The result
+|                                      is (zlen + 1) * 32 bits long.  It the function succeeds it returns
+|                                      GENERIC_OK, else GENERIC_ERROR.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *a                                      UINT32                  The array containing the first number.
+|      alen                            USHORT                  The length of array a, minus 1 (0 - 99).
+|      *bneg                           UINT32                  The array containing the second number.
+|      blen                            USHORT                  The length of array b, minus 1 (0 - 99).
+|      *z                                      UINT32                  The array containing the resulting number.
+|      zlen                            USHORT                  The length of array z, minus 1 (0 - 99).
+|      *neg                            USHORT                  Indicates if the result is negative 
+|                                                                              (TRUE/FALSE).
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLmSubtract
+UINT32 OctApiLmSubtract(UINT32 * a,USHORT alen,UINT32 * bneg,USHORT blen,UINT32 * z,USHORT zlen,USHORT * neg)
+{
+       USHORT i;
+       UINT32 temp;
+       UINT32 carry=1;
+       UINT32 aprim;
+       UINT32 bprim;
+
+       /* Check for array lengths.*/
+       if (alen > zlen || blen > zlen) return(OCTAPI_LM_ARRAY_SIZE_MISMATCH);
+
+       for(i=0;i<=zlen;i++)
+       {
+               if (i <= alen) aprim = *(a+i); else aprim = 0;
+               if (i <= blen) bprim = ~(*(bneg+i)); else bprim = 0xFFFFFFFF;
+               temp = aprim + bprim + carry;
+
+               /* Calculate carry for next time.*/
+               if (carry == 0)
+                       if (temp < aprim) carry = 1; else carry = 0;
+               else
+                       if (temp <= aprim) carry = 1; else carry = 0;
+
+               /* Write new value.*/
+               *(z+i) = temp;
+       }
+
+       /* Check for overflow, which means negative number!*/
+       if (carry == 0)
+       {
+               /* Number is not of right neg. Invert and add one to correct neg.*/
+               for(i=0;i<=zlen;i++)
+                       *(z+i) = ~(*(z+i));
+
+               temp = 1;
+               OctApiLmAdd(&temp,0,z,zlen,z,zlen);
+
+               *neg = TRUE;
+               return(GENERIC_OK);
+       }
+
+       /* Result is positive.*/
+       *neg = FALSE;
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLmCompare.
+|
+|      Description:    This function compares two numbers (arrays) of equal lengths.
+|                                      Number a is (alen + 1) * 32 bits long; b is (blen + 1) * 32 bits long.  The result
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *a                                      UINT32                  The array containing the first number.
+|      alen                            USHORT                  The length of array a, minus 1 (0 - 99).
+|      *b                                      UINT32                  The array containing the second number.
+|      blen                            USHORT                  The length of array b, minus 1 (0 - 99).
+|      *neg                            USHORT                  Result of compare.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLmCompare
+UINT32 OctApiLmCompare(UINT32 * a,USHORT alen,UINT32 * bneg,USHORT blen,USHORT * neg)
+{
+       USHORT i;
+       UINT32 temp;
+       UINT32 carry=1;
+       UINT32 aprim;
+       UINT32 bprim;
+       UINT32 zlen;
+
+       /* Set zlen to alen or blen (which ever is longer)*/
+       if (alen < blen)
+               zlen = blen;
+       else
+               zlen = alen;
+
+       for(i=0;i<=zlen;i++)
+       {
+               if (i <= alen) aprim = *(a+i); else aprim = 0;
+               if (i <= blen) bprim = ~(*(bneg+i)); else bprim = 0xFFFFFFFF;
+               temp = aprim + bprim + carry;
+
+               /* Calculate carry for next time.*/
+               if (carry == 0)
+                       if (temp < aprim) carry = 1; else carry = 0;
+               else
+                       if (temp <= aprim) carry = 1; else carry = 0;
+       }
+
+       /* Check for overflow, which means negative number!*/
+       if (carry == 0)
+       {
+               *neg = TRUE;
+               return(GENERIC_OK);
+       }
+
+       /* Result is positive.*/
+       *neg = FALSE;
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLmSubtract.
+|
+|      Description:    This function multiplies 2 numbers, a and b.  Number a and 
+|                                      b are both  (ablen + 1) * 32 bits long.  The result is twice as
+|                                      long.  If the functions succeeds if returns GENERIC_OK, 
+|                                      else GENERIC_ERROR.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *a                                      UINT32                  The array containing the first number.
+|      *b                                      UINT32                  The array containing the second number.
+|      ablen                           USHORT                  The length of arrays a and b, minus 1 (0 - 99).
+|      *z                                      UINT32                  The array containing the resulting number.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLmMultiply
+UINT32 OctApiLmMultiply(UINT32 * a,UINT32 * b,USHORT ablen,UINT32 * z)
+{
+       USHORT i,j,k;
+       USHORT nos;
+       UINT32 lownum;
+       UINT32 highnum;
+       USHORT longnumi;
+       USHORT longnumj;
+       USHORT indentw,indentl;
+
+
+       /* Caculate number of shorts in a and b.*/
+       nos = (USHORT)((ablen+1) * 2);
+
+       /* Clear answer word.*/
+       for(i=0;i<nos;i++)
+               *(z+i) = 0;
+
+       {
+               USHORT optimizea, optimizeb;
+               USHORT l;
+               optimizea = TRUE;
+               optimizeb = TRUE;
+               for(l = 1; l < ablen+1; l++)
+               {
+                       if(*(a+l) != 0)
+                               optimizea = FALSE;
+                       if(*(b+l) != 0)
+                               optimizeb = FALSE;
+               }
+               if(*a > OCTAPI_LM_MAX_OPTIMIZE_MUL)
+                       optimizea = FALSE;
+               if(*b > OCTAPI_LM_MAX_OPTIMIZE_MUL)
+                       optimizeb = FALSE;
+
+               if(optimizea == TRUE)
+               {
+                       for(l = 0; l < *a; l++)
+                               OctApiLmAdd(z, (USHORT)(nos-1), b, ablen, z, (USHORT)(nos-1));
+                       return(GENERIC_OK);
+               }
+
+               if(optimizeb == TRUE)
+               {
+                       for(l = 0; l < *b; l++)
+                               OctApiLmAdd(z, (USHORT)(nos-1), a, ablen, z, (USHORT)(nos-1));
+                       return(GENERIC_OK);
+               }
+       }
+
+       for(i=0;i<nos;i++)
+       {
+               longnumi = (USHORT)( i/2 );
+               /* One iteration per short in a.*/
+               if ((i%2) == 0)
+                       lownum = *(a+longnumi) & 0xFFFF;  /* Even word. Lower part of long.*/
+               else
+                       lownum = *(a+longnumi)>>16;       /* Odd word. Upper part of long.*/
+
+               for(j=0;j<nos;j++)
+               {
+                       UINT32 product;
+
+                       longnumj = (USHORT)( j/2 );
+                       /* One iteration per short in a.*/
+                       if ((j%2) == 0)
+                               highnum = *(b+longnumj) & 0xFFFF;  /* Even word. Lower part of long.*/
+                       else
+                               highnum = *(b+longnumj)>>16;       /* Odd word. Upper part of long.*/
+
+                       /* Find the word indent of the answer. 0 = no indent. 1 = one word indent.*/
+                       indentw = (USHORT)( j+i );
+                       indentl = (USHORT)( indentw / 2 );
+
+                       /* Multiply both numbers.*/
+                       product = highnum * lownum;
+
+                       /* After multiplying both numbers, add result to end result.*/
+                       if ((indentw % 2) == 0) /* Even word boundary, addition in one shot!*/
+                       {
+                               UINT32 carry=0;
+                               UINT32 temp;
+                               UINT32 addme;
+
+                               for(k=indentl;k<nos;k++)
+                               {
+                                       if (k==indentl) addme = product; else addme = 0;
+
+                                       temp = *(z+k) + addme + carry;
+
+                                       /* Calculate carry for next time.*/
+                                       if (carry == 0)
+                                               if (temp < addme) carry = 1; else carry = 0;
+                                       else
+                                               if (temp <= addme) carry = 1; else carry = 0;
+
+                                       /* Set value.*/
+                                       *(z+k) = temp;
+                               }
+
+                               /* Carry should always be 0.*/
+                               if (carry == 1) return(GENERIC_ERROR);
+                       }
+                       else /* Odd word boundary, addition in two shots.*/
+                       {
+                               UINT32 carry=0;
+                               UINT32 temp;
+                               UINT32 addme;
+
+                               for(k=indentl;k<nos;k++)
+                               {
+                                       if (k==indentl) addme = product<<16;
+                                       else if (k==(indentl+1)) addme = product>>16;
+                                       else addme = 0;
+
+                                       temp = *(z+k) + addme + carry;
+
+                                       /* Calculate carry for next time.*/
+                                       if (carry == 0)
+                                               if (temp < addme) carry = 1; else carry = 0;
+                                       else
+                                               if (temp <= addme) carry = 1; else carry = 0;
+
+                                       /* Set value.*/
+                                       *(z+k) = temp;
+                               }
+
+                               /* Carry should always be 0.*/
+                               if (carry == 1) return(GENERIC_ERROR);
+                       }
+               }
+       }
+
+       return(GENERIC_OK);
+}
+#endif
+
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLmDivide.
+|
+|      Description:    This function divides the number n by the number d.  The
+|                                      quotient is placed in q and the remainder in r.  The arrays
+|                                      n, d, q and r are all of the same length, namely (ndqrlen + 1).
+|                                      If the functions succeeds if returns GENERIC_OK, else 
+|                                      GENERIC_ERROR.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *a                                      UINT32                  The array containing the first number.
+|      *b                                      UINT32                  The array containing the second number.
+|      ablen                           USHORT                  The length of arrays a and b, minus 1 (0 - 99).
+|      *z                                      UINT32                  The array containing the resulting number.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLmDivide
+UINT32 OctApiLmDivide(UINT32 * n,UINT32 * d,UINT32 * q,UINT32 * r,USHORT ndqrlen)
+{
+       /* Proceedure for division:*/
+       /*      r = n*/
+       /*              q = 0*/
+       /*              shift = initial_denominator_shift (for upper '1's to be in same bit position).*/
+       /*              d <<= shift;*/
+       /* Start loop:*/
+       /*              compare  r and d*/
+       /*              if r > d then*/
+       /*                      r -= d;*/
+       /*                      write a '1' to bit "shift" of array q.*/
+       /*              end if;*/
+       /*              if shift == 0 then*/
+       /*                      return;*/
+       /*              else*/
+       /*                      shift--;*/
+       /*                      d>>=1;*/
+       /*                      goto "Start loop:"*/
+       /*              end if;*/
+
+       UINT32 i;
+       UINT32 result;
+       USHORT shift,n_msb,d_msb;
+       USHORT neg;
+       USHORT ConditionFlag = TRUE;
+
+       /*      r = n*/
+       for(i=0;i<=ndqrlen;i++)
+               *(r+i) = *(n+i);
+
+       /*              q = 0*/
+       for(i=0;i<=ndqrlen;i++)
+               *(q+i) = 0;
+
+       /*              shift = initial_denominator_shift (for upper '1's to be in same bit position).*/
+       result = OctApiLmGetMsb(d,ndqrlen,&d_msb);
+       if (result != GENERIC_OK) return(result);
+
+       result = OctApiLmGetMsb(n,ndqrlen,&n_msb);
+       if (result != GENERIC_OK) return(result);
+
+       if (d_msb == 0xFFFF) /* Division by 0.*/
+               return(OCTAPI_LM_DIVISION_BY_ZERO);
+
+       if (n_msb == 0xFFFF) /* 0/n, returns 0 R 0.*/
+               return(GENERIC_OK);
+
+       if (n_msb < d_msb)      /* x/y, where x is smaller than y, returns 0 R x.*/
+               return(GENERIC_OK);
+
+       shift = (USHORT)( n_msb - d_msb );
+
+       /* Shift d to match n highest bit position.*/
+       result = OctApiLmShiftn(d,ndqrlen,TRUE,shift);
+       if (result != GENERIC_OK) return(result);
+
+       /* Start loop:*/
+       while( ConditionFlag == TRUE )
+       {
+               /*              compare  r and d*/
+               result = OctApiLmCompare(r,ndqrlen,d,ndqrlen,&neg);
+               if (result != GENERIC_OK) return(result);
+
+               if (neg == FALSE) /* Subtraction can be done(do it).*/
+               {
+                       /*                      r -= d;*/
+                       result = OctApiLmSubtract(r,ndqrlen,d,ndqrlen,r,ndqrlen,&neg);
+                       if (result != GENERIC_OK) return(result);
+
+                       /*                      write a '1' to bit "shift" of array q.*/
+                       *(q+(shift/32)) |= (UINT32)0x1 << (shift%32);
+               }
+
+               /*              if shift == 0 then*/
+               /*                      return;*/
+               if (shift == 0) return(GENERIC_OK);
+
+               /*                      shift--;*/
+               /*                      d>>=1;*/
+               /*                      goto "Start loop:"*/
+               shift--;
+               OctApiLmShiftRight1(d,ndqrlen);
+       }
+
+       return(GENERIC_OK);
+}
+#endif
+
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               octapi_lm_shifright1.
+|
+|      Description:    The function is for internal use only.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      N/A.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLmShiftRight1
+UINT32 OctApiLmShiftRight1(UINT32 * a,USHORT alen)
+{
+       UINT32 i;
+
+       /* Start with lower long and move up by one long each time,*/
+       /* shifting each long to the right by one bit. The upper bit*/
+       /* of the next long will have to be concatenated each time a*/
+       /* loop is executed. For the last long, leave the highest bit*/
+       /* intact.*/
+       for(i=0;i<alen;i++)
+       {
+               *(a+i)>>=1; /*  Shift long by one to the right.*/
+               *(a+i)|=*(a+i+1)<<31;
+       }
+       *(a+alen)>>=1; /*  Shift last long, leaving it's highest bit at 0.*/
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLmShiftn.
+|
+|      Description:    The function is for internal use only.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      N/A.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLmShiftn
+UINT32 OctApiLmShiftn(UINT32 * a,USHORT alen,USHORT shiftleft,USHORT shiftn)
+{
+       UINT32 i;
+       USHORT long_offset;
+       USHORT bit_offset;
+
+       long_offset = (USHORT)( shiftn / 32 );
+       bit_offset = (USHORT)( shiftn % 32 );
+
+       if (shiftleft == TRUE) /* Shift left.*/
+       {
+               for(i=alen;i<=alen;i--)
+               {
+                       /* Fill upper bits of long.*/
+                       if (i >= long_offset)
+                               *(a+i) = *(a+i-long_offset) << bit_offset;
+                       else
+                               *(a+i) = 0;
+
+                       /* Fill lower bits of long.*/
+                       if (i > long_offset && bit_offset != 0)
+                               *(a+i) |= *(a+i-long_offset-1) >> (32-bit_offset);
+               }
+       }
+       else /* Shift right.*/
+       {
+               for(i=0;i<=alen;i++)
+               {
+                       /* Fill lower bits of long.*/
+                       if ((alen-i) >= long_offset)
+                               *(a+i) = *(a+i+long_offset) >> bit_offset;
+                       else
+                               *(a+i) = 0;
+
+                       /* Fill upper bits of long.*/
+                       if ((alen-i) > long_offset && bit_offset != 0)
+                               *(a+i) |= *(a+i+long_offset+1) << (32-bit_offset);
+
+               }
+       }
+
+       return(GENERIC_OK);
+}
+#endif
+
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLmGetMsb.
+|
+|      Description:    The function is for internal use only.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      N/A.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLmGetMsb
+UINT32 OctApiLmGetMsb(UINT32 * a,USHORT alen,USHORT * msb_pos)
+{
+       UINT32 i,j;
+       UINT32 x;
+
+       for(i=alen;i<=alen;i--)
+       {
+               if (*(a+i) == 0) continue;
+
+      x = *(a+i);
+               for(j=31;j<=31;j--)
+               {
+                       /* Test for bit being '1'.*/
+                       if ((x & 0x80000000) != 0)
+                       {
+                               *msb_pos=(USHORT)(j+(32*i));
+                               return(GENERIC_OK);
+                       }
+
+                       /* Shift bit one bit position, and try again.*/
+                       x<<=1;
+               }
+       }
+
+       /* MSB not found.*/
+       *msb_pos = 0xFFFF;
+
+       return(GENERIC_OK);
+}
+#endif
diff --git a/xpp/oct612x/apilib/llman/octapi_llman.c b/xpp/oct612x/apilib/llman/octapi_llman.c
new file mode 100644 (file)
index 0000000..9926d20
--- /dev/null
@@ -0,0 +1,2787 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+
+File:  octapi_llman.c
+
+    Copyright (c) 2001-2007 Octasic Inc.
+    
+Description: 
+
+       Library used to manage allocation tables and linked lists.  The library is
+       made such that only a block of contiguous memory is needed for the
+       management of the linked list/allocation table.
+
+This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API  is 
+free software; you can redistribute it and/or modify it under the terms of 
+the GNU General Public License as published by the Free Software Foundation; 
+either version 2 of the License, or (at your option) any later version.
+
+The OCT6100 GPL API is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
+for more details. 
+
+You should have received a copy of the GNU General Public License 
+along with the OCT6100 GPL API; if not, write to the Free Software 
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+$Octasic_Release: OCT612xAPI-01.00-PR49 $
+
+$Octasic_Revision: 22 $
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#include "octapi_llman_private.h"
+#include "apilib/octapi_llman.h"
+#include "apilib/octapi_largmath.h"
+
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctapiLlmAllocGetSize.
+|
+|      Description:    This function determines the amount of memory needed to
+|                                      manage the allocation of a fixed amount of resources.
+|                                      The memory is measured in bytes.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      number_of_items         UINT32                  The number of resources to be allocated.
+|      *l_size UINT32          UINT32                  The amount of memory needed, returned.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctapiLlmAllocGetSize
+UINT32 OctapiLlmAllocGetSize(UINT32 number_of_items,UINT32 * l_size)
+{
+       if (number_of_items == 0) return(GENERIC_BAD_PARAM);
+
+       *l_size = (sizeof(LLM_ALLOC)) + (number_of_items * sizeof(UINT32));
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctapiLlmAllocInit.
+|
+|      Description:    This function intializes the LLM_ALLOC structure.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      **l                                     void                    The memory used by the LLM_ALLOC structure.
+|      number_of_items         UINT32                  The number of resources to be allocated.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctapiLlmAllocInit
+UINT32 OctapiLlmAllocInit(void ** l,UINT32 number_of_items)
+{
+       LLM_ALLOC* ls;
+       UINT32 i;
+
+       /* Check the number of items required.*/
+       if (number_of_items == 0) return(GENERIC_BAD_PARAM);
+
+       /* If no memory has been allocated yet:*/
+       if (*l == NULL) return(OCTAPI_LLM_MEMORY_NOT_ALLOCATED);
+
+       /* Build the structure before starting.*/
+       ls = (LLM_ALLOC *)(*l);
+       ls->linked_list = (UINT32 *)((BYTE *)ls + sizeof(LLM_ALLOC));
+
+       ls->number_of_items = number_of_items;
+
+       /* Linked list links all structures in ascending order.*/
+       for(i=0;i<number_of_items;i++)
+       {
+               ls->linked_list[i] = i+1;
+       }
+
+       ls->linked_list[number_of_items - 1] = 0xFFFFFFFF; /* Invalid link.*/
+
+       /* Next avail is 0.*/
+       ls->next_avail_num = 0;
+
+       /* Number of allocated items is null.*/
+       ls->allocated_items = 0;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctapiLlmAllocInfo.
+|
+|      Description:    This function returns the number of free and allocated
+|                                      block in the LLMAN list.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM_ALLOC structure.
+|      *allocated_items        UINT32                  Number of allocated items.
+|      *available_items        UINT32                  Number of available items.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctapiLlmAllocInfo
+UINT32 OctapiLlmAllocInfo(void * l,UINT32 * allocated_items,UINT32 * available_items)
+{
+       LLM_ALLOC* ls;
+
+       /* Build the structure before starting.*/
+       ls = (LLM_ALLOC *)l;
+       ls->linked_list = (UINT32 *)((BYTE *)ls + sizeof(LLM_ALLOC));
+
+       *allocated_items = ls->allocated_items;
+       *available_items = ls->number_of_items - ls->allocated_items;
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctapiLlmAllocInfo.
+|
+|      Description:    This function allocates the resource indicated by blocknum.
+|                                      If the resource can be allocated then GENERIC_OK is returned.  
+|                                      Else an error.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM_ALLOC structure.
+|      *block_num                      UINT32                  The resource to be allocated.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctapiLlmAllocAlloc
+UINT32 OctapiLlmAllocAlloc(void * l,UINT32 * blocknum)
+{
+       LLM_ALLOC* ls;
+       UINT32 allocated_block;
+       UINT32* node;
+
+       /* Build the structure before starting.*/
+       ls = (LLM_ALLOC *)l;
+       ls->linked_list = (UINT32 *)((BYTE *)ls + sizeof(LLM_ALLOC));
+
+       /* Get next available block number.*/
+       allocated_block = ls->next_avail_num;
+
+       /* Check if block is invalid.*/
+       if (allocated_block == 0xFFFFFFFF)
+       {
+               /* Make blocknum NULL.*/
+               *blocknum = 0xFFFFFFFF;
+
+               return(OCTAPI_LLM_NO_STRUCTURES_LEFT);
+       }
+
+       node = &ls->linked_list[allocated_block];
+
+       /* Copy next block number.*/
+       ls->next_avail_num = *node;
+
+       /* Tag as used the current block number.*/
+       *node = 0xFFFFFFFE;
+
+       /* Return proper block number.*/
+       *blocknum = allocated_block;
+
+       /* Update block usage number.*/
+       ls->allocated_items++;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctapiLlmAllocDealloc.
+|
+|      Description:    This function deallocates the resource indicated by blocknum.
+|                                      If the resource is not already allocated an error is returned.
+|                                      Else GENERIC_OK is returned.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM_ALLOC structure.
+|      block_num                       UINT32                  The resource to be deallocated.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctapiLlmAllocDealloc
+UINT32 OctapiLlmAllocDealloc(void * l,UINT32 blocknum)
+{
+       LLM_ALLOC* ls;
+       UINT32* node;
+
+       /* Build the structure before starting.*/
+       ls = (LLM_ALLOC *)l;
+       ls->linked_list = (UINT32 *)((BYTE *)ls + sizeof(LLM_ALLOC));
+       
+       /* Check for null item pointer.*/
+       if (blocknum == 0xFFFFFFFF) return(GENERIC_OK);
+
+       /* Check if blocknum is within specified item range.*/
+       if (blocknum >= ls->number_of_items) return(OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE);
+
+       node = &ls->linked_list[blocknum];
+
+       /* Check if block is really used as of now.*/
+       if (*node != 0xFFFFFFFE) return(OCTAPI_LLM_MEMORY_NOT_ALLOCATED);
+
+       /* Add link to list.*/
+       *node = ls->next_avail_num;
+
+       /* Point to returned block.*/
+       ls->next_avail_num = blocknum;
+
+       /* Update block usage number.*/
+       ls->allocated_items--;
+
+       return(GENERIC_OK);
+}
+#endif
+
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiTllmAllocGetSize.
+|
+|      Description:    This function determines the amount of memory needed to
+|                                      manage the allocation of a fixed amount of resources.
+|                                      The memory is measured in bytes. 
+|
+|                                      This version is a time manage version of llman.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      number_of_items         UINT32                  The number of resources to be allocated.
+|      *l_size UINT32          UINT32                  The amount of memory needed, returned.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiTllmAllocGetSize
+UINT32 OctApiTllmAllocGetSize(UINT32 number_of_items,UINT32 * l_size)
+{
+       if (number_of_items == 0) return(GENERIC_BAD_PARAM);
+
+       *l_size = (sizeof(TLLM_ALLOC)) + (number_of_items * sizeof(TLLM_ALLOC_NODE));
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiTllmAllocInit.
+|
+|      Description:    This function intializes the TLLM_ALLOC structure.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      **l                                     void                    The memory used by the LLM_ALLOC structure.
+|      number_of_items         UINT32                  The number of resources to be allocated.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiTllmAllocInit
+UINT32 OctApiTllmAllocInit(void ** l,UINT32 number_of_items)
+{
+       TLLM_ALLOC* ls;
+       UINT32 i;
+
+       /* Check the number of items required.*/
+       if (number_of_items == 0) return(GENERIC_BAD_PARAM);
+
+       /* If no memory has been allocated yet.*/
+       if (*l == NULL) return(OCTAPI_LLM_MEMORY_NOT_ALLOCATED);
+
+       /* Build the structure before starting.*/
+       ls = (TLLM_ALLOC *)(*l);
+       ls->linked_list = (TLLM_ALLOC_NODE *)((BYTE *)ls + sizeof(TLLM_ALLOC));
+
+       ls->number_of_items = number_of_items;
+
+       /* Linked list links all structures in ascending order.*/
+       for(i=0;i<number_of_items;i++)
+       {
+               ls->linked_list[i].value = i+1;
+       }
+
+       ls->linked_list[number_of_items - 1].value = 0xFFFFFFFF; /* Invalid link.*/
+
+       /* Next avail is 0.*/
+       ls->next_avail_num = 0;
+
+       /* Number of allocated items is null.*/
+       ls->allocated_items = 0;
+
+       /* Set the number of timeout entry.*/
+       ls->number_of_timeout = 0;
+
+       /* Next timeout is 0.*/
+       ls->next_timeout_num = 0xFFFFFFFF;
+       ls->last_timeout_num = 0xFFFFFFFF;
+
+       /* Set the known time to 0.*/
+       ls->last_known_time[ 0 ] = 0;
+       ls->last_known_time[ 1 ] = 0;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiTllmAllocInfo.
+|
+|      Description:    This function returns the number of free and allocated
+|                                      block in the TLLMAN list.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM_ALLOC structure.
+|      *allocated_items        UINT32                  Number of allocated items.
+|      *available_items        UINT32                  Number of available items.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiTllmAllocInfo
+UINT32 OctApiTllmAllocInfo(void * l,UINT32 * allocated_items,UINT32 * available_items)
+{
+       TLLM_ALLOC* ls;
+
+       /* Build the structure before starting.*/
+       ls = (TLLM_ALLOC *)l;
+       *allocated_items = ls->allocated_items;
+       *available_items = ls->number_of_items - ls->allocated_items;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiTllmAllocAlloc.
+|
+|      Description:    This function allocates the resource indicated by blocknum.
+|                                      If the resource can be allocated then GENERIC_OK is returned.  
+|                                      Else an error.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM_ALLOC structure.
+|      *block_num                      UINT32                  The resource to be allocated.
+|      *current_time           UINT32
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiTllmAllocAlloc
+UINT32 OctApiTllmAllocAlloc(void * l,UINT32 * blocknum, UINT32 *current_time)
+{
+       TLLM_ALLOC* ls;
+       UINT32 allocated_block;
+       TLLM_ALLOC_NODE* node;
+
+       /* Build the structure before starting.*/
+       ls = (TLLM_ALLOC *)l;
+       ls->linked_list = (TLLM_ALLOC_NODE *)((BYTE *)ls + sizeof(TLLM_ALLOC));
+       
+       if ( ls->allocated_items == ls->number_of_items  && 
+                ls->next_timeout_num != 0xFFFFFFFF )
+       {
+               UINT32 l_ulResult;
+               l_ulResult = OctApiTllmCheckTimeoutList( ls, current_time );
+               if ( l_ulResult != GENERIC_OK )
+                       return l_ulResult;
+       }
+       
+       /* Get next available block number.*/
+       allocated_block = ls->next_avail_num;
+
+       /* Check if block is invalid.*/
+       if (allocated_block == 0xFFFFFFFF)
+       {
+               /* Make blocknum NULL.*/
+               *blocknum = 0xFFFFFFFF;
+
+               return(OCTAPI_LLM_NO_STRUCTURES_LEFT);
+       }
+
+       node = &ls->linked_list[allocated_block];
+
+       /* Copy next block number.*/
+       ls->next_avail_num = node->value;
+
+       /* Tag as used the current block number.*/
+       node->value = 0xFFFFFFFE;
+
+       /* Return proper block number.*/
+       *blocknum = allocated_block;
+
+       /* Update block usage number.*/
+       ls->allocated_items++;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiTllmAllocDealloc.
+|
+|      Description:    This function deallocates the resource indicated by blocknum.
+|                                      If the resource is not already allocated an error is returned.
+|                                      Else GENERIC_OK is returned.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM_ALLOC structure.
+|      block_num                       UINT32                  The resource to be deallocated.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiTllmAllocDealloc
+UINT32 OctApiTllmAllocDealloc(void * l,UINT32 blocknum, UINT32 timeout_value, UINT32 current_time[2])
+{
+       TLLM_ALLOC* ls;
+       TLLM_ALLOC_NODE* node;
+       UINT32  l_ulResult;
+
+       /* Build the structure before starting.*/
+       ls = (TLLM_ALLOC *)l;
+       ls->linked_list = (TLLM_ALLOC_NODE *)((BYTE *)ls + sizeof(TLLM_ALLOC));
+       
+       /* Check for null item pointer.*/
+       if (blocknum == 0xFFFFFFFF) return(GENERIC_OK);
+
+       /* Check if blocknum is within specified item range.*/
+       if (blocknum >= ls->number_of_items) return(OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE);
+
+       if ( ls->next_timeout_num != 0xFFFFFFFF )
+       {
+               l_ulResult = OctApiTllmCheckTimeoutList( ls, current_time );
+               if ( l_ulResult != GENERIC_OK )
+                       return l_ulResult;
+       }
+
+       node = &ls->linked_list[blocknum];
+
+       /* Check if block is really used as of now.*/
+       if (node->value != 0xFFFFFFFE) return(OCTAPI_LLM_MEMORY_NOT_ALLOCATED);
+
+       /* Add link to timeout list.*/
+       if ( ls->last_timeout_num != 0xFFFFFFFF )
+       {
+               TLLM_ALLOC_NODE* last_node;
+
+               /* insert the node at the end of the list.*/
+               node->value = 0xFFFFFFFF;
+               last_node = &ls->linked_list[ ls->last_timeout_num ];
+               last_node->value = blocknum;
+       }
+       else
+       {
+               /* The node is alone in the list.*/
+               node->value = 0xFFFFFFFF;
+               ls->next_timeout_num = blocknum;
+       }
+
+       ls->last_timeout_num = blocknum;
+       ls->number_of_timeout++;
+
+       /* Set the timeout time of the node.*/
+       l_ulResult = OctApiLmAdd( current_time, 1, &timeout_value, 0, node->timeout, 1 );
+       if (l_ulResult != GENERIC_OK) 
+               return(l_ulResult);
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiTllmCheckTimeoutList.
+|
+|      Description:    This function will verify if the timeout time 
+|                                      of all the node present in the timeout list are bigger
+|                                      then the current time.  If so the node will be returned
+|                                      ot the free node list.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *ls                                             TLLM_ALLOC              The memory used by the TLLM_ALLOC structure.
+|      current_time                    UINT32[2]               The current time in msec.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiTllmCheckTimeoutList
+UINT32 OctApiTllmCheckTimeoutList(TLLM_ALLOC *ls, UINT32 current_time[2])
+{
+       UINT32  result;
+       UINT32  fConditionFlag = TRUE;
+
+       /* Free-up any pending memory before trying the allocation:*/
+       if ((ls->last_known_time[0] != current_time[0] ||
+               ls->last_known_time[1] != current_time[1]) && 
+               (current_time[1] != 0 || current_time[0] != 0)) /* Time has changed.*/
+       {
+               TLLM_ALLOC_NODE *pcurrent_node;
+               UINT32  current_num;
+               USHORT  neg;
+
+               /* Remember time for next time!*/
+               ls->last_known_time[0] = current_time[0];
+               ls->last_known_time[1] = current_time[1];
+
+       
+               while ( fConditionFlag == TRUE )
+               {
+                       /* Get a node from the timeout list.*/
+                       pcurrent_node = &ls->linked_list[ ls->next_timeout_num ];
+                       current_num = ls->next_timeout_num;
+       
+                       /* Check if first node has timeout.*/
+                       result = OctApiLmCompare(current_time,1,pcurrent_node->timeout ,1,&neg);
+                       if (result != GENERIC_OK) return(result);
+                       
+                       /* if the timeout tiem was exceeded, set the block as free.*/
+                       if ( neg == FALSE )
+                       {
+                               /* set the next node pointer.*/
+                               ls->next_timeout_num = pcurrent_node->value;
+                               ls->number_of_timeout--;
+
+                               /* reset the last pointer of the timeout list.*/
+                               if ( ls->number_of_timeout == 0 )
+                                       ls->last_timeout_num = 0xFFFFFFFF;
+
+                               /* return the node the free list.*/
+                               pcurrent_node->value = ls->next_avail_num;
+                               ls->next_avail_num = current_num;
+                               ls->allocated_items--;
+                       }
+                       else    /* node not in timeout */
+                       {
+                               fConditionFlag = FALSE;
+                               break;
+                       }
+
+                       if ( ls->next_timeout_num == 0xFFFFFFFF )
+                       {
+                               fConditionFlag = FALSE;
+                               break;  /* end of timeout list.*/
+                       }
+               }
+       }
+
+       return(GENERIC_OK);
+}
+#endif
+/**************************************** llm_alloc section **********************************************/
+
+
+
+
+
+
+
+/**************************************** llm_list section **********************************************/
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlmListGetSize
+|
+|      Description:    This function determines the amount of memory needed by
+|                                      the LLM_LIST structure to manage the allocation of
+|                                      number_of_items number of resources.  The memory is
+|                                      measured in bytes.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      number_of_items         UINT32                  The number of resources to be allocated
+|                                                                              amongst all linked-lists.
+|      number_of_lists         UINT32                  The maximum number of linked-lists that
+|                                                                              can be allocated.
+|      *l_size UINT32          UINT32                  The amount of memory needed, returned.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlmListGetSize
+UINT32 OctApiLlmListGetSize(UINT32 number_of_items,UINT32 number_of_lists,UINT32 user_info_size,UINT32 * l_size)
+{
+       UINT32 head_alloc_size;
+       UINT32 result;
+       UINT32 user_info_size_roundup;
+
+       if (number_of_items == 0) return(GENERIC_BAD_PARAM);
+       if (number_of_lists == 0) return(GENERIC_BAD_PARAM);
+       if (user_info_size == 0) return(GENERIC_BAD_PARAM);
+
+       user_info_size_roundup = ((user_info_size + 3) / 4) * 4;
+
+       result = OctapiLlmAllocGetSize(number_of_lists,&head_alloc_size);
+       if(result != GENERIC_OK) return(result);
+
+       *l_size = sizeof(LLM_LIST) + (number_of_lists * sizeof(LLM_LIST_HEAD)) + head_alloc_size + (number_of_items * (sizeof(LLM_LIST_ITEM) + user_info_size_roundup - 4));
+
+       return(GENERIC_OK);
+}
+#endif
+
+#if !SKIP_OctApiLlmListGetItemPointer
+LLM_LIST_ITEM * OctApiLlmListGetItemPointer(LLM_LIST * ls, UINT32 item_number)
+{
+       return (LLM_LIST_ITEM *) (((BYTE *)ls->li) + (ls->item_size * item_number)) ;
+}
+#endif
+
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlmListInit.
+|
+|      Description:    This function intializes the LLM_TALLOC structure.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM_LIST structure.
+|      number_of_items         UINT32                  The number of resources to be allocated
+|                                                                              amongst all linked-lists.
+|      number_of_lists         UINT32                  The maximum number of linked-lists that
+|                                                                              can be allocated.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlmListInit
+UINT32 OctApiLlmListInit(void ** l,UINT32 number_of_items,UINT32 number_of_lists,UINT32 user_info_size)
+{
+       LLM_LIST* ls;
+       LLM_LIST_ITEM* item;
+       UINT32 i;
+       UINT32 head_alloc_size;
+       UINT32 result;
+       UINT32 user_info_size_roundup;
+       UINT32 total_lists;
+       BYTE* lsbyte;
+
+
+       if (number_of_items == 0) return(GENERIC_BAD_PARAM);
+       if (number_of_lists == 0) return(GENERIC_BAD_PARAM);
+       if (user_info_size == 0) return(GENERIC_BAD_PARAM);
+
+       user_info_size_roundup = ((user_info_size + 3) / 4) * 4;
+
+       /* Get the size of the Alloc structure used to manage head of list structures.*/
+       result = OctapiLlmAllocGetSize(number_of_lists,&head_alloc_size);
+       if(result != GENERIC_OK) return(result);
+
+       if (*l == NULL) return(OCTAPI_LLM_MEMORY_NOT_ALLOCATED);
+
+       /* Built the structure based on the base address:*/
+       ls = (LLM_LIST *)(*l);
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)));
+       ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size);
+
+       /* Initialize parameters in the structure.*/
+       ls->head_alloc_size = head_alloc_size;
+       ls->user_info_bytes = user_info_size;
+       ls->user_info_size = user_info_size_roundup;
+       ls->total_items = number_of_items;
+       ls->assigned_items = 0;
+       ls->total_lists = number_of_lists;
+       ls->assigned_lists = 0;
+       ls->next_empty_item = 0;
+       ls->item_size = sizeof(LLM_LIST_ITEM) + user_info_size_roundup - 4;
+
+       /* Complete the build!*/
+       ls = (LLM_LIST *)(*l);
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)));
+       ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size);
+
+       /* Initialize the head of queue Alloc structure.*/
+       result = OctapiLlmAllocInit(&(ls->list_head_alloc),number_of_lists);
+       if(result != GENERIC_OK) return(result);
+
+       /* Initialize the linked list of the items:*/
+       for(i=0; i<number_of_items; i++)
+       {
+               item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * i);
+
+               if (i == (number_of_items - 1))
+                       item->forward_link = 0xFFFFFFFF;
+               else
+                       item->forward_link = i + 1;
+       }
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlmListInfo.
+|
+|      Description:    This function returns the status of the LLM_LIST structure.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM_LIST structure.
+|      *allocated_lists        UINT32                  The number of linked_lists allocated.
+|      *free_lists                     UINT32                  The number of linked_lists still free.
+|      *allocated_items        UINT32                  The number of items allocated to lists.
+|      *free_items                     UINT32                  The number of items still free.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlmListInfo
+UINT32 OctApiLlmListInfo(void * l,UINT32 * allocated_lists,UINT32 * allocated_items,
+                                                                       UINT32 * free_lists,UINT32 * free_items)
+{
+       LLM_LIST* ls;
+       BYTE* lsbyte;
+       UINT32 total_lists;
+
+       /* Built the structure based on the base address:*/
+       ls = (LLM_LIST *)l;
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)));
+       ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size);
+
+       *allocated_items = ls->assigned_items;
+       *free_items = ls->total_items - ls->assigned_items;
+
+       *allocated_lists = ls->assigned_lists;
+       *free_lists = ls->total_lists - ls->assigned_lists;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlmListCreate.
+|
+|      Description:    This function creates a linked list.  The target which is
+|                                      allocated the newly created list can request additions
+|                                      or removals from the list later on.  To target identifies
+|                                      its list with the returned list handle.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM_LIST structure.
+|      *list_handle            UINT32                  The handle to the new list, returned.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlmListCreate
+UINT32 OctApiLlmListCreate(void * l,UINT32 * list_handle)
+{
+       LLM_LIST* ls;
+       LLM_LIST_HEAD* lh;
+       UINT32 blocknum;
+       UINT32 total_lists;
+       UINT32 result;
+       BYTE* lsbyte;
+
+       /* Built the structure based on the base address:*/
+       ls = (LLM_LIST *)l;
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)));
+       ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size);
+
+       /* Get a list using the list head alloc structure.*/
+       result = OctapiLlmAllocAlloc(ls->list_head_alloc, &blocknum);
+       if (result != GENERIC_OK) return(result);
+
+       /* The handle is the block number.*/
+       *list_handle = blocknum;
+
+       /* Initialize the list head structure.*/
+       lh = &ls->lh[blocknum];
+       lh->list_length = 0;
+       lh->head_pointer = 0xFFFFFFFF;
+       lh->tail_pointer = 0xFFFFFFFF;
+       lh->cache_item_number = 0xFFFFFFFF;
+       lh->cache_item_pointer = 0xFFFFFFFF;
+
+       ls->assigned_lists++;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlmListDelete.
+|
+|      Description:    This function deletes the linked list indicated by the
+|                                      handle list_handle.  Any items which are still allocated
+|                                      to the list are first deallocated.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM_LIST structure.
+|      *list_handle            UINT32                  The handle to the list.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlmListDelete
+UINT32 OctApiLlmListDelete(void * l,UINT32 list_handle)
+{
+       LLM_LIST* ls;
+       LLM_LIST_HEAD* lh;
+       UINT32 total_lists;
+       UINT32 result;
+       BYTE* lsbyte;
+
+       /* Built the structure based on the base address:*/
+       ls = (LLM_LIST *)l;
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)));
+       ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size);
+
+       
+       if (list_handle >= ls->total_lists) return(OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE);
+       if (ls->lh[list_handle].list_length == 0xFFFFFFFF) return(OCTAPI_LLM_INVALID_LIST_HANDLE);
+
+       /* Release internal list header handle...*/
+       result = OctapiLlmAllocDealloc(ls->list_head_alloc,list_handle);
+       if (result != GENERIC_OK) return(result);
+
+       lh = &ls->lh[list_handle];
+
+       /* Deallocate all items in the list!*/
+       if (lh->list_length != 0)
+       {
+               LLM_LIST_ITEM * item;
+
+               item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * lh->tail_pointer);
+
+               /* Release the items using only the links.*/
+               item->forward_link = ls->next_empty_item;
+               ls->next_empty_item = lh->head_pointer;
+
+               /* Remove items from item counter.*/
+               ls->assigned_items -= lh->list_length;
+       }
+
+       lh->list_length = 0xFFFFFFFF;
+       lh->head_pointer = 0xFFFFFFFF;
+       lh->tail_pointer = 0xFFFFFFFF;
+       lh->cache_item_number = 0xFFFFFFFF;
+       lh->cache_item_pointer = 0xFFFFFFFF;
+
+       ls->assigned_lists--;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlmListLength.
+|
+|      Description:    This function returns the number of items allocated to the
+|                                      list indicated by the handle list_handle.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM_LIST structure.
+|      list_handle                     UINT32                  The handle to the list.
+|      *number_of_items        UINT32                  The number of items in the list, returned.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlmListLength
+UINT32 OctApiLlmListLength(void * l,UINT32 list_handle, UINT32 * number_of_items_in_list)
+{
+       LLM_LIST* ls;
+       LLM_LIST_HEAD* lh;
+       UINT32 total_lists;
+       BYTE* lsbyte;
+
+       /* Built the structure based on the base address:*/
+       ls = (LLM_LIST *)l;
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)));
+       ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size);
+
+       lh = &ls->lh[list_handle];
+       
+       if (list_handle >= ls->total_lists) return(OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE);
+       if (lh->list_length == 0xFFFFFFFF) return(OCTAPI_LLM_INVALID_LIST_HANDLE);
+
+       *number_of_items_in_list = lh->list_length;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlmListItemData
+|
+|      Description:    This function returns a pointer to the user data associated
+|                                      with an item.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM_LIST structure.
+|      list_handle                     UINT32                  The handle to the list.
+|      item_number                     UINT32                  The number of the list node in question.
+|      **item_data_pnt         void                    The pointer to the user data, returned.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlmListItemData
+UINT32 OctApiLlmListItemData(void * l,UINT32 list_handle,UINT32 item_number,void ** item_data_pnt)
+{
+       LLM_LIST* ls;
+       LLM_LIST_HEAD* lh;
+       LLM_LIST_ITEM* item;
+       UINT32  cur_list_pnt;
+       UINT32  cur_list_num;
+       UINT32  total_lists;
+       UINT32  list_length;
+       BYTE*   lsbyte;
+       UINT32  fConditionFlag = TRUE;
+
+       /* Built the structure based on the base address:*/
+       ls = (LLM_LIST *)l;
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)));
+       ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size);
+
+       lh = &ls->lh[list_handle];
+       list_length = lh->list_length;
+       
+       *item_data_pnt = NULL;
+       if (list_handle >= ls->total_lists) return(OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE);
+       if (list_length == 0xFFFFFFFF) return(OCTAPI_LLM_INVALID_LIST_HANDLE);
+       if (list_length <= item_number) return(OCTAPI_LLM_ELEMENT_NOT_FOUND);
+
+       /* Determine where the search will start.*/
+       if (list_length == (item_number + 1))   /* Last item in list:*/
+       {
+               cur_list_pnt = lh->tail_pointer;
+               cur_list_num = item_number;
+       }
+       else if (lh->cache_item_number <= item_number)  /* Start at cache:*/
+       {
+               cur_list_pnt = lh->cache_item_pointer;
+               cur_list_num = lh->cache_item_number;
+       }
+       else  /* Start at beginning:*/
+       {
+               cur_list_pnt = lh->head_pointer;
+               cur_list_num = 0;
+       }
+
+       /* Start search from cur_list_pnt and cur_list_num.*/
+       while ( fConditionFlag == TRUE )
+       {
+               item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * cur_list_pnt);
+
+               if (cur_list_num == item_number) /* Item number found.*/
+               {
+                       /* Write new cache entry.*/
+                       lh->cache_item_pointer = cur_list_pnt;
+                       lh->cache_item_number = cur_list_num;
+
+                       /* Get item info.*/
+                       *item_data_pnt = (void *)item->user_info;
+
+                       return(GENERIC_OK);
+               }
+               else if(item->forward_link == 0xFFFFFFFF) /* End of list found?!?*/
+               {
+                       return(OCTAPI_LLM_INTERNAL_ERROR0);
+               }
+               else /* Item was not found, but continue searching.*/
+               {
+                       cur_list_pnt = item->forward_link;
+               }
+
+               cur_list_num++;
+       }
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlmListInsertItem.
+|
+|      Description:    This function allocates a node to the linked list specified
+|                                      by the handle list_handle.  The position of the new item
+|                                      can be specified. A position of 0xFFFFFFFF means append to the 
+|                                      list( use the OCTAPI_LLM_LIST_APPEND define for clarity); 
+|                   a position of 0 mean insert at the begining of the list.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM_LIST structure.
+|      *list_handle            UINT32                  The handle to the list.
+|      **item_data                     void                    Address of the user data space for this item.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlmListInsertItem
+UINT32 OctApiLlmListInsertItem(void * l,UINT32 list_handle,UINT32 item_number,void ** item_data_pnt)
+{
+       LLM_LIST* ls;
+       LLM_LIST_HEAD* lh;
+       LLM_LIST_ITEM* free_item;
+       UINT32 free_item_pnt;
+       UINT32 total_lists;
+       BYTE* lsbyte;
+       UINT32  fConditionFlag = TRUE;
+
+       /* Built the structure based on the base address:*/
+       ls = (LLM_LIST *)l;
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)));
+       ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size);
+
+       lh = &ls->lh[list_handle];
+       
+       *item_data_pnt = NULL;
+       if (list_handle >= ls->total_lists) return(OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE);
+       if (lh->list_length == 0xFFFFFFFF) return(OCTAPI_LLM_INVALID_LIST_HANDLE);
+       if (lh->list_length < item_number && item_number != 0xFFFFFFFF) 
+               return(OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE);
+       if (ls->next_empty_item == 0xFFFFFFFF) return(OCTAPI_LLM_NO_STRUCTURES_LEFT);
+
+       /* Get a free item from the free item list!*/
+       free_item_pnt = ls->next_empty_item;
+       free_item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * free_item_pnt);
+       ls->next_empty_item = free_item->forward_link;
+
+       if (item_number == 0xFFFFFFFF)
+               item_number = lh->list_length;
+
+       if (lh->list_length == 0)       /* First item and only item:*/
+       {
+               free_item->forward_link = 0xFFFFFFFF;
+               lh->tail_pointer = free_item_pnt;
+               lh->head_pointer = free_item_pnt;
+       }
+       else if (item_number == 0)      /* First item and but list not empty:*/
+       {
+               free_item->forward_link = lh->head_pointer;
+               lh->head_pointer = free_item_pnt;
+       }
+       else if (item_number == lh->list_length)        /* Append:*/
+       {
+               LLM_LIST_ITEM * last_item;
+               last_item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * lh->tail_pointer);
+
+               last_item->forward_link = free_item_pnt;
+               free_item->forward_link = 0xFFFFFFFF;
+               lh->tail_pointer = free_item_pnt;
+       }
+       else    /* Insert:*/
+       {
+               LLM_LIST_ITEM * last_item = NULL;
+               LLM_LIST_ITEM * item;
+               UINT32 last_list_pnt;
+               UINT32 cur_list_pnt;
+               UINT32 cur_list_num;
+
+               if (lh->cache_item_number < item_number)        /* Start at cache:*/
+               {
+                       cur_list_pnt = lh->cache_item_pointer;
+                       cur_list_num = lh->cache_item_number;
+               }
+               else /* Start at beginning:*/
+               {
+                       cur_list_pnt = lh->head_pointer;
+                       cur_list_num = 0;
+               }
+
+               last_list_pnt = 0xFFFFFFFF;
+
+               /* Start search from cur_list_pnt and cur_list_num.*/
+               while ( fConditionFlag == TRUE )
+               {
+                       item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * cur_list_pnt);
+
+                       if (cur_list_num == item_number) /* Item number found.*/
+                       {
+                               if (last_list_pnt == 0xFFFFFFFF) return(OCTAPI_LLM_INTERNAL_ERROR1);
+
+                               free_item->forward_link = cur_list_pnt;
+                               last_item->forward_link = free_item_pnt;
+                               
+                               fConditionFlag = FALSE;
+                               break;
+                       }
+                       else if (item->forward_link == 0xFFFFFFFF) /* End of list found?!?*/
+                       {
+                               return(OCTAPI_LLM_INTERNAL_ERROR0);
+                       }
+                       else /* Item was not found, but continue searching.*/
+                       {
+                               last_item = item;
+                               last_list_pnt = cur_list_pnt;
+                               cur_list_pnt = item->forward_link;
+                       }
+
+                       cur_list_num++;
+               }
+       }
+
+       /* Increase the list length.*/
+       lh->list_length++;
+       ls->assigned_items++;
+       *item_data_pnt = (void *)free_item->user_info;
+
+       /* Write new cache entry.*/
+       lh->cache_item_pointer = free_item_pnt;
+       lh->cache_item_number = item_number;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlmListCreateFull.
+|
+|      Description:    This function allocates the desired number of nodes to
+|                                      the linked list specified by the handle list_handle.
+|                                      The position of the new item can be specified. A
+|                                      position of 0xFFFFFFFF means append to the list (use the
+|                                      OCTAPI_LLM_LIST_APPEND define for clarity); a position
+|                                      of 0 means insert at the begining of the list.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM_LIST structure.
+|      *list_handle            UINT32                  The handle to the list.
+|      **item_data                     void                    Address of the user data space for this item.
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlmListCreateFull
+UINT32 OctApiLlmListCreateFull(void* l, UINT32 list_length, UINT32* plist_handle)
+{
+       LLM_LIST* ls;
+       LLM_LIST_HEAD* lh;
+       LLM_LIST_ITEM* free_item;
+       LLM_LIST_ITEM* last_item = NULL;
+       UINT32 free_item_pnt = 0xFFFFFFFF;
+       UINT32 total_lists;
+       UINT32 list_handle;
+       UINT32 list_length_m1;
+       UINT32 next_empty_item;
+       UINT32 result;
+       UINT32 i;
+       BYTE* lsbyte;
+
+
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+       /* Build the structure based on the base address:*/
+       ls = (LLM_LIST *)l;
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)));
+       ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size);
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+
+
+
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+       /* Make sure another list can be created.*/
+       if (ls->assigned_lists == ls->total_lists)
+               return(OCTAPI_LLM_ELEMENT_ALREADY_ASSIGNED);
+
+       /* Make sure there are enough free nodes to fill the new list.*/
+       if (list_length > (ls->total_items - ls->assigned_items))
+               return(OCTAPI_LLM_ELEMENT_ALREADY_ASSIGNED);
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+
+
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+       /* Create list (i.e. get a list using the list head alloc structure.*/
+       result = OctapiLlmAllocAlloc(ls->list_head_alloc, &list_handle);
+       if (result != GENERIC_OK) return(result);
+
+       /* Initialize the list head structure.*/
+       lh = &ls->lh[list_handle];
+       lh->list_length = 0;
+       lh->head_pointer = 0xFFFFFFFF;
+       lh->tail_pointer = 0xFFFFFFFF;
+       lh->cache_item_number = 0xFFFFFFFF;
+       lh->cache_item_pointer = 0xFFFFFFFF;
+
+       ls->assigned_lists++;
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+
+
+
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+       /* Add the number of requested nodes to the list.*/
+       lh = &ls->lh[list_handle];
+       list_length_m1 = list_length - 1;
+       next_empty_item = ls->next_empty_item;
+
+       for (i=0; i<list_length; i++)
+       {
+               /* Get a free item from the free item list!*/
+               free_item_pnt = next_empty_item;
+               free_item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * free_item_pnt);
+               next_empty_item = free_item->forward_link;
+
+               /* Branch according to whether the node is the first in list, last, or in
+                       the middle.*/
+               if (i == 0)     
+               {
+                       /* First item.*/
+                       free_item->forward_link = 0xFFFFFFFF;
+                       lh->head_pointer = free_item_pnt;
+                       lh->tail_pointer = free_item_pnt;
+               }
+               else if (i == list_length_m1)   
+               {
+                       /* Last item.*/
+                       last_item->forward_link = free_item_pnt;
+                       free_item->forward_link = 0xFFFFFFFF;
+                       lh->tail_pointer = free_item_pnt;
+               }
+               else
+               {
+                       /* Node somewhere in the middle.*/
+                       last_item->forward_link = free_item_pnt;
+               }
+
+               /* Store pointer to free item as pointer to last item (for next iteration).*/
+               last_item = free_item;
+       }
+
+       /* Store new value of next_empty_item.*/
+       ls->next_empty_item = next_empty_item;
+
+       /* Write new cache entry.*/
+       lh->cache_item_pointer = free_item_pnt;
+       lh->cache_item_number = list_length_m1;
+
+       /* Set the list length.*/
+       lh->list_length = list_length;
+       ls->assigned_items += list_length;
+
+       /* Return pointer to new list.*/
+       *plist_handle = list_handle;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlmListAppendItems.
+|
+|      Description:    This function allocates the desired number of nodes to
+|                                      the linked list specified by the handle list_handle.
+|                                      The position of the new item can be specified. A
+|                                      position of 0xFFFFFFFF means append to the list (use the
+|                                      OCTAPI_LLM_LIST_APPEND define for clarity); a position
+|                                      of 0 means insert at the begining of the list.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM_LIST structure.
+|      *list_handle            UINT32                  The handle to the list.
+|      **item_data                     void                    Address of the user data space for this item.
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlmListAppendItems
+UINT32 OctApiLlmListAppendItems(void* l, UINT32 list_handle, UINT32 num_items)
+{
+       LLM_LIST* ls;
+       LLM_LIST_HEAD* lh;
+       LLM_LIST_ITEM* item_list;
+       LLM_LIST_ITEM* curr_item = NULL;
+       LLM_LIST_ITEM* free_item;
+       UINT32 curr_item_pnt = 0xFFFFFFFF;
+       UINT32 total_lists;
+       UINT32 next_empty_item;
+       UINT32 item_size;
+       UINT32 i;
+       BYTE* lsbyte;
+
+
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+       /* Build the structure based on the base address:*/
+       ls = (LLM_LIST *)l;
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)));
+       ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size);
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+
+
+
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+       /* Make sure list handle is valid.*/
+       if (list_handle >= ls->total_lists)
+               return(OCTAPI_LLM_INVALID_LIST_HANDLE);
+
+       /* Make sure there is at least one item.*/
+       if (num_items == 0)
+               return(OCTAPI_LLM_INVALID_PARAMETER);
+
+       /* Make sure there are enough free nodes.*/
+       if (num_items > (ls->total_items - ls->assigned_items))
+               return(OCTAPI_LLM_NO_STRUCTURES_LEFT);
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+
+
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+       /* Get pointer to list structure.*/
+       lh = &ls->lh[list_handle];
+       if (lh->list_length == 0xFFFFFFFF)
+               return(OCTAPI_LLM_INVALID_LIST_HANDLE);
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+
+
+
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+       /* Add the number of requested nodes to the list.*/
+       item_list = ls->li;
+       item_size = ls->item_size;
+       next_empty_item = ls->next_empty_item;
+
+       for (i=0; i<num_items; i++)
+       {
+               if (i == 0)
+               {
+                       if (lh->head_pointer == 0xFFFFFFFF)
+                       {
+                               /* Current and next items are one and the same!*/
+                               curr_item = (LLM_LIST_ITEM *)((BYTE *)item_list + item_size * next_empty_item);
+
+                               /* Set new head and tail pointers.*/
+                               lh->head_pointer = next_empty_item;
+                               lh->tail_pointer = next_empty_item;
+
+                               /* Update current item pnt.*/
+                               curr_item_pnt = next_empty_item;
+
+                               /* Update next item.*/
+                               next_empty_item = curr_item->forward_link;
+
+                               /* Set first item to be only item in list.*/
+                               curr_item->forward_link = 0xFFFFFFFF;
+                       }
+                       else
+                       {
+                               /* Get a free item from the free item list!*/
+                               curr_item = (LLM_LIST_ITEM *)((BYTE *)item_list + item_size * lh->tail_pointer);
+                               free_item = (LLM_LIST_ITEM *)((BYTE *)item_list + item_size * next_empty_item);
+
+                               /* Have current item point to next empty item.*/
+                               curr_item->forward_link = next_empty_item;
+
+                               /* Update current item pnt.*/
+                               curr_item_pnt = next_empty_item;
+
+                               /* Update next_empty_item.*/
+                               next_empty_item = free_item->forward_link;
+
+                               /* Update pointers to current item and free item.*/
+                               curr_item = free_item;
+                       }
+               }
+               else
+               {
+                       /* Update pointers to current item and free item.*/
+                       free_item = (LLM_LIST_ITEM *)((BYTE *)item_list + item_size * next_empty_item);
+
+                       /* Have current item point to next empty item.*/
+                       curr_item->forward_link = next_empty_item;
+
+                       /* Update current item pnt.*/
+                       curr_item_pnt = next_empty_item;
+
+                       /* Update next_empty_item.*/
+                       next_empty_item = free_item->forward_link;
+
+                       /* Update pointers to current item and free item.*/
+                       curr_item = free_item;
+               }
+       }
+
+       /* Terminate list.*/
+       if ( curr_item != NULL )
+               curr_item->forward_link = 0xFFFFFFFF;
+
+       /* Update llman structure variables.*/
+       ls->next_empty_item = next_empty_item;
+       ls->assigned_items += num_items;
+
+       /* Update list variables.*/
+       lh->list_length += num_items;
+       lh->cache_item_pointer = curr_item_pnt;
+       lh->cache_item_number = lh->list_length - 1;
+       lh->tail_pointer = curr_item_pnt;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlmListAppendAndSetItems.
+|
+|      Description:
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlmListAppendAndSetItems
+UINT32 OctApiLlmListAppendAndSetItems(void* l, UINT32 list_handle, UINT32 num_items, void* data_list)
+{
+       LLM_LIST* ls;
+       LLM_LIST_HEAD* lh;
+       LLM_LIST_ITEM* item_list;
+       LLM_LIST_ITEM* curr_item = NULL;
+       LLM_LIST_ITEM* free_item;
+       UINT32 curr_item_pnt = 0xFFFFFFFF;
+       UINT32 total_lists;
+       UINT32 next_empty_item;
+       UINT32 user_info_bytes;
+       UINT32 item_size;
+       UINT32 i;
+       BYTE* lsbyte;
+       void* data_item;
+
+
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+       /* Build the structure based on the base address:*/
+       ls = (LLM_LIST *)l;
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)));
+       ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size);
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+
+
+
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+       /* Make sure list handle is valid.*/
+       if (list_handle >= ls->total_lists)
+               return(OCTAPI_LLM_INVALID_LIST_HANDLE);
+
+       /* Make sure there is at least one item.*/
+       if (num_items == 0)
+               return(OCTAPI_LLM_INVALID_PARAMETER);
+
+       /* Make sure there are enough free nodes.*/
+       if (num_items > (ls->total_items - ls->assigned_items))
+               return(OCTAPI_LLM_NO_STRUCTURES_LEFT);
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+
+
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+       /* Get pointer to list structure.*/
+       lh = &ls->lh[list_handle];
+       if (lh->list_length == 0xFFFFFFFF)
+               return(OCTAPI_LLM_INVALID_LIST_HANDLE);
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+
+
+
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+       /* Add the number of requested nodes to the list.*/
+       item_list = ls->li;
+       user_info_bytes = ls->user_info_bytes;
+       item_size = ls->item_size;
+       next_empty_item = ls->next_empty_item;
+       data_item = data_list;
+
+       for (i=0; i<num_items; i++)
+       {
+               if (i == 0)
+               {
+                       if (lh->head_pointer == 0xFFFFFFFF)
+                       {
+                               /* Current and next items are one and the same!*/
+                               curr_item = (LLM_LIST_ITEM *)((BYTE *)item_list + item_size * next_empty_item);
+
+                               /* Set new head and tail pointers.*/
+                               lh->head_pointer = next_empty_item;
+                               lh->tail_pointer = next_empty_item;
+
+                               /* Update current item pnt.*/
+                               curr_item_pnt = next_empty_item;
+
+                               /* Update next item.*/
+                               next_empty_item = curr_item->forward_link;
+
+                               /* Set first item to be only item in list.*/
+                               curr_item->forward_link = 0xFFFFFFFF;
+                       }
+                       else
+                       {
+                               /* Get a free item from the free item list!*/
+                               curr_item = (LLM_LIST_ITEM *)((BYTE *)item_list + item_size * lh->tail_pointer);
+                               free_item = (LLM_LIST_ITEM *)((BYTE *)item_list + item_size * next_empty_item);
+
+                               /* Have current item point to next empty item.*/
+                               curr_item->forward_link = next_empty_item;
+
+                               /* Update current item pnt.*/
+                               curr_item_pnt = next_empty_item;
+
+                               /* Update next_empty_item.*/
+                               next_empty_item = free_item->forward_link;
+
+                               /* Update pointers to current item and free item.*/
+                               curr_item = free_item;
+                       }
+               }
+               else
+               {
+                       /* Update pointers to current item and free item.*/
+                       free_item = (LLM_LIST_ITEM *)((BYTE *)item_list + item_size * next_empty_item);
+
+                       /* Have current item point to next empty item.*/
+                       curr_item->forward_link = next_empty_item;
+
+                       /* Update current item pnt.*/
+                       curr_item_pnt = next_empty_item;
+
+                       /* Update next_empty_item.*/
+                       next_empty_item = free_item->forward_link;
+
+                       /* Update pointers to current item and free item.*/
+                       curr_item = free_item;
+               }
+
+               /* Copy data to new item.*/
+               OctApiLlmMemCpy(curr_item->user_info, data_item, user_info_bytes);
+
+               /* Update data_item pointer for next iteration (item).*/
+               data_item = (void *)((BYTE *)data_item + user_info_bytes);
+       }
+
+
+       /* Terminate list.*/
+       if ( curr_item != NULL )
+               curr_item->forward_link = 0xFFFFFFFF;
+
+       /* Update llman structure variables.*/
+       ls->next_empty_item = next_empty_item;
+       ls->assigned_items += num_items;
+
+       /* Update list variables.*/
+       lh->list_length += num_items;
+       lh->cache_item_pointer = curr_item_pnt;
+       lh->cache_item_number = lh->list_length - 1;
+       lh->tail_pointer = curr_item_pnt;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlmListSetItems.
+|
+|      Description:    This function takes a start entry (0 to length - 1),
+|                                      a pointer to a list of data (each item of list is the
+|                                      size of one data unit, specified at init), and the
+|                                      length of the data list.  From this, the data will be
+|                                      copied from the data list to the linked list, from
+|                                      entry start_entry to (start_entry + data_length - 1).
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlmListSetItems
+UINT32 OctApiLlmListSetItems(void* l, UINT32 list_handle, UINT32 start_item, UINT32 data_length, void* pdata_list)
+{
+       LLM_LIST* ls;
+       LLM_LIST_HEAD* lh;
+       LLM_LIST_ITEM* item = NULL;
+       UINT32 total_lists;
+       UINT32 item_pnt = 0xFFFFFFFF;
+       UINT32 i, j;
+       BYTE* lsbyte;
+       void* pdata_item = NULL;
+
+
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+       /* Build the structure based on the base address:*/
+       ls = (LLM_LIST *)l;
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)));
+       ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size);
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+
+
+
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+       /* Make sure list handle is valid.*/
+       if (list_handle >= ls->total_lists)
+               return(OCTAPI_LLM_INVALID_LIST_HANDLE);
+       lh = &ls->lh[list_handle];
+       if (lh->list_length == 0xFFFFFFFF)
+               return(OCTAPI_LLM_INVALID_LIST_HANDLE);
+
+       /* Make sure the start_entry is within limits.*/
+       if (start_item >= lh->list_length)
+               return(OCTAPI_LLM_INVALID_PARAMETER);
+
+       /* Make sure the end_entry is within limits.*/
+       lh = &ls->lh[list_handle];
+       if ((start_item + data_length) > lh->list_length)
+               return(OCTAPI_LLM_INVALID_PARAMETER);
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+
+
+
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+       /* Set the data of each node.*/
+       for (i=0; i<data_length; i++)
+       {
+               /* Obtain pointer to current item.*/
+               if (i == 0)     
+               {
+                       /* Check if location of start item is already cached.  If not, must search
+                               for it manually.*/
+                       if (start_item == (lh->cache_item_number + 1))
+                       {
+                               item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * lh->cache_item_pointer);
+                               item_pnt = item->forward_link;
+                               item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * item_pnt);
+                       }
+                       else
+                       {
+                               item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * lh->head_pointer);
+                               item_pnt = lh->head_pointer;
+                               for (j=0; j<start_item; j++)
+                               {
+                                       item_pnt = item->forward_link;
+                                       item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * item_pnt);
+                               }
+                       }
+
+                       pdata_item = (void *)((BYTE *)pdata_list + (i * ls->user_info_bytes));
+               }
+               else
+               {
+                       item_pnt = item->forward_link;
+                       item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * item_pnt);
+
+                       pdata_item = (void *)((BYTE *)pdata_item + ls->user_info_bytes);
+               }
+
+               /* Set the value of the item's user data.*/
+               OctApiLlmMemCpy(item->user_info, pdata_item, ls->user_info_bytes);
+       }
+
+       /* Write new cache entry.*/
+       lh->cache_item_pointer = item_pnt;
+       lh->cache_item_number = start_item + data_length - 1;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlmListCopyData.
+|
+|      Description:    This function takes a start entry (0 to length - 1),
+|                                      a pointer to a list of data (each item of list is the
+|                                      size of one data unit, specified at init), and the
+|                                      length of the data list.  From this, the data will be
+|                                      copied from the linked list to the data list, from
+|                                      entry start_entry of the linked list to
+|                                      (start_entry + data_length - 1).
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlmListCopyData
+UINT32 OctApiLlmListCopyData(void* l, UINT32 list_handle, UINT32 start_item, UINT32 data_length, void* pdata_list)
+{
+       LLM_LIST* ls;
+       LLM_LIST_HEAD* lh;
+       LLM_LIST_ITEM* item = NULL;
+       UINT32 item_pnt = 0xFFFFFFFF;
+       UINT32 total_lists;
+       UINT32 i, j;
+       BYTE* lsbyte;
+       void* pdata_item = NULL;
+
+
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+       /* Build the structure based on the base address:*/
+       ls = (LLM_LIST *)l;
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)));
+       ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size);
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+
+
+
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+       /* Make sure list handle is valid.*/
+       if (list_handle >= ls->total_lists)
+               return(OCTAPI_LLM_INVALID_LIST_HANDLE);
+       lh = &ls->lh[list_handle];
+       if (lh->list_length == 0xFFFFFFFF)
+               return(OCTAPI_LLM_INVALID_LIST_HANDLE);
+
+       /* Make sure the start_entry is within limits.*/
+       if (start_item >= lh->list_length)
+               return(OCTAPI_LLM_INVALID_PARAMETER);
+
+       /* Make sure the end_entry is within limits.*/
+       lh = &ls->lh[list_handle];
+       if ((start_item + data_length) > lh->list_length)
+               return(OCTAPI_LLM_INVALID_PARAMETER);
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+
+
+
+       /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
+       /* Set the data of each node.*/
+       for (i=0; i<data_length; i++)
+       {
+               /* Obtain pointer to current item.*/
+               if (i == 0)     
+               {
+                       /* Check if location of start item is already cached.  If not, must search
+                               for it manually.*/
+                       if (start_item == (lh->cache_item_number + 1))
+                       {
+                               item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * lh->cache_item_pointer);
+                               item_pnt = item->forward_link;
+                               item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * item_pnt);
+                       }
+                       else
+                       {
+                               item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * lh->head_pointer);
+                               for (j=0; j<start_item; j++)
+                               {
+                                       item_pnt = item->forward_link;
+                                       item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * item_pnt);
+                               }
+                       }
+
+                       pdata_item = (void *)((BYTE *)pdata_list + (i * ls->user_info_bytes));
+               }
+               else
+               {
+                       item_pnt = item->forward_link;
+                       item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * item_pnt);
+
+                       pdata_item = (void *)((BYTE *)pdata_item + ls->user_info_bytes);
+               }
+
+               /* Set the value of the item's user data.*/
+               OctApiLlmMemCpy(pdata_item, item->user_info, ls->user_info_bytes);
+       }
+
+       /* Write new cache entry.*/
+       lh->cache_item_pointer = item_pnt;
+       lh->cache_item_number = start_item + data_length - 1;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlmListRemoveItem.
+|
+|      Description:    This function deallocates a node of the linked list specified
+|                                      by the handle list_handle.  
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM_LIST structure.
+|      list_handle                     UINT32                  The handle to the list.
+|      item_number                     UINT32                  The number of the item to be removed.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlmListRemoveItem
+UINT32 OctApiLlmListRemoveItem(void * l,UINT32 list_handle,UINT32 item_number)
+{
+       LLM_LIST* ls;
+       LLM_LIST_ITEM* freed_item = NULL;
+       LLM_LIST_HEAD* lh;
+       UINT32 freed_item_pnt = 0xFFFFFFFF;
+       UINT32 total_lists;
+       BYTE* lsbyte;
+       UINT32  fConditionFlag = TRUE;
+
+       /* Built the structure based on the base address:*/
+       ls = (LLM_LIST *)l;
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)));
+       ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size);
+
+       lh = &ls->lh[list_handle];
+       
+       if (list_handle >= ls->total_lists) return(OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE);
+       if (lh->list_length == 0xFFFFFFFF) return(OCTAPI_LLM_INVALID_LIST_HANDLE);
+       if (lh->list_length <= item_number)     return(OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE);
+
+       if (item_number == 0 && lh->list_length == 1)/* First item and only item:*/
+       {
+               freed_item_pnt = lh->head_pointer;
+               freed_item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * freed_item_pnt);
+
+               lh->head_pointer = 0xFFFFFFFF;
+               lh->tail_pointer = 0xFFFFFFFF;
+
+               lh->cache_item_number = 0xFFFFFFFF;
+               lh->cache_item_pointer = 0xFFFFFFFF;
+       }
+       else if (item_number == 0)      /* First item and but list not empty:*/
+       {
+               freed_item_pnt = ls->lh[list_handle].head_pointer;
+               freed_item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * freed_item_pnt);
+
+               lh->head_pointer = freed_item->forward_link;
+
+               lh->cache_item_number = 0;
+               lh->cache_item_pointer = freed_item->forward_link;
+       }
+       else    /* Discard non-first item! (Caution: this could be the last item!)*/
+       {
+               LLM_LIST_ITEM * last_item = NULL;
+               LLM_LIST_ITEM * item;
+               UINT32 last_list_pnt;
+               UINT32 cur_list_pnt;
+               UINT32 cur_list_num;
+
+               if (lh->cache_item_number < item_number)        /* Start at cache:*/
+               {
+                       cur_list_pnt = lh->cache_item_pointer;
+                       cur_list_num = lh->cache_item_number;
+               }
+               else /* Start at beginning:*/
+               {
+                       cur_list_pnt = lh->head_pointer;
+                       cur_list_num = 0;
+               }
+
+               last_list_pnt = 0xFFFFFFFF;
+
+               /* Start search from cur_list_pnt and cur_list_num.*/
+               while( fConditionFlag == TRUE )
+               {
+                       item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * cur_list_pnt);
+
+                       if (cur_list_num == item_number) /* Item number found.*/
+                       {
+                               if (last_list_pnt == 0xFFFFFFFF) return(OCTAPI_LLM_INTERNAL_ERROR1);
+
+                               if ((item_number + 1) == lh->list_length)
+                               {
+                                       lh->tail_pointer = last_list_pnt;
+                                       last_item->forward_link = 0xFFFFFFFF;
+                               }
+                               else
+                               {
+                                       last_item->forward_link = item->forward_link;
+                               }
+                               freed_item_pnt = cur_list_pnt;
+                               freed_item = item;
+
+                               /* Reset cache entry.*/
+                               lh->cache_item_pointer = last_list_pnt;
+                               lh->cache_item_number = cur_list_num - 1;
+
+                               fConditionFlag = FALSE;
+                               break;
+                       }
+                       else if (item->forward_link == 0xFFFFFFFF) /* End of list found?!?*/
+                       {
+                               return(OCTAPI_LLM_INTERNAL_ERROR0);
+                       }
+                       else /* Item was not found, but continue searching.*/
+                       {
+                               last_item = item;
+                               last_list_pnt = cur_list_pnt;
+                               cur_list_pnt = item->forward_link;
+                       }
+
+                       cur_list_num++;
+               }
+       }
+
+       /* Decrease the list length.*/
+       lh->list_length--;
+       ls->assigned_items--;
+
+       /* Return free block to free block list:*/
+       freed_item->forward_link = ls->next_empty_item;
+       ls->next_empty_item = freed_item_pnt;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/**************************************** llm2 function section *****************************************/
+
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlm2ListGetSize
+|
+|      Description:    This function determines the amount of memory needed by
+|                                      the LLM2_LIST structure to manage the allocation of
+|                                      number_of_items number of resources.  The memory is
+|                                      measured in bytes.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      number_of_items         UINT32                  The number of resources to be allocated
+|                                                                              amongst all linked-lists.
+|      number_of_lists         UINT32                  The maximum number of linked-lists that
+|                                                                              can be allocated.
+|      *l_size UINT32          UINT32                  The amount of memory needed, returned.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlm2ListGetSize
+UINT32 OctApiLlm2ListGetSize(UINT32 number_of_items,UINT32 number_of_lists,UINT32 user_info_size,UINT32 * l_size)
+{
+       UINT32 head_alloc_size;
+       UINT32 result;
+       UINT32 user_info_size_roundup;
+
+       if (number_of_items == 0) return(GENERIC_BAD_PARAM);
+       if (number_of_lists == 0) return(GENERIC_BAD_PARAM);
+       if (user_info_size == 0) return(GENERIC_BAD_PARAM);
+
+       user_info_size_roundup = ((user_info_size + 3) / 4) * 4;
+
+       result = OctapiLlmAllocGetSize(number_of_lists,&head_alloc_size);
+       if(result != GENERIC_OK) return(result);
+
+       *l_size = sizeof(LLM2_LIST) + (number_of_lists * sizeof(LLM2_LIST_HEAD)) + head_alloc_size + (number_of_items * (sizeof(LLM2_LIST_ITEM) + user_info_size_roundup - 4));
+
+       return(GENERIC_OK);
+}
+#endif
+
+#if !SKIP_OctApiLlm2ListGetItemPointer
+LLM2_LIST_ITEM * OctApiLlm2ListGetItemPointer(LLM2_LIST * ls, UINT32 item_number)
+{
+       return (LLM2_LIST_ITEM *) (((BYTE *)ls->li) + (ls->item_size * item_number)) ;
+}
+#endif
+
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlm2ListInit.
+|
+|      Description:    This function intializes the LLM2_TALLOC structure.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM2_LIST structure.
+|      number_of_items         UINT32                  The number of resources to be allocated
+|                                                                              amongst all linked-lists.
+|      number_of_lists         UINT32                  The maximum number of linked-lists that
+|                                                                              can be allocated.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlm2ListInit
+UINT32 OctApiLlm2ListInit(void ** l,UINT32 number_of_items,UINT32 number_of_lists,UINT32 user_info_size)
+{
+       LLM2_LIST* ls;
+       LLM2_LIST_ITEM* item;
+       UINT32 i;
+       UINT32 head_alloc_size;
+       UINT32 result;
+       UINT32 user_info_size_roundup;
+       UINT32 total_lists;
+       BYTE* lsbyte;
+
+
+       if (number_of_items == 0) return(GENERIC_BAD_PARAM);
+       if (number_of_lists == 0) return(GENERIC_BAD_PARAM);
+       if (user_info_size == 0) return(GENERIC_BAD_PARAM);
+
+       user_info_size_roundup = ((user_info_size + 3) / 4) * 4;
+
+       /* Get the size of the Alloc structure used to manage head of list structures.*/
+       result = OctapiLlmAllocGetSize(number_of_lists,&head_alloc_size);
+       if(result != GENERIC_OK) return(result);
+
+       if (*l == NULL) return(OCTAPI_LLM_MEMORY_NOT_ALLOCATED);
+
+       /* Built the structure based on the base address:*/
+       ls = (LLM2_LIST *)(*l);
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM2_LIST_HEAD *)(lsbyte + sizeof(LLM2_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)));
+       ls->li = (LLM2_LIST_ITEM *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)) + ls->head_alloc_size);
+
+       /* Initialize parameters in the structure.*/
+       ls->head_alloc_size = head_alloc_size;
+       ls->user_info_bytes = user_info_size;
+       ls->user_info_size = user_info_size_roundup;
+       ls->total_items = number_of_items;
+       ls->assigned_items = 0;
+       ls->total_lists = number_of_lists;
+       ls->assigned_lists = 0;
+       ls->next_empty_item = 0;
+       ls->item_size = sizeof(LLM2_LIST_ITEM) + user_info_size_roundup - 4;
+
+       /* Complete the build!*/
+       ls = (LLM2_LIST *)(*l);
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM2_LIST_HEAD *)(lsbyte + sizeof(LLM2_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)));
+       ls->li = (LLM2_LIST_ITEM *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)) + ls->head_alloc_size);
+
+       /* Initialize the head of queue Alloc structure.*/
+       result = OctapiLlmAllocInit(&(ls->list_head_alloc),number_of_lists);
+       if(result != GENERIC_OK) return(result);
+
+       /* Initialize the linked list of the items:*/
+       for(i=0; i<number_of_items; i++)
+       {
+               item = (LLM2_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * i);
+
+               if (i == (number_of_items - 1))
+                       item->forward_link = 0xFFFFFFFF;
+               else
+                       item->forward_link = i + 1;
+       }
+
+       return(GENERIC_OK);
+}
+#endif
+
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlm2ListCreate.
+|
+|      Description:    This function creates a linked list.  The target which is
+|                                      allocated the newly created list can request additions
+|                                      or removals from the list later on.  To target identifies
+|                                      its list with the returned list handle.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM_LIST structure.
+|      *list_handle            UINT32                  The handle to the new list, returned.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlm2ListCreate
+UINT32 OctApiLlm2ListCreate(void * l,UINT32 * list_handle)
+{
+       LLM2_LIST* ls;
+       LLM2_LIST_HEAD* lh;
+       UINT32 blocknum;
+       UINT32 total_lists;
+       UINT32 result;
+       BYTE* lsbyte;
+
+       /* Built the structure based on the base address:*/
+       ls = (LLM2_LIST *)l;
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM2_LIST_HEAD *)(lsbyte + sizeof(LLM2_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)));
+       ls->li = (LLM2_LIST_ITEM *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)) + ls->head_alloc_size);
+
+       /* Get a list using the list head alloc structure.*/
+       result = OctapiLlmAllocAlloc(ls->list_head_alloc, &blocknum);
+       if (result != GENERIC_OK) return(result);
+
+       /* The handle is the block number.*/
+       *list_handle = blocknum;
+
+       /* Initialize the list head structure.*/
+       lh = &ls->lh[blocknum];
+       lh->list_length = 0;
+       lh->head_pointer = 0xFFFFFFFF;
+       lh->tail_pointer = 0xFFFFFFFF;
+
+       ls->assigned_lists++;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlmListDelete.
+|
+|      Description:    This function deletes the linked list indicated by the
+|                                      handle list_handle.  Any items which are still allocated
+|                                      to the list are first deallocated.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM2_LIST structure.
+|      *list_handle            UINT32                  The handle to the list.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlm2ListDelete
+UINT32 OctApiLlm2ListDelete(void * l,UINT32 list_handle)
+{
+       LLM2_LIST* ls;
+       LLM2_LIST_HEAD* lh;
+       UINT32 total_lists;
+       UINT32 result;
+       BYTE* lsbyte;
+
+       /* Built the structure based on the base address:*/
+       ls = (LLM2_LIST *)l;
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM2_LIST_HEAD *)(lsbyte + sizeof(LLM2_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)));
+       ls->li = (LLM2_LIST_ITEM *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)) + ls->head_alloc_size);
+
+       
+       if (list_handle >= ls->total_lists) return(OCTAPI_LLM2_BLOCKNUM_OUT_OF_RANGE);
+       if (ls->lh[list_handle].list_length == 0xFFFFFFFF) return(OCTAPI_LLM2_INVALID_LIST_HANDLE);
+
+       /* Release internal list header handle...*/
+       result = OctapiLlmAllocDealloc(ls->list_head_alloc,list_handle);
+       if (result != GENERIC_OK) return(result);
+
+       lh = &ls->lh[list_handle];
+
+       /* Deallocate all items in the list!*/
+       if (lh->list_length != 0)
+       {
+               LLM2_LIST_ITEM * item;
+
+               item = (LLM2_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * lh->tail_pointer);
+
+               /* Release the items using only the links.*/
+               item->forward_link = ls->next_empty_item;
+               ls->next_empty_item = lh->head_pointer;
+
+               /* Remove items from item counter.*/
+               ls->assigned_items -= lh->list_length;
+       }
+
+       lh->list_length = 0xFFFFFFFF;
+       lh->head_pointer = 0xFFFFFFFF;
+       lh->tail_pointer = 0xFFFFFFFF;
+
+       ls->assigned_lists--;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlmListLength.
+|
+|      Description:    This function returns the number of items allocated to the
+|                                      list indicated by the handle list_handle.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM2_LIST structure.
+|      list_handle                     UINT32                  The handle to the list.
+|      *number_of_items        UINT32                  The number of items in the list, returned.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlm2ListLength
+UINT32 OctApiLlm2ListLength(void * l,UINT32 list_handle, UINT32 * number_of_items_in_list)
+{
+       LLM2_LIST* ls;
+       LLM2_LIST_HEAD* lh;
+       UINT32 total_lists;
+       BYTE* lsbyte;
+
+       /* Built the structure based on the base address:*/
+       ls = (LLM2_LIST *)l;
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM2_LIST_HEAD *)(lsbyte + sizeof(LLM2_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)));
+       ls->li = (LLM2_LIST_ITEM *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)) + ls->head_alloc_size);
+
+       lh = &ls->lh[list_handle];
+       
+       if (list_handle >= ls->total_lists) return(OCTAPI_LLM2_BLOCKNUM_OUT_OF_RANGE);
+       if (lh->list_length == 0xFFFFFFFF) return(OCTAPI_LLM2_INVALID_LIST_HANDLE);
+
+       *number_of_items_in_list = lh->list_length;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlm2ListItemData
+|
+|      Description:    This function returns a pointer to the user data associated
+|                                      with an item.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM2_LIST structure.
+|      list_handle                     UINT32                  The handle to the list.
+|      item_number                     UINT32                  The number of the list node in question.
+|      **item_data_pnt         void                    The pointer to the user data, returned.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlm2ListItemData
+UINT32 OctApiLlm2ListItemData(void * l,UINT32 list_handle,UINT32 item_key,void ** item_data_pnt, PUINT32 item_number_pnt)
+{
+       LLM2_LIST* ls;
+       LLM2_LIST_HEAD* lh;
+       LLM2_LIST_ITEM* item;
+       UINT32 cur_list_pnt;
+       UINT32 cur_list_key = 0xFFFFFFFF;
+       UINT32 total_lists;
+       UINT32 list_length;
+       BYTE* lsbyte;
+       UINT32  fConditionFlag = TRUE;
+
+       /* Built the structure based on the base address:*/
+       ls = (LLM2_LIST *)l;
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM2_LIST_HEAD *)(lsbyte + sizeof(LLM2_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)));
+       ls->li = (LLM2_LIST_ITEM *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)) + ls->head_alloc_size);
+
+       lh = &ls->lh[list_handle];
+       list_length = lh->list_length;
+       
+       *item_data_pnt = NULL;
+       *item_number_pnt = 0;
+       if (list_handle >= ls->total_lists) return(OCTAPI_LLM2_BLOCKNUM_OUT_OF_RANGE);
+       if (list_length == 0xFFFFFFFF) return(OCTAPI_LLM2_INVALID_LIST_HANDLE);
+
+       /* Determine where the search will start.*/
+       /* Start at beginning:*/
+       cur_list_pnt = lh->head_pointer;
+       item = (LLM2_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * cur_list_pnt);
+       cur_list_key = item->key;
+       
+       /* Start search from cur_list_pnt and cur_list_num.*/
+       while ( fConditionFlag == TRUE )
+       {
+               if (cur_list_key == item_key) /* Item key found.*/
+               {
+                       /* Get item info.*/
+                       *item_data_pnt = (void *)item->user_info;
+
+                       return(GENERIC_OK);
+               }
+               else if(item->forward_link == 0xFFFFFFFF) /* End of list found?!?*/
+               {
+                       return(OCTAPI_LLM2_INTERNAL_ERROR0);
+               }
+               else /* Item was not found, but continue searching.*/
+               {
+                       cur_list_pnt = item->forward_link;
+               }
+
+               item = (LLM2_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * cur_list_pnt);
+               cur_list_key = item->key;
+               (*item_number_pnt)++;
+       }
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlm2ListInsertItem.
+|
+|      Description:    This function allocates a node to the linked list specified
+|                                      by the handle list_handle.  The position of the new item
+|                                      will be defined based on the key value.  All entry are inserted
+|                                      in the list in incremental Key value.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM2_LIST structure.
+|      *list_handle            UINT32                  The handle to the list.
+|      **item_data                     void                    Address of the user data space for this item.
+|      **prev_item_data        void                    Address of the user data space for the previous item.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlm2ListInsertItem
+UINT32 OctApiLlm2ListInsertItem(void * l,UINT32 list_handle,UINT32 item_key,void ** item_data_pnt, void ** prev_item_data_pnt, void ** prev_prev_item_data_pnt, PUINT32 insert_status_pnt )
+{
+       LLM2_LIST* ls;
+       LLM2_LIST_HEAD* lh;
+       LLM2_LIST_ITEM* free_item;
+       UINT32 free_item_pnt;
+       UINT32 total_lists;
+       BYTE* lsbyte;
+       UINT32  ulPassCount = 0;
+       UINT32  fConditionFlag = TRUE;
+
+       /* Set the status of the insertion.*/
+       *insert_status_pnt = OCTAPI_LLM2_INSERT_ERROR;
+
+       /* Built the structure based on the base address:*/
+       ls = (LLM2_LIST *)l;
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       ls->lh = (LLM2_LIST_HEAD *)(lsbyte + sizeof(LLM2_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)));
+       ls->li = (LLM2_LIST_ITEM *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)) + ls->head_alloc_size);
+
+       lh = &ls->lh[list_handle];
+       
+       *item_data_pnt = NULL;
+       if (list_handle >= ls->total_lists) return(OCTAPI_LLM2_BLOCKNUM_OUT_OF_RANGE);
+       if (lh->list_length == 0xFFFFFFFF) return(OCTAPI_LLM2_INVALID_LIST_HANDLE);
+       if (ls->next_empty_item == 0xFFFFFFFF) return(OCTAPI_LLM2_NO_STRUCTURES_LEFT);
+
+       /* Get a free item from the free item list!*/
+       free_item_pnt = ls->next_empty_item;
+       free_item = (LLM2_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * free_item_pnt);
+       free_item->key = item_key;
+       ls->next_empty_item = free_item->forward_link;
+
+       if (lh->list_length == 0)       /* First item and only item:*/
+       {
+               free_item->forward_link = 0xFFFFFFFF;
+               lh->tail_pointer = free_item_pnt;
+               lh->head_pointer = free_item_pnt;
+               *insert_status_pnt = OCTAPI_LLM2_INSERT_FIRST_NODE;
+
+               /* There is no previous node information to return.*/
+               *prev_item_data_pnt = NULL;
+               *prev_prev_item_data_pnt = NULL;
+       }
+       else    /* Insert:*/
+       {
+               LLM2_LIST_ITEM * last_last_item = NULL;
+               LLM2_LIST_ITEM * last_item = NULL;
+               LLM2_LIST_ITEM * item;
+               UINT32 last_list_pnt;
+               UINT32 cur_list_pnt;
+               UINT32 cur_list_key = 0xFFFFFFFF;
+
+               /* Start at beginning:*/
+               cur_list_pnt = lh->head_pointer;
+               item = (LLM2_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * cur_list_pnt);
+               cur_list_key = item->key;
+               
+               last_list_pnt = 0xFFFFFFFF;
+
+               /* Start search from cur_list_pnt and cur_list_num.*/
+               while ( fConditionFlag == TRUE )
+               {
+                       /* Increment the pass count to determine if the addition will happen next to last.*/
+                       ulPassCount++;
+       
+                       if (cur_list_key >= item_key) /* Item new node between the last and the curent. */
+                       {
+                               if (last_list_pnt == 0xFFFFFFFF) /* Must insert at the head of the list.*/
+                               {
+                                       free_item->forward_link = cur_list_pnt;
+                                       lh->head_pointer = free_item_pnt;
+                               }
+                               else                                                                    /* Standard insertion.*/
+                               {
+                                       free_item->forward_link = cur_list_pnt;
+                                       last_item->forward_link = free_item_pnt;
+                               }
+                       
+                               /* Check if the entry was made before the last one.*/
+                               if ( ulPassCount == lh->list_length )
+                                       *insert_status_pnt = OCTAPI_LLM2_INSERT_BEFORE_LAST_NODE;
+                               else
+                                       *insert_status_pnt = OCTAPI_LLM2_INSERT_LIST_NODE;
+
+                               fConditionFlag = FALSE;
+                               break;
+                       }
+                       else if (item->forward_link == 0xFFFFFFFF) /* End of list found, must insert at the end.*/
+                       {
+                               free_item->forward_link = 0xFFFFFFFF;
+                               item->forward_link = free_item_pnt;
+                               lh->tail_pointer = free_item_pnt;
+
+                               *insert_status_pnt = OCTAPI_LLM2_INSERT_LAST_NODE;
+
+                               fConditionFlag = FALSE;
+                               break;
+                       }
+                       else /* Item was not found, but continue searching.*/
+                       {
+                               last_last_item = last_item;
+                               last_item = item;
+                               last_list_pnt = cur_list_pnt;
+                               cur_list_pnt = item->forward_link;
+                       }
+
+                       item = (LLM2_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * cur_list_pnt);
+                       cur_list_key = item->key;
+
+               }
+
+               /* Return the previous node if possible.*/
+               if ( *insert_status_pnt == OCTAPI_LLM2_INSERT_LIST_NODE ||
+                    *insert_status_pnt == OCTAPI_LLM2_INSERT_BEFORE_LAST_NODE )
+               {
+                       if ( last_item != NULL )
+                               *prev_item_data_pnt = (void *)last_item->user_info;
+
+                       if ( last_last_item != NULL )
+                               *prev_prev_item_data_pnt = (void *)last_last_item->user_info;
+                       else
+                               *prev_prev_item_data_pnt = NULL;
+               }
+               else
+               {
+                       *prev_item_data_pnt = (void *)item->user_info;
+
+                       if ( ( last_last_item != NULL ) && ( last_item != NULL ) )
+                               *prev_prev_item_data_pnt = (void *)last_item->user_info;
+                       else
+                               *prev_prev_item_data_pnt = NULL;
+               }
+       }
+
+       /* Increase the list length.*/
+       lh->list_length++;
+       ls->assigned_items++;
+       *item_data_pnt = (void *)free_item->user_info;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlm2ListRemoveItem.
+|
+|      Description:    This function deallocates a node of the linked list specified
+|                                      by the handle list_handle.  
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *l                                      void                    The memory used by the LLM2_LIST structure.
+|      list_handle                     UINT32                  The handle to the list.
+|      item_key                        UINT32                  The key of the item to be removed.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlm2ListRemoveItem
+UINT32 OctApiLlm2ListRemoveItem(void * l,UINT32 list_handle,UINT32 item_key, PUINT32 prev_item_key_pnt, PUINT32 prev_prev_item_key_pnt, PUINT32 remove_status_pnt )
+{
+       LLM2_LIST* ls;
+       LLM2_LIST_ITEM* freed_item = NULL;
+       LLM2_LIST_HEAD* lh;
+       UINT32 freed_item_pnt = 0xFFFFFFFF;
+       UINT32 total_lists;
+       BYTE* lsbyte;
+       UINT32  fConditionFlag = TRUE;
+       UINT32  ulPassCount = 0;
+
+       /* Built the structure based on the base address:*/
+       ls = (LLM2_LIST *)l;
+       lsbyte = (BYTE *)ls;
+       total_lists = ls->total_lists;
+
+       /* Set the status of the removal to error as a default value.*/
+       *remove_status_pnt = OCTAPI_LLM2_REMOVE_ERROR;
+       
+       ls->lh = (LLM2_LIST_HEAD *)(lsbyte + sizeof(LLM2_LIST));
+       ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)));
+       ls->li = (LLM2_LIST_ITEM *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)) + ls->head_alloc_size);
+
+       lh = &ls->lh[list_handle];
+       
+       if (list_handle >= ls->total_lists) return(OCTAPI_LLM2_BLOCKNUM_OUT_OF_RANGE);
+       if (lh->list_length == 0xFFFFFFFF) return(OCTAPI_LLM2_INVALID_LIST_HANDLE);
+
+       if (lh->list_length == 1)/* First item and only item if he matches.*/
+       {
+               freed_item_pnt = lh->head_pointer;
+               freed_item = (LLM2_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * freed_item_pnt);
+
+               if ( freed_item->key == item_key )
+               {
+                       lh->head_pointer = 0xFFFFFFFF;
+                       lh->tail_pointer = 0xFFFFFFFF;
+               }
+               else
+                       return(OCTAPI_LLM2_INTERNAL_ERROR1);
+               
+               /* Indicate that there was no node prior to the one removed.*/
+               *prev_item_key_pnt = 0xFFFFFFFF;
+               *prev_prev_item_key_pnt = 0xFFFFFFFF;
+               *remove_status_pnt = OCTAPI_LLM2_REMOVE_FIRST_NODE;
+       }
+       else    /* Discard non-first item! (Caution: this could be the last item!)*/
+       {
+               LLM2_LIST_ITEM * last_last_item = NULL;
+               LLM2_LIST_ITEM * last_item = NULL;
+               LLM2_LIST_ITEM * item;
+               UINT32 last_list_pnt;
+               UINT32 cur_list_pnt;
+               UINT32 cur_list_key;
+
+               /* Start at beginning:*/
+               cur_list_pnt = lh->head_pointer;
+               item = (LLM2_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * cur_list_pnt);
+               cur_list_key = item->key;
+               
+               last_list_pnt = 0xFFFFFFFF;
+
+               /* Start search from cur_list_pnt and cur_list_num.*/
+               while( fConditionFlag == TRUE )
+               {
+                       ulPassCount++;
+                       if (cur_list_key == item_key) /* Item number found.*/
+                       {
+                               if (last_list_pnt == 0xFFFFFFFF)        /* First item in the list.*/
+                               {
+                                       lh->head_pointer = item->forward_link;
+                                       *remove_status_pnt = OCTAPI_LLM2_REMOVE_FIRST_NODE;
+                               }
+                               else if ( item->forward_link == 0xFFFFFFFF)     /* Last item of the list.*/
+                               {
+                                       last_item->forward_link = 0xFFFFFFFF;
+                                       lh->tail_pointer = last_list_pnt;
+                                       *remove_status_pnt = OCTAPI_LLM2_REMOVE_LAST_NODE;
+                               }
+                               else
+                               {
+                                       last_item->forward_link = item->forward_link;
+
+                                       if ( ulPassCount == ( lh->list_length - 1 ) )
+                                               *remove_status_pnt = OCTAPI_LLM2_REMOVE_BEFORE_LAST_NODE;
+                                       else
+                                               *remove_status_pnt = OCTAPI_LLM2_REMOVE_LIST_NODE;
+                               }
+                                       
+                               freed_item_pnt = cur_list_pnt;
+                               freed_item = item;
+
+                               fConditionFlag = FALSE;
+                               break;
+                       }
+                       else if (item->forward_link == 0xFFFFFFFF) /* End of list found?!?*/
+                       {
+                               return(OCTAPI_LLM2_INTERNAL_ERROR0);
+                       }
+                       else /* Item was not found, but continue searching.*/
+                       {
+                               last_last_item = last_item;
+                               last_item = item;
+                               last_list_pnt = cur_list_pnt;
+                               cur_list_pnt = item->forward_link;
+                       }
+
+                       item = (LLM2_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * cur_list_pnt);
+                       cur_list_key = item->key;
+               }
+
+               /* Return the key of the node before the node removed if possible.*/
+               if ( last_list_pnt == 0xFFFFFFFF )
+                       *prev_item_key_pnt = 0xFFFFFFFF;
+               else if ( last_item != NULL )
+                       *prev_item_key_pnt = last_item->key;
+
+               /* Return the key of the node before before the node removed if possible.*/
+               if ( last_last_item == NULL )
+                       *prev_prev_item_key_pnt = 0xFFFFFFFF;
+               else
+                       *prev_prev_item_key_pnt = last_last_item->key;
+
+       }
+
+       /* Decrease the list length.*/
+       lh->list_length--;
+       ls->assigned_items--;
+
+       /* Return free block to free block list:*/
+       freed_item->forward_link = ls->next_empty_item;
+       ls->next_empty_item = freed_item_pnt;
+
+       return(GENERIC_OK);
+}
+#endif
+
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+|      API UTILITIES
+|
+|      Function:               OctApiLlmMemCpy.
+|
+|      Description:    This function copies data from a source to a destination.
+|
+|  -----------------------------------------------------------------------  
+|  |   Variable        |     Type     |          Description                
+|  -----------------------------------------------------------------------  
+|      *f_pvDestination        VOID                    The destination where to copy the data.
+|      *f_pvSource                     VOID                    The source where to copy the data from.
+|      f_ulSize                        UINT32                  The number of bytes to copy.
+|
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#if !SKIP_OctApiLlmMemCpy
+VOID * OctApiLlmMemCpy( VOID *f_pvDestination, const VOID * f_pvSource, UINT32 f_ulSize )
+{
+    CHAR * pbyDst;
+    const CHAR * pbySrc;
+    UINT32 * f_pulAlignedDst;
+    const UINT32 * f_pulAlignedSrc;
+    
+    pbyDst = (CHAR *)f_pvDestination;
+    pbySrc = (const CHAR *)f_pvSource;
+
+    /* 
+     * If the size is small, or either SRC or DST is unaligned,
+     * then punt into the byte copy loop.  This should be rare.
+     */
+    if ( ( f_ulSize < sizeof(UINT32) ) 
+               || ( ( (unsigned long)( pbySrc ) & ( sizeof(UINT32) - 1 ) ) | ( (unsigned long)( pbyDst ) & ( sizeof(UINT32) - 1 ) ) ) )
+    {
+        while ( f_ulSize-- )
+            *pbyDst++ = *pbySrc++;
+        return f_pvDestination;
+    }
+    
+    f_pulAlignedDst = (UINT32 *)pbyDst;
+    f_pulAlignedSrc = (const UINT32 *)pbySrc;
+    
+    /* Copy 4X long words at a time if possible. */
+    while ( f_ulSize >= 4 * sizeof(UINT32) )
+    {
+        *f_pulAlignedDst++ = *f_pulAlignedSrc++;
+        *f_pulAlignedDst++ = *f_pulAlignedSrc++;
+        *f_pulAlignedDst++ = *f_pulAlignedSrc++;
+        *f_pulAlignedDst++ = *f_pulAlignedSrc++;
+        f_ulSize -= 4 * sizeof(UINT32);
+    } 
+    
+    /* Copy one long word at a time if possible. */
+    while ( f_ulSize >= sizeof(UINT32) )
+    {
+        *f_pulAlignedDst++ = *f_pulAlignedSrc++;
+        f_ulSize -= sizeof(UINT32);
+    }
+    
+    /* Pick up any residual with a byte copier. */
+    pbyDst = (CHAR *)f_pulAlignedDst;
+    pbySrc = (const CHAR *)f_pulAlignedSrc;
+    while ( f_ulSize-- )
+        *pbyDst++ = *pbySrc++;
+    
+    return f_pvDestination;
+}
+#endif
+
+/**************************************** llm_list section **********************************************/
+
diff --git a/xpp/oct612x/apilib/llman/octapi_llman_private.h b/xpp/oct612x/apilib/llman/octapi_llman_private.h
new file mode 100644 (file)
index 0000000..14a053d
--- /dev/null
@@ -0,0 +1,206 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+
+File:          octapi_llman_private.h
+
+Copyright (c) 2001 Octasic Inc. All rights reserved.
+    
+Description: 
+
+       Library used to manage allocation tables and linked lists.  The library is
+       made such that only a block of contiguous memory is needed for the
+       management of the linked list/allocation table.
+       
+
+This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API  is 
+free software; you can redistribute it and/or modify it under the terms of 
+the GNU General Public License as published by the Free Software Foundation; 
+either version 2 of the License, or (at your option) any later version.
+
+The OCT6100 GPL API is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
+for more details. 
+
+You should have received a copy of the GNU General Public License 
+along with the OCT6100 GPL API; if not, write to the Free Software 
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+$Octasic_Release: OCT612xAPI-01.00-PR49 $
+
+$Octasic_Revision: 13 $
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#ifndef __OCTAPI_LLMAN_PRIVATE_H__
+#define __OCTAPI_LLMAN_PRIVATE_H__
+
+#include "octdef.h"
+
+
+/**************************************** llm_alloc section **********************************************/
+
+
+/*     Most basic linked list model.
+       LLM_STR contains a list of "number_of_items" that
+       are each "unassigned" or "assigned". When requesting
+       a new element, llm_alloc must choose an "unassigned"
+       element. An element that is deallocated will be last
+       to be allocated.
+*/
+
+typedef struct _LLM_ALLOC
+{
+       UINT32 *linked_list;    /* Each item is either used (0xFFFFFFFE)*/
+                                                       /* or unused (pointer to next unused item, 0xFFFFFFFF means last item reached).*/
+       UINT32 next_avail_num;  /* Points to the next available item in linked list. (0xFFFFFFFF means none available)*/
+       UINT32 number_of_items; /* Total number of items in linked list.*/
+       UINT32 allocated_items; /* Allocated items in linked list.*/
+
+} LLM_ALLOC;
+
+typedef struct _TLLM_ALLOC_NODE_
+{
+       UINT32 value;           /* Each item is either used (0xFFFFFFFE)*/
+                                               /* or unused (pointer to next unused item, 0xFFFFFFFF means last item reached).*/
+       UINT32 timeout[2];      /* Timeout value that must be exceeded for the node to be considered free again.*/
+
+} TLLM_ALLOC_NODE;
+
+
+typedef struct _TLLM_ALLOC_
+{
+       TLLM_ALLOC_NODE *linked_list;   /* List of nodes used by the link list.*/
+
+       UINT32 next_avail_num;  /* Points to the next available item in linked list. (0xFFFFFFFF means none available)*/
+       UINT32 number_of_items; /* Total number of items in linked list.*/
+       UINT32 allocated_items; /* Allocated items in linked list.*/
+
+       UINT32 number_of_timeout;       /* Number of block currently in timeout.*/
+       UINT32 next_timeout_num;        /* Points to the next block currently in timeout.*/
+       UINT32 last_timeout_num;        /* Last node of the timeout list.*/
+
+       UINT32 last_known_time[2];      /* last known time.*/
+
+} TLLM_ALLOC;
+
+/*
+void octapi_llm_alloc_build_structure(void *l, LLM_ALLOC ** ls);
+*/
+/**************************************** llm_alloc section **********************************************/
+
+
+
+/**************************************** llm_list section **********************************************/
+/*     This section contains memory structures and functions used
+       to maintain a variable number of lists (FIFOs) that each
+       have a variable amount of items. A total amount of items
+       can be assigned through-out all the lists. Each item in
+       each list contains a UINT32 specified by the software using
+       the lists. Each used item in the list is accessible through
+       it's position in the list. */
+
+typedef struct _LLM_LIST_HEAD
+{
+       UINT32 list_length;     /* Current number of items in the list.*/
+                                               /* 0xFFFFFFFF means that the list is not used.*/
+       UINT32 head_pointer;    /* Number of the item in the item pool that is the first of this list.*/
+                                               /* 0xFFFFFFFF indicates end-of-list link.*/
+       UINT32 tail_pointer;    /* Number of the item in the item pool that is the last of this list.*/
+
+       /* Item cache (pointer within the list of the last accessed item):*/
+       UINT32 cache_item_number;       /* Number of the last accessed item in the list. 0xFFFFFFFF indicates invalid cache.*/
+       UINT32 cache_item_pointer;      /* Number of the last accessed item in the item pool.*/
+} LLM_LIST_HEAD;
+
+typedef struct _LLM_LIST_ITEM
+{
+       UINT32 forward_link;    /* Number of the item in the item pool that is next in this list.*/
+                                               /* 0xFFFFFFFF indicates end-of-list link.*/
+
+       /* User item info (variable size)*/
+       UINT32 user_info[1];
+} LLM_LIST_ITEM;
+
+typedef struct _LLM_LIST
+{
+       UINT32 user_info_bytes; /* In bytes, size of the user info in a single item.*/
+       UINT32 user_info_size;  /* In bytes, size of the user info in a single item.*/
+       UINT32 item_size;
+
+       UINT32 head_alloc_size;
+       UINT32 total_items;
+       UINT32 assigned_items;
+
+       UINT32 total_lists;
+       UINT32 assigned_lists;
+
+       UINT32 next_empty_item; /* Contains a pointer to the next empty item in the*/
+                                                       /* item pool.*/
+
+       /* Table of all the possible list heads:*/
+       LLM_LIST_HEAD * lh;
+       void * list_head_alloc; /* LLM_ALLOC structure used for list head allocation!*/
+
+       /* Table of the list items:*/
+       LLM_LIST_ITEM * li;
+} LLM_LIST;
+
+
+/**********************************************************************************/
+/* These structures are are used by the Llm2 functions to creates lists of ordered
+   items based on a key given by the user when a new node is inserted in a list. */
+typedef struct _LLM2_LIST_HEAD
+{
+       UINT32 list_length;     /* Current number of items in the list.*/
+                                               /* 0xFFFFFFFF means that the list is not used.*/
+       UINT32 head_pointer;    /* Number of the item in the item pool that is the first of this list.*/
+                                               /* 0xFFFFFFFF indicates end-of-list link.*/
+       UINT32 tail_pointer;    /* Number of the item in the item pool that is the last of this list.*/
+
+} LLM2_LIST_HEAD;
+
+typedef struct _LLM2_LIST_ITEM
+{
+       UINT32 forward_link;    /* Number of the item in the item pool that is next in this list.*/
+                                               /* 0xFFFFFFFF indicates end-of-list link.*/
+       UINT32 key;                     /* Key used to order the entries.*/
+
+       /* User item info (variable size)*/
+       UINT32 user_info[1];
+} LLM2_LIST_ITEM;
+
+typedef struct _LLM2_LIST
+{
+       UINT32 user_info_bytes; /* In bytes, size of the user info in a single item.*/
+       UINT32 user_info_size;  /* In bytes, size of the user info in a single item.*/
+       UINT32 item_size;
+
+       UINT32 head_alloc_size;
+       UINT32 total_items;
+       UINT32 assigned_items;
+
+       UINT32 total_lists;
+       UINT32 assigned_lists;
+
+       UINT32 next_empty_item; /* Contains a pointer to the next empty item in the*/
+                                                       /* item pool.*/
+
+       /* Table of all the possible list heads:*/
+       LLM2_LIST_HEAD * lh;
+       void * list_head_alloc; /* LLM_ALLOC structure used for list head allocation!*/
+
+       /* Table of the list items:*/
+       LLM2_LIST_ITEM * li;
+} LLM2_LIST;
+
+/*void octapi_llm_list_build_structure(void *l, LLM_LIST ** ls);*/
+LLM_LIST_ITEM * OctApiLlmListGetItemPointer( LLM_LIST * ls, UINT32 item_number );
+LLM2_LIST_ITEM * OctApiLlm2ListGetItemPointer( LLM2_LIST * ls, UINT32 item_number );
+UINT32 OctApiTllmCheckTimeoutList( TLLM_ALLOC *ls, UINT32 current_time[2] );
+VOID * OctApiLlmMemCpy( VOID *f_pvDestination, const VOID * f_pvSource, UINT32 f_ulSize );
+/**************************************** llm_list section **********************************************/
+
+
+
+
+
+#endif /*__OCTAPI_LLMAN_PRIVATE_H__*/
diff --git a/xpp/oct612x/get_discards b/xpp/oct612x/get_discards
new file mode 100755 (executable)
index 0000000..5436118
--- /dev/null
@@ -0,0 +1,51 @@
+#!/usr/bin/php
+
+<?php
+/*
+ * Written by Jared Smith and Kevin P. Fleming
+ *
+ * Copyright (C) 2006, Jared Smith and Digium, Inc.
+ *
+ */
+
+# create an array of all the different prefixes you want to match on,
+# as Perl-compatible regular expressions
+# (yes, this is a stupid example, as the second one is just a simplified
+# version of the first, but it's just an example)
+$prefixes = array('\.text\.Oct');
+
+$fp = fopen('test.map','r');
+
+while (!feof($fp))
+{
+        # Loop until we find the top of section we want
+        while ($line = fgets($fp))
+        {
+                if (preg_match('/Discarded input sections/i',$line))
+                {
+                        break;
+                }
+        }
+
+        # Now loop until we find the next section
+        while ($line = fgets($fp))
+        {
+                if (preg_match('/Memory Configuration/i',$line))
+                {
+                        # we found it!
+                        break;
+                }
+                foreach ($prefixes as $prefix)
+                {
+                        if (preg_match("/$prefix/i",$line))
+                        {
+                               preg_match("/Oct.*/", $line, $matches);
+                                $line2 = fgets($fp);
+                               echo "#define SKIP_".$matches[0]." 1\n";
+                                break;
+                        }
+                }
+        }
+}
+fclose($fp);
+?>
diff --git a/xpp/oct612x/include/apilib/octapi_bt0.h b/xpp/oct612x/include/apilib/octapi_bt0.h
new file mode 100644 (file)
index 0000000..a0f22ca
--- /dev/null
@@ -0,0 +1,75 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+
+File:  octapi_bt0.h
+
+    Copyright (c) 2001-2007 Octasic Inc.
+    
+Description: 
+
+       Library used to manage a binary tree of variable max size.  Library is
+       made to use one block of contiguous memory to manage the tree.
+
+This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API  is 
+free software; you can redistribute it and/or modify it under the terms of 
+the GNU General Public License as published by the Free Software Foundation; 
+either version 2 of the License, or (at your option) any later version.
+
+The OCT6100 GPL API is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
+for more details. 
+
+You should have received a copy of the GNU General Public License 
+along with the OCT6100 GPL API; if not, write to the Free Software 
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+$Octasic_Release: OCT612xAPI-01.00-PR49 $
+
+$Octasic_Revision: 11 $
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#ifndef __OCTAPI_BT0_H__
+#define __OCTAPI_BT0_H__
+
+#include "octdef.h"
+
+#define OCTAPI_BT0_BASE                                                                0xFFFF0000
+#define OCTAPI_BT0_KEY_SIZE_NOT_MUTLIPLE_OF_UINT32     OCTAPI_BT0_BASE+0x0001
+#define OCTAPI_BT0_DATA_SIZE_NOT_MUTLIPLE_OF_UINT32    OCTAPI_BT0_BASE+0x0002
+#define OCTAPI_BT0_MALLOC_FAILED                                       OCTAPI_BT0_BASE+0x0003
+#define OCTAPI_BT0_NO_NODES_AVAILABLE                          OCTAPI_BT0_BASE+0x0004
+#define OCTAPI_BT0_KEY_ALREADY_IN_TREE                         OCTAPI_BT0_BASE+0x0005
+#define OCTAPI_BT0_KEY_NOT_IN_TREE                                     OCTAPI_BT0_BASE+0x0006
+
+/* Possible result for Find Or Add function. */
+#define OCTAPI0_BT0_NODE_FOUND         0
+#define OCTAPI0_BT0_NODE_ADDDED                1
+
+#define OCTAPI_BT0_NO_SMALLER_KEY      0xAAAAAAAA
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define octapi_bt0_get_size( number_of_items, key_size, data_size, b_size ) OctApiBt0GetSize( (UINT32) number_of_items,(UINT32) key_size, (UINT32) data_size, (PUINT32) b_size ) 
+#define octapi_bt0_init( b, number_of_items, key_size, data_size )                     OctApiBt0Init( (void **) b,(UINT32) number_of_items,(UINT32) key_size, (UINT32) data_size )
+#define octapi_bt0_add_node( b, key, data )                                                                    OctApiBt0AddNode( (void *) b,(void *) key,(void **) data )
+#define octapi_bt0_remove_node( b, key )                                                                       OctApiBt0RemoveNode( (void *) b,(void *) key )
+#define octapi_bt0_query_node( b, key, data )                                                          OctApiBt0QueryNode( (void *) b,(void *) key,(void **) data )
+#define octapi_bt0_get_first_node( b, key, data )                                                      OctApiBt0GetFirstNode( (void *) b,(void **) key, (void **) data )
+
+UINT32 OctApiBt0GetSize( UINT32 number_of_items, UINT32 key_size, UINT32 data_size, UINT32 * b_size );
+UINT32 OctApiBt0Init( void ** b, UINT32 number_of_items, UINT32 key_size, UINT32 data_size );
+UINT32 OctApiBt0AddNode( void * b, void * key, void ** data );
+UINT32 OctApiBt0RemoveNode( void * b, void * key );
+UINT32 OctApiBt0QueryNode( void * b, void * key, void ** data );
+UINT32 OctApiBt0GetFirstNode( void * b, void ** key, void ** data );
+UINT32 OctApiBt0FindOrAddNode( void * b, void * key, void ** data, UINT32 *fnct_result );
+
+UINT32 OctApiBt0AddNodeReportPrevNodeData( void * b, void * key, void ** data, void ** prev_data, UINT32 *fnct_result );
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /*__OCTAPI_BT0_H__*/
diff --git a/xpp/oct612x/include/apilib/octapi_largmath.h b/xpp/oct612x/include/apilib/octapi_largmath.h
new file mode 100644 (file)
index 0000000..1680474
--- /dev/null
@@ -0,0 +1,69 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+
+File:  octapi_largmath.h
+
+    Copyright (c) 2001-2007 Octasic Inc.
+    
+Description: 
+
+       Library used to perform arithmetic on integer values of an integer multiple
+       of 32-bits.
+
+This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API  is 
+free software; you can redistribute it and/or modify it under the terms of 
+the GNU General Public License as published by the Free Software Foundation; 
+either version 2 of the License, or (at your option) any later version.
+
+The OCT6100 GPL API is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
+for more details. 
+
+You should have received a copy of the GNU General Public License 
+along with the OCT6100 GPL API; if not, write to the Free Software 
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+$Octasic_Release: OCT612xAPI-01.00-PR49 $
+
+$Octasic_Revision: 6 $
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#ifndef __OCTAPI_LARGMATH_H__
+#define __OCTAPI_LARGMATH_H__
+
+#include "octdef.h"
+
+#define OCTAPI_LM_DIVISION_BY_ZERO             0xFFFF
+#define OCTAPI_LM_OVERFLOW                             0xFFFE
+#define OCTAPI_LM_ARRAY_SIZE_MISMATCH  0xFFFD
+
+#define OCTAPI_LM_MAX_OPTIMIZE_MUL             10
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define octapi_lm_add( a, alen, b, blen, z,  zlen )                                    OctApiLmAdd( (PUINT32) a, (USHORT) alen, (PUINT32) b, (USHORT) blen, (PUINT32) z, (USHORT) zlen )
+#define octapi_lm_subtract( a, alen, bneg, blen, z,  zlen, neg )       OctApiLmSubtract( (PUINT32) a, (USHORT) alen, (PUINT32) bneg, (USHORT) blen, (PUINT32) z, (USHORT) zlen, (USHORT*) neg )
+#define octapi_lm_compare( a, alen, bneg, blen, neg )                          OctApiLmCompare( (PUINT32) a, (USHORT) alen, (PUINT32) bneg, (USHORT) blen, (USHORT*) neg )
+#define octapi_lm_multiply( a, b, ablen, z )                                           OctApiLmMultiply( (PUINT32) a, (PUINT32) b, (USHORT) ablen, (PUINT32) z )
+#define octapi_lm_divide( n, d, q, r, ndqrlen )                                                OctApiLmDivide( (PUINT32) n, (PUINT32) d, (PUINT32) q, (PUINT32) r, (USHORT) ndqrlen )
+#define octapi_lm_shiftright1( a, alen )                                                       OctApiLmShiftRight1( (PUINT32) a, (USHORT) alen )
+#define octapi_lm_shiftn( a, alen, shiftleft, shiftn )                         OctApiLmShiftn( (PUINT32) a, (USHORT) alen, (USHORT) shiftleft, (USHORT) shiftn )
+#define octapi_lm_getmsb( a, alen, msb_pos )                                           OctApiLmGetMsb( (PUINT32) a, (USHORT) alen, (USHORT*) msb_pos )
+       
+
+UINT32 OctApiLmAdd( PUINT32 a, USHORT alen, PUINT32 b, USHORT blen, PUINT32 z, USHORT zlen );
+UINT32 OctApiLmSubtract( PUINT32 a, USHORT alen, PUINT32 bneg, USHORT blen, PUINT32 z, USHORT zlen, PUSHORT neg );
+UINT32 OctApiLmCompare( PUINT32 a, USHORT alen, PUINT32 bneg, USHORT blen, PUSHORT neg );
+UINT32 OctApiLmMultiply( PUINT32 a, PUINT32 b, USHORT ablen, PUINT32 z );
+UINT32 OctApiLmDivide( PUINT32 n, PUINT32 d, PUINT32 q, PUINT32 r, USHORT ndqrlen );
+UINT32 OctApiLmShiftRight1( PUINT32 a, USHORT alen );
+UINT32 OctApiLmShiftn( PUINT32 a, USHORT alen, USHORT shiftleft, USHORT shiftn );
+UINT32 OctApiLmGetMsb( PUINT32 a, USHORT alen, PUSHORT msb_pos );
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __OCTAPI_LARGMATH_H__ */
diff --git a/xpp/oct612x/include/apilib/octapi_llman.h b/xpp/oct612x/include/apilib/octapi_llman.h
new file mode 100644 (file)
index 0000000..b70a851
--- /dev/null
@@ -0,0 +1,142 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+
+File:  octapi_llman.h
+
+    Copyright (c) 2001-2007 Octasic Inc.
+    
+Description:
+
+       Library used to manage allocation tables and linked lists.  The library is
+       made such that only a block of contiguous memory is needed for the
+       management of the linked list/allocation table.
+
+This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API  is 
+free software; you can redistribute it and/or modify it under the terms of 
+the GNU General Public License as published by the Free Software Foundation; 
+either version 2 of the License, or (at your option) any later version.
+
+The OCT6100 GPL API is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
+for more details. 
+
+You should have received a copy of the GNU General Public License 
+along with the OCT6100 GPL API; if not, write to the Free Software 
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+$Octasic_Release: OCT612xAPI-01.00-PR49 $
+
+$Octasic_Revision: 8 $
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#ifndef __OCTAPI_LLMAN_H__
+#define __OCTAPI_LLMAN_H__
+
+#include "octdef.h"
+
+/* Error defines. */
+#define OCTAPI_LLM_MEMORY_NOT_ALLOCATED                        0xFFFFFFFF
+#define OCTAPI_LLM_NO_STRUCTURES_LEFT                  0xFFFFFFFE
+#define OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE               0xFFFFFFFD
+#define OCTAPI_LLM_ELEMENT_ALREADY_ASSIGNED            0xFFFFFFFC
+#define OCTAPI_LLM_ELEMENT_NOT_FOUND                   0xFFFFFFFB
+#define OCTAPI_LLM_LIST_EMPTY                                  0xFFFFFFFA
+#define OCTAPI_LLM_INVALID_LIST_HANDLE                 0xFFFFFFF9
+#define OCTAPI_LLM_TREE_NODE_ABSENT                            0xFFFFFFF8
+#define OCTAPI_LLM_INTERNAL_ERROR0                             0xFFFFFFF7
+#define OCTAPI_LLM_INTERNAL_ERROR1                             0xFFFFFFF6
+#define OCTAPI_LLM_INVALID_PARAMETER                   0xFFFFFFF5
+
+#define OCTAPI_LLM2_MEMORY_NOT_ALLOCATED               0xFEFFFFFF
+#define OCTAPI_LLM2_NO_STRUCTURES_LEFT                 0xFEFFFFFE
+#define OCTAPI_LLM2_BLOCKNUM_OUT_OF_RANGE              0xFEFFFFFD
+#define OCTAPI_LLM2_ELEMENT_ALREADY_ASSIGNED   0xFEFFFFFC
+#define OCTAPI_LLM2_ELEMENT_NOT_FOUND                  0xFEFFFFFB
+#define OCTAPI_LLM2_LIST_EMPTY                                 0xFEFFFFFA
+#define OCTAPI_LLM2_INVALID_LIST_HANDLE                        0xFEFFFFF9
+#define OCTAPI_LLM2_TREE_NODE_ABSENT                   0xFEFFFFF8
+#define OCTAPI_LLM2_INTERNAL_ERROR0                            0xFEFFFFF7
+#define OCTAPI_LLM2_INTERNAL_ERROR1                            0xFEFFFFF6
+#define OCTAPI_LLM2_INVALID_PARAMETER                  0xFEFFFFF5
+
+/* Other defines. */
+#define OCTAPI_LLM_LIST_APPEND                                 0xFFFFFFFF
+#define OCTAPI_LLM2_INSERT_ERROR                               0xFFFFFFFF
+#define OCTAPI_LLM2_INSERT_FIRST_NODE                  0xFFFF0000
+#define OCTAPI_LLM2_INSERT_LIST_NODE                   0xFFFF0001
+#define OCTAPI_LLM2_INSERT_LAST_NODE                   0xFFFF0002
+#define OCTAPI_LLM2_INSERT_BEFORE_LAST_NODE            0xFFFF0003
+#define OCTAPI_LLM2_REMOVE_ERROR                               0xFFFFFFFF
+#define OCTAPI_LLM2_REMOVE_FIRST_NODE                  0xFFFF0004
+#define OCTAPI_LLM2_REMOVE_LIST_NODE                   0xFFFF0005
+#define OCTAPI_LLM2_REMOVE_LAST_NODE                   0xFFFF0006
+#define OCTAPI_LLM2_REMOVE_BEFORE_LAST_NODE            0xFFFF0007
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define octapi_llm_alloc_get_size( number_of_items, l_size )                                                           OctapiLlmAllocGetSize( (UINT32) number_of_items,(PUINT32) l_size )
+#define octapi_llm_alloc_init( l, number_of_items )                                                                                    OctapiLlmAllocInit( (PVOID*) l,(UINT32) number_of_items )
+#define octapi_llm_alloc_info( l, allocated_items, available_items )                                           OctapiLlmAllocInfo( (PVOID) l, (PUINT32) allocated_items, (PUINT32) available_items )
+#define octapi_llm_alloc_alloc( l, blocknum )                                                                                          OctapiLlmAllocAlloc( (PVOID) l, (PUINT32) blocknum )
+#define octapi_llm_alloc_dealloc( l, blocknum )                                                                                                OctapiLlmAllocDealloc( (PVOID) l,(UINT32) blocknum )
+#define octapi_llm_list_get_size( number_of_items, number_of_lists, user_info_size, l_size ) OctApiLlmListGetSize( (UINT32) number_of_items,(UINT32) number_of_lists,(UINT32) user_info_size,(PUINT32) l_size )
+#define octapi_llm_list_init( l, number_of_items, number_of_lists, user_info_size )                    OctApiLlmListInit( (PVOID*) l,(UINT32) number_of_items,(UINT32) number_of_lists,(UINT32) user_info_size )
+#define octapi_llm_list_info( l, allocated_lists, allocated_items, free_lists, free_items )    OctApiLlmListInfo( (PVOID) l,(PUINT32) allocated_lists,(PUINT32) allocated_items,(PUINT32) free_lists,(PUINT32) free_items )
+#define octapi_llm_list_create( l, list_handle )                                                                                       OctApiLlmListCreate( (PVOID) l,(PUINT32) list_handle )
+#define octapi_llm_list_create_full( l, list_length, plist_handle )                                                    OctApiLlmListCreateFull( (PVOID) l, (UINT32) list_length, (PUINT32) plist_handle )
+#define octapi_llm_list_append_items( l,  list_handle,  num_items )                                                    OctApiLlmListAppendItems( (PVOID) l, (UINT32) list_handle, (UINT32) num_items )
+#define octapi_llm_list_append_and_set_items( l, list_handle, num_items, data_list )           OctApiLlmListAppendAndSetItems( (PVOID) l, (UINT32) list_handle, (UINT32) num_items, (PVOID) data_list )
+#define octapi_llm_list_delete( l, list_handle )                                                                                       OctApiLlmListDelete( (PVOID) l,(UINT32) list_handle )
+#define octapi_llm_list_length( l, list_handle, number_of_items_in_list )                                      OctApiLlmListLength( (PVOID) l,(UINT32) list_handle, (PUINT32) number_of_items_in_list )
+#define octapi_llm_list_insert_item( l, list_handle, item_number, item_data_pnt )                      OctApiLlmListInsertItem( (PVOID) l,(UINT32) list_handle,(UINT32) item_number,(PVOID*) item_data_pnt )
+#define octapi_llm_list_remove_item( l, list_handle, item_number )                                                     OctApiLlmListRemoveItem( (PVOID) l,(UINT32) list_handle,(UINT32) item_number )
+#define octapi_llm_list_item_data( l, list_handle, item_number, item_data_pnt )                                OctApiLlmListItemData( (PVOID) l,(UINT32) list_handle,(UINT32) item_number,(PVOID*) item_data_pnt )
+#define octapi_llm_list_copy_data( l, list_handle, start_item, data_length, pdata_list )       OctApiLlmListCopyData( (PVOID) l, (UINT32) list_handle, (UINT32) start_item, (UINT32) data_length, (PVOID) pdata_list )
+#define octapi_llm_list_set_items( l, list_handle, start_item, data_length, pdata_list )       OctApiLlmListSetItems( (PVOID) l, (UINT32) list_handle, (UINT32) start_item, (UINT32) data_length, (PVOID) pdata_list )
+
+/* Alloc man. */
+UINT32 OctapiLlmAllocGetSize( UINT32 number_of_items,PUINT32 l_size );
+UINT32 OctapiLlmAllocInit( PVOID* l,UINT32 number_of_items );
+UINT32 OctapiLlmAllocInfo( PVOID l, PUINT32 allocated_items, PUINT32 available_items );
+UINT32 OctapiLlmAllocAlloc( PVOID l, PUINT32 blocknum );
+UINT32 OctapiLlmAllocDealloc( PVOID l,UINT32 blocknum );
+
+/* Time managed alloc man. */
+UINT32 OctApiTllmAllocGetSize( UINT32 number_of_items, PUINT32 l_size );
+UINT32 OctApiTllmAllocInit( PVOID* l, UINT32 number_of_items );
+UINT32 OctApiTllmAllocInfo( PVOID l, PUINT32 allocated_items, PUINT32 available_items );
+UINT32 OctApiTllmAllocAlloc( PVOID l, PUINT32 blocknum, UINT32 current_time[2] );
+UINT32 OctApiTllmAllocDealloc( PVOID l, UINT32 blocknum, UINT32 timeout_value, UINT32 current_time[2] );
+
+/* List man. */
+UINT32 OctApiLlmListGetSize( UINT32 number_of_items, UINT32 number_of_lists, UINT32 user_info_size, PUINT32 l_size );
+UINT32 OctApiLlmListInit( PVOID* l, UINT32 number_of_items, UINT32 number_of_lists, UINT32 user_info_size );
+UINT32 OctApiLlmListInfo( PVOID l, PUINT32 allocated_lists, PUINT32 allocated_items, PUINT32 free_lists, PUINT32 free_items );
+UINT32 OctApiLlmListCreate( PVOID l, PUINT32 list_handle );
+UINT32 OctApiLlmListCreateFull( PVOID l, UINT32 list_length, UINT32* plist_handle );
+UINT32 OctApiLlmListAppendItems( PVOID l, UINT32 list_handle, UINT32 num_items );
+UINT32 OctApiLlmListAppendAndSetItems( PVOID l, UINT32 list_handle, UINT32 num_items, PVOID data_list );
+UINT32 OctApiLlmListDelete( PVOID l, UINT32 list_handle );
+UINT32 OctApiLlmListLength( PVOID l, UINT32 list_handle, PUINT32 number_of_items_in_list );
+UINT32 OctApiLlmListInsertItem( PVOID l, UINT32 list_handle, UINT32 item_number, PVOID* item_data_pnt );
+UINT32 OctApiLlmListRemoveItem( PVOID l, UINT32 list_handle, UINT32 item_number );
+UINT32 OctApiLlmListItemData( PVOID l, UINT32 list_handle, UINT32 item_number, PVOID* item_data_pnt );
+UINT32 OctApiLlmListCopyData( PVOID l, UINT32 list_handle, UINT32 start_item, UINT32 data_length, PVOID pdata_list );
+UINT32 OctApiLlmListSetItems( PVOID l, UINT32 list_handle, UINT32 start_item, UINT32 data_length, PVOID pdata_list );
+
+/* Second list manager using a key to order info in the list. */
+UINT32 OctApiLlm2ListGetSize( UINT32 number_of_items, UINT32 number_of_lists, UINT32 user_info_size, PUINT32 l_size );
+UINT32 OctApiLlm2ListInit( PVOID* l,UINT32 number_of_items, UINT32 number_of_lists, UINT32 user_info_size );
+UINT32 OctApiLlm2ListCreate( PVOID l, PUINT32 list_handle );
+UINT32 OctApiLlm2ListLength( PVOID l, UINT32 list_handle, PUINT32 number_of_items_in_list );
+UINT32 OctApiLlm2ListInsertItem(void * l, UINT32 list_handle, UINT32 item_key, void ** item_data_pnt, void ** prev_item_data_pnt, void ** prev_prev_item_data_pnt, PUINT32 insert_status_pnt );
+UINT32 OctApiLlm2ListRemoveItem(void * l, UINT32 list_handle, UINT32 item_key, PUINT32 prev_item_key_pnt, PUINT32 prev_prev_item_key_pnt, PUINT32 remove_status_pnt );
+UINT32 OctApiLlm2ListItemData( PVOID l, UINT32 list_handle, UINT32 item_key, PVOID* item_data_pnt, PUINT32 item_number );
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __OCTAPI_LLMAN_H__ */
diff --git a/xpp/oct612x/include/digium_unused.h b/xpp/oct612x/include/digium_unused.h
new file mode 100644 (file)
index 0000000..ecf382f
--- /dev/null
@@ -0,0 +1,297 @@
+/* Define macros here to suppress functions from the API being built */
+
+#if 1
+
+#define SKIP_Oct6100AdpcmChanOpenDef 1
+#define SKIP_Oct6100AdpcmChanOpen 1
+#define SKIP_Oct6100AdpcmChanCloseDef 1
+#define SKIP_Oct6100AdpcmChanClose 1
+#define SKIP_Oct6100AdpcmChanOpenSer 1
+#define SKIP_Oct6100ApiCheckAdpcmChanParams 1
+#define SKIP_Oct6100ApiReserveAdpcmChanResources 1
+#define SKIP_Oct6100ApiWriteAdpcmChanStructs 1
+#define SKIP_Oct6100ApiUpdateAdpcmChanEntry 1
+#define SKIP_Oct6100AdpcmChanCloseSer 1
+#define SKIP_Oct6100ApiAssertAdpcmChanParams 1
+#define SKIP_Oct6100ApiInvalidateAdpcmChanStructs 1
+#define SKIP_Oct6100ApiReleaseAdpcmChanResources 1
+#define SKIP_Oct6100ApiReserveAdpcmChanEntry 1
+#define SKIP_Oct6100ApiReleaseAdpcmChanEntry 1
+#define SKIP_Oct6100ChannelCloseDef 1
+#define SKIP_Oct6100ChannelClose 1
+#define SKIP_Oct6100ChannelCreateBiDirDef 1
+#define SKIP_Oct6100ChannelCreateBiDir 1
+#define SKIP_Oct6100ChannelDestroyBiDirDef 1
+#define SKIP_Oct6100ChannelDestroyBiDir 1
+#define SKIP_Oct6100ChannelBroadcastTsstAddDef 1
+#define SKIP_Oct6100ChannelBroadcastTsstAdd 1
+#define SKIP_Oct6100ChannelBroadcastTsstRemove 1
+#define SKIP_Oct6100ChannelGetStatsDef 1
+#define SKIP_Oct6100ChannelGetStats 1
+#define SKIP_Oct6100ChannelMuteDef 1
+#define SKIP_Oct6100ChannelMute 1
+#define SKIP_Oct6100ChannelUnMuteDef 1
+#define SKIP_Oct6100ChannelUnMute 1
+#define SKIP_Oct6100ChannelCloseSer 1
+#define SKIP_Oct6100ApiAssertChannelParams 1
+#define SKIP_Oct6100ApiInvalidateChannelStructs 1
+#define SKIP_Oct6100ApiReleaseChannelResources 1
+#define SKIP_Oct6100ChannelBroadcastTsstAddSer 1
+#define SKIP_Oct6100ApiCheckChanTsstAddParams 1
+#define SKIP_Oct6100ApiReserveTsstAddResources 1
+#define SKIP_Oct6100ApiWriteTsstAddStructs 1
+#define SKIP_Oct6100ApiUpdateTsstAddChanEntry 1
+#define SKIP_Oct6100ApiChannelGetStatsSer 1
+#define SKIP_Oct6100ApiReserveBiDirChanEntry 1
+#define SKIP_Oct6100ApiReleaseBiDirChanEntry 1
+#define SKIP_Oct6100ApiRetrieveNlpConfDword 1
+#define SKIP_Oct6100ApiSaveNlpConfDword 1
+#define SKIP_Oct6100ChannelCreateBiDirSer 1
+#define SKIP_Oct6100ApiCheckChannelCreateBiDirParams 1
+#define SKIP_Oct6100ApiReserveChannelCreateBiDirResources 1
+#define SKIP_Oct6100ApiWriteChannelCreateBiDirStructs 1
+#define SKIP_Oct6100ApiUpdateBiDirChannelEntry 1
+#define SKIP_Oct6100ChannelDestroyBiDirSer 1
+#define SKIP_Oct6100ApiAssertDestroyBiDirChanParams 1
+#define SKIP_Oct6100ApiInvalidateBiDirChannelStructs 1
+#define SKIP_Oct6100ApiReleaseBiDirChannelResources 1
+#define SKIP_Oct6100ApiOctFloatToDbEnergyByte 1
+#define SKIP_Oct6100ApiOctFloatToDbEnergyHalf 1
+#define SKIP_Oct6100ChannelMuteSer 1
+#define SKIP_Oct6100ApiAssertChannelMuteParams 1
+#define SKIP_Oct6100ChannelUnMuteSer 1
+#define SKIP_Oct6100ApiAssertChannelUnMuteParams 1
+#define SKIP_Oct6100ApiMuteSinWithFeatures 1
+#define SKIP_Oct6100ApiMuteChannelPorts 1
+#define SKIP_Oct6100CreateLocalInstanceDef 1
+#define SKIP_Oct6100CreateLocalInstance 1
+#define SKIP_Oct6100DestroyLocalInstanceDef 1
+#define SKIP_Oct6100DestroyLocalInstance 1
+#define SKIP_Oct6100GetHwRevisionDef 1
+#define SKIP_Oct6100GetHwRevision 1
+#define SKIP_Oct6100FreeResourcesDef 1
+#define SKIP_Oct6100FreeResources 1
+#define SKIP_Oct6100ProductionBistDef 1
+#define SKIP_Oct6100ProductionBist 1
+#define SKIP_Oct6100ApiGetVersionDef 1
+#define SKIP_Oct6100ApiGetVersion 1
+#define SKIP_Oct6100FreeResourcesSer 1
+#define SKIP_Oct6100ProductionBistSer 1
+#define SKIP_Oct6100ChipGetStatsDef 1
+#define SKIP_Oct6100ChipGetStats 1
+#define SKIP_Oct6100ChipGetImageInfoDef 1
+#define SKIP_Oct6100ChipGetImageInfo 1
+#define SKIP_Oct6100ChipGetStatsSer 1
+#define SKIP_Oct6100ConfBridgeOpenDef 1
+#define SKIP_Oct6100ConfBridgeOpen 1
+#define SKIP_Oct6100ConfBridgeClose 1
+#define SKIP_Oct6100ConfBridgeChanAddDef 1
+#define SKIP_Oct6100ConfBridgeChanAdd 1
+#define SKIP_Oct6100ConfBridgeChanRemove 1
+#define SKIP_Oct6100ConfBridgeChanMuteDef 1
+#define SKIP_Oct6100ConfBridgeChanMute 1
+#define SKIP_Oct6100ConfBridgeChanUnMuteDef 1
+#define SKIP_Oct6100ConfBridgeChanUnMute 1
+#define SKIP_Oct6100ConfBridgeDominantSpeakerSetDef 1
+#define SKIP_Oct6100ConfBridgeDominantSpeakerSet 1
+#define SKIP_Oct6100ConfBridgeMaskChangeDef 1
+#define SKIP_Oct6100ConfBridgeMaskChange 1
+#define SKIP_Oct6100ConfBridgeGetStatsDef 1
+#define SKIP_Oct6100ConfBridgeGetStats 1
+#define SKIP_Oct6100ConfBridgeOpenSer 1
+#define SKIP_Oct6100ApiCheckBridgeParams 1
+#define SKIP_Oct6100ApiReserveBridgeResources 1
+#define SKIP_Oct6100ApiUpdateBridgeEntry 1
+#define SKIP_Oct6100ConfBridgeChanAddSer 1
+#define SKIP_Oct6100ApiCheckBridgeAddParams 1
+#define SKIP_Oct6100ApiReserveBridgeAddResources 1
+#define SKIP_Oct6100ApiBridgeEventAdd 1
+#define SKIP_Oct6100ApiBridgeAddParticipantToChannel 1
+#define SKIP_Oct6100ConfBridgeChanMuteSer 1
+#define SKIP_Oct6100ApiCheckBridgeMuteParams 1
+#define SKIP_Oct6100ApiUpdateBridgeMuteResources 1
+#define SKIP_Oct6100ConfBridgeChanUnMuteSer 1
+#define SKIP_Oct6100ApiCheckBridgeUnMuteParams 1
+#define SKIP_Oct6100ApiUpdateBridgeUnMuteResources 1
+#define SKIP_Oct6100ConfBridgeDominantSpeakerSetSer 1
+#define SKIP_Oct6100ApiCheckBridgeDominantSpeakerParams 1
+#define SKIP_Oct6100ApiUpdateBridgeDominantSpeakerResources 1
+#define SKIP_Oct6100ConfBridgeMaskChangeSer 1
+#define SKIP_Oct6100ApiCheckBridgeMaskChangeParams 1
+#define SKIP_Oct6100ApiUpdateMaskModifyResources 1
+#define SKIP_Oct6100ApiBridgeUpdateMask 1
+#define SKIP_Oct6100ConfBridgeGetStatsSer 1
+#define SKIP_Oct6100ApiReserveBridgeEntry 1
+#define SKIP_Oct6100ApiReserveFlexConfParticipantEntry 1
+#define SKIP_Oct6100DebugSelectChannelDef 1
+#define SKIP_Oct6100DebugSelectChannel 1
+#define SKIP_Oct6100DebugGetDataDef 1
+#define SKIP_Oct6100DebugGetData 1
+#define SKIP_Oct6100DebugSelectChannelSer 1
+#define SKIP_Oct6100DebugGetDataSer 1
+#define SKIP_Oct6100BufferPlayoutGetEventDef 1
+#define SKIP_Oct6100BufferPlayoutGetEvent 1
+#define SKIP_Oct6100BufferPlayoutGetEventSer 1
+#define SKIP_Oct6100InterruptConfigureDef 1
+#define SKIP_Oct6100InterruptConfigure 1
+#define SKIP_Oct6100ApiReserveBufferPlayoutMemoryNode 1
+#define SKIP_Oct6100ApiReleaseBufferPlayoutMemoryNode 1
+#define SKIP_Oct6100ApiReserveBufferPlayoutMemory 1
+#define SKIP_Oct6100ApiReleaseBufferPlayoutMemory 1
+#define SKIP_Oct6100ApiCreateFeatureMask 1
+#define SKIP_Oct6100MixerCopyEventCreateDef 1
+#define SKIP_Oct6100MixerCopyEventCreate 1
+#define SKIP_Oct6100MixerCopyEventDestroyDef 1
+#define SKIP_Oct6100MixerCopyEventDestroy 1
+#define SKIP_Oct6100MixerCopyEventCreateSer 1
+#define SKIP_Oct6100ApiCheckCopyEventCreateParams 1
+#define SKIP_Oct6100ApiReserveCopyEventCreateResources 1
+#define SKIP_Oct6100ApiWriteCopyEventCreateStructs 1
+#define SKIP_Oct6100ApiUpdateCopyEventCreateEntry 1
+#define SKIP_Oct6100MixerCopyEventDestroySer 1
+#define SKIP_Oct6100ApiAssertCopyEventDestroyParams 1
+#define SKIP_Oct6100ApiInvalidateCopyEventStructs 1
+#define SKIP_Oct6100ApiReleaseCopyEventResources 1
+#define SKIP_Oct6100ApiReserveCopyEventEntry 1
+#define SKIP_Oct6100ApiReleaseCopyEventEntry 1
+#define SKIP_Oct6100PhasingTsstOpenDef 1
+#define SKIP_Oct6100PhasingTsstOpen 1
+#define SKIP_Oct6100PhasingTsstCloseDef 1
+#define SKIP_Oct6100PhasingTsstClose 1
+#define SKIP_Oct6100PhasingTsstOpenSer 1
+#define SKIP_Oct6100ApiCheckPhasingParams 1
+#define SKIP_Oct6100ApiReservePhasingResources 1
+#define SKIP_Oct6100ApiWritePhasingStructs 1
+#define SKIP_Oct6100ApiUpdatePhasingEntry 1
+#define SKIP_Oct6100PhasingTsstCloseSer 1
+#define SKIP_Oct6100ApiAssertPhasingParams 1
+#define SKIP_Oct6100ApiInvalidatePhasingStructs 1
+#define SKIP_Oct6100ApiReleasePhasingResources 1
+#define SKIP_Oct6100ApiReservePhasingEntry 1
+#define SKIP_Oct6100ApiReleasePhasingEntry 1
+#define SKIP_Oct6100BufferPlayoutLoadDef 1
+#define SKIP_Oct6100BufferPlayoutLoad 1
+#define SKIP_Oct6100BufferPlayoutLoadBlockInitDef 1
+#define SKIP_Oct6100BufferPlayoutLoadBlockInit 1
+#define SKIP_Oct6100BufferPlayoutLoadBlockDef 1
+#define SKIP_Oct6100BufferPlayoutLoadBlock 1
+#define SKIP_Oct6100BufferPlayoutUnloadDef 1
+#define SKIP_Oct6100BufferPlayoutUnload 1
+#define SKIP_Oct6100BufferPlayoutAddDef 1
+#define SKIP_Oct6100BufferPlayoutAdd 1
+#define SKIP_Oct6100BufferPlayoutStartDef 1
+#define SKIP_Oct6100BufferPlayoutStart 1
+#define SKIP_Oct6100BufferPlayoutStop 1
+#define SKIP_Oct6100BufferLoadSer 1
+#define SKIP_Oct6100BufferLoadBlockInitSer 1
+#define SKIP_Oct6100BufferLoadBlockSer 1
+#define SKIP_Oct6100ApiCheckBufferParams 1
+#define SKIP_Oct6100ApiCheckBufferLoadBlockParams 1
+#define SKIP_Oct6100ApiReserveBufferResources 1
+#define SKIP_Oct6100ApiWriteBufferInMemory 1
+#define SKIP_Oct6100ApiUpdateBufferEntry 1
+#define SKIP_Oct6100BufferUnloadSer 1
+#define SKIP_Oct6100ApiAssertBufferParams 1
+#define SKIP_Oct6100ApiReleaseBufferResources 1
+#define SKIP_Oct6100BufferPlayoutAddSer 1
+#define SKIP_Oct6100ApiCheckPlayoutAddParams 1
+#define SKIP_Oct6100ApiWriteBufferAddStructs 1
+#define SKIP_Oct6100BufferPlayoutStartSer 1
+#define SKIP_Oct6100ApiCheckPlayoutStartParams 1
+#define SKIP_Oct6100ApiWriteChanPlayoutStructs 1
+#define SKIP_Oct6100ApiReserveBufPlayoutListEntry 1
+#define SKIP_Oct6100ApiReleaseBufPlayoutListEntry 1
+#define SKIP_Oct6100RemoteDebugDef 1
+#define SKIP_Oct6100RemoteDebug 1
+#define SKIP_Oct6100ApiCheckEndianDetectField 1
+#define SKIP_Oct6100ApiCalculateChecksum 1
+#define SKIP_Oct6100ApiFormResponsePkt 1
+#define SKIP_Oct6100ApiCheckPktCommands 1
+#define SKIP_Oct6100ApiExecutePktCommands 1
+#define SKIP_Oct6100ApiCheckSessionNum 1
+#define SKIP_Oct6100ApiRpcReadWord 1
+#define SKIP_Oct6100ApiRpcReadBurst 1
+#define SKIP_Oct6100ApiRpcReadArray 1
+#define SKIP_Oct6100ApiRpcWriteWord 1
+#define SKIP_Oct6100ApiRpcWriteSmear 1
+#define SKIP_Oct6100ApiRpcWriteBurst 1
+#define SKIP_Oct6100ApiRpcSetHotChannel 1
+#define SKIP_Oct6100ApiRpcGetDebugChanIndex 1
+#define SKIP_Oct6100ApiRpcDisconnect 1
+#define SKIP_Oct6100ToneDetectionDisable 1
+#define SKIP_Oct6100TsiCnctOpenDef 1
+#define SKIP_Oct6100TsiCnctOpen 1
+#define SKIP_Oct6100TsiCnctCloseDef 1
+#define SKIP_Oct6100TsiCnctClose 1
+#define SKIP_Oct6100TsiCnctOpenSer 1
+#define SKIP_Oct6100ApiCheckTsiParams 1
+#define SKIP_Oct6100ApiReserveTsiResources 1
+#define SKIP_Oct6100ApiWriteTsiStructs 1
+#define SKIP_Oct6100ApiUpdateTsiEntry 1
+#define SKIP_Oct6100TsiCnctCloseSer 1
+#define SKIP_Oct6100ApiAssertTsiParams 1
+#define SKIP_Oct6100ApiInvalidateTsiStructs 1
+#define SKIP_Oct6100ApiReleaseTsiResources 1
+#define SKIP_Oct6100ApiReserveTsiCnctEntry 1
+#define SKIP_Oct6100ApiReleaseTsiCnctEntry 1
+#define SKIP_Oct6100UserDriverWriteOs 1
+#define SKIP_Oct6100UserDriverWriteSmearOs 1
+#define SKIP_Oct6100UserDriverWriteBurstOs 1
+#define SKIP_Oct6100UserDriverReadOs 1
+#define SKIP_Oct6100UserDriverReadBurstOs 1
+#define SKIP_OctApiBt0AddNode 1
+#define SKIP_OctApiBt0AddNode2 1
+#define SKIP_OctApiBt0AddNode3 1
+#define SKIP_OctApiBt0AddNode4 1
+#define SKIP_OctApiBt0KeyCompare 1
+#define SKIP_OctApiBt0UpdateLinkDepth 1
+#define SKIP_OctApiBt0Rebalance 1
+#define SKIP_OctApiBt0ExternalHeavy 1
+#define SKIP_OctApiBt0RemoveNode2 1
+#define SKIP_OctApiBt0RemoveNode3 1
+#define SKIP_OctApiBt0RemoveNode 1
+#define SKIP_OctApiBt0QueryNode2 1
+#define SKIP_OctApiBt0QueryNode 1
+#define SKIP_OctApiBt0GetFirstNode 1
+#define SKIP_OctApiBt0FindOrAddNode 1
+#define SKIP_OctApiBt0AddNodeReportPrevNodeData 1
+#define SKIP_OctApiLmCompare 1
+#define SKIP_OctApiLmMultiply 1
+#define SKIP_OctApiLmDivide 1
+#define SKIP_OctApiLmShiftRight1 1
+#define SKIP_OctApiLmShiftn 1
+#define SKIP_OctApiLmGetMsb 1
+#define SKIP_OctApiTllmAllocGetSize 1
+#define SKIP_OctApiTllmAllocInit 1
+#define SKIP_OctApiTllmAllocInfo 1
+#define SKIP_OctApiTllmAllocAlloc 1
+#define SKIP_OctApiTllmAllocDealloc 1
+#define SKIP_OctApiTllmCheckTimeoutList 1
+#define SKIP_OctApiLlmListGetSize 1
+#define SKIP_OctApiLlmListGetItemPointer 1
+#define SKIP_OctApiLlmListInit 1
+#define SKIP_OctApiLlmListInfo 1
+#define SKIP_OctApiLlmListCreate 1
+#define SKIP_OctApiLlmListDelete 1
+#define SKIP_OctApiLlmListLength 1
+#define SKIP_OctApiLlmListItemData 1
+#define SKIP_OctApiLlmListInsertItem 1
+#define SKIP_OctApiLlmListCreateFull 1
+#define SKIP_OctApiLlmListAppendItems 1
+#define SKIP_OctApiLlmListAppendAndSetItems 1
+#define SKIP_OctApiLlmListSetItems 1
+#define SKIP_OctApiLlmListCopyData 1
+#define SKIP_OctApiLlmListRemoveItem 1
+#define SKIP_OctApiLlm2ListGetSize 1
+#define SKIP_OctApiLlm2ListGetItemPointer 1
+#define SKIP_OctApiLlm2ListInit 1
+#define SKIP_OctApiLlm2ListCreate 1
+#define SKIP_OctApiLlm2ListDelete 1
+#define SKIP_OctApiLlm2ListLength 1
+#define SKIP_OctApiLlm2ListItemData 1
+#define SKIP_OctApiLlm2ListInsertItem 1
+#define SKIP_OctApiLlm2ListRemoveItem 1
+#define SKIP_OctApiLlmMemCpy 1
+
+#endif
+
diff --git a/xpp/oct612x/include/oct6100api/oct6100_adpcm_chan_inst.h b/xpp/oct612x/include/oct6100api/oct6100_adpcm_chan_inst.h
new file mode 100644 (file)
index 0000000..9e33909
--- /dev/null
@@ -0,0 +1,74 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+
+File:  oct6100_adpcm_chan_inst.h
+
+    Copyright (c) 2001-2007 Octasic Inc.
+    
+Description: 
+
+       File containing all defines, macros, and structures pertaining to the file
+       oct6100_adpcm_chan.c.  All elements defined in this file are for public
+       usage of the API.  All private elements are defined in the
+       oct6100_adpcm_chan_priv.h file.
+
+This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API  is 
+free software; you can redistribute it and/or modify it under the terms of 
+the GNU General Public License as published by the Free Software Foundation; 
+either version 2 of the License, or (at your option) any later version.
+
+The OCT6100 GPL API is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
+for more details. 
+
+You should have received a copy of the GNU General Public License 
+along with the OCT6100 GPL API; if not, write to the Free Software 
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+$Octasic_Release: OCT612xAPI-01.00-PR49 $
+
+$Octasic_Revision: 6 $
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+
+#ifndef __OCT6100_ADPCM_CHAN_INST_H__
+#define __OCT6100_ADPCM_CHAN_INST_H__
+
+/*****************************  INCLUDE FILES  *******************************/
+
+/*****************************  DEFINES  *************************************/
+
+/*****************************  TYPES  ***************************************/
+
+typedef struct _OCT6100_API_ADPCM_CHAN_
+{
+       /* Flag specifying whether the entry is used or not. */
+       UINT8   fReserved;
+       
+       /* Count used to manage entry handles allocated to user. */
+       UINT8   byEntryOpenCnt;
+
+       /* TSI chariot memory entry. */
+       UINT16  usTsiMemIndex;
+       
+       /* ADPCM memory entry. */
+       UINT16  usAdpcmMemIndex;
+
+       /* Input and output timeslot information. */
+       UINT16  usInputTimeslot;
+       UINT16  usInputStream;
+       UINT8   byInputNumTssts;
+       UINT8   byInputPcmLaw;
+
+       UINT16  usOutputTimeslot;
+       UINT16  usOutputStream;
+       UINT8   byOutputNumTssts;
+       UINT8   byOutputPcmLaw;
+
+       /* Internal info for quick access to structures associated to this TSI cnct. */
+       UINT16  usInputTsstIndex;
+       UINT16  usOutputTsstIndex;
+
+} tOCT6100_API_ADPCM_CHAN, *tPOCT6100_API_ADPCM_CHAN;
+
+#endif /* __OCT6100_ADPCM_CHAN_INST_H__ */
diff --git a/xpp/oct612x/include/oct6100api/oct6100_adpcm_chan_pub.h b/xpp/oct612x/include/oct6100api/oct6100_adpcm_chan_pub.h
new file mode 100644 (file)
index 0000000..e29fac4
--- /dev/null
@@ -0,0 +1,90 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+
+File:  oct6100_adpcm_chan_pub.h
+
+    Copyright (c) 2001-2007 Octasic Inc.
+    
+Description: 
+
+       File containing all defines, macros, and structures pertaining to the file
+       oct6100_adpcm_chan.c.  All elements defined in this file are for public
+       usage of the API.  All private elements are defined in the
+       oct6100_adpcm_chan_priv.h file.
+
+This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API  is 
+free software; you can redistribute it and/or modify it under the terms of 
+the GNU General Public License as published by the Free Software Foundation; 
+either version 2 of the License, or (at your option) any later version.
+
+The OCT6100 GPL API is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
+for more details. 
+
+You should have received a copy of the GNU General Public License 
+along with the OCT6100 GPL API; if not, write to the Free Software 
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+$Octasic_Release: OCT612xAPI-01.00-PR49 $
+
+$Octasic_Revision: 5 $
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+
+#ifndef __OCT6100_ADPCM_CHAN_PUB_H__
+#define __OCT6100_ADPCM_CHAN_PUB_H__
+
+/*****************************  INCLUDE FILES  *******************************/
+
+
+/*****************************  DEFINES  *************************************/
+
+
+/*****************************  TYPES  ***************************************/
+
+typedef struct _OCT6100_ADPCM_CHAN_OPEN_
+{
+       PUINT32 pulChanHndl;
+
+       UINT32  ulInputTimeslot;
+       UINT32  ulInputStream;
+       UINT32  ulInputNumTssts;
+       UINT32  ulInputPcmLaw;
+
+       UINT32  ulOutputTimeslot;
+       UINT32  ulOutputStream;
+       UINT32  ulOutputNumTssts;
+       UINT32  ulOutputPcmLaw;
+
+       UINT32  ulChanMode;                     /* Encoding or decoding. */
+
+       UINT32  ulEncodingRate;
+       UINT32  ulDecodingRate;         
+
+       UINT32  ulAdpcmNibblePosition;
+
+} tOCT6100_ADPCM_CHAN_OPEN, *tPOCT6100_ADPCM_CHAN_OPEN;
+
+typedef struct _OCT6100_ADPCM_CHAN_CLOSE_
+{
+       UINT32  ulChanHndl;
+
+} tOCT6100_ADPCM_CHAN_CLOSE, *tPOCT6100_ADPCM_CHAN_CLOSE;
+
+
+/************************** FUNCTION PROTOTYPES  *****************************/
+
+
+UINT32 Oct6100AdpcmChanOpenDef(
+                               OUT             tPOCT6100_ADPCM_CHAN_OPEN                               f_pAdpcmChanOpen );
+UINT32 Oct6100AdpcmChanOpen(
+                               IN OUT  tPOCT6100_INSTANCE_API                                  f_pApiInstance,
+                               IN OUT  tPOCT6100_ADPCM_CHAN_OPEN                               f_pAdpcmChanOpen );
+
+UINT32 Oct6100AdpcmChanCloseDef(
+                               OUT             tPOCT6100_ADPCM_CHAN_CLOSE                              f_pAdpcmChanClose );
+UINT32 Oct6100AdpcmChanClose(
+                               IN OUT  tPOCT6100_INSTANCE_API                                  f_pApiInstance,
+                               IN OUT  tPOCT6100_ADPCM_CHAN_CLOSE                              f_pAdpcmChanClose );
+
+#endif /* __OCT6100_ADPCM_CHAN_PUB_H__ */
diff --git a/xpp/oct612x/include/oct6100api/oct6100_api.h b/xpp/oct612x/include/oct6100api/oct6100_api.h
new file mode 100644 (file)
index 0000000..35a9666
--- /dev/null
@@ -0,0 +1,84 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+
+File:  oct6100_api.h
+
+    Copyright (c) 2001-2007 Octasic Inc.
+    
+Description: 
+
+       Header file containing all definitions used throughout the API.
+
+This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API  is 
+free software; you can redistribute it and/or modify it under the terms of 
+the GNU General Public License as published by the Free Software Foundation; 
+either version 2 of the License, or (at your option) any later version.
+
+The OCT6100 GPL API is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
+for more details. 
+
+You should have received a copy of the GNU General Public License 
+along with the OCT6100 GPL API; if not, write to the Free Software 
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+$Octasic_Release: OCT612xAPI-01.00-PR49 $
+
+$Octasic_Revision: 23 $
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+
+#ifndef __OCT6100_API_H__
+#define __OCT6100_API_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*****************************  INCLUDE FILES  *******************************/
+
+#include "octdef.h"
+
+#include "oct6100_defines.h"
+#include "oct6100_errors.h"
+
+#include "oct6100_apiud.h"
+#include "oct6100_tlv_inst.h"
+#include "oct6100_chip_stats_inst.h"
+#include "oct6100_tsi_cnct_inst.h"
+#include "oct6100_mixer_inst.h"
+#include "oct6100_events_inst.h"
+#include "oct6100_tone_detection_inst.h"
+#include "oct6100_conf_bridge_inst.h"
+#include "oct6100_playout_buf_inst.h"
+
+#include "oct6100_adpcm_chan_inst.h"
+#include "oct6100_phasing_tsst_inst.h"
+#include "oct6100_channel_inst.h"
+#include "oct6100_interrupts_inst.h"
+#include "oct6100_remote_debug_inst.h"
+#include "oct6100_debug_inst.h"
+#include "oct6100_chip_open_inst.h"
+#include "oct6100_api_inst.h"
+
+#include "oct6100_interrupts_pub.h"
+#include "oct6100_tsi_cnct_pub.h"
+#include "oct6100_events_pub.h"
+#include "oct6100_tone_detection_pub.h"
+#include "oct6100_mixer_pub.h"
+#include "oct6100_conf_bridge_pub.h"
+#include "oct6100_playout_buf_pub.h"
+
+#include "oct6100_channel_pub.h"
+#include "oct6100_remote_debug_pub.h"
+#include "oct6100_debug_pub.h"
+#include "oct6100_chip_open_pub.h"
+#include "oct6100_chip_stats_pub.h"
+#include "oct6100_adpcm_chan_pub.h"
+#include "oct6100_phasing_tsst_pub.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OCT6100_API_H__ */
diff --git a/xpp/oct612x/include/oct6100api/oct6100_api_inst.h b/xpp/oct612x/include/oct6100api/oct6100_api_inst.h
new file mode 100644 (file)
index 0000000..29bd0fd
--- /dev/null
@@ -0,0 +1,138 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+
+File:  oct6100_api_inst.h
+
+    Copyright (c) 2001-2007 Octasic Inc.
+    
+Description: 
+
+       File containing the definition of the API instance structure.
+
+This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API  is 
+free software; you can redistribute it and/or modify it under the terms of 
+the GNU General Public License as published by the Free Software Foundation; 
+either version 2 of the License, or (at your option) any later version.
+
+The OCT6100 GPL API is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
+for more details. 
+
+You should have received a copy of the GNU General Public License 
+along with the OCT6100 GPL API; if not, write to the Free Software 
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+$Octasic_Release: OCT612xAPI-01.00-PR49 $
+
+$Octasic_Revision: 40 $
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+
+#ifndef __OCT6100_API_INST_H__
+#define __OCT6100_API_INST_H__
+
+/*****************************  INCLUDE FILES  *******************************/
+
+
+/*****************************  DEFINES  *************************************/
+
+
+/*****************************  TYPES  ***************************************/
+
+typedef struct _OCT6100_SHARED_INFO_
+{
+       /* Local copy of chip configuration structure. */
+       tOCT6100_API_CHIP_CONFIG                ChipConfig;
+       
+       /* Miscellaneous calculations and mapping of static structures in external memory. */
+       tOCT6100_API_MISCELLANEOUS              MiscVars;
+       tOCT6100_API_MEMORY_MAP                 MemoryMap;
+
+       /* Error stats structure. */
+       tOCT6100_API_CHIP_ERROR_STATS   ErrorStats;
+       tOCT6100_API_CHIP_STATS                 ChipStats;
+       
+       /* Mixer information. */
+       tOCT6100_API_MIXER                              MixerInfo;
+
+       /* Image breakdown information. */
+       tOCT6100_API_IMAGE_REGION               ImageRegion[ cOCT6100_MAX_IMAGE_REGION ];
+       tOCT6100_API_IMAGE_INFO                 ImageInfo;
+
+       /* Configuration and management of interrupts. */
+       tOCT6100_API_INTRPT_CONFIG              IntrptConfig;
+       tOCT6100_API_INTRPT_MANAGE              IntrptManage;
+       /* Remote debugging. */
+       tOCT6100_API_REMOTE_DEBUG_INFO  RemoteDebugInfo;
+       /* Chip debugging information. */
+       tOCT6100_API_DEBUG                              DebugInfo;
+
+       /* Management variables of software and hardware buffers. */
+       tOCT6100_API_SOFT_BUFS                  SoftBufs;
+
+       /* Caller buffer playout memory management structure. */
+       tOCT6100_API_BUFFER_PLAYOUT_MALLOC_INFO PlayoutInfo;
+       
+
+
+       UINT32  ulChannelListOfst;
+       UINT32  ulChannelAllocOfst;
+
+       UINT32  ulConversionMemoryAllocOfst;
+
+       UINT32  ulTsiMemoryAllocOfst;
+       UINT32  ulExtraTsiMemoryAllocOfst;
+       UINT32  ulEchoMemoryAllocOfst;
+
+       UINT32  ulTsstAllocOfst;
+       UINT32  ulTsstListOfst;
+       UINT32  ulTsstListAllocOfst;
+
+       UINT32  ulTsiCnctListOfst;
+       UINT32  ulTsiCnctAllocOfst;
+
+       UINT32  ulMixerEventListOfst;
+       UINT32  ulMixerEventAllocOfst;
+
+       UINT32  ulCopyEventListOfst;
+       UINT32  ulCopyEventAllocOfst;
+
+       UINT32  ulBiDirChannelListOfst;
+       UINT32  ulBiDirChannelAllocOfst;
+
+       UINT32  ulConfBridgeListOfst;
+       UINT32  ulConfBridgeAllocOfst;
+       
+       UINT32  ulFlexConfParticipantListOfst;
+       UINT32  ulFlexConfParticipantAllocOfst;
+
+       UINT32  ulPlayoutBufListOfst;
+       UINT32  ulPlayoutBufAllocOfst;
+       UINT32  ulPlayoutBufMemoryNodeListOfst;
+       
+
+
+       UINT32  ulAdpcmChanListOfst;
+       UINT32  ulAdpcmChanAllocOfst;
+
+       UINT32  ulPhasingTsstListOfst;
+       UINT32  ulPhasingTsstAllocOfst;
+
+} tOCT6100_SHARED_INFO, *tPOCT6100_SHARED_INFO;
+
+typedef struct _OCT6100_INSTANCE_API_
+{
+       /* Pointer to portion of API instance structure shared amongst all processes. */
+       tPOCT6100_SHARED_INFO   pSharedInfo;
+
+       /* Pointer to user-supplied, process context structure.  The structure is
+               a parameter to all user-supplied functions. */
+       PVOID   pProcessContext;
+
+       /* Handles to all serialization objects used by the API. */
+       tOCT6100_USER_SERIAL_OBJECT     ulApiSerObj;
+
+       
+} tOCT6100_INSTANCE_API, *tPOCT6100_INSTANCE_API;
+
+#endif /* __OCT6100_API_INST_H__ */
diff --git a/xpp/oct612x/include/oct6100api/oct6100_apimi.h b/xpp/oct612x/include/oct6100api/oct6100_apimi.h
new file mode 100644 (file)
index 0000000..dd584ea
--- /dev/null
@@ -0,0 +1,69 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+
+File:  oct6100_apimi.h
+
+    Copyright (c) 2001-2007 Octasic Inc.
+    
+Description: 
+
+       This file contains the declaration of all functions exported from the 
+       APIMI block.  The APIMI block contains only one function:
+               Oct6100InterruptMask.
+       The function is used to mask out the interrupt pin of the chip.  This 
+       function is used when a deferred procedure call treats the interrupt (new 
+       interrupts must not be generated until the signalled interrupt is treated).
+
+This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API  is 
+free software; you can redistribute it and/or modify it under the terms of 
+the GNU General Public License as published by the Free Software Foundation; 
+either version 2 of the License, or (at your option) any later version.
+
+The OCT6100 GPL API is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
+for more details. 
+
+You should have received a copy of the GNU General Public License 
+along with the OCT6100 GPL API; if not, write to the Free Software 
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+$Octasic_Release: OCT612xAPI-01.00-PR49 $
+
+$Octasic_Revision: 6 $
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+
+#ifndef __OCT6100_APIMI_H__
+#define __OCT6100_APIMI_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/*****************************  INCLUDE FILES  *******************************/
+
+#include "octdef.h"
+
+/*****************************  TYPES  ***************************************/
+
+typedef struct _OCT6100_INTERRUPT_MASK_
+{
+       UINT32  ulUserChipIndex;
+       PVOID   pProcessContext;
+
+
+} tOCT6100_INTERRUPT_MASK, *tPOCT6100_INTERRUPT_MASK;
+
+/************************** FUNCTION PROTOTYPES  *****************************/
+
+UINT32 Oct6100InterruptMaskDef(
+                               OUT             tPOCT6100_INTERRUPT_MASK f_pInterruptMask );
+UINT32 Oct6100InterruptMask(
+                               IN              tPOCT6100_INTERRUPT_MASK f_pInterruptMask );
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __OCT6100_APIMI_H__ */
diff --git a/xpp/oct612x/include/oct6100api/oct6100_apiud.h b/xpp/oct612x/include/oct6100api/oct6100_apiud.h
new file mode 100644 (file)
index 0000000..feff93e
--- /dev/null
@@ -0,0 +1,312 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+
+File:  oct6100_apiud.h
+
+    Copyright (c) 2001-2007 Octasic Inc.
+    
+Description: 
+
+       Header file containing the definitions and prototypes that are to be
+       completed by the user.
+
+This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API  is 
+free software; you can redistribute it and/or modify it under the terms of 
+the GNU General Public License as published by the Free Software Foundation; 
+either version 2 of the License, or (at your option) any later version.
+
+The OCT6100 GPL API is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
+for more details. 
+
+You should have received a copy of the GNU General Public License 
+along with the OCT6100 GPL API; if not, write to the Free Software 
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+$Octasic_Release: OCT612xAPI-01.00-PR49 $
+
+$Octasic_Revision: 16 $
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+
+#ifndef __OCT6100_APIUD_H__
+#define __OCT6100_APIUD_H__
+
+/*****************************  INCLUDE FILES  *******************************/
+
+#include "octdef.h"
+
+/*****************************  DEFINES  *************************************/
+
+
+/* Determines the maximum length of a burst of reads/writes. This value must
+       be in the range 8 - 1024. This value obtains best performance if set to
+       a power of 2 (i.e. 2^n). */
+#define cOCT6100_MAX_RW_ACCESSES       32
+
+/* The define used to specify that the Oct6100SeizeSerializeObject function
+       is not to return until the specified serialization object has been seized. */
+#define cOCT6100_WAIT_INFINITELY       0xFFFFFFFF
+
+
+/* Compile option: enabling this compile option inserts code to check every
+       call to a user provided function to make sure the function parameters
+       are not changed, as required by the API specification. */
+#define cOCT6100_USER_FUNCTION_CHECK
+
+
+
+#define cOCT6100_GET_TIME_FAILED_0                     0xFFFF0000
+#define cOCT6100_GET_TIME_FAILED_1                     0xFFFF0001
+#define cOCT6100_GET_TIME_FAILED_2                     0xFFFF0002
+#define cOCT6100_GET_TIME_FAILED_3                     0xFFFF0003
+#define cOCT6100_GET_TIME_FAILED_4                     0xFFFF0004
+
+#define cOCT6100_CREATE_SERIAL_FAILED_0                0xFFFF0010
+#define cOCT6100_CREATE_SERIAL_FAILED_1                0xFFFF0011
+#define cOCT6100_CREATE_SERIAL_FAILED_2                0xFFFF0012
+#define cOCT6100_CREATE_SERIAL_FAILED_3                0xFFFF0013
+#define cOCT6100_CREATE_SERIAL_FAILED_4                0xFFFF0014
+
+#define cOCT6100_DESTROY_SERIAL_FAILED_0       0xFFFF0020
+#define cOCT6100_DESTROY_SERIAL_FAILED_1       0xFFFF0021
+#define cOCT6100_DESTROY_SERIAL_FAILED_2       0xFFFF0022
+#define cOCT6100_DESTROY_SERIAL_FAILED_3       0xFFFF0023
+#define cOCT6100_DESTROY_SERIAL_FAILED_4       0xFFFF0024
+
+#define cOCT6100_INVALID_SERIAL_HANDLE_0       0xFFFF0030
+#define cOCT6100_INVALID_SERIAL_HANDLE_1       0xFFFF0031
+#define cOCT6100_INVALID_SERIAL_HANDLE_2       0xFFFF0032
+#define cOCT6100_INVALID_SERIAL_HANDLE_3       0xFFFF0033
+#define cOCT6100_INVALID_SERIAL_HANDLE_4       0xFFFF0034
+
+#define cOCT6100_RELEASE_SERIAL_FAILED_0       0xFFFF0040
+#define cOCT6100_RELEASE_SERIAL_FAILED_1       0xFFFF0041
+#define cOCT6100_RELEASE_SERIAL_FAILED_2       0xFFFF0042
+#define cOCT6100_RELEASE_SERIAL_FAILED_3       0xFFFF0043
+#define cOCT6100_RELEASE_SERIAL_FAILED_4       0xFFFF0044
+
+#define cOCT6100_SEIZE_SERIAL_FAILED_0         0xFFFF0050
+#define cOCT6100_SEIZE_SERIAL_FAILED_1         0xFFFF0051
+#define cOCT6100_SEIZE_SERIAL_FAILED_2         0xFFFF0052
+#define cOCT6100_SEIZE_SERIAL_FAILED_3         0xFFFF0053
+#define cOCT6100_SEIZE_SERIAL_FAILED_4         0xFFFF0054
+
+#define cOCT6100_DRIVER_WRITE_FAILED_0         0xFFFF0060
+#define cOCT6100_DRIVER_WRITE_FAILED_1         0xFFFF0061
+#define cOCT6100_DRIVER_WRITE_FAILED_2         0xFFFF0062
+#define cOCT6100_DRIVER_WRITE_FAILED_3         0xFFFF0063
+#define cOCT6100_DRIVER_WRITE_FAILED_4         0xFFFF0064
+
+#define cOCT6100_DRIVER_WSMEAR_FAILED_0                0xFFFF0070
+#define cOCT6100_DRIVER_WSMEAR_FAILED_1                0xFFFF0071
+#define cOCT6100_DRIVER_WSMEAR_FAILED_2                0xFFFF0072
+#define cOCT6100_DRIVER_WSMEAR_FAILED_3                0xFFFF0073
+#define cOCT6100_DRIVER_WSMEAR_FAILED_4                0xFFFF0074
+
+#define cOCT6100_DRIVER_WBURST_FAILED_0                0xFFFF0080
+#define cOCT6100_DRIVER_WBURST_FAILED_1                0xFFFF0081
+#define cOCT6100_DRIVER_WBURST_FAILED_2                0xFFFF0082
+#define cOCT6100_DRIVER_WBURST_FAILED_3                0xFFFF0083
+#define cOCT6100_DRIVER_WBURST_FAILED_4                0xFFFF0084
+
+#define cOCT6100_DRIVER_READ_FAILED_0          0xFFFF0090
+#define cOCT6100_DRIVER_READ_FAILED_1          0xFFFF0091
+#define cOCT6100_DRIVER_READ_FAILED_2          0xFFFF0092
+#define cOCT6100_DRIVER_READ_FAILED_3          0xFFFF0093
+#define cOCT6100_DRIVER_READ_FAILED_4          0xFFFF0094
+
+#define cOCT6100_DRIVER_RBURST_FAILED_0                0xFFFF00A0
+#define cOCT6100_DRIVER_RBURST_FAILED_1                0xFFFF00A1
+#define cOCT6100_DRIVER_RBURST_FAILED_2                0xFFFF00A2
+#define cOCT6100_DRIVER_RBURST_FAILED_3                0xFFFF00A3
+#define cOCT6100_DRIVER_RBURST_FAILED_4                0xFFFF00A4
+
+
+
+
+
+/*****************************  TYPES  ***************************************/
+
+/*Change this type if your platform uses 64bits semaphores/locks */ 
+typedef UINT32 tOCT6100_USER_SERIAL_OBJECT;
+
+typedef struct _OCT6100_GET_TIME_
+{
+       PVOID   pProcessContext;
+       UINT32  aulWallTimeUs[ 2 ];
+
+} tOCT6100_GET_TIME, *tPOCT6100_GET_TIME;
+
+
+
+
+
+typedef struct _OCT6100_CREATE_SERIALIZE_OBJECT_
+{
+       PVOID                                           pProcessContext;
+       PSZ                                                     pszSerialObjName;
+       tOCT6100_USER_SERIAL_OBJECT     ulSerialObjHndl;
+
+} tOCT6100_CREATE_SERIALIZE_OBJECT, *tPOCT6100_CREATE_SERIALIZE_OBJECT;
+
+
+typedef struct _OCT6100_DESTROY_SERIALIZE_OBJECT_
+{
+       PVOID                                           pProcessContext;
+       tOCT6100_USER_SERIAL_OBJECT     ulSerialObjHndl;
+
+} tOCT6100_DESTROY_SERIALIZE_OBJECT, *tPOCT6100_DESTROY_SERIALIZE_OBJECT;
+
+
+typedef struct _OCT6100_SEIZE_SERIALIZE_OBJECT_
+{
+       PVOID                                           pProcessContext;
+       tOCT6100_USER_SERIAL_OBJECT     ulSerialObjHndl;
+       UINT32                                          ulTryTimeMs;
+
+} tOCT6100_SEIZE_SERIALIZE_OBJECT, *tPOCT6100_SEIZE_SERIALIZE_OBJECT;
+
+
+typedef struct _OCT6100_RELEASE_SERIALIZE_OBJECT_
+{
+       PVOID                                           pProcessContext;
+       tOCT6100_USER_SERIAL_OBJECT     ulSerialObjHndl;
+
+} tOCT6100_RELEASE_SERIALIZE_OBJECT, *tPOCT6100_RELEASE_SERIALIZE_OBJECT;
+
+
+typedef struct _OCT6100_WRITE_PARAMS_
+{
+       PVOID   pProcessContext;
+
+       UINT32  ulUserChipId;
+       UINT32  ulWriteAddress;
+       UINT16  usWriteData;
+
+} tOCT6100_WRITE_PARAMS, *tPOCT6100_WRITE_PARAMS;
+
+
+typedef struct _OCT6100_WRITE_SMEAR_PARAMS_
+{
+       PVOID   pProcessContext;
+
+       UINT32  ulUserChipId;
+       UINT32  ulWriteAddress;
+       UINT32  ulWriteLength;
+       UINT16  usWriteData;
+
+} tOCT6100_WRITE_SMEAR_PARAMS, *tPOCT6100_WRITE_SMEAR_PARAMS;
+
+
+typedef struct _OCT6100_WRITE_BURST_PARAMS_
+{
+       PVOID   pProcessContext;
+
+       UINT32  ulUserChipId;
+       UINT32  ulWriteAddress;
+       UINT32  ulWriteLength;
+       PUINT16 pusWriteData;
+
+} tOCT6100_WRITE_BURST_PARAMS, *tPOCT6100_WRITE_BURST_PARAMS;
+
+
+typedef struct _OCT6100_READ_PARAMS_
+{
+       PVOID   pProcessContext;
+
+       UINT32  ulUserChipId;
+       UINT32  ulReadAddress;
+       PUINT16 pusReadData;
+
+} tOCT6100_READ_PARAMS, *tPOCT6100_READ_PARAMS;
+
+
+typedef struct _OCT6100_READ_BURST_PARAMS_
+{
+       PVOID   pProcessContext;
+
+       UINT32  ulUserChipId;
+       UINT32  ulReadAddress;
+       UINT32  ulReadLength;
+       PUINT16 pusReadData;
+
+} tOCT6100_READ_BURST_PARAMS, *tPOCT6100_READ_BURST_PARAMS;
+
+
+
+
+
+
+
+
+/************************** FUNCTION PROTOTYPES  *****************************/
+
+/* Time function. */
+UINT32 Oct6100UserGetTime(
+                               IN OUT  tPOCT6100_GET_TIME                                      f_pTime );
+
+
+
+/* Memory management functions. */
+UINT32 Oct6100UserMemSet(
+                               IN              PVOID                                                           f_pAddress,
+                               IN              UINT32                                                          f_ulPattern,
+                               IN              UINT32                                                          f_ulLength );
+
+UINT32 Oct6100UserMemCopy(
+                               IN              PVOID                                                           f_pDestination,
+                               IN              const void                                                      *f_pSource,
+                               IN              UINT32                                                          f_ulLength );
+
+/* Serialization functions. */
+UINT32 Oct6100UserCreateSerializeObject(
+                               IN OUT tPOCT6100_CREATE_SERIALIZE_OBJECT        f_pCreate);
+
+UINT32 Oct6100UserDestroySerializeObject(
+                               IN tPOCT6100_DESTROY_SERIALIZE_OBJECT           f_pDestroy);
+
+UINT32 Oct6100UserSeizeSerializeObject(
+                               IN tPOCT6100_SEIZE_SERIALIZE_OBJECT                     f_pSeize);
+
+UINT32 Oct6100UserReleaseSerializeObject(
+                               IN tPOCT6100_RELEASE_SERIALIZE_OBJECT           f_pRelease);
+
+/* Read/Write functions.*/
+UINT32 Oct6100UserDriverWriteApi(
+                               IN      tPOCT6100_WRITE_PARAMS                                  f_pWriteParams );
+
+UINT32 Oct6100UserDriverWriteOs(
+                               IN      tPOCT6100_WRITE_PARAMS                                  f_pWriteParams );
+
+UINT32 Oct6100UserDriverWriteSmearApi(
+                               IN      tPOCT6100_WRITE_SMEAR_PARAMS                    f_pSmearParams );
+
+UINT32 Oct6100UserDriverWriteSmearOs(
+                               IN      tPOCT6100_WRITE_SMEAR_PARAMS                    f_pSmearParams );
+
+UINT32 Oct6100UserDriverWriteBurstApi(
+                               IN      tPOCT6100_WRITE_BURST_PARAMS                    f_pBurstParams );
+
+UINT32 Oct6100UserDriverWriteBurstOs(
+                               IN      tPOCT6100_WRITE_BURST_PARAMS                    f_pBurstParams );
+
+UINT32 Oct6100UserDriverReadApi(
+                               IN OUT  tPOCT6100_READ_PARAMS                           f_pReadParams );
+
+UINT32 Oct6100UserDriverReadOs(
+                               IN OUT  tPOCT6100_READ_PARAMS                           f_pReadParams );
+
+UINT32 Oct6100UserDriverReadBurstApi(
+                               IN OUT  tPOCT6100_READ_BURST_PARAMS                     f_pBurstParams );
+
+UINT32 Oct6100UserDriverReadBurstOs(
+                               IN OUT  tPOCT6100_READ_BURST_PARAMS                     f_pBurstParams );
+
+
+
+
+
+
+
+#endif /* __OCT6100_APIUD_H__ */
diff --git a/xpp/oct612x/include/oct6100api/oct6100_channel_inst.h b/xpp/oct612x/include/oct6100api/oct6100_channel_inst.h
new file mode 100644 (file)
index 0000000..5b71bb0
--- /dev/null
@@ -0,0 +1,374 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+
+File:  oct6100_channel_inst.h
+
+    Copyright (c) 2001-2007 Octasic Inc.
+    
+Description: 
+
+       File containing all defines, macros, and structures pertaining to the file
+       oct6100_channel.c.  All elements defined in this file are for public
+       usage of the API.  All private elements are defined in the
+       oct6100_channel_priv.h file.
+
+This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API  is 
+free software; you can redistribute it and/or modify it under the terms of 
+the GNU General Public License as published by the Free Software Foundation; 
+either version 2 of the License, or (at your option) any later version.
+
+The OCT6100 GPL API is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
+for more details. 
+
+You should have received a copy of the GNU General Public License 
+along with the OCT6100 GPL API; if not, write to the Free Software 
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+$Octasic_Release: OCT612xAPI-01.00-PR49 $
+
+$Octasic_Revision: 90 $
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+
+#ifndef __OCT6100_CHANNEL_INST_H__
+#define __OCT6100_CHANNEL_INST_H__
+
+/*****************************  INCLUDE FILES  *******************************/
+
+/*****************************  DEFINES  *************************************/
+
+/*****************************  TYPES  ***************************************/
+
+#ifndef        __KERNEL__
+#include       <stdint.h>
+#endif
+
+#ifndef        PTR_TYPE
+#define        PTR_TYPE        UINT16
+#endif
+
+typedef struct _OCT6100_API_CHANNEL_TDM_
+{
+       /* Laws. */
+       UINT8   byRinPcmLaw : 1;
+       UINT8   bySinPcmLaw : 1;
+       UINT8   byRoutPcmLaw : 1;
+       UINT8   bySoutPcmLaw : 1;
+
+       UINT8   byRinNumTssts : 1;
+       UINT8   bySinNumTssts : 1;
+       UINT8   byRoutNumTssts : 1;
+       UINT8   bySoutNumTssts : 1;
+
+       /* RIN port. */
+       UINT16  usRinTimeslot;
+       UINT16  usRinStream;
+
+       /* SIN port. */
+       UINT16  usSinTimeslot;
+       UINT16  usSinStream;
+
+       /* ROUT port. */
+       UINT16  usRoutTimeslot;
+       UINT16  usRoutStream;
+       
+       /* SOUT port. */
+       UINT16  usSoutTimeslot;
+       UINT16  usSoutStream;
+
+       /* ROUT broadcast info. */
+       UINT16  usRoutBrdcastTsstFirstEntry;
+       UINT16  usRoutBrdcastTsstNumEntry;
+
+       /* SOUT broadcast info. */
+       UINT16  usSoutBrdcastTsstFirstEntry;
+       UINT16  usSoutBrdcastTsstNumEntry;
+
+} tOCT6100_API_CHANNEL_TDM, *tPOCT6100_API_CHANNEL_TDM;
+
+typedef struct _OCT6100_API_CHANNEL_VQE_
+{
+       UINT8   fEnableNlp : 1;
+       UINT8   fEnableTailDisplacement : 1;
+       UINT8   fSinDcOffsetRemoval : 1;
+       UINT8   fRinDcOffsetRemoval : 1;
+       UINT8   fRinLevelControl : 1;
+       UINT8   fSoutLevelControl : 1;
+       UINT8   fRinAutomaticLevelControl : 1;
+       UINT8   fSoutAutomaticLevelControl : 1;
+       UINT8   fRinHighLevelCompensation : 1;
+       UINT8   fSoutAdaptiveNoiseReduction : 1;
+       UINT8   fDtmfToneRemoval : 1;
+       UINT8   fAcousticEcho : 1;
+       UINT8   byComfortNoiseMode : 1;
+       UINT8   fSoutNaturalListenerEnhancement : 1;
+       UINT8   fRoutNoiseReduction : 1;
+       UINT8   fEnableMusicProtection : 1;
+       UINT8   fIdleCodeDetection : 1;
+       UINT8   byAnrVoiceNoiseSegregation : 1;
+       UINT8   byDoubleTalkBehavior : 1;
+       UINT8   fSoutNoiseBleaching : 1;
+       UINT8   fSoutConferencingNoiseReduction : 1;
+       UINT8   bySoutAutomaticListenerEnhancementGainDb : 1;
+       UINT8   byNonLinearityBehaviorA : 1;
+       UINT8   byNonLinearityBehaviorB : 1;
+       UINT8   bySoutNaturalListenerEnhancementGainDb : 1;
+
+       OCT_INT8        chRinAutomaticLevelControlTargetDb;
+       OCT_INT8        chSoutAutomaticLevelControlTargetDb;
+       
+       OCT_INT8        chRinHighLevelCompensationThresholdDb;
+       
+       OCT_INT8        chRinLevelControlGainDb;
+       OCT_INT8        chSoutLevelControlGainDb;
+
+       OCT_INT8        chDefaultErlDb;
+       OCT_INT8        chAecDefaultErlDb;
+
+       OCT_INT8        chRoutNoiseReductionLevelGainDb;
+       OCT_INT8        chAnrSnrEnhancementDb;
+
+       UINT16  usToneDisablerVqeActivationDelay;
+       UINT16  usAecTailLength;
+
+       UINT16  usTailDisplacement;
+       UINT16  usTailLength;
+
+} tOCT6100_API_CHANNEL_VQE, *tPOCT6100_API_CHANNEL_VQE;
+
+typedef struct _OCT6100_API_CHANNEL_CODEC_
+{
+       UINT8   byAdpcmNibblePosition : 1;
+       UINT8   fEnableSilenceSuppression : 1;
+
+       UINT8   byEncoderPort : 1;
+       UINT8   byEncodingRate : 1;
+
+       UINT8   byDecoderPort : 1;
+       UINT8   byDecodingRate : 1;
+       
+       UINT8   byPhase : 1;
+       UINT8   byPhasingType : 1;
+
+} tOCT6100_API_CHANNEL_CODEC, *tPOCT6100_API_CHANNEL_CODEC;
+
+typedef struct _OCT6100_API_CHANNEL_
+{
+       /*=======================================================================*/
+       /* Channel configuration. */
+
+       /* Flag specifying whether the entry is used or not. */
+       UINT8   fReserved : 1;
+
+       /* Count used to manage entry handles allocated to user. */
+       UINT8   byEntryOpenCnt : 1;
+
+       /* Is this a bidirectionnal channel? */
+       UINT8   fBiDirChannel : 1;
+
+       /* Enable tone disabler? */
+       UINT8   fEnableToneDisabler : 1;
+
+       /* Current echo operation mode. */
+       UINT8   byEchoOperationMode : 1;
+
+       UINT8   byToneDisablerStatus : 1;
+
+       UINT8   fMute : 1;
+       UINT8   fTap : 1;
+       UINT8   fBeingTapped : 1;
+       UINT8   fCopyEventCreated : 1;
+
+       UINT8   fSoutBufPlaying : 1;
+       UINT8   fRinBufPlaying : 1;
+
+       UINT8   fRinBufPlayoutNotifyOnStop : 1;
+       UINT8   fRinBufPlayoutRepeatUsed : 1;
+
+
+       UINT8   fSoutBufPlayoutNotifyOnStop : 1;
+       UINT8   fSoutBufPlayoutRepeatUsed : 1;
+
+       UINT8   fRinHardStop : 1;
+       UINT8   fSoutHardStop : 1;
+
+       UINT8   byRinPlayoutStopEventType : 1;
+       UINT8   bySoutPlayoutStopEventType : 1;
+
+       UINT8   fRinBufAdded : 1;
+       UINT8   fSoutBufAdded : 1;
+
+       UINT8   fBufPlayoutActive : 1;
+
+       /* Enable extended tone detection. */
+       UINT8   fEnableExtToneDetection : 1;
+
+       /* State of the codec structure associated to this channel. */
+       UINT8   fSinSoutCodecActive : 1;
+       UINT8   fRinRoutCodecActive : 1;
+
+       /* TSI chariot memory entry for the Rin/Rout stream. */
+       UINT16  usRinRoutTsiMemIndex;
+
+       /* TSI chariot memory entry for the Sin/Sout stream. */
+       UINT16  usSinSoutTsiMemIndex;
+
+       /* Additional TSI entry used to temporarily store the SIN signal. */
+       UINT16  usExtraSinTsiMemIndex;
+       UINT16  usExtraSinTsiDependencyCnt;
+
+       /* Additional TSI entry used to temporarily store the RIN signal. */
+       UINT16  usExtraRinTsiMemIndex;
+       UINT16  usExtraRinTsiDependencyCnt;
+       
+       /* Conversion chariot memory entry. */
+       UINT16  usRinRoutConversionMemIndex;
+       UINT16  usSinSoutConversionMemIndex;
+       
+       /* TSST control memory entry. */
+       UINT16  usRinTsstIndex;
+       UINT16  usSinTsstIndex;
+       UINT16  usRoutTsstIndex;
+       UINT16  usSoutTsstIndex;
+
+       /* SSPX memory entry. */
+       UINT16  usEchoMemIndex;
+
+       /* Active mixer events count to test for last event. */
+       UINT16  usMixerEventCnt;
+
+       /* Copy events. */
+       UINT16  usSinCopyEventIndex;
+       UINT16  usSoutCopyEventIndex;
+       
+       /* Silence events. */
+       UINT16  usRinSilenceEventIndex;
+       UINT16  usSinSilenceEventIndex;
+
+       /* TDM configuration. */
+       tOCT6100_API_CHANNEL_TDM        TdmConfig;
+
+       /* VQE configuration. */
+       tOCT6100_API_CHANNEL_VQE        VqeConfig;
+
+       /* Currently muted ports. */
+       UINT16  usMutedPorts;
+
+       /*=======================================================================*/
+
+       /*=======================================================================*/
+       /* Statistics section. */
+
+       INT16   sComfortNoiseLevel;
+
+       UINT16  usCurrentEchoDelay;
+       UINT16  usMaxEchoDelay;
+
+       UINT16  usNumEchoPathChanges;
+       UINT16  usNumEchoPathChangesOfst;
+       
+       INT16   sCurrentERL;
+       INT16   sCurrentERLE;
+       
+       INT16   sMaxERL;
+       INT16   sMaxERLE;
+       
+       INT16   sRinLevel;
+       INT16   sSinLevel;
+       
+       INT16   sRinAppliedGain;
+       INT16   sSoutAppliedGain;
+
+       /*=======================================================================*/
+
+
+       /*=======================================================================*/
+       /* Bridge information. */
+
+       UINT16  usBridgeIndex;
+
+       UINT16  usLoadEventIndex;
+       UINT16  usSubStoreEventIndex;
+       
+       UINT16  usFlexConfParticipantIndex;
+       UINT16  usTapBridgeIndex;
+       UINT16  usTapChanIndex;
+       
+       /*=======================================================================*/
+
+
+       /*=======================================================================*/
+       /* Buffer playout information. */
+
+       PTR_TYPE        ulRinBufWritePtr;
+       PTR_TYPE        ulRinBufSkipPtr;
+       PTR_TYPE        ulSoutBufWritePtr;
+       PTR_TYPE        ulSoutBufSkipPtr;
+
+       /* User channel ID, transparently passed to the user. */
+       
+       /*=======================================================================*/
+
+
+       /*=======================================================================*/
+       /* Copy events information. */
+
+       /* Number of copy events created. */
+       UINT16  usCopyEventCnt;
+
+       /*=======================================================================*/
+
+
+       /*=======================================================================*/
+       /* Extended tone detection info. */
+
+       
+       UINT16  usExtToneChanIndex;
+       UINT16  usExtToneMixerIndex;
+       UINT16  usExtToneTsiIndex;
+
+       /* Index of the phasing TSST */
+       UINT16  usPhasingTsstIndex;
+
+       /* Mode of operation of the channel based on the extended tone detection configuration. */
+       PTR_TYPE        ulExtToneChanMode;
+
+       /*=======================================================================*/
+
+       /* Tone detection state. */
+       /* This array is configured as follow. */
+       /* Index 0 contain event 0 to 31 and Index 1 contains event 32 - 55 */
+       PTR_TYPE        ulLastSSToneDetected;
+       PTR_TYPE        ulLastSSToneTimestamp;
+
+
+       PTR_TYPE        ulRinUserBufPlayoutEventId;
+       PTR_TYPE        ulSoutUserBufPlayoutEventId;
+
+       UINT32  aulToneConf[2];
+       UINT32  ulUserChanId;
+       /*=======================================================================*/
+
+
+       /*=======================================================================*/
+
+
+       /* Codec configuration. */
+       tOCT6100_API_CHANNEL_CODEC      CodecConfig;
+
+} tOCT6100_API_CHANNEL, *tPOCT6100_API_CHANNEL;
+
+typedef struct _OCT6100_API_BIDIR_CHANNEL_
+{
+       UINT16  usFirstChanIndex;
+       UINT16  usSecondChanIndex;
+       
+       /* Flag specifying whether the entry is used or not. */
+       UINT8   fReserved : 1;
+       /* Count used to manage entry handles allocated to user. */
+       UINT8   byEntryOpenCnt : 1;
+
+} tOCT6100_API_BIDIR_CHANNEL, *tPOCT6100_API_BIDIR_CHANNEL;
+
+#endif /* __OCT6100_CHANNEL_INST_H__ */
diff --git a/xpp/oct612x/include/oct6100api/oct6100_channel_pub.h b/xpp/oct612x/include/oct6100api/oct6100_channel_pub.h
new file mode 100644 (file)
index 0000000..2691e10
--- /dev/null
@@ -0,0 +1,547 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+
+File:  oct6100_channel_pub.h
+
+    Copyright (c) 2001-2007 Octasic Inc.
+    
+Description: 
+
+       File containing all defines, macros, and structures pertaining to the file
+       oct6100_channel.c.  All elements defined in this file are for public
+       usage of the API.  All private elements are defined in the
+       oct6100_channel_priv.h file.
+
+This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API  is 
+free software; you can redistribute it and/or modify it under the terms of 
+the GNU General Public License as published by the Free Software Foundation; 
+either version 2 of the License, or (at your option) any later version.
+
+The OCT6100 GPL API is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
+for more details. 
+
+You should have received a copy of the GNU General Public License 
+along with the OCT6100 GPL API; if not, write to the Free Software 
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+$Octasic_Release: OCT612xAPI-01.00-PR49 $
+
+$Octasic_Revision: 84 $
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+
+#ifndef __OCT6100_CHANNEL_PUB_H__
+#define __OCT6100_CHANNEL_PUB_H__
+
+/*****************************  INCLUDE FILES  *******************************/
+
+
+/*****************************  DEFINES  *************************************/
+
+
+/*****************************  TYPES  ***************************************/
+
+/* Channel open structures. */
+typedef struct _OCT6100_CHANNEL_OPEN_TDM_
+{
+       UINT32  ulRinNumTssts;
+       UINT32  ulSinNumTssts;
+       UINT32  ulRoutNumTssts;
+       UINT32  ulSoutNumTssts;
+
+       UINT32  ulSinTimeslot;
+       UINT32  ulSinStream;
+       UINT32  ulSinPcmLaw;
+
+       UINT32  ulSoutTimeslot;
+       UINT32  ulSoutStream;
+       UINT32  ulSoutPcmLaw;
+
+       UINT32  ulRinTimeslot;
+       UINT32  ulRinStream;
+       UINT32  ulRinPcmLaw;
+
+       UINT32  ulRoutTimeslot;
+       UINT32  ulRoutStream;
+       UINT32  ulRoutPcmLaw;
+
+} tOCT6100_CHANNEL_OPEN_TDM, *tPOCT6100_CHANNEL_OPEN_TDM;
+
+typedef struct _OCT6100_CHANNEL_OPEN_VQE_
+{
+       BOOL    fEnableNlp;
+       BOOL    fEnableTailDisplacement;
+       UINT32  ulTailDisplacement;
+       UINT32  ulTailLength;
+
+       BOOL    fSinDcOffsetRemoval;
+       BOOL    fRinDcOffsetRemoval;
+       BOOL    fRinLevelControl;
+       BOOL    fSoutLevelControl;
+       BOOL    fRinAutomaticLevelControl;
+       BOOL    fSoutAutomaticLevelControl;
+       BOOL    fRinHighLevelCompensation;
+       BOOL    fAcousticEcho;
+       BOOL    fSoutAdaptiveNoiseReduction;
+       BOOL    fDtmfToneRemoval;
+
+       BOOL    fSoutNoiseBleaching;
+       BOOL    fSoutConferencingNoiseReduction;
+
+       UINT32  ulComfortNoiseMode;
+       UINT32  ulNonLinearityBehaviorA;
+       UINT32  ulNonLinearityBehaviorB;
+
+       INT32   lRinLevelControlGainDb;
+       INT32   lSoutLevelControlGainDb;
+       INT32   lRinAutomaticLevelControlTargetDb;
+       INT32   lSoutAutomaticLevelControlTargetDb;
+       INT32   lRinHighLevelCompensationThresholdDb;
+       INT32   lDefaultErlDb;
+       INT32   lAecDefaultErlDb;
+       UINT32  ulAecTailLength;
+       UINT32  ulSoutAutomaticListenerEnhancementGainDb;
+       UINT32  ulSoutNaturalListenerEnhancementGainDb;
+       BOOL    fSoutNaturalListenerEnhancement;
+       BOOL    fRoutNoiseReduction;
+       INT32   lRoutNoiseReductionLevelGainDb;
+       INT32   lAnrSnrEnhancementDb;
+       UINT32  ulAnrVoiceNoiseSegregation;
+       UINT32  ulDoubleTalkBehavior;
+       
+       UINT32  ulToneDisablerVqeActivationDelay;
+
+       BOOL    fEnableMusicProtection;
+       BOOL    fIdleCodeDetection;
+       
+
+
+} tOCT6100_CHANNEL_OPEN_VQE, *tPOCT6100_CHANNEL_OPEN_VQE;
+
+typedef struct _OCT6100_CHANNEL_OPEN_CODEC_
+{
+       UINT32  ulAdpcmNibblePosition;
+
+       UINT32  ulEncoderPort;
+       UINT32  ulEncodingRate;
+
+       UINT32  ulDecoderPort;
+       UINT32  ulDecodingRate;
+
+       BOOL    fEnableSilenceSuppression;
+       UINT32  ulPhase;
+       UINT32  ulPhasingType;
+       UINT32  ulPhasingTsstHndl;
+
+} tOCT6100_CHANNEL_OPEN_CODEC, *tPOCT6100_CHANNEL_OPEN_CODEC;
+
+typedef struct _OCT6100_CHANNEL_OPEN_
+{
+       PUINT32 pulChannelHndl;
+       UINT32  ulUserChanId;
+
+       UINT32  ulEchoOperationMode;
+
+       BOOL    fEnableToneDisabler;
+
+       BOOL    fEnableExtToneDetection;
+
+       tOCT6100_CHANNEL_OPEN_TDM       TdmConfig;
+       tOCT6100_CHANNEL_OPEN_VQE       VqeConfig;
+       tOCT6100_CHANNEL_OPEN_CODEC     CodecConfig;
+
+
+
+} tOCT6100_CHANNEL_OPEN, *tPOCT6100_CHANNEL_OPEN;
+
+/* Channel close structure. */
+typedef struct _OCT6100_CHANNEL_CLOSE_
+{
+       UINT32  ulChannelHndl;
+
+} tOCT6100_CHANNEL_CLOSE, *tPOCT6100_CHANNEL_CLOSE;
+
+/* Channel modify structures. */
+typedef struct _OCT6100_CHANNEL_MODIFY_TDM_
+{
+       UINT32  ulRinNumTssts;
+       UINT32  ulSinNumTssts;
+       UINT32  ulRoutNumTssts;
+       UINT32  ulSoutNumTssts;
+       
+       UINT32  ulSinTimeslot;
+       UINT32  ulSinStream;
+       UINT32  ulSinPcmLaw;
+
+       UINT32  ulSoutTimeslot;
+       UINT32  ulSoutStream;
+       UINT32  ulSoutPcmLaw;
+
+       UINT32  ulRinTimeslot;
+       UINT32  ulRinStream;
+       UINT32  ulRinPcmLaw;
+
+       UINT32  ulRoutTimeslot;
+       UINT32  ulRoutStream;
+       UINT32  ulRoutPcmLaw;
+
+} tOCT6100_CHANNEL_MODIFY_TDM, *tPOCT6100_CHANNEL_MODIFY_TDM;
+
+typedef struct _OCT6100_CHANNEL_MODIFY_VQE_
+{
+       BOOL    fEnableNlp;
+       BOOL    fEnableTailDisplacement;
+       UINT32  ulTailDisplacement;
+
+       BOOL    fSinDcOffsetRemoval;
+       BOOL    fRinDcOffsetRemoval;
+       BOOL    fRinLevelControl;
+       BOOL    fSoutLevelControl;
+       BOOL    fRinAutomaticLevelControl;
+       BOOL    fSoutAutomaticLevelControl;
+       BOOL    fRinHighLevelCompensation;
+       BOOL    fAcousticEcho;
+       BOOL    fSoutAdaptiveNoiseReduction;
+       BOOL    fDtmfToneRemoval;
+
+       BOOL    fSoutConferencingNoiseReduction;
+       BOOL    fSoutNoiseBleaching;
+
+       UINT32  ulNonLinearityBehaviorA;
+       UINT32  ulNonLinearityBehaviorB;
+       UINT32  ulComfortNoiseMode;
+
+       INT32   lRinLevelControlGainDb;
+       INT32   lSoutLevelControlGainDb;
+       INT32   lRinAutomaticLevelControlTargetDb;
+       INT32   lSoutAutomaticLevelControlTargetDb;
+       INT32   lRinHighLevelCompensationThresholdDb;
+       INT32   lDefaultErlDb;
+       INT32   lAecDefaultErlDb;
+       UINT32  ulAecTailLength;
+       UINT32  ulSoutAutomaticListenerEnhancementGainDb;
+       UINT32  ulSoutNaturalListenerEnhancementGainDb;
+       BOOL    fSoutNaturalListenerEnhancement;
+       BOOL    fRoutNoiseReduction;
+       INT32   lRoutNoiseReductionLevelGainDb;
+       INT32   lAnrSnrEnhancementDb;
+       UINT32  ulAnrVoiceNoiseSegregation;
+       UINT32  ulDoubleTalkBehavior;
+
+       UINT32  ulToneDisablerVqeActivationDelay;
+
+       BOOL    fEnableMusicProtection;
+       BOOL    fIdleCodeDetection;
+
+
+
+} tOCT6100_CHANNEL_MODIFY_VQE, *tPOCT6100_CHANNEL_MODIFY_VQE;
+
+typedef struct _OCT6100_CHANNEL_MODIFY_CODEC_
+{
+       UINT32  ulEncoderPort;
+       UINT32  ulEncodingRate;
+
+       UINT32  ulDecoderPort;
+       UINT32  ulDecodingRate;
+
+       BOOL    fEnableSilenceSuppression;
+       UINT32  ulPhase;
+       UINT32  ulPhasingType;
+       UINT32  ulPhasingTsstHndl;
+
+} tOCT6100_CHANNEL_MODIFY_CODEC, *tPOCT6100_CHANNEL_MODIFY_CODEC;
+
+typedef struct _OCT6100_CHANNEL_MODIFY_
+{
+       UINT32  ulChannelHndl;
+       UINT32  ulUserChanId;
+       UINT32  ulEchoOperationMode;
+
+       BOOL    fEnableToneDisabler;
+       
+       BOOL    fApplyToAllChannels;
+       
+       BOOL    fDisableToneDetection;
+       BOOL    fStopBufferPlayout;
+       BOOL    fRemoveConfBridgeParticipant;
+       BOOL    fRemoveBroadcastTssts;
+
+       BOOL    fTdmConfigModified;             /* TRUE/FALSE */
+       BOOL    fVqeConfigModified;             /* TRUE/FALSE */
+       BOOL    fCodecConfigModified;   /* TRUE/FALSE */
+
+
+       tOCT6100_CHANNEL_MODIFY_TDM             TdmConfig;
+       tOCT6100_CHANNEL_MODIFY_VQE             VqeConfig;
+       tOCT6100_CHANNEL_MODIFY_CODEC   CodecConfig;
+
+} tOCT6100_CHANNEL_MODIFY, *tPOCT6100_CHANNEL_MODIFY;
+
+typedef struct _OCT6100_CHANNEL_BROADCAST_TSST_ADD_
+{
+       UINT32  ulChannelHndl;
+
+       UINT32  ulPort;
+       UINT32  ulTimeslot;
+       UINT32  ulStream;
+
+} tOCT6100_CHANNEL_BROADCAST_TSST_ADD, *tPOCT6100_CHANNEL_BROADCAST_TSST_ADD;
+
+typedef struct _OCT6100_CHANNEL_BROADCAST_TSST_REMOVE_
+{
+       UINT32  ulChannelHndl;
+
+       UINT32  ulPort;
+       UINT32  ulTimeslot;
+       UINT32  ulStream;
+
+       BOOL    fRemoveAll;
+
+} tOCT6100_CHANNEL_BROADCAST_TSST_REMOVE, *tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE;
+
+/* Channel open structures.*/
+typedef struct _OCT6100_CHANNEL_STATS_TDM_
+{
+       UINT32  ulMaxBroadcastTssts;
+       UINT32  ulNumRoutBroadcastTssts;
+       BOOL    fMoreRoutBroadcastTssts;
+       UINT32  ulNumSoutBroadcastTssts;
+       BOOL    fMoreSoutBroadcastTssts;
+
+       UINT32  ulSinNumTssts;
+       UINT32  ulSoutNumTssts;
+       UINT32  ulRinNumTssts;
+       UINT32  ulRoutNumTssts;
+
+       UINT32  ulSinTimeslot;
+       UINT32  ulSinStream;
+       UINT32  ulSinPcmLaw;
+
+       UINT32  ulSoutTimeslot;
+       UINT32  ulSoutStream;
+       UINT32  ulSoutPcmLaw;
+
+       PUINT32 pulSoutBroadcastTimeslot;
+       PUINT32 pulSoutBroadcastStream;
+       
+       UINT32  ulRinTimeslot;
+       UINT32  ulRinStream;
+       UINT32  ulRinPcmLaw;
+
+       UINT32  ulRoutTimeslot;
+       UINT32  ulRoutStream;
+       UINT32  ulRoutPcmLaw;
+
+       PUINT32 pulRoutBroadcastTimeslot;
+       PUINT32 pulRoutBroadcastStream;
+
+} tOCT6100_CHANNEL_STATS_TDM, *tPOCT6100_CHANNEL_STATS_TDM;
+
+typedef struct _OCT6100_CHANNEL_STATS_VQE_
+{
+       BOOL    fEnableNlp;
+       BOOL    fEnableTailDisplacement;
+       UINT32  ulTailDisplacement;
+       UINT32  ulTailLength;
+
+       BOOL    fSinDcOffsetRemoval;
+       BOOL    fRinDcOffsetRemoval;
+       BOOL    fRinLevelControl;
+       BOOL    fSoutLevelControl;
+       BOOL    fRinAutomaticLevelControl;
+       BOOL    fSoutAutomaticLevelControl;
+       BOOL    fRinHighLevelCompensation;
+       BOOL    fAcousticEcho;
+       BOOL    fSoutAdaptiveNoiseReduction;
+       BOOL    fDtmfToneRemoval;
+
+       BOOL    fSoutConferencingNoiseReduction;
+       BOOL    fSoutNoiseBleaching;
+       
+       UINT32  ulComfortNoiseMode;
+       UINT32  ulNonLinearityBehaviorA;
+       UINT32  ulNonLinearityBehaviorB;
+
+       INT32   lRinLevelControlGainDb;
+       INT32   lSoutLevelControlGainDb;
+       INT32   lRinAutomaticLevelControlTargetDb;
+       INT32   lSoutAutomaticLevelControlTargetDb;
+       INT32   lRinHighLevelCompensationThresholdDb;
+       INT32   lDefaultErlDb;
+       INT32   lAecDefaultErlDb;
+       UINT32  ulAecTailLength;
+       UINT32  ulSoutAutomaticListenerEnhancementGainDb;
+       UINT32  ulSoutNaturalListenerEnhancementGainDb;
+       BOOL    fSoutNaturalListenerEnhancement;
+       BOOL    fRoutNoiseReduction;
+       INT32   lRoutNoiseReductionLevelGainDb;
+       INT32   lAnrSnrEnhancementDb;
+       UINT32  ulAnrVoiceNoiseSegregation;
+       UINT32  ulDoubleTalkBehavior;
+
+       UINT32  ulToneDisablerVqeActivationDelay;
+
+       BOOL    fEnableMusicProtection;
+       BOOL    fIdleCodeDetection;
+
+
+
+} tOCT6100_CHANNEL_STATS_VQE, *tPOCT6100_CHANNEL_STATS_VQE;
+
+typedef struct _OCT6100_CHANNEL_STATS_CODEC_
+{
+       UINT32  ulAdpcmNibblePosition;
+
+       UINT32  ulEncoderPort;
+       UINT32  ulEncodingRate;
+
+       UINT32  ulDecoderPort;
+       UINT32  ulDecodingRate;
+
+       BOOL    fEnableSilenceSuppression;
+       UINT32  ulPhase;
+       UINT32  ulPhasingType;
+       UINT32  ulPhasingTsstHndl;
+
+} tOCT6100_CHANNEL_STATS_CODEC, *tPOCT6100_CHANNEL_STATS_CODEC;
+
+typedef struct _OCT6100_CHANNEL_STATS_
+{
+       BOOL    fResetStats;
+       
+       UINT32  ulChannelHndl;
+       UINT32  ulUserChanId;
+
+       UINT32  ulEchoOperationMode;
+       BOOL    fEnableToneDisabler;
+
+       UINT32  ulMutePortsMask;
+       BOOL    fEnableExtToneDetection;
+
+       tOCT6100_CHANNEL_STATS_TDM              TdmConfig;
+       tOCT6100_CHANNEL_STATS_VQE              VqeConfig;
+       tOCT6100_CHANNEL_STATS_CODEC    CodecConfig;
+
+       /* Real stats. */
+       UINT32  ulNumEchoPathChanges;
+       UINT32  ulToneDisablerStatus;
+
+       INT32   lCurrentERL;
+       INT32   lCurrentERLE;
+       UINT32  ulCurrentEchoDelay;
+
+       INT32   lMaxERL;
+       INT32   lMaxERLE;
+       UINT32  ulMaxEchoDelay;
+
+       INT32   lRinLevel;
+       INT32   lSinLevel;
+       INT32   lRinAppliedGain;
+       INT32   lSoutAppliedGain;
+       INT32   lComfortNoiseLevel;
+       
+       BOOL    fEchoCancellerConverged;
+       BOOL    fSinVoiceDetected;
+
+
+
+} tOCT6100_CHANNEL_STATS, *tPOCT6100_CHANNEL_STATS;
+
+typedef struct _OCT6100_CHANNEL_CREATE_BIDIR_
+{
+       PUINT32 pulBiDirChannelHndl;
+
+       UINT32  ulFirstChannelHndl;
+       UINT32  ulSecondChannelHndl;
+       
+
+
+} tOCT6100_CHANNEL_CREATE_BIDIR, *tPOCT6100_CHANNEL_CREATE_BIDIR;
+
+typedef struct _OCT6100_CHANNEL_DESTROY_BIDIR_
+{
+       UINT32  ulBiDirChannelHndl;
+
+} tOCT6100_CHANNEL_DESTROY_BIDIR, *tPOCT6100_CHANNEL_DESTROY_BIDIR;
+
+typedef struct _OCT6100_CHANNEL_MUTE_
+{
+       UINT32  ulChannelHndl;
+       UINT32  ulPortMask;
+
+} tOCT6100_CHANNEL_MUTE, *tPOCT6100_CHANNEL_MUTE;
+
+typedef struct _OCT6100_CHANNEL_UNMUTE_
+{
+       UINT32  ulChannelHndl;
+       UINT32  ulPortMask;
+
+} tOCT6100_CHANNEL_UNMUTE, *tPOCT6100_CHANNEL_UNMUTE;
+
+
+/************************** FUNCTION PROTOTYPES  *****************************/
+
+
+UINT32 Oct6100ChannelOpenDef(
+                               OUT             tPOCT6100_CHANNEL_OPEN                                  f_pChannelOpen );
+UINT32 Oct6100ChannelOpen(
+                               IN OUT  tPOCT6100_INSTANCE_API                                  f_pApiInstance,
+                               IN OUT  tPOCT6100_CHANNEL_OPEN                                  f_pChannelOpen );
+
+UINT32 Oct6100ChannelCloseDef(
+                               OUT             tPOCT6100_CHANNEL_CLOSE                                 f_pChannelClose );
+UINT32 Oct6100ChannelClose(
+                               IN OUT  tPOCT6100_INSTANCE_API                                  f_pApiInstance,
+                               IN OUT  tPOCT6100_CHANNEL_CLOSE                                 f_pChannelClose );
+
+UINT32 Oct6100ChannelModifyDef(
+                               OUT             tPOCT6100_CHANNEL_MODIFY                                f_pChannelModify );
+UINT32 Oct6100ChannelModify(
+                               IN OUT  tPOCT6100_INSTANCE_API                                  f_pApiInstance,
+                               IN OUT  tPOCT6100_CHANNEL_MODIFY                                f_pChannelModify );
+
+UINT32 Oct6100ChannelBroadcastTsstAddDef(
+                               OUT             tPOCT6100_CHANNEL_BROADCAST_TSST_ADD    f_pChannelTsstAdd );
+UINT32 Oct6100ChannelBroadcastTsstAdd(
+                               IN OUT  tPOCT6100_INSTANCE_API                                  f_pApiInstance,
+                               IN OUT  tPOCT6100_CHANNEL_BROADCAST_TSST_ADD    f_pChannelTsstAdd );
+
+UINT32 Oct6100ChannelBroadcastTsstRemoveDef(
+                               OUT             tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelTsstRemove );
+UINT32 Oct6100ChannelBroadcastTsstRemove(
+                               IN OUT  tPOCT6100_INSTANCE_API                                  f_pApiInstance,
+                               IN OUT  tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelTsstRemove );
+
+UINT32 Oct6100ChannelGetStatsDef(
+                               OUT             tPOCT6100_CHANNEL_STATS                                 f_pChannelStats );
+UINT32 Oct6100ChannelGetStats(
+                               IN OUT  tPOCT6100_INSTANCE_API                                  f_pApiInstance,
+                               IN OUT  tPOCT6100_CHANNEL_STATS                                 f_pChannelStats );
+
+UINT32 Oct6100ChannelCreateBiDirDef(
+                               OUT             tPOCT6100_CHANNEL_CREATE_BIDIR                  f_pChannelCreateBiDir );
+UINT32 Oct6100ChannelCreateBiDir(
+                               IN OUT  tPOCT6100_INSTANCE_API                                  f_pApiInstance,
+                               IN OUT  tPOCT6100_CHANNEL_CREATE_BIDIR                  f_pChannelCreateBiDir );
+
+UINT32 Oct6100ChannelDestroyBiDirDef(
+                               OUT             tPOCT6100_CHANNEL_DESTROY_BIDIR                 f_pChannelDestroyBiDir );
+UINT32 Oct6100ChannelDestroyBiDir(
+                               IN OUT  tPOCT6100_INSTANCE_API                                  f_pApiInstance,
+                               IN OUT  tPOCT6100_CHANNEL_DESTROY_BIDIR                 f_pChannelDestroyBiDir );
+
+UINT32 Oct6100ChannelMuteDef(
+                               OUT             tPOCT6100_CHANNEL_MUTE                                  f_pChannelMute );
+UINT32 Oct6100ChannelMute(
+                               IN OUT  tPOCT6100_INSTANCE_API                                  f_pApiInstance,
+                               IN OUT  tPOCT6100_CHANNEL_MUTE                                  f_pChannelMute );
+
+UINT32 Oct6100ChannelUnMuteDef(
+                               OUT  &n