GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > FBS / V0-2-1
Constituent: fbs_rtos     Tag: sun-gcc
#include <stdio.h>
#include <sys/types.h>
Include dependency graph for FBS_pubrtos.h:
This graph shows which files directly or indirectly include this file:
Data Structures | |
struct | _SIB_Info |
Contains address and size information about the various SIB board memory and register regions. More... | |
File Device Definitions | |
#define | FILE_DEV_NAME_BOOT "/boot" |
The name of the boot file device. | |
#define | FILE_DEV_NAME_RAM "/ram" |
The name of the RAM disk file device. | |
#define | FILE_DEV_NAME_EE0 "/ee0" |
The name of the TFFS/EEPROM file device 0. | |
#define | FILE_DEV_NAME_EE1 "/ee1" |
The name of the TFFS/EEPROM file device 1. | |
#define | FILE_DEV_NAME_TMP "/tmp" |
The name of the temp file device. | |
#define | FILE_DEV_NUM_BOOT (0) |
The device number of the boot file device. | |
#define | FILE_DEV_NUM_RAM (1) |
The device number of the RAM disk file device. | |
#define | FILE_DEV_NUM_EE0 (2) |
The device number of the TFFS/EEPROM file device 0. | |
#define | FILE_DEV_NUM_EE1 (3) |
The device number of the TFFS/EEPROM file device 1. | |
#define | FILE_DEV_NUM_TMP (4) |
The device number of the temp file device. | |
#define | FILE_DEV_NUM_USR0 (5) |
The devive number of the user file device 0. | |
#define | FILE_DEV_NUM_USR1 (6) |
The devive number of the user file device 1. | |
File ID Utility Macros | |
#define | FILE_ID_M_DEV (0xe0000000) |
The file ID device number bitmask. | |
#define | FILE_ID_M_DIR (0x1fc00000) |
The file ID directory number bitmask. | |
#define | FILE_ID_M_FILE (0x003fffff) |
The file ID file number bitmask. | |
#define | FILE_ID_S_DEV (29) |
The file ID device number shift count. | |
#define | FILE_ID_S_DIR (22) |
The file ID directory number shift count. | |
#define | FILE_ID_S_FILE (0) |
The file ID file number shift count. | |
#define | FILE_ID_TO_NUM(_id, _dev, _dir, _file) |
Translates a file ID word into component numbers. | |
#define | FILE_NUM_TO_ID(_id, _dev, _dir, _file) |
Translates file component numbers to an ID word. | |
File Path Utility Macros | |
#define | FILE_PATH_STR_SIZE (24) |
The number of bytes needed to hold a system file path string. | |
#define | FILE_PATH_STR_SIZE_USR (256) |
The number of bytes needed to hold a user-defined file path string. | |
#define | FILE_ID_TO_PATH(_str, _dev, _dir, _file) |
Translates file component numbers to an ASCII path name. | |
File Manipulation Functions | |
int | FILE_close (int fd) |
Close a FSW file (regular, headed/not-headed, compressed/not-compressed). | |
unsigned int | FILE_decodePrimary (unsigned char *buf, unsigned int len, unsigned int *ver, unsigned int *cmp, unsigned short *typ, unsigned int *key, unsigned int *fcs) |
Assuming buf points to a file header, decode it. | |
unsigned int | FILE_getCompression (int fd) |
Get the compression flag associated with the file descriptor. | |
unsigned int | FILE_getKey (int fd) |
Get the value of the key associated with the file descriptor. | |
int | FILE_getName (int fd, char *nam, unsigned int len) |
Get the original file name associated with the file descriptor. | |
unsigned int | FILE_getSize (int fd) |
Get the file header size associated with the file descriptor. | |
unsigned short | FILE_getType (int fd) |
Get the value of the type associated with the file descriptor. | |
unsigned int | FILE_getVersion (int fd) |
Get the file header version associated with the file descriptor. | |
unsigned int | FILE_hdrCreate (void *buf, unsigned int length, unsigned int time, unsigned int chksum, unsigned short type, unsigned int key, FILE_Hdr_Compression_Flag compress, const char *name) |
Create a new file header. | |
unsigned int | FILE_hdrGetChksum (const void *buf, unsigned int *chksum) |
Get the file checksum. | |
unsigned int | FILE_hdrGetCompression (const void *buf, unsigned short *compress) |
Get the file compression flag. | |
unsigned int | FILE_hdrGetKey (const void *buf, unsigned int *key) |
Get the file key. | |
unsigned int | FILE_hdrGetLength (const void *buf, unsigned int *length) |
Get the file data size. | |
unsigned int | FILE_hdrGetName (const void *buf, char *name) |
Get the file name string. | |
unsigned int | FILE_hdrGetTime (const void *buf, unsigned int *time) |
Get the file timestamp. | |
unsigned int | FILE_hdrGetType (const void *buf, unsigned short *type) |
Get the file type. | |
unsigned int | FILE_hdrSizeof (void) |
Get the size of a file header. | |
unsigned int | FILE_hdrVerify (const void *buf) |
Verify the integrety of a file header. | |
int | FILE_open (const char *fil, int flg, mode_t mod) |
Open a FSW file (regular, headed/not-headed, compressed/not-compressed). | |
Module Loading Functions | |
unsigned int | FILE_loadModuleByID (unsigned int id, int sym, void **mod) |
Load a FSW code module by file ID. | |
unsigned int | FILE_loadModuleByName (const char *nam, int sym, void **mod) |
Load a FSW code module by file name. | |
unsigned int | FILE_loadModuleSecondary (unsigned int id, int sym, void **mod, unsigned int *dat) |
Load a FSW code module by file ID (special for secondary boot). | |
File ID, Name and Path Manipulation Functions | |
unsigned int | FILE_pathInit (const char *usrName5, const char *usrName6) |
Initialize the file path mapping library. | |
unsigned int | FILE_pathSizeof (void) |
Get the size of a file path string. | |
unsigned int | FILE_pathIdToNum (unsigned int id, unsigned int *dev, unsigned int *dir, unsigned int *file) |
Translates a file ID word into component numbers. | |
unsigned int | FILE_pathNumToId (unsigned int *id, unsigned int dev, unsigned int dir, unsigned int file) |
Translates file component numbers to an ID word. | |
unsigned int | FILE_pathIdToPath (unsigned int id, char *str) |
Translates file ID word to an ASCII path name. | |
unsigned int | FILE_pathPathToId (const char *nam) |
Convert a file name to a file ID (if possible). | |
TFFS and RAM Disk Functions | |
unsigned int | FILE_sysRamCreate (void *addr, int size) |
unsigned int | FILE_sysTffsMount (int drv) |
unsigned int | FILE_sysTffsFormat (int drv, unsigned int offset) |
unsigned int | FILE_sysTffsCheck (int drv) |
unsigned int | FILE_sysTffsRepair (int drv) |
Defines | |
#define | FILE_HDR_NAME_SIZE (8) |
The size in bytes of the file name contained in a file header. | |
#define | FILE_M_MODULE ( 0x02000000 ) |
Module number in the errno sense. | |
#define | FILE_S_SUCCESS ( FILE_M_MODULE | 0x0000 ) |
File opened successfully (not a read-only request). | |
#define | FILE_S_NOHED ( FILE_M_MODULE | 0x0004 ) |
File opened successfully (no FSW header found). | |
#define | FILE_S_HEDNOCMP ( FILE_M_MODULE | 0x0008 ) |
File opened successfully (FSW header found, file not compressed). | |
#define | FILE_S_HEDCMP ( FILE_M_MODULE | 0x000c ) |
File opened successfully (FSW header found, file compressed). | |
#define | FILE_E_CORRUPT ( FILE_M_MODULE | 0x0003 ) |
File open failed (the adler32 checksum of the body failed). | |
#define | FILE_E_NOMKDIR ( FILE_M_MODULE | 0x0007 ) |
File open failed (could not create directory for temporary file). | |
#define | FILE_E_NOSLOT ( FILE_M_MODULE | 0x000b ) |
File open failed (no more slots to store temporary file info). | |
#define | FILE_E_NOTMPOPN ( FILE_M_MODULE | 0x000f ) |
File open failed (could not open temporary file). | |
#define | FILE_E_NOINFLAT ( FILE_M_MODULE | 0x0013 ) |
File open failed (inflation step failed). | |
#define | FILE_E_NOREOPEN ( FILE_M_MODULE | 0x0017 ) |
File open failed (could not reopen temporary file read-only). | |
Typedefs | |
typedef enum _FILE_Hdr_Version | FILE_Hdr_Version |
Typedef for enum _FILE_Hdr_Version. | |
typedef enum _FILE_Hdr_Compression_Flag | FILE_Hdr_Compression_Flag |
Typedef for enum _FILE_Hdr_Compression_Flag. | |
typedef _SIB_Info | SIB_Info |
Typedef for struct _SIB_Info. | |
Enumerations | |
enum | _FILE_Hdr_Version { FILE_HDR_VERSION_1 = 0x2000, FILE_HDR_VERSION_2 = 0x4000 } |
The file header version enumeration. Tracks format changes. More... | |
enum | _FILE_Hdr_Compression_Flag { FILE_HDR_UNCOMPRESSED = 0x0000, FILE_HDR_COMPRESSED = 0x1000 } |
The file header compression flag values. More... |
CVS $Id: FBS_pubrtos.h,v 1.3 2005/11/09 22:48:08 apw Exp $
|
Value: { \ *(_dev) = (((_id) & FILE_ID_M_DEV ) >> FILE_ID_S_DEV ); \ *(_dir) = (((_id) & FILE_ID_M_DIR ) >> FILE_ID_S_DIR ); \ *(_file) = (((_id) & FILE_ID_M_FILE) >> FILE_ID_S_FILE); \ }
|
|
Value: snprintf((_str), FILE_PATH_STR_SIZE, "%s/d%03u/f%07u", \ (_dev), (_dir), (_file));
|
|
Value: { \ *(_id) = (((_dev) << FILE_ID_S_DEV ) & FILE_ID_M_DEV ); \ *(_id) |= (((_dir) << FILE_ID_S_DIR ) & FILE_ID_M_DIR ); \ *(_id) |= (((_file) << FILE_ID_S_FILE) & FILE_ID_M_FILE); \ }
|
|
The file header compression flag values.
|
|
The file header version enumeration. Tracks format changes.
|
|
Close a FSW file (regular, headed/not-headed, compressed/not-compressed).
|
|
Assuming buf points to a file header, decode it.
|
|
Get the compression flag associated with the file descriptor.
If these conditions are not met, the guard value 0 is returned. Note that this is the compression bit from the original file open. If the original file is compressed, FILE_open() automatically runs a decompression step and points the caller to a decompressed version of the file. |
|
Get the value of the key associated with the file descriptor.
If these conditions are not met, the guard value 0xffffffff is returned. |
|
Get the original file name associated with the file descriptor.
If these conditions are not met, the guard value -1 is returned. Assuming the above conditions are met, this routine will always return a zero terminated string in nam, even if nam is not sufficiently long to accomodate the full name. To check for this case, the caller should compare the string length of nam against the true name length, which is returned by this function. |
|
Get the file header size associated with the file descriptor.
If these conditions are not met, the guard value 0 is returned. Note that the size returned is literally the number stored in the file header, and does not include the four bytes at the start of the header used to store the file header checksum. |
|
Get the value of the type associated with the file descriptor.
If these conditions are not met, the guard value 0xffff is returned. |
|
Get the file header version associated with the file descriptor.
If these conditions are not met, the guard value 0 is returned. |
|
Create a new file header.
|
|
Get the file checksum.
|
|
Get the file compression flag.
|
|
Get the file key.
|
|
Get the file data size.
|
|
Get the file name string.
|
|
Get the file timestamp.
|
|
Get the file type.
|
|
Get the size of a file header.
|
|
Verify the integrety of a file header.
|
|
Load a FSW code module by file ID.
|
|
Load a FSW code module by file name.
|
|
Load a FSW code module by file ID (special for secondary boot).
|
|
Open a FSW file (regular, headed/not-headed, compressed/not-compressed).
Flight software files appear in three different formats:
When FILE_open() is asked to open any of these formats, it will first inspect the file to classify it. The adler32 checksum in the header is very powerful here. Subsequent processing depends on the file format:
In keeping with the idea that FILE_open() is modeled on open(), the errno method is used to return extra information. One unusual feature of this is that errno can contain helpful information, even when the file open is successful. If the return value is not -1 (i.e. the open succeeded), errno can contain:
If the return value is -1 (i.e. the open failed), errno, in addition to any of the regular values that open() can return, can contain:
If you wish to use these values for additional checking, note that errno is a four byte word encoded as two two-byte units. The most significant unit is a module number and the lower unit is the "error" number. The additional error codes defined by FILE_open() are module 0x200 (to avoid collisions with unix and VxWorks error codes), and the error numbers obey MSG conventions, i.e. if the least significant bit is clear, the operation was a success. |
|
Translates a file ID word into component numbers.
|
|
Translates file ID word to an ASCII path name.
|
|
Initialize the file path mapping library.
|
|
Translates file component numbers to an ID word.
|
|
Convert a file name to a file ID (if possible).
|
|
Get the size of a file path string.
|
|
Creates, formats, and mounts a RAM disk partition.
|
|
Runs the DOSFS chkdsk utility on the requested TFFS partition. Only the status is checked; no repairs to the partition file system are attempted.
|
|
Formats a TFFS file system for a raw TFFS non-volatile memory bank. Both the TFFS/FTL layer and the DOSFS layer are written to the media. The offset parameter allows a portion of a media memory bank to be used by boot software.
|
|
Mounts a TFFS/DOSFS filesytem for use. The non-volatile memory bank must have previously been formatted with both the TFFS and DOSFS layers.
|
|
Runs the DOSFS chkdsk utility on the requested TFFS partition. If an error is found by the utility, repairs to the partition file system are attempted.
|