Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
swim.c File Reference
#include <linux/module.h>
#include <linux/fd.h>
#include <linux/slab.h>
#include <linux/blkdev.h>
#include <linux/mutex.h>
#include <linux/hdreg.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <asm/mac_via.h>

Go to the source code of this file.

Data Structures

struct  sector_header
 
struct  swim
 
struct  iwm
 
struct  floppy_state
 
struct  swim_priv
 

Macros

#define CARDNAME   "swim"
 
#define DRIVER_VERSION   "Version 0.2 (2008-10-30)"
 
#define REG(x)   unsigned char x, x ## _pad[0x200 - 1];
 
#define swim_write(base, reg, v)   out_8(&(base)->write_##reg, (v))
 
#define swim_read(base, reg)   in_8(&(base)->read_##reg)
 
#define iwm_write(base, reg, v)   out_8(&(base)->reg, (v))
 
#define iwm_read(base, reg)   in_8(&(base)->reg)
 
#define SEEK_POSITIVE   0x070
 
#define SEEK_NEGATIVE   0x074
 
#define STEP   0x071
 
#define MOTOR_ON   0x072
 
#define MOTOR_OFF   0x076
 
#define INDEX   0x073
 
#define EJECT   0x077
 
#define SETMFM   0x171
 
#define SETGCR   0x175
 
#define RELAX   0x033
 
#define LSTRB   0x008
 
#define CA_MASK   0x077
 
#define READ_DATA_0   0x074
 
#define TWOMEG_DRIVE   0x075
 
#define SINGLE_SIDED   0x076
 
#define DRIVE_PRESENT   0x077
 
#define DISK_IN   0x170
 
#define WRITE_PROT   0x171
 
#define TRACK_ZERO   0x172
 
#define TACHO   0x173
 
#define READ_DATA_1   0x174
 
#define MFM_MODE   0x175
 
#define SEEK_COMPLETE   0x176
 
#define ONEMEG_MEDIA   0x177
 
#define MARK_BYTE   0x01
 
#define CRC_ZERO   0x02
 
#define RDDATA   0x04
 
#define SENSE   0x08
 
#define MOTEN   0x10
 
#define ERROR   0x20
 
#define DAT2BYTE   0x40
 
#define DAT1BYTE   0x80
 
#define S_INV_WDATA   0x01
 
#define S_3_5_SELECT   0x02
 
#define S_GCR   0x04
 
#define S_FCLK_DIV2   0x08
 
#define S_ERROR_CORR   0x10
 
#define S_IBM_DRIVE   0x20
 
#define S_GCR_WRITE   0x40
 
#define S_TIMEOUT   0x80
 
#define CLFIFO   0x01
 
#define ENBL1   0x02
 
#define ENBL2   0x04
 
#define ACTION   0x08
 
#define WRITE_MODE   0x10
 
#define HEDSEL   0x20
 
#define MOTON   0x80
 
#define FD_MAX_UNIT   2
 

Enumerations

enum  drive_location { INTERNAL_DRIVE = 0x02, EXTERNAL_DRIVE = 0x04 }
 
enum  media_type { DD_MEDIA, HD_MEDIA }
 
enum  motor_action { OFF, ON }
 
enum  head { LOWER_HEAD = 0, UPPER_HEAD = 1 }
 

Functions

struct sector_header __attribute__ ((packed))
 
int swim_read_sector_header (struct swim __iomem *base, struct sector_header *header)
 
int swim_read_sector_data (struct swim __iomem *base, unsigned char *data)
 
 module_init (swim_init)
 
 module_exit (swim_exit)
 
 MODULE_DESCRIPTION ("Driver for SWIM floppy controller")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_AUTHOR ("Laurent Vivier <laurent@lvivier.info>")
 
 MODULE_ALIAS_BLOCKDEV_MAJOR (FLOPPY_MAJOR)
 

Variables

unsigned char side
 
unsigned char track
 
unsigned char sector
 
unsigned char size
 
unsigned char crc0
 
unsigned char crc1
 
enum drive_location __attribute__
 

Macro Definition Documentation

#define ACTION   0x08

Definition at line 152 of file swim.c.

#define CA_MASK   0x077

Definition at line 108 of file swim.c.

#define CARDNAME   "swim"

Definition at line 31 of file swim.c.

#define CLFIFO   0x01

Definition at line 149 of file swim.c.

#define CRC_ZERO   0x02

Definition at line 128 of file swim.c.

#define DAT1BYTE   0x80

Definition at line 134 of file swim.c.

#define DAT2BYTE   0x40

Definition at line 133 of file swim.c.

#define DISK_IN   0x170

Definition at line 116 of file swim.c.

#define DRIVE_PRESENT   0x077

Definition at line 115 of file swim.c.

#define DRIVER_VERSION   "Version 0.2 (2008-10-30)"

Definition at line 42 of file swim.c.

#define EJECT   0x077

Definition at line 101 of file swim.c.

#define ENBL1   0x02

Definition at line 150 of file swim.c.

#define ENBL2   0x04

Definition at line 151 of file swim.c.

#define ERROR   0x20

Definition at line 132 of file swim.c.

#define FD_MAX_UNIT   2

Definition at line 209 of file swim.c.

#define HEDSEL   0x20

Definition at line 154 of file swim.c.

#define INDEX   0x073

Definition at line 100 of file swim.c.

#define iwm_read (   base,
  reg 
)    in_8(&(base)->reg)

Definition at line 91 of file swim.c.

#define iwm_write (   base,
  reg,
  v 
)    out_8(&(base)->reg, (v))

Definition at line 90 of file swim.c.

#define LSTRB   0x008

Definition at line 106 of file swim.c.

#define MARK_BYTE   0x01

Definition at line 127 of file swim.c.

#define MFM_MODE   0x175

Definition at line 121 of file swim.c.

#define MOTEN   0x10

Definition at line 131 of file swim.c.

#define MOTON   0x80

Definition at line 155 of file swim.c.

#define MOTOR_OFF   0x076

Definition at line 99 of file swim.c.

#define MOTOR_ON   0x072

Definition at line 98 of file swim.c.

#define ONEMEG_MEDIA   0x177

Definition at line 123 of file swim.c.

#define RDDATA   0x04

Definition at line 129 of file swim.c.

#define READ_DATA_0   0x074

Definition at line 112 of file swim.c.

#define READ_DATA_1   0x174

Definition at line 120 of file swim.c.

#define REG (   x)    unsigned char x, x ## _pad[0x200 - 1];

Definition at line 44 of file swim.c.

#define RELAX   0x033

Definition at line 105 of file swim.c.

#define S_3_5_SELECT   0x02

Definition at line 139 of file swim.c.

#define S_ERROR_CORR   0x10

Definition at line 142 of file swim.c.

#define S_FCLK_DIV2   0x08

Definition at line 141 of file swim.c.

#define S_GCR   0x04

Definition at line 140 of file swim.c.

#define S_GCR_WRITE   0x40

Definition at line 144 of file swim.c.

#define S_IBM_DRIVE   0x20

Definition at line 143 of file swim.c.

#define S_INV_WDATA   0x01

Definition at line 138 of file swim.c.

#define S_TIMEOUT   0x80

Definition at line 145 of file swim.c.

#define SEEK_COMPLETE   0x176

Definition at line 122 of file swim.c.

#define SEEK_NEGATIVE   0x074

Definition at line 96 of file swim.c.

#define SEEK_POSITIVE   0x070

Definition at line 95 of file swim.c.

#define SENSE   0x08

Definition at line 130 of file swim.c.

#define SETGCR   0x175

Definition at line 103 of file swim.c.

#define SETMFM   0x171

Definition at line 102 of file swim.c.

#define SINGLE_SIDED   0x076

Definition at line 114 of file swim.c.

#define STEP   0x071

Definition at line 97 of file swim.c.

#define swim_read (   base,
  reg 
)    in_8(&(base)->read_##reg)

Definition at line 67 of file swim.c.

#define swim_write (   base,
  reg,
  v 
)    out_8(&(base)->write_##reg, (v))

Definition at line 66 of file swim.c.

#define TACHO   0x173

Definition at line 119 of file swim.c.

#define TRACK_ZERO   0x172

Definition at line 118 of file swim.c.

#define TWOMEG_DRIVE   0x075

Definition at line 113 of file swim.c.

#define WRITE_MODE   0x10

Definition at line 153 of file swim.c.

#define WRITE_PROT   0x171

Definition at line 117 of file swim.c.

Enumeration Type Documentation

Enumerator:
INTERNAL_DRIVE 
EXTERNAL_DRIVE 

Definition at line 159 of file swim.c.

enum head
Enumerator:
LOWER_HEAD 
UPPER_HEAD 

Definition at line 204 of file swim.c.

enum media_type
Enumerator:
DD_MEDIA 
HD_MEDIA 

Definition at line 164 of file swim.c.

Enumerator:
OFF 
ON 

Definition at line 199 of file swim.c.

Function Documentation

struct sector_header __attribute__ ( (packed)  )
read

Definition at line 171 of file esd_usb2.c.

MODULE_ALIAS_BLOCKDEV_MAJOR ( FLOPPY_MAJOR  )
MODULE_AUTHOR ( "Laurent Vivier <laurent@lvivier.info>"  )
MODULE_DESCRIPTION ( "Driver for SWIM floppy controller )
module_exit ( swim_exit  )
module_init ( swim_init  )
MODULE_LICENSE ( "GPL"  )
int swim_read_sector_data ( struct swim __iomem base,
unsigned char data 
)
int swim_read_sector_header ( struct swim __iomem base,
struct sector_header header 
)

Variable Documentation

unsigned char crc0

Definition at line 45 of file swim.c.

unsigned char crc1

Definition at line 46 of file swim.c.

__u8 sector

Definition at line 43 of file swim.c.

unsigned char side

Definition at line 41 of file swim.c.

unsigned char size

Definition at line 44 of file swim.c.

unsigned char track

Definition at line 42 of file swim.c.