1 |
610 |
jeremybenn |
//*****************************************************************************
|
2 |
|
|
//
|
3 |
|
|
// ssi.h - Prototypes for the Synchronous Serial Interface Driver.
|
4 |
|
|
//
|
5 |
|
|
// Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved.
|
6 |
|
|
//
|
7 |
|
|
// Software License Agreement
|
8 |
|
|
//
|
9 |
|
|
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
|
10 |
|
|
// exclusively on LMI's microcontroller products.
|
11 |
|
|
//
|
12 |
|
|
// The software is owned by LMI and/or its suppliers, and is protected under
|
13 |
|
|
// applicable copyright laws. All rights are reserved. You may not combine
|
14 |
|
|
// this software with "viral" open-source software in order to form a larger
|
15 |
|
|
// program. Any use in violation of the foregoing restrictions may subject
|
16 |
|
|
// the user to criminal sanctions under applicable laws, as well as to civil
|
17 |
|
|
// liability for the breach of the terms and conditions of this license.
|
18 |
|
|
//
|
19 |
|
|
// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
20 |
|
|
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
21 |
|
|
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
22 |
|
|
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
|
23 |
|
|
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
|
24 |
|
|
//
|
25 |
|
|
// This is part of revision 2523 of the Stellaris Peripheral Driver Library.
|
26 |
|
|
//
|
27 |
|
|
//*****************************************************************************
|
28 |
|
|
|
29 |
|
|
#ifndef __SSI_H__
|
30 |
|
|
#define __SSI_H__
|
31 |
|
|
|
32 |
|
|
//*****************************************************************************
|
33 |
|
|
//
|
34 |
|
|
// If building with a C++ compiler, make all of the definitions in this header
|
35 |
|
|
// have a C binding.
|
36 |
|
|
//
|
37 |
|
|
//*****************************************************************************
|
38 |
|
|
#ifdef __cplusplus
|
39 |
|
|
extern "C"
|
40 |
|
|
{
|
41 |
|
|
#endif
|
42 |
|
|
|
43 |
|
|
//*****************************************************************************
|
44 |
|
|
//
|
45 |
|
|
// Values that can be passed to SSIIntEnable, SSIIntDisable, and SSIIntClear
|
46 |
|
|
// as the ulIntFlags parameter, and returned by SSIIntStatus.
|
47 |
|
|
//
|
48 |
|
|
//*****************************************************************************
|
49 |
|
|
#define SSI_TXFF 0x00000008 // TX FIFO half empty or less
|
50 |
|
|
#define SSI_RXFF 0x00000004 // RX FIFO half full or less
|
51 |
|
|
#define SSI_RXTO 0x00000002 // RX timeout
|
52 |
|
|
#define SSI_RXOR 0x00000001 // RX overrun
|
53 |
|
|
|
54 |
|
|
//*****************************************************************************
|
55 |
|
|
//
|
56 |
|
|
// Values that can be passed to SSIConfigSetExpClk.
|
57 |
|
|
//
|
58 |
|
|
//*****************************************************************************
|
59 |
|
|
#define SSI_FRF_MOTO_MODE_0 0x00000000 // Moto fmt, polarity 0, phase 0
|
60 |
|
|
#define SSI_FRF_MOTO_MODE_1 0x00000002 // Moto fmt, polarity 0, phase 1
|
61 |
|
|
#define SSI_FRF_MOTO_MODE_2 0x00000001 // Moto fmt, polarity 1, phase 0
|
62 |
|
|
#define SSI_FRF_MOTO_MODE_3 0x00000003 // Moto fmt, polarity 1, phase 1
|
63 |
|
|
#define SSI_FRF_TI 0x00000010 // TI frame format
|
64 |
|
|
#define SSI_FRF_NMW 0x00000020 // National MicroWire frame format
|
65 |
|
|
|
66 |
|
|
#define SSI_MODE_MASTER 0x00000000 // SSI master
|
67 |
|
|
#define SSI_MODE_SLAVE 0x00000001 // SSI slave
|
68 |
|
|
#define SSI_MODE_SLAVE_OD 0x00000002 // SSI slave with output disabled
|
69 |
|
|
|
70 |
|
|
//*****************************************************************************
|
71 |
|
|
//
|
72 |
|
|
// Values that can be passed to SSIDMAEnable() and SSIDMADisable().
|
73 |
|
|
//
|
74 |
|
|
//*****************************************************************************
|
75 |
|
|
#define SSI_DMA_TX 0x00000002 // Enable DMA for transmit
|
76 |
|
|
#define SSI_DMA_RX 0x00000001 // Enable DMA for receive
|
77 |
|
|
|
78 |
|
|
//*****************************************************************************
|
79 |
|
|
//
|
80 |
|
|
// Prototypes for the APIs.
|
81 |
|
|
//
|
82 |
|
|
//*****************************************************************************
|
83 |
|
|
extern void SSIConfigSetExpClk(unsigned long ulBase, unsigned long ulSSIClk,
|
84 |
|
|
unsigned long ulProtocol, unsigned long ulMode,
|
85 |
|
|
unsigned long ulBitRate,
|
86 |
|
|
unsigned long ulDataWidth);
|
87 |
|
|
extern void SSIDataGet(unsigned long ulBase, unsigned long *pulData);
|
88 |
|
|
extern long SSIDataGetNonBlocking(unsigned long ulBase,
|
89 |
|
|
unsigned long *pulData);
|
90 |
|
|
extern void SSIDataPut(unsigned long ulBase, unsigned long ulData);
|
91 |
|
|
extern long SSIDataPutNonBlocking(unsigned long ulBase, unsigned long ulData);
|
92 |
|
|
extern void SSIDisable(unsigned long ulBase);
|
93 |
|
|
extern void SSIEnable(unsigned long ulBase);
|
94 |
|
|
extern void SSIIntClear(unsigned long ulBase, unsigned long ulIntFlags);
|
95 |
|
|
extern void SSIIntDisable(unsigned long ulBase, unsigned long ulIntFlags);
|
96 |
|
|
extern void SSIIntEnable(unsigned long ulBase, unsigned long ulIntFlags);
|
97 |
|
|
extern void SSIIntRegister(unsigned long ulBase, void(*pfnHandler)(void));
|
98 |
|
|
extern unsigned long SSIIntStatus(unsigned long ulBase, tBoolean bMasked);
|
99 |
|
|
extern void SSIIntUnregister(unsigned long ulBase);
|
100 |
|
|
extern void SSIDMAEnable(unsigned long ulBase, unsigned long ulDMAFlags);
|
101 |
|
|
extern void SSIDMADisable(unsigned long ulBase, unsigned long ulDMAFlags);
|
102 |
|
|
|
103 |
|
|
//*****************************************************************************
|
104 |
|
|
//
|
105 |
|
|
// Several SSI APIs have been renamed, with the original function name being
|
106 |
|
|
// deprecated. These defines provide backward compatibility.
|
107 |
|
|
//
|
108 |
|
|
//*****************************************************************************
|
109 |
|
|
#ifndef DEPRECATED
|
110 |
|
|
#include "sysctl.h"
|
111 |
|
|
#define SSIConfig(a, b, c, d, e) \
|
112 |
|
|
SSIConfigSetExpClk(a, SysCtlClockGet(), b, c, d, e)
|
113 |
|
|
#define SSIDataNonBlockingGet(a, b) \
|
114 |
|
|
SSIDataGetNonBlocking(a, b)
|
115 |
|
|
#define SSIDataNonBlockingPut(a, b) \
|
116 |
|
|
SSIDataPutNonBlocking(a, b)
|
117 |
|
|
#endif
|
118 |
|
|
|
119 |
|
|
//*****************************************************************************
|
120 |
|
|
//
|
121 |
|
|
// Mark the end of the C bindings section for C++ compilers.
|
122 |
|
|
//
|
123 |
|
|
//*****************************************************************************
|
124 |
|
|
#ifdef __cplusplus
|
125 |
|
|
}
|
126 |
|
|
#endif
|
127 |
|
|
|
128 |
|
|
#endif // __SSI_H__
|