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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [io/] [pcmcia/] [v2_0/] [include/] [pcmcia.h] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
#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 Red Hat, 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 version.
18
//
19
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
20
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
21
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
22
// for more details.
23
//
24
// You should have received a copy of the GNU General Public License along
25
// with eCos; if not, write to the Free Software Foundation, Inc.,
26
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
27
//
28
// As a special exception, if other files instantiate templates or use macros
29
// or inline functions from this file, or you compile this file and link it
30
// with other works to produce a work based on this file, this file does not
31
// by itself cause the resulting work to be covered by the GNU General Public
32
// License. However the source code for this file must still be made available
33
// in accordance with section (3) of the GNU General Public License.
34
//
35
// This exception does not invalidate any other reasons why a work based on
36
// this file might be covered by the GNU General Public License.
37
//
38
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
39
// at http://sources.redhat.com/ecos/ecos-license/
40
// -------------------------------------------
41
//####ECOSGPLCOPYRIGHTEND####
42
// ====================================================================
43
//#####DESCRIPTIONBEGIN####
44
//
45
// Author(s):     gthomas
46
// Contributors:  gthomas
47
// Date:          2000-07-06
48
// Purpose:       Interfaces for PCMCIA I/O drivers
49
// Description:
50
//
51
//####DESCRIPTIONEND####
52
//
53
// ====================================================================
54
 
55
// PCMCIA I/O interfaces
56
 
57
#include <pkgconf/system.h>
58
#include <pkgconf/io_pcmcia.h>
59
 
60
#include <cyg/infra/cyg_type.h>
61
#include <cyg/hal/drv_api.h>
62
 
63
struct cf_irq_handler {
64
    void         (*handler)(int, int, void *);
65
    void          *param;
66
};
67
 
68
// Basic information about a slot/device
69
struct cf_slot {
70
    int            index;       // In case hardware layer needs it
71
    int            state;
72
    unsigned char *attr;
73
    int            attr_length;
74
    unsigned char *io;
75
    int            io_length;
76
    unsigned char *mem;
77
    int            mem_length;
78
    int            int_num;    // Hardware interrupt number
79
    struct cf_irq_handler irq_handler;
80
};
81
 
82
#define CF_SLOT_STATE_Empty     0
83
#define CF_SLOT_STATE_Inserted  1
84
#define CF_SLOT_STATE_Powered   2
85
#define CF_SLOT_STATE_Reset     3
86
#define CF_SLOT_STATE_Ready     4
87
#define CF_SLOT_STATE_Removed   5
88
 
89
#define CF_CISTPL_VERS_1        0x15
90
#define CF_CISTPL_CONFIG        0x1A
91
#define CF_CISTPL_CFTABLE_ENTRY 0x1B
92
#define CF_CISTPL_MANFID        0x20
93
#define CF_CISTPL_FUNCID        0x21
94
 
95
#define CF_MAX_IO_ADDRS      8
96
struct cf_io_space {
97
    unsigned long base[CF_MAX_IO_ADDRS];     // Base address of I/O registers
98
    unsigned long size[CF_MAX_IO_ADDRS];     // Length(-1) of I/O registers
99
    int           num_addrs;
100
    unsigned char mode;
101
};
102
 
103
// Corresponds to CISTPL_CFTABLE_ENTRY
104
struct cf_cftable {
105
    unsigned char      cor;              // Value to write to COR register
106
    unsigned char      interface;
107
    unsigned char      feature_select;
108
    struct cf_io_space io_space;
109
};
110
 
111
// Corresponds to CISTPL_CONFIG
112
struct cf_config {
113
    unsigned long base;
114
    int           mask_length;
115
    unsigned char mask[16];
116
};
117
 
118
// Function prototypes
119
 
120
bool cf_get_CIS(struct cf_slot *slot, unsigned char id,
121
                unsigned char *buf, int *len, int *ptr);
122
void cf_set_COR(struct cf_slot *slot, unsigned long cor, unsigned char val);
123
bool cf_parse_cftable(unsigned char *buf, int len, struct cf_cftable *cftable);
124
bool cf_parse_config(unsigned char *buf, int len, struct cf_config *config);
125
struct cf_slot *cf_get_slot(int indx);
126
void cf_change_state(struct cf_slot *slot, int desired_state);
127
void cf_register_handler(struct cf_slot *, void (*handler)(int, int, void *), void *);
128
void cf_clear_interrupt(struct cf_slot *);
129
void cf_init(void);
130
 
131
void cf_hwr_poll(struct cf_slot *);
132
 
133
#endif // CYGONCE_PCMCIA_H

powered by: WebSVN 2.1.0

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