blob: 05bf501eacb80d50f926407c59779b221df3ae5e [file] [log] [blame]
/*
* Copyright 2023 Google LLC
* Copyright lowRISC contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#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;
}