#include <stddef.h>
#include <string.h>
#include <sys/timer.h>
#include <sys/thread.h>
#include <sys/event.h>
#include <sys/atom.h>
#include <sys/heap.h>
#include <dev/irqreg.h>
#include <dev/ide.h>
#include <dev/idep.h>
#include <fs/typedefs.h>
Go to the source code of this file.
Data Structures | |
struct | _drive |
Defines | |
#define | __IDE_C__ |
#define | HIBYTE(_x) (BYTE)((_x >> 8) & 0x00FF) |
#define | LOBYTE(_x) (BYTE)(_x & 0x00FF) |
#define | IDE_IRQ INT7 |
#define | IDE_INT_RISING_EDGE 0xC0 |
#define | CF_IRQ INT6 |
#define | CF_INT_SENS_MASK 0x30 |
#define | CF_INT_FALLING_EDGE 0x20 |
#define | CF_INT_RISING_EDGE 0x30 |
#define | IDE_MAX_SUPPORTED_DEVICE 1 |
#define | CF_AVAILABLE 0 |
#define | CF_NOT_AVAILABLE 1 |
#define | INITTIMEOUT 10000 |
#define | DISKTIMEOUT 10000 |
#define | CONTROLLERTIMEOUT 200 |
#define | ATAPITIMEOUT 5000 |
#define | IDEIn(x) pIDE[x] |
#define | IDEOut(x, y) pIDE[x] = y |
#define | IDE_SUPPORT_LBA 0x0001 |
#define | IDE_SUPPORT_LBA48 0x0002 |
#define | IDE_SUPPORT_PACKET 0x0004 |
#define | IDE_SUPPORT_INTRQ_PACKET 0x0008 |
#define | IDE_CDROM_DEVICE 0x1000 |
#define | IDE_ZIP_DEVICE 0x2000 |
#define | IDE_READ_ONLY 0x4000 |
#define | IDE_READY 0x8000 |
#define | ATAPI_CFG_12_BYTE_MSK 0x0003 |
#define | ATAPI_CFG_INTRQ 0x0060 |
#define | ATAPI_CFG_REM_MEDIUM 0x0080 |
#define | ATAPI_CFG_DEVICE 0x1F00 |
#define | ATAPI_CFG_ATAPI 0xC000 |
#define | ATAPI_IS_12_BYTE 0x0000 |
#define | ATAPI_USE_INTRQ 0x0020 |
#define | ATAPI_IS_DIRECT_ACCESS 0x0000 |
#define | ATAPI_IS_CDROM 0x0500 |
#define | ATAPI_IS_PACKET 0x8000 |
#define | ATAPI_CMD(_x) |
#define | CLEAR_ATAPI_CMD() memset(aATAPICmd, 0x00, sizeof(aATAPICmd)); |
Typedefs | |
typedef struct _drive | DRIVE |
typedef struct _drive * | LPDRIVE |
Functions | |
void | IDELock (void) |
void | IDEFree (void) |
void | IDESemaInit (void) |
void | CFChange (void *arg) |
int | IDEInit (int nBaseAddress, int nIDEMode, IDE_MOUNT_FUNC *pMountFunc, IDE_MOUNT_FUNC *pUnMountFunc) |
int | IDEMountDevice (BYTE bDevice, BYTE *pSectorBuffer) |
int | IDEGetSectorSize (BYTE bDevice) |
int | IDEIsCDROMDevice (BYTE bDevice) |
int | IDEIsZIPDevice (BYTE bDevice) |
int | IDEUnMountDevice (BYTE bDevice) |
DWORD | IDEGetTotalSectors (BYTE bDevice) |
int | IDEReadSectors (BYTE bDevice, void *pData, DWORD dwStartSector, WORD wSectorCount) |
int | IDEATAPISetCDSpeed (BYTE bDevice, WORD wSpeed) |
#define CF_IRQ INT6 |
Definition at line 86 of file ide.c.
Referenced by CFChange(), and IDEInit().
#define CF_INT_SENS_MASK 0x30 |
Definition at line 87 of file ide.c.
Referenced by CFChange(), and IDEInit().
#define CF_INT_FALLING_EDGE 0x20 |
Definition at line 88 of file ide.c.
Referenced by CFChange(), and IDEInit().
#define CF_INT_RISING_EDGE 0x30 |
Definition at line 89 of file ide.c.
Referenced by CFChange(), and IDEInit().
#define IDE_MAX_SUPPORTED_DEVICE 1 |
Definition at line 92 of file ide.c.
Referenced by IDEATAPISetCDSpeed(), IDEGetSectorSize(), IDEGetTotalSectors(), IDEInit(), IDEIsCDROMDevice(), IDEIsZIPDevice(), IDEMountDevice(), IDEReadSectors(), and IDEUnMountDevice().
#define CF_AVAILABLE 0 |
Definition at line 94 of file ide.c.
Referenced by CFChange(), and IDEInit().
#define CF_NOT_AVAILABLE 1 |
Definition at line 95 of file ide.c.
Referenced by CFChange(), and IDEInit().
#define IDE_SUPPORT_PACKET 0x0004 |
Definition at line 110 of file ide.c.
Referenced by IDEATAPISetCDSpeed(), IDEMountDevice(), and IDEReadSectors().
#define IDE_CDROM_DEVICE 0x1000 |
Definition at line 117 of file ide.c.
Referenced by IDEIsCDROMDevice().
#define IDE_ZIP_DEVICE 0x2000 |
Definition at line 118 of file ide.c.
Referenced by IDEIsZIPDevice().
#define IDE_READY 0x8000 |
Definition at line 121 of file ide.c.
Referenced by IDEATAPISetCDSpeed(), IDEIsCDROMDevice(), IDEIsZIPDevice(), IDEMountDevice(), and IDEReadSectors().
#define ATAPI_CMD | ( | _x | ) |
{ \
memset(aATAPICmd, 0x00, sizeof(aATAPICmd)); \
aATAPICmd[0] = _x; \
}
Definition at line 192 of file ide.c.
Referenced by IDEATAPISetCDSpeed(), and IDEReadSectors().
#define CLEAR_ATAPI_CMD | ( | ) | memset(aATAPICmd, 0x00, sizeof(aATAPICmd)); |
void IDELock | ( | void | ) |
Definition at line 227 of file ide.c.
References NutEventWait().
Referenced by IDEGetSectorSize(), IDEGetTotalSectors(), IDEIsCDROMDevice(), IDEIsZIPDevice(), IDEMountDevice(), IDEReadSectors(), and IDEUnMountDevice().
void IDEFree | ( | void | ) |
Definition at line 235 of file ide.c.
References NutEventPost().
Referenced by IDEGetSectorSize(), IDEGetTotalSectors(), IDEIsCDROMDevice(), IDEIsZIPDevice(), IDEMountDevice(), IDEReadSectors(), and IDEUnMountDevice().
void IDESemaInit | ( | void | ) |
Definition at line 243 of file ide.c.
References NutEventPost().
Referenced by IDEInit().
void CFChange | ( | void * | arg | ) |
Definition at line 1120 of file ide.c.
References BV, CF_AVAILABLE, CF_INT_FALLING_EDGE, CF_INT_RISING_EDGE, CF_INT_SENS_MASK, CF_IRQ, CF_NOT_AVAILABLE, EICR, IDE_DRIVE_C, IDEMountDevice(), IDEUnMountDevice(), NutEnterCritical, NutEventWaitNext(), NutExitCritical, NutHeapAlloc, NutHeapFree, and NutSleep().
Referenced by IDEInit().
int IDEInit | ( | int | nBaseAddress, |
int | nIDEMode, | ||
IDE_MOUNT_FUNC * | pMountFunc, | ||
IDE_MOUNT_FUNC * | pUnMountFunc | ||
) |
Definition at line 1185 of file ide.c.
References _BV, _drive::bDevice, _drive::bIDEMode, BV, CF_AVAILABLE, CF_INT_FALLING_EDGE, CF_INT_RISING_EDGE, CF_INT_SENS_MASK, CF_IRQ, CF_NOT_AVAILABLE, CFChange(), EICR, FALSE, IDE_BASE_ADDRESS, IDE_COMPACT_FLASH, IDE_HARDDISK, IDE_HARDDISK_7MHZ, IDE_INT_RISING_EDGE, IDE_IRQ, IDE_MAX_SUPPORTED_DEVICE, IDE_OK, IDESemaInit(), MEM_8BIT_COMPACT_FLASH, memset(), NutEnterCritical, NutExitCritical, NutRegisterIrqHandler(), NutThreadCreate(), sbi, sig_INTERRUPT6, and sig_INTERRUPT7.
Definition at line 1325 of file ide.c.
References ATAPI_SECTOR_SIZE, _drive::dwTotalSectors, IDE_ERROR, IDE_MAX_SUPPORTED_DEVICE, IDE_OK, IDE_READY, IDE_SECTOR_SIZE, IDE_SUPPORT_PACKET, IDEFree(), IDELock(), _drive::wFlags, and _drive::wSectorSize.
Referenced by CFChange().
int IDEGetSectorSize | ( | BYTE | bDevice | ) |
Definition at line 1391 of file ide.c.
References IDE_MAX_SUPPORTED_DEVICE, IDEFree(), IDELock(), and _drive::wSectorSize.
int IDEIsCDROMDevice | ( | BYTE | bDevice | ) |
Definition at line 1415 of file ide.c.
References FALSE, IDE_CDROM_DEVICE, IDE_MAX_SUPPORTED_DEVICE, IDE_READY, IDEFree(), IDELock(), TRUE, and _drive::wFlags.
int IDEIsZIPDevice | ( | BYTE | bDevice | ) |
Definition at line 1441 of file ide.c.
References FALSE, IDE_MAX_SUPPORTED_DEVICE, IDE_READY, IDE_ZIP_DEVICE, IDEFree(), IDELock(), TRUE, and _drive::wFlags.
int IDEUnMountDevice | ( | BYTE | bDevice | ) |
Definition at line 1467 of file ide.c.
References IDE_ERROR, IDE_MAX_SUPPORTED_DEVICE, IDEFree(), IDELock(), and _drive::wFlags.
Referenced by CFChange().
Definition at line 1492 of file ide.c.
References _drive::dwTotalSectors, IDE_MAX_SUPPORTED_DEVICE, IDEFree(), and IDELock().
Definition at line 1518 of file ide.c.
References ATAPI_CMD, ATAPI_CMD_READ12, _drive::dwTotalSectors, IDE_DRIVE_NOT_FOUND, IDE_ERROR, IDE_MAX_SUPPORTED_DEVICE, IDE_OK, IDE_PARAM_ERROR, IDE_READY, IDE_SUPPORT_PACKET, IDEFree(), IDELock(), _drive::wFlags, and _drive::wSectorSize.
Referenced by FATFileRead().
Definition at line 1664 of file ide.c.
References ATAPI_CMD, IDE_DRIVE_NOT_FOUND, IDE_MAX_SUPPORTED_DEVICE, IDE_NOT_SUPPORTED, IDE_OK, IDE_READY, IDE_SUPPORT_PACKET, and _drive::wFlags.