samples: ipc: openamp_rsc_table: Normalize printed output

Currently a mix of printk() and LOG_*() are used, switch to using
the LOG functions in all cases. The code also has mixed line-ending
types, as the LOG functions add newlines remove these.

Also some messages that are failures are printed with debug log level,
use ERR level here.

Signed-off-by: Andrew Davis <afd@ti.com>
This commit is contained in:
Andrew Davis 2024-03-11 10:56:50 -05:00 committed by David Leach
parent 27cb75edb8
commit 21275868ee

View file

@ -93,7 +93,7 @@ static K_SEM_DEFINE(data_tty_sem, 0, 1);
static void platform_ipm_callback(const struct device *dev, void *context,
uint32_t id, volatile void *data)
{
LOG_DBG("%s: msg received from mb %d\n", __func__, id);
LOG_DBG("%s: msg received from mb %d", __func__, id);
k_sem_give(&data_sem);
}
@ -132,7 +132,7 @@ static void receive_message(unsigned char **msg, unsigned int *len)
static void new_service_cb(struct rpmsg_device *rdev, const char *name,
uint32_t src)
{
LOG_ERR("%s: unexpected ns service receive for name %s\n",
LOG_ERR("%s: unexpected ns service receive for name %s",
__func__, name);
}
@ -140,7 +140,7 @@ int mailbox_notify(void *priv, uint32_t id)
{
ARG_UNUSED(priv);
LOG_DBG("%s: msg received\n", __func__);
LOG_DBG("%s: msg received", __func__);
ipm_send(ipm_handle, 0, id, NULL, 0);
return 0;
@ -156,19 +156,19 @@ int platform_init(void)
status = metal_init(&metal_params);
if (status) {
LOG_DBG("metal_init: failed: %d\n", status);
LOG_ERR("metal_init: failed: %d", status);
return -1;
}
status = metal_register_generic_device(&shm_device);
if (status) {
LOG_DBG("Couldn't register shared memory: %d\n", status);
LOG_ERR("Couldn't register shared memory: %d\n", status);
return -1;
}
status = metal_device_open("generic", SHM_DEVICE_NAME, &device);
if (status) {
LOG_DBG("metal_device_open failed: %d\n", status);
LOG_ERR("metal_device_open failed: %d\n", status);
return -1;
}
@ -178,7 +178,7 @@ int platform_init(void)
shm_io = metal_device_io_region(device, 0);
if (!shm_io) {
LOG_DBG("Failed to get shm_io region\n");
LOG_ERR("Failed to get shm_io region\n");
return -1;
}
@ -191,13 +191,13 @@ int platform_init(void)
rsc_io = metal_device_io_region(device, 1);
if (!rsc_io) {
LOG_DBG("Failed to get rsc_io region\n");
LOG_ERR("Failed to get rsc_io region\n");
return -1;
}
/* setup IPM */
if (!device_is_ready(ipm_handle)) {
LOG_DBG("IPM device is not ready\n");
LOG_ERR("IPM device is not ready");
return -1;
}
@ -205,7 +205,7 @@ int platform_init(void)
status = ipm_set_enabled(ipm_handle, 1);
if (status) {
LOG_DBG("ipm_set_enabled failed\n");
LOG_ERR("ipm_set_enabled failed");
return -1;
}
@ -234,7 +234,7 @@ platform_create_rpmsg_vdev(unsigned int vdev_index,
rsc_io, NULL, mailbox_notify, NULL);
if (!vdev) {
LOG_DBG("failed to create vdev\r\n");
LOG_ERR("failed to create vdev");
return NULL;
}
@ -246,7 +246,7 @@ platform_create_rpmsg_vdev(unsigned int vdev_index,
(void *)vring_rsc->da, rsc_io,
vring_rsc->num, vring_rsc->align);
if (ret) {
LOG_DBG("failed to init vring 0\r\n");
LOG_ERR("failed to init vring 0");
goto failed;
}
@ -255,7 +255,7 @@ platform_create_rpmsg_vdev(unsigned int vdev_index,
(void *)vring_rsc->da, rsc_io,
vring_rsc->num, vring_rsc->align);
if (ret) {
LOG_DBG("failed to init vring 1\r\n");
LOG_ERR("failed to init vring 1");
goto failed;
}
@ -263,7 +263,7 @@ platform_create_rpmsg_vdev(unsigned int vdev_index,
ret = rpmsg_init_vdev(&rvdev, vdev, ns_cb, shm_io, &shpool);
if (ret) {
LOG_DBG("failed rpmsg_init_vdev\r\n");
LOG_ERR("failed rpmsg_init_vdev");
goto failed;
}
@ -286,27 +286,27 @@ void app_rpmsg_client_sample(void *arg1, void *arg2, void *arg3)
k_sem_take(&data_sc_sem, K_FOREVER);
printk("\r\nOpenAMP[remote] Linux sample client responder started\r\n");
LOG_INF("OpenAMP[remote] Linux sample client responder started");
ret = rpmsg_create_ept(&sc_ept, rpdev, "rpmsg-client-sample",
RPMSG_ADDR_ANY, RPMSG_ADDR_ANY,
rpmsg_recv_cs_callback, NULL);
if (ret) {
LOG_ERR("[Linux sample client] Could not create endpoint: %d\n", ret);
LOG_ERR("[Linux sample client] Could not create endpoint: %d", ret);
goto task_end;
}
while (msg_cnt < 100) {
k_sem_take(&data_sc_sem, K_FOREVER);
msg_cnt++;
printk("[Linux sample client] incoming msg %d: %.*s\n", msg_cnt, sc_msg.len,
(char *)sc_msg.data);
LOG_INF("[Linux sample client] incoming msg %d: %.*s", msg_cnt, sc_msg.len,
(char *)sc_msg.data);
rpmsg_send(&sc_ept, sc_msg.data, sc_msg.len);
}
rpmsg_destroy_ept(&sc_ept);
task_end:
printk("OpenAMP Linux sample client responder ended\n");
LOG_INF("OpenAMP Linux sample client responder ended");
}
void app_rpmsg_tty(void *arg1, void *arg2, void *arg3)
@ -320,21 +320,22 @@ void app_rpmsg_tty(void *arg1, void *arg2, void *arg3)
k_sem_take(&data_tty_sem, K_FOREVER);
printk("\r\nOpenAMP[remote] Linux TTY responder started\r\n");
LOG_INF("OpenAMP[remote] Linux TTY responder started");
tty_ept.priv = &tty_msg;
ret = rpmsg_create_ept(&tty_ept, rpdev, "rpmsg-tty",
RPMSG_ADDR_ANY, RPMSG_ADDR_ANY,
rpmsg_recv_tty_callback, NULL);
if (ret) {
LOG_ERR("[Linux TTY] Could not create endpoint: %d\n", ret);
LOG_ERR("[Linux TTY] Could not create endpoint: %d", ret);
goto task_end;
}
while (tty_ept.addr != RPMSG_ADDR_ANY) {
k_sem_take(&data_tty_sem, K_FOREVER);
if (tty_msg.len) {
printk("[Linux TTY] incoming msg: %.*s", tty_msg.len, (char *)tty_msg.data);
LOG_INF("[Linux TTY] incoming msg: %.*s",
tty_msg.len, (char *)tty_msg.data);
snprintf(tx_buff, 13, "TTY 0x%04x: ", tty_ept.addr);
memcpy(&tx_buff[12], tty_msg.data, tty_msg.len);
rpmsg_send(&tty_ept, tx_buff, tty_msg.len + 12);
@ -346,7 +347,7 @@ void app_rpmsg_tty(void *arg1, void *arg2, void *arg3)
rpmsg_destroy_ept(&tty_ept);
task_end:
printk("OpenAMP Linux TTY responder ended\n");
LOG_INF("OpenAMP Linux TTY responder ended");
}
void rpmsg_mng_task(void *arg1, void *arg2, void *arg3)
@ -359,12 +360,12 @@ void rpmsg_mng_task(void *arg1, void *arg2, void *arg3)
unsigned int len;
int ret = 0;
printk("\r\nOpenAMP[remote] Linux responder demo started\r\n");
LOG_INF("OpenAMP[remote] Linux responder demo started");
/* Initialize platform */
ret = platform_init();
if (ret) {
LOG_ERR("Failed to initialize platform\n");
LOG_ERR("Failed to initialize platform");
ret = -1;
goto task_end;
}
@ -372,7 +373,7 @@ void rpmsg_mng_task(void *arg1, void *arg2, void *arg3)
rpdev = platform_create_rpmsg_vdev(0, VIRTIO_DEV_DEVICE, NULL,
new_service_cb);
if (!rpdev) {
LOG_ERR("Failed to create rpmsg virtio device\n");
LOG_ERR("Failed to create rpmsg virtio device");
ret = -1;
goto task_end;
}
@ -392,12 +393,12 @@ void rpmsg_mng_task(void *arg1, void *arg2, void *arg3)
task_end:
cleanup_system();
printk("OpenAMP demo ended\n");
LOG_INF("OpenAMP demo ended");
}
int main(void)
{
printk("Starting application threads!\n");
LOG_INF("Starting application threads!");
k_thread_create(&thread_mng_data, thread_mng_stack, APP_TASK_STACK_SIZE,
rpmsg_mng_task,
NULL, NULL, NULL, K_PRIO_COOP(8), 0, K_NO_WAIT);