collab/mm20
git clone https://git.julia.blue/collab/mm20
0548bd1
firmware
1#include <stdbool.h> 2#include <stdint.h> 3//***************************************************************************** 4// 5// ssi.h - Prototypes for the Synchronous Serial Interface Driver. 6// 7// Copyright (c) 2005-2017 Texas Instruments Incorporated. All rights reserved. 8// Software License Agreement 9// 10// Redistribution and use in source and binary forms, with or without 11// modification, are permitted provided that the following conditions 12// are met: 13// 14// Redistributions of source code must retain the above copyright 15// notice, this list of conditions and the following disclaimer. 16// 17// Redistributions in binary form must reproduce the above copyright 18// notice, this list of conditions and the following disclaimer in the 19// documentation and/or other materials provided with the 20// distribution. 21// 22// Neither the name of Texas Instruments Incorporated nor the names of 23// its contributors may be used to endorse or promote products derived 24// from this software without specific prior written permission. 25// 26// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37// 38// This is part of revision 2.1.4.178 of the Tiva Peripheral Driver Library. 39// 40//***************************************************************************** 41 42#ifndef __DRIVERLIB_SSI_H__ 43#define __DRIVERLIB_SSI_H__ 44 45//***************************************************************************** 46// 47// If building with a C++ compiler, make all of the definitions in this header 48// have a C binding. 49// 50//***************************************************************************** 51#ifdef __cplusplus 52extern "C" 53{ 54#endif 55 56//***************************************************************************** 57// 58// Values that can be passed to SSIIntEnable, SSIIntDisable, and SSIIntClear 59// as the ui32IntFlags parameter, and returned by SSIIntStatus. 60// 61//***************************************************************************** 62#define SSI_TXEOT 0x00000040 // Transmit FIFO is empty 63#define SSI_DMATX 0x00000020 // DMA Transmit complete 64#define SSI_DMARX 0x00000010 // DMA Receive complete 65#define SSI_TXFF 0x00000008 // TX FIFO half full or less 66#define SSI_RXFF 0x00000004 // RX FIFO half full or more 67#define SSI_RXTO 0x00000002 // RX timeout 68#define SSI_RXOR 0x00000001 // RX overrun 69 70//***************************************************************************** 71// 72// Values that can be passed to SSIConfigSetExpClk. 73// 74//***************************************************************************** 75#define SSI_FRF_MOTO_MODE_0 0x00000000 // Moto fmt, polarity 0, phase 0 76#define SSI_FRF_MOTO_MODE_1 0x00000002 // Moto fmt, polarity 0, phase 1 77#define SSI_FRF_MOTO_MODE_2 0x00000001 // Moto fmt, polarity 1, phase 0 78#define SSI_FRF_MOTO_MODE_3 0x00000003 // Moto fmt, polarity 1, phase 1 79#define SSI_FRF_TI 0x00000010 // TI frame format 80#define SSI_FRF_NMW 0x00000020 // National MicroWire frame format 81 82#define SSI_MODE_MASTER 0x00000000 // SSI master 83#define SSI_MODE_SLAVE 0x00000001 // SSI slave 84#define SSI_MODE_SLAVE_OD 0x00000002 // SSI slave with output disabled 85 86//***************************************************************************** 87// 88// Values that can be passed to SSIDMAEnable() and SSIDMADisable(). 89// 90//***************************************************************************** 91#define SSI_DMA_TX 0x00000002 // Enable DMA for transmit 92#define SSI_DMA_RX 0x00000001 // Enable DMA for receive 93 94//***************************************************************************** 95// 96// Values that can be passed to SSIClockSourceSet() or returned from 97// SSIClockSourceGet(). 98// 99//***************************************************************************** 100#define SSI_CLOCK_SYSTEM 0x00000000 101#define SSI_CLOCK_PIOSC 0x00000005 102 103//***************************************************************************** 104// 105// Values that can be passed to SSIAdvModeSet(). 106// 107//***************************************************************************** 108#define SSI_ADV_MODE_LEGACY 0x00000000 109#define SSI_ADV_MODE_READ_WRITE 0x000001c0 110#define SSI_ADV_MODE_WRITE 0x000000c0 111#define SSI_ADV_MODE_BI_READ 0x00000140 112#define SSI_ADV_MODE_BI_WRITE 0x00000040 113#define SSI_ADV_MODE_QUAD_READ 0x00000180 114#define SSI_ADV_MODE_QUAD_WRITE 0x00000080 115 116//***************************************************************************** 117// 118// Prototypes for the APIs. 119// 120//***************************************************************************** 121extern void SSIConfigSetExpClk (uint32_t ui32Base ,uint32_t ui32SSIClk , 122uint32_t ui32Protocol ,uint32_t ui32Mode , 123uint32_t ui32BitRate , 124uint32_t ui32DataWidth ); 125extern void SSIDataGet (uint32_t ui32Base ,uint32_t * pui32Data ); 126extern int32_t SSIDataGetNonBlocking (uint32_t ui32Base , 127uint32_t * pui32Data ); 128extern void SSIDataPut (uint32_t ui32Base ,uint32_t ui32Data ); 129extern int32_t SSIDataPutNonBlocking (uint32_t ui32Base ,uint32_t ui32Data ); 130extern void SSIDisable (uint32_t ui32Base ); 131extern void SSIEnable (uint32_t ui32Base ); 132extern void SSIIntClear (uint32_t ui32Base ,uint32_t ui32IntFlags ); 133extern void SSIIntDisable (uint32_t ui32Base ,uint32_t ui32IntFlags ); 134extern void SSIIntEnable (uint32_t ui32Base ,uint32_t ui32IntFlags ); 135extern void SSIIntRegister (uint32_t ui32Base ,void (* pfnHandler )(void )); 136extern uint32_t SSIIntStatus (uint32_t ui32Base ,bool bMasked ); 137extern void SSIIntUnregister (uint32_t ui32Base ); 138extern void SSIDMAEnable (uint32_t ui32Base ,uint32_t ui32DMAFlags ); 139extern void SSIDMADisable (uint32_t ui32Base ,uint32_t ui32DMAFlags ); 140extern bool SSIBusy (uint32_t ui32Base ); 141extern void SSIClockSourceSet (uint32_t ui32Base ,uint32_t ui32Source ); 142extern uint32_t SSIClockSourceGet (uint32_t ui32Base ); 143extern void SSIAdvModeSet (uint32_t ui32Base ,uint32_t ui32Mode ); 144extern void SSIAdvDataPutFrameEnd (uint32_t ui32Base ,uint32_t ui32Data ); 145extern int32_t SSIAdvDataPutFrameEndNonBlocking (uint32_t ui32Base , 146uint32_t ui32Data ); 147extern void SSIAdvFrameHoldEnable (uint32_t ui32Base ); 148extern void SSIAdvFrameHoldDisable (uint32_t ui32Base ); 149 150//***************************************************************************** 151// 152// Mark the end of the C bindings section for C++ compilers. 153// 154//***************************************************************************** 155#ifdef __cplusplus 156} 157#endif 158 159#endif // __DRIVERLIB_SSI_H__