Linux Audio

Check our new training course

Loading...
v3.5.6
  1/*
  2 * This file is subject to the terms and conditions of the GNU General Public
  3 * License.  See the file "COPYING" in the main directory of this archive
  4 * for more details.
  5 *
  6 * Copyright (C) 1996, 1997, 1998, 2003 by Ralf Baechle
  7 */
  8#ifndef __ASM_MACH_GENERIC_FLOPPY_H
  9#define __ASM_MACH_GENERIC_FLOPPY_H
 10
 11#include <linux/delay.h>
 12#include <linux/init.h>
 13#include <linux/ioport.h>
 14#include <linux/sched.h>
 15#include <linux/linkage.h>
 16#include <linux/types.h>
 17#include <linux/mm.h>
 18
 19#include <asm/bootinfo.h>
 20#include <asm/cachectl.h>
 21#include <asm/dma.h>
 22#include <asm/floppy.h>
 23#include <asm/io.h>
 24#include <asm/irq.h>
 25#include <asm/pgtable.h>
 26
 27/*
 28 * How to access the FDC's registers.
 29 */
 30static inline unsigned char fd_inb(unsigned int port)
 31{
 32	return inb_p(port);
 33}
 34
 35static inline void fd_outb(unsigned char value, unsigned int port)
 36{
 37	outb_p(value, port);
 38}
 39
 40/*
 41 * How to access the floppy DMA functions.
 42 */
 43static inline void fd_enable_dma(void)
 44{
 45	enable_dma(FLOPPY_DMA);
 46}
 47
 48static inline void fd_disable_dma(void)
 49{
 50	disable_dma(FLOPPY_DMA);
 51}
 52
 53static inline int fd_request_dma(void)
 54{
 55	return request_dma(FLOPPY_DMA, "floppy");
 56}
 57
 58static inline void fd_free_dma(void)
 59{
 60	free_dma(FLOPPY_DMA);
 61}
 62
 63static inline void fd_clear_dma_ff(void)
 64{
 65	clear_dma_ff(FLOPPY_DMA);
 66}
 67
 68static inline void fd_set_dma_mode(char mode)
 69{
 70	set_dma_mode(FLOPPY_DMA, mode);
 71}
 72
 73static inline void fd_set_dma_addr(char *addr)
 74{
 75	set_dma_addr(FLOPPY_DMA, (unsigned long) addr);
 76}
 77
 78static inline void fd_set_dma_count(unsigned int count)
 79{
 80	set_dma_count(FLOPPY_DMA, count);
 81}
 82
 83static inline int fd_get_dma_residue(void)
 84{
 85	return get_dma_residue(FLOPPY_DMA);
 86}
 87
 88static inline void fd_enable_irq(void)
 89{
 90	enable_irq(FLOPPY_IRQ);
 91}
 92
 93static inline void fd_disable_irq(void)
 94{
 95	disable_irq(FLOPPY_IRQ);
 96}
 97
 98static inline int fd_request_irq(void)
 99{
100	return request_irq(FLOPPY_IRQ, floppy_interrupt,
101	                   0, "floppy", NULL);
102}
103
104static inline void fd_free_irq(void)
105{
106	free_irq(FLOPPY_IRQ, NULL);
107}
108
109#define fd_free_irq()           free_irq(FLOPPY_IRQ, NULL);
110
111
112static inline unsigned long fd_getfdaddr1(void)
113{
114	return 0x3f0;
115}
116
117static inline unsigned long fd_dma_mem_alloc(unsigned long size)
118{
119	unsigned long mem;
120
121	mem = __get_dma_pages(GFP_KERNEL, get_order(size));
122
123	return mem;
124}
125
126static inline void fd_dma_mem_free(unsigned long addr, unsigned long size)
127{
128	free_pages(addr, get_order(size));
129}
130
131static inline unsigned long fd_drive_type(unsigned long n)
132{
133	if (n == 0)
134		return 4;	/* 3,5", 1.44mb */
135
136	return 0;
137}
138
139#endif /* __ASM_MACH_GENERIC_FLOPPY_H */
v6.13.7
  1/*
  2 * This file is subject to the terms and conditions of the GNU General Public
  3 * License.  See the file "COPYING" in the main directory of this archive
  4 * for more details.
  5 *
  6 * Copyright (C) 1996, 1997, 1998, 2003 by Ralf Baechle
  7 */
  8#ifndef __ASM_MACH_GENERIC_FLOPPY_H
  9#define __ASM_MACH_GENERIC_FLOPPY_H
 10
 11#include <linux/delay.h>
 
 12#include <linux/ioport.h>
 13#include <linux/sched.h>
 14#include <linux/linkage.h>
 15#include <linux/types.h>
 16#include <linux/mm.h>
 17
 18#include <asm/bootinfo.h>
 19#include <asm/cachectl.h>
 20#include <asm/dma.h>
 21#include <asm/floppy.h>
 22#include <asm/io.h>
 23#include <asm/irq.h>
 
 24
 25/*
 26 * How to access the FDC's registers.
 27 */
 28static inline unsigned char fd_inb(unsigned int base, unsigned int reg)
 29{
 30	return inb_p(base + reg);
 31}
 32
 33static inline void fd_outb(unsigned char value, unsigned int base, unsigned int reg)
 34{
 35	outb_p(value, base + reg);
 36}
 37
 38/*
 39 * How to access the floppy DMA functions.
 40 */
 41static inline void fd_enable_dma(void)
 42{
 43	enable_dma(FLOPPY_DMA);
 44}
 45
 46static inline void fd_disable_dma(void)
 47{
 48	disable_dma(FLOPPY_DMA);
 49}
 50
 51static inline int fd_request_dma(void)
 52{
 53	return request_dma(FLOPPY_DMA, "floppy");
 54}
 55
 56static inline void fd_free_dma(void)
 57{
 58	free_dma(FLOPPY_DMA);
 59}
 60
 61static inline void fd_clear_dma_ff(void)
 62{
 63	clear_dma_ff(FLOPPY_DMA);
 64}
 65
 66static inline void fd_set_dma_mode(char mode)
 67{
 68	set_dma_mode(FLOPPY_DMA, mode);
 69}
 70
 71static inline void fd_set_dma_addr(char *addr)
 72{
 73	set_dma_addr(FLOPPY_DMA, (unsigned long) addr);
 74}
 75
 76static inline void fd_set_dma_count(unsigned int count)
 77{
 78	set_dma_count(FLOPPY_DMA, count);
 79}
 80
 81static inline int fd_get_dma_residue(void)
 82{
 83	return get_dma_residue(FLOPPY_DMA);
 84}
 85
 86static inline void fd_enable_irq(void)
 87{
 88	enable_irq(FLOPPY_IRQ);
 89}
 90
 91static inline void fd_disable_irq(void)
 92{
 93	disable_irq(FLOPPY_IRQ);
 94}
 95
 96static inline int fd_request_irq(void)
 97{
 98	return request_irq(FLOPPY_IRQ, floppy_interrupt,
 99			   0, "floppy", NULL);
100}
101
102static inline void fd_free_irq(void)
103{
104	free_irq(FLOPPY_IRQ, NULL);
105}
106
107#define fd_free_irq()		free_irq(FLOPPY_IRQ, NULL);
108
109
110static inline unsigned long fd_getfdaddr1(void)
111{
112	return 0x3f0;
113}
114
115static inline unsigned long fd_dma_mem_alloc(unsigned long size)
116{
117	return __get_dma_pages(GFP_KERNEL, get_order(size));
 
 
 
 
118}
119
120static inline void fd_dma_mem_free(unsigned long addr, unsigned long size)
121{
122	free_pages(addr, get_order(size));
123}
124
125static inline unsigned long fd_drive_type(unsigned long n)
126{
127	if (n == 0)
128		return 4;	/* 3,5", 1.44mb */
129
130	return 0;
131}
132
133#endif /* __ASM_MACH_GENERIC_FLOPPY_H */