summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/abe/abe_api.h
blob: b224d7001baf437a74547d7c8bd4d60d104045e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
/*
 * ==========================================================================
 *               Texas Instruments OMAP(TM) Platform Firmware
 * (c) Copyright 2009, Texas Instruments Incorporated.  All Rights Reserved.
 *
 *  Use of this firmware is controlled by the terms and conditions found
 *  in the license agreement under which this firmware has been supplied.
 * ==========================================================================
 */

#ifndef _ABE_API_H_
#define _ABE_API_H_

#ifdef __cplusplus
extern "C" {
#endif

/*
 * External API
 */
#if PC_SIMULATION
extern void target_server_read_pmem(abe_uint32 address,	 abe_uint32 *data, abe_uint32 nb_words_32bits);
extern void target_server_write_pmem(abe_uint32 address,	 abe_uint32 *data, abe_uint32 nb_words_32bits);
extern void target_server_read_cmem(abe_uint32 address,	 abe_uint32 *data, abe_uint32 nb_words_32bits);
extern void target_server_write_cmem(abe_uint32 address,	 abe_uint32 *data, abe_uint32 nb_words_32bits);
extern void target_server_read_atc(abe_uint32 address,	 abe_uint32 *data, abe_uint32 nb_words_32bits);
extern void target_server_write_atc(abe_uint32 address,        abe_uint32 *data, abe_uint32 nb_words_32bits);
extern void target_server_read_smem(abe_uint32 address_48bits, abe_uint32 *data, abe_uint32 nb_words_48bits);
extern void target_server_write_smem(abe_uint32 address_48bits, abe_uint32 *data, abe_uint32 nb_words_48bits);
extern void target_server_read_dmem(abe_uint32 address_byte,   abe_uint32 *data, abe_uint32 nb_byte);
extern void target_server_write_dmem(abe_uint32 address_byte,   abe_uint32 *data, abe_uint32 nb_byte);

extern void target_server_activate_mcpdm_ul(void);
extern void target_server_activate_mcpdm_dl(void);
extern void target_server_activate_dmic(void);
extern void target_server_set_voice_sampling(int dVirtAudioVoiceMode, int dVirtAudioVoiceSampleFrequency);
extern void target_server_set_dVirtAudioMultimediaMode(int dVirtAudioMultimediaMode);
#endif

/*
 * Internal API
 */

/**
* abe_read_sys_clock() description for void abe_read_sys_clock().
*
*  Operations : returns the current time indication for the LOG
*
*  Parameter  : No parameter
* @param
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_read_sys_clock(abe_micros_t *time);

/**
* abe_fprintf() description for void abe_fprintf().
*
*  Operations : returns the current time indication for the LOG
*
*  Parameter  : No parameter
* @param
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
//void abe_fprintf(char *line);

/*
 * API as part of the HAL paper documentation
 */

/**
* abe_reset_hal() description for void abe_reset_hal().
*
*  Operations : reset the HAL by reloading the static variables and default AESS registers.
*	Called after a PRCM cold-start reset of ABE
*
*  Parameter  : No parameter
* @param
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_reset_hal(void);

/**
*  abe_read_use_case_opp() description for void abe_read_use_case_opp().
*
*  Operations : returns the expected min OPP for a given use_case list
*
*  Parameter  : No parameter
* @param
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_read_use_case_opp(abe_use_case_id *u, abe_opp_t *o);

/**
* abe_load_fw() description for void abe_load_fw().
*
*  Operations :
*      loads the Audio Engine firmware, generate a single pulse on the Event generator
*      to let execution start, read the version number returned from this execution.
*
*  Parameter  : No parameter
* @param
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code in case the firmware does not start.
*
* @see
*/
void abe_load_fw(void);

/**
* abe_read_port_address() description for void abe_read_port_address().
*
*  Operations :
*      This API returns the address of the DMA register used on this audio port.
*
*  Parameter  : No parameter
* @param	dma : output pointer to the DMA iteration and data destination pointer
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_read_port_address(abe_port_id port, abe_dma_t *dma);

/**
* abe_default_configuration() description for void abe_default_configuration().
*
*  Parameter  :
*      use-case-ID : "LP player", "voice-call" use-cases as defined in the paragraph
*      "programming use-case sequences"
*      param1, 2, 3, 4 : two parameters to be used later during FW06 integration
*
*  Operations :
*      private API used during development. Loads all the necessary parameters and data
*      patterns to allow a stand-alone functional test without the need of.
*
*  Parameter  : No parameter
* @param	dma : output pointer to the DMA iteration and data destination pointer
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_default_configuration(abe_uint32 use_case);

/**
* abe_irq_processing() description for void abe_irq_processing().
*
*  Parameter  :
*      No parameter
*
*  Operations :
*      This subroutine will check the IRQ_FIFO from the AE and act accordingly.
*      Some IRQ source are originated for the delivery of "end of time sequenced tasks"
*      notifications, some are originated from the Ping-Pong protocols, some are generated from
*      the embedded debugger when the firmware stops on programmable break-points, etc …
*
* @param	dma : output pointer to the DMA iteration and data destination pointer
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_irq_processing(void);

/**
* abe_write_event_generator () description for void abe_event_generator_switch().
*
*  Operations :
*      load the AESS event generator hardware source. Loads the firmware parameters
*      accordingly. Indicates to the FW which data stream is the most important to preserve
*      in case all the streams are asynchronous. If the parameter is "default", let the HAL
*      decide which Event source is the best appropriate based on the opened ports.
*
* @param	e: Event Generation Counter, McPDM, DMIC or default.
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_write_event_generator(abe_event_id e);

/**
* abe_read_lowest_opp() description for void abe_read_lowest_opp().
*
*  Operations :
*      Returns the lowest possible OPP based on the current active ports.
*
* @param	o: returned data
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_read_lowest_opp(abe_opp_t *o);

/**
* abe_set_opp_processing() description for void abe_set_opp_processing().
*
*  Parameter  :
*      New processing network and OPP:
*	  0: Ultra Lowest power consumption audio player (no post-processing, no mixer);
*	  1: OPP 25% (simple multimedia features, including low-power player);
*	  2: OPP 50% (multimedia and voice calls);
*	  3: OPP100% (EANC, multimedia complex use-cases);
*
*  Operations :
*      Rearranges the FW task network to the corresponding OPP list of features.
*      The corresponding AE ports are supposed to be set/reset accordingly before this switch.
*
* @param	o: desired opp
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_set_opp_processing(abe_opp_t opp);

/**
* abe_set_ping_pong_bufferg() description for void abe_set_ping_pong_buffer().
*
*  Parameter  :
*      Port_ID :
*      Pointer name : Read or Write pointer
*      New data
*
*  Operations :
*      Updates the ping-pong read/write pointer with the input data.
*
* @param
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_set_ping_pong_buffer(abe_port_id port, abe_uint32 n);

/**
* @fn abe_connect_irq_ping_pong_port()
*
*  Operations : enables the data echanges between a direct access to the DMEM
*       memory of ABE using cache flush. On each IRQ activation a subroutine
*       registered with "abe_plug_subroutine" will be called. This subroutine
*       will generate an amount of samples, send them to DMEM memory and call
*       "abe_set_ping_pong_buffer" to notify the new amount of samples in the
*       pong buffer.
*
*    Parameters :
*       id: port name
*       f : desired data format
*       I : index of the call-back subroutine to call
*       s : half-buffer (ping) size
*
*       p: returned base address of the first (ping) buffer)
*
* @see	ABE_API.h
*/
void abe_connect_irq_ping_pong_port(abe_port_id id, abe_data_format_t *f, abe_uint32 d,
				abe_uint32 s, abe_uint32 *p, abe_uint32 dsp_mcu_flag);

/**
* abe_plug_subroutine() description for void abe_plug_subroutine().
*
* Parameter :
*  id: returned sequence index after plugging a new subroutine
*  f : subroutine address to be inserted
*
*  Operations :
*      register a list of subroutines for call-back purpose.
*
* @param
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_plug_subroutine(abe_uint32 *id, abe_subroutine2 f, abe_uint32 n, abe_uint32 *params);

/**
* abe_plug_sequence() description for void abe_plug_sequence().
*
 *  Parameter  :
 *       Id: returned sequence index after pluging a new sequence (index in the tables);
 *       s : sequence to be inserted
 *
 *  Operations :
 *      Load a list a time-sequenced operations.
*
* @param
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_plug_sequence(abe_uint32 *id, abe_sequence_t *s);

/**
* abe_launch_sequence() description for void abe_launch_sequence().
*
*  Parameter  :
*      Sequence index
*
*  Operations :
*      Launch a list a time-sequenced operations.
*
* @param
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_launch_sequence(abe_patch_rev patch, abe_uint32 n);

/**
* abe_launch_sequence_param() description for void abe_launch_sequence_param().
*
*  Parameter  :
*      Sequence index
*      Parameters to the programmable sequence
*
*  Operations :
*      Launch a list a time-sequenced operations.
*
* @param
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_launch_sequence_param(abe_patch_rev patch, abe_uint32 n, abe_int32 *param1, abe_int32 *param2, abe_int32 *param3, abe_int32 *param4);;

/**
* abe_read_analog_gain_dl() description for void abe_read_analog_gain_dl().
*
*  Parameter  :
*      gain value pointer
*
*  Operations :
*      returns to the data pointer the gain value of the phoenix headset in case the
*      dynamic extension is activated.
*
* @param
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_read_analog_gain_dl(abe_gain_t *a);

/**
* abe_read_analog_gain_ul() description for void abe_read_analog_gain_ul().
*
 *  Parameter  :
 *      gain value pointer
 *
 *  Operations :
 *      returns to the data pointer the gain value of the phoenix headset in case the
 *	dynamic extension is activated.
*
* @param
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_read_analog_gain_ul(abe_gain_t *a);

/**
* abe_enable_dyn_ul_gain() description for void abe_enable_dyn_ul_gain().
*
*  Parameter  :
*      None.
*
*  Operations :
*      enables the audio engine capability to change dynamically the analog microphone
*      amplitude based on the information of analog gain changes..
*
* @param
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_enable_dyn_ul_gain(void);

/**
* abe_disable_dyn_ul_gain() description for void abe_disable_dyn_ul_gain().
*
*  Parameter  :
*      None.
*
*  Operations :
*      disables the audio engine capability to change dynamically the analog microphone
*      amplitude based on the information of analog gain changes.
*
* @param
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_disable_dyn_ul_gain(void);

/**
* abe_enable_dyn_extension() description for void abe_enable_dyn_extension().
*
*  Parameter  :
*      None
*
*  Operations :
*      enables the audio engine capability to change the analog gain of Phoenix headset port.
*      This feature enables dynamic range extension by increasing the digital gains and lowering
*      the analog gains. This API is preferably called at reset time.
*
* @param
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_enable_dyn_extension(void);

/**
* abe_disable_dyn_extension() description for void abe_disable_dyn_extension().
*
*  Parameter  :
*      None
*
*  Operations :
*      disables the audio engine capability to change the analog gain of Phoenix heads
*
* @param
*
* @pre	  no pre-condition
*
* @post
*
* @return       error code
*
* @see
*/
void abe_disable_dyn_extension(void);

/*
 *  ABE_NOTIFY_ANALOG_GAIN_CHANGED
 *
 *  Parameter  :
 *      Id: name of the Phoenix (or other device); port for which a gain was changed
 *      G: pointer to the notified gain value
 *
 *  Operations :
 *      The upper layer tells the HAL a new gain was programmed in the analog renderer.
 *      This will help the tuning of the APS parameters.
 *
 *  Return value :
 *      None.
 */
void abe_notify_analog_gain_changed(abe_ana_port_id Id, abe_gain_t *G);

/*
 *  ABE_RESET_PORT
 *
 *  Parameters :
 *  id: port name
 *
 *  Returned value : error code
 *
 *  Operations : stop the port activity and reload default parameters on the associated processing features.
 *
 */
void abe_reset_port(abe_port_id id);

/*
 *  ABE_READ_REMAINING_DATA
 *
 *  Parameter  :
 *      Port_ID :
 *      size : pointer to the remaining number of 32bits words
 *
 *  Operations :
 *      computes the remaining amount of data in the buffer.
 *
 *  Return value :
 *      error code
 */
void abe_read_remaining_data(abe_port_id port, abe_uint32 *n);

/*
 *  ABE_DISABLE_DATA_TRANSFER
 *
 *  Parameter  :
 *      p: port indentifier
 *
 *  Operations :
 *      disables the ATC descriptor
 *
 *  Return value :
 *      None.
 */
void abe_disable_data_transfer (abe_port_id p);

/*
 *  ABE_ENABLE_DATA_TRANSFER
 *
 *  Parameter  :
 *      p: port indentifier
 *
 *  Operations :
 *      enables the ATC descriptor
 *
 *  Return value :
 *      None.
 */
void abe_enable_data_transfer(abe_port_id p);

/*
 *  ABE_READ_GLOBAL_COUNTER
 *
 *  Parameter  :
 *      data pointer to the counter value
 *      data pointer to the translated milliseconds
 *
 *  Operations :
 *      returns the value of the 32bits counter incremented on each firmware scheduling task
 *      loops (250us / 272us with respectively 48kHz / 44.1kHz on Phoenix);. Translates this data
 *      in milli seconds format.
 *
 *  Return value :
 *      None.
 */
void abe_read_global_counter(abe_time_stamp_t *t, abe_millis_t *m);

/*
 *  ABE_SET_DMIC_FILTER
 *
 *  Parameter  :
 *      DMIC decimation ratio : 16/25/32/40
 *
 *  Operations :
 *      Loads in CMEM a specific list of coefficients depending on the DMIC sampling
 *      frequency (2.4MHz or 3.84MHz);. This table compensates the DMIC decimator roll-off at 20kHz.
 *      The default table is loaded with the DMIC 2.4MHz recommended configuration.
 *
 *  Return value :
 *      None.
 */
void abe_set_dmic_filter(abe_dmic_ratio_t d);

/**
* @fn abe_connect_cbpr_dmareq_port()
*
*  Operations : enables the data echange between a DMA and the ABE through the
*       CBPr registers of AESS.
*
*   Parameters :
*   id: port name
*   f : desired data format
*   d : desired dma_request line (0..7)
*   a : returned pointer to the base address of the CBPr register and number of
*       samples to exchange during a DMA_request.
*
* @see	ABE_API.h
*/
void abe_connect_cbpr_dmareq_port(abe_port_id id, abe_data_format_t *f, abe_uint32 d, abe_dma_t *a);

/**
* @fn abe_connect_dmareq_port()
*
*  Operations : enables the data echange between a DMA and the ABE through the
*       CBPr registers of AESS.
*
*   Parameters :
*   id: port name
*   f : desired data format
*   d : desired dma_request line (0..7)
*   a : returned pointer to the base address of the ping-pong buffer and number
*       of samples to exchange during a DMA_request..
*
* @see	ABE_API.h
*/
void abe_connect_dmareq_port(abe_port_id id, abe_data_format_t *f, abe_uint32 d, abe_dma_t *a);

/**
* @fn abe_connect_dmareq_ping_pong_port()
*
*  Operations : enables the data echanges between a DMA and a direct access to the
*       DMEM memory of ABE. On each dma_request activation the DMA will exchange "s"
*       bytes and switch to the "pong" buffer for a new buffer exchange.ABE
*
*    Parameters :
*    id: port name
*    f : desired data format
*    d : desired dma_request line (0..7)
*    s : half-buffer (ping) size
*
*    a : returned pointer to the base address of the ping-pong buffer and number of samples to exchange during a DMA_request.
*
* @see	ABE_API.h
*/
void abe_connect_dmareq_ping_pong_port(abe_port_id id, abe_data_format_t *f, abe_uint32 d, abe_uint32 s, abe_dma_t *a);

/**
* @fn abe_connect_serial_port()
*
*  Operations : enables the data echanges between a McBSP and an ATC buffer in
*   DMEM. This API is used connect 48kHz McBSP streams to MM_DL and 8/16kHz
*   voice streams to VX_UL, VX_DL, BT_VX_UL, BT_VX_DL. It abstracts the
*   abe_write_port API.
*
*   Parameters :
*    id: port name
*    f : data format
*    i : peripheral ID (McBSP #1, #2, #3)
*
* @see	ABE_API.h
*/
void abe_connect_serial_port(abe_port_id id, abe_data_format_t *f, abe_mcbsp_id i);

/*
 *  ABE_WRITE_PORT_DESCRIPTOR
 *
 *  Parameter  :
 *      id: port name
 *      f : input pointer to the data format
 *      p : input pointer to the protocol description
 *      dma : output pointer to the DMA iteration and data destination pointer
 *
 *  Operations :
 *      writes the corresponding port descriptor in the AE memory spaces. The ATC DMEM descriptors
 *      are initialized.
 *      - translates the data format to AE I/O task format
 *      - copy to DMEM
 *      - load ATC descriptor - disabled
 *
 *  Return value :
 *      None.
 */
void abe_write_port_descriptor(abe_port_id id, abe_data_format_t *f, abe_port_protocol_t *p, abe_dma_t *dma);

/*
 *  ABE_READ_PORT_DESCRIPTOR
 *
 *  Parameter  :
 *      id: port name
 *      f : input pointer to the data format
 *      p : input pointer to the protocol description
 *
 *  Operations :
 *      returns the port parameters from the HAL internal buffer.
 *
 *  Return value :
 *      error code in case the Port_id is not compatible with the current OPP value
 */
void abe_read_port_descriptor(abe_port_id id, abe_data_format_t *f, abe_port_protocol_t *p);

/*
 *  ABE_READ_APS_ENERGY
 *
 *  Parameter  :
 *      Port_ID : port ID supporting APS
 *      APS data struct pointer
 *
 *  Operations :
 *      Returns the estimated amount of energy
 *
 *  Return value :
 *      error code when the Port is not activated.
 */
void abe_read_aps_energy(abe_port_id *p, abe_gain_t *a);

/*
 *  ABE_WRITE_PORT_GAIN
 *
 *  Parameter  :
 *      port : name of the port (VX_DL_PORT, MM_DL_PORT, MM_EXT_DL_PORT, TONES_DL_PORT, …);
 *      dig_gain_port pointer to returned port gain and time constant
 *
 *  Operations :
 *      saves the gain data in the local HAL-L0 table of gains in native format.
 *      Translate the gain to the AE-FW format and load it in CMEM
 *
 *  Return value :
 *      error code in case the gain_id is not compatible with the current OPP value.
 */

void abe_write_port_gain(abe_port_id port, abe_gain_t g, abe_ramp_t ramp);
void abe_write_gain(abe_gain_id id, abe_gain_t f_g, abe_ramp_t f_ramp, abe_port_id p);

/*
 *  ABE_READ_GAIN
 *
 *  Parameter  :
 *      port : name of the port (VX_DL_PORT, MM_DL_PORT, MM_EXT_DL_PORT, TONES_DL_PORT, …);
 *      dig_gain_port pointer to returned port gain and time constant
 *
 *  Operations :
 *      returns the real-time value of the gain from CMEM.
 *
 *  Return value :
 *      error code in case the gain_id is not compatible with the current OPP value.
 */
void abe_read_port_gain(abe_port_id port, abe_gain_t *gain, abe_ramp_t *ramp);

/*
 *  ABE_READ_GAIN_RANGES
 *
 *  Parameter  :
 *      Id  : name of the AE port
 *      Gain data pointer to the minimum, maximum gain,
 *	gain steps for the overall digital and/or analog hardware.
 *
 *  Operations :
 *      returns the gain steps accuracy and range. If the API abe_enable_dyn_extension
 *      was called, the ports connected to Phoenix McPDM will also incorporate the gains
 *      of the analog part, else only the digital part is taken into account.
 *
 *  Return value :
 *      None.
 */
void abe_read_gain_range(abe_port_id id, abe_gain_t *min, abe_gain_t *max, abe_gain_t *step);

/*
 *  ABE_WRITE_EQUALIZER
 *
 *  Parameter  :
 *      Id  : name of the equalizer
 *      Param : equalizer coefficients
 *
 *  Operations :
 *      Load the coefficients in CMEM. This API can be called when the corresponding equalizer
 *      is not activated. After reloading the firmware the default coefficients corresponds to
 *      "no equalizer feature". Loading all coefficients with zeroes disables the feature.
 *
 *  Return value :
 *      None.
 */
void abe_write_equalizer(abe_equ_id id, abe_equ_t *param);

/*
 * ABE_WRITE_ASRC
 *
 *  Parameter  :
 *      Id  : name of the asrc
 *      param : drift value t compensate
 *
 *  Operations :
 *      Load the drift coefficients in FW memory. This API can be called when the corresponding
 *      ASRC is not activated. After reloading the firmware the default coefficients corresponds
 *      to "no ASRC activated". Loading the drift value with zero disables the feature.
 *
 *  Return value :
 *      None.
 */
void abe_write_asrc(abe_asrc_id id, abe_drift_t param);
void abe_set_asrc_drift_control(abe_asrc_id id, abe_uint32 f);

/*
 *  ABE_WRITE_APS
 *
 *  Parameter  :
 *      Id  : name of the aps filter
 *      param : table of filter coefficients
 *
 *  Operations :
 *      Load the filters and thresholds coefficients in FW memory. This API can be called when
 *      the corresponding APS is not activated. After reloading the firmware the default coefficients
 *      corresponds to "no APS activated". Loading all the coefficients value with zero disables
 *      the feature.
 *
 *  Return value :
 *      None.
 */
void abe_write_aps(abe_aps_id id, abe_aps_t *param);

/*
 *  ABE_WRITE_MIXER
 *
 *  Parameter  :
 *  Id  : name of the mixer
 *  param : list of input gains of the mixer
 *  p : list of ports corresponding to the above gains
 *
 *  Operations :
 *      Load the gain coefficients in FW memory. This API can be called when the corresponding
 *      MIXER is not activated. After reloading the firmware the default coefficients corresponds
 *      to "all input and output mixer's gain in mute state". A mixer is disabled with a network
 *      reconfiguration corresponding to an OPP value.
 *
 *  Return value :
 *      None.
 */
void abe_write_mixer(abe_mixer_id id, abe_gain_t g, abe_ramp_t ramp, abe_port_id p);

/*
 *  ABE_WRITE_EANC
 *
 *  Parameter  :
 *      param : table of coefficients
 *
 *  Operations :
 *      Load the EANC coefficients in FW memory. This API can be called when EANC is not
 *      activated. After reloading the firmware the default coefficients corresponds to
 *      "no EANC activated". Loading the coefficients value with zero disables the feature.
 *
 *  Return value :
 *      None.
 */
void abe_write_eanc(abe_eanc_t *param);

/*
 *  ABE_ENABLE_ROUTER_CONFIGURATION
 *
 *  Parameter  :
 *      Id  : name of the router
 *      param : list of output index of the route
 *
 *  Operations : load a pre-computed router configuration
 *
 *  Return value :
 *      None.
 */
void abe_enable_router_configuration(abe_router_id id, abe_uint32 configuration);

/*
 *  ABE_SET_ROUTER_CONFIGURATION
 *
 *  Parameter  :
 *      Id  : name of the router
 *      Conf : id of the configuration
 *      param : list of output index of the route
 *
 *  Operations :
 *      The uplink router takes its input from DMIC (6 samples), AMIC (2 samples) and
 *      PORT1/2 (2 stereo ports). Each sample will be individually stored in an intermediate
 *      table of 10 elements. The intermediate table is used to route the samples to
 *      three directions : REC1 mixer, 2 EANC DMIC source of filtering and MM recording audio path.
 *      For example, a use case consisting in AMIC used for uplink voice communication, DMIC 0,1,2,3
 *      used for multimedia recording, , DMIC 5 used for EANC filter, DMIC 4 used for the feedback channel,
 *      will be implemented with the following routing table index list :
 *      [3, 2 , 1, 0, 0, 0 (two dummy indexes to data that will not be on MM_UL), 4, 5, 7, 6]
 *
 *  Return value :
 *      None.
 */
void abe_set_router_configuration(abe_router_id id, abe_uint32 configuration, abe_router_t *param);

/*
 *  ABE_WRITE_ROUTER
 *
 *  Parameter  :
 *      Id  : name of the router
 *      param : list of output index of the route
 *
 *  Operations :
 *      The uplink router takes its input from DMIC (6 samples);, AMIC (2 samples); and
 *      PORT1/2 (2 stereo ports);. Each sample will be individually stored in an intermediate
 *      table of 10 elements. The intermediate table is used to route the samples to
 *      three directions : REC1 mixer, 2 EANC DMIC source of filtering and MM recording audio path.
 *      For example, a use case consisting in AMIC used for uplink voice communication, DMIC 0,1,2,3
 *      used for multimedia recording, , DMIC 5 used for EANC filter, DMIC 4 used for the feedback channel,
 *      will be implemented with the following routing table index list :
 *      [3, 2 , 1, 0, 0, 0 (two dummy indexes to data that will not be on MM_UL);, 4, 5, 7, 6]
 *
 *  Return value :
 *      None.
 */
void abe_write_router(abe_router_id id, abe_router_t *param);

/*
 *  ABE_READ_ASRC
 *
 *  Parameter  :
 *      Id  : name of the asrc
 *      param : drift value to compensate
 *
 *
 *  Operations :
 *      read drift ppm value
 *
 *  Return value :
 *      None.
 */
void abe_read_asrc(abe_asrc_id id, abe_drift_t *param);

/*
 *  ABE_READ_APS
 *
 *  Parameter  :
 *      Id  : name of the aps filter
 *      param : table of filter coefficients
 *
 *  Operations :
 *      Read APS coefficients
 *
 *  Return value :
 *      None.
 */
void abe_read_aps(abe_aps_id id, abe_aps_t *param);

/*
 *  ABE_READ_MIXER
 *
 *  Parameter  :
 *      Id  : name of the aps filter
 *      param : table of filter coefficients
 *
 *  Operations :
 *      Id  : name of the mixer
 *      param : list of input and output gains of the mixer
 *
 *  Return value :
 *      None.
 */
void abe_read_mixer(abe_mixer_id id, abe_gain_t *f_gain, abe_ramp_t *f_ramp, abe_port_id p);

/*
 *  ABE_READ_EANC
 *
 *  Parameter  :
 *      param : table of coefficients
 *
 *  Operations :
 *      read eanc coefficients
 *
 *  Return value :
 *      None.
 */
void abe_read_eanc(abe_eanc_t *param);

/*
 *  ABE_READ_ROUTER
 *
 *  Parameter  :
 *      Id  : name of the router
 *      param : list of output index of the route
 *
 *  Operations :
 *
 *
 *  Return value :
 *      None.
 */
void abe_read_router(abe_router_id id, abe_router_t *param);

/*
 *  ABE_READ_DEBUG_TRACE
 *
 *  Parameter  :
 *      data destination pointer
 *      max number of data read
 *
 *  Operations :
 *      reads the AE circular data pointer holding pairs of debug data+timestamps, and store
 *      the pairs in linear addressing to the parameter pointer. Stops the copy when the max
 *	parameter is reached or when the FIFO is empty.
 *
 *  Return value :
 *      None.
 */
void abe_read_debug_trace(abe_uint32 *data, abe_uint32 *n);

/*
 *  ABE_SET_DEBUG_TRACE
 *
 *  Parameter  :
 *      debug ID from a list to be defined
 *
 *  Operations :
 *      load a mask which filters the debug trace to dedicated types of data
 *
 *  Return value :
 *      None.
 */
void abe_set_debug_trace(abe_dbg_t debug);

/*
 *  ABE_SET_DEBUG_PINS
 *
 *  Parameter  :
 *      debugger commands to the AESS register in charge of the debug pins
 *
 *  Operations :
 *      interpret the debugger commands: activate the AESS debug pins and
 *      allocate those pins to the AE outputs.
 *
 *  Return value :
 *      None.
 */
void abe_set_debug_pins(abe_uint32 debug_pins);

#ifdef __cplusplus
}
#endif

#endif	/* _ABE_API_H_ */