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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [io/] [pcmcia/] [current/] [include/] [pcmcia.h] - Blame information for rev 825

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

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_PCMCIA_H
2
#define CYGONCE_PCMCIA_H
3
// ====================================================================
4
//
5
//      pcmcia.h
6
//
7
//      Device I/O 
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, 2004 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):     gthomas
45
// Contributors:  gthomas
46
// Date:          2000-07-06
47
// Purpose:       Interfaces for PCMCIA I/O drivers
48
// Description:
49
//
50
//####DESCRIPTIONEND####
51
//
52
// ====================================================================
53
 
54
// PCMCIA I/O interfaces
55
 
56
#include <pkgconf/system.h>
57
#include <pkgconf/io_pcmcia.h>
58
 
59
#include <cyg/infra/cyg_type.h>
60
#include <cyg/hal/drv_api.h>
61
 
62
struct cf_irq_handler {
63
    void         (*handler)(int, int, void *);
64
    void          *param;
65
};
66
 
67
// Basic information about a slot/device
68
struct cf_slot {
69
    int            index;       // In case hardware layer needs it
70
    int            state;
71
    unsigned char *attr;
72
    int            attr_length;
73
    unsigned char *io;
74
    int            io_length;
75
    unsigned char *mem;
76
    int            mem_length;
77
    int            int_num;    // Hardware interrupt number
78
    struct cf_irq_handler irq_handler;
79
};
80
 
81
#define CF_SLOT_STATE_Empty     0
82
#define CF_SLOT_STATE_Inserted  1
83
#define CF_SLOT_STATE_Powered   2
84
#define CF_SLOT_STATE_Reset     3
85
#define CF_SLOT_STATE_Ready     4
86
#define CF_SLOT_STATE_Removed   5
87
 
88
#define CF_CISTPL_VERS_1        0x15
89
#define CF_CISTPL_CONFIG        0x1A
90
#define CF_CISTPL_CFTABLE_ENTRY 0x1B
91
#define CF_CISTPL_MANFID        0x20
92
#define CF_CISTPL_FUNCID        0x21
93
 
94
// Configuration register offsets
95
#define CF_CONFIG_COR           0x00
96
#define CF_CONFIG_CCSR          0x02
97
#define CF_CONFIG_PRR           0x04
98
#define CF_CONFIG_SCR           0x06
99
#define CF_CONFIG_ESR           0x08
100
#define CF_CONFIG_IOBASE_0      0x0a
101
#define CF_CONFIG_IOBASE_1      0x0c
102
#define CF_CONFIG_IOBASE_2      0x0e
103
#define CF_CONFIG_IOBASE_3      0x10
104
#define CF_CONFIG_IOSIZE        0x12
105
 
106
// Configuration Option Register bits
107
#define CF_COR_FUNC_ENA         0x01
108
#define CF_COR_ADDR_DECODE      0x02
109
#define CF_COR_IREQ_ENA         0x04
110
#define CF_COR_LEVEL_REQ        0x40
111
#define CF_COR_SOFT_RESET       0x80
112
 
113
 
114
#define CF_MAX_IO_ADDRS      8
115
struct cf_io_space {
116
    unsigned long base[CF_MAX_IO_ADDRS];     // Base address of I/O registers
117
    unsigned long size[CF_MAX_IO_ADDRS];     // Length(-1) of I/O registers
118
    int           num_addrs;
119
    unsigned char mode;
120
};
121
 
122
// Corresponds to CISTPL_CFTABLE_ENTRY
123
struct cf_cftable {
124
    unsigned char      cor;              // Value to write to COR register
125
    unsigned char      interface;
126
    unsigned char      feature_select;
127
    struct cf_io_space io_space;
128
};
129
 
130
// Corresponds to CISTPL_CONFIG
131
struct cf_config {
132
    unsigned long base;
133
    int           mask_length;
134
    unsigned char mask[16];
135
};
136
 
137
// Function prototypes
138
 
139
bool cf_get_CIS(struct cf_slot *slot, unsigned char id,
140
                unsigned char *buf, int *len, int *ptr);
141
void cf_set_COR(struct cf_slot *slot, unsigned long cor, unsigned char val);
142
bool cf_parse_cftable(unsigned char *buf, int len, struct cf_cftable *cftable);
143
bool cf_parse_config(unsigned char *buf, int len, struct cf_config *config);
144
struct cf_slot *cf_get_slot(int indx);
145
void cf_change_state(struct cf_slot *slot, int desired_state);
146
void cf_register_handler(struct cf_slot *, void (*handler)(int, int, void *), void *);
147
void cf_clear_interrupt(struct cf_slot *);
148
void cf_init(void);
149
 
150
void cf_hwr_poll(struct cf_slot *);
151
 
152
#endif // CYGONCE_PCMCIA_H

powered by: WebSVN 2.1.0

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