[ifxmips]
[openwrt/svn-archive/archive.git] / package / lqtapi / src / mps / vmmc.h
1 #ifndef __VMMC_H__
2
3 #include <linux/list.h>
4 #include <linux/tapi/tapi.h>
5
6 #include "mps.h"
7 #include "vmmc-module.h"
8
9 struct vmmc
10 {
11 struct mps *mps;
12 struct device *dev;
13
14 struct vmmc_port *ports;
15
16 struct completion firmware_loaded_completion;
17 struct completion cmd_completion;
18
19 struct mps_mailbox mbox_cmd;
20 struct mps_mailbox mbox_data;
21 struct mps_fifo fifo_event;
22
23 int irq_fw_loaded;
24 int irq_mbox_cmd;
25 int irq_mbox_data;
26 int irq_event_fifo;
27 int irq_cmd_error;
28
29 unsigned int num_coders;
30 struct vmmc_coder *coder;
31 unsigned long coder_used;
32
33 struct list_head modules;
34
35 struct tapi_device tdev;
36
37 struct sk_buff_head recv_queue;
38 struct sk_buff_head send_queue;
39 };
40
41 static inline struct vmmc *tdev_to_vmmc(struct tapi_device *tdev)
42 {
43 return container_of(tdev, struct vmmc, tdev);
44 }
45
46 static inline void vmmc_register_module(struct vmmc *vmmc,
47 struct vmmc_module *module)
48 {
49 list_add_tail(&module->head, &vmmc->modules);
50 }
51
52 static inline void vmmc_unregister_module(struct vmmc *vmmc,
53 struct vmmc_module *module)
54 {
55 list_del(&module->head);
56 }
57
58 int vmmc_command_write(struct vmmc *vmmc, uint32_t cmd,
59 const uint32_t *data);
60 int vmmc_command_read(struct vmmc *vmmc, uint32_t cmd, uint32_t *result);
61
62 struct vmmc_coder *vmmc_coder_get(struct vmmc *);
63 void vmmc_coder_put(struct vmmc *, struct vmmc_coder *);
64 void vmmc_init_coders(struct vmmc *);
65
66 void vmmc_send_paket(struct vmmc *vmmc, unsigned int chan, struct sk_buff *skb);
67
68 #endif