// Copyright 2011-2023 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
#ifndef __DNR_DSP_BUF_H__
#define __DNR_DSP_BUF_H__

#include <xs1.h>
#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
#include <platform.h>
#include <xcore/chanend.h>
#include <xcore/channel.h>
#if DNR_11MS
#define DNR_DSP_FRAME_SIZE 128
#else
#define DNR_DSP_FRAME_SIZE 512
#endif
#define BUF_SLOT_NUM    3   //one for input, one for output, one for processing
#define DSP_CH_NUM      2

#if __XC__
extern "C" {
#endif

void dnr_set_chan(chanend_t dnr_tile0_c, chanend_t dnr_tile1_c);

void dsp_buf_init();
void buf_slot_rotate();
void write_to_sample_in_buf(unsigned data, unsigned index, unsigned ch);
void read_from_sample_out_buf(unsigned* read_data, unsigned index, unsigned ch);

void start_dsp_processing(void);
void Aizip_DNR_init(void);

#if __XC__
} //extern c
#endif
#endif //RINGBUFFER_H

