1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
/*
* Copyright © 2017-2022 The Crust Firmware Authors.
* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only
*/
#include <device.h>
#include <intrusive.h>
#include <msgbox.h>
#include <stdbool.h>
#include <stdint.h>
#include "msgbox.h"
/**
* Get the ops for the msgbox controller device.
*/
static inline const struct msgbox_driver_ops *
msgbox_ops_for(const struct device *dev)
{
const struct msgbox_driver *drv =
container_of(dev->drv, const struct msgbox_driver, drv);
return &drv->ops;
}
void
msgbox_ack_rx(const struct device *dev, uint8_t chan)
{
msgbox_ops_for(dev)->ack_rx(dev, chan);
}
bool
msgbox_last_tx_done(const struct device *dev, uint8_t chan)
{
return msgbox_ops_for(dev)->last_tx_done(dev, chan);
}
int
msgbox_receive(const struct device *dev, uint8_t chan, uint32_t *message)
{
return msgbox_ops_for(dev)->receive(dev, chan, message);
}
int
msgbox_send(const struct device *dev, uint8_t chan, uint32_t message)
{
return msgbox_ops_for(dev)->send(dev, chan, message);
}
|