📄 sd16.asm
字号:
; Archelon URCC C 3.20 2005/04/19
; MSP430 CIF 2005/04/06
; Compiled "E:\Developing\freq\Anti-Tamperring Emeter\key_check_emeter\source_file\SD16.c" Fri Sep 09 15:45:03 2005
;
.dbgseg dbg_syms
.align 0x2
.long 0x6c69662e
.long 0x65
.long 0x1
.long 0x0
.long 0x167fffe
.long 0x0
.long DBG5
.long 0x0
.long 0x0
.long 0x0
; __builtin__ unsigned short _BIS_SR(unsigned short);
; __builtin__ unsigned short _BIC_SR(unsigned short);
; __builtin__ unsigned short _BIS_SR_IRQ(unsigned short);
; __builtin__ unsigned short _BIC_SR_IRQ(unsigned short);
; __builtin__ void _DINT(void);
; __builtin__ void _EINT(void);
; __builtin__ void _NOP(void);
; __builtin__ void _OPC(const unsigned short op);
; __builtin__ short _SWPB(short);
; __builtin__ long _SWPB_LONG(long);
; __builtin__ float _SWPB_FLOAT(float);
; sfrb IE1 = (0x0000) ;
; sfrb IFG1 = (0x0002) ;
; sfrb ME1 = (0x0004) ;
; sfrb IE2 = (0x0001) ;
; sfrb IFG2 = (0x0003) ;
; sfrw WDTCTL = (0x0120) ;
; const sfrb P1IN = (0x0020) ;
; sfrb P1OUT = (0x0021) ;
; sfrb P1DIR = (0x0022) ;
; sfrb P1IFG = (0x0023) ;
; sfrb P1IES = (0x0024) ;
; sfrb P1IE = (0x0025) ;
; sfrb P1SEL = (0x0026) ;
; const sfrb P2IN = (0x0028) ;
; sfrb P2OUT = (0x0029) ;
; sfrb P2DIR = (0x002A) ;
; sfrb P2IFG = (0x002B) ;
; sfrb P2IES = (0x002C) ;
; sfrb P2IE = (0x002D) ;
; sfrb P2SEL = (0x002E) ;
; sfrb BTCTL = (0x0040) ;
; sfrb BTCNT1 = (0x0046) ;
; sfrb BTCNT2 = (0x0047) ;
; sfrb SCFI0 = (0x0050) ;
; sfrb SCFI1 = (0x0051) ;
; sfrb SCFQCTL = (0x0052) ;
; sfrb FLL_CTL0 = (0x0053) ;
; sfrb FLL_CTL1 = (0x0054) ;
; sfrb SVSCTL = (0x0056) ;
; sfrb LCDCTL = (0x0090) ;
; sfrb LCDM1 = (0x0091) ;
; sfrb LCDM2 = (0x0092) ;
; sfrb LCDM3 = (0x0093) ;
; sfrb LCDM4 = (0x0094) ;
; sfrb LCDM5 = (0x0095) ;
; sfrb LCDM6 = (0x0096) ;
; sfrb LCDM7 = (0x0097) ;
; sfrb LCDM8 = (0x0098) ;
; sfrb LCDM9 = (0x0099) ;
; sfrb LCDM10 = (0x009A) ;
; sfrb LCDM11 = (0x009B) ;
; sfrb LCDM12 = (0x009C) ;
; sfrb LCDM13 = (0x009D) ;
; sfrb LCDM14 = (0x009E) ;
; sfrb LCDM15 = (0x009F) ;
; sfrb LCDM16 = (0x00A0) ;
; sfrb LCDM17 = (0x00A1) ;
; sfrb LCDM18 = (0x00A2) ;
; sfrb LCDM19 = (0x00A3) ;
; sfrb LCDM20 = (0x00A4) ;
; sfrb U0CTL = (0x0070) ;
; sfrb U0TCTL = (0x0071) ;
; sfrb U0RCTL = (0x0072) ;
; sfrb U0MCTL = (0x0073) ;
; sfrb U0BR0 = (0x0074) ;
; sfrb U0BR1 = (0x0075) ;
; const sfrb U0RXBUF = (0x0076) ;
; sfrb U0TXBUF = (0x0077) ;
; const sfrw TAIV = (0x012E) ;
; sfrw TACTL = (0x0160) ;
; sfrw TACCTL0 = (0x0162) ;
; sfrw TACCTL1 = (0x0164) ;
; sfrw TACCTL2 = (0x0166) ;
; sfrw TAR = (0x0170) ;
; sfrw TACCR0 = (0x0172) ;
; sfrw TACCR1 = (0x0174) ;
; sfrw TACCR2 = (0x0176) ;
; sfrw FCTL1 = (0x0128) ;
; sfrw FCTL2 = (0x012A) ;
; sfrw FCTL3 = (0x012C) ;
; sfrw MPY = (0x0130) ;
; sfrw MPYS = (0x0132) ;
; sfrw MAC = (0x0134) ;
; sfrw MACS = (0x0136) ;
; sfrw OP2 = (0x0138) ;
; sfrw RESLO = (0x013A) ;
; sfrw RESHI = (0x013C) ;
; const sfrw SUMEXT = (0x013E) ;
; sfrb SD16INCTL0 = (0x00B0) ;
; sfrb SD16INCTL1 = (0x00B1) ;
; sfrb SD16INCTL2 = (0x00B2) ;
; sfrb SD16PRE0 = (0x00B8) ;
; sfrb SD16PRE1 = (0x00B9) ;
; sfrb SD16PRE2 = (0x00BA) ;
; sfrb SD16TRIM1 = (0x00BF) ;
; sfrb SD16CONF0 = (0x00B7) ;
; sfrb SD16CONF1 = (0x00BF) ;
; sfrw SD16CTL = (0x0100) ;
; sfrw SD16CCTL0 = (0x0102) ;
; sfrw SD16CCTL1 = (0x0104) ;
; sfrw SD16CCTL2 = (0x0106) ;
; sfrw SD16IV = (0x0110) ;
; sfrw SD16MEM0 = (0x0112) ;
; sfrw SD16MEM1 = (0x0114) ;
; sfrw SD16MEM2 = (0x0116) ;
; sfrw ESPCTL = (0x0150) ;
; sfrw MBCTL = (0x0152) ;
; sfrw MBIN0 = (0x0154) ;
; sfrw MBIN1 = (0x0156) ;
; sfrw MBOUT0 = (0x0158) ;
; sfrw MBOUT1 = (0x015A) ;
; const sfrw RET0 = (0x01C0) ;
; const sfrw RET1 = (0x01C2) ;
; const sfrw RET2 = (0x01C4) ;
; const sfrw RET3 = (0x01C6) ;
; const sfrw RET4 = (0x01C8) ;
; const sfrw RET5 = (0x01CA) ;
; const sfrw RET6 = (0x01CC) ;
; const sfrw RET7 = (0x01CE) ;
; const sfrw RET8 = (0x01D0) ;
; const sfrw RET9 = (0x01D2) ;
; const sfrw RET10 = (0x01D4) ;
; const sfrw RET11 = (0x01D6) ;
; const sfrw RET12 = (0x01D8) ;
; const sfrw RET13 = (0x01DA) ;
; const sfrw RET14 = (0x01DC) ;
; const sfrw RET15 = (0x01DE) ;
; const sfrw RET16 = (0x01E0) ;
; const sfrw RET17 = (0x01E2) ;
; const sfrw RET18 = (0x01E4) ;
; const sfrw RET19 = (0x01E6) ;
; const sfrw RET20 = (0x01E8) ;
; const sfrw RET21 = (0x01EA) ;
; const sfrw RET22 = (0x01EC) ;
; const sfrw RET23 = (0x01EE) ;
; const sfrw RET24 = (0x01F0) ;
; const sfrw RET25 = (0x01F2) ;
; const sfrw RET26 = (0x01F4) ;
; const sfrw RET27 = (0x01F6) ;
; const sfrw RET28 = (0x01F8) ;
; const sfrw RET29 = (0x01FA) ;
; const sfrw RET30 = (0x01FC) ;
; const sfrw RET31 = (0x01FE) ;
; typedef unsigned char uint8;
; uint8 size 1
; typedef signed char int8;
; int8 size 1
; typedef unsigned int uint16;
; uint16 size 2
; typedef signed int int16;
; int16 size 2
; typedef unsigned long uint32;
; uint32 size 4
; typedef signed long int32;
; int32 size 4
; typedef unsigned char uint8_t;
; uint8_t size 1
; typedef signed char int8_t;
; int8_t size 1
; typedef unsigned int uint16_t;
; uint16_t size 2
; typedef signed int int16_t;
; int16_t size 2
; typedef unsigned long uint32_t;
; uint32_t size 4
; typedef signed long int32_t;
; int32_t size 4
; extern const unsigned char lcd_digit_table[];
; struct emeter_var
; {
; uint16 ui_meter_status;
; uint16 ui_anti_tamperring_status;
; uint16 ui_firmware_version;
; uint8 uc_display_stage;
; uint16 ui_sec_count;
; uint16 ui_main_frequency;
; uint16 ui_power_factor;
; int16 i_last_temperature;
; int16 i_temperature;
; int16 i_temperature_offset;
; uint16 ui_current_IRMS;
; uint16 ui_voltage_V1RMS;
; float f_total_energy;
; uint32 ul_total_power;
; uint32 ul_act_power_counter;
; uint32 ul_act_power1;
; uint32 ul_act_power2;
; uint32 ul_react_power;
; uint32 ul_app_power;
; float f_re_total_power;
; uint8 ucFlashOperated[2];
; float f_Cz1;
; float f_Cz2;
; uint16 ui_GainCorr1;
; uint16 ui_GainCorr2;
; int32 l_PowerOffset1;
; int32 l_PowerOffset2;
; float f_PhaseCorr1;
; float f_PhaseCorr2;
; uint16 ui_SD16_CurrentCorr1;
; uint16 ui_SD16_CurrentCorr2;
; uint16 ui_SD16_VoltageCorr1;
; uint16 ul_TempSampleOffset;
; uint8 ucCalibrationMode;
; uint8 ucCalibrationOption;
; uint8 uc_pout_hc595;
; uint8 uc_restart_esp_delay;
; uint8 uc_lcd_remaining_times;
; uint8 uc_switch_delay_counter;
; uint8 display_stage;
; };
; extern struct emeter_var emeter;
; union signed_long_word
; {
; int32 l;
; uint16 w[2];
; };
; extern union signed_long_word ds;
; extern uint32 ul_total_power_infact;
; extern uint16 ui_step_counter;
; struct current_sensor_parms_s
; {
; uint16 V_rms;
; uint16 I_rms;
; int32_t I_dc_estimate;
; int16_t P_accum[3];
; int16_t P_accum_logged[3];
; int16_t I_sq_accum[3];
; int16_t I_sq_accum_logged[3];
; int16_t sample_count;
; int16_t sample_count_logged;
; int16_t fir_beta;
; int16_t fir_step;
; int16_t fir_gain;
; int16_t I_history[2];
; int8_t I_endstops;
; };
; struct phase_parms_s
; {
; uint16_t V_rms;
; uint16_t I_rms;
; int32_t V_dc_estimate[2];
; int16_t V_history[4];
; int16_t V_sq_accum[3];
; int16_t V_sq_accum_logged[3];
; struct current_sensor_parms_s current;
; struct current_sensor_parms_s neutral;
; int16_t sample_count;
; int16_t sample_count_logged;
; uint16_t status;
; int8_t V_endstops;
; int8_t V_history_index;
; };
; extern struct phase_parms_s *phase;
; enum
; {
; DISPLAY_STAGE_ACT_ENERGY_1 = 1,
; DISPLAY_STAGE_ACT_ENERGY_2,
; DISPLAY_STAGE_CURRENT,
; DISPLAY_STAGE_VOLTAGE,
; DISPLAY_STAGE_FREQUENCY,
; DISPLAY_STAGE_POWERFACTOR,
; DISPLAY_STAGE_REACT_ENERGY,
; DISPLAY_STAGE_APP_ENERGY,
; DISPLAY_STAGE_TEMPERATURE,
; DISPLAY_STAGE_TIME,
; DISPLAY_STAGE_DATE,
; DISPLAY_STAGE_TEST1,
; DISPLAY_STAGE_TEST2,
; DISPLAY_STAGE_TEST3,
; DISPLAY_STAGE_TEST4,
; DISPLAY_STAGE_TEST5,
; DISPLAY_STAGE_TEST6,
; DISPLAY_STAGE_TEST7,
; DISPLAY_STAGE_TEST8,
; DISPLAY_STAGE_TEST9,
; DISPLAY_STAGE_LAST
; };
; struct rtc_s
; {
; uint8 second;
; uint8 minute;
; uint8 hour;
; uint8 day;
; uint8 week;
; uint8 month;
; uint8 year;
; uint8 sumcheck;
; };
; extern struct rtc_s rtc;
; extern uint32 ul_actensper1;
; extern uint32 ul_actensper2;
; extern void display (unsigned int value);
; extern void update_display(void);
; extern void LCDudec16(unsigned int value, int pos, int digits, int after);
; extern void LCDudec32(unsigned long value, int pos, int digits, int after);
; extern void LCDicon(int id, int on);
; extern void LCDmodify_char(unsigned char ch, int pos, int on);
; extern void LCDchar(unsigned char ch, int pos);
; extern void clr_lcd_display(void);
; extern void bin2bcd32(unsigned char bcd[5], unsigned long bin);
; extern void bin2bcd16(unsigned char bcd[3], unsigned int bin);
; extern unsigned long scale_long(unsigned long l, float f);
; extern unsigned int scale_int(unsigned int i, float f);
; extern void set_rtc_sumcheck(void);
; extern int check_rtc_sumcheck(void);
; extern int bump_rtc(void);
; extern int weekday(void);
; extern void rtc_bumper(void);
; extern void correct_rtc(void);
; extern void init_analog_front_end_ESP(void);
; extern void init_esp_parameter(void);
; extern void set_parameter(unsigned int param, unsigned int data);
; extern void start_measurement(void);
; extern char store_flash_var(char *ptr,char *from, int len);
; extern void EnergyReadyIntMapping(void);
; extern void ActensperReadyIntMapping(void);
; extern void BasicTimerIntMapping(void);
; void init_analog_front_end_SD16(void);
; extern void tpd_gen(void);
; extern int16_t dc_filter(register int32_t *p, register int16_t x);
; extern int32_t imul16_up(register int16_t x, register int16_t y);
; extern void accum48(register int16_t x[3], register int32_t y);
; extern void log_parameters(void);
; extern void transfer48(register int16_t y[3], register int16_t x[3]);
; extern int32_t div48(register int16_t x[3], register int16_t y);
; extern int32_t isqrt32(register int32_t h);
; extern int32_t div_sh48(register int16_t x[3], int sh, register int16_t y);
; extern int32_t current(void);
; extern int32_t voltage(void);
; extern void CheckExternVoltage(void);
; extern void EnterSD16Measure (void);
; extern void ExitSD16Measure (void);
; extern void EnterESPMeasure (void);
; extern void ExitESPMeasure (void);
; extern void SwitchToSD16Measure(void);
; extern void SwitchToESPMeasure(void);
; extern void OnlyRTCMode(void);
; void ClrDispVary(unsigned char OpMode);
; void init_analog_front_end_SD16(void)
DBG3:
.long 0x0
.long DBG10
.long _init_analog_front_end_SD16
.long 0x40
.long 0x1020001
.long DBG1
.long DBG7-DBG8
.long DBG9
.long DBG6
.long 0x0
.pseg SD16_code
DBG8:
.dbgseg dbg_syms
DBG1:
.long 0x66622e
.long 0x0
.long DBG8
.long 0x0
.long 0x1650001
.long 0x0
.long 0x20
.long 0x0
.long DBG11
.long 0x0
.dbgseg dbg_line
.align 0x2
DBG9:
.long DBG3
.long 0x0
.long _init_analog_front_end_SD16
.long 0x1
.long DBG13
.long 0x2
.long DBG14
.long 0x8
.long DBG15
.long 0x14
.long DBG16
.long 0x27
.long DBG17
.long 0x28
.long DBG18
.long 0x29
.long DBG19
.long 0x3b
.long DBG20
.long 0x3c
.long DBG21
.long 0x3d
.long DBG22
.long 0x40
.long DBG23
.long 0x41
.long DBG24
.long 0x42
.long DBG25
.long 0x44
.long DBG26
.long 0x45
.long DBG27
.long 0x4c
.pseg SD16_code
.global _init_analog_front_end_SD16
_init_analog_front_end_SD16:
; ENTRY
DBG12:
; {
DBG13:
; ESPCTL &= ~ (0x0001) ;
DBG14:
bic #0x1,&0x150
DBG15:
; SD16CTL = 0x800
; | ( (0x0010) )
; | ( (0x0080) )
; | (0x0004)
mov #0x994,&0x100
DBG16:
; | (0x0100) ;
; SD16INCTL0 = (0x0000) | (0x0000) ;
mov.b #0x0,&0xb0
DBG17:
; SD16CCTL0 = (0x0000) | (0x0010) | (0x0001) ;
mov #0x11,r12
mov r12,&0x102
DBG18:
; SD16PRE0 = 0;
mov.b #0x0,&0xb8
DBG19:
; SD16INCTL1 = (0x0000) | (0x0020) ;
mov.b #0x20,&0xb1
DBG20:
; SD16CCTL1 = (0x0000) | (0x0010) | (0x0001) ;
mov r12,&0x104
DBG21:
; SD16PRE1 = 0;
mov.b #0x0,&0xb9
DBG22:
; SD16INCTL2 = (0x0000) | (0x0000) ;
mov.b #0x0,&0xb2
DBG23:
; SD16CCTL2 = (0x0000) | (0x0010) | (0x0002) | (0x0008) ;
mov #0x1a,&0x106
DBG24:
; SD16PRE2 = 0;
mov.b #0x0,&0xba
DBG25:
; SD16CONF0 = 0xC0 ;
mov.b #0xc0,&0xb7
DBG26:
; SD16CONF1 = 0x40 ;
mov.b #0x40,&0xbf
DBG28:
DBG27:
; EXIT
ret
.dbgseg dbg_syms
.long 0x0
.long DBG29
.long 0x0
.long 0x0
.long 0x10002
.long 0x0
.long DBG30
.long 0x2
.long 0x0
.long 0x10002
.long 0x504e5f5f
.long 0x534d5241
.long 0x0
.long 0x0
.long 0x10002
.long 0x66652e
.long 0x0
.long DBG28
.long 0x0
.long 0x1650001
.long 0x0
.long 0x6b
.long 0x0
.long 0x0
.long 0x0
.pseg SD16_code
DBG7:
.dbgseg dbg_syms
.long 0x0
.long DBG10
.long DBG7
.long 0x0
.long 0xff0001
; }
; uint16_t rndnum;
; uint16_t tpdnum;
; void tpd_gen(void)
DBG6:
.long 0x5f647074
.long 0x6e6567
.long _tpd_gen
.long 0x40
.long 0x1020001
.long DBG11
.long DBG32-DBG33
.long DBG34
.long DBG31
.long 0x0
.pseg SD16_code
DBG33:
.dbgseg dbg_syms
DBG11:
.long 0x66622e
.long 0x0
.long DBG33
.long 0x0
.long 0x1650001
.long 0x0
.long 0x74
.long 0x0
.long DBG35
.long 0x0
.dbgseg dbg_line
DBG34:
.long DBG6
.long 0x0
.long _tpd_gen
.long 0x1
.long DBG37
.long 0x2
.long DBG38
.long 0x5
.long DBG39
.long 0x6
.long DBG40
.long 0x8
.long DBG41
.long 0x9
.long DBG42
.long 0xa
.long DBG43
.long 0xb
.long DBG44
.long 0xc
.long DBG45
.long 0xd
.long DBG46
.long 0xe
.long DBG47
.long 0xf
.long DBG48
.long 0x10
.long DBG49
.long 0x11
.long DBG50
.long 0x12
.long DBG51
.long 0x13
.long DBG52
.long 0x14
.long DBG53
.long 0x15
.long DBG54
.long 0x16
.long DBG55
.long 0x17
.long DBG56
.long 0x18
.long DBG57
.long 0x1a
.long DBG58
.long 0x1b
.long DBG59
.long 0x1c
.long DBG60
.long 0x1d
.pseg SD16_code
.global _tpd_gen
_tpd_gen:
; ENTRY
DBG36:
; x1 in reg r15 size 2
; x2 in reg r14 size 2
; {
DBG37:
; register int16_t x1;
; register int16_t x2;
; x1 = rndnum;
DBG38:
mov &_rndnum,r15
DBG39:
; x2 = 0;
mov #0x0,r14
DBG40:
; /$
sub r15,r14
DBG41:
rla r15
DBG42:
add r15,r14
DBG43:
rla r15
DBG44:
sub r15,r14
DBG45:
rla r15
DBG46:
rla r15
DBG47:
add r15,r14
DBG48:
rla r15
DBG49:
rla r15
DBG50:
sub r15,r14
DBG51:
rla r15
DBG52:
add r15,r14
DBG53:
rla r15
DBG54:
rla r15
DBG55:
rla r15
DBG56:
sub r15,r14
DBG57:
; $/
; x2 = (x2 + 13849) & 0x3FFF;
add #0x3619,r14
and #0x3fff,r14
DBG58:
; tpdnum = rndnum + x2;
mov &_rndnum,r12
add r14,r12
mov r12,&_tpdnum
DBG59:
; rndnum = x2;
mov r14,&_rndnum
DBG61:
DBG60:
; EXIT
ret
.dbgseg dbg_syms
.long 0x0
.long DBG29
.long 0x0
.long 0x0
.long 0x10002
.long 0x0
.long DBG30
.long 0x2
.long 0x0
.long 0x10002
.long 0x504e5f5f
.long 0x534d5241
.long 0x0
.long 0x0
.long 0x10002
.long 0x3178
.long 0x0
.long 0xf0102
.long 0x4
.long 0x4ffff
.long 0x3278
.long 0x0
.long 0xe0102
.long 0x4
.long 0x4ffff
.long 0x66652e
.long 0x0
.long DBG61
.long 0x0
.long 0x1650001
.long 0x0
.long 0x90
.long 0x0
.long 0x0
.long 0x0
.pseg SD16_code
DBG32:
.dbgseg dbg_syms
.long 0x5f647074
.long 0x6e6567
.long DBG32
.long 0x0
.long 0xff0001
; }
; int16_t dc_filter(register int32_t *p, register int16_t x)
DBG31:
.long 0x0
.long DBG66
.long _dc_filter
.long 0x44
.long 0x1020001
.long DBG35
.long DBG63-DBG64
.long DBG65
.long DBG62
.long 0x0
.pseg SD16_code
DBG64:
.dbgseg dbg_syms
DBG35:
.long 0x66622e
.long 0x0
.long DBG64
.long 0x0
.long 0x1650001
.long 0x0
.long 0x95
.long 0x0
.long DBG67
.long 0x0
.dbgseg dbg_line
DBG65:
.long DBG31
.long 0x0
.long _dc_filter
.long 0x1
.long DBG69
.long 0x2
.long DBG70
.long 0xe
.long DBG71
.long 0x11
.long DBG72
.long 0x12
.long DBG73
.long 0x13
.long DBG74
.long 0x14
.long DBG75
.long 0x15
.long DBG76
.long 0x16
.long DBG77
.long 0x17
.long DBG78
.long 0x18
.long DBG79
.long 0x19
.long DBG80
.long 0x1a
.long DBG81
.long 0x1b
.long DBG82
.long 0x1c
.long DBG83
.long 0x1d
.long DBG84
.long 0x1e
.long DBG85
.long 0x1f
.long DBG86
.long 0x20
.long DBG87
.long 0x21
.long DBG88
.long 0x22
.long DBG89
.long 0x23
.long DBG90
.long 0x24
.long DBG91
.long 0x25
.long DBG92
.long 0x26
.long DBG93
.long 0x27
.long DBG94
.long 0x2a
.long DBG95
.long 0x2b
.pseg SD16_code
.global _dc_filter
_dc_filter:
; ENTRY
DBG68:
; p at argloc 0 (0x0) in reg r12 size 2
; x at argloc 0 (0x0) in reg r13 size 2
; z in reg r14(2) size 4
; {
DBG69:
; register int32_t z;
; z = 0x12345678;
DBG70:
mov #0x5678,r15
mov #0x1234,r14
DBG71:
; /$
mov r13,r14
DBG72:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -