fs.c File Reference

File System. More...

#include "app.h"
Include dependency graph for fs.c:

Go to the source code of this file.

Functions

void FS_FlashTest (void)
 
void FS_WaitReady (void)
 
void FS_Check (void)
 
BYTE FS_Init (void)
 
void FS_SetBoot (WORD Offset, BYTE *data, BYTE size)
 
void FS_GetBoot (WORD Offset, BYTE *data, BYTE size)
 
void FS_Format (void)
 
BYTE FS_Open (BYTE file)
 
BYTE FS_Close (BYTE file)
 
void FS_Length (BYTE file, WORD *p)
 
void FS_ZapRegis (void)
 
BYTE FS_AppendRegis (REGIS *data)
 
BYTE FS_ReadRegis (REGIS *data)
 
BYTE FS_AppendUnit (UNIT *data)
 
BYTE FS_WriteUnit (UNIT *data)
 
BYTE FS_ReadUnit (UNIT *data)
 

Variables

bank3 WORD gRcp
 
bank3 WORD gRnor
 
bank3 WORD gRcb
 
bank3 WORD gUcp
 
bank3 WORD gUnor
 
bank3 WORD gUcb
 
bank3 WORD gPA =0x0000
 Stored value in flash. More...
 
bank3 WORD gPC =0x0000
 temporal More...
 

Detailed Description

File System.

This file is part of JADEKU Portable ADQ device for Routines Control.

Copyright (C) 2006-2009, Hernan Monserrat hemonserrat<at>gmail<dot>com

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file fs.c.

Function Documentation

◆ FS_AppendRegis()

BYTE FS_AppendRegis ( REGIS data)

Append data to the REGIS stream.

Parameters
data- buffer to extract data.
Returns
FSOK, FSEOF

Definition at line 324 of file fs.c.

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

◆ FS_AppendUnit()

BYTE FS_AppendUnit ( UNIT data)

Append data to the UNIT stream.

Parameters
data- buffer to extract data.
Returns
FSOK, FSEOF

Definition at line 392 of file fs.c.

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

◆ FS_Check()

void FS_Check ( void  )

Periodic function to check and health the file system structure.

Remarks
Use algorithm 2 from Serial data flash devices.

Definition at line 54 of file fs.c.

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

◆ FS_Close()

BYTE FS_Close ( BYTE  file)

Close the given stream.

Parameters
file- stream descriptor pointer.
Returns
FSOK FSNOTFOUND

Definition at line 228 of file fs.c.

Here is the caller graph for this function:

◆ FS_FlashTest()

void FS_FlashTest ( void  )

◆ FS_Format()

void FS_Format ( void  )

Initialize and formats the storage device

Parameters
nops- Number of pages for files.

Definition at line 143 of file fs.c.

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

◆ FS_GetBoot()

void FS_GetBoot ( WORD  Offset,
BYTE data,
BYTE  size 
)

Get boot sector information

Parameters
Offset- from buffer
data- buffer to store data
size- number of bytes to read
Remarks
Use Buffer 1 to mirror.

Definition at line 132 of file fs.c.

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

◆ FS_Init()

BYTE FS_Init ( void  )

Initialize file system

Returns
FSOK
FSNOCHIP
Remarks
if no valid boot sector found then formats

Definition at line 72 of file fs.c.

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

◆ FS_Length()

void FS_Length ( BYTE  file,
WORD p 
)

Return the number of records in the stream

Parameters
file- stream descriptor pointer.
p- pointer to a word

Definition at line 246 of file fs.c.

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

◆ FS_Open()

BYTE FS_Open ( BYTE  file)

Open a file stream

Parameters
file- stream descriptor pointer.
Returns
FSOK

Definition at line 204 of file fs.c.

Here is the caller graph for this function:

◆ FS_ReadRegis()

BYTE FS_ReadRegis ( REGIS data)

Read a number of bytes from the REGIS stream

Parameters
data- buffer to store data.
Returns
FSOK FSEOF

Definition at line 364 of file fs.c.

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

◆ FS_ReadUnit()

BYTE FS_ReadUnit ( UNIT data)

Read a number of bytes from the UNIT stream

Parameters
data- buffer to store data.
Returns
FSOK FSEOF

Definition at line 454 of file fs.c.

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

◆ FS_SetBoot()

void FS_SetBoot ( WORD  Offset,
BYTE data,
BYTE  size 
)

Sets boot sector information

Parameters
Offset- from buffer
data- buffer to extract data
size- number of bytes to write
Remarks
Use buffer 1 to mirror.

Definition at line 107 of file fs.c.

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

◆ FS_WaitReady()

void FS_WaitReady ( void  )

POLL Flash status device to see if ready

Remarks
Need to implement a timeout, now if fails, blocks for ever.

Definition at line 42 of file fs.c.

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

◆ FS_WriteUnit()

BYTE FS_WriteUnit ( UNIT data)

Write data to the UNIT stream.

Parameters
data- buffer to extract data.
Returns
FSOK, FSEOF

Definition at line 428 of file fs.c.

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

◆ FS_ZapRegis()

void FS_ZapRegis ( void  )

Deletes records on REGIS stream

Definition at line 295 of file fs.c.

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

Variable Documentation

◆ gPA

bank3 WORD gPA =0x0000

Stored value in flash.

Definition at line 35 of file fs.c.

◆ gPC

bank3 WORD gPC =0x0000

temporal

Definition at line 36 of file fs.c.

◆ gRcb

bank3 WORD gRcb

Definition at line 27 of file fs.c.

◆ gRcp

bank3 WORD gRcp

Definition at line 25 of file fs.c.

◆ gRnor

bank3 WORD gRnor

Definition at line 26 of file fs.c.

◆ gUcb

bank3 WORD gUcb

Definition at line 30 of file fs.c.

◆ gUcp

bank3 WORD gUcp

Definition at line 28 of file fs.c.

◆ gUnor

bank3 WORD gUnor

Definition at line 29 of file fs.c.