GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > PBC / V4-5-0

Constituent: pbc_bootshell     Tag: rad750


Interface   Data Structures   File List   Data Fields   Globals  

pbc_commit.c File Reference

Handle commit state. More...

#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:

Include dependency graph

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.

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.

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.


Detailed Description

Handle commit state.

Author:
Ray Caperoon
Date:
Wed Mar 3 07:54:40 2004
  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.


Define Documentation

#define pbc_COMMIT_EEPROM_PAGE_BYTES   (EE_PAGE_BYTES)
 

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.

#define pbc_COMMIT_RAM_PAGE_BYTES   (1024 * 4)
 

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.

#define pbc_FILE_ID_MAP_SIZE   (sizeof(pbc_fileIdMap) / sizeof(*pbc_fileIdMap))
 

Size fo file id map structure.

Indicates the number of entries in the file id map pbc_fileIdMap.


Typedef Documentation

pbc_CommitFileId
 

The typedef for _pbc_CommitFileId


Enumeration Type Documentation

enum _pbc_CommitDest
 

PBC commit destination enumeration.

description...

enum _pbc_CommitFileId
 

Lists the file ids that are loaded by PBC.

Enumeration values:
pbc_FILE_ID_RTOS_RAM  RTOS loaded to RAM
pbc_FILE_ID_MOD0_RAM  Module 0 loaded to RAM
pbc_FILE_ID_MOD1_RAM  Module 1 loaded to RAM
pbc_FILE_ID_RTOS_EEPROM0  RTOS loaded to EEPROM bank 0
pbc_FILE_ID_MOD0_EEPROM0  Module 0 loaded to EEPROM bank 0
pbc_FILE_ID_MOD1_EEPROM0  Module 1 loaded to EEPROM bank 0
pbc_FILE_ID_RTOS_EEPROM1  RTOS loaded to EEPROM bank 1
pbc_FILE_ID_MOD0_EEPROM1  Module 0 loaded to EEPROM bank 1
pbc_FILE_ID_MOD1_EEPROM1  Module 1 loaded to EEPROM bank 1
pbc_MAX_FILE_ID  Maximum value of file ID.

enum _pbc_CommitState
 

PBC commit state enumeration.

description...


Function Documentation

void Pbc_CommitConfigureData const unsigned long  source,
const unsigned long  dest,
const size_t  bytes
 

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.

Parameters:
source Address of data to be commited.
dest Address where data is to be commited.
bytes Number of bytes to commit.
Return values:
none 

void Pbc_CommitConfigureFile const unsigned long  source,
const size_t  bytes,
const unsigned int  fileId
 

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.

Parameters:
source Address of data to be commited.
fileId File id that maps to an address where data is to be commited.
bytes Number of bytes to commit.
Return values:
none 

Here is the call graph for this function:

void Pbc_CommitDone const unsigned long  newBootMode  ) 
 

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.

Parameters:
newBootMode boot mode to enter
Return values:
none 

Here is the call graph for this function:

void Pbc_CommitInit  ) 
 

Initialize commit state machine.

Set internal commit data to idle state and reset members of commit context.

Return values:
none 

unsigned int pbc_CommitMapFileToAddress const unsigned int  fileId,
unsigned int *  destAddr,
size_t *  destSize
[static]
 

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.

Parameters:
fileId File id to map (input parameter).
destAddr Address where file is to be stored. Not valid unless PBC_SUCCESS is returned. (output parameter).
destSize Size of file storage. Not valid unless PBC_SUCCESS is returned. (output parameter).
Returns:
PBC_COMBDFID, PBC_SUCCESS or value from EE_getBankHeaderAddress() or EE_getBankHeaderItem()
Return values:
PBC_COMBDFID Bad file id passed in
PBC_SUCCESS Successful mapping.

void Pbc_CommitNextChunk  )  [static]
 

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.

Return values:
none 

Here is the call graph for this function:

void Pbc_CommitReset  ) 
 

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.

Return values:
none 

Here is the call graph for this function:

void Pbc_CommitService  ) 
 

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.

Return values:
none 

Here is the call graph for this function:


Variable Documentation

size_t currentOffset
 

offset from source and destination for next copy.

unsigned long destPointer
 

base address of destination

pbc_CommitDest destType
 

current commit destination

EE_Bank eepromBank
 

EEPROM bank, only valid if destType is EEPROM

int numStall
 

number of times EE write stalled.

size_t pageBytes
 

number of bytes to copy on each commit loop.

pbc_commitData
 

PBC commit state information.

description...

pbc_fileIdMap
 

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.

unsigned long sourcePointer
 

base address of source

pbc_CommitState state
 

current commit state.

size_t totalBytes
 

total bytes to copy


Generated on Fri Jul 22 20:17:35 2005 by doxygen 1.3.3