1 |
577 |
jeremybenn |
/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
|
2 |
|
|
* File Name : 75x_gpio.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 |
|
|
* GPIO 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_GPIO_H
|
22 |
|
|
#define __75x_GPIO_H
|
23 |
|
|
|
24 |
|
|
/* Includes ------------------------------------------------------------------*/
|
25 |
|
|
#include "75x_map.h"
|
26 |
|
|
|
27 |
|
|
/* Exported types ------------------------------------------------------------*/
|
28 |
|
|
/* Configuration Mode enumeration */
|
29 |
|
|
typedef enum
|
30 |
|
|
{ GPIO_Mode_AIN = 1,
|
31 |
|
|
GPIO_Mode_IN_FLOATING,
|
32 |
|
|
GPIO_Mode_IPD,
|
33 |
|
|
GPIO_Mode_IPU,
|
34 |
|
|
GPIO_Mode_Out_OD,
|
35 |
|
|
GPIO_Mode_Out_PP,
|
36 |
|
|
GPIO_Mode_AF_OD,
|
37 |
|
|
GPIO_Mode_AF_PP
|
38 |
|
|
}GPIOMode_TypeDef;
|
39 |
|
|
|
40 |
|
|
/* GPIO Init structure definition */
|
41 |
|
|
typedef struct
|
42 |
|
|
{
|
43 |
|
|
u32 GPIO_Pin;
|
44 |
|
|
GPIOMode_TypeDef GPIO_Mode;
|
45 |
|
|
}GPIO_InitTypeDef;
|
46 |
|
|
|
47 |
|
|
/* Bit_SET and Bit_RESET enumeration */
|
48 |
|
|
typedef enum
|
49 |
|
|
{ Bit_RESET = 0,
|
50 |
|
|
Bit_SET
|
51 |
|
|
}BitAction;
|
52 |
|
|
|
53 |
|
|
|
54 |
|
|
/* Exported constants --------------------------------------------------------*/
|
55 |
|
|
/* GPIO pins define */
|
56 |
|
|
#define GPIO_Pin_None 0x00000000 /* No pin selected */
|
57 |
|
|
#define GPIO_Pin_0 0x00000001 /* Pin 0 selected */
|
58 |
|
|
#define GPIO_Pin_1 0x00000002 /* Pin 1 selected */
|
59 |
|
|
#define GPIO_Pin_2 0x00000004 /* Pin 2 selected */
|
60 |
|
|
#define GPIO_Pin_3 0x00000008 /* Pin 3 selected */
|
61 |
|
|
#define GPIO_Pin_4 0x00000010 /* Pin 4 selected */
|
62 |
|
|
#define GPIO_Pin_5 0x00000020 /* Pin 5 selected */
|
63 |
|
|
#define GPIO_Pin_6 0x00000040 /* Pin 6 selected */
|
64 |
|
|
#define GPIO_Pin_7 0x00000080 /* Pin 7 selected */
|
65 |
|
|
#define GPIO_Pin_8 0x00000100 /* Pin 8 selected */
|
66 |
|
|
#define GPIO_Pin_9 0x00000200 /* Pin 9 selected */
|
67 |
|
|
#define GPIO_Pin_10 0x00000400 /* Pin 10 selected */
|
68 |
|
|
#define GPIO_Pin_11 0x00000800 /* Pin 11 selected */
|
69 |
|
|
#define GPIO_Pin_12 0x00001000 /* Pin 12 selected */
|
70 |
|
|
#define GPIO_Pin_13 0x00002000 /* Pin 13 selected */
|
71 |
|
|
#define GPIO_Pin_14 0x00004000 /* Pin 14 selected */
|
72 |
|
|
#define GPIO_Pin_15 0x00008000 /* Pin 15 selected */
|
73 |
|
|
#define GPIO_Pin_16 0x00010000 /* Pin 16 selected */
|
74 |
|
|
#define GPIO_Pin_17 0x00020000 /* Pin 17 selected */
|
75 |
|
|
#define GPIO_Pin_18 0x00040000 /* Pin 18 selected */
|
76 |
|
|
#define GPIO_Pin_19 0x00080000 /* Pin 19 selected */
|
77 |
|
|
#define GPIO_Pin_20 0x00100000 /* Pin 20 selected */
|
78 |
|
|
#define GPIO_Pin_21 0x00200000 /* Pin 21 selected */
|
79 |
|
|
#define GPIO_Pin_22 0x00400000 /* Pin 22 selected */
|
80 |
|
|
#define GPIO_Pin_23 0x00800000 /* Pin 23 selected */
|
81 |
|
|
#define GPIO_Pin_24 0x01000000 /* Pin 24 selected */
|
82 |
|
|
#define GPIO_Pin_25 0x02000000 /* Pin 25 selected */
|
83 |
|
|
#define GPIO_Pin_26 0x04000000 /* Pin 26 selected */
|
84 |
|
|
#define GPIO_Pin_27 0x08000000 /* Pin 27 selected */
|
85 |
|
|
#define GPIO_Pin_28 0x10000000 /* Pin 28 selected */
|
86 |
|
|
#define GPIO_Pin_29 0x20000000 /* Pin 29 selected */
|
87 |
|
|
#define GPIO_Pin_30 0x40000000 /* Pin 30 selected */
|
88 |
|
|
#define GPIO_Pin_31 0x80000000 /* Pin 31 selected */
|
89 |
|
|
#define GPIO_Pin_All 0xFFFFFFFF /* All pins selected */
|
90 |
|
|
|
91 |
|
|
/* GPIO Remap define */
|
92 |
|
|
#define GPIO_Remap_SMI_CS3_EN 0x23 /* SMI CS3 Enable */
|
93 |
|
|
#define GPIO_Remap_SMI_CS2_EN 0x22 /* SMI CS2 Enable */
|
94 |
|
|
#define GPIO_Remap_SMI_CS1_EN 0x21 /* SMI CS1 Enable */
|
95 |
|
|
#define GPIO_Remap_SMI_EN 0x20 /* SMI Enable */
|
96 |
|
|
#define GPIO_Remap_DBGOFF 0x45 /* JTAG Disable */
|
97 |
|
|
#define GPIO_Remap_UART1 0x44 /* UART1 Alternate Function mapping */
|
98 |
|
|
#define GPIO_Remap_UART2 0x43 /* UART2 Alternate Function mapping */
|
99 |
|
|
#define GPIO_Remap_SSP1 0x42 /* SSP1 Alternate Function mapping */
|
100 |
|
|
#define GPIO_Remap_TIM2 0x41 /* TIM2 Alternate Function mapping */
|
101 |
|
|
#define GPIO_Remap_TIM0 0x40 /* TIM0 Alternate Function mapping */
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
/* Exported macro ------------------------------------------------------------*/
|
105 |
|
|
/* Exported functions ------------------------------------------------------- */
|
106 |
|
|
|
107 |
|
|
void GPIO_DeInit(GPIO_TypeDef* GPIOx);
|
108 |
|
|
void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct);
|
109 |
|
|
void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct);
|
110 |
|
|
u32 GPIO_Read(GPIO_TypeDef* GPIOx);
|
111 |
|
|
u8 GPIO_ReadBit(GPIO_TypeDef* GPIOx, u32 GPIO_Pin);
|
112 |
|
|
void GPIO_Write(GPIO_TypeDef* GPIOx, u32 PortVal);
|
113 |
|
|
void GPIO_WriteBit(GPIO_TypeDef* GPIOx,u32 GPIO_Pin, BitAction BitVal);
|
114 |
|
|
void GPIO_PinMaskConfig(GPIO_TypeDef* GPIOx, u32 GPIO_Pin, FunctionalState NewState);
|
115 |
|
|
u32 GPIO_GetPortMask(GPIO_TypeDef* GPIOx);
|
116 |
|
|
void GPIO_PinRemapConfig(u16 GPIO_Remap, FunctionalState NewState);
|
117 |
|
|
|
118 |
|
|
#endif /* __75x_GPIO_H */
|
119 |
|
|
|
120 |
|
|
/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
|