Documente Academic
Documente Profesional
Documente Cultură
26 August 2002
XMP
Station Software Developer Kit XMP- 1 page 1
Revision History
Date
12 Sep 2001 26 Aug 2002
revision
A 1
Description
First release all XMP specification in one doc Change all references to XMP- 1 and condensed
XMP
Station Software Developer Kit XMP- 1 page 2
Table of Contents
1 PURPOSE AND SCOPE ................................................................................. 4 1.1 1.2 1.3 1.4 2 CHAPTER NAMES AND D ESCRIPTIONS ................................................................. 4 SUGGESTED ORDER OF REVIEW ....................................................................... 4 ADDITIONAL I NFORMATION ............................................................................. 4 TECHNICAL ASSISTANCE ................................................................................ 4
XMP INTEGRATION REQUIREMENTS ......................................................... 5 2.1 OVERVIEW OF I MPLEMENTATION LEVELS .............................................................. 5 2.1.1 XMP Condensed ............................................................................... 5 2.1.2 XMP- 1 ............................................................................................ 5 2.1.3 XMP- 2 ............................................................................................ 5 2.1.4 XMP- 4 ............................................................................................ 6 2.2 FUNCTIONAL ORGANIZATION ........................................................................... 6 2.3 FUNCTIONAL BLOCK D ESCRIPTIONS ................................................................... 6 2.3.1 38 KHz Demodulation ......................................................................... 6 2.3.2 Pulse Capture and PPM/PWM Decode .................................................... 7 2.3.3 Checksum Validation .......................................................................... 7 2.3.4 Owner Validation ............................................................................... 7 2.3.5 Tag Validation ................................................................................... 7 2.3.6 Slot Validation ................................................................................... 8 2.3.7 End- of- Cycle Synthesis ....................................................................... 8 2.3.8 PPM/PWM Encode............................................................................... 8 2.3.9 Pulse Generation................................................................................ 8 2.3.10 38 KHz Modulation .......................................................................... 8 2.3.11 Payload Extraction........................................................................... 8 2.3.12 Registry Determination .................................................................... 9 2.3.13 Direction to Driver........................................................................... 9 2.4 AUTOMATIC D ETECTION OF PROTOCOL LEVEL ........................................................ 9
XMP- 1 IR LAYER SPECIFICATION ............................................................. 10 3.1 3.2 3.3 3.4 3.5 3.6 UNITS AND TOLERANCES ............................................................................. 10 SPECTRAL REQUIREMENTS ............................................................................ 10 CARRIER CYCLE ........................................................................................ 10 PULSE FORMATS ....................................................................................... 10 D ATA PULSE POSITION MODULATION ............................................................... 11 PERIPHERAL- TO- STATION PACKET FORMAT......................................................... 11
XMP- 1 PACKET LAYER SPECIFICATIONS ................................................... 12 4.1 PACKET LAYER IR INBOUND ....................................................................... 12 4.2 EXAMPLE PERIPHERAL D ATA PACKET FORMATS: ................................................... 14 4.3 STATION TRANSCEIVER (TS CONTROLLER) IR PROTOCOL POLICIES ......................... 17 4.3.1 Inter- packet Spacing ........................................................................ 17 4.3.2 Peripheral Ownership........................................................................ 17 4.3.3 Peripheral Addressing ....................................................................... 17 4.3.4 Unidirectional Tagging ...................................................................... 17 4.3.5 XMP- Condensed Packets ................................................................... 17
XMP DEVICE DRIVER POLICIES .............................................................. 18 5.1 5.2 5.3 5.4 5.5 OVERVIEW .............................................................................................. 18 KEY STATE CHANGE ................................................................................... 18 KEY ACTIVITY .......................................................................................... 18 KEY ACTIVE/BREAK ................................................................................... 18 TIMING POLICIES ...................................................................................... 19
XMP
Station Software Developer Kit XMP- 1 page 3
5.5.1 Key Down Timeout ........................................................................... 19 5.5.2 Peripheral Key Repetition .................................................................. 19 5.5.3 Character Repetition (Typematic Rate) ............................................. 19 5.6 RESEND PACKET FILTERING ........................................................................ 20 5.7 TRUTH TABLES FOR PACKET VALIDATION (KEY ACTIVITY SCHEME) ............................. 20 APPENDIX 1 - IR Reception Requirements APPENDIX 2 Timing Diagram APPENDIX 3 XMP Protocol Formulas APPENDIX 4 Peripheral Registration Policies
XMP
Station Software Developer Kit XMP- 1 page 4
XMP Integration Requirements Explanation of XMP integration options. XMP- 1 IR Layer Specification Specifications for the infrared layer. XMP- 1 Packet Layer Specification Specifications for the packet layer. XMP Device Driver Policies Guidelines for device driver implementation. Appendix; XMP- 1 Annex; XMP- 1
Device Driver Pseudo Code .C Sample pseudo code for device driver.
1.2
The Integration Requirements should be reviewed first to confirm (a) that XMP- 1 is the appropriate level of implementation for readers project and (b) that the platform architecture is able to support integration of the XMP codec. Review of the Timing Diagram (Appendix) should be next. This will familiarize the reader with basic organization and sequencing of infrared pulses arriving at the photodetector. The Decoder Source Code is used to extract the data payload from arriving infrared packets. These payload structures, illustrated in the Packet Layer Specification, are presented to the appropriate device driver for mapping of peripheral events to the platforms OS queues for alphanumeric input, mouse movement, and multimedia commands. Device drivers should be implemented from the Driver Pseudo Code or at least with reference to the Driver Policies. Assuming use of UEI standard link controllers or direct use of UEI source code, the reader may omit review of the IR Layer Specification and Timing Diagram. NOTE: Provision for installation of the additional components required for quad device operation may be appropriate to facilitate future protocol upgrades.
1.3
Additional Information
Payload specifications are available for all XMP compatible devices. These documents describe the definition and organization of bits in the packet payload from each respective device.
1.4
Technical Assistance
Questions are expected. You may request assistance in several ways: By telephone: Call Universal Electronics at +1 714 820 1000 By email: Email your questions to cchambers@ueic.com. Thanks for choosing the XMP technology for your project.
XMP
Station Software Developer Kit XMP- 1 page 5
2.1
The XMP Protocol IR Layer may currently be implemented at four different levels. Lowest cost implementation employs a unidirectional link, handling (30) packets per second from one peripheral at a time, and configured for either Condensed (combined registry and data packet) or Standard (separate registry and data packets) reporting. Recovery from errors is added by implementing the infrared return path for a bidirectional link between the peripheral and platform. The most comprehensive implementation of XMP again employs a bidirectional link but increases reporting rate to (120) packets per second, (30) per second from each of up to four peripherals operating simultaneously. The two unidirectional levels are referred to as XMP Condensed and XMP- 1 respectively. The two bidirectional levels are referred to as XMP- 2 and XMP- 4.
2.1.2 XMP-1
Separate 32- bit packets respectively for registry and payload data. Reporting rate up to (80) packets per second. Payload size of 20 bits per data packet.
2.1.3 XMP-2
Two- way (bidirectional) link. Provides recovery from link errors. Adds standard photodetector in the mobile unit and LED in the fixed unit. Reporting and acknowledgement of up to (80) packets per second.
XMP
Station Software Developer Kit XMP- 1 page 6
2.1.4 XMP-4
Two- way (bidirectional) link. Allows simultaneous operation of four peripherals. Requires specific photodetectors in both fixed and mobile units. Separate 30- bit packets respectively for registry and payload data. Reporting rate up to (120) packets per second. Payload of 22 bits per data packet. XMP- Condensed is recommended for simple remote control applications. XMP- 1 and XMP- 2 are recommended for keyboard applications. XMP- 4 is only required when simultaneous multiplayer operation is necessary, such as during game play.
2.2
Functional Organization
Transception of XMP can be divided into functional blocks as illustrated. Respective realization of particular blocks in software, firmware, and/or hardware varies for each implementation.
XMP- Condensed, XMP- 1, and XMP- 2 handle one device at a time. The response stack from "End- of- Cycle Synthesis" down thru "38 KHz Modulation", required for XMP- 2 and XMP- 4, is executed after each incoming packet. XMP- 4 handles simultaneous operation of four peripherals. After each incoming XMP- 4 packet, an acknowledgement pulse is generated following "Slot Validation". After every fourth XMP- 4 slot, the entire response stack is executed. No response stack implementation is required for decoding of XMPCondensed or XMP- 1.
2.3
XMP
Station Software Developer Kit XMP- 1 page 7
Units
usec usec
XMP
Station Software Developer Kit XMP- 1 page 8
msec
usec usec
2 3
Applicable to XMP- 4 only. End- of- Cycle Synthesis, PPM/PWM Encode, Pulse Generation, and 38 KHz Modulation are not applicable to XMP- Condensed and XMP- 1.
XMP
Station Software Developer Kit XMP- 1 page 9
2.4
XMP transceivers operate in a specific mode at any given point in time. Mode is asserted at start- up, and then only changed upon command from the application software, and/or upon recognition of XMP activity only valid in a non- active mode. The modes are distinguished by examination of the checksum value.
XMP
Station Software Developer Kit XMP- 1 page 10
All times are in microseconds unless otherwise specified. All tolerances are 0% unless otherwise specified.
3.2
Spectral Requirements
Light Wavelength: 940 nm Optical Intensity: 50 mW/sr for 10- meter linear operating range.
3.3
Carrier Cycle
26.31 0.5
3.4
Pulse Formats
Encoding:
8 Carrier Cycles
XMP
Station Software Developer Kit XMP- 1 page 11
3.5
Encoding:
Decoding:
3.6
Nibble 0
Header Pulse
8 Data Pulses
XMP
Station Software Developer Kit XMP- 1 page 12
4.1
General Packet Format: 7 6 5 4 3 2 D23 D22 D21 D20 S3 S2 D19 D18 D17 D16 T3 T2 D15 D14 D13 D12 D11 D10 D7 D6 D5 D4 D3 D2 1 S1 T1 D9 D1 0 S0 T0 D8 D0
0 1 2 3
General Registration Packet or Data Packet Format: 7 6 5 4 3 2 N3 N2 N1 N0 S3 S2 D19 D18 D17 D16 T3 T2 D15 D14 D13 D12 D11 D10 D7 D6 D5 D4 D3 D2 1 S1 T1 D9 D1 0 S0 T0 D8 D0
0 1 2 3
N3- N0 Owner (setup by user) (default = 0)6 S3- S0 Checksum7 T3- T0 Peripherals Tag or Special Command8 D19- D0 Peripheral/Command specific data Peripheral Registration Packet Formats: Peripheral Identification for Basic Registry 7 N3 T3 0 R7 6 5 4 3 2 N2 N1 N0 S3 S2 T2 T1 T0 1 1 R14 R13 R12 R11 R10 R6 R5 R4 R3 R2 1 S1 1 R9 R1 0 S0 1 R8 R0
0 1 2 3
Owner (setup by user) (default = 0) Checksum Tag from Peripheral Basic Registry Number9
Checksum is that number which causes the mod- 16 addition of the eight nibbles to equal the appropriate Checksum Result. For Registration Packets and Data Packets the Checksum Result is zero (0). For Condensed (Registration & Data) Packets the Checksum Result is seven (7). 5 Peripheral Tags range from 0000 to 1101. Special commands range from 1110 to 1111. 6 Peripherals will respond to Acknowledge packets matching their own Owner as well as packets containing Owner = 0000. 7 Checksum is that number which causes the mod- 16 addition of the eight nibbles to equal zero. 8 Peripheral Tags range from 0000 to 1101. Special commands range from 1110 to 1111.
XMP
Station Software Developer Kit XMP- 1 page 13
General Peripheral Data Packet Format: 7 6 5 4 3 2 N3 N2 N1 N0 S3 S2 D19 D18 D17 D16 T3 T2 D15 D14 D13 D12 D11 D10 D7 D6 D5 D4 D3 D2 1 S1 T1 D9 D1 0 S0 T0 D8 D0
0 1 2 3
Owner (setup by user) (default = 0)10 Checksum Tag (as returned with Acknowledge Packet) Peripheral specific data
Registry numbers are assigned by UEI. The registry number is used as a pointer into a table whose contents identify the peripherals manufacturer, product name, model number, product type, revision, A/B channel and packet format. 10 Peripherals will respond to Acknowledge packets matching their own Owner Value as well as packets containing Owner Value = 0000.
XMP
Station Software Developer Kit XMP- 1 page 14
4.2
Keyboard 7 6 N3 N2 RPT RSN K7 K6 CNTL SHIFT 5 4 N1 N0 TBD TBD K5 K4 ALT M1 3 S3 T3 K3 M2 2 1 0 S2 S1 S0 T2 T1 T0 K2 K1 K0 TBD TBD TBD
0 1 2 3
N3- N0 S3- S0 RPT RSN TBD T3- T0 K7- K0 CNTL SHIFT ALT M1 M2
Owner (setup by user) (default = 0) Checksum Key Repeat Flag (repeat of last key = 1) Resending due to lack of Acknowledgement11 Reserved (default = 0) Tag (as returned with Acknowledge Packet) Key Scan Code Control Key (active = 1) Shift Key (active = 1) Alt Key (active = 1) Reserved Modifier Key 1 Reserved Modifier Key 2
Owner (setup by user) (default = 0) Checksum X Coordinate MSB Y Coordinate MSB Button 1 (left) (active = 1) Button 2 (right) (active = 1) Tag (as returned with Acknowledge Packet) X Coordinate (0..511, origin = left edge) Y Coordinate (0..511, origin = lower edge)
Used to avoid duplicate packets due to loss of Acknowledgment. Support for this bit isnt mandatory.
XMP
Station Software Developer Kit XMP- 1 B1 B2 B3 T3- T0 X7- X0 Y7- Y0 TBD Data Uplink 7 6 5 4 3 2 N3 N2 N1 N0 S3 S2 TBD RSN C1 C0 T3 T2 D15 D14 D13 D12 D11 D10 D7 D6 D5 D4 D3 D2 1 S1 T1 D9 D1 0 S0 T0 D8 D0 Button 1 (left) (active = 1) Button 2 (right) (active = 1) Button 3 (middle) (active = 1) Tag (as returned with Acknowledge Packet) X Delta (- 128..127, right is positive) 2s complement Y Delta (- 128..127, up is positive) 2s complement Reserved (default = 0) page 15
T3- T0 D15- D0
Owner (setup by user) (default = 0) Checksum Reserved (default = 0) Resending due to lack of Acknowledgement13 Cycle Type: 00 = use data as starting address 01 = single byte of data in D7- D0 10 = word of data 11 = single last byte Tag (as returned with Acknowledge Packet) Data Byte(s)
Keyboard (Extended Modifier Handling) 7 6 5 4 3 2 1 0 0 N3 N2 N1 N0 S3 S2 S1 S0 1 RPT RSN TBD TBD T3 T2 T1 T0 2 K7 K6 K5 K4 K3 K2 K1 K0 3 CNTL SHIFT ALT M1 M2 CNTL SHIFT ALT (Left) (Left) (Left) (Right) (Right) (Right) N3- N0 S3- S0 RPT RSN TBD T3- T0 K7- K0 CNTL SHIFT ALT M1 M2 Owner (setup by user) (default = 0) Checksum Key Repeat Flag (repeat of last key = 1) Resending due to lack of Acknowledgement14 Reserved (default = 0) Tag (as returned with Acknowledge Packet) Key Scan Code Control Key (active = 1) Shift Key (active = 1) Alt Key (active = 1) Reserved Modifier Key 1 (active = 1) Reserved Modifier Key 2 (active = 1)
12
Used to avoid duplicate packets due to loss of Acknowledgment. Support for this bit isnt mandatory. 13 Used to avoid duplicate packets due to loss of Acknowledgment. Support for this bit isnt mandatory. 14 Used to avoid duplicate packets due to loss of Acknowledgment. Support for this bit isnt mandatory.
XMP
Station Software Developer Kit XMP- 1 page 16
If there is an active key that doesnt have an associated modifier flag then its scan code will be reported. All active modifier keys will have their respective modifier flags set. The left and right keys for a specific modifier are independently selectable. If there arent any active keys that dont have an associated modifier flag then one of the active modifier keys will have its scan code reported and its associated modifier flag cleared. All other active modifier keys will be reported at the same time by having their respective modifier flags set. The order of precedence when determining which modifier scan code to send is as follows, Left CONTROL, Right CONTROL, Left SHIFT, Right SHIFT, Left ALT, Right ALT, Modifier 1, Modifier 2.
General Peripheral Condensed (Registration & Data) Packet Format: 7 R7 R3 1 D7 6 R6 R2 TBD D6 5 R5 R1 R9 D5 4 R4 R0 R8 D4 3 2 S3 S2 1 1 D11 D10 D3 D2 1 S1 1 D9 D1 0 S0 1 D8 D0
0 1 2 3
Checksum15 Basic Registry Number16 16,384 Peripheral specific data Reserved (default = 0)
Example Peripheral Condensed Packet Formats: Remote Control 7 R7 R3 1 K7 6 R6 R2 TBD K6 5 R5 R1 R9 K5 4 R4 R0 R8 K4 3 2 1 0 S3 S2 S1 S0 1 1 1 1 RPT CNTL SHIFT ALT K3 K2 K1 K0
Checksum Basic Registry Number 16,384 Key Repeat Flag (repeat of last key = 1) Control Key (active = 1) Shift Key (active = 1) Alt Key (active = 1) Key Scan Code Reserved (default = 0)
15
Checksum is that number which causes the mod- 16 addition of the eight nibbles to equal seven (0x07). 16 Registry numbers are assigned by UEI. The registry number is used as a pointer into a table whose contents identify the peripherals manufacturer, product name, model number, product type, revision, A/B channel and packet format. The range of Registry Numbers from 16,384 to 17,407 are reserved for peripherals employing Condensed Packets.
XMP
Station Software Developer Kit XMP- 1 page 17
4.3
XMP
Station Software Developer Kit XMP- 1 page 18
This chapter the policies and behaviors that need to be considered when implementing device drivers for XMP- 1 and/or XMP- 2 peripherals.
5.1
Overview
In general, there have been two paradigms employed in wireless peripheral protocols. Many older protocols utilize a scheme based on reporting Key State Changes. XMP peripherals have traditionally been based on reporting Key Activity. Newer XMP- 4 peripherals however utilize Key Active/Break reporting.
5.2
Protocols based on reporting Key State Changes usually concern themselves with reporting events such as Key Up and Key Down. For example, a peripheral would report a Key Down when a key was initially pressed, and a Key Up when it was released. If the Key Down were lost then the keypress would never occur. If the Key Up were lost then the key would repeat indefinitely.
5.3
Key Activity
The XMP Protocol has often been used on peripherals based on the concept of reporting Key Activity. For example, a peripheral would report a Key Down when a key was initially pressed, and would continue to periodically report a Key Repeat as long as the key was depressed. When a device driver receives a Key Down report it will set the appropriate keys state as active (Make). The key will continue to be considered active until either a subsequent Key Down report arrives specifying a different key as being active, or until a sufficient period of time has elapsed without reception of a Key Repeat report which would maintain the keys active state. Although modifier keys can be reported as explicit scan codes, the state of all modifiers is reported in each keyboard packet with a reserved bit for each modifier. One limitation of this method is that multiple modifiers and only a single non- modifier key can be active at one time.
5.4
Key Active/Break
The XMP Protocol can also support peripherals based on the concept of Key Active/Break reporting. This scheme is an extension of Key Activity reporting which allows for maintaining multiple active keys and modifiers. Peripherals report a Key Down when a key is initially pressed, and continue to periodically report a Key Repeat as long as the key is still depressed and hasnt been rolled by a subsequent key. Subsequent concurrently active keys are reported with an initial Key Down and, should they persist, with periodic Key Repeat reports. When a device driver receives a Key Down report it will set the appropriate keys state as active (Make). The key will continue to be considered active until either a key report arrives which causes the key to be considered inactive (Break), or until a sufficient period of time has elapsed without reception of any key report, which causes all currently active keys to be set inactive. Active keys can be Broken through the use of the Keyboard State(KS) field common to all Active/Break keyboard packets. A Keyboard State of RESET indicates that all currently active keys and modifiers must be Broken before Making the newly specified scan code and modifiers. A Keyboard State of EXCLUSIVE indicates that the specified scan code is exclusive and that therefore that no other non- modifier keys are currently active. Finally, a Keyboard State of BREAK can be used to request a Break for the specified scan code while leaving all other non- modifier keys unaffected. Although
XMP
Station Software Developer Kit XMP- 1 page 19
modifier keys can be reported as explicit scan codes, the state of all modifiers is reported in each keyboard packet with a reserved bit for each modifier. A properly optimized peripheral will attempt to utilize the Keyboard States of RESET and EXCLUSIVE as well as implicit Breaks on timeout in order to minimize the number of explicit BREAK reports sent. Whenever a keyboard reports activity after transitioning from a state in which there were no active keys or modifiers it will always specify the first key report with a Key State of RESET.
5.5
Timing Policies
XMP
Station Software Developer Kit XMP- 1 page 20
5.6
In the XMP- 2 protocol most data packet formats contain the RESEND flag RSN. This flag signifies that the peripheral either received a NACK in response to its last packet, or didnt receive any response at all, and is thus re- transmitting the packet. This flag allows a device driver to avoid the stutter that would occur when receiving a RESEND packet in addition to the original packet. The general rule is to discard a RESEND packet if, disregarding the RSN flag, it is identical to the previously received packet from the same peripheral. XMP- 1 peripherals will usually never transmit a packet with the RESEND flag set.
5.7
Unidirectional Peripherals Data Packet Driver State Driver Action Key(s) Set Key(s) Set Key(s) RESEND REPEAT Key(s) same as Inactive Active Key(s) still Bit Bit Active last (if needed) (if needed) Active report N Y Y Y Y N Y Y N Y Y N Y N Y Y N Y N N Y N N Y Y Y Y N N Y N Y Y N N N Y Y N N N N Y
Notes
Note 1: Upon exhaustion of the Key Down Timeout, the Driver should set all keys inactive. Note 2: Upon taking any action, the Driver should restart the Key Down Timeout.
XMP
Station Software Developer Kit XMP- 1 page 21
XMP
Station Software Developer Kit XMP- 1 page 22
XMP
Station Software Developer Kit XMP- 1 page 23
XMP
Station Software Developer Kit XMP- 1 page 24