comparison L1/audio_include/l1audio_btapi.h @ 0:75a11d740a02

initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 09 Jun 2016 00:02:41 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:75a11d740a02
1 /****************************************************
2 / FILE NAME:- BT_L1_API.h file.
3 / ****************************************************/
4 #include "../../include/config.h"
5 #include "../include/l1_confg.h"
6 #include "../include/l1_types.h"
7 #if(L1_BT_AUDIO==1)
8
9 /****************************************************
10 / Data structure defination
11 / ****************************************************/
12 #define BT_STATUS_ERROR 1
13 #define BT_STATUS_OK 0
14
15 /*-------------------------------------------------------------------------------
16 * L1AudioPcmStatus type
17 *
18 * Defines status of current PCM buffer
19 *
20 */
21 typedef unsigned char L1AudioPcmStatus;
22
23 #define L1_PCM_READY (0x01) /* the next PCM block is ready */
24 #define L1_PCM_PENDING (0x02) /* the next PCM block is not ready yet.
25 a callback will be made when it will be ready */
26 #define L1_PCM_MEDIA_ENDED (0x03) /* no PCM blocks are available anymore.
27 (e.g. current track ended) */
28 #define L1_PCM_FAILED (0x04) /* no PCM blocks are ready. general failure */
29
30 typedef struct _L1AudioPcmBlock
31 {
32 UWORD8 *pcmBuffer; /* a pointer to the buffer holding the PCM data */
33 int lengthInBytes; /* how many bytes are currently in the PCM buffer */
34 } L1AudioPcmBlock;
35
36 /****************************************************/
37 typedef struct _L1AudioPcmConfig
38 {
39 int sampleRate; /* PCM sample rate in Hz (e.g. 44100, 48000, 32000, 16000) */
40 short numChannels; /* number of audio channels (1 or 2, for mono or stereo) */
41 short bitsPerSample; /* number of bits per PCM sample. must always be 16. */
42 } L1AudioPcmConfig;
43 /****************************************************/
44
45 /****************************************************/
46 typedef void (*L1AudioPcmCallback)(L1AudioPcmBlock *pcmBlock);
47 /*Description:- A callback function, implemented at BTHAL_MM, which will be called by L1-MCU to send a ready PCM block.
48 The callback will be called by L1-MCU only after a previous call from BTHAL_MM to request a PCM block returned Pending.
49 NOTE: Since the callback is called from L1 context, the BTHAL_MM code should not spend considerable time in this function.
50 It must not block the L1-MCU task.
51
52 Parameters:
53 pcmBlock [in] - a pointer to a PCM block structure
54 Returns: void
55 */
56
57 /****************************************************/
58 typedef void (*L1AudioConfigureCallback) (L1AudioPcmConfig *pcmConfig);
59
60 /*Description:- A callback function, implemented at BTHAL_MM, that will be called by MCU-L1 to specify the next PCM configuration.
61 L1-MCU will call this function before a new audio track is going to start playing. BT side will use this info to reconfigure the current
62 A2DP stream, and after the configuration is completed, it will start pulling PCM blocks from the L1-MCU stack.
63 Parameters: pcmConfig [in] - pointer to struct with the PCM config info
64 */
65
66 /****************************************************/
67
68
69 BOOL L1Audio_InformBtAudioPathState (BOOL connected);
70 /*Description: - This function is implemented in L1-MCU and called by BTHAL_MM to inform L1,
71 whether the audio path to BT is up or down. The use of this function is optional. It should be used by BTHAL_MM,
72 to find out that L1-MCU is not being told byBMI/MMI, whether to use the BT audio or not.
73
74 Parameters:- connected [in] -
75 TRUE - path is valid, MM should send the PCM to BT
76 FALSE - path is not valid, MM should send the PCM to handset default audio device
77 Returns: void
78 */
79
80 /****************************************************/
81 void L1Audio_RegisterBthal (L1AudioPcmCallback pcmCallback, L1AudioConfigureCallback configCallback);
82 /*Description: - This function is implemented in L1-MCU and called by BTHAL_MM to init the L1-MCU for BT audio
83 and to register callback functions that the L1-MCU will need to call into BTHAL.
84
85 Parameters:
86 pcmCallback [in] - pointer of the PCM callback function.
87 configCallback [in] - pointer of the config callback function.
88 Returns: void
89 */
90
91
92 /****************************************************/
93 L1AudioPcmStatus L1Audio_PullPcmBlock (L1AudioPcmBlock *pcmBlock);
94 /*Description: - This function is implemented in L1-MCU and called by BTHAL_MM to pull the next PCM block.
95 If L1 already has a ready PCM block it should fill he pcmBlock parameter and return L1_PCM_READY.
96 If a block is not ready yet, it should return with proper return type as defined below.
97
98 Parameters:
99 pcmBlock [out] - a pointer to PCM block struct. if the function returns MM_PCM_READY, MM should fill this struct with the info of the current ready PCM block .
100 Returns:
101 L1_PCM_READY: The next PCM block is ready now
102 L1_PCM_PENDING: The next PCM block is not ready yet, a callback will be made by MM when it is ready
103 L1_PCM_MEDIA_ENDED: no more PCM blocks will be available anymore for the current track
104 L1_PCM_FAILED: other failures
105 */
106
107 /****************************************************/
108
109 #endif