1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * Copyright (C) STMicroelectronics SA 2015 4*4882a593Smuzhiyun * Author: Hugues Fruchet <hugues.fruchet@st.com> for STMicroelectronics. 5*4882a593Smuzhiyun */ 6*4882a593Smuzhiyun 7*4882a593Smuzhiyun #ifndef DELTA_IPC_H 8*4882a593Smuzhiyun #define DELTA_IPC_H 9*4882a593Smuzhiyun 10*4882a593Smuzhiyun int delta_ipc_init(struct delta_dev *delta); 11*4882a593Smuzhiyun void delta_ipc_exit(struct delta_dev *delta); 12*4882a593Smuzhiyun 13*4882a593Smuzhiyun /* 14*4882a593Smuzhiyun * delta_ipc_open - open a decoding instance on firmware side 15*4882a593Smuzhiyun * @ctx: (in) delta context 16*4882a593Smuzhiyun * @name: (in) name of decoder to be used 17*4882a593Smuzhiyun * @param: (in) open command parameters specific to decoder 18*4882a593Smuzhiyun * @param.size: (in) size of parameter 19*4882a593Smuzhiyun * @param.data: (in) virtual address of parameter 20*4882a593Smuzhiyun * @ipc_buf_size: (in) size of IPC shared buffer between host 21*4882a593Smuzhiyun * and copro used to share command data. 22*4882a593Smuzhiyun * Client have to set here the size of the biggest 23*4882a593Smuzhiyun * command parameters (+ status if any). 24*4882a593Smuzhiyun * Allocation will be done in this function which 25*4882a593Smuzhiyun * will give back to client in @ipc_buf the virtual 26*4882a593Smuzhiyun * & physical addresses & size of shared IPC buffer. 27*4882a593Smuzhiyun * All the further command data (parameters + status) 28*4882a593Smuzhiyun * have to be written in this shared IPC buffer 29*4882a593Smuzhiyun * virtual memory. This is done to avoid 30*4882a593Smuzhiyun * unnecessary copies of command data. 31*4882a593Smuzhiyun * @ipc_buf: (out) allocated IPC shared buffer 32*4882a593Smuzhiyun * @ipc_buf.size: (out) allocated size 33*4882a593Smuzhiyun * @ipc_buf.vaddr: (out) virtual address where to copy 34*4882a593Smuzhiyun * further command data 35*4882a593Smuzhiyun * @hdl: (out) handle of decoding instance. 36*4882a593Smuzhiyun */ 37*4882a593Smuzhiyun 38*4882a593Smuzhiyun int delta_ipc_open(struct delta_ctx *ctx, const char *name, 39*4882a593Smuzhiyun struct delta_ipc_param *param, u32 ipc_buf_size, 40*4882a593Smuzhiyun struct delta_buf **ipc_buf, void **hdl); 41*4882a593Smuzhiyun 42*4882a593Smuzhiyun /* 43*4882a593Smuzhiyun * delta_ipc_set_stream - set information about stream to decoder 44*4882a593Smuzhiyun * @hdl: (in) handle of decoding instance. 45*4882a593Smuzhiyun * @param: (in) set stream command parameters specific to decoder 46*4882a593Smuzhiyun * @param.size: (in) size of parameter 47*4882a593Smuzhiyun * @param.data: (in) virtual address of parameter. Must be 48*4882a593Smuzhiyun * within IPC shared buffer range 49*4882a593Smuzhiyun */ 50*4882a593Smuzhiyun int delta_ipc_set_stream(void *hdl, struct delta_ipc_param *param); 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun /* 53*4882a593Smuzhiyun * delta_ipc_decode - frame decoding synchronous request, returns only 54*4882a593Smuzhiyun * after decoding completion on firmware side. 55*4882a593Smuzhiyun * @hdl: (in) handle of decoding instance. 56*4882a593Smuzhiyun * @param: (in) decode command parameters specific to decoder 57*4882a593Smuzhiyun * @param.size: (in) size of parameter 58*4882a593Smuzhiyun * @param.data: (in) virtual address of parameter. Must be 59*4882a593Smuzhiyun * within IPC shared buffer range 60*4882a593Smuzhiyun * @status: (in/out) decode command status specific to decoder 61*4882a593Smuzhiyun * @status.size: (in) size of status 62*4882a593Smuzhiyun * @status.data: (in/out) virtual address of status. Must be 63*4882a593Smuzhiyun * within IPC shared buffer range. 64*4882a593Smuzhiyun * Status is filled by decoding instance 65*4882a593Smuzhiyun * after decoding completion. 66*4882a593Smuzhiyun */ 67*4882a593Smuzhiyun int delta_ipc_decode(void *hdl, struct delta_ipc_param *param, 68*4882a593Smuzhiyun struct delta_ipc_param *status); 69*4882a593Smuzhiyun 70*4882a593Smuzhiyun /* 71*4882a593Smuzhiyun * delta_ipc_close - close decoding instance 72*4882a593Smuzhiyun * @hdl: (in) handle of decoding instance to close. 73*4882a593Smuzhiyun */ 74*4882a593Smuzhiyun void delta_ipc_close(void *hdl); 75*4882a593Smuzhiyun 76*4882a593Smuzhiyun #endif /* DELTA_IPC_H */ 77