Files
CW_A5H_9225_8108/A5H_9225_8108_SPIV3.0/HY88xx/hy8108.h

345 lines
12 KiB
C
Raw Normal View History

2025-09-29 16:42:09 +08:00
#ifndef __HY8108_H
#define __HY8108_H
#ifdef HY8108
//0x41
#define HT_DITHER_Pos 7
#define HT_DITHER_2BIT_DISABLE 0
#define HT_DITHER_2BIT_ENABLE 1
#define HT_DITHER (HT_DITHER_2BIT_ENABLE<<HT_DITHER_Pos)
#define TURBO_Pos 8
#define TURBO_DISABLE 0
#define TURBO_ENABLE 1
#define TURBO (TURBO_DISABLE<<TURBO_Pos)
#define DOS_OUT_EOP_Pos 9
#define DOS_OUT_EOP_DISABLE 0
#define DOS_OUT_EOP_ENABLE 1
#define DOS_OUT_EOP (DOS_OUT_EOP_DISABLE<<DOS_OUT_EOP_Pos)
#define DOS_FIX_FREQ_Pos 10
#define DOS_FIX_FREQ_200K 0
#define DOS_FIX_FREQ_500K 1
#define DOS_FIX_FREQ (DOS_FIX_FREQ_200K<<DOS_FIX_FREQ_Pos)
#define IO_SWITCH_TIMEOUT_Pos 11
#define IO_SWITCH_TIMEOUT_1MS 0
#define IO_SWITCH_TIMEOUT_2MS 1
#define IO_SWITCH_TIMEOUT_4MS 2
#define IO_SWITCH_TIMEOUT_6MS 3
#define IO_SWITCH_TIMEOUT (IO_SWITCH_TIMEOUT_1MS<<IO_SWITCH_TIMEOUT_Pos)
#define IO_SWITCH_WINDOW_Pos 13
#define IO_SWITCH_WINDOW_250US 0
#define IO_SWITCH_WINDOW_500US 1
#define IO_SWITCH_WINDOW_1MS 2
#define IO_SWITCH_WINDOW_1500US 3
#define IO_SWITCH_WINDOW (IO_SWITCH_WINDOW_250US<<IO_SWITCH_WINDOW_Pos)
#define IO_SWITCH_COMMAND_NUM_Pos 15
#define IO_SWITCH_COMMAND_NUM_2 0
#define IO_SWITCH_COMMAND_NUM_1 1
#define IO_SWITCH_COMMAND_NUM (IO_SWITCH_COMMAND_NUM_2<<IO_SWITCH_COMMAND_NUM_Pos)
//0x42
#define DIM_DATA_OFFSET_Pos 0
#define DIM_DATA_OFFSET (0<<DIM_DATA_OFFSET_Pos)
#define DUPLEX_IO_OVERLAP_TIME_Pos 12
#define DUPLEX_IO_OVERLAP_TIME_126NS 0
#define DUPLEX_IO_OVERLAP_TIME_252NS 1
#define DUPLEX_IO_OVERLAP_TIME (DUPLEX_IO_OVERLAP_TIME_126NS<<DUPLEX_IO_OVERLAP_TIME_Pos)
#define SLAVE_TX_FREQ_Pos 13
#define SLAVE_TX_FREQ_FOLLOW_RX 0
#define SLAVE_TX_FREQ_FIX 1
#define SLAVE_TX_FREQ (SLAVE_TX_FREQ_FOLLOW_RX<<SLAVE_TX_FREQ_Pos)
#define DELAY_CHANGE_IO_CMD_Pos 14
#define DELAY_CHANGE_IO_CMD_8_16US 0
#define DELAY_CHANGE_IO_CMD_2_10US 1
#define DELAY_CHANGE_IO_CMD_4_12US 2
#define DELAY_CHANGE_IO_CMD_16_24US 3
#define DELAY_CHANGE_IO_CMD (DELAY_CHANGE_IO_CMD_8_16US<<DELAY_CHANGE_IO_CMD_Pos)
//0x47
#define HEADROOM_Pos 0
#define HEADROOM_250MV 0
#define HEADROOM_300MV 1
#define HEADROOM_350MV 2
#define HEADROOM_400MV 3
#define HEADROOM_450MV 4
#define HEADROOM_500MV 5
#define HEADROOM_600MV 6
#define HEADROOM_650MV 7
#define HEADROOM_700MV 8
#define HEADROOM_850MV 9
#define HEADROOM_900MV 10
#define HEADROOM_1000MV 11
#define HEADROOM_1100MV 12
#define HEADROOM_1150MV 13
#define HEADROOM_1200MV 14
#define HEADROOM_1300MV 15
#define HEADROOM (HEADROOM_450MV<<HEADROOM_Pos) //headroom<6F><6D><EFBFBD><EFBFBD>
#define DUP_IO_TIMEOUT_Pos 4
#define DUP_IO_TIMEOUT_ENABLE 0
#define DUP_IO_TIMEOUT_DISABLE 1
#define DUP_IO_TIMEOUT (DUP_IO_TIMEOUT_ENABLE<<DUP_IO_TIMEOUT_Pos)
//0x48
#define CLK_ALWAYS_ON_Pos 0
#define CLK_ALWAYS_ON_DISABLE 0
#define CLK_ALWAYS_ON_ENABLE 1
#define CLK_ALWAYS_ON (0<<CLK_ALWAYS_ON_Pos)
#define OPEN_LV_Pos 2
#define OPEN_LV_50MV 0
#define OPEN_LV_80MV 1
#define OPEN_LV_100MV 2
#define OPEN_LV_130MV 3
#define OPEN_LV (OPEN_LV_80MV<<OPEN_LV_Pos)
#define PWM_COMPENSATION_TIME_Pos 4
#define PWM_COMPENSATION_TIME_97NS 0
#define PWM_COMPENSATION_TIME_328NS 1
#define PWM_COMPENSATION_TIME_484US 2
#define PWM_COMPENSATION_TIME_706NS 3
#define PWM_COMPENSATION_TIME (PWM_COMPENSATION_TIME_706NS<<PWM_COMPENSATION_TIME_Pos)
#define BURST_MODE_Pos 9
#define BURST_MODE_DISABLE 0
#define BURST_MODE_ENABLE 1
#define BURST_MODE (BURST_MODE_ENABLE<<BURST_MODE_Pos)
#define PWM_COMPENSATION_Pos 10
#define PWM_COMPENSATION_NO 0
#define PWM_COMPENSATION_WITH 1
#define PWM_COMPENSATION (PWM_COMPENSATION_NO<<PWM_COMPENSATION_Pos)
#define DOS_OUTPUT_OH_SEL_Pos 12
#define DOS_OUTPUT_OH_LOCKED_STATE 0
#define DOS_OUTPUT_OH_REAL 1
#define DOS_OUTPUT_OH_SEL (DOS_OUTPUT_OH_LOCKED_STATE<<DOS_OUTPUT_OH_SEL_Pos)
#define OPEN_DEBOUNCE_TIME_Pos 13
#define OPEN_DEBOUNCE_TIME_3_TPWM 0
#define OPEN_DEBOUNCE_TIME_4_TPWM 1
#define OPEN_DEBOUNCE_TIME_8_TPWM 2
#define OPEN_DEBOUNCE_TIME_16_TPWM 3
#define OPEN_DEBOUNCE_TIME_32_TPWM 4
#define OPEN_DEBOUNCE_TIME_64_TPWM 5
#define OPEN_DEBOUNCE_TIME_96_TPWM 6
#define OPEN_DEBOUNCE_TIME_128_TPWM 7
#define OPEN_DEBOUNCE_TIME (OPEN_DEBOUNCE_TIME_64_TPWM<<OPEN_DEBOUNCE_TIME_Pos)
//Reg49
#define OH_LV_Pos 8
#define OH_LV_115_105 0
#define OH_LV_105_95 1
#define OH_LV_95_85 2
#define OH_LV_85_775 3
#define OH_LV (OH_LV_115_105<<OH_LV_Pos)
#define UART_TRANS_TYPE_Pos 10
#define UART_TRANS_DATA 0
#define UART_TRANS_FAULT 1
#define UART_TRANS_TYPE (UART_TRANS_FAULT<<UART_TRANS_TYPE_Pos)
#define UART_FREQ_Pos 14
#define UART_FREQ_115200 0
#define UART_FREQ_230400 1
#define UART_FREQ_460800 2
#define UART_FREQ_921600 3
#define UART_FREQ (UART_FREQ_460800<<UART_FREQ_Pos)
//Reg4A
#define OTP_LV_Pos 0
#define OTP_LV_155__125 0
#define OTP_LV_145__115 1
#define OTP_LV_135__105 2
#define OTP_LV_125__95 3
#define OTP_LV (OTP_LV_145__115<<OTP_LV_Pos)
#define SHORT_DET_DAC_Pos 2
#define SHORT_DET_DAC_ENABLE 0
#define SHORT_DET_DAC_DISABLE 1
#define SHORT_DET_DAC (SHORT_DET_DAC_ENABLE<<SHORT_DET_DAC_Pos)
#define IDAC_REF_Pos 3
#define IDAC_REF_80MV_110MV_160MV 0
#define IDAC_REF_110MV_150MV_220MV 1
#define IDAC_REF_140MV_190MV_300MV 2
#define IDAC_REF_170MV_230MV_370MV 3
#define IDAC_REF (IDAC_REF_170MV_230MV_370MV<<IDAC_REF_Pos)
#define DC_RANG_Pos 5
#define DC_RANG_60MA 0
#define DC_RANG_48MA 1
#define DC_RANG_30MA 2
#define DC_RANG_18MA 3
#define DC_RANG (DC_RANG_60MA<<DC_RANG_Pos)
#define ONE_WIRE_DEGLITCH_TIME_Pos 7
#define ONE_WIRE_DEGLITCH_TIME_2_TOSC 0
#define ONE_WIRE_DEGLITCH_TIME_4_TOSC 1
#define ONE_WIRE_DEGLITCH_TIME_8_TOSC 2
#define ONE_WIRE_DEGLITCH_TIME_32_TOSC 3
#define ONE_WIRE_DEGLITCH_TIME (ONE_WIRE_DEGLITCH_TIME_2_TOSC<<ONE_WIRE_DEGLITCH_TIME_Pos)
#define MOPICC_CONFIG_Pos 10
#define MOPICC_CONFIG_100 0
#define MOPICC_CONFIG_75 1
#define MOPICC_CONFIG_50 2
#define MOPICC_CONFIG_25 3
#define MOPICC_CONFIG_25_1 4
#define MOPICC_CONFIG_18_75 5
#define MOPICC_CONFIG_12_5 6
#define MOPICC_CONFIG_6_25 7
#define MOPICC_CONFIG (MOPICC_CONFIG_100<<MOPICC_CONFIG_Pos)
#define SHORT_DETECTION_THRESHOLD_Pos 13
#define SHORT_DETECTION_THRESHOLD_4 0
#define SHORT_DETECTION_THRESHOLD_8 1
#define SHORT_DETECTION_THRESHOLD_16 2
#define SHORT_DETECTION_THRESHOLD_31 3
#define SHORT_DETECTION_THRESHOLD (SHORT_DETECTION_THRESHOLD_4<<SHORT_DETECTION_THRESHOLD_Pos)
#define CHANNEL_DELAY_UPDATE_Pos 15
#define CHANNEL_DELAY_UPDATE_WAIT_PWM 0
#define CHANNEL_DELAY_UPDATE_IMMEDIATELY 1
#define CHANNEL_DELAY_UPDATE (CHANNEL_DELAY_UPDATE_WAIT_PWM<<CHANNEL_DELAY_UPDATE_Pos)
//Reg4B
#define READ_BACK_MODE_Pos 10
#define NOT_SENT_READ_BACK_CMD_GET_EOP 0
#define SENT_READ_BACK_CMD_GET_EOP 1
#define READ_BACK_MODE (NOT_SENT_READ_BACK_CMD_GET_EOP<<READ_BACK_MODE_Pos)
#define FRAME_SPACE_Pos 12
#define FRAME_SPACE_2048_TOSC 0
#define FRAME_SPACE_1024_TOSC 1
#define FRAME_SPACE_512_TOSC 2
#define FRAME_SPACE_256_TOSC 3
#define FRAME_SPACE_128_TOSC 4
#define FRAME_SPACE_64_TOSC 5
#define FRAME_SPACE_32_TOSC 6
#define FRAME_SPACE_16_TOSC 7
#define FRAME_SPACE (FRAME_SPACE_2048_TOSC<<FRAME_SPACE_Pos)
#define DC_DITHER_22BIT_Pos 15
#define DC_DITHER_22BIT_DISABLE 0
#define DC_DITHER_22BIT_ENABLE 1
#define DC_DITHER_22BIT (DC_DITHER_22BIT_DISABLE<<DC_DITHER_22BIT_Pos)
//Reg4c
#define FAULT_DEGLITCH_TIME_Pos 3
#define FAULT_DEGLITCH_TIME_0_5US 0
#define FAULT_DEGLITCH_TIME_1US 1
#define FAULT_DEGLITCH_TIME_2US 2
#define FAULT_DEGLITCH_TIME_3US 3
#define FAULT_DEGLITCH_TIME (FAULT_DEGLITCH_TIME_1US<<FAULT_DEGLITCH_TIME_Pos)
#define BFI_CRC_ERR_REPEAT_Pos 5
#define BFI_CRC_ERR_REPEAT_DISABLE 0
#define BFI_CRC_ERR_REPEAT_ENABLE 1
#define BFI_CRC_ERR_REPEAT (BFI_CRC_ERR_REPEAT_DISABLE<<BFI_CRC_ERR_REPEAT_Pos)
#define FAULT_BLANK_TIME_Pos 10
#define FAULT_BLANK_TIME (8<<FAULT_BLANK_TIME_Pos) //6bits (4*N+3)
//Reg4E
#define PWM_CHANNEL_CLK_DIVIDED_Pos 0
#define PWM_CHANNEL_CLK_DIVIDED (1<<PWM_CHANNEL_CLK_DIVIDED_Pos) //8BITS
#define PWM_CLK_SEL_Pos 8
#define PWM_CLK_SEL_DIVEDED_CLK 0
#define PWM_CLK_SEL_20480HZ 1
#define PWM_CLK_SEL (PWM_CLK_SEL_DIVEDED_CLK<<PWM_CLK_SEL_Pos)
#define SHORT_LV_Pos 9
#define SHORT_LV_2V 0
#define SHORT_LV_3V 1
#define SHORT_LV_4V 2
#define SHORT_LV_5V 3
#define SHORT_LV_6V 4
#define SHORT_LV_7V 5
#define SHORT_LV_9V 6
#define SHORT_LV_12V 7
#define SHORT_LV (SHORT_LV_12V<<SHORT_LV_Pos)
#define OPEN_DEBOUNCE_SEL_Pos 12
#define OPEN_SEL_EOP 0
#define OPEN_SEL_PWM 1
#define OPEN_DEBOUNCE_SEL (OPEN_SEL_PWM<<OPEN_DEBOUNCE_SEL_Pos)
#define BFI_MODE_Pos 13
#define BFI_RESERVE_FIRST 0
#define BFI_BLANK_FIRST 1
#define BFI_MODE (BFI_RESERVE_FIRST<<BFI_MODE_Pos)
#define BFI_Pos 14
#define BFI_DISABLE 0
#define BFI_ENABLE 1
#define BFI (BFI_DISABLE<<BFI_Pos)
#define PWM_DIV_Pos 15
#define PWM_OUT_30K 0
#define PWM_DIV_USE 1
#define PWM_DIV (PWM_DIV_USE<<PWM_DIV_Pos)
//0X4F
#define BFI_NUMBER_Pos 0
#define BFI_NUMBER (0<<BFI_NUMBER_Pos) //9BITS
#define OW_2P5M_MODE_Pos 12
#define OW_2P5M_MODE_DISABLE 0
#define OW_2P5M_MODE_ENABLE 1
#define OW_2P5M_MODE (OW_2P5M_MODE_DISABLE<<OW_2P5M_MODE_Pos)
#define BMC_SAMPLING_POINT_Pos 13
#define BMC_SAMPLING_POINT_RESERVED 0
#define BMC_SAMPLING_POINT_2M 1
#define BMC_SAMPLING_POINT_1_8M 2
#define BMC_SAMPLING_POINT_1_6M 3
#define BMC_SAMPLING_POINT (BMC_SAMPLING_POINT_1_6M<<BMC_SAMPLING_POINT_Pos)
#define MUX_OPTION_Pos 15
#define MUX_OPTION_OWB 0
#define MUX_OPTION_OWS 1
#define MUX_OPTION (MUX_OPTION_OWB<<MUX_OPTION_Pos)
//0x46
#define SICK_FAULT_DISABLE 0 // 0:Enable sick dection 1:Disable sick dection
#define OPEN_FALUT_DISABLE 0 // 0:Enable open dection 1:Disable open dection
#define SHORT_FAULT_DISABLE 0 // 0:Enable short dection 1:Disable short dection
#define OTP_FAULT_DISABLE 0 // 0:Enable OTP dection 1:Disable OTP dection
#define OTP_OFF_DISABLE 0 // 0:Turn off pwm when OTP 1:not turn off pwm when OTP
#define OTP_REC_DISABLE 0 // 0:recovery pwm when OTP relieve 1:not auto recovery pwm when OTP relieve
#define OPEN_OFF_DISABLE 1 // 0:turn off pwm when open fault detected 1:not turn off pwm when open fault detected
#define SHORT_OFF_DISABLE 0 // 0:turn off pwm when short fault detected 1:not turn off pwm when short fault detected
#define OWB_DATA_OFFSET_ENABLE 0 // 0: disable OWB_data_offset_register 1: enable OWB_data_offset_register
#define PWM_HIGH_TIME_FAULT_DISABLE 0 // 0:enable pwm high time detect function 1:disable pwm high time detect function
#define OH_DISABLE 1 // 0:enable OH detect function 1:disable OH detect function
#define SICK_RANGE_SEL 0 // 0:sick detection related to open 1:sick detection not related to open
#define DIS_DOS_CRC 0 // 0:enable dis-dos communication CRC check 1:disable dis-dos communication CRC check
#define DUPLEX_ENABLE 0 // 0:disable duplex 1:enable duplex
#define CONFIG_DONE 1
#endif
#endif