/*
 * Copyright 2023 Google LLC
 *
 * 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.
 */

#ifndef EXAMPLES_SOUNDSTREAM_ML_TOP_H_
#define EXAMPLES_SOUNDSTREAM_ML_TOP_H_

#include <compartment.h>

#include "sw/device/lib/dif/dif_ml_top.h"

typedef dif_ml_top_irq_t ml_top_irq_t;
const ml_top_irq_t kMlTopIrqFinish = kDifMlTopIrqFinish;
const ml_top_irq_t kMlTopIrqFault = kDifMlTopIrqFault;

struct output_header {
  uint32_t return_code;  // Populated in kelvin_start
  uint32_t output_ptr;
  uint32_t length;
  uint32_t resume_pc;  // PC at which to resume for another invocation.
};

void __cheri_compartment("ml_top") ml_top_init(void);
void __cheri_compartment("ml_top") ml_top_isr(void);
void __cheri_compartment("ml_top") ml_top_irq_acknowledge_all(void);
void __cheri_compartment("ml_top")
    ml_top_irq_set_enabled(ml_top_irq_t irq_id, bool enabled);
bool __cheri_compartment("ml_top") ml_top_finish_done(void);
void __cheri_compartment("ml_top") ml_top_wait_for_finish(void);
void __cheri_compartment("ml_top") ml_top_resume_ctrl_en(uint32_t resume_pc);
void __cheri_compartment("ml_top")
    ml_top_set_input(void* const data, size_t data_len_bytes);
void __cheri_compartment("ml_top")
    ml_top_get_output_header(struct output_header* header);
void __cheri_compartment("ml_top")
    ml_top_get_output_data(struct output_header* const header, void* buffer);

#endif  // EXAMPLES_SOUNDSTREAM_ML_TOP_H_
