RCOM PROJ
File transfer via serial port
|
Data Structures | |
struct | stateMachineParams |
List of Parameters to Personalize the State Machine. More... | |
Enumerations | |
enum | stateMachineType { Supervision, Write, Read } |
enum | stateMachineState { Start, FLAG_RCV, A_RCV, C_RCV, BCC_OK, DONE } |
Functions | |
void | stateMachineSetUp (unsigned char control, unsigned char address, enum stateMachineState state, enum stateMachineType type) |
Function to easily change the State Machine. More... | |
int | stateMachine (unsigned char byte, unsigned char **buf, int *size) |
The StateMachine function that processes a byte and updates it's state. More... | |
int | processStart (unsigned char byte) |
Function to process a byte in case the state is Start. More... | |
int | processFLAG_RCV (unsigned char byte) |
Function to process a byte in case the state is FLAG_RCV. More... | |
int | processA_RCV (unsigned char byte) |
Function to process a byte in case the state is A_RCV. More... | |
int | processC_RCV (unsigned char byte) |
Function to process a byte in case the state is C_RCV. More... | |
int | processBCC_OK (unsigned char byte, unsigned char **buffer, int *buffersize) |
Function to process a byte in case the state is BCC_OK. More... | |
Variables | |
static unsigned | checkBuffer [2] |
static int | frameIndex |
static int | wrongC |
struct stateMachineParams | state_machine |
enum stateMachineState |
enum stateMachineType |
int processA_RCV | ( | unsigned char | byte | ) |
Function to process a byte in case the state is A_RCV.
byte | byte to be processed |
References C_I, C_RCV, C_REJ, checkBuffer, stateMachineParams::control, FLAG, FLAG_RCV, frameIndex, log_caution(), log_error(), Read, linkLayer::sequenceNumber, Start, stateMachineParams::state, state_machine, Supervision, TRUE, stateMachineParams::type, Write, and wrongC.
Referenced by stateMachine().
int processBCC_OK | ( | unsigned char | byte, |
unsigned char ** | buffer, | ||
int * | buffersize | ||
) |
Function to process a byte in case the state is BCC_OK.
byte | byte to be processed |
buffer | buffer to put data if stateMachineType is Read |
buffersize | variable to keeo size of buf if stateMachineType is Read |
References DONE, FLAG, linkLayer::frame, frameIndex, generateErrorBCC2(), log_error(), PROBABILITY_BCC2, Read, linkLayer::sequenceNumber, Start, stateMachineParams::state, state_machine, Supervision, T_PROP_DELAY, stateMachineParams::type, and Write.
Referenced by stateMachine().
int processC_RCV | ( | unsigned char | byte | ) |
Function to process a byte in case the state is C_RCV.
byte | byte to be processed |
References BCC, BCC_OK, checkBuffer, FLAG, FLAG_RCV, frameIndex, generateErrorBCC1(), log_caution(), log_error(), PROBABILITY_BCC1, Read, Start, stateMachineParams::state, state_machine, Supervision, TRUE, stateMachineParams::type, Write, and wrongC.
Referenced by stateMachine().
int processFLAG_RCV | ( | unsigned char | byte | ) |
Function to process a byte in case the state is FLAG_RCV.
byte | byte to be processed |
References A_RCV, stateMachineParams::address, checkBuffer, FLAG, frameIndex, Read, Start, stateMachineParams::state, state_machine, and stateMachineParams::type.
Referenced by stateMachine().
int processStart | ( | unsigned char | byte | ) |
Function to process a byte in case the state is Start.
byte | byte to be processed |
References FALSE, FLAG, FLAG_RCV, frameIndex, Read, stateMachineParams::state, state_machine, stateMachineParams::type, and wrongC.
Referenced by stateMachine().
int stateMachine | ( | unsigned char | byte, |
unsigned char ** | buf, | ||
int * | size | ||
) |
The StateMachine function that processes a byte and updates it's state.
byte | byte to process |
buf | buffer to put data if stateMachineType is Read |
size | variable to keeo size of buf if stateMachineType is Read |
References A_RCV, BCC_OK, C_RCV, DONE, FLAG_RCV, linkLayer::frame, frameIndex, log_error(), processA_RCV(), processBCC_OK(), processC_RCV(), processFLAG_RCV(), processStart(), Read, Start, stateMachineParams::state, state_machine, and stateMachineParams::type.
Referenced by readingCycle(), and writeCycle().
void stateMachineSetUp | ( | unsigned char | control, |
unsigned char | address, | ||
enum stateMachineState | state, | ||
enum stateMachineType | type | ||
) |
Function to easily change the State Machine.
control | Control Byte that is suppossed to be received |
address | Address Byte that is suppossed to be received |
state | State of the State Machine |
type | Type of State Machine |
References stateMachineParams::address, stateMachineParams::control, stateMachineParams::state, state_machine, and stateMachineParams::type.
Referenced by llread(), llwrite(), receiver_DISC_UA(), receiver_UA(), transmitter_DISC_UA(), and transmitter_SET().
|
static |
Referenced by generateErrorBCC1(), processA_RCV(), processC_RCV(), and processFLAG_RCV().
|
static |
Referenced by processA_RCV(), processBCC_OK(), processC_RCV(), processFLAG_RCV(), processStart(), and stateMachine().
struct stateMachineParams state_machine |
Referenced by atende(), processA_RCV(), processBCC_OK(), processC_RCV(), processFLAG_RCV(), processStart(), readingCycle(), stateMachine(), stateMachineSetUp(), and writeCycle().
|
static |
Referenced by processA_RCV(), processC_RCV(), and processStart().