Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

include/lnp/sys/lnp.h File Reference

Internal LNP Interface: link networking protocol. More...

#include "../lnp.h"

Include dependency graph for lnp.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define LNP_HOSTMASK   CONF_LNP_HOSTMASK
 the LNP host mask (config.h)

#define LNP_PORTMASK   (0x00ff & ~CONF_LNP_HOSTMASK)
 LNP port mask is derived from host mask.

#define LNP_RCX_HEADER_LENGTH   (3-1)
 length of header from remote/rcx, -1 because first byte is used to id sequence

#define LNP_RCX_REMOTE_OP_LENGTH   (5-3)
 length of remote button op, -3 because first 3 bytes is used to id sequence

#define LNP_RCX_MSG_OP_LENGTH   (5-3)
 length of rcx message op, -3 because first 3 bytes is used to id sequence


Enumerations

enum  lnp_integrity_state_t {
  LNPwaitHeader, LNPwaitLength, LNPwaitData, LNPwaitCRC,
  LNPwaitRMH1, LNPwaitRMH2, LNPwaitRMH3, LNPwaitRMH4,
  LNPwaitRB0, LNPwaitRB0I, LNPwaitRB1, LNPwaitRB1I,
  LNPwaitRC, LNPwaitRCI, LNPwaitMH3, LNPwaitMH4,
  LNPwaitMN, LNPwaitMNC, LNPwaitMC, LNPwaitMCC
}
 states for the integrity layer state machine More...


Functions

unsigned char lnp_checksum_copy (unsigned char *dest, const unsigned char *data, unsigned length)
 the LNP `copy and compute checksum' function.

void lnp_integrity_byte (unsigned char b)
 receive a byte from the physical layer, decoding integrity layer packets.

void lnp_integrity_reset (void)
 reset the integrity layer on error or timeout.

int lnp_integrity_active (void)
 return whether a packet is currently being received

void lnp_timeout_reset (void)
 reset the inter-byte timeout counter.

void lnp_timeout_set (unsigned short timeout)
 set the inter-byte timeout and reset the timeout counter to that value.

void lnp_init (void)
 Initialise protocol handlers.


Variables

volatile unsigned short lnp_timeout_counter
 the timeout counter in ms

unsigned short lnp_timeout
 the timeout length in ms

lnp_integrity_state_t lnp_integrity_state
 the integrity layer state


Detailed Description

Internal LNP Interface: link networking protocol.

Author:
Markus L. Noga <markus@noga.de>

Definition in file lnp.h.


Define Documentation

#define LNP_HOSTMASK   CONF_LNP_HOSTMASK
 

the LNP host mask (config.h)

Definition at line 43 of file lnp.h.

#define LNP_PORTMASK   (0x00ff & ~CONF_LNP_HOSTMASK)
 

LNP port mask is derived from host mask.

Definition at line 46 of file lnp.h.

#define LNP_RCX_HEADER_LENGTH   (3-1)
 

length of header from remote/rcx, -1 because first byte is used to id sequence

Definition at line 50 of file lnp.h.

#define LNP_RCX_MSG_OP_LENGTH   (5-3)
 

length of rcx message op, -3 because first 3 bytes is used to id sequence

Definition at line 56 of file lnp.h.

#define LNP_RCX_REMOTE_OP_LENGTH   (5-3)
 

length of remote button op, -3 because first 3 bytes is used to id sequence

Definition at line 53 of file lnp.h.


Enumeration Type Documentation

enum lnp_integrity_state_t
 

states for the integrity layer state machine

Enumeration values:
LNPwaitHeader 
LNPwaitLength 
LNPwaitData 
LNPwaitCRC 
LNPwaitRMH1  states when waiting for rcx protocol message
LNPwaitRMH2 
LNPwaitRMH3 
LNPwaitRMH4 
LNPwaitRB0  states when waiting for remote buttons args
LNPwaitRB0I 
LNPwaitRB1 
LNPwaitRB1I 
LNPwaitRC 
LNPwaitRCI 
LNPwaitMH3  states when waiting for rcx message opcode
LNPwaitMH4 
LNPwaitMN 
LNPwaitMNC 
LNPwaitMC 
LNPwaitMCC 

Definition at line 60 of file lnp.h.


Function Documentation

unsigned char lnp_checksum_copy unsigned char *  dest,
const unsigned char *  data,
unsigned  length
 

the LNP `copy and compute checksum' function.

void lnp_init void   ) 
 

Initialise protocol handlers.

Adressing port 0 is reserved for the program handler. DLL transfers programs to this port.

int lnp_integrity_active void   )  [inline]
 

return whether a packet is currently being received

Returns:
1 if yes, else zero

Definition at line 140 of file lnp.h.

References lnp_integrity_state, and LNPwaitHeader.

void lnp_integrity_byte unsigned char  b  ) 
 

receive a byte from the physical layer, decoding integrity layer packets.

Parameters:
b the byte to receive

void lnp_integrity_reset void   ) 
 

reset the integrity layer on error or timeout.

void lnp_timeout_reset void   ) 
 

reset the inter-byte timeout counter.

void lnp_timeout_set unsigned short  timeout  )  [inline]
 

set the inter-byte timeout and reset the timeout counter to that value.

Parameters:
timeout the new timeout value

Definition at line 155 of file lnp.h.

References lnp_timeout, and lnp_timeout_counter.


Variable Documentation

lnp_integrity_state_t lnp_integrity_state
 

the integrity layer state

Definition at line 110 of file lnp.h.

Referenced by lnp_integrity_active().

unsigned short lnp_timeout
 

the timeout length in ms

Definition at line 107 of file lnp.h.

Referenced by lnp_timeout_set().

volatile unsigned short lnp_timeout_counter
 

the timeout counter in ms

Definition at line 104 of file lnp.h.

Referenced by lnp_timeout_set().


brickOS is released under the Mozilla Public License.
Original code copyright 1998-2002 by the authors.

Generated on Mon Feb 16 21:02:21 2004 for brickOS Kernel Developer by doxygen 1.3.5