| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /********************************************************************* | 
 | 2 |  *                 | 
 | 3 |  * Filename:      qos.h | 
 | 4 |  * Version:       1.0 | 
 | 5 |  * Description:   Quality of Service definitions | 
 | 6 |  * Status:        Experimental. | 
 | 7 |  * Author:        Dag Brattli <dagb@cs.uit.no> | 
 | 8 |  * Created at:    Fri Sep 19 23:21:09 1997 | 
 | 9 |  * Modified at:   Thu Dec  2 13:51:54 1999 | 
 | 10 |  * Modified by:   Dag Brattli <dagb@cs.uit.no> | 
 | 11 |  *  | 
 | 12 |  *     Copyright (c) 1999 Dag Brattli, All Rights Reserved. | 
 | 13 |  *      | 
 | 14 |  *     This program is free software; you can redistribute it and/or  | 
 | 15 |  *     modify it under the terms of the GNU General Public License as  | 
 | 16 |  *     published by the Free Software Foundation; either version 2 of  | 
 | 17 |  *     the License, or (at your option) any later version. | 
 | 18 |  *  | 
 | 19 |  *     This program is distributed in the hope that it will be useful, | 
 | 20 |  *     but WITHOUT ANY WARRANTY; without even the implied warranty of | 
 | 21 |  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 
 | 22 |  *     GNU General Public License for more details. | 
 | 23 |  *  | 
 | 24 |  *     You should have received a copy of the GNU General Public License  | 
 | 25 |  *     along with this program; if not, write to the Free Software  | 
 | 26 |  *     Foundation, Inc., 59 Temple Place, Suite 330, Boston,  | 
 | 27 |  *     MA 02111-1307 USA | 
 | 28 |  *      | 
 | 29 |  ********************************************************************/ | 
 | 30 |  | 
 | 31 | #ifndef IRDA_QOS_H | 
 | 32 | #define IRDA_QOS_H | 
 | 33 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | #include <linux/skbuff.h> | 
 | 35 |  | 
 | 36 | #include <net/irda/parameters.h> | 
 | 37 |  | 
 | 38 | #define PI_BAUD_RATE     0x01 | 
 | 39 | #define PI_MAX_TURN_TIME 0x82 | 
 | 40 | #define PI_DATA_SIZE     0x83 | 
 | 41 | #define PI_WINDOW_SIZE   0x84 | 
 | 42 | #define PI_ADD_BOFS      0x85 | 
 | 43 | #define PI_MIN_TURN_TIME 0x86 | 
 | 44 | #define PI_LINK_DISC     0x08 | 
 | 45 |  | 
 | 46 | #define IR_115200_MAX 0x3f | 
 | 47 |  | 
 | 48 | /* Baud rates (first byte) */ | 
 | 49 | #define IR_2400     0x01 | 
 | 50 | #define IR_9600     0x02 | 
 | 51 | #define IR_19200    0x04 | 
 | 52 | #define IR_38400    0x08 | 
 | 53 | #define IR_57600    0x10 | 
 | 54 | #define IR_115200   0x20 | 
 | 55 | #define IR_576000   0x40 | 
 | 56 | #define IR_1152000  0x80 | 
 | 57 |  | 
 | 58 | /* Baud rates (second byte) */ | 
 | 59 | #define IR_4000000  0x01 | 
 | 60 | #define IR_16000000 0x02 | 
 | 61 |  | 
 | 62 | /* Quality of Service information */ | 
 | 63 | typedef struct { | 
 | 64 | 	__u32 value; | 
 | 65 | 	__u16 bits; /* LSB is first byte, MSB is second byte */ | 
 | 66 | } qos_value_t; | 
 | 67 |  | 
 | 68 | struct qos_info { | 
 | 69 | 	magic_t magic; | 
 | 70 |  | 
 | 71 | 	qos_value_t baud_rate;       /* IR_11520O | ... */ | 
 | 72 | 	qos_value_t max_turn_time; | 
 | 73 | 	qos_value_t data_size; | 
 | 74 | 	qos_value_t window_size; | 
 | 75 | 	qos_value_t additional_bofs; | 
 | 76 | 	qos_value_t min_turn_time; | 
 | 77 | 	qos_value_t link_disc_time; | 
 | 78 | 	 | 
 | 79 | 	qos_value_t power; | 
 | 80 | }; | 
 | 81 |  | 
 | 82 | extern int sysctl_max_baud_rate; | 
 | 83 | extern int sysctl_max_inactive_time; | 
 | 84 |  | 
 | 85 | void irda_init_max_qos_capabilies(struct qos_info *qos); | 
 | 86 | void irda_qos_compute_intersection(struct qos_info *, struct qos_info *); | 
 | 87 |  | 
 | 88 | __u32 irlap_max_line_capacity(__u32 speed, __u32 max_turn_time); | 
 | 89 |  | 
 | 90 | void irda_qos_bits_to_value(struct qos_info *qos); | 
 | 91 |  | 
 | 92 | /* So simple, how could we not inline those two ? | 
 | 93 |  * Note : one byte is 10 bits if you include start and stop bits | 
 | 94 |  * Jean II */ | 
 | 95 | #define irlap_min_turn_time_in_bytes(speed, min_turn_time) (	\ | 
 | 96 | 	speed * min_turn_time / 10000000			\ | 
 | 97 | ) | 
 | 98 | #define irlap_xbofs_in_usec(speed, xbofs) (			\ | 
 | 99 | 	xbofs * 10000000 / speed				\ | 
 | 100 | ) | 
 | 101 |  | 
 | 102 | #endif | 
 | 103 |  |