Texas Instruments TMS320C6A816 Series Technical Reference Manual page 1584

C6-integra dsp+arm processors
Table of Contents

Advertisement

Use Cases
}// Wait unti FR is Cleared.
while (sataRegs->P0CMD & AHCI_PxCMD_FR)
waitForXms(WAIT_500_MILLISECONDS);
// If P0CMD.FRE is still set, HBA probably has hunged. No need to continue.
//
Need to perform HBA Reset.
if (sataRegs->P0CMD & AHCI_PxCMD_FRE)
return(1);
return(0);
}
void associateSysMem2Hba(Uint16 cmdSlot) {
associtateCmdSlotWithCmdTable(cmdSlot);
List Slot
//associtatePrdsWithCmdTable(cmdSlot);
associtatePrdsWithCmdTable(cmdSlot, sata_input_filePageSize);
}
void associtateCmdSlotWithCmdTable(Uint16 cmdSlot) {
CmdLists[cmdSlot].DW2.CmdTableAddLow=((unsigned int)&CmdTable[cmdSlot] & 0xFFFFFF80);
CmdLists[cmdSlot].DW3.CmdTableAddHigh=0x0;
}
void associtatePrdsWithCmdTable(Uint16 cmdSlot, Uint16 fSize) {
Uint16 fileSIZE, prdLength;
for (fileSIZE=0; fileSIZE<fSize; fileSIZE++) {
for (prdLength=0; prdLength<sata_input_prdLength; prdLength++) {
// Command Header 0 PRD Descriptors 0 & 1 are Initialized.
CmdTable[cmdSlot].prdTable[(sata_input_prdLength*fileSIZE)+prdLength].DW0.DbaLow=(unsigned
int)&prdTableDataBuff[cmdSlot][prdLength];
CmdTable[cmdSlot].prdTable[(sata_input_prdLength*fileSIZE)+prdLength].DW1.DbaHigh=0x0;
CmdTable[cmdSlot].prdTable[(sata_input_prdLength*fileSIZE)+prdLength].DW3.DataBC=sata_input_prd_
dataBuffLen-1;
}
}
}
void setSataSpeed(unsigned char iSpeed) {
sataRegs->P0SCTL |= (iSpeed << AHCI_PxSCTL_PxSSTS_SPD_SHIFT);
waitForXms(5); // This might not be necessary: wait a bit
}
char setupCfisEntriesForDataRdWr(CmdListHeader *CmdListNum, dataXferDir readOrWrite,
xferProtocol xferType) {
// *************************************************************************************
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ **** Initializing the Command Header *******
// Other part of the Command List Structure, with the exception of Word 0 for the
//
Command Slots[0] and [1] are already initialized when invoking sata_init_and_spin_up()
//
function via associateMem2HBA() function.
// Configure Word 0 of Command List
CmdListNum->DW0.CmdLen=5;
CmdListNum->DW0.Atapi=0;
CmdListNum->DW0.Prefetch=1; // Doesn't hurt prefetching so do it.
CmdListNum->DW0.Reset=0;
CmdListNum->DW0.Bist=0;
normal operation.
CmdListNum->DW0.Rok=0;
P0CI are modified by HBA as appropriate.
CmdListNum->DW0.Pmp=0x0;
selects the Port of the Port Multiplier.
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
// The above DW0 fields usually would not change for Normal operation.
1584
Serial ATA (SATA) Controller
Preliminary
// Assign Sys Mem allocated for Cmd Table to Cmd
// Assign PRD info to Cmd Table
// This is the length of H2D FIS. This might need changing
//
based on the Command issued to Device. Need to Check.
// Command is destined to HDD Like Device.
// WARNING: Do Not Prefetch if using:
//
=> Command Queuing
//
=> Port Multiplier
// This is normally set to Zero unless a Soft Reset is required.
// This is for entering test mode and should be cleared for
// For Normal operation require to Clear this bit so P0TFD and
//
Rok should be set for S/W Reset Command.
// Used only if an external Port Multiplier is attached and
© 2011, Texas Instruments Incorporated
www.ti.com
SPRUGX9 – 15 April 2011
Submit Documentation Feedback

Advertisement

Table of Contents
loading

Table of Contents