Choco OS  V.0.16.9.0
Join to the chocolate world
oc_fmc.h
Go to the documentation of this file.
1 
34 #ifndef _OC_FMC_H
35 #define _OC_FMC_H
36 #define DRIVER_HEADER
37 #define DRIVER_NAME FMC
38 
39 #include <oc_driver.h>
40 #include <oc_stdlib.h>
41 #include <oc_ioctl.h>
42 #include <oc_fmc_lld.h>
43 #include <oc_frequency.h>
44 #include <oc_memory.h>
45 
46 #ifdef oC_FMC_LLD_AVAILABLE
47 
53 #define _________________________________________TYPES_SECTION______________________________________________________________________________
54 
55 //==========================================================================================================================================
63 //==========================================================================================================================================
64 typedef enum
65 {
66  oC_FMC_Protection_Default = oC_FMC_LLD_Protection_Default ,
67  oC_FMC_Protection_AllowWrite = oC_FMC_LLD_Protection_AllowWrite ,
68  oC_FMC_Protection_AllowRead = oC_FMC_LLD_Protection_AllowRead ,
69  oC_FMC_Protection_AllowExecute = oC_FMC_LLD_Protection_AllowExecute ,
71 
72 //==========================================================================================================================================
80 //==========================================================================================================================================
81 typedef enum
82 {
86 
87 //==========================================================================================================================================
96 //==========================================================================================================================================
97 typedef enum
98 {
99  oC_FMC_SDRAM_Command_EnableClock = oC_FMC_LLD_SDRAM_Command_EnableClock ,
100  oC_FMC_SDRAM_Command_Inhibit = oC_FMC_LLD_SDRAM_Command_Inhibit ,
101  oC_FMC_SDRAM_Command_Nop = oC_FMC_LLD_SDRAM_Command_Nop ,
102  oC_FMC_SDRAM_Command_LoadModeRegister = oC_FMC_LLD_SDRAM_Command_LoadModeRegister ,
103  oC_FMC_SDRAM_Command_Active = oC_FMC_LLD_SDRAM_Command_Active ,
104  oC_FMC_SDRAM_Command_Read = oC_FMC_LLD_SDRAM_Command_Read ,
105  oC_FMC_SDRAM_Command_Write = oC_FMC_LLD_SDRAM_Command_Write ,
106  oC_FMC_SDRAM_Command_Precharge = oC_FMC_LLD_SDRAM_Command_Precharge ,
107  oC_FMC_SDRAM_Command_BurstTerminate = oC_FMC_LLD_SDRAM_Command_BurstTerminate ,
108  oC_FMC_SDRAM_Command_AutoRefresh = oC_FMC_LLD_SDRAM_Command_AutoRefresh ,
109  oC_FMC_SDRAM_Command_SelfRefresh = oC_FMC_LLD_SDRAM_Command_SelfRefresh ,
111 
112 //==========================================================================================================================================
120 //==========================================================================================================================================
121 typedef oC_FMC_LLD_SDRAM_CommandData_t oC_FMC_SDRAM_CommandData_t;
122 
123 //==========================================================================================================================================
134 //==========================================================================================================================================
135 typedef struct Context_t * oC_FMC_Context_t;
136 
137 //==========================================================================================================================================
148 //==========================================================================================================================================
149 typedef oC_ErrorCode_t (*oC_FMC_InitializationFunction_t)( const void * Config , oC_FMC_Context_t Context , oC_Time_t * Timeout );
150 
151 //==========================================================================================================================================
157 //==========================================================================================================================================
158 typedef struct
159 {
160  oC_FMC_LLD_ChipParameters_t ChipParameters;
163 
164 //==========================================================================================================================================
175 //==========================================================================================================================================
176 typedef struct oC_FMC_Config_t
177 {
181  union
182  {
183  oC_FMC_LLD_SDRAM_Config_t SDRAM;
184  oC_FMC_LLD_PSRAM_Config_t PSRAM;
185  oC_FMC_LLD_NANDFlash_Config_t NANDFlash;
186  oC_FMC_LLD_NORFlash_Config_t NORFlash;
187  };
189 
190 #undef _________________________________________TYPES_SECTION______________________________________________________________________________
191 
197 #define _________________________________________INTERFACE_FUNCTIONS_SECTION________________________________________________________________
198 
199 extern oC_ErrorCode_t oC_FMC_TurnOn ( void );
200 extern oC_ErrorCode_t oC_FMC_TurnOff ( void );
201 extern bool oC_FMC_IsTurnedOn ( void );
202 extern oC_ErrorCode_t oC_FMC_Configure ( const oC_FMC_Config_t * Config , oC_FMC_Context_t * outContext );
203 extern oC_ErrorCode_t oC_FMC_Unconfigure ( const oC_FMC_Config_t * Config , oC_FMC_Context_t * outContext );
204 extern oC_ErrorCode_t oC_FMC_Read ( oC_FMC_Context_t Context , char * outBuffer , uint32_t Size , oC_IoFlags_t IoFlags );
205 extern oC_ErrorCode_t oC_FMC_Write ( oC_FMC_Context_t Context , const char * Buffer , uint32_t Size , oC_IoFlags_t IoFlags );
206 extern oC_ErrorCode_t oC_FMC_Ioctl ( oC_FMC_Context_t Context , oC_Ioctl_Command_t Command , void * Data );
207 extern oC_ErrorCode_t oC_FMC_SDRAM_SendCommand ( oC_FMC_Context_t Context , oC_Time_t * Timeout , oC_FMC_SDRAM_Command_t Command , const oC_FMC_SDRAM_CommandData_t * Data );
208 extern oC_ErrorCode_t oC_FMC_ReadDirectAddress ( oC_FMC_Context_t Context , void ** outAddress , oC_MemorySize_t * outMemorySize );
209 extern oC_ErrorCode_t oC_FMC_FinishInitialization ( const oC_FMC_Config_t * Config , oC_FMC_Context_t Context );
210 
211 #undef _________________________________________INTERFACE_FUNCTIONS_SECTION________________________________________________________________
212 
213 #endif
214 #endif /* _OC_FMC_H */
oC_FMC_SDRAM_Command_t
commands for SDRAM
Definition: oc_fmc.h:97
The file with interface for the GPIO driver.
const oC_FMC_ChipInfo_t * ChipInfo
Pointer to the informations about the selected chip.
Definition: oc_fmc.h:179
The file with frequency definitions.
oC_ErrorCode_t oC_FMC_TurnOff(void)
Turns off the FMC driver.
Definition: oc_fmc.c:204
oC_FMC_LLD_NORFlash_Config_t NORFlash
NOR Flash configuration structure.
Definition: oc_fmc.h:186
Simple no operation command.
Definition: oc_fmc.h:101
Never use the memory as heap.
Definition: oc_fmc.h:84
Deactivate a row in a bank (or in all banks)
Definition: oc_fmc.h:106
oC_FMC_LLD_SDRAM_CommandData_t oC_FMC_SDRAM_CommandData_t
stores data for SDRAM commands
Definition: oc_fmc.h:121
oC_ErrorCode_t oC_FMC_Write(oC_FMC_Context_t Context, const char *Buffer, uint32_t Size, oC_IoFlags_t IoFlags)
write buffer to the driver
Definition: oc_fmc.c:428
Write a burst to an active row.
Definition: oc_fmc.h:105
bool oC_FMC_IsTurnedOn(void)
checks if the driver is turned on
Definition: oc_fmc.c:231
Read operations are performed.
Definition: oc_fmc.h:68
Enables the clock (provides a stable CLK signal)
Definition: oc_fmc.h:99
The COMMAND INHIBIT function prevents new commands from being executed by the device, regardless of whether the CLK signal is enabled.
Definition: oc_fmc.h:100
oC_FMC_LLD_NANDFlash_Config_t NANDFlash
NAND Flash configuration structure.
Definition: oc_fmc.h:185
oC_ErrorCode_t oC_FMC_Configure(const oC_FMC_Config_t *Config, oC_FMC_Context_t *outContext)
configures FMC pins to work
Definition: oc_fmc.c:250
The command used for activate a row in a bank for a subsequent access.
Definition: oc_fmc.h:103
The file with interface for driver creating.
oC_ErrorCode_t oC_FMC_FinishInitialization(const oC_FMC_Config_t *Config, oC_FMC_Context_t Context)
finishes initialization
Definition: oc_fmc.c:530
The file with LLD interface for the FMC driver.
oC_FMC_Protection_t
stores memory protection
Definition: oc_fmc.h:64
oC_ErrorCode_t oC_FMC_SDRAM_SendCommand(oC_FMC_Context_t Context, oC_Time_t *Timeout, oC_FMC_SDRAM_Command_t Command, const oC_FMC_SDRAM_CommandData_t *Data)
sends command to SDRAM chips
Definition: oc_fmc.c:468
Read a burst to an active row.
Definition: oc_fmc.h:104
oC_FMC_LLD_ChipParameters_t ChipParameters
Chip parameters.
Definition: oc_fmc.h:160
oC_ErrorCode_t oC_FMC_TurnOn(void)
turns on the module
Definition: oc_fmc.c:168
Default protection for the memory type.
Definition: oc_fmc.h:66
oC_ErrorCode_t(* oC_FMC_InitializationFunction_t)(const void *Config, oC_FMC_Context_t Context, oC_Time_t *Timeout)
function for initialization of the chip
Definition: oc_fmc.h:149
Execution operations are performed.
Definition: oc_fmc.h:69
oC_ErrorCode_t oC_FMC_Read(oC_FMC_Context_t Context, char *outBuffer, uint32_t Size, oC_IoFlags_t IoFlags)
reads buffer from the driver
Definition: oc_fmc.c:389
Terminates a burst (either fixed length or continuous page burst)
Definition: oc_fmc.h:107
The file with interface for IOCTL.
oC_FMC_InitializationFunction_t InitializationFunction
Function to call for initialize the chip.
Definition: oc_fmc.h:161
stores informations about chip
Definition: oc_fmc.h:158
oC_FMC_HeapUsage_t
Heap should be used or not.
Definition: oc_fmc.h:81
Refreshes a ram, when the system is powered-down (it does not require a CLOCK)
Definition: oc_fmc.h:109
stores ETH context
Definition: oc_eth.c:97
Default option - if usage of heap is possible, then use it.
Definition: oc_fmc.h:83
oC_FMC_LLD_SDRAM_Config_t SDRAM
SDRAM configuration structure.
Definition: oc_fmc.h:183
Refreshes a SDRAM.
Definition: oc_fmc.h:108
Configuration command for loading modes registers.
Definition: oc_fmc.h:102
Write operations are performed.
Definition: oc_fmc.h:67
oC_FMC_HeapUsage_t HeapUsage
Use or not the configured memory as heap.
Definition: oc_fmc.h:178
FMC driver configuration structure.
Definition: oc_fmc.h:176
oC_FMC_LLD_PSRAM_Config_t PSRAM
PSRAM configuration structure.
Definition: oc_fmc.h:184
struct Context_t * oC_FMC_Context_t
The FMC context structure.
Definition: oc_fmc.h:135
struct oC_FMC_Config_t oC_FMC_Config_t
FMC driver configuration structure.
oC_ErrorCode_t oC_FMC_ReadDirectAddress(oC_FMC_Context_t Context, void **outAddress, oC_MemorySize_t *outMemorySize)
returns an address for direct access to the memory
Definition: oc_fmc.c:497
oC_ErrorCode_t oC_FMC_Unconfigure(const oC_FMC_Config_t *Config, oC_FMC_Context_t *outContext)
Unconfigures the driver.
Definition: oc_fmc.c:302
oC_ErrorCode_t oC_FMC_Ioctl(oC_FMC_Context_t Context, oC_Ioctl_Command_t Command, void *Data)
handles input/output driver commands
Definition: oc_fmc.c:342
oC_Time_t MaximumTimeForConfiguration
Maximum time for the memory configuration.
Definition: oc_fmc.h:180