![Texas Instruments AM1808 Скачать руководство пользователя страница 1354](http://html.mh-extra.com/html/texas-instruments/am1808/am1808_technical-reference-manual_10945581354.webp)
Use Cases
1354
SPRUH82C – April 2013 – Revised September 2016
Copyright © 2013–2016, Texas Instruments Incorporated
Serial ATA (SATA) Controller
28.3.1
General Utilities: Structures and Subroutines Sample Program Uses
/* Allocating memory for Command List. The structure pointed to by this
address range is 1K-bytes in length and must be 1K-byte aligned.
Note that each command header occupies 32 bytes of memory and 32
command headers require 1024 bytes of memory.
*/
#pragma DATA_SECTION(CmdLists,
".L3_BUF");
#pragma DATA_ALIGN(CmdLists, 1024);
CmdListHeader CmdLists[32]={0};
/* Indicates the 32-bit physical address of the command table, which
contains
the command FIS,
ATAPI Command,
andPRD table.
This address must be aligned to a 128-bytes of memory,
*/
#pragma DATA_SECTION(CmdTable,
".L3_BUF");
#pragma DATA_ALIGN(CmdTable, 128);
CommandTable CmdTable[LISTLENGTH];
/* Indicates the 32-bit base physical address for received FISes. The
structure pointed to by this address range is 256 bytes in length
and must be 256-byte aligned.
*/
#pragma DATA_SECTION(RcvFis,
".L3_BUF");
#pragma DATA_ALIGN(RcvFis, 256);
ReceiveFis RcvFis;
#pragma DATA_SECTION(prdTableDataBuff,
".L3_BUF");
unsigned char prdTableDataBuff[LISTLENGTH][PRDLENGTH][DATABUFFERLEN];
#define NUMOFPORTS
(1)
// Freon Supports A Single HBA Port. However it can support up to
//
16 additional Ports with the use of an external Port Multiplier.
//
So keep this value to 1.
#define LISTLENGTH
(2)
// Max Command Header Per Port is 32
#define WRITE_CMD_SLOT
(0)
// Value used here should be <= LISTLENGTH-1
#define READ_CMD_SLOT
(1)
// Value used here should be <= LISTLENGTH-1
// WARNING. PRDLENGTH can not be greater than 8 for this program.
//
See Note captured by the area when memory has been reserved for
//
within sata_utilities.c for Command Table "CmdTable" for
//
more information.
#if 1
#define _MAX_DATA_TRANSFER_
// Define this in project file when needed.
#endif
#ifndef _MAX_DATA_TRANSFER_
// 512 Bytes Data Size within 2 PRD Descriptors.
#define PRDLENGTH
(2)
// Max PRD Length is 65535 per port.
#define DATABUFFERLEN (256)
// DMA Data Buffer Length
#else // Max Data Size Transfer 8K Bytes within 2 PRD Descriptors
#define PRDLENGTH
(2)
// Max PRD Length is 65535 per port.
#define DATABUFFERLEN (2*4096)
// DMA Data Buffer Length
#endif
#if ((PRDLENGTH > 8) | (WRITE_CMD_SLOT > LISTLENGTH-1) | (READ_CMD_SLT > LISTLENGTH-1))
#error PRDLENGTH ENTRY ERROR - PROGRAM HARD CODED FOR MAX VALUE OF 8 - CMD SLOT ENTRY ERROR
#endif
#define DESIRED_SPEED
(GEN1)
// GOASFASTASDEVICE, GEN1, GEN2
#define DEVICE_LBA_ADDRESS
(0x00000002) // Dev28bitLbaAddress = 28-Bit LBA Address
#define WAIT_500_MILLISECONDS
(50)
// This should be set to 500 once the ONE_MS_VALUE is
programmed correctly.