PageRenderTime 87ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/staging/tidspbridge/include/dspbridge/dspapi-ioctl.h

https://github.com/mstsirkin/linux
C Header | 467 lines | 347 code | 69 blank | 51 comment | 0 complexity | ce2bbc228852e5066a81af6412f05e8e MD5 | raw file
  1. /*
  2. * dspapi-ioctl.h
  3. *
  4. * DSP-BIOS Bridge driver support functions for TI OMAP processors.
  5. *
  6. * Contains structures and commands that are used for interaction
  7. * between the DDSP API and Bridge driver.
  8. *
  9. * Copyright (C) 2008 Texas Instruments, Inc.
  10. *
  11. * This package is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. *
  15. * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  16. * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  17. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  18. */
  19. #ifndef DSPAPIIOCTL_
  20. #define DSPAPIIOCTL_
  21. #include <dspbridge/cmm.h>
  22. #include <dspbridge/strmdefs.h>
  23. #include <dspbridge/dbdcd.h>
  24. union trapped_args {
  25. /* MGR Module */
  26. struct {
  27. u32 node_id;
  28. struct dsp_ndbprops __user *ndb_props;
  29. u32 ndb_props_size;
  30. u32 __user *num_nodes;
  31. } args_mgr_enumnode_info;
  32. struct {
  33. u32 processor_id;
  34. struct dsp_processorinfo __user *processor_info;
  35. u32 processor_info_size;
  36. u32 __user *num_procs;
  37. } args_mgr_enumproc_info;
  38. struct {
  39. struct dsp_uuid *uuid_obj;
  40. enum dsp_dcdobjtype obj_type;
  41. char *sz_path_name;
  42. } args_mgr_registerobject;
  43. struct {
  44. struct dsp_uuid *uuid_obj;
  45. enum dsp_dcdobjtype obj_type;
  46. } args_mgr_unregisterobject;
  47. struct {
  48. struct dsp_notification __user *__user *anotifications;
  49. u32 count;
  50. u32 __user *index;
  51. u32 timeout;
  52. } args_mgr_wait;
  53. /* PROC Module */
  54. struct {
  55. u32 processor_id;
  56. struct dsp_processorattrin __user *attr_in;
  57. void *__user *ph_processor;
  58. } args_proc_attach;
  59. struct {
  60. void *processor;
  61. u32 cmd;
  62. struct dsp_cbdata __user *args;
  63. } args_proc_ctrl;
  64. struct {
  65. void *processor;
  66. } args_proc_detach;
  67. struct {
  68. void *processor;
  69. void *__user *node_tab;
  70. u32 node_tab_size;
  71. u32 __user *num_nodes;
  72. u32 __user *allocated;
  73. } args_proc_enumnode_info;
  74. struct {
  75. void *processor;
  76. u32 resource_type;
  77. struct dsp_resourceinfo *resource_info;
  78. u32 resource_info_size;
  79. } args_proc_enumresources;
  80. struct {
  81. void *processor;
  82. struct dsp_processorstate __user *proc_state_obj;
  83. u32 state_info_size;
  84. } args_proc_getstate;
  85. struct {
  86. void *processor;
  87. u8 __user *buf;
  88. u8 __user *size;
  89. u32 max_size;
  90. } args_proc_gettrace;
  91. struct {
  92. void *processor;
  93. s32 argc_index;
  94. char __user *__user *user_args;
  95. char *__user *user_envp;
  96. } args_proc_load;
  97. struct {
  98. void *processor;
  99. u32 event_mask;
  100. u32 notify_type;
  101. struct dsp_notification __user *notification;
  102. } args_proc_register_notify;
  103. struct {
  104. void *processor;
  105. u32 size;
  106. void *__user *rsv_addr;
  107. } args_proc_rsvmem;
  108. struct {
  109. void *processor;
  110. u32 size;
  111. void *rsv_addr;
  112. } args_proc_unrsvmem;
  113. struct {
  114. void *processor;
  115. void *mpu_addr;
  116. u32 size;
  117. void *req_addr;
  118. void *__user *map_addr;
  119. u32 map_attr;
  120. } args_proc_mapmem;
  121. struct {
  122. void *processor;
  123. u32 size;
  124. void *map_addr;
  125. } args_proc_unmapmem;
  126. struct {
  127. void *processor;
  128. void *mpu_addr;
  129. u32 size;
  130. u32 dir;
  131. } args_proc_dma;
  132. struct {
  133. void *processor;
  134. void *mpu_addr;
  135. u32 size;
  136. u32 flags;
  137. } args_proc_flushmemory;
  138. struct {
  139. void *processor;
  140. void *mpu_addr;
  141. u32 size;
  142. } args_proc_invalidatememory;
  143. /* NODE Module */
  144. struct {
  145. void *processor;
  146. struct dsp_uuid __user *node_id_ptr;
  147. struct dsp_cbdata __user *args;
  148. struct dsp_nodeattrin __user *attr_in;
  149. void *__user *node;
  150. } args_node_allocate;
  151. struct {
  152. void *node;
  153. u32 size;
  154. struct dsp_bufferattr __user *attr;
  155. u8 *__user *buffer;
  156. } args_node_allocmsgbuf;
  157. struct {
  158. void *node;
  159. s32 prio;
  160. } args_node_changepriority;
  161. struct {
  162. void *node;
  163. u32 stream_id;
  164. void *other_node;
  165. u32 other_stream;
  166. struct dsp_strmattr __user *attrs;
  167. struct dsp_cbdata __user *conn_param;
  168. } args_node_connect;
  169. struct {
  170. void *node;
  171. } args_node_create;
  172. struct {
  173. void *node;
  174. } args_node_delete;
  175. struct {
  176. void *node;
  177. struct dsp_bufferattr __user *attr;
  178. u8 *buffer;
  179. } args_node_freemsgbuf;
  180. struct {
  181. void *node;
  182. struct dsp_nodeattr __user *attr;
  183. u32 attr_size;
  184. } args_node_getattr;
  185. struct {
  186. void *node;
  187. struct dsp_msg __user *message;
  188. u32 timeout;
  189. } args_node_getmessage;
  190. struct {
  191. void *node;
  192. } args_node_pause;
  193. struct {
  194. void *node;
  195. struct dsp_msg __user *message;
  196. u32 timeout;
  197. } args_node_putmessage;
  198. struct {
  199. void *node;
  200. u32 event_mask;
  201. u32 notify_type;
  202. struct dsp_notification __user *notification;
  203. } args_node_registernotify;
  204. struct {
  205. void *node;
  206. } args_node_run;
  207. struct {
  208. void *node;
  209. int __user *status;
  210. } args_node_terminate;
  211. struct {
  212. void *processor;
  213. struct dsp_uuid __user *node_id_ptr;
  214. struct dsp_ndbprops __user *node_props;
  215. } args_node_getuuidprops;
  216. /* STRM module */
  217. struct {
  218. void *stream;
  219. u32 size;
  220. u8 *__user *ap_buffer;
  221. u32 num_bufs;
  222. } args_strm_allocatebuffer;
  223. struct {
  224. void *stream;
  225. } args_strm_close;
  226. struct {
  227. void *stream;
  228. u8 *__user *ap_buffer;
  229. u32 num_bufs;
  230. } args_strm_freebuffer;
  231. struct {
  232. void *stream;
  233. void **event;
  234. } args_strm_geteventhandle;
  235. struct {
  236. void *stream;
  237. struct stream_info __user *stream_info;
  238. u32 stream_info_size;
  239. } args_strm_getinfo;
  240. struct {
  241. void *stream;
  242. bool flush_flag;
  243. } args_strm_idle;
  244. struct {
  245. void *stream;
  246. u8 *buffer;
  247. u32 bytes;
  248. u32 buf_size;
  249. u32 arg;
  250. } args_strm_issue;
  251. struct {
  252. void *node;
  253. u32 direction;
  254. u32 index;
  255. struct strm_attr __user *attr_in;
  256. void *__user *stream;
  257. } args_strm_open;
  258. struct {
  259. void *stream;
  260. u8 *__user *buf_ptr;
  261. u32 __user *bytes;
  262. u32 __user *buf_size_ptr;
  263. u32 __user *arg;
  264. } args_strm_reclaim;
  265. struct {
  266. void *stream;
  267. u32 event_mask;
  268. u32 notify_type;
  269. struct dsp_notification __user *notification;
  270. } args_strm_registernotify;
  271. struct {
  272. void *__user *stream_tab;
  273. u32 strm_num;
  274. u32 __user *mask;
  275. u32 timeout;
  276. } args_strm_select;
  277. /* CMM Module */
  278. struct {
  279. struct cmm_object *cmm_mgr;
  280. u32 size;
  281. struct cmm_attrs *attrs;
  282. void **buf_va;
  283. } args_cmm_allocbuf;
  284. struct {
  285. struct cmm_object *cmm_mgr;
  286. void *buf_pa;
  287. u32 seg_id;
  288. } args_cmm_freebuf;
  289. struct {
  290. void *processor;
  291. struct cmm_object *__user *cmm_mgr;
  292. } args_cmm_gethandle;
  293. struct {
  294. struct cmm_object *cmm_mgr;
  295. struct cmm_info __user *cmm_info_obj;
  296. } args_cmm_getinfo;
  297. /* UTIL module */
  298. struct {
  299. s32 util_argc;
  300. char **argv;
  301. } args_util_testdll;
  302. };
  303. /*
  304. * Dspbridge Ioctl numbering scheme
  305. *
  306. * 7 0
  307. * ---------------------------------
  308. * | Module | Ioctl Number |
  309. * ---------------------------------
  310. * | x | x | x | 0 | 0 | 0 | 0 | 0 |
  311. * ---------------------------------
  312. */
  313. /* Ioctl driver identifier */
  314. #define DB 0xDB
  315. /*
  316. * Following are used to distinguish between module ioctls, this is needed
  317. * in case new ioctls are introduced.
  318. */
  319. #define DB_MODULE_MASK 0xE0
  320. #define DB_IOC_MASK 0x1F
  321. /* Ioctl module masks */
  322. #define DB_MGR 0x0
  323. #define DB_PROC 0x20
  324. #define DB_NODE 0x40
  325. #define DB_STRM 0x60
  326. #define DB_CMM 0x80
  327. #define DB_MODULE_SHIFT 5
  328. /* Used to calculate the ioctl per dspbridge module */
  329. #define DB_IOC(module, num) \
  330. (((module) & DB_MODULE_MASK) | ((num) & DB_IOC_MASK))
  331. /* Used to get dspbridge ioctl module */
  332. #define DB_GET_MODULE(cmd) ((cmd) & DB_MODULE_MASK)
  333. /* Used to get dspbridge ioctl number */
  334. #define DB_GET_IOC(cmd) ((cmd) & DB_IOC_MASK)
  335. /* TODO: Remove deprecated and not implemented */
  336. /* MGR Module */
  337. #define MGR_ENUMNODE_INFO _IOWR(DB, DB_IOC(DB_MGR, 0), unsigned long)
  338. #define MGR_ENUMPROC_INFO _IOWR(DB, DB_IOC(DB_MGR, 1), unsigned long)
  339. #define MGR_REGISTEROBJECT _IOWR(DB, DB_IOC(DB_MGR, 2), unsigned long)
  340. #define MGR_UNREGISTEROBJECT _IOWR(DB, DB_IOC(DB_MGR, 3), unsigned long)
  341. #define MGR_WAIT _IOWR(DB, DB_IOC(DB_MGR, 4), unsigned long)
  342. /* MGR_GET_PROC_RES Deprecated */
  343. #define MGR_GET_PROC_RES _IOR(DB, DB_IOC(DB_MGR, 5), unsigned long)
  344. /* PROC Module */
  345. #define PROC_ATTACH _IOWR(DB, DB_IOC(DB_PROC, 0), unsigned long)
  346. #define PROC_CTRL _IOR(DB, DB_IOC(DB_PROC, 1), unsigned long)
  347. /* PROC_DETACH Deprecated */
  348. #define PROC_DETACH _IOR(DB, DB_IOC(DB_PROC, 2), unsigned long)
  349. #define PROC_ENUMNODE _IOWR(DB, DB_IOC(DB_PROC, 3), unsigned long)
  350. #define PROC_ENUMRESOURCES _IOWR(DB, DB_IOC(DB_PROC, 4), unsigned long)
  351. #define PROC_GET_STATE _IOWR(DB, DB_IOC(DB_PROC, 5), unsigned long)
  352. #define PROC_GET_TRACE _IOWR(DB, DB_IOC(DB_PROC, 6), unsigned long)
  353. #define PROC_LOAD _IOW(DB, DB_IOC(DB_PROC, 7), unsigned long)
  354. #define PROC_REGISTERNOTIFY _IOWR(DB, DB_IOC(DB_PROC, 8), unsigned long)
  355. #define PROC_START _IOW(DB, DB_IOC(DB_PROC, 9), unsigned long)
  356. #define PROC_RSVMEM _IOWR(DB, DB_IOC(DB_PROC, 10), unsigned long)
  357. #define PROC_UNRSVMEM _IOW(DB, DB_IOC(DB_PROC, 11), unsigned long)
  358. #define PROC_MAPMEM _IOWR(DB, DB_IOC(DB_PROC, 12), unsigned long)
  359. #define PROC_UNMAPMEM _IOR(DB, DB_IOC(DB_PROC, 13), unsigned long)
  360. #define PROC_FLUSHMEMORY _IOW(DB, DB_IOC(DB_PROC, 14), unsigned long)
  361. #define PROC_STOP _IOWR(DB, DB_IOC(DB_PROC, 15), unsigned long)
  362. #define PROC_INVALIDATEMEMORY _IOW(DB, DB_IOC(DB_PROC, 16), unsigned long)
  363. #define PROC_BEGINDMA _IOW(DB, DB_IOC(DB_PROC, 17), unsigned long)
  364. #define PROC_ENDDMA _IOW(DB, DB_IOC(DB_PROC, 18), unsigned long)
  365. /* NODE Module */
  366. #define NODE_ALLOCATE _IOWR(DB, DB_IOC(DB_NODE, 0), unsigned long)
  367. #define NODE_ALLOCMSGBUF _IOWR(DB, DB_IOC(DB_NODE, 1), unsigned long)
  368. #define NODE_CHANGEPRIORITY _IOW(DB, DB_IOC(DB_NODE, 2), unsigned long)
  369. #define NODE_CONNECT _IOW(DB, DB_IOC(DB_NODE, 3), unsigned long)
  370. #define NODE_CREATE _IOW(DB, DB_IOC(DB_NODE, 4), unsigned long)
  371. #define NODE_DELETE _IOW(DB, DB_IOC(DB_NODE, 5), unsigned long)
  372. #define NODE_FREEMSGBUF _IOW(DB, DB_IOC(DB_NODE, 6), unsigned long)
  373. #define NODE_GETATTR _IOWR(DB, DB_IOC(DB_NODE, 7), unsigned long)
  374. #define NODE_GETMESSAGE _IOWR(DB, DB_IOC(DB_NODE, 8), unsigned long)
  375. #define NODE_PAUSE _IOW(DB, DB_IOC(DB_NODE, 9), unsigned long)
  376. #define NODE_PUTMESSAGE _IOW(DB, DB_IOC(DB_NODE, 10), unsigned long)
  377. #define NODE_REGISTERNOTIFY _IOWR(DB, DB_IOC(DB_NODE, 11), unsigned long)
  378. #define NODE_RUN _IOW(DB, DB_IOC(DB_NODE, 12), unsigned long)
  379. #define NODE_TERMINATE _IOWR(DB, DB_IOC(DB_NODE, 13), unsigned long)
  380. #define NODE_GETUUIDPROPS _IOWR(DB, DB_IOC(DB_NODE, 14), unsigned long)
  381. /* STRM Module */
  382. #define STRM_ALLOCATEBUFFER _IOWR(DB, DB_IOC(DB_STRM, 0), unsigned long)
  383. #define STRM_CLOSE _IOW(DB, DB_IOC(DB_STRM, 1), unsigned long)
  384. #define STRM_FREEBUFFER _IOWR(DB, DB_IOC(DB_STRM, 2), unsigned long)
  385. #define STRM_GETEVENTHANDLE _IO(DB, DB_IOC(DB_STRM, 3)) /* Not Impl'd */
  386. #define STRM_GETINFO _IOWR(DB, DB_IOC(DB_STRM, 4), unsigned long)
  387. #define STRM_IDLE _IOW(DB, DB_IOC(DB_STRM, 5), unsigned long)
  388. #define STRM_ISSUE _IOW(DB, DB_IOC(DB_STRM, 6), unsigned long)
  389. #define STRM_OPEN _IOWR(DB, DB_IOC(DB_STRM, 7), unsigned long)
  390. #define STRM_RECLAIM _IOWR(DB, DB_IOC(DB_STRM, 8), unsigned long)
  391. #define STRM_REGISTERNOTIFY _IOWR(DB, DB_IOC(DB_STRM, 9), unsigned long)
  392. #define STRM_SELECT _IOWR(DB, DB_IOC(DB_STRM, 10), unsigned long)
  393. /* CMM Module */
  394. #define CMM_ALLOCBUF _IO(DB, DB_IOC(DB_CMM, 0)) /* Not Impl'd */
  395. #define CMM_FREEBUF _IO(DB, DB_IOC(DB_CMM, 1)) /* Not Impl'd */
  396. #define CMM_GETHANDLE _IOR(DB, DB_IOC(DB_CMM, 2), unsigned long)
  397. #define CMM_GETINFO _IOR(DB, DB_IOC(DB_CMM, 3), unsigned long)
  398. #endif /* DSPAPIIOCTL_ */