blob: 2a814774a00149c35df2a89e43f87df6ebdfe23b [file] [log] [blame]
Manu Abrahamdd827da2009-12-04 05:00:30 -03001/*
2 Mantis PCI bridge driver
3
Manu Abraham8825a092009-12-15 09:13:49 -03004 Copyright (C) Manu Abraham (abraham.manu@gmail.com)
Manu Abrahamdd827da2009-12-04 05:00:30 -03005
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef __MANTIS_LINK_H
22#define __MANTIS_LINK_H
23
Manu Abrahamf6843362009-12-04 05:34:19 -030024#include <linux/mutex.h>
Manu Abraham12855ca2009-12-04 05:09:04 -030025#include <linux/workqueue.h>
Manu Abraham60532402009-12-04 05:11:14 -030026#include "dvb_ca_en50221.h"
Manu Abraham12855ca2009-12-04 05:09:04 -030027
Manu Abrahamdd827da2009-12-04 05:00:30 -030028enum mantis_sbuf_status {
29 MANTIS_SBUF_DATA_AVAIL = 1,
30 MANTIS_SBUF_DATA_EMPTY = 2,
31 MANTIS_SBUF_DATA_OVFLW = 3
32};
33
34struct mantis_slot {
35 u32 timeout;
Manu Abrahamd8b14f82009-12-04 05:09:47 -030036 u32 slave_cfg;
37 u32 bar;
Manu Abrahamdd827da2009-12-04 05:00:30 -030038};
39
Manu Abraham8ce571f2009-12-04 05:06:00 -030040/* Physical layer */
41enum mantis_slot_state {
42 MODULE_INSERTED = 3,
43 MODULE_XTRACTED = 4
44};
45
Manu Abrahamdd827da2009-12-04 05:00:30 -030046struct mantis_ca {
Manu Abrahamd8b14f82009-12-04 05:09:47 -030047 struct mantis_slot slot[4];
Manu Abrahamdd827da2009-12-04 05:00:30 -030048
Manu Abraham12855ca2009-12-04 05:09:04 -030049 struct work_struct hif_evm_work;
Manu Abrahamdd827da2009-12-04 05:00:30 -030050
51 u32 hif_event;
52 wait_queue_head_t hif_opdone_wq;
53 wait_queue_head_t hif_brrdyw_wq;
54 wait_queue_head_t hif_data_wq;
Manu Abrahame0e099a2009-12-04 05:29:48 -030055 wait_queue_head_t hif_write_wq; /* HIF Write op */
Manu Abrahamdd827da2009-12-04 05:00:30 -030056
57 enum mantis_sbuf_status sbuf_status;
58
Manu Abraham8ce571f2009-12-04 05:06:00 -030059 enum mantis_slot_state slot_state;
60
Manu Abrahamdd827da2009-12-04 05:00:30 -030061 void *ca_priv;
Manu Abraham60532402009-12-04 05:11:14 -030062
63 struct dvb_ca_en50221 en50221;
Manu Abrahamf6843362009-12-04 05:34:19 -030064 struct mutex ca_lock;
Manu Abrahamdd827da2009-12-04 05:00:30 -030065};
66
Manu Abraham50d82602009-12-04 05:06:38 -030067/* CA */
68extern void mantis_event_cam_plugin(struct mantis_ca *ca);
69extern void mantis_event_cam_unplug(struct mantis_ca *ca);
70extern int mantis_pcmcia_init(struct mantis_ca *ca);
71extern void mantis_pcmcia_exit(struct mantis_ca *ca);
72extern int mantis_evmgr_init(struct mantis_ca *ca);
73extern void mantis_evmgr_exit(struct mantis_ca *ca);
74
Manu Abrahamd8b14f82009-12-04 05:09:47 -030075/* HIF */
76extern int mantis_hif_init(struct mantis_ca *ca);
77extern void mantis_hif_exit(struct mantis_ca *ca);
78extern int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr);
79extern int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data);
Manu Abraham60532402009-12-04 05:11:14 -030080extern int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr);
81extern int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data);
Manu Abrahamd8b14f82009-12-04 05:09:47 -030082
Manu Abrahamb3b96142009-12-04 05:41:11 -030083#endif /* __MANTIS_LINK_H */