110 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			110 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
|  | /****************************************************************************
 | ||
|  | 
 | ||
|  | 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 IOT_ETH_API_H
 | ||
|  | #define IOT_ETH_API_H
 | ||
|  | 
 | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | extern "C" { | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #define EMAC_UNIT  0
 | ||
|  | 
 | ||
|  | /** \defgroup EMAC_APIs
 | ||
|  |  *  @brief EMAC APIs | ||
|  |  * | ||
|  |  * | ||
|  |  */ | ||
|  | 
 | ||
|  | /* recv callback */ | ||
|  | typedef void (*eth_packet_recv)(uint8_t *data, uint32_t len); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_eth_send_packet() - send packet list into emac's hardware queue. | ||
|  |  * @param lst:         iot_pkt list for packets. | ||
|  |  * @return | ||
|  |  * | ||
|  |  */ | ||
|  | void iot_eth_send_packet(iot_pkt_ls *lst); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_eth_register_recv_callback() - register a recv callback | ||
|  |  * @param recv        recv callback function. | ||
|  |  * @return | ||
|  |  * | ||
|  |  */ | ||
|  | void iot_eth_register_recv_callback(eth_packet_recv recv); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_eth_set_mac_addr() - set mac address | ||
|  |  * @param addr        mac address | ||
|  |  * @return | ||
|  |  * | ||
|  |  */ | ||
|  | void iot_eth_set_mac_addr(uint8_t *addr); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_eth_init() - get mac address | ||
|  |  * @param addr        mac address | ||
|  |  * @return | ||
|  |  * | ||
|  |  */ | ||
|  | void iot_eth_get_mac_addr(uint8_t *addr); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_eth_restart() - restart emac controller | ||
|  |  * | ||
|  |  * @return | ||
|  |  * | ||
|  |  */ | ||
|  | void iot_eth_restart(); | ||
|  | 
 | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_eth_get_link_status() - query link status | ||
|  |  * | ||
|  |  * @return 1=linked, 0=un-link | ||
|  |  */ | ||
|  | uint8_t iot_eth_get_link_status(); | ||
|  | 
 | ||
|  | /** \defgroup EMAC_APIs
 | ||
|  |  *  @brief EMAC APIs | ||
|  |  * | ||
|  |  * | ||
|  |  */ | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_eth_init() - init emac subsystem | ||
|  |  * | ||
|  |  * @return | ||
|  |  * | ||
|  |  */ | ||
|  | void iot_eth_init(); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_eth_dinit() - deinit emac subsystem | ||
|  |  * | ||
|  |  * @return | ||
|  |  * | ||
|  |  */ | ||
|  | void iot_eth_deinit(); | ||
|  | 
 | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | } | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #endif //IOT_ETH_API_H
 |