📄 ci_config.s
字号:
.module CI_Config.c
.area text(rom, con, rel)
.dbfile O:\2007全国电子设计大赛\键盘显示模块\CI_Config.c
.dbfunc e MSG_Map_CommunicationInterface_INIT _MSG_Map_CommunicationInterface_INIT fV
.dbstruct 0 3 MsgMapItem
.dbfield 0 cCMD c
.dbfield 1 pMsgFunc pfc
.dbend
.dbstruct 0 3 MsgMap
.dbfield 0 cItemCount c
.dbfield 1 pMsgItems pS[MsgMapItem]
.dbend
; pMsgMap -> R16,R17
; Reg2 -> R10,R11
; n1 -> R18
.even
_MSG_Map_CommunicationInterface_INIT::
st -y,R10
st -y,R11
.dbline -1
.dbline 77
; /***********************************************************
; * 函数库说明:指令解析系统函数库 *
; * 版本: v0.30 *
; * 作者: 王卓然 *
; * 创建日期: 2007年9月02日 *
; * -------------------------------------------------------- *
; * [支 持 库] *
; * 支持库名称: *
; * 需要版本: *
; * 声明库说明: *
; * -------------------------------------------------------- *
; * [版本更新] *
; * 修改: *
; * 修改日期: *
; * 版本: *
; * -------------------------------------------------------- *
; * [版本历史] *
; * -------------------------------------------------------- *
; * [使用说明] *
; ***********************************************************/
;
; /********************
; * 头 文 件 配 置 区 *
; ********************/
; # include "RD_MacroAndConst.h"
; # include "CI_Config.h"
; # include "LIB_Config.h"
; # include "RD_ADT_QUEUE.h"
; # include "RD_ADT_MSGMap.h"
; # include "RD_UseSerialFrame_PROC.h"
; # include "CI_MSGMap.h"
;
; /********************
; * 系 统 宏 定 义 *
; ********************/
;
; /*------------------*
; * 常 数 宏 定 义 *
; *------------------*/
;
; /*------------------*
; * 动 作 宏 定 义 *
; *------------------*/
;
; /********************
; * 用户变量类型定义 *
; ********************/
;
; /********************
; * 结构体定义区 *
; ********************/
;
; /********************
; * 模块函数声明区 *
; ********************/
; void Communication_INIT(void);
; BOOL Send_MSG(uint8 cCMD,uint8 *pData,uint8 Length);
; BOOL Serial_Frame_Process_Refresh(void);
;
; /********************
; * 全局函数声明区 *
; ********************/
;
; /********************
; * 模块变量声明区 *
; ********************/
;
; /********************
; * 全局变量声明区 *
; ********************/
;
; /********************
; * 自定义数据结构区 *
; ********************/
;
; //机器人平台
; START_DEFINE_MSG_MAP(CommunicationInterface,4)
.dbline 77
.dbline 77
ldi R16,<_MSGMapCommunicationInterface
ldi R17,>_MSGMapCommunicationInterface
.dbline 77
ldi R24,<_MSGMapCommunicationInterfaceItemArray
ldi R25,>_MSGMapCommunicationInterfaceItemArray
movw R30,R16
std z+2,R25
std z+1,R24
.dbline 77
ldi R24,4
std z+0,R24
.dbline 77
clr R18
xjmp L5
L2:
.dbline 77
.dbline 77
ldi R24,3
mul R24,R18
movw R10,R0
ldi R24,<_MSGMapCommunicationInterfaceItemArray
ldi R25,>_MSGMapCommunicationInterfaceItemArray
movw R30,R10
add R30,R24
adc R31,R25
clr R2
std z+0,R2
.dbline 77
ldi R24,<_MSGMapCommunicationInterfaceItemArray+1
ldi R25,>_MSGMapCommunicationInterfaceItemArray+1
movw R30,R10
add R30,R24
adc R31,R25
ldi R24,<PL_MSG_NULL_PROC
ldi R25,>PL_MSG_NULL_PROC
std z+1,R25
std z+0,R24
.dbline 77
L3:
.dbline 77
inc R18
L5:
.dbline 77
cpi R18,4
brlo L2
X0:
.dbline 77
.dbline 78
; ADD_NEW_MSG_MAP_ITEM(CMD_ACK,PROC_Acknowledge)
movw R30,R16
ldd R2,z+0
clr R3
cp R3,R2
brsh L7
X1:
.dbline 78
.dbline 78
clr R4
clr R5
ldd R2,z+1
ldd R3,z+2
movw R30,R4
add R30,R2
adc R31,R3
ldi R24,172
std z+0,R24
.dbline 78
movw R30,R16
ldd R2,z+1
ldd R3,z+2
movw R30,R4
add R30,R2
adc R31,R3
ldi R24,<PL_PROC_Acknowledge
ldi R25,>PL_PROC_Acknowledge
std z+2,R25
std z+1,R24
.dbline 78
.dbline 78
L7:
.dbline -2
L1:
.dbline 0 ; func end
ld R11,y+
ld R10,y+
ret
.dbsym r pMsgMap 16 pS[MsgMap]
.dbsym r Reg2 10 S
.dbsym r n1 18 c
.dbend
.dbfunc e SFP_CommunicationShell_INIT _SFP_CommunicationShell_INIT fV
.dbstruct 0 18 AbstructDataTypeQueue
.dbfield 0 pBuffer pc
.dbfield 2 nSize i
.dbfield 4 nHead i
.dbfield 6 nTail i
.dbfield 8 nCount i
.dbfield 10 fnAddToBuffer pfc
.dbfield 12 fnGetFromBuffer pfc
.dbfield 14 fnCheckEmpty pfc
.dbfield 16 fnPeekFromBuffer pfc
.dbend
.dbstruct 0 4 MsgItem
.dbfield 0 cCMD c
.dbfield 1 cDataLength c
.dbfield 2 pData pc
.dbend
.dbstruct 0 37 SerialFrameProcess
.dbfield 0 FrameBuffer S[AbstructDataTypeQueue]
.dbfield 18 pMsgMap pS[MsgMap]
.dbfield 20 MsgItem S[MsgItem]
.dbfield 24 cHeadByte c
.dbfield 25 cEndByte c
.dbfield 26 cFixLength c
.dbfield 27 cAddress c
.dbfield 28 InputDataFunc pfc
.dbfield 30 OutputDataFunc pfc
.dbfield 32 PeekDataFunc pfc
.dbfield 34 cActionFlag c
.dbfield 35 cXORCheck c
.dbfield 36 cFrameSize c
.dbend
; pSFP -> R16,R17
.even
_SFP_CommunicationShell_INIT::
.dbline -1
.dbline 81
; END_DEFINE_MSG_MAP
;
; START_DEFINE_SERIAL_FRAME_PROCESS(CommunicationShell,16,MSG_MAP(CommunicationInterface))
.dbline 81
ldi R16,<_SFPCommunicationShell
ldi R17,>_SFPCommunicationShell
.dbline 81
ldi R24,<_MSGMapCommunicationInterface
ldi R25,>_MSGMapCommunicationInterface
movw R30,R16
std z+19,R25
std z+18,R24
.dbline 81
.dbline 81
ldi R24,<_SFPCommunicationShellBuffer
ldi R25,>_SFPCommunicationShellBuffer
sts _SFPCommunicationShell+1,R25
sts _SFPCommunicationShell,R24
.dbline 81
ldi R24,16
ldi R25,0
sts _SFPCommunicationShell+2+1,R25
sts _SFPCommunicationShell+2,R24
.dbline 81
clr R2
clr R3
sts _SFPCommunicationShell+4+1,R3
sts _SFPCommunicationShell+4,R2
.dbline 81
sts _SFPCommunicationShell+6+1,R3
sts _SFPCommunicationShell+6,R2
.dbline 81
sts _SFPCommunicationShell+8+1,R3
sts _SFPCommunicationShell+8,R2
.dbline 81
ldi R24,<PL_ADT_Queue_Add_To_Buffer
ldi R25,>PL_ADT_Queue_Add_To_Buffer
sts _SFPCommunicationShell+10+1,R25
sts _SFPCommunicationShell+10,R24
.dbline 81
ldi R24,<PL_ADT_Queue_Get_From_Buffer
ldi R25,>PL_ADT_Queue_Get_From_Buffer
sts _SFPCommunicationShell+12+1,R25
sts _SFPCommunicationShell+12,R24
.dbline 81
ldi R24,<PL_ADT_Queue_Check_Empty
ldi R25,>PL_ADT_Queue_Check_Empty
sts _SFPCommunicationShell+14+1,R25
sts _SFPCommunicationShell+14,R24
.dbline 81
ldi R24,<PL_ADT_Queue_Peek_From_Buffer
ldi R25,>PL_ADT_Queue_Peek_From_Buffer
sts _SFPCommunicationShell+16+1,R25
sts _SFPCommunicationShell+16,R24
.dbline 81
.dbline 81
ldi R24,<_SFPCommunicationShellMsgItem
ldi R25,>_SFPCommunicationShellMsgItem
std z+23,R25
std z+22,R24
.dbline 81
ldi R24,170
std z+24,R24
.dbline 81
ldi R24,85
std z+25,R24
.dbline 81
std z+26,R2
.dbline 81
std z+27,R2
.dbline 81
std z+34,R2
.dbline 81
std z+35,R2
.dbline 81
std z+36,R2
.dbline 81
ldi R24,<PL_SFP_NULL_Input_Data_Function
ldi R25,>PL_SFP_NULL_Input_Data_Function
std z+29,R25
std z+28,R24
.dbline 81
ldi R24,<PL_SFP_NULL_Output_Data_Function
ldi R25,>PL_SFP_NULL_Output_Data_Function
std z+31,R25
std z+30,R24
.dbline 81
ldi R24,<PL_SFP_NULL_Peek_Data_Function
ldi R25,>PL_SFP_NULL_Peek_Data_Function
std z+33,R25
std z+32,R24
.dbline 83
;
; SET_INPUT_DATA_FUNCTION(UARTgetDataFromRxBuff)
ldi R24,<PL_UARTgetDataFromRxBuff
ldi R25,>PL_UARTgetDataFromRxBuff
std z+29,R25
std z+28,R24
.dbline 84
; SET_OUTPUT_DATA_FUNCTION(UARTaddDataToTxBuff)
ldi R24,<PL_UARTaddDataToTxBuff
ldi R25,>PL_UARTaddDataToTxBuff
std z+31,R25
std z+30,R24
.dbline 85
; SET_PEEK_DATA_FUNCTION(UARTPeekDataFromRxBuff)
ldi R24,<PL_UARTPeekDataFromRxBuff
ldi R25,>PL_UARTPeekDataFromRxBuff
std z+33,R25
std z+32,R24
.dbline -2
L9:
.dbline 0 ; func end
ret
.dbsym r pSFP 16 pS[SerialFrameProcess]
.dbend
.dbfunc e Communication_INIT _Communication_INIT fV
.even
_Communication_INIT::
.dbline -1
.dbline 96
;
; END_DEFINE_SERIAL_FRAME_PROCESS
;
; /***********************************************************
; * 函数说明:指令解析系统初始化函数 *
; * 输入: 无 *
; * 输出: 无 *
; * 调用函数:无 *
; ***********************************************************/
; void Communication_INIT(void)
; {
.dbline 97
; INIT_MSG_MAP(CommunicationInterface)
xcall _MSG_Map_CommunicationInterface_INIT
.dbline 98
; INIT_SERIAL_FRAME_PROCESS(CommunicationShell)
xcall _SFP_CommunicationShell_INIT
.dbline -2
L18:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Send_MSG _Send_MSG fc
; Length -> y+7
; pData -> R12,R13
; cCMD -> R10
.even
_Send_MSG::
xcall push_xgset003C
movw R12,R18
mov R10,R16
sbiw R28,3
.dbline -1
.dbline 108
; }
;
; /***********************************************************
; * 函数说明:消息发送函数 *
; * 输入: 指令,要发送的数据,数据的长度 *
; * 输出: 指令是否发送成功 *
; * 调用函数:SPF_Send_MSG() *
; ***********************************************************/
; BOOL Send_MSG(uint8 cCMD,uint8 *pData,uint8 Length)
; {
.dbline 109
; return SPF_Send_MSG
ldd R0,y+7
std y+2,R0
std y+1,R13
std y+0,R12
mov R18,R10
ldi R16,<_SFPCommunicationShell
ldi R17,>_SFPCommunicationShell
xcall _SPF_Send_MSG
.dbline -2
L19:
.dbline 0 ; func end
adiw R28,3
xjmp pop_xgset003C
.dbsym l Length 7 c
.dbsym r pData 12 pc
.dbsym r cCMD 10 c
.dbend
.dbfunc e Serial_Frame_Process_Refresh _Serial_Frame_Process_Refresh fc
.even
_Serial_Frame_Process_Refresh::
.dbline -1
.dbline 125
; (
; &SERIAL_FRAME_PROC(CommunicationShell),
; cCMD,
; pData,
; Length
; );
; }
;
; /***********************************************************
; * 函数说明:下位机指令系统进程 *
; * 输入: 无 *
; * 输出: 恒为TRUE *
; * 调用函数:SERIAL_FRAME_PROCESS(RobotPlatformShell) *
; ***********************************************************/
; BOOL Serial_Frame_Process_Refresh(void)
; {
.dbline 128
; //SERIAL_FRAME_PROCESS(CommunicationShell);
;
; return TRUE;
ldi R16,1
.dbline -2
L20:
.dbline 0 ; func end
ret
.dbend
.area bss(ram, con, rel)
.dbfile O:\2007全国电子设计大赛\键盘显示模块\CI_Config.c
_SFPCommunicationShellMsgItem::
.blkb 16
.dbsym e SFPCommunicationShellMsgItem _SFPCommunicationShellMsgItem A[16:16]c
_SFPCommunicationShellBuffer::
.blkb 16
.dbsym e SFPCommunicationShellBuffer _SFPCommunicationShellBuffer A[16:16]c
_SFPCommunicationShell::
.blkb 37
.dbsym e SFPCommunicationShell _SFPCommunicationShell S[SerialFrameProcess]
_MSGMapCommunicationInterfaceItemArray::
.blkb 12
.dbsym e MSGMapCommunicationInterfaceItemArray _MSGMapCommunicationInterfaceItemArray A[12:4]S[MsgMapItem]
_MSGMapCommunicationInterface::
.blkb 3
.dbsym e MSGMapCommunicationInterface _MSGMapCommunicationInterface S[MsgMap]
; }
.area func_lit
PL_UARTPeekDataFromRxBuff: .word `_UARTPeekDataFromRxBuff
PL_UARTaddDataToTxBuff: .word `_UARTaddDataToTxBuff
PL_UARTgetDataFromRxBuff: .word `_UARTgetDataFromRxBuff
PL_SFP_NULL_Peek_Data_Function: .word `_SFP_NULL_Peek_Data_Function
PL_SFP_NULL_Output_Data_Function: .word `_SFP_NULL_Output_Data_Function
PL_SFP_NULL_Input_Data_Function: .word `_SFP_NULL_Input_Data_Function
PL_ADT_Queue_Peek_From_Buffer: .word `_ADT_Queue_Peek_From_Buffer
PL_ADT_Queue_Check_Empty: .word `_ADT_Queue_Check_Empty
PL_ADT_Queue_Get_From_Buffer: .word `_ADT_Queue_Get_From_Buffer
PL_ADT_Queue_Add_To_Buffer: .word `_ADT_Queue_Add_To_Buffer
PL_PROC_Acknowledge: .word `_PROC_Acknowledge
PL_MSG_NULL_PROC: .word `_MSG_NULL_PROC
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -