OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [ARM7_STR71x_IAR/] [Library/] [include/] [gpio.h] - Blame information for rev 615

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 577 jeremybenn
/******************** (C) COPYRIGHT 2003 STMicroelectronics ********************
2
* File Name          : gpio.h
3
* Author             : MCD Application Team
4
* Date First Issued  : 08/06/2003
5
* Description        : This file contains all the functions prototypes for the
6
*                      GPIO software library.
7
********************************************************************************
8
* History:
9
*  30/11/2004 : V2.0
10
*  14/07/2004 : V1.3
11
*  01/01/2004 : V1.2
12
*******************************************************************************
13
 THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
14
 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, INDIRECT
16
 OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
17
 OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
18
 CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
19
*******************************************************************************/
20
#ifndef __gpio_H
21
#define __gpio_H
22
 
23
#include "71x_map.h"
24
 
25
typedef enum
26
{
27
  GPIO_HI_AIN_TRI,
28
  GPIO_IN_TRI_TTL,
29
  GPIO_IN_TRI_CMOS,
30
  GPIO_IPUPD_WP,
31
  GPIO_OUT_OD,
32
  GPIO_OUT_PP,
33
  GPIO_AF_OD,
34
  GPIO_AF_PP
35
} GpioPinMode_TypeDef;
36
 
37
#define GPIO_LSB  0x00
38
#define GPIO_MSB  0x08
39
 
40
/*******************************************************************************
41
* Function Name  : GPIO_Config
42
* Description    : Configure the GPIO port pins
43
* Input 1        : GPIOx (x can be 0,1 or 2) the desired port
44
* Input 2        : Port_Pins : pins placements
45
* Input 3        : Pins Mode
46
* Output         : None
47
* Return         : None
48
*******************************************************************************/
49
void GPIO_Config (GPIO_TypeDef *GPIOx, u16 Port_Pins, GpioPinMode_TypeDef GPIO_Mode);
50
 
51
/*******************************************************************************
52
* Function Name  : GPIO_BitRead
53
* Description    : Read the desired port pin value
54
* Input 1        : Selected GPIO port
55
* Input 2        : Pin number
56
* Output         : None
57
* Return         : The selected pin value
58
*******************************************************************************/
59
inline u8 GPIO_BitRead(GPIO_TypeDef *GPIOx, u8 Port_Pin)
60
{
61
  return (GPIOx->PD >> Port_Pin) & 0x0001;
62
}
63
 
64
/*******************************************************************************
65
* Function Name  : GPIO_ByteRead
66
* Description    : Read the desired port Byte value
67
* Input 1        : Selected GPIO port
68
* Input 2        : GPIO_MSB or GPIO_LSB
69
* Output         : None
70
* Return         : The GPIO_MSB or GPIO_LSB of the selected PD register
71
*******************************************************************************/
72
inline u8 GPIO_ByteRead(GPIO_TypeDef *GPIOx, u8 Port_Byte)
73
{
74
  return (u8)(GPIOx->PD >> Port_Byte);
75
}
76
 
77
/*******************************************************************************
78
* Function Name  : GPIO_WordRead
79
* Description    : Read the desired port word value
80
* Input 1        : Selected GPIO port
81
* Output         : None
82
* Return         : The selected PD register value
83
*******************************************************************************/
84
inline u16 GPIO_WordRead(GPIO_TypeDef *GPIOx)
85
{
86
  return GPIOx->PD;
87
}
88
 
89
/*******************************************************************************
90
* Function Name  : GPIO_BitWrite
91
* Description    : Set or reset the selected port pin
92
* Input 1        : Selected GPIO port
93
* Input 2        : Pin number
94
* Input 3        : bit value
95
* Output         : None
96
* Return         : None
97
*******************************************************************************/
98
void GPIO_BitWrite(GPIO_TypeDef *GPIOx, u8 Port_Pin, u8 Port_Val);
99
 
100
/*******************************************************************************
101
* Function Name  : GPIO_ByteWrite
102
* Description    : Write byte value to the selected PD register
103
* Input 1        : Selected GPIO port
104
* Input 2        : GPIO_MSB or GPIO_LSB
105
* Input 3        : Byte value
106
* Output         : None
107
* Return         : None
108
*******************************************************************************/
109
void GPIO_ByteWrite(GPIO_TypeDef *GPIOx, u8 Port_Byte, u8 Port_Val);
110
 
111
/*******************************************************************************
112
* Function Name  : GPIO_WordWrite
113
* Description    : Write word value to the selected PD register
114
* Input 1        : Selected GPIO port
115
* Input 2        : Value
116
* Output         : None
117
* Return         : None
118
*******************************************************************************/
119
inline void GPIO_WordWrite(GPIO_TypeDef *GPIOx, u16 Port_Val)
120
{
121
  GPIOx->PD = Port_Val;
122
}
123
 
124
#endif /* __gpio_H */
125
 
126
/******************* (C) COPYRIGHT 2003 STMicroelectronics *****END OF FILE****/

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.