summaryrefslogtreecommitdiff
path: root/drivers/dahdi/xpp/xproto.h
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2011-01-30 14:11:49 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2011-01-30 14:11:49 +0000
commit486c84923571900ad0f99f9db04b6dad3bdcb998 (patch)
tree97f044c12a12a4d36b363ec8a5e7c655f36e4520 /drivers/dahdi/xpp/xproto.h
parentcb9ca13edc842637833463569d37a13c22a931d4 (diff)
xpp: prepare for phonedev refactor
* Allow having XPDs that represent a device that is not a span. * Refactor all span related data from 'struct xpd' to 'struct phonedev' * Refactor span related methods into 'phonedev->phoneops' * Refactor phone related initialization into phonedev_init()/phonedev_cleanup() Signed-off-by: Oron Peled <oron@actcom.co.il> Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9704 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/xpp/xproto.h')
-rw-r--r--drivers/dahdi/xpp/xproto.h29
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/dahdi/xpp/xproto.h b/drivers/dahdi/xpp/xproto.h
index 765cc68..5be6797 100644
--- a/drivers/dahdi/xpp/xproto.h
+++ b/drivers/dahdi/xpp/xproto.h
@@ -216,13 +216,9 @@ xproto_handler_t xproto_global_handler(byte opcode);
#define CALL_XMETHOD(name, xbus, xpd, ...) \
(xpd)->xops->name(xbus, xpd, ## __VA_ARGS__ )
-struct xops {
- xpd_t *(*card_new)(xbus_t *xbus, int unit, int subunit,
- const xproto_table_t *proto_table, byte subtype,
- int subunits, int subunit_ports, bool to_phone);
- 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);
+#define PHONE_METHOD(xpd, name) PHONEDEV(xpd).phoneops->name
+
+struct phoneops {
void (*card_pcm_recompute)(xbus_t *xbus, xpd_t *xpd, xpp_line_t pcm_mask);
void (*card_pcm_fromspan)(xbus_t *xbus, xpd_t *xpd, xpacket_t *pack);
void (*card_pcm_tospan)(xbus_t *xbus, xpd_t *xpd, xpacket_t *pack);
@@ -233,11 +229,20 @@ struct xops {
int (*card_ioctl)(xpd_t *xpd, int pos, unsigned int cmd, unsigned long arg);
int (*card_open)(xpd_t *xpd, lineno_t pos);
int (*card_close)(xpd_t *xpd, lineno_t pos);
- int (*card_register_reply)(xbus_t *xbus, xpd_t *xpd, reg_cmd_t *reg);
int (*XPD_STATE)(xbus_t *xbus, xpd_t *xpd, bool on);
};
+struct xops {
+ xpd_t *(*card_new)(xbus_t *xbus, int unit, int subunit,
+ const xproto_table_t *proto_table, byte subtype,
+ int subunits, int subunit_ports, bool to_phone);
+ 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_register_reply)(xbus_t *xbus, xpd_t *xpd, reg_cmd_t *reg);
+};
+
struct xproto_entry {
xproto_handler_t handler;
int datalen;
@@ -246,9 +251,11 @@ struct xproto_entry {
};
struct xproto_table {
- struct module *owner;
- xproto_entry_t entries[256]; /* Indexed by opcode */
- xops_t xops;
+ struct module *owner;
+ xproto_entry_t entries[256]; /* Indexed by opcode */
+ const struct xops *xops; /* Card level operations */
+ const struct phoneops *phoneops; /* DAHDI operations */
+ //const struct echoops *echo;
xpd_type_t type;
byte ports_per_subunit;
const char *name;