Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is subject to the terms and conditions of the GNU General Public
0003  * License.  See the file "COPYING" in the main directory of this archive
0004  * for more details.
0005  *
0006  * Copyright (C) 1996, 1997, 1998, 2003 by Ralf Baechle
0007  */
0008 #ifndef __ASM_MACH_GENERIC_FLOPPY_H
0009 #define __ASM_MACH_GENERIC_FLOPPY_H
0010 
0011 #include <linux/delay.h>
0012 #include <linux/ioport.h>
0013 #include <linux/sched.h>
0014 #include <linux/linkage.h>
0015 #include <linux/types.h>
0016 #include <linux/mm.h>
0017 
0018 #include <asm/bootinfo.h>
0019 #include <asm/cachectl.h>
0020 #include <asm/dma.h>
0021 #include <asm/floppy.h>
0022 #include <asm/io.h>
0023 #include <asm/irq.h>
0024 
0025 /*
0026  * How to access the FDC's registers.
0027  */
0028 static inline unsigned char fd_inb(unsigned int base, unsigned int reg)
0029 {
0030     return inb_p(base + reg);
0031 }
0032 
0033 static inline void fd_outb(unsigned char value, unsigned int base, unsigned int reg)
0034 {
0035     outb_p(value, base + reg);
0036 }
0037 
0038 /*
0039  * How to access the floppy DMA functions.
0040  */
0041 static inline void fd_enable_dma(void)
0042 {
0043     enable_dma(FLOPPY_DMA);
0044 }
0045 
0046 static inline void fd_disable_dma(void)
0047 {
0048     disable_dma(FLOPPY_DMA);
0049 }
0050 
0051 static inline int fd_request_dma(void)
0052 {
0053     return request_dma(FLOPPY_DMA, "floppy");
0054 }
0055 
0056 static inline void fd_free_dma(void)
0057 {
0058     free_dma(FLOPPY_DMA);
0059 }
0060 
0061 static inline void fd_clear_dma_ff(void)
0062 {
0063     clear_dma_ff(FLOPPY_DMA);
0064 }
0065 
0066 static inline void fd_set_dma_mode(char mode)
0067 {
0068     set_dma_mode(FLOPPY_DMA, mode);
0069 }
0070 
0071 static inline void fd_set_dma_addr(char *addr)
0072 {
0073     set_dma_addr(FLOPPY_DMA, (unsigned long) addr);
0074 }
0075 
0076 static inline void fd_set_dma_count(unsigned int count)
0077 {
0078     set_dma_count(FLOPPY_DMA, count);
0079 }
0080 
0081 static inline int fd_get_dma_residue(void)
0082 {
0083     return get_dma_residue(FLOPPY_DMA);
0084 }
0085 
0086 static inline void fd_enable_irq(void)
0087 {
0088     enable_irq(FLOPPY_IRQ);
0089 }
0090 
0091 static inline void fd_disable_irq(void)
0092 {
0093     disable_irq(FLOPPY_IRQ);
0094 }
0095 
0096 static inline int fd_request_irq(void)
0097 {
0098     return request_irq(FLOPPY_IRQ, floppy_interrupt,
0099                0, "floppy", NULL);
0100 }
0101 
0102 static inline void fd_free_irq(void)
0103 {
0104     free_irq(FLOPPY_IRQ, NULL);
0105 }
0106 
0107 #define fd_free_irq()       free_irq(FLOPPY_IRQ, NULL);
0108 
0109 
0110 static inline unsigned long fd_getfdaddr1(void)
0111 {
0112     return 0x3f0;
0113 }
0114 
0115 static inline unsigned long fd_dma_mem_alloc(unsigned long size)
0116 {
0117     return __get_dma_pages(GFP_KERNEL, get_order(size));
0118 }
0119 
0120 static inline void fd_dma_mem_free(unsigned long addr, unsigned long size)
0121 {
0122     free_pages(addr, get_order(size));
0123 }
0124 
0125 static inline unsigned long fd_drive_type(unsigned long n)
0126 {
0127     if (n == 0)
0128         return 4;   /* 3,5", 1.44mb */
0129 
0130     return 0;
0131 }
0132 
0133 #endif /* __ASM_MACH_GENERIC_FLOPPY_H */