comparison gsm-fw/L1/audio_include/l1audio_btapi.h @ 603:d638de8cc6b8

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