#ifdef MAGMA_DEBUG
#define dprintf(x) printf x
#else
#define dprintf(x)
#endif
#define MAGMA_MAX_CARDS 4
#define MAGMA_MAX_TTY 16
#define MAGMA_MAX_BPP 2
#define MAGMA_MAX_CD1400 4
#define MAGMA_MAX_CD1190 2
#define MAGMA_CARD(x) ((minor(x) >> 6) & 0x03)
#define MAGMA_PORT(x) (minor(x) & 0x0f)
#define MTTY_DIALOUT(x) (minor(x) & 0x10)
struct magma_board_info {
const char *mb_sbusname;
const char *mb_name;
const char *mb_realname;
int mb_nser;
int mb_npar;
int mb_ncd1400;
int mb_svcackr;
int mb_svcackt;
int mb_svcackm;
int mb_cd1400[MAGMA_MAX_CD1400];
int mb_ncd1190;
int mb_cd1190[MAGMA_MAX_CD1190];
};
struct cd1400 {
bus_space_handle_t cd_regh;
bus_space_tag_t cd_regt;
int cd_chiprev;
int cd_clock;
int cd_parmode;
};
struct cd1190 {
bus_space_handle_t cd_regh;
bus_space_tag_t cd_regt;
int cd_chiprev;
};
struct magma_softc {
struct device ms_dev;
bus_space_tag_t sc_bustag;
bus_space_handle_t sc_iohandle;
void *sc_ih;
void *sc_sih;
int ms_ncd1400;
struct cd1400 ms_cd1400[MAGMA_MAX_CD1400];
bus_space_handle_t sc_svcackrh;
bus_space_handle_t sc_svcackth;
bus_space_handle_t sc_svcackmh;
int ms_ncd1190;
struct cd1190 ms_cd1190[MAGMA_MAX_CD1190];
const struct magma_board_info *ms_board;
struct mtty_softc *ms_mtty;
struct mbpp_softc *ms_mbpp;
struct intrhand ms_hardint;
struct intrhand ms_softint;
};
#define MTTY_RBUF_SIZE (2 * 512)
#define MTTY_RX_FIFO_THRESHOLD 6
#define MTTY_RX_DTR_THRESHOLD 9
struct mtty_port {
struct cd1400 *mp_cd1400;
int mp_channel;
struct tty *mp_tty;
int mp_openflags;
int mp_flags;
int mp_carrier;
u_char *mp_rbuf;
u_char *mp_rend;
u_char *mp_rget;
u_char *mp_rput;
u_char *mp_txp;
int mp_txc;
};
#define MTTYF_CARRIER_CHANGED (1<<0)
#define MTTYF_SET_BREAK (1<<1)
#define MTTYF_CLR_BREAK (1<<2)
#define MTTYF_DONE (1<<3)
#define MTTYF_STOP (1<<4)
#define MTTYF_RING_OVERFLOW (1<<5)
struct mtty_softc {
struct device ms_dev;
int ms_nports;
struct mtty_port ms_port[MAGMA_MAX_TTY];
};
#define MBPP_RX_FIFO_THRESHOLD 25
struct mbpp_port {
struct cd1400 *mp_cd1400;
struct cd1190 *mp_cd1190;
int mp_flags;
struct bpp_param mp_param;
#define mp_burst mp_param.bp_burst
#define mp_timeout mp_param.bp_timeout
#define mp_delay mp_param.bp_delay
u_char *mp_ptr;
int mp_cnt;
struct timeout mp_timeout_tmo;
struct timeout mp_start_tmo;
};
#define MBPPF_OPEN (1<<0)
#define MBPPF_TIMEOUT (1<<1)
#define MBPPF_UIO (1<<2)
#define MBPPF_DELAY (1<<3)
#define MBPPF_WAKEUP (1<<4)
struct mbpp_softc {
struct device ms_dev;
int ms_nports;
struct mbpp_port ms_port[MAGMA_MAX_BPP];
};
int cd1400_compute_baud(speed_t, int, int *, int *);
void cd1400_enable_transmitter(struct cd1400 *, int);
int magma_match(struct device *, void *, void *);
void magma_attach(struct device *, struct device *, void *);
int magma_hard(void *);
void magma_soft(void *);
int mtty_match(struct device *, void *, void *);
void mtty_attach(struct device *, struct device *, void *);
int mtty_modem_control(struct mtty_port *, int, int);
int mtty_param(struct tty *, struct termios *);
void mtty_start(struct tty *);
int mbpp_match(struct device *, void *, void *);
void mbpp_attach(struct device *, struct device *, void *);
int mbpp_rw(dev_t, struct uio *);
void mbpp_timeout(void *);
void mbpp_start(void *);
int mbpp_send(struct mbpp_port *, caddr_t, int);
int mbpp_recv(struct mbpp_port *, caddr_t, int);
#define CD1400_REGMAPSIZE 0x80
#define CD1190_REGMAPSIZE 0x20