1 |
608 |
jeremybenn |
/* ----------------------------------------------------------------------------
|
2 |
|
|
* ATMEL Microcontroller Software Support
|
3 |
|
|
* ----------------------------------------------------------------------------
|
4 |
|
|
* Copyright (c) 2008, Atmel Corporation
|
5 |
|
|
*
|
6 |
|
|
* All rights reserved.
|
7 |
|
|
*
|
8 |
|
|
* Redistribution and use in source and binary forms, with or without
|
9 |
|
|
* modification, are permitted provided that the following conditions are met:
|
10 |
|
|
*
|
11 |
|
|
* - Redistributions of source code must retain the above copyright notice,
|
12 |
|
|
* this list of conditions and the disclaimer below.
|
13 |
|
|
*
|
14 |
|
|
* Atmel's name may not be used to endorse or promote products derived from
|
15 |
|
|
* this software without specific prior written permission.
|
16 |
|
|
*
|
17 |
|
|
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
18 |
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
19 |
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
20 |
|
|
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
21 |
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22 |
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
23 |
|
|
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
24 |
|
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
25 |
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
26 |
|
|
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27 |
|
|
* ----------------------------------------------------------------------------
|
28 |
|
|
*/
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
#ifndef AC97C_H
|
32 |
|
|
#define AC97C_H
|
33 |
|
|
|
34 |
|
|
//------------------------------------------------------------------------------
|
35 |
|
|
// Constants
|
36 |
|
|
//------------------------------------------------------------------------------
|
37 |
|
|
|
38 |
|
|
/// The channel is already busy with a transfer.
|
39 |
|
|
#define AC97C_ERROR_BUSY 1
|
40 |
|
|
/// The transfer has been stopped by the user.
|
41 |
|
|
#define AC97C_ERROR_STOPPED 2
|
42 |
|
|
|
43 |
|
|
/// Codec channel index.
|
44 |
|
|
#define AC97C_CHANNEL_CODEC 0
|
45 |
|
|
/// Channel A index.
|
46 |
|
|
#define AC97C_CHANNEL_A 1
|
47 |
|
|
/// Channel B index.
|
48 |
|
|
#define AC97C_CHANNEL_B 2
|
49 |
|
|
|
50 |
|
|
/// Codec transmit/receive transfer index.
|
51 |
|
|
#define AC97C_CODEC_TRANSFER 0
|
52 |
|
|
/// Channel A receive transfer index.
|
53 |
|
|
#define AC97C_CHANNEL_A_RECEIVE 1
|
54 |
|
|
/// Channel A transmit transfer index.
|
55 |
|
|
#define AC97C_CHANNEL_A_TRANSMIT 2
|
56 |
|
|
/// Channel B receive transfer index.
|
57 |
|
|
#define AC97C_CHANNEL_B_RECEIVE 3
|
58 |
|
|
/// Channel B transmit transfer index.
|
59 |
|
|
#define AC97C_CHANNEL_B_TRANSMIT 4
|
60 |
|
|
|
61 |
|
|
//------------------------------------------------------------------------------
|
62 |
|
|
// Types
|
63 |
|
|
//------------------------------------------------------------------------------
|
64 |
|
|
|
65 |
|
|
/// AC97C transfer callback function.
|
66 |
|
|
typedef void (*Ac97Callback)(void *pArg,
|
67 |
|
|
unsigned char status,
|
68 |
|
|
unsigned int remaining);
|
69 |
|
|
|
70 |
|
|
//------------------------------------------------------------------------------
|
71 |
|
|
// Exported functions
|
72 |
|
|
//------------------------------------------------------------------------------
|
73 |
|
|
|
74 |
|
|
extern void AC97C_Configure();
|
75 |
|
|
|
76 |
|
|
extern void AC97C_ConfigureChannel(unsigned char channel, unsigned int cfg);
|
77 |
|
|
|
78 |
|
|
extern void AC97C_AssignInputSlots(unsigned char channel, unsigned int slots);
|
79 |
|
|
|
80 |
|
|
extern void AC97C_AssignOutputSlots(unsigned char channel, unsigned int slots);
|
81 |
|
|
|
82 |
|
|
extern unsigned char AC97C_Transfer(
|
83 |
|
|
unsigned char channel,
|
84 |
|
|
unsigned char *pBuffer,
|
85 |
|
|
unsigned int numSamples,
|
86 |
|
|
Ac97Callback callback,
|
87 |
|
|
void *pArg);
|
88 |
|
|
|
89 |
|
|
extern unsigned char AC97C_IsFinished(unsigned char channel);
|
90 |
|
|
|
91 |
|
|
extern void AC97C_WriteCodec(unsigned char address, unsigned short data);
|
92 |
|
|
|
93 |
|
|
extern unsigned short AC97C_ReadCodec(unsigned char address);
|
94 |
|
|
|
95 |
|
|
extern void AC97C_SetChannelSize(unsigned char channel, unsigned char size);
|
96 |
|
|
|
97 |
|
|
extern void AC97C_CancelTransfer(unsigned char channel);
|
98 |
|
|
|
99 |
|
|
#endif //#ifndef AC97C_H
|
100 |
|
|
|