yb_arm/driver/rfic/ucp/api/src/ucp_api_jesd.c
2025-05-20 01:20:32 +08:00

149 lines
4.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//******************** (C) COPYRIGHT 2022 SmartLogic*******************************
// FileName : ucp_api_jesd.c
// Author : Boheng Lin bhlin919@126.com
// Date First Issued : 2023-03-04 02:37:50 PM
// Last Modified :
// Description :
// ------------------------------------------------------------
// Modification History:
// Version Date Author Modification Description
//
//**********************************************************************************
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "ucp_reg_io.h"
#include "ucp_api_jesd.h"
#include "ucp_jesd_gpio.h"
#include "../../base/inc/ucp_hardware.h"
#define API_VERSION 1
#define MAJOR_VERSION 1
#define MINOR_VERSION 17
#define CUSTOM_VERSION 0
#define VER_INF \
"version 001: 2023.05.26 - 合并9.8G\n", \
"version 002: 2023.06.06 - lte OK\n", \
"version 003: 2023.06.09 - power 在 251 上拉齐到 20dbm\n", \
"version 004: 2023.06.26 - new interface\n", \
"version 005: 2023.07.06 - 时钟与 TR 初始化分离\n", \
"version 006: 2023.07.24 - new apiNR OK\n", \
"version 007: 2023.08.08 - new apiLTE OK. 添加编译开关 signal=NR(LTE)\n", \
"version 008: 2023.09.01 - 修正 evmy 板 RF 控制引脚错配到 TRX 控制引脚的问题,解决 251 evmy 板配置失败问题\n", \
"version 009: 2023.09.04 - 修正 tx rx rf 默认配置,使其上电不使能\n", \
"version 010: 2023.09.27 - 修改共享内存地址\n", \
"version 011: 2023.10.18 - 添加 ORX JSON 可配时钟源\n", \
"version 012: 2023.10.25 - 添加 EVMYF 分支\n", \
"version 1.1.5.0: 2023.10.31 - 正确配置 NR、NR200、LTE、ORX\n" \
"version 1.1.6.0: 2023.10.31 - RF GPIO 控制逻辑来自于配置文件 \n" \
"version 1.1.7.0: 2023.11.01 - 修改共享参数基地址 \n" \
"version 1.1.8.0: 2023.11.01 - 修改 EVMT、EVMF 不匹配的 GPIO \n" \
"version 1.1.9.0: 2023.11.08 - 修改 EVMT、EVMF 不匹配的 GPIO \n" \
"version 1.1.10.0: 2023.11.09 - 更新 evmt 校准参数 \n" \
"version 1.1.11.0: 2023.11.14 - 添加 TRX、RF、SW 控制 GPIO JSON \n" \
"version 1.1.12.0: 2023.11.21 - 板卡解耦, EVMY JSON 添加 TRX GPIO \n" \
"version 1.1.13.0: 2023.11.24 - EVMT、EVMY ORX 添加 sniff 切换逻辑EVB TRX 收发采用 SPI 模式 \n" \
"version 1.1.14.0: 2023.11.29 - 调整源码组织格式 \n" \
"version 1.1.15.0: 2024.01.02 - 修改 rfic 配置 json \n" \
"version 1.1.16.0: 2024.01.18 - 修改共享参数错误 \n" \
"version 1.1.17.0: 2024.04.24 - 添加 lvdsCoupling 解析 \n"
extern void ucp_jesd_pcsReset(void);
extern void ucp_jesd_init(ucp_jesd_Init_t *setting);
static ucp_jesd_TrxGpioCfg_t gTrxGpioCfg;
uint32_t UCP_API_JESD_Version(void)
{
printf("JesdVersion: %d.%d.%d.%d\n", API_VERSION, MAJOR_VERSION, MINOR_VERSION, CUSTOM_VERSION);
printf("Compile @%s, %s\n", __TIME__, __DATE__);
return ((API_VERSION << 24) + (MAJOR_VERSION << 16) + (MINOR_VERSION << 8) + CUSTOM_VERSION);
}
void UCP_API_JESD_ApeWorkStep(ucp_jesd_ApeWorkStep_e step)
{
ucp_reg32_write(SERDES_INIT_FLAG_ADDR, step);
if (step > 0)
{
printf("ApeWorkStep@ %d\n", step);
}
}
void UCP_API_JESD_TrxGpioSetup (const char *trxGpioConfigFile, uint16_t enLog)
{
ucp_reg_init();
memset(&gTrxGpioCfg, 0, sizeof(gTrxGpioCfg));
gTrxGpioCfg = ucp_jesd_gpioInit(trxGpioConfigFile, enLog);
}
ucp_jesd_TrxGpioCfg_t* UCP_API_JESD_TrxGpioGet (void)
{
return (ucp_jesd_TrxGpioCfg_t*)&gTrxGpioCfg;
}
ucp_jesd_States_e UCP_API_JESD_Init (ucp_jesd_Init_t *setting)
{
ucp_jesd_pcsReset();
ucp_jesd_init(setting);
return UCP_JESD_STATE_POWERONRESET;
}
ucp_jesd_States_e UCP_API_JESD_CellSetup (ucp_jesd_Init_t *setting)
{
return UCP_API_JESD_Init(setting);
}
void UCP_API_JESD_CellDelete (void)
{
ucp_jesd_pcsReset();
return;
}
void UCP_API_GPIO_Tx (void)
{
ucp_jesd_gpio_tx();
}
void UCP_API_GPIO_Rx (void)
{
ucp_jesd_gpio_rx();
}
void UCP_API_GPIO_On (void)
{
ucp_jesd_gpio_on();
}
void UCP_API_GPIO_Off (void)
{
ucp_jesd_gpio_off();
}
void UCP_API_GPIO_OrxOn (void)
{
ucp_jesd_gpio_orxOn();
}
void UCP_API_GPIO_OrxOff (void)
{
ucp_jesd_gpio_orxOff();
}
void UCP_API_GPIO_TrigOn (void)
{
ucp_jesd_gpio_trigOn();
}
void UCP_API_GPIO_TrigOff (void)
{
ucp_jesd_gpio_trigOff();
}