simple FS  v0.1.0
Public Attributes | List of all members
MemoryDriver_t Struct Reference

Interface that defines list of functions with basic operation with memory. More...

#include <memory_driver.h>

Public Attributes

uint8_t(* Init )(void *hw_object, void *GPIOx, uint16_t GPIO_Pin)
 Init memory hardware peripheral. More...
 
uint16_t(* Read )(uint32_t addr, uint8_t *buf, uint16_t n)
 Read amount data frommemory. More...
 
uint16_t(* Write )(uint32_t addr, uint8_t *buf, int32_t n)
 Write amount of data in memory. More...
 
uint8_t(* IsBusy )(void)
 Return state information from memory. More...
 
uint8_t(* EraseAll )(void)
 Erase whole memory. More...
 
uint8_t(* EraseSector )(uint32_t addr_start)
 Erase specified sector in memory. More...
 
uint8_t(* PowerUp )(void)
 Power up memory. More...
 
uint8_t(* PowerDown )(void)
 Power down memory. More...
 
void(* Dump )(void)
 
uint8_t(* Capacity )(void)
 Return capacity code: More...
 
uint8_t(* Manufacturer )(void)
 Return manufacturer code of memory: More...
 
uint8_t(* Type )(void)
 Return type fo memory.
 
uint64_t(* Id )(void)
 Return HW ID of used memory. More...
 

Detailed Description

Interface that defines list of functions with basic operation with memory.

These functions must to be implemented in fina implementation of memory.

Member Data Documentation

◆ Capacity

uint8_t(* MemoryDriver_t::Capacity) (void)

Return capacity code:

EEPROM

  • 0x01 - 512 bit
  • 0x02 - 1024 bit (1kB)
  • 0x03 - 2048 bit (2kB)
  • 0x04 - 4096 bit (4kB)
  • 0x05 - 8kB
  • 0x06 - 16kB
  • 0x05 - 20kB

FLASH

  • 0x11 - 1MBit
  • 0x12 - 2Mbit
  • 0x13 - 4Mbit
  • 0x14 - 8Mbit
  • 0x15 - 16Mbit
  • 0x16 - 32Mbit
  • 0x17 - 64Mbit
  • 0x18 - 128Mbit

◆ EraseAll

uint8_t(* MemoryDriver_t::EraseAll) (void)

Erase whole memory.

This operation can be performed for several seconds.

Returns
1, if is successfully done.

◆ EraseSector

uint8_t(* MemoryDriver_t::EraseSector) (uint32_t addr_start)

Erase specified sector in memory.

Size of sector is hardware dependent. This operation can be performed for several seconds.

Parameters
addr_startstarting address of sector.
Returns
1, if is successfully done.

◆ Id

uint64_t(* MemoryDriver_t::Id) (void)

Return HW ID of used memory.

Returns
hardware ID as long integer (64bit)

◆ Init

uint8_t(* MemoryDriver_t::Init) (void *hw_object, void *GPIOx, uint16_t GPIO_Pin)

Init memory hardware peripheral.

Parameters
hw_objectrepresent pointer to used interface. SPI, I2C, UART, NULL (in simulation mode)
GPIOxadditional HW resource. e.g. GPIOPort
GPIO_Pinadditional HW resource. w.g. GPIOPin
Returns
HAL_OK, in case of success

◆ IsBusy

uint8_t(* MemoryDriver_t::IsBusy) (void)

Return state information from memory.

Returns
1 - busy, 0 - available

◆ Manufacturer

uint8_t(* MemoryDriver_t::Manufacturer) (void)

Return manufacturer code of memory:

  • 0x20 -> Micron
  • 0xEF -> Winbond
  • 0x2D, 0x43 -> Maxim integrated (DS..) - return family code
  • 0x00 -> RAM (SW simulation)

◆ PowerDown

uint8_t(* MemoryDriver_t::PowerDown) (void)

Power down memory.

Only if it is supported by hardware.

Returns
1, if is successfully done.

◆ PowerUp

uint8_t(* MemoryDriver_t::PowerUp) (void)

Power up memory.

Only if it is supported by hardware.

Returns
1, if is successfully done.

◆ Read

uint16_t(* MemoryDriver_t::Read) (uint32_t addr, uint8_t *buf, uint16_t n)

Read amount data frommemory.

Parameters
addrstarting address for reading
bufpointer to array, where will data store.
nsize of array buf
Returns
length of written data

◆ Write

uint16_t(* MemoryDriver_t::Write) (uint32_t addr, uint8_t *buf, int32_t n)

Write amount of data in memory.

Parameters
addrstarting address for writing
bufpointer to array, that will be written.
nsize of array buf
Returns
length of written data

The documentation for this struct was generated from the following file: