RTEMS
5.1
Main Page
Related Pages
Modules
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Files
File List
+
Globals
+
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Variables
_
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
v
w
+
Typedefs
a
b
c
d
e
f
g
h
i
l
m
o
p
q
r
s
t
u
v
w
x
+
Enumerations
a
b
c
e
h
i
l
m
o
p
q
r
s
t
w
+
Enumerator
a
c
d
h
i
l
m
p
r
s
t
w
+
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
bsps
powerpc
tqm8xx
include
bsp
spi.h
1
/*===============================================================*\
2
| Project: RTEMS support for MPC8xx |
3
+-----------------------------------------------------------------+
4
| Copyright (c) 2009 |
5
| Embedded Brains GmbH |
6
| Obere Lagerstr. 30 |
7
| D-82178 Puchheim |
8
| Germany |
9
| rtems@embedded-brains.de |
10
+-----------------------------------------------------------------+
11
| The license and distribution terms for this file may be |
12
| found in the file LICENSE in this distribution or at |
13
| |
14
| http://www.rtems.org/license/LICENSE. |
15
| |
16
+-----------------------------------------------------------------+
17
| this file contains the MPC8xx SPI driver declarations |
18
\*===============================================================*/
19
#ifndef _M8XX_SPIDRV_H
20
#define _M8XX_SPIDRV_H
21
22
#include <mpc8xx.h>
23
#include <
rtems/libi2c.h
>
24
#include <
rtems/irq.h
>
25
26
#ifdef __cplusplus
27
extern
"C"
{
28
#endif
29
30
typedef
struct
m8xx_spi_softc
{
31
int
initialized;
32
rtems_id
irq_sema_id;
33
rtems_isr_entry old_handler;
34
m8xxBufferDescriptor_t
*rx_bd;
35
m8xxBufferDescriptor_t
*tx_bd;
36
}
m8xx_spi_softc_t
;
37
38
typedef
struct
{
39
rtems_libi2c_bus_t
bus_desc;
40
m8xx_spi_softc_t
softc;
41
}
m8xx_spi_desc_t
;
42
43
/*=========================================================================*\
44
| Function: |
45
\*-------------------------------------------------------------------------*/
46
rtems_status_code
m8xx_spi_init
47
(
48
/*-------------------------------------------------------------------------*\
49
| Purpose: |
50
| initialize the driver |
51
+---------------------------------------------------------------------------+
52
| Input Parameters: |
53
\*-------------------------------------------------------------------------*/
54
rtems_libi2c_bus_t
*bh
/* bus specifier structure */
55
);
56
/*-------------------------------------------------------------------------*\
57
| Return Value: |
58
| o = ok or error code |
59
\*=========================================================================*/
60
61
/*=========================================================================*\
62
| Function: |
63
\*-------------------------------------------------------------------------*/
64
int
m8xx_spi_read_bytes
65
(
66
/*-------------------------------------------------------------------------*\
67
| Purpose: |
68
| receive some bytes from SPI device |
69
+---------------------------------------------------------------------------+
70
| Input Parameters: |
71
\*-------------------------------------------------------------------------*/
72
rtems_libi2c_bus_t
*bh,
/* bus specifier structure */
73
unsigned
char
*buf,
/* buffer to store bytes */
74
int
len
/* number of bytes to receive */
75
);
76
/*-------------------------------------------------------------------------*\
77
| Return Value: |
78
| number of bytes received or (negative) error code |
79
\*=========================================================================*/
80
81
/*=========================================================================*\
82
| Function: |
83
\*-------------------------------------------------------------------------*/
84
int
m8xx_spi_write_bytes
85
(
86
/*-------------------------------------------------------------------------*\
87
| Purpose: |
88
| send some bytes to SPI device |
89
+---------------------------------------------------------------------------+
90
| Input Parameters: |
91
\*-------------------------------------------------------------------------*/
92
rtems_libi2c_bus_t
*bh,
/* bus specifier structure */
93
unsigned
char
*buf,
/* buffer to send */
94
int
len
/* number of bytes to send */
95
96
);
97
/*-------------------------------------------------------------------------*\
98
| Return Value: |
99
| number of bytes sent or (negative) error code |
100
\*=========================================================================*/
101
102
/*=========================================================================*\
103
| Function: |
104
\*-------------------------------------------------------------------------*/
105
rtems_status_code
m8xx_spi_set_tfr_mode
106
(
107
/*-------------------------------------------------------------------------*\
108
| Purpose: |
109
| set SPI to desired baudrate/clock mode/character mode |
110
+---------------------------------------------------------------------------+
111
| Input Parameters: |
112
\*-------------------------------------------------------------------------*/
113
rtems_libi2c_bus_t
*bh,
/* bus specifier structure */
114
const
rtems_libi2c_tfr_mode_t
*tfr_mode
/* transfer mode info */
115
);
116
/*-------------------------------------------------------------------------*\
117
| Return Value: |
118
| rtems_status_code |
119
\*=========================================================================*/
120
121
/*=========================================================================*\
122
| Function: |
123
\*-------------------------------------------------------------------------*/
124
int
m8xx_spi_ioctl
125
(
126
/*-------------------------------------------------------------------------*\
127
| Purpose: |
128
| perform selected ioctl function for SPI |
129
+---------------------------------------------------------------------------+
130
| Input Parameters: |
131
\*-------------------------------------------------------------------------*/
132
rtems_libi2c_bus_t
*bh,
/* bus specifier structure */
133
int
cmd,
/* ioctl command code */
134
void
*arg
/* additional argument array */
135
);
136
/*-------------------------------------------------------------------------*\
137
| Return Value: |
138
| rtems_status_code |
139
\*=========================================================================*/
140
141
#ifdef __cplusplus
142
}
143
#endif
144
145
146
#endif
/* _M8XX_SPIDRV_H */
m8xx_spi_softc
Definition:
spi.h:30
rtems_libi2c_bus_t_
Definition:
libi2c.h:162
rtems_status_code
rtems_status_code
Classic API Status.
Definition:
status.h:43
rtems_libi2c_tfr_mode_t
Definition:
libi2c.h:462
m8xxBufferDescriptor_
Definition:
mpc8xx.h:683
irq.h
m8xx_spi_desc_t
Definition:
spi.h:38
rtems_id
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition:
types.h:83
libi2c.h
Legacy I2C Library.
Generated by
1.8.15