📄 atashow.c
字号:
** atapiFeatureEnabledGet - get the enabled features.** This function is used to get drive Features Enabled by the ATA/ATAPI drive * specified by <ctrl> and <drive> from drive structure. It returns a 32 bit * value whose bits represents the features Enabled. The following table gives * the cross reference for the bits.** \is* \i Bit 21 Power-up in Standby Feature* \i Bit 20 Removable Media Status Notification Feature* \i Bit 19 Adavanced Power Management Feature* \i Bit 18 CFA Feature* \i Bit 10 Host protected Area Feature* \i Bit 4 Packet Command Feature* \i Bit 3 Power Management Feature* \i Bit 2 Removable Media Feature* \i Bit 1 Security Mode Feature* \i Bit 0 SMART Feature* \ie** RETURNS: enabled features.*/UINT32 atapiFeatureEnabledGet(int ctrl,int drive) { UINT32 featureEnabled; featureEnabled=((ataCtrl[ctrl].drive[drive].param.enableCommandFeature2)<<16 )|(ataCtrl[ctrl].drive[drive].param.enableCommandFeature1); return(featureEnabled); } /* atapiFeatureEnabledGet *//**************************************************************************** atapiMaxUDmaModeGet - get the Maximum Ultra DMA mode the drive can support.** This function is used to get drive maximum UDMA mode supported by the * ATA/ATAPI drive specified by <ctrl> and <drive> from drive structure.* The following bits are set for corresponding modes supported.** \is* \i Bit4 Ultra DMA mode 4 and below are supported* \i Bit3 Ultra DMA mode 3 and below are supported* \i Bit2 Ultra DMA mode 2 and below are supported* \i Bit1 Ultra DMA mode 1 and below are supported* \i Bit0 Ultra DMA mode 0 is supported* \ie* RETURNS: Maximum Ultra DMA mode.*/UINT8 atapiMaxUDmaModeGet(int ctrl,int drive) { return(UINT8)(ataCtrl[ ctrl].drive[ drive].param.ultraDmaMode); } /* atapiMaxUDmaModeGet *//**************************************************************************** atapiCurrentUDmaModeGet - get the enabled Ultra DMA mode.** This function is used to get drive UDMA mode enable in the * ATA/ATAPI drive specified by <ctrl> and <drive> from drive structure* The following bit is set for corresponding mode selected.** \is* \i Bit4 Ultra DMA mode 4 is Selected* \i Bit3 Ultra DMA mode 3 is Selected* \i Bit2 Ultra DMA mode 2 is Selected* \i Bit1 Ultra DMA mode 1 is Selected* \i Bit0 Ultra DMA mode 0 is Selected* \ie* RETURNS: Enabled Ultra DMA mode.*/UINT8 atapiCurrentUDmaModeGet(int ctrl,int drive) { return(UINT8)((ataCtrl[ ctrl].drive[ drive].param.ultraDmaMode)>>8); } /* atapiCurrentUDmaModeGet *//**************************************************************************** atapiMaxMDmaModeGet - get the Maximum Multi word DMA mode the drive supports.** This function is used to get drive maximum MDMA mode supported by the * ATA/ATAPI drive specified by <ctrl> and <drive> from drive structure* The following bits are set for corresponding modes supported.** \is* \i Bit2 Multi DMA mode 2 and below are supported* \i Bit1 Multi DMA mode 1 and below are supported* \i Bit0 Multi DMA mode 0 is supported* \ie** RETURNS: Maximum Multi word DMA mode.*/UINT8 atapiMaxMDmaModeGet(int ctrl,int drive) { return(UINT8)(ataCtrl[ ctrl].drive[ drive].param.multiDma); } /* atapiMaxMDmaModeGet *//**************************************************************************** atapiCurrentMDmaModeGet - get the enabled Multi word DMA mode.** This function is used to get drive MDMA mode enable in the * ATA/ATAPI drive specified by <ctrl> and <drive> from drive structure* The following bit is set for corresponding mode selected.** \is* \i Bit2 Multi DMA mode 2 is Selected* \i Bit1 Multi DMA mode 1 is Selected* \i Bit0 Multi DMA mode 0 is Selected* \ie** RETURNS: Enabled Multi word DMA mode.*/UINT8 atapiCurrentMDmaModeGet(int ctrl,int drive) { return(UINT8)((ataCtrl[ ctrl].drive[ drive].param.dmaMode)>>8); } /* atapiCurrentMDmaModeGet *//**************************************************************************** atapiMaxSDmaModeGet - get the Maximum Single word DMA mode the drive supports** This function is used to get drive maximum SDMA mode supported by the * ATA/ATAPI drive specified by <ctrl> and <drive> from drive structure** RETURNS: Maximum Single word DMA mode.*/UINT8 atapiMaxSDmaModeGet(int ctrl,int drive) { return(UINT8)(ataCtrl[ ctrl].drive[ drive].param.singleDma); } /* atapiMaxSDmaModeGet *//**************************************************************************** atapiCurrentSDmaModeGet - get the enabled Single word DMA mode.** This function is used to get drive SDMA mode enable in the * ATA/ATAPI drive specified by <ctrl> and <drive> from drive structure** RETURNS: Enabled Single word DMA mode.*/UINT8 atapiCurrentSDmaModeGet(int ctrl,int drive) { return(UINT8)((ataCtrl[ ctrl].drive[ drive].param.singleDma)>>8); } /* atapiCurrentSDmaModeGet *//**************************************************************************** atapiMaxPioModeGet - get the Maximum PIO mode that drive can support.** This function is used to get drive maximum PIO mode supported by the * ATA/ATAPI drive specified by <ctrl> and <drive> from drive structure** RETURNS: maximum PIO mode.*/UINT8 atapiMaxPioModeGet(int ctrl,int drive) { return(UINT8)(ataCtrl[ ctrl].drive[ drive].pioMode); } /* atapiMaxPioModeGet *//**************************************************************************** atapiCurrentPioModeGet - get the enabled PIO mode.** This function is used to get drive current PIO mode enabled in the * ATA/ATAPI drive specified by <ctrl> and <drive> from drive structure.** RETURNS: Enabled PIO mode.*/UINT8 atapiCurrentPioModeGet(int ctrl,int drive) { return(UINT8)(ataCtrl[ ctrl].drive[ drive].pioMode); } /* atapiCurrentPioModeGet *//**************************************************************************** atapiCurrentRwModeGet - get the current Data transfer mode.** This function will return the current Data transfer mode if it is* PIO 0,1,2,3,4 mode, SDMA 0,1,2 mode, MDMA 0,1,2 mode or UDMA 0,1,2,3,4,5 * mode.** RETURNS: current PIO mode.*/UINT8 atapiCurrentRwModeGet(int ctrl,int drive) { return(UINT8)(ataCtrl[ ctrl].drive[ drive].rwMode); } /* atapiCurrentRwModeGet *//**************************************************************************** atapiDriveTypeGet - get the drive type.** This function routine will return the type of the drive if* it is CD-ROM or Printer etc. The following table indicates the type depending* on the return value.* \is* \i 0x00h Direct-access device * \i 0x01h Sequential-access device* \i 0x02h Printer Device* \i 0x03h Processor device* \i 0x04h Write-once device* \i 0x05h CD-ROM device * \i 0x06h Scanner device * \i 0x07h Optical memory device* \i 0x08h Medium Change Device* \i 0x09h Communications device* \i 0x0Ch Array Controller Device* \i 0x0Dh Encloser Services Device* \i 0x0Eh Reduced Block Command Devices* \i 0x0Fh Optical Card Reader/Writer Device * \i 0x1Fh Unknown or no device type* \ie ** RETURNS: drive type.*/UINT8 atapiDriveTypeGet(int ctrl,int drive) { return(ataCtrl[ ctrl].drive[ drive].driveType); } /* atapiDriveTypeGet *//**************************************************************************** atapiVersionNumberGet - get the ATA/ATAPI version number of the drive.** This function will return the ATA/ATAPI version number of* the drive. Most significant 16 bits represent the Major Version Number and * the Lease significant 16 bits represents the minor Version Number.* \is* \i Major Version Number* \i Bit 22 ATA/ATAPI-6* \i Bit 21 ATA/ATAPI-5* \i Bit 20 ATA/ATAPI-4* \i Bit 19 ATA-3* \i Bit 18 ATA-2* * * \i Minor version Number (bit 15 through bit 0)* \i 0001h Obsolete* \i 0002h Obsolete* \i 0003h Obsolete* \i 0004h ATA-2 published, ANSI X3.279-1996* \i 0005h ATA-2 X3T10 948D prior to revision 2k* \i 0006h ATA-3 X3T10 2008D revision 1* \i 0007h ATA-2 X3T10 948D revision 2k* \i 0008h ATA-3 X3T10 2008D revision 0* \i 0009h ATA-2 X3T10 948D revision 3* \i 000Ah ATA-3 published, ANSI X3.298-199x* \i 000Bh ATA-3 X3T10 2008D revision 6* \i 000Ch ATA-3 X3T13 2008D revision 7 and 7a* \i 000Dh ATA/ATAPI-4 X3T13 1153D revision 6* \i 000Eh ATA/ATAPI-4 T13 1153D revision 13* \i 000Fh ATA/ATAPI-4 X3T13 1153D revision 7* \i 0010h ATA/ATAPI-4 T13 1153D revision 18* \i 0011h ATA/ATAPI-4 T13 1153D revision 15* \i 0012h ATA/ATAPI-4 published, ANSI NCITS 317-1998* \i 0013h Reserved* \i 0014h ATA/ATAPI-4 T13 1153D revision 14* \i 0015h ATA/ATAPI-5 T13 1321D revision 1* \i 0016h Reserved* \i 0017h ATA/ATAPI-4 T13 1153D revision 17* \i 0018h-FFFFh Reserved* \ie** RETURNS: ATA/ATAPI version number.*/UINT32 atapiVersionNumberGet(int ctrl,int drive) { return(UINT32)(((ataCtrl[ ctrl].drive[ drive].param.majorVer)<<16)| (ataCtrl[ ctrl].drive[ drive].param.minorVer)); } /* atapiVersionNumberGet *//**************************************************************************** atapiRemovMediaStatusNotifyVerGet - get the Media Stat Notification Version.** This function will return the removable media status notification* version of the drive.** RETURNS: Version Number.*/UINT16 atapiRemovMediaStatusNotifyVerGet(int ctrl,int drive) { return(UINT16)(ataCtrl[ ctrl].drive[ drive].mediaStatusNotifyVer); } /* atapiRemovMediaStatusNotifyVerGet *//**************************************************************************** atapiCurrentCylinderCountGet - get logical number of cylinders in the drive.** This function will return the number of logical cylinders* in the drive. This value represents the no of cylinders that can be addressed.** RETURNS: Cylinder count.*/UINT16 atapiCurrentCylinderCountGet(int ctrl,int drive) { return(UINT16)(ataCtrl[ ctrl].drive[ drive].param.currentCylinders); } /* atapiCurrentCylinderCountGet *//**************************************************************************** atapiCurrentHeadCountGet - get the number of read/write heads in the drive.** This function will return the number of heads in the drive from device * structure.** RETURNS: Number of heads.*/UINT8 atapiCurrentHeadCountGet(int ctrl,int drive) { return(UINT8)(ataCtrl[ ctrl].drive[ drive].param.currentHeads); } /* atapiCurrentHeadCountGet *//**************************************************************************** atapiBytesPerTrackGet - get the number of Bytes per track.** This function will return the number of Bytes per track.* This function will return correct values for drives of ATA/ATAPI-4 or less* as this feild is retired for the drives compliant to ATA/ATAPI-5 or higher.** RETURNS: Bytes per track.*/UINT16 atapiBytesPerTrackGet(int ctrl,int drive) { return(UINT16)(ataCtrl[ ctrl].drive[ drive].param.retired4); } /* atapiBytesPerTrackGet *//**************************************************************************** atapiBytesPerSectorGet - get the number of Bytes per sector.** This function will return the number of Bytes per sector.* This function will return correct values for drives of ATA/ATAPI-4 or less* as this field is retired for the drives compliant to ATA/ATAPI-5 or higher.** RETURNS: Bytes per sector.*/UINT16 atapiBytesPerSectorGet(int ctrl,int drive) { return(UINT16)(ataCtrl[ ctrl].drive[ drive].param.retired5); } /* atapiBytesPerSectorGet *//**************************************************************************** ataAdjustAndCopyByte - swaps every seccesive bytes and copies string** RETURNS: N/A*/LOCAL void ataAdjustAndCopyByte(char * pbuf,char * pSource) { int i,j; for (i=1,j=0;i<=strlen(pSource);i+=2) {#if (_BYTE_ORDER == _LITTLE_ENDIAN) pbuf[j]=pSource[i]; j++; pbuf[j]=pSource[i-1]; j++;#else pbuf[j]=pSource[i-1]; j++; pbuf[j]=pSource[i]; j++;#endif /* (_BYTE_ORDER == _LITTLE_ENDIAN) */ } pbuf[j]='\0'; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -