summaryrefslogtreecommitdiff
path: root/drivers/dahdi/xpp/xpd.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dahdi/xpp/xpd.h')
-rw-r--r--drivers/dahdi/xpp/xpd.h155
1 files changed, 76 insertions, 79 deletions
diff --git a/drivers/dahdi/xpp/xpd.h b/drivers/dahdi/xpp/xpd.h
index 8c8c27e..4f3b095 100644
--- a/drivers/dahdi/xpp/xpd.h
+++ b/drivers/dahdi/xpp/xpd.h
@@ -37,7 +37,7 @@
#include <asm/semaphore.h>
#endif
#include <linux/moduleparam.h>
-#endif /* __KERNEL__ */
+#endif /* __KERNEL__ */
#include <dahdi/kernel.h>
@@ -45,7 +45,7 @@
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14)
/* also added in RHEL kernels with the OpenInfiniband backport: */
#if LINUX_VERSION_CODE != KERNEL_VERSION(2, 6, 9) || !defined(DEFINE_SPINLOCK)
-typedef unsigned gfp_t; /* Added in 2.6.14 */
+typedef unsigned gfp_t; /* Added in 2.6.14 */
#endif
#endif
@@ -81,21 +81,21 @@ typedef unsigned gfp_t; /* Added in 2.6.14 */
module_param_array(name, type, &name ## _num_values, 0644); \
MODULE_PARM_DESC(name, desc " ( 1-" __MODULE_STRING(count) ")")
#endif
-#endif // __KERNEL__
+#endif // __KERNEL__
#define CARD_DESC_MAGIC 0xca9dde5c
-struct card_desc_struct {
- struct list_head card_list;
- u32 magic;
- __u8 type; /* LSB: 1 - to_phone, 0 - to_line */
- __u8 subtype;
- struct xpd_addr xpd_addr;
- __u8 numchips;
- __u8 ports_per_chip;
- __u8 ports;
- __u8 port_dir;
- struct xpd_addr ec_addr; /* echo canceler address */
+struct card_desc_struct {
+ struct list_head card_list;
+ u32 magic;
+ __u8 type; /* LSB: 1 - to_phone, 0 - to_line */
+ __u8 subtype;
+ struct xpd_addr xpd_addr;
+ __u8 numchips;
+ __u8 ports_per_chip;
+ __u8 ports;
+ __u8 port_dir;
+ struct xpd_addr ec_addr; /* echo canceler address */
};
typedef enum xpd_direction {
@@ -120,12 +120,9 @@ enum {
/* yucky, make an instance so we can size it... */
static struct xpd_counters {
- char *name;
+ char *name;
} xpd_counters[] = {
- C_(PCM_READ),
- C_(PCM_WRITE),
- C_(RECV_ERRORS),
-};
+C_(PCM_READ), C_(PCM_WRITE), C_(RECV_ERRORS),};
#undef C_
@@ -138,43 +135,43 @@ enum xpd_state {
XPD_STATE_NOHW,
};
-bool xpd_setstate(xpd_t *xpd, enum xpd_state newstate);
-const char *xpd_statename(enum xpd_state st);
+bool xpd_setstate(xpd_t *xpd, enum xpd_state newstate);
+const char *xpd_statename(enum xpd_state st);
#define PHONEDEV(xpd) ((xpd)->phonedev)
#define IS_PHONEDEV(xpd) (PHONEDEV(xpd).phoneops)
struct phonedev {
- const struct phoneops *phoneops; /* Card level operations */
- struct dahdi_span span;
- struct dahdi_chan *chans[32];
+ const struct phoneops *phoneops; /* Card level operations */
+ struct dahdi_span span;
+ struct dahdi_chan *chans[32];
#define XPD_CHAN(xpd, chan) (PHONEDEV(xpd).chans[(chan)])
struct dahdi_echocan_state *ec[32];
- int channels;
- xpd_direction_t direction; /* TO_PHONE, TO_PSTN */
- xpp_line_t no_pcm; /* Temporary: disable PCM (for USB-1) */
- xpp_line_t offhook_state; /* Actual chip state: 0 - ONHOOK, 1 - OFHOOK */
- xpp_line_t oht_pcm_pass; /* Transfer on-hook PCM */
+ int channels;
+ xpd_direction_t direction; /* TO_PHONE, TO_PSTN */
+ xpp_line_t no_pcm; /* Temporary: disable PCM (for USB-1) */
+ xpp_line_t offhook_state; /* Actual chip state: 0 - ONHOOK, 1 - OFHOOK */
+ xpp_line_t oht_pcm_pass; /* Transfer on-hook PCM */
/* Voice Mail Waiting Indication: */
- unsigned int msg_waiting[CHANNELS_PERXPD];
- xpp_line_t digital_outputs; /* 0 - no, 1 - yes */
- xpp_line_t digital_inputs; /* 0 - no, 1 - yes */
- xpp_line_t digital_signalling; /* BRI signalling channels */
- uint timing_priority; /* from 'span' directives in chan_dahdi.conf */
+ unsigned int msg_waiting[CHANNELS_PERXPD];
+ xpp_line_t digital_outputs; /* 0 - no, 1 - yes */
+ xpp_line_t digital_inputs; /* 0 - no, 1 - yes */
+ xpp_line_t digital_signalling; /* BRI signalling channels */
+ uint timing_priority; /* from 'span' directives in chan_dahdi.conf */
/* Assure atomicity of changes to pcm_len and wanted_pcm_mask */
- spinlock_t lock_recompute_pcm;
+ spinlock_t lock_recompute_pcm;
/* maintained by card drivers */
- uint pcm_len; /* allocation length of PCM packet (dynamic) */
- xpp_line_t wanted_pcm_mask;
- xpp_line_t silence_pcm; /* inject silence during next tick */
- xpp_line_t mute_dtmf;
+ uint pcm_len; /* allocation length of PCM packet (dynamic) */
+ xpp_line_t wanted_pcm_mask;
+ xpp_line_t silence_pcm; /* inject silence during next tick */
+ xpp_line_t mute_dtmf;
- bool ringing[CHANNELS_PERXPD];
+ bool ringing[CHANNELS_PERXPD];
- atomic_t dahdi_registered; /* Am I fully registered with dahdi */
- atomic_t open_counter; /* Number of open channels */
+ atomic_t dahdi_registered; /* Am I fully registered with dahdi */
+ atomic_t open_counter; /* Number of open channels */
/* Echo cancelation */
u_char ec_chunk1[CHANNELS_PERXPD][DAHDI_CHUNKSIZE];
@@ -186,51 +183,51 @@ struct phonedev {
*/
struct xpd {
char xpdname[XPD_NAMELEN];
- struct phonedev phonedev;
-
- const struct xops *xops;
- xpd_type_t type;
- const char *type_name;
- __u8 subtype;
- int subunits; /* all siblings */
- enum xpd_state xpd_state;
- struct device xpd_dev;
+ struct phonedev phonedev;
+
+ const struct xops *xops;
+ xpd_type_t type;
+ const char *type_name;
+ __u8 subtype;
+ int subunits; /* all siblings */
+ enum xpd_state xpd_state;
+ struct device xpd_dev;
#define dev_to_xpd(dev) container_of(dev, struct xpd, xpd_dev)
- struct kref kref;
+ struct kref kref;
#define kref_to_xpd(k) container_of(k, struct xpd, kref)
- xbus_t *xbus; /* The XBUS we are connected to */
- struct device *echocancel;
+ xbus_t *xbus; /* The XBUS we are connected to */
+ struct device *echocancel;
- spinlock_t lock;
+ spinlock_t lock;
- int flags;
- unsigned long blink_mode; /* bitmask of blinking ports */
+ int flags;
+ unsigned long blink_mode; /* bitmask of blinking ports */
#define DEFAULT_LED_PERIOD (1000/8) /* in tick */
#ifdef CONFIG_PROC_FS
- struct proc_dir_entry *proc_xpd_dir;
- struct proc_dir_entry *proc_xpd_summary;
+ struct proc_dir_entry *proc_xpd_dir;
+ struct proc_dir_entry *proc_xpd_summary;
#endif
- int counters[XPD_COUNTER_MAX];
+ int counters[XPD_COUNTER_MAX];
- const xproto_table_t *xproto; /* Card level protocol table */
- void *priv; /* Card level private data */
- bool card_present;
- reg_cmd_t requested_reply;
- reg_cmd_t last_reply;
+ const xproto_table_t *xproto; /* Card level protocol table */
+ void *priv; /* Card level private data */
+ bool card_present;
+ reg_cmd_t requested_reply;
+ reg_cmd_t last_reply;
- unsigned long last_response; /* in jiffies */
- unsigned xbus_idx; /* index in xbus->xpds[] */
- struct xpd_addr addr;
+ unsigned long last_response; /* in jiffies */
+ unsigned xbus_idx; /* index in xbus->xpds[] */
+ struct xpd_addr addr;
struct list_head xpd_list;
- unsigned int timer_count;
+ unsigned int timer_count;
};
#define for_each_line(xpd, i) for ((i) = 0; (i) < PHONEDEV(xpd).channels; (i)++)
#define IS_BRI(xpd) ((xpd)->type == XPD_TYPE_BRI)
-#define TICK_TOLERANCE 500 /* usec */
+#define TICK_TOLERANCE 500 /* usec */
#ifdef DEBUG_SYNC_PARPORT
void xbus_flip_bit(xbus_t *xbus, unsigned int bitnum0, unsigned int bitnum1);
@@ -240,7 +237,7 @@ void xbus_flip_bit(xbus_t *xbus, unsigned int bitnum0, unsigned int bitnum1);
static inline void *my_kzalloc(size_t size, gfp_t flags)
{
- void *p;
+ void *p;
p = kmalloc(size, flags);
if (p)
@@ -249,18 +246,18 @@ static inline void *my_kzalloc(size_t size, gfp_t flags)
}
struct xpd_driver {
- xpd_type_t type;
+ xpd_type_t type;
- struct device_driver driver;
+ struct device_driver driver;
#define driver_to_xpd_driver(driver) container_of(driver, struct xpd_driver, driver)
};
-int xpd_driver_register(struct device_driver *driver);
-void xpd_driver_unregister(struct device_driver *driver);
-xpd_t *get_xpd(const char *msg, xpd_t *xpd);
-void put_xpd(const char *msg, xpd_t *xpd);
-int refcount_xpd(xpd_t *xpd);
+int xpd_driver_register(struct device_driver *driver);
+void xpd_driver_unregister(struct device_driver *driver);
+xpd_t *get_xpd(const char *msg, xpd_t *xpd);
+void put_xpd(const char *msg, xpd_t *xpd);
+int refcount_xpd(xpd_t *xpd);
#endif
-#endif /* XPD_H */
+#endif /* XPD_H */