Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

qos.h

Go to the documentation of this file.
00001 /*********************************************************************
00002  *                
00003  * Filename:      qos.h
00004  * Version:       1.0
00005  * Description:   Quality of Service definitions
00006  * Status:        Experimental.
00007  * Author:        Dag Brattli <dagb@cs.uit.no>
00008  * Created at:    Fri Sep 19 23:21:09 1997
00009  * Modified at:   Thu Dec  2 13:51:54 1999
00010  * Modified by:   Dag Brattli <dagb@cs.uit.no>
00011  * 
00012  *     Copyright (c) 1999 Dag Brattli, All Rights Reserved.
00013  *     
00014  *     This program is free software; you can redistribute it and/or 
00015  *     modify it under the terms of the GNU General Public License as 
00016  *     published by the Free Software Foundation; either version 2 of 
00017  *     the License, or (at your option) any later version.
00018  * 
00019  *     This program is distributed in the hope that it will be useful,
00020  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00022  *     GNU General Public License for more details.
00023  * 
00024  *     You should have received a copy of the GNU General Public License 
00025  *     along with this program; if not, write to the Free Software 
00026  *     Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
00027  *     MA 02111-1307 USA
00028  *     
00029  ********************************************************************/
00030 
00031 #ifndef IRDA_QOS_H
00032 #define IRDA_QOS_H
00033 
00034 #include <linux/config.h>
00035 #include <linux/skbuff.h>
00036 
00037 #include <net/irda/parameters.h>
00038 
00039 #define PI_BAUD_RATE     0x01
00040 #define PI_MAX_TURN_TIME 0x82
00041 #define PI_DATA_SIZE     0x83
00042 #define PI_WINDOW_SIZE   0x84
00043 #define PI_ADD_BOFS      0x85
00044 #define PI_MIN_TURN_TIME 0x86
00045 #define PI_LINK_DISC     0x08
00046 #define PI_COMPRESSION   0x07 /* Just a random pick */
00047 
00048 
00049 #define IR_115200_MAX 0x3f
00050 
00051 /* Baud rates (first byte) */
00052 #define IR_2400     0x01
00053 #define IR_9600     0x02
00054 #define IR_19200    0x04
00055 #define IR_38400    0x08
00056 #define IR_57600    0x10
00057 #define IR_115200   0x20
00058 #define IR_576000   0x40
00059 #define IR_1152000  0x80
00060 
00061 /* Baud rates (second byte) */
00062 #define IR_4000000  0x01
00063 #define IR_16000000 0x02
00064 
00065 /* Quality of Service information */
00066 typedef struct {
00067         __u32 value;
00068         __u16 bits; /* LSB is first byte, MSB is second byte */
00069 } qos_value_t;
00070 
00071 struct qos_info {
00072         magic_t magic;
00073 
00074         qos_value_t baud_rate;       /* IR_11520O | ... */
00075         qos_value_t max_turn_time;
00076         qos_value_t data_size;
00077         qos_value_t window_size;
00078         qos_value_t additional_bofs;
00079         qos_value_t min_turn_time;
00080         qos_value_t link_disc_time;
00081         
00082         qos_value_t power;
00083 #ifdef CONFIG_IRDA_COMPRESSION
00084         /* An experimental non IrDA field */
00085         qos_value_t compression;
00086 #endif
00087 };
00088 
00089 extern __u32 baud_rates[];
00090 extern __u32 data_sizes[];
00091 extern __u32 min_turn_times[];
00092 extern __u32 add_bofs[];
00093 extern __u32 compressions[];
00094 
00095 void irda_init_max_qos_capabilies(struct qos_info *qos);
00096 void irda_qos_compute_intersection(struct qos_info *, struct qos_info *);
00097 
00098 __u32 irlap_max_line_capacity(__u32 speed, __u32 max_turn_time);
00099 __u32 irlap_requested_line_capacity(struct qos_info *qos);
00100 __u32 irlap_min_turn_time_in_bytes(__u32 speed, __u32 min_turn_time);
00101 
00102 int msb_index(__u16 byte);
00103 int value_index(__u32 value, __u32 *array);
00104 __u32 byte_value(__u8 byte, __u32 *array);
00105 __u32 index_value(int index, __u32 *array);
00106 
00107 void irda_qos_bits_to_value(struct qos_info *qos);
00108 
00109 #endif
00110 
00111 
00112 
00113 
00114