samples: Apply IPM callback signature change where relevant

Applications using IPM callbacks get the imp device instance pointer
now through the callback. Which help to clarify a bit the code here and
there as well.

Fixes #26923

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2020-07-08 19:15:11 +02:00 committed by Carles Cufí
parent c6706561b9
commit 42b1d76d80
8 changed files with 27 additions and 19 deletions

View file

@ -123,7 +123,8 @@ static void ipm_callback_process(struct k_work *work)
virtqueue_notification(vq[1]);
}
static void ipm_callback(void *context, uint32_t id, volatile void *data)
static void ipm_callback(struct device *dev, void *context,
uint32_t id, volatile void *data)
{
LOG_INF("Got callback of id %u", id);
k_work_submit(&ipm_work);

View file

@ -9,9 +9,8 @@
#include <device.h>
#include <drivers/ipm.h>
static struct device *ipm;
static void ipm_callback(void *context, uint32_t id, volatile void *data)
static void ipm_callback(struct device *dev, void *context,
uint32_t id, volatile void *data)
{
int i;
int status;
@ -23,7 +22,7 @@ static void ipm_callback(void *context, uint32_t id, volatile void *data)
}
printk("\n");
status = ipm_send(ipm, 1, id, (const void *)data,
status = ipm_send(dev, 1, id, (const void *)data,
CONFIG_IPM_IMX_MAX_DATA_SIZE);
if (status) {
printk("ipm_send() failed: %d\n", status);
@ -32,6 +31,8 @@ static void ipm_callback(void *context, uint32_t id, volatile void *data)
void main(void)
{
struct device *ipm;
ipm = device_get_binding("MU_B");
if (!ipm) {
while (1) {

View file

@ -9,17 +9,18 @@
#include <device.h>
#include <drivers/ipm.h>
struct device *ipm;
void ping_ipm_callback(void *context, uint32_t id, volatile void *data)
void ping_ipm_callback(struct device *dev, void *context,
uint32_t id, volatile void *data)
{
ipm_send(ipm, 1, 0, (const void *)data, 4);
ipm_send(dev, 1, 0, (const void *)data, 4);
}
void main(void)
{
struct device *ipm;
ipm = device_get_binding(DT_LABEL(DT_INST(0, nxp_lpc_mailbox)));
if (!ipm) {
while (1) {

View file

@ -9,10 +9,10 @@
#include <device.h>
#include <drivers/ipm.h>
struct device *ipm;
int gcounter;
void ping_ipm_callback(void *context, uint32_t id, volatile void *data)
void ping_ipm_callback(struct device *dev, void *context,
uint32_t id, volatile void *data)
{
gcounter = *(int *)data;
/* Show current ping-pong counter value */
@ -21,7 +21,7 @@ void ping_ipm_callback(void *context, uint32_t id, volatile void *data)
gcounter++;
if (gcounter < 100) {
/* Send back to the other core */
ipm_send(ipm, 1, 0, &gcounter, 4);
ipm_send(dev, 1, 0, &gcounter, 4);
}
}
@ -30,6 +30,8 @@ void main(void)
int first_message = 1; /* do not start from 0,
* zero value can't be sent via mailbox register
*/
struct device *ipm;
printk("Hello World from MASTER! %s\n", CONFIG_ARCH);
/* Get IPM device handle */

View file

@ -32,14 +32,14 @@ static void main_cpu_1(void)
}
}
static void mhu_isr_callback(void *context, uint32_t cpu_id,
volatile void *data)
static void mhu_isr_callback(struct device *dev, void *context,
uint32_t cpu_id, volatile void *data)
{
const uint32_t set_mhu = 1;
printk("MHU ISR on CPU %d\n", cpu_id);
if (cpu_id == MHU_CPU0) {
ipm_send(mhu0, 0, MHU_CPU1, &set_mhu, 1);
ipm_send(dev, 0, MHU_CPU1, &set_mhu, 1);
} else if (cpu_id == MHU_CPU1) {
printk("MHU Test Done.\n");
}
@ -58,7 +58,7 @@ void main(void)
} else {
printk("CPU %d, get MHU0 success!\n",
sse_200_platform_get_cpu_id());
ipm_register_callback(mhu0, mhu_isr_callback, mhu0);
ipm_register_callback(mhu0, mhu_isr_callback, NULL);
}
if (sse_200_platform_get_cpu_id() == MHU_CPU0) {

View file

@ -95,7 +95,8 @@ struct virtio_dispatch dispatch = {
static K_SEM_DEFINE(data_sem, 0, 1);
static K_SEM_DEFINE(data_rx_sem, 0, 1);
static void platform_ipm_callback(void *context, uint32_t id, volatile void *data)
static void platform_ipm_callback(struct device *dev, void *context,
uint32_t id, volatile void *data)
{
k_sem_give(&data_sem);
}

View file

@ -108,7 +108,8 @@ struct virtio_dispatch dispatch = {
static K_SEM_DEFINE(data_sem, 0, 1);
static K_SEM_DEFINE(data_rx_sem, 0, 1);
static void platform_ipm_callback(void *context, uint32_t id, volatile void *data)
static void platform_ipm_callback(struct device *dev, void *context,
uint32_t id, volatile void *data)
{
k_sem_give(&data_sem);
}

View file

@ -66,7 +66,8 @@ static struct rpmsg_endpoint rcv_ept;
static K_SEM_DEFINE(data_sem, 0, 1);
static K_SEM_DEFINE(data_rx_sem, 0, 1);
static void platform_ipm_callback(void *context, uint32_t id, volatile void *data)
static void platform_ipm_callback(struct device *device, void *context,
uint32_t id, volatile void *data)
{
LOG_DBG("%s: msg received from mb %d\n", __func__, id);
k_sem_give(&data_sem);