3596|2

77

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

求助 流小驱动开发 如何设置RGB格式 [复制链接]

各位大哥大姐,帮帮忙啦
修改的《windows驱动开发技术详解》第20章的例子,上周终于跑起来了。
现在的问题是:graphEdit渲染直接连接到VMR,调试发现是调用的UYVY格式数据。
老板要改成RGB格式,我直接将UYVY格式注释掉,再用GraphEdit渲染时引脚和VMR之间多了一个color space transactor。但只现在一写类驱动传入的显卡地址就死机。
请问:1:应该如何改成支持RGB格式?
2:我改的哪里出错了,为什么会接受到一个不可以写的地址?

另外发现:此驱动无法在XP SP3下安装,SP2和Vista下安装均正常,有哪位大侠知道是什么原因?
感激不尽^_^

最新回复

怎样才能把帖子删掉?  详情 回复 发表于 2009-9-1 16:40
点赞 关注

回复
举报

77

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
没人理我 上代码:
  1. NTSTATUS
  2. DriverEntry(
  3.     IN PDRIVER_OBJECT  DriverObject,
  4.     IN PUNICODE_STRING RegistryPath
  5.     )
  6. {
  7.     NTSTATUS                                   status;
  8.         HW_INITIALIZATION_DATA        HwInitData;

  9.         KdPrint(("进入DriveEntry函数\n"));

  10.         RtlZeroMemory(&HwInitData,sizeof(HwInitData));
  11.         HwInitData.HwInitializationDataSize        = sizeof(HwInitData);
  12.         HwInitData.HwInterrupt                                = NULL;
  13.         HwInitData.HwReceivePacket                        = AdapterReceivePacket;
  14.         HwInitData.HwCancelPacket                        = AdapterCancelPacket;
  15.         HwInitData.HwRequestTimeoutHandler        = AdapterTimeoutPacket;
  16.         HwInitData.DeviceExtensionSize                = sizeof(HW_DEVICE_EXTENSION);
  17.         HwInitData.PerRequestExtensionSize        = sizeof(SRB_EXTENSION);
  18.         HwInitData.FilterInstanceExtensionSize        = 0;
  19.         HwInitData.PerStreamExtensionSize        = sizeof(STREAMEX);
  20.         HwInitData.BusMasterDMA                                = FALSE;
  21.         HwInitData.Dma24BitAddresses                = FALSE;
  22.         HwInitData.BufferAlignment                        = 3;
  23.         HwInitData.DmaBufferSize                        = 0;
  24.         HwInitData.TurnOffSynchronization        = TRUE;

  25.         status        = StreamClassRegisterAdapter(DriverObject ,RegistryPath ,&HwInitData);

  26.         KdPrint(("退出DriverEntry函数\n"));
  27.     return status;
  28. }
  29. VOID AdapterReceivePacket(IN PHW_STREAM_REQUEST_BLOCK        pSrb)
  30. {
  31.     PHW_DEVICE_EXTENSION    pHwDevExt = ((PHW_DEVICE_EXTENSION)pSrb->HwDeviceExtension);
  32.     BOOL                    Busy;

  33.     DEBUG_ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL);

  34.     KdPrint(("TestCap: Receiving Adapter  SRB %8x, %x\n", pSrb, pSrb->Command));

  35.     // The very first time through, we need to initialize the adapter spinlock
  36.     // and queue
  37.     if (!pHwDevExt->AdapterQueueInitialized)
  38.         {
  39.         InitializeListHead (&pHwDevExt->AdapterSRBList);
  40.         KeInitializeSpinLock (&pHwDevExt->AdapterSpinLock);
  41.         pHwDevExt->AdapterQueueInitialized = TRUE;
  42.         pHwDevExt->ProcessingAdapterSRB = FALSE;
  43.     }

  44.     //
  45.     // If we're already processing an SRB, add it to the queue
  46.     //
  47.     Busy = AddToListIfBusy (
  48.                     pSrb,
  49.                     &pHwDevExt->AdapterSpinLock,
  50.                     &pHwDevExt->ProcessingAdapterSRB,
  51.                     &pHwDevExt->AdapterSRBList);

  52.     if (Busy)
  53.         {
  54.         return;
  55.     }

  56.     //
  57.     // This will run until the queue is empty
  58.     //
  59.     while (TRUE)
  60.         {
  61.         //
  62.         // Assume success
  63.         //
  64.         pSrb->Status = STATUS_SUCCESS;

  65.         //
  66.         // determine the type of packet.
  67.         //

  68.         switch (pSrb->Command)
  69.         {
  70.         case SRB_INITIALIZE_DEVICE:

  71.             // open the device
  72.             HwInitialize(pSrb);

  73.             break;

  74.         case SRB_UNINITIALIZE_DEVICE:

  75.             // close the device.
  76.             HwUnInitialize(pSrb);

  77.             break;

  78.         case SRB_OPEN_STREAM:

  79.             // open a stream
  80.             AdapterOpenStream(pSrb);

  81.             break;

  82.         case SRB_CLOSE_STREAM:

  83.             // close a stream
  84.             AdapterCloseStream(pSrb);

  85.             break;

  86.         case SRB_GET_STREAM_INFO:

  87.             //
  88.             // return a block describing all the streams
  89.             //
  90.             AdapterStreamInfo(pSrb);

  91.             break;

  92.         case SRB_GET_DATA_INTERSECTION:

  93.             //
  94.             // Return a format, given a range
  95.             //
  96.             AdapterFormatFromRange(pSrb);

  97.             break;

  98.         case SRB_OPEN_DEVICE_INSTANCE:
  99.         case SRB_CLOSE_DEVICE_INSTANCE:

  100.             //
  101.             // We should never get these since this is a single instance device
  102.             //
  103.             pSrb->Status = STATUS_NOT_IMPLEMENTED;
  104.             break;

  105.         case SRB_GET_DEVICE_PROPERTY:

  106.             //
  107.             // Get adapter wide properties
  108.             //
  109.             AdapterGetProperty (pSrb);
  110.             break;

  111.         case SRB_SET_DEVICE_PROPERTY:

  112.             //
  113.             // Set adapter wide properties
  114.             //
  115.             AdapterSetProperty (pSrb);
  116.             break;

  117.         case SRB_PAGING_OUT_DRIVER:

  118.             //
  119.             // The driver is being paged out
  120.             // Disable Interrupts if you have them!
  121.             //
  122.             KdPrint(("'Testcap: Receiving SRB_PAGING_OUT_DRIVER -- SRB=%x\n", pSrb));
  123.             break;

  124.         case SRB_CHANGE_POWER_STATE:

  125.             //
  126.             // Changing the device power state, D0 ... D3
  127.             //
  128.             KdPrint(("'Testcap: Receiving SRB_CHANGE_POWER_STATE ------ SRB=%x\n", pSrb));
  129.             AdapterPowerState(pSrb);
  130.             break;

  131.         case SRB_INITIALIZATION_COMPLETE:

  132.             //
  133.             // Stream class has finished initialization.
  134.             // Now create DShow Medium interface BLOBs.
  135.             // This needs to be done at low priority since it uses the registry
  136.             //
  137.             KdPrint(("'Testcap: Receiving SRB_INITIALIZATION_COMPLETE-- SRB=%x\n", pSrb));

  138.             break;


  139.         case SRB_UNKNOWN_DEVICE_COMMAND:
  140.         default:

  141.             //
  142.             // this is a request that we do not understand.  Indicate invalid
  143.             // command and complete the request
  144.             //
  145.             pSrb->Status = STATUS_NOT_IMPLEMENTED;

  146.         }

  147.         //
  148.         // Indicate back to the Stream Class that we're done with this SRB
  149.         //
  150.         CompleteDeviceSRB (pSrb);

  151.         //
  152.         // See if there's anything else on the queue
  153.         //
  154.         Busy = RemoveFromListIfAvailable (
  155.                 &pSrb,
  156.                 &pHwDevExt->AdapterSpinLock,
  157.                 &pHwDevExt->ProcessingAdapterSRB,
  158.                 &pHwDevExt->AdapterSRBList);

  159.         if (!Busy)
  160.                 {
  161.             break;
  162.         }
  163.     } // end of while there's anything in the queue
  164. }
  165. BOOLEAN        STREAMAPI HwInitialize ( IN OUT PHW_STREAM_REQUEST_BLOCK pSrb )
  166. {
  167.     STREAM_PHYSICAL_ADDRESS     adr;
  168.     ULONG                       Size;
  169.     PUCHAR                      pDmaBuf;
  170.     int                         j;

  171.     PPORT_CONFIGURATION_INFORMATION ConfigInfo = pSrb->CommandData.ConfigInfo;

  172.     PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)ConfigInfo->HwDeviceExtension;

  173.         KdPrint(("Enter the function of 'HwInitialize'\n"));

  174.     KdPrint(("TestCap: Number of access ranges = %lx\n", ConfigInfo->NumberOfAccessRanges));
  175.     KdPrint(("TestCap: Memory Range = %lx\n", pHwDevExt->ioBaseLocal));
  176.     KdPrint(("TestCap: IRQ = %lx\n", ConfigInfo->BusInterruptLevel));

  177.     if (ConfigInfo->NumberOfAccessRanges != 0)
  178.         {
  179.         pHwDevExt->ioBaseLocal = (PULONG)(ULONG_PTR)(ConfigInfo->AccessRanges[1].RangeStart.LowPart);
  180.     }               
  181.     pHwDevExt->Irq  = (USHORT)(ConfigInfo->BusInterruptLevel);

  182.     ConfigInfo->StreamDescriptorSize = sizeof (HW_STREAM_HEADER) +
  183.                 DRIVER_STREAM_COUNT * sizeof (HW_STREAM_INFORMATION);

  184.     pDmaBuf = StreamClassGetDmaBuffer(pHwDevExt);

  185.     adr = StreamClassGetPhysicalAddress(pHwDevExt,
  186.             NULL, pDmaBuf, DmaBuffer, &Size);

  187.     // Init VideoProcAmp properties
  188.     pHwDevExt->Brightness = BrightnessDefault;
  189.     pHwDevExt->BrightnessFlags = KSPROPERTY_VIDEOPROCAMP_FLAGS_AUTO;
  190.     pHwDevExt->Contrast = ContrastDefault;
  191.     pHwDevExt->ContrastFlags = KSPROPERTY_VIDEOPROCAMP_FLAGS_AUTO;
  192.     pHwDevExt->ColorEnable = ColorEnableDefault;
  193.     pHwDevExt->ColorEnableFlags = KSPROPERTY_VIDEOPROCAMP_FLAGS_MANUAL;

  194.     // Init CameraControl properties
  195.     pHwDevExt->Focus = FocusDefault;
  196.     pHwDevExt->FocusFlags = KSPROPERTY_CAMERACONTROL_FLAGS_AUTO;
  197.     pHwDevExt->Zoom = ZoomDefault;
  198.     pHwDevExt->ZoomFlags = KSPROPERTY_CAMERACONTROL_FLAGS_AUTO;

  199.     // Init VideoControl properties
  200.     pHwDevExt->VideoControlMode = 0;

  201.     // Init VideoCompression properties
  202.     pHwDevExt->CompressionSettings.CompressionKeyFrameRate = 15;
  203.     pHwDevExt->CompressionSettings.CompressionPFramesPerKeyFrame = 3;
  204.     pHwDevExt->CompressionSettings.CompressionQuality = 5000;

  205.     pHwDevExt->PDO = ConfigInfo->RealPhysicalDeviceObject;
  206.     KdPrint(("TestCap: Physical Device Object = %lx\n", pHwDevExt->PDO));

  207.     for (j = 0; j < MAX_TESTCAP_STREAMS; j++)
  208.         {
  209.         // For each stream, maintain a separate queue for data and control
  210.         InitializeListHead (&pHwDevExt->StreamSRBList[j]);
  211.         InitializeListHead (&pHwDevExt->StreamControlSRBList[j]);
  212.         KeInitializeSpinLock (&pHwDevExt->StreamSRBSpinLock[j]);
  213.         pHwDevExt->StreamSRBListSize[j] = 0;
  214.     }

  215.     // Init ProtectionStatus
  216.     pHwDevExt->ProtectionStatus = 0;


  217.     // The following allows multiple instance of identical hardware
  218.     // to be installed.  GlobalDriverMediumInstanceCount is set in the Medium.Id field.

  219.     pHwDevExt->DriverMediumInstanceCount = GlobalDriverMediumInstanceCount++;
  220.     pSrb->Status = STATUS_SUCCESS;
  221.        
  222.         KdPrint(("Exit the function of 'HwInitialize'\n"));
  223.     return (TRUE);
  224. }
复制代码
 
 

回复

75

帖子

0

TA的资源

一粒金砂(初级)

板凳
 
怎样才能把帖子删掉?
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表