fork download
  1. #include <stdio.h>
  2. #include <stdint.h>
  3.  
  4. typedef struct
  5. {
  6. //0
  7. uint32_t pulse_detect_enable : 1;
  8. uint32_t reg0_31_1 : 31;
  9. //1
  10. uint32_t cfar_lead : 3;
  11. uint32_t detection_algo : 1;
  12. uint32_t stop_on_buffer_full : 1;
  13. uint32_t reg1_5 : 1; //reserved
  14. uint32_t min_pulse_length : 3;
  15. uint32_t required_valid_fields : 4;
  16. uint32_t reg1_15_13 : 3; //reserved
  17. uint32_t dsp_width_threshold : 16;
  18. //2
  19. uint32_t num_rays_per_line : 12;
  20. uint32_t derated_samples_per_ray : 13;
  21. uint32_t reg2_31_25 : 7;
  22. //3
  23. uint32_t reg3_12_0 : 13;
  24. uint32_t ray_start_idx : 13;
  25. uint32_t reg3_31_26 : 6;
  26. //4
  27. uint32_t reset_start_idx : 13;
  28. uint32_t reset_end_idx : 13;
  29. uint32_t reg4_31_26 : 6;
  30. //5
  31. uint32_t ot0_start_idx : 13;
  32. uint32_t ot0_end_idx : 13;
  33. uint32_t reg5_31_26 : 6;
  34. //6
  35. uint32_t dsp_sat_peak_threshold : 12;
  36. uint32_t reg6_15_12 : 4;
  37. uint32_t leading_search_window : 8;
  38. uint32_t trailing_search_window : 8;
  39. //7
  40. uint32_t dsp_time_offset : 16;
  41. uint32_t fraction_of_local_max_to_declare_peak : 8;
  42. uint32_t fraction_of_local_min_to_declare_saddle : 8;
  43. //8
  44. uint32_t negative_energy_sum_threshold; //32
  45. //9
  46. uint32_t fixed_start_threshold : 12;
  47. //uint32_t fixed_cfar_end_threshold : 12;
  48. uint32_t reg9_23_12 : 12;
  49. uint32_t reg9_31_24 : 8;
  50. //10
  51. uint32_t width_threshold_enable : 1;
  52. uint32_t retro_detect_enable : 1;
  53. uint32_t range_threshold_enable : 1;
  54. uint32_t noise_threshold_enable : 1;
  55. uint32_t noise_measurement_enable : 1;
  56. uint32_t median_select : 1;
  57. uint32_t reg10_7_6 : 2; //reserved
  58. uint32_t pulse_width_start_threshold : 12;
  59. uint32_t retro_detect_threshold : 12;
  60. //11,12
  61. uint32_t start_threshold_width_scale_constant_table[2]; //6 x 8bit (idx0: 0-3, idx1: 4,5)
  62. //13,14
  63. //uint32_t cfar_end_threshold_width_scale_constant_table[2]; //6 x 8bit (idx0: 0-3, idx1: 4,5)
  64. uint32_t reg13;
  65. uint32_t reg14;
  66. //15-18
  67. uint32_t range_scale_boundary_index_table[4]; //8 x 13bit
  68. //19,20
  69. uint32_t start_threshold_range_scale_constant_offset_table[2]; //8 x 8bit
  70. //21-24
  71. uint32_t start_threshold_range_scale_constant_slope_table[4]; //8 x 16bit
  72. //25,26
  73. uint32_t enable_raw_pulse_format : 1;
  74. uint32_t standard_pulse_format_num_groups : 3;
  75. uint32_t reg25_4 : 1;
  76. uint32_t standard_pulse_format_group0 : 5;
  77. uint32_t standard_pulse_format_group1 : 5;
  78. uint32_t standard_pulse_format_group2 : 5;
  79. uint32_t standard_pulse_format_group3 : 5;
  80. uint32_t standard_pulse_format_group4 : 5;
  81. uint32_t reg25_31_30 : 2;
  82. uint32_t standard_pulse_format_group5 : 5;
  83. uint32_t standard_pulse_format_group6 : 5;
  84. uint32_t standard_pulse_format_group7 : 5;
  85. uint32_t reg26_31_15 : 17;
  86. //27,28
  87. uint32_t enable_saturated_pulse_format : 1;
  88. uint32_t saturated_pulse_format_num_groups : 3;
  89. uint32_t reg27_4 : 1;
  90. uint32_t saturated_pulse_format_group0 : 5;
  91. uint32_t saturated_pulse_format_group1 : 5;
  92. uint32_t saturated_pulse_format_group2 : 5;
  93. uint32_t saturated_pulse_format_group3 : 5;
  94. uint32_t saturated_pulse_format_group4 : 5;
  95. uint32_t reg27_31_30 : 2;
  96. uint32_t saturated_pulse_format_group5 : 5;
  97. uint32_t saturated_pulse_format_group6 : 5;
  98. uint32_t saturated_pulse_format_group7 : 5;
  99. uint32_t reg28_31_15 : 17;
  100. //29,30
  101. uint32_t enable_fused_pulse_format : 1;
  102. uint32_t fused_pulse_format_num_groups : 3;
  103. uint32_t reg29_4 : 1;
  104. uint32_t fused_pulse_format_group0 : 5;
  105. uint32_t fused_pulse_format_group1 : 5;
  106. uint32_t fused_pulse_format_group2 : 5;
  107. uint32_t fused_pulse_format_group3 : 5;
  108. uint32_t fused_pulse_format_group4 : 5;
  109. uint32_t reg29_31_30 : 2;
  110. uint32_t fused_pulse_format_group5 : 5;
  111. uint32_t fused_pulse_format_group6 : 5;
  112. uint32_t fused_pulse_format_group7 : 5;
  113. uint32_t reg30_31_15 : 17;
  114. //31
  115. uint32_t reg31;
  116. //32
  117. uint32_t signal_preprocessor_enable : 1;
  118. uint32_t filter_enable : 1;
  119. uint32_t rounding_enable : 1;
  120. uint32_t reg32_31_3 : 29;
  121. //33
  122. uint32_t adc_offset_constant : 16;
  123. uint32_t adc_scale_constant : 16;
  124. //34
  125. uint32_t filter_select : 1;
  126. uint32_t reg34_3_1 : 3; //reserved
  127. uint32_t cic_width : 4;
  128. uint32_t cic_order : 2;
  129. uint32_t reg34_15_10 : 6; //reserved
  130. uint32_t one_over_cic_gain : 16;
  131. //35-42
  132. uint32_t firCoefficients[8];
  133. //43
  134. uint32_t reg43;
  135. } dsp_config_channel_t;
  136.  
  137. typedef struct
  138. {
  139. uint32_t max_returns : 4;
  140. uint32_t down_selection_method : 4;
  141. uint32_t reg0_31_8 : 24;
  142. uint32_t farDetectionSamePulseWindowWidth;
  143. uint32_t superLowGainDetectionSamePulseWindowWidth;
  144. uint32_t align64pad_0;
  145. } dsp_config_channel_fusion_t;
  146.  
  147. typedef struct
  148. {
  149. uint32_t reserved[8];
  150. } stream_data_compiler_t;
  151.  
  152. typedef struct
  153. {
  154. uint32_t adpBiasValueCoarse;
  155. uint32_t adpBiasValueFine;
  156. } dsp_config_roic_t;
  157.  
  158. typedef struct
  159. {
  160. uint32_t enable;
  161. uint32_t detectionAlgo;
  162. float rangeOffset;
  163. float retroRangeOffset;
  164. float azimuthOffset;
  165. float elevationOffset;
  166. dsp_config_channel_t nearHighGainChannel;
  167. dsp_config_channel_t superLowGainChannel;
  168. dsp_config_channel_t farHighGainChannel;
  169. dsp_config_channel_fusion_t channelFusion;
  170. dsp_config_roic_t roic;
  171. stream_data_compiler_t streamDataCompiler;
  172. } dsp_config_site_t;
  173.  
  174. typedef struct
  175. {
  176. uint8_t prf_offset_lsrdrv1[8][8];
  177. uint8_t prf_offset_lsrdrv2[8][8];
  178. uint8_t prf_offset_roic_rst[8][8];
  179. uint32_t laser_period : 16;
  180. uint32_t pad : 16;
  181. uint32_t lsrdrv1_pulse_width : 8;
  182. uint32_t lsrdrv2_pulse_width : 8;
  183. uint32_t lsrdrv1_high_res_pulse_width : 8;
  184. uint32_t lsrdrv2_high_res_pulse_width : 8;
  185. uint32_t reserved[8];
  186. } dsp_config_laser_timing_t;
  187.  
  188. typedef struct
  189. {
  190. uint32_t simulationModeEnable : 1;
  191. uint32_t rcv_setting : 3;
  192. uint32_t rcv_mode : 2;
  193. uint32_t rcv_type : 3;
  194. uint32_t pad : 23;
  195. float tecSetPoint;
  196. uint32_t pointCloudFormat;
  197. uint32_t positionCalculationMethod;
  198. dsp_config_laser_timing_t laserTiming;
  199. } dsp_config_general_t;
  200.  
  201. typedef struct
  202. {
  203. uint32_t structVersion;
  204. uint32_t align64pad;
  205. dsp_config_general_t generalSettings;
  206. dsp_config_site_t site[4];
  207. } dsp_config_parameter_block_version_1_t;
  208.  
  209. #define SIMULATION_MODE 1
  210. #define DSP_CONFIG_STRUCT_VERSION 8
  211. #define POSITION_CALCULATION_METHOD 3
  212. #define FIR_01_00 0x00080007 // FIR Tap 1 | 0 ( 0.0002, 0.0002)
  213. #define FIR_03_02 0xffc3fff2 // FIR Tap 3 | 2 (-0.0019, -0.0005)
  214. #define FIR_05_04 0x0015ffb4 // FIR Tap 5 | 4 ( 0.0006, -0.0023)
  215. #define FIR_07_06 0x018000e8 // FIR Tap 7 | 6 ( 0.0117, 0.0071)
  216. #define FIR_09_08 0xfe3600c0 // FIR Tap 9 | 8 (-0.0140, 0.0059)
  217. #define FIR_11_10 0xfb1afb47 // FIR Tap 11 | 10 (-0.0383, -0.0369)
  218. #define FIR_13_12 0x0c1800a9 // FIR Tap 13 | 12 ( 0.0945, 0.0052)
  219. #define FIR_15_14 0x227e1974 // FIR Tap 15 | 14 ( 0.2695, 0.1989)
  220.  
  221. #define FIR_INIT { FIR_01_00, FIR_03_02, FIR_05_04, FIR_07_06, FIR_09_08, FIR_11_10, FIR_13_12, FIR_15_14 }
  222.  
  223. #define START_THRESHOLD_WIDTH_SCALE_CONSTANT_TABLE { 0, 126 << 8 }
  224. #define RANGE_SCALE_BOUNDARY_INDEX_TABLE { 0, 0, 0, 0 }
  225. #define START_THRESHOLD_RANGE_SCALE_CONSTANT_OFFSET_TABLE { 0, 0 }
  226. #define START_THRESHOLD_RANGE_SCALE_CONSTANT_SLOPE_TABLE { 0, 0, 0, 0 }
  227.  
  228. #if defined (ADV_A2_J) || defined (ADV_A3_STAGING) || defined (ADV_A3)
  229. #define RAY_START_INDEX 304
  230. #else
  231. #define RAY_START_INDEX 488
  232. #endif
  233. #define DSP_CONFIG_SITE_0_CHANNEL_0_INIT \
  234. { \
  235.   .pulse_detect_enable = 1, \
  236.   .cfar_lead = 3, \
  237.   .detection_algo = 1, \
  238.   .stop_on_buffer_full = 0, \
  239.   .min_pulse_length = 3, \
  240.   .required_valid_fields = 15, \
  241.   .dsp_width_threshold = 50, \
  242.   .num_rays_per_line = 960, \
  243.   .derated_samples_per_ray = 8191, \
  244.   .ray_start_idx = RAY_START_INDEX, \
  245.   .reset_start_idx = 0, \
  246.   .reset_end_idx = 16, \
  247.   .ot0_start_idx = 0, \
  248.   .ot0_end_idx = 16, \
  249.   .dsp_sat_peak_threshold = 1200, \
  250.   .leading_search_window = 5, \
  251.   .trailing_search_window = 5, \
  252.   .dsp_time_offset = 0, \
  253.   .negative_energy_sum_threshold = 0, \
  254.   .fixed_start_threshold = 175, \
  255.   .width_threshold_enable = 0, \
  256.   .retro_detect_enable = 1, \
  257.   .range_threshold_enable = 0, \
  258.   .noise_threshold_enable = 0, \
  259.   .noise_measurement_enable = 1, \
  260.   .median_select = 0, \
  261.   .pulse_width_start_threshold = 0, \
  262.   .retro_detect_threshold = 250, \
  263.   .start_threshold_width_scale_constant_table = START_THRESHOLD_WIDTH_SCALE_CONSTANT_TABLE, \
  264.   .range_scale_boundary_index_table = RANGE_SCALE_BOUNDARY_INDEX_TABLE, \
  265.   .start_threshold_range_scale_constant_offset_table = START_THRESHOLD_RANGE_SCALE_CONSTANT_OFFSET_TABLE, \
  266.   .start_threshold_range_scale_constant_slope_table = START_THRESHOLD_RANGE_SCALE_CONSTANT_SLOPE_TABLE, \
  267.   .signal_preprocessor_enable = 1, \
  268.   .filter_enable = 1, \
  269.   .rounding_enable = 1, \
  270.   .fraction_of_local_min_to_declare_saddle = 51, \
  271.   .fraction_of_local_max_to_declare_peak = 205, \
  272.   .adc_offset_constant = 1200, \
  273.   .adc_scale_constant = 5600, \
  274.   .filter_select = 0, \
  275.   .cic_width = 5, \
  276.   .cic_order = 3, \
  277.   .one_over_cic_gain = 13107, \
  278.   .firCoefficients = FIR_INIT, \
  279. }
  280.  
  281. #define DSP_CONFIG_SITE_0_CHANNEL_1_INIT \
  282. { \
  283.   .pulse_detect_enable = 1, \
  284.   .cfar_lead = 3, \
  285.   .detection_algo = 1, \
  286.   .stop_on_buffer_full = 0, \
  287.   .min_pulse_length = 3, \
  288.   .required_valid_fields = 15, \
  289.   .dsp_width_threshold = 50, \
  290.   .num_rays_per_line = 960, \
  291.   .derated_samples_per_ray = 8191, \
  292.   .ray_start_idx = RAY_START_INDEX, \
  293.   .reset_start_idx = 0, \
  294.   .reset_end_idx = 16, \
  295.   .ot0_start_idx = 0, \
  296.   .ot0_end_idx = 16, \
  297.   .dsp_sat_peak_threshold = 1200, \
  298.   .leading_search_window = 5, \
  299.   .trailing_search_window = 5, \
  300.   .dsp_time_offset = 0, \
  301.   .negative_energy_sum_threshold = 0, \
  302.   .fixed_start_threshold = 175, \
  303.   .width_threshold_enable = 0, \
  304.   .retro_detect_enable = 1, \
  305.   .range_threshold_enable = 0, \
  306.   .noise_threshold_enable = 0, \
  307.   .noise_measurement_enable = 1, \
  308.   .median_select = 0, \
  309.   .pulse_width_start_threshold = 0, \
  310.   .retro_detect_threshold = 250, \
  311.   .start_threshold_width_scale_constant_table = START_THRESHOLD_WIDTH_SCALE_CONSTANT_TABLE, \
  312.   .range_scale_boundary_index_table = RANGE_SCALE_BOUNDARY_INDEX_TABLE, \
  313.   .start_threshold_range_scale_constant_offset_table = START_THRESHOLD_RANGE_SCALE_CONSTANT_OFFSET_TABLE, \
  314.   .start_threshold_range_scale_constant_slope_table = START_THRESHOLD_RANGE_SCALE_CONSTANT_SLOPE_TABLE, \
  315.   .signal_preprocessor_enable = 1, \
  316.   .filter_enable = 1, \
  317.   .rounding_enable = 1, \
  318.   .fraction_of_local_min_to_declare_saddle = 51, \
  319.   .fraction_of_local_max_to_declare_peak = 205, \
  320.   .adc_offset_constant = 1200, \
  321.   .adc_scale_constant = 5600, \
  322.   .filter_select = 0, \
  323.   .cic_width = 5, \
  324.   .cic_order = 3, \
  325.   .one_over_cic_gain = 13107, \
  326.   .firCoefficients = FIR_INIT, \
  327. }
  328.  
  329. #define DSP_CONFIG_SITE_0_CHANNEL_2_INIT \
  330. { \
  331.   .pulse_detect_enable = 1, \
  332.   .cfar_lead = 3, \
  333.   .detection_algo = 1, \
  334.   .stop_on_buffer_full = 0, \
  335.   .min_pulse_length = 3, \
  336.   .required_valid_fields = 15, \
  337.   .dsp_width_threshold = 50, \
  338.   .num_rays_per_line = 960, \
  339.   .derated_samples_per_ray = 8191, \
  340.   .ray_start_idx = RAY_START_INDEX, \
  341.   .reset_start_idx = 0, \
  342.   .reset_end_idx = 16, \
  343.   .ot0_start_idx = 0, \
  344.   .ot0_end_idx = 16, \
  345.   .dsp_sat_peak_threshold = 1200, \
  346.   .leading_search_window = 5, \
  347.   .trailing_search_window = 5, \
  348.   .dsp_time_offset = 0, \
  349.   .negative_energy_sum_threshold = 0, \
  350.   .fixed_start_threshold = 175, \
  351.   .width_threshold_enable = 0, \
  352.   .retro_detect_enable = 1, \
  353.   .range_threshold_enable = 0, \
  354.   .noise_threshold_enable = 0, \
  355.   .noise_measurement_enable = 1, \
  356.   .median_select = 0, \
  357.   .pulse_width_start_threshold = 0, \
  358.   .retro_detect_threshold = 250, \
  359.   .start_threshold_width_scale_constant_table = START_THRESHOLD_WIDTH_SCALE_CONSTANT_TABLE, \
  360.   .range_scale_boundary_index_table = RANGE_SCALE_BOUNDARY_INDEX_TABLE, \
  361.   .start_threshold_range_scale_constant_offset_table = START_THRESHOLD_RANGE_SCALE_CONSTANT_OFFSET_TABLE, \
  362.   .start_threshold_range_scale_constant_slope_table = START_THRESHOLD_RANGE_SCALE_CONSTANT_SLOPE_TABLE, \
  363.   .signal_preprocessor_enable = 1, \
  364.   .filter_enable = 1, \
  365.   .rounding_enable = 1, \
  366.   .fraction_of_local_min_to_declare_saddle = 51, \
  367.   .fraction_of_local_max_to_declare_peak = 205, \
  368.   .adc_offset_constant = 1200, \
  369.   .adc_scale_constant = 5600, \
  370.   .filter_select = 0, \
  371.   .cic_width = 5, \
  372.   .cic_order = 3, \
  373.   .one_over_cic_gain = 13107, \
  374.   .firCoefficients = FIR_INIT, \
  375. }
  376.  
  377. #define DSP_CONFIG_SITE_1_CHANNEL_0_INIT \
  378. { \
  379.   .pulse_detect_enable = 1, \
  380.   .cfar_lead = 3, \
  381.   .detection_algo = 1, \
  382.   .stop_on_buffer_full = 0, \
  383.   .min_pulse_length = 3, \
  384.   .required_valid_fields = 15, \
  385.   .dsp_width_threshold = 50, \
  386.   .num_rays_per_line = 960, \
  387.   .derated_samples_per_ray = 8191, \
  388.   .ray_start_idx = RAY_START_INDEX, \
  389.   .reset_start_idx = 0, \
  390.   .reset_end_idx = 16, \
  391.   .ot0_start_idx = 0, \
  392.   .ot0_end_idx = 16, \
  393.   .dsp_sat_peak_threshold = 1200, \
  394.   .leading_search_window = 5, \
  395.   .trailing_search_window = 5, \
  396.   .dsp_time_offset = 0, \
  397.   .negative_energy_sum_threshold = 0, \
  398.   .fixed_start_threshold = 175, \
  399.   .width_threshold_enable = 0, \
  400.   .retro_detect_enable = 1, \
  401.   .range_threshold_enable = 0, \
  402.   .noise_threshold_enable = 0, \
  403.   .noise_measurement_enable = 1, \
  404.   .median_select = 0, \
  405.   .pulse_width_start_threshold = 0, \
  406.   .retro_detect_threshold = 250, \
  407.   .start_threshold_width_scale_constant_table = START_THRESHOLD_WIDTH_SCALE_CONSTANT_TABLE, \
  408.   .range_scale_boundary_index_table = RANGE_SCALE_BOUNDARY_INDEX_TABLE, \
  409.   .start_threshold_range_scale_constant_offset_table = START_THRESHOLD_RANGE_SCALE_CONSTANT_OFFSET_TABLE, \
  410.   .start_threshold_range_scale_constant_slope_table = START_THRESHOLD_RANGE_SCALE_CONSTANT_SLOPE_TABLE, \
  411.   .signal_preprocessor_enable = 1, \
  412.   .filter_enable = 1, \
  413.   .rounding_enable = 1, \
  414.   .fraction_of_local_min_to_declare_saddle = 51, \
  415.   .fraction_of_local_max_to_declare_peak = 205, \
  416.   .adc_offset_constant = 1200, \
  417.   .adc_scale_constant = 5600, \
  418.   .filter_select = 0, \
  419.   .cic_width = 5, \
  420.   .cic_order = 3, \
  421.   .one_over_cic_gain = 13107, \
  422.   .firCoefficients = FIR_INIT, \
  423. }
  424.  
  425. #define DSP_CONFIG_SITE_1_CHANNEL_1_INIT \
  426. { \
  427.   .pulse_detect_enable = 1, \
  428.   .cfar_lead = 3, \
  429.   .detection_algo = 1, \
  430.   .stop_on_buffer_full = 0, \
  431.   .min_pulse_length = 3, \
  432.   .required_valid_fields = 15, \
  433.   .dsp_width_threshold = 50, \
  434.   .num_rays_per_line = 960, \
  435.   .derated_samples_per_ray = 8191, \
  436.   .ray_start_idx = RAY_START_INDEX, \
  437.   .reset_start_idx = 0, \
  438.   .reset_end_idx = 16, \
  439.   .ot0_start_idx = 0, \
  440.   .ot0_end_idx = 16, \
  441.   .dsp_sat_peak_threshold = 1200, \
  442.   .leading_search_window = 5, \
  443.   .trailing_search_window = 5, \
  444.   .dsp_time_offset = 0, \
  445.   .negative_energy_sum_threshold = 0, \
  446.   .fixed_start_threshold = 175, \
  447.   .width_threshold_enable = 0, \
  448.   .retro_detect_enable = 1, \
  449.   .range_threshold_enable = 0, \
  450.   .noise_threshold_enable = 0, \
  451.   .noise_measurement_enable = 1, \
  452.   .median_select = 0, \
  453.   .pulse_width_start_threshold = 0, \
  454.   .retro_detect_threshold = 250, \
  455.   .start_threshold_width_scale_constant_table = START_THRESHOLD_WIDTH_SCALE_CONSTANT_TABLE, \
  456.   .range_scale_boundary_index_table = RANGE_SCALE_BOUNDARY_INDEX_TABLE, \
  457.   .start_threshold_range_scale_constant_offset_table = START_THRESHOLD_RANGE_SCALE_CONSTANT_OFFSET_TABLE, \
  458.   .start_threshold_range_scale_constant_slope_table = START_THRESHOLD_RANGE_SCALE_CONSTANT_SLOPE_TABLE, \
  459.   .signal_preprocessor_enable = 1, \
  460.   .filter_enable = 1, \
  461.   .rounding_enable = 1, \
  462.   .fraction_of_local_min_to_declare_saddle = 51, \
  463.   .fraction_of_local_max_to_declare_peak = 205, \
  464.   .adc_offset_constant = 1200, \
  465.   .adc_scale_constant = 5600, \
  466.   .filter_select = 0, \
  467.   .cic_width = 5, \
  468.   .cic_order = 3, \
  469.   .one_over_cic_gain = 13107, \
  470.   .firCoefficients = FIR_INIT, \
  471. }
  472.  
  473. #define DSP_CONFIG_SITE_1_CHANNEL_2_INIT \
  474. { \
  475.   .pulse_detect_enable = 1, \
  476.   .cfar_lead = 3, \
  477.   .detection_algo = 1, \
  478.   .stop_on_buffer_full = 0, \
  479.   .min_pulse_length = 3, \
  480.   .required_valid_fields = 15, \
  481.   .dsp_width_threshold = 50, \
  482.   .num_rays_per_line = 960, \
  483.   .derated_samples_per_ray = 8191, \
  484.   .ray_start_idx = RAY_START_INDEX, \
  485.   .reset_start_idx = 0, \
  486.   .reset_end_idx = 16, \
  487.   .ot0_start_idx = 0, \
  488.   .ot0_end_idx = 16, \
  489.   .dsp_sat_peak_threshold = 1200, \
  490.   .leading_search_window = 5, \
  491.   .trailing_search_window = 5, \
  492.   .dsp_time_offset = 0, \
  493.   .negative_energy_sum_threshold = 0, \
  494.   .fixed_start_threshold = 175, \
  495.   .width_threshold_enable = 0, \
  496.   .retro_detect_enable = 1, \
  497.   .range_threshold_enable = 0, \
  498.   .noise_threshold_enable = 0, \
  499.   .noise_measurement_enable = 1, \
  500.   .median_select = 0, \
  501.   .pulse_width_start_threshold = 0, \
  502.   .retro_detect_threshold = 250, \
  503.   .start_threshold_width_scale_constant_table = START_THRESHOLD_WIDTH_SCALE_CONSTANT_TABLE, \
  504.   .range_scale_boundary_index_table = RANGE_SCALE_BOUNDARY_INDEX_TABLE, \
  505.   .start_threshold_range_scale_constant_offset_table = START_THRESHOLD_RANGE_SCALE_CONSTANT_OFFSET_TABLE, \
  506.   .start_threshold_range_scale_constant_slope_table = START_THRESHOLD_RANGE_SCALE_CONSTANT_SLOPE_TABLE, \
  507.   .signal_preprocessor_enable = 1, \
  508.   .filter_enable = 1, \
  509.   .rounding_enable = 1, \
  510.   .fraction_of_local_min_to_declare_saddle = 51, \
  511.   .fraction_of_local_max_to_declare_peak = 205, \
  512.   .adc_offset_constant = 1200, \
  513.   .adc_scale_constant = 5600, \
  514.   .filter_select = 0, \
  515.   .cic_width = 5, \
  516.   .cic_order = 3, \
  517.   .one_over_cic_gain = 13107, \
  518.   .firCoefficients = FIR_INIT, \
  519. }
  520.  
  521. #define DSP_CONFIG_SITE_2_CHANNEL_0_INIT DSP_CONFIG_SITE_1_CHANNEL_0_INIT
  522. #define DSP_CONFIG_SITE_2_CHANNEL_1_INIT DSP_CONFIG_SITE_1_CHANNEL_1_INIT
  523. #define DSP_CONFIG_SITE_2_CHANNEL_2_INIT DSP_CONFIG_SITE_1_CHANNEL_2_INIT
  524. #define DSP_CONFIG_SITE_3_CHANNEL_0_INIT DSP_CONFIG_SITE_1_CHANNEL_0_INIT
  525. #define DSP_CONFIG_SITE_3_CHANNEL_1_INIT DSP_CONFIG_SITE_1_CHANNEL_1_INIT
  526. #define DSP_CONFIG_SITE_3_CHANNEL_2_INIT DSP_CONFIG_SITE_1_CHANNEL_2_INIT
  527.  
  528. #define CHANNEL_FUSION_INIT \
  529. { \
  530.   .max_returns = 8, \
  531.   .down_selection_method = 0, \
  532.   .reg0_31_8 = 0, \
  533.   .farDetectionSamePulseWindowWidth = 20, \
  534.   .superLowGainDetectionSamePulseWindowWidth = 20, \
  535.   .align64pad_0 = 0, \
  536.  }
  537.  
  538.  
  539. #define DSP_CONFIG_SITE_0_INIT \
  540. { \
  541.   .enable = 1, \
  542.   .detectionAlgo = 1, \
  543.   .rangeOffset = 0.0f, \
  544.   .retroRangeOffset = 0.0f, \
  545.   .azimuthOffset = 0.0145f - 1.0472f, \
  546.   .elevationOffset = 0.0049f, \
  547.   .nearHighGainChannel = DSP_CONFIG_SITE_0_CHANNEL_0_INIT, \
  548.   .superLowGainChannel = DSP_CONFIG_SITE_0_CHANNEL_1_INIT, \
  549.   .farHighGainChannel = DSP_CONFIG_SITE_0_CHANNEL_2_INIT, \
  550.   .channelFusion = CHANNEL_FUSION_INIT, \
  551.   .roic = { 22,0 }, \
  552. }
  553.  
  554. #if defined (ADV_A2_J)
  555. #define PULSE_DETECT_ENABLE 1
  556. #elif defined (ADV_A3_STAGING) || defined (ADV_A3)
  557. #define PULSE_DETECT_ENABLE 1
  558. #else
  559. #define PULSE_DETECT_ENABLE 1
  560. #endif
  561.  
  562. #define DSP_CONFIG_SITE_1_INIT \
  563. { \
  564.   .enable = PULSE_DETECT_ENABLE, \
  565.   .detectionAlgo = 1, \
  566.   .rangeOffset = 0.0f, \
  567.   .retroRangeOffset = 0.0f, \
  568.   .azimuthOffset = -0.0145f - 1.0472f, \
  569.   .elevationOffset = -0.0049f, \
  570.   .nearHighGainChannel = DSP_CONFIG_SITE_1_CHANNEL_0_INIT, \
  571.   .superLowGainChannel = DSP_CONFIG_SITE_1_CHANNEL_1_INIT, \
  572.   .farHighGainChannel = DSP_CONFIG_SITE_1_CHANNEL_2_INIT, \
  573.   .channelFusion = CHANNEL_FUSION_INIT, \
  574.   .roic = { 22,0 }, \
  575. }
  576.  
  577. //TODO: Update these values (mainly offsets)
  578. #define DSP_CONFIG_SITE_2_INIT \
  579. { \
  580.   .enable = PULSE_DETECT_ENABLE, \
  581.   .detectionAlgo = 1, \
  582.   .rangeOffset = 0.0f, \
  583.   .retroRangeOffset = 0.0f, \
  584.   .azimuthOffset = 0.f - 1.0472f, \
  585.   .elevationOffset = 0.f, \
  586.   .nearHighGainChannel = DSP_CONFIG_SITE_2_CHANNEL_0_INIT, \
  587.   .superLowGainChannel = DSP_CONFIG_SITE_2_CHANNEL_1_INIT, \
  588.   .farHighGainChannel = DSP_CONFIG_SITE_2_CHANNEL_2_INIT, \
  589.   .channelFusion = CHANNEL_FUSION_INIT, \
  590.   .roic = { 22,0 }, \
  591. }
  592.  
  593.  
  594. #define DSP_CONFIG_SITE_3_INIT \
  595. { \
  596.   .enable = PULSE_DETECT_ENABLE, \
  597.   .detectionAlgo = 1, \
  598.   .rangeOffset = 0.0f, \
  599.   .retroRangeOffset = 0.0f, \
  600.   .azimuthOffset = -0.0290f - 1.0472f, \
  601.   .elevationOffset = -0.0098f, \
  602.   .nearHighGainChannel = DSP_CONFIG_SITE_3_CHANNEL_0_INIT, \
  603.   .superLowGainChannel = DSP_CONFIG_SITE_3_CHANNEL_1_INIT, \
  604.   .farHighGainChannel = DSP_CONFIG_SITE_3_CHANNEL_2_INIT, \
  605.   .channelFusion = CHANNEL_FUSION_INIT, \
  606.   .roic = { 22,0 }, \
  607. }
  608.  
  609. #define PRF_OFFSET_LSRDRV1_INIT \
  610. { \
  611.   0, 0, 0, 0, 0, 0, 0, 0, \
  612.   0, 0, 0, 0, 0, 0, 0, 0, \
  613.   0, 0, 0, 0, 0, 0, 0, 0, \
  614.   0, 0, 0, 0, 0, 0, 0, 0, \
  615.   0, 0, 0, 0, 0, 0, 0, 0, \
  616.   0, 0, 0, 0, 0, 0, 0, 0, \
  617.   0, 0, 0, 0, 0, 0, 0, 0, \
  618.   0, 0, 0, 0, 0, 0, 0, 0, \
  619. }
  620. #define PRF_OFFSET_LSRDRV2_INIT \
  621. { \
  622.   0, 0, 0, 0, 0, 0, 0, 0, \
  623.   0, 0, 0, 0, 0, 0, 0, 0, \
  624.   0, 0, 0, 0, 0, 0, 0, 0, \
  625.   0, 0, 0, 0, 0, 0, 0, 0, \
  626.   0, 0, 0, 0, 0, 0, 0, 0, \
  627.   0, 0, 0, 0, 0, 0, 0, 0, \
  628.   0, 0, 0, 0, 0, 0, 0, 0, \
  629.   0, 0, 0, 0, 0, 0, 0, 0, \
  630. }
  631. #define PRF_OFFSET_ROIC_RST_INIT \
  632. { \
  633.   0, 0, 0, 0, 0, 0, 0, 0, \
  634.   0, 0, 0, 0, 0, 0, 0, 0, \
  635.   0, 0, 0, 0, 0, 0, 0, 0, \
  636.   0, 0, 0, 0, 0, 0, 0, 0, \
  637.   0, 0, 0, 0, 0, 0, 0, 0, \
  638.   0, 0, 0, 0, 0, 0, 0, 0, \
  639.   0, 0, 0, 0, 0, 0, 0, 0, \
  640.   0, 0, 0, 0, 0, 0, 0, 0, \
  641. }
  642.  
  643. #define DSP_CONFIG_LASER_TIMING_INIT \
  644. { \
  645.   .prf_offset_lsrdrv1 = PRF_OFFSET_LSRDRV1_INIT, \
  646.   .prf_offset_lsrdrv2 = PRF_OFFSET_LSRDRV2_INIT, \
  647.   .prf_offset_roic_rst = PRF_OFFSET_ROIC_RST_INIT, \
  648.   .laser_period = 0, \
  649.   .lsrdrv1_pulse_width = 0, \
  650.   .lsrdrv2_pulse_width = 0, \
  651.   .lsrdrv1_high_res_pulse_width = 0, \
  652.   .lsrdrv2_high_res_pulse_width = 0, \
  653. }
  654. /* For 4 beams ROICs, the APDs are connected to the middle sites,
  655. so sites 2,3,4 & 5 are active. Site 0,1,6,7 are inactive.
  656.  
  657. The mode used is JTX2 to begin with, the mode is changed in TC4, and is only for monitoring purposes
  658. J1=0 , JTX1=1, JTX2=2, JTX3=3
  659.  
  660. rcv_type tells which ROIC type is used, 1 is 711, 2 is 711a (needs to be sent to Rfsoc for monitoring purposes)
  661. */
  662. #define DSP_CONFIG_GENERAL_INIT \
  663. { \
  664.   .simulationModeEnable = SIMULATION_MODE, \
  665.   .rcv_setting = 2, \
  666.   .rcv_mode = 2, \
  667.   .rcv_type = 1, \
  668.   .tecSetPoint = 35.0, \
  669.   .pointCloudFormat = 1, \
  670.   .positionCalculationMethod = POSITION_CALCULATION_METHOD, \
  671.   .laserTiming = DSP_CONFIG_LASER_TIMING_INIT, \
  672. }
  673.  
  674. dsp_config_parameter_block_version_1_t const default_dsp_config =
  675. {
  676. .structVersion = DSP_CONFIG_STRUCT_VERSION,
  677. .generalSettings = DSP_CONFIG_GENERAL_INIT,
  678. .site = { DSP_CONFIG_SITE_0_INIT, DSP_CONFIG_SITE_1_INIT, DSP_CONFIG_SITE_2_INIT, DSP_CONFIG_SITE_3_INIT },
  679. };
  680.  
  681. int main(void) {
  682. // your code goes here
  683. return 0;
  684. }
  685.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
Standard output is empty