| 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 |
#ifndef _GPAKCUST_H |
| 37 |
#define _GPAKCUST_H |
| 38 |
|
| 39 |
#include <linux/module.h> |
| 40 |
#include <linux/device.h> |
| 41 |
#include <linux/completion.h> |
| 42 |
#include <linux/workqueue.h> |
| 43 |
#include <linux/delay.h> |
| 44 |
#include <linux/version.h> |
| 45 |
#include <linux/semaphore.h> |
| 46 |
|
| 47 |
#include "gpakenum.h" |
| 48 |
#include "adt_lec.h" |
| 49 |
|
| 50 |
#define DEBUG_VPMADT032_ECHOCAN (1 << 4) |
| 51 |
|
| 52 |
|
| 53 |
#define MAX_DSP_CORES 128 |
| 54 |
#define MAX_CHANNELS 32 |
| 55 |
#define MAX_WAIT_LOOPS 50 |
| 56 |
#define DSP_IFBLK_ADDRESS 0x0100 |
| 57 |
#define DOWNLOAD_BLOCK_SIZE 512 |
| 58 |
|
| 59 |
#define VPM150M_MAX_COMMANDS 8 |
| 60 |
|
| 61 |
#define __VPM150M_RWPAGE (1 << 4) |
| 62 |
#define __VPM150M_RD (1 << 3) |
| 63 |
#define __VPM150M_WR (1 << 2) |
| 64 |
#define __VPM150M_FIN (1 << 1) |
| 65 |
#define __VPM150M_TX (1 << 0) |
| 66 |
#define __VPM150M_RWPAGE (1 << 4) |
| 67 |
#define __VPM150M_RD (1 << 3) |
| 68 |
#define __VPM150M_WR (1 << 2) |
| 69 |
#define __VPM150M_FIN (1 << 1) |
| 70 |
#define __VPM150M_TX (1 << 0) |
| 71 |
|
| 72 |
|
| 73 |
#define VPM150M_HPIRESET 1 |
| 74 |
#define VPM150M_SWRESET 2 |
| 75 |
#define VPM150M_ACTIVE 4 |
| 76 |
|
| 77 |
#define NLPTYPE_NONE 0 |
| 78 |
#define NLPTYPE_MUTE 1 |
| 79 |
#define NLPTYPE_RANDOM_NOISE 2 |
| 80 |
#define HOTH_NOISE_NLPTYPE 3 |
| 81 |
#define NLPTYPE_SUPPRESS 4 |
| 82 |
#define NLPTYPE_RESERVED 5 |
| 83 |
#define NLPTYPE_AUTOSUPPRESS 6 |
| 84 |
#define DEFAULT_NLPTYPE NLPTYPE_AUTOSUPPRESS |
| 85 |
|
| 86 |
|
| 87 |
#define DEFAULT_NLPTHRESH 22 |
| 88 |
#define DEFAULT_NLPMAXSUPP 10 |
| 89 |
|
| 90 |
struct vpmadt032_cmd { |
| 91 |
struct list_head node; |
| 92 |
__le32 address; |
| 93 |
__le16 data; |
| 94 |
u8 desc; |
| 95 |
u8 txident; |
| 96 |
struct completion complete; |
| 97 |
}; |
| 98 |
|
| 99 |
|
| 100 |
struct vpmadt032_options { |
| 101 |
int vpmnlptype; |
| 102 |
int vpmnlpthresh; |
| 103 |
int vpmnlpmaxsupp; |
| 104 |
u32 debug; |
| 105 |
u32 channels; |
| 106 |
}; |
| 107 |
|
| 108 |
struct GpakChannelConfig; |
| 109 |
|
| 110 |
struct vpmadt032 { |
| 111 |
struct voicebus *vb; |
| 112 |
struct work_struct work; |
| 113 |
struct workqueue_struct *wq; |
| 114 |
int dspid; |
| 115 |
struct semaphore sem; |
| 116 |
unsigned long control; |
| 117 |
unsigned char curpage; |
| 118 |
unsigned short version; |
| 119 |
struct adt_lec_params curecstate[MAX_CHANNELS]; |
| 120 |
spinlock_t change_list_lock; |
| 121 |
struct list_head change_list; |
| 122 |
spinlock_t list_lock; |
| 123 |
|
| 124 |
struct list_head pending_cmds; |
| 125 |
|
| 126 |
struct list_head active_cmds; |
| 127 |
struct vpmadt032_options options; |
| 128 |
void (*setchanconfig_from_state)(struct vpmadt032 *vpm, int channel, struct GpakChannelConfig *chanconfig); |
| 129 |
}; |
| 130 |
|
| 131 |
struct voicebus; |
| 132 |
struct dahdi_chan; |
| 133 |
struct dahdi_echocanparams; |
| 134 |
struct dahdi_echocanparam; |
| 135 |
struct dahdi_echocan_state; |
| 136 |
|
| 137 |
char vpmadt032tone_to_zaptone(GpakToneCodes_t tone); |
| 138 |
int vpmadt032_test(struct vpmadt032 *vpm, struct voicebus *vb); |
| 139 |
int vpmadt032_init(struct vpmadt032 *vpm); |
| 140 |
int vpmadt032_reset(struct vpmadt032 *vpm); |
| 141 |
struct vpmadt032 *vpmadt032_alloc(struct vpmadt032_options *options); |
| 142 |
void vpmadt032_free(struct vpmadt032 *vpm); |
| 143 |
int vpmadt032_echocan_create(struct vpmadt032 *vpm, int channo, |
| 144 |
enum adt_companding companding, |
| 145 |
struct dahdi_echocanparams *ecp, |
| 146 |
struct dahdi_echocanparam *p); |
| 147 |
void vpmadt032_echocan_free(struct vpmadt032 *vpm, int channo, |
| 148 |
struct dahdi_echocan_state *ec); |
| 149 |
|
| 150 |
struct GpakEcanParms; |
| 151 |
void vpmadt032_get_default_parameters(struct GpakEcanParms *p); |
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
static inline struct vpmadt032_cmd *vpmadt032_get_ready_cmd(struct vpmadt032 *vpm) |
| 156 |
{ |
| 157 |
struct vpmadt032_cmd *cmd; |
| 158 |
|
| 159 |
spin_lock(&vpm->list_lock); |
| 160 |
if (list_empty(&vpm->pending_cmds)) { |
| 161 |
spin_unlock(&vpm->list_lock); |
| 162 |
return NULL; |
| 163 |
} |
| 164 |
cmd = list_entry(vpm->pending_cmds.next, struct vpmadt032_cmd, node); |
| 165 |
list_move_tail(&cmd->node, &vpm->active_cmds); |
| 166 |
spin_unlock(&vpm->list_lock); |
| 167 |
return cmd; |
| 168 |
} |
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
static inline void vpmadt032_resend(struct vpmadt032 *vpm) |
| 174 |
{ |
| 175 |
struct vpmadt032_cmd *cmd, *temp; |
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
spin_lock(&vpm->list_lock); |
| 180 |
list_for_each_entry_safe(cmd, temp, &vpm->active_cmds, node) { |
| 181 |
cmd->desc &= ~(__VPM150M_TX); |
| 182 |
list_move_tail(&cmd->node, &vpm->pending_cmds); |
| 183 |
} |
| 184 |
spin_unlock(&vpm->list_lock); |
| 185 |
} |
| 186 |
|
| 187 |
|
| 188 |
typedef __u16 DSP_WORD; |
| 189 |
typedef __u32 DSP_ADDRESS; |
| 190 |
typedef __u32 GPAK_FILE_ID; |
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
extern void gpakReadDspMemory( |
| 204 |
unsigned short int DspId, |
| 205 |
DSP_ADDRESS DspAddress, |
| 206 |
unsigned int NumWords, |
| 207 |
DSP_WORD *pWordValues |
| 208 |
); |
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
extern void gpakWriteDspMemory( |
| 223 |
unsigned short int DspId, |
| 224 |
DSP_ADDRESS DspAddress, |
| 225 |
unsigned int NumWords, |
| 226 |
DSP_WORD *pWordValues |
| 227 |
); |
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
extern void gpakHostDelay(void); |
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
extern void gpakLockAccess( |
| 256 |
unsigned short int DspId |
| 257 |
); |
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
extern void gpakUnlockAccess( |
| 270 |
unsigned short int DspId |
| 271 |
); |
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
extern int gpakReadFile( |
| 287 |
GPAK_FILE_ID FileId, |
| 288 |
unsigned char *pBuffer, |
| 289 |
unsigned int NumBytes |
| 290 |
); |
| 291 |
|
| 292 |
|
| 293 |
#endif |
| 294 |
|
| 295 |
|