167 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			167 lines
		
	
	
		
			4.6 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 _MAC_RAWDATA_HW_H_
 | ||
|  | #define _MAC_RAWDATA_HW_H_
 | ||
|  | #include "iot_config.h"
 | ||
|  | 
 | ||
|  | #include "os_utils.h"
 | ||
|  | #include "tx_mpdu_start.h"
 | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | extern "C" { | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #define RAW_FC_LEN_DW     4
 | ||
|  | 
 | ||
|  | #define RAW_REG_TYPE_MAC  1
 | ||
|  | #define RAW_REG_TYPE_PHY  2
 | ||
|  | 
 | ||
|  | /* sack fc tx int mask */ | ||
|  | #define MAC_TX_SACK_FC_MASK             0x2 // bit 1
 | ||
|  | /* tx start int mask */ | ||
|  | #define MAC_TX_START_MASK               0x1 // bit 0
 | ||
|  | 
 | ||
|  | /* sack int status */ | ||
|  | #define MAC_TX_SACK_INT_STATUS          (0x1 << 1)
 | ||
|  | /* tx start int status */ | ||
|  | #define MAC_TX_START_INT_STATUS         (0x1 << 0)
 | ||
|  | 
 | ||
|  | /*
 | ||
|  | *  store high accurency hw tick timer, used for profiling timing | ||
|  | */ | ||
|  | typedef struct _fc_profile{ | ||
|  |     uint32_t rawdata_interrupt_trigger_ticks; | ||
|  |     uint32_t rawdata_get_fc_ticks; | ||
|  |     uint32_t rawdata_translate_fc_ticks; | ||
|  |     uint32_t rawdata_set_translate_fc_ticks; | ||
|  |     uint32_t rawdata_interrupt_release_ticks; | ||
|  |     uint32_t irq_type; | ||
|  | }fc_profile; | ||
|  | 
 | ||
|  | /*
 | ||
|  | *  translate message include src dest and timing | ||
|  | */ | ||
|  | typedef struct _fc_trans_msg{ | ||
|  |     uint32_t  org_fc[RAW_FC_LEN_DW]; | ||
|  |     uint32_t  trans_fc[RAW_FC_LEN_DW]; | ||
|  |     fc_profile profile; | ||
|  | }fc_trans_msg; | ||
|  | 
 | ||
|  | /**
 | ||
|  | * @brief iot_raw_write_reg() - write mac rawdata register. | ||
|  | * | ||
|  | * @param type:  register type. RAW_REG_TYPE_MAC or RAW_REG_TYPE_PHY. | ||
|  | * @param addr:  write target register address. | ||
|  | * @param val:   write target register value. | ||
|  | * | ||
|  | * @return       none | ||
|  | */ | ||
|  | void iot_raw_write_reg(uint32_t type, uint32_t addr, uint32_t val); | ||
|  | 
 | ||
|  | /*
 | ||
|  |  * iot_rawdata_hw_enable() - rawdata enable . | ||
|  |  */ | ||
|  | uint32_t iot_rawdata_hw_enable(uint8_t rawdata_enbale); | ||
|  | 
 | ||
|  | /*
 | ||
|  |  * iot_rawdata_get_tx_fc_bytes() - rawdata get fc from reg . | ||
|  |  */ | ||
|  | uint32_t iot_rawdata_get_tx_fc_bytes(fc_trans_msg *rawfc); | ||
|  | 
 | ||
|  | /*
 | ||
|  |  * iot_rawdata_translate_tx_fc() - rawdata translate fc . | ||
|  |  */ | ||
|  | uint32_t iot_rawdata_translate_tx_fc(fc_trans_msg *rawfc, \ | ||
|  |     uint32_t src_prot, uint32_t trans_prot); | ||
|  | 
 | ||
|  | /*
 | ||
|  |  * iot_rawdata_set_translate_tx_fc() - rawdata tx fc . | ||
|  |  */ | ||
|  | uint32_t iot_rawdata_set_translate_tx_fc(fc_trans_msg *rawfc); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief mac_rawdata_sack_isr_cfg() - rawdata sack isr config. | ||
|  |  * @param src_prot:    protocol | ||
|  |  */ | ||
|  | void mac_rawdata_sack_isr_cfg(uint32_t src_prot); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief mac_rawdata_sack_tx_isr_disable() - disable rawdata sack isr. | ||
|  |  */ | ||
|  | void mac_rawdata_sack_tx_isr_disable(); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief mac_rawdata_sack_tx_isr_enable() - enable rawdata sack isr. | ||
|  |  */ | ||
|  | void mac_rawdata_sack_tx_isr_enable(); | ||
|  | 
 | ||
|  | 
 | ||
|  | /**
 | ||
|  | * @brief mac_rawdata_mode_set() | ||
|  | *        set mac's rawdata mode's protocol support | ||
|  | * @param src_prot:    [protocol, PLC_PROTO_SG|PLC_PROTO_PSG|PLC_PROTO_GP] | ||
|  | * @return [none] | ||
|  | */ | ||
|  | void mac_rawdata_proto_set(uint32_t src_prot); | ||
|  | 
 | ||
|  | /**
 | ||
|  | * @brief mac_rawdata_mode_enable() | ||
|  | *        set mac's rawdata mode's enablement | ||
|  | * @param enable:    [1:enable;0:disable] | ||
|  | * @return [none] | ||
|  | */ | ||
|  | void mac_rawdata_mode_enable(uint32_t enable); | ||
|  | 
 | ||
|  | /**
 | ||
|  | * @brief iot_raw_read_reg() | ||
|  | *        read reg | ||
|  | * @param type:    [RAW_REG_TYPE_MAC:MAC RAW;RAW_REG_TYPE_PHY:PHY RAW] | ||
|  | * @param addr:    [register offset address] | ||
|  | * @return [register value] | ||
|  | */ | ||
|  | uint32_t iot_raw_read_reg(uint32_t type,  uint32_t addr); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief mac_rawdata_tx_war_isr_cfg() - rawdata war tx start isr config. | ||
|  |  */ | ||
|  | void mac_rawdata_tx_war_isr_cfg(void); | ||
|  | 
 | ||
|  | /**
 | ||
|  | * @brief mac_rawdata_tx_start_isr_clr() - clean rawdata tx start intrrupt status | ||
|  | * | ||
|  | * @param        none | ||
|  | * | ||
|  | * @return       none | ||
|  | */ | ||
|  | void mac_rawdata_tx_start_isr_clr(void); | ||
|  | 
 | ||
|  | /**
 | ||
|  | * @brief mac_rawdata_send_cert_mpdu() - mac rawdata send cert mpdu | ||
|  | * @param mpdu:                        - [tx mpdu start] | ||
|  | * @param fc:                          - [fc] | ||
|  | * @param tmi:                         - [tmi] | ||
|  | * @param ext_tmi:                     - [ext tmi] | ||
|  | * @return void                        void | ||
|  | */ | ||
|  | void mac_rawdata_send_cert_mpdu(uint32_t hwqid, tx_mpdu_start *mpdu, | ||
|  |     fc_trans_msg *p_msg, void *fc, uint32_t tmi, uint32_t ext_tmi); | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | } | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #endif
 |