pdcp.h
00001 #ifndef PDCP_H_
00002 #define PDCP_H_
00003 
00004 #include "types.h"
00005 
00006 #define MESSAGE_PRIORITY 9
00007 #define MESSAGE_MODE     8
00008 
00009 #define RESPCODE_FAILURE 0
00010 #define RESPCODE_SUCCESS 1
00011 
00012 /*
00013  * Naming convention
00014  * 1) Names are taken from the "Function Codes" section of the PDCP protocol spec.
00015  * 2) All names start with either "request_" or "respons_", or the uppercase equivalents.
00016  *    This is not valid English, but prefixes of equal length are beautyful.
00017  *    Prefixes are a poor man's namespace, and as opposed to suffixes, is a big-endian
00018  *    naming convention, which is both logical and beautyful.
00019  * 3) To keep names short, omit "device" and the request/response suffix.
00020  */
00021 
00022 enum{
00023         REQUEST_BIND                             = 0x01,
00024         RESPONS_BIND                             = 0x81,
00025         REQUEST_GET_INFO                         = 0x02,
00026         RESPONS_GET_INFO                         = 0x82,
00027         REQUEST_GET_PARAMETER                    = 0x03,
00028         RESPONS_GET_PARAMETER                    = 0x83,
00029         REQUEST_SET_PARAMETER                    = 0x04,
00030         RESPONS_SET_PARAMETER                    = 0x84,
00031         REQUEST_SUSPEND                          = 0x08,
00032         RESPONS_SUSPEND                          = 0x88,
00033         REQUEST_RELEASE                          = 0x09,
00034         RESPONS_RELEASE                          = 0x89,
00035         REQUEST_BEACON                           = 0x0A,
00036 //      RESPONS_BEACON                           = 0x8A, undefined
00037         REQUEST_RESET                            = 0x0B,
00038         RESPONS_RESET                            = 0x8B,
00039         REQUEST_CONFIGURE_GET_BULK_DATA_TRANSFER = 0x0C,
00040         RESPONS_CONFIGURE_GET_BULK_DATA_TRANSFER = 0x8C,
00041         REQUEST_CONFIGURE_SET_BULK_DATA_TRANSFER = 0x0D,
00042         RESPONS_CONFIGURE_SET_BULK_DATA_TRANSFER = 0x8D,
00043         REQUEST_BULK_DATA_TRANSFER               = 0x0E,
00044         RESPONS_BULK_DATA_TRANSFER               = 0x8E,
00045         REQUEST_UPDATE_DATA_CHANNEL              = 0x0F,
00046         RESPONS_UPDATE_DATA_CHANNEL              = 0x8F
00047 };
00048 
00049 /*
00050  * Multibyte fields are little endian, according to
00051  * "Function Code Implementation Examples" of the PDCP spec.
00052  */
00053 
00054 struct request_bind{
00055         u16 vendor_id;
00056         u16 product_id;
00057         u16 serial_number;
00058 };
00059 
00060 struct respons_bind{
00061         u8 node_id;
00062         u16 vendor_id;
00063         u16 product_id;
00064         u16 serial_number;
00065 };
00066 
00067 struct request_get_parameter{
00068         u8 parameter_id;
00069         u8 channel_index;
00070 };
00071 
00072 struct respons_get_parameter{
00073         u8 response_code;
00074         u8 parameter_id;
00075         u8 channel_index;
00076         u8 parameter_value[4];
00077 };
00078 
00079 struct request_set_parameter{
00080         u8 parameter_id;
00081         u8 channel_index;
00082         u8 parameter_value[4];
00083 };
00084 
00085 struct respons_set_parameter{
00086         u8 response_code;
00087         u8 parameter_id;
00088         u8 channel_index;
00089         u8 parameter_value[4];
00090 };
00091 
00092 struct request_suspend{
00093         u16 time_msec;
00094 };
00095 
00096 struct respons_suspend{
00097         u8 response_code;
00098         u16 time_msec;
00099 };
00100 
00101 struct request_release{};
00102 
00103 struct respons_release{
00104         u8 response_code;
00105 };
00106 
00107 struct request_beacon{};
00108 
00109 struct request_reset{};
00110 
00111 struct respons_reset{
00112         u8 response_code;
00113 };
00114 
00115 struct request_configure_get_bulk_data_transfer{
00116         u8 parameter_id;
00117         u8 channel_index;
00118 };
00119 
00120 struct respons_configure_get_bulk_data_transfer{
00121         u8 response_code;
00122         u8 parameter_id;
00123         u8 channel_index;
00124         u16 bulk_data_size;
00125 };
00126 
00127 struct request_configure_set_bulk_data_transfer{
00128         u8 parameter_id;
00129         u8 channel_index;
00130         u16 bulk_data_size;
00131 };
00132 
00133 struct respons_configure_set_bulk_data_transfer{
00134         u8 response_code;
00135         u8 parameter_id;
00136         u8 channel_index;
00137         u16 bulk_data_size;
00138 };
00139 
00140 struct request_bulk_data_transfer{
00141         u8 packet_id;
00142         u8 bulk_data[6];
00143 };
00144 
00145 struct respons_bulk_data_transfer{
00146         u8 response_code;
00147 };
00148 
00149 struct respons_update_data_channel{
00150         u8 channel_index;
00151 };
00152 
00153 struct request_update_data_channel{
00154         u8 response_code;
00155         u8 channel_index;
00156 };
00157 
00158 #endif
 All Classes Files Functions Enumerations Enumerator Defines