Mistake on this page?
Report an issue in GitHub or email us
pal_i2s.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief I2S driver definition.
6  *
7  * Copyright (c) 2019 ARM Ltd. All Rights Reserved.
8  *
9  * Copyright (c) 2019-2020 Packetcraft, Inc.
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  * http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */
23 /*************************************************************************************************/
24 
25 #ifndef PAL_I2S_H
26 #define PAL_I2S_H
27 
28 #include "pal_types.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /*! \addtogroup PAL_I2S
35  * \{ */
36 
37 /**************************************************************************************************
38  Data Types
39 **************************************************************************************************/
40 
41 /*! \brief Operational states. */
42 typedef enum
43 {
44  PAL_I2S_STATE_UNINIT = 0, /*!< Uninitialized state. */
45  PAL_I2S_STATE_ERROR = 0, /*!< Error state. */
46  PAL_I2S_STATE_IDLE, /*!< Initialized state. */
47  PAL_I2S_STATE_READY, /*!< Configured state. */
48  PAL_I2S_STATE_BUSY /*!< Busy state. */
50 
51 /*! \brief Call signature for next buffer pointer. */
52 typedef void (*PalI2sCompCback_t)(void *);
53 
54 /*! \brief I2S modes. */
55 typedef enum
56 {
57  PAL_I2S_MODE_MASTER, /*!< Master mode. */
58  PAL_I2S_MODE_SLAVE /*!< Slave mode. */
59 } PalI2sMode_t;
60 
61 /*! \brief Channels. */
62 typedef enum
63 {
64  PAL_I2S_CH_LEFT_BIT = (1 << 0), /*!< Left channel bit. */
65  PAL_I2S_CH_RIGHT_BIT = (1 << 1) /*!< Right channel bit. */
67 
68 /*! \brief I2S configuration. */
69 typedef struct
70 {
71  PalI2sMode_t mode:8; /*!< Mode of operation. */
72  uint32_t rate; /*!< Sample rate. */
73  uint8_t bitDepth; /*!< Sample bit depth. */
74  uint8_t chan; /*!< Enabled channels. */
75  PalI2sCompCback_t frmCback; /*!< Get next read buffer callback. */
76  void *pCtx; /*!< Opaque operation context. */
78 
79 /**************************************************************************************************
80  Function Declarations
81 **************************************************************************************************/
82 
83 /* Initialization */
84 void PalI2sInit(void);
85 void PalI2sDeInit(void);
86 
87 /* Control and Status */
88 PalI2sState_t PalI2sGetState(void);
89 void PalI2sConfig(PalI2sConfig_t *pCfg);
90 void PalI2sDeConfig(void);
91 
92 /* Data Transfer */
93 void PalI2sReadData(uint8_t *pData, uint16_t len);
94 void PalI2sWriteData(const uint8_t *pData, uint16_t len);
95 
96 /*! \} */ /* PAL_I2S */
97 
98 #ifdef __cplusplus
99 };
100 #endif
101 
102 #endif /* PAL_I2S_H */
PalI2sState_t
Operational states.
Definition: pal_i2s.h:42
uint8_t bitDepth
Definition: pal_i2s.h:73
PalI2sMode_t
I2S modes.
Definition: pal_i2s.h:55
PalI2sCompCback_t frmCback
Definition: pal_i2s.h:75
I2S configuration.
Definition: pal_i2s.h:69
uint32_t rate
Definition: pal_i2s.h:72
void(* PalI2sCompCback_t)(void *)
Call signature for next buffer pointer.
Definition: pal_i2s.h:52
void * pCtx
Definition: pal_i2s.h:76
Platform-independent data types.
uint8_t chan
Definition: pal_i2s.h:74
PalI2sChanMask_t
Channels.
Definition: pal_i2s.h:62
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.