/*
* Copyright (c) Texas Instruments Incorporated 2016-2017
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* \file bspdrv_ar12xx.c
*
* \brief AR12xx Radar sensor driver.
*
*/
/* ========================================================================== */
/* Include Files */
/* ========================================================================== */
#include <xdc/std.h>
#include <ti/drv/vps/include/common/bsp_types.h>
#include <ti/drv/vps/include/common/trace.h>
#include <ti/drv/vps/include/common/bsp_config.h>
#include <ti/drv/vps/include/common/bsp_utils.h>
#include <ti/drv/vps/include/osal/bsp_osal.h>
#include <ti/drv/vps/include/devices/bsp_device.h>
#include <ti/drv/vps/include/devices/bsp_ar12xx.h>
#include <ti/drv/vps/include/boards/bsp_board.h>
#include <bspdrv_ar12xxPriv.h>
/* ========================================================================== */
/* Macros & Typedefs */
/* ========================================================================== */
/* None */
/* ========================================================================== */
/* Structure Declarations */
/* ========================================================================== */
/* None */
/* ========================================================================== */
/* Global Variables */
/* ========================================================================== */
/** List of the sensors supported by the radar driver */
Bsp_ar12xxSensorObj gBspAr12xxSensorCfgList[
BSP_AR12XX_MAX_CONFIG_SUPPORTED] =
{
{1U, BSP_AR12XX_AR1243_NAME, &gAr1243RadarConfig},
{0U, "\0", NULL },
{0U, "\0", NULL },
{0U, "\0", NULL },
{0U, "\0", NULL }
};
/** BSP Driver AR12xx radar object */
Bsp_ar12xxObj gBspAr12xxObj;
/* ========================================================================== */
/* Function Declarations */
/* ========================================================================== */
/**
* \brief Function to check if the necessary initialization parameters are
* populated for the radar sensor to work.
*
* \param initPrms Pointer to the initialization parameters.
*
* \return retVal Returns BSP_SOK if the parameters are populated correctly.
* BSP_EINVALID_PARAMS is returned otherwise.
*/
static Int32 Bsp_ar12xxCheckInitParams(
const Bsp_Ar12xxInitParams *initPrms);
/**
* \brief Function to set the CSI AR configuration for trim settings.
*
* \param None
*
* \return retVal Returns BSP_SOK if the parameters are populated correctly.
* BSP_EINVALID_PARAMS is returned otherwise.
*/
static Int32 Bsp_ar12xxCsiTrimConfig(void);
/**
* \brief Set CRC type of async event from AWR1243 MasterSS
*
* \param [in] deviceMap - Device Index map
*
* \return int32_t Success - BSP_SOK, Failure - Error Code
*
*/
static int32_t Bsp_ar12xxSetDeviceCrcType(uint8_t deviceMap);
/* ========================================================================== */
/* Function Definitions */
/* ========================================================================== */
Int32 Bsp_ar12xxRegisterConfig(
char name[BSP_AR12XX_MAX_SENSOR_NAME_LENGTH],
Bsp_Ar12xxConfigObj *configObj)
{
Int32 retVal = BSP_SOK;
UInt32 i;
UInt32 numSensorsSupported = sizeof (gBspAr12xxSensorCfgList) /
sizeof (Bsp_ar12xxSensorObj);
for (i = 0; i < numSensorsSupported; i++)
{
if (gBspAr12xxSensorCfgList[i].isUsed == 0U)
{
strcpy(gBspAr12xxSensorCfgList[i].radarConfigName, name);
gBspAr12xxSensorCfgList[i].sensorConfigObj = configObj;
gBspAr12xxSensorCfgList[i].isUsed = 1U;
break;
}
}
if (i == numSensorsSupported)
{
retVal = BSP_EFAIL;
}
return retVal;
}
Int32 Bsp_ar12xxInit(const Bsp_Ar12xxInitParams *initPrms)
{
Int32 retVal = BSP_SOK;
UInt32 numSensorsSupported = sizeof (gBspAr12xxSensorCfgList) /
sizeof (Bsp_ar12xxSensorObj);
UInt32 i, devId;
UInt32 devArrMap[] =
{
RL_DEVICE_MAP_CASCADED_1,
RL_DEVICE_MAP_CASCADED_2,
RL_DEVICE_MAP_CASCADED_3,
RL_DEVICE_MAP_CASCADED_4
};
/* First initialize the driver object with 0s */
memset(&gBspAr12xxObj, 0, sizeof (Bsp_ar12xxObj));
/* Check if all necessary input init parameters are okay */
retVal = Bsp_ar12xxCheckInitParams(initPrms);
/* Find the configuration structure for the given radar sensor name */
if (retVal == BSP_SOK)
{
for (devId = 0; devId < initPrms->numRadarDevicesInCascade; devId++)
{
for (i = 0; i < numSensorsSupported; i++)
{
if (0 ==
strcmp(initPrms->devParams[devId].radarConfigName,
gBspAr12xxSensorCfgList[i].radarConfigName))
{
break;
}
}
if (i == numSensorsSupported)
{
retVal = BSP_EFAIL;
}
else
{
/* Set the radar ID to get the right configuration parameters */
gBspAr12xxObj.radarConfigId[devId] = i;
}
}
}
if (retVal == BSP_SOK)
{
/* Copy the initialization parameters to a local copy to be
* used later.
*/
memcpy(&gBspAr12xxObj.initPrmsCopy, initPrms,
sizeof (Bsp_Ar12xxInitParams));
/* Find the device map index */
gBspAr12xxObj.devIdxMap = 0U;
for (i = 0U; i < initPrms->numRadarDevicesInCascade; i++)
{
gBspAr12xxObj.devIdxMap |= devArrMap[i];
}
#if defined (BOARD_TYPE_TDA3XX_RVP)
/* Check if Satellite Radar is used or not */
/* Set pin mux & GPIO accordingly. */
if (Bsp_ar12xxGetConnType() == BSP_AR12XX_CONN_TYPE_DIRECT)
{
Bsp_boardTda3xxRvpAr12
code-changes
179 浏览量
2024-03-27
10:00:02
上传
评论
收藏 22KB ZIP 举报
![avatar](https://profile-avatar.csdnimg.cn/c53d7408ebe44e7099d3f9d130ed4b12_weixin_44296793.jpg!1)
根本学不会OvO
- 粉丝: 206
- 资源: 9
最新资源
- 目标检测-零售食品LOGO检测数据集-40000张图-+对应VOC-COCO-YOLO三种格式标签+数据集划分脚本
- 目标检测-零售食品LOGO检测数据集-30000张图-+对应VOC-COCO-YOLO三种格式标签+数据集划分脚本
- 目标检测-零售食品LOGO检测数据集-20000张图-+对应VOC-COCO-YOLO三种格式标签+数据集划分脚本
- 目标检测-零售食品LOGO检测数据集-10000张图-+对应VOC-COCO-YOLO三种格式标签+数据集划分脚本
- 基于GUI+MYSQL+JAVA图书管理系统文档说明+源码(高分大作业项目).zip
- 基于Qt使用C++实现图书管理系统源码+数据库(95分以上).zip
- 基于GUI+MYSQL+JAVA票务管理系统文档介绍+源码+数据库(高分大作业).zip
- 优先编码器除法电微分运算电路 全加器函数发生电路等电路经典Multisim仿真实验源文件合集(25个).zip
- 2331308JS课堂案例.zip
- STM32H750VBT6单片机最小系统开发板AD设计硬件(原理图+PCB+3D封装库)工程文件.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)