本文整理汇总了C++中RsSetFlagBits函数的典型用法代码示例。如果您正苦于以下问题:C++ RsSetFlagBits函数的具体用法?C++ RsSetFlagBits怎么用?C++ RsSetFlagBits使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RsSetFlagBits函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RsDoQwordSpaceDescriptor
ASL_RESOURCE_NODE *
RsDoQwordSpaceDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ACPI_PARSE_OBJECT *MinOp = NULL;
ACPI_PARSE_OBJECT *MaxOp = NULL;
ACPI_PARSE_OBJECT *LengthOp = NULL;
ACPI_PARSE_OBJECT *GranOp = NULL;
ASL_RESOURCE_NODE *Rnode;
UINT8 *OptionalFields;
UINT16 StringLength = 0;
UINT32 OptionIndex = 0;
UINT32 i;
BOOLEAN ResSourceIndex = FALSE;
InitializerOp = Op->Asl.Child;
StringLength = RsGetStringDataLength (InitializerOp);
Rnode = RsAllocateResourceNode (
sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
Descriptor = Rnode->Buffer;
Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64;
/*
* Initial descriptor length -- may be enlarged if there are
* optional fields present
*/
OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64);
Descriptor->Address64.ResourceLength = (UINT16)
(sizeof (AML_RESOURCE_ADDRESS64) -
sizeof (AML_RESOURCE_LARGE_HEADER));
/* Process all child initialization nodes */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
case 0: /* Resource Type */
Descriptor->Address64.ResourceType =
(UINT8) InitializerOp->Asl.Value.Integer;
break;
case 1: /* Resource Usage */
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1);
break;
case 2: /* DecodeType */
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1);
break;
case 3: /* MinType */
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2);
break;
case 4: /* MaxType */
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3);
break;
case 5: /* Type-Specific flags */
Descriptor->Address64.SpecificFlags =
(UINT8) InitializerOp->Asl.Value.Integer;
break;
case 6: /* Address Granularity */
Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
GranOp = InitializerOp;
break;
case 7: /* Min Address */
Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
MinOp = InitializerOp;
break;
case 8: /* Max Address */
Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
//.........这里部分代码省略.........
示例2: RsDoInterruptDescriptor
ASL_RESOURCE_NODE *
RsDoInterruptDescriptor (
ASL_RESOURCE_INFO *Info)
{
AML_RESOURCE *Descriptor;
AML_RESOURCE *Rover = NULL;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
UINT16 StringLength = 0;
UINT32 OptionIndex = 0;
UINT32 CurrentByteOffset;
UINT32 i;
BOOLEAN HasResSourceIndex = FALSE;
UINT8 ResSourceIndex = 0;
UINT8 *ResSourceString = NULL;
InitializerOp = Info->DescriptorTypeOp->Asl.Child;
CurrentByteOffset = Info->CurrentByteOffset;
StringLength = RsGetStringDataLength (InitializerOp);
/* Count the interrupt numbers */
for (i = 0; InitializerOp; i++)
{
InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
if (i <= 6)
{
if (i == 3 &&
InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
/*
* ResourceSourceIndex was specified, always make room for
* it, even if the ResourceSource was omitted.
*/
OptionIndex++;
}
continue;
}
OptionIndex += 4;
}
InitializerOp = Info->DescriptorTypeOp->Asl.Child;
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_EXTENDED_IRQ) +
1 + OptionIndex + StringLength);
Descriptor = Rnode->Buffer;
Descriptor->ExtendedIrq.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_IRQ;
/*
* Initial descriptor length -- may be enlarged if there are
* optional fields present
*/
Descriptor->ExtendedIrq.ResourceLength = 2; /* Flags and table length byte */
Descriptor->ExtendedIrq.InterruptCount = 0;
Rover = ACPI_CAST_PTR (AML_RESOURCE,
(&(Descriptor->ExtendedIrq.Interrupts[0])));
/* Process all child initialization nodes */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
case 0: /* Resource Usage (Default: consumer (1) */
RsSetFlagBits (&Descriptor->ExtendedIrq.Flags, InitializerOp, 0, 1);
break;
case 1: /* Interrupt Type (or Mode - edge/level) */
RsSetFlagBits (&Descriptor->ExtendedIrq.Flags, InitializerOp, 1, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtendedIrq.Flags), 1);
break;
case 2: /* Interrupt Level (or Polarity - Active high/low) */
RsSetFlagBits (&Descriptor->ExtendedIrq.Flags, InitializerOp, 2, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTLEVEL,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtendedIrq.Flags), 2);
break;
case 3: /* Share Type - Default: exclusive (0) */
RsSetFlagBits (&Descriptor->ExtendedIrq.Flags, InitializerOp, 3, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtendedIrq.Flags), 3);
break;
case 4: /* ResSourceIndex [Optional Field - BYTE] */
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
HasResSourceIndex = TRUE;
ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
//.........这里部分代码省略.........
示例3: RsDoIrqDescriptor
ASL_RESOURCE_NODE *
RsDoIrqDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
UINT32 Interrupts = 0;
UINT16 IrqMask = 0;
UINT32 i;
InitializerOp = Op->Asl.Child;
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ));
/* Length = 3 (with flag byte) */
Descriptor = Rnode->Buffer;
Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
(ASL_RDESC_IRQ_SIZE + 0x01);
/* Process all child initialization nodes */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
case 0: /* Interrupt Type (or Mode - edge/level) */
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 0, 1);
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 0);
break;
case 1: /* Interrupt Level (or Polarity - Active high/low) */
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 3, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTLEVEL,
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 3);
break;
case 2: /* Share Type - Default: exclusive (0) */
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 4, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4);
break;
case 3: /* Name */
UtAttachNamepathToOwner (Op, InitializerOp);
break;
default:
/* All IRQ bytes are handled here, after the flags and name */
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
/* Up to 16 interrupts can be specified in the list */
Interrupts++;
if (Interrupts > 16)
{
AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST,
InitializerOp, NULL);
return (Rnode);
}
/* Only interrupts 0-15 are allowed (mask is 16 bits) */
if (InitializerOp->Asl.Value.Integer > 15)
{
AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER,
InitializerOp, NULL);
}
else
{
IrqMask |= (1 << (UINT8) InitializerOp->Asl.Value.Integer);
}
}
/* Case 4: First IRQ value in list */
if (i == 4)
{
/* Check now for duplicates in list */
RsCheckListForDuplicates (InitializerOp);
/* Create a named field at the start of the list */
RsCreateWordField (InitializerOp, ACPI_RESTAG_INTERRUPT,
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
}
break;
}
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
//.........这里部分代码省略.........
示例4: RsDoDmaDescriptor
ASL_RESOURCE_NODE *
RsDoDmaDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
UINT32 i;
UINT8 DmaChannelMask = 0;
UINT8 DmaChannels = 0;
InitializerOp = Op->Asl.Child;
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_DMA));
Descriptor = Rnode->Buffer;
Descriptor->Dma.DescriptorType = ACPI_RESOURCE_NAME_DMA |
ASL_RDESC_DMA_SIZE;
/* Process all child initialization nodes */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
case 0: /* DMA type */
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0);
RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_DMATYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5, 2);
break;
case 1: /* Bus Master */
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 2, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_BUSMASTER,
CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 2);
break;
case 2: /* Xfer Type (transfer width) */
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 0, 0);
RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_XFERTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0, 2);
break;
case 3: /* Name */
UtAttachNamepathToOwner (Op, InitializerOp);
break;
default:
/* All DMA channel bytes are handled here, after flags and name */
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
/* Up to 8 channels can be specified in the list */
DmaChannels++;
if (DmaChannels > 8)
{
AslError (ASL_ERROR, ASL_MSG_DMA_LIST,
InitializerOp, NULL);
return (Rnode);
}
/* Only DMA channels 0-7 are allowed (mask is 8 bits) */
if (InitializerOp->Asl.Value.Integer > 7)
{
AslError (ASL_ERROR, ASL_MSG_DMA_CHANNEL,
InitializerOp, NULL);
}
/* Build the mask */
DmaChannelMask |=
(1 << ((UINT8) InitializerOp->Asl.Value.Integer));
}
if (i == 4) /* case 4: First DMA byte */
{
/* Check now for duplicates in list */
RsCheckListForDuplicates (InitializerOp);
/* Create a named field at the start of the list */
RsCreateByteField (InitializerOp, ACPI_RESTAG_DMA,
CurrentByteOffset +
ASL_RESDESC_OFFSET (Dma.DmaChannelMask));
}
break;
}
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
//.........这里部分代码省略.........
示例5: RsDoExtendedSpaceDescriptor
ASL_RESOURCE_NODE *
RsDoExtendedSpaceDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ACPI_PARSE_OBJECT *MinOp = NULL;
ACPI_PARSE_OBJECT *MaxOp = NULL;
ACPI_PARSE_OBJECT *LengthOp = NULL;
ACPI_PARSE_OBJECT *GranOp = NULL;
ASL_RESOURCE_NODE *Rnode;
UINT16 StringLength = 0;
UINT32 i;
InitializerOp = Op->Asl.Child;
StringLength = RsGetStringDataLength (InitializerOp);
Rnode = RsAllocateResourceNode (
sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
Descriptor = Rnode->Buffer;
Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
Descriptor->ExtAddress64.ResourceLength = (UINT16)
(sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
sizeof (AML_RESOURCE_LARGE_HEADER));
/* Process all child initialization nodes */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
case 0: /* Resource Type */
Descriptor->ExtAddress64.ResourceType =
(UINT8) InitializerOp->Asl.Value.Integer;
break;
case 1: /* Resource Usage */
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1);
break;
case 2: /* DecodeType */
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
break;
case 3: /* MinType */
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
break;
case 4: /* MaxType */
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
break;
case 5: /* Type-Specific flags */
Descriptor->ExtAddress64.SpecificFlags =
(UINT8) InitializerOp->Asl.Value.Integer;
break;
case 6: /* Address Granularity */
Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
GranOp = InitializerOp;
break;
case 7: /* Min Address */
Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
MinOp = InitializerOp;
break;
case 8: /* Max Address */
Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
MaxOp = InitializerOp;
break;
case 9: /* Translation Offset */
//.........这里部分代码省略.........
示例6: RsDoIoDescriptor
ASL_RESOURCE_NODE *
RsDoIoDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ACPI_PARSE_OBJECT *MinOp = NULL;
ACPI_PARSE_OBJECT *MaxOp = NULL;
ACPI_PARSE_OBJECT *LengthOp = NULL;
ACPI_PARSE_OBJECT *AlignOp = NULL;
ASL_RESOURCE_NODE *Rnode;
UINT32 i;
InitializerOp = Op->Asl.Child;
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IO));
Descriptor = Rnode->Buffer;
Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_IO |
ASL_RDESC_IO_SIZE;
/* Process all child initialization nodes */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
case 0: /* Decode size */
RsSetFlagBits (&Descriptor->Io.Flags, InitializerOp, 0, 1);
RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Flags), 0);
break;
case 1: /* Min Address */
Descriptor->Io.Minimum =
(UINT16) InitializerOp->Asl.Value.Integer;
RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum));
MinOp = InitializerOp;
break;
case 2: /* Max Address */
Descriptor->Io.Maximum =
(UINT16) InitializerOp->Asl.Value.Integer;
RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum));
MaxOp = InitializerOp;
break;
case 3: /* Alignment */
Descriptor->Io.Alignment =
(UINT8) InitializerOp->Asl.Value.Integer;
RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Alignment));
AlignOp = InitializerOp;
break;
case 4: /* Length */
Descriptor->Io.AddressLength =
(UINT8) InitializerOp->Asl.Value.Integer;
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.AddressLength));
LengthOp = InitializerOp;
break;
case 5: /* Name */
UtAttachNamepathToOwner (Op, InitializerOp);
break;
default:
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
break;
}
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
/* Validate the Min/Max/Len/Align values */
RsSmallAddressCheck (ACPI_RESOURCE_NAME_IO,
Descriptor->Io.Minimum,
Descriptor->Io.Maximum,
Descriptor->Io.AddressLength,
Descriptor->Io.Alignment,
MinOp, MaxOp, LengthOp, AlignOp, Op);
return (Rnode);
}
示例7: RsDoSpiSerialBusDescriptor
ASL_RESOURCE_NODE *
RsDoSpiSerialBusDescriptor (
ASL_RESOURCE_INFO *Info)
{
AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
char *ResourceSource = NULL;
UINT8 *VendorData = NULL;
UINT16 ResSourceLength;
UINT16 VendorLength;
UINT16 DescriptorSize;
UINT32 CurrentByteOffset;
UINT32 i;
InitializerOp = Info->DescriptorTypeOp->Asl.Child;
CurrentByteOffset = Info->CurrentByteOffset;
/*
* Calculate lengths for fields that have variable length:
* 1) Resource Source string
* 2) Vendor Data buffer
*/
ResSourceLength = RsGetStringDataLength (InitializerOp);
VendorLength = RsGetBufferDataLength (InitializerOp);
DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_SPI_SERIALBUS) +
ResSourceLength + VendorLength;
/* Allocate the local resource node and initialize */
Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER));
Descriptor = Rnode->Buffer;
Descriptor->SpiSerialBus.ResourceLength = DescriptorSize;
Descriptor->SpiSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
Descriptor->SpiSerialBus.RevisionId = AML_RESOURCE_SPI_REVISION;
Descriptor->SpiSerialBus.TypeRevisionId = AML_RESOURCE_SPI_TYPE_REVISION;
Descriptor->SpiSerialBus.Type = AML_RESOURCE_SPI_SERIALBUSTYPE;
Descriptor->SpiSerialBus.TypeDataLength = AML_RESOURCE_SPI_MIN_DATA_LEN + VendorLength;
/* Build pointers to optional areas */
VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_SPI_SERIALBUS));
ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);
DbgPrint (ASL_DEBUG_OUTPUT,
"%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, TypLen: %.2X\n",
"SpiSerialBus", Descriptor->SpiSerialBus.ResourceLength,
(UINT16) sizeof (AML_RESOURCE_SPI_SERIALBUS), ResSourceLength,
VendorLength, Descriptor->SpiSerialBus.TypeDataLength);
/* Process all child initialization nodes */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
case 0: /* Device Selection [WORD] (_ADR) */
Descriptor->SpiSerialBus.DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer;
RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS,
CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DeviceSelection));
break;
case 1: /* Device Polarity [Flag] (_DPL) */
RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 1, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_DEVICEPOLARITY,
CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 1);
break;
case 2: /* Wire Mode [Flag] (_MOD) */
RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 0);
break;
case 3: /* Device Bit Length [BYTE] (_LEN) */
Descriptor->SpiSerialBus.DataBitLength = (UINT8) InitializerOp->Asl.Value.Integer;
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DataBitLength));
break;
case 4: /* Slave Mode [Flag] (_SLV) */
RsSetFlagBits (&Descriptor->SpiSerialBus.Flags, InitializerOp, 0, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_SLAVEMODE,
CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.Flags), 0);
break;
case 5: /* Connection Speed [DWORD] (_SPE) */
Descriptor->SpiSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ConnectionSpeed));
break;
//.........这里部分代码省略.........
示例8: RsDoUartSerialBusDescriptor
ASL_RESOURCE_NODE *
RsDoUartSerialBusDescriptor (
ASL_RESOURCE_INFO *Info)
{
AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
char *ResourceSource = NULL;
UINT8 *VendorData = NULL;
UINT16 ResSourceLength;
UINT16 VendorLength;
UINT16 DescriptorSize;
UINT32 CurrentByteOffset;
UINT32 i;
InitializerOp = Info->DescriptorTypeOp->Asl.Child;
CurrentByteOffset = Info->CurrentByteOffset;
/*
* Calculate lengths for fields that have variable length:
* 1) Resource Source string
* 2) Vendor Data buffer
*/
ResSourceLength = RsGetStringDataLength (InitializerOp);
VendorLength = RsGetBufferDataLength (InitializerOp);
DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_UART_SERIALBUS) +
ResSourceLength + VendorLength;
/* Allocate the local resource node and initialize */
Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER));
Descriptor = Rnode->Buffer;
Descriptor->UartSerialBus.ResourceLength = DescriptorSize;
Descriptor->UartSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
Descriptor->UartSerialBus.RevisionId = AML_RESOURCE_UART_REVISION;
Descriptor->UartSerialBus.TypeRevisionId = AML_RESOURCE_UART_TYPE_REVISION;
Descriptor->UartSerialBus.Type = AML_RESOURCE_UART_SERIALBUSTYPE;
Descriptor->UartSerialBus.TypeDataLength = AML_RESOURCE_UART_MIN_DATA_LEN + VendorLength;
/* Build pointers to optional areas */
VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_UART_SERIALBUS));
ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);
DbgPrint (ASL_DEBUG_OUTPUT,
"%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, TypLen: %.2X\n",
"UartSerialBus", Descriptor->UartSerialBus.ResourceLength,
(UINT16) sizeof (AML_RESOURCE_UART_SERIALBUS), ResSourceLength,
VendorLength, Descriptor->UartSerialBus.TypeDataLength);
/* Process all child initialization nodes */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
case 0: /* Connection Speed (Baud Rate) [DWORD] (_SPE) */
Descriptor->UartSerialBus.DefaultBaudRate = (UINT32) InitializerOp->Asl.Value.Integer;
RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.DefaultBaudRate));
break;
case 1: /* Bits Per Byte [Flags] (_LEN) */
RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 4, 3);
RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 4, 3);
break;
case 2: /* Stop Bits [Flags] (_STB) */
RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 2, 1);
RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_STOPBITS,
CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 2, 2);
break;
case 3: /* Lines In Use [BYTE] (_LIN) */
Descriptor->UartSerialBus.LinesEnabled = (UINT8) InitializerOp->Asl.Value.Integer;
RsCreateByteField (InitializerOp, ACPI_RESTAG_LINE,
CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.LinesEnabled));
break;
case 4: /* Endianness [Flag] (_END) */
RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 7, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_ENDIANNESS,
CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 7);
break;
case 5: /* Parity [BYTE] (_PAR) */
Descriptor->UartSerialBus.Parity = (UINT8) InitializerOp->Asl.Value.Integer;
RsCreateByteField (InitializerOp, ACPI_RESTAG_PARITY,
CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.Parity));
break;
//.........这里部分代码省略.........
示例9: RsDoStartDependentDescriptor
ASL_RESOURCE_NODE *
RsDoStartDependentDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
ASL_RESOURCE_NODE *PreviousRnode;
ASL_RESOURCE_NODE *NextRnode;
UINT32 i;
UINT8 State;
InitializerOp = Op->Asl.Child;
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT));
PreviousRnode = Rnode;
Descriptor = Rnode->Buffer;
/* Descriptor has priority byte */
Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT |
(ASL_RDESC_ST_DEPEND_SIZE + 0x01);
/* Process all child initialization nodes */
State = ACPI_RSTATE_START_DEPENDENT;
for (i = 0; InitializerOp; i++)
{
switch (i)
{
case 0: /* Compatibility Priority */
if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
{
AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY,
InitializerOp, NULL);
}
RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 0, 0);
break;
case 1: /* Performance/Robustness Priority */
if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
{
AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE,
InitializerOp, NULL);
}
RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 2, 0);
break;
default:
NextRnode = RsDoOneResourceDescriptor (InitializerOp,
CurrentByteOffset, &State);
/*
* Update current byte offset to indicate the number of bytes from the
* start of the buffer. Buffer can include multiple descriptors, we
* must keep track of the offset of not only each descriptor, but each
* element (field) within each descriptor as well.
*/
CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode,
NextRnode);
break;
}
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
return (Rnode);
}
示例10: RsDoMemory32FixedDescriptor
ASL_RESOURCE_NODE *
RsDoMemory32FixedDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
UINT32 i;
InitializerOp = Op->Asl.Child;
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_MEMORY32));
Descriptor = Rnode->Buffer;
Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32;
Descriptor->FixedMemory32.ResourceLength = 9;
/* Process all child initialization nodes */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
case 0: /* Read/Write type */
RsSetFlagBits (&Descriptor->FixedMemory32.Flags, InitializerOp, 0, 1);
RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Flags), 0);
break;
case 1: /* Address */
Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer;
RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address));
break;
case 2: /* Length */
Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength));
break;
case 3: /* Name */
UtAttachNamepathToOwner (Op, InitializerOp);
break;
default:
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
break;
}
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
return (Rnode);
}
示例11: RsDoMemory32Descriptor
ASL_RESOURCE_NODE *
RsDoMemory32Descriptor (
ASL_RESOURCE_INFO *Info)
{
AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ACPI_PARSE_OBJECT *MinOp = NULL;
ACPI_PARSE_OBJECT *MaxOp = NULL;
ACPI_PARSE_OBJECT *LengthOp = NULL;
ACPI_PARSE_OBJECT *AlignOp = NULL;
ASL_RESOURCE_NODE *Rnode;
UINT32 CurrentByteOffset;
UINT32 i;
InitializerOp = Info->DescriptorTypeOp->Asl.Child;
CurrentByteOffset = Info->CurrentByteOffset;
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY32));
Descriptor = Rnode->Buffer;
Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32;
Descriptor->Memory32.ResourceLength = 17;
/* Process all child initialization nodes */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
case 0: /* Read/Write type */
RsSetFlagBits (&Descriptor->Memory32.Flags, InitializerOp, 0, 1);
RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Flags), 0);
break;
case 1: /* Min Address */
Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum));
MinOp = InitializerOp;
break;
case 2: /* Max Address */
Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum));
MaxOp = InitializerOp;
break;
case 3: /* Alignment */
Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
RsCreateDwordField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment));
AlignOp = InitializerOp;
break;
case 4: /* Length */
Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength));
LengthOp = InitializerOp;
break;
case 5: /* Name */
UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
break;
default:
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
break;
}
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
/* Validate the Min/Max/Len/Align values */
RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32,
Descriptor->Memory32.Minimum,
Descriptor->Memory32.Maximum,
Descriptor->Memory32.AddressLength,
Descriptor->Memory32.Alignment,
MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp);
return (Rnode);
}