ncloader  0.1
 모두 데이타 구조 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 매크로 그룹들 페이지들
Floppy Drive Controller

플로피 디스크 드라이버를 구현한다. 더 자세히 ...

+ Floppy Drive Controller에 대한 협력 다이어그램:

데이타 구조

struct  status_register
 
struct  status_register_b
 
struct  digital_output_register
 
struct  tape_drive_register
 
struct  datarate_select_register
 
struct  main_status_register
 
struct  digital_input_register
 
struct  configuration_control_register
 
struct  fdc_context
 

매크로

#define REG_SRA(base)   (base)
 
#define SRA(reg)   ((SRA_t*)(ret))
 
#define REG_SRB(base)   ((base) + 0x01)
 
#define SRB(reg)   ((SRB_t*)(reg))
 
#define REG_DOR(base)   ((base) + 0x02)
 
#define DOR_RESET(ctx)
 
#define DOR_ENABLE(ctx, drv, dma)
 
#define REG_TDR(base)   ((base) + 0x03)
 
#define REG_DSR(base)   ((base) + 0x04)
 
#define SELECT_DRATE(reg, rate)
 
#define DSR_RESET(reg)
 
#define REG_MSR(base)   ((base) + 0x04)
 
#define MSR(reg)   ((MSR_t*)(reg))
 
#define DIR_OF_DATA(reg)   (MSR(reg)->RQM ? (MSR(reg)->DIO ? READ_REQUIRED : WRITE_REQUIRED) : UNDEFINED)
 
#define IN_RESULT_PHASE(reg)   (MSR(reg)->cmd_busy)
 
#define IN_SEEK_PORTION(reg)   (MSR(reg)->drive_busy)
 
#define REG_FIFO(base)   ((base) + 0x05)
 
#define REG_DIR(base)   ((base) + 0x07)
 
#define REG_CCR(base)   ((base) + 0x07)
 
#define SET_DRATE(reg, drate)   (((CCR_t*)(reg))->drate_sel = (drate))
 
#define LBA_TO_CHS(lba, h, t, s)
 Converting the Logical Block Address to CHS. CHS: Cylinder, Head, Sector. 더 자세히 ...
 
#define VALIDATE_RESULT(ctx)
 

타입정의

typedef struct status_register SRA_t
 
typedef struct status_register_b SRB_t
 
typedef struct
digital_output_register 
DOR_t
 
typedef struct tape_drive_register TDR_t
 
typedef struct
datarate_select_register 
DSR_t
 
typedef struct main_status_register MSR_t
 
typedef struct
digital_input_register 
DIR_t
 
typedef struct
configuration_control_register 
CCR_t
 

열거형 타입

enum  { FD_SECTOR_PER_TRACK = 18, FD_HEAD = 2, FD_BLKSZ = 512 }
 트랙, 헤드, 블럭크기를 정의한다. 더 자세히 ...
 
enum  base_address { FDC_PRIMARY = 0x3F0, FDC_SECONDARY = 0x370, FDC_BASE_MAX = 0xFFFF }
 플로피 디스크 드라이버 Primary,Secondary 포트 주소 정의 더 자세히 ...
 
enum  bytes_per_sector { SECTOR_128 = 0, SECTOR_256 = 1, SECTOR_512 = 2, SECTOR_1024 = 3 }
 섹터당 바이트 수를 정의한다 더 자세히 ...
 
enum  drive_activation_values { DRIVE0 = 0x1C, DRIVE1 = 0x2D, DRIVE2 = 0x4E, DRIVE3 = 0x8F }
 
enum  dma_state { DMA = 0x01, NONDMA = 0x00 }
 
enum  precompensation_delays {
  DELAY_DISABLED = 0x07, DELAY_41_67ns = 0x01, DELAY_83_34ns = 0x02, DELAY_125ns = 0x03,
  DELAY_166_67ns = 0x04, DELAY_208_33ns = 0x05, DELAY_250ns = 0x06, DELAY_DEFAULT = 0x0
}
 
enum  data_rates { DRATE_1Mbps = 0x03, DRATE_500Kbps = 0x00, DRATE_300Kbps = 0x01, DRATE_250Kbps = 0x02 }
 
enum  drive_letter {
  DRIVE_A = 0x00, DRIVE_B = 0x01, DRIVE_C = 0x02, DRIVE_D = 0x03,
  DRIVE_MAX = 0xFF
}
 
enum  dir_of_data { UNDEFINED = 0x00, READ_REQUIRED = 0x01, WRITE_REQUIRED = 0x02, MAX_DIR_OF_DATA = 0xFF }
 
enum  fdc_dma_dir_t { FDC_DMA_READ = 1, FDC_DMA_WRITE = 2 }
 
enum  command_set {
  CMD_READ_DATA = 0x06, CMD_READ_DELETED_DATA = 0x0C, CMD_WRITE_DATA = 0x05, CMD_WRITE_DELETED_DATA = 0x09,
  CMD_READ_TRACK = 0x02, CMD_VERIFY = 0x16, CMD_VERSION = 0x10, CMD_FORMAT_TRACK = 0x0D,
  CMD_SCAN_EQUAL = 0x11, CMD_SCAN_LOW_OR_EQUAL = 0x19, CMD_SCAN_HIGH_OR_EQUAL = 0x1D, CMD_RECALIBRATE = 0x07,
  CMD_SENSE_INTERRUPT = 0x08, CMD_SPECIFY = 0x03, CMD_SEND_DRIVE_STATUS = 0x04, CMD_SEEK = 0x0F,
  CMD_CONFIGURE = 0x13, CMD_RELATIVE_SEEK = 0x8F, CMD_DUMPREG = 0x0E, CMD_READ_ID = 0x0A,
  CMD_PERPENDICULAR_MODE = 0x12, CMD_LOCK = 0x14, CMD_EXT_MULTITRACK = 0x80, CMD_EXT_DENSITY = 0x40,
  CMD_EXT_SKIP = 0x20
}
 
enum  symbol { EIS = 0x06, EFIFO = 0x05, POLL = 0x04 }
 

함수

int fdc_init (void)
 

상세한 설명

플로피 디스크 드라이버를 구현한다.

작성자
Sung-jae Park nices.nosp@m.j@ni.nosp@m.cesj..nosp@m.com
날짜
2011-8-16

매크로 문서화

#define DIR_OF_DATA (   reg)    (MSR(reg)->RQM ? (MSR(reg)->DIO ? READ_REQUIRED : WRITE_REQUIRED) : UNDEFINED)
#define DOR_ENABLE (   ctx,
  drv,
  dma 
)
값:
do { \
unsigned char reg; \
DOR_t *dor = (DOR_t*)® \
dor->b_reset = 1; \
dor->drive = (drv); \
dor->b_dma_gate = (dma); \
dor->motor = 0x01 << (drv); \
outb(REG_DOR((ctx)->ctrl), reg); \
} while (0)
#define DOR_RESET (   ctx)
값:
do { \
unsigned reg; \
DOR_t *dor = (DOR_t*)&reg; \
dor->b_reset = 0; \
dor->drive = 0; \
dor->b_dma_gate = 0; \
dor->motor = 0; \
outb(REG_DOR((ctx)->ctrl), reg); \
} while (0)
#define DSR_RESET (   reg)
값:
do { \
DSR_t *dsr = (DSR_t*)(reg); \
dsr->sw_reset = 1; \
dsr->power_down = 1; \
} while (0)
#define IN_RESULT_PHASE (   reg)    (MSR(reg)->cmd_busy)
#define IN_SEEK_PORTION (   reg)    (MSR(reg)->drive_busy)
#define LBA_TO_CHS (   lba,
  h,
  t,
 
)
값:
do { \
(t) = (lba) / (FD_SECTOR_PER_TRACK * FD_HEAD); \
(s) = ((lba) % FD_SECTOR_PER_TRACK) + 1; \
} while (0)

Converting the Logical Block Address to CHS. CHS: Cylinder, Head, Sector.

#define MSR (   reg)    ((MSR_t*)(reg))
#define REG_CCR (   base)    ((base) + 0x07)
#define REG_DIR (   base)    ((base) + 0x07)
#define REG_DOR (   base)    ((base) + 0x02)
#define REG_DSR (   base)    ((base) + 0x04)
#define REG_FIFO (   base)    ((base) + 0x05)
#define REG_MSR (   base)    ((base) + 0x04)
#define REG_SRA (   base)    (base)
#define REG_SRB (   base)    ((base) + 0x01)
#define REG_TDR (   base)    ((base) + 0x03)
#define SELECT_DRATE (   reg,
  rate 
)
값:
do { \
DSR_t *dsr = (DSR_t*)(reg); \
dsr->dratesel = rate; \
switch (dsr->dratesel) { \
case DRATE_1Mbps: \
dsr->precomp = DELAY_41_67ns; \
break; \
case DRATE_500Kbps: \
dsr->precomp = DELAY_125ns; \
break; \
case DRATE_300Kbps: \
dsr->precomp = DELAY_125ns; \
break; \
case DRATE_250Kbps: \
dsr->precomp = DELAY_125ns; \
break; \
default: \
break; \
} \
} while (0)
#define SET_DRATE (   reg,
  drate 
)    (((CCR_t*)(reg))->drate_sel = (drate))
#define SRA (   reg)    ((SRA_t*)(ret))
#define SRB (   reg)    ((SRB_t*)(reg))
#define VALIDATE_RESULT (   ctx)
값:
do { \
int ret; \
unsigned char byte; \
ret = read_byte(ctx, &byte); \
if (ret < 0 || byte == 0x80) \
printf("Failed to read\n"); \
} while (0)

타입정의 문서화

typedef struct digital_input_register DIR_t
typedef struct main_status_register MSR_t
typedef struct status_register SRA_t
typedef struct status_register_b SRB_t
typedef struct tape_drive_register TDR_t

열거형 타입 문서화

anonymous enum

트랙, 헤드, 블럭크기를 정의한다.

열거형 멤버
FD_SECTOR_PER_TRACK 

트랙당 섹터 수

FD_HEAD 

해드 수

FD_BLKSZ 

섹터 크기 (bytes)

플로피 디스크 드라이버 Primary,Secondary 포트 주소 정의

열거형 멤버
FDC_PRIMARY 

Primary controller 의 주소

FDC_SECONDARY 

Secondary controller 의 주소

FDC_BASE_MAX 

섹터당 바이트 수를 정의한다

열거형 멤버
SECTOR_128 

128 바이트

SECTOR_256 

256 바이트

SECTOR_512 

512 바이트

SECTOR_1024 

1024 바이트

열거형 멤버
CMD_READ_DATA 
CMD_READ_DELETED_DATA 
CMD_WRITE_DATA 
CMD_WRITE_DELETED_DATA 
CMD_READ_TRACK 
CMD_VERIFY 
CMD_VERSION 
CMD_FORMAT_TRACK 
CMD_SCAN_EQUAL 
CMD_SCAN_LOW_OR_EQUAL 
CMD_SCAN_HIGH_OR_EQUAL 
CMD_RECALIBRATE 
CMD_SENSE_INTERRUPT 
CMD_SPECIFY 
CMD_SEND_DRIVE_STATUS 
CMD_SEEK 
CMD_CONFIGURE 
CMD_RELATIVE_SEEK 
CMD_DUMPREG 
CMD_READ_ID 
CMD_PERPENDICULAR_MODE 
CMD_LOCK 
CMD_EXT_MULTITRACK 
CMD_EXT_DENSITY 
CMD_EXT_SKIP 
enum data_rates
열거형 멤버
DRATE_1Mbps 
DRATE_500Kbps 
DRATE_300Kbps 
DRATE_250Kbps 
열거형 멤버
UNDEFINED 
READ_REQUIRED 
WRITE_REQUIRED 
MAX_DIR_OF_DATA 
enum dma_state
열거형 멤버
DMA 
NONDMA 
열거형 멤버
DRIVE0 
DRIVE1 
DRIVE2 
DRIVE3 
열거형 멤버
DRIVE_A 
DRIVE_B 
DRIVE_C 
DRIVE_D 
DRIVE_MAX 
열거형 멤버
FDC_DMA_READ 
FDC_DMA_WRITE 
열거형 멤버
DELAY_DISABLED 
DELAY_41_67ns 
DELAY_83_34ns 
DELAY_125ns 
DELAY_166_67ns 
DELAY_208_33ns 
DELAY_250ns 
DELAY_DEFAULT 
enum symbol
열거형 멤버
EIS 
EFIFO 
POLL 

함수 문서화

int fdc_init ( void  )

+ 이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

+ 이 함수를 호출하는 함수들에 대한 그래프입니다.: