Rapid Prototyping Solutions Seminars

Download Report

Transcript Rapid Prototyping Solutions Seminars

Rapid Prototyping Solutions
USB and MFS Stacks
TM
Freescale, the Freescale logo, AltiVec, C-5, CodeTest, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc.,
Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions Logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SmartMOS, TurboLink
and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010.
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
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2009.
TM
2
Module Agenda
►
USB Host
► USB Device
► MFS
► USB and File System Lab
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2009.
TM
3
Module Agenda
►
USB Host
► USB Device
► MFS
► USB and File System Lab
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2009.
TM
4
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)
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2009.
TM
Demo Applications Available
► Mouse
► Keyboard
► Mass
Storage Device
► CDC Serial
► Found
in <mqx_install_dir>\usb\host\examples
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2009.
TM
MQX USB Host Structure
User Application
HUB
MFS
Other to be
developed
Intermediate
I/O Drivers
MSD
HID
CDC
Host Class
Drivers
HOST API (class level)
Hardware
Independent
Layer
USB 2.0 Chapter 9 API
OS and HW-level HOST API
USB Module (low-level drivers)
KHCI (Kirin2U/Kirin3specific controller)
EHCI (Enhanced Host
Controller Interface)
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2009.
Other (OHCI, ...)
TM
Module Agenda
►
USB Host
► USB Device
► MFS
► USB and File System Lab
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2009.
TM
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)
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2009.
TM
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
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2009.
TM
Architecture Overview
Applications
Mouse
Medical
Communication
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
-----
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2009.
USB IP
TM
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 …)
Class
- USB generic class implementation (Suspend/Resume/Reset ….)
- USB function specific implementation (Non Control Endpoint Request, Class specific Request)
- USB Device API user
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
Low level
driver
- USB Controller IP interfacing module.
- candidate to change for every new USB IP
USB Hardware
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2009.
TM
Module Agenda
►
USB Host
► USB Device
► MFS
► USB and File System Lab
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2009.
TM
13
MFS structure
Files and directories
MFS
Partition manager (optional)
Device
Hardware
Flash cards
USB mass
storage
devices
ATA
PCMCIA
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2009.
Removable
hard drives
TM
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
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2009.
TM
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
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2009.
TM
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.
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2009.
TM
17
Module Agenda
►
USB Host
► USB Device
► MFS
► USB and File System Lab
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2009.
TM
18
Hands-On
► Follow
the USB Lab document to read and write to a USB flash drive
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2009.
TM
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
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2009.
TM
20
TM