ccci_ipc.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*****************************************************************************
  2. *
  3. *Filename:
  4. *---------
  5. *ccci_ipc.h
  6. *
  7. *
  8. *Author:
  9. *-------
  10. *Yalin wang (mtk80678)
  11. *
  12. ****************************************************************************/
  13. #ifndef __CCCI_IPC_H__
  14. #define __CCCI_IPC_H__
  15. #include <linux/kernel.h>
  16. #include <linux/types.h>
  17. #include <linux/spinlock.h>
  18. #include <linux/wait.h>
  19. #include <linux/device.h>
  20. #include <linux/fs.h>
  21. #include <linux/cdev.h>
  22. #include <linux/timer.h>
  23. #include <linux/list.h>
  24. #include <linux/sched.h>
  25. #include <linux/mutex.h>
  26. #include <linux/bitops.h>
  27. #include <linux/atomic.h>
  28. #include "ccci_tty.h"
  29. #define IPC_MSGSVC_RVC_DONE 0x12344321
  30. #define MAX_NUM_IPC_TASKS_MD 10
  31. #define MAX_NUM_IPC_TASKS 10
  32. #define CCCI_IPC_BUFFER_SIZE (4<<10)
  33. #define CCCI_IPC_DEV_MAJOR 183
  34. #define CCCI_TASK_PENDING 0x01
  35. #define CCCI_MD_IMAGE_MAPPING_SIZE (20<<20)
  36. #define CCCI_IPC_MAGIC 'P'
  37. #define CCCI_IPC_RESET_RECV _IO(CCCI_IPC_MAGIC, 0)
  38. #define CCCI_IPC_RESET_SEND _IO(CCCI_IPC_MAGIC, 1)
  39. #define CCCI_IPC_WAIT_MD_READY _IO(CCCI_IPC_MAGIC, 2)
  40. typedef unsigned int uint32;
  41. typedef unsigned char uint8;
  42. typedef unsigned short uint16;
  43. typedef struct {
  44. uint8 ref_count;
  45. uint16 msg_len;
  46. uint8 data[0];
  47. } local_para_struct;
  48. typedef struct {
  49. uint16 pdu_len;
  50. uint8 ref_count;
  51. uint8 pb_resvered;
  52. uint16 free_header_space;
  53. uint16 free_tail_space;
  54. uint8 data[0];
  55. } peer_buff_struct;
  56. typedef struct ipc_ilm_struct {
  57. uint32 src_mod_id;
  58. uint32 dest_mod_id;
  59. uint32 sap_id;
  60. uint32 msg_id;
  61. local_para_struct *local_para_ptr;
  62. peer_buff_struct *peer_buff_ptr;
  63. } ipc_ilm_t;
  64. typedef struct {
  65. uint32 rx_offset;
  66. uint32 tx_offset;
  67. uint32 size;
  68. uint8 buffer[CCCI_IPC_BUFFER_SIZE];
  69. } BUFF;
  70. typedef struct {
  71. BUFF buff_wr;
  72. BUFF buff_rd;
  73. } CCCI_IPC_BUFFER;
  74. typedef struct {
  75. ipc_ilm_t ilm_md[MAX_NUM_IPC_TASKS_MD]; /*md side ilms */
  76. ipc_ilm_t ilm[MAX_NUM_IPC_TASKS];
  77. CCCI_IPC_BUFFER buffer;
  78. } CCCI_IPC_MEM;
  79. typedef struct {
  80. struct list_head list;
  81. void *data;
  82. uint32 len;
  83. } CCCI_RECV_ITEM;
  84. typedef struct {
  85. spinlock_t lock;
  86. unsigned long flag;
  87. atomic_t user;
  88. unsigned long w_jiffies;
  89. uint32 to_id;
  90. struct fasync_struct *fasync;
  91. ipc_ilm_t *ilm_p;
  92. uint32 time_out;
  93. uint32 ilm_phy_addr;
  94. wait_queue_head_t read_wait_queue;
  95. wait_queue_head_t write_wait_queue;
  96. struct list_head recv_list;
  97. void *owner;
  98. } IPC_TASK;
  99. typedef struct IPC_MSGSVC_TASKMAP_STRUCT {
  100. uint32 extq_id; /*IPC universal mapping external queue */
  101. uint32 task_id; /*IPC processor internal task id */
  102. } IPC_MSGSVC_TASKMAP_T;
  103. extern int __init ccci_ipc_init(int);
  104. extern void __exit ccci_ipc_exit(int);
  105. #define offset_of(type, mem) ((uint32)(&(((type *)0)->mem)))
  106. #define CCCI_IPC_SMEM_SIZE (sizeof(CCCI_IPC_MEM))
  107. #endif /*__CCCI_IPC_H__ */