RTEMS 5.2
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
m360_spi.h
Go to the documentation of this file.
1
9/*===============================================================*\
10| Project: RTEMS support for MC68360 |
11+-----------------------------------------------------------------+
12| Copyright (c) 2008 |
13| Embedded Brains GmbH |
14| Obere Lagerstr. 30 |
15| D-82178 Puchheim |
16| Germany |
17| rtems@embedded-brains.de |
18+-----------------------------------------------------------------+
19| The license and distribution terms for this file may be |
20| found in the file LICENSE in this distribution or at |
21| |
22| http://www.rtems.org/license/LICENSE. |
23| |
24\*===============================================================*/
25
34#ifndef _M360_SPIDRV_H
35#define _M360_SPIDRV_H
36
37#include <rtems/m68k/m68360.h>
38#include <rtems/libi2c.h>
39#include <rtems/irq.h>
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45typedef struct m360_spi_softc {
46 int initialized;
47 rtems_id irq_sema_id;
48 rtems_isr_entry old_handler;
52
53typedef struct {
54 rtems_libi2c_bus_t bus_desc;
55 m360_spi_softc_t softc;
57
58/*=========================================================================*\
59| Function: |
60\*-------------------------------------------------------------------------*/
61rtems_status_code m360_spi_init
62(
63/*-------------------------------------------------------------------------*\
64| Purpose: |
65| initialize the driver |
66+---------------------------------------------------------------------------+
67| Input Parameters: |
68\*-------------------------------------------------------------------------*/
69 rtems_libi2c_bus_t *bh /* bus specifier structure */
70 );
71/*-------------------------------------------------------------------------*\
72| Return Value: |
73| o = ok or error code |
74\*=========================================================================*/
75
76/*=========================================================================*\
77| Function: |
78\*-------------------------------------------------------------------------*/
79int m360_spi_read_bytes
80(
81/*-------------------------------------------------------------------------*\
82| Purpose: |
83| receive some bytes from SPI device |
84+---------------------------------------------------------------------------+
85| Input Parameters: |
86\*-------------------------------------------------------------------------*/
87 rtems_libi2c_bus_t *bh, /* bus specifier structure */
88 unsigned char *buf, /* buffer to store bytes */
89 int len /* number of bytes to receive */
90 );
91/*-------------------------------------------------------------------------*\
92| Return Value: |
93| number of bytes received or (negative) error code |
94\*=========================================================================*/
95
96/*=========================================================================*\
97| Function: |
98\*-------------------------------------------------------------------------*/
99int m360_spi_write_bytes
100(
101/*-------------------------------------------------------------------------*\
102| Purpose: |
103| send some bytes to SPI device |
104+---------------------------------------------------------------------------+
105| Input Parameters: |
106\*-------------------------------------------------------------------------*/
107 rtems_libi2c_bus_t *bh, /* bus specifier structure */
108 unsigned char *buf, /* buffer to send */
109 int len /* number of bytes to send */
110
111 );
112/*-------------------------------------------------------------------------*\
113| Return Value: |
114| number of bytes sent or (negative) error code |
115\*=========================================================================*/
116
117/*=========================================================================*\
118| Function: |
119\*-------------------------------------------------------------------------*/
120rtems_status_code m360_spi_set_tfr_mode
121(
122/*-------------------------------------------------------------------------*\
123| Purpose: |
124| set SPI to desired baudrate/clock mode/character mode |
125+---------------------------------------------------------------------------+
126| Input Parameters: |
127\*-------------------------------------------------------------------------*/
128 rtems_libi2c_bus_t *bh, /* bus specifier structure */
129 const rtems_libi2c_tfr_mode_t *tfr_mode /* transfer mode info */
130 );
131/*-------------------------------------------------------------------------*\
132| Return Value: |
133| rtems_status_code |
134\*=========================================================================*/
135
136/*=========================================================================*\
137| Function: |
138\*-------------------------------------------------------------------------*/
139int m360_spi_ioctl
140(
141/*-------------------------------------------------------------------------*\
142| Purpose: |
143| perform selected ioctl function for SPI |
144+---------------------------------------------------------------------------+
145| Input Parameters: |
146\*-------------------------------------------------------------------------*/
147 rtems_libi2c_bus_t *bh, /* bus specifier structure */
148 int cmd, /* ioctl command code */
149 void *arg /* additional argument array */
150 );
151/*-------------------------------------------------------------------------*\
152| Return Value: |
153| rtems_status_code |
154\*=========================================================================*/
155
156#ifdef __cplusplus
157}
158#endif
159
160
161#endif /* _M360_SPIDRV_H */
rtems_status_code
Classic API Status.
Definition: status.h:43
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition: types.h:83
Legacy I2C Library.
Definitions for Motorola MC68360 Processor.
Definition: m68360.h:403
Definition: m360_spi.h:53
Definition: m360_spi.h:45
Definition: libi2c.h:163
Definition: libi2c.h:462