PageRenderTime 95ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/arch/arm/mach-fsm/qdsp6/dal.h

https://bitbucket.org/sammyz/iscream_thunderc-2.6.35-rebase
C++ Header | 94 lines | 62 code | 14 blank | 18 comment | 3 complexity | 2bcf54114b41b08fcbbc0e648305d26e MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
  1. /* arch/arm/mach-msm/qdsp6/dal.h
  2. *
  3. * Copyright (C) 2009 Google, Inc.
  4. * Author: Brian Swetland <swetland@google.com>
  5. *
  6. * This software is licensed under the terms of the GNU General Public
  7. * License version 2, as published by the Free Software Foundation, and
  8. * may be copied, distributed, and modified under those terms.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. */
  16. #ifndef _MACH_MSM_DAL_
  17. #define _MACH_MSM_DAL_
  18. struct dal_client;
  19. struct dal_info {
  20. uint32_t size;
  21. uint32_t version;
  22. char name[32];
  23. };
  24. typedef void (*dal_event_func_t)(void *data, int len, void *cookie);
  25. struct dal_client *dal_attach(uint32_t device_id, const char *name,
  26. uint32_t cpu, dal_event_func_t func, void *cookie);
  27. int dal_detach(struct dal_client *client);
  28. int dal_call(struct dal_client *client,
  29. unsigned ddi, unsigned prototype,
  30. void *data, int data_len,
  31. void *reply, int reply_max);
  32. void dal_trace(struct dal_client *client);
  33. void dal_trace_dump(struct dal_client *client);
  34. /* function to call before panic on stalled dal calls */
  35. void dal_set_oops(struct dal_client *client, void (*oops)(void));
  36. /* convenience wrappers */
  37. int dal_call_f0(struct dal_client *client, uint32_t ddi,
  38. uint32_t arg1);
  39. int dal_call_f1(struct dal_client *client, uint32_t ddi,
  40. uint32_t arg1, uint32_t arg2);
  41. int dal_call_f5(struct dal_client *client, uint32_t ddi,
  42. void *ibuf, uint32_t ilen);
  43. int dal_call_f6(struct dal_client *client, uint32_t ddi,
  44. uint32_t s1, void *ibuf, uint32_t ilen);
  45. int dal_call_f9(struct dal_client *client, uint32_t ddi,
  46. void *obuf, uint32_t olen);
  47. int dal_call_f13(struct dal_client *client, uint32_t ddi, void *ibuf1,
  48. uint32_t ilen1, void *ibuf2, uint32_t ilen2, void *obuf,
  49. uint32_t olen);
  50. int dal_call_f14(struct dal_client *client, uint32_t ddi, void *ibuf,
  51. uint32_t ilen, void *obuf1, uint32_t olen1, void *obuf2,
  52. uint32_t olen2, uint32_t *oalen2);
  53. /* common DAL operations */
  54. enum {
  55. DAL_OP_ATTACH = 0,
  56. DAL_OP_DETACH,
  57. DAL_OP_INIT,
  58. DAL_OP_DEINIT,
  59. DAL_OP_OPEN,
  60. DAL_OP_CLOSE,
  61. DAL_OP_INFO,
  62. DAL_OP_POWEREVENT,
  63. DAL_OP_SYSREQUEST,
  64. DAL_OP_FIRST_DEVICE_API,
  65. };
  66. static inline int check_version(struct dal_client *client, uint32_t version)
  67. {
  68. struct dal_info info;
  69. int res;
  70. res = dal_call_f9(client, DAL_OP_INFO, &info, sizeof(struct dal_info));
  71. if (!res) {
  72. if (((info.version & 0xFFFF0000) != (version & 0xFFFF0000)) ||
  73. ((info.version & 0x0000FFFF) <
  74. (version & 0x0000FFFF))) {
  75. res = -EINVAL;
  76. }
  77. }
  78. return res;
  79. }
  80. #endif