diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-05-03 23:06:02 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-05-03 23:06:02 +0000 |
commit | 2dd60aaf18e98b0e9d3c06bd9dce5f1128fa55ad (patch) | |
tree | 1a1cd28888f191e6ce83bcbbe539124e2529c90b /xpp/xproto.h | |
parent | 8c4db4e3acd9a7626e709af0494055487b589719 (diff) |
xpp driver release 1.1.0 (first part of commit)
* FPGA firmware now loaded from PC (for newer models)
* Driver for the FXO module
* Moved most userspace files to the subdirectory utils (see also next commit)
* Explicit license for firmware files
* Optionally avoid auto-registration
* Initializations parameters to chips given from userspace
* And did I mention bugfixes?
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1021 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/xproto.h')
-rw-r--r-- | xpp/xproto.h | 65 |
1 files changed, 29 insertions, 36 deletions
diff --git a/xpp/xproto.h b/xpp/xproto.h index a369a6b..0cae398 100644 --- a/xpp/xproto.h +++ b/xpp/xproto.h @@ -2,7 +2,7 @@ #define XPROTO_H /* * Written by Oron Peled <oron@actcom.co.il> - * Copyright (C) 2004-2005, Xorcom + * Copyright (C) 2004-2006, Xorcom * * All rights reserved. * @@ -28,16 +28,19 @@ #include <linux/list.h> #endif -#define XPD_TYPE(n) XPD_TYPE_ ## n #define PROTO_TABLE(n) n ## _protocol_table -typedef enum xpd_type { - XPD_TYPE(FXO) = 0x02, - XPD_TYPE(FXS) = 0x03, - XPD_TYPE(NOMODULE) = 0x0F, -} xpd_type_t; +#define XPD_TYPE_FXS 3 +#define XPD_TYPE_FXO 4 +#define XPD_TYPE_NOMODULE 15 + +typedef byte xpd_type_t; + +#define XPD_TYPE_PREFIX "xpd-type-" + +#define MODULE_ALIAS_XPD(type) \ + MODULE_ALIAS(XPD_TYPE_PREFIX __stringify(type)) -#define LINE_BITS (sizeof(xpp_line_t)*8) #define PCM_CHUNKSIZE (CHANNELS_PERXPD * 8) /* samples of 8 bytes */ typedef struct xpd_addr { @@ -124,14 +127,13 @@ typedef int (*xproto_handler_t)( const xproto_entry_t *cmd, xpacket_t *pack); -const xproto_entry_t *find_xproto_entry(xpd_t *xpd, byte opcode); - -const xproto_table_t *get_xproto_table(xpd_type_t cardtype); +const xproto_table_t *xproto_get(xpd_type_t cardtype); +void xproto_put(const xproto_table_t *xtable); const xproto_entry_t *xproto_card_entry(const xproto_table_t *table, byte opcode); -const xproto_handler_t xproto_card_handler(const xproto_table_t *table, byte opcode); +xproto_handler_t xproto_card_handler(const xproto_table_t *table, byte opcode); const xproto_entry_t *xproto_global_entry(byte opcode); -const xproto_handler_t xproto_global_handler(byte opcode); +xproto_handler_t xproto_global_handler(byte opcode); #define CALL_XMETHOD(name, xbus, xpd, ...) \ (xpd)->xops->name(xbus, xpd, ## __VA_ARGS__ ) @@ -141,23 +143,19 @@ struct xops { int (*card_init)(xbus_t *xbus, xpd_t *xpd); int (*card_remove)(xbus_t *xbus, xpd_t *xpd); int (*card_tick)(xbus_t *xbus, xpd_t *xpd); + int (*card_zaptel_registration)(xpd_t *xpd, bool on); + int (*card_sethook)(xbus_t *xbus, xpd_t *xpd, int pos, int hookstate); int (*SYNC_SOURCE)(xbus_t *xbus, xpd_t *xpd, bool setit, bool is_master); int (*PCM_WRITE)(xbus_t *xbus, xpd_t *xpd, xpp_line_t hookstate, volatile byte *buf); int (*CHAN_ENABLE)(xbus_t *xbus, xpd_t *xpd, xpp_line_t lines, bool on); - int (*CHAN_POWER)(xbus_t *xbus, xpd_t *xpd, xpp_line_t lines, bool on); int (*CHAN_CID)(xbus_t *xbus, xpd_t *xpd, xpp_line_t lines); int (*RING)(xbus_t *xbus, xpd_t *xpd, int pos, bool on); - int (*SETHOOK)(xbus_t *xbus, xpd_t *xpd, xpp_line_t hook_status); - int (*LED)(xbus_t *xbus, xpd_t *xpd, xpp_line_t lines, byte which, bool on); + int (*SETHOOK)(xbus_t *xbus, xpd_t *xpd, int pos, bool offhook); int (*RELAY_OUT)(xbus_t *xbus, xpd_t *xpd, byte which, bool on); }; -const xops_t *get_xops(xpd_type_t xpd_type); - -#undef XMETHOD - struct xproto_entry { xproto_handler_t handler; int datalen; @@ -166,6 +164,7 @@ struct xproto_entry { }; struct xproto_table { + struct module *owner; xproto_entry_t entries[255]; /* Indexed by opcode */ xops_t xops; xpd_type_t type; @@ -176,6 +175,7 @@ struct xproto_table { #include "card_global.h" #include "card_fxs.h" +#include "card_fxo.h" enum opcodes { XPROTO_NAME(GLOBAL, DESC_REQ) = 0x04, @@ -186,21 +186,6 @@ enum opcodes { /**/ XPROTO_NAME(GLOBAL, SYNC_SOURCE) = 0x19, XPROTO_NAME(GLOBAL, SYNC_REPLY) = 0x1A, - - XPROTO_NAME(FXS, SIG_CHANGED) = 0x06, -/**/ - XPROTO_NAME(FXS, SLIC_WRITE) = 0x0F, /* Write to SLIC */ - XPROTO_NAME(FXS, CHAN_ENABLE) = 0x0F, /* Write to SLIC */ - XPROTO_NAME(FXS, CHAN_POWER) = 0x0F, /* Write to SLIC */ - XPROTO_NAME(FXS, CHAN_CID) = 0x0F, /* Write to SLIC */ - XPROTO_NAME(FXS, RING) = 0x0F, /* Write to SLIC */ - XPROTO_NAME(FXS, SETHOOK) = 0x0F, /* Write to SLIC */ - XPROTO_NAME(FXS, LED) = 0x0F, /* Write to SLIC */ - XPROTO_NAME(FXS, RELAY_OUT) = 0x0F, /* Write to SLIC */ - XPROTO_NAME(FXS, SLIC_INIT) = 0x0F, /* Write to SLIC */ - XPROTO_NAME(FXS, SLIC_QUERY) = 0x0F, /* Write to SLIC */ -/**/ - XPROTO_NAME(FXS, SLIC_REPLY) = 0x10, }; @@ -218,6 +203,13 @@ struct xpacket_raw { MEMBER(FXS, SIG_CHANGED); MEMBER(FXS, SLIC_REPLY); + MEMBER(FXS, SLIC_INIT); + MEMBER(FXS, SLIC_WRITE); + + MEMBER(FXO, SIG_CHANGED); + MEMBER(FXO, DAA_REPLY); + MEMBER(FXO, DAA_INIT); + MEMBER(FXO, DAA_WRITE); byte data[0]; }; @@ -225,8 +217,9 @@ struct xpacket_raw { struct xpacket { xpacket_raw_t content; - size_t datalen; + int datalen; struct list_head list; + void *packet_priv; }; void dump_packet(const char *msg, xpacket_t *packet, bool print_dbg); |