1 |
786 |
skrzyp |
#ifndef CYGONCE_DEVS_SPI_ARM_LPC2XXX_H
|
2 |
|
|
#define CYGONCE_DEVS_SPI_ARM_LPC2XXX_H
|
3 |
|
|
|
4 |
|
|
//==========================================================================
|
5 |
|
|
//
|
6 |
|
|
// spi_lpc2xxx.h
|
7 |
|
|
//
|
8 |
|
|
// SPI driver for LPC2xxx
|
9 |
|
|
//
|
10 |
|
|
//==========================================================================
|
11 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
12 |
|
|
// -------------------------------------------
|
13 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
14 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
15 |
|
|
//
|
16 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
17 |
|
|
// the terms of the GNU General Public License as published by the Free
|
18 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
19 |
|
|
// version.
|
20 |
|
|
//
|
21 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
22 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
23 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
24 |
|
|
// for more details.
|
25 |
|
|
//
|
26 |
|
|
// You should have received a copy of the GNU General Public License
|
27 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
28 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
29 |
|
|
//
|
30 |
|
|
// As a special exception, if other files instantiate templates or use
|
31 |
|
|
// macros or inline functions from this file, or you compile this file
|
32 |
|
|
// and link it with other works to produce a work based on this file,
|
33 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
34 |
|
|
// the GNU General Public License. However the source code for this file
|
35 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
36 |
|
|
// General Public License v2.
|
37 |
|
|
//
|
38 |
|
|
// This exception does not invalidate any other reasons why a work based
|
39 |
|
|
// on this file might be covered by the GNU General Public License.
|
40 |
|
|
// -------------------------------------------
|
41 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
42 |
|
|
//==========================================================================
|
43 |
|
|
//#####DESCRIPTIONBEGIN####
|
44 |
|
|
//
|
45 |
|
|
// Author(s): Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
|
46 |
|
|
// Contributors:
|
47 |
|
|
// Date: 2007-07-12
|
48 |
|
|
// Purpose:
|
49 |
|
|
// Description:
|
50 |
|
|
//
|
51 |
|
|
//####DESCRIPTIONEND####
|
52 |
|
|
//
|
53 |
|
|
//==========================================================================
|
54 |
|
|
|
55 |
|
|
#include <pkgconf/hal.h>
|
56 |
|
|
#include <pkgconf/io_spi.h>
|
57 |
|
|
#include <pkgconf/devs_spi_arm_lpc2xxx.h>
|
58 |
|
|
|
59 |
|
|
#include <cyg/infra/cyg_type.h>
|
60 |
|
|
#include <cyg/hal/drv_api.h>
|
61 |
|
|
#include <cyg/io/spi.h>
|
62 |
|
|
|
63 |
|
|
struct spi_dev {
|
64 |
|
|
volatile cyg_uint32 spcr;
|
65 |
|
|
volatile cyg_uint32 spsr;
|
66 |
|
|
volatile cyg_uint32 spdr;
|
67 |
|
|
volatile cyg_uint32 spccr;
|
68 |
|
|
cyg_uint32 d1, d2, d3;
|
69 |
|
|
volatile cyg_uint32 spint;
|
70 |
|
|
};
|
71 |
|
|
|
72 |
|
|
typedef struct {
|
73 |
|
|
cyg_spi_bus spi_bus;
|
74 |
|
|
|
75 |
|
|
cyg_interrupt spi_intr;
|
76 |
|
|
cyg_handle_t spi_hand;
|
77 |
|
|
cyg_vector_t spi_vect;
|
78 |
|
|
cyg_priority_t spi_prio;
|
79 |
|
|
cyg_drv_mutex_t spi_lock;
|
80 |
|
|
cyg_drv_cond_t spi_wait;
|
81 |
|
|
|
82 |
|
|
struct spi_dev *spi_dev;
|
83 |
|
|
|
84 |
|
|
volatile cyg_uint32 count;
|
85 |
|
|
volatile const cyg_uint8 *tx;
|
86 |
|
|
volatile cyg_uint8 *rx;
|
87 |
|
|
} cyg_spi_lpc2xxx_bus_t;
|
88 |
|
|
|
89 |
|
|
typedef struct {
|
90 |
|
|
cyg_spi_device spi_device;
|
91 |
|
|
|
92 |
|
|
cyg_uint8 spi_cpha;
|
93 |
|
|
cyg_uint8 spi_cpol;
|
94 |
|
|
cyg_uint8 spi_lsbf;
|
95 |
|
|
cyg_uint32 spi_baud;
|
96 |
|
|
|
97 |
|
|
void (*spi_cs)(int);
|
98 |
|
|
} cyg_spi_lpc2xxx_dev_t;
|
99 |
|
|
|
100 |
|
|
#ifdef CYGPKG_DEVS_SPI_ARM_LPC2XXX_BUS0
|
101 |
|
|
externC cyg_spi_lpc2xxx_bus_t cyg_spi_lpc2xxx_bus0;
|
102 |
|
|
#endif
|
103 |
|
|
|
104 |
|
|
#ifdef CYGPKG_DEVS_SPI_ARM_LPC2XXX_BUS1
|
105 |
|
|
externC cyg_spi_lpc2xxx_bus_t cyg_spi_lpc2xxx_bus1;
|
106 |
|
|
#endif
|
107 |
|
|
|
108 |
|
|
#endif
|