~gandelman-a/ubuntu/precise/dahdi-linux/merge879743

« back to all changes in this revision

Viewing changes to drivers/dahdi/voicebus/vpmoct.h

  • Committer: Adam Gandelman
  • Date: 2011-10-22 01:54:59 UTC
  • mfrom: (3.1.7 sid)
  • Revision ID: adamg@canonical.com-20111022015459-kx0rzv8gpef9gcmb
* Merge from Debian testing (LP: #879743). Remaining changes:
  - debian/dahdi-dkms.install.in : add .version
  - Import modifications by Javier Uruen Val <javi@warp.es>:
    - debian/system.conf
    - debian/modules
  - DKMS support:
    - debian/control: Added Depends to dahdi-linux (dahdi-dkms | dahdi-source)
    - debian/control: Add dkms package
    - debian/dahdi-dkms.install
    - debian/dahdi-dkms.postinst
    - debian/dahdi-dkms.prerm
    - debian/dahdi-linux.install
    - debian/rules: add code to automatically configure dkms.conf
    - debian/dkms.conf.in
* Dropped changes:
  - debian/control: Fix typo (right command is m-a a-i dahdi-source)
  - debian/patches/define_spinlock: Fixed upstream
* debian/rules: Debian moved to dh, re-add code to automatically configure
  dkms.conf
* debian/dkms.conf.in: update to reflect dahdi-linux-extra patch update
  (opvxa1200's new  location (subdir) and to include ap400 and opvxd115)
* debian/patches/zaphfc_d_channel_fix.patch: Correct typo in zaphfc module
  until fix gets synced into dahdi-linux-extra patch in Debian (LP: #612091)
* New upstream release (Closes: #639702).
  - Patch wcb4xxp_bn4s0e removed: merged upstream.
  - Patch define_spinlock removed: merged upstream.
  - Patch dahdi-linux-extra updated.
* Updated dahdi-linux-extra:
  - "Upstream" is now a complete git mirror.
  - Actually include ap400 in the list of modules to build.
  - Updated OpenVox drivers: opvxa1200 is a subdirectory 
  - Updated OpenVox drivers: opvxd115 added (digital cards).
* Patch define_spinlock: include a (slightly big) build fix from upstream.
* Standards version 3.9.2 (no change needed).
* Switch to dh.
* Patch notest: Remove a bogus upstream 'test' target.
* Lintian override for an odd interpteter a dummy kernel module init script. 
* Dahdi udev rules are now named 'dahdi-linux.conf'.
* Patch xpp_fix_2fxs6fxo: bugfix for Xorcom 2FXX6FXO module code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * VPMOCT Driver.
 
3
 *
 
4
 * Written by Russ Meyerriecks <rmeyerriecks@digium.com>
 
5
 *
 
6
 * Copyright (C) 2010-2011 Digium, Inc.
 
7
 *
 
8
 * All rights reserved.
 
9
 *
 
10
 */
 
11
 
 
12
/*
 
13
 * See http://www.asterisk.org for more information about
 
14
 * the Asterisk project. Please do not directly contact
 
15
 * any of the maintainers of this project for assistance;
 
16
 * the project provides a web site, mailing lists and IRC
 
17
 * channels for your use.
 
18
 *
 
19
 * This program is free software, distributed under the terms of
 
20
 * the GNU General Public License Version 2 as published by the
 
21
 * Free Software Foundation. See the LICENSE file included with
 
22
 * this program for more details.
 
23
 */
 
24
 
 
25
#ifndef _VPMOCT_H
 
26
#define _VPMOCT_H
 
27
 
 
28
#include <linux/list.h>
 
29
#include <linux/pci.h>
 
30
#include <linux/timer.h>
 
31
#include "dahdi/kernel.h"
 
32
 
 
33
#include <stdbool.h>
 
34
 
 
35
#define VPMOCT_FIRM_HEADER_LEN 32
 
36
#define VPMOCT_BOOT_RAM_LEN 128
 
37
#define VPMOCT_FLASH_BUF_SECTIONS 4
 
38
#define VPMOCT_MAX_CHUNK 7
 
39
 
 
40
/* Bootloader commands */
 
41
#define VPMOCT_BOOT_FLASH_ERASE 0x01
 
42
#define VPMOCT_BOOT_FLASH_COPY 0x02
 
43
#define VPMOCT_BOOT_IMAGE_VALIDATE 0x06
 
44
#define VPMOCT_BOOT_REBOOT 0x07
 
45
#define VPMOCT_BOOT_DECRYPT 0x08
 
46
#define VPMOCT_BOOT_FLASHLOAD 0x10
 
47
 
 
48
/* Dual use registers */
 
49
#define VPMOCT_IDENT 0x00
 
50
#define VPMOCT_MAJOR 0x0a
 
51
#define VPMOCT_MINOR 0x0b
 
52
#define VPMOCT_SERIAL 0x90
 
53
#define VPMOCT_SERIAL_SIZE 32
 
54
 
 
55
/* Bootloader registers */
 
56
#define VPMOCT_BOOT_ERROR 0x0c
 
57
#define VPMOCT_BOOT_STATUS 0x10
 
58
#define VPMOCT_BOOT_CMD 0x11
 
59
#define VPMOCT_BOOT_LEN 0x14
 
60
#define VPMOCT_BOOT_ADDRESS1 0x18
 
61
#define VPMOCT_BOOT_ADDRESS2 0x1c
 
62
#define VPMOCT_BOOT_RAM 0x20
 
63
 
 
64
enum vpmoct_mode { UNKNOWN = 0, APPLICATION, BOOTLOADER };
 
65
 
 
66
struct vpmoct {
 
67
        struct list_head pending_list;
 
68
        struct list_head active_list;
 
69
        spinlock_t list_lock;
 
70
        struct mutex mutex;
 
71
        enum vpmoct_mode mode;
 
72
        struct device *dev;
 
73
        u32 companding;
 
74
        u32 echo;
 
75
        unsigned int preecho_enabled:1;
 
76
        unsigned int echo_update_active:1;
 
77
        unsigned int companding_update_active:1;
 
78
        u8 preecho_timeslot;
 
79
        u8 preecho_buf[8];
 
80
        u8 major;
 
81
        u8 minor;
 
82
};
 
83
 
 
84
struct vpmoct_cmd {
 
85
        struct list_head node;
 
86
        u8 address;
 
87
        u8 data[VPMOCT_MAX_CHUNK];
 
88
        u8 command;
 
89
        u8 chunksize;
 
90
        u8 txident;
 
91
        struct completion complete;
 
92
};
 
93
 
 
94
static inline bool is_vpmoct_cmd_read(const struct vpmoct_cmd *cmd)
 
95
{
 
96
        return (0x60 == (cmd->command & 0xf0));
 
97
}
 
98
 
 
99
struct vpmoct *vpmoct_alloc(void);
 
100
void vpmoct_free(struct vpmoct *vpm);
 
101
typedef void (*load_complete_func_t)(struct device *dev, bool operational);
 
102
int vpmoct_init(struct vpmoct *vpm, load_complete_func_t load_complete);
 
103
int vpmoct_echocan_create(struct vpmoct *vpm,
 
104
                           int channo,
 
105
                           int companding);
 
106
void vpmoct_echocan_free(struct vpmoct *vpm,
 
107
                         int channo);
 
108
int vpmoct_preecho_enable(struct vpmoct *vpm, int channo);
 
109
int vpmoct_preecho_disable(struct vpmoct *vpm, int channo);
 
110
#endif