Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
8936d3af
Commit
8936d3af
authored
Mar 28, 2024
by
iabdalkader
Committed by
Damien George
Mar 29, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extmod/modopenamp: Use metal logging functions exclusively.
Signed-off-by:
iabdalkader
<
i.abdalkader@gmail.com
>
parent
aa0f3ebe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
14 deletions
+8
-14
extmod/modopenamp.c
extmod/modopenamp.c
+3
-5
extmod/modopenamp_remoteproc.c
extmod/modopenamp_remoteproc.c
+0
-2
extmod/modopenamp_remoteproc_store.c
extmod/modopenamp_remoteproc_store.c
+5
-7
No files found.
extmod/modopenamp.c
View file @
8936d3af
...
...
@@ -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
);
...
...
extmod/modopenamp_remoteproc.c
View file @
8936d3af
...
...
@@ -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
...
...
extmod/modopenamp_remoteproc_store.c
View file @
8936d3af
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment