36 #include <oc_errors.h> 41 #if oC_Channel_IsModuleDefined(FMC) && oC_ModulePinFunctions_IsModuleDefined(FMC) && oC_ModulePin_IsModuleDefined(FMC) 43 #define oC_FMC_LLD_AVAILABLE 50 #define _________________________________________TYPES_SECTION______________________________________________________________________________ 51 #define MODULE_NAME FMC 63 oC_ModulePinFunction_DefineType;
73 oC_ModulePin_DefineType;
85 oC_FMC_LLD_MemoryType_RAM = (1<<6) ,
86 oC_FMC_LLD_MemoryType_Flash = (1<<7) ,
87 oC_FMC_LLD_MemoryType_SDRAM = (0x1) | oC_FMC_LLD_MemoryType_RAM ,
88 oC_FMC_LLD_MemoryType_PSRAM = (0x2) | oC_FMC_LLD_MemoryType_RAM ,
89 oC_FMC_LLD_MemoryType_NAND_Flash = (0x3) | oC_FMC_LLD_MemoryType_Flash ,
90 oC_FMC_LLD_MemoryType_NOR_Flash = (0x4) | oC_FMC_LLD_MemoryType_Flash ,
91 } oC_FMC_LLD_MemoryType_t;
102 oC_FMC_LLD_DataBusWidth_8Bits = 1,
103 oC_FMC_LLD_DataBusWidth_16Bits = 2,
104 oC_FMC_LLD_DataBusWidth_32Bits = 4,
105 oC_FMC_LLD_DataBusWidth_64Bits = 8,
106 } oC_FMC_LLD_DataBusWidth_t;
117 oC_FMC_LLD_Protection_Default = 0 ,
118 oC_FMC_LLD_Protection_AllowWrite = (1<<0) ,
119 oC_FMC_LLD_Protection_AllowRead = (1<<1) ,
120 oC_FMC_LLD_Protection_AllowExecute = (1<<2) ,
121 } oC_FMC_LLD_Protection_t;
132 oC_FMC_LLD_SDRAM_CasLatency_0 = (1<<0) ,
133 oC_FMC_LLD_SDRAM_CasLatency_1 = (1<<1) ,
134 oC_FMC_LLD_SDRAM_CasLatency_2 = (1<<2) ,
135 oC_FMC_LLD_SDRAM_CasLatency_3 = (1<<3) ,
136 oC_FMC_LLD_SDRAM_CasLatency_4 = (1<<4) ,
137 oC_FMC_LLD_SDRAM_CasLatency_5 = (1<<5) ,
138 oC_FMC_LLD_SDRAM_CasLatency_6 = (1<<6) ,
139 oC_FMC_LLD_SDRAM_CasLatency_7 = (1<<7) ,
140 } oC_FMC_LLD_SDRAM_CasLatency_t;
151 oC_FMC_LLD_SDRAM_BurstLength_1 = (1<<0),
152 oC_FMC_LLD_SDRAM_BurstLength_2 = (1<<1),
153 oC_FMC_LLD_SDRAM_BurstLength_4 = (1<<2),
154 oC_FMC_LLD_SDRAM_BurstLength_8 = (1<<3),
155 oC_FMC_LLD_SDRAM_BurstLength_FullPage = (1<<4),
156 } oC_FMC_LLD_SDRAM_BurstLength_t;
165 oC_FMC_LLD_PinUsage_NotUsed ,
166 oC_FMC_LLD_PinUsage_Optional ,
167 oC_FMC_LLD_PinUsage_Required ,
168 oC_FMC_LLD_PinUsage_Used
169 } oC_FMC_LLD_PinUsage_t;
179 } oC_FMC_LLD_NANDFlash_Pins_t;
189 } oC_FMC_LLD_NORFlash_Pins_t;
202 oC_Pin_t PinsArray[1];
217 } oC_FMC_LLD_SDRAM_Pins_t;
227 } oC_FMC_LLD_PSRAM_Pins_t;
237 } oC_FMC_LLD_NANDFlash_ChipParameters_t;
247 } oC_FMC_LLD_NORFlash_ChipParameters_t;
262 oC_MemorySize_t Size;
263 oC_MemorySize_t BankSize;
264 uint32_t NumberOfBanks;
265 oC_FMC_LLD_DataBusWidth_t DataBusWidth;
266 oC_FMC_LLD_SDRAM_CasLatency_t CasLatencyMask;
267 oC_Time_t CasLatency;
268 oC_FMC_LLD_SDRAM_BurstLength_t BurstLengthMask;
269 bool AutoPrechargePossible;
270 bool AutoRefreshPossible;
271 bool SelfPrechargePossible;
272 oC_Time_t AutoRefreshPeriod;
274 uint8_t NumberOfRowAddressBits;
275 uint8_t NumberOfColumnAddressBits;
276 oC_Time_t ActiveToReadWriteDelay;
277 oC_Time_t PrechargeDelay;
278 oC_Time_t WriteRecoveryDelay;
279 oC_Time_t RefreshToActivateDelay;
280 oC_Time_t MinimumSelfRefreshPeriod;
281 oC_Time_t ExitSelfRefreshDelay;
282 uint32_t CyclesToDelayAfterLoadMode;
285 oC_Time_t ReadPipeDelay;
288 } oC_FMC_LLD_SDRAM_ChipParameters_t;
299 } oC_FMC_LLD_PSRAM_ChipParameters_t;
311 oC_FMC_LLD_MemoryType_t MemoryType;
315 oC_FMC_LLD_SDRAM_ChipParameters_t SDRAM;
317 } oC_FMC_LLD_ChipParameters_t;
328 } oC_FMC_LLD_NANDFlash_Config_t;
338 } oC_FMC_LLD_NORFlash_Config_t;
349 oC_FMC_LLD_DataBusWidth_t DataBusWidth;
350 oC_FMC_LLD_Protection_t Protection;
351 oC_FMC_LLD_SDRAM_Pins_t Pins;
353 } oC_FMC_LLD_SDRAM_Config_t;
365 } oC_FMC_LLD_PSRAM_Config_t;
367 typedef uint32_t oC_FMC_LLD_Bank_t;
380 oC_FMC_LLD_PinUsage_t PinsUsage[1];
392 oC_FMC_LLD_PinUsage_t SDCLK;
393 oC_FMC_LLD_PinUsage_t SDCKE[2];
394 oC_FMC_LLD_PinUsage_t SDNE[2];
395 oC_FMC_LLD_PinUsage_t A[13];
396 oC_FMC_LLD_PinUsage_t D[32];
397 oC_FMC_LLD_PinUsage_t BA[4];
398 oC_FMC_LLD_PinUsage_t NRAS;
399 oC_FMC_LLD_PinUsage_t NCAS;
400 oC_FMC_LLD_PinUsage_t SDNWE;
401 oC_FMC_LLD_PinUsage_t NBL[4];
405 uint8_t * MemoryStart;
406 oC_MemorySize_t MemorySize;
407 oC_FMC_LLD_Bank_t ConfiguredBanks;
408 oC_FMC_LLD_Protection_t DirectAccessProtection;
409 oC_FMC_LLD_DataBusWidth_t DataBusWidth;
410 } oC_FMC_LLD_Result_t;
422 oC_FMC_LLD_SDRAM_Command_EnableClock ,
423 oC_FMC_LLD_SDRAM_Command_Inhibit ,
424 oC_FMC_LLD_SDRAM_Command_Nop ,
425 oC_FMC_LLD_SDRAM_Command_LoadModeRegister ,
426 oC_FMC_LLD_SDRAM_Command_Active ,
427 oC_FMC_LLD_SDRAM_Command_Read ,
428 oC_FMC_LLD_SDRAM_Command_Write ,
429 oC_FMC_LLD_SDRAM_Command_Precharge ,
430 oC_FMC_LLD_SDRAM_Command_BurstTerminate ,
431 oC_FMC_LLD_SDRAM_Command_AutoRefresh ,
432 oC_FMC_LLD_SDRAM_Command_SelfRefresh ,
433 } oC_FMC_LLD_SDRAM_Command_t;
440 typedef uint64_t oC_FMC_LLD_Address_t;
451 oC_FMC_LLD_Address_t RowAddress;
452 oC_FMC_LLD_Address_t BankAddress;
458 oC_FMC_LLD_Address_t ColumnAddress;
459 oC_FMC_LLD_Address_t BankAddress;
460 bool EnableAutoPrecharge;
465 oC_FMC_LLD_Address_t ColumnAddress;
466 oC_FMC_LLD_Address_t BankAddress;
467 bool EnableAutoPrecharge;
472 oC_FMC_LLD_Address_t Reserved;
473 oC_FMC_LLD_Address_t BankAddress;
481 oC_FMC_LLD_Address_t MRD;
485 oC_FMC_LLD_Address_t BurstLength:3;
486 oC_FMC_LLD_Address_t BurstType:1;
487 oC_FMC_LLD_Address_t CasLatency:3;
488 oC_FMC_LLD_Address_t OperatingMode:2;
489 oC_FMC_LLD_Address_t WriteBurstMode:1;
490 oC_FMC_LLD_Address_t Reserved:55;
492 # error LoadModeRegister is not defined for BIG_ENDIAN 496 oC_FMC_LLD_Address_t BankAddress;
502 oC_FMC_LLD_Address_t NumberOfAutoRefresh;
503 oC_FMC_LLD_Address_t Reserved;
509 oC_FMC_LLD_Address_t Address;
510 oC_FMC_LLD_Address_t BankAddress;
513 } oC_FMC_LLD_SDRAM_CommandData_t;
516 #undef _________________________________________TYPES_SECTION______________________________________________________________________________ 524 #define _________________________________________MACROS_SECTION_____________________________________________________________________________ 526 #undef _________________________________________MACROS_SECTION_____________________________________________________________________________ 534 #define _________________________________________FUNCTIONS_SECTION__________________________________________________________________________ 558 extern oC_ErrorCode_t oC_FMC_LLD_TurnOnDriver(
void );
579 extern oC_ErrorCode_t oC_FMC_LLD_TurnOffDriver(
void );
589 extern oC_ErrorCode_t oC_FMC_LLD_ConfigureSDRAM(
const oC_FMC_LLD_SDRAM_Config_t * Config ,
const oC_FMC_LLD_ChipParameters_t * ChipInfo , oC_FMC_LLD_Result_t * outResult );
590 extern oC_ErrorCode_t oC_FMC_LLD_ConfigureNORFlash(
const oC_FMC_LLD_NORFlash_Config_t * Config ,
const oC_FMC_LLD_ChipParameters_t * ChipInfo , oC_FMC_LLD_Result_t * outResult );
591 extern oC_ErrorCode_t oC_FMC_LLD_ConfigureNANDFlash(
const oC_FMC_LLD_NANDFlash_Config_t * Config ,
const oC_FMC_LLD_ChipParameters_t * ChipInfo , oC_FMC_LLD_Result_t * outResult );
592 extern oC_ErrorCode_t oC_FMC_LLD_ConfigurePSRAM(
const oC_FMC_LLD_PSRAM_Config_t * Config ,
const oC_FMC_LLD_ChipParameters_t * ChipInfo , oC_FMC_LLD_Result_t * outResult );
593 extern oC_ErrorCode_t oC_FMC_LLD_UnconfigureSDRAM(
const oC_FMC_LLD_SDRAM_Config_t * Config ,
const oC_FMC_LLD_ChipParameters_t * ChipInfo , oC_FMC_LLD_Result_t * outResult );
594 extern oC_ErrorCode_t oC_FMC_LLD_UnconfigureNORFlash(
const oC_FMC_LLD_NORFlash_Config_t * Config ,
const oC_FMC_LLD_ChipParameters_t * ChipInfo , oC_FMC_LLD_Result_t * outResult );
595 extern oC_ErrorCode_t oC_FMC_LLD_UnconfigureNANDFlash(
const oC_FMC_LLD_NANDFlash_Config_t * Config ,
const oC_FMC_LLD_ChipParameters_t * ChipInfo , oC_FMC_LLD_Result_t * outResult );
596 extern oC_ErrorCode_t oC_FMC_LLD_UnconfigurePSRAM(
const oC_FMC_LLD_PSRAM_Config_t * Config ,
const oC_FMC_LLD_ChipParameters_t * ChipInfo , oC_FMC_LLD_Result_t * outResult );
597 extern oC_ErrorCode_t oC_FMC_LLD_SendSDRAMCommand( oC_FMC_LLD_Result_t * Result , oC_Time_t * Timeout , oC_FMC_LLD_SDRAM_Command_t Command ,
const oC_FMC_LLD_SDRAM_CommandData_t * Data );
598 extern oC_ErrorCode_t oC_FMC_LLD_FinishSDRAMInitialization(
const oC_FMC_LLD_SDRAM_Config_t * Config ,
const oC_FMC_LLD_ChipParameters_t * ChipInfo , oC_FMC_LLD_Result_t * Result );
599 extern oC_ErrorCode_t oC_FMC_LLD_FinishNORFlashInitialization(
const oC_FMC_LLD_NORFlash_Config_t * Config ,
const oC_FMC_LLD_ChipParameters_t * ChipInfo , oC_FMC_LLD_Result_t * Result );
600 extern oC_ErrorCode_t oC_FMC_LLD_FinishNANDFlashInitialization(
const oC_FMC_LLD_NANDFlash_Config_t * Config ,
const oC_FMC_LLD_ChipParameters_t * ChipInfo , oC_FMC_LLD_Result_t * Result );
601 extern oC_ErrorCode_t oC_FMC_LLD_FinishPSRAMInitialization(
const oC_FMC_LLD_PSRAM_Config_t * Config ,
const oC_FMC_LLD_ChipParameters_t * ChipInfo , oC_FMC_LLD_Result_t * Result );
603 #undef _________________________________________FUNCTIONS_SECTION__________________________________________________________________________ The file with interface for the GPIO driver.
The file with frequency definitions.
double oC_Frequency_t
type to store frequency
The library with time definitions.
static oC_ErrorCode_t Write(ConnectionContext_t Context, const char *Buffer, uint32_t *Size, oC_Time_t Timeout)
function called when process want to write data on STDOUT stream
static oC_ErrorCode_t Read(ConnectionContext_t Context, char *outBuffer, uint32_t *Size, oC_Time_t Timeout)
function called when process want to read data from STDIN stream
The file with interface for the machine module.