|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +#ifndef _HW_DRIVERS_IPC_ICBMSG_H |
| 21 | +#define _HW_DRIVERS_IPC_ICBMSG_H |
| 22 | + |
| 23 | +#include <stdint.h> |
| 24 | +#include <stdbool.h> |
| 25 | +#include <os/os.h> |
| 26 | + |
| 27 | +#ifdef __cplusplus |
| 28 | +extern "C" { |
| 29 | +#endif |
| 30 | + |
| 31 | +struct ipc_service_cb { |
| 32 | + void (*received)(const void *data, size_t len, void *user_data); |
| 33 | +}; |
| 34 | + |
| 35 | +struct ipc_ept_cfg { |
| 36 | + const char *name; |
| 37 | + struct ipc_service_cb cb; |
| 38 | + void *user_data; |
| 39 | + uint8_t tx_channel; |
| 40 | + uint8_t rx_channel; |
| 41 | +}; |
| 42 | + |
| 43 | +struct ipc_icmsg_buf { |
| 44 | + size_t block_id; |
| 45 | + uint8_t *data; |
| 46 | + uint16_t len; |
| 47 | +}; |
| 48 | + |
| 49 | +typedef void (*ipc_icbmsg_recv_cb)(uint8_t ipc_id, void *user_data); |
| 50 | + |
| 51 | +uint8_t ipc_icmsg_register_ept(uint8_t ipc_id, struct ipc_ept_cfg *cfg); |
| 52 | + |
| 53 | +int ipc_icbmsg_send(uint8_t ipc_id, uint8_t ept_addr, const void *data, uint16_t len); |
| 54 | + |
| 55 | +int ipc_icbmsg_send_buf(uint8_t ipc_id, uint8_t ept_addr, struct ipc_icmsg_buf *buf); |
| 56 | + |
| 57 | +int ipc_icbmsg_alloc_tx_buf(uint8_t ipc_id, struct ipc_icmsg_buf *buf, uint32_t size); |
| 58 | + |
| 59 | +uint8_t ipc_icsmsg_ept_ready(uint8_t ipc_id, uint8_t ept_addr); |
| 60 | + |
| 61 | +#ifdef __cplusplus |
| 62 | +} |
| 63 | +#endif |
| 64 | + |
| 65 | +#endif /* _HW_DRIVERS_IPC_ICBMSG_H */ |
0 commit comments