home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / src / linux-headers-2.6.28-15 / arch / arm / plat-omap / include / mach / mailbox.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-12-24  |  1.8 KB  |  74 lines

  1. /* mailbox.h */
  2.  
  3. #ifndef MAILBOX_H
  4. #define MAILBOX_H
  5.  
  6. #include <linux/wait.h>
  7. #include <linux/workqueue.h>
  8. #include <linux/blkdev.h>
  9.  
  10. typedef u32 mbox_msg_t;
  11. typedef void (mbox_receiver_t)(mbox_msg_t msg);
  12. struct omap_mbox;
  13.  
  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)
  17.  
  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)
  21.  
  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);
  26.     /* fifo */
  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);
  31.     /* irq */
  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);
  36. };
  37.  
  38. struct omap_mbox_queue {
  39.     spinlock_t        lock;
  40.     struct request_queue    *queue;
  41.     struct work_struct    work;
  42.     int    (*callback)(void *);
  43.     struct omap_mbox    *mbox;
  44. };
  45.  
  46. struct omap_mbox {
  47.     char            *name;
  48.     unsigned int        irq;
  49.  
  50.     struct omap_mbox_queue    *txq, *rxq;
  51.  
  52.     struct omap_mbox_ops    *ops;
  53.  
  54.     mbox_msg_t        seq_snd, seq_rcv;
  55.  
  56.     struct device        dev;
  57.  
  58.     struct omap_mbox    *next;
  59.     void            *priv;
  60.  
  61.     void            (*err_notify)(void);
  62. };
  63.  
  64. int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg, void *);
  65. void omap_mbox_init_seq(struct omap_mbox *);
  66.  
  67. struct omap_mbox *omap_mbox_get(const char *);
  68. void omap_mbox_put(struct omap_mbox *);
  69.  
  70. int omap_mbox_register(struct omap_mbox *);
  71. int omap_mbox_unregister(struct omap_mbox *);
  72.  
  73. #endif /* MAILBOX_H */
  74.