18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) STMicroelectronics SA 2015 48c2ecf20Sopenharmony_ci * Author: Hugues Fruchet <hugues.fruchet@st.com> for STMicroelectronics. 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#ifndef DELTA_IPC_H 88c2ecf20Sopenharmony_ci#define DELTA_IPC_H 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciint delta_ipc_init(struct delta_dev *delta); 118c2ecf20Sopenharmony_civoid delta_ipc_exit(struct delta_dev *delta); 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* 148c2ecf20Sopenharmony_ci * delta_ipc_open - open a decoding instance on firmware side 158c2ecf20Sopenharmony_ci * @ctx: (in) delta context 168c2ecf20Sopenharmony_ci * @name: (in) name of decoder to be used 178c2ecf20Sopenharmony_ci * @param: (in) open command parameters specific to decoder 188c2ecf20Sopenharmony_ci * @param.size: (in) size of parameter 198c2ecf20Sopenharmony_ci * @param.data: (in) virtual address of parameter 208c2ecf20Sopenharmony_ci * @ipc_buf_size: (in) size of IPC shared buffer between host 218c2ecf20Sopenharmony_ci * and copro used to share command data. 228c2ecf20Sopenharmony_ci * Client have to set here the size of the biggest 238c2ecf20Sopenharmony_ci * command parameters (+ status if any). 248c2ecf20Sopenharmony_ci * Allocation will be done in this function which 258c2ecf20Sopenharmony_ci * will give back to client in @ipc_buf the virtual 268c2ecf20Sopenharmony_ci * & physical addresses & size of shared IPC buffer. 278c2ecf20Sopenharmony_ci * All the further command data (parameters + status) 288c2ecf20Sopenharmony_ci * have to be written in this shared IPC buffer 298c2ecf20Sopenharmony_ci * virtual memory. This is done to avoid 308c2ecf20Sopenharmony_ci * unnecessary copies of command data. 318c2ecf20Sopenharmony_ci * @ipc_buf: (out) allocated IPC shared buffer 328c2ecf20Sopenharmony_ci * @ipc_buf.size: (out) allocated size 338c2ecf20Sopenharmony_ci * @ipc_buf.vaddr: (out) virtual address where to copy 348c2ecf20Sopenharmony_ci * further command data 358c2ecf20Sopenharmony_ci * @hdl: (out) handle of decoding instance. 368c2ecf20Sopenharmony_ci */ 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ciint delta_ipc_open(struct delta_ctx *ctx, const char *name, 398c2ecf20Sopenharmony_ci struct delta_ipc_param *param, u32 ipc_buf_size, 408c2ecf20Sopenharmony_ci struct delta_buf **ipc_buf, void **hdl); 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci/* 438c2ecf20Sopenharmony_ci * delta_ipc_set_stream - set information about stream to decoder 448c2ecf20Sopenharmony_ci * @hdl: (in) handle of decoding instance. 458c2ecf20Sopenharmony_ci * @param: (in) set stream command parameters specific to decoder 468c2ecf20Sopenharmony_ci * @param.size: (in) size of parameter 478c2ecf20Sopenharmony_ci * @param.data: (in) virtual address of parameter. Must be 488c2ecf20Sopenharmony_ci * within IPC shared buffer range 498c2ecf20Sopenharmony_ci */ 508c2ecf20Sopenharmony_ciint delta_ipc_set_stream(void *hdl, struct delta_ipc_param *param); 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci/* 538c2ecf20Sopenharmony_ci * delta_ipc_decode - frame decoding synchronous request, returns only 548c2ecf20Sopenharmony_ci * after decoding completion on firmware side. 558c2ecf20Sopenharmony_ci * @hdl: (in) handle of decoding instance. 568c2ecf20Sopenharmony_ci * @param: (in) decode command parameters specific to decoder 578c2ecf20Sopenharmony_ci * @param.size: (in) size of parameter 588c2ecf20Sopenharmony_ci * @param.data: (in) virtual address of parameter. Must be 598c2ecf20Sopenharmony_ci * within IPC shared buffer range 608c2ecf20Sopenharmony_ci * @status: (in/out) decode command status specific to decoder 618c2ecf20Sopenharmony_ci * @status.size: (in) size of status 628c2ecf20Sopenharmony_ci * @status.data: (in/out) virtual address of status. Must be 638c2ecf20Sopenharmony_ci * within IPC shared buffer range. 648c2ecf20Sopenharmony_ci * Status is filled by decoding instance 658c2ecf20Sopenharmony_ci * after decoding completion. 668c2ecf20Sopenharmony_ci */ 678c2ecf20Sopenharmony_ciint delta_ipc_decode(void *hdl, struct delta_ipc_param *param, 688c2ecf20Sopenharmony_ci struct delta_ipc_param *status); 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci/* 718c2ecf20Sopenharmony_ci * delta_ipc_close - close decoding instance 728c2ecf20Sopenharmony_ci * @hdl: (in) handle of decoding instance to close. 738c2ecf20Sopenharmony_ci */ 748c2ecf20Sopenharmony_civoid delta_ipc_close(void *hdl); 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci#endif /* DELTA_IPC_H */ 77