Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | ingob | 1 | /******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** |
2 | * File Name : 91x_ssp.h |
||
3 | * Author : MCD Application Team |
||
4 | * Date First Issued : 05/18/2006 : Version 1.0 |
||
5 | * Description : This file contains all the functions prototypes for the |
||
6 | * SSP software library. |
||
7 | ******************************************************************************** |
||
8 | * History: |
||
9 | * 05/22/2007 : Version 1.2 |
||
10 | * 05/24/2006 : Version 1.1 |
||
11 | * 05/18/2006 : Version 1.0 |
||
12 | ******************************************************************************** |
||
13 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS |
||
14 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. |
||
15 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, |
||
16 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE |
||
17 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING |
||
18 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. |
||
19 | *******************************************************************************/ |
||
20 | |||
21 | /* Define to prevent recursive inclusion -------------------------------------*/ |
||
22 | #ifndef __91x_SSP_H |
||
23 | #define __91x_SSP_H |
||
24 | |||
25 | /* Includes ------------------------------------------------------------------*/ |
||
26 | #include "91x_map.h" |
||
27 | |||
28 | /* Exported types ------------------------------------------------------------*/ |
||
29 | /* SSP Init structure definition */ |
||
30 | typedef struct |
||
31 | { |
||
32 | u16 SSP_FrameFormat ; |
||
33 | u16 SSP_Mode ; |
||
34 | u16 SSP_CPOL ; |
||
35 | u16 SSP_CPHA ; |
||
36 | u16 SSP_DataSize ; |
||
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 | #define SSP_FrameFormat_Microwire 0x0020 |
||
47 | |||
48 | /* SSP Master/Slave Select */ |
||
49 | #define SSP_Mode_Master 0xFFFB |
||
50 | #define SSP_Mode_Slave 0x0004 |
||
51 | |||
52 | /* SSP Clock Polarity */ |
||
53 | #define SSP_CPOL_Low 0xFFBF |
||
54 | #define SSP_CPOL_High 0x0040 |
||
55 | |||
56 | /* SSP Clock Phase */ |
||
57 | #define SSP_CPHA_1Edge 0xFF7F |
||
58 | #define SSP_CPHA_2Edge 0x0080 |
||
59 | |||
60 | /* SSP Data Size */ |
||
61 | #define SSP_DataSize_16b 0x000F |
||
62 | #define SSP_DataSize_15b 0x000E |
||
63 | #define SSP_DataSize_14b 0x000D |
||
64 | #define SSP_DataSize_13b 0x000C |
||
65 | #define SSP_DataSize_12b 0x000B |
||
66 | #define SSP_DataSize_11b 0x000A |
||
67 | #define SSP_DataSize_10b 0x0009 |
||
68 | #define SSP_DataSize_9b 0x0008 |
||
69 | #define SSP_DataSize_8b 0x0007 |
||
70 | #define SSP_DataSize_7b 0x0006 |
||
71 | #define SSP_DataSize_6b 0x0005 |
||
72 | #define SSP_DataSize_5b 0x0004 |
||
73 | #define SSP_DataSize_4b 0x0003 |
||
74 | |||
75 | /* SSP Slave output config */ |
||
76 | #define SSP_SlaveOutput_Enable 0xFFF7 |
||
77 | #define SSP_SlaveOutput_Disable 0x0008 |
||
78 | |||
79 | /* SSP Interrupts */ |
||
80 | #define SSP_IT_TxFifo 0x0008 |
||
81 | #define SSP_IT_RxFifo 0x0004 |
||
82 | #define SSP_IT_RxTimeOut 0x0002 |
||
83 | #define SSP_IT_RxOverrun 0x0001 |
||
84 | |||
85 | /* SSP Flags */ |
||
86 | #define SSP_FLAG_Busy 0x0024 |
||
87 | #define SSP_FLAG_RxFifoFull 0x0023 |
||
88 | #define SSP_FLAG_RxFifoNotEmpty 0x0022 |
||
89 | #define SSP_FLAG_TxFifoNotFull 0x0021 |
||
90 | #define SSP_FLAG_TxFifoEmpty 0x0020 |
||
91 | #define SSP_FLAG_TxFifo 0x0043 |
||
92 | #define SSP_FLAG_RxFifo 0x0042 |
||
93 | #define SSP_FLAG_RxTimeOut 0x0041 |
||
94 | #define SSP_FLAG_RxOverrun 0x0040 |
||
95 | |||
96 | /* SSP DMA Requests */ |
||
97 | #define SSP_DMA_Transmit 0x0002 |
||
98 | #define SSP_DMA_Receive 0x0001 |
||
99 | |||
100 | /* Exported macro ------------------------------------------------------------*/ |
||
101 | /* Exported functions ------------------------------------------------------- */ |
||
102 | |||
103 | void SSP_DeInit(SSP_TypeDef* SSPx); |
||
104 | void SSP_Init(SSP_TypeDef* SSPx, SSP_InitTypeDef* SSP_InitStruct); |
||
105 | void SSP_StructInit(SSP_InitTypeDef* SSP_InitStruct); |
||
106 | void SSP_Cmd(SSP_TypeDef* SSPx, FunctionalState NewState); |
||
107 | void SSP_ITConfig(SSP_TypeDef* SSPx, u16 SSP_IT, FunctionalState NewState); |
||
108 | void SSP_DMACmd(SSP_TypeDef* SSPx, u16 SSP_DMATransfert, FunctionalState NewState); |
||
109 | void SSP_SendData(SSP_TypeDef* SSPx, u16 Data); |
||
110 | u16 SSP_ReceiveData(SSP_TypeDef* SSPx); |
||
111 | void SSP_LoopBackConfig(SSP_TypeDef* SSPx, FunctionalState NewState); |
||
112 | FlagStatus SSP_GetFlagStatus(SSP_TypeDef* SSPx, u16 SSP_FLAG); |
||
113 | void SSP_ClearFlag(SSP_TypeDef* SSPx, u16 SSP_FLAG); |
||
114 | ITStatus SSP_GetITStatus(SSP_TypeDef* SSPx, u16 SSP_IT); |
||
115 | void SSP_ClearITPendingBit(SSP_TypeDef* SSPx, u16 SSP_IT); |
||
116 | |||
117 | #endif /* __91x_SSP_H */ |
||
118 | |||
119 | /******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ |
||
120 |