Reworked little endian bitfields a bit.

* Added B_ prefix.
* Renamed 16 bit variants to B_LENDIAN16_*.
* Added 32 bit variants (albeit only 16 of them for now).
* Adjusted headers that were using them.
This commit is contained in:
Axel Dörfler
2015-11-10 08:47:48 +01:00
parent ab306fb8f5
commit 93c0a5d790
8 changed files with 251 additions and 209 deletions
+4 -4
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2005-2007, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2005-2015, Axel Dörfler, [email protected]. All rights reserved.
* Copyright 2002-04, Thomas Kurschel. All rights reserved. * Copyright 2002-04, Thomas Kurschel. All rights reserved.
* *
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
@@ -7,8 +7,8 @@
#ifndef _ATA_PCI_H #ifndef _ATA_PCI_H
#define _ATA_PCI_H #define _ATA_PCI_H
/*
ATA adapter library /*! ATA adapter library
Module to simplify writing an ATA adapter driver. Module to simplify writing an ATA adapter driver.
@@ -29,7 +29,7 @@ typedef struct prd_entry {
uint32 address; // physical address of block (must be even) uint32 address; // physical address of block (must be even)
uint16 count; // size of block, 0 stands for 65536 (must be even) uint16 count; // size of block, 0 stands for 65536 (must be even)
uint8 res6; uint8 res6;
LBITFIELD8_2( B_LBITFIELD8_2(
res7_0 : 7, res7_0 : 7,
EOT : 1 // 1 for last entry EOT : 1 // 1 for last entry
); );
+16 -14
View File
@@ -5,9 +5,11 @@
#ifndef __ATA_TYPES_H__ #ifndef __ATA_TYPES_H__
#define __ATA_TYPES_H__ #define __ATA_TYPES_H__
#include <iovec.h> #include <iovec.h>
#include <lendian_bitfield.h> #include <lendian_bitfield.h>
// ATA task file. // ATA task file.
// contains the command block interpreted under different conditions with // contains the command block interpreted under different conditions with
// first byte being first command register, second byte second command register // first byte being first command register, second byte second command register
@@ -22,7 +24,7 @@ union ata_task_file {
uint8 sector_number; uint8 sector_number;
uint8 cylinder_0_7; uint8 cylinder_0_7;
uint8 cylinder_8_15; uint8 cylinder_8_15;
LBITFIELD8_3( B_LBITFIELD8_3(
head : 4, head : 4,
device : 1, device : 1,
mode : 3 mode : 3
@@ -35,7 +37,7 @@ union ata_task_file {
uint8 lba_0_7; uint8 lba_0_7;
uint8 lba_8_15; uint8 lba_8_15;
uint8 lba_16_23; uint8 lba_16_23;
LBITFIELD8_3( B_LBITFIELD8_3(
lba_24_27 : 4, lba_24_27 : 4,
device : 1, device : 1,
mode : 3 mode : 3
@@ -43,19 +45,19 @@ union ata_task_file {
uint8 command; uint8 command;
} lba; } lba;
struct { struct {
LBITFIELD8_3( B_LBITFIELD8_3(
dma : 1, dma : 1,
ovl : 1, ovl : 1,
_0_res2 : 6 _0_res2 : 6
); );
LBITFIELD8_2( B_LBITFIELD8_2(
_1_res0 : 3, _1_res0 : 3,
tag : 5 tag : 5
); );
uint8 _2_res; uint8 _2_res;
uint8 byte_count_0_7; uint8 byte_count_0_7;
uint8 byte_count_8_15; uint8 byte_count_8_15;
LBITFIELD8_6( B_LBITFIELD8_6(
lun : 3, lun : 3,
_5_res3 : 1, _5_res3 : 1,
device : 1, device : 1,
@@ -66,14 +68,14 @@ union ata_task_file {
uint8 command; uint8 command;
} packet; } packet;
struct { struct {
LBITFIELD8_5( B_LBITFIELD8_5(
ili : 1, ili : 1,
eom : 1, eom : 1,
abrt : 1, abrt : 1,
_0_res3 : 1, _0_res3 : 1,
sense_key : 4 sense_key : 4
); );
LBITFIELD8_4( B_LBITFIELD8_4(
cmd_or_data : 1, // 1 - cmd, 0 - data cmd_or_data : 1, // 1 - cmd, 0 - data
input_or_output : 1, // 0 - input (to device), 1 - output input_or_output : 1, // 0 - input (to device), 1 - output
release : 1, release : 1,
@@ -82,14 +84,14 @@ union ata_task_file {
uint8 _2_res; uint8 _2_res;
uint8 byte_count_0_7; uint8 byte_count_0_7;
uint8 byte_count_8_15; uint8 byte_count_8_15;
LBITFIELD8_5( B_LBITFIELD8_5(
_4_res0 : 4, _4_res0 : 4,
device : 1, device : 1,
_4_obs5 : 1, _4_obs5 : 1,
_4_res6 : 1, _4_res6 : 1,
_4_obs7 : 1 _4_obs7 : 1
); );
LBITFIELD8_7( B_LBITFIELD8_7(
chk : 1, chk : 1,
_7_res1 : 2, _7_res1 : 2,
drq : 1, drq : 1,
@@ -101,7 +103,7 @@ union ata_task_file {
} packet_res; } packet_res;
struct { struct {
uint8 sector_count; uint8 sector_count;
LBITFIELD8_4( // only <tag> is defined for write B_LBITFIELD8_4( // only <tag> is defined for write
cmd_or_data : 1, // 1 - cmd, 0 - data cmd_or_data : 1, // 1 - cmd, 0 - data
input_or_output : 1, // 0 - input (to device), 1 - output input_or_output : 1, // 0 - input (to device), 1 - output
release : 1, release : 1,
@@ -110,7 +112,7 @@ union ata_task_file {
uint8 lba_0_7; uint8 lba_0_7;
uint8 lba_8_15; uint8 lba_8_15;
uint8 lba_16_23; uint8 lba_16_23;
LBITFIELD8_3( B_LBITFIELD8_3(
lba_24_27 : 4, lba_24_27 : 4,
device : 1, device : 1,
mode : 3 mode : 3
@@ -124,7 +126,7 @@ union ata_task_file {
uint8 lba_0_7; uint8 lba_0_7;
uint8 lba_8_15; uint8 lba_8_15;
uint8 lba_16_23; uint8 lba_16_23;
LBITFIELD8_3( B_LBITFIELD8_3(
_5low_res0 : 4, _5low_res0 : 4,
device : 1, device : 1,
mode : 3 mode : 3
@@ -141,7 +143,7 @@ union ata_task_file {
struct { struct {
// low order bytes // low order bytes
uint8 sector_count_0_7; uint8 sector_count_0_7;
LBITFIELD8_4( B_LBITFIELD8_4(
cmd_or_data : 1, // 1 - cmd, 0 - data cmd_or_data : 1, // 1 - cmd, 0 - data
input_or_output : 1, // 0 - input (to device), 1 - output input_or_output : 1, // 0 - input (to device), 1 - output
release : 1, release : 1,
@@ -150,7 +152,7 @@ union ata_task_file {
uint8 lba_0_7; uint8 lba_0_7;
uint8 lba_8_15; uint8 lba_8_15;
uint8 lba_16_23; uint8 lba_16_23;
LBITFIELD8_3( B_LBITFIELD8_3(
_5low_res0 : 4, _5low_res0 : 4,
device : 1, device : 1,
mode : 3 mode : 3
+84 -49
View File
@@ -1,67 +1,102 @@
/* /*
** Copyright 2002, Thomas Kurschel. All rights reserved. * Copyright 2015, Haiku, Inc. All RightsReserved.
** Distributed under the terms of the OpenBeOS License. * Copyright 2002, Thomas Kurschel. All rights reserved.
*/ * Distributed under the terms of the MIT License.
*/
#ifndef LENDIAN_BITFIELD_H #ifndef LENDIAN_BITFIELD_H
#define LENDIAN_BITFIELD_H #define LENDIAN_BITFIELD_H
#include <ByteOrder.h> #include <ByteOrder.h>
#if B_HOST_IS_BENDIAN #if B_HOST_IS_BENDIAN
#define LBITFIELD8_2(b1,b2) uint8 b2,b1 #define B_LBITFIELD8_2(b1,b2) uint8 b2,b1
#define LBITFIELD8_3(b1,b2,b3) uint8 b3,b2,b1 #define B_LBITFIELD8_3(b1,b2,b3) uint8 b3,b2,b1
#define LBITFIELD8_4(b1,b2,b3,b4) uint8 b4,b3,b2,b1 #define B_LBITFIELD8_4(b1,b2,b3,b4) uint8 b4,b3,b2,b1
#define LBITFIELD8_5(b1,b2,b3,b4,b5) uint8 b5,b4,b3,b2,b1 #define B_LBITFIELD8_5(b1,b2,b3,b4,b5) uint8 b5,b4,b3,b2,b1
#define LBITFIELD8_6(b1,b2,b3,b4,b5,b6) uint8 b6,b5,b4,b3,b2,b1 #define B_LBITFIELD8_6(b1,b2,b3,b4,b5,b6) uint8 b6,b5,b4,b3,b2,b1
#define LBITFIELD8_7(b1,b2,b3,b4,b5,b6,b7) uint8 b7,b6,b5,b4,b3,b2,b1 #define B_LBITFIELD8_7(b1,b2,b3,b4,b5,b6,b7) uint8 b7,b6,b5,b4,b3,b2,b1
#define LBITFIELD8_8(b1,b2,b3,b4,b5,b6,b7,b8) uint8 b8,b7,b6,b5,b4,b3,b2,b1 #define B_LBITFIELD8_8(b1,b2,b3,b4,b5,b6,b7,b8) uint8 b8,b7,b6,b5,b4,b3,b2,b1
#define LBITFIELD2(b1,b2) uint16 b2,b1 #define B_LBITFIELD16_2(b1,b2) uint16 b2,b1
#define LBITFIELD3(b1,b2,b3) uint16 b3,b2,b1 #define B_LBITFIELD16_3(b1,b2,b3) uint16 b3,b2,b1
#define LBITFIELD4(b1,b2,b3,b4) uint16 b4,b3,b2,b1 #define B_LBITFIELD16_4(b1,b2,b3,b4) uint16 b4,b3,b2,b1
#define LBITFIELD5(b1,b2,b3,b4,b5) uint16 b5,b4,b3,b2,b1 #define B_LBITFIELD16_5(b1,b2,b3,b4,b5) uint16 b5,b4,b3,b2,b1
#define LBITFIELD6(b1,b2,b3,b4,b5,b6) uint16 b6,b5,b4,b3,b2,b1 #define B_LBITFIELD16_6(b1,b2,b3,b4,b5,b6) uint16 b6,b5,b4,b3,b2,b1
#define LBITFIELD7(b1,b2,b3,b4,b5,b6,b7) uint16 b7,b6,b5,b4,b3,b2,b1 #define B_LBITFIELD16_7(b1,b2,b3,b4,b5,b6,b7) uint16 b7,b6,b5,b4,b3,b2,b1
#define LBITFIELD8(b1,b2,b3,b4,b5,b6,b7,b8) uint16 b8,b7,b6,b5,b4,b3,b2,b1 #define B_LBITFIELD16_8(b1,b2,b3,b4,b5,b6,b7,b8) uint16 b8,b7,b6,b5,b4,b3,b2,b1
#define LBITFIELD9(b1,b2,b3,b4,b5,b6,b7,b8,b9) uint16 b9,b8,b7,b6,b5,b4,b3,b2,b1 #define B_LBITFIELD16_9(b1,b2,b3,b4,b5,b6,b7,b8,b9) uint16 b9,b8,b7,b6,b5,b4,b3,b2,b1
#define LBITFIELD10(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10) uint16 b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 #define B_LBITFIELD16_10(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10) uint16 b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
#define LBITFIELD11(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11) uint16 b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 #define B_LBITFIELD16_11(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11) uint16 b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
#define LBITFIELD12(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12) uint16 b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 #define B_LBITFIELD16_12(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12) uint16 b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
#define LBITFIELD13(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13) uint16 b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 #define B_LBITFIELD16_13(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13) uint16 b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
#define LBITFIELD14(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14) uint16 b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 #define B_LBITFIELD16_14(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14) uint16 b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
#define LBITFIELD15(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15) uint16 b15,b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 #define B_LBITFIELD16_15(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15) uint16 b15,b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
#define LBITFIELD16(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16) uint16 b16,b15,b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1 #define B_LBITFIELD16_16(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16) uint16 b16,b15,b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
#define B_LBITFIELD32_2(b1,b2) uint32 b2,b1
#define B_LBITFIELD32_3(b1,b2,b3) uint32 b3,b2,b1
#define B_LBITFIELD32_4(b1,b2,b3,b4) uint32 b4,b3,b2,b1
#define B_LBITFIELD32_5(b1,b2,b3,b4,b5) uint32 b5,b4,b3,b2,b1
#define B_LBITFIELD32_6(b1,b2,b3,b4,b5,b6) uint32 b6,b5,b4,b3,b2,b1
#define B_LBITFIELD32_7(b1,b2,b3,b4,b5,b6,b7) uint32 b7,b6,b5,b4,b3,b2,b1
#define B_LBITFIELD32_8(b1,b2,b3,b4,b5,b6,b7,b8) uint32 b8,b7,b6,b5,b4,b3,b2,b1
#define B_LBITFIELD32_9(b1,b2,b3,b4,b5,b6,b7,b8,b9) uint32 b9,b8,b7,b6,b5,b4,b3,b2,b1
#define B_LBITFIELD32_10(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10) uint32 b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
#define B_LBITFIELD32_11(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11) uint32 b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
#define B_LBITFIELD32_12(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12) uint32 b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
#define B_LBITFIELD32_13(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13) uint32 b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
#define B_LBITFIELD32_14(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14) uint32 b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
#define B_LBITFIELD32_15(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15) uint32 b15,b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
#define B_LBITFIELD32_16(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16) uint32 b16,b15,b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
#elif B_HOST_IS_LENDIAN #elif B_HOST_IS_LENDIAN
#define LBITFIELD8_2(b1,b2) uint8 b1,b2 #define B_LBITFIELD8_2(b1,b2) uint8 b1,b2
#define LBITFIELD8_3(b1,b2,b3) uint8 b1,b2,b3 #define B_LBITFIELD8_3(b1,b2,b3) uint8 b1,b2,b3
#define LBITFIELD8_4(b1,b2,b3,b4) uint8 b1,b2,b3,b4 #define B_LBITFIELD8_4(b1,b2,b3,b4) uint8 b1,b2,b3,b4
#define LBITFIELD8_5(b1,b2,b3,b4,b5) uint8 b1,b2,b3,b4,b5 #define B_LBITFIELD8_5(b1,b2,b3,b4,b5) uint8 b1,b2,b3,b4,b5
#define LBITFIELD8_6(b1,b2,b3,b4,b5,b6) uint8 b1,b2,b3,b4,b5,b6 #define B_LBITFIELD8_6(b1,b2,b3,b4,b5,b6) uint8 b1,b2,b3,b4,b5,b6
#define LBITFIELD8_7(b1,b2,b3,b4,b5,b6,b7) uint8 b1,b2,b3,b4,b5,b6,b7 #define B_LBITFIELD8_7(b1,b2,b3,b4,b5,b6,b7) uint8 b1,b2,b3,b4,b5,b6,b7
#define LBITFIELD8_8(b1,b2,b3,b4,b5,b6,b7,b8) uint8 b1,b2,b3,b4,b5,b6,b7,b8 #define B_LBITFIELD8_8(b1,b2,b3,b4,b5,b6,b7,b8) uint8 b1,b2,b3,b4,b5,b6,b7,b8
#define LBITFIELD2(b1,b2) uint16 b1,b2 #define B_LBITFIELD16_2(b1,b2) uint16 b1,b2
#define LBITFIELD3(b1,b2,b3) uint16 b1,b2,b3 #define B_LBITFIELD16_3(b1,b2,b3) uint16 b1,b2,b3
#define LBITFIELD4(b1,b2,b3,b4) uint16 b1,b2,b3,b4 #define B_LBITFIELD16_4(b1,b2,b3,b4) uint16 b1,b2,b3,b4
#define LBITFIELD5(b1,b2,b3,b4,b5) uint16 b1,b2,b3,b4,b5 #define B_LBITFIELD16_5(b1,b2,b3,b4,b5) uint16 b1,b2,b3,b4,b5
#define LBITFIELD6(b1,b2,b3,b4,b5,b6) uint16 b1,b2,b3,b4,b5,b6 #define B_LBITFIELD16_6(b1,b2,b3,b4,b5,b6) uint16 b1,b2,b3,b4,b5,b6
#define LBITFIELD7(b1,b2,b3,b4,b5,b6,b7) uint16 b1,b2,b3,b4,b5,b6,b7 #define B_LBITFIELD16_7(b1,b2,b3,b4,b5,b6,b7) uint16 b1,b2,b3,b4,b5,b6,b7
#define LBITFIELD8(b1,b2,b3,b4,b5,b6,b7,b8) uint16 b1,b2,b3,b4,b5,b6,b7,b8 #define B_LBITFIELD16_8(b1,b2,b3,b4,b5,b6,b7,b8) uint16 b1,b2,b3,b4,b5,b6,b7,b8
#define LBITFIELD9(b1,b2,b3,b4,b5,b6,b7,b8,b9) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9 #define B_LBITFIELD16_9(b1,b2,b3,b4,b5,b6,b7,b8,b9) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9
#define LBITFIELD10(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10 #define B_LBITFIELD16_10(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10
#define LBITFIELD11(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11 #define B_LBITFIELD16_11(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11
#define LBITFIELD12(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12 #define B_LBITFIELD16_12(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12
#define LBITFIELD13(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13 #define B_LBITFIELD16_13(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13
#define LBITFIELD14(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14 #define B_LBITFIELD16_14(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14
#define LBITFIELD15(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15 #define B_LBITFIELD16_15(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15
#define LBITFIELD16(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16 #define B_LBITFIELD16_16(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16
#define B_LBITFIELD32_2(b1,b2) uint32 b1,b2
#define B_LBITFIELD32_3(b1,b2,b3) uint32 b1,b2,b3
#define B_LBITFIELD32_4(b1,b2,b3,b4) uint32 b1,b2,b3,b4
#define B_LBITFIELD32_5(b1,b2,b3,b4,b5) uint32 b1,b2,b3,b4,b5
#define B_LBITFIELD32_6(b1,b2,b3,b4,b5,b6) uint32 b1,b2,b3,b4,b5,b6
#define B_LBITFIELD32_7(b1,b2,b3,b4,b5,b6,b7) uint32 b1,b2,b3,b4,b5,b6,b7
#define B_LBITFIELD32_8(b1,b2,b3,b4,b5,b6,b7,b8) uint32 b1,b2,b3,b4,b5,b6,b7,b8
#define B_LBITFIELD32_9(b1,b2,b3,b4,b5,b6,b7,b8,b9) uint32 b1,b2,b3,b4,b5,b6,b7,b8,b9
#define B_LBITFIELD32_10(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10) uint32 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10
#define B_LBITFIELD32_11(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11) uint32 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11
#define B_LBITFIELD32_12(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12) uint32 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12
#define B_LBITFIELD32_13(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13) uint32 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13
#define B_LBITFIELD32_14(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14) uint32 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14
#define B_LBITFIELD32_15(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15) uint32 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15
#define B_LBITFIELD32_16(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16) uint32 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16
#else #else
#error "Unknown host endianness" # error "Unknown host endianness"
#endif #endif
#endif /* LENDIAN_BITFIELD_H */ #endif /* LENDIAN_BITFIELD_H */
+66 -66
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2004-2013, Haiku, Inc. All RightsReserved. * Copyright 2004-2015, Haiku, Inc. All RightsReserved.
* Copyright 2002/03, Thomas Kurschel. All rights reserved. * Copyright 2002/03, Thomas Kurschel. All rights reserved.
* *
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
@@ -222,7 +222,7 @@
typedef struct scsi_cmd_inquiry { typedef struct scsi_cmd_inquiry {
uint8 opcode; uint8 opcode;
LBITFIELD8_3( B_LBITFIELD8_3(
evpd : 1, // enhanced vital product data evpd : 1, // enhanced vital product data
_res1_1 : 4, _res1_1 : 4,
lun : 3 lun : 3
@@ -234,20 +234,20 @@ typedef struct scsi_cmd_inquiry {
} _PACKED scsi_cmd_inquiry; } _PACKED scsi_cmd_inquiry;
typedef struct scsi_res_inquiry { typedef struct scsi_res_inquiry {
LBITFIELD8_2( B_LBITFIELD8_2(
device_type : 5, device_type : 5,
device_qualifier : 3 device_qualifier : 3
); );
LBITFIELD8_2( B_LBITFIELD8_2(
device_type_modifier : 7, // obsolete, normally set to zero device_type_modifier : 7, // obsolete, normally set to zero
removable_medium : 1 removable_medium : 1
); );
LBITFIELD8_3( // 0 always means "not conforming" B_LBITFIELD8_3( // 0 always means "not conforming"
ansi_version : 3, // 1 for SCSI-1, 2 for SCSI-2 etc. ansi_version : 3, // 1 for SCSI-1, 2 for SCSI-2 etc.
ecma_version : 3, ecma_version : 3,
iso_version : 2 iso_version : 2
); );
LBITFIELD8_4( B_LBITFIELD8_4(
response_data_format : 4, // 2 = SCSI/2 compliant response_data_format : 4, // 2 = SCSI/2 compliant
_res3_4 : 2, _res3_4 : 2,
term_iop : 1, // 1 = supports TERMINATE I/O PROCESS term_iop : 1, // 1 = supports TERMINATE I/O PROCESS
@@ -257,7 +257,7 @@ typedef struct scsi_res_inquiry {
uint8 additional_length; // total (whished) length = this + 4 uint8 additional_length; // total (whished) length = this + 4
uint8 _res5; uint8 _res5;
uint8 _res6; uint8 _res6;
LBITFIELD8_8( B_LBITFIELD8_8(
soft_reset : 1, // 0 = soft reset leads to hard reset soft_reset : 1, // 0 = soft reset leads to hard reset
cmd_queue : 1, // 1 = supports tagged command queuing cmd_queue : 1, // 1 = supports tagged command queuing
_res7_2 : 1, _res7_2 : 1,
@@ -319,7 +319,7 @@ enum scsi_device_type {
// vital product data: supported pages // vital product data: supported pages
typedef struct scsi_page_list { typedef struct scsi_page_list {
LBITFIELD8_2( B_LBITFIELD8_2(
device_type : 5, device_type : 5,
device_qualifier : 3 device_qualifier : 3
); );
@@ -332,7 +332,7 @@ typedef struct scsi_page_list {
// vital product data: unit serial number page // vital product data: unit serial number page
typedef struct scsi_page_usn { typedef struct scsi_page_usn {
LBITFIELD8_2( B_LBITFIELD8_2(
device_type : 5, device_type : 5,
device_qualifier : 3 device_qualifier : 3
); );
@@ -344,14 +344,14 @@ typedef struct scsi_page_usn {
} _PACKED scsi_page_usn; } _PACKED scsi_page_usn;
typedef struct scsi_page_block_limits { typedef struct scsi_page_block_limits {
LBITFIELD8_2( B_LBITFIELD8_2(
device_type : 5, device_type : 5,
device_qualifier : 3 device_qualifier : 3
); );
uint8 page_code; uint8 page_code;
uint16 _page_length; uint16 _page_length;
LBITFIELD8_2( B_LBITFIELD8_2(
wsnz : 1, wsnz : 1,
_res4_1 : 7 _res4_1 : 7
); );
@@ -369,7 +369,7 @@ typedef struct scsi_page_block_limits {
} _PACKED scsi_page_block_limits; } _PACKED scsi_page_block_limits;
typedef struct scsi_page_lb_provisioning { typedef struct scsi_page_lb_provisioning {
LBITFIELD8_2( B_LBITFIELD8_2(
device_type : 5, device_type : 5,
device_qualifier : 3 device_qualifier : 3
); );
@@ -377,7 +377,7 @@ typedef struct scsi_page_lb_provisioning {
uint16 page_length; uint16 page_length;
uint8 threshold_exponent; uint8 threshold_exponent;
LBITFIELD8_7( B_LBITFIELD8_7(
dp : 1, dp : 1,
anc_sup : 1, anc_sup : 1,
lbprz : 1, lbprz : 1,
@@ -386,7 +386,7 @@ typedef struct scsi_page_lb_provisioning {
lbpws : 1, lbpws : 1,
lbpu : 1 lbpu : 1
); );
LBITFIELD8_2( B_LBITFIELD8_2(
provisioning_type : 3, provisioning_type : 3,
_res6_3 : 5 _res6_3 : 5
); );
@@ -398,14 +398,14 @@ typedef struct scsi_page_lb_provisioning {
typedef struct scsi_cmd_read_capacity { typedef struct scsi_cmd_read_capacity {
uint8 opcode; uint8 opcode;
LBITFIELD8_3( B_LBITFIELD8_3(
relative_address : 1, // relative address relative_address : 1, // relative address
_res1_1 : 4, _res1_1 : 4,
lun : 3 lun : 3
); );
uint32 lba; uint32 lba;
uint8 _res6[2]; uint8 _res6[2];
LBITFIELD8_2( B_LBITFIELD8_2(
pmi : 1, // partial medium indicator pmi : 1, // partial medium indicator
_res8_1 : 7 _res8_1 : 7
); );
@@ -438,7 +438,7 @@ typedef struct scsi_res_read_capacity_long {
typedef struct scsi_cmd_rw_6 { typedef struct scsi_cmd_rw_6 {
uint8 opcode; uint8 opcode;
LBITFIELD8_2( B_LBITFIELD8_2(
high_lba : 5, high_lba : 5,
lun : 3 lun : 3
); );
@@ -453,7 +453,7 @@ typedef struct scsi_cmd_rw_6 {
typedef struct scsi_cmd_rw_10 { typedef struct scsi_cmd_rw_10 {
uint8 opcode; uint8 opcode;
LBITFIELD8_5( B_LBITFIELD8_5(
relative_address : 1, // relative address relative_address : 1, // relative address
_res1_1 : 2, _res1_1 : 2,
force_unit_access : 1, // force unit access (1 = safe, cacheless access) force_unit_access : 1, // force unit access (1 = safe, cacheless access)
@@ -471,7 +471,7 @@ typedef struct scsi_cmd_rw_10 {
typedef struct scsi_cmd_rw_12 { typedef struct scsi_cmd_rw_12 {
uint8 opcode; uint8 opcode;
LBITFIELD8_5( B_LBITFIELD8_5(
relative_address : 1, // relative address relative_address : 1, // relative address
_res1_1 : 2, _res1_1 : 2,
force_unit_access : 1, // force unit access (1 = safe, cacheless access) force_unit_access : 1, // force unit access (1 = safe, cacheless access)
@@ -489,7 +489,7 @@ typedef struct scsi_cmd_rw_12 {
typedef struct scsi_cmd_rw_16 { typedef struct scsi_cmd_rw_16 {
uint8 opcode; uint8 opcode;
LBITFIELD8_6( B_LBITFIELD8_6(
_res1_0 : 1, _res1_0 : 1,
force_unit_access_non_volatile : 1, force_unit_access_non_volatile : 1,
_res1_2 : 1, _res1_2 : 1,
@@ -499,7 +499,7 @@ typedef struct scsi_cmd_rw_16 {
); );
uint64 lba; // big endian uint64 lba; // big endian
uint32 length; uint32 length;
LBITFIELD8_3( B_LBITFIELD8_3(
group_number : 5, group_number : 5,
_res_14_5 : 2, _res_14_5 : 2,
_res_14_7 : 1 _res_14_7 : 1
@@ -512,7 +512,7 @@ typedef struct scsi_cmd_rw_16 {
typedef struct scsi_cmd_wsame_16 { typedef struct scsi_cmd_wsame_16 {
uint8 opcode; uint8 opcode;
LBITFIELD8_6( B_LBITFIELD8_6(
_res1_0 : 1, _res1_0 : 1,
lb_data : 1, lb_data : 1,
pb_data : 1, pb_data : 1,
@@ -522,7 +522,7 @@ typedef struct scsi_cmd_wsame_16 {
); );
uint64 lba; uint64 lba;
uint32 length; uint32 length;
LBITFIELD8_2( B_LBITFIELD8_2(
group_number : 5, group_number : 5,
_res14_5 : 3 _res14_5 : 3
); );
@@ -534,12 +534,12 @@ typedef struct scsi_cmd_wsame_16 {
typedef struct scsi_cmd_unmap { typedef struct scsi_cmd_unmap {
uint8 opcode; uint8 opcode;
LBITFIELD8_2( B_LBITFIELD8_2(
anchor : 1, anchor : 1,
_reserved1_7 : 7 _reserved1_7 : 7
); );
uint32 _reserved1; uint32 _reserved1;
LBITFIELD8_2( B_LBITFIELD8_2(
group_number : 5, group_number : 5,
_reserved5_7 : 3 _reserved5_7 : 3
); );
@@ -565,7 +565,7 @@ struct scsi_unmap_parameter_list {
typedef struct scsi_cmd_request_sense { typedef struct scsi_cmd_request_sense {
uint8 opcode; uint8 opcode;
LBITFIELD8_2( B_LBITFIELD8_2(
_res1_0 : 5, _res1_0 : 5,
lun : 3 lun : 3
); );
@@ -581,12 +581,12 @@ typedef struct scsi_cmd_request_sense {
#define SCSIS_DEFERRED_ERROR 0x71 #define SCSIS_DEFERRED_ERROR 0x71
typedef struct scsi_sense { typedef struct scsi_sense {
LBITFIELD8_2( B_LBITFIELD8_2(
error_code : 7, error_code : 7,
valid : 1 // 0 = not conforming to standard valid : 1 // 0 = not conforming to standard
); );
uint8 segment_number; // for COPY/COPY AND VERIFY/COMPARE uint8 segment_number; // for COPY/COPY AND VERIFY/COMPARE
LBITFIELD8_5( B_LBITFIELD8_5(
sense_key : 4, sense_key : 4,
res2_4 : 1, res2_4 : 1,
ILI : 1, // incorrect length indicator - req. block ILI : 1, // incorrect length indicator - req. block
@@ -612,7 +612,7 @@ typedef struct scsi_sense {
union { union {
struct { struct {
LBITFIELD8_2( B_LBITFIELD8_2(
high_key_spec : 7, high_key_spec : 7,
SKSV : 1 // 1 = sense key specific (byte 15-17) valid SKSV : 1 // 1 = sense key specific (byte 15-17) valid
); );
@@ -622,7 +622,7 @@ typedef struct scsi_sense {
// ILLEGAL REQUEST // ILLEGAL REQUEST
struct { struct {
LBITFIELD8_5( B_LBITFIELD8_5(
bit_pointer : 3, // points to (highest) invalid bit of parameter bit_pointer : 3, // points to (highest) invalid bit of parameter
BPV : 1, // 1 = bit_pointer is valid BPV : 1, // 1 = bit_pointer is valid
res15_4 : 2, res15_4 : 2,
@@ -635,7 +635,7 @@ typedef struct scsi_sense {
// access error (RECOVERED, HARDWARE or MEDIUM ERROR) // access error (RECOVERED, HARDWARE or MEDIUM ERROR)
struct { struct {
LBITFIELD8_2( B_LBITFIELD8_2(
res15_0 : 7, res15_0 : 7,
SKSV : 1 SKSV : 1
); );
@@ -645,7 +645,7 @@ typedef struct scsi_sense {
// format progress (if sense key = NOT READY) // format progress (if sense key = NOT READY)
struct { struct {
LBITFIELD8_2( B_LBITFIELD8_2(
res15_0 : 7, res15_0 : 7,
SKSV : 1 SKSV : 1
); );
@@ -661,12 +661,12 @@ typedef struct scsi_sense {
typedef struct scsi_cmd_prevent_allow { typedef struct scsi_cmd_prevent_allow {
uint8 opcode; uint8 opcode;
LBITFIELD8_2( B_LBITFIELD8_2(
_res1_0 : 5, _res1_0 : 5,
lun : 3 lun : 3
); );
uint8 _res2[2]; uint8 _res2[2];
LBITFIELD8_2( B_LBITFIELD8_2(
prevent : 1, // 1 - prevent medium removal, 0 - allow removal prevent : 1, // 1 - prevent medium removal, 0 - allow removal
_res4_1 : 7 _res4_1 : 7
); );
@@ -677,13 +677,13 @@ typedef struct scsi_cmd_prevent_allow {
typedef struct scsi_cmd_ssu { typedef struct scsi_cmd_ssu {
uint8 opcode; uint8 opcode;
LBITFIELD8_3( B_LBITFIELD8_3(
immediately : 1, // 1 - return immediately, 0 - return on completion immediately : 1, // 1 - return immediately, 0 - return on completion
_res1_1 : 4, _res1_1 : 4,
lun : 3 lun : 3
); );
uint8 res2[2]; uint8 res2[2];
LBITFIELD8_3( B_LBITFIELD8_3(
start : 1, // 1 - load+start, i.e. allow, 0 - eject+stop, i.e. deny start : 1, // 1 - load+start, i.e. allow, 0 - eject+stop, i.e. deny
load_eject : 1, // 1 - include loading/ejecting, 0 - only to allow/deny load_eject : 1, // 1 - include loading/ejecting, 0 - only to allow/deny
_res4_2 : 6 _res4_2 : 6
@@ -696,7 +696,7 @@ typedef struct scsi_cmd_ssu {
typedef struct scsi_cmd_mode_select_6 { typedef struct scsi_cmd_mode_select_6 {
uint8 opcode; uint8 opcode;
LBITFIELD8_4( B_LBITFIELD8_4(
save_pages : 1, // 1 = save pages to non-volatile memory save_pages : 1, // 1 = save pages to non-volatile memory
_res1_1 : 3, _res1_1 : 3,
pf : 1, // 0 = old SCSI-1; 1 = new SCSI-2 format pf : 1, // 0 = old SCSI-1; 1 = new SCSI-2 format
@@ -712,13 +712,13 @@ typedef struct scsi_cmd_mode_select_6 {
typedef struct scsi_cmd_mode_sense_6 { typedef struct scsi_cmd_mode_sense_6 {
uint8 opcode; uint8 opcode;
LBITFIELD8_4( B_LBITFIELD8_4(
_res1_0 : 3, _res1_0 : 3,
disable_block_desc : 1, // disable block descriptors disable_block_desc : 1, // disable block descriptors
_res1_4 : 1, _res1_4 : 1,
lun : 3 lun : 3
); );
LBITFIELD8_2( B_LBITFIELD8_2(
page_code : 6, page_code : 6,
page_control : 2 // page control field page_control : 2 // page control field
); );
@@ -732,7 +732,7 @@ typedef struct scsi_cmd_mode_sense_6 {
typedef struct scsi_cmd_mode_select_10 { typedef struct scsi_cmd_mode_select_10 {
uint8 opcode; uint8 opcode;
LBITFIELD8_4( B_LBITFIELD8_4(
save_pages : 1, // 1 = save pages to non-volatile memory save_pages : 1, // 1 = save pages to non-volatile memory
_res1_1 : 3, _res1_1 : 3,
pf : 1, // 0 = old SCSI-1; 1 = new SCSI-2 format pf : 1, // 0 = old SCSI-1; 1 = new SCSI-2 format
@@ -748,13 +748,13 @@ typedef struct scsi_cmd_mode_select_10 {
typedef struct scsi_cmd_mode_sense_10 { typedef struct scsi_cmd_mode_sense_10 {
uint8 opcode; uint8 opcode;
LBITFIELD8_4( B_LBITFIELD8_4(
_res1_0 : 3, _res1_0 : 3,
disable_block_desc : 1, // disable block descriptors disable_block_desc : 1, // disable block descriptors
_res1_4 : 1, _res1_4 : 1,
lun : 3 lun : 3
); );
LBITFIELD8_2( B_LBITFIELD8_2(
page_code : 6, page_code : 6,
page_control : 2 // page control field page_control : 2 // page control field
); );
@@ -792,7 +792,7 @@ typedef struct scsi_mode_param_header_10 {
// content of dev_spec_parameter for direct access devices // content of dev_spec_parameter for direct access devices
typedef struct scsi_mode_param_dev_spec_da { typedef struct scsi_mode_param_dev_spec_da {
LBITFIELD8_4( B_LBITFIELD8_4(
_res0_0 : 4, _res0_0 : 4,
dpo_fua : 1, // 1 = supports DPO and FUA, see READ (10) (sense only) dpo_fua : 1, // 1 = supports DPO and FUA, see READ (10) (sense only)
_res0_6 : 1, _res0_6 : 1,
@@ -814,7 +814,7 @@ typedef struct scsi_mode_param_block_desc {
// header of a mode pages // header of a mode pages
typedef struct scsi_modepage_header { typedef struct scsi_modepage_header {
LBITFIELD8_3( B_LBITFIELD8_3(
page_code : 6, page_code : 6,
_res0_6 : 1, _res0_6 : 1,
PS : 1 // 1 = page can be saved (only valid for MODE SENSE) PS : 1 // 1 = page can be saved (only valid for MODE SENSE)
@@ -828,17 +828,17 @@ typedef struct scsi_modepage_header {
typedef struct scsi_modepage_control { typedef struct scsi_modepage_control {
scsi_modepage_header header; scsi_modepage_header header;
LBITFIELD8_2( B_LBITFIELD8_2(
RLEC : 1, // Report Log Exception Condition RLEC : 1, // Report Log Exception Condition
res2_1 : 7 res2_1 : 7
); );
LBITFIELD8_4( B_LBITFIELD8_4(
DQue : 1, // disable Queuing DQue : 1, // disable Queuing
QErr : 1, // abort queued commands on contingent allegiance condition QErr : 1, // abort queued commands on contingent allegiance condition
res3_2 : 2, res3_2 : 2,
QAM : 4 // Queue Algorithm Modifier QAM : 4 // Queue Algorithm Modifier
); );
LBITFIELD8_5( B_LBITFIELD8_5(
EAENP : 1, // error AEN permission; true = send AEN on deferred error EAENP : 1, // error AEN permission; true = send AEN on deferred error
// false = generate UA condition after deferred error // false = generate UA condition after deferred error
UAAENP : 1, // unit attention AEN permission; true = send AEN, UAAENP : 1, // unit attention AEN permission; true = send AEN,
@@ -865,7 +865,7 @@ typedef struct scsi_modepage_control {
typedef struct scsi_modepage_audio { typedef struct scsi_modepage_audio {
scsi_modepage_header header; scsi_modepage_header header;
LBITFIELD8_4( B_LBITFIELD8_4(
_res2_0 : 1, _res2_0 : 1,
stop_on_track_crossing : 1, // Stop On Track Crossing stop_on_track_crossing : 1, // Stop On Track Crossing
// 0 - stop according transfer length, 1 - stop at end of track // 0 - stop according transfer length, 1 - stop at end of track
@@ -875,7 +875,7 @@ typedef struct scsi_modepage_audio {
uint8 _res3[3]; uint8 _res3[3];
uint8 _obsolete6[2]; uint8 _obsolete6[2];
struct { struct {
LBITFIELD8_2( B_LBITFIELD8_2(
channel : 4, // select channel to connect to this port channel : 4, // select channel to connect to this port
_res0_4 : 4 _res0_4 : 4
); );
@@ -895,7 +895,7 @@ typedef struct scsi_modepage_audio {
typedef struct scsi_cmd_tur { typedef struct scsi_cmd_tur {
uint8 opcode; uint8 opcode;
LBITFIELD8_2( B_LBITFIELD8_2(
_res1_0 : 5, _res1_0 : 5,
lun : 3 lun : 3
); );
@@ -908,13 +908,13 @@ typedef struct scsi_cmd_tur {
typedef struct scsi_cmd_read_toc { typedef struct scsi_cmd_read_toc {
uint8 opcode; uint8 opcode;
LBITFIELD8_4( B_LBITFIELD8_4(
_res1_0 : 1, _res1_0 : 1,
time : 1, // true, to use MSF format, false for LBA format time : 1, // true, to use MSF format, false for LBA format
_res1_2 : 3, _res1_2 : 3,
lun : 3 lun : 3
); );
LBITFIELD8_2( B_LBITFIELD8_2(
format : 4, // see below format : 4, // see below
_res2_4 : 4 _res2_4 : 4
); );
@@ -960,7 +960,7 @@ typedef struct scsi_cd_track_number {
// one track for SCSI_TOC_FORMAT_TOC // one track for SCSI_TOC_FORMAT_TOC
typedef struct scsi_toc_track { typedef struct scsi_toc_track {
uint8 _res0; uint8 _res0;
LBITFIELD8_2( B_LBITFIELD8_2(
control : 4, control : 4,
adr : 4 adr : 4
); );
@@ -1006,13 +1006,13 @@ typedef struct scsi_toc_toc {
typedef struct scsi_cmd_read_subchannel { typedef struct scsi_cmd_read_subchannel {
uint8 opcode; uint8 opcode;
LBITFIELD8_4( B_LBITFIELD8_4(
_res1_0 : 1, _res1_0 : 1,
time : 1, // true, to use MSF format, false for LBA format time : 1, // true, to use MSF format, false for LBA format
_res1_2 : 3, _res1_2 : 3,
lun : 3 lun : 3
); );
LBITFIELD8_3( B_LBITFIELD8_3(
_res2_0 : 6, _res2_0 : 6,
subq : 1, // 1 - return Q sub-channel data subq : 1, // 1 - return Q sub-channel data
_res2_7 : 1 _res2_7 : 1
@@ -1050,7 +1050,7 @@ enum scsi_audio_status {
typedef struct scsi_cd_current_position { typedef struct scsi_cd_current_position {
uint8 format_code; // always 1 uint8 format_code; // always 1
LBITFIELD8_2( B_LBITFIELD8_2(
control : 4, // see scsi_q_control control : 4, // see scsi_q_control
adr : 4 // see scsi_adr adr : 4 // see scsi_adr
); );
@@ -1071,7 +1071,7 @@ typedef struct scsi_cd_current_position {
typedef struct scsi_cmd_play_msf { typedef struct scsi_cmd_play_msf {
uint8 opcode; uint8 opcode;
LBITFIELD8_2( B_LBITFIELD8_2(
_res1_0 : 5, _res1_0 : 5,
lun : 3 lun : 3
); );
@@ -1090,7 +1090,7 @@ typedef struct scsi_cmd_play_msf {
typedef struct scsi_cmd_stop_play { typedef struct scsi_cmd_stop_play {
uint8 opcode; uint8 opcode;
LBITFIELD8_2( B_LBITFIELD8_2(
_res1_0 : 5, _res1_0 : 5,
lun : 3 lun : 3
); );
@@ -1103,12 +1103,12 @@ typedef struct scsi_cmd_stop_play {
typedef struct scsi_cmd_pause_resume { typedef struct scsi_cmd_pause_resume {
uint8 opcode; uint8 opcode;
LBITFIELD8_2( B_LBITFIELD8_2(
_res1_0 : 5, _res1_0 : 5,
lun : 3 lun : 3
); );
uint8 _res2[6]; uint8 _res2[6];
LBITFIELD8_2( B_LBITFIELD8_2(
resume : 1, // 1 for resume, 0 for pause resume : 1, // 1 for resume, 0 for pause
_res8_2 : 7 _res8_2 : 7
); );
@@ -1120,7 +1120,7 @@ typedef struct scsi_cmd_pause_resume {
typedef struct scsi_cmd_scan { typedef struct scsi_cmd_scan {
uint8 opcode; uint8 opcode;
LBITFIELD8_4( B_LBITFIELD8_4(
relative_address : 1, // must be zero relative_address : 1, // must be zero
_res1_1 : 3, _res1_1 : 3,
direct : 1, // direction: 0 forward, 1 backward direct : 1, // direction: 0 forward, 1 backward
@@ -1132,7 +1132,7 @@ typedef struct scsi_cmd_scan {
scsi_cd_track_number track_number; scsi_cd_track_number track_number;
} start; } start;
uint8 _res6[3]; uint8 _res6[3];
LBITFIELD8_2( B_LBITFIELD8_2(
res9_0 : 6, res9_0 : 6,
type : 2 // actual type of <start> (see below) type : 2 // actual type of <start> (see below)
); );
@@ -1152,7 +1152,7 @@ enum scsi_scan_type {
typedef struct scsi_cmd_read_cd { typedef struct scsi_cmd_read_cd {
uint8 opcode; uint8 opcode;
LBITFIELD8_4( B_LBITFIELD8_4(
relative_address : 1, // must be zero relative_address : 1, // must be zero
_res1_1 : 1, _res1_1 : 1,
sector_type : 3, // required sector type (1=CDDA) sector_type : 3, // required sector type (1=CDDA)
@@ -1162,7 +1162,7 @@ typedef struct scsi_cmd_read_cd {
uint8 high_length; uint8 high_length;
uint8 mid_length; uint8 mid_length;
uint8 low_length; uint8 low_length;
LBITFIELD8_6( B_LBITFIELD8_6(
_res9_0 : 1, _res9_0 : 1,
error_field : 2, error_field : 2,
edc_ecc : 1, // include EDC/ECC; includes 8 byte padding for Mode 1 format edc_ecc : 1, // include EDC/ECC; includes 8 byte padding for Mode 1 format
@@ -1171,7 +1171,7 @@ typedef struct scsi_cmd_read_cd {
header_code : 2, header_code : 2,
sync : 1 // if 1, include sync field from sector sync : 1 // if 1, include sync field from sector
); );
LBITFIELD8_2( B_LBITFIELD8_2(
sub_channel_selection : 4, sub_channel_selection : 4,
_res10_4 : 4 _res10_4 : 4
); );
@@ -1206,7 +1206,7 @@ enum scsi_read_cd_sub_channel_selection {
typedef struct scsi_cmd_sync_cache { typedef struct scsi_cmd_sync_cache {
uint8 opcode; uint8 opcode;
LBITFIELD8_4( B_LBITFIELD8_4(
relative_address : 1, // must be zero relative_address : 1, // must be zero
immediately : 1, // 1 - return immediately, 0 - return on completion immediately : 1, // 1 - return immediately, 0 - return on completion
_res1_1 : 3, _res1_1 : 3,
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2013, Axel Dörfler, [email protected]. * Copyright 2010-2015, Axel Dörfler, [email protected].
* Copyright 2009, Michael Lotz, [email protected]. * Copyright 2009, Michael Lotz, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -18,7 +18,7 @@
typedef struct ata_device_infoblock { typedef struct ata_device_infoblock {
union { union {
struct { struct {
LBITFIELD8( B_LBITFIELD16_8(
word_0_bit_0_reserved : 1, word_0_bit_0_reserved : 1,
word_0_bit_1_retired : 1, word_0_bit_1_retired : 1,
response_incomplete : 1, response_incomplete : 1,
@@ -30,7 +30,7 @@ typedef struct ata_device_infoblock {
); );
} ata; } ata;
struct { struct {
LBITFIELD8( B_LBITFIELD16_8(
packet_length : 2, // 0 = 12, 1 = 16 bytes packet_length : 2, // 0 = 12, 1 = 16 bytes
response_incomplete : 1, response_incomplete : 1,
word_0_bit_3_4_reserved : 2, word_0_bit_3_4_reserved : 2,
@@ -57,14 +57,14 @@ typedef struct ata_device_infoblock {
char firmware_revision[8]; char firmware_revision[8];
char model_number[40]; char model_number[40];
LBITFIELD2( B_LBITFIELD16_2(
max_sectors_per_interrupt : 8, max_sectors_per_interrupt : 8,
word_47_bit_8_15_80h : 8 // should be 0x80 word_47_bit_8_15_80h : 8 // should be 0x80
); );
uint16 word_48_reserved; uint16 word_48_reserved;
LBITFIELD9( B_LBITFIELD16_9(
word_49_bit_0_7_retired : 8, word_49_bit_0_7_retired : 8,
dma_supported : 1, dma_supported : 1,
lba_supported : 1, lba_supported : 1,
@@ -76,7 +76,7 @@ typedef struct ata_device_infoblock {
atapi_interleaved_dma_supported : 1 atapi_interleaved_dma_supported : 1
); );
LBITFIELD5( B_LBITFIELD16_5(
standby_timer_value_min : 1, standby_timer_value_min : 1,
word_50_bit_1_obsolete : 1, word_50_bit_1_obsolete : 1,
word_50_bit_2_13_reserved : 12, word_50_bit_2_13_reserved : 12,
@@ -86,7 +86,7 @@ typedef struct ata_device_infoblock {
uint16 word_51_52_obsolete[2]; uint16 word_51_52_obsolete[2];
LBITFIELD4( B_LBITFIELD16_4(
word_53_bit_0_obsolete : 1, word_53_bit_0_obsolete : 1,
word_64_70_valid : 1, word_64_70_valid : 1,
word_88_valid : 1, word_88_valid : 1,
@@ -95,7 +95,7 @@ typedef struct ata_device_infoblock {
uint16 word_54_58_obsolete[5]; uint16 word_54_58_obsolete[5];
LBITFIELD3( B_LBITFIELD16_3(
current_sectors_per_interrupt : 8, current_sectors_per_interrupt : 8,
multiple_sector_setting_valid : 1, multiple_sector_setting_valid : 1,
word_59_bit_9_15_reserved : 7 word_59_bit_9_15_reserved : 7
@@ -104,7 +104,7 @@ typedef struct ata_device_infoblock {
uint32 lba_sector_count; uint32 lba_sector_count;
uint16 word_62_obsolete; uint16 word_62_obsolete;
LBITFIELD8( B_LBITFIELD16_8(
multiword_dma_0_supported : 1, multiword_dma_0_supported : 1,
multiword_dma_1_supported : 1, multiword_dma_1_supported : 1,
multiword_dma_2_supported : 1, multiword_dma_2_supported : 1,
@@ -115,7 +115,7 @@ typedef struct ata_device_infoblock {
word_63_bit_11_15_reserved : 5 word_63_bit_11_15_reserved : 5
); );
LBITFIELD2( B_LBITFIELD16_2(
pio_modes_supported : 8, pio_modes_supported : 8,
word_64_bit_8_15_reserved : 8 word_64_bit_8_15_reserved : 8
); );
@@ -124,7 +124,7 @@ typedef struct ata_device_infoblock {
uint16 recommended_multiword_dma_cycle_time; uint16 recommended_multiword_dma_cycle_time;
uint16 min_pio_cycle_time; uint16 min_pio_cycle_time;
uint16 min_pio_cycle_time_io_ready; uint16 min_pio_cycle_time_io_ready;
LBITFIELD12( B_LBITFIELD16_12(
word_69_bit_0_4_reserved : 5, word_69_bit_0_4_reserved : 5,
supports_read_zero_after_trim : 1, supports_read_zero_after_trim : 1,
supports_ata28_commands : 1, supports_ata28_commands : 1,
@@ -143,14 +143,14 @@ typedef struct ata_device_infoblock {
uint16 atapi_service_command_to_busy_clear_time_ns; uint16 atapi_service_command_to_busy_clear_time_ns;
uint16 word_71_74_reserved[2]; uint16 word_71_74_reserved[2];
LBITFIELD2( B_LBITFIELD16_2(
max_queue_depth_minus_one : 5, max_queue_depth_minus_one : 5,
word_75_bit_5_15_reserved : 11 word_75_bit_5_15_reserved : 11
); );
uint16 word_76_79_reserved[4]; uint16 word_76_79_reserved[4];
LBITFIELD14( B_LBITFIELD16_14(
word_80_bit_0_reserved : 1, word_80_bit_0_reserved : 1,
word_80_bit_1_3_obsolete : 3, word_80_bit_1_3_obsolete : 3,
supports_ata_atapi_4 : 1, supports_ata_atapi_4 : 1,
@@ -169,7 +169,7 @@ typedef struct ata_device_infoblock {
uint16 minor_version; uint16 minor_version;
LBITFIELD16( B_LBITFIELD16_16(
smart_supported : 1, smart_supported : 1,
security_mode_supported : 1, security_mode_supported : 1,
removable_media_supported : 1, removable_media_supported : 1,
@@ -188,7 +188,7 @@ typedef struct ata_device_infoblock {
word_82_bit_15_obsolete : 1 word_82_bit_15_obsolete : 1
); );
LBITFIELD16( B_LBITFIELD16_16(
download_microcode_supported : 1, download_microcode_supported : 1,
read_write_dma_queued_supported : 1, read_write_dma_queued_supported : 1,
compact_flash_assoc_supported : 1, compact_flash_assoc_supported : 1,
@@ -207,7 +207,7 @@ typedef struct ata_device_infoblock {
word_83_bit_15_zero : 1 word_83_bit_15_zero : 1
); );
LBITFIELD9( B_LBITFIELD16_9(
smart_error_logging_supported : 1, smart_error_logging_supported : 1,
smart_self_test_supported : 1, smart_self_test_supported : 1,
media_serial_number_supported : 1, media_serial_number_supported : 1,
@@ -219,7 +219,7 @@ typedef struct ata_device_infoblock {
word_84_bit_15_zero : 1 word_84_bit_15_zero : 1
); );
LBITFIELD16( B_LBITFIELD16_16(
smart_enabled : 1, smart_enabled : 1,
security_mode_enabled : 1, security_mode_enabled : 1,
removable_media_enabled : 1, removable_media_enabled : 1,
@@ -238,7 +238,7 @@ typedef struct ata_device_infoblock {
word_85_bit_15_obsolete : 1 word_85_bit_15_obsolete : 1
); );
LBITFIELD15( B_LBITFIELD16_15(
download_microcode_supported_2 : 1, download_microcode_supported_2 : 1,
read_write_dma_queued_supported_2 : 1, read_write_dma_queued_supported_2 : 1,
compact_flash_assoc_enabled : 1, compact_flash_assoc_enabled : 1,
@@ -256,7 +256,7 @@ typedef struct ata_device_infoblock {
word_86_bit_14_15_reserved : 2 word_86_bit_14_15_reserved : 2
); );
LBITFIELD9( B_LBITFIELD16_9(
smart_error_logging_supported_2 : 1, smart_error_logging_supported_2 : 1,
smart_self_test_supported_2 : 1, smart_self_test_supported_2 : 1,
media_serial_number_valid : 1, media_serial_number_valid : 1,
@@ -268,7 +268,7 @@ typedef struct ata_device_infoblock {
word_87_bit_15_zero : 1 word_87_bit_15_zero : 1
); );
LBITFIELD16( B_LBITFIELD16_16(
ultra_dma_0_supported : 1, ultra_dma_0_supported : 1,
ultra_dma_1_supported : 1, ultra_dma_1_supported : 1,
ultra_dma_2_supported : 1, ultra_dma_2_supported : 1,
@@ -292,7 +292,7 @@ typedef struct ata_device_infoblock {
uint16 current_advanced_power_management_value; uint16 current_advanced_power_management_value;
uint16 master_password_revision_code; uint16 master_password_revision_code;
LBITFIELD5( B_LBITFIELD16_5(
device_0_hardware_reset_result : 8, device_0_hardware_reset_result : 8,
device_1_hardware_reset_result : 5, device_1_hardware_reset_result : 5,
cable_id_detected : 1, cable_id_detected : 1,
@@ -300,7 +300,7 @@ typedef struct ata_device_infoblock {
word_93_bit_15_zero : 1 word_93_bit_15_zero : 1
); );
LBITFIELD2( B_LBITFIELD16_2(
current_acoustic_management_value : 8, current_acoustic_management_value : 8,
recommended_acoustic_management_value : 8 recommended_acoustic_management_value : 8
); );
@@ -310,7 +310,7 @@ typedef struct ata_device_infoblock {
uint16 word_104_reserved; uint16 word_104_reserved;
uint16 max_data_set_management_lba_range_blocks; uint16 max_data_set_management_lba_range_blocks;
LBITFIELD6( B_LBITFIELD16_6(
logical_sectors_per_physical_sector : 4, // 2^x exponent logical_sectors_per_physical_sector : 4, // 2^x exponent
word_106_bit_4_11_reserved : 8, word_106_bit_4_11_reserved : 8,
logical_sector_not_512_bytes : 1, logical_sector_not_512_bytes : 1,
@@ -325,12 +325,12 @@ typedef struct ata_device_infoblock {
uint16 word_119_126_reserved[8]; uint16 word_119_126_reserved[8];
LBITFIELD2( B_LBITFIELD16_2(
removable_media_status_supported_2 : 2, // 1 = supported removable_media_status_supported_2 : 2, // 1 = supported
word_127_bit_2_15_reserved : 14 word_127_bit_2_15_reserved : 14
); );
LBITFIELD9( B_LBITFIELD16_9(
security_supported : 1, security_supported : 1,
security_enabled : 1, security_enabled : 1,
security_locked : 1, security_locked : 1,
@@ -344,7 +344,7 @@ typedef struct ata_device_infoblock {
uint16 word_129_159_vendor_specific[31]; uint16 word_129_159_vendor_specific[31];
LBITFIELD5( B_LBITFIELD16_5(
cfa_max_current_milli_ampers : 12, cfa_max_current_milli_ampers : 12,
cfa_power_mode_1_disabled : 1, cfa_power_mode_1_disabled : 1,
cfa_power_mode_1_required : 1, cfa_power_mode_1_required : 1,
@@ -353,11 +353,11 @@ typedef struct ata_device_infoblock {
); );
uint16 word_161_167_reserved_compact_flash_assoc[7]; uint16 word_161_167_reserved_compact_flash_assoc[7];
LBITFIELD2( B_LBITFIELD16_2(
device_nominal_form_factor : 4, device_nominal_form_factor : 4,
word_168_bits_4_15_reserved : 12 word_168_bits_4_15_reserved : 12
); );
LBITFIELD2( B_LBITFIELD16_2(
data_set_management_support : 1, data_set_management_support : 1,
word_169_bits_1_15_reserved : 15 word_169_bits_1_15_reserved : 15
); );
@@ -366,7 +366,7 @@ typedef struct ata_device_infoblock {
uint16 current_media_serial_number[30]; uint16 current_media_serial_number[30];
uint16 word_206_208_reserved[3]; uint16 word_206_208_reserved[3];
LBITFIELD3( B_LBITFIELD16_3(
logical_sector_offset : 14, logical_sector_offset : 14,
word_209_bit_14_one : 1, word_209_bit_14_one : 1,
word_209_bit_15_zero : 1 word_209_bit_15_zero : 1
@@ -374,7 +374,7 @@ typedef struct ata_device_infoblock {
uint16 word_210_254_reserved[45]; uint16 word_210_254_reserved[45];
LBITFIELD2( B_LBITFIELD16_2(
signature : 8, signature : 8,
checksum : 8 checksum : 8
); );
@@ -1,5 +1,5 @@
/* /*
* Copyright 2004-2006, Haiku, Inc. All RightsReserved. * Copyright 2004-2015, Haiku, Inc. All RightsReserved.
* Copyright 2002/03, Thomas Kurschel. All rights reserved. * Copyright 2002/03, Thomas Kurschel. All rights reserved.
* *
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
@@ -28,7 +28,7 @@
typedef struct tagdevice_infoblock { typedef struct tagdevice_infoblock {
union { // 0 general configuration union { // 0 general configuration
struct { struct {
LBITFIELD8 ( B_LBITFIELD16_8 (
_0_res1 : 1, _0_res1 : 1,
_0_ret1 : 1, _0_ret1 : 1,
response_incomplete : 1, response_incomplete : 1,
@@ -40,7 +40,7 @@ typedef struct tagdevice_infoblock {
); );
} ata; } ata;
struct { struct {
LBITFIELD8 ( B_LBITFIELD16_8 (
packet_size : 2, // 0 - 12 bytes, 1 - 16 bytes packet_size : 2, // 0 - 12 bytes, 1 - 16 bytes
response_incomplete : 1, response_incomplete : 1,
_0_res2 : 2, _0_res2 : 2,
@@ -63,7 +63,7 @@ typedef struct tagdevice_infoblock {
char firmware_version[8]; // 2e char firmware_version[8]; // 2e
char model_number[40]; // 36 char model_number[40]; // 36
uint16 dummy5[2]; // 5e uint16 dummy5[2]; // 5e
LBITFIELD5 ( // 62 (49) capabilities B_LBITFIELD16_5 ( // 62 (49) capabilities
_49_ret1 : 8, _49_ret1 : 8,
DMA_supported : 1, DMA_supported : 1,
LBA_supported : 1, LBA_supported : 1,
@@ -72,13 +72,13 @@ typedef struct tagdevice_infoblock {
); );
uint16 dummy6[1]; // 64 uint16 dummy6[1]; // 64
LBITFIELD2 ( // 66 (51) obsolete: PIO modes? B_LBITFIELD16_2 ( // 66 (51) obsolete: PIO modes?
_51_obs1 : 8, _51_obs1 : 8,
PIO_mode : 8 PIO_mode : 8
); );
uint16 dummy7[1]; // 68 uint16 dummy7[1]; // 68
LBITFIELD3 ( // 6a (53) validity B_LBITFIELD16_3 ( // 6a (53) validity
_54_58_valid : 1, _54_58_valid : 1,
_64_70_valid : 1, _64_70_valid : 1,
_88_valid : 1 _88_valid : 1
@@ -95,7 +95,7 @@ typedef struct tagdevice_infoblock {
uint32 LBA_total_sectors; // 78 (60) uint32 LBA_total_sectors; // 78 (60)
uint16 dummy9[1]; // 7c uint16 dummy9[1]; // 7c
LBITFIELD7 ( // 7e (63) MDMA modes B_LBITFIELD16_7 ( // 7e (63) MDMA modes
MDMA0_supported : 1, MDMA0_supported : 1,
MDMA1_supported : 1, MDMA1_supported : 1,
MDMA2_supported : 1, MDMA2_supported : 1,
@@ -106,13 +106,13 @@ typedef struct tagdevice_infoblock {
); );
uint16 dummy10[11]; // 80 uint16 dummy10[11]; // 80
LBITFIELD2 ( // 96 (75) B_LBITFIELD16_2 ( // 96 (75)
queue_depth : 5, queue_depth : 5,
_75_res1 : 9 _75_res1 : 9
); );
uint16 dummy11[6]; // 98 uint16 dummy11[6]; // 98
LBITFIELD16 ( // a4 (82) supported_command_set B_LBITFIELD16_16 ( // a4 (82) supported_command_set
SMART_supported : 1, SMART_supported : 1,
security_mode_supported : 1, security_mode_supported : 1,
removable_media_supported : 1, removable_media_supported : 1,
@@ -131,7 +131,7 @@ typedef struct tagdevice_infoblock {
NOP_supported : 1, NOP_supported : 1,
_81_obs2 : 1 _81_obs2 : 1
); );
LBITFIELD15 ( // a6 (83) supported_command_sets B_LBITFIELD16_15 ( // a6 (83) supported_command_sets
DOWNLOAD_MICROCODE_supported : 1, DOWNLOAD_MICROCODE_supported : 1,
DMA_QUEUED_supported : 1, DMA_QUEUED_supported : 1,
CFA_supported : 1, CFA_supported : 1,
@@ -150,7 +150,7 @@ typedef struct tagdevice_infoblock {
); );
uint16 dummy12[4]; // a8 (84) uint16 dummy12[4]; // a8 (84)
LBITFIELD15 ( // b0 (88) UDMA modes B_LBITFIELD16_15 ( // b0 (88) UDMA modes
UDMA0_supported : 1, UDMA0_supported : 1,
UDMA1_supported : 1, UDMA1_supported : 1,
UDMA2_supported : 1, UDMA2_supported : 1,
@@ -172,11 +172,11 @@ typedef struct tagdevice_infoblock {
uint64 LBA48_total_sectors; // c8 (100) uint64 LBA48_total_sectors; // c8 (100)
uint16 dummy102[22]; // cc (104) uint16 dummy102[22]; // cc (104)
LBITFIELD2 ( // fc (126) B_LBITFIELD16_2 ( // fc (126)
last_lun : 2, last_lun : 2,
_126_res2 : 14 _126_res2 : 14
); );
LBITFIELD4 ( // fe (127) RMSN support B_LBITFIELD16_4 ( // fe (127) RMSN support
_127_RMSN_support : 2,// 0 = not supported, 1 = supported, 3, 4 = reserved _127_RMSN_support : 2,// 0 = not supported, 1 = supported, 3, 4 = reserved
_127_res2 : 6, _127_res2 : 6,
device_write_protect: 2, device_write_protect: 2,
@@ -1,5 +1,5 @@
/* /*
* Copyright 2004-2007, Haiku, Inc. All RightsReserved. * Copyright 2004-2015, Haiku, Inc. All RightsReserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Author: * Author:
@@ -8,10 +8,13 @@
#ifndef _SCSI_COMMANDS_H_ #ifndef _SCSI_COMMANDS_H_
#define _SCSI_COMMANDS_H_ #define _SCSI_COMMANDS_H_
/*! Definitions for SCSI commands, structures etc. */
#include <lendian_bitfield.h> #include <lendian_bitfield.h>
/*! Definitions for SCSI commands, structures etc. */
/* References: /* References:
* http://www.t10.org/ftp/t10/drafts/rbc/rbc-r10a.pdf * http://www.t10.org/ftp/t10/drafts/rbc/rbc-r10a.pdf
* http://www.t10.org/ftp/t10/drafts/rbc/rbc-a101.pdf * http://www.t10.org/ftp/t10/drafts/rbc/rbc-a101.pdf
@@ -190,7 +193,7 @@ typedef scsi_cmd_generic_6 scsi_cmd_rw_6;
/* READ_10 / WRITE_10 */ /* READ_10 / WRITE_10 */
typedef struct { typedef struct {
uint8 opcode; uint8 opcode;
LBITFIELD8_5( B_LBITFIELD8_5(
relative_address : 1, // relative address relative_address : 1, // relative address
_res1_1 : 2, _res1_1 : 2,
force_unit_access : 1, // force unit access (1 = safe, cacheless access) force_unit_access : 1, // force unit access (1 = safe, cacheless access)
@@ -5,8 +5,10 @@
#ifndef HID_DATA_TYPES_H #ifndef HID_DATA_TYPES_H
#define HID_DATA_TYPES_H #define HID_DATA_TYPES_H
#include <lendian_bitfield.h> #include <lendian_bitfield.h>
#define ITEM_TYPE_MAIN 0x0 #define ITEM_TYPE_MAIN 0x0
#define ITEM_TYPE_GLOBAL 0x1 #define ITEM_TYPE_GLOBAL 0x1
#define ITEM_TYPE_LOCAL 0x2 #define ITEM_TYPE_LOCAL 0x2
@@ -68,7 +70,7 @@
typedef struct item_prefix { typedef struct item_prefix {
LBITFIELD8_3( B_LBITFIELD8_3(
size : 2, size : 2,
type : 2, type : 2,
tag : 4 tag : 4
@@ -99,7 +101,7 @@ typedef struct long_item {
typedef struct main_item_data { typedef struct main_item_data {
LBITFIELD9( B_LBITFIELD16_9(
data_constant : 1, data_constant : 1,
array_variable : 1, array_variable : 1,
relative : 1, relative : 1,