ConOpSys V2970  P004.07
ANVILEX control operating system
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
TFM25V02 Class Reference

NVRAM memory hardware driver. More...

#include <FM25V02.h>

Inheritance diagram for TFM25V02:
Inheritance graph
Collaboration diagram for TFM25V02:
Collaboration graph

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_Baseobject_SPI_Master = (TSPI_Master_Base*)NULL
 Pointer to the SPI master object. More...
 
TMemory_Chip_Descriptorstruct_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...
 

Detailed Description

NVRAM memory hardware driver.

Member Typedef Documentation

◆ TDevice_ID

device ID structure

Member Enumeration Documentation

◆ TNVRAMCommand

Define NVRAM commands.

Enumerator
commandWREN 

Write Enable Latch command.

commandWRDI 

Write Disable command.

commandRDSR 

Read Status Register command.

commandWRSR 

Write Status Register command.

commandREAD 

Read Memory Data command.

commandFSTRD 

Fast Read Memory Data command.

commandWRITE 

Write Memory Data command.

commandSLEEP 

Enter sleep mode command.

commandRDID 

Read device ID command.

commandSNR 

Read device serial number command.

Constructor & Destructor Documentation

◆ TFM25V02()

TFM25V02::TFM25V02 ( )

Class constructor method.


Note
None
Override
Not allowed
Attention
Don't call this method directly.

◆ ~TFM25V02()

TFM25V02::~TFM25V02 ( )
virtual

Class destructor method.


Note
None
Override
Not allowed
Attention
Don't call this method directly.

Member Function Documentation

◆ Exit_Sleep_Mode()

VOID TFM25V02::Exit_Sleep_Mode ( )
private

Exit from sleep mode.


Note
None
Returns
None
Override
Requered
Attention
Depricated method.

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.

Here is the call graph for this function:

◆ Init()

VOID TFM25V02::Init ( )

Driver initialisation method.


Note
By calling this method driver make internal initialisation and prepering for operation.
Returns
None
Override
Not allowed
Attention
None

References TSPI_Memory_Base::Init(), struct_Device_ID, and TFM25V02::TDevice_ID::u8_Device_ID.

Referenced by TApplication_Base::Init(), and TBootloader_Base::Init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Is_Address_In_Range()

BOOL TFM25V02::Is_Address_In_Range ( U32  u32_Address,
U32  u32_Size 
)
private

Address in range checking method.


Note
None
Parameters
[in]u32_Address- Address (4 bytes)
[in]u32_Size- Data size
Returns
None
Override
Not requered
Attention
Depricated method.

References struct_Device_ID, and TFM25V02::TDevice_ID::u8_Density.

Referenced by Read_Buffer(), Verify_Buffer(), and Write_Buffer().

Here is the caller graph for this function:

◆ Read_Buffer()

BOOL TFM25V02::Read_Buffer ( U32  u32_Linear_Address,
U32  u32_Size,
U8 u8_Data_Buffer 
)
virtual

Read data from memory into buffer.


Note
None
Parameters
[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
Returns
BOOL - Data read operation status
Return values
false- Read operation failed
true- Read operation successed
Override
Not requered
Attention
None

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Read_Device_ID()

BOOL TFM25V02::Read_Device_ID ( )
privatevirtual

Read manufacturer identifier pure virtual method.


Note
None
Returns
None
Override
Requered
Attention
Depricated method.

Read device identifier pure virtual method.

Note
None
Returns
None
Override
Requered
Attention
Depricated 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Read_Identification()

BOOL TFM25V02::Read_Identification ( )
privatevirtual

Read memory device identification information method.


Note
None
Returns
BOOL - Read operation status
Return values
false- Read operation failed
true- Read operation successed
Override
Requered
Attention
None

Implements TSPI_Memory_Base.

References Read_Device_ID(), and Read_Serial_Number().

Here is the call graph for this function:

◆ Read_Memory()

BOOL TFM25V02::Read_Memory ( U32  u32_Address,
U8 u8_Data 
)
privatevirtual

Read byte from device method.


Note
None
Parameters
[in]u32_Address- Address
[out]*u8_Data- Pointer to returned data value
Returns
BOOL - Read operation status
Return values
false- Read operation failed
true- Read operation successed
Override
Requered
Attention
None

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().

Here is the call graph for this function:

◆ Read_Serial_Number()

BOOL TFM25V02::Read_Serial_Number ( )
privatevirtual

Read device serial number pure virtual method.


Note
None
Returns
None
Override
Requered
Attention
Depricated 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Read_Status_Register()

BOOL TFM25V02::Read_Status_Register ( U8 u8_Status_Register)
privatevirtual

Read memory device status register method.


Note
None
Parameters
[out]*u8_Status_Register- Pointer to status register value
Returns
BOOL - Read operation status
Return values
false- Read operation failed
true- Read operation successed
Override
Requered
Attention
None

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().

Here is the call graph for this function:

◆ Start()

VOID TFM25V02::Start ( )
virtual

Driver start operation method.


Note
By calling this method driver starts opration.
Returns
None
Override
Not allowed
Attention
None

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Translate_Address()

VOID TFM25V02::Translate_Address ( U32  u32_Address,
U8 u8_Address_Size,
U8 u8_Address_Byte_2,
U8 u8_Address_Byte_1,
U8 u8_Address_Byte_0 
)
private

Address translation method.


Note
None
Parameters
[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)
Returns
None
Override
Not requered
Attention
Depricated method.

References struct_Device_ID, and TFM25V02::TDevice_ID::u8_Density.

Referenced by Read_Buffer(), Read_Memory(), Verify_Buffer(), Write_Buffer(), and Write_Memory().

Here is the caller graph for this function:

◆ Verify_Buffer()

BOOL TFM25V02::Verify_Buffer ( U32  u32_Linear_Address,
U32  u32_Size,
U8 u8_Data_Buffer 
)
virtual

Write data from buffer into memory.


Note
None
Parameters
[in]u32_Linear_Address- Linear address
[in]u32_Size- Size of the data
[out]*u8_Data_Buffer- Pointer to the data buffer
Returns
BOOL - Oeration status
Return values
false- Operation failed
true- Operation successed
Override
Not requered
Attention
None

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().

Here is the call graph for this function:

◆ Write_Buffer()

BOOL TFM25V02::Write_Buffer ( U32  u32_Linear_Address,
U32  u32_Size,
U8 u8_Data_Buffer 
)
virtual

Write data from buffer into memory.


Note
None
Parameters
[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
Returns
BOOL - Data write operation status
Return values
false- Write operation failed
true- Write operation successed
Override
Not requered
Attention
None

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Write_Memory()

BOOL TFM25V02::Write_Memory ( U32  u32_Address,
U8  u8_Data 
)
privatevirtual

Write byte into device method.


Note
None
Parameters
[in]u32_Address- Address
[in]u8_Data- Data value
Returns
BOOL - Write operation status
Return values
false- Write operation failed
true- Write operation successed
Override
Requered
Attention
None

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().

Here is the call graph for this function:

◆ Write_Status_Register()

BOOL TFM25V02::Write_Status_Register ( U8  u8_Status_Register)
privatevirtual

Write memory device status register method.


Note
None
Parameters
[in]u8_Status_Register- Status register value
Returns
BOOL - Write operation status
Return values
false- Write operation failed
true- Write operation successed
Override
Requered
Attention
None

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().

Here is the call graph for this function:

Member Data Documentation

◆ struct_Device_ID

TDevice_ID TFM25V02::struct_Device_ID
private

Memory device ID structure.

Referenced by Init(), Is_Address_In_Range(), Read_Device_ID(), Start(), and Translate_Address().

◆ u8_Serial_Number

U8 TFM25V02::u8_Serial_Number[8] = { (U8)0x00, (U8)0x00, (U8)0x00, (U8)0x00, (U8)0x00, (U8)0x00, (U8)0x00, (U8)0x00 }
private

Serial number storage.

Referenced by Read_Serial_Number().


The documentation for this class was generated from the following files: