| ISF 2.1 Intelligent Sensing Framework for Kinetis with Processor Expert

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Serial_ISF_UART1.c
Go to the documentation of this file.
1 /* ###################################################################
2 ** THIS COMPONENT MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
3 ** Filename : Serial_ISF_UART1.c
4 ** Project : ISF_K64F_CW_PROJ
5 ** Processor : MK64FN1M0VLL12
6 ** Component : Serial_LDD
7 ** Version : Component 01.187, Driver 01.12, CPU db: 3.00.000
8 ** Compiler : GNU C Compiler
9 ** Date/Time : 2015-03-03, 11:01, # CodeGen: 0
10 ** Abstract :
11 ** This component "Serial_LDD" implements an asynchronous serial
12 ** communication. The component supports different settings of
13 ** parity, word width, stop-bit and communication speed,
14 ** user can select interrupt or polling handler.
15 ** Communication speed can be changed also in runtime.
16 ** The component requires one on-chip asynchronous serial communication channel.
17 ** Settings :
18 ** Component name : Serial_ISF_UART1
19 ** Device : UART0
20 ** Interrupt service/event : Enabled
21 ** Interrupt RxD : INT_UART0_RX_TX
22 ** Interrupt RxD priority : medium priority
23 ** Interrupt TxD : INT_UART0_RX_TX
24 ** Interrupt TxD priority : medium priority
25 ** Interrupt Error : INT_UART0_ERR
26 ** Interrupt Error priority : medium priority
27 ** Settings :
28 ** Data width : 8 bits
29 ** Parity : None
30 ** Stop bits : 1
31 ** Loop mode : Normal
32 ** Baud rate : 115200 baud
33 ** Wakeup condition : Idle line wakeup
34 ** Stop in wait mode : no
35 ** Idle line mode : Starts after start bit
36 ** Transmitter output : Not inverted
37 ** Receiver input : Not inverted
38 ** Break generation length : 10/11 bits
39 ** Receiver : Enabled
40 ** RxD : PTB16/SPI1_SOUT/UART0_RX/FTM_CLKIN0/FB_AD17/EWM_IN
41 ** RxD pin signal :
42 ** Transmitter : Enabled
43 ** TxD : PTB17/SPI1_SIN/UART0_TX/FTM_CLKIN1/FB_AD16/EWM_OUT_b
44 ** TxD pin signal :
45 ** Flow control : Hardware (RTS/CTS)
46 ** CTS : Disabled
47 ** RTS : Disabled
48 ** Initialization :
49 ** Enabled in init. code : yes
50 ** Auto initialization : no
51 ** Event mask :
52 ** OnBlockSent : Enabled
53 ** OnBlockReceived : Enabled
54 ** OnTxComplete : Disabled
55 ** OnError : Disabled
56 ** OnBreak : Disabled
57 ** CPU clock/configuration selection :
58 ** Clock configuration 0 : This component enabled
59 ** Clock configuration 1 : This component disabled
60 ** Clock configuration 2 : This component disabled
61 ** Clock configuration 3 : This component disabled
62 ** Clock configuration 4 : This component disabled
63 ** Clock configuration 5 : This component disabled
64 ** Clock configuration 6 : This component disabled
65 ** Clock configuration 7 : This component disabled
66 ** Contents :
67 ** Init - LDD_TDeviceData* Serial_ISF_UART1_Init(LDD_TUserData *UserDataPtr);
68 ** SendBlock - LDD_TError Serial_ISF_UART1_SendBlock(LDD_TDeviceData *DeviceDataPtr,...
69 ** ReceiveBlock - LDD_TError Serial_ISF_UART1_ReceiveBlock(LDD_TDeviceData *DeviceDataPtr,...
70 **
71 ** Copyright : 1997 - 2014 Freescale Semiconductor, Inc.
72 ** All Rights Reserved.
73 **
74 ** Redistribution and use in source and binary forms, with or without modification,
75 ** are permitted provided that the following conditions are met:
76 **
77 ** o Redistributions of source code must retain the above copyright notice, this list
78 ** of conditions and the following disclaimer.
79 **
80 ** o Redistributions in binary form must reproduce the above copyright notice, this
81 ** list of conditions and the following disclaimer in the documentation and/or
82 ** other materials provided with the distribution.
83 **
84 ** o Neither the name of Freescale Semiconductor, Inc. nor the names of its
85 ** contributors may be used to endorse or promote products derived from this
86 ** software without specific prior written permission.
87 **
88 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
89 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
90 ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
91 ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
92 ** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
93 ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
94 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
95 ** ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
96 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
97 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
98 **
99 ** http: www.freescale.com
100 ** mail: support@freescale.com
101 ** ###################################################################*/
102 /*!
103 ** @file Serial_ISF_UART1.c
104 ** @version 01.12
105 ** @brief
106 ** This component "Serial_LDD" implements an asynchronous serial
107 ** communication. The component supports different settings of
108 ** parity, word width, stop-bit and communication speed,
109 ** user can select interrupt or polling handler.
110 ** Communication speed can be changed also in runtime.
111 ** The component requires one on-chip asynchronous serial communication channel.
112 */
113 /*!
114 ** @addtogroup Serial_ISF_UART1_module Serial_ISF_UART1 module documentation
115 ** @{
116 */
117
118 /* MODULE Serial_ISF_UART1. */
119 /*lint -save -e926 -e927 -e928 -e929 -e572 Disable MISRA rule (11.4,12.8) checking. */
120
121 /* MQX Lite include files */
122 #include "mqxlite.h"
123 #include "mqxlite_prv.h"
124 #include "Serial_ISF_UART1.h"
125 #include "UART_CH1.h"
126 #include "UART_PDD.h"
127 #include "SIM_PDD.h"
128
129 #ifdef __cplusplus
130 extern "C" {
131 #endif
132
133 /*! The mask of available events used to enable/disable events during runtime. */
134 #define AVAILABLE_EVENTS_MASK (LDD_SERIAL_ON_BLOCK_RECEIVED | LDD_SERIAL_ON_BLOCK_SENT)
135
136 /* {MQXLite RTOS Adapter} Static object used for simulation of dynamic driver memory allocation */
137 static Serial_ISF_UART1_TDeviceData DeviceDataPrv__DEFAULT_RTOS_ALLOC;
138
139 /*
140 ** ===================================================================
141 ** Method : Serial_ISF_UART1_Init (component Serial_LDD)
142 */
143 /*!
144 ** @brief
145 ** Initializes the device. Allocates memory for the device data
146 ** structure, allocates interrupt vectors and sets interrupt
147 ** priority, sets pin routing, sets timing, etc. If the "Enable
148 ** in init. code" is set to "yes" value then the device is also
149 ** enabled(see the description of the Enable() method). In this
150 ** case the Enable() method is not necessary and needn't to be
151 ** generated.
152 ** @param
153 ** UserDataPtr - Pointer to the user or
154 ** RTOS specific data. This pointer will be
155 ** passed as an event or callback parameter.
156 ** @return
157 ** - Device data structure pointer.
158 */
159 /* ===================================================================*/
160 LDD_TDeviceData* Serial_ISF_UART1_Init(LDD_TUserData *UserDataPtr)
161 {
162 /* Allocate device structure */
163 Serial_ISF_UART1_TDeviceDataPtr DeviceDataPrv;
164 /* {MQXLite RTOS Adapter} Driver memory allocation: Dynamic allocation is simulated by a pointer to the static object */
165 DeviceDataPrv = &DeviceDataPrv__DEFAULT_RTOS_ALLOC;
166
167 /* Clear the receive counters and pointer */
168 DeviceDataPrv->InpRecvDataNum = 0x00U; /* Clear the counter of received characters */
169 DeviceDataPrv->InpDataNumReq = 0x00U; /* Clear the counter of characters to receive by ReceiveBlock() */
170 DeviceDataPrv->InpDataPtr = NULL; /* Clear the buffer pointer for received characters */
171 /* Clear the transmit counters and pointer */
172 DeviceDataPrv->OutSentDataNum = 0x00U; /* Clear the counter of sent characters */
173 DeviceDataPrv->OutDataNumReq = 0x00U; /* Clear the counter of characters to be send by SendBlock() */
174 DeviceDataPrv->OutDataPtr = NULL; /* Clear the buffer pointer for data to be transmitted */
175 DeviceDataPrv->UserDataPtr = UserDataPtr; /* Store the RTOS device structure */
176 /* Allocate interrupt vectors */
177 /* {MQXLite RTOS Adapter} Save old and set new interrupt vector (function handler and ISR parameter) */
178 /* Note: Exception handler for interrupt is not saved, because it is not modified */
179 DeviceDataPrv->SavedISRSettings.isrData = _int_get_isr_data(LDD_ivIndex_INT_UART0_RX_TX);
180 DeviceDataPrv->SavedISRSettings.isrFunction = _int_install_isr(LDD_ivIndex_INT_UART0_RX_TX, Serial_ISF_UART1_Interrupt, DeviceDataPrv);
181 /* {MQXLite RTOS Adapter} Save old and set new interrupt vector (function handler and ISR parameter) */
182 /* Note: Exception handler for interrupt is not saved, because it is not modified */
183 DeviceDataPrv->SavedISRSettings.isrData = _int_get_isr_data(LDD_ivIndex_INT_UART0_ERR);
184 DeviceDataPrv->SavedISRSettings.isrFunction = _int_install_isr(LDD_ivIndex_INT_UART0_ERR, Serial_ISF_UART1_Interrupt, DeviceDataPrv);
185 /* SIM_SCGC4: UART0=1 */
186 SIM_SCGC4 |= SIM_SCGC4_UART0_MASK;
187 /* SIM_SCGC5: PORTB=1 */
188 SIM_SCGC5 |= SIM_SCGC5_PORTB_MASK;
189 /* PORTB_PCR16: ISF=0,MUX=3 */
190 PORTB_PCR16 = (uint32_t)((PORTB_PCR16 & (uint32_t)~(uint32_t)(
191 PORT_PCR_ISF_MASK |
192 PORT_PCR_MUX(0x04)
193 )) | (uint32_t)(
194 PORT_PCR_MUX(0x03)
195 ));
196 /* PORTB_PCR17: ISF=0,MUX=3 */
197 PORTB_PCR17 = (uint32_t)((PORTB_PCR17 & (uint32_t)~(uint32_t)(
198 PORT_PCR_ISF_MASK |
199 PORT_PCR_MUX(0x04)
200 )) | (uint32_t)(
201 PORT_PCR_MUX(0x03)
202 ));
203 /* NVICIP31: PRI31=0x70 */
204 NVICIP31 = NVIC_IP_PRI31(0x70);
205 /* NVICISER0: SETENA|=0x80000000 */
206 NVICISER0 |= NVIC_ISER_SETENA(0x80000000);
207 /* NVICIP32: PRI32=0x70 */
208 NVICIP32 = NVIC_IP_PRI32(0x70);
209 /* NVICISER1: SETENA|=1 */
210 NVICISER1 |= NVIC_ISER_SETENA(0x01);
211 UART_PDD_EnableTransmitter(UART0_BASE_PTR, PDD_DISABLE); /* Disable transmitter. */
212 UART_PDD_EnableReceiver(UART0_BASE_PTR, PDD_DISABLE); /* Disable receiver. */
213 DeviceDataPrv->SerFlag = 0x00U; /* Reset flags */
214 /* UART0_C1: LOOPS=0,UARTSWAI=0,RSRC=0,M=0,WAKE=0,ILT=0,PE=0,PT=0 */
215 UART0_C1 = 0x00U; /* Set the C1 register */
216 /* UART0_C3: R8=0,T8=0,TXDIR=0,TXINV=0,ORIE=0,NEIE=0,FEIE=0,PEIE=0 */
217 UART0_C3 = 0x00U; /* Set the C3 register */
218 /* UART0_C4: MAEN1=0,MAEN2=0,M10=0,BRFA=0 */
219 UART0_C4 = UART_C4_BRFA(0x00); /* Set the C4 register */
220 /* UART0_S2: LBKDIF=0,RXEDGIF=0,MSBF=0,RXINV=0,RWUID=0,BRK13=0,LBKDE=0,RAF=0 */
221 UART0_S2 = 0x00U; /* Set the S2 register */
222 /* UART0_MODEM: ??=0,??=0,??=0,??=0,RXRTSE=0,TXRTSPOL=0,TXRTSE=0,TXCTSE=0 */
223 UART0_MODEM = 0x00U; /* Set the MODEM register */
224 UART_PDD_SetBaudRateFineAdjust(UART0_BASE_PTR, 3u); /* Set baud rate fine adjust */
225 UART_PDD_SetBaudRate(UART0_BASE_PTR, 65U); /* Set the baud rate register. */
226 UART_PDD_EnableFifo(UART0_BASE_PTR, (UART_PDD_TX_FIFO_ENABLE | UART_PDD_RX_FIFO_ENABLE)); /* Enable RX and TX FIFO */
227 UART_PDD_FlushFifo(UART0_BASE_PTR, (UART_PDD_TX_FIFO_FLUSH | UART_PDD_RX_FIFO_FLUSH)); /* Flush RX and TX FIFO */
228 UART_PDD_EnableTransmitter(UART0_BASE_PTR, PDD_ENABLE); /* Enable transmitter */
229 UART_PDD_EnableReceiver(UART0_BASE_PTR, PDD_ENABLE); /* Enable receiver */
230 UART_PDD_EnableInterrupt(UART0_BASE_PTR, ( UART_PDD_INTERRUPT_RECEIVER )); /* Enable interrupts */
231 /* Registration of the device structure */
232 PE_LDD_RegisterDeviceStructure(PE_LDD_COMPONENT_Serial_ISF_UART1_ID,DeviceDataPrv);
233 return ((LDD_TDeviceData *)DeviceDataPrv);
234 }
235
236 /*
237 ** ===================================================================
238 ** Method : Serial_ISF_UART1_ReceiveBlock (component Serial_LDD)
239 */
240 /*!
241 ** @brief
242 ** Specifies the number of data to receive. The method returns
243 ** ERR_BUSY until the specified number of characters is
244 ** received. Method [CancelBlockReception] can be used to
245 ** cancel a running receive operation. If a receive operation
246 ** is not in progress (the method was not called or a previous
247 ** operation has already finished) all received characters will
248 ** be lost without any notification. To prevent the loss of
249 ** data call the method immediately after the last receive
250 ** operation has finished (e.g. from the [OnBlockReceived]
251 ** event). This method finishes immediately after calling it -
252 ** it doesn't wait the end of data reception. Use event
253 ** [OnBlockReceived] to check the end of data reception.
254 ** @param
255 ** DeviceDataPtr - Device data structure
256 ** pointer returned by [Init] method.
257 ** @param
258 ** BufferPtr - Pointer to a buffer where
259 ** received characters will be stored. In case
260 ** of 8bit character width each character in
261 ** buffer occupies 1 byte. In case of 9 and
262 ** more bit long character width each
263 ** character in buffer occupies 2 bytes.
264 ** @param
265 ** Size - Number of characters to receive
266 ** @return
267 ** - Error code, possible codes:
268 ** ERR_OK - OK
269 ** ERR_SPEED - The component does not work in
270 ** the active clock configuration.
271 ** ERR_PARAM_SIZE - Parameter Size is out of
272 ** expected range.
273 ** ERR_DISABLED - The component or device is
274 ** disabled.
275 ** ERR_BUSY - The previous receive request is
276 ** pending.
277 */
278 /* ===================================================================*/
279 LDD_TError Serial_ISF_UART1_ReceiveBlock(LDD_TDeviceData *DeviceDataPtr, LDD_TData *BufferPtr, uint16_t Size)
280 {
281 Serial_ISF_UART1_TDeviceDataPtr DeviceDataPrv = (Serial_ISF_UART1_TDeviceDataPtr)DeviceDataPtr;
282
283 if (Size == 0U) { /* Is the parameter Size within an expected range? */
284 return ERR_PARAM_SIZE; /* If no then error */
285 }
286 if (DeviceDataPrv->InpDataNumReq != 0x00U) { /* Is the previous receive operation pending? */
287 return ERR_BUSY; /* If yes then error */
288 }
289 /* {MQXLite RTOS Adapter} Critical section begin (RTOS function call is defined by MQXLite RTOS Adapter property) */
290 _int_disable();
291 DeviceDataPrv->InpDataPtr = (uint8_t*)BufferPtr; /* Store a pointer to the input data. */
292 DeviceDataPrv->InpDataNumReq = Size; /* Store a number of characters to be received. */
293 DeviceDataPrv->InpRecvDataNum = 0x00U; /* Set number of received characters to zero. */
294 /* {MQXLite RTOS Adapter} Critical section ends (RTOS function call is defined by MQXLite RTOS Adapter property) */
295 _int_enable();
296 return ERR_OK; /* OK */
297 }
298
299 /*
300 ** ===================================================================
301 ** Method : Serial_ISF_UART1_SendBlock (component Serial_LDD)
302 */
303 /*!
304 ** @brief
305 ** Sends a block of characters. The method returns ERR_BUSY
306 ** when the previous block transmission is not completed.
307 ** Method [CancelBlockTransmission] can be used to cancel a
308 ** transmit operation. This method is available only if the
309 ** transmitter property is enabled. This method finishes
310 ** immediately after calling it - it doesn't wait the end of
311 ** data transmission. Use event [OnBlockSent] to check the end
312 ** of data transmission.
313 ** @param
314 ** DeviceDataPtr - Device data structure
315 ** pointer returned by [Init] method.
316 ** @param
317 ** BufferPtr - Pointer to a buffer from where
318 ** data will be sent. In case of 8bit
319 ** character width each character in buffer
320 ** occupies 1 byte. In case of 9 and more bit
321 ** long character width each character in
322 ** buffer occupies 2 bytes.
323 ** @param
324 ** Size - Number of characters in the buffer.
325 ** @return
326 ** - Error code, possible codes:
327 ** ERR_OK - OK
328 ** ERR_SPEED - The component does not work in
329 ** the active clock configuration.
330 ** ERR_PARAM_SIZE - Parameter Size is out of
331 ** expected range.
332 ** ERR_DISABLED - The component or device is
333 ** disabled.
334 ** ERR_BUSY - The previous transmit request is
335 ** pending.
336 */
337 /* ===================================================================*/
338 LDD_TError Serial_ISF_UART1_SendBlock(LDD_TDeviceData *DeviceDataPtr, LDD_TData *BufferPtr, uint16_t Size)
339 {
340 Serial_ISF_UART1_TDeviceDataPtr DeviceDataPrv = (Serial_ISF_UART1_TDeviceDataPtr)DeviceDataPtr;
341
342 if (Size == 0U) { /* Is the parameter Size within an expected range? */
343 return ERR_PARAM_SIZE; /* If no then error */
344 }
345 if (DeviceDataPrv->OutDataNumReq != 0x00U) { /* Is the previous transmit operation pending? */
346 return ERR_BUSY; /* If yes then error */
347 }
348 /* {MQXLite RTOS Adapter} Critical section begin (RTOS function call is defined by MQXLite RTOS Adapter property) */
349 _int_disable();
350 DeviceDataPrv->OutDataPtr = (uint8_t*)BufferPtr; /* Set a pointer to the output data. */
351 DeviceDataPrv->OutDataNumReq = Size; /* Set the counter of characters to be sent. */
352 DeviceDataPrv->OutSentDataNum = 0x00U; /* Clear the counter of sent characters. */
353 DeviceDataPrv->SerFlag |= ENABLED_TX_INT; /* Set the flag ENABLED_TX_INT */
354 UART_PDD_EnableInterrupt(UART0_BASE_PTR, UART_PDD_INTERRUPT_TRANSMITTER); /* Enable TX interrupt */
355 /* {MQXLite RTOS Adapter} Critical section ends (RTOS function call is defined by MQXLite RTOS Adapter property) */
356 _int_enable();
357 return ERR_OK; /* OK */
358 }
359
360 /*
361 ** ===================================================================
362 ** Method : InterruptRx (component Serial_LDD)
363 **
364 ** Description :
365 ** The method services the receive interrupt of the selected
366 ** peripheral(s) and eventually invokes the bean's event(s).
367 ** This method is internal. It is used by Processor Expert only.
368 ** ===================================================================
369 */
370 static void InterruptRx(Serial_ISF_UART1_TDeviceDataPtr DeviceDataPrv)
371 {
372 register uint16_t Data; /* Temporary variable for data */
373
374 Data = (uint16_t)UART_PDD_GetChar8(UART0_BASE_PTR); /* Read an 8-bit character from the receiver */
375 if (DeviceDataPrv->InpDataNumReq != 0x00U) { /* Is the receive block operation pending? */
376 *(DeviceDataPrv->InpDataPtr++) = (uint8_t)Data; /* Put an 8-bit character to the receive buffer */
377 DeviceDataPrv->InpRecvDataNum++; /* Increment received char. counter */
378 if (DeviceDataPrv->InpRecvDataNum == DeviceDataPrv->InpDataNumReq) { /* Is the requested number of characters received? */
379 DeviceDataPrv->InpDataNumReq = 0x00U; /* If yes then clear number of requested characters to be received. */
380 Serial_ISF_UART1_OnBlockReceived(DeviceDataPrv->UserDataPtr);
381 }
382 }
383 }
384
385 /*
386 ** ===================================================================
387 ** Method : InterruptTx (component Serial_LDD)
388 **
389 ** Description :
390 ** The method services the receive interrupt of the selected
391 ** peripheral(s) and eventually invokes the bean's event(s).
392 ** This method is internal. It is used by Processor Expert only.
393 ** ===================================================================
394 */
395 static void InterruptTx(Serial_ISF_UART1_TDeviceDataPtr DeviceDataPrv)
396 {
397
398 if (DeviceDataPrv->OutSentDataNum < DeviceDataPrv->OutDataNumReq) { /* Is number of sent characters less than the number of requested incoming characters? */
399 UART_PDD_PutChar8(UART0_BASE_PTR, *(DeviceDataPrv->OutDataPtr++)); /* Put a 8-bit character to the transmit register */
400 DeviceDataPrv->OutSentDataNum++; /* Increment the counter of sent characters. */
401 if (DeviceDataPrv->OutSentDataNum == DeviceDataPrv->OutDataNumReq) {
402 DeviceDataPrv->OutDataNumReq = 0x00U; /* Clear the counter of characters to be send by SendBlock() */
403 Serial_ISF_UART1_OnBlockSent(DeviceDataPrv->UserDataPtr);
404 }
405 } else {
406 UART_PDD_DisableInterrupt(UART0_BASE_PTR, UART_PDD_INTERRUPT_TRANSMITTER); /* Disable TX interrupt */
407 DeviceDataPrv->SerFlag &= (uint16_t)(~(uint16_t)ENABLED_TX_INT); /* Clear the flag ENABLED_TX_INT */
408 }
409 }
410
411 /*
412 ** ===================================================================
413 ** Method : Serial_ISF_UART1_Interrupt (component Serial_LDD)
414 **
415 ** Description :
416 ** The ISR function handling the device receive/transmit
417 ** interrupt. Calls InterruptTX/InterruptRX methods.
418 ** This method is internal. It is used by Processor Expert only.
419 ** ===================================================================
420 */
421 void Serial_ISF_UART1_Interrupt(LDD_RTOS_TISRParameter _isrParameter)
422 {
423 /* {MQXLite RTOS Adapter} ISR parameter is passed as parameter from RTOS interrupt dispatcher */
424 Serial_ISF_UART1_TDeviceDataPtr DeviceDataPrv = (Serial_ISF_UART1_TDeviceDataPtr)_isrParameter;
425 register uint32_t StatReg = UART_PDD_ReadInterruptStatusReg(UART0_BASE_PTR); /* Read status register */
426
427 if (StatReg & (UART_S1_NF_MASK | UART_S1_OR_MASK | UART_S1_FE_MASK | UART_S1_PF_MASK)) { /* Is any error flag set? */
428 (void)UART_PDD_GetChar8(UART0_BASE_PTR); /* Dummy read 8-bit character from receiver */
429 StatReg &= (uint32_t)(~(uint32_t)UART_S1_RDRF_MASK); /* Clear the receive data flag to discard the errorneous data */
430 }
431 if (StatReg & UART_S1_RDRF_MASK) { /* Is the receiver's interrupt flag set? */
432 InterruptRx(DeviceDataPrv); /* If yes, then invoke the internal service routine. This routine is inlined. */
433 }
434 if (DeviceDataPrv->SerFlag & ENABLED_TX_INT) { /* Is the transmitter interrupt enabled? */
435 if (StatReg & UART_S1_TDRE_MASK) { /* Is the transmitter empty? */
436 InterruptTx(DeviceDataPrv); /* If yes, then invoke the internal service routine. This routine is inlined. */
437 }
438 }
439 }
440
441 /*lint -restore Enable MISRA rule (11.4,12.8) checking. */
442 /* END Serial_ISF_UART1. */
443
444 #ifdef __cplusplus
445 } /* extern "C" */
446 #endif
447
448 /*!
449 ** @}
450 */
451 /*
452 ** ###################################################################
453 **
454 ** This file was created by Processor Expert 10.3 [05.09]
455 ** for the Freescale Kinetis series of microcontrollers.
456 **
457 ** ###################################################################
458 */
Serial_ISF_UART1_TDeviceData::InpDataPtr
uint8_t * InpDataPtr
Definition: Serial_ISF_UART1.h:152
Serial_ISF_UART1_TDeviceData::OutSentDataNum
uint16_t OutSentDataNum
Definition: Serial_ISF_UART1.h:154
Serial_ISF_UART1_SendBlock
LDD_TError Serial_ISF_UART1_SendBlock(LDD_TDeviceData *DeviceDataPtr, LDD_TData *BufferPtr, uint16_t Size)
Sends a block of characters. The method returns ERR_BUSY when the previous block transmission is not ...
Definition: Serial_ISF_UART1.c:338
ENABLED_TX_INT
#define ENABLED_TX_INT
Definition: Serial_ISF_UART1.h:143
Serial_ISF_UART1_TDeviceData::OutDataNumReq
uint16_t OutDataNumReq
Definition: Serial_ISF_UART1.h:156
Serial_ISF_UART1_Init
LDD_TDeviceData * Serial_ISF_UART1_Init(LDD_TUserData *UserDataPtr)
Initializes the device. Allocates memory for the device data structure, allocates interrupt vectors a...
Definition: Serial_ISF_UART1.c:160
Serial_ISF_UART1_TDeviceDataPtr
Serial_ISF_UART1_TDeviceData * Serial_ISF_UART1_TDeviceDataPtr
Definition: Serial_ISF_UART1.h:161
Serial_ISF_UART1_ReceiveBlock
LDD_TError Serial_ISF_UART1_ReceiveBlock(LDD_TDeviceData *DeviceDataPtr, LDD_TData *BufferPtr, uint16_t Size)
Specifies the number of data to receive. The method returns ERR_BUSY until the specified number of ch...
Definition: Serial_ISF_UART1.c:279
Serial_ISF_UART1.h
This component "Serial_LDD" implements an asynchronous serial communication. The component supports d...
Serial_ISF_UART1_TDeviceData::SavedISRSettings
LDD_RTOS_TISRVectorSettings SavedISRSettings
Definition: Serial_ISF_UART1.h:157
Serial_ISF_UART1_TDeviceData::OutDataPtr
uint8_t * OutDataPtr
Definition: Serial_ISF_UART1.h:155
Serial_ISF_UART1_TDeviceData::SerFlag
uint16_t SerFlag
Definition: Serial_ISF_UART1.h:150
Serial_ISF_UART1_OnBlockSent
void Serial_ISF_UART1_OnBlockSent(LDD_TUserData *UserDataPtr)
Definition: UART_CH1.c:47
Serial_ISF_UART1_TDeviceData
Definition: Serial_ISF_UART1.h:149
Serial_ISF_UART1_TDeviceData::InpDataNumReq
uint16_t InpDataNumReq
Definition: Serial_ISF_UART1.h:153
Serial_ISF_UART1_Interrupt
void Serial_ISF_UART1_Interrupt(LDD_RTOS_TISRParameter _isrParameter)
Definition: Serial_ISF_UART1.c:421
Serial_ISF_UART1_TDeviceData::InpRecvDataNum
uint16_t InpRecvDataNum
Definition: Serial_ISF_UART1.h:151
Serial_ISF_UART1_TDeviceData::UserDataPtr
LDD_TUserData * UserDataPtr
Definition: Serial_ISF_UART1.h:158
UART_CH1.h
Serial_ISF_UART1_OnBlockReceived
void Serial_ISF_UART1_OnBlockReceived(LDD_TUserData *UserDataPtr)
Definition: UART_CH1.c:62
- © Freescale Semiconductor, Inc. 2015. All Rights Reserved.