; TASKING TriCore C compiler v1.5r1 Build 322 SN 00090364
; options: -e -A1 -g -O0 -Id:\ctri\include -s -N8 -zTC112_COR1 -zTC112_COR4
;          -zTC112_COR10 -zTC112_COR13 -zTC112_COR14 -zTC112_COR16 -zTC112_COR17
	.name	"asc_test"
	.symb	TOOL, "TASKING TriCore C compiler v1.5", 1
	.symb	TYPE, 256, "bit", 'g', 0, 1
	.symb	FILE, "asc_test.c"
; file "asc_test.c":
;    1 |
;    2 |#include "stdio.h"
	.symb	FILE, "d:\\ctri\\include\\stdio.h"
	.symb	FILE, "d:\\ctri\\include\\stdarg.h"
	.symb	ENDF
	.symb	TYPE, 258, 'P', #2
	.symb	TYPE, 259, "_iobuf", 'S', 24,\
		 "_ptr", #258, 0,\
		 "_base", #258, 4,\
		 "_cnt", #16, 8,\
		 "_bufsiz", #16, 12,\
		 "_flag", #5, 16,\
		 "_file", #2, 18,\
		 "_wcnt", #16, 20
	.symb	TYPE, 260, "FILE", 'T', #259
	.symb	TYPE, 261, "va_list", 'T', #258
	.symb	TYPE, 262, "size_t", 'T', #18
	.symb	TYPE, 263, "fpos_t", 'T', #7
	.symb	TYPE, 264, "off_t", 'T', #6
	.symb	ENDF
;    3 |#include "Main.h"
	.symb	FILE, "Main.h"
	.symb	TYPE, 265, "uword", 'T', #18
	.symb	FILE, "TC1775BRegs.h"
	.symb	ENDF
	.symb	FILE, "IO.H"
	.symb	ENDF
	.symb	FILE, "ASC0.H"
	.symb	TYPE, 266, "ushort", 'T', #5
	.symb	ENDF
	.symb	FILE, "ASC1.H"
	.symb	ENDF
	.symb	FILE, "CAN.H"
	.symb	TYPE, 267, "ubyte", 'T', #3
	.symb	TYPE, 268, 'Z', #3, 7
	.symb	TYPE, 270, 'S', 20,\
		 "usMsgCfg", #5, 0,\
		 "uwID", #18, 2,\
		 "uwMask", #18, 6,\
		 "ubData", #268, 10,\
		 "usCounter", #5, 18
	.symb	TYPE, 271, "TCAN_SWObj", 'T', #270
	.symb	ENDF
	.symb	ENDF
;    4 |#include "ASC0.h"
	.symb	FILE, "ASC0.h"
	.symb	ENDF
;    5 |#include "ASC1.h"
	.symb	FILE, "ASC1.h"
	.symb	ENDF
;    6 |
;    7 |unsigned char ucASC_Test(void)
;    8 |{
	.sdecl	"code.asc_test",CODE
	.sect	"code.asc_test"
	.align	4
	.symb	LINE, 8
	.symb	TYPE, 272, 'g', 0, 1
	.symb	TYPE, 273, 'g', 0, 1
	.symb	TYPE, 274, 'g', 0, 1
	.symb	TYPE, 275, 'g', 0, 1
	.symb	TYPE, 276, 'g', 0, 1
	.symb	TYPE, 277, 'g', 0, 1
	.symb	TYPE, 278, 'g', 0, 1
	.symb	TYPE, 279, 'g', 0, 1
	.symb	TYPE, 280, 'g', 0, 1
	.symb	TYPE, 281, 'g', 0, 1
	.symb	TYPE, 282, 'g', 0, 1
	.symb	TYPE, 283, 'g', 0, 1
	.symb	TYPE, 284, 'g', 0, 1
	.symb	TYPE, 285, 'g', 0, 1
	.symb	TYPE, 286, 'g', 0, 1
	.symb	TYPE, 287, 'g', 0, 1
	.symb	TYPE, 288, 'g', 0, 1
	.symb	TYPE, 289, 'g', 0, 1
	.symb	TYPE, 290, 'g', 0, 1
	.symb	TYPE, 291, 'g', 0, 1
	.symb	TYPE, 292, 'g', 0, 1
	.symb	TYPE, 293, 'g', 0, 1
	.symb	TYPE, 294, 'g', 0, 1
	.symb	TYPE, 295, 'g', 0, 1
	.symb	TYPE, 296, 'g', 0, 1
	.symb	TYPE, 297, 'g', 0, 1
	.symb	TYPE, 298, 'g', 0, 1
	.symb	TYPE, 299, 'g', 0, 1
	.symb	TYPE, 300, 'g', 0, 1
	.symb	TYPE, 301, 'g', 0, 1
	.symb	TYPE, 302, 'g', 0, 1
	.symb	TYPE, 303, 'g', 0, 1
	.symb	TYPE, 304, 'S', 4,\
		 "bit0", #272, 0,\
		 "bit1", #273, 1,\
		 "bit2", #274, 2,\
		 "bit3", #275, 3,\
		 "bit4", #276, 4,\
		 "bit5", #277, 5,\
		 "bit6", #278, 6,\
		 "bit7", #279, 7,\
		 "bit8", #280, 8,\
		 "bit9", #281, 9,\
		 "bit10", #282, 10,\
		 "bit11", #283, 11,\
		 "bit12", #284, 12,\
		 "bit13", #285, 13,\
		 "bit14", #286, 14,\
		 "bit15", #287, 15,\
		 "bit16", #288, 16,\
		 "bit17", #289, 17,\
		 "bit18", #290, 18,\
		 "bit19", #291, 19,\
		 "bit20", #292, 20,\
		 "bit21", #293, 21,\
		 "bit22", #294, 22,\
		 "bit23", #295, 23,\
		 "bit24", #296, 24,\
		 "bit25", #297, 25,\
		 "bit26", #298, 26,\
		 "bit27", #299, 27,\
		 "bit28", #300, 28,\
		 "bit29", #301, 29,\
		 "bit30", #302, 30,\
		 "bit31", #303, 31
	.symb	TYPE, 305, "T_Reg32", 'T', #304
	.symb	TYPE, 306, 'X', 8, #3, 26, 0
	.symb	GFUN, "ucASC_Test", ucASC_Test, #306, 0, 16, 0
	.symb	ALAB, ucASC_Test, #306
ucASC_Test:
	.symb	SOFF, 16
	.symb	IDEN, "ucASC0rec", -16, #3, 131, 0x5
	.symb	IDEN, "ucASC1rec", -12, #3, 131, 0x5
	nop
	sub16.a	sp,#16
;    9 |unsigned char ucASC0rec;
;   10 |unsigned char ucASC1rec;
;   11 |
;   12 |ucASC0rec = 0x40;
	.symb	LINE, 12
	mov16	d15,#64				; ucASC0rec
	st16.b	[sp],d15			; ucASC0rec
;   13 |ucASC1rec = 0x40;
	.symb	LINE, 13
	mov16	d15,#64				; ucASC1rec
	st16.b	[sp]4,d15			; ucASC1rec
;   14 |
;   15 |printf("Start of RS232 test...\n");
	.symb	LINE, 15
	movh.a	a4,#@his(_17)
	lea	a4,[a4]@los(_17)
	callg	printf
;   16 |
;   17 |		
;   18 |// printf("	Serial-0 sending...\n");
;   19 |while(! ASC0_ubTxBufFree());
	.symb	LINE, 19
	j	_21
_20:
_21:
_22:
	ld.bu	d15,-268433155
	extr.u	d15,d15,#5,#1
	jeq	d15,#0,_22
;   20 |ASC0_vSendData(0x41);
	.symb	LINE, 20
	mov	d4,#65				; 65
	callg	ASC0_vSendData
;   21 |
;   22 |// printf("	Serial-1 recieving...\n");
;   23 |while(! ASC1_ubRxDataReady());
	.symb	LINE, 23
	j	_24
_23:
_24:
_25:
	ld.bu	d15,-268432907
	extr.u	d15,d15,#5,#1
	jeq	d15,#0,_25
;   24 |ucASC1rec = ASC1_usGetData();
	.symb	LINE, 24
	callg	ASC1_usGetData
	st.b	[sp]4,d2			; ucASC1rec
;   25 |// printf("	Serial-1 recieved Data = %c\n",ucASC1rec);
;   26 |
;   27 |// printf("	Serial-1 sending...\n");
;   28 |while(! ASC1_ubTxBufFree());
	.symb	LINE, 28
	j	_27
_26:
_27:
_28:
	ld.bu	d15,-268432899
	extr.u	d15,d15,#5,#1
	jeq	d15,#0,_28
;   29 |ASC1_vSendData(0x42);
	.symb	LINE, 29
	mov	d4,#66				; 66
	callg	ASC1_vSendData
;   30 |
;   31 |// printf("	Serial-0 recieving...\n");
;   32 |while(! ASC0_ubRxDataReady());
	.symb	LINE, 32
	j	_30
_29:
_30:
_31:
	ld.bu	d15,-268433163
	extr.u	d15,d15,#5,#1
	jeq	d15,#0,_31
;   33 |ucASC0rec = ASC0_usGetData();
	.symb	LINE, 33
	callg	ASC0_usGetData
	st16.b	[sp],d2				; ucASC0rec
;   34 |// printf("	Serial-0 recieved Data = %c\n",ucASC0rec);
;   35 |
;   36 |if ( ucASC1rec != (ucASC0rec-1))
	.symb	LINE, 36
	ld16.bu	d15,[sp]4			; ucASC1rec
	ld16.bu	d7,[sp]				; ucASC0rec
	add16	d7,#-1
	jeq	d15,d7,_32
;   37 |	{
;   38 |	printf("	ERROR: ASC-datacompare failed!\n");
	.symb	LINE, 38
	movh.a	a4,#@his(_18)
	lea	a4,[a4]@los(_18)
	callg	printf
;   39 |	ucErrorFlag = 1;
	.symb	LINE, 39
	mov16	d15,#1				; ucErrorFlag
	st.b	ucErrorFlag,d15			; ucErrorFlag
;   40 |	return (ucErrorFlag);
	.symb	LINE, 40
	ld.bu	d2,ucErrorFlag			; ucErrorFlag
	ret16
;   41 |	}
	.symb	LINE, 41
_32:
;   42 |else
;   43 |	{
;   44 |    printf("	Both ASC´s are O.K.\n");
	.symb	LINE, 44
	movh.a	a4,#@his(_19)
	lea	a4,[a4]@los(_19)
	callg	printf
;   45 |	ucErrorFlag = 0;
	.symb	LINE, 45
	mov16	d15,#0				; ucErrorFlag
	st.b	ucErrorFlag,d15			; ucErrorFlag
;   46 |	return (ucErrorFlag);
	.symb	LINE, 46
	ld.bu	d2,ucErrorFlag			; ucErrorFlag
;   47 |	}
;   48 |}
	.symb	LINE, 48
_33:
	ret16
	.symb	EFUN
;   49 |
	.symb	ENDF
	.symb	ALAB, ucErrorFlag, #3
	.sdecl	"fardata.asc_test",DATA,INIT
	.sect	"fardata.asc_test"
	.align	4
_18:
	.ascii	"	ERROR: ASC-datacompare failed!"
	.byte	0x0a,0x00
	.symb	TYPE, 307, 'X', 8, #5, 26, 0
	.symb	ALAB, ASC1_usGetData, #307
	.align	2
_19:
	.ascii	"	Both ASC´s are O.K."
	.byte	0x0a,0x00
	.symb	TYPE, 308, 'X', 8, #5, 26, 0
	.symb	ALAB, ASC0_usGetData, #308
	.symb	TYPE, 309, 'X', 8, #16, 26, 2, #258, #1
	.symb	ALAB, printf, #309
	.symb	TYPE, 310, 'X', 8, #1, 26, 1, #5
	.symb	ALAB, ASC1_vSendData, #310
_17:
	.ascii	"Start of RS232 test..."
	.byte	0x0a,0x00
	.symb	TYPE, 311, 'X', 8, #1, 26, 1, #5
	.symb	ALAB, ASC0_vSendData, #311
	.global	ucASC_Test
	.extern	(CODE) ASC0_usGetData
	.extern	(CODE) ASC0_vSendData
	.extern	(CODE) ASC1_usGetData
	.extern	(CODE) ASC1_vSendData
	.extern	(CODE) printf
	.extern	(DATA,ABS18) ucErrorFlag
	.calls	"ucASC_Test", "ASC0_usGetData"
	.calls	"ucASC_Test", "ASC0_vSendData"
	.calls	"ucASC_Test", "ASC1_usGetData"
	.calls	"ucASC_Test", "ASC1_vSendData"
	.calls	"ucASC_Test", "printf"
