00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef IRDA_PARAMS_H
00032 #define IRDA_PARAMS_H
00033
00034
00035
00036
00037
00038 typedef enum {
00039 PV_INTEGER,
00040 PV_INT_8_BITS,
00041 PV_INT_16_BITS,
00042 PV_STRING,
00043 PV_INT_32_BITS,
00044 PV_OCT_SEQ,
00045 PV_NO_VALUE
00046 } PV_TYPE;
00047
00048
00049 #define PV_BIG_ENDIAN 0x80
00050 #define PV_LITTLE_ENDIAN 0x00
00051 #define PV_MASK 0x7f
00052
00053 #define PV_PUT 0
00054 #define PV_GET 1
00055
00056 typedef union {
00057 char *c;
00058 __u8 b;
00059 __u16 s;
00060 __u32 i;
00061 __u8 *bp;
00062 __u16 *sp;
00063 __u32 *ip;
00064 } irda_pv_t;
00065
00066 typedef struct {
00067 __u8 pi;
00068 __u8 pl;
00069 irda_pv_t pv;
00070 } irda_param_t;
00071
00072 typedef int (*PI_HANDLER)(void *self, irda_param_t *param, int get);
00073 typedef int (*PV_HANDLER)(void *self, __u8 *buf, int len, __u8 pi,
00074 PV_TYPE type, PI_HANDLER func);
00075
00076 typedef struct {
00077 PI_HANDLER func;
00078 PV_TYPE type;
00079 } pi_minor_info_t;
00080
00081 typedef struct {
00082 pi_minor_info_t *pi_minor_call_table;
00083 int len;
00084 } pi_major_info_t;
00085
00086 typedef struct {
00087 pi_major_info_t *tables;
00088 int len;
00089 __u8 pi_mask;
00090 int pi_major_offset;
00091 } pi_param_info_t;
00092
00093 int irda_param_pack(__u8 *buf, char *fmt, ...);
00094 int irda_param_unpack(__u8 *buf, char *fmt, ...);
00095
00096 int irda_param_insert(void *self, __u8 pi, __u8 *buf, int len,
00097 pi_param_info_t *info);
00098 int irda_param_extract(void *self, __u8 *buf, int len, pi_param_info_t *info);
00099 int irda_param_extract_all(void *self, __u8 *buf, int len,
00100 pi_param_info_t *info);
00101
00102 #define irda_param_insert_byte(buf,pi,pv) irda_param_pack(buf,"bbb",pi,1,pv)
00103
00104 #endif
00105