Main Page | Modules | Data Structures | File List | Data Fields

Ab protocol internals


Data Structures

struct  message_struct
 Structure used to store incoming and outgoing messages. More...

struct  site_struct
 Structure used to store other communicating sites. More...


Defines

#define flip_sb(rs)   rs^=0x1

Typedefs

typedef message_struct msg_s
 Structure used to store incoming and outgoing messages.

typedef site_struct site_s
 Structure used to store other communicating sites.


Functions

void erase (site_s *site)
 Erases the first message for a given site.

msg_snew_msg (const unsigned char *header, const unsigned char *msg, unsigned char length)
 Creates a new message.

site_snew_site (unsigned char id)
 Creates a new site.

void add (site_s *site, msg_s *m)
site_ssearch_and_add (unsigned char id)
 Searches for a site with a given id, and creates one if not found.

void AB_portHandler (const unsigned char *message, unsigned char length)
 This is the ISR for the infrared.

int thread_AB_I ()
 Thread handling incoming messages.

int thread_AB_O ()
 Thread handling outgoing messages.


Variables

sem_t sem_ab_write
 Semaphores for mutual exclusion and producer/consumer.

sem_t sem_ab_portHandler
 Semaphores for mutual exclusion and producer/consumer.

sem_t sem_todo_i
 Semaphores for mutual exclusion and producer/consumer.

sem_t sem_todo_o
 Semaphores for mutual exclusion and producer/consumer.

site_ss_head
 list of current messages to (re)send

msg_sm_head
 list of received messages

msg_sm_tail
 list of received messages

unsigned char _id
 Current site's id.

void(* user_portHandler_8 )(const unsigned char *buf, unsigned char len)

Detailed Description

Internal function for the AB protocol

Define Documentation

#define flip_sb rs   )     rs^=0x1
 

AB PROTOCOL *

Definition at line 97 of file ab.c.


Function Documentation

void AB_portHandler const unsigned char *  message,
unsigned char  length
[static]
 

This is the ISR for the infrared.

Incoming messages are put into the linked list pointed to by m_head, and will be treated by one of the protocol's threads

Definition at line 196 of file ab.c.

void add site_s site,
msg_s m
[static]
 

Adds a message to the outgoing messages to a certain site

Parameters:
site The destination site
m The message

Definition at line 162 of file ab.c.

void erase site_s site  )  [static]
 

Erases the first message for a given site.

Parameters:
site The site

Definition at line 107 of file ab.c.

msg_s* new_msg const unsigned char *  header,
const unsigned char *  msg,
unsigned char  length
[static]
 

Creates a new message.

Parameters:
header The header for the new message see definitions of MSG_xxxx
msg The message
length The length of msg control on memory allocation
Returns:
a new message, or NULL if memory was not available and wait is false

Definition at line 123 of file ab.c.

site_s* new_site unsigned char  id  )  [static]
 

Creates a new site.

Parameters:
id The new site's id
Returns:
a fresh site_s or NULL if no more memory available

Definition at line 147 of file ab.c.

site_s* search_and_add unsigned char  id  )  [static]
 

Searches for a site with a given id, and creates one if not found.

Parameters:
id The id to look for
Returns:
The site with the given id, NULL if not found and no more available memory

Definition at line 178 of file ab.c.


Variable Documentation

void(* user_portHandler_8)(const unsigned char *buf, unsigned char len)
 

Pointer to the user's porthandler (for incoming messages, dispatched to the user) Limited to 256-DEFAULT_HEADER_SIZE characters

Definition at line 56 of file ab.c.


Generated on Sat Mar 12 16:12:58 2005 for Alternating Bit by doxygen 1.3.3