; 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	"asc1"
	.symb	TOOL, "TASKING TriCore C compiler v1.5", 1
	.symb	TYPE, 256, "bit", 'g', 0, 1
	.symb	FILE, "asc1.c"
; file "asc1.c":
;    1 |//****************************************************************************
;    2 |// @Module        Asynchronous Synchronous Serial Interface 1 (ASC1)
;    3 |// @Filename      ASC1.C
;    4 |// @Project       Test_TC1775B.dav
;    5 |//----------------------------------------------------------------------------
;    6 |// @Controller    Infineon TC1775 B-Step
;    7 |//
;    8 |// @Compiler      Tasking
;    9 |//
;   10 |// @Codegenerator 2.2
;   11 |//
;   12 |// @Description   This file contains functions that use the ASC1 module.
;   13 |//
;   14 |//----------------------------------------------------------------------------
;   15 |// @Date          12.06.2002 17:31:46
;   16 |//
;   17 |//****************************************************************************
;   18 |
;   19 |// USER CODE BEGIN (ASC1_General,1)
;   20 |
;   21 |// USER CODE END
;   22 |
;   23 |
;   24 |
;   25 |//****************************************************************************
;   26 |// @Project Includes
;   27 |//****************************************************************************
;   28 |
;   29 |#include "MAIN.H"
	.symb	FILE, "MAIN.H"
	.symb	TYPE, 257, "uword", 'T', #18
	.symb	FILE, "TC1775BRegs.h"
	.symb	ENDF
	.symb	FILE, "IO.H"
	.symb	ENDF
	.symb	FILE, "ASC0.H"
	.symb	TYPE, 258, "ushort", 'T', #5
	.symb	ENDF
	.symb	FILE, "ASC1.H"
	.symb	ENDF
	.symb	FILE, "CAN.H"
	.symb	TYPE, 259, "ubyte", 'T', #3
	.symb	TYPE, 260, 'Z', #3, 7
	.symb	TYPE, 262, 'S', 20,\
		 "usMsgCfg", #5, 0,\
		 "uwID", #18, 2,\
		 "uwMask", #18, 6,\
		 "ubData", #260, 10,\
		 "usCounter", #5, 18
	.symb	TYPE, 263, "TCAN_SWObj", 'T', #262
	.symb	ENDF
	.symb	ENDF
;   30 |
;   31 |// USER CODE BEGIN (ASC1_General,2)
;   32 |
;   33 |// USER CODE END
;   34 |
;   35 |
;   36 |//****************************************************************************
;   37 |// @Macros
;   38 |//****************************************************************************
;   39 |
;   40 |// USER CODE BEGIN (ASC1_General,3)
;   41 |
;   42 |// USER CODE END
;   43 |
;   44 |
;   45 |//****************************************************************************
;   46 |// @Defines
;   47 |//****************************************************************************
;   48 |
;   49 |// USER CODE BEGIN (ASC1_General,4)
;   50 |
;   51 |// USER CODE END
;   52 |
;   53 |
;   54 |//****************************************************************************
;   55 |// @Typedefs
;   56 |//****************************************************************************
;   57 |
;   58 |// USER CODE BEGIN (ASC1_General,5)
;   59 |
;   60 |// USER CODE END
;   61 |
;   62 |
;   63 |//****************************************************************************
;   64 |// @Imported Global Variables
;   65 |//****************************************************************************
;   66 |
;   67 |// USER CODE BEGIN (ASC1_General,6)
;   68 |
;   69 |// USER CODE END
;   70 |
;   71 |
;   72 |//****************************************************************************
;   73 |// @Global Variables
;   74 |//****************************************************************************
;   75 |
;   76 |// USER CODE BEGIN (ASC1_General,7)
;   77 |
;   78 |// USER CODE END
;   79 |
;   80 |
;   81 |//****************************************************************************
;   82 |// @External Prototypes
;   83 |//****************************************************************************
;   84 |
;   85 |// USER CODE BEGIN (ASC1_General,8)
;   86 |
;   87 |// USER CODE END
;   88 |
;   89 |
;   90 |//****************************************************************************
;   91 |// @Prototypes Of Local Functions
;   92 |//****************************************************************************
;   93 |
;   94 |// USER CODE BEGIN (ASC1_General,9)
;   95 |
;   96 |// USER CODE END
;   97 |
;   98 |
;   99 |//****************************************************************************
;  100 |// @Function      void ASC1_vInit(void) 
;  101 |//
;  102 |//----------------------------------------------------------------------------
;  103 |// @Description   This is the initialization function of the ASC1 function 
;  104 |//                library. It is assumed that the SFRs used by this library 
;  105 |//                are in its reset state. 
;  106 |//
;  107 |//----------------------------------------------------------------------------
;  108 |// @Returnvalue   None
;  109 |//
;  110 |//----------------------------------------------------------------------------
;  111 |// @Parameters    None
;  112 |//
;  113 |//----------------------------------------------------------------------------
;  114 |// @Date          12.06.2002
;  115 |//
;  116 |//****************************************************************************
;  117 |
;  118 |// USER CODE BEGIN (Init,1)
;  119 |
;  120 |// USER CODE END
;  121 |
;  122 |void ASC1_vInit(void)
;  123 |{
	.sdecl	"code.asc1",CODE
	.sect	"code.asc1"
	.align	4
	.symb	LINE, 123
	.symb	TYPE, 264, 'g', 0, 1
	.symb	TYPE, 265, 'g', 0, 1
	.symb	TYPE, 266, 'g', 0, 1
	.symb	TYPE, 267, 'g', 0, 1
	.symb	TYPE, 268, 'g', 0, 1
	.symb	TYPE, 269, 'g', 0, 1
	.symb	TYPE, 270, 'g', 0, 1
	.symb	TYPE, 271, 'g', 0, 1
	.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, 'S', 4,\
		 "bit0", #264, 0,\
		 "bit1", #265, 1,\
		 "bit2", #266, 2,\
		 "bit3", #267, 3,\
		 "bit4", #268, 4,\
		 "bit5", #269, 5,\
		 "bit6", #270, 6,\
		 "bit7", #271, 7,\
		 "bit8", #272, 8,\
		 "bit9", #273, 9,\
		 "bit10", #274, 10,\
		 "bit11", #275, 11,\
		 "bit12", #276, 12,\
		 "bit13", #277, 13,\
		 "bit14", #278, 14,\
		 "bit15", #279, 15,\
		 "bit16", #280, 16,\
		 "bit17", #281, 17,\
		 "bit18", #282, 18,\
		 "bit19", #283, 19,\
		 "bit20", #284, 20,\
		 "bit21", #285, 21,\
		 "bit22", #286, 22,\
		 "bit23", #287, 23,\
		 "bit24", #288, 24,\
		 "bit25", #289, 25,\
		 "bit26", #290, 26,\
		 "bit27", #291, 27,\
		 "bit28", #292, 28,\
		 "bit29", #293, 29,\
		 "bit30", #294, 30,\
		 "bit31", #295, 31
	.symb	TYPE, 297, "T_Reg32", 'T', #296
	.symb	TYPE, 298, 'X', 8, #1, 26, 0
	.symb	GFUN, "ASC1_vInit", ASC1_vInit, #298, 0, 0, 0
	.symb	ALAB, ASC1_vInit, #298
ASC1_vInit:
	.symb	SOFF, 0
;  124 |  // USER CODE BEGIN (Init,2)
;  125 |
;  126 |  // USER CODE END
;  127 |
;  128 |  ///  -----------------------------------------------------------------------
;  129 |  ///  Configuration of the Module Clock:
;  130 |  ///  -----------------------------------------------------------------------
;  131 |  ///  - enable the ASC1 module
;  132 |  ///  - clock divider for normal operation mode: System clock / 1 (= 40,0000 
;  133 |  ///    MHz; 25,000 ns )
;  134 |  ///  - the ASC1 module is stopped during sleep mode
;  135 |
;  136 |  MAIN_vResetENDINIT();
	.symb	LINE, 136
	ld.w	d4,-268435424
	mov16	d15,#-2				; -2
	and16	d4,d15
	callg	MAIN_vWriteWDTCON0
;  137 |  ASC1_CLC       =  0x00000100;  // load clock control register
	.symb	LINE, 137
	mov	d15,#256
	st.w	-268433152,d15
;  138 |  MAIN_vSetENDINIT();
	.symb	LINE, 138
	ld.w	d4,-268435424
	or	d4,d4,#1
	callg	MAIN_vWriteWDTCON0
;  139 |
;  140 |  ///  -----------------------------------------------------------------------
;  141 |  ///  Configuration of the ASC1 Baudrate Generator:
;  142 |  ///  -----------------------------------------------------------------------
;  143 |  ///  - the ASC1 module clock is 40 MHz
;  144 |  ///  - additionally reduce serial clock to 2
;  145 |  ///  - required baud rate = 19,200 kbaud
;  146 |  ///  - real baud rate     = 19,231 kbaud
;  147 |  ///  - deviation          = 0,160 %
;  148 |
;  149 |  ASC1_BG        =  0x0040;      // load ASC1 baud rate time reload register
	.symb	LINE, 149
	mov16	d15,#64
	st.w	-268433132,d15
;  150 |
;  151 |  ///  -----------------------------------------------------------------------
;  152 |  ///  Configuration of the ASC1 Operation Mode:
;  153 |  ///  -----------------------------------------------------------------------
;  154 |  ///  - 8-bit data asychronous operation with one stop bit
;  155 |
;  156 |  ///  - receiver is enabled
;  157 |
;  158 |  ASC1_CON       =  0x0011;      // load ASC1 control register
	.symb	LINE, 158
	mov16	d15,#17
	st.w	-268433136,d15
;  159 |
;  160 |  ///  -----------------------------------------------------------------------
;  161 |  ///  Configuration of the used ASC1 Port Pins:
;  162 |  ///  -----------------------------------------------------------------------
;  163 |  ASC1_PISEL     =  0x0000;      // load peripheral input selection register
	.symb	LINE, 163
	mov16	d15,#0
	st.w	-268433148,d15
;  164 |
;  165 |  ///  - P12.15 is used for ASC1 transmit output signal (ASC1_TXD)
;  166 |  ///  - P12.14 is used for ASC1 receive input signal (ASC1_RXD)
;  167 |
;  168 |  P12_ALTSEL0   |=  0x8000;      // select alternate output function
	.symb	LINE, 168
	ld.w	d15,-268422076
	mov.u	d7,#32768			; 32768
	or16	d15,d7
	st.w	-268422076,d15
;  169 |  P12_DIR       |=  0x8000;      // set direction register
	.symb	LINE, 169
	ld.w	d15,-268422120
	mov.u	d7,#32768			; 32768
	or16	d15,d7
	st.w	-268422120,d15
;  170 |
;  171 |  ///  -----------------------------------------------------------------------
;  172 |  ///  Configuration of the used ASC1 Interrupts:
;  173 |  ///  -----------------------------------------------------------------------
;  174 |
;  175 |  //   -----------------------------------------------------------------------
;  176 |  //   Default Settings for Service Request Flags:
;  177 |  //   -----------------------------------------------------------------------
;  178 |  ASC1_TBSRC_SETR  =  1;         // indicates that the transmit buffer is 
	.symb	LINE, 178
	st.t	-268432899,#7,#1
;  179 |                                 // empty
;  180 |
;  181 |  // USER CODE BEGIN (ASC1_Function,3)
;  182 |
;  183 |  // USER CODE END
;  184 |
;  185 |  ASC1_CON      |=  0x8000;      // enable baud rate generator
	.symb	LINE, 185
	ld.w	d15,-268433136
	mov.u	d7,#32768			; 32768
	or16	d15,d7
	st.w	-268433136,d15
;  186 |
;  187 |
;  188 |} //  End of function ASC1_vInit
	.symb	LINE, 188
	ret16
	.symb	EFUN
;  189 |
;  190 |
;  191 |//****************************************************************************
;  192 |// @Function      void ASC1_vSendData(ushort usData) 
;  193 |//
;  194 |//----------------------------------------------------------------------------
;  195 |// @Description   This function writes a send data initialization word into 
;  196 |//                the transmit buffer register.
;  197 |//                
;  198 |//                Note: 
;  199 |//                In a multiprocessor system the master with this function 
;  200 |//                has the possibility to send data to the selected slave. To 
;  201 |//                achieve this, the 9th bit must set on zero.
;  202 |//
;  203 |//----------------------------------------------------------------------------
;  204 |// @Returnvalue   None
;  205 |//
;  206 |//----------------------------------------------------------------------------
;  207 |// @Parameters    usData: 
;  208 |//                Data to be send
;  209 |//
;  210 |//----------------------------------------------------------------------------
;  211 |// @Date          12.06.2002
;  212 |//
;  213 |//****************************************************************************
;  214 |
;  215 |// USER CODE BEGIN (SendData,1)
;  216 |
;  217 |// USER CODE END
;  218 |
;  219 |void ASC1_vSendData(ushort usData)
;  220 |{
	.symb	LINE, 220
	.symb	TYPE, 299, 'X', 8, #1, 26, 1, #5
	.symb	GFUN, "ASC1_vSendData", ASC1_vSendData, #299, 0, 16, 0
	.symb	ALAB, ASC1_vSendData, #299
ASC1_vSendData:
	.symb	SOFF, 16
	.symb	LTIM, "usData", 4, 0, 0x8cd
	.symb	IDEN, "usData", 4, #5, 0, 0x80d
	.symb	LTIM, "usData", 4, 0, 0x84d
	.symb	LTIM, "usData", -16, 131, 0x8c5
	.symb	LTIM, "usData", -16, 131, 0x845
	.symb	LTIM, "usData", 15, 0, 0x8cd
	nop
	sub16.a	sp,#16
	st16.h	[sp],d4				; usData
;  221 |  ASC1_TBSRC_CLRR = 1;   //  reset transmit buffer interrupt request 
	.symb	LINE, 221
	st.t	-268432899,#6,#1
;  222 |  ASC1_TBUF  = usData;   //  load transmit buffer register
	.symb	LINE, 222
	ld.hu	d15,[sp]			; usData
	st.w	-268433120,d15
;  223 |
;  224 |} //  End of function ASC1_vSendData
	.symb	LINE, 224
	ret16
	.symb	LTIM, "usData", 15, 0, 0x84d
	.symb	EFUN
;  225 |
;  226 |
;  227 |//****************************************************************************
;  228 |// @Function      ushort ASC1_usGetData(void) 
;  229 |//
;  230 |//----------------------------------------------------------------------------
;  231 |// @Description   This function reads out the content of the receive buffer 
;  232 |//                register which contains the received data.
;  233 |//
;  234 |//----------------------------------------------------------------------------
;  235 |// @Returnvalue   data that has been received
;  236 |//
;  237 |//----------------------------------------------------------------------------
;  238 |// @Parameters    None
;  239 |//
;  240 |//----------------------------------------------------------------------------
;  241 |// @Date          12.06.2002
;  242 |//
;  243 |//****************************************************************************
;  244 |
;  245 |// USER CODE BEGIN (GetData,1)
;  246 |
;  247 |// USER CODE END
;  248 |
;  249 |ushort ASC1_usGetData(void)
;  250 |{
	.symb	LINE, 250
	.symb	TYPE, 300, 'X', 8, #5, 26, 0
	.symb	GFUN, "ASC1_usGetData", ASC1_usGetData, #300, 0, 0, 0
	.symb	ALAB, ASC1_usGetData, #300
ASC1_usGetData:
	.symb	SOFF, 0
;  251 |  ASC1_RSRC_CLRR = 1;    // reset receive interrupt request
	.symb	LINE, 251
	st.t	-268432907,#6,#1
;  252 |  return(ASC1_RBUF);     // return receive buffer register
	.symb	LINE, 252
	ld.w	d2,-268433116
	extr.u	d2,d2,#0,#16
;  253 |
;  254 |} //  End of function ASC1_usGetData
	.symb	LINE, 254
_17:
	ret16
	.symb	EFUN
;  255 |
;  256 |
;  257 |
;  258 |
;  259 |// USER CODE BEGIN (ASC1_General,10)
;  260 |
;  261 |// USER CODE END
;  262 |
	.symb	ENDF
	.symb	TYPE, 301, 'X', 8, #1, 26, 1, #18
	.symb	ALAB, MAIN_vWriteWDTCON0, #301
	.global	ASC1_usGetData
	.global	ASC1_vInit
	.global	ASC1_vSendData
	.extern	(CODE) MAIN_vWriteWDTCON0
	.calls	"ASC1_vInit", "MAIN_vWriteWDTCON0"
