blob: 5d8ae5391e5ef35d8a3be4eaea71e1d372e1c736 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
#ifndef _VPM150M_H
#define _VPM150M_H
#include "../zaptel.h"
#include "wcte12xp.h"
#include <linux/pci.h>
#include <linux/firmware.h>
#include <linux/list.h>
struct t1_firmware {
const struct firmware *fw;
unsigned int offset;
};
/* Host and DSP system dependent related definitions. */
#define MAX_DSP_CORES 128 /* maximum number of DSP cores */
//#define MAX_CONFS 1 /* maximum number of conferences */
//#define MAX_PKT_CHANNELS 8 /* maximum number of packet channels */
#define MAX_CHANNELS 32 /* maximum number of channels */
#define MAX_WAIT_LOOPS 50 /* max number of wait delay loops */
#define DSP_IFBLK_ADDRESS 0x0100 /* DSP address of I/F block pointer */
#define DOWNLOAD_BLOCK_SIZE 512 /* download block size (DSP words) */
//#define MAX_CIDPAYLOAD_BYTES 512 /* max size of a CID payload (octets) */
typedef unsigned short DSP_WORD; /* 16 bit DSP word */
typedef unsigned int DSP_ADDRESS; /* 32 bit DSP address */
typedef struct t1_firmware* GPAK_FILE_ID; /* G.PAK Download file identifier */
#define __VPM150M_RWPAGE (1 << 4)
#define __VPM150M_RD (1 << 3)
#define __VPM150M_WR (1 << 2)
#define __VPM150M_FIN (1 << 1)
#define __VPM150M_TX (1 << 0)
#define VPM150M_HPI_CONTROL 0x00
#define VPM150M_HPI_ADDRESS 0x02
#define VPM150M_HPI_DATA 0x03
#define VPM150M_MAX_COMMANDS 8
/* Some Bit ops for different operations */
#define VPM150M_SPIRESET 0
#define VPM150M_HPIRESET 1
#define VPM150M_SWRESET 2
#define VPM150M_DTMFDETECT 3
#define VPM150M_ACTIVE 4
#define VPM150M_MAX_DATA 1
static const char *vpm150m_firmware = "VPMADT032.bin";
struct vpm150m_cmd {
unsigned short address;
unsigned short data[VPM150M_MAX_DATA];
unsigned char ident;
unsigned char datalen;
unsigned int flags;
unsigned char cs_slot;
};
struct vpm150m {
unsigned short dspid;
unsigned long control;
unsigned char curpage;
unsigned short version;
struct vpm150m_cmd cmdq[VPM150M_MAX_COMMANDS];
spinlock_t lock; /* control access to list of bottom half tasks */
struct semaphore sem;
struct workqueue_struct *wq;
struct work_struct work_dtmf;
struct work_struct work_debug;
struct work_struct work_echocan;
struct list_head worklist;
unsigned char curtone[32];
unsigned long curdtmfmutestate;
unsigned long desireddtmfmutestate;
struct t1 *wc;
};
/* linked list for vpm echocan workqueue*/
struct vpm150m_workentry {
struct list_head list;
struct t1 *wc; /* what card are we dealing with? */
struct zt_chan *chan; /* what channels are we going to deal with? */
int eclen; /* how should we behave? */
};
extern int debug;
extern int vpmsupport;
extern int vpmdtmfsupport;
extern struct pci_driver te12xp_driver;
void t1_vpm150m_init(struct t1 *wc);
void vpm150m_cmd_dequeue(struct t1 *wc, volatile unsigned char *writechunk, int whichframe);
void vpm150m_cmd_decipher(struct t1 *wc, volatile unsigned char *readchunk);
int vpm150m_config_hw(struct t1 *wc);
/* gpak API functions */
void gpakReadDspMemory(
unsigned short int DspId, /* DSP Identifier (0 to MAX_DSP_CORES-1) */
DSP_ADDRESS DspAddress, /* DSP's memory address of first word */
unsigned int NumWords, /* number of contiguous words to read */
DSP_WORD *pWordValues /* pointer to array of word values variable */
);
void gpakWriteDspMemory(
unsigned short int DspId, /* DSP Identifier (0 to MAX_DSP_CORES-1) */
DSP_ADDRESS DspAddress, /* DSP's memory address of first word */
unsigned int NumWords, /* number of contiguous words to write */
DSP_WORD *pWordValues /* pointer to array of word values to write */
);
void gpakHostDelay(void);
void gpakLockAccess(
unsigned short int DspId /* DSP Identifier (0 to MAX_DSP_CORES-1) */
);
void gpakUnlockAccess(
unsigned short int DspId /* DSP Identifier (0 to MAX_DSP_CORES-1) */
);
int gpakReadFile(
GPAK_FILE_ID FileId, /* G.PAK Download File Identifier */
unsigned char *pBuffer, /* pointer to buffer for storing bytes */
unsigned int NumBytes /* number of bytes to read */
);
#endif
|