    #ifndef _GPIO_H_
#define _GPIO_H_

#define OUT 1
#define IN 0

//-------------------------------  pin的io方向寄存器映射---------------------------------------
#define PIN_1_D DDR1AD_DDR1AD5
#define PIN_2_D DDR1AD_DDR1AD6
#define PIN_3_D DDR1AD_DDR1AD7
#define PIN_4_D DDR0AD_DDR0AD0
#define PIN_5_D DDR0AD_DDR0AD1
#define PIN_6_D DDR0AD_DDR0AD2
#define PIN_7_D DDR0AD_DDR0AD3
#define PIN_9_D DDRU_DDRU0
#define PIN_10_D DDRU_DDRU1
#define PIN_11_D DDRU_DDRU2
#define PIN_12_D DDRU_DDRU3
#define PIN_15_D DDRU_DDRU4
#define PIN_16_D DDRU_DDRU5
#define PIN_17_D DDRU_DDRU6
#define PIN_18_D DDRU_DDRU7
#define PIN_19_D DDRV_DDRV0
#define PIN_20_D DDRV_DDRV1
#define PIN_21_D DDRV_DDRV2
#define PIN_22_D DDRV_DDRV3
#define PIN_25_D DDRV_DDRV4
#define PIN_26_D DDRV_DDRV5
#define PIN_27_D DDRV_DDRV6
#define PIN_28_D DDRV_DDRV7
#define PIN_29_D DDRP_DDRP0
#define PIN_30_D DDRP_DDRP1
#define PIN_31_D DDRP_DDRP2
#define PIN_32_D DDRP_DDRP3
#define PIN_33_D DDRP_DDRP4
#define PIN_34_D DDRP_DDRP5
#define PIN_35_D DDRP_DDRP6
#define PIN_36_D DDRP_DDRP7
#define PIN_37_D DDRR_DDRR2
#define PIN_38_D DDRR_DDRR3
#define PIN_39_D DDRS_DDRS0
#define PIN_40_D DDRS_DDRS1
#define PIN_43_D DDRS_DDRS2
#define PIN_44_D DDRS_DDRS3
#define PIN_45_D DDRR_DDRR0
#define PIN_46_D DDRR_DDRR1
#define PIN_47_D DDRS_DDRS4
#define PIN_48_D DDRS_DDRS5
#define PIN_49_D DDRS_DDRS6
#define PIN_50_D DDRS_DDRS7
#define PIN_52_D DDRT_DDRT0
#define PIN_53_D DDRT_DDRT1
#define PIN_54_D DDRT_DDRT2
#define PIN_55_D DDRT_DDRT3
#define PIN_56_D DDRR_DDRR4
#define PIN_57_D DDRT_DDRT4
#define PIN_58_D DDRT_DDRT5
#define PIN_59_D DDRT_DDRT6
#define PIN_60_D DDRT_DDRT7
#define PIN_61_D DDRR_DDRR5
#define PIN_62_D DDRR_DDRR6
#define PIN_63_D DDRH_DDRH0
#define PIN_64_D DDRH_DDRH1
#define PIN_65_D DDRH_DDRH2
#define PIN_66_D DDRH_DDRH3
#define PIN_69_D DDRM_DDRM0
#define PIN_70_D DDRM_DDRM1
#define PIN_71_D DDRM_DDRM2
#define PIN_72_D DDRM_DDRM3
#define PIN_75_D DDRH_DDRH4
#define PIN_76_D DDRH_DDRH5
#define PIN_83_D DDRH_DDRH6
#define PIN_84_D DDRH_DDRH7
#define PIN_85_D DDRR_DDRR7
#define PIN_86_D DDRB_DDRB0
#define PIN_87_D DDRA_DDRA0
#define PIN_88_D DDRA_DDRA1
#define PIN_89_D DDRA_DDRA2
#define PIN_90_D DDRA_DDRA3
#define PIN_91_D DDRA_DDRA4
#define PIN_92_D DDRA_DDRA5
#define PIN_93_D DDRA_DDRA6
#define PIN_94_D DDRA_DDRA7
#define PIN_95_D DDRB_DDRB1
#define PIN_96_D DDRB_DDRB2
#define PIN_97_D DDRB_DDRB3
#define PIN_100_D DDRB_DDRB4
#define PIN_101_D DDRB_DDRB5
#define PIN_102_D DDRB_DDRB6
#define PIN_103_D DDRB_DDRB7
#define PIN_108_D DDR1AD_DDR1AD0
#define PIN_109_D DDR1AD_DDR1AD1
#define PIN_110_D DDR1AD_DDR1AD2
#define PIN_111_D DDR1AD_DDR1AD3
#define PIN_112_D DDR1AD_DDR1AD4

//-------------------------------  pin的io数据寄存器映射---------------------------------------
#define PIN_1_P PT1AD_PT1AD5
#define PIN_2_P PT1AD_PT1AD6
#define PIN_3_P PT1AD_PT1AD7
#define PIN_4_P PT0AD_PT0AD0
#define PIN_5_P PT0AD_PT0AD1
#define PIN_6_P PT0AD_PT0AD2
#define PIN_7_P PT0AD_PT0AD3
#define PIN_9_P PTU_PTU0
#define PIN_10_P PTU_PTU1
#define PIN_11_P PTU_PTU2
#define PIN_12_P PTU_PTU3
#define PIN_15_P PTU_PTU4
#define PIN_16_P PTU_PTU5
#define PIN_17_P PTU_PTU6
#define PIN_18_P PTU_PTU7
#define PIN_19_P PTV_PTV0
#define PIN_20_P PTV_PTV1
#define PIN_21_P PTV_PTV2
#define PIN_22_P PTV_PTV3
#define PIN_25_P PTV_PTV4
#define PIN_26_P PTV_PTV5
#define PIN_27_P PTV_PTV6
#define PIN_28_P PTV_PTV7
#define PIN_29_P PTP_PTP0
#define PIN_30_P PTP_PTP1
#define PIN_31_P PTP_PTP2
#define PIN_32_P PTP_PTP3
#define PIN_33_P PTP_PTP4
#define PIN_34_P PTP_PTP5
#define PIN_35_P PTP_PTP6
#define PIN_36_P PTP_PTP7
#define PIN_37_P PTR_PTR2
#define PIN_38_P PTR_PTR3
#define PIN_39_P PTS_PTS0
#define PIN_40_P PTS_PTS1
#define PIN_43_P PTS_PTS2
#define PIN_44_P PTS_PTS3
#define PIN_45_P PTR_PTR0
#define PIN_46_P PTR_PTR1
#define PIN_47_P PTS_PTS4
#define PIN_48_P PTS_PTS5
#define PIN_49_P PTS_PTS6
#define PIN_50_P PTS_PTS7
#define PIN_52_P PTT_PTT0
#define PIN_53_P PTT_PTT1
#define PIN_54_P PTT_PTT2
#define PIN_55_P PTT_PTT3
#define PIN_56_P PTR_PTR4
#define PIN_57_P PTT_PTT4
#define PIN_58_P PTT_PTT5
#define PIN_59_P PTT_PTT6
#define PIN_60_P PTT_PTT7
#define PIN_61_P PTR_PTR5
#define PIN_62_P PTR_PTR6
#define PIN_63_P PTH_PTH0
#define PIN_64_P PTH_PTH1
#define PIN_65_P PTH_PTH2
#define PIN_66_P PTH_PTH3
#define PIN_69_P PTM_PTM0
#define PIN_70_P PTM_PTM1
#define PIN_71_P PTM_PTM2
#define PIN_72_P PTM_PTM3
#define PIN_75_P PTH_PTH4
#define PIN_76_P PTH_PTH5
#define PIN_83_P PTH_PTH6
#define PIN_84_P PTH_PTH7
#define PIN_85_P PTR_PTR7
#define PIN_86_P PORTB_PB0
#define PIN_87_P PORTA_PA0
#define PIN_88_P PORTA_PA1
#define PIN_89_P PORTA_PA2
#define PIN_90_P PORTA_PA3
#define PIN_91_P PORTA_PA4
#define PIN_92_P PORTA_PA5
#define PIN_93_P PORTA_PA6
#define PIN_94_P PORTA_PA7
#define PIN_95_P PORTB_PB1
#define PIN_96_P PORTB_PB2
#define PIN_97_P PORTB_PB3
#define PIN_100_P PORTB_PB4
#define PIN_101_P PORTB_PB5
#define PIN_102_P PORTB_PB6
#define PIN_103_P PORTB_PB7
#define PIN_108_P PT1AD_PT1AD0
#define PIN_109_P PT1AD_PT1AD1
#define PIN_110_P PT1AD_PT1AD2
#define PIN_111_P PT1AD_PT1AD3
#define PIN_112_P PT1AD_PT1AD4
//-------------------------------  pin的io输入内拉使能寄存器映射---------------------------------------
#define PIN_1_PULL PER1AD_PER1AD5
#define PIN_2_PULL PER1AD_PER1AD6
#define PIN_3_PULL PER1AD_PER1AD7
#define PIN_4_PULL PER0AD_PER0AD0
#define PIN_5_PULL PER0AD_PER0AD1
#define PIN_6_PULL PER0AD_PER0AD2
#define PIN_7_PULL PER0AD_PER0AD3
//#define	PIN_8_PER     PIN_PER_Null
#define PIN_9_PULL PERU_PERU0
#define PIN_10_PULL PERU_PERU1
#define PIN_11_PULL PERU_PERU2
#define PIN_12_PULL PERU_PERU3
//#define		PIN_13_PULL	  PIN_PER_Null
//#define		PIN_14_PULL	  PIN_PER_Null
#define PIN_15_PULL PERU_PERU4
#define PIN_16_PULL PERU_PERU5
#define PIN_17_PULL PERU_PERU6
#define PIN_18_PULL PERU_PERU7
#define PIN_19_PULL PERV_PERV0
#define PIN_20_PULL PERV_PERV1
#define PIN_21_PULL PERV_PERV2
#define PIN_22_PULL PERV_PERV3
//#define		PIN_23_PULL	  PIN_PER_Null
//#define		PIN_24_PULL	  PIN_PER_Null
#define PIN_25_PULL PERV_PERV4
#define PIN_26_PULL PERV_PERV5
#define PIN_27_PULL PERV_PERV6
#define PIN_28_PULL PERV_PERV7
#define PIN_29_PULL PERP_PERP0
#define PIN_30_PULL PERP_PERP1
#define PIN_31_PULL PERP_PERP2
#define PIN_32_PULL PERP_PERP3
#define PIN_33_PULL PERP_PERP4
#define PIN_34_PULL PERP_PERP5
#define PIN_35_PULL PERP_PERP6
#define PIN_36_PULL PERP_PERP7
#define PIN_37_PULL PERR_PERR2
#define PIN_38_PULL PERR_PERR3
#define PIN_39_PULL PERS_PERS0
#define PIN_40_PULL PERS_PERS1
//#define		PIN_41_PULL	  PIN_PER_Null
//#define		PIN_42_PULL	  PIN_PER_Null
#define PIN_43_PULL PERS_PERS2
#define PIN_44_PULL PERS_PERS3
#define PIN_45_PULL PERR_PERR0
#define PIN_46_PULL PERR_PERR1
#define PIN_47_PULL PERS_PERS4
#define PIN_48_PULL PERS_PERS5
#define PIN_49_PULL PERS_PERS6
#define PIN_50_PULL PERS_PERS7
//#define		PIN_51_PULL	  PIN_PER_Null
#define PIN_52_PULL PERT_PERT0
#define PIN_53_PULL PERT_PERT1
#define PIN_54_PULL PERT_PERT2
#define PIN_55_PULL PERT_PERT3
#define PIN_56_PULL PERR_PERR4
#define PIN_57_PULL PERT_PERT4
#define PIN_58_PULL PERT_PERT5
#define PIN_59_PULL PERT_PERT6
#define PIN_60_PULL PERT_PERT7
#define PIN_61_PULL PERR_PERR5
#define PIN_62_PULL PERR_PERR6
#define PIN_63_PULL PERH_PERH0
#define PIN_64_PULL PERH_PERH1
#define PIN_65_PULL PERH_PERH2
#define PIN_66_PULL PERH_PERH3
//#define		PIN_67_PULL	  PIN_PER_Null
//#define		PIN_68_PULL	  PIN_PER_Null
#define PIN_69_PULL PERM_PERM0       //down
#define PIN_70_PULL PERM_PERM1       //right
#define PIN_71_PULL PERM_PERM2
#define PIN_72_PULL PERM_PERM3     //left
//#define		PIN_73_PULL	  PIN_PER_Null
//#define		PIN_74_PULL	  PIN_PER_Null
#define PIN_75_PULL PERH_PERH4
#define PIN_76_PULL PERH_PERH5
//#define		PIN_77_PULL	  PIN_PER_Null
//#define		PIN_78_PULL	  PIN_PER_Null
//#define		PIN_79_PULL	  PIN_PER_Null
//#define		PIN_80_PULL	  PIN_PER_Null
//#define		PIN_81_PULL	  PIN_PER_Null
//#define		PIN_82_PULL	  PIN_PER_Null
#define PIN_83_PULL PERH_PERH6
#define PIN_84_PULL PERH_PERH7
#define PIN_85_PULL PERR_PERR7
//#define		PIN_86_PULL	  PIN_PER_Null
//#define		PIN_87_PULL	  PIN_PER_Null
//#define		PIN_88_PULL	  PIN_PER_Null
//#define		PIN_89_PULL	  PIN_PER_Null
//#define		PIN_90_PULL	  PIN_PER_Null
//#define		PIN_91_PULL	  PIN_PER_Null
//#define		PIN_92_PULL	  PIN_PER_Null
//#define		PIN_93_PULL	  PIN_PER_Null
//#define		PIN_94_PULL	  PIN_PER_Null
//#define		PIN_95_PULL	  PIN_PER_Null
//#define		PIN_96_PULL	  PIN_PER_Null
//#define		PIN_97_PULL	  PIN_PER_Null
//#define		PIN_98_PULL	  PIN_PER_Null
//#define		PIN_99_PULL	  PIN_PER_Null
//#define		PIN_100_PULL	  PIN_PER_Null
//#define		PIN_101_PULL	  PIN_PER_Null
//#define		PIN_102_PULL	  PIN_PER_Null
//#define		PIN_103_PULL	  PIN_PER_Null
//#define		PIN_104_PULL	  PIN_PER_Null
//#define		PIN_105_PULL	  PIN_PER_Null
//#define		PIN_106_PULL	  PIN_PER_Null
//#define		PIN_107_PULL	  PIN_PER_Null
#define PIN_108_PULL PER1AD_PER1AD0
#define PIN_109_PULL PER1AD_PER1AD1
#define PIN_110_PULL PER1AD_PER1AD2
#define PIN_111_PULL PER1AD_PER1AD3
#define PIN_112_PULL PER1AD_PER1AD4
//-------------------------------  pin的io输入内拉电阻极性寄存器映射---------------------------------------
//#define	PIN_1_POLAR	只能上拉
//#define	PIN_2_POLAR	只能上拉
//#define	PIN_3_POLAR	只能上拉
//#define	PIN_4_POLAR	只能上拉
//#define	PIN_5_POLAR	只能上拉
//#define	PIN_6_POLAR	只能上拉
//#define	PIN_7_POLAR	只能上拉
//#define	PIN_8_POLAR 	只能上拉

#define PIN_9_POLAR PPSU_PPSU0
#define PIN_10_POLAR PPSU_PPSU1
#define PIN_11_POLAR PPSU_PPSU2
#define PIN_12_POLAR PPSU_PPSU3
//#define	PIN_13_POLAR	NONE
//#define	PIN_14_POLAR	NONE
#define PIN_15_POLAR PPSU_PPSU4
#define PIN_16_POLAR PPSU_PPSU5
#define PIN_17_POLAR PPSU_PPSU6
#define PIN_18_POLAR PPSU_PPSU7
#define PIN_19_POLAR PPSV_PPSV0
#define PIN_20_POLAR PPSV_PPSV1
#define PIN_21_POLAR PPSV_PPSV2
#define PIN_22_POLAR PPSV_PPSV3
//#define	PIN_23_POLAR	NONE
//#define	PIN_24_POLAR	NONE
#define PIN_25_POLAR PPSV_PPSV4
#define PIN_26_POLAR PPSV_PPSV5
#define PIN_27_POLAR PPSV_PPSV6
#define PIN_28_POLAR PPSV_PPSV7
#define PIN_29_POLAR PPSP_PPSP0
#define PIN_30_POLAR PPSP_PPSP1
#define PIN_31_POLAR PPSP_PPSP2
#define PIN_32_POLAR PPSP_PPSP3
#define PIN_33_POLAR PPSP_PPSP4
#define PIN_34_POLAR PPSP_PPSP5
#define PIN_35_POLAR PPSP_PPSP6
#define PIN_36_POLAR PPSP_PPSP7
#define PIN_37_POLAR PPSR_PPSR2
#define PIN_38_POLAR PPSR_PPSR3
#define PIN_39_POLAR PPSS_PPSS0
#define PIN_40_POLAR PPSS_PPSS1
//#define	PIN_41_POLAR	NONE
//#define	PIN_42_POLAR	NONE
#define PIN_43_POLAR PPSS_PPSS2
#define PIN_44_POLAR PPSS_PPSS3
#define PIN_45_POLAR PPSR_PPSR0
#define PIN_46_POLAR PPSR_PPSR1
#define PIN_47_POLAR PPSS_PPSS4
#define PIN_48_POLAR PPSS_PPSS5
#define PIN_49_POLAR PPSS_PPSS6
#define PIN_50_POLAR PPSS_PPSS7
//#define	PIN_51_POLAR	NONE
#define PIN_52_POLAR PPST_PPST0
#define PIN_53_POLAR PPST_PPST1
#define PIN_54_POLAR PPST_PPST2
#define PIN_55_POLAR PPST_PPST3
#define PIN_56_POLAR PPSR_PPSR4
#define PIN_57_POLAR PPST_PPST4
#define PIN_58_POLAR PPST_PPST5
#define PIN_59_POLAR PPST_PPST6
#define PIN_60_POLAR PPST_PPST7
#define PIN_61_POLAR PPSR_PPSR5
#define PIN_62_POLAR PPSR_PPSR6
#define PIN_63_POLAR PPSH_PPSH0
#define PIN_64_POLAR PPSH_PPSH1
#define PIN_65_POLAR PPSH_PPSH2
#define PIN_66_POLAR PPSH_PPSH3
//#define	PIN_67_POLAR	NONE
//#define	PIN_68_POLAR	NONE
#define PIN_69_POLAR PPSM_PPSM0
#define PIN_70_POLAR PPSM_PPSM1
#define PIN_71_POLAR PPSM_PPSM2
#define PIN_72_POLAR PPSM_PPSM3
//#define	PIN_73_POLAR	NONE
//#define	PIN_74_POLAR	NONE
#define PIN_75_POLAR PPSH_PPSH4
#define PIN_76_POLAR PPSH_PPSH5
//#define	PIN_77_POLAR	NONE
//#define	PIN_78_POLAR	NONE
//#define	PIN_79_POLAR	NONE
//#define	PIN_80_POLAR	NONE
//#define	PIN_81_POLAR	NONE
//#define	PIN_82_POLAR	NONE
#define PIN_83_POLAR PPSH_PPSH6
#define PIN_84_POLAR PPSH_PPSH7
#define PIN_85_POLAR PPSR_PPSR7
//#define	PIN_86_POLAR	NONE
//#define	PIN_87_POLAR	NONE
//#define	PIN_88_POLAR	NONE
//#define	PIN_89_POLAR	NONE
//#define	PIN_90_POLAR	NONE
//#define	PIN_91_POLAR	NONE
//#define	PIN_92_POLAR	NONE
//#define	PIN_93_POLAR	NONE
//#define	PIN_94_POLAR	NONE
//#define	PIN_95_POLAR	NONE
//#define	PIN_96_POLAR	NONE
//#define	PIN_97_POLAR	NONE
//#define	PIN_98_POLAR	NONE
//#define	PIN_99_POLAR	NONE
//#define	PIN_100_POLAR	NONE
//#define	PIN_101_POLAR	NONE
//#define	PIN_102_POLAR	NONE
//#define	PIN_103_POLAR	NONE
//#define	PIN_104_POLAR	NONE
//#define	PIN_105_POLAR	NONE
//#define	PIN_106_POLAR	NONE
//#define	PIN_107_POLAR	NONE
//#define	PIN_108_POLAR	只能上拉
//#define	PIN_109_POLAR	只能上拉
//#define	PIN_110_POLAR	只能上拉
//#define	PIN_111_POLAR	只能上拉
//#define	PIN_112_POLAR	只能上拉
//////////////////以下为具体板子定义的引脚功能///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////以下为具体板子定义的引脚功能///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////以下为具体板子定义的引脚功能///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//输入硬线//低有效


#define	DifferentialLock_IN_P	    	PIN_32_P//I_MCU_轴间差速锁工作（-）_预留
#define	BatteryCharge_IN_P	    		PIN_33_P//I_MCU_蓄电池充放电（-）_预留        
#define	CabLock_IN_P	    			PIN_35_P	/*驾驶室锁止*/
#define	LowDCFlt_IN_P				PIN_38_P/*低压DCDC故障*/
#define	Driver_SafeBelt_IN_P		PIN_40_P/*主安全带*/

#define	Parking_Brake_IN_P			PIN_49_P/*驻车制动*/
#define	ChargeWakeup_IN_P		PIN_52_P/*I_MCU_充电唤醒_预留*/
#define	BrakeLiquid_IN_P			PIN_53_P	/*I_MCU_制动液位低（-）_预留*/
#define	BrakeShoeWear_IN_P	  	PIN_59_P /*蹄片磨损警告*/
#define	Passenger_SafeBelt_IN_P		PIN_60_P/*副安全带*/	     //预留

#define	SteerLiquid_IN_P			PIN_63_P /*I_MCU_转向液位低（-）_预留*/	
#define	Middle_SafeBelt_IN_P		PIN_75_P/*中间座位安全带报警*/  //预留
#define	Emptyfilter_Block_P			PIN_111_P   /* I_MCU_空滤阻塞（-）  */
#define	Wheel_DifferentialLock_P	PIN_3_P   /* I_MCU_轮间差速锁工作（-）_预留*/

#define     BUTTON_DOWN_IN_P 		PIN_69_P
#define     BUTTON_RIGHT_IN_P		PIN_70_P
#define     BUTTON_LEFT_IN_P			PIN_72_P

#define     BACKLIGHT_IN_P			PIN_57_P


//输出硬线//高有效
#define  GPIO_5V_Control_OUT   PIN_58_P//可控5V的控制引脚	  21

#define  GPIO_Speed_OUT_1    PIN_39_P//车速输出1引脚	   21
//输出硬线//低有效

//#define  LM2735_EN_OUT_P    PIN_33_P



///////函数///////////////////////////////////////
void GPIO_Init_First(void);
void GPIO_Sleep_Init(void);
void GPIO_WakeUp_Init(void);

#endif