Go to the documentation of this file.
   44 static volatile bool done = 
FALSE;
 
   46 static bool diskChange = 
FALSE;
 
   47 static bool motor = 
FALSE;
 
   48 static volatile Int8 fdcTrack = 0xff;
 
   50 static volatile int timeOut = 0;
 
   51 static Int8 statSize = 0;
 
   52 static Int8 status[7] = { 0 };
 
   86   "  call floppyIsrhndlr \n" 
  104   for (tmo = 0; tmo < 128; tmo++) {
 
  106     if ((msr & 0xc0) == 0x80) {
 
  117   for (tmo = 0; tmo < 128; tmo++) {
 
  119     if ((msr & 0xd0) == 0xd0) {
 
  127 bool fdcRw(
int block, 
unsigned char *blockBuffer, 
bool read, 
unsigned long numSectors) {
 
  128   int head = 0x0, track = 0x0, sector = 0x0, tries = 0x0, copyCount = 0x0;
 
  129   unsigned char *p_tbaddr = (
unsigned char *) 0x80000;
 
  130   unsigned char *p_blockbuff = blockBuffer;
 
  132   block2Hts(block, &head, &track, §or);
 
  134   if (!
read && blockBuffer) {
 
  136     for (copyCount = 0; copyCount < (numSectors * 512); copyCount++) {
 
  137       *p_tbaddr = *p_blockbuff;
 
  142   for (tries = 0; tries < 3; tries++) {
 
  148       kprint(
"FDC: Disk change detected. Trying again.\n");
 
  149       return fdcRw(block, blockBuffer, 
read, numSectors);
 
  153       kprintf(
"FDC: Error seeking to track [%i]\n", block);
 
  179       kprint(
"Timed out, trying operation again after reset()\n");
 
  181       return fdcRw(block, blockBuffer, 
read, numSectors);
 
  183     if ((status[0] & 0xc0) == 0)
 
  188   if (
read && blockBuffer) {
 
  189     p_blockbuff = blockBuffer;
 
  190     p_tbaddr = (
unsigned char *) 0x80000;
 
  191     for (copyCount = 0x0; copyCount < (numSectors * 512); copyCount++) {
 
  192       *p_blockbuff = *p_tbaddr;
 
  200 void block2Hts(
int block, 
int *head, 
int *track, 
int *sector) {
 
  201   *head = (block % (geometry.
spt * geometry.
heads)) / (geometry.
spt);
 
  202   *track = block / (geometry.
spt * geometry.
heads);
 
  203   *sector = block % geometry.
spt + 1;
 
  207   if (motor == 
FALSE) {
 
  222   if (fdcTrack == track) {
 
  232   if ((sr0 != 0x20) || (fdcTrack != track)) {
 
  241   int result = 0x0, loop = 0x0;
 
  242   if (numSectors > 1) {
 
  243     for (loop = 0; loop < numSectors; loop++) {
 
  244       result = 
fdcRw(block + loop, blockBuffer + (loop * 512), 
TRUE, 1);
 
  248   return fdcRw(block, blockBuffer, 
TRUE, numSectors);
 
  252   return fdcRw(block, blockBuffer, 
FALSE, numSectors);
 
  257   while (!done && timeOut)
 
  261     status[(int) statSize++] = 
getByte();
 
  305   readBlock(startSector, baseAddr, sectorCount);
 
  310   writeBlock(startSector, baseAddr, sectorCount);
 
  
 
void dmaXfer(uInt8 channel, uInt32 address, uInt length, uInt8 read)
 
void fdcWrite(void *info, void *baseAddr, uInt32 startSector, uInt32 sectorCount)
 
void outportByte(unsigned int, unsigned char)
outputut one byte to specified port
 
void spinUnlock(spinLock_t *lock)
 
void block2Hts(int block, int *head, int *track, int *sector)
 
#define SPIN_LOCK_INITIALIZER
 
int device_add(int, char, struct device_interface *)
 
void spinLock(spinLock_t *lock)
 
unsigned char inportByte(unsigned int)
input one byte from specified port
 
bool readBlock(int block, Int8 *blockBuffer, unsigned long numSectors)
 
bool writeBlock(int block, Int8 *blockBuffer, unsigned long numSectors)
 
void fdcRead(void *info, void *baseAddr, uInt32 startSector, uInt32 sectorCount)
 
int devfs_makeNode(char *name, uInt8 type, uInt16 major, uInt16 minor)
 
int(* write)(void *, void *, uInt32, uInt32)
 
int read(struct thread *td, struct read_args *uap)
 
int(* read)(void *, void *, uInt32, uInt32)
 
void * kmalloc(uInt32 len)
 
void setVector(void *handler, unsigned char interrupt, unsigned short controlMajor)
 
void irqEnable(uInt16 irqNo)
 
struct device_interface * devInfo
 
int fdcInit2(struct device_node *dev)
 
int kprintf(const char *,...)
 
bool fdcRw(int block, unsigned char *blockBuffer, bool read, unsigned long numSectors)
 
void kprint(char *string)
 
bool waitFdc(bool sensei)