ConOpSys V2970
P004.07
ANVILEX control operating system
|
NVRAM memory hardware driver. More...
#include <FM25V02.h>
Classes | |
union | TDevice_ID |
device ID structure More... | |
Public Types | |
typedef union TFM25V02::TDevice_ID | TDevice_ID |
device ID structure More... | |
Public Member Functions | |
TFM25V02 () | |
Class constructor method. More... | |
virtual | ~TFM25V02 () |
Class destructor method. More... | |
VOID | Init () |
Driver initialisation method. More... | |
virtual VOID | Start () |
Driver start operation method. More... | |
virtual BOOL | Read_Buffer (U32 u32_Linear_Address, U32 u32_Size, U8 *u8_Data_Buffer) |
Read data from memory into buffer. More... | |
virtual BOOL | Write_Buffer (U32 u32_Linear_Address, U32 u32_Size, U8 *u8_Data_Buffer) |
Write data from buffer into memory. More... | |
virtual BOOL | Verify_Buffer (U32 u32_Linear_Address, U32 u32_Size, U8 *u8_Data_Buffer) |
Write data from buffer into memory. More... | |
Public Member Functions inherited from TSPI_Memory_Base | |
TSPI_Memory_Base () | |
Base class constructor method. More... | |
virtual | ~TSPI_Memory_Base () |
Base class constructor method. More... | |
VOID | Init () |
SPI memory base object initialisation method. More... | |
VOID | Done () |
SPI memory base object finalisation method. More... | |
virtual VOID | Stop () |
Stop operation of SPI memory base driver. More... | |
VOID | Assign_SPI_Master (TSPI_Master_Base *object_New_SPI_Master) |
Assign SPI master hardware driver. More... | |
VOID | Unassign_SPI_Master () |
Unassign SPI master hardware driver. More... | |
virtual BOOL | Erase_Chip (BOOL bool_Force_Bad_Block_Erase) |
Erase chip method. More... | |
BOOL | Get_Block_Address (U16 u16_Block_Index, U32 *u32_Linear_Address) |
Get linear address of the block by specified block index. More... | |
BOOL | Get_Page_Address (U16 u16_Block_Index, U16 u16_Relative_Page_Index, U32 *u32_Linear_Address) |
Get linear address of the page by specified block index and relative page index. More... | |
U32 | Get_Capacity () |
Get capacity of attached SPI memory. More... | |
TRIL | Is_Available () |
Return SPI avaliability. More... | |
virtual VOID | Send_Information (TProtocol_Base *object_Protocol) |
Method sends default driver information over specified communication channel. More... | |
BOOL | Get_Page_Index (U32 u32_Linear_Address, U32 *u32_Page_Index) |
Get page index from lenear address. More... | |
BOOL | Get_Page_Index (U16 u16_Block_Index, U16 u16_Page_Relative_Index, U32 *u32_Page_Index) |
Get page index from block index and page relative index. More... | |
BOOL | Get_Block_Index_By_Page (U32 u32_Page_Index, U16 *u16_Block_Index) |
Get block index by page index. More... | |
BOOL | Get_Page_Index (U16 u16_Block_Index, U32 *u32_Page_Index) |
Get page index of the block. More... | |
BOOL | Get_Page_Size (U16 *u16_Page_Size) |
Return page size in bytes. More... | |
BOOL | Get_Pages_Per_Block_Count (U16 *u16_Pages_Per_Block) |
Return pages number into block. More... | |
BOOL | Get_Block_Count (U16 *u16_Block_Count) |
Return total amount of the blocks. More... | |
BOOL | Get_Pages_Per_Chip_Count (U32 *u32_Pages_Per_Chip) |
Return total amount of the pages. More... | |
Private Types | |
enum | TNVRAMCommand { commandWREN = (U8)0x06 , commandWRDI = (U8)0x04 , commandRDSR = (U8)0x05 , commandWRSR = (U8)0x01 , commandREAD = (U8)0x03 , commandFSTRD = (U8)0x0B , commandWRITE = (U8)0x02 , commandSLEEP = (U8)0xB9 , commandRDID = (U8)0x9F , commandSNR = (U8)0xC3 } |
Define NVRAM commands. More... | |
Private Member Functions | |
virtual BOOL | Read_Status_Register (U8 *u8_Status_Register) |
Read memory device status register method. More... | |
virtual BOOL | Write_Status_Register (U8 u8_Status_Register) |
Write memory device status register method. More... | |
virtual BOOL | Read_Memory (U32 u32_Address, U8 *u8_Data) |
Read byte from device method. More... | |
virtual BOOL | Write_Memory (U32 u32_Address, U8 u8_Data) |
Write byte into device method. More... | |
virtual BOOL | Read_Identification () |
Read memory device identification information method. More... | |
virtual BOOL | Read_Device_ID () |
Read manufacturer identifier pure virtual method. More... | |
virtual BOOL | Read_Serial_Number () |
Read device serial number pure virtual method. More... | |
VOID | Exit_Sleep_Mode () |
Exit from sleep mode. More... | |
VOID | Translate_Address (U32 u32_Address, U8 *u8_Address_Size, U8 *u8_Address_Byte_2, U8 *u8_Address_Byte_1, U8 *u8_Address_Byte_0) |
Address translation method. More... | |
BOOL | Is_Address_In_Range (U32 u32_Address, U32 u32_Size) |
Address in range checking method. More... | |
Private Attributes | |
U8 | u8_Serial_Number [8] = { (U8)0x00, (U8)0x00, (U8)0x00, (U8)0x00, (U8)0x00, (U8)0x00, (U8)0x00, (U8)0x00 } |
Serial number storage. More... | |
TDevice_ID | struct_Device_ID |
Memory device ID structure. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from TSPI_Memory_Base | |
BOOL | Get_Chip_Size (U32 *u32_Chip_Size) |
Return total chip capacity in bytes. More... | |
BOOL | Get_Block_Size (U32 *u32_Block_Size) |
Return block size in bytes. More... | |
BOOL | Extract_Page_Relative_Address (U32 u32_Linear_Address, U16 *u16_Relative_Address) |
Extract page relative address from lenear address. More... | |
BOOL | Is_Block_Index_In_Range (U16 u16_Block_Index) |
This method check that block index is valid. More... | |
BOOL | Is_Page_Index_In_Range (U32 u32_Page_Index) |
This method check that page index is valid. More... | |
Protected Attributes inherited from TSPI_Memory_Base | |
TSPI_Master_Base * | object_SPI_Master = (TSPI_Master_Base*)NULL |
Pointer to the SPI master object. More... | |
TMemory_Chip_Descriptor * | struct_Memory_Chip_Descriptor = (TMemory_Chip_Descriptor*)NULL |
Pointer to the chip descriptor structure. More... | |
TRIL | tril_Available = (TRIL)unset |
Memory chip availablility status. More... | |
BOOL | bool_Manufacturer_ID_Available = (BOOL)false |
Manufacturer ID availablility status. More... | |
BOOL | bool_Device_ID_Available = (BOOL)false |
Device ID availablility status. More... | |
BOOL | bool_Serial_Number_Available = (BOOL)false |
Serial number availablility status. More... | |
U32 | u32_Capacity = (U32)0 |
Depricated: Capacity of SPI memory in bytes. More... | |
NVRAM memory hardware driver.
typedef union TFM25V02::TDevice_ID TFM25V02::TDevice_ID |
device ID structure
|
private |
Define NVRAM commands.
TFM25V02::TFM25V02 | ( | ) |
Class constructor method.
|
virtual |
Class destructor method.
|
private |
Exit from sleep mode.
References TSPI_Master_Base::CS_Activate(), TSPI_Master_Base::CS_Deactivate(), THigh_Precision_Timer_Base::Delay(), object_Delay_Timer, and TSPI_Memory_Base::object_SPI_Master.
VOID TFM25V02::Init | ( | ) |
Driver initialisation method.
References TSPI_Memory_Base::Init(), struct_Device_ID, and TFM25V02::TDevice_ID::u8_Device_ID.
Referenced by TApplication_Base::Init(), and TBootloader_Base::Init().
Address in range checking method.
[in] | u32_Address | - Address (4 bytes) |
[in] | u32_Size | - Data size |
References struct_Device_ID, and TFM25V02::TDevice_ID::u8_Density.
Referenced by Read_Buffer(), Verify_Buffer(), and Write_Buffer().
Read data from memory into buffer.
[in] | u32_Linear_Address | - Linear address of the data in memory |
[in] | u32_Size | - Size of the data to read |
[out] | *u8_Data_Buffer | - Pointer to the data buffer |
false | - Read operation failed |
true | - Read operation successed |
Implements TSPI_Memory_Base.
References commandREAD, TSPI_Master_Base::CS_Activate(), TSPI_Master_Base::CS_Deactivate(), THigh_Precision_Timer_Base::Delay(), Is_Address_In_Range(), NULL, object_Delay_Timer, TSPI_Memory_Base::object_SPI_Master, TSPI_Master_Base::Receive_Byte(), TSPI_Master_Base::Send_Byte(), and Translate_Address().
Referenced by TCommand_NVRAM::Execute(), and Start().
|
privatevirtual |
Read manufacturer identifier pure virtual method.
Read device identifier pure virtual method.
References TSPI_Memory_Base::bool_Device_ID_Available, commandRDID, TSPI_Master_Base::CS_Activate(), TSPI_Master_Base::CS_Deactivate(), THigh_Precision_Timer_Base::Delay(), NULL, object_Delay_Timer, TSPI_Memory_Base::object_SPI_Master, TSPI_Master_Base::Receive_Byte(), TSPI_Master_Base::Send_Byte(), struct_Device_ID, and TFM25V02::TDevice_ID::u8_Device_ID.
Referenced by Read_Identification(), and Start().
|
privatevirtual |
Read memory device identification information method.
false | - Read operation failed |
true | - Read operation successed |
Implements TSPI_Memory_Base.
References Read_Device_ID(), and Read_Serial_Number().
Read byte from device method.
[in] | u32_Address | - Address |
[out] | *u8_Data | - Pointer to returned data value |
false | - Read operation failed |
true | - Read operation successed |
Reimplemented from TSPI_Memory_Base.
References commandREAD, TSPI_Master_Base::CS_Activate(), TSPI_Master_Base::CS_Deactivate(), THigh_Precision_Timer_Base::Delay(), NULL, object_Delay_Timer, TSPI_Memory_Base::object_SPI_Master, TSPI_Master_Base::Receive_Byte(), TSPI_Master_Base::Send_Byte(), and Translate_Address().
|
privatevirtual |
Read device serial number pure virtual method.
References TSPI_Memory_Base::bool_Serial_Number_Available, commandSNR, TSPI_Master_Base::CS_Activate(), TSPI_Master_Base::CS_Deactivate(), THigh_Precision_Timer_Base::Delay(), NULL, object_Delay_Timer, TSPI_Memory_Base::object_SPI_Master, TSPI_Master_Base::Receive_Byte(), TSPI_Master_Base::Send_Byte(), and u8_Serial_Number.
Referenced by Read_Identification().
Read memory device status register method.
[out] | *u8_Status_Register | - Pointer to status register value |
false | - Read operation failed |
true | - Read operation successed |
Reimplemented from TSPI_Memory_Base.
References commandRDSR, TSPI_Master_Base::CS_Activate(), TSPI_Master_Base::CS_Deactivate(), THigh_Precision_Timer_Base::Delay(), object_Delay_Timer, TSPI_Memory_Base::object_SPI_Master, TSPI_Master_Base::Receive_Byte(), and TSPI_Master_Base::Send_Byte().
|
virtual |
Driver start operation method.
Reimplemented from TSPI_Memory_Base.
References TSPI_Memory_Base::object_SPI_Master, Read_Buffer(), Read_Device_ID(), TSPI_Master_Base::Start(), struct_Device_ID, TSPI_Memory_Base::tril_Available, TSPI_Memory_Base::u32_Capacity, TFM25V02::TDevice_ID::u8_Density, and Write_Buffer().
Referenced by TApplication_Base::Init(), and TBootloader_Base::Init().
|
private |
Address translation method.
[in] | u32_Address | - Address (4 bytes) |
[out] | *u8_Address_Size | - Size of the address in bytes |
[out] | *u8_Address_Byte_2 | - Address (2th byte) |
[out] | *u8_Address_Byte_1 | - Address (1th byte) |
[out] | *u8_Address_Byte_0 | - Address (0th byte) |
References struct_Device_ID, and TFM25V02::TDevice_ID::u8_Density.
Referenced by Read_Buffer(), Read_Memory(), Verify_Buffer(), Write_Buffer(), and Write_Memory().
Write data from buffer into memory.
[in] | u32_Linear_Address | - Linear address |
[in] | u32_Size | - Size of the data |
[out] | *u8_Data_Buffer | - Pointer to the data buffer |
false | - Operation failed |
true | - Operation successed |
Reimplemented from TSPI_Memory_Base.
References commandREAD, TSPI_Master_Base::CS_Activate(), TSPI_Master_Base::CS_Deactivate(), THigh_Precision_Timer_Base::Delay(), Is_Address_In_Range(), NULL, object_Delay_Timer, TSPI_Memory_Base::object_SPI_Master, TSPI_Master_Base::Receive_Byte(), TSPI_Master_Base::Send_Byte(), and Translate_Address().
Write data from buffer into memory.
[in] | u32_Linear_Address | - Linear address of the data in memory |
[in] | u32_Size | - Size of the data to write |
[out] | *u8_Data_Buffer | - Pointer to the data buffer |
false | - Write operation failed |
true | - Write operation successed |
Implements TSPI_Memory_Base.
References commandWREN, commandWRITE, TSPI_Master_Base::CS_Activate(), TSPI_Master_Base::CS_Deactivate(), THigh_Precision_Timer_Base::Delay(), Is_Address_In_Range(), NULL, object_Delay_Timer, TSPI_Memory_Base::object_SPI_Master, TSPI_Master_Base::Send_Byte(), and Translate_Address().
Referenced by Start().
Write byte into device method.
[in] | u32_Address | - Address |
[in] | u8_Data | - Data value |
false | - Write operation failed |
true | - Write operation successed |
Reimplemented from TSPI_Memory_Base.
References commandWREN, commandWRITE, TSPI_Master_Base::CS_Activate(), TSPI_Master_Base::CS_Deactivate(), THigh_Precision_Timer_Base::Delay(), NULL, object_Delay_Timer, TSPI_Memory_Base::object_SPI_Master, TSPI_Master_Base::Send_Byte(), and Translate_Address().
Write memory device status register method.
[in] | u8_Status_Register | - Status register value |
false | - Write operation failed |
true | - Write operation successed |
Reimplemented from TSPI_Memory_Base.
References commandWREN, commandWRSR, TSPI_Master_Base::CS_Activate(), TSPI_Master_Base::CS_Deactivate(), THigh_Precision_Timer_Base::Delay(), object_Delay_Timer, TSPI_Memory_Base::object_SPI_Master, and TSPI_Master_Base::Send_Byte().
|
private |
Memory device ID structure.
Referenced by Init(), Is_Address_In_Range(), Read_Device_ID(), Start(), and Translate_Address().
|
private |
Serial number storage.
Referenced by Read_Serial_Number().