extmod/modopenamp: Use metal logging functions exclusively.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
pull/14120/head
iabdalkader 2024-03-28 08:22:55 +01:00 zatwierdzone przez Damien George
rodzic aa0f3ebe93
commit 8936d3af46
3 zmienionych plików z 8 dodań i 14 usunięć

Wyświetl plik

@ -77,8 +77,6 @@ static const char openamp_trace_buf[128];
#endif // MICROPY_PY_OPENAMP_RSC_TABLE_ENABLE
#define debug_printf(...) // mp_printf(&mp_plat_print, __VA_ARGS__)
#if MICROPY_PY_OPENAMP_REMOTEPROC
extern mp_obj_type_t openamp_remoteproc_type;
#endif
@ -138,7 +136,7 @@ typedef struct _endpoint_obj_t {
static const mp_obj_type_t endpoint_type;
static int endpoint_recv_callback(struct rpmsg_endpoint *ept, void *data, size_t len, uint32_t src, void *priv) {
debug_printf("endpoint_recv_callback() message received src: %lu msg len: %d\n", src, len);
metal_log(METAL_LOG_DEBUG, "endpoint_recv_callback() message received src: %lu msg len: %d\n", src, len);
endpoint_obj_t *self = metal_container_of(ept, endpoint_obj_t, ep);
if (self->callback != mp_const_none) {
mp_call_function_2(self->callback, mp_obj_new_int(src), mp_obj_new_bytearray_by_ref(len, data));
@ -176,7 +174,7 @@ static mp_obj_t endpoint_send(uint n_args, const mp_obj_t *pos_args, mp_map_t *k
mp_buffer_info_t rbuf;
mp_get_buffer_raise(pos_args[1], &rbuf, MP_BUFFER_READ);
debug_printf("endpoint_send() msg len: %d\n", rbuf.len);
metal_log(METAL_LOG_DEBUG, "endpoint_send() msg len: %d\n", rbuf.len);
int bytes = 0;
mp_int_t timeout = args[ARG_timeout].u_int;
@ -260,7 +258,7 @@ void openamp_remoteproc_notified(mp_sched_node_t *node) {
}
static void openamp_ns_callback(struct rpmsg_device *rdev, const char *name, uint32_t dest) {
debug_printf("rpmsg_new_service_callback() new service request name: %s dest %lu\n", name, dest);
metal_log(METAL_LOG_DEBUG, "rpmsg_new_service_callback() new service request name: %s dest %lu\n", name, dest);
// The remote processor advertises its presence to the host by sending
// the Name Service (NS) announcement containing the name of the channel.
virtio_dev_obj_t *virtio_device = metal_container_of(rdev, virtio_dev_obj_t, rvdev);

Wyświetl plik

@ -46,8 +46,6 @@
#include "modopenamp.h"
#include "modopenamp_remoteproc.h"
#define DEBUG_printf(...) // mp_printf(&mp_plat_print, __VA_ARGS__)
#if !MICROPY_PY_OPENAMP
#error "MICROPY_PY_OPENAMP_REMOTEPROC requires MICROPY_PY_OPENAMP"
#endif

Wyświetl plik

@ -47,8 +47,6 @@
#if MICROPY_PY_OPENAMP_REMOTEPROC_STORE_ENABLE
#define DEBUG_printf(...) // mp_printf(&mp_plat_print, __VA_ARGS__)
// Note the initial file buffer size needs to be at least 512 to read
// enough of the elf headers on the first call to store_open(), and on
// subsequent calls to store functions, it gets reallocated if needed.
@ -70,7 +68,7 @@ void *mp_openamp_remoteproc_store_alloc(void) {
}
static int openamp_remoteproc_store_open(void *store, const char *path, const void **image_data) {
DEBUG_printf("store_open(): %s\n", path);
metal_log(METAL_LOG_DEBUG, "store_open(): %s\n", path);
mp_obj_t args[2] = {
mp_obj_new_str(path, strlen(path)),
MP_OBJ_NEW_QSTR(MP_QSTR_rb),
@ -89,7 +87,7 @@ static int openamp_remoteproc_store_open(void *store, const char *path, const vo
}
static void openamp_remoteproc_store_close(void *store) {
DEBUG_printf("store_close()\n");
metal_log(METAL_LOG_DEBUG, "store_close()\n");
openamp_remoteproc_filestore_t *fstore = store;
mp_stream_close(fstore->file);
metal_free_memory(fstore->buf);
@ -113,17 +111,17 @@ static int openamp_remoteproc_store_load(void *store, size_t offset, size_t size
// Note tracked allocs don't support realloc.
fstore->len = size;
fstore->buf = metal_allocate_memory(size);
DEBUG_printf("store_load() realloc to %lu\n", fstore->len);
metal_log(METAL_LOG_DEBUG, "store_load() realloc to %lu\n", fstore->len);
}
*data = fstore->buf;
DEBUG_printf("store_load(): pa 0x%lx offset %u size %u \n", (uint32_t)pa, offset, size);
metal_log(METAL_LOG_DEBUG, "store_load(): pa 0x%lx offset %u size %u \n", (uint32_t)pa, offset, size);
} else {
void *va = metal_io_phys_to_virt(io, pa);
if (va == NULL) {
return -EINVAL;
}
*data = va;
DEBUG_printf("store_load(): pa 0x%lx va 0x%p offset %u size %u \n", (uint32_t)pa, va, offset, size);
metal_log(METAL_LOG_DEBUG, "store_load(): pa 0x%lx va 0x%p offset %u size %u \n", (uint32_t)pa, va, offset, size);
}
mp_uint_t bytes = mp_stream_read_exactly(fstore->file, (void *)*data, size, &error);