GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > PBC / V4-12-1
Constituent: pbc_bootshell     Tag: rad750
#include "PBC/PBC.h"
#include "bootshell.h"
#include "PBC/PBC_msgs.h"
#include "PBC/PBC_types.h"
#include "PBC/PBC_string.h"
#include "EE_boot.h"
#include "pbc_sio.h"
#include "cmdtlm.h"
#include "MSG/MSG_macdefs.h"
#include "pbc_memmap.h"
Include dependency graph for pbc_commit.c:
Data Structures | |
struct | _pbc_FileIdMapEntry |
PBC file ID to address map entry. See pbc_fileIdMap. More... | |
Defines | |
#define | PBC_COMMIT_MAX_STALL (1000) |
Maximum number of times that an EEPROM write request can make no progress before declaring a timeout failure. | |
#define | pbc_COMMIT_EEPROM_PAGE_BYTES (EE_PAGE_BYTES) |
EEPROM page size in bytes. | |
#define | pbc_COMMIT_RAM_PAGE_BYTES (1024 * 4) |
RAM page size in bytes. | |
#define | pbc_FILE_ID_MAP_SIZE (sizeof(pbc_fileIdMap) / sizeof(*pbc_fileIdMap)) |
Size fo file id map structure. | |
Typedefs | |
typedef enum _pbc_CommitState | pbc_CommitState |
typedef for _pbc_CommitState | |
typedef enum _pbc_CommitDest | pbc_CommitDest |
typedef for _pbc_CommitDest | |
typedef enum _pbc_CommitFileId | pbc_CommitFileId |
Enumerations | |
enum | _pbc_CommitState { pbc_COMMIT_STATE_IDLE, pbc_COMMIT_STATE_ACTIVE, pbc_COMMIT_STATE_ERROR } |
PBC commit state enumeration. More... | |
enum | _pbc_CommitDest { pbc_COMMIT_DEST_NONE, pbc_COMMIT_DEST_RAM, pbc_COMMIT_DEST_EEPROM } |
PBC commit destination enumeration. More... | |
enum | _pbc_CommitFileId { pbc_FILE_ID_RTOS_RAM = 0, pbc_FILE_ID_MOD0_RAM = 1, pbc_FILE_ID_MOD1_RAM = 2, pbc_FILE_ID_RTOS_EEPROM0 = 3, pbc_FILE_ID_MOD0_EEPROM0 = 4, pbc_FILE_ID_MOD1_EEPROM0 = 5, pbc_FILE_ID_RTOS_EEPROM1 = 6, pbc_FILE_ID_MOD0_EEPROM1 = 7, pbc_FILE_ID_MOD1_EEPROM1 = 8, pbc_MAX_FILE_ID = 8 } |
Functions | |
void | Pbc_CommitInit () |
Initialize commit state machine. | |
void | Pbc_CommitReset () |
Reset commit state machine. | |
static unsigned int | pbc_CommitMapFileToAddress (const unsigned int fileId, unsigned int *destAddr, size_t *destSize) |
Map file id to virtual address. | |
void | Pbc_CommitConfigureData (const unsigned long source, const unsigned long dest, const size_t bytes) |
Configure commit request for memory block. | |
unsigned int | Pbc_CommitConfigureFile (const unsigned long source, const size_t bytes, const unsigned int fileId) |
Configure commit request for a file upload. | |
static void | Pbc_CommitNextChunk () |
Copy next chunk of data. | |
void | Pbc_CommitDone (const unsigned long newBootMode) |
Copy next chunk of data. | |
void | Pbc_CommitService () |
Service commit state machine. | |
Variables | |
struct { | |
pbc_CommitState state | |
pbc_CommitDest destType | |
EE_Bank eepromBank | |
unsigned long sourcePointer | |
unsigned long destPointer | |
size_t totalBytes | |
size_t currentOffset | |
size_t pageBytes | |
int numStall | |
} | pbc_commitData |
PBC commit state information. | |
const struct _pbc_FileIdMapEntry | pbc_fileIdMap [] |
PBC file ID to address map. |
CVS $Id: pbc_commit.c,v 1.13 2005/01/26 17:40:24 dmay Exp $
Handle commit state machine. This module provides and interface to commit data uploaded data to the EEPROM or RAM. Four functions make up the interface:
Pbc_CommitInit() - initialize or reset commit state data. Should be called at system initialization. Also can be called on error to reset state data. Is called internally to recover from errors.
Pbc_CommitConfigureData() - Configure commit state machine to copy a specified data to RAM or EEPROM. Takes source address, destination address and size arguments.
Pbc_CommitConfigureFile() - Configure commit state machine to copy a specified file to RAM or EEPROM. Takes source address, file id and size arguments.
Pbc_CommitService() - Perform periodic processing of commit state machine. Should be called at all times, even when commit is not active.
|
EEPROM page size in bytes. The EEPROM driver won't write more than the EEPROM page size as specified by Hitachi, so don't bother to request any more. |
|
RAM page size in bytes. RAM does not really have any kind of physical limitations on paging, but RAM commit is done in chunks so PBC can keep up with the command and telemetry system. |
|
Size fo file id map structure. Indicates the number of entries in the file id map pbc_fileIdMap. |
|
The typedef for _pbc_CommitFileId |
|
PBC commit destination enumeration. description... |
|
|
PBC commit state enumeration. description... |
|
Configure commit request for memory block. Configure commit state machine to copy a specified data to RAM or EEPROM. Takes source address, destination address and size arguments. Puts the commit state machine in the active state.
|
|
Configure commit request for a file upload. Configure commit state machine to copy a specified file to RAM or EEPROM. Takes source address, file id and size arguments. Puts the commit state machine in the active state. A destination address is calculated from the fileId.
|
|
Copy next chunk of data. Cleanup state machine and PBC state when commit is done. Commit state machine is reset and we go back into boot command mode. It is assumed that we're in the PBC_SW_MODE_COMMIT mode when this function is called.
|
|
Initialize commit state machine. Set internal commit data to idle state and reset members of commit context.
|
|
Map file id to virtual address. Maps a file id from a file upload command to a address in virtual space where file should be loaded. This address can be in either RAM or EEPROM.
|
|
Copy next chunk of data. Handle the legwork of copying data during a commit. This routine should be called by Pbc_CommitService() when a chunk of data is ready to be written. Sorry, no parameters - all data is in global pbc_commitData structure.
|
|
Reset commit state machine. Reset commit state machine. Calls Pbc_CommitInit() to clear out the structure, also forces a lock on the EEPROM parts. Should be called when commit is done due to successful or error completion.
|
|
Service commit state machine. Perform periodic processing of commit state machine. Should be called at all times, even when commit is not active. Sorry, no parameters - all data is in global pbc_commitData structure.
|
|
offset from source and destination for next copy. |
|
base address of destination |
|
current commit destination |
|
EEPROM bank, only valid if destType is EEPROM |
|
number of times EE write stalled. |
|
number of bytes to copy on each commit loop. |
|
PBC commit state information. description... |
|
PBC file ID to address map. This structure maps boot file ids to either address in RAM or to offsets in the EEPROM bank headers that can be used to fetch addresses in EEPROM. |
|
base address of source |
|
current commit state. |
|
total bytes to copy |