Device Object Example for a USB Mass Storage Device

本文介绍了复合USB存储设备的对象结构及其驱动程序的工作原理。从PCI总线驱动开始,通过USB端口驱动创建主机控制器的功能设备对象(FDO),然后枚举USB集线器并为每个USB存储设备创建PDO。USB存储端口驱动程序进一步将物理存储设备划分为多个逻辑单元,并由本地磁盘类驱动程序管理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The following figure shows the device objects that are created for a composite USB mass storage device containing both a Smart Media slot and a Compact Flash slot.

 

Ff552547.usbstor(en-us,VS.85).png

 

Device Object Tree for a Composite USB Mass Storage Device

Starting from the bottom of the figure, the following list describes each device object or device object stack and its associated driver:

  1. The PCI bus driver enumerates the USB host controller. The system loads the port driver, usbport.sys, and its accompanying miniports (not shown in the figure). Then, usbport.sys creates an FDO for the host controller.

  2. The port driver enumerates the USB hubs in the system, starting with the root hub. The usbhub.sys driver manages all USB hubs. The figure only shows one level of hub device objects, but USB allows daisy-chaining of hub devices, so there could potentially be many more hub device objects in the tree. The hub driver detects and enumerates the USB mass storage device and creates a PDO for it.

  3. Windows supplies a USB storage port driver, usbstor.sys, that serves as an interface between the USB stack and the native Windows storage class drivers. The USB storage port driver creates its own functional device object (FDO). The USB storage port driver can divide the physical storage device into as many as 16 logical units. In the example depicted in the figure, the USB storage device contains separate slots for a Compact Flash device and a Smart Media device. Therefore, in this example, the USB storage port driver creates two separate PDOs, one for the Compact Flash device and another for the Smart Media device.

  4. The stack above the USB storage port driver is managed in the usual way by the native disk class driver. The disk class driver creates a PDO and an FDO for the disk as a whole (partition zero), and PDOs for each partition on the disk.

  5. The partition manager creates an FDO for each disk partition.

# Edge Impulse - OpenMV Object Detection Example import sensor, image, time, os, tf, math, uos, gc sensor.reset() # Reset and initialize the sensor. sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.set_windowing((240, 240)) # Set 240x240 window. sensor.skip_frames(time=2000) # Let the camera adjust. net = None labels = None min_confidence = 0.5 try: # load the model, alloc the model file on the heap if we have at least 64K free after loading net = tf.load("trained.tflite", load_to_fb=uos.stat('trained.tflite')[6] > (gc.mem_free() - (64*1024))) except Exception as e: raise Exception('Failed to load "trained.tflite", did you copy the .tflite and labels.txt file onto the mass-storage device? (' + str(e) + ')') try: labels = [line.rstrip('\n') for line in open("labels.txt")] except Exception as e: raise Exception('Failed to load "labels.txt", did you copy the .tflite and labels.txt file onto the mass-storage device? (' + str(e) + ')') colors = [ # Add more colors if you are detecting more than 7 types of classes at once. (255, 0, 0), ( 0, 255, 0), (255, 255, 0), ( 0, 0, 255), (255, 0, 255), ( 0, 255, 255), (255, 255, 255), ] clock = time.clock() while(True): clock.tick() img = sensor.snapshot() # detect() returns all objects found in the image (splitted out per class already) # we skip class index 0, as that is the background, and then draw circles of the center # of our objects for i, detection_list in enumerate(net.detect(img, thresholds=[(math.ceil(min_confidence * 255), 255)])): if (i == 0): continue # background class if (len(detection_list) == 0): continue # no detections for this class? print("********** %s **********" % labels[i]) for d in detection_list: [x, y, w, h] = d.rect() center_x = math.floor(x + (w / 2)) center_y = math.floor(y + (h / 2)) print('x %d\ty %d' % (center_x, center_y)) img.draw_circle((center_x, center_y, 12), color=colors[i], thickness=2) print(clock.fps(), "fps", end="\n\n")
07-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值