210 likes | 228 Views
This session explores the USB capabilities available when using MQX and demonstrates how the MQX File System stack can interact with a USB stack. Participants will engage in a hands-on lab that involves writing data to a USB Flash Stick.
E N D
Rapid Prototyping Solutions USB and MFS Stacks
Module Objectives • This session describes the USB capabilities that are available when using MQX • Describes how the MQX File System stack can interact with a USB stack • Presents a hands-on lab with writing data to a USB Flash Stick
Module Agenda • USB Host • USB Device • MFS • USB and File System Lab
Module Agenda • USB Host • USB Device • MFS • USB and File System Lab
MQX Host USB • Implements USB 2.0 version • Layered architecture • scalability (choose only components needed in application) • portability (class drivers independent on underlying hardware) • Class drivers supported: • HID devices (mouse, keyboard) • MSD devices (flash disk) • HUB support (transparent communication through HUB) • CDC devices (serial communication)
Demo Applications Available • Mouse • Keyboard • Mass Storage Device • CDC Serial • Found in <mqx_install_dir>\usb\host\examples
MQX USB Host Structure User Application Intermediate I/O Drivers Other to be developed MFS Host Class Drivers MSD HID CDC Hardware IndependentLayer HUB HOST API (class level) USB 2.0 Chapter 9 API OS and HW-level HOST API USB Module (low-level drivers) KHCI (Kirin2U/Kirin3-specific controller) EHCI (Enhanced Host Controller Interface) Other (OHCI, ...)
Module Agenda USB Host USB Device MFS USB and File System Lab 8
Stack Features • All USB-IF chapter 9 compliance • USB Class Support • Human Interface Device (HID) • Communication Data Class – Abstract Control Model (CDC – ACM) • PHDC (Personal Health Care Device Class) • MSD (Mass Storage Support)
Demo Applications available • Mouse • USB to Serial • USB Network Adapter • Weigh Scale (IEEE 11073 – 20601, IEEE 11073 - 10415) • RAM Disk • Found in <mqx_install_dir>\usb\device\examples
Architecture Overview Applications Mouse Medical Commun- ication Storage Class API HID PHDC CDC MSD Device API USB Device Stack Library Device Layer Controller API mcf5229x mcf54455 Low level driver - - - - - HW Register IF - - - - - V2 USB IP V4 USB IP USB IP
Device Layers • USB Descriptors, endpoint information • USB Application implementing class specific callbacks • USB Class API user Application • USB Framework Module implementation (USB Ch9, Control Endpoint …) • USB generic class implementation (Suspend/Resume/Reset ….) • USB function specific implementation (Non Control Endpoint Request, Class specific Request) • USB Device API user Class Device Layer • Abstracts Hardware specific details and provides generic USB interfaces to the upper layer • Allows easy port of Applications/Class functionality over different USB IPs • USB Controller IP interfacing module. • candidate to change for every new USB IP Low level driver USB Hardware
Module Agenda USB Host USB Device MFS USB and File System Lab 13
MFS structure Hardware USB mass storage devices ATA PCMCIA Removable hard drives Flash cards Files and directories MFS Partition manager (optional) Device 14
MFS Features Standard FAT12, FAT16 and FAT32 support Standard handling of directory paths Both \ and / can be used as directory separators Support for * and ? wildcard characters File Attributes Supported Standard: Directory, Read-only, Hidden File, System file, Archived file Special: Volume Label file (only one such file allowed in root directory) File Time and Date Each file entry contains 16-bit time and date fields. FAT Copies MFS updates as many FATs as configured for. Only reads the first FAT. High-Level Formatting An application can perform high-level formatting on a disk by calling ioctl(). Partition Manager Support for multiple partitions on one physical drive 15
Device Devices usable by MFS MFS can be installed on any memory-oriented device which is standard MQX IO device in terms of open/close/read/write/ioctl calls is able to “seek” on any given position supports few block-oriented IOCTL Devices supported today ATA PC Card flash cards USB mass storage devices RAM or MRAM FlashX driver working with internal or external Flash memory SPI-based SD Cards Code under development (or legacy not-tested code) ATA hard drives floppy-disk drives 16
MFS – API Basic MFS API _io_mfs_install - initializes MFS and allocates memory for all of the internal MFS data structures. _io_mfs_uninstall - uninstalls the MFS device driver and frees the memory context. fopen -Opens the device by specifying device name or opens a file if both device name and file path is specified. fd_ptr = fopen(“mfsram:\data\march\March2000results.data”, “w”); fclose –Closes the file and frees the memory allocated by given FILE_PTR ioctl – File- or device-specific control interface. 17
Module Agenda USB Host USB Device MFS USB and File System Lab 18
Hands-On • Follow the USB Lab document to read and write to a USB flash drive
Summary Learned about the USB capabilities that are available when using MQX Described how the MQX File System stack can interact with a USB stack Performed a hands-on lab with writing data to an USB Flash Stick 20