📄 owihighlevelfunctions.s90
字号:
//////////////////////////////////////////////////////////////////////////////
// /
// IAR Atmel AVR C/EC++ Compiler V3.20A/W32 19/Aug/2004 16:18:27 /
// Copyright 1996-2004 IAR Systems. All rights reserved. /
// /
// Source file = Z:\qvcs\AVR318 Dallas 1-wire Communication /
// Interface\Source Code\IAR\polled\OWIHighLevelFunctions /
// .c /
// Command line = --cpu=m32 -ms -o "Z:\qvcs\AVR318 Dallas 1-wire /
// Communication Interface\Source /
// Code\IAR\polled\Debug\Obj\" -lC "Z:\qvcs\AVR318 /
// Dallas 1-wire Communication Interface\Source /
// Code\IAR\polled\Debug\List\" -lA "Z:\qvcs\AVR318 /
// Dallas 1-wire Communication Interface\Source /
// Code\IAR\polled\Debug\List\" --initializers_in_flash /
// --root_variables -z2 --no_cse --no_inline /
// --no_code_motion --no_cross_call --no_clustering /
// --debug -DENABLE_BIT_DEFINITIONS -e -I "C:\Program /
// Files\IAR Systems\Embedded Workbench 3.2\avr\INC\" -I /
// "C:\Program Files\IAR Systems\Embedded Workbench /
// 3.2\avr\INC\CLIB\" --eeprom_size 1024 "Z:\qvcs\AVR318 /
// Dallas 1-wire Communication Interface\Source /
// Code\IAR\polled\OWIHighLevelFunctions.c" /
// List file = Z:\qvcs\AVR318 Dallas 1-wire Communication /
// Interface\Source Code\IAR\polled\Debug\List\OWIHighLev /
// elFunctions.s90 /
// /
// /
//////////////////////////////////////////////////////////////////////////////
NAME OWIHighLevelFunctions
RTMODEL "__64bit_doubles", "disabled"
RTMODEL "__cpu", "3"
RTMODEL "__cpu_name", "ATmega32"
RTMODEL "__enhanced_core", "enabled"
RTMODEL "__has_elpm", "false"
RTMODEL "__memory_model", "2"
RTMODEL "__rt_version", "3"
RSEG CSTACK:DATA:NOROOT(0)
RSEG RSTACK:DATA:NOROOT(0)
EXTERN ?EPILOGUE_B3_L09
EXTERN ?EPILOGUE_B4_L09
EXTERN ?EPILOGUE_B9_L09
EXTERN ?PROLOGUE3_L09
EXTERN ?PROLOGUE4_L09
EXTERN ?PROLOGUE9_L09
EXTERN ?Register_R4_is_cg_reg
EXTERN ?Register_R5_is_cg_reg
EXTERN ?Register_R6_is_cg_reg
EXTERN ?Register_R7_is_cg_reg
EXTERN ?Register_R8_is_cg_reg
PUBLIC OWI_MatchRom
FUNCTION OWI_MatchRom,021203H
LOCFRAME CSTACK, 4, STACK
LOCFRAME RSTACK, 2, STACK
PUBLIC OWI_ReadRom
FUNCTION OWI_ReadRom,021203H
LOCFRAME CSTACK, 4, STACK
LOCFRAME RSTACK, 2, STACK
PUBLIC OWI_ReceiveByte
FUNCTION OWI_ReceiveByte,021203H
LOCFRAME CSTACK, 3, STACK
LOCFRAME RSTACK, 2, STACK
PUBLIC OWI_SearchRom
FUNCTION OWI_SearchRom,021203H
LOCFRAME CSTACK, 9, STACK
LOCFRAME RSTACK, 2, STACK
PUBLIC OWI_SendByte
FUNCTION OWI_SendByte,021203H
LOCFRAME CSTACK, 4, STACK
LOCFRAME RSTACK, 2, STACK
PUBLIC OWI_SkipRom
FUNCTION OWI_SkipRom,021203H
LOCFRAME CSTACK, 1, STACK
LOCFRAME RSTACK, 2, STACK
PUBWEAK _A_ACSR
PUBWEAK _A_ADC
PUBWEAK _A_ADCSRA
PUBWEAK _A_ADMUX
PUBWEAK _A_ASSR
PUBWEAK _A_DDRA
PUBWEAK _A_DDRB
PUBWEAK _A_DDRC
PUBWEAK _A_DDRD
PUBWEAK _A_EEAR
PUBWEAK _A_EECR
PUBWEAK _A_EEDR
PUBWEAK _A_GICR
PUBWEAK _A_GIFR
PUBWEAK _A_ICR1
PUBWEAK _A_MCUCR
PUBWEAK _A_MCUCSR
PUBWEAK _A_OCR0
PUBWEAK _A_OCR1A
PUBWEAK _A_OCR1B
PUBWEAK _A_OCR2
PUBWEAK _A_OSCCAL
PUBWEAK _A_PINA
PUBWEAK _A_PINB
PUBWEAK _A_PINC
PUBWEAK _A_PIND
PUBWEAK _A_PORTA
PUBWEAK _A_PORTB
PUBWEAK _A_PORTC
PUBWEAK _A_PORTD
PUBWEAK _A_SFIOR
PUBWEAK _A_SP
PUBWEAK _A_SPCR
PUBWEAK _A_SPDR
PUBWEAK _A_SPMCR
PUBWEAK _A_SPSR
PUBWEAK _A_SREG
PUBWEAK _A_TCCR0
PUBWEAK _A_TCCR1A
PUBWEAK _A_TCCR1B
PUBWEAK _A_TCCR2
PUBWEAK _A_TCNT0
PUBWEAK _A_TCNT1
PUBWEAK _A_TCNT2
PUBWEAK _A_TIFR
PUBWEAK _A_TIMSK
PUBWEAK _A_TWAR
PUBWEAK _A_TWBR
PUBWEAK _A_TWCR
PUBWEAK _A_TWDR
PUBWEAK _A_TWSR
PUBWEAK _A_UBRRH
PUBWEAK _A_UBRRL
PUBWEAK _A_UCSRA
PUBWEAK _A_UCSRB
PUBWEAK _A_UDR
PUBWEAK _A_WDTCR
PUBWEAK __?EEARH
PUBWEAK __?EEARL
PUBWEAK __?EECR
PUBWEAK __?EEDR
CFI Names cfiNames0
CFI StackFrame CFA_Y Y DATA
CFI StackFrame CFA_SP SP DATA
CFI VirtualResource ?RetPad:1, ?RetHigh:8, ?RetLow:8, ?Ret:17
CFI Resource R0:8, R1:8, R2:8, R3:8, R4:8, R5:8, R6:8, R7:8, R8:8, R9:8
CFI Resource R10:8, R11:8, R12:8, R13:8, R14:8, R15:8, R16:8, R17:8
CFI Resource R18:8, R19:8, R20:8, R21:8, R22:8, R23:8, R24:8, R25:8
CFI Resource R26:8, R27:8, R28:8, R29:8, R30:8, R31:8
CFI Resource ?RetHighByteMask:8, SP:16, SPH:8, SPL:8, Y:16
CFI ResourceParts ?Ret ?RetHigh, ?RetLow, ?RetPad
CFI ResourceParts SP SPH, SPL
CFI ResourceParts Y R29, R28
CFI EndNames cfiNames0
CFI Common cfiCommon0 Using cfiNames0
CFI CodeAlign 1
CFI DataAlign 1
CFI ReturnAddress ?Ret CODE
CFI CFA_Y Y+0
CFI CFA_SP SP+2
CFI ?RetPad 0
CFI ?RetHigh and(load(1, DATA, sub(CFA_SP, 1)), ?RetHighByteMask)
CFI ?RetLow Frame(CFA_SP, 0)
CFI ?Ret Concat
CFI R0 Undefined
CFI R1 Undefined
CFI R2 Undefined
CFI R3 Undefined
CFI R4 SameValue
CFI R5 SameValue
CFI R6 SameValue
CFI R7 SameValue
CFI R8 SameValue
CFI R9 SameValue
CFI R10 SameValue
CFI R11 SameValue
CFI R12 SameValue
CFI R13 SameValue
CFI R14 SameValue
CFI R15 SameValue
CFI R16 Undefined
CFI R17 Undefined
CFI R18 Undefined
CFI R19 Undefined
CFI R20 Undefined
CFI R21 Undefined
CFI R22 Undefined
CFI R23 Undefined
CFI R24 SameValue
CFI R25 SameValue
CFI R26 SameValue
CFI R27 SameValue
CFI R28 Undefined
CFI R29 Undefined
CFI R30 Undefined
CFI R31 Undefined
CFI ?RetHighByteMask SameValue
CFI SPH Undefined
CFI SPL Undefined
CFI EndCommon cfiCommon0
EXTERN OWI_WriteBit1
FUNCTION OWI_WriteBit1,0202H
EXTERN OWI_WriteBit0
FUNCTION OWI_WriteBit0,0202H
EXTERN OWI_ReadBit
FUNCTION OWI_ReadBit,0202H
// Z:\qvcs\AVR318 Dallas 1-wire Communication Interface\Source Code\IAR\polled\OWIHighLevelFunctions.c
// 1 // This file has been prepared for Doxygen automatic documentation generation.
// 2 /*! \file ********************************************************************
// 3 *
// 4 * Atmel Corporation
// 5 *
// 6 * \li File: OWIHighLevelFunctions.c
// 7 * \li Compiler: IAR EWAAVR 3.20a
// 8 * \li Support mail: avr@atmel.com
// 9 *
// 10 * \li Supported devices: All AVRs.
// 11 *
// 12 * \li Application Note: AVR318 - Dallas 1-Wire(R) master.
// 13 *
// 14 *
// 15 * \li Description: High level functions for transmission of full bytes
// 16 * on the 1-Wire(R) bus and implementations of ROM
// 17 * commands.
// 18 *
// 19 * $Revision: 1.6 $
// 20 * $Date: Thursday, August 19, 2004 09:02:02 UTC $
// 21 ****************************************************************************/
// 22
// 23 #include <ioavr.h>
// 24
// 25 #include "OWIHighLevelFunctions.h"
// 26 #include "OWIBitFunctions.h"
// 27 #include "OWIPolled.h"
// 28
// 29
// 30 /*! \brief Sends one byte of data on the 1-Wire(R) bus(es).
// 31 *
// 32 * This function automates the task of sending a complete byte
// 33 * of data on the 1-Wire bus(es).
// 34 *
// 35 * \param data The data to send on the bus(es).
// 36 *
// 37 * \param pins A bitmask of the buses to send the data to.
// 38 */
RSEG CODE:CODE:NOROOT(1)
// 39 void OWI_SendByte(unsigned char data, unsigned char pins)
OWI_SendByte:
CFI Block cfiBlock0 Using cfiCommon0
CFI Function OWI_SendByte
// 40 {
FUNCALL OWI_SendByte, OWI_WriteBit1
LOCFRAME CSTACK, 4, STACK
LOCFRAME RSTACK, 2, STACK
FUNCALL OWI_SendByte, OWI_WriteBit0
LOCFRAME CSTACK, 4, STACK
LOCFRAME RSTACK, 2, STACK
CALL ?PROLOGUE4_L09
CFI R27 Frame(CFA_Y, -1)
CFI R26 Frame(CFA_Y, -2)
CFI R25 Frame(CFA_Y, -3)
CFI R24 Frame(CFA_Y, -4)
CFI CFA_Y Y+4
MOV R26,R16
MOV R25,R17
// 41 unsigned char temp;
// 42 unsigned char i;
// 43
// 44 // Do once for each bit
// 45 for (i = 0; i < 8; i++)
LDI R24,0
??OWI_SendByte_0:
CPI R24,8
BRCC ??OWI_SendByte_1
// 46 {
// 47 // Determine if lsb is '0' or '1' and transmit corresponding
// 48 // waveform on the bus.
// 49 temp = data & 0x01;
MOV R16,R26
ANDI R16,0x01
MOV R27,R16
// 50 if (temp)
TST R27
BREQ ??OWI_SendByte_2
// 51 {
// 52 OWI_WriteBit1(pins);
MOV R16,R25
CALL OWI_WriteBit1
RJMP ??OWI_SendByte_3
// 53 }
// 54 else
// 55 {
// 56 OWI_WriteBit0(pins);
??OWI_SendByte_2:
MOV R16,R25
CALL OWI_WriteBit0
// 57 }
// 58 // Right shift the data to get next bit.
// 59 data >>= 1;
??OWI_SendByte_3:
LSR R26
// 60 }
INC R24
RJMP ??OWI_SendByte_0
// 61 }
??OWI_SendByte_1:
LDI R30,4
JMP ?EPILOGUE_B4_L09
CFI EndBlock cfiBlock0
// 62
// 63
// 64 /*! \brief Receives one byte of data from the 1-Wire(R) bus.
// 65 *
// 66 * This function automates the task of receiving a complete byte
// 67 * of data from the 1-Wire bus.
// 68 *
// 69 * \param pin A bitmask of the bus to read from.
// 70 *
// 71 * \return The byte read from the bus.
// 72 */
RSEG CODE:CODE:NOROOT(1)
// 73 unsigned char OWI_ReceiveByte(unsigned char pin)
OWI_ReceiveByte:
CFI Block cfiBlock1 Using cfiCommon0
CFI Function OWI_ReceiveByte
// 74 {
FUNCALL OWI_ReceiveByte, OWI_ReadBit
LOCFRAME CSTACK, 3, STACK
LOCFRAME RSTACK, 2, STACK
CALL ?PROLOGUE3_L09
CFI R26 Frame(CFA_Y, -1)
CFI R25 Frame(CFA_Y, -2)
CFI R24 Frame(CFA_Y, -3)
CFI CFA_Y Y+3
MOV R26,R16
// 75 unsigned char data;
// 76 unsigned char i;
// 77
// 78 // Clear the temporary input variable.
// 79 data = 0x00;
LDI R25,0
// 80
// 81 // Do once for each bit
// 82 for (i = 0; i < 8; i++)
LDI R24,0
??OWI_ReceiveByte_0:
CPI R24,8
BRCC ??OWI_ReceiveByte_1
// 83 {
// 84 // Shift temporary input variable right.
// 85 data >>= 1;
LSR R25
// 86 // Set the msb if a '1' value is read from the bus.
// 87 // Leave as it is ('0') else.
// 88 if (OWI_ReadBit(pin))
MOV R16,R26
CALL OWI_ReadBit
TST R16
BREQ ??OWI_ReceiveByte_2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -