LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
spi_8xx.h
Go to the documentation of this file.
1 /*
2  * @brief LPC8xx SPI inclusion file
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2012
6  * All rights reserved.
7  *
8  * @par
9  * Software that is described herein is for illustrative purposes only
10  * which provides customers with programming information regarding the
11  * LPC products. This software is supplied "AS IS" without any warranties of
12  * any kind, and NXP Semiconductors and its licensor disclaim any and
13  * all warranties, express or implied, including all implied warranties of
14  * merchantability, fitness for a particular purpose and non-infringement of
15  * intellectual property rights. NXP Semiconductors assumes no responsibility
16  * or liability for the use of the software, conveys no license or rights under any
17  * patent, copyright, mask work right, or any other intellectual property rights in
18  * or to any products. NXP Semiconductors reserves the right to make changes
19  * in the software without notification. NXP Semiconductors also makes no
20  * representation or warranty that such application will be suitable for the
21  * specified use without further testing or modification.
22  *
23  * @par
24  * Permission to use, copy, modify, and distribute this software and its
25  * documentation is hereby granted, under NXP Semiconductors' and its
26  * licensor's relevant copyrights in the software, without fee, provided that it
27  * is used in conjunction with NXP Semiconductors microcontrollers. This
28  * copyright, permission, and disclaimer notice must appear in all copies of
29  * this code.
30  */
31 
32 #ifndef __SPI_8XX_H_
33 #define __SPI_8XX_H_
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
49 
53 typedef struct {
54  uint16_t *pTx;
55  uint32_t TxCnt;/* Transmit Counter */
56  uint16_t *pRx;
57  uint32_t RxCnt;/* Transmit Counter */
59  uint16_t DataSize;
61 
68 void Chip_SPI_Init(LPC_SPI_T *pSPI, SPI_CONFIG_T *pConfig);
69 
77 
85 STATIC INLINE void Chip_SPI_DelayConfig(LPC_SPI_T *pSPI, SPI_DELAY_CONFIG_T *pConfig)
86 {
87  IP_SPI_DelayConfig(pSPI, pConfig);
88 }
89 
96 void Chip_SPI_DeInit(LPC_SPI_T *pSPI);
97 
105 void Chip_SPI_Int_Cmd(LPC_SPI_T *pSPI, uint32_t IntMask, FunctionalState NewState);
106 
113 {
114  IP_SPI_Enable(pSPI);
115 }
116 
123 {
124  IP_SPI_Disable(pSPI);
125 }
126 
135 {
136  IP_SPI_EnableLoopBack(pSPI);
137 }
138 
147 {
149 }
150 
157 {
158  return IP_SPI_GetStatus(pSPI);
159 }
160 
168 STATIC INLINE void Chip_SPI_SendFirstFrame_RxIgnore(LPC_SPI_T *pSPI, uint16_t Data, uint8_t DataSize)
169 {
171  Data,
172  DataSize,
174 }
175 
183 STATIC INLINE void Chip_SPI_SendFirstFrame(LPC_SPI_T *pSPI, uint16_t Data, uint8_t DataSize)
184 {
186 }
187 
194 STATIC INLINE void Chip_SPI_SendMidFrame(LPC_SPI_T *pSPI, uint16_t Data)
195 {
196  IP_SPI_SendFrame(pSPI, Data);
197 }
198 
206 STATIC INLINE void Chip_SPI_SendLastFrame_RxIgnore(LPC_SPI_T *pSPI, uint16_t Data, uint8_t DataSize)
207 {
209  Data,
210  DataSize,
212 }
213 
221 STATIC INLINE void Chip_SPI_SendLastFrame(LPC_SPI_T *pSPI, uint16_t Data, uint8_t DataSize)
222 {
224 }
225 
232 {
233  return IP_SPI_ReceiveFrame(pSPI);
234 }
235 
244 
257 
269 
281 
286 #ifdef __cplusplus
287 }
288 #endif
289 
290 #endif /* __SPI_8XX_H_ */