#ifndef __SWM260_PORT_H__
#define __SWM260_PORT_H__

void PORT_Init(uint32_t PORTx, uint32_t n, uint32_t func, uint32_t digit_in_en);	//端口引脚功能选择，其可取值如下：

#define PORTA	0
#define PORTB	1
#define PORTC	2
#define PORTD	3


#define PORTA_PIN0_GPIO		 	0

#define PORTA_PIN1_GPIO			0
#define PORTA_PIN1_SPI1_SCLK    1
#define PORTA_PIN1_TIMR2_IN		2
#define PORTA_PIN1_TIMR2_OUT	3

#define PORTA_PIN2_GPIO			0
#define PORTA_PIN2_UART4_TX		1
#define PORTA_PIN2_SWDIO		2

#define PORTA_PIN3_GPIO			0
#define PORTA_PIN3_PWM3B		1

#define PORTA_PIN4_GPIO			0
#define PORTA_PIN4_UART4_RX		1
#define PORTA_PIN4_SWCLK		2

#define PORTA_PIN5_GPIO			0
#define PORTA_PIN5_SPI0_SSEL	1
#define PORTA_PIN5_PWM3A		2

#define PORTA_PIN6_GPIO			0
#define PORTA_PIN6_SPI0_MISO	1
#define PORTA_PIN6_UART2_RX		2
#define PORTA_PIN6_TIMR2_IN		3
#define PORTA_PIN6_TIMR2_OUT	4

#define PORTA_PIN7_GPIO			0
#define PORTA_PIN7_SPI0_MOSI	1
#define PORTA_PIN7_UART2_TX		2
#define PORTA_PIN7_TIMR1_IN		3
#define PORTA_PIN7_TIMR1_OUT	4
#define PORTA_PIN7_ADC0_IN7		7

#define PORTA_PIN8_GPIO		 	0
#define PORTA_PIN8_SPI0_SCLK	1
#define PORTA_PIN8_TIMR0_IN		2
#define PORTA_PIN8_TIMR0_OUT	3
#define PORTA_PIN8_ADC0_IN6		7

#define PORTA_PIN9_GPIO			0
#define PORTA_PIN9_SPI0_MOSI	1
#define PORTA_PIN9_UART2_TX	    2
#define PORTA_PIN9_PWM_BRK0		3
#define PORTA_PIN9_ADC0_IN5		7

#define PORTA_PIN10_GPIO		0
#define PORTA_PIN10_SPI1_SSEL	1
#define PORTA_PIN10_UART2_RX	2
#define PORTA_PIN10_TIMR0_IN	3
#define PORTA_PIN10_TIMR0_OUT	4
#define PORTA_PIN10_ADC0_IN4	7

#define PORTA_PIN11_GPIO		0
#define PORTA_PIN11_SPI1_SCLK	1
#define PORTA_PIN11_PWM0A		2
#define PORTA_PIN11_TIMR2_IN	3
#define PORTA_PIN11_TIMR2_OUT	4
#define PORTA_PIN11_ADC0_IN3	7

#define PORTA_PIN12_GPIO		0
#define PORTA_PIN12_SPI1_MOSI	1
#define PORTA_PIN12_UART1_TX	2
#define PORTA_PIN12_PWM0B		3
#define PORTA_PIN12_TIMR0_IN	4
#define PORTA_PIN12_TIMR0_OUT	5
#define PORTA_PIN12_ADC0_IN2	7

#define PORTA_PIN13_GPIO		0
#define PORTA_PIN13_SPI1_MISO	1
#define PORTA_PIN13_UART1_RX	2
#define PORTA_PIN13_TIMR1_IN	3
#define PORTA_PIN13_TIMR1_OUT	4
#define PORTA_PIN13_ADC0_IN1	7

#define PORTA_PIN14_GPIO		0
#define PORTA_PIN14_ADC0_IN0	7

#define PORTA_PIN15_GPIO		0


#define PORTB_PIN0_GPIO		 	0

#define PORTB_PIN1_GPIO			0
#define PORTB_PIN1_PWM2A		1
#define PORTB_PIN1_XTAL_IN		7

#define PORTB_PIN2_GPIO			0
#define PORTB_PIN2_PWM2B		1
#define PORTB_PIN2_XTAL_OUT		7

#define PORTB_PIN3_GPIO			0

#define PORTB_PIN4_GPIO			0
#define PORTB_PIN4_TIMR3_IN		1
#define PORTB_PIN4_TIMR3_OUT	2
#define PORTB_PIN4_ACMP0_INN	7

#define PORTB_PIN5_GPIO			0
#define PORTB_PIN5_UART4_RX		1
#define PORTB_PIN5_PWM3BN		2
#define PORTB_PIN5_ACMP0_INP	7

#define PORTB_PIN6_GPIO			0
#define PORTB_PIN6_UART4_TX		1
#define PORTB_PIN6_PWM3AN		2

#define PORTB_PIN7_GPIO			0

#define PORTB_PIN8_GPIO		 	0
#define PORTB_PIN8_PWM_BRK2		1

#define PORTB_PIN9_GPIO			0
#define PORTB_PIN9_SPI1_MISO	1
#define PORTB_PIN9_UART1_RX		2
#define PORTB_PIN9_PWM1BN		3

#define PORTB_PIN10_GPIO		0
#define PORTB_PIN10_I2C4_SDA	1
#define PORTB_PIN10_SPI1_MOSI	2
#define PORTB_PIN10_UART1_TX	3
#define PORTB_PIN10_PWM1AN		4

#define PORTB_PIN11_GPIO		0
#define PORTB_PIN11_I2C4_SCL	1
#define PORTB_PIN11_SPI1_SCLK	2
#define PORTB_PIN11_HALL_IN0	3

#define PORTB_PIN12_GPIO		0
#define PORTB_PIN12_SPI1_MISO	1
#define PORTB_PIN12_UART3_RX	2
#define PORTB_PIN12_HALL_IN1	3
#define PORTB_PIN12_TIMR1_IN	4
#define PORTB_PIN12_TIMR1_OUT	5

#define PORTB_PIN13_GPIO		0
#define PORTB_PIN13_SPI1_MOSI	1
#define PORTB_PIN13_UART3_TX	2
#define PORTB_PIN13_HALL_IN2	3
#define PORTB_PIN13_TIMR0_IN	4
#define PORTB_PIN13_TIMR0_OUT	5

#define PORTB_PIN14_GPIO		0
#define PORTB_PIN14_UART3_CTS	1
#define PORTB_PIN14_TIMR3_IN	2
#define PORTB_PIN14_TIRM3_OUT	3

#define PORTB_PIN15_GPIO		0
#define PORTB_PIN15_UART3_RTS	1


#define PORTC_PIN0_GPIO			0
#define PORTC_PIN0_UART4_CTS	1
#define PORTC_PIN0_PWM_BRK1		2
#define PORTC_PIN0_ADC0_TRIG	3

#define PORTC_PIN1_GPIO			0
#define PORTC_PIN1_I2C4_SDA		1
#define PORTC_PIN1_UART4_RTS	2
#define PORTC_PIN1_PWM2B		3
#define PORTC_PIN1_TIMR0_IN		4
#define PORTC_PIN1_TIMR0_OUT	5

#define PORTC_PIN2_GPIO			0
#define PORTC_PIN2_I2C4_SCL		1
#define PORTC_PIN2_PWM2A		2
#define PORTC_PIN2_TIMR1_IN		3
#define PORTC_PIN2_TIMR1_OUT	4

#define PORTC_PIN3_GPIO			0
#define PORTC_PIN3_UART4_TX		1
#define PORTC_PIN3_PWM1B		2

#define PORTC_PIN4_GPIO			0
#define PORTC_PIN4_UART4_RX		1
#define PORTC_PIN4_PWM1A		2

#define PORTC_PIN5_GPIO			0
#define PORTC_PIN5_SPI0_MISO	1
#define PORTC_PIN5_UART3_RX		2
#define PORTC_PIN5_TIMR0_IN		3
#define PORTC_PIN5_TIMR0_OUT	4

#define PORTC_PIN6_GPIO			0
#define PORTC_PIN6_SPI0_MOSI	1
#define PORTC_PIN6_UART3_TX		2
#define PORTC_PIN6_PWM3BN		3
#define PORTC_PIN6_TIMR1_IN		4
#define PORTC_PIN6_TIMR1_OUT	5
#define PORTC_PIN6_OPA1_INN		7

#define PORTC_PIN7_GPIO			0
#define PORTC_PIN7_PWM3AN		1
#define PORTC_PIN7_OPA1_INP		7

#define PORTC_PIN8_GPIO			0
#define PORTC_PIN8_SPI0_MISO	1
#define PORTC_PIN8_UART2_RX		2
#define PORTC_PIN8_TIMR1_IN		3
#define PORTC_PIN8_TIMR1_OUT	4
#define PORTC_PIN8_OPA1_OUT		7

#define PORTC_PIN9_GPIO			0
#define PORTC_PIN9_SPI0_MOSI	1
#define PORTC_PIN9_UART2_TX		2
#define PORTC_PIN9_TIMR0_IN		3
#define PORTC_PIN9_TIMR0_OUT	4

#define PORTC_PIN10_GPIO		0
#define PORTC_PIN10_SPI0_SCLK	1
#define PORTC_PIN10_UART4_RX	2
#define PORTC_PIN10_PWM0AN		3
#define PORTC_PIN10_TIMR2_IN	4
#define PORTC_PIN10_TIMR2_OUT	5

#define PORTC_PIN11_GPIO		0
#define PORTC_PIN11_UART4_TX	1
#define PORTC_PIN11_PWM0BN		2
#define PORTC_PIN11_ADC0_TRIG	3

#define PORTC_PIN12_GPIO		0
#define PORTC_PIN12_SPI1_SCLK	1
#define PORTC_PIN12_PWM3B		2
#define PORTC_PIN12_TIMR2_IN	3
#define PORTC_PIN12_TIMR2_OUT	4
#define PORTC_PIN12_OPA0_INN	7

#define PORTC_PIN13_GPIO		0
#define PORTC_PIN13_SPI1_MOSI	1
#define PORTC_PIN13_UART0_TX	2
#define PORTC_PIN13_TIMR0_IN	3
#define PORTC_PIN13_TIMR0_OUT	4
#define PORTC_PIN13_OPA0_INP	7

#define PORTC_PIN14_GPIO		0
#define PORTC_PIN14_SPI1_MISO	1
#define PORTC_PIN14_UART0_RX	2
#define PORTC_PIN14_PWM3A		3
#define PORTC_PIN14_TIMR1_IN	4
#define PORTC_PIN14_TIMR1_OUT	5
#define PORTC_PIN14_OPA0_OUT	7

#define PORTC_PIN15_GPIO		0


#define PORTD_PIN0_GPIO			0
#define PORTD_PIN0_UART1_CTS	1
#define PORTD_PIN0_PWM2BN		2

#define PORTD_PIN1_GPIO			0
#define PORTD_PIN1_UART1_RTS	1
#define PORTD_PIN1_PWM2AN		2

#define PORTD_PIN2_GPIO			0
#define PORTD_PIN2_UART2_CTS	1

#define PORTD_PIN3_GPIO			0
#define PORTD_PIN3_UART2_RTS	1
#define PORTD_PIN3_TIMR3_IN		2
#define PORTD_PIN3_TIMR3_OUT	3

#define PORTD_PIN4_GPIO			0
#define PORTD_PIN4_UART0_TX		1
#define PORTD_PIN4_TIMR3_IN		2
#define PORTD_PIN4_TIMR3_OUT	3

#define PORTD_PIN5_GPIO			0
#define PORTD_PIN5_UART0_RX		1

#define PORTD_PIN6_GPIO			0
#define PORTD_PIN6_UART0_CTS	1
#define PORTD_PIN6_PWM0A		2
#define PORTD_PIN6_TIMR3_IN		3
#define PORTD_PIN6_TIMR3_OUT	4

#define PORTD_PIN7_GPIO			0
#define PORTD_PIN7_UART0_RTS	1
#define PORTD_PIN7_PWM0B		2


#endif //__SWM260_PORT_H__
