| 
									
										
										
										
											2024-09-28 14:24:04 +08:00
										 |  |  | /****************************************************************************
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT | 
					
						
							|  |  |  | be copied by any method or incorporated into another program without | 
					
						
							|  |  |  | the express written consent of Aerospace C.Power. This Information or any portion | 
					
						
							|  |  |  | thereof remains the property of Aerospace C.Power. The Information contained herein | 
					
						
							|  |  |  | is believed to be accurate and Aerospace C.Power assumes no responsibility or | 
					
						
							|  |  |  | liability for its use in any way and conveys no license or title under | 
					
						
							|  |  |  | any patent or copyright and makes no representation or warranty that this | 
					
						
							|  |  |  | Information is free from patent or copyright infringement. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ****************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef BOARD_INFO_H
 | 
					
						
							|  |  |  | #define BOARD_INFO_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  | extern "C" { | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-26 14:10:20 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define BOARD_OEM_INFO_SIZE_MAX (8192)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-28 14:24:04 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  load oem configuration information from oem partition, | 
					
						
							|  |  |  |  *              then set module type. | 
					
						
							|  |  |  |  * @return      ERR_OK -- ok | 
					
						
							|  |  |  |  *              others -- error | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | uint32_t  board_load_oem_cfg(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  dump board gpio resource configuration information. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | void board_resource_cfg_dump(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief board_lookup_uart_port() - get a uart port | 
					
						
							|  |  |  |  * @param type: the define UART_xxxx_PORT | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return      uart port | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | uint8_t board_lookup_uart_port(uint8_t type); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief board_lookup_pwm_ch() - get pwm channel | 
					
						
							|  |  |  |  * @param type: pwm channel type, see PWM_CH_TYPE_XXX. | 
					
						
							|  |  |  |  * @retval:     pwm channel num, see IOT_PWM_CHANNEL_XXX. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | uint8_t board_lookup_pwm_ch(uint8_t type); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief board_lookup_gpio() - get a gpio | 
					
						
							|  |  |  |  * @param type: the define GPIO_XXX | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return      gpio pin | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | uint8_t board_lookup_gpio(uint8_t type); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief board_get_adc() - get an adc channel | 
					
						
							|  |  |  |  * @param type: adc's type, see ADC_XXX. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return      adc's channel, see ADC_CHANNEL enum. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | uint8_t board_get_adc(uint8_t type); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief board_get_led() - get a led's gpio | 
					
						
							|  |  |  |  * @param type:  led's id, see IOT_LED_TYPE enum. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return      gpio pin | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | uint8_t board_get_led(uint8_t type); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief board_get_led_cnt() - get a led's total number | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return      total number of led | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | uint8_t board_get_led_cnt(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief board_get_led_id() - get a led's id | 
					
						
							|  |  |  |  * @param sig_out: gpio matrix signal out number, see IOT_LED_SIG_OUT enum. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return      id of led, see IOT_LED_TYPE enum. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | uint8_t board_get_led_id(uint8_t sig_out); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   bond/unbond debug uart pin | 
					
						
							|  |  |  |  * @param   enable: | 
					
						
							|  |  |  |  *             true -- bond uart pin; | 
					
						
							|  |  |  |  *             false -- unbond uart pin; | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | void board_debug_uart_pin_bond(bool_t enable); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   board_get_cert_test_uart_type() - get cert test uart type. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return  cert test uart type. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | uint8_t board_get_cert_test_uart_type(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   check if this board use rmii or not. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return  true  - this board use rmii interface | 
					
						
							|  |  |  |  *          false - this board not use eth rmii interface | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | bool_t board_support_rmii(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   check if this board use 6 way zero-crossing. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return  true  - this board use 6 way zero-crossing | 
					
						
							|  |  |  |  *          false - this board not use 6 way zero-crossing | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | bool_t board_support_zc6(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   check if this board use pulse for zero crossing. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return  true  - this board use pulse | 
					
						
							|  |  |  |  *          false - this board not use pulse | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | bool_t board_support_zc_pulse(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   check if this board use high precision zero crossing. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return  true  - this board use high precision | 
					
						
							|  |  |  |  *          false - this board not use high precision | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | bool_t board_support_zc_high_precision(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   get ntb offset between collected zc and real zc | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return  offset ntb, negative offset means collected zc is earlier than | 
					
						
							|  |  |  |  *          real zc, unit is 0.04us | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | int32_t board_get_zc_ntb_offset(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   check if this board use extend gpio switch reverse zero crossing. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return  true  - this board use extend gpio switch | 
					
						
							|  |  |  |  *          false - this board not use extend gpio switch | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | bool_t board_support_rev_zc_ext_gpio_switch(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   check if this board use failing edge for zero crossing. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return  true  - this board use failing edge | 
					
						
							|  |  |  |  *          false - this board not use failing edge | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | bool_t board_zc_edge_is_failing(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   check if this board support topo rx or not. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return  true  - this board support topo rx | 
					
						
							|  |  |  |  *          false - this board not support topo rx | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | bool_t board_support_topo_rx(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  get number of external uart port. | 
					
						
							|  |  |  |  * @return number of external uart port. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | uint8_t board_get_external_uart_port_num(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  get number of virtual uart port. | 
					
						
							|  |  |  |  * @return number of virtual uart port. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | uint8_t board_get_virtual_uart_port_num(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  get number of DMA uart port USED on this board. | 
					
						
							|  |  |  |  * @return number of uart port. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | uint8_t board_get_dma_uart_port_num(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  get number of uart port on KL chip. | 
					
						
							|  |  |  |  * @return number of uart port. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | uint8_t board_get_onchip_uart_port_num(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  get number of interkernel communication uart port. | 
					
						
							|  |  |  |  * @return number of uart port. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | uint8_t board_get_interkernel_communication_uart_port_num(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   get the reason of system reset and set default reset reason. | 
					
						
							|  |  |  |  * @param   p_reset_type - get reset type | 
					
						
							|  |  |  |  * @param   p_soft_reset_type  - get software reset type. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | void board_reset_reason_get(uint8_t *p_reset_type, uint8_t *p_soft_reset_type); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   check if this board is 5v power in or not. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return  true  - this board is 5v power in | 
					
						
							|  |  |  |  *          false - this board is not 5v power in | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | bool_t board_is_5v_power_in(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* BOARD_INFO_H */
 |