
Use Cases
1368
SPRUH82C – April 2013 – Revised September 2016
Copyright © 2013–2016, Texas Instruments Incorporated
Serial ATA (SATA) Controller
CSL_IntcContext intcContext;
CSL_IntcEventHandlerRecord EventHandler[30];
CSL_IntcGlobalEnableState state;
CSL_IntcHandle hIntc;
CSL_IntcObj myIntcObj;
CSL_IntcEventHandlerRecord myIntcEventHandlerRecord;
CSL_IntcEventId SATA_GEM_EVENT_ID = (CSL_IntcEventId)CSL_INTC_SATAINT;
// GEM INTC
Interrupt Event # 24: See gem_int_index.h or Freon_ch_14_interrupt_????.pdf
CSL_IntcEventHandler SATA_ISR_ADDR = (CSL_IntcEventHandler)sataIsr;
CSL_intcGlobalNmiEnable();
// Enable Global Interrupts
intStat = CSL_intcGlobalEnable(&state);
vectId = CSL_INTC_VECTID_4; // CPU interrupt number
// Intc Module Initialization
intcContext.eventhandlerRecord = EventHandler;
intcContext.numEvtEntries = 10;
// used to allocate isr table entries
CSL_intcInit(&intcContext);
CSL_intcInterruptEnable(vectId);
// Open a handle for the Event interrupt
hIntc = CSL_intcOpen (&myIntcObj, SATA_GEM_EVENT_ID, &vectId , &intStat);
myIntcEventHandlerRecord.handler = (CSL_IntcEventHandler)SATA_ISR_ADDR;
myIntcEventHandlerRecord.arg = NULL;
CSL_intcPlugEventHandler(hIntc, &myIntcEventHandlerRecord);
#endif
}
// Used by both ARM and GEM Processors
void sataIsr(void) {
in+;
// Count interrupt.
intIsrFlag=1;
// Ensure all pending Port Interrupts and The Single Global Interrupt are cleared.
clearIntOrErrorDiag(INTFIELDS, sataRegs->P0IS); // Clear P0IS and IS Regs
}
28.3.2 Example on Initialization and Spinning Up Device
//char hetero_doTest(void) {
char sata_setup() {
progStatus1='F';
progStatus2='F';
// Firmware HwInit Fields Configuration values.
//
Need to configure this prior to calling sata_init_and_spin_up();
swCtrlFeatures.capSMPS=1;
// Input Pin exist for external activity detection presence.
swCtrlFeatures.capSSS=1;
// Always set to 1 in order to avoid spin up when HBA is powered.
swCtrlFeatures.piPi=1;
// Freon supports a single HBA Port. This should always requires
to be set to 1.
swCtrlFeatures.p0cmdEsp=0;
// The state of this bit is based on the support for eSATA.
CAP.SXS setting is the Logical OR of all Ports PxCMD.ESP. If any of the PxCMD.ESP is set, the
CAP.SXS will be set too.
swCtrlFeatures.p0cmdCpd=1;
// Detection of Bus Power Device is supported.
swCtrlFeatures.p0cmdMpsp=1; // We have bonded out a pin (input) to detect a change on a
switch or line
swCtrlFeatures.p0cmdHpcp=1; // Since ESP is mutually exclusive with HPCP (as mentioned in
spec) then HPCP should be set to 1.