#ifndef _MAIN_H_
#define _MAIN_H_

#define ASSERT_CONCAT_(a, b) a##b
#define ASSERT_CONCAT(a, b) ASSERT_CONCAT_(a, b)
#define ct_assert(e,msg) typedef char assert_failed_##msg[ (!!(e)) ? 1 : -1]

//#include "usb_protocol_cdc.h"
#include "usb_protocol_audio.h"
#include "udi_audio_conf.h"
#include "pdm_mics.h"
#include "fan_motor_control.h"
#include "i2c.h"
#include "test_and_debug.h"
#include "temp_sense.h"
#include "prox_tmd2635.h"
#include "adc.h"
#include "rgb_led.h"
#include "rtt_util.h"
#include "signature.h"
#include "usart_interface.h"
#include "linkbox_hpd.h"
#include "power_control.h"
#include "video_proc.h"
#include "usbhid_interface.h"
#include "vxr_interface.h"
#include "prox_control.h"
#include "hw_test.h"
#include "sw_ver.h"
#include "eeprom_emulation.h"

#include "crash_handler.h"

void main_system_shutdown(void);

void main_audio_enable(void);
void main_audio_disable(void);

void vbus_monitor_start(void);
bool vbus_is_present(void);

/*! \brief Manages the leds behaviors
 * Called when a start of frame is received on USB line each 1ms.
 */
void main_sof_action(void);

/*! \brief Enters the application in low power mode
 * Callback called when USB host sets USB line in suspend state
 */
void main_suspend_action(void);

/*! \brief Turn on a led to notify active mode
 * Called when the USB line is resumed from the suspend state
 */
void main_resume_action(void);

#ifdef USB_DEVICE_LPM_SUPPORT
/*! \brief Enters the application in low power mode
 * Callback called when USB host sets LPM suspend state
 */
void main_suspend_lpm_action(void);

/*! \brief Called by UDC when USB Host request to enable LPM remote wakeup
 */
void main_remotewakeup_lpm_enable(void);

/*! \brief Called by UDC when USB Host request to disable LPM remote wakeup
 */
void main_remotewakeup_lpm_disable(void);
#endif

typedef enum
{
	STATE_VOICE_SIDE_LEFT,
	STATE_VOICE_SIDE_RIGHT
}	Main_Voice_Side_t;

typedef enum {
	taskid_USBLoad,
	taskid_HID_Command,
	taskid_HID_Report,
	taskid_I2C,
	taskid_TIMED_START,
	taskid_ADC,
	taskid_LED,
	taskid_FAN,
	taskid_video_proc,
	taskid_USART,
	taskid_IDLE,
	taskid_Tmr_Svc,
	taskid_NUM_TASKS
} TaskID_t;

/* Access to i2c handles from main */

I2C_Handle* DDIC_I2C(void);
I2C_Handle* MCU_I2C(void);

/* Display reset pin statuses from VXR7200 */
bool main_left_display_reset_status(void);
bool main_right_display_reset_status(void);

#endif // _MAIN_H_
