📄 drivers.lst
字号:
236: * Function: read 1 word from SPI
237: * Parameters: SPI address
238: * Return: a word, w. w[0] is the MSB, w[1] is the LSB
239: **************************************************************/
240: __uint16__ drv_read_spi_1(__uint8__ addr)
241: {
Function: drv_read_spi_1
Source : D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\Sources\drivers.c
Options : -Cs08 -DAXM_0308 -Env"GENPATH=*D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac;D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\target\include;*C:\Program Files\Metrowerks\CW08 V3.1" -Env"LIBPATH=*C:\Program Files\Metrowerks\CW08 V3.1" -Env"OBJPATH=D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\bin" -Env"TEXTPATH=D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\bin" -Lasm=%n.lst -Ms -ObjN="D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\smac_Data\GB60_(EVB_-_rev_A-B-C)\ObjectCode\drivers.c.o" -WmsgSd1106 -WmsgSd1420 -WmsgSd1801 -WmsgSd2705
0000 87 PSHA
0001 a7fe AIS #-2
242: __uint16__ w; /* w[0] is MSB, w[1] is LSB */
243: __uint8__ temp_value; /* Used to flush the SPI1D register during read */
244: temp_value = SPI1S; /* Clear status register (possible SPRF, SPTEF) */
0003 b600 LDA _SPI1S
245: temp_value = SPI1D; /* Clear receive data register. SPI entirely ready for read or write */
0005 b600 LDA _SPI1D
246: disable_MC13192_interrupts(); /* Necessary to prevent double SPI access */
0007 cd0000 JSR disable_MC13192_interrupts
247: AssertCE; /* Enables MC13192 SPI */
000a 1500 BCLR 2,_PTED
248: SPI1D = (addr & 0x3f) | 0x80; /* Mask address, 6bit addr, Set read bit. */
000c 95 TSX
000d e602 LDA 2,X
000f a43f AND #63
0011 aa80 ORA #-128
0013 ad19 BSR L2E ;abs = 002e
249: WaitSPI_transfer_done(); /* For this bit to be set, SPTED MUST be set */
250: temp_value = SPI1D; /* Clear receive data register. SPI entirely ready for read or write */
251: SPI1D = addr; /* Dummy write. Receive register of SPI will contain MSB */
0015 95 TSX
0016 e602 LDA 2,X
0018 ad14 BSR L2E ;abs = 002e
252: WaitSPI_transfer_done(); /* For this bit to be set, SPTED MUST be set. Get MSB */
253: ((__uint8__*)&w)[0] = SPI1D; /* MSB */
001a 95 TSX
001b f7 STA ,X
254: SPI1D = addr; /* Dummy write. Waiting until after reading received data insures no overrun */
001c e602 LDA 2,X
001e ad0e BSR L2E ;abs = 002e
255: WaitSPI_transfer_done(); /* For this bit to be set, SPTED MUST be set. Get LSB */
256: ((__uint8__*)&w)[1] = SPI1D; /* LSB */
0020 95 TSX
0021 e701 STA 1,X
257: DeAssertCE; /* Disables MC13192 SPI */
0023 1400 BSET 2,_PTED
258: restore_MC13192_interrupts(); /* Restore MC13192 interrupt status */
0025 cd0000 JSR restore_MC13192_interrupts
259: return w;
0028 9efe01 LDHX 1,SP
260: }
002b a703 AIS #3
002d 81 RTS
002e L2E:
002e b700 STA _SPI1D
0030 cd0000 JSR WaitSPI_transfer_done
0033 b600 LDA _SPI1D
0035 81 RTS
261:
262: /**************************************************************
263: * Parameters: None
264: * Purpose: Waits until the SPI1D has been transferred and received
265: **************************************************************/
266: void WaitSPI_transfer_done(void)
267: {
Function: WaitSPI_transfer_done
Source : D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\Sources\drivers.c
Options : -Cs08 -DAXM_0308 -Env"GENPATH=*D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac;D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\target\include;*C:\Program Files\Metrowerks\CW08 V3.1" -Env"LIBPATH=*C:\Program Files\Metrowerks\CW08 V3.1" -Env"OBJPATH=D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\bin" -Env"TEXTPATH=D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\bin" -Lasm=%n.lst -Ms -ObjN="D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\smac_Data\GB60_(EVB_-_rev_A-B-C)\ObjectCode\drivers.c.o" -WmsgSd1106 -WmsgSd1420 -WmsgSd1801 -WmsgSd2705
0000 L0:
268: while (!(SPI1S_SPRF))
0000 0f00fd BRCLR 7,_SPI1S,L0 ;abs = 0000
269: {
270: }
271: }
0003 81 RTS
272:
273: /**************************************************************
274: * Function: disable MC13192 interrupts
275: * Parameters: none
276: * Return:
277: **************************************************************/
278: void disable_MC13192_interrupts(void)
279: {
Function: disable_MC13192_interrupts
Source : D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\Sources\drivers.c
Options : -Cs08 -DAXM_0308 -Env"GENPATH=*D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac;D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\target\include;*C:\Program Files\Metrowerks\CW08 V3.1" -Env"LIBPATH=*C:\Program Files\Metrowerks\CW08 V3.1" -Env"OBJPATH=D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\bin" -Env"TEXTPATH=D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\bin" -Lasm=%n.lst -Ms -ObjN="D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\smac_Data\GB60_(EVB_-_rev_A-B-C)\ObjectCode\drivers.c.o" -WmsgSd1106 -WmsgSd1420 -WmsgSd1801 -WmsgSd2705
280: irq_value = MC13192_IRQ_SOURCE; /* Save the context of the MC13192_INT_REG (global) */
0000 b600 LDA _IRQSC
0002 c70000 STA irq_value
281: MC13192_IRQ_SOURCE = irq_value & ~(0x06); /* Disable the MC13192 interrupt source */
0005 a4f9 AND #-7
0007 b700 STA _IRQSC
282: }
0009 81 RTS
283:
284: /**************************************************************
285: * Function: restore MC13192 interrupts to previous condition
286: * Parameters: none
287: * Return:
288: **************************************************************/
289: void restore_MC13192_interrupts(void)
290: {
Function: restore_MC13192_interrupts
Source : D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\Sources\drivers.c
Options : -Cs08 -DAXM_0308 -Env"GENPATH=*D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac;D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\target\include;*C:\Program Files\Metrowerks\CW08 V3.1" -Env"LIBPATH=*C:\Program Files\Metrowerks\CW08 V3.1" -Env"OBJPATH=D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\bin" -Env"TEXTPATH=D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\bin" -Lasm=%n.lst -Ms -ObjN="D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\smac_Data\GB60_(EVB_-_rev_A-B-C)\ObjectCode\drivers.c.o" -WmsgSd1106 -WmsgSd1420 -WmsgSd1801 -WmsgSd2705
291: MC13192_IRQ_SOURCE = irq_value; /* Restore the context of the IRQ register from global */
0000 c60000 LDA irq_value
0003 b700 STA _IRQSC
292:
293: }
0005 81 RTS
294:
295:
296: /**************************************************************
297: * Function: write a block of data to TX packet RAM (whichever is selected)
298: * Parameters: length length of the block of data in bytes
299: * *contents pointer to the data block
300: **************************************************************/
301: void drv_write_tx_ram(tx_packet_t *tx_pkt)
302: {
Function: drv_write_tx_ram
Source : D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\Sources\drivers.c
Options : -Cs08 -DAXM_0308 -Env"GENPATH=*D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac;D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\target\include;*C:\Program Files\Metrowerks\CW08 V3.1" -Env"LIBPATH=*C:\Program Files\Metrowerks\CW08 V3.1" -Env"OBJPATH=D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\bin" -Env"TEXTPATH=D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\bin" -Lasm=%n.lst -Ms -ObjN="D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\smac_Data\GB60_(EVB_-_rev_A-B-C)\ObjectCode\drivers.c.o" -WmsgSd1106 -WmsgSd1420 -WmsgSd1801 -WmsgSd2705
0000 89 PSHX
0001 8b PSHH
0002 a7fb AIS #-5
303: __uint8__ i, ibyte, temp_value; /* i, ibyte are counters. temp_value is used to flush the SPI1D register during read */
304: __uint16__ reg; /* TX packet length register value */
305: reg = drv_read_spi_1(TX_PKT_LEN); /* Read the TX packet length register contents */
0004 a603 LDA #3
0006 ad00 BSR drv_read_spi_1
0008 9eff03 STHX 3,SP
306: reg = (0xFF80 & reg) | (tx_pkt->dataLength + 2); /* Mask out old length setting and update. Add 2 for CRC */
000b 9efe06 LDHX 6,SP
000e f6 LDA ,X
000f 8c CLRH
0010 97 TAX
0011 af02 AIX #2
0013 9ee604 LDA 4,SP
0016 a480 AND #-128
0018 89 PSHX
0019 8b PSHH
001a 95 TSX
001b ea01 ORA 1,X
001d e701 STA 1,X
001f 86 PULA
0020 ea04 ORA 4,X
307: drv_write_spi_1(TX_PKT_LEN, reg); /* Update the TX packet length field */
0022 e702 STA 2,X
0024 88 PULX
0025 87 PSHA
0026 8a PULH
0027 a603 LDA #3
0029 cd0000 JSR drv_write_spi_1
308: temp_value = SPI1S; /* Clear status register (possible SPRF, SPTEF) */
002c b600 LDA _SPI1S
309: temp_value = SPI1D; /* Clear receive data register. SPI entirely ready for read or write */
002e b600 LDA _SPI1D
310: disable_MC13192_interrupts(); /* Necessary to prevent double SPI access */
0030 ad00 BSR disable_MC13192_interrupts
311: AssertCE; /* Enables MC13192 SPI */
0032 1500 BCLR 2,_PTED
312: SPI1D = TX_PKT; /* SPI TX ram data register */
0034 6e0200 MOV #2,_SPI1D
313: WaitSPI_transfer_done(); /* For this bit to be set, SPTED MUST be set. Now write content MSB */
0037 ad00 BSR WaitSPI_transfer_done
314: temp_value = SPI1D; /* Clear receive data register. SPI entirely ready for read or write */
0039 b600 LDA _SPI1D
315: ibyte = 0; /* Byte counter for *contents */
003b 95 TSX
003c 6f01 CLR 1,X
316: for (i=0; i<((tx_pkt->dataLength+1) >> 1); i++) /* Word loop. Round up. */
003e 6f04 CLR 4,X
0040 2041 BRA L83 ;abs = 0083
0042 L42:
317: {
318: SPI1D = tx_pkt->data[ibyte + 1]; /* Write MSB */
0042 95 TSX
0043 e601 LDA 1,X
0045 87 PSHA
0046 8c CLRH
0047 88 PULX
0048 af01 AIX #1
004a 89 PSHX
004b 8b PSHH
004c 9efe08 LDHX 8,SP
004f 9ee602 LDA 2,SP
0052 eb02 ADD 2,X
0054 9ee702 STA 2,SP
0057 86 PULA
0058 e901 ADC 1,X
005a 87 PSHA
005b 8a PULH
005c 88 PULX
005d 7e00 MOV X+,_SPI1D
319: WaitSPI_transfer_done(); /* For this bit to be set, SPTED MUST be set. Now write content LSB */
005f ad00 BSR WaitSPI_transfer_done
320: temp_value = SPI1D; /* Clear receive data register. SPI entirely ready for read or write */
0061 b600 LDA _SPI1D
321: SPI1D = tx_pkt->data[ibyte]; /* Write LSB */
0063 95 TSX
0064 e601 LDA 1,X
0066 9efe06 LDHX 6,SP
0069 eb02 ADD 2,X
006b 87 PSHA
006c 4f CLRA
006d e901 ADC 1,X
006f 87 PSHA
0070 8a PULH
0071 88 PULX
0072 7e00 MOV X+,_SPI1D
322: ibyte=ibyte+2; /* Increment byte counter */
0074 95 TSX
0075 e601 LDA 1,X
0077 ab02 ADD #2
0079 e701 STA 1,X
323: WaitSPI_transfer_done(); /* For this bit to be set, SPTED MUST be set.*/
007b cd0000 JSR WaitSPI_transfer_done
324: temp_value = SPI1D; /* Clear receive data register. SPI entirely ready for read or write */
007e b600 LDA _SPI1D
0080 95 TSX
0081 6c04 INC 4,X
0083 L83:
0083 9efe06 LDHX 6,SP
0086 f6 LDA ,X
0087 8c CLRH
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -