Choco OS  V.0.16.9.0
Join to the chocolate world
oc_fmc.c File Reference

The file with source for FMC driver interface. More...

#include <oc_fmc.h>
#include <oc_fmc_lld.h>
#include <oc_compiler.h>
#include <oc_module.h>
#include <oc_intman.h>
#include <oc_null.h>
#include <oc_math.h>
#include <oc_memman.h>
#include <oc_struct.h>
#include <oc_gpio.h>
#include <oc_driver.h>

Go to the source code of this file.

Data Structures

struct  Context_t
 stores ETH context More...
 

Functions

static bool IsContextCorrect (oC_FMC_Context_t Context)
 Checks if the context of the FMC driver is correct.
 
static bool IsMemoryTypeCorrect (oC_FMC_LLD_MemoryType_t MemoryType)
 returns true if memory type is correct
 
static oC_FMC_Context_t Context_New (const oC_FMC_Config_t *Config)
 allocates memory for new context
 
static bool Context_Delete (oC_FMC_Context_t *outContext)
 releases memory allocated for context
 
static oC_ErrorCode_t ReadData (oC_FMC_Context_t Context, char *outData)
 Reads one byte from the configured buffer.
 
static oC_ErrorCode_t WriteData (oC_FMC_Context_t Context, char Data)
 Writes one byte to the configured buffer.
 
static oC_ErrorCode_t ConfigureHeap (const oC_FMC_Config_t *Config, oC_FMC_Context_t Context)
 configures memory as heap
 
static oC_ErrorCode_t UnconfigureHeap (const oC_FMC_Config_t *Config, oC_FMC_Context_t Context)
 unconfigures memory as heap
 
static oC_ErrorCode_t ConfigureMemoryInLld (const oC_FMC_Config_t *Config, oC_FMC_Context_t Context)
 configures memory (calls a LLD function according to the memory type)
 
static oC_ErrorCode_t UnconfigureMemoryInLld (const oC_FMC_Config_t *Config, oC_FMC_Context_t Context)
 unconfigures memory (calls a LLD function according to the memory type)
 
static oC_ErrorCode_t FinishMemoryInitializationInLld (const oC_FMC_Config_t *Config, oC_FMC_Context_t Context)
 finishes memory initialization (calls a LLD function according to the memory type)
 
static oC_ErrorCode_t CopyChipInfo (const oC_FMC_Config_t *Config, oC_FMC_Context_t Context)
 searches for informations about chip
 
static oC_ErrorCode_t VerifyChipInfo (const oC_FMC_Config_t *Config, oC_FMC_Context_t Context)
 verify, that the given chip info is correct
 
static oC_ErrorCode_t VerifyNANDFlashChipParameters (const oC_FMC_Config_t *Config, oC_FMC_Context_t Context)
 verifies chip info structure for the NAND flash memory type
 
static oC_ErrorCode_t VerifyNORFlashChipParameters (const oC_FMC_Config_t *Config, oC_FMC_Context_t Context)
 verifies chip info structure for the NOR Flash memory type
 
static oC_ErrorCode_t VerifySDRAMChipParameters (const oC_FMC_Config_t *Config, oC_FMC_Context_t Context)
 verifies chip parameters structure for the SDRAM memory type More...
 
static oC_ErrorCode_t VerifyPSRAMChipParameters (const oC_FMC_Config_t *Config, oC_FMC_Context_t Context)
 verifies chip info structure for the PSRAM memory type
 
static oC_ErrorCode_t InitializeChip (const oC_FMC_Config_t *Config, oC_FMC_Context_t Context)
 calls initialization of the chip
 
oC_ErrorCode_t oC_FMC_TurnOn (void)
 turns on the module More...
 
oC_ErrorCode_t oC_FMC_TurnOff (void)
 Turns off the FMC driver. More...
 
bool oC_FMC_IsTurnedOn (void)
 checks if the driver is turned on More...
 
oC_ErrorCode_t oC_FMC_Configure (const oC_FMC_Config_t *Config, oC_FMC_Context_t *outContext)
 configures FMC pins to work More...
 
oC_ErrorCode_t oC_FMC_Unconfigure (const oC_FMC_Config_t *Config, oC_FMC_Context_t *outContext)
 Unconfigures the driver. More...
 
oC_ErrorCode_t oC_FMC_Ioctl (oC_FMC_Context_t Context, oC_Ioctl_Command_t Command, void *Data)
 handles input/output driver commands More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
oC_ErrorCode_t oC_FMC_FinishInitialization (const oC_FMC_Config_t *Config, oC_FMC_Context_t Context)
 finishes initialization More...
 

Variables

static const oC_Allocator_t Allocator
 

Detailed Description


File based on driver.c Ver 1.1.0

Author
Patryk Kubiak - (Created on: 2016-04-02 - 16:12:02)

Definition in file oc_fmc.c.

Function Documentation

oC_ErrorCode_t oC_FMC_FinishInitialization ( const oC_FMC_Config_t Config,
oC_FMC_Context_t  Context 
)

The function should be called at the end of the chip initialization procedure. It finishes initialization by performing all required additional configuration.

Parameters
ConfigPointer to the FMC configuration structure
ContextContext of the FMC from the oC_FMC_Configure function
Returns
code of error or #oC_ErrorCode_None if success

Definition at line 530 of file oc_fmc.c.

bool oC_FMC_IsTurnedOn ( void  )
Returns
true if driver is turned on

Definition at line 231 of file oc_fmc.c.

oC_ErrorCode_t oC_FMC_ReadDirectAddress ( oC_FMC_Context_t  Context,
void **  outAddress,
oC_MemorySize_t *  outMemorySize 
)

The function returns an address to direct access to the memory (if it is available)

Parameters
ContextContext of the FMC configuration
outAddressDestination for the address
outMemorySizeSize of the memory
Returns
code of error

Definition at line 497 of file oc_fmc.c.

static oC_ErrorCode_t VerifySDRAMChipParameters ( const oC_FMC_Config_t Config,
oC_FMC_Context_t  Context 
)
static
Warning
It verifies only basic fields of the structure. The others are verified during configuration

Definition at line 899 of file oc_fmc.c.

Variable Documentation

const oC_Allocator_t Allocator
static
Initial value:
= {
.Name = "fmc module"
}

The 'Allocator' for this driver. It should be used for all FMC driver kernel allocations.

Definition at line 115 of file oc_fmc.c.