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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [drivers/] [char/] [ftape/] [lowlevel/] [ftape-setup.c] - Blame information for rev 1774

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

Line No. Rev Author Line
1 1275 phoenix
/*
2
 * Copyright (C) 1996, 1997 Claus-Justus Heine.
3
 
4
 This program is free software; you can redistribute it and/or modify
5
 it under the terms of the GNU General Public License as published by
6
 the Free Software Foundation; either version 2, or (at your option)
7
 any later version.
8
 
9
 This program is distributed in the hope that it will be useful,
10
 but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 GNU General Public License for more details.
13
 
14
 You should have received a copy of the GNU General Public License
15
 along with this program; see the file COPYING.  If not, write to
16
 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
17
 
18
 *
19
 * $Source: /home/marcus/revision_ctrl_test/oc_cvs/cvs/or1k/linux/linux-2.4/drivers/char/ftape/lowlevel/ftape-setup.c,v $
20
 * $Revision: 1.1.1.1 $
21
 * $Date: 2004-04-15 02:02:35 $
22
 *
23
 *      This file contains the code for processing the kernel command
24
 *      line options for the QIC-40/80/3010/3020 floppy-tape driver
25
 *      "ftape" for Linux.
26
 */
27
 
28
#include <linux/config.h>
29
#include <linux/string.h>
30
#include <linux/errno.h>
31
#include <linux/mm.h>
32
#include <asm/segment.h>
33
 
34
#include <linux/ftape.h>
35
#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,16)
36
#include <linux/init.h>
37
#else
38
#define __initdata
39
#define __initfunc(__arg) __arg
40
#endif
41
#include "../lowlevel/ftape-tracing.h"
42
#include "../lowlevel/fdc-io.h"
43
 
44
static struct param_table {
45
        const char *name;
46
        int *var;
47
        int def_param;
48
        int min;
49
        int max;
50
} config_params[] __initdata = {
51
#ifndef CONFIG_FT_NO_TRACE_AT_ALL
52
        { "tracing",   &ftape_tracing,     3,              ft_t_bug, ft_t_any},
53
#endif
54
        { "ioport",    &ft_fdc_base,       CONFIG_FT_FDC_BASE,     0x0, 0xfff},
55
        { "irq",       &ft_fdc_irq,        CONFIG_FT_FDC_IRQ,        2,    15},
56
        { "dma",       &ft_fdc_dma,        CONFIG_FT_FDC_DMA,        0,     3},
57
        { "threshold", &ft_fdc_threshold,  CONFIG_FT_FDC_THR,         1,    16},
58
        { "datarate",  &ft_fdc_rate_limit, CONFIG_FT_FDC_MAX_RATE, 500,  2000},
59
        { "fc10",      &ft_probe_fc10,     CONFIG_FT_PROBE_FC10,     0,     1},
60
        { "mach2",     &ft_mach2,          CONFIG_FT_MACH2,          0,     1}
61
};
62
 
63
static int __init ftape_setup(char *str)
64
{
65
        int i;
66
        int param;
67
        int ints[2];
68
 
69
        TRACE_FUN(ft_t_flow);
70
 
71
        str = get_options(str, ARRAY_SIZE(ints), ints);
72
        if (str) {
73
                for (i=0; i < NR_ITEMS(config_params); i++) {
74
                        if (strcmp(str,config_params[i].name) == 0){
75
                                if (ints[0]) {
76
                                        param = ints[1];
77
                                } else {
78
                                        param = config_params[i].def_param;
79
                                }
80
                                if (param < config_params[i].min ||
81
                                    param > config_params[i].max) {
82
                                        TRACE(ft_t_err,
83
                                        "parameter %s out of range %d ... %d",
84
                                              config_params[i].name,
85
                                              config_params[i].min,
86
                                              config_params[i].max);
87
                                        goto out;
88
                                }
89
                                if(config_params[i].var) {
90
                                        TRACE(ft_t_info, "%s=%d", str, param);
91
                                        *config_params[i].var = param;
92
                                }
93
                                goto out;
94
                        }
95
                }
96
        }
97
        if (str) {
98
                TRACE(ft_t_err, "unknown ftape option [%s]", str);
99
 
100
                TRACE(ft_t_err, "allowed options are:");
101
                for (i=0; i < NR_ITEMS(config_params); i++) {
102
                        TRACE(ft_t_err, " %s",config_params[i].name);
103
                }
104
        } else {
105
                TRACE(ft_t_err, "botched ftape option");
106
        }
107
 out:
108
        TRACE_EXIT 1;
109
}
110
 
111
__setup("ftape=", ftape_setup);

powered by: WebSVN 2.1.0

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