| 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 |
#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 |
|
| 34 |
#define VPMOCT_FIRM_HEADER_LEN 32 |
| 35 |
#define VPMOCT_BOOT_RAM_LEN 128 |
| 36 |
#define VPMOCT_FLASH_BUF_SECTIONS 4 |
| 37 |
#define VPMOCT_MAX_CHUNK 7 |
| 38 |
|
| 39 |
|
| 40 |
#define VPMOCT_BOOT_FLASH_ERASE 0x01 |
| 41 |
#define VPMOCT_BOOT_FLASH_COPY 0x02 |
| 42 |
#define VPMOCT_BOOT_IMAGE_VALIDATE 0x06 |
| 43 |
#define VPMOCT_BOOT_REBOOT 0x07 |
| 44 |
#define VPMOCT_BOOT_DECRYPT 0x08 |
| 45 |
#define VPMOCT_BOOT_FLASHLOAD 0x10 |
| 46 |
|
| 47 |
|
| 48 |
#define VPMOCT_IDENT 0x00 |
| 49 |
#define VPMOCT_MAJOR 0x0a |
| 50 |
#define VPMOCT_MINOR 0x0b |
| 51 |
#define VPMOCT_SERIAL 0x90 |
| 52 |
#define VPMOCT_SERIAL_SIZE 32 |
| 53 |
|
| 54 |
|
| 55 |
#define VPMOCT_BOOT_ERROR 0x0c |
| 56 |
#define VPMOCT_BOOT_STATUS 0x10 |
| 57 |
#define VPMOCT_BOOT_CMD 0x11 |
| 58 |
#define VPMOCT_BOOT_LEN 0x14 |
| 59 |
#define VPMOCT_BOOT_ADDRESS1 0x18 |
| 60 |
#define VPMOCT_BOOT_ADDRESS2 0x1c |
| 61 |
#define VPMOCT_BOOT_RAM 0x20 |
| 62 |
|
| 63 |
enum vpmoct_mode { UNKNOWN = 0, APPLICATION, BOOTLOADER }; |
| 64 |
|
| 65 |
struct vpmoct { |
| 66 |
struct list_head pending_list; |
| 67 |
struct list_head active_list; |
| 68 |
spinlock_t list_lock; |
| 69 |
struct mutex mutex; |
| 70 |
enum vpmoct_mode mode; |
| 71 |
struct device *dev; |
| 72 |
u32 companding; |
| 73 |
u32 echo; |
| 74 |
unsigned int preecho_enabled:1; |
| 75 |
unsigned int echo_update_active:1; |
| 76 |
unsigned int companding_update_active:1; |
| 77 |
u8 preecho_timeslot; |
| 78 |
u8 preecho_buf[8]; |
| 79 |
u8 major; |
| 80 |
u8 minor; |
| 81 |
}; |
| 82 |
|
| 83 |
struct vpmoct_cmd { |
| 84 |
struct list_head node; |
| 85 |
u8 address; |
| 86 |
u8 data[VPMOCT_MAX_CHUNK]; |
| 87 |
u8 command; |
| 88 |
u8 chunksize; |
| 89 |
u8 txident; |
| 90 |
struct completion complete; |
| 91 |
}; |
| 92 |
|
| 93 |
static inline bool is_vpmoct_cmd_read(const struct vpmoct_cmd *cmd) |
| 94 |
{ |
| 95 |
return (0x60 == (cmd->command & 0xf0)); |
| 96 |
} |
| 97 |
|
| 98 |
struct vpmoct *vpmoct_alloc(void); |
| 99 |
void vpmoct_free(struct vpmoct *vpm); |
| 100 |
typedef void (*load_complete_func_t)(struct device *dev, bool operational); |
| 101 |
int vpmoct_init(struct vpmoct *vpm, load_complete_func_t load_complete); |
| 102 |
int vpmoct_echocan_create(struct vpmoct *vpm, |
| 103 |
int channo, |
| 104 |
int companding); |
| 105 |
void vpmoct_echocan_free(struct vpmoct *vpm, |
| 106 |
int channo); |
| 107 |
int vpmoct_preecho_enable(struct vpmoct *vpm, int channo); |
| 108 |
int vpmoct_preecho_disable(struct vpmoct *vpm, int channo); |
| 109 |
#endif |