#ifndef _DIM2_HAL_H
#define _DIM2_HAL_H
#include <linux/types.h>
#include "reg.h"
enum mlb_clk_speed { … };
struct dim_ch_state { … };
struct int_ch_state { … };
struct dim_channel { … };
u8 dim_startup(struct dim2_regs __iomem *dim_base_address, u32 mlb_clock,
u32 fcnt);
void dim_shutdown(void);
bool dim_get_lock_state(void);
u16 dim_norm_ctrl_async_buffer_size(u16 buf_size);
u16 dim_norm_isoc_buffer_size(u16 buf_size, u16 packet_length);
u16 dim_norm_sync_buffer_size(u16 buf_size, u16 bytes_per_frame);
u8 dim_init_control(struct dim_channel *ch, u8 is_tx, u16 ch_address,
u16 max_buffer_size);
u8 dim_init_async(struct dim_channel *ch, u8 is_tx, u16 ch_address,
u16 max_buffer_size);
u8 dim_init_isoc(struct dim_channel *ch, u8 is_tx, u16 ch_address,
u16 packet_length);
u8 dim_init_sync(struct dim_channel *ch, u8 is_tx, u16 ch_address,
u16 bytes_per_frame);
u8 dim_destroy_channel(struct dim_channel *ch);
void dim_service_mlb_int_irq(void);
void dim_service_ahb_int_irq(struct dim_channel *const *channels);
u8 dim_service_channel(struct dim_channel *ch);
struct dim_ch_state *dim_get_channel_state(struct dim_channel *ch,
struct dim_ch_state *state_ptr);
u16 dim_dbr_space(struct dim_channel *ch);
bool dim_enqueue_buffer(struct dim_channel *ch, u32 buffer_addr,
u16 buffer_size);
bool dim_detach_buffers(struct dim_channel *ch, u16 buffers_number);
void dimcb_on_error(u8 error_id, const char *error_message);
#endif