Coverage Report

Created: 2025-06-15 00:57

/src/cmp_tool/lib/rdcu_compress/rdcu_cmd.c
Line
Count
Source (jump to first uncovered line)
1
/**
2
 * @file   rdcu_cmd.c
3
 * @author Armin Luntzer (armin.luntzer@univie.ac.at)
4
 * @date   2018
5
 *
6
 * @copyright GPLv2
7
 * This program is free software; you can redistribute it and/or modify it
8
 * under the terms and conditions of the GNU General Public License,
9
 * version 2, as published by the Free Software Foundation.
10
 *
11
 * This program is distributed in the hope it will be useful, but WITHOUT
12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14
 * more details.
15
 *
16
 * @brief RMAP RDCU RMAP command library
17
 * @see FPGA Requirement Specification PLATO-IWF-PL-RS-005 Issue 0.7
18
 */
19
20
#include <stdint.h>
21
22
#include "rmap.h"
23
#include "rdcu_cmd.h"
24
#include "rdcu_rmap.h"
25
26
27
/**
28
 * @brief generate a read command for an arbitrary register (internal)
29
 *
30
 * @param trans_id a transaction identifier
31
 *
32
 * @param cmd the command buffer; if NULL, the function returns the needed size
33
 *
34
 * @param addr the register address
35
 *
36
 * @note this will configure a multi-address, 4 byte wide read command, because
37
 *   the IWF RMAP core does not support single address read commands
38
 */
39
40
static int rdcu_read_cmd_register_internal(uint16_t trans_id, uint8_t *cmd,
41
             uint32_t addr)
42
0
{
43
0
  return rdcu_gen_cmd(trans_id, cmd, RMAP_READ_ADDR_INC, addr, 4);
44
0
}
45
46
47
/**
48
 * @brief generate a write command for an arbitrary register (internal)
49
 *
50
 * @param trans_id a transaction identifier
51
 *
52
 * @param cmd the command buffer; if NULL, the function returns the needed size
53
 *
54
 * @param addr the register address
55
 *
56
 * @returns the size of the command data buffer or 0 on error
57
 *
58
 * @note this will configure a multi-address, 4 byte wide write command, because
59
 *   the IWF RMAP core does not support single address write commands with
60
 *   reply and CRC check enabled
61
 */
62
63
static int rdcu_write_cmd_register_internal(uint16_t trans_id, uint8_t *cmd,
64
              uint32_t addr)
65
0
{
66
0
  return rdcu_gen_cmd(trans_id, cmd, RMAP_WRITE_ADDR_INC_VERIFY_REPLY,
67
0
          addr, 4);
68
0
}
69
70
71
/**
72
 * @brief create a command to write arbitrary data to the RDCU (internal)
73
 *
74
 * @param trans_id a transaction identifier
75
 *
76
 * @param cmd the command buffer; if NULL, the function returns the needed size
77
 *
78
 * @param addr the address to write to
79
 * @param size the number of bytes to write
80
 *
81
 * @returns the size of the command data buffer or 0 on error
82
 *
83
 * @note this will configure a multi-address write command with reply enabled
84
 */
85
86
static int rdcu_write_cmd_data_internal(uint16_t trans_id, uint8_t *cmd,
87
          uint32_t addr, uint32_t size)
88
0
{
89
0
  return rdcu_gen_cmd(trans_id, cmd, RMAP_WRITE_ADDR_INC_REPLY,
90
0
          addr, size);
91
0
}
92
93
94
/**
95
 * @brief create a command to read arbitrary data to the RDCU (internal)
96
 *
97
 * @param trans_id a transaction identifier
98
 *
99
 * @param cmd the command buffer; if NULL, the function returns the needed size
100
 *
101
 * @param addr the address to read from
102
 * @param size the number of bytes to read
103
 *
104
 * @returns the size of the command data buffer or 0 on error
105
 *
106
 * @note this will configure a multi-address read command
107
 *
108
 */
109
110
static int rdcu_read_cmd_data_internal(uint16_t trans_id, uint8_t *cmd,
111
               uint32_t addr, uint32_t size)
112
0
{
113
0
  return rdcu_gen_cmd(trans_id, cmd,
114
0
          RMAP_READ_ADDR_INC, addr, size);
115
0
}
116
117
118
/**
119
 * @brief create a command to write arbitrary data to the RDCU
120
 *
121
 * @param trans_id a transaction identifier
122
 *
123
 * @param cmd the command buffer; if NULL, the function returns the needed size
124
 *
125
 * @param addr the address to write to
126
 * @param size the number of bytes to write
127
 *
128
 * @returns the size of the command data buffer or 0 on error
129
 *
130
 * @note this will configure a multi-address write command with reply enabled
131
 */
132
133
int rdcu_write_cmd_data(uint16_t trans_id, uint8_t *cmd,
134
      uint32_t addr, uint32_t size)
135
0
{
136
0
  return rdcu_write_cmd_data_internal(trans_id, cmd, addr, size);
137
0
}
138
139
140
/**
141
 *
142
 * @brief create a command to read arbitrary data to the RDCU
143
 *
144
 * @param trans_id a transaction identifier
145
 *
146
 * @param cmd the command buffer; if NULL, the function returns the needed size
147
 *
148
 * @param addr the address to read from
149
 * @param size the number of bytes to read
150
 *
151
 * @returns the size of the command data buffer or 0 on error
152
 *
153
 * @note this will configure a multi-address read command
154
 *
155
 */
156
157
int rdcu_read_cmd_data(uint16_t trans_id, uint8_t *cmd,
158
           uint32_t addr, uint32_t size)
159
0
{
160
0
  return rdcu_read_cmd_data_internal(trans_id, cmd, addr, size);
161
0
}
162
163
164
165
166
/**
167
 * @brief generate a read command for an arbitrary register
168
 *
169
 * @param trans_id a transaction identifier
170
 *
171
 * @param cmd the command buffer; if NULL, the function returns the needed size
172
 *
173
 * @param addr the register address
174
 *
175
 * @note this will configure a single address, 4 byte wide read command
176
 */
177
178
int rdcu_read_cmd_register(uint16_t trans_id, uint8_t *cmd, uint32_t addr)
179
0
{
180
0
  return rdcu_read_cmd_register_internal(trans_id, cmd, addr);
181
0
}
182
183
184
/**
185
 * @brief generate a write command for an arbitrary register
186
 *
187
 * @param trans_id a transaction identifier
188
 *
189
 * @param cmd the command buffer; if NULL, the function returns the needed size
190
 *
191
 * @param addr the register address
192
 *
193
 * @returns the size of the command data buffer or 0 on error
194
 *
195
 * @note this will configure a single address, 4 byte wide write command with
196
 *   reply and CRC check enabled
197
 */
198
199
int rdcu_write_cmd_register(uint16_t trans_id, uint8_t *cmd, uint32_t addr)
200
0
{
201
0
  return rdcu_write_cmd_register_internal(trans_id, cmd, addr);
202
0
}
203
204
205
206
207
/**
208
 * @brief create a command to read the RDCU FPGA version register
209
 *
210
 * @param trans_id a transaction identifier
211
 *
212
 * @param cmd the command buffer; if NULL, the function returns the needed size
213
 *
214
 * @returns the size of the command data buffer or 0 on error
215
 */
216
217
int rdcu_read_cmd_fpga_version(uint16_t trans_id, uint8_t *cmd)
218
0
{
219
0
  return rdcu_read_cmd_register_internal(trans_id, cmd, FPGA_VERSION);
220
0
}
221
222
223
/**
224
 * @brief create a command to read the RDCU status register
225
 *
226
 * @param trans_id a transaction identifier
227
 *
228
 * @param cmd the command buffer; if NULL, the function returns the needed size
229
 *
230
 * @returns the size of the command data buffer or 0 on error
231
 */
232
233
int rdcu_read_cmd_rdcu_status(uint16_t trans_id, uint8_t *cmd)
234
0
{
235
0
  return rdcu_read_cmd_register_internal(trans_id, cmd, RDCU_STATUS);
236
0
}
237
238
239
/**
240
 * @brief create a command to read the RDCU LVDS core status register
241
 *
242
 * @param trans_id a transaction identifier
243
 *
244
 * @param cmd the command buffer; if NULL, the function returns the needed size
245
 *
246
 * @returns the size of the command data buffer or 0 on error
247
 */
248
249
int rdcu_read_cmd_lvds_core_status(uint16_t trans_id, uint8_t *cmd)
250
0
{
251
0
  return rdcu_read_cmd_register_internal(trans_id, cmd, LVDS_CORE_STATUS);
252
0
}
253
254
255
/**
256
 * @brief create a command to read the RDCU SPW link status register
257
 *
258
 * @param trans_id a transaction identifier
259
 *
260
 * @param cmd the command buffer; if NULL, the function returns the needed size
261
 *
262
 * @returns the size of the command data buffer or 0 on error
263
 */
264
265
int rdcu_read_cmd_spw_link_status(uint16_t trans_id, uint8_t *cmd)
266
0
{
267
0
  return rdcu_read_cmd_register_internal(trans_id, cmd, SPW_LINK_STATUS);
268
0
}
269
270
271
/**
272
 * @brief create a command to read the RDCU SPW error counters register
273
 *
274
 * @param trans_id a transaction identifier
275
 *
276
 * @param cmd the command buffer; if NULL, the function returns the needed size
277
 *
278
 * @returns the size of the command data buffer or 0 on error
279
 */
280
281
int rdcu_read_cmd_spw_err_cntrs(uint16_t trans_id, uint8_t *cmd)
282
0
{
283
0
  return rdcu_read_cmd_register_internal(trans_id, cmd, SPW_ERR_CNTRS);
284
0
}
285
286
287
/**
288
 * @brief create a command to read the RDCU RMAP last error register
289
 *
290
 * @param trans_id a transaction identifier
291
 *
292
 * @param cmd the command buffer; if NULL, the function returns the needed size
293
 *
294
 * @returns the size of the command data buffer or 0 on error
295
 */
296
297
int rdcu_read_cmd_rmap_last_err(uint16_t trans_id, uint8_t *cmd)
298
0
{
299
0
  return rdcu_read_cmd_register_internal(trans_id, cmd, RMAP_LAST_ERR);
300
0
}
301
302
303
/**
304
 * @brief create a command to read the RDCU RMAP no reply error counter register
305
 *
306
 * @param trans_id a transaction identifier
307
 *
308
 * @param cmd the command buffer; if NULL, the function returns the needed size
309
 *
310
 * @returns the size of the command data buffer or 0 on error
311
 */
312
313
int rdcu_read_cmd_rmap_no_reply_err_cntrs(uint16_t trans_id, uint8_t *cmd)
314
0
{
315
0
  return rdcu_read_cmd_register_internal(trans_id, cmd,
316
0
                 RMAP_NO_REPLY_ERR_CNTRS);
317
0
}
318
319
320
/**
321
 * @brief create a command to read the RDCU RMAP packet error counter register
322
 *
323
 * @param trans_id a transaction identifier
324
 *
325
 * @param cmd the command buffer; if NULL, the function returns the needed size
326
 *
327
 * @returns the size of the command data buffer or 0 on error
328
 */
329
330
int rdcu_read_cmd_rmap_pckt_err_cntrs(uint16_t trans_id, uint8_t *cmd)
331
0
{
332
0
  return rdcu_read_cmd_register_internal(trans_id, cmd,
333
0
                 RMAP_PCKT_ERR_CNTRS);
334
0
}
335
336
337
/**
338
 * @brief create a command to read the RDCU ADC values 1 register
339
 *
340
 * @param trans_id a transaction identifier
341
 *
342
 * @param cmd the command buffer; if NULL, the function returns the needed size
343
 *
344
 * @returns the size of the command data buffer or 0 on error
345
 */
346
347
int rdcu_read_cmd_adc_values_1(uint16_t trans_id, uint8_t *cmd)
348
0
{
349
0
  return rdcu_read_cmd_register_internal(trans_id, cmd, ADC_VALUES_1);
350
0
}
351
352
353
/**
354
 * @brief create a command to read the RDCU ADC values 2 register
355
 *
356
 * @param trans_id a transaction identifier
357
 *
358
 * @param cmd the command buffer; if NULL, the function returns the needed size
359
 *
360
 * @returns the size of the command data buffer or 0 on error
361
 */
362
363
int rdcu_read_cmd_adc_values_2(uint16_t trans_id, uint8_t *cmd)
364
0
{
365
0
  return rdcu_read_cmd_register_internal(trans_id, cmd, ADC_VALUES_2);
366
0
}
367
368
369
/**
370
 * @brief create a command to read the RDCU ADC values 3 register
371
 *
372
 * @param trans_id a transaction identifier
373
 *
374
 * @param cmd the command buffer; if NULL, the function returns the needed size
375
 *
376
 * @returns the size of the command data buffer or 0 on error
377
 */
378
379
int rdcu_read_cmd_adc_values_3(uint16_t trans_id, uint8_t *cmd)
380
0
{
381
0
  return rdcu_read_cmd_register_internal(trans_id, cmd, ADC_VALUES_3);
382
0
}
383
384
385
/**
386
 * @brief create a command to read the RDCU ADC values 4 register
387
 *
388
 * @param trans_id a transaction identifier
389
 *
390
 * @param cmd the command buffer; if NULL, the function returns the needed size
391
 *
392
 * @returns the size of the command data buffer or 0 on error
393
 */
394
395
int rdcu_read_cmd_adc_values_4(uint16_t trans_id, uint8_t *cmd)
396
0
{
397
0
  return rdcu_read_cmd_register_internal(trans_id, cmd, ADC_VALUES_4);
398
0
}
399
400
401
/**
402
 * @brief create a command to read the RDCU ADC status register
403
 *
404
 * @param trans_id a transaction identifier
405
 *
406
 * @param cmd the command buffer; if NULL, the function returns the needed size
407
 *
408
 * @returns the size of the command data buffer or 0 on error
409
 */
410
411
int rdcu_read_cmd_adc_status(uint16_t trans_id, uint8_t *cmd)
412
0
{
413
0
  return rdcu_read_cmd_register_internal(trans_id, cmd, ADC_STATUS);
414
0
}
415
416
417
/**
418
 * @brief create a command to read the RDCU compressor status register
419
 *
420
 * @param trans_id a transaction identifier
421
 *
422
 * @param cmd the command buffer; if NULL, the function returns the needed size
423
 *
424
 * @returns the size of the command data buffer or 0 on error
425
 */
426
427
int rdcu_read_cmd_compr_status(uint16_t trans_id, uint8_t *cmd)
428
0
{
429
0
  return rdcu_read_cmd_register_internal(trans_id, cmd, COMPR_STATUS);
430
0
}
431
432
433
434
/**
435
 * @brief create a command to write the RDCU reset register
436
 *
437
 * @param trans_id a transaction identifier
438
 *
439
 * @param cmd the command buffer; if NULL, the function returns the needed size
440
 *
441
 * @returns the size of the command data buffer or 0 on error
442
 */
443
444
int rdcu_write_cmd_rdcu_reset(uint16_t trans_id, uint8_t *cmd)
445
0
{
446
0
  return rdcu_write_cmd_register_internal(trans_id, cmd, RDCU_RESET);
447
0
}
448
449
450
/**
451
 * @brief create a command to write the RDCU SPW link control register
452
 *
453
 * @param trans_id a transaction identifier
454
 *
455
 * @param cmd the command buffer; if NULL, the function returns the needed size
456
 *
457
 * @returns the size of the command data buffer or 0 on error
458
 */
459
460
int rdcu_write_cmd_spw_link_ctrl(uint16_t trans_id, uint8_t *cmd)
461
0
{
462
0
  return rdcu_write_cmd_register_internal(trans_id, cmd, SPW_LINK_CTRL);
463
0
}
464
465
466
/**
467
 * @brief create a command to write the RDCU LVDS control register
468
 *
469
 * @param trans_id a transaction identifier
470
 *
471
 * @param cmd the command buffer; if NULL, the function returns the needed size
472
 *
473
 * @returns the size of the command data buffer or 0 on error
474
 */
475
476
int rdcu_write_cmd_lvds_ctrl(uint16_t trans_id, uint8_t *cmd)
477
0
{
478
0
  return rdcu_write_cmd_register_internal(trans_id, cmd, LVDS_CTRL);
479
0
}
480
481
482
/**
483
 *
484
 * @brief create a command to write the RDCU core control register
485
 *
486
 * @param trans_id a transaction identifier
487
 *
488
 * @param cmd the command buffer; if NULL, the function returns the needed size
489
 *
490
 * @returns the size of the command data buffer or 0 on error
491
 */
492
493
int rdcu_write_cmd_core_ctrl(uint16_t trans_id, uint8_t *cmd)
494
0
{
495
0
  return rdcu_write_cmd_register_internal(trans_id, cmd, CORE_CTRL);
496
0
}
497
498
499
/**
500
 *
501
 * @brief create a command to write the RDCU ADC control register
502
 *
503
 * @param trans_id a transaction identifier
504
 *
505
 * @param cmd the command buffer; if NULL, the function returns the needed size
506
 *
507
 * @returns the size of the command data buffer or 0 on error
508
 */
509
510
int rdcu_write_cmd_adc_ctrl(uint16_t trans_id, uint8_t *cmd)
511
0
{
512
0
  return rdcu_write_cmd_register_internal(trans_id, cmd, ADC_CTRL);
513
0
}
514
515
516
/**
517
 *
518
 * @brief create a command to write the RDCU compressor control register
519
 *
520
 * @param trans_id a transaction identifier
521
 *
522
 * @param cmd the command buffer; if NULL, the function returns the needed size
523
 *
524
 * @returns the size of the command data buffer or 0 on error
525
 */
526
527
int rdcu_write_cmd_compr_ctrl(uint16_t trans_id, uint8_t *cmd)
528
0
{
529
0
  return rdcu_write_cmd_register_internal(trans_id, cmd, COMPR_CTRL);
530
0
}
531
532
533
/**
534
 * @brief create a command to write the RDCU compressor parameter 1 register
535
 *
536
 * @param trans_id a transaction identifier
537
 *
538
 * @param cmd the command buffer; if NULL, the function returns the needed size
539
 *
540
 * @returns the size of the command data buffer or 0 on error
541
 */
542
543
int rdcu_write_cmd_compressor_param1(uint16_t trans_id, uint8_t *cmd)
544
0
{
545
0
  return rdcu_write_cmd_register_internal(trans_id, cmd, COMPR_PARAM_1);
546
0
}
547
548
549
/**
550
 * @brief create a command to write the RDCU compressor parameter 2 register
551
 *
552
 * @param trans_id a transaction identifier
553
 *
554
 * @param cmd the command buffer; if NULL, the function returns the needed size
555
 *
556
 * @returns the size of the command data buffer or 0 on error
557
 */
558
559
int rdcu_write_cmd_compressor_param2(uint16_t trans_id, uint8_t *cmd)
560
0
{
561
0
  return rdcu_write_cmd_register_internal(trans_id, cmd, COMPR_PARAM_2);
562
0
}
563
564
565
/**
566
 * @brief create a command to write the RDCU adaptive parameter 1 register
567
 *
568
 * @param trans_id a transaction identifier
569
 *
570
 * @param cmd the command buffer; if NULL, the function returns the needed size
571
 *
572
 * @returns the size of the command data buffer or 0 on error
573
 */
574
575
int rdcu_write_cmd_adaptive_param1(uint16_t trans_id, uint8_t *cmd)
576
0
{
577
0
  return rdcu_write_cmd_register_internal(trans_id, cmd,
578
0
            ADAPTIVE_PARAM_1);
579
0
}
580
581
582
/**
583
 * @brief create a command to write the RDCU adaptive parameter 2 register
584
 *
585
 * @param trans_id a transaction identifier
586
 *
587
 * @param cmd the command buffer; if NULL, the function returns the needed size
588
 *
589
 * @returns the size of the command data buffer or 0 on error
590
 */
591
592
int rdcu_write_cmd_adaptive_param2(uint16_t trans_id, uint8_t *cmd)
593
0
{
594
0
  return rdcu_write_cmd_register_internal(trans_id, cmd,
595
0
            ADAPTIVE_PARAM_2);
596
0
}
597
598
599
/**
600
 * @brief create a command to write the RDCU data start address register
601
 *
602
 * @param trans_id a transaction identifier
603
 *
604
 * @param cmd the command buffer; if NULL, the function returns the needed size
605
 *
606
 * @returns the size of the command data buffer or 0 on error
607
 */
608
609
int rdcu_write_cmd_data_start_addr(uint16_t trans_id, uint8_t *cmd)
610
0
{
611
0
  return rdcu_write_cmd_register_internal(trans_id, cmd, DATA_START_ADDR);
612
0
}
613
614
615
/**
616
 * @brief create a command to write the RDCU model start address register
617
 *
618
 * @param trans_id a transaction identifier
619
 *
620
 * @param cmd the command buffer; if NULL, the function returns the needed size
621
 *
622
 * @returns the size of the command data buffer or 0 on error
623
 */
624
625
int rdcu_write_cmd_model_start_addr(uint16_t trans_id, uint8_t *cmd)
626
0
{
627
0
  return rdcu_write_cmd_register_internal(trans_id, cmd, MODEL_START_ADDR);
628
0
}
629
630
631
/**
632
 * @brief create a command to write the RDCU number of samples register
633
 *
634
 * @param trans_id a transaction identifier
635
 *
636
 * @param cmd the command buffer; if NULL, the function returns the needed size
637
 *
638
 * @returns the size of the command data buffer or 0 on error
639
 */
640
641
int rdcu_write_cmd_num_samples(uint16_t trans_id, uint8_t *cmd)
642
0
{
643
0
  return rdcu_write_cmd_register_internal(trans_id, cmd, NUM_SAMPLES);
644
0
}
645
646
647
/**
648
 * @brief create a command to write the RDCU updated/new model start address register
649
 *
650
 * @param trans_id a transaction identifier
651
 *
652
 * @param cmd the command buffer; if NULL, the function returns the needed size
653
 *
654
 * @returns the size of the command data buffer or 0 on error
655
 */
656
657
int rdcu_write_cmd_new_model_start_addr(uint16_t trans_id, uint8_t *cmd)
658
0
{
659
0
  return rdcu_write_cmd_register_internal(trans_id, cmd,
660
0
            UPDATED_MODEL_START_ADDR);
661
0
}
662
663
664
/**
665
 * @brief create a command to write the RDCU compressed data buffer start
666
 *    address register
667
 *
668
 * @param trans_id a transaction identifier
669
 *
670
 * @param cmd the command buffer; if NULL, the function returns the needed size
671
 *
672
 * @returns the size of the command data buffer or 0 on error
673
 */
674
675
int rdcu_write_cmd_compr_data_buf_start_addr(uint16_t trans_id, uint8_t *cmd)
676
0
{
677
0
  return rdcu_write_cmd_register_internal(trans_id, cmd,
678
0
            COMPR_DATA_BUF_START_ADDR);
679
0
}
680
681
682
/**
683
 * @brief create a command to write the RDCU compressed data buffer length
684
 *    register
685
 *
686
 * @param trans_id a transaction identifier
687
 *
688
 * @param cmd the command buffer; if NULL, the function returns the needed size
689
 *
690
 * @returns the size of the command data buffer or 0 on error
691
 */
692
693
int rdcu_write_cmd_compr_data_buf_len(uint16_t trans_id, uint8_t *cmd)
694
0
{
695
0
  return rdcu_write_cmd_register_internal(trans_id, cmd,
696
0
            COMPR_DATA_BUF_LEN);
697
0
}
698
699
700
701
/**
702
 * @brief create a command to read the RDCU used parameter 1 register
703
 *
704
 * @param trans_id a transaction identifier
705
 *
706
 * @param cmd the command buffer; if NULL, the function returns the needed size
707
 *
708
 * @returns the size of the command data buffer or 0 on error
709
 */
710
711
int rdcu_read_cmd_used_param1(uint16_t trans_id, uint8_t *cmd)
712
0
{
713
0
  return rdcu_read_cmd_register_internal(trans_id, cmd,
714
0
                 USED_COMPR_PARAM_1);
715
0
}
716
717
718
/**
719
 * @brief create a command to read the RDCU unused parameter 2 register
720
 *
721
 * @param trans_id a transaction identifier
722
 *
723
 * @param cmd the command buffer; if NULL, the function returns the needed size
724
 *
725
 * @returns the size of the command data buffer or 0 on error
726
 */
727
728
int rdcu_read_cmd_used_param2(uint16_t trans_id, uint8_t *cmd)
729
0
{
730
0
  return rdcu_read_cmd_register_internal(trans_id, cmd,
731
0
                 USED_COMPR_PARAM_2);
732
0
}
733
734
735
/**
736
 * @brief create a command to read the RDCU compressed data start address
737
 *    register
738
 *
739
 * @param trans_id a transaction identifier
740
 *
741
 * @param cmd the command buffer; if NULL, the function returns the needed size
742
 *
743
 * @returns the size of the command data buffer or 0 on error
744
 */
745
746
int rdcu_read_cmd_compr_data_start_addr(uint16_t trans_id, uint8_t *cmd)
747
0
{
748
0
  return rdcu_read_cmd_register_internal(trans_id, cmd,
749
0
                 COMPR_DATA_START_ADDR);
750
0
}
751
752
753
/**
754
 * @brief create a command to read the RDCU compressed data size register
755
 *
756
 * @param trans_id a transaction identifier
757
 *
758
 * @param cmd the command buffer; if NULL, the function returns the needed size
759
 *
760
 * @returns the size of the command data buffer or 0 on error
761
 */
762
763
int rdcu_read_cmd_compr_data_size(uint16_t trans_id, uint8_t *cmd)
764
0
{
765
0
  return rdcu_read_cmd_register_internal(trans_id, cmd, COMPR_DATA_SIZE);
766
0
}
767
768
769
/**
770
 * @brief create a command to read the RDCU compressed data adaptive 1 size
771
 *    register
772
 *
773
 * @param trans_id a transaction identifier
774
 *
775
 * @param cmd the command buffer; if NULL, the function returns the needed size
776
 *
777
 * @returns the size of the command data buffer or 0 on error
778
 */
779
780
int rdcu_read_cmd_compr_data_adaptive_1_size(uint16_t trans_id, uint8_t *cmd)
781
0
{
782
0
  return rdcu_read_cmd_register_internal(trans_id, cmd,
783
0
                 COMPR_DATA_ADAPTIVE_1_SIZE);
784
0
}
785
786
787
/**
788
 * @brief create a command to read the RDCU compressed data adaptive 2 size
789
 *    register
790
 *
791
 * @param trans_id a transaction identifier
792
 *
793
 * @param cmd the command buffer; if NULL, the function returns the needed size
794
 *
795
 * @returns the size of the command data buffer or 0 on error
796
 */
797
798
int rdcu_read_cmd_compr_data_adaptive_2_size(uint16_t trans_id, uint8_t *cmd)
799
0
{
800
0
  return rdcu_read_cmd_register_internal(trans_id, cmd,
801
0
                 COMPR_DATA_ADAPTIVE_2_SIZE);
802
0
}
803
804
805
/**
806
 * @brief create a command to read the RDCU compression error register
807
 *
808
 * @param trans_id a transaction identifier
809
 *
810
 * @param cmd the command buffer; if NULL, the function returns the needed size
811
 *
812
 * @returns the size of the command data buffer or 0 on error
813
 */
814
815
int rdcu_read_cmd_compr_error(uint16_t trans_id, uint8_t *cmd)
816
0
{
817
0
  return rdcu_read_cmd_register_internal(trans_id, cmd, COMPR_ERROR);
818
0
}
819
820
821
/**
822
 * @brief create a command to read the RDCU updated model start address register
823
 *
824
 * @param trans_id a transaction identifier
825
 *
826
 * @param cmd the command buffer; if NULL, the function returns the needed size
827
 *
828
 * @returns the size of the command data buffer or 0 on error
829
 */
830
831
int rdcu_read_cmd_new_model_addr_used(uint16_t trans_id, uint8_t *cmd)
832
0
{
833
0
  return rdcu_read_cmd_register_internal(trans_id, cmd,
834
0
                 USED_UPDATED_MODEL_START_ADDR);
835
0
}
836
837
838
/**
839
 * @brief create a command to read the RDCU used number of samples register
840
 *
841
 * @param trans_id a transaction identifier
842
 *
843
 * @param cmd the command buffer; if NULL, the function returns the needed size
844
 *
845
 * @returns the size of the command data buffer or 0 on error
846
 */
847
848
int rdcu_read_cmd_samples_used(uint16_t trans_id, uint8_t *cmd)
849
0
{
850
0
  return rdcu_read_cmd_register_internal(trans_id, cmd,
851
0
                 USED_NUMBER_OF_SAMPLES);
852
0
}
853
854
855
/**
856
 * @brief create a command to write the SRAM EDAC Control register
857
 *
858
 * @param trans_id a transaction identifier
859
 *
860
 * @param cmd the command buffer; if NULL, the function returns the needed size
861
 *
862
 * @returns the size of the command data buffer or 0 on error
863
 */
864
865
int rdcu_write_cmd_sram_edac_ctrl(uint16_t trans_id, uint8_t *cmd)
866
0
{
867
0
  return rdcu_write_cmd_register_internal(trans_id, cmd, SRAM_EDAC_CTRL);
868
0
}
869
870
/**
871
 * @brief create a command to read the SRAM EDAC Status register
872
 *
873
 * @param trans_id a transaction identifier
874
 *
875
 * @param cmd the command buffer; if NULL, the function returns the needed size
876
 *
877
 * @returns the size of the command data buffer or 0 on error
878
 */
879
880
int rdcu_read_cmd_sram_edac_status(uint16_t trans_id, uint8_t *cmd)
881
0
{
882
0
  return rdcu_read_cmd_register_internal(trans_id, cmd, SRAM_EDAC_STATUS);
883
0
}