From 2d939361e5740352dd9e5446a35d8e6cb8b6f772 Mon Sep 17 00:00:00 2001 From: jsloan Date: Mon, 11 Jun 2007 16:14:07 +0000 Subject: Revert earlier erred commit git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@2625 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- wctc4xxp/base.c | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 164 insertions(+), 5 deletions(-) diff --git a/wctc4xxp/base.c b/wctc4xxp/base.c index db9d5a8..6ff049f 100644 --- a/wctc4xxp/base.c +++ b/wctc4xxp/base.c @@ -1,3 +1,164 @@ +/* + * Wildcard TC400B Driver + * + * Written by John Sloan + * + * Copyright (C) 2006, Digium, Inc. + * + * All rights reserved. + * + * This program 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. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef CONFIG_DEVFS_FS +#include +#endif +#ifdef STANDALONE_ZAPATA +#include "zaptel.h" +#else +#include +#endif + +#ifdef HOTPLUG_FIRMWARE +static const char *dte_firmware = "tc400m-firmware.bin"; +#else +extern u8 _binary_tc400m_firmware_bin_start[]; +extern void _binary_tc400m_firmware_bin_size; +#endif + + +/* #define USE_TEST_HW */ +#define USE_TDM_CONFIG +#define QUIET_DSP + +#define WC_MAX_IFACES 128 + +#define NUM_CARDS 24 +#define NUM_EC 4 + +/* NUM_CHANNELS must be checked if new firmware (dte_firm.h) is used */ +#define NUM_CHANNELS 97 + +#define DTE_FORMAT_ULAW 0x00 +#define DTE_FORMAT_G723_1 0x04 +#define DTE_FORMAT_ALAW 0x08 +#define DTE_FORMAT_G729A 0x12 +#define DTE_FORMAT_UNDEF 0xFF + +#define G729_LENGTH 20 +#define G723_LENGTH 30 + +#define G729_SAMPLES 160 /* g.729 */ +#define G723_SAMPLES 240 /* g.723 */ + +#define G729_BYTES 20 /* g.729 */ +#define G723_BYTES 20 /* g.723 */ + + + +#define ACK_SPACE 20 + +#define MAX_COMMANDS (NUM_CHANNELS + ACK_SPACE) +#define MAX_RCV_COMMANDS 16 + +/* 1432 for boot, 274 for 30msec ulaw, 194 for 20mec ulaw */ +#define BOOT_CMD_LEN 1500 +#define OTHER_CMD_LEN 300 + +#define MAX_COMMAND_LEN BOOT_CMD_LEN /* Must be the larger of BOOT_CMD_LEN or OTHER_CMD_LEN */ + +#define ERING_SIZE (NUM_CHANNELS / 2) /* Maximum ring size */ + +#define SFRAME_SIZE MAX_COMMAND_LEN + +#define PCI_WINDOW_SIZE ((2* 2 * ERING_SIZE * SFRAME_SIZE) + (2 * ERING_SIZE * 4)) + +#define MDIO_SHIFT_CLK 0x10000 +#define MDIO_DATA_WRITE0 0x00000 +#define MDIO_DATA_WRITE1 0x20000 +#define MDIO_ENB 0x00000 +#define MDIO_ENB_IN 0x40000 +#define MDIO_DATA_READ 0x80000 + +#define RCV_CSMENCAPS 1 +#define RCV_RTP 2 +#define RCV_CSMENCAPS_ACK 3 +#define RCV_OTHER 99 + + +/* TDM Commands */ +#define CMD_MSG_TDM_SELECT_BUS_MODE_LEN 30 +#define CMD_MSG_TDM_SELECT_BUS_MODE(s) { \ + 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ + 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0A, 0x01, 0x00,0x06,0x17,0x04, 0xFF,0xFF, \ + 0x04,0x00 } +#define CMD_MSG_TDM_ENABLE_BUS_LEN 30 +#define CMD_MSG_TDM_ENABLE_BUS(s) { \ + 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ + 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0A, 0x02, 0x00,0x06,0x05,0x04, 0xFF,0xFF, \ + 0x04,0x00 } +#define CMD_MSG_SUPVSR_SETUP_TDM_PARMS_LEN 34 +#define CMD_MSG_SUPVSR_SETUP_TDM_PARMS(s,p1,p2,p3) { \ + 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ + 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x10, p1, 0x00,0x06,0x07,0x04, 0xFF,0xFF, \ + p2,0x83, 0x00,0x0C, 0x00,0x00, p3,0x00 } +#define CMD_MSG_TDM_OPT_LEN 30 +#define CMD_MSG_TDM_OPT(s) { \ + 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ + 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0A, 0x00, 0x00,0x06,0x35,0x04, 0xFF,0xFF, \ + 0x00,0x00 } +#define CMD_MSG_DEVICE_SET_COUNTRY_CODE_LEN 30 +#define CMD_MSG_DEVICE_SET_COUNTRY_CODE(s) { \ + 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ + 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0A, 0x00, 0x00,0x06,0x1B,0x04, 0xFF,0xFF, \ + 0x00,0x00 } + +/* CPU Commands */ +#define CMD_MSG_SET_ARM_CLK_LEN 32 +#define CMD_MSG_SET_ARM_CLK(s) { \ + 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ + 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0C, 0x00, 0x00,0x06,0x11,0x04, 0x00,0x00, \ + 0x2C,0x01, 0x00,0x00 } +#define CMD_MSG_SET_SPU_CLK_LEN 32 +#define CMD_MSG_SET_SPU_CLK(s) { \ + 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ + 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0C, 0x00, 0x00,0x06,0x12,0x04, 0x00,0x00, \ + 0x2C,0x01, 0x00,0x00 } +#define CMD_MSG_SPU_FEATURES_CONTROL_LEN 30 +#define CMD_MSG_SPU_FEATURES_CONTROL(s,p1) { \ 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0A, 0x00, 0x00,0x06,0x13,0x00, 0xFF,0xFF, \ p1,0x00 } @@ -199,8 +360,7 @@ struct wcdte_desc { int flags; }; -static struct wcdte_desc wctc400 = { "Wildcard TC400P+TC400M", 0 }; -static struct wcdte_desc wctce400 = { "Wildcard TCE400+TC400M", 0 }; +static struct wcdte_desc wcdte = { "Wildcard TC400P+TC400M", 0 }; static struct wcdte *ifaces[WC_MAX_IFACES]; @@ -1659,10 +1819,9 @@ static void __devexit wcdte_remove_one(struct pci_dev *pdev) static struct pci_device_id wcdte_pci_tbl[] = { #ifndef USE_TEST_HW - { 0xd161, 0x3400, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &wctc400 }, /* Digium board */ - { 0xd161, 0x8004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &wctce400 }, /* Digium board */ + { 0xd161, 0x3400, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &wcdte }, /* Digium board */ #else - { 0x1317, 0x0985, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &wctc400 }, /* reference board */ + { 0x1317, 0x0985, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &wcdte }, /* reference board */ #endif { 0 } }; -- cgit v1.2.3