GTM MCSBOWLYSPETPENT CONTODRUN

公告

大中华汽车电子生态圈社区并入开发者社区- 更多资讯点击此

Tip / 登入 to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Translation_Bot
Community Manager
Community Manager
Community Manager

GTM mcshare有8个频道,每个频道都可独立运行代码,通过什么方法式配置mcs每个频道起始地了还有呢?

0 点赞
1 解答
Translation_Bot
Community Manager
Community Manager
Community Manager

@hoji_1442086

下图的汇编代码示例示例已在 mcs0 的频道中创建任务并启用 TaskTrophined,希望 Helpboogn 助你理解。

 

;
; \file Mcs0.asm
; \brief Template with MCS0 Init function.
;
; \copyright Copyright (c) 2018 Infineon Technologies AG. All rights reserved.
;
;
;
;                                 IMPORTANT NOTICE
;
;
; Infineon Technologies AG (Infineon) is supplying this file for use
; exclusively with Infineon's microcontroller products. This file can be freely
; distributed within development tools that are supporting such microcontroller
; products.
;
; THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
; OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
; MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
; INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
; OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
;

; Declare header for Bosch-CASPR-Translator
;----------------------------------------------------------------------;
.include "mcs24_3.inc"


; General defines
;----------------------------------------------------------------------;
.define EN_H_MSK		$000001
.define EN_L_MSK		$FFFFFE
.define IRQ_H_MSK		$000002
.define IRQ_L_MSK		$FFFFFD
.define ERR_H_MSK		$000004
.define ERR_L_MSK		$FFFFFB
.define MCA_H_MSK		$000008
.define MCA_L_MSK		$FFFFF7
.define CY_H_MSK		$000010
.define CY_L_MSK		$FFFFEF
.define Z_H_MSK			$000020
.define Z_L_MSK			$FFFFDF
.define V_H_MSK			$000040
.define V_L_MSK			$FFFFBF
.define N_H_MSK			$000080
.define N_L_MSK			$FFFF7F
.define CAT_H_MSK		$000100
.define CAT_L_MSK		$FFFEFF
.define CWT_H_MSK		$000200
.define CWT_L_MSK		$FFFDFF

; My define
.define DELAY_TIME		$4C4B40

; Initialize reset vectors of different tasks
;----------------------------------------------------------------------;
.org 0x0
jmp tsk0_init
jmp tsk1_init
jmp tsk2_init
jmp tsk3_init
jmp tsk4_init
jmp tsk5_init
jmp tsk6_init
jmp tsk7_init

; Allocate stack frames (each channel has a stack of 8 memory locations)
;----------------------------------------------------------------------;
.org 0x20
tsk0_stack:
.org (tsk0_stack+0x1C)
tsk1_stack:
.org (tsk1_stack+0x1C)
tsk2_stack:
.org (tsk2_stack+0x1C)
tsk3_stack:
.org (tsk3_stack+0x1C)
tsk4_stack:
.org (tsk4_stack+0x1C)
tsk5_stack:
.org (tsk5_stack+0x1C)
tsk6_stack:
.org (tsk6_stack+0x1C)
tsk7_stack:
.org (tsk7_stack+0x1C)

; Program entry for MCS-channel 0
;----------------------------------------------------------------------;
tsk0_init:
	movl R7 tsk0_stack ; initialize stack pointer
	movl R0 0
    movl R1 0
    movl R2 0
    movl R3 0
    movl R4 0
    movl R5 0
    movl R6 0
    call main0
tsk0_done:
    mov r6 STA	; disable channel
    andl r6 EN_L_MSK
    mov STA r6
    jmp tsk0_init	; jump back to start

; Program entry for MCS-channel 1
;----------------------------------------------------------------------;
tsk1_init:
	movl R7 tsk1_stack ; initialize stack pointer
	movl R0 0
    movl R1 0
    movl R2 0
    movl R3 0
    movl R4 0
    movl R5 0
    movl R6 0
    call main1
tsk1_done:
    mov r6 STA	; disable channel
    andl r6 EN_L_MSK
    mov STA r6
    jmp tsk1_init	; jump back to start

; Program entry for MCS-channel 2
;----------------------------------------------------------------------;
tsk2_init:
	movl R7 tsk2_stack ; initialize stack pointer
	movl R0 0
    movl R1 0
    movl R2 0
    movl R3 0
    movl R4 0
    movl R5 0
    movl R6 0
    call main2
tsk2_done:
    mov r6 STA	; disable channel
    andl r6 EN_L_MSK
    mov STA r6
    jmp tsk2_init	; jump back to start

; Program entry for MCS-channel 3
;----------------------------------------------------------------------;
tsk3_init:
	movl R7 tsk3_stack ; initialize stack pointer
	movl R0 0
    movl R1 0
    movl R2 0
    movl R3 0
    movl R4 0
    movl R5 0
    movl R6 0
    call main3
tsk3_done:
    mov r6 STA	; disable channel
    andl r6 EN_L_MSK
    mov STA r6
    jmp tsk3_init	; jump back to start

; Program entry for MCS-channel 4
;----------------------------------------------------------------------;
tsk4_init:
	movl R7 tsk4_stack ; initialize stack pointer
	movl R0 0
    movl R1 0
    movl R2 0
    movl R3 0
    movl R4 0
    movl R5 0
    movl R6 0
    call main4
tsk4_done:
    mov r6 STA	; disable channel
    andl r6 EN_L_MSK
    mov STA r6
    jmp tsk4_init	; jump back to start

; Program entry for MCS-channel 5
;--------------------------------------------------------;
tsk5_init:
	movl R7 tsk5_stack ; initialize stack pointer
	movl R0 0
    movl R1 0
    movl R2 0
    movl R3 0
    movl R4 0
    movl R5 0
    movl R6 0
    call main5
tsk5_done:
    mov r6 STA	; disable channel
    andl r6 EN_L_MSK
    mov STA r6
    jmp tsk5_init	; jump back to start

; Program entry for MCS-channel 6
;--------------------------------------------------------;
tsk6_init:
	movl R7 tsk6_stack ; initialize stack pointer
	movl R0 0
    movl R1 0
    movl R2 0
    movl R3 0
    movl R4 0
    movl R5 0
    movl R6 0
    call main6
tsk6_done:
    mov r6 STA	; disable channel
    andl r6 EN_L_MSK
    mov STA r6
    jmp tsk6_init	; jump back to start

; Program entry for MCS-channel 7
;----------------------------------------------------------------------;
tsk7_init:
	movl R7 tsk7_stack ; initialize stack pointer
	movl R0 0
    movl R1 0
    movl R2 0
    movl R3 0
    movl R4 0
    movl R5 0
    movl R6 0
    call main7
tsk7_done:
    mov r6 STA	; disable channel
    andl r6 EN_L_MSK
    mov STA r6
    jmp tsk7_init	; jump back to start


; Main function for MCS-channel 0
;----------------------------------------------------------------------;
main0:

	brd R2 ATOM_CH4_CTRL
	movl MHB 0			 ; set MHB to 0. It will be transferred to ATOM_CH4_CTRL
	mov R1 TBU_TS0		 ; R1 = time stamp of TBU_TS0
	addl R1 DELAY_TIME   ; increase R1 by DELAY time (5.000.000 tick at CMU_CLK0 = 10MHz = 0.5s)
	xorl R2 $10			 ; toggle bit 4 of R2 (ACB[0]) in ATOM_CH0_CTRL)
	WURM R1 TBU_TS0 $FFFF; wait until TBU_TS0 match R1
	bwr R2 ATOM_CH4_CTRL ; transfer R2 and MHB to ATOM_CH4_CTRL
	jmp main0       	 ; restart from main0

	ret	; return from main

; Main function for MCS-channel 1
;----------------------------------------------------------------------;
main1:

	ret	; return from main

; Main function for MCS-channel 2
;----------------------------------------------------------------------;
main2:

	ret	; return from main

; Main function for MCS-channel 3
;----------------------------------------------------------------------;
main3:

	ret	; return from main

; Main function for MCS-channel 4
;----------------------------------------------------------------------;
main4:

	ret	; return from main

; Main function for MCS-channel 5
;----------------------------------------------------------------------;
main5:

	ret	; return from main

; Main function for MCS-channel 6
;----------------------------------------------------------------------;
main6:

	ret	; return from main

; Main function for MCS-channel 7
;----------------------------------------------------------------------;
main7:

	ret	; return from main


;--------------------------------- Functions --------------------------;


; locate Values from CPU in memory
.org 0x2FFC
Place_Holder: .var 0x0



 

BR,

杰里米

在原帖中查看解决方案

0 点赞
1 回复
Translation_Bot
Community Manager
Community Manager
Community Manager

@hoji_1442086

下图的汇编代码示例示例已在 mcs0 的频道中创建任务并启用 TaskTrophined,希望 Helpboogn 助你理解。

 

;
; \file Mcs0.asm
; \brief Template with MCS0 Init function.
;
; \copyright Copyright (c) 2018 Infineon Technologies AG. All rights reserved.
;
;
;
;                                 IMPORTANT NOTICE
;
;
; Infineon Technologies AG (Infineon) is supplying this file for use
; exclusively with Infineon's microcontroller products. This file can be freely
; distributed within development tools that are supporting such microcontroller
; products.
;
; THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
; OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
; MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
; INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
; OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
;

; Declare header for Bosch-CASPR-Translator
;----------------------------------------------------------------------;
.include "mcs24_3.inc"


; General defines
;----------------------------------------------------------------------;
.define EN_H_MSK		$000001
.define EN_L_MSK		$FFFFFE
.define IRQ_H_MSK		$000002
.define IRQ_L_MSK		$FFFFFD
.define ERR_H_MSK		$000004
.define ERR_L_MSK		$FFFFFB
.define MCA_H_MSK		$000008
.define MCA_L_MSK		$FFFFF7
.define CY_H_MSK		$000010
.define CY_L_MSK		$FFFFEF
.define Z_H_MSK			$000020
.define Z_L_MSK			$FFFFDF
.define V_H_MSK			$000040
.define V_L_MSK			$FFFFBF
.define N_H_MSK			$000080
.define N_L_MSK			$FFFF7F
.define CAT_H_MSK		$000100
.define CAT_L_MSK		$FFFEFF
.define CWT_H_MSK		$000200
.define CWT_L_MSK		$FFFDFF

; My define
.define DELAY_TIME		$4C4B40

; Initialize reset vectors of different tasks
;----------------------------------------------------------------------;
.org 0x0
jmp tsk0_init
jmp tsk1_init
jmp tsk2_init
jmp tsk3_init
jmp tsk4_init
jmp tsk5_init
jmp tsk6_init
jmp tsk7_init

; Allocate stack frames (each channel has a stack of 8 memory locations)
;----------------------------------------------------------------------;
.org 0x20
tsk0_stack:
.org (tsk0_stack+0x1C)
tsk1_stack:
.org (tsk1_stack+0x1C)
tsk2_stack:
.org (tsk2_stack+0x1C)
tsk3_stack:
.org (tsk3_stack+0x1C)
tsk4_stack:
.org (tsk4_stack+0x1C)
tsk5_stack:
.org (tsk5_stack+0x1C)
tsk6_stack:
.org (tsk6_stack+0x1C)
tsk7_stack:
.org (tsk7_stack+0x1C)

; Program entry for MCS-channel 0
;----------------------------------------------------------------------;
tsk0_init:
	movl R7 tsk0_stack ; initialize stack pointer
	movl R0 0
    movl R1 0
    movl R2 0
    movl R3 0
    movl R4 0
    movl R5 0
    movl R6 0
    call main0
tsk0_done:
    mov r6 STA	; disable channel
    andl r6 EN_L_MSK
    mov STA r6
    jmp tsk0_init	; jump back to start

; Program entry for MCS-channel 1
;----------------------------------------------------------------------;
tsk1_init:
	movl R7 tsk1_stack ; initialize stack pointer
	movl R0 0
    movl R1 0
    movl R2 0
    movl R3 0
    movl R4 0
    movl R5 0
    movl R6 0
    call main1
tsk1_done:
    mov r6 STA	; disable channel
    andl r6 EN_L_MSK
    mov STA r6
    jmp tsk1_init	; jump back to start

; Program entry for MCS-channel 2
;----------------------------------------------------------------------;
tsk2_init:
	movl R7 tsk2_stack ; initialize stack pointer
	movl R0 0
    movl R1 0
    movl R2 0
    movl R3 0
    movl R4 0
    movl R5 0
    movl R6 0
    call main2
tsk2_done:
    mov r6 STA	; disable channel
    andl r6 EN_L_MSK
    mov STA r6
    jmp tsk2_init	; jump back to start

; Program entry for MCS-channel 3
;----------------------------------------------------------------------;
tsk3_init:
	movl R7 tsk3_stack ; initialize stack pointer
	movl R0 0
    movl R1 0
    movl R2 0
    movl R3 0
    movl R4 0
    movl R5 0
    movl R6 0
    call main3
tsk3_done:
    mov r6 STA	; disable channel
    andl r6 EN_L_MSK
    mov STA r6
    jmp tsk3_init	; jump back to start

; Program entry for MCS-channel 4
;----------------------------------------------------------------------;
tsk4_init:
	movl R7 tsk4_stack ; initialize stack pointer
	movl R0 0
    movl R1 0
    movl R2 0
    movl R3 0
    movl R4 0
    movl R5 0
    movl R6 0
    call main4
tsk4_done:
    mov r6 STA	; disable channel
    andl r6 EN_L_MSK
    mov STA r6
    jmp tsk4_init	; jump back to start

; Program entry for MCS-channel 5
;--------------------------------------------------------;
tsk5_init:
	movl R7 tsk5_stack ; initialize stack pointer
	movl R0 0
    movl R1 0
    movl R2 0
    movl R3 0
    movl R4 0
    movl R5 0
    movl R6 0
    call main5
tsk5_done:
    mov r6 STA	; disable channel
    andl r6 EN_L_MSK
    mov STA r6
    jmp tsk5_init	; jump back to start

; Program entry for MCS-channel 6
;--------------------------------------------------------;
tsk6_init:
	movl R7 tsk6_stack ; initialize stack pointer
	movl R0 0
    movl R1 0
    movl R2 0
    movl R3 0
    movl R4 0
    movl R5 0
    movl R6 0
    call main6
tsk6_done:
    mov r6 STA	; disable channel
    andl r6 EN_L_MSK
    mov STA r6
    jmp tsk6_init	; jump back to start

; Program entry for MCS-channel 7
;----------------------------------------------------------------------;
tsk7_init:
	movl R7 tsk7_stack ; initialize stack pointer
	movl R0 0
    movl R1 0
    movl R2 0
    movl R3 0
    movl R4 0
    movl R5 0
    movl R6 0
    call main7
tsk7_done:
    mov r6 STA	; disable channel
    andl r6 EN_L_MSK
    mov STA r6
    jmp tsk7_init	; jump back to start


; Main function for MCS-channel 0
;----------------------------------------------------------------------;
main0:

	brd R2 ATOM_CH4_CTRL
	movl MHB 0			 ; set MHB to 0. It will be transferred to ATOM_CH4_CTRL
	mov R1 TBU_TS0		 ; R1 = time stamp of TBU_TS0
	addl R1 DELAY_TIME   ; increase R1 by DELAY time (5.000.000 tick at CMU_CLK0 = 10MHz = 0.5s)
	xorl R2 $10			 ; toggle bit 4 of R2 (ACB[0]) in ATOM_CH0_CTRL)
	WURM R1 TBU_TS0 $FFFF; wait until TBU_TS0 match R1
	bwr R2 ATOM_CH4_CTRL ; transfer R2 and MHB to ATOM_CH4_CTRL
	jmp main0       	 ; restart from main0

	ret	; return from main

; Main function for MCS-channel 1
;----------------------------------------------------------------------;
main1:

	ret	; return from main

; Main function for MCS-channel 2
;----------------------------------------------------------------------;
main2:

	ret	; return from main

; Main function for MCS-channel 3
;----------------------------------------------------------------------;
main3:

	ret	; return from main

; Main function for MCS-channel 4
;----------------------------------------------------------------------;
main4:

	ret	; return from main

; Main function for MCS-channel 5
;----------------------------------------------------------------------;
main5:

	ret	; return from main

; Main function for MCS-channel 6
;----------------------------------------------------------------------;
main6:

	ret	; return from main

; Main function for MCS-channel 7
;----------------------------------------------------------------------;
main7:

	ret	; return from main


;--------------------------------- Functions --------------------------;


; locate Values from CPU in memory
.org 0x2FFC
Place_Holder: .var 0x0



 

BR,

杰里米

0 点赞