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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [devs/] [spi/] [arm/] [at91/] [current/] [include/] [spi_at91.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_DEVS_SPI_ARM_AT91_H
2
#define CYGONCE_DEVS_SPI_ARM_AT91_H
3
//==========================================================================
4
//
5
//      spi_at91.h
6
//
7
//      Atmel AT91 (ARM) SPI driver defines
8
//
9
//==========================================================================
10
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
11
// -------------------------------------------                              
12
// This file is part of eCos, the Embedded Configurable Operating System.   
13
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
14
//
15
// eCos is free software; you can redistribute it and/or modify it under    
16
// the terms of the GNU General Public License as published by the Free     
17
// Software Foundation; either version 2 or (at your option) any later      
18
// version.                                                                 
19
//
20
// eCos is distributed in the hope that it will be useful, but WITHOUT      
21
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
22
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
23
// for more details.                                                        
24
//
25
// You should have received a copy of the GNU General Public License        
26
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
27
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
28
//
29
// As a special exception, if other files instantiate templates or use      
30
// macros or inline functions from this file, or you compile this file      
31
// and link it with other works to produce a work based on this file,       
32
// this file does not by itself cause the resulting work to be covered by   
33
// the GNU General Public License. However the source code for this file    
34
// must still be made available in accordance with section (3) of the GNU   
35
// General Public License v2.                                               
36
//
37
// This exception does not invalidate any other reasons why a work based    
38
// on this file might be covered by the GNU General Public License.         
39
// -------------------------------------------                              
40
// ####ECOSGPLCOPYRIGHTEND####                                              
41
//==========================================================================
42
//#####DESCRIPTIONBEGIN####
43
//
44
// Author(s):     Savin Zlobec <savin@elatec.si> 
45
// Date:          2004-08-25
46
//
47
//####DESCRIPTIONEND####
48
//
49
//==========================================================================
50
 
51
#include <pkgconf/hal.h>
52
#include <pkgconf/io_spi.h>
53
 
54
#include <cyg/infra/cyg_type.h>
55
#include <cyg/hal/drv_api.h>
56
#include <cyg/io/spi.h>
57
 
58
//-----------------------------------------------------------------------------
59
// AT91 SPI BUS
60
 
61
typedef struct cyg_spi_at91_bus_s
62
{
63
    // ---- Upper layer data ----
64
 
65
    cyg_spi_bus   spi_bus;                  // Upper layer SPI bus data
66
 
67
    // ---- Lower layer data ----
68
 
69
    cyg_interrupt     spi_interrupt;        // SPI interrupt object
70
    cyg_handle_t      spi_interrupt_handle; // SPI interrupt handle
71
    cyg_drv_mutex_t   transfer_mx;          // Transfer mutex
72
    cyg_drv_cond_t    transfer_cond;        // Transfer condition
73
    cyg_bool          transfer_end;         // Transfer end flag
74
    cyg_bool          cs_up;                // Chip Select up flag 
75
    cyg_vector_t      interrupt_number;     // SPI Interrupt Number
76
    cyg_addrword_t    base;                 // Base Address of the SPI peripheral
77
    cyg_uint8         cs_en[4];             // The Configurations state for the CS
78
    cyg_uint32        cs_gpio[4];           // The GPIO Configurations for the CS
79
} cyg_spi_at91_bus_t;
80
 
81
//-----------------------------------------------------------------------------
82
// AT91 SPI DEVICE
83
 
84
typedef struct cyg_spi_at91_device_s
85
{
86
    // ---- Upper layer data ----
87
 
88
    cyg_spi_device spi_device;  // Upper layer SPI device data
89
 
90
    // ---- Lower layer data (configurable) ----
91
 
92
    cyg_uint8  dev_num;         // Device number
93
    cyg_uint8  cl_pol;          // Clock polarity (0 or 1)
94
    cyg_uint8  cl_pha;          // Clock phase    (0 or 1)
95
    cyg_uint32 cl_brate;        // Clock baud rate
96
    cyg_uint16 cs_up_udly;      // Delay in us between CS up and transfer start
97
    cyg_uint16 cs_dw_udly;      // Delay in us between transfer end and CS down
98
    cyg_uint16 tr_bt_udly;      // Delay in us between two transfers
99
 
100
    // ---- Lower layer data (internal) ----
101
 
102
    cyg_bool   init;            // Is device initialized
103
    cyg_uint8  cl_scbr;         // Value of SCBR (SPI clock) reg field
104
    cyg_uint8  cl_div32;        // Divide SPI master clock by 32
105
} cyg_spi_at91_device_t;
106
 
107
//-----------------------------------------------------------------------------
108
// AT91 SPI exported busses
109
 
110
/* For backwards compatability  */
111
#define cyg_spi_at91_bus cyg_spi_at91_bus0
112
 
113
externC cyg_spi_at91_bus_t cyg_spi_at91_bus0;
114
externC cyg_spi_at91_bus_t cyg_spi_at91_bus1;
115
 
116
//-----------------------------------------------------------------------------
117
 
118
#endif // CYGONCE_DEVS_SPI_ARM_AT91_H 
119
 
120
//-----------------------------------------------------------------------------
121
// End of spi_at91.h

powered by: WebSVN 2.1.0

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