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

📄 simple_phy.lst

📁 在飞思卡尔MC9S08GB60单片机环境下实现了无线监控
💻 LST
📖 第 1 页 / 共 5 页
字号:
ANSI-C/cC++ Compiler for HC08 V-5.0.19 (beta 0) Build 4210, Jul 29 2004

    1:  /**************************************************************
    2:  *	This is the SMAC C source physical layer file for the HC(S)08 MCU
    3:  *   and MC13192 transceiver.
    4:  *   The SMAC phy is the second lowest layer of C code.
    5:  **************************************************************/
    6:  
    7:  
    8:  /**************************************************************
    9:  *	Includes
   10:  **************************************************************/
   11:  #include "MC13192_regs.h"
   12:  #include "MC13192_hw_config.h"
   13:  #include <hidef.h>
   14:  #include "pub_def.h"
   15:  #include "drivers.h"
   16:  #include "simple_phy.h"
   17:  #include "simple_mac.h"
   18:  #include "mcu_hw_config.h"
   19:  
   20:  /**************************************************************
   21:  *	Globals
   22:  **************************************************************/
   23:  extern rx_packet_t *drv_rx_packet;
   24:  extern byte rtx_mode;
   25:  
   26:  /**************************************************************
   27:  * Version string to put in NVM. Note! size limits
   28:  **************************************************************/
   29:  
   30:  // Normally it shoud be enough to change the version numbers.
   31:  #define PHY_Version		"1.00"
   32:  #define PHY_Label       "SPHY "
   33:  
   34:  #pragma MESSAGE DISABLE C3303  // Warning C3303: Implicit concatenation of strings
   35:  #pragma MESSAGE DISABLE C4200  // Warning C4200: Other segment than in previous declaration
   36:  #pragma CONST_SEG BOOTLOADER_PHY_NV_DATA0
   37:  
   38:  // DO NOT CHANGE OR REMOVE
   39:  
   40:  // This string will be located in the NV RAM0 section.
   41:  // Note!! Check that item is location in the sequence as specified. 
   42:  const unsigned char SPHY_Version[47] = "PHY " PHY_Label " Ver " PHY_Version " Build: "__DATE__" "__TIME__;
   43:  
   44:  #pragma CONST_SEG DEFAULT
   45:  
   46:  /**************************************************************
   47:  *	Function: 	Transmit data packet
   48:  *	Parameters: packet pointer
   49:  *	Return:		status
   50:  **************************************************************/
   51:  int pd_data_request(tx_packet_t *packet)
   52:  {

Function: pd_data_request
Source  : D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\Sources\simple_phy.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\simple_phy.c.o" -WmsgSd1106 -WmsgSd1420 -WmsgSd1801 -WmsgSd2705 -WmsgSd3303 -WmsgSd4200

   53:  	if (rtx_mode == IDLE_MODE)
  0000 c60000           LDA   rtx_mode
  0003 2613             BNE   L18 ;abs = 0018
   54:  	{ 
   55:  		drv_write_tx_ram(packet); /* Load the data into packet RAM */
  0005 cd0000           JSR   drv_write_tx_ram
   56:  		PLME_set_trx_state_request(TX_MODE); /* transmit it */
  0008 a603             LDA   #3
  000a cd0000           JSR   PLME_set_trx_state_request
   57:  		/* Wait for the state to return to idle. (finish transmitting) */
   58:  		while (rtx_mode != IDLE_MODE)
  000d 21               SKIP1 LF ;abs = 000f
  000e          LE:     
   59:  		{
   60:  			MCU_LOW_POWER_WHILE;
  000e 8f               WAIT  
  000f          LF:     
  000f c60000           LDA   rtx_mode
  0012 26fa             BNE   LE ;abs = 000e
   61:  		}
   62:  		return SUCCESS;
  0014 ae77             LDX   #119
  0016 8c               CLRH  
  0017 81               RTS   
  0018          L18:    
   63:  	}
   64:  	else
   65:  	{
   66:  		return RX_ON;
  0018 ae01             LDX   #1
  001a 8c               CLRH  
   67:  	}
   68:  }
  001b 81               RTS   
   69:  
   70:  /**************************************************************
   71:  *	Function: 	Receive data packet indication
   72:  *	Parameters: none
   73:  *	Return:		MCPS data indication
   74:  **************************************************************/
   75:  void pd_data_indication()
   76:  {

Function: pd_data_indication
Source  : D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\Sources\simple_phy.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\simple_phy.c.o" -WmsgSd1106 -WmsgSd1420 -WmsgSd1801 -WmsgSd2705 -WmsgSd3303 -WmsgSd4200

   77:  	/* Read the Data only if it is a good packet. */
   78:  	if (drv_rx_packet->status == SUCCESS)
  0000 320000           LDHX  drv_rx_packet
  0003 e604             LDA   4,X
  0005 a177             CMP   #119
  0007 2603             BNE   LC ;abs = 000c
   79:  	{
   80:  		drv_read_rx_ram(drv_rx_packet); /* read data from MC13192, check status */
  0009 cd0000           JSR   drv_read_rx_ram
  000c          LC:     
   81:  	}
   82:  	EnableInterrupts; /* Allow system interrupts within the IRQ handler */
  000c 9a               CLI   
   83:  	MCPS_data_indication(drv_rx_packet);
  000d 320000           LDHX  drv_rx_packet
  0010 cc0000           JMP   MCPS_data_indication
   84:  }
   85:  
   86:  /**************************************************************
   87:  *	Function: 	Hibernate the MC13192 (very low current, no CLKO)
   88:  *	Parameters: none
   89:  *	Return:		status
   90:  **************************************************************/
   91:  int PLME_hibernate_request(void)
   92:  {

Function: PLME_hibernate_request
Source  : D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\Sources\simple_phy.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\simple_phy.c.o" -WmsgSd1106 -WmsgSd1420 -WmsgSd1801 -WmsgSd2705 -WmsgSd3303 -WmsgSd4200

  0000 a7fe             AIS   #-2
   93:  	__uint16__ current_value;
   94:  	rtx_mode = HIBERNATE_MODE;
  0002 a681             LDA   #-127
  0004 c70000           STA   rtx_mode
   95:  	current_value = drv_read_spi_1(MODE2_ADDR);	/* Read MC13192 Hiberate register. */
  0007 a607             LDA   #7
  0009 cd0000           JSR   drv_read_spi_1
  000c 9eff01           STHX  1,SP
   96:  	current_value &= 0xFFFC;
  000f 95               TSX   
  0010 e601             LDA   1,X
  0012 a4fc             AND   #-4
  0014 e701             STA   1,X
   97:  	current_value |= 0x0002; /* Hiberate enable */
  0016 aa02             ORA   #2
  0018 e701             STA   1,X
   98:  	drv_write_spi_1(MODE2_ADDR, current_value);	/* Write back to MC13192 to enable hibernate mode. */
  001a a607             LDA   #7
  001c 9efe01           LDHX  1,SP
  001f cd0000           JSR   drv_write_spi_1
   99:  	return SUCCESS;		/* Call back to MAC layer indicating success. */
  0022 ae77             LDX   #119
  0024 8c               CLRH  
  100:  }
  0025 a702             AIS   #2
  0027 81               RTS   
  101:  
  102:  /**************************************************************
  103:  *	Function: 	Doze the MC13192 (Low current, CLKO <= 1MHz)
  104:  *	Parameters: none
  105:  *	Return:		status
  106:  **************************************************************/
  107:  int PLME_doze_request(void)
  108:  {

Function: PLME_doze_request
Source  : D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\Sources\simple_phy.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\simple_phy.c.o" -WmsgSd1106 -WmsgSd1420 -WmsgSd1801 -WmsgSd2705 -WmsgSd3303 -WmsgSd4200

  0000 a7fe             AIS   #-2
  109:  	__uint16__ current_value;
  110:  	rtx_mode = DOZE_MODE;
  0002 a682             LDA   #-126
  0004 c70000           STA   rtx_mode
  111:  	current_value = drv_read_spi_1(MODE2_ADDR);	/* Read MC13192 Doze register. */
  0007 a607             LDA   #7
  0009 cd0000           JSR   drv_read_spi_1
  000c 9eff01           STHX  1,SP
  112:  	current_value &= 0xFFFC;
  000f 95               TSX   
  0010 e601             LDA   1,X
  0012 a4fc             AND   #-4
  0014 e701             STA   1,X
  113:  	current_value |= 0x0001; /* Doze (acoma) enable */
  0016 aa01             ORA   #1
  0018 e701             STA   1,X
  114:  	drv_write_spi_1(MODE2_ADDR, current_value);	/* Write back to MC13192 to enable hibernate mode. */
  001a a607             LDA   #7
  001c 9efe01           LDHX  1,SP
  001f cd0000           JSR   drv_write_spi_1
  115:  	return SUCCESS;		/* Call back to MAC layer indicating success. */
  0022 ae77             LDX   #119
  0024 8c               CLRH  
  116:  }
  0025 a702             AIS   #2
  0027 81               RTS   
  117:  
  118:  /**************************************************************
  119:  *	Function: 	Wake the MC13192 from Hibernate or Doze
  120:  *	Parameters: none
  121:  *	Return:		status
  122:  **************************************************************/
  123:  int PLME_wake_request(void)
  124:  {

Function: PLME_wake_request
Source  : D:\Profiles\flr005\My Documents\Bluetooth Exchange Folder\smac 4_0\CW_IDE_3p1\smac\Sources\simple_phy.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\simple_phy.c.o" -WmsgSd1106 -WmsgSd1420 -WmsgSd1801 -WmsgSd2705 -WmsgSd3303 -WmsgSd4200

  0000 a7fe             AIS   #-2
  125:  	__uint16__ current_value;
  126:  	Wake_MC13192(); /* Wake up the device */
  0002 cd0000           JSR   Wake_MC13192
  127:  	while (rtx_mode != IDLE_MODE_ATTN)
  0005 21               SKIP1 L7 ;abs = 0007
  0006          L6:     
  128:  	{
  129:  		MCU_LOW_POWER_WHILE; /* Wait until ATTN */
  0006 8f               WAIT  
  0007          L7:     
  0007 c60000           LDA   rtx_mode
  000a a184             CMP   #-124
  000c 26f8             BNE   L6 ;abs = 0006
  130:  	}
  131:  	current_value = drv_read_spi_1(MODE2_ADDR);	/* Read MC13192 Hiberate/Doze register. */
  000e a607             LDA   #7
  0010 cd0000           JSR   drv_read_spi_1
  0013 9eff01           STHX  1,SP
  132:  	current_value &= 0xFFFC; /* Hiberate and Doze disable */
  0016 95               TSX   
  0017 e601             LDA   1,X
  0019 a4fc             AND   #-4
  001b e701             STA   1,X
  133:  	drv_write_spi_1(MODE2_ADDR, current_value);	/* Write back to MC13192 to disable hibernate and doze mode. */
  001d a607             LDA   #7
  001f 9efe01           LDHX  1,SP
  0022 cd0000           JSR   drv_write_spi_1
  134:  	rtx_mode = IDLE_MODE;
  0025 4f               CLRA  
  0026 c70000           STA   rtx_mode
  135:  	return SUCCESS;
  0029 ae77             LDX   #119
  002b 8c               CLRH  
  136:  }
  002c a702             AIS   #2
  002e 81               RTS   
  137:  
  138:  /**************************************************************

⌨️ 快捷键说明

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