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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-armnommu/] [floppy.h] - Blame information for rev 1777

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

Line No. Rev Author Line
1 1633 jcastillo
/*
2
 * linux/include/asm-arm/floppy.h
3
 *
4
 * (C) 1996 Russell King
5
 */
6
#ifndef __ASM_ARM_FLOPPY_H
7
#define __ASM_ARM_FLOPPY_H
8
#if 0
9
#include <asm/arch/floppy.h>
10
#endif
11
 
12
#define fd_outb(val,port)       outb((val),(port))
13
#define fd_inb(port)            inb((port))
14
#define fd_request_irq()        request_irq(IRQ_FLOPPYDISK,floppy_interrupt,\
15
                                        SA_INTERRUPT|SA_SAMPLE_RANDOM,"floppy",NULL)
16
#define fd_free_irq()           free_irq(IRQ_FLOPPYDISK,NULL)
17
#define fd_disable_irq()        disable_irq(IRQ_FLOPPYDISK)
18
#define fd_enable_irq()         enable_irq(IRQ_FLOPPYDISK)
19
 
20
#define fd_request_dma()        request_dma(FLOPPY_DMA,"floppy")
21
#define fd_free_dma()           free_dma(FLOPPY_DMA)
22
#define fd_disable_dma()        disable_dma(FLOPPY_DMA)
23
#define fd_enable_dma()         enable_dma(FLOPPY_DMA)
24
#define fd_clear_dma_ff()       clear_dma_ff(FLOPPY_DMA)
25
#define fd_set_dma_mode(mode)   set_dma_mode(FLOPPY_DMA, (mode))
26
#define fd_set_dma_addr(addr)   set_dma_addr(FLOPPY_DMA, (addr))
27
#define fd_set_dma_count(len)   set_dma_count(FLOPPY_DMA, (len))
28
#define fd_cacheflush(addr,sz)
29
 
30
/* Floppy_selects is the list of DOR's to select drive fd
31
 *
32
 * On initialisation, the floppy list is scanned, and the drives allocated
33
 * in the order that they are found.  This is done by seeking the drive
34
 * to a non-zero track, and then restoring it to track 0.  If an error occurs,
35
 * then there is no floppy drive present.       [to be put back in again]
36
 */
37
static unsigned char floppy_selects[2][4] =
38
{
39
        { 0x10, 0x21, 0x23, 0x33 },
40
        { 0x10, 0x21, 0x23, 0x33 }
41
};
42
 
43
#define fd_setdor(dor)                                                                          \
44
do {                                                                                            \
45
        int new_dor = (dor);                                                                    \
46
        if (new_dor & 0xf0)                                                                     \
47
                fd_outb((new_dor & 0x0c) | floppy_selects[fdc][new_dor & 3], FD_DOR);           \
48
        else                                                                                    \
49
                fd_outb((new_dor & 0x0c), FD_DOR);                                              \
50
} while (0)
51
 
52
/*
53
 * Someday, we'll automatically detect which drives are present...
54
 */
55
extern __inline__ void fd_scandrives (void)
56
{
57
#if 0
58
        int floppy, drive_count;
59
 
60
        fd_disable_irq();
61
        raw_cmd = &default_raw_cmd;
62
        raw_cmd->flags = FD_RAW_SPIN | FD_RAW_NEED_SEEK;
63
        raw_cmd->track = 0;
64
        raw_cmd->rate = ?;
65
        drive_count = 0;
66
        for (floppy = 0; floppy < 4; floppy ++) {
67
                current_drive = drive_count;
68
                /*
69
                 * Turn on floppy motor
70
                 */
71
                if (start_motor(redo_fd_request))
72
                        continue;
73
                /*
74
                 * Set up FDC
75
                 */
76
                fdc_specify();
77
                /*
78
                 * Tell FDC to recalibrate
79
                 */
80
                output_byte(FD_RECALIBRATE);
81
                LAST_OUT(UNIT(floppy));
82
                /* wait for command to complete */
83
                if (!successful) {
84
                        int i;
85
                        for (i = drive_count; i < 3; i--)
86
                                floppy_selects[fdc][i] = floppy_selects[fdc][i + 1];
87
                        floppy_selects[fdc][3] = 0;
88
                        floppy -= 1;
89
                } else
90
                        drive_count++;
91
        }
92
#else
93
        floppy_selects[0][0] = 0x10;
94
        floppy_selects[0][1] = 0x21;
95
        floppy_selects[0][2] = 0x23;
96
        floppy_selects[0][3] = 0x33;
97
#endif
98
}
99
 
100
#define FDC1 (0x3f0)
101
static int FDC2 = -1;
102
 
103
#define FLOPPY0_TYPE 4
104
#define FLOPPY1_TYPE 4
105
 
106
#define N_FDC 1
107
#define N_DRIVE 8
108
 
109
#define FLOPPY_MOTOR_MASK 0xf0
110
 
111
#define CROSS_64KB(a,s) (0)
112
 
113
#endif

powered by: WebSVN 2.1.0

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