首页 > 代码库 > Vxworks下的SATA提速

Vxworks下的SATA提速

 

1.      ATA接口的三种数据传输方式

 

1PIOProgrammable Input-Output)传输,可以分为PIO寄存器传输和PIO数据传输。PIO寄存器传输主要用于对ATA设备中的寄存器进行读写。读写的数据位数为8DD[7:0]ATA主机控制器根据所要读写的寄存器地址设置CS0_CS1_DA[2:0]地址信号,同时将DIOW_DIOR_设为有效,ATA主机控制器或ATA设备驱动数据总线释放数据。当DIOW_DIOR_撤销时,ATA主机控制器或ATA设备从数据总线上读取数据。对于PIO数据传输,所读写的地址为数据端口,读写数据为16位。

2MDMAMultiword DMA)传输,用于数据传输。ATA主机控制器向ATA设备下达MDMA传输命令后,等待设备向主机发送DMARQ数据传输请求信号。当主机收到DMARQ信号后,向设备发送DMACK_响应信号。MDMA数据传输过程与PIO方式大致相同,也是通过DIOW_DIOR_的周期变化来控制数据的传输。在数据传输过程中,DMARQDMACK_握手信号一直保持有效。

3UDMAUltra DMA),也是用于数据传输。这种传输方式的传输速度比MDMA要快,ATA/ATAPI-5协议中所定义的UDMA传输方式最高数据传输速率是66MB/sUDMA对数据传输的控制信号重新进行了定义。另外,UDMA还引入了CRC数据校验机制,保证了数据传输过程的正确性,但其传输过程较为复杂。

Transfer mode      | Description                   |  Transfer Rate

 

ATA_PIO_DEF_0      | PIO default mode              |

ATA_PIO_DEF_1      | PIO default mode, no IORDY    |

ATA_PIO_0          | PIO mode 0                    |    3.3 MBps

ATA_PIO_1          | PIO mode 1                    |    5.2 MBps

ATA_PIO_2          | PIO mode 2                    |    8.3 MBps

ATA_PIO_3          | PIO mode 3                    |    11.1 MBps

ATA_PIO_4          | PIO mode 4                    |    16.6 MBps

ATA_PIO_AUTO       | PIO max supported mode        |

ATA_DMA_SINGLE_0   | Single DMA mode 0             |    2.1 MBps

ATA_DMA_SINGLE_1   | Single DMA mode 1             |    4.2 MBps

ATA_DMA_SINGLE_2   | Single DMA mode 2             |    8.3 MBps

ATA_DMA_MULTI_0    | Multi word DMA mode 0         |    4.2 MBps

ATA_DMA_MULTI_1    | Multi word DMA mode 1         |    13.3 MBps

ATA_DMA_MULTI_2    | Multi word DMA mode 2         |    16.6 MBps

ATA_DMA_ULTRA_0    | Ultra DMA mode 0              |    16.6 MBps

ATA_DMA_ULTRA_1    | Ultra DMA mode 1              |   25.0 MBps

ATA_DMA_ULTRA_2    | Ultra DMA mode 2              |    33.3 MBps

ATA_DMA_ULTRA_3    | Ultra DMA mode 3              |    44.4 MBps

ATA_DMA_ULTRA_4    | Ultra DMA mode 4              |    66.6 MBps

ATA_DMA_ULTRA_5    | Ultra DMA mode 5              |   100.0 MBps

ATA_DMA_AUTO       | DMA max supported mode        |

 

2.      VxworksSATA部分的启动流程

 

//usrConfig.c

#ifdef INCLUDE_ATA

   usrAtaInit ();

   if (strcmp (FS_NAMES_ATA_PRIMARY_MASTER, "" ))

       usrAtaConfig (0, 0, FS_NAMES_ATA_PRIMARY_MASTER);

   if (strcmp (FS_NAMES_ATA_PRIMARY_SLAVE, "" ))

       usrAtaConfig (0, 1, FS_NAMES_ATA_PRIMARY_SLAVE);

   if (strcmp (FS_NAMES_ATA_SECONDARY_MASTER, "" ))

       usrAtaConfig (1, 0, FS_NAMES_ATA_SECONDARY_MASTER);

   if (strcmp (FS_NAMES_ATA_SECONDARY_SLAVE, "" ))

       usrAtaConfig (1, 1, FS_NAMES_ATA_SECONDARY_SLAVE);

 

#ifdef INCLUDE_SHOW_ROUTINES

   ataShowInit ();                     /* install ATA/IDE show routine */

#endif /* INCLUDE_SHOW_ROUTINES */

#endif /* INCLUDE_ATA */

//usrAta.c

void usrAtaInit (void)

   {

   int ix;

   ATA_RESOURCE *pAtaResource;

 

   for (ix = 0; ix < ATA_MAX_CTRLS; ix++)

       {

       pAtaResource = &ataResources[ix];

 

       if (pAtaResource->ctrlType == IDE_LOCAL)

 

           if ((ataDrv (ix, pAtaResource->drives, pAtaResource->intVector,

                  pAtaResource->intLevel, pAtaResource->configType,

                  pAtaResource->semTimeout, pAtaResource->wdgTimeout))

              == ERROR)

               {

               printf ("ataDrv returned ERROR from usrRoot.\n");

               }

       }

}

//ataDrv.c

ataDrv - Initialize the ATA driver ……

 

INCLUDE_DRV_STORAGE_INTEL_ICH

INCLUDE_ATA

INCLUDE_PIIX4_ATADMA

INCLUDE_ICH7_SUPPORT