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