![Texas Instruments AM1808 Technical Reference Manual Download Page 1361](http://html.mh-extra.com/html/texas-instruments/am1808/am1808_technical-reference-manual_10945581361.webp)
Use Cases
1361
SPRUH82C – April 2013 – Revised September 2016
Copyright © 2013–2016, Texas Instruments Incorporated
Serial ATA (SATA) Controller
typedef struct {
Uint32
capSMPS:1;
Uint32
capSSS:1;
Uint32
piPi:2;
Uint32
p0cmdCpd:1;
Uint32
p0cmdEsp:1;
Uint32
p0cmdMpsp:1;
Uint32
p0cmdHpcp:1;
Uint32
rsv:24;
}FirmwareCtrlFeatures;
void initMemory(Uint32 *startAddress, Uint32 length, Uint32 seedWord, Uint32 modifyVal) {
Uint32 I;
*start+ = seedWord;
for (I=0; i<length-1; I++) {
se= modifyVal;
*start+ = seedWord;
}
}
void clearCmdList(void) {
//clear Host to Device (Command FIS) Space
initMemory((Uint32*)CmdLists, (LISTLENGTH*(sizeof(CmdListHeader)/4)), 0, 0);
}
void clearCmdTables(void) {
Uint16 cmdSlot;
for (cmdSlot=0; cmdSlot<LISTLENGTH; +) {
//Clear Command FIS and ATAPI Command Spaces for Command Header X; LISTLENGTH < X < 0
initMemory((Uint32 *)&CmdTable[cmdSlot], (sizeof(CommandFIS)/4)+(sizeof(Atapi)/4), 0, 0);
//Clear PRD Descriptor Locations for Command Header X; LISTLENGTH < X < 0
initMemory((Uint32*)((Uint32)&CmdTable[c0x80),
(sata_input_filePageSize*(sizeof(PRDT)/4)*sata_input_prdLength), 0, 0);
}
}
void clearRcvFis() {
//clear Receive DMA Setup FIS Space.
initMemory((Uint32*)&RcvFis, (sizeof(DMASetupFis)/4), 0, 0);
//clear Receive PIO Setup FIS Space.
initMemory((Uint32*)((Uint32)&0x20), (sizeof(PIOSetupFis)/4), 0, 0);
//clear Receive Device to Host (D2H) Register FIS Space.
initMemory((Uint32*)((Uint32)&0x40), (sizeof(D2HRegFis)/4), 0, 0);
//clear Set Device Bits FIS Space.
initMemory((Uint32*)((Uint32)&0x58), (sizeof(SetDevBitsFis)/4), 0, 0);
//clear Unknow FIS Space.
initMemory((Uint32*)((Uint32)&0x60), (sizeof(UnknownFis)/4), 0, 0);
}
void clearDmaBuffers(void) {
//Clear PRD Data Buffer Memory
initMemory((Uint32 *)prdTableDataBuff, (LISTLENGTH*PRDLENGTH*DATABUFFERLEN/4), 0, 0);
}
void performFirmwareInit(void) {
/* Firmware Initialization*/
//
Make sure you perform a Single Write in one operation of all HwInit Fields
//
initialization defined within a single register
sataRegs->CAP |= ((swCtrlFeatures.capSMPS << 28) |
(swCtrlFeatures.capSSS
<< 27)
);