⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lpradio.asm

📁 the newest cypress wirelessusb LP and PROC LP radio driver
💻 ASM
📖 第 1 页 / 共 2 页
字号:
; 'C' Call:        void RadioSetThreshold32(BYTE threshold);
;
; Assembly Call:   A: threshold
;                  X: Unused
;
; Assembly Return: A: Undefined
;                  X: Undefined
;
_RadioSetThreshold32::
 RadioSetThreshold32::
        MOV     X, DATA32_THOLD_ADR
        JMP     RadioWriteSwapped
                    
.endsection
IF PROVIDE_ALL_FUNCTIONS
.section
;-----------------------------------------------------------------------------
;
; RadioGetThreshold32:
;                  Return the threshold for the 32 chip data modes.
;
; 'C' Call:        BYTE RadioGetThreshold32(void);
;
; Assembly Call:   A: unused
;                  X: unused
;
; Assembly Return: A: threshold
;                  X: Undefined
;
_RadioGetThreshold32::
 RadioGetThreshold32::
        MOV     A, DATA32_THOLD_ADR
        JMP     RadioRead
                    
.endsection
ENDIF
IF PROVIDE_ALL_FUNCTIONS
.section
;-----------------------------------------------------------------------------
;
; RadioSetThreshold64:
;                  Set the threshold for the 64 chip data modes.
;
; 'C' Call:        void RadioSetThreshold64(BYTE threshold);
;
; Assembly Call:   A: threshold
;                  X: Unused
;
; Assembly Return: A: Undefined
;                  X: Undefined
;
_RadioSetThreshold64::
 RadioSetThreshold64::
        MOV     X, DATA64_THOLD_ADR
        JMP     RadioWriteSwapped
                    
.endsection
ENDIF
IF PROVIDE_ALL_FUNCTIONS
.section
;-----------------------------------------------------------------------------
;
; RadioGetThreshold64:
;                  Return the threshold for the 64 chip data modes.
;
; 'C' Call:        BYTE RadioGetThreshold64(void);
;
; Assembly Call:   A: unused
;                  X: unused
;
; Assembly Return: A: threshold
;                  X: Undefined
;
_RadioGetThreshold64::
 RadioGetThreshold64::
        MOV     A, DATA64_THOLD_ADR
        JMP     RadioRead
                    
.endsection
ENDIF
.section
;-----------------------------------------------------------------------------
;
; RadioSetPreambleCount:
;                  Set the preamble repetition count.
;
; 'C' Call:        void RadioSetPreambleCount(BYTE count);
;
; Assembly Call:   A: preamble count
;                  X: Unused
;
; Assembly Return: A: Undefined
;                  X: Undefined
;
_RadioSetPreambleCount::
 RadioSetPreambleCount::
        MOV     X, PREAMBLE_ADR         ; Write the preamble count...
        CALL    RadioWriteSwapped

        RAM_SETPAGE_CUR >RadioDriverRamPage
  IF (SYSTEM_LARGE_MEMORY_MODEL)
        MOV     [RadioWipPtr+1], >RadioTemp1 ; LMM: MSByte RadioWipPtr 
  ENDIF
        MOV     [RadioWipPtr+0], <RadioTemp1 ; LSByte RadioWipPtr
                                        ; Preamble file register is 3 bytes
        MOV     A, PREAMBLE_ADR         ;  and must always be accessed 3 times
        MOV     X, 2                    ;  so do a throw away burst read of 2
        JMP     RadioFileReadWip        ;  to move it a total of 3 bytes.

.endsection
IF PROVIDE_ALL_FUNCTIONS
.section
;-----------------------------------------------------------------------------
;
; RadioGetPreambleCount:
;                  Get the preamble repetition count.
;
; 'C' Call:        BYTE RadioGetPreambleCount(void);
;
; Assembly Call:   A: unused
;                  X: unused
;
; Assembly Return: A: preamble count
;                  X: Undefined
;
_RadioGetPreambleCount::
 RadioGetPreambleCount::
        RAM_SETPAGE_CUR >RadioDriverRamPage
  IF (SYSTEM_LARGE_MEMORY_MODEL)
        MOV     [RadioWipPtr+1], >RadioTemp1 ; LMM: MSB RadioWipPtr
  ENDIF
        MOV     [RadioWipPtr+0], <RadioTemp1 ; SMM: 8-bit RadioWipPtr
                                        ; The preamble file register is 3 byte
        MOV     A, PREAMBLE_ADR         ;  and must always be accessed 3 times
        MOV     X, 3                    ;  so do a burst read of the whole 3
        CALL    RadioFileReadWip        ;  byte file register.
        MOV     A, [RadioTemp1]         ; The first byte is the count.
        RET
                    
.endsection
ENDIF
IF PROVIDE_ALL_FUNCTIONS
.section
;-----------------------------------------------------------------------------
;
; RadioSetPreamblePattern:
;                  Set the preamble pattern.
;
; 'C' Call:        void RadioSetPreamblePattern(WORD pattern);
;
; Assembly Call:   A: pattern low order
;                  X: pattern high order
;
; Assembly Return: A: Undefined
;                  X: Undefined
;
_RadioSetPreamblePattern::
 RadioSetPreamblePattern::
        RAM_SETPAGE_CUR >RadioDriverRamPage
        MOV     [RadioTemp1], A         ; Save the pattern.
        MOV     [RadioTemp2], X
        MOV     A, PREAMBLE_ADR         ; Gotta access the whole 3 byte file -
        CALL    RadioRead               ;  do throw away read of preamblecount

  IF (SYSTEM_LARGE_MEMORY_MODEL)
        MOV     [RadioWipPtr+1], >RadioTemp1 ; LMM: MSB RadioWipPtr
  ENDIF
        MOV     [RadioWipPtr+0], <RadioTemp1 ; SMM: 8-bit RadioWipPtr
        MOV     A, PREAMBLE_ADR         ; Write the pattern as a 2 byte
        MOV     X, 2                    ;  file register burst.
        JMP     RadioFileWriteWip

.endsection
ENDIF
IF PROVIDE_ALL_FUNCTIONS
.section
;-----------------------------------------------------------------------------
;
; RadioGetPreamblePattern:
;                  Get the preamble pattern.
;
; 'C' Call:        WORD RadioGetPreamblePattern(void);
;
; Assembly Call:   A: unused
;                  X: unused
;
; Assembly Return: A: preamble count
;                  X: Undefined
;
_RadioGetPreamblePattern::
 RadioGetPreamblePattern::
        RAM_SETPAGE_CUR >RadioDriverRamPage
  IF (SYSTEM_LARGE_MEMORY_MODEL)
        MOV     [RadioWipPtr+1], >RadioTemp1 ; LMM: MSB RadioWipPtr
  ENDIF
        MOV     [RadioWipPtr+0], <RadioTemp1 ; SMM: 8-bit RadioWipPtr
                                        ; Preamble file register is 3 bytes
        MOV     A, PREAMBLE_ADR         ;  and must always be accessed 3 times
        MOV     X, 3                    ;  so do a burst read of the whole 3
        CALL    RadioFileReadWip        ;  byte file register.
        MOV     A, [RadioTemp2]         ; The first byte is the count and the
        MOV     X, [RadioTemp3]         ;  pattern is the 2nd and 3rd bytes.
        RET
                    
.endsection
ENDIF
.section
;-----------------------------------------------------------------------------
;
; RadioSetCrcSeed: Sets CRC seed value used for both Tx and Rx
;
; 'C' Call:        void RadioSetCrcSeed(WORD crcSeed);
;
; Assembly Call:   A: crcSeed low order
;                  X: crcSeed high order
;
; Assembly Return: A: Undefined
;                  X: Undefined
;
 RadioSetCrcSeed::
_RadioSetCrcSeed::
        RAM_SETPAGE_CUR >RadioDriverRamPage
        MOV     [RadioTemp1], A         ; Save pattern in local work buffer
        MOV     [RadioTemp2], X
  IF (SYSTEM_LARGE_MEMORY_MODEL)
        MOV     [RadioWipPtr+1], >RadioTemp1 ; LMM: MSB RadioWipPtr
  ENDIF
        MOV     [RadioWipPtr+0], <RadioTemp1 ; SMM: 8-bit RadioWipPtr
        MOV     A, CRC_SEED_LSB_ADR     ;  Write the pattern as a 2 byte file
        MOV     X, 2                    ;  register burst.
        JMP     RadioBurstWriteWip

.endsection
IF PROVIDE_ALL_FUNCTIONS
.section
;-----------------------------------------------------------------------------
;
; RadioGetCrcSeed: Return CRC seed value used for both Tx and Rx
;
; 'C' Call:        WORD RadioGetCrcSeed(void);
;
; Assembly Call:   A: unused
;                  X: unused
;
; Assembly Return: A: crcSeed low order
;                  X: crcSeed high order
;
 RadioGetCrcSeed::
_RadioGetCrcSeed::
        RAM_SETPAGE_CUR >RadioDriverRamPage
  IF (SYSTEM_LARGE_MEMORY_MODEL)
        MOV     [RadioWipPtr+1], >RadioTemp1 ; LMM: MSB RadioWipPtr
  ENDIF
        MOV     [RadioWipPtr+0], <RadioTemp1 ; SMM: 8-bit RadioWipPtr
                                        ; The 3-byte Preamble file register
        MOV     A, CRC_SEED_LSB_ADR     ;  must always be accessed 3 times
        MOV     X, 2                    ;  so do a burst read of whole 3
        CALL    RadioBurstReadWip       ;  byte file register.
        MOV     A, [RadioTemp1]         ; The first byte is the count and the
        MOV     X, [RadioTemp2]         ;  pattern is the 2nd and 3rd bytes.
        RET
                    
.endsection
ENDIF
IF PROVIDE_ALL_FUNCTIONS
.section
;-----------------------------------------------------------------------------
;
; RadioGetFuses:   Get the fuse values from the radio.
;
;                  Copy 6 bytes of Fuse data to buf specified by RadioSetPtr.
;
; 'C' Call:        void RadioGetFuses(void);
;
; Assembly Call:   A: unused
;                  X: unused
;
; Assembly Return: A: Undefined
;                  X: Undefined
;
 RadioGetFuses::
_RadioGetFuses::
        MOV     A, MFG_ID_ADR           ; Turn on fuse read bias.
        MOV     X, 0FFh
        CALL    RadioWrite

        MOV     A, MFG_ID_ADR           ; Read the fuses.
        MOV     X, 6
        CALL    RadioFileRead

;       RAM_SETPAGE_CUR >RadioDriverRamPage    already done by RadioWrite()
  IF (SYSTEM_LARGE_MEMORY_MODEL)
        MOV     A, [RadioPtr+1]         ; MSB RadioPtr (page number)
        RAM_SETPAGE_IDX A               ; IDX_PP = MSB
        RAM_X_POINTS_TO_INDEXPAGE       ; IDX instructions use IDX_PP reg
  ENDIF
        MOV     X, [RadioPtr+0]         ; LSB of pointer
        MOV     A, 5
.Loop:  XOR     [X+0], 0xFF
        INC     X
        DEC     A
        JNC     .Loop

        RAM_RESTORE_NATIVE_PAGING

        MOV     A, MFG_ID_ADR           ; Turn off fuse read bias.
        MOV     X, 0
        JMP     RadioWrite
.endsection
ENDIF
.section
;-----------------------------------------------------------------------------
;
; RadioSetConstSopPnCode:  Set SOP PN Code.
;
; 'C' Call:        void RadioSetConstSopPnCode(const BYTE *patternAddr);
;
; Assembly Call:   A: Code address high
;                  X: Code address low
;
; Assembly Return: A: Undefined
;                  X: Undefined
;
_RadioSetConstSopPnCode::
 RadioSetConstSopPnCode::
        RAM_SETPAGE_CUR >RadioDriverRamPage
        MOV     [RadioFileAddr], SOP_CODE_ADR
RadioSetConstCode2:
        MOV     [RadioConstAddrHi], A
        MOV     [RadioConstAddrLo], X
RadioSetConstCode:
        MOV     [RadioCount], 8
.loop:  MOV     A, [RadioConstAddrHi]
        MOV     X, [RadioConstAddrLo]
        ROMX
        INC     [RadioConstAddrLo]
        JNZ     .S1
        INC     [RadioConstAddrHi]
.S1:    MOV     X, [RadioFileAddr]
        CALL    RadioWriteSwapped
        DEC     [RadioCount]
        JNZ     .loop
        RET             

.endsection
IF PROVIDE_ALL_FUNCTIONS
.section
;-----------------------------------------------------------------------------
;
; RadioSetConstDataPnCode: Set DATA PN Code.
;
; 'C' Call:        void RadioSetConstDataPnCode(const BYTE *patternAddr);
;
; Assembly Call:   A: Code address high
;                  X: Code address low
;
; Assembly Return: A: Undefined
;                  X: Undefined
;
_RadioSetConstDataPnCode::
 RadioSetConstDataPnCode::
        RAM_SETPAGE_CUR >RadioDriverRamPage
        MOV     [RadioFileAddr], DATA_CODE_ADR
        CALL    RadioSetConstCode2
        JMP     RadioSetConstCode

.endsection
ENDIF
.section
;-----------------------------------------------------------------------------
;
; RadioSetSopPnCode: Set the Start Of Packet PN Code.
;
; 'C' Call:        void RadioSetSopPnCode(BYTE patternNum);
;
; Assembly Call:   A: Code number
;                  X: unused
;
; Assembly Return: A: Undefined
;                  X: Undefined
;
_RadioSetSopPnCode::
 RadioSetSopPnCode::
        ASL     A                           ; PN Codes are 8 bytes.
        ASL     A
        ASL     A
        MOV     X, >RadioPnCodeTable
        ADD     A, <RadioPnCodeTable
        JNC     .S1
        INC     X
.S1:    SWAP    A, X
        JMP     _RadioSetConstSopPnCode

;--------------------------------------------------------------------------;
;                                                                          ;
;                        P N   C o d e   T a b l e s                       ;
;                                                                          ;
;--------------------------------------------------------------------------;

;-----------------------------------------------------------------------------
;
; These are the 20 Multiplicative codes documented in RWW-87. The first 10 are
;  the set recommended as the best at the conclusion of that memo. 
;
; Bit ordering for these codes:
;  The LSB of the first byte is the first bit transceived.
;  The MSB of the first byte is the eighth bit transceived.
;  The MSB of the eighth byte is the last bit transceived.
;
RadioPnCodeTable:  DB   3Ch, 37h, CCh, 91h, E2h, F8h, CCh, 91h ; PN Code 0
                   DB   9Bh, C5h, A1h, 0Fh, ADh, 39h, A2h, 0Fh ; PN Code 1 
                   DB   EFh, 64h, B0h, 2Ah, D2h, 8Fh, B1h, 2Ah ; PN Code 2 
                   DB   66h, CDh, 7Ch, 50h, DDh, 26h, 7Ch, 50h ; PN Code 3 
                   DB   5Ch, E1h, F6h, 44h, ADh, 16h, F6h, 44h ; PN Code 4 
                   DB   5Ah, CCh, AEh, 46h, B6h, 31h, AEh, 46h ; PN Code 5 
                   DB   A1h, 78h, DCh, 3Ch, 9Eh, 82h, DCh, 3Ch ; PN Code 6 
                   DB   B9h, 8Eh, 19h, 74h, 6Fh, 65h, 18h, 74h ; PN Code 7 
                   DB   DFh, B1h, C0h, 49h, 62h, DFh, C1h, 49h ; PN Code 8 
                   DB   97h, E5h, 14h, 72h, 7Fh, 1Ah, 14h, 72h ; PN Code 9 
;
; Most systems do not need 20 codes and they take up much space, so we've
;  commented out most of the codes. Uncomment them if you need more.
;
;                   DB   82h, C7h, 90h, 36h, 21h, O3h, FFh, 17h ; PN Code 10 
;                   DB   E2h, F8h, CCh, 91h, 3Ch, 37h, CCh, 91h ; PN Code 11 
;                   DB   ADh, 39h, A2h, 0Fh, 9Bh, C5h, A1h, 0Fh ; PN Code 12 
;                   DB   D2h, 8Fh, B1h, 2Ah, EFh, 64h, B0h, 2Ah ; PN Code 13 
;                   DB   DDh, 26h, 7Ch, 50h, 66h, CDh, 7Ch, 50h ; PN Code 14 
;                   DB   ADh, 16h, F6h, 44h, 5Ch, E1h, F6h, 44h ; PN Code 15 
;                   DB   B6h, 31h, AEh, 46h, 5Ah, CCh, AEh, 46h ; PN Code 16 
;                   DB   9Eh, 82h, DCh, 3Ch, A1h, 78h, DCh, 3Ch ; PN Code 17 
;                   DB   6Fh, 65h, 18h, 74h, B9h, 8Eh, 19h, 74h ; PN Code 18 
;                   DB   62h, DFh, C1h, 49h, DFh, B1h, C0h, 49h ; PN Code 19 

.endsection

        ENABLE_CODE_COMPRESSION
; ############################################################################
; END OF lpRadio.asm
; ############################################################################

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -