4
* Written by Russ Meyerriecks <rmeyerriecks@digium.com>
6
* Copyright (C) 2010-2011 Digium, Inc.
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.
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.
28
#include <linux/list.h>
29
#include <linux/pci.h>
30
#include <linux/timer.h>
31
#include "dahdi/kernel.h"
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
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
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
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
64
enum vpmoct_mode { UNKNOWN = 0, APPLICATION, BOOTLOADER };
67
struct list_head pending_list;
68
struct list_head active_list;
71
enum vpmoct_mode mode;
75
unsigned int preecho_enabled:1;
76
unsigned int echo_update_active:1;
77
unsigned int companding_update_active:1;
85
struct list_head node;
87
u8 data[VPMOCT_MAX_CHUNK];
91
struct completion complete;
94
static inline bool is_vpmoct_cmd_read(const struct vpmoct_cmd *cmd)
96
return (0x60 == (cmd->command & 0xf0));
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,
106
void vpmoct_echocan_free(struct vpmoct *vpm,
108
int vpmoct_preecho_enable(struct vpmoct *vpm, int channo);
109
int vpmoct_preecho_disable(struct vpmoct *vpm, int channo);