2
* Copyright (c) 2005, Adaptive Digital Technologies, Inc.
4
* File Name: GpakCust.h
7
* This file contains host system dependent definitions and prototypes of
8
* functions to support generic G.PAK API functions. The file is used when
9
* integrating G.PAK API functions in a specific host processor environment.
11
* Note: This file may need to be modified by the G.PAK system integrator.
16
* 06/15/05 - Initial release.
18
* This program has been released under the terms of the GPL version 2 by
19
* permission of Adaptive Digital Technologies, Inc.
24
* See http://www.asterisk.org for more information about
25
* the Asterisk project. Please do not directly contact
26
* any of the maintainers of this project for assistance;
27
* the project provides a web site, mailing lists and IRC
28
* channels for your use.
30
* This program is free software, distributed under the terms of
31
* the GNU General Public License Version 2 as published by the
32
* Free Software Foundation. See the LICENSE file included with
33
* this program for more details.
36
#ifndef _GPAKCUST_H /* prevent multiple inclusion */
39
#include "wctdm24xxp.h"
40
#ifdef VPM150M_SUPPORT
41
#include <linux/device.h>
42
#include <linux/firmware.h>
47
struct wctdm_firmware {
48
const struct firmware *fw;
52
/* Host and DSP system dependent related definitions. */
53
#define MAX_DSP_CORES 128 /* maximum number of DSP cores */
54
//#define MAX_CONFS 1 /* maximum number of conferences */
55
//#define MAX_PKT_CHANNELS 8 /* maximum number of packet channels */
56
#define MAX_CHANNELS 32 /* maximum number of channels */
57
#define MAX_WAIT_LOOPS 50 /* max number of wait delay loops */
58
#define DSP_IFBLK_ADDRESS 0x0100 /* DSP address of I/F block pointer */
59
#define DOWNLOAD_BLOCK_SIZE 512 /* download block size (DSP words) */
60
//#define MAX_CIDPAYLOAD_BYTES 512 /* max size of a CID payload (octets) */
61
typedef unsigned short DSP_WORD; /* 16 bit DSP word */
62
typedef unsigned int DSP_ADDRESS; /* 32 bit DSP address */
63
typedef struct wctdm_firmware* GPAK_FILE_ID; /* G.PAK Download file identifier */
65
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
66
* gpakReadDspMemory - Read DSP memory.
69
* This function reads a contiguous block of words from DSP memory starting at
70
* the specified address.
76
extern void gpakReadDspMemory(
77
unsigned short int DspId, /* DSP Identifier (0 to MAX_DSP_CORES-1) */
78
DSP_ADDRESS DspAddress, /* DSP's memory address of first word */
79
unsigned int NumWords, /* number of contiguous words to read */
80
DSP_WORD *pWordValues /* pointer to array of word values variable */
84
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
85
* gpakWriteDspMemory - Write DSP memory.
88
* This function writes a contiguous block of words to DSP memory starting at
89
* the specified address.
95
extern void gpakWriteDspMemory(
96
unsigned short int DspId, /* DSP Identifier (0 to MAX_DSP_CORES-1) */
97
DSP_ADDRESS DspAddress, /* DSP's memory address of first word */
98
unsigned int NumWords, /* number of contiguous words to write */
99
DSP_WORD *pWordValues /* pointer to array of word values to write */
103
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
104
* gpakHostDelay - Delay for a fixed time interval.
107
* This function delays for a fixed time interval before returning. The time
108
* interval is the Host Port Interface sampling period when polling a DSP for
109
* replies to command messages.
115
extern void gpakHostDelay(void);
118
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
119
* gpakLockAccess - Lock access to the specified DSP.
122
* This function aquires exclusive access to the specified DSP.
128
extern void gpakLockAccess(
129
unsigned short int DspId /* DSP Identifier (0 to MAX_DSP_CORES-1) */
133
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
134
* gpakUnlockAccess - Unlock access to the specified DSP.
137
* This function releases exclusive access to the specified DSP.
143
extern void gpakUnlockAccess(
144
unsigned short int DspId /* DSP Identifier (0 to MAX_DSP_CORES-1) */
148
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
149
* gpakReadFile - Read a block of bytes from a G.PAK Download file.
152
* This function reads a contiguous block of bytes from a G.PAK Download file
153
* starting at the current file position.
156
* The number of bytes read from the file.
157
* -1 indicates an error occurred.
158
* 0 indicates all bytes have been read (end of file)
161
extern int gpakReadFile(
162
GPAK_FILE_ID FileId, /* G.PAK Download File Identifier */
163
unsigned char *pBuffer, /* pointer to buffer for storing bytes */
164
unsigned int NumBytes /* number of bytes to read */
168
unsigned char wctdm_vpm150m_getpage(struct wctdm *wc);
170
int wctdm_vpm150m_setpage(struct wctdm *wc, unsigned short addr);
172
int wctdm_vpm150m_setreg(struct wctdm *wc, unsigned int len, unsigned int addr, unsigned short *data);
174
unsigned short wctdm_vpm150m_getreg(struct wctdm *wc, unsigned int len, unsigned int addr, unsigned short *data);
176
char vpm150mtone_to_zaptone(GpakToneCodes_t tone);
178
#endif /* prevent multiple inclusion */