cx18-mailbox.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * cx18 mailbox functions
  4. *
  5. * Copyright (C) 2007 Hans Verkuil <[email protected]>
  6. * Copyright (C) 2008 Andy Walls <[email protected]>
  7. */
  8. #ifndef _CX18_MAILBOX_H_
  9. #define _CX18_MAILBOX_H_
  10. /* mailbox max args */
  11. #define MAX_MB_ARGUMENTS 6
  12. /* compatibility, should be same as the define in cx2341x.h */
  13. #define CX2341X_MBOX_MAX_DATA 16
  14. #define MB_RESERVED_HANDLE_0 0
  15. #define MB_RESERVED_HANDLE_1 0xFFFFFFFF
  16. #define APU 0
  17. #define CPU 1
  18. #define EPU 2
  19. #define HPU 3
  20. struct cx18;
  21. /*
  22. * This structure is used by CPU to provide completed MDL & buffers information.
  23. * Its structure is dictated by the layout of the SCB, required by the
  24. * firmware, but its definition needs to be here, instead of in cx18-scb.h,
  25. * for mailbox work order scheduling
  26. */
  27. struct cx18_mdl_ack {
  28. u32 id; /* ID of a completed MDL */
  29. u32 data_used; /* Total data filled in the MDL with 'id' */
  30. };
  31. /* The cx18_mailbox struct is the mailbox structure which is used for passing
  32. messages between processors */
  33. struct cx18_mailbox {
  34. /* The sender sets a handle in 'request' after he fills the command. The
  35. 'request' should be different than 'ack'. The sender, also, generates
  36. an interrupt on XPU2YPU_irq where XPU is the sender and YPU is the
  37. receiver. */
  38. u32 request;
  39. /* The receiver detects a new command when 'req' is different than 'ack'.
  40. He sets 'ack' to the same value as 'req' to clear the command. He, also,
  41. generates an interrupt on YPU2XPU_irq where XPU is the sender and YPU
  42. is the receiver. */
  43. u32 ack;
  44. u32 reserved[6];
  45. /* 'cmd' identifies the command. The list of these commands are in
  46. cx23418.h */
  47. u32 cmd;
  48. /* Each command can have up to 6 arguments */
  49. u32 args[MAX_MB_ARGUMENTS];
  50. /* The return code can be one of the codes in the file cx23418.h. If the
  51. command is completed successfully, the error will be ERR_SYS_SUCCESS.
  52. If it is pending, the code is ERR_SYS_PENDING. If it failed, the error
  53. code would indicate the task from which the error originated and will
  54. be one of the errors in cx23418.h. In that case, the following
  55. applies ((error & 0xff) != 0).
  56. If the command is pending, the return will be passed in a MB from the
  57. receiver to the sender. 'req' will be returned in args[0] */
  58. u32 error;
  59. };
  60. struct cx18_stream;
  61. int cx18_api(struct cx18 *cx, u32 cmd, int args, u32 data[]);
  62. int cx18_vapi_result(struct cx18 *cx, u32 data[MAX_MB_ARGUMENTS], u32 cmd,
  63. int args, ...);
  64. int cx18_vapi(struct cx18 *cx, u32 cmd, int args, ...);
  65. int cx18_api_func(void *priv, u32 cmd, int in, int out,
  66. u32 data[CX2341X_MBOX_MAX_DATA]);
  67. void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu);
  68. void cx18_in_work_handler(struct work_struct *work);
  69. #endif