LPCOpen Platform
v1.03
LPCOpen Platform for NXP LPC Microcontrollers
Main Page
Modules
Data Structures
Files
Related Pages
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
spi_17xx_40xx.h
Go to the documentation of this file.
1
/*
2
* @brief LPC17xx/40xx SPI driver
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_17XX_40XX_H_
33
#define __SPI_17XX_40XX_H_
34
35
#ifdef __cplusplus
36
extern
"C"
{
37
#endif
38
44
#define CHIP_SPI_CLOCK_MODE_T IP_SPI_CLOCK_MODE_T
45
#define CHIP_SPI_MODE_T IP_SPI_MODE_T
46
#define CHIP_SPI_DATA_ORDER_T IP_SPI_DATA_ORDER_T
47
#define CHIP_SPI_BITS_T IP_SPI_BITS_T
48
50
typedef
void (*
CHIP_SPI_CALLBACK_T
)(void);
51
/*
52
* @brief SPI config format
53
*/
54
typedef
struct
CHIP_SPI_CONFIG_FORMAT_T
{
55
CHIP_SPI_BITS_T
bits
;
56
CHIP_SPI_CLOCK_MODE_T
clockMode
;
57
CHIP_SPI_DATA_ORDER_T
dataOrder
;
58
}
CHIP_SPI_CONFIG_FORMAT_T
;
59
60
/*
61
* @brief SPI data setup structure
62
*/
63
typedef
struct
{
64
uint8_t *
pTxData
;
65
uint8_t *
pRxData
;
66
uint32_t
cnt
;
67
uint32_t
length
;
68
CHIP_SPI_CALLBACK_T
fnBefFrame
;
69
CHIP_SPI_CALLBACK_T
fnAftFrame
;
70
CHIP_SPI_CALLBACK_T
fnBefTransfer
;
71
CHIP_SPI_CALLBACK_T
fnAftTransfer
;
72
}
CHIP_SPI_DATA_SETUP_T
;
73
78
STATIC
INLINE
uint32_t
Chip_SPI_GetStatus
(
LPC_SPI_T
*pSPI)
79
{
80
return
IP_SPI_GetStatus
(pSPI);
81
}
82
88
void
Chip_SPI_Int_FlushData
(
LPC_SPI_T
*pSPI);
89
97
Status
Chip_SPI_Int_RWFrames8Bits
(
LPC_SPI_T
*pSPI,
CHIP_SPI_DATA_SETUP_T
*
xf_setup
);
98
106
Status
Chip_SPI_Int_RWFrames16Bits
(
LPC_SPI_T
*pSPI,
CHIP_SPI_DATA_SETUP_T
*
xf_setup
);
107
119
uint32_t
Chip_SPI_RWFrames_Blocking
(
LPC_SPI_T
*pSPI,
CHIP_SPI_DATA_SETUP_T
*pXfSetup);
120
131
uint32_t
Chip_SPI_WriteFrames_Blocking
(
LPC_SPI_T
*pSPI, uint8_t *
buffer
,
uint32_t
buffer_len);
132
143
uint32_t
Chip_SPI_ReadFrames_Blocking
(
LPC_SPI_T
*pSPI, uint8_t *
buffer
,
uint32_t
buffer_len);
144
150
void
Chip_SPI_Init
(
LPC_SPI_T
*pSPI);
151
158
void
Chip_SPI_DeInit
(
LPC_SPI_T
*pSPI);
159
166
STATIC
INLINE
void
Chip_SPI_SetMode
(
LPC_SPI_T
*pSPI,
CHIP_SPI_MODE_T
mode)
167
{
168
IP_SPI_SetMode
(pSPI, mode);
169
}
170
177
void
Chip_SPI_SetBitRate
(
LPC_SPI_T
*pSPI,
uint32_t
bitRate);
178
185
STATIC
INLINE
void
Chip_SPI_SetFormat
(
LPC_SPI_T
*pSPI,
CHIP_SPI_CONFIG_FORMAT_T
*format)
186
{
187
IP_SPI_SetFormat
(pSPI, format->
bits
, format->
clockMode
, format->
dataOrder
);
188
}
189
195
STATIC
INLINE
void
Chip_SPI_Int_Enable
(
LPC_SPI_T
*pSPI)
196
{
197
IP_SPI_IntEnable
(pSPI);
198
}
199
205
STATIC
INLINE
void
Chip_SPI_Int_Disable
(
LPC_SPI_T
*pSPI)
206
{
207
IP_SPI_IntDisable
(pSPI);
208
}
209
214
#ifdef __cplusplus
215
}
216
#endif
217
218
#endif
/* __SPI_17XX_40XX_H_ */
software
lpc_core
lpc_chip
chip_17xx_40xx
spi_17xx_40xx.h
Generated on Fri May 10 2013 10:42:14 for LPCOpen Platform by
1.8.2