Corrected bitfields -- the smallest datatype required for each bitfield is now used...
authorDean Camera <dean@fourwalledcubicle.com>
Thu, 26 Mar 2009 03:22:02 +0000 (03:22 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Thu, 26 Mar 2009 03:22:02 +0000 (03:22 +0000)
Demos/Device/MassStorage/SCSI.h
Demos/Device/RNDISEthernet/IP.h
Demos/Device/RNDISEthernet/TCP.h
Demos/Host/MassStorageHost/MassStoreCommands.h

index a0be390..58eea1b 100644 (file)
                 */\r
                typedef struct\r
                {\r
-                       unsigned int DeviceType          : 5;\r
-                       unsigned int PeripheralQualifier : 3;\r
+                       unsigned char DeviceType          : 5;\r
+                       unsigned char PeripheralQualifier : 3;\r
                        \r
-                       unsigned int _RESERVED1          : 7;\r
-                       unsigned int Removable           : 1;\r
+                       unsigned char _RESERVED1          : 7;\r
+                       unsigned char Removable           : 1;\r
                        \r
                        uint8_t      Version;\r
                        \r
-                       unsigned int ResponseDataFormat  : 4;\r
-                       unsigned int _RESERVED2          : 1;\r
-                       unsigned int NormACA             : 1;\r
-                       unsigned int TrmTsk              : 1;\r
-                       unsigned int AERC                : 1;\r
+                       unsigned char ResponseDataFormat  : 4;\r
+                       unsigned char _RESERVED2          : 1;\r
+                       unsigned char NormACA             : 1;\r
+                       unsigned char TrmTsk              : 1;\r
+                       unsigned char AERC                : 1;\r
 \r
                        uint8_t      AdditionalLength;\r
                        uint8_t      _RESERVED3[2];\r
 \r
-                       unsigned int SoftReset           : 1;\r
-                       unsigned int CmdQue              : 1;\r
-                       unsigned int _RESERVED4          : 1;\r
-                       unsigned int Linked              : 1;\r
-                       unsigned int Sync                : 1;\r
-                       unsigned int WideBus16Bit        : 1;\r
-                       unsigned int WideBus32Bit        : 1;\r
-                       unsigned int RelAddr             : 1;\r
+                       unsigned char SoftReset           : 1;\r
+                       unsigned char CmdQue              : 1;\r
+                       unsigned char _RESERVED4          : 1;\r
+                       unsigned char Linked              : 1;\r
+                       unsigned char Sync                : 1;\r
+                       unsigned char WideBus16Bit        : 1;\r
+                       unsigned char WideBus32Bit        : 1;\r
+                       unsigned char RelAddr             : 1;\r
                        \r
                        uint8_t      VendorID[8];\r
                        uint8_t      ProductID[16];\r
                        \r
                        uint8_t      SegmentNumber;\r
                        \r
-                       unsigned int SenseKey            : 4;\r
-                       unsigned int _RESERVED1          : 1;\r
-                       unsigned int ILI                 : 1;\r
-                       unsigned int EOM                 : 1;\r
-                       unsigned int FileMark            : 1;\r
+                       unsigned char SenseKey            : 4;\r
+                       unsigned char _RESERVED1          : 1;\r
+                       unsigned char ILI                 : 1;\r
+                       unsigned char EOM                 : 1;\r
+                       unsigned char FileMark            : 1;\r
                        \r
                        uint8_t      Information[4];\r
                        uint8_t      AdditionalLength;\r
index 119d219..be928e6 100644 (file)
                /** Type define of an IP packet header. */\r
                typedef struct\r
                {\r
-                       unsigned int  HeaderLength   : 4; /**< Total length of the packet header, in 4-byte blocks */\r
-                       unsigned int  Version        : 4; /**< IP protocol version */\r
-                       unsigned int  TypeOfService  : 8; /**< Special service type identifier, indicating delay/throughput/reliability levels */\r
-                       unsigned int  TotalLength    : 16; /**< Total length of the IP packet, in bytes */\r
+                       unsigned char  HeaderLength   : 4; /**< Total length of the packet header, in 4-byte blocks */\r
+                       unsigned char  Version        : 4; /**< IP protocol version */\r
+                       uint8_t        TypeOfService; /**< Special service type identifier, indicating delay/throughput/reliability levels */\r
+                       uint16_t       TotalLength; /**< Total length of the IP packet, in bytes */\r
 \r
-                       unsigned int  Identification : 16; /**< Idenfication value for identifying fragmented packets */\r
-                       unsigned int  FragmentOffset : 13; /**< Offset of this IP fragment */\r
-                       unsigned int  Flags          : 3; /**< Fragment flags, to indicate if a packet is fragmented */\r
+                       uint16_t       Identification; /**< Idenfication value for identifying fragmented packets */\r
+                       unsigned int   FragmentOffset : 13; /**< Offset of this IP fragment */\r
+                       unsigned int   Flags          : 3; /**< Fragment flags, to indicate if a packet is fragmented */\r
 \r
-                       unsigned int  TTL            : 8; /**< Maximum allowable number of hops to reach the packet destination */\r
-                       unsigned int  Protocol       : 8; /**< Encapsulated protocol type */\r
-                       unsigned int  HeaderChecksum : 16; /**< Ethernet checksum of the IP header */\r
+                       uint8_t        TTL; /**< Maximum allowable number of hops to reach the packet destination */\r
+                       uint8_t        Protocol; /**< Encapsulated protocol type */\r
+                       uint16_t       HeaderChecksum; /**< Ethernet checksum of the IP header */\r
                        \r
                        IP_Address_t  SourceAddress; /**< Source protocol IP address of the packet */\r
                        IP_Address_t  DestinationAddress; /**< Destination protocol IP address of the packet */\r
index 2125485..25fa657 100644 (file)
                        uint32_t               SequenceNumber; /**< Data sequence number of the packet */\r
                        uint32_t               AcknowledgmentNumber; /**< Data acknowledgment number of the packet */\r
                        \r
-                       unsigned int           Reserved : 4; /**< Reserved, must be all 0 */\r
-                       unsigned int           DataOffset : 4; /**< Offset of the data from the start of the header, in 4 byte chunks */\r
+                       unsigned char          Reserved : 4; /**< Reserved, must be all 0 */\r
+                       unsigned char          DataOffset : 4; /**< Offset of the data from the start of the header, in 4 byte chunks */\r
                        uint8_t                Flags; /**< TCP packet flags */\r
                        uint16_t               WindowSize; /**< Current data window size (bytes remaning in reception buffer) */\r
                        \r
index d3ddfee..adab4fb 100644 (file)
                 */\r
                typedef struct\r
                {\r
-                       unsigned int ReponseCode         : 7;\r
-                       unsigned int Valid               : 1;\r
+                       unsigned char ReponseCode         : 7;\r
+                       unsigned char Valid               : 1;\r
                        \r
                        uint8_t      SegmentNumber;\r
                        \r
-                       unsigned int SenseKey            : 4;\r
-                       unsigned int _RESERVED1          : 1;\r
-                       unsigned int ILI                 : 1;\r
-                       unsigned int EOM                 : 1;\r
-                       unsigned int FileMark            : 1;\r
+                       unsigned char SenseKey            : 4;\r
+                       unsigned char _RESERVED1          : 1;\r
+                       unsigned char ILI                 : 1;\r
+                       unsigned char EOM                 : 1;\r
+                       unsigned char FileMark            : 1;\r
                        \r
                        uint8_t      Information[4];\r
                        uint8_t      AdditionalLength;\r