GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > VXW / V7-2-0
Constituent: vxw_tornado_sio     Tag: rad750
#include "vxWorks.h"
#include "string.h"
#include "sysLib.h"
#include "wdLib.h"
#include "semLib.h"
#include "tffs/flflash.h"
#include "tffs/flsocket.h"
#include "tffs/tffsIoctl.h"
Include dependency graph for eemtd.c:
Data Structures | |
struct | _EEPROM_Desc |
Defines | |
#define | EEPROM_MTD_LOG(_lev, _msg, _x0, _x1, _x2, _x3, _x4, _x5) |
#define | EEPROM_MTD_TYPE 2 |
#define | EEPROM_CHIP_SIZE 0x20000 |
#define | EEPROM_ERASE_SIZE 0x10000 |
#define | EEPROM_WORD_SIZE 4 |
#define | EEPROM_BUFFER_SIZE 1024 |
#define | EEPROM_PAGE_SIZE (128 * EEPROM_WORD_SIZE) |
#define | EEPROM_TOGGLE_MASK 0x40404040 |
#define | EEPROM_ERASE_VALUE 0xffffffff |
#define | EEPROM_CLK_DIVISOR 25 |
#define | EEPROM_RETRY_CALC ((sysClkRateGet() / EEPROM_CLK_DIVISOR) + 1) |
#define | EEPROM_ADDR_MAP(_offset) ((vol.socket->window.baseAddress << 12) + (_offset)) |
#define | EEPROM_ADDR_OFFSET(_addr) ((_addr) - (vol.socket->window.baseAddress << 12)) |
Typedefs | |
typedef _EEPROM_Desc | EEPROM_Desc |
Functions | |
static FLStatus | eeMTDWriteWord (EEPROM_Desc *desc, unsigned int addr, unsigned int data, int retry) |
Writes to one EEPROM location. | |
static FLStatus | eeMTDWritePage (EEPROM_Desc *desc, unsigned int pageBase, const void FAR1 *buffer, unsigned int numPages) |
static FLStatus | eeMTDWriteQuery (EEPROM_Desc *desc, unsigned int addr, int retry) |
Waits for write completion. | |
static void | eeMTDError (FLFlash vol, FLStatus error, unsigned int offset) |
static void | eeMTDHandler (FLStatus error, int drv, unsigned int offset, int arg) |
static FLStatus | eeMTDWrite (FLFlash vol, CardAddress address, const void FAR1 *buffer, int length, FLBoolean overwrite) |
Write to EEPROM. | |
static FLStatus | eeMTDRead (FLFlash vol, CardAddress address, void FAR1 *buffer, int length, int modes) |
Read from EEPROM. | |
static FLStatus | eeMTDErase (FLFlash vol, int firstBlock, int numBlocks) |
Erase EEPROM. | |
static void FAR0 * | eeMTDMap (FLFlash vol, CardAddress address, int length) |
Map EEPROM into local memory. | |
FLStatus | eeMTDIdentify (FLFlash vol) |
Registers EEPROM driver. | |
STATUS | tffsIoctl (TFFS_IOC funcCode, int arg0, int arg1, int arg2) |
TFFS driver low-level control. | |
Variables | |
static EEPROM_Desc | eeDesc [DRIVES] |
static TFFS_Error_Handler * | eeErrHandler = eeMTDHandler |
static int | eeErrArg |
|
Maps a TFFS partition local offset address into a EEPROM physical address.
|
|
Maps an EEPROM physical address into a TFFS partition local offset.
|
|
The size in bytes of the map emulation buffer. |
|
The size in bytes of one EEPROM chip. |
|
The system clock divisor used to calculate the write retry value. |
|
The size of an erase block (simulated). |
|
The value to write to simulate an erase operation. |
|
Macro to control debug log messages.
|
|
Fake JTEC ID to indicate EEPROM. |
|
The size in bytes of one EEPROM write page. |
|
Macro to calculate write retry count based on the current system clock rate. |
|
The D6 toggle bit mask for an EEPROM location. |
|
The size of an addressable EEPROM location. |
|
The typedef for _EEPROM_Desc. |
|
Erase EEPROM. This routine is registered as MTD vol.erase. The EEPROM media does not actually support a hardware erase operation. In fact, writes can always be done to a location at any time. TFFS, however, assumes that an erased block is set to value 0xffffffff. This function emulates the erase operation by writing 0xfffffff to all EEPROM locations within the erase block. This function takes advantage of the EEPROM page mode programming feature to write all of the locations in an erase block.
|
|
This function is called when the EEPROM driver encounters an error. If a user error handler callback is installed, it is called.
|
|
The default error handler callback. Simply logs the callback parameters.
|
|
Registers EEPROM driver. MTD vol structure is initialized. The vol structure function pointers are initialized to the EEPROM MTD callbacks.
|
|
Map EEPROM into local memory. This routine is registered as MTD vol.map. Because the EEPROM bank memory cannot be read directly by TFFS, this function provides mapping through copy emulation. The eeMTDRead() function is used to read the requested partition data into the driver private read buffer. A pointer to the read buffer is then returned.
|
|
Read from EEPROM. This routine is registered as MTD vol.read. Data is read as requested. Because the EEPROM chips can only be read in groups of 4, this function does the appropriate byte extraction to handle any size or address alignments.
|
|
Write to EEPROM. This routine is registered as MTD vol.write. Because the EEPROM chips can only be writen in groups of 4, this function does a general read-modify-write routine when inserting new data.
|
|
This function takes advantage of the EEPROM page mode programming feature to write all of the locations in hardware page. After the initial page write, all of the locations are read to verify the write success. Any failures from the page write are tried again using the single word write mode.
|
|
Waits for write completion. The address just written is read once every system clock tick to check for completion status. The EEPROM chip returns undefined data while it is in write programming mode, except for bit 6 of the written location. Bit 6 will toggle back and forth until the internal write process has completed. This function does back to back reads of the address and checks for the stability of bit 6. The retry parameter limits the number of times that the location is checked for completion status. Once bit 6 stabalizes, the location is read once more and compared to the original write data value before declaring success.
|
|
Writes to one EEPROM location. Writes one 4 byte word to a single EEPROM address. After the data is written to the location, the location is polled for completion, and a read is performed to verify the write success.
|
|
TFFS driver low-level control.
This function provides extended control over the EEPROM MTD driver not available with the standard VxWorks TFFS interface. The funcCode parameter specifies the action to perform. TFFS_IOC_ERROR_HANDLER - Installs a callback which will catch EEPROM MTD driver errors. Set arg0 to the address of the function and arg1 to a user parmeter value which will be passed to the callback. The callback is in the form TFFS_Error_Handler.
|
|
Local driver partition descriptors. |
|
The user argument for eeErrHandler. |
|
The user installed error callback. |