blob: 5ef207fd5be192cd5fce564dcc7214276311f035 [file] [log] [blame]
/*
* 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 SW_DEVICE_CHERIOT_SOUNDSTREAM_ML_TOP_H_
#define SW_DEVICE_CHERIOT_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);
void __cheri_compartment("ml_top")
ml_top_load_file_from_tar(const char* filename);
#endif // SW_DEVICE_CHERIOT_SOUNDSTREAM_ML_TOP_H_