;**************************************************************************** ; ; file: wusb-ls-headers.inc ; Description: This file contains application registers addresses, ; constants, etc. ; Target: Cypress CY7C63723/CY7C63743 Encore Chips ; $Header: ; Version: 1.3.0000 ; ;**************************************************************************** ; Copyright (2003), Cypress Semiconductor Corporation ; This software is owned by Cypress Semiconductor Corporation (Cypress) and is ; protected by United States copyright laws and international treaty provisions. ; Cypress hereby grants to Licensee a personal, non-exclusive, non-transferable ; license to copy, use, modify, create derivative works of, and compile the ; Cypress Source Code and derivative works for the sole purpose of creating ; custom software in support of Licensee product ("Licensee Product") to be used ; only in conjunction with a Cypress integrated circuit. Any reproduction, ; modification, translation, compilation, or representation of this software ; except as specified above is prohibited without the express written permission ; of Cypress. ; Disclaimer: Cypress makes no warranty of any kind, express or implied, with ; regard to this material, including, but not limited to, the implied warranties ; of merchantability and fitness for a particular purpose. Cypress reserves the ; right to make changes without further notice to the materials described herein. ; Cypress does not assume any liability arising out of the application or use of ; any product or circuit described herein. Cypress’ products described herein are ; not authorized for use as components in life-support devices. ; This software is protected by and subject to worldwide patent coverage, ; including U.S. and foreign patents. Use may be limited by and subject to the ; Cypress Software License Agreement. ; ;**************************************************************************** INCLUDE "usb.inc" INCLUDE "radio.inc" ;---------------------------------------------------- ; RADIO DEFINES ;---------------------------------------------------- BIND_POLL_TIMEOUT: equ 30h ; poll rate for bind button, RSSI check, etc. POLL_TIMEOUT: equ 14 EOF_BITS: equ 07h IDLE_TIMEOUT: equ 30h NUM_CHANNELS: equ 78 ; number of channels that are used 0 to NUM_CHANNELS-1 CHANNEL_OFFSET: equ 02 IFDEF DATA_RATE_16 DEFINE PN_CODE_64_TABLE RADIO_MODE: equ (b64_CHIP_BITS | bNORMAL_DATA_RATE | b6X_OVERSAMPLING) ENDIF IFDEF DATA_RATE_32 DEFINE PN_CODE_32_TABLE RADIO_MODE: equ (b32_CHIP_BITS | bNORMAL_DATA_RATE | b6X_OVERSAMPLING) ENDIF IFDEF DATA_RATE_64 DEFINE PN_CODE_32_TABLE RADIO_MODE: equ (b32_CHIP_BITS | bDOUBLE_DATA_RATE | b6X_OVERSAMPLING) ENDIF IFDEF PN_CODE_64_TABLE THRESHOLD_L: equ 8 ; RX correlator lo threshold THRESHOLD_H: equ 56 ; RX correlator hi threshold NUM_PN_CODES: equ 49 ENDIF IFDEF PN_CODE_32_TABLE THRESHOLD_L: equ 3 ; RX correlator lo threshold THRESHOLD_H: equ 29 ; RX correlator hi threshold NUM_PN_CODES: equ 8 ENDIF IFDEF USE_RSSI RSSI_NOISE_THRESHOLD: equ 0Eh RSSI_NOISE_THRESHOLD: equ 08h CHANNELS_PER_RSSI_INCREMENT: equ 2 PING_RSSI_INTERVAL: equ 1 ; time between RSSI readings in ping_mode (in ms) PING_NUM_RSSI: equ 20 ; number of RSSI readings in ping_mode CORRUPT_THRESHOLD: equ 10 ; was 6 NUM_BITS_CORRECTABLE: equ 03 CONNECT_REQ_CORRUPT_COUNT: equ 00 NUM_HIGH_RSSI_READINGS: equ 7 RSSI_COUNTER_THRESHOLD: equ 20 CHANNELS_PER_RSSI_INCREMENT: equ 4 ENDIF ; USE_RSSI IFDEF AGC_SUPPORT CORRUPT_RSSI_MAX_THRESHOLD: equ 1Ah RSSI_MIN_AGC_THRESHOLD: equ 08h AGC_CORRUPT_THRESHOLD: equ 8 ENDIF ; AGC_SUPPORT CORRUPT_THRESHOLD: equ 20 IDLE_CORRUPT_THRESHOLD: equ 20 NUM_BITS_CORRECTABLE: equ 03h PING_MODE_RSSI: equ 0 ; Flags CONNECTED_MODE_RSSI: equ 1 ;***************************************** ; Data Memory map ;***************************************** PSP_BASE: equ 00h ; Program stack rises from here DSP_TOP: equ dfh ; Data stack pointer works down from just below EP0 buffer ;------------------------------------------------------ ; LS Protocol Constants ;------------------------------------------------------ bFLAG_EOF: equ 01h bFLAG_FIXED: equ 02h bFLAG_VALID: equ 04h bDEVICE_ID_ACK: equ 04h bDEVICE_ID_NULL: equ 02h bDEVICE_ID_DATA: equ 02h PT_BIND_REQ: equ 00h PT_BIND_RSP: equ 00h PT_CONN_REQ: equ 10h PT_CONN_RSP: equ 20h PT_PING: equ 30h PT_DATA: equ 40h PT_ACK: equ 50h PT_ACKDATA: equ 60h PT_NULL: equ 70h bHEADER_FLAG: equ 08h bTX_DATA_TOGGLE: equ 04h bPARITY: equ 01h IFDEF CHECKSUM_ALL_PACKETS LEN_ACK: equ 2 LEN_NULL: equ 2 LEN_PING: equ 2 LEN_CONN_RESPONSE: equ 2 ELSE LEN_ACK: equ 1 LEN_NULL: equ 1 LEN_PING: equ 1 LEN_CONN_RESPONSE: equ 1 ENDIF ; CHECKSUM_ALL_PACKETS IFDEF PROTOCOL_1_1 IFDEF CHECKSUM_ALL_PACKETS LEN_BIND_REQUEST: equ 2 ELSE LEN_BIND_REQUEST: equ 1 ENDIF ; CHECKSUM_ALL_PACKETS LEN_BIND_RESPONSE: equ 6 LEN_CONN_REQUEST: equ 6 BIND_RSP_DATA: equ 01h ; Header byte for Bind Response packets ELSE LEN_BIND_REQUEST: equ 6 LEN_BIND_RESPONSE: equ 5 LEN_CONN_REQUEST: equ 8 ENDIF ; PROTOCOL_1_1 ;------------------------------------------------------ ; Radio-related Variables ;------------------------------------------------------ ; USB uses registers up to 36h port0Shadow: equ 39h port1Shadow: equ 3Ah reg_addr: equ 3Bh reg_data: equ 3Ch packet_type: equ 3Dh rx_counter: equ 3Eh timer: equ 3Fh led_state: equ 40h led_timer: equ 41h radio_int: equ 42h channel: equ 43h pn_code: equ 44h packet_ready: equ 45h sequence_id_a: equ 46h IFDEF USE_DEVICE_ID_BIT sequence_id_b: equ 47h ENDIF ; USE_DEVICE_ID_BIT checksum_a: equ 48h checksum_b: equ 49h ls_temp: equ 4Ah parity: equ 4Bh loop_counter: equ 4Ch invalid_bit: equ 4Dh corrected_bits: equ 4Eh checksum_seed: equ 4Fh led_timer2: equ 50h app_timer: equ 51h button_pushed: equ 52h ; Radio parameters of peripheral devices batt_report_req_a: equ 53h battery_a: equ 54h ; _a = kbd rssi_a: equ 55h batt_report_req_b: equ 56h55h battery_b: equ 57h56h ; _b = mouse rssi_b: equ 58h ; requires 16 bytes for rx_buffer AND 16 bytes for valid_buffer ; Determines size of RX Buffer, must be at least 10 bytes for encrypted, 8 bytes for unencrypted RX_BUFFER_LEN: equ 10 rx_buffer: equ 70h ; requires 16 bytes70h-79h app_buffer: equ 71h ; skips header byte valid_buffer: equ 80h ; requires 16 bytes80h-89h tx_sys_counter: equ 90h tx_sys_buffer: equ 90h 91h ; requires 10 bytes tx_sys_counter: equ 9Ah bad_packets_a_low: equ 7Ah bad_packets_a_high: equ 7Bh good_packets_a_low: equ 7Ch good_packets_a_high: equ 7Dh bad_packets_b_low: equ 8Ah bad_packets_b_high: equ 8Bh good_packets_b_low: equ 8Ch good_packets_b_high: equ 8Dh ;---------------------------------------------------- ; Two Way Data ;---------------------------------------------------- IFDEF TWO_WAY_DATA bWAIT_FOR_ACK_A: equ 01h bWAIT_FOR_ACK_B: equ 02h tx_app_counter: equ 5Bh57h tx_data_toggle: equ 5Ch58h tx_ack_pending: equ 5Dh59h tx_app_header: equ 66h tx_app_buffer: equ 67h ; requires 9 bytes ENDIF ; TWO_WAY_DATA ;---------------------------------------------------- ; Automatic Bind Configuration ;---------------------------------------------------- IFDEF BIND_AUTO PING_DATA: equ 31h PING_RSP_DATA: equ 38h CONN_RSP_YES: equ 29h CONN_RSP_NO: equ 20h PING_LOOP_TIMEOUT: equ 3 ; time between PING messages PING_TIMEOUT: equ 10 ; number of PING messages to send per channel PING_REASON_NORMAL: equ 0 PING_REASON_RSSI: equ 1 PING_REASON_CORRUPT: equ 2 BIND_CHANNEL_TIMEOUT: equ 132 ; 132 ms on each channel BIND_TIMEOUT: equ 95 ; bind listens on each channel five times... Bind mode takes approximately 13 secs BIND_INIT_CHANNEL: equ 00h BIND_PN_CODE: equ 00h BIND_CHECKSUM_SEED: equ 00h MAX_PIN: equ 07h ; PIN is A 3-bit value MIN_PIN: equ 03h ; PIN needs to be large enough to jump around a Wi-Fi channel mPIN_MASK: equ 07h network_pin: equ 5Eh5Ah base_channel: equ 5Fh5Bh network_pn_code: equ 60h ping_channel: equ 61h mode_timer: equ 62h corrupt_counter: equ 63h rssi_counter: equ 64h ping_channel_count: equ 65h rssi_adjust: equ 9Bh IFDEF AGC_SUPPORT corrupt_rssi: equ 9Ch agc_control: equ 9Dh ENDIF ; AGC_SUPPORT ENDIF ; BIND_AUTO ;------------------------------------------------------ ; Semi-automatic Bind Configuration ;------------------------------------------------------ ping_channel: equ 5Ch mode_timer: equ 5Dh corrupt_counter: equ 5Eh ping_channel_count: equ 5Fh rssi_counter: equ 60h rssi_threshold: equ 61h IFDEF BIND_SEMIDYNAMIC_PA_SUPPORT BIND_NUM_BYTES: equ 02h ; number of data bytes in bind packet (excludes checksum) PING_TIMER_INIT: equ 15 PING_DATA: equ 5Ah BS_BIND: equ 00h ; waiting for A bind packet BS_PING: equ 01h ; waiting for A ping packet BIND_CHANNEL: equ 77 BIND_PN_CODE: equ 00 bind_state: equ 5Eh bind_timer: equ 5Fh ; total time in bind mode (DEC 'd every time we reinit the radio, approximately every 48ms) ping_timer: equ 60h ; time waiting for A ping ENDIF ; BIND_SEMI pa_bias_a: equ 64h pa_bias_b: equ 65h PA_POSITION: equ 5 ENDIF ; DYNAMIC_PA_SUPPORT ENDIF ; BIND_AUTO IFDEF MFG_TEST in_mfg_test: equ 9Eh9Fh ENDIF ; MFG_TEST ;------------------------------------------------------ ; Hardware Constants ;------------------------------------------------------ bBUTTON_DOWN: equ 01h ; port 0 nRESET: equ 01h IRQ: equ 02h DIO0: equ 04h nCS: equ 04h DIO1: equ 08h nDATA_LED: equ 08h EnSS: equ 10h EMOSI: equ 20h EMISO: equ 40h ESCLK: equ 80h ; port 1 nPD_R: equ 01h PWR_EN: equ 02h IFDEF PDC_9168 nBIND_LED: equ 02h ENDIF ; PDC_9168 IFDEF PDC_9075 nBIND_LED: equ 04h ENDIF ; PDC_9075 ; port 2 BIND_BUTTON: equ 02h P0_MODE_1_DEFAULT: equ (ESCLK | EMOSI | EnSS | nDATA_LED | nCS | nRESET) ;BDh ;1011 1101 P0_MODE_0_DEFAULT: equ (ESCLK | EMOSI ) ;A0h ;1010 0000 ;P0_DATA_DEFAULT: equ (ESCLK | EMISO | EMOSI | EnSS | nCS | nRESET) ;F5h ;1111 0101 P0_MODE_1_SUSPEND: equ FFh P0_MODE_0_SUSPEND: equ 00h P0_DATA_SUSPEND: equ 1Dh P1_BITS: equ (PWR_EN | nPD_R) P1_MODE_1_DEFAULT: equ FFh P1_MODE_0_DEFAULT: equ 00h ;P1_DATA_DEFAULT: equ (PWR_EN | nPD_R) ;03h ;0000 0011 P1_MODE_1_SUSPEND: equ FFh P1_MODE_0_SUSPEND: equ 00h P1_DATA_SUSPEND: equ FEh ; continue to hold nPD low during suspend ;P1_DATA_SUSPEND: equ FFh