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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [mips/] [kernel/] [tyne-c.c] - Blame information for rev 1777

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

Line No. Rev Author Line
1 1624 jcastillo
/*
2
 * Deskstation Tyne specific C parts
3
 *
4
 * This file is subject to the terms and conditions of the GNU General Public
5
 * License.  See the file "COPYING" in the main directory of this archive
6
 * for more details.
7
 *
8
 * Copyright (C) 1994, 1995 by Ralf Baechle
9
 */
10
#include <linux/delay.h>
11
#include <linux/kernel.h>
12
#include <linux/types.h>
13
#include <asm/bootinfo.h>
14
#include <asm/cachectl.h>
15
#include <asm/dma.h>
16
#include <asm/io.h>
17
 
18
/*
19
 * How to access the FDC's registers.
20
 */
21
unsigned char deskstation_tyne_fd_inb(unsigned int port)
22
{
23
        return inb_p(port);
24
}
25
 
26
void deskstation_tyne_fd_outb(unsigned char value, unsigned int port)
27
{
28
        outb_p(value, port);
29
}
30
 
31
/*
32
 * How to access the floppy DMA functions.
33
 */
34
void deskstation_tyne_fd_enable_dma(void)
35
{
36
        enable_dma(FLOPPY_DMA);
37
}
38
 
39
void deskstation_tyne_fd_disable_dma(void)
40
{
41
        disable_dma(FLOPPY_DMA);
42
}
43
 
44
int deskstation_tyne_fd_request_dma(void)
45
{
46
        return request_dma(FLOPPY_DMA, "floppy");
47
}
48
 
49
void deskstation_tyne_fd_free_dma(void)
50
{
51
        free_dma(FLOPPY_DMA);
52
}
53
 
54
void deskstation_tyne_fd_clear_dma_ff(void)
55
{
56
        clear_dma_ff(FLOPPY_DMA);
57
}
58
 
59
int deskstation_tyne_fd_set_dma_mode(char mode)
60
{
61
        return set_dma_mode(FLOPPY_DMA, mode);
62
}
63
 
64
void deskstation_tyne_fd_set_dma_addr(unsigned int a)
65
{
66
        set_dma_addr(FLOPPY_DMA, addr);
67
}
68
 
69
void deskstation_tyne_fd_set_dma_count(unsigned int count)
70
{
71
        set_dma_count(FLOPPY_DMA, count);
72
}
73
 
74
int deskstation_tyne_fd_get_dma_residue(void)
75
{
76
        return get_dma_residue(FLOPPY_DMA);
77
}
78
 
79
void deskstation_tyne_fd_enable_irq(void)
80
{
81
        enable_irq(FLOPPY_IRQ);
82
}
83
 
84
void deskstation_tyne_fd_disable_irq(void)
85
{
86
        disable_irq(FLOPPY_IRQ);
87
}
88
 
89
void deskstation_tyne_fd_cacheflush(unsigned char *addr, unsigned int)
90
{
91
        sys_cacheflush((void *)addr, size, DCACHE);
92
}
93
 
94
 
95
/*
96
 * Tiny Tyne DMA buffer allocator
97
 *
98
 * Untested for a long time and changed again and again ...
99
 * Sorry, but no hardware to test ...
100
 */
101
static unsigned long allocated;
102
 
103
/*
104
 * Not very sophisticated, but should suffice for now...
105
 */
106
unsigned long deskstation_tyne_dma_alloc(size_t size)
107
{
108
        unsigned long ret = allocated;
109
        allocated += size;
110
        if (allocated > boot_info.dma_cache_size)
111
                ret = -1;
112
        return ret;
113
}
114
 
115
void deskstation_tyne_dma_init(void)
116
{
117
        if (boot_info.machtype != MACH_DESKSTATION_TYNE)
118
                return;
119
        allocated = 0;
120
        printk ("Deskstation Tyne DMA (%luk) buffer initialized.\n",
121
                boot_info.dma_cache_size >> 10);
122
}

powered by: WebSVN 2.1.0

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