#pragma once

#include "binding.h"

#include <inttypes.h>

#ifdef __cplusplus
extern "C" {
#endif

extern const uint32_t DATA_CHANNEL_DEPTH;
extern const uint32_t DATA_CHANNEL_COUNT;
extern const uint32_t DATA_CHANNEL_BASE_LIST[];

void data_channel_bind( uint32_t base, const DataChannelBinding * binding );

uint32_t data_channel_get_binding( uint32_t base );

uint32_t data_channel_is_empty( uint32_t base );
uint32_t data_channel_is_full( uint32_t base );
uint32_t data_channel_level( uint32_t base );

void data_channel_clear( uint32_t base );

int data_channel_write( uint32_t base, uint32_t value );
int data_channel_write_all( uint32_t base, const uint32_t * data, uint32_t len );
int data_channel_read( uint32_t base, uint32_t * value );
int data_channel_read_all( uint32_t base, void * buffer );

uint32_t data_channel_base_from_number( uint32_t channel );

#ifdef __cplusplus
}
#endif

