blob: 24ba34fe51c5e33441dcf6652a1908c63abcd007 [file] [log] [blame]
// Copyright 2022 Google LLC.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
#include "sw/device/lib/dif/dif_tlul_mailbox.h"
#include <stddef.h>
#include "sw/device/lib/base/bitfield.h"
#include "sw/device/lib/base/macros.h"
#include "sw/device/lib/dif/dif_base.h"
#include "tlul_mailbox_regs.h" // Generated.
dif_result_t dif_tlul_mailbox_send_message(const dif_tlul_mailbox_t *tlul_mailbox, uint32_t *buf) {
if (tlul_mailbox == NULL) {
return kDifBadArg;
}
mmio_region_write32(tlul_mailbox->base_addr, TLUL_MAILBOX_MBOXW_REG_OFFSET, *buf);
return kDifOk;
}
dif_result_t dif_tlul_mailbox_read_message(const dif_tlul_mailbox_t *tlul_mailbox, uint32_t *buf) {
if (tlul_mailbox == NULL) {
return kDifBadArg;
}
*buf = mmio_region_read32(tlul_mailbox->base_addr, TLUL_MAILBOX_MBOXR_REG_OFFSET);
return kDifOk;
}