Mistake on this page?
Report an issue in GitHub or email us
pal_codec.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Hardware audio codec interface file.
6  *
7  * Copyright (c) 2019-2020 Packetcraft, Inc.
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 /*************************************************************************************************/
22 
23 #ifndef PAL_CODEC_H
24 #define PAL_CODEC_H
25 
26 #include "wsf_types.h"
27 #include "wsf_os.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /*!
34  * \addtogroup PAL_CODEC
35  * \{
36  */
37 
38 /**************************************************************************************************'
39  Data Types
40 **************************************************************************************************/
41 
42 /*! \brief Audio data path direction. */
43 typedef enum
44 {
45  PAL_CODEC_DIR_INPUT = 0, /*!< Input data path. */
46  PAL_CODEC_DIR_OUTPUT = 1 /*!< Output data path. */
48 
49 /*! \brief Audio Channel. */
50 typedef enum
51 {
52  PAL_CODEC_CH_LEFT = 0, /*!< Left channel. */
53  PAL_CODEC_CH_RIGHT = 1, /*!< Right channel. */
54  AUDIO_NUM_CH /*!< Right channel. */
56 
57 /*! \brief Audio Channel mask. */
58 enum
59 {
60  PAL_CODEC_CH_LEFT_BIT = (1 << PAL_CODEC_CH_LEFT),
61  PAL_CODEC_CH_RIGHT_BIT = (1 << PAL_CODEC_CH_RIGHT)
62 };
63 
64 /*! \brief Standard codec info block. */
65 typedef struct
66 {
67  uint8_t codecId; /*!< Codec ID. */
69 
70 /*! \brief VS codec info block. */
71 typedef struct
72 {
73  uint16_t compId; /*!< Company ID. */
74  uint16_t codecId; /*!< Codec ID. */
76 
77 /*! \brief Buffer available call signature. */
78 typedef void (*PalCodecDataReady_t)(uint16_t id);
79 
80 /*! \brief Codec. */
81 typedef struct
82 {
83  PalAudioDir_t dir; /*!< Stream data direction. */
84  uint16_t chMask; /*!< Audio channel mask. */
85  uint32_t intervalUsec; /*!< SDU interval in microseconds. */
86  uint32_t pktCtr; /*!< Initial packet counter value. */
87  PalCodecDataReady_t rdyCback; /*!< Data ready callback. */
89 
90 /**************************************************************************************************
91  Function Declarations
92 **************************************************************************************************/
93 
94 /* Codec Information */
95 void PalCodecReadLocalSupportedCodecs(uint8_t *pNumStd, AudioStdCodecInfo_t stdCodecs[],
96  uint8_t *pNumVs, AudioVsCodecInfo_t vsCodecs[]);
97 bool_t PalCodecReadLocalSupportedCodecCapabilities(uint8_t codingFmt, uint16_t compId, uint16_t vsCodecId, PalAudioDir_t dir);
98 bool_t PalCodecReadLocalSupportedControllerDelay(uint8_t codingFmt, uint16_t compId, uint16_t vsCodecId, PalAudioDir_t dir,
99  uint32_t *pMinDly, uint32_t *pMaxDly);
100 bool_t PalCodecConfigureDataPath(PalAudioDir_t dir, uint8_t dataPathId);
101 
102 /* Audio Amplifier */
103 void PalCodecAmpInit(void);
104 uint8_t PalCodecAmpGetVol(void);
105 void PalCodecAmpVolumeUp(void);
106 void PalCodecAmpVolumeDown(void);
107 void PalCodecAmpMute(void);
108 void PalCodecAmpUnmute(void);
109 
110 /* Data Path */
111 void PalCodecDataInit(void);
112 bool_t PalCodecDataStartStream(uint16_t id, PalCodecSreamParam_t *pParam);
113 void PalCodecDataStopStream(uint16_t id);
114 uint16_t PalCodecDataStreamIn(uint16_t id, uint8_t *pBuf, uint16_t len, uint32_t *pPktCtr);
115 void PalCodecDataStreamOut(uint16_t id, const uint8_t *pBuf, uint16_t len, uint32_t pktCtr);
116 
117 /*! \} */ /* PAL_CODEC */
118 
119 #ifdef __cplusplus
120 };
121 #endif
122 
123 #endif /* PAL_CODEC_H */
PalAudioDir_t dir
Definition: pal_codec.h:83
VS codec info block.
Definition: pal_codec.h:71
PalAudioChan_t
Audio Channel.
Definition: pal_codec.h:50
Platform-independent data types.
void(* PalCodecDataReady_t)(uint16_t id)
Buffer available call signature.
Definition: pal_codec.h:78
PalAudioDir_t
Audio data path direction.
Definition: pal_codec.h:43
PalCodecDataReady_t rdyCback
Definition: pal_codec.h:87
uint32_t intervalUsec
Definition: pal_codec.h:85
uint16_t codecId
Definition: pal_codec.h:74
uint16_t compId
Definition: pal_codec.h:73
Software foundation OS API.
Standard codec info block.
Definition: pal_codec.h:65
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.