1 #ifndef _NXPUWB_CHIP_H_ 2 #define _NXPUWB_CHIP_H_ 3 4 #include <cstddef> 5 #include <cstdint> 6 7 #include <memory> 8 9 #include "phUwbTypes.h" 10 11 // Chip type 12 typedef enum { 13 DEVICE_TYPE_UNKNOWN, 14 DEVICE_TYPE_SR1xxT, 15 DEVICE_TYPE_SR1xxS, 16 DEVICE_TYPE_SR200, 17 } device_type_t; 18 19 // SW defined data structures 20 typedef enum { 21 // 6 bytes 22 // [1:0] cap1 [3:2] cap2 [5:4] gm current control 23 EXTCAL_PARAM_CLK_ACCURACY = 0x1, // xtal 24 25 // 3n + 1 bytes 26 // [0] n, number of entries + n * { [0] antenna-id [1:0] RX delay(Q14.2) } 27 EXTCAL_PARAM_RX_ANT_DELAY = 0x2, // ant_delay 28 29 // 5N + 1 bytes 30 // [0]: n, number of entries + n * { [0] antenna-id [2:1] delta-peak [4:3] id-rms } 31 EXTCAL_PARAM_TX_POWER = 0x3, // tx_power 32 33 // channel independent 34 // 1 byte 35 // b0: enable/disable DDFS tone generation (default off) 36 // b1: enable/disable DC suppression (default off) 37 EXTCAL_PARAM_TX_BASE_BAND_CONTROL = 0x101, // ddfs_enable, dc_suppress 38 39 // channel independent (raw data contains channel info) 40 // bytes array 41 EXTCAL_PARAM_DDFS_TONE_CONFIG = 0x102, // ddfs_tone_config 42 43 // channel independent 44 // byte array 45 EXTCAL_PARAM_TX_PULSE_SHAPE = 0x103, // tx_pulse_shape 46 } extcal_param_id_t; 47 48 class NxpUwbChip { 49 public: 50 virtual ~NxpUwbChip() = default; 51 52 // Bring-up the chip into UCI operational modes 53 // FW donwloading and enter UCI mode 54 virtual tHAL_UWB_STATUS chip_init() = 0; 55 56 // Per-chip device configurations 57 // Binding check, life cycle check. 58 virtual tHAL_UWB_STATUS core_init() = 0; 59 60 // Determine device_type_t from DEVICE_INFO_RSP::UWB_CHIP_ID 61 virtual device_type_t get_device_type(const uint8_t* param, size_t param_len) = 0; 62 63 // Read Calibration parameters storead at OTP 64 virtual tHAL_UWB_STATUS read_otp(extcal_param_id_t id, 65 uint8_t *data, 66 size_t data_len, 67 size_t *retlen); 68 69 // Apply device calibration 70 virtual tHAL_UWB_STATUS apply_calibration(extcal_param_id_t id, 71 const uint8_t ch, 72 const uint8_t *data, 73 size_t data_len) = 0; 74 75 // Group Delay Compensation, if any 76 // SR1XX needs this, because it has 77 // different handling during calibration with D48/D49 vs D50 78 virtual int16_t extra_group_delay() = 0; 79 }; 80 81 std::unique_ptr<NxpUwbChip> GetUwbChip(); 82 83 #endif