1 |
577 |
jeremybenn |
/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
|
2 |
|
|
* File Name : 75x_SSP.h
|
3 |
|
|
* Author : MCD Application Team
|
4 |
|
|
* Date First Issued : 03/10/2006
|
5 |
|
|
* Description : This file contains all the functions prototypes for the
|
6 |
|
|
* SSP software library.
|
7 |
|
|
********************************************************************************
|
8 |
|
|
* History:
|
9 |
|
|
* 07/17/2006 : V1.0
|
10 |
|
|
* 03/10/2006 : V0.1
|
11 |
|
|
********************************************************************************
|
12 |
|
|
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
13 |
|
|
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
14 |
|
|
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
15 |
|
|
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
16 |
|
|
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
17 |
|
|
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
18 |
|
|
*******************************************************************************/
|
19 |
|
|
|
20 |
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
21 |
|
|
#ifndef __75x_SSP_H
|
22 |
|
|
#define __75x_SSP_H
|
23 |
|
|
|
24 |
|
|
/* Includes ------------------------------------------------------------------*/
|
25 |
|
|
#include "75x_map.h"
|
26 |
|
|
|
27 |
|
|
/* Exported types ------------------------------------------------------------*/
|
28 |
|
|
/* SSP Init structure definition */
|
29 |
|
|
typedef struct
|
30 |
|
|
{
|
31 |
|
|
u16 SSP_FrameFormat;
|
32 |
|
|
u16 SSP_Mode;
|
33 |
|
|
u16 SSP_CPOL;
|
34 |
|
|
u16 SSP_CPHA;
|
35 |
|
|
u16 SSP_DataSize;
|
36 |
|
|
u16 SSP_NSS;
|
37 |
|
|
u16 SSP_SlaveOutput;
|
38 |
|
|
u8 SSP_ClockRate;
|
39 |
|
|
u8 SSP_ClockPrescaler;
|
40 |
|
|
}SSP_InitTypeDef;
|
41 |
|
|
|
42 |
|
|
/* Exported constants --------------------------------------------------------*/
|
43 |
|
|
/* SSP Frame Format Select */
|
44 |
|
|
#define SSP_FrameFormat_TI 0x0010
|
45 |
|
|
#define SSP_FrameFormat_Motorola 0xFFCF
|
46 |
|
|
|
47 |
|
|
/* SSP Master/Slave Select */
|
48 |
|
|
#define SSP_Mode_Master 0xFFFB
|
49 |
|
|
#define SSP_Mode_Slave 0x0004
|
50 |
|
|
|
51 |
|
|
/* SSP Clock Polarity */
|
52 |
|
|
#define SSP_CPOL_Low 0xFFBF
|
53 |
|
|
#define SSP_CPOL_High 0x0040
|
54 |
|
|
|
55 |
|
|
/* SSP Clock Phase */
|
56 |
|
|
#define SSP_CPHA_1Edge 0xFF7F
|
57 |
|
|
#define SSP_CPHA_2Edge 0x0080
|
58 |
|
|
|
59 |
|
|
/* SSP Data Size */
|
60 |
|
|
#define SSP_DataSize_16b 0x000F
|
61 |
|
|
#define SSP_DataSize_15b 0x000E
|
62 |
|
|
#define SSP_DataSize_14b 0x000D
|
63 |
|
|
#define SSP_DataSize_13b 0x000C
|
64 |
|
|
#define SSP_DataSize_12b 0x000B
|
65 |
|
|
#define SSP_DataSize_11b 0x000A
|
66 |
|
|
#define SSP_DataSize_10b 0x0009
|
67 |
|
|
#define SSP_DataSize_9b 0x0008
|
68 |
|
|
#define SSP_DataSize_8b 0x0007
|
69 |
|
|
#define SSP_DataSize_7b 0x0006
|
70 |
|
|
#define SSP_DataSize_6b 0x0005
|
71 |
|
|
#define SSP_DataSize_5b 0x0004
|
72 |
|
|
#define SSP_DataSize_4b 0x0003
|
73 |
|
|
|
74 |
|
|
/* SSP Slave Select management config */
|
75 |
|
|
#define SSP_NSS_Hard 0xFFEF
|
76 |
|
|
#define SSP_NSS_Soft 0x0010
|
77 |
|
|
|
78 |
|
|
/* SSP NSS internal config */
|
79 |
|
|
#define SSP_NSSInternal_Set 0x0020
|
80 |
|
|
#define SSP_NSSInternal_Reset 0xFFDF
|
81 |
|
|
|
82 |
|
|
/* SSP Slave output config */
|
83 |
|
|
#define SSP_SlaveOutput_Enable 0xFFF7
|
84 |
|
|
#define SSP_SlaveOutput_Disable 0x0008
|
85 |
|
|
|
86 |
|
|
/* SSP Interrupts */
|
87 |
|
|
#define SSP_IT_TxFifo 0x0008
|
88 |
|
|
#define SSP_IT_RxFifo 0x0004
|
89 |
|
|
#define SSP_IT_RxTimeOut 0x0002
|
90 |
|
|
#define SSP_IT_RxOverrun 0x0001
|
91 |
|
|
|
92 |
|
|
/* SSP Flags */
|
93 |
|
|
#define SSP_FLAG_Busy 0x0024
|
94 |
|
|
#define SSP_FLAG_RxFifoFull 0x0023
|
95 |
|
|
#define SSP_FLAG_RxFifoNotEmpty 0x0022
|
96 |
|
|
#define SSP_FLAG_TxFifoNotFull 0x0021
|
97 |
|
|
#define SSP_FLAG_TxFifoEmpty 0x0020
|
98 |
|
|
#define SSP_FLAG_TxFifo 0x0043
|
99 |
|
|
#define SSP_FLAG_RxFifo 0x0042
|
100 |
|
|
#define SSP_FLAG_RxTimeOut 0x0041
|
101 |
|
|
#define SSP_FLAG_RxOverrun 0x0040
|
102 |
|
|
|
103 |
|
|
/* SSP DMA Requests */
|
104 |
|
|
#define SSP0_DMA_Transmit 0x0002
|
105 |
|
|
#define SSP0_DMA_Receive 0x0001
|
106 |
|
|
|
107 |
|
|
#define SSP0_DMATxReq_Single 0xFFF7
|
108 |
|
|
#define SSP0_DMATxReq_Burst 0x0008
|
109 |
|
|
|
110 |
|
|
#define SSP0_DMARxReq_Single 0xFFFB
|
111 |
|
|
#define SSP0_DMARxReq_Burst 0x0004
|
112 |
|
|
|
113 |
|
|
/* Exported macro ------------------------------------------------------------*/
|
114 |
|
|
/* Exported functions ------------------------------------------------------- */
|
115 |
|
|
|
116 |
|
|
void SSP_DeInit(SSP_TypeDef* SSPx);
|
117 |
|
|
void SSP_Init(SSP_TypeDef* SSPx, SSP_InitTypeDef* SSP_InitStruct);
|
118 |
|
|
void SSP_StructInit(SSP_InitTypeDef* SSP_InitStruct);
|
119 |
|
|
void SSP_Cmd(SSP_TypeDef* SSPx, FunctionalState NewState);
|
120 |
|
|
void SSP_ITConfig(SSP_TypeDef* SSPx, u16 SSP_IT, FunctionalState NewState);
|
121 |
|
|
void SSP_DMACmd(u16 SSP0_DMAtransfer, FunctionalState NewState);
|
122 |
|
|
void SSP_DMATxConfig(u16 SSP0_DMATxReq);
|
123 |
|
|
void SSP_DMARxConfig(u16 SSP0_DMARxReq);
|
124 |
|
|
void SSP_SendData(SSP_TypeDef* SSPx, u16 Data);
|
125 |
|
|
u16 SSP_ReceiveData(SSP_TypeDef* SSPx);
|
126 |
|
|
void SSP_LoopBackConfig(SSP_TypeDef* SSPx, FunctionalState NewState);
|
127 |
|
|
void SSP_NSSInternalConfig(SSP_TypeDef* SSPx, u16 SSP_NSSState);
|
128 |
|
|
FlagStatus SSP_GetFlagStatus(SSP_TypeDef* SSPx, u16 SSP_FLAG);
|
129 |
|
|
void SSP_ClearFlag(SSP_TypeDef* SSPx, u16 SSP_FLAG);
|
130 |
|
|
ITStatus SSP_GetITStatus(SSP_TypeDef* SSPx, u16 SSP_IT);
|
131 |
|
|
void SSP_ClearITPendingBit(SSP_TypeDef* SSPx, u16 SSP_IT);
|
132 |
|
|
|
133 |
|
|
#endif /* __75x_SSP_H */
|
134 |
|
|
|
135 |
|
|
/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
|