6 #include <linux/wait.h>
7 #include <linux/workqueue.h>
9 typedef u32 mbox_msg_t;
10 typedef void (mbox_receiver_t)(mbox_msg_t msg);
14 typedef int __bitwise omap_mbox_irq_t;
15 #define IRQ_TX ((__force omap_mbox_irq_t) 1)
16 #define IRQ_RX ((__force omap_mbox_irq_t) 2)
18 typedef int __bitwise omap_mbox_type_t;
19 #define OMAP_MBOX_TYPE1 ((__force omap_mbox_type_t) 1)
20 #define OMAP_MBOX_TYPE2 ((__force omap_mbox_type_t) 2)
22 struct omap_mbox_ops {
23 omap_mbox_type_t type;
24 int (*startup)(struct omap_mbox *mbox);
25 void (*shutdown)(struct omap_mbox *mbox);
27 mbox_msg_t (*fifo_read)(struct omap_mbox *mbox);
28 void (*fifo_write)(struct omap_mbox *mbox, mbox_msg_t msg);
29 int (*fifo_empty)(struct omap_mbox *mbox);
30 int (*fifo_full)(struct omap_mbox *mbox);
32 void (*enable_irq)(struct omap_mbox *mbox, omap_mbox_irq_t irq);
33 void (*disable_irq)(struct omap_mbox *mbox, omap_mbox_irq_t irq);
34 void (*ack_irq)(struct omap_mbox *mbox, omap_mbox_irq_t irq);
35 int (*is_irq)(struct omap_mbox *mbox, omap_mbox_irq_t irq);
42 struct omap_mbox_ops *ops;
44 wait_queue_head_t tx_waitq;
46 struct work_struct msg_receive;
47 void (*msg_receive_cb)(mbox_msg_t);
50 int (*msg_sender_cb)(void*);
52 mbox_msg_t seq_snd, seq_rcv;
54 struct class_device class_dev;
58 struct omap_mbox *next;
61 int omap_mbox_msg_send(struct omap_mbox *mbox_h, mbox_msg_t msg, void* arg);
62 void omap_mbox_init_seq(struct omap_mbox *mbox);
64 struct omap_mbox *omap_mbox_get(const char *name);
65 int omap_mbox_register(struct omap_mbox *mbox);
66 int omap_mbox_unregister(struct omap_mbox *mbox);
68 #endif /* MAILBOX_H */