Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

link.h File Reference

Link layer include file. More...

#include <inttypes.h>
#include "net/buffers.h"

Go to the source code of this file.

Data Structures

struct  lnk_err_t
 Link layer error statistics. More...


Functions

void lnk_init (void)
 Perform initialization of link layer.

void lnk_process (void)
 Process link layer specific tasks.

int8_t lnk_requ (net_buf_t *buf, uint8_t backlog)
 Schedule a packet for sending.

uint8_t lnk_clear_to_send (void)
 Check if link layer is able to process further packets.

void lnk_get_error_stats (struct lnk_err_t *buf)
 Fill a buffer with link layer error statistics.


Detailed Description

Link layer include file.

This module implements the link layer of the OpenHome protocol stack. Include it in your main module and call lnk_init() for initialization. Also call lnk_process() directly from your main loop. Check net.h for static configuration parameters.

Note:
You may have a look at link.c for a description of implementation specific details especially about harware usage!

Definition in file link.h.


Function Documentation

uint8_t lnk_clear_to_send void   ) 
 

Check if link layer is able to process further packets.

Returns:
Returns a nonzero value if the link layer is ready to process the next packet.

Definition at line 426 of file link.c.

References SEND_STAT_IDLE, and send_info_t::status.

Referenced by net_clear_to_send(), and net_requ().

void lnk_get_error_stats struct lnk_err_t buf  ) 
 

Fill a buffer with link layer error statistics.

Parameters:
buf A pointer to a structure receiving the error statistics.

Definition at line 436 of file link.c.

void lnk_init void   ) 
 

Perform initialization of link layer.

This function must be called before any other network functions are called.

Definition at line 289 of file link.c.

References receive_info_t::crc16, send_info_t::slot, and receive_info_t::slots.

void lnk_process void   ) 
 

Process link layer specific tasks.

Call this function as often as possible from your main loop. It processes link layer specific tasks such as passing received packets to upper layers and scheduling send requests.

Attention:
Must not be called from a interrupt routine. The implementation is not thread-save.

Definition at line 317 of file link.c.

References send_info_t::backlog, send_info_t::backlog_add, receive_info_t::buf, receive_info_t::crc16, lnk_con(), lnk_ind(), receive_info_t::pos, RECV_STAT_EXAMINE, RECV_STAT_FREE, lnk_err_t::rx_crc, lnk_err_t::rx_len, SEND_STAT_IDLE, SEND_STAT_INFORM, SEND_STAT_WAIT, send_info_t::slot, receive_info_t::slots, receive_info_t::status, and send_info_t::status.

int8_t lnk_requ net_buf_t *  buf,
uint8_t  backlog
 

Schedule a packet for sending.

This function returns without waiting for the packet to be sent. If the packet is fully transmitted then lnk_con is called.

Parameters:
buf A network buffer containing the data to be sent. Must not be released until lnk_con() is called.
backlog Link layer backlog field. See OpenHome.doc for a detailed discussion of this field.
Returns:
Zero if a transmission is already in progress and the packet could not be processed. Otherwise it returns a nonzero value.

Definition at line 383 of file link.c.

References send_info_t::backlog_add, send_info_t::data, POLY_CRC16, SEND_STAT_IDLE, SEND_STAT_WAIT, send_info_t::slot, and send_info_t::status.

Referenced by net_requ().


Generated on Fri Oct 17 16:45:54 2003 for OpenHome by doxygen 1.3.3