xref: /OK3568_Linux_fs/external/mpp/osal/driver/inc/mpp_service_impl.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright 2021 Rockchip Electronics Co. LTD
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __MPP_SERVICE_IMPL_H__
18 #define __MPP_SERVICE_IMPL_H__
19 
20 #include "mpp_device.h"
21 #include "mpp_service.h"
22 
23 #define MAX_REG_OFFSET          64
24 #define MAX_RCB_OFFSET          32
25 #define MAX_INFO_COUNT          16
26 
27 typedef struct FdTransInfo_t {
28     RK_U32          reg_idx;
29     RK_U32          offset;
30 } RegOffsetInfo;
31 
32 typedef struct RcbInfo_t {
33     RK_U32          reg_idx;
34     RK_U32          size;
35 } RcbInfo;
36 
37 typedef struct MppDevMppService_t {
38     RK_S32          client_type;
39     RK_S32          client;
40     RK_S32          server;
41     void            *serv_ctx;
42     RK_S32          batch_io;
43     MppCbCtx        *dev_cb;
44 
45     MppReqV1        *reqs;
46     RK_S32          req_max;
47     RK_S32          req_cnt;
48 
49     RegOffsetInfo   *reg_offset_info;
50     RK_S32          reg_offset_max;
51     RK_S32          reg_offset_count;
52     RK_S32          reg_offset_pos;
53 
54     RcbInfo         *rcb_info;
55     RK_S32          rcb_max;
56     RK_S32          rcb_count;
57     RK_S32          rcb_pos;
58 
59     MppDevBatCmd    bat_cmd;
60 
61     RK_S32          info_count;
62     MppDevInfoCfg   info[MAX_INFO_COUNT];
63 
64     /* support max cmd buttom  */
65     const MppServiceCmdCap *cap;
66     RK_U32          support_set_info;
67     RK_U32          support_set_rcb_info;
68     RK_U32          support_hw_irq;
69 } MppDevMppService;
70 
71 #ifdef  __cplusplus
72 extern "C" {
73 #endif
74 
75 RK_S32 mpp_service_ioctl(RK_S32 fd, RK_U32 cmd, RK_U32 size, void *param);
76 RK_S32 mpp_service_ioctl_request(RK_S32 fd, MppReqV1 *req);
77 MPP_RET mpp_service_check_cmd_valid(RK_U32 cmd, const MppServiceCmdCap *cap);
78 
79 #ifdef  __cplusplus
80 }
81 #endif
82 
83 #endif /* __MPP_SERVICE_IMPL_H__ */
84