nckernel  0.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
fdc_ctrl.c File Reference
#include <sys/types.h>
#include <sys/io.h>
#include <stddef.h>
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include <errno.h>
#include <list.h>
#include <semaphore.h>
#include <device.h>
#include <pthread.h>
#include <assert.h>
#include <isr.h>
#include <interrupt.h>
#include <fdc.h>
#include <fdc_ctrl.h>
#include <fdc_single.h>
#include <debug.h>
Include dependency graph for fdc_ctrl.c:

Go to the source code of this file.

Functions

int fdc_fini_ctrl (struct fdc_context *ctx)
 
int fdc_init_ctrl (struct fdc_context *ctx, int minor)
 
int fdc_lock (struct fdc_context *ctx)
 
void fdc_motor_off (struct fdc_context *ctx)
 
void fdc_motor_on (struct fdc_context *ctx)
 
int fdc_read_deleted_sector (struct fdc_context *ctx, int c, int h, int r)
 
int fdc_read_id (struct fdc_context *ctx, int head)
 
int fdc_read_sector (struct fdc_context *ctx, int c, int h, int r)
 
int fdc_read_track (struct fdc_context *ctx, unsigned char c, unsigned char h, unsigned char r)
 
int fdc_seek (struct fdc_context *ctx, int cyl, int head)
 
int fdc_unlock (struct fdc_context *ctx)
 
int fdc_verify (struct fdc_context *ctx, unsigned char c, unsigned char h, unsigned char r)
 
int fdc_version (struct fdc_context *ctx, unsigned char *ver)
 
int fdc_write_deleted_sector (struct fdc_context *ctx, unsigned char c, unsigned char h, unsigned char r)
 
int fdc_write_sector (struct fdc_context *ctx, unsigned char c, unsigned char h, unsigned char r)
 

Function Documentation

int fdc_fini_ctrl ( struct fdc_context ctx)

Definition at line 1078 of file fdc_ctrl.c.

References fdc_single_put(), NULL, and fdc_context::single.

Referenced by fdc_close().

Here is the call graph for this function:

Here is the caller graph for this function:

int fdc_init_ctrl ( struct fdc_context ctx,
int  minor 
)

Definition at line 1041 of file fdc_ctrl.c.

References assert, DRIVE_A, EFAULT, EINVAL, ENOTSUP, FDC_PRIMARY, fdc_single_get(), fdc_single_initiate(), fdc_single_is_initiated(), fdc_version(), and fdc_context::single.

Referenced by fdc_open().

Here is the call graph for this function:

Here is the caller graph for this function:

int fdc_lock ( struct fdc_context ctx)

Definition at line 307 of file fdc_ctrl.c.

References CMD_LOCK, EIO, and VALIDATE_RESULT.

void fdc_motor_off ( struct fdc_context ctx)

Definition at line 1031 of file fdc_ctrl.c.

References fdc_single_ctrl(), fdc_single_drive(), inb(), digital_output_register::motor, outb(), REG_DOR, and fdc_context::single.

Referenced by fdc_close().

Here is the call graph for this function:

Here is the caller graph for this function:

void fdc_motor_on ( struct fdc_context ctx)

Definition at line 1021 of file fdc_ctrl.c.

References fdc_single_ctrl(), fdc_single_drive(), inb(), digital_output_register::motor, outb(), REG_DOR, and fdc_context::single.

Referenced by fdc_open().

Here is the call graph for this function:

Here is the caller graph for this function:

int fdc_read_deleted_sector ( struct fdc_context ctx,
int  c,
int  h,
int  r 
)
int fdc_read_id ( struct fdc_context ctx,
int  head 
)

Definition at line 443 of file fdc_ctrl.c.

References assert, CMD_EXT_DENSITY, CMD_READ_ID, fdc_single_drive(), fdc_single_sem(), sem_wait(), fdc_context::single, and VALIDATE_RESULT.

Here is the call graph for this function:

int fdc_read_sector ( struct fdc_context ctx,
int  c,
int  h,
int  r 
)
Note
Sector number(r) is started from 0.

Definition at line 502 of file fdc_ctrl.c.

References assert, CMD_EXT_DENSITY, CMD_EXT_MULTITRACK, CMD_EXT_SKIP, CMD_READ_DATA, FD_SECTOR_PER_TRACK, fdc_single_drive(), fdc_single_sem(), SECTOR_512, sem_wait(), fdc_context::single, and VALIDATE_RESULT.

Here is the call graph for this function:

int fdc_read_track ( struct fdc_context ctx,
unsigned char  c,
unsigned char  h,
unsigned char  r 
)

Definition at line 817 of file fdc_ctrl.c.

References assert, CMD_EXT_DENSITY, CMD_READ_TRACK, FD_SECTOR_PER_TRACK, fdc_single_drive(), fdc_single_sem(), SECTOR_512, sem_wait(), fdc_context::single, and VALIDATE_RESULT.

Here is the call graph for this function:

int fdc_seek ( struct fdc_context ctx,
int  cyl,
int  head 
)

Definition at line 273 of file fdc_ctrl.c.

References assert, CMD_SEEK, EIO, fdc_single_drive(), fdc_single_sem(), sem_wait(), fdc_context::single, and VALIDATE_RESULT.

Here is the call graph for this function:

int fdc_unlock ( struct fdc_context ctx)

Definition at line 326 of file fdc_ctrl.c.

References CMD_LOCK, EIO, and VALIDATE_RESULT.

int fdc_verify ( struct fdc_context ctx,
unsigned char  c,
unsigned char  h,
unsigned char  r 
)
int fdc_version ( struct fdc_context ctx,
unsigned char *  ver 
)

Definition at line 1005 of file fdc_ctrl.c.

References CMD_VERSION, and VALIDATE_RESULT.

Referenced by fdc_init_ctrl(), and fdc_ioctl().

Here is the caller graph for this function:

int fdc_write_deleted_sector ( struct fdc_context ctx,
unsigned char  c,
unsigned char  h,
unsigned char  r 
)
int fdc_write_sector ( struct fdc_context ctx,
unsigned char  c,
unsigned char  h,
unsigned char  r 
)