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

📄 lpradio.asm

📁 CYRF6936 zigbee模块设计的全部资料
💻 ASM
📖 第 1 页 / 共 2 页
字号:
;
; 'C' Call:        RADIO_FRAME_CONFIG RadioGetFrameConfig(void);
;
; Assembly Call:   A: Unused
;                  X: Unused
;
; Assembly Return: A: config
;                  X: Undefined
;
_RadioGetFrameConfig::
 RadioGetFrameConfig::
                   MOV     A, FRAMING_CFG_ADR
                   JMP     RadioRead
                    
.endsection
.section
;--------------------------------------------------------------------------------
;
; RadioSetThreshold32:
;                  Set the threshold for the 32 chip data modes.
;
; '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
.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
.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
.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
.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
                   MOV     [RadioWipPtr], <RadioTemp1  ; The 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
.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::
                   MOV     [RadioWipPtr], <RadioTemp1  ; The 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, [RadioTemp1]             ; The first byte is the count.
                   RET
                    
.endsection
.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::
                   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.
                   MOV     [RadioWipPtr], <RadioTemp1  ; Write the pattern as a 2 byte file
                   MOV     A, PREAMBLE_ADR             ;  register burst.
                   MOV     X, 2
                   JMP     RadioFileWriteWip

.endsection
.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::
                   MOV     [RadioWipPtr], <RadioTemp1  ; The 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
.section
;--------------------------------------------------------------------------------
;
; RadioSetCrcSeed: Sets the value used as the CRC seed value for both transmit and receive.
;
; 'C' Call:        void RadioSetCrcSeed(WORD crcSeed);
;
; Assembly Call:   A: crcSeed low order
;                  X: crcSeed high order
;
; Assembly Return: A: Undefined
;                  X: Undefined
;
 RadioSetCrcSeed::
_RadioSetCrcSeed:: MOV     [RadioTemp1], A              ; Save the pattern into our little work
                   MOV     [RadioTemp2], X              ;  buffer and...
                   MOV     [RadioWipPtr], <RadioTemp1   ;  ...write the pattern as a 2 byte file
                   MOV     A, CRC_SEED_LSB_ADR          ;  register burst.
                   MOV     X, 2
                   JMP     RadioBurstWriteWip

.endsection
.section
;--------------------------------------------------------------------------------
;
; RadioGetCrcSeed: Returns the value used as the CRC seed value for both transmit and receive.
;
; 'C' Call:        WORD RadioGetCrcSeed(void);
;
; Assembly Call:   A: unused
;                  X: unused
;
; Assembly Return: A: crcSeed low order
;                  X: crcSeed high order
;
 RadioGetCrcSeed::
_RadioGetCrcSeed:: MOV     [RadioWipPtr], <RadioTemp1  ; The preamble file register is 3 bytes
                   MOV     A, CRC_SEED_LSB_ADR         ;  and must always be accessed 3 times
                   MOV     X, 2                        ;  so do a burst read of the 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
.section
;--------------------------------------------------------------------------------
;
; RadioGetFuses:   Get the fuse values from the radio.
;
;                  The 8 bytes will be stored at the buffer pointed to by the most
;                  recent call to 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
                   
                   MOV     X, [RadioPtr]
                   MOV     A, 5
.Loop:             XOR     [X+0], 0xFF
                   INC     X
                   DEC     A
                   JNC     .Loop
                   
                   MOV     A, MFG_ID_ADR                ; Turn off fuse read bias.
                   MOV     X, 0
                   JMP     RadioWrite
.endsection
.section
;--------------------------------------------------------------------------------
;
; RadioSetConstSopPnCode:
;                  Set the Start Of Packet 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::
                   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     .noIncHi
                   INC     [RadioConstAddrHi]
.noIncHi:          MOV     X, [RadioFileAddr]
                   CALL    RadioWriteSwapped
                   DEC     [RadioCount]
                   JNZ     .loop
                   RET             

.endsection
.section
;--------------------------------------------------------------------------------
;
; RadioSetConstDataPnCode:
;                  Set the Start Of Packet 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::
                   MOV     [RadioFileAddr], DATA_CODE_ADR
                   CALL    RadioSetConstCode2
                   JMP     RadioSetConstCode

.endsection
.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     .noIncHi
                   INC     X
.noIncHi:          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

;
; Code compression enabled again.
;
                   ENABLE_CODE_COMPRESSION

⌨️ 快捷键说明

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