diff --git a/Middlewares/Rpmsg_Library/Inc/list.h b/Middlewares/Rpmsg_Library/Inc/list.h deleted file mode 100644 index 1c526a861760402f0f75c77b878928c21a6cf7ee..0000000000000000000000000000000000000000 --- a/Middlewares/Rpmsg_Library/Inc/list.h +++ /dev/null @@ -1,169 +0,0 @@ -#ifndef LIST_H -#define LIST_H - -//#ifdef __KERNEL__ -//#include - -//#else - -/* - * Copied from include/linux/... - */ - -#undef offsetof -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) - -/** - * container_of - cast a member of a structure out to the containing structure - * @ptr: the pointer to the member. - * @type: the type of the container struct this is embedded in. - * @member: the name of the member within the struct. - * - */ -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) - - -struct list_head { - struct list_head *next, *prev; -}; - - -#define LIST_HEAD_INIT(name) { &(name), &(name) } - -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) - -static inline void INIT_LIST_HEAD(struct list_head *list) -{ - list->next = list; - list->prev = list; -} - - -/** - * list_entry - get the struct for this entry - * @ptr: the &struct list_head pointer. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - */ -#define list_entry(ptr, type, member) \ - container_of(ptr, type, member) - -/** - * list_first_entry - get the first element from a list - * @ptr: the list head to take the element from. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - * - * Note, that list is expected to be not empty. - */ -#define list_first_entry(ptr, type, member) \ - list_entry((ptr)->next, type, member) - -/** - * list_first_entry_or_null - get the first element from a list - * @ptr: the list head to take the element from. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - * - * Note that if the list is empty, it returns NULL. - */ -#define list_first_entry_or_null(ptr, type, member) \ - (!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL) - - -/** - * list_for_each_entry - iterate over list of given type - * @pos: the type * to use as a loop cursor. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) - -/** - * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry - * @pos: the type * to use as a loop cursor. - * @n: another type * to use as temporary storage - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry_safe(pos, n, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) - -/** - * list_empty - tests whether a list is empty - * @head: the list to test. - */ -static inline int list_empty(const struct list_head *head) -{ - return head->next == head; -} - -/* - * Insert a new entry between two known consecutive entries. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -static inline void __list_add(struct list_head *_new, - struct list_head *prev, - struct list_head *next) -{ - next->prev = _new; - _new->next = next; - _new->prev = prev; - prev->next = _new; -} - -/** - * list_add_tail - add a new entry - * @new: new entry to be added - * @head: list head to add it before - * - * Insert a new entry before the specified head. - * This is useful for implementing queues. - */ -static inline void list_add_tail(struct list_head *_new, struct list_head *head) -{ - __list_add(_new, head->prev, head); -} - -/* - * Delete a list entry by making the prev/next entries - * point to each other. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -static inline void __list_del(struct list_head *prev, struct list_head *next) -{ - next->prev = prev; - prev->next = next; -} - -#define LIST_POISON1 ((void *) 0x00100100) -#define LIST_POISON2 ((void *) 0x00200200) -/** - * list_del - deletes entry from list. - * @entry: the element to delete from the list. - * Note: list_empty() on entry does not return true after this, the entry is - * in an undefined state. - */ -static inline void list_del(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - entry->next = (struct list_head*)LIST_POISON1; - entry->prev = (struct list_head*)LIST_POISON2; -} - -//#endif - -#endif diff --git a/Middlewares/Rpmsg_Library/Inc/rpmsg_api.h b/Middlewares/Rpmsg_Library/Inc/rpmsg_api.h deleted file mode 100755 index a69047bce65e6335fdc358597f7799886746a464..0000000000000000000000000000000000000000 --- a/Middlewares/Rpmsg_Library/Inc/rpmsg_api.h +++ /dev/null @@ -1,174 +0,0 @@ -/** - * @file x2600_hal_template.h - * @author MPU系统软件部团队 - * @brief rpmsg核间通信头文件 - * - * @copyright 版权所有 (北京君正集成电路股份有限公司) {2022} - * @copyright Copyright© 2022 Ingenic Semiconductor Co.,Ltd - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ - -#ifndef __RPMSG_LIBRARY_H__ -#define __RPMSG_LIBRARY_H__ - -#ifdef __cplusplus - extern "C" { -#endif - -/** - * @addtogroup group_RPMSG_LIBRARY - * @{ - */ - -/* 1. 头文件 (Includes)----------------------------------------------- */ -#include "rpmsg_config.h" -#include "rpmsg_lite.h" -#include "rpmsg_ns.h" -#include "list.h" - -/* 2. 导出的类型 (Exported Types)--------------------------------------- */ -/** - * @defgroup RPMSG_LIBRARY_exported_types RPMSG_LIBRARY 导出的类型 (Exported Types) - * @{ - */ -typedef struct { - struct rpmsg_lite_instance rpmsg_lite_dev_ctx; - struct rpmsg_lite_instance *rpmsg_instance; - struct rpmsg_lite_ept_static_context rpmsg_lite_ept_ctx; - struct rpmsg_lite_endpoint *rpmsg_ept; -}ingenic_rpmsg_t; - - -/** - * @} - */ -/* 3. 导出常量定义 Exported Constants ----------------------------------- */ -/** - * @defgroup RPMSG_LIBRARY_exported_constants RPMSG_LIBRARY 导出的常量 Exported Constants - * @{ - */ - -// 删除此行, 添加内容 -// 删除此行, 添加内容 - -/** - * @} - */ -/* 4. 导出宏定义 Exported Macros --------------------------------------- */ -/** - * @defgroup RPMSG_LIBRARY_exported_macros RPMSG_LIBRARY 导出宏 Exported Macros - * @{ - */ -#define MAX_MSG_NUM 20 - -#define VRING_RX_ADDRESS 0x12400000 -#define VRING_TX_ADDRESS 0x12401000 - -#define VRING_ALIGNMENT 16 -#define VRING_NUM_BUFFS RL_BUFFER_COUNT -#define VRING0_ID 0 -#define VRING1_ID 1 - -/** - * @} - */ -/* 5. 导出函数申明 Exported Funcs --------------------------------------- */ -/** - * @defgroup RPMSG_LIBRARY_private_var RPMSG_LIBRARY 私有变量申明 (Private Variables) - * @defgroup RPMSG_LIBRARY_exported_funcs RPMSG_LIBRARY 导出函数申明 Exported Funcs - * @{ - */ -void create_channel(ingenic_rpmsg_t *ingenic_rpmsg); -int32_t msg_recv(void **buffer, uint32_t *len, uint32_t *src); -int32_t msg_send(ingenic_rpmsg_t *ingenic_rpmsg, uint32_t dst, char *data, uint32_t size, uint32_t timeout); - -/** - * @} - */ -/* 6. 导出变量申明 (Exported Variables) --------------------------------- */ -/** - * @defgroup RPMSG_LIBRARY_exported_var RPMSG_LIBRARY 导出变量申明 (Exported Variables) - * @{ - */ - -// 删除此行, 添加内容 -// 删除此行, 添加内容 - -/** - * @} - */ -/* 7. 私有类型定义 (Private Types) -------------------------------------- */ -/** - * @defgroup RPMSG_LIBRARY_private_types RPMSG_LIBRARY 私有类型定义 (Private Types) - * @{ - */ -struct msg{ - void *buf; - uint32_t size; - uint32_t src; - struct list_head entry; -}; - -/** - * @} - */ -/* 8. 私有常量定义Private Constants ------------------------------------- */ -/** - * @defgroup RPMSG_LIBRARY_private_constants RPMSG_LIBRARY 私有常量定义Private Constants - * @{ - */ - -// 删除此行, 添加内容 -// 删除此行, 添加内容 - -/** - * @} - */ -/* 9. 私有宏定义 (Private Macros) -------------------------------------- */ -/** - * @defgroup RPMSG_LIBRARY_private_macros RPMSG_LIBRARY 私有宏定义 (Private Macros) - * @{ - */ - -// 删除此行, 添加内容 -// 删除此行, 添加内容 - -/** - * @} - */ -/* 10. 私有函数申明 (Private Funcs) ------------------------------------- */ -/** - * @defgroup RPMSG_LIBRARY_private_funcs RPMSG_LIBRARY 私有函数申明 (Private Funcs) - * @{ - */ - -// 删除此行, 添加内容 -// 删除此行, 添加内容 - -/** - * @} - */ -/* 11. 私有变量申明 Private Variables ----------------------------------- */ -/** - * @defgroup RPMSG_LIBRARY_private_var RPMSG_LIBRARY 私有变量申明 (Private Variables) - * @{ - */ - -// 删除此行, 添加内容 -// 删除此行, 添加内容 - -/** - * @} - */ - -/** - * @} - */ -#ifdef __cplusplus -} -#endif -#endif /* __RPMSG_LIBRARY_H__ */ diff --git a/Middlewares/Rpmsg_Library/Src/rpmsg_api.c b/Middlewares/Rpmsg_Library/Src/rpmsg_api.c deleted file mode 100755 index 5fac0918e72d8d20190217229163d1a585fee558..0000000000000000000000000000000000000000 --- a/Middlewares/Rpmsg_Library/Src/rpmsg_api.c +++ /dev/null @@ -1,239 +0,0 @@ -/** - * @file rpmsg_api.c - * @author MPU系统软件部团队 - * @brief rpmsg核间通信源文件 - * - * @copyright 版权所有 (北京君正集成电路股份有限公司) {2022} - * @copyright Copyright© 2022 Ingenic Semiconductor Co.,Ltd - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - @verbatim - ============================================================================== - ##### 使用说明 ##### - ============================================================================== - @endverbatim - */ - -/* 1.头文件 (Includes)------------------------------------------------ */ -#include -#include -#include - -/** @addtogroup RPMSG_LIBRARY - * @{ - */ - -/* 2.私有常量定义Private Constants -------------------------------------- */ -/** - * @addtogroup RPMSG_LIBRARY_private_constants - * @{ - */ -struct msg msg[MAX_MSG_NUM]; -LIST_HEAD(avali); -LIST_HEAD(used); -DEFINE_SPINLOCK(lock); - -/** - * @} - */ -/* 3. 私有类型定义 (Private Types) -------------------------------------- */ -/** - * @addtogroup RPMSG_LIBRARY_private_types - * @{ - */ - -// 删除此行, 添加内容 -// 删除此行, 添加内容 - -/** - * @} - */ -/* 4. 私有宏定义 (Private Macros) -------------------------------------- */ -/** - * @addtogroup RPMSG_LIBRARY_private_macros - * @{ - */ - -#define CLIENT_NAME "rpmsg_chrdev" - -/** - * @} - */ -/* 5. 私有变量申明 Private Variables ------------------------------------ */ -/** - * @addtogroup RPMSG_LIBRARY_private_var - * @{ - */ - -// 删除此行, 添加内容 -// 删除此行, 添加内容 - -/** - * @} - */ -/* 6. 私有函数申明 (Private Funcs) -------------------------------------- */ -/** - * @addtogroup RPMSG_LIBRARY_private_funcs - * @{ - */ - -static int32_t msg_queue_init(); -static int32_t msg_available(); -static int32_t msg_enqueue(void *payload, uint32_t payload_len, uint32_t src); -static int32_t msg_dequeue(void **payload, uint32_t *payload_len, uint32_t *src); -static int32_t riscv_ept_rx_cb_t(void *payload, uint32_t payload_len, uint32_t src, void *priv); -static void rpmsg_mailbox_handler(int irq, void *data); - -/** - * @} - */ -/* 7. 私有函数实现 (Private Funcs) -------------------------------------- */ -/** - * @defgroup RPMSG_LIBRARY_private_funcs_impl RPMSG_LIBRARY 私有函数实现 - * @{ - */ -static int32_t msg_queue_init() -{ - uint32_t i; - for(i = 0; i < MAX_MSG_NUM; i++) - list_add_tail(&msg[i].entry, &avali); -} - -static int32_t msg_available() -{ - int32_t ret; - ret = list_empty(&used); - return !ret; -} - -static int32_t msg_enqueue(void *payload, uint32_t payload_len, uint32_t src) -{ - struct msg *msg; - - spin_lock_irq(&lock); - msg = list_first_entry(&avali, struct msg, entry); - - msg->buf = payload; - msg->size = payload_len; - msg->src = src; - - list_del(&msg->entry); - list_add_tail(&msg->entry, &used); - spin_unlock_irq(&lock); - - return 0; -} - -static int32_t msg_dequeue(void **payload, uint32_t *payload_len, uint32_t *src) -{ - struct msg *msg; - - spin_lock(&lock); - msg = list_first_entry(&used, struct msg, entry); - - *payload = msg->buf; - *payload_len = msg->size; - *src = msg->src; - - list_del(&msg->entry); - list_add_tail(&msg->entry, &avali); - spin_unlock(&lock); - - return 0; -} - - -static int32_t riscv_ept_rx_cb_t(void *payload, uint32_t payload_len, uint32_t src, void *priv) -{ - ingenic_rpmsg_t *ingenic_rpmsg = priv; - char* data = (char*)payload; - if(payload_len && data[0] != '0') - - msg_enqueue(payload, payload_len, src); - - return 0; -} - -static void rpmsg_mailbox_handler(int irq, void *data) { - RISCV_CCU_TypeDef *RISC_CCU = (RISCV_CCU_TypeDef *)data; - uint32_t msg = 0; - msg = LL_RISC_CCU_Mbox_Recvmsg(RISC_CCU); - rpmsg_handler(msg); -} - -/** - * @} - */ -/* 8. 导出函数实现------------------------------------------------------- */ -/** - * @defgroup RPMSG_LIBRARY_exported_funcs_impl RPMSG_LIBRARY 导出函数实现 - * @{ - */ -void create_channel(ingenic_rpmsg_t *ingenic_rpmsg) -{ - unsigned int timeout = 0xffff; - int ret = 0; - - ingenic_rpmsg->rpmsg_instance = rpmsg_lite_remote_init((void*)VRING_RX_ADDRESS, - 0,0,&ingenic_rpmsg->rpmsg_lite_dev_ctx); - if(!ingenic_rpmsg->rpmsg_instance){ - prom_printk("rpmsg_lite_remote_init failed \r\n"); - } - - ll_request_irq(IRQ_RISCV_MAILBOX, rpmsg_mailbox_handler, RISC_CCU_Instance); - - - ingenic_rpmsg->rpmsg_ept = rpmsg_lite_create_ept(ingenic_rpmsg->rpmsg_instance,RL_ADDR_ANY, - riscv_ept_rx_cb_t,ingenic_rpmsg,&ingenic_rpmsg->rpmsg_lite_ept_ctx); - if(!ingenic_rpmsg->rpmsg_ept){ - prom_printk("rpmsg_lite_create_ept failed \r\n"); - } - - do { - ret = rpmsg_ns_announce(ingenic_rpmsg->rpmsg_instance, - ingenic_rpmsg->rpmsg_ept, - CLIENT_NAME, - 0); - timeout--; - } - while((ret == RL_NOT_READY) && timeout); - - msg_queue_init(); - - return ret; -} - -int32_t msg_recv(void **buffer, uint32_t *len, uint32_t *src) -{ - while(1) - { - spin_lock(&lock); - if(!msg_available()) - { - spin_unlock(&lock); - continue; - } - - msg_dequeue(buffer, len, src); - spin_unlock(&lock); - break; - } - return 0; -} - -int32_t msg_send(ingenic_rpmsg_t *ingenic_rpmsg, uint32_t dst, char *data, uint32_t size, uint32_t timeout) -{ - return rpmsg_lite_send(ingenic_rpmsg->rpmsg_instance,ingenic_rpmsg->rpmsg_ept, dst, data, size, timeout); -} - - -/** - * @} - */ - -/** - * @} - */ diff --git a/projects/x2660-halley/Templates/template-riscv-rpmsg/CMakeLists.txt b/projects/x2660-halley/Templates/template-riscv-rpmsg/CMakeLists.txt index 7665376dac8eb4895b325ba873db421fcab3e42f..9d0378a948edcc9283cfa1b97e22d0af14e9ae84 100755 --- a/projects/x2660-halley/Templates/template-riscv-rpmsg/CMakeLists.txt +++ b/projects/x2660-halley/Templates/template-riscv-rpmsg/CMakeLists.txt @@ -59,7 +59,6 @@ set(sources_SRCS # Modified ${SDK_PATH}/Middlewares/Third_Party/rpmsg/rpmsg_lite/rpmsg_lite.c ${SDK_PATH}/Middlewares/Third_Party/rpmsg/rpmsg_lite/rpmsg_ns.c ${SDK_PATH}/Middlewares/Third_Party/rpmsg/virtio/virtqueue.c - ${SDK_PATH}/Middlewares/Rpmsg_Library/Src/rpmsg_api.c main.c ) @@ -84,7 +83,6 @@ include_directories( ${SDK_PATH}/Middlewares/Third_Party/rpmsg/include ${SDK_PATH}/Middlewares/Third_Party/rpmsg/include/environment/bm ${SDK_PATH}/Middlewares/Third_Party/rpmsg/include/platform/ingenic_riscv - ${SDK_PATH}/Middlewares/Rpmsg_Library/Inc ) # diff --git a/projects/x2660-halley/Templates/template-riscv-rpmsg/Makefile b/projects/x2660-halley/Templates/template-riscv-rpmsg/Makefile index cd3b0df30eccef11ef1590509efe7ab745d99117..ea2ed8930a3f366166e0ae0db195976d989bddec 100644 --- a/projects/x2660-halley/Templates/template-riscv-rpmsg/Makefile +++ b/projects/x2660-halley/Templates/template-riscv-rpmsg/Makefile @@ -43,7 +43,6 @@ ${SDK_PATH}/Middlewares/Third_Party/rpmsg/rpmsg_lite/porting/platform/ingenic_ri ${SDK_PATH}/Middlewares/Third_Party/rpmsg/rpmsg_lite/rpmsg_lite.c \ ${SDK_PATH}/Middlewares/Third_Party/rpmsg/rpmsg_lite/rpmsg_ns.c \ ${SDK_PATH}/Middlewares/Third_Party/rpmsg/virtio/virtqueue.c \ -${SDK_PATH}/Middlewares/Rpmsg_Library/Src/rpmsg_api.c \ main.c # ASM sources @@ -112,8 +111,7 @@ C_INCLUDES = \ -I$(SDK_PATH)/drivers/drivers-x2600/include \ -I${SDK_PATH}/Middlewares/Third_Party/rpmsg/include \ -I${SDK_PATH}/Middlewares/Third_Party/rpmsg/include/environment/bm \ --I${SDK_PATH}/Middlewares/Third_Party/rpmsg/include/platform/ingenic_riscv \ --I${SDK_PATH}/Middlewares/Rpmsg_Library/Inc \ +-I${SDK_PATH}/Middlewares/Third_Party/rpmsg/include/platform/ingenic_riscv # compile gcc flags diff --git a/Middlewares/Rpmsg_Library/Inc/remoteproc_rsc_table.h b/projects/x2660-halley/Templates/template-riscv-rpmsg/include/remoteproc_rsc_table.h similarity index 89% rename from Middlewares/Rpmsg_Library/Inc/remoteproc_rsc_table.h rename to projects/x2660-halley/Templates/template-riscv-rpmsg/include/remoteproc_rsc_table.h index d6bb0c289b2615c9dd345b761920b087660f74f7..e53017abe65f4f702ee98d29ed9549d8d29d9e65 100644 --- a/Middlewares/Rpmsg_Library/Inc/remoteproc_rsc_table.h +++ b/projects/x2660-halley/Templates/template-riscv-rpmsg/include/remoteproc_rsc_table.h @@ -1,8 +1,6 @@ #ifndef __REMOTEPROC_RSC_TABLE_H__ #define __REMOTEPROC_RSC_TABLE_H__ -#include "rpmsg_api.h" - #define VIRTIO_ID_RPMSG 7 #define VRING_COUNT 2 @@ -53,6 +51,15 @@ enum fw_resource_type { RSC_VENDOR_END = 512, }; +#define VRING_RX_ADDRESS 0x12400000 +#define VRING_TX_ADDRESS 0x12401000 + +#define VRING_ALIGNMENT 16 +#define VRING_NUM_BUFFS RL_BUFFER_COUNT +#define VRING0_ID 0 +#define VRING1_ID 1 + + volatile struct sh_resource_table __attribute__((used,section(".resource_table"))) resource_table = { /* volatile struct sh_resource_table __attribute__((used)) resource_table = { */ .ver = 1, diff --git a/Middlewares/Rpmsg_Library/Inc/rpmsg_config.h b/projects/x2660-halley/Templates/template-riscv-rpmsg/include/rpmsg_config.h similarity index 100% rename from Middlewares/Rpmsg_Library/Inc/rpmsg_config.h rename to projects/x2660-halley/Templates/template-riscv-rpmsg/include/rpmsg_config.h diff --git a/projects/x2660-halley/Templates/template-riscv-rpmsg/main.c b/projects/x2660-halley/Templates/template-riscv-rpmsg/main.c index f7219a63b2308e49ad87ab68e54effaa1902cfc0..686d6e4f76e2171345e16280dc988083c2c0410c 100644 --- a/projects/x2660-halley/Templates/template-riscv-rpmsg/main.c +++ b/projects/x2660-halley/Templates/template-riscv-rpmsg/main.c @@ -1,25 +1,73 @@ #include -#include +#include +#include +#include +#include -static ingenic_rpmsg_t ingenic_rpmsg_ctx; +#define CLIENT_NAME "rpmsg_chrdev" + +struct rpmsg_lite_instance rpmsg_lite_dev_ctx; +struct rpmsg_lite_instance *rpmsg_instance; +struct rpmsg_lite_ept_static_context rpmsg_lite_ept_ctx; +struct rpmsg_lite_endpoint *rpmsg_ept; + +int32_t rpmsg_ept_rx_cb(void *payload, uint32_t payload_len, uint32_t src, void *priv) +{ + struct rpmsg_lite_endpoint *rpmsg_ept = *(struct rpmsg_lite_endpoint **)priv; + char* data = (char*)payload; + char msg[16]; + unsigned int timeout = 0xffff; + + + if(payload_len && data[0] != '0') + printf("####%s\n", payload); + + sprintf(msg, "hello host!"); + rpmsg_lite_send(rpmsg_instance, rpmsg_ept, src, msg, sizeof(msg), timeout); + + return 0; +} + +void rpmsg_mailbox_handler(int irq, void *data) { + RISCV_CCU_TypeDef *RISC_CCU = (RISCV_CCU_TypeDef *)data; + uint32_t msg = 0; + msg = LL_RISC_CCU_Mbox_Recvmsg(RISC_CCU); + rpmsg_handler(msg); +} int main() { - unsigned int i,j; void *buffer; uint32_t len, src; - char msg[16]; + uint32_t timeout = 0xffff; + uint32_t ret = 0; printf("\nriscv start\n"); - create_channel(&ingenic_rpmsg_ctx); + rpmsg_instance = rpmsg_lite_remote_init((void*)VRING_RX_ADDRESS, + 0,0,&rpmsg_lite_dev_ctx); + if(!rpmsg_instance){ + prom_printk("rpmsg_lite_remote_init failed \r\n"); + } + + ll_request_irq(IRQ_RISCV_MAILBOX, rpmsg_mailbox_handler, RISC_CCU_Instance); + + rpmsg_ept = rpmsg_lite_create_ept(rpmsg_instance,RL_ADDR_ANY, + rpmsg_ept_rx_cb,&rpmsg_ept,&rpmsg_lite_ept_ctx); + if(!rpmsg_ept){ + prom_printk("rpmsg_lite_create_ept failed \r\n"); + } - while(1) { - msg_recv(&buffer, &len, &src); - printf("====%s\n", buffer); - sprintf(msg, "hello host!"); - msg_send(&ingenic_rpmsg_ctx, src, msg, sizeof(msg), 100); + do { + ret = rpmsg_ns_announce(rpmsg_instance, + rpmsg_ept, + CLIENT_NAME, + 0); + timeout--; } + while((ret == RL_NOT_READY) && timeout); + + while(1); printf("\nriscv end\n");