Xiaojie雷达之路---ADCBuf Driver External Functions详解

本文主要讲解为了使用驱动程序ADCBuf而需要调用的所有导出的API

init

函数原型:

void ADCBuf_init(
	void
)

函数功能:

这个函数是用于初始化ADC模块,在其他函数调用之前这个函数一定要被调用

函数参数:

函数返回值:

Params_init

函数原型:

void ADCBuf_Params_init(	
	ADCBuf_Params * 	params	
)	

函数功能:

这个函数用于将指定的ADCBuf_Params结构体所有的字段设置为其默认值

函数参数:

参数params,是一个指向用于初始化的ADCBuf_Params结构体的指针,结构体如下:

typedef struct ADCBuf_Params_t
{
    
    
    /* ADC buffer source, DFE or HIL */
    ADCBufSource        source;

    /* Continuous mode selection */
    uint8_t             continousMode;

#ifdef SOC_XWR14XX
    /* Chirp Threshold for non-continous operation */
    uint8_t             chirpThreshold;
#endif

#if defined(SOC_XWR16XX) || defined(SOC_XWR18XX) || defined(SOC_XWR68XX)
    /* Ping buffer Chirp Threshold for non-continous operation */
    uint8_t             chirpThresholdPing;

    /* Pong buffer Chirp Threshold for non-continous operation */
    uint8_t             chirpThresholdPong;
#endif

    /* Custom configuration, Pointer to a device specific extension of the ADCBuf_Params */
    void                *custom;
} ADCBuf_Params;

在这里插入图片描述

函数返回值:

open

函数原型:

ADCBuf_Handle ADCBuf_open(	
	uint_fast8_t 	index,
	ADCBuf_Params * 	params 
)	

函数功能:

函数的功能是打开一个给定的ADCBuf的外围设备

函数参数:

第一个参数index,是编入ADCBuf_config表的ADCBuf的逻辑外围设备号
第二个参数params,是指向参数块的指针,如果为NULL将使用默认值

函数返回值:

成功时,返回一个ADCBuf_Handle,错误时或者已经打开,会返回一个错误值,如果返回值为NULL,则以后的调用ADC API将导致未定义的行为

control

函数原型:

int_fast16_t ADCBuf_control(	
	ADCBuf_Handle 	handle,
	uint_fast8_t 	cmd,
	void * 	arg 
)	

函数功能:

该函数对于给定的ADCBuf_Handle执行特定于实现的特性

函数参数:

第一个参数是handle,是执行ADCBuf_open()返回的ADCBuf_Handle
第二个参数是cmd,有驱动程序实现的特定的命令,cmd可取的值有如下:

typedef enum ADCBufMMWave_CMD_e
{
    
    
    /**
     * @brief   set ADCBUF source, it can be DFE or VIN.
     *          The size of the argument size for this command is 4 bytes
     */
    ADCBufMMWave_CMD_SET_SRC    = 0,

    /**
     * @brief   Set number of Chirps to be stored in each Ping and Pong buffer.
     *          It should be programmed one less the actual number needed .
     *          The size of the argument size for this command is 4 bytes
     */
    ADCBufMMWave_CMD_SET_CHIRP_THRESHHOLD,

    /**
     * @brief   Set number of Chirps to be stored in each Ping buffer.
     *          It should be programmed one less the actual number needed .
     *          The size of the argument size for this command is 4 bytes
     */
    ADCBufMMWave_CMD_SET_PING_CHIRP_THRESHHOLD,

    /**
     * @brief   Set number of Chirps to be stored in each  Pong buffer.
     *          It should be programmed one less the actual number needed .
     *          The size of the argument size for this command is 4 bytes
     */
    ADCBufMMWave_CMD_SET_PONG_CHIRP_THRESHHOLD,

    /**
     * @brief   Enables/Disables Continuous mode for ADCBUF.
     *             1 to enable continuous mode.
     *          The size of the argument size for this command is 4 bytes
     */
    ADCBufMMWave_CMD_SET_CONTINUOUS_MODE,

    /**
     * @brief   Starts Continuous mode for ADCBUF.
     *          Number of Samples to store in Ping/Pong buffer needs to be provided.
     *          The size of the argument size for this command is 4 bytes
     */
    ADCBufMMWave_CMD_START_CONTINUOUS_MODE,

    /**
     * @brief   Stops Continuous mode for ADCBUF.
     *          The size of the argument size for this command is 0 bytes
     */
    ADCBufMMWave_CMD_STOP_CONTINUOUS_MODE,

    /**
     * @brief   Configures ADCBUF data format.
     *          The size of the argument size for this command is size of \ref ADCBuf_dataFormat
     */
    ADCBufMMWave_CMD_CONF_DATA_FORMAT,

    /**
     * @brief   Enable RX channels and configures the address offset in ADCBUF for the channel.
     *          The size of the argument size for this command is size of \ref ADCBuf_RxChanConf
     */
    ADCBufMMWave_CMD_CHANNEL_ENABLE,

    /**
     * @brief   Disable RX channels specified with RX channel bitmask
     *          The size of the argument size for this command is 4 bytes
     */
    ADCBufMMWave_CMD_CHANNEL_DISABLE,

    /**
     * @brief   Test pattern configuration.
     *          The size of the argument size for this command is size of \ref ADCBuf_TestPatternConf
     */
    ADCBufMMWave_CMD_CONF_TEST_PATTERN,

    /**
     * @brief   Starts Test pattern generation. Reboot is required when switching from Test pattern mode
     *          to normal operation mode.
     *          The size of the argument size for this command is 0 bytes
     */
    ADCBufMMWave_CMD_START_TEST_PATTERN,

    /**
     * @brief   Stops Test pattern generation.
     *          The size of the argument size for this command is 0 bytes
     */
    ADCBufMMWave_CMD_STOP_TEST_PATTERN,

    /**
     * @brief   Chirp Quality configuration.
     *          The size of the argument size for this command is size of \ref ADCBuf_CQConf
     */
    ADCBufMMWave_CMD_CONF_CQ,

    /**
     * @brief  Last command.
     */
    ADCBufMMWave_CMD_LAST
}ADCBufMMWave_CMD;

第三个参数是arg,指向与cmd一起提供的可选的R/W(读/写)参数的指针。arg应该对齐4个字节

函数返回值:

一个ADCBuf_Status描述一个错误或者成功的状态,负值表示错误

插话
ADCBuf_dataFormat结构体:

typedef struct ADCBuf_dataFormat_t
{
    
    
    /* ADC out Format
         0 - Complex Data mode
         1 - Real data mode
      */
    uint8_t     adcOutFormat;

    /* Sample interleave - IQswap
         0 - I is stored in LSB, Q is stored in MSB
         1 - Q is stored in LSB, I is stored in MSB
      */
    uint8_t     sampleInterleave;

    /* channel interleave
         0 - interleaved
         1 - non-interleaved
      */
    uint8_t     channelInterleave;
}ADCBuf_dataFormat;

ADCBuf_RxChanConf结构体:

typedef struct ADCBuf_RxChanConf_t
{
    
    
    /* RX channel id - 0~3 */
    uint8_t   channel;

    /* Address offset for the channel in Ping/Pong buffer
      Used only in non-interleaved mode, it must be 16 bytes aligned.
     */
    uint16_t  offset;
}ADCBuf_RxChanConf;

参考文献:

  1. 《mmWave SDK Module Documentation》

猜你喜欢

转载自blog.csdn.net/Xiao_Jie123/article/details/111088427