Files
kunlun/plc/halmac/inc/mac_cmn_hw.h
2024-09-28 14:24:04 +08:00

112 lines
3.5 KiB
C
Executable File

/****************************************************************************
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_CMN_HW_H
#define MAC_CMN_HW_H
/* os shim includes */
#include "os_types.h"
/* mac module internal includes */
#include "mac_vdev.h"
#include "phy_bb.h"
#ifdef __cplusplus
extern "C" {
#endif
/* mac_config_nid() - config network ID to HW
* @vdev: pointer to mac vdev
* @nid: the network ID to be set
*/
void mac_config_nid(mac_vdev_t *vdev, uint32_t nid);
/* mac_get_hw_nid() get network nid from hw
* @return return nid
*/
uint32_t mac_get_hw_nid();
/* mac_config_role() - config device role to HW
* @vdev: pointer to mac vdev
* @role: the role to be set. see PLC_DEV_ROLE_XXX
*/
void mac_config_role(mac_vdev_t *vdev, uint8_t role);
/* mac_get_hw_role() get network role from hw
* @return return hw reg value of role config
*/
uint32_t mac_get_hw_role();
/* mac_config_tei() - config tei to HW
* @vdev: pointer to mac vdev
* @role: the tei to be set
*/
void mac_config_tei(mac_vdev_t *vdev, uint16_t tei);
/* mac_get_hw_tei() get network tei from hw
* @return return hw reg value of tei config
*/
uint32_t mac_get_hw_tei();
/* mac_config_ntb_delta_from_isr() - config ntb diff to HW
* @is_positive: 1: the delta is positive; 0: the delta is negative
* @delta_ntb: the value of delta, unsigned value
* @
* @return need sw compensate ntb count
*/
int32_t mac_config_ntb_delta_from_isr(uint8_t is_positive, uint32_t delta_ntb);
/* mac_enable_hw_ntb_adjust() - enable/disable hw sync ppm.
* @para enable - enable/disable.
* @return 0
*/
uint32_t mac_enable_hw_ntb_adjust(uint32_t enable);
/* mac_ena_hw_ntb_wrap_fix() - enable/disable hw fix ntb high 32bit.
* @para enable - enable/disable.
* @return 0
*/
void mac_ena_hw_ntb_wrap_fix(uint8_t enable);
/* mac ppm calibration */
/*
* @brief mac ppm calibration and set reg
*
* @param cal_unit: calibration unit, see PHY_CAL_UNIT_ID
* @param ppm_err: mac ppm error, unit see PLC_NTB_PPM_SHIFT
* @param rate_mode: communication rate mode.
*
* @return 0 - success, others - fail.
*/
uint32_t mac_ppm_cal_set(PHY_CAL_UNIT_ID cal_unit, \
int16_t ppm_err, uint32_t rate_mode);
/* mac_dump_buf_from_cvg() - dump data based on CVG request */
void mac_dump_buf_from_cvg(void);
/**
*@brief mac_hw_sync_ppm_clr rst rx ppm
*@param pdev_id indicate pdev id
*@exception none
*@return none
*/
void mac_hw_sync_ppm_clr(uint8_t pdev_id);
#ifdef __cplusplus
}
#endif
#endif /* MAC_CMN_HW_H */