i2s.h 6.5 KB
Newer Older
F
 
fengzi.rtt@gmail.com 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
//*****************************************************************************
//
// i2s.h - Prototypes and macros for the I2S controller.
//
// Copyright (c) 2008-2011 Texas Instruments Incorporated.  All rights reserved.
// Software License Agreement
// 
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
// 
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
// 
21
// This is part of revision 8264 of the Stellaris Peripheral Driver Library.
F
 
fengzi.rtt@gmail.com 已提交
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
//
//*****************************************************************************

#ifndef __I2S_H__
#define __I2S_H__

//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif

//*****************************************************************************
//
// Values that can be passed to I2STxConfigSet() and I2SRxConfigSet()
//
//*****************************************************************************
#define I2S_CONFIG_FORMAT_MASK  0x3C000000  //  JST,  DLY,  SCP,  LRP
#define I2S_CONFIG_FORMAT_I2S   0x14000000  // !JST,  DLY, !SCP,  LRP
#define I2S_CONFIG_FORMAT_LEFT_JUST \
                                0x00000000  // !JST, !DLY, !SCP, !LRP
#define I2S_CONFIG_FORMAT_RIGHT_JUST \
                                0x20000000  //  JST, !DLY, !SCP, !LRP

#define I2S_CONFIG_SCLK_INVERT  0x08000000

#define I2S_CONFIG_MODE_MASK    0x03000000
#define I2S_CONFIG_MODE_DUAL    0x00000000
#define I2S_CONFIG_MODE_COMPACT_16 \
                                0x01000000
#define I2S_CONFIG_MODE_COMPACT_8 \
                                0x03000000
#define I2S_CONFIG_MODE_MONO    0x02000000

#define I2S_CONFIG_EMPTY_MASK   0x00800000
#define I2S_CONFIG_EMPTY_ZERO   0x00000000
#define I2S_CONFIG_EMPTY_REPEAT 0x00800000

#define I2S_CONFIG_CLK_MASK     0x00400000
#define I2S_CONFIG_CLK_MASTER   0x00400000
#define I2S_CONFIG_CLK_SLAVE    0x00000000

#define I2S_CONFIG_SAMPLE_SIZE_MASK \
                                0x0000FC00
#define I2S_CONFIG_SAMPLE_SIZE_32 \
                                0x00007C00
#define I2S_CONFIG_SAMPLE_SIZE_24 \
                                0x00005C00
#define I2S_CONFIG_SAMPLE_SIZE_20 \
                                0x00004C00
#define I2S_CONFIG_SAMPLE_SIZE_16 \
                                0x00003C00
#define I2S_CONFIG_SAMPLE_SIZE_8 \
                                0x00001C00

#define I2S_CONFIG_WIRE_SIZE_MASK \
                                0x000003F0
#define I2S_CONFIG_WIRE_SIZE_32 0x000001F0
#define I2S_CONFIG_WIRE_SIZE_24 0x00000170
#define I2S_CONFIG_WIRE_SIZE_20 0x00000130
#define I2S_CONFIG_WIRE_SIZE_16 0x000000F0
#define I2S_CONFIG_WIRE_SIZE_8  0x00000070

//*****************************************************************************
//
// Values that can be passed to I2SMasterClockSelect()
//
//*****************************************************************************
#define I2S_TX_MCLK_EXT         0x00000010
#define I2S_TX_MCLK_INT         0x00000000
#define I2S_RX_MCLK_EXT         0x00000020
#define I2S_RX_MCLK_INT         0x00000000

//*****************************************************************************
//
// Values that can be passed to I2SIntEnable(), I2SIntDisable(), and
// I2SIntClear()
//
//*****************************************************************************
#define I2S_INT_RXERR           0x00000020
#define I2S_INT_RXREQ           0x00000010
#define I2S_INT_TXERR           0x00000002
#define I2S_INT_TXREQ           0x00000001

//*****************************************************************************
//
// API Function prototypes
//
//*****************************************************************************
extern void I2STxEnable(unsigned long ulBase);
extern void I2STxDisable(unsigned long ulBase);
extern void I2STxDataPut(unsigned long ulBase, unsigned long ulData);
extern long I2STxDataPutNonBlocking(unsigned long ulBase,
                                    unsigned long ulData);
extern void I2STxConfigSet(unsigned long ulBase, unsigned long ulConfig);
extern void I2STxFIFOLimitSet(unsigned long ulBase, unsigned long ulLevel);
extern unsigned long I2STxFIFOLimitGet(unsigned long ulBase);
extern unsigned long I2STxFIFOLevelGet(unsigned long ulBase);
extern void I2SRxEnable(unsigned long ulBase);
extern void I2SRxDisable(unsigned long ulBase);
extern void I2SRxDataGet(unsigned long ulBase, unsigned long *pulData);
extern long I2SRxDataGetNonBlocking(unsigned long ulBase,
                                    unsigned long *pulData);
extern void I2SRxConfigSet(unsigned long ulBase, unsigned long ulConfig);
extern void I2SRxFIFOLimitSet(unsigned long ulBase, unsigned long ulLevel);
extern unsigned long I2SRxFIFOLimitGet(unsigned long ulBase);
extern unsigned long I2SRxFIFOLevelGet(unsigned long ulBase);
extern void I2STxRxEnable(unsigned long ulBase);
extern void I2STxRxDisable(unsigned long ulBase);
extern void I2STxRxConfigSet(unsigned long ulBase, unsigned long ulConfig);
extern void I2SMasterClockSelect(unsigned long ulBase, unsigned long ulMClock);
extern void I2SIntEnable(unsigned long ulBase, unsigned long ulIntFlags);
extern void I2SIntDisable(unsigned long ulBase, unsigned long ulIntFlags);
extern unsigned long I2SIntStatus(unsigned long ulBase, tBoolean bMasked);
extern void I2SIntClear(unsigned long ulBase, unsigned long ulIntFlags);
extern void I2SIntRegister(unsigned long ulBase, void (*pfnHandler)(void));
extern void I2SIntUnregister(unsigned long ulBase);

//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif

#endif //  __I2S_H__