spc2_struct.h

00001 #ifndef __SPC2_STRUCT_H__6R1KTJP0NJ__
00002 #define __SPC2_STRUCT_H__6R1KTJP0NJ__
00003 
00004 typedef uint8_t uint40_bytes[5];
00005 typedef uint8_t uint32_bytes[4];
00006 typedef uint8_t uint16_bytes[2];
00007 
00008 #ifndef CC_BYTE_ALIGNED
00009 #ifdef __GNUC__
00010 #define CC_BYTE_ALIGNED __attribute__ ((packed))
00011 #endif
00012 #endif
00013 
00014 #ifndef CC_BYTE_ALIGNED
00015 #define CC_BYTE_ALIGNED
00016 #endif
00017 
00018 #define HOST16_TO_BE_BYTES(x) {(((x) >> 8) & 0xff), ((x) & 0xff)}
00019 #define HOST32_TO_BE_BYTES(x) {(((x) >> 24) & 0xff), (((x) >> 16) & 0xff), \
00020  (((x) >> 8) & 0xff), ((x) & 0xff)}
00021 #define HOST40_TO_BE_BYTES(x) {(((x) >> 32) & 0xff), (((x) >> 24) & 0xff), (((x) >> 16) & 0xff), \
00022  (((x) >> 8) & 0xff), ((x) & 0xff)}
00023 
00024 inline unsigned long
00025 be16_to_host(uint16_bytes bytes)
00026 {
00027   return bytes[0] << 8 | bytes[1];
00028 }
00029 
00030 inline unsigned long
00031 be32_to_host(uint32_bytes bytes)
00032 {
00033   return (be16_to_host(bytes) << 16) | be16_to_host(bytes + 2);
00034 }
00035 
00036 
00037 #define BE16_TO_HOST(bytes) ((bytes)[0] << 8 | (bytes)[1])
00038 #define BE32_TO_HOST(bytes) \
00039 ((BE16_TO_HOST(bytes) << 16) | BE16_TO_HOST((bytes)+2))
00040 struct spc2_inquiry_cmd
00041 {
00042   uint8_t op_code;
00043   uint8_t flags;
00044   uint8_t page;
00045   uint8_t reserved;
00046   uint8_t allocation_length;
00047   uint8_t control;
00048 } CC_BYTE_ALIGNED;
00049 
00050 struct spc2_std_inquiry_data
00051 {
00052   uint8_t device;
00053   uint8_t flags1;
00054   uint8_t version;
00055   uint8_t flags2;
00056   uint8_t additional_length;
00057   uint8_t flags3;
00058   uint8_t flags4;
00059   uint8_t flags5;
00060   char vendor_id[8];
00061   char product_id[16];
00062   char product_rev[4];
00063 } CC_BYTE_ALIGNED;
00064 
00065 struct spc2_vital_product_data_head
00066 {
00067   uint8_t device;
00068   uint8_t page;
00069   uint8_t reserved;
00070   uint8_t page_length;
00071 } CC_BYTE_ALIGNED;
00072 
00073 struct spc2_identification_descriptor
00074 {
00075   uint8_t code_set;
00076   uint8_t identifier_type;
00077   uint8_t reserved;
00078   uint8_t identifier_length;
00079 };
00080 
00081 struct spc2_request_sense_cmd
00082 {
00083   uint8_t op_code;
00084   uint8_t reserved1;
00085   uint8_t reserved2;
00086   uint8_t reserved3;
00087   uint8_t allocation_length;
00088   uint8_t control;
00089 } CC_BYTE_ALIGNED;
00090 
00091 struct spc2_sense_data
00092 {
00093   uint8_t response_code;
00094   uint8_t obsolete;
00095   uint8_t sense_key;
00096   uint8_t information[4];
00097   uint8_t additional_length;
00098   uint8_t command_specific[4];
00099   uint8_t asc;
00100   uint8_t ascq;
00101   uint8_t unit_code;
00102   uint8_t sense_key_specific[3];
00103 } CC_BYTE_ALIGNED;
00104 
00105 struct spc2_mode_sence_6_cmd
00106 {
00107   uint8_t op_code;
00108   uint8_t flags;
00109   uint8_t page_code;
00110   uint8_t reserved;
00111   uint8_t allocation_length;
00112   uint8_t control;
00113 } CC_BYTE_ALIGNED;
00114 
00115 struct spc2_mode_select_6_cmd
00116 {
00117   uint8_t op_code;
00118   uint8_t flags;
00119   uint8_t reserved1;
00120   uint8_t reserved2;
00121   uint8_t parameter_list_length;
00122   uint8_t control;
00123 };
00124 
00125 struct spc2_mode_parameter_header_6
00126 {
00127   uint8_t mode_data_length;
00128   uint8_t medium_type;
00129   uint8_t device_specific_parameter;
00130   uint8_t block_descriptor_length;
00131 } CC_BYTE_ALIGNED;
00132 
00133 struct spc2_mode_page
00134 {
00135   uint8_t page_code;
00136   uint8_t page_length;
00137 } CC_BYTE_ALIGNED;
00138 
00139 #endif /* __SPC2_STRUCT_H__6R1KTJP0NJ__ */

Generated on Mon Apr 11 14:23:35 2011 for Contiki 2.5 by  doxygen 1.6.1