1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * cx18 mailbox functions
5 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
6 * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net>
9 #ifndef _CX18_MAILBOX_H_
10 #define _CX18_MAILBOX_H_
12 /* mailbox max args */
13 #define MAX_MB_ARGUMENTS 6
14 /* compatibility, should be same as the define in cx2341x.h */
15 #define CX2341X_MBOX_MAX_DATA 16
17 #define MB_RESERVED_HANDLE_0 0
18 #define MB_RESERVED_HANDLE_1 0xFFFFFFFF
28 * This structure is used by CPU to provide completed MDL & buffers information.
29 * Its structure is dictated by the layout of the SCB, required by the
30 * firmware, but its definition needs to be here, instead of in cx18-scb.h,
31 * for mailbox work order scheduling
34 u32 id
; /* ID of a completed MDL */
35 u32 data_used
; /* Total data filled in the MDL with 'id' */
38 /* The cx18_mailbox struct is the mailbox structure which is used for passing
39 messages between processors */
41 /* The sender sets a handle in 'request' after he fills the command. The
42 'request' should be different than 'ack'. The sender, also, generates
43 an interrupt on XPU2YPU_irq where XPU is the sender and YPU is the
46 /* The receiver detects a new command when 'req' is different than 'ack'.
47 He sets 'ack' to the same value as 'req' to clear the command. He, also,
48 generates an interrupt on YPU2XPU_irq where XPU is the sender and YPU
52 /* 'cmd' identifies the command. The list of these commands are in
55 /* Each command can have up to 6 arguments */
56 u32 args
[MAX_MB_ARGUMENTS
];
57 /* The return code can be one of the codes in the file cx23418.h. If the
58 command is completed successfully, the error will be ERR_SYS_SUCCESS.
59 If it is pending, the code is ERR_SYS_PENDING. If it failed, the error
60 code would indicate the task from which the error originated and will
61 be one of the errors in cx23418.h. In that case, the following
62 applies ((error & 0xff) != 0).
63 If the command is pending, the return will be passed in a MB from the
64 receiver to the sender. 'req' will be returned in args[0] */
70 int cx18_api(struct cx18
*cx
, u32 cmd
, int args
, u32 data
[]);
71 int cx18_vapi_result(struct cx18
*cx
, u32 data
[MAX_MB_ARGUMENTS
], u32 cmd
,
73 int cx18_vapi(struct cx18
*cx
, u32 cmd
, int args
, ...);
74 int cx18_api_func(void *priv
, u32 cmd
, int in
, int out
,
75 u32 data
[CX2341X_MBOX_MAX_DATA
]);
77 void cx18_api_epu_cmd_irq(struct cx18
*cx
, int rpu
);
79 void cx18_in_work_handler(struct work_struct
*work
);