]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo_bsp/ps7_cortexa9_0/libsrc/uartps_v2_1/src/xuartps.c
7393308ed359fd99c147fdbde4d2ff5942487e0c
[freertos] / FreeRTOS / Demo / CORTEX_A9_Zynq_ZC702 / RTOSDemo_bsp / ps7_cortexa9_0 / libsrc / uartps_v2_1 / src / xuartps.c
1 /******************************************************************************
2 *
3 * Copyright (C) 2010 - 2014 Xilinx, Inc.  All rights reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * Use of the Software is limited solely to applications:
16 * (a) running on a Xilinx device, or
17 * (b) that interact with a Xilinx device through a bus or interconnect.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * XILINX  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * SOFTWARE.
26 *
27 * Except as contained in this notice, the name of the Xilinx shall not be used
28 * in advertising or otherwise to promote the sale, use or other dealings in
29 * this Software without prior written authorization from Xilinx.
30 *
31 ******************************************************************************/
32 /****************************************************************************/
33 /**
34 *
35 * @file xuartps.c
36 * @addtogroup uartps_v2_1
37 * @{
38 *
39 * This file contains the implementation of the interface functions for XUartPs
40 * driver. Refer to the header file xuartps.h for more detailed information.
41 *
42 * <pre>
43 * MODIFICATION HISTORY:
44 *
45 * Ver   Who    Date      Changes
46 * ----- ------ -------- ----------------------------------------------
47 * 1.00  drg/jz 01/13/10 First Release
48 * </pre>
49 *
50 *****************************************************************************/
51
52 /***************************** Include Files ********************************/
53
54 #include "xstatus.h"
55 #include "xuartps.h"
56 #include "xil_io.h"
57
58 /************************** Constant Definitions ****************************/
59
60 /* The following constant defines the amount of error that is allowed for
61  * a specified baud rate. This error is the difference between the actual
62  * baud rate that will be generated using the specified clock and the
63  * desired baud rate.
64  */
65 #define XUARTPS_MAX_BAUD_ERROR_RATE              3      /* max % error allowed */
66
67 /**************************** Type Definitions ******************************/
68
69
70 /***************** Macros (Inline Functions) Definitions ********************/
71
72
73 /************************** Function Prototypes *****************************/
74
75 static void XUartPs_StubHandler(void *CallBackRef, u32 Event,
76                                  unsigned int ByteCount);
77
78 unsigned int XUartPs_SendBuffer(XUartPs *InstancePtr);
79
80 unsigned int XUartPs_ReceiveBuffer(XUartPs *InstancePtr);
81
82 /************************** Variable Definitions ****************************/
83
84 /****************************************************************************/
85 /**
86 *
87 * Initializes a specific XUartPs instance such that it is ready to be used.
88 * The data format of the device is setup for 8 data bits, 1 stop bit, and no
89 * parity by default. The baud rate is set to a default value specified by
90 * Config->DefaultBaudRate if set, otherwise it is set to 19.2K baud. The
91 * receive FIFO threshold is set for 8 bytes. The default operating mode of the
92 * driver is polled mode.
93 *
94 * @param        InstancePtr is a pointer to the XUartPs instance.
95 * @param        Config is a reference to a structure containing information
96 *               about a specific XUartPs driver.
97 * @param        EffectiveAddr is the device base address in the virtual memory
98 *               address space. The caller is responsible for keeping the address
99 *               mapping from EffectiveAddr to the device physical base address
100 *               unchanged once this function is invoked. Unexpected errors may
101 *               occur if the address mapping changes after this function is
102 *               called. If address translation is not used, pass in the physical
103 *               address instead.
104 *
105 * @return
106 *
107 *               - XST_SUCCESS if initialization was successful
108 *               - XST_UART_BAUD_ERROR if the baud rate is not possible because
109 *                 the inputclock frequency is not divisible with an acceptable
110 *                 amount of error
111 *
112 * @note
113 *
114 * The default configuration for the UART after initialization is:
115 *
116 * - 19,200 bps or XPAR_DFT_BAUDRATE if defined
117 * - 8 data bits
118 * - 1 stop bit
119 * - no parity
120 * - FIFO's are enabled with a receive threshold of 8 bytes
121 * - The RX timeout is enabled with a timeout of 1 (4 char times)
122 *
123 *   All interrupts are disabled.
124 *
125 *****************************************************************************/
126 int XUartPs_CfgInitialize(XUartPs *InstancePtr,
127                                    XUartPs_Config * Config, u32 EffectiveAddr)
128 {
129         int Status;
130         u32 ModeRegister;
131         u32 BaudRate;
132
133         /*
134          * Assert validates the input arguments
135          */
136         Xil_AssertNonvoid(InstancePtr != NULL);
137         Xil_AssertNonvoid(Config != NULL);
138
139         /*
140          * Setup the driver instance using passed in parameters
141          */
142         InstancePtr->Config.BaseAddress = EffectiveAddr;
143         InstancePtr->Config.InputClockHz = Config->InputClockHz;
144         InstancePtr->Config.ModemPinsConnected = Config->ModemPinsConnected;
145
146         /*
147          * Initialize other instance data to default values
148          */
149         InstancePtr->Handler = XUartPs_StubHandler;
150
151         InstancePtr->SendBuffer.NextBytePtr = NULL;
152         InstancePtr->SendBuffer.RemainingBytes = 0;
153         InstancePtr->SendBuffer.RequestedBytes = 0;
154
155         InstancePtr->ReceiveBuffer.NextBytePtr = NULL;
156         InstancePtr->ReceiveBuffer.RemainingBytes = 0;
157         InstancePtr->ReceiveBuffer.RequestedBytes = 0;
158
159         /*
160          * Flag that the driver instance is ready to use
161          */
162         InstancePtr->IsReady = XIL_COMPONENT_IS_READY;
163
164         /*
165          * Set the default baud rate here, can be changed prior to
166          * starting the device
167          */
168         BaudRate = XUARTPS_DFT_BAUDRATE;
169         Status = XUartPs_SetBaudRate(InstancePtr, BaudRate);
170         if (Status != XST_SUCCESS) {
171                 InstancePtr->IsReady = 0;
172                 return Status;
173         }
174
175         /*
176          * Set up the default data format: 8 bit data, 1 stop bit, no
177          * parity
178          */
179         ModeRegister = XUartPs_ReadReg(InstancePtr->Config.BaseAddress,
180                                   XUARTPS_MR_OFFSET);
181
182         /*
183          * Mask off what's already there
184          */
185         ModeRegister &= ~(XUARTPS_MR_CHARLEN_MASK |
186                                          XUARTPS_MR_STOPMODE_MASK |
187                                          XUARTPS_MR_PARITY_MASK);
188
189         /*
190          * Set the register value to the desired data format
191          */
192         ModeRegister |= (XUARTPS_MR_CHARLEN_8_BIT |
193                                         XUARTPS_MR_STOPMODE_1_BIT |
194                                         XUARTPS_MR_PARITY_NONE);
195
196         /*
197          * Write the mode register out
198          */
199         XUartPs_WriteReg(InstancePtr->Config.BaseAddress, XUARTPS_MR_OFFSET,
200                            ModeRegister);
201
202         /*
203          * Set the RX FIFO trigger at 8 data bytes.
204          */
205         XUartPs_WriteReg(InstancePtr->Config.BaseAddress,
206                            XUARTPS_RXWM_OFFSET, 0x08);
207
208         /*
209          * Set the RX timeout to 1, which will be 4 character time
210          */
211         XUartPs_WriteReg(InstancePtr->Config.BaseAddress,
212                            XUARTPS_RXTOUT_OFFSET, 0x01);
213
214         /*
215          * Disable all interrupts, polled mode is the default
216          */
217         XUartPs_WriteReg(InstancePtr->Config.BaseAddress, XUARTPS_IDR_OFFSET,
218                            XUARTPS_IXR_MASK);
219
220         return XST_SUCCESS;
221 }
222
223 /****************************************************************************/
224 /**
225 *
226 * This functions sends the specified buffer using the device in either
227 * polled or interrupt driven mode. This function is non-blocking, if the device
228 * is busy sending data, it will return and indicate zero bytes were sent.
229 * Otherwise, it fills the TX FIFO as much as it can, and return the number of
230 * bytes sent.
231 *
232 * In a polled mode, this function will only send as much data as TX FIFO can
233 * buffer. The application may need to call it repeatedly to send the entire
234 * buffer.
235 *
236 * In interrupt mode, this function will start sending the specified buffer,
237 * then the interrupt handler will continue sending data until the entire
238 * buffer has been sent. A callback function, as specified by the application,
239 * will be called to indicate the completion of sending.
240 *
241 * @param        InstancePtr is a pointer to the XUartPs instance.
242 * @param        BufferPtr is pointer to a buffer of data to be sent.
243 * @param        NumBytes contains the number of bytes to be sent. A value of
244 *               zero will stop a previous send operation that is in progress
245 *               in interrupt mode. Any data that was already put into the
246 *               transmit FIFO will be sent.
247 *
248 * @return       The number of bytes actually sent.
249 *
250 * @note
251 *
252 * The number of bytes is not asserted so that this function may be called with
253 * a value of zero to stop an operation that is already in progress.
254 * <br><br>
255 *
256 *****************************************************************************/
257 unsigned int XUartPs_Send(XUartPs *InstancePtr, u8 *BufferPtr,
258                            unsigned int NumBytes)
259 {
260         unsigned int BytesSent;
261
262         /*
263          * Asserts validate the input arguments
264          */
265         Xil_AssertNonvoid(InstancePtr != NULL);
266         Xil_AssertNonvoid(BufferPtr != NULL);
267         Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
268
269         /*
270          * Disable the UART transmit interrupts to allow this call to stop a
271          * previous operation that may be interrupt driven.
272          */
273         XUartPs_WriteReg(InstancePtr->Config.BaseAddress, XUARTPS_IDR_OFFSET,
274                                           (XUARTPS_IXR_TXEMPTY | XUARTPS_IXR_TXFULL));
275
276         /*
277          * Setup the buffer parameters
278          */
279         InstancePtr->SendBuffer.RequestedBytes = NumBytes;
280         InstancePtr->SendBuffer.RemainingBytes = NumBytes;
281         InstancePtr->SendBuffer.NextBytePtr = BufferPtr;
282
283         /*
284          * Transmit interrupts will be enabled in XUartPs_SendBuffer(), after
285          * filling the TX FIFO.
286          */
287         BytesSent = XUartPs_SendBuffer(InstancePtr);
288
289         return BytesSent;
290 }
291
292 /****************************************************************************/
293 /**
294 *
295 * This function attempts to receive a specified number of bytes of data
296 * from the device and store it into the specified buffer. This function works
297 * for both polled or interrupt driven modes. It is non-blocking.
298 *
299 * In a polled mode, this function will only receive the data already in the
300 * RX FIFO. The application may need to call it repeatedly to receive the
301 * entire buffer. Polled mode is the default mode of operation for the device.
302 *
303 * In interrupt mode, this function will start the receiving, if not the entire
304 * buffer has been received, the interrupt handler will continue receiving data
305 * until the entire buffer has been received. A callback function, as specified
306 * by the application, will be called to indicate the completion of the
307 * receiving or error conditions.
308 *
309 * @param        InstancePtr is a pointer to the XUartPs instance
310 * @param        BufferPtr is pointer to buffer for data to be received into
311 * @param        NumBytes is the number of bytes to be received. A value of zero
312 *               will stop a previous receive operation that is in progress in
313 *               interrupt mode.
314 *
315 * @return       The number of bytes received.
316 *
317 * @note
318 *
319 * The number of bytes is not asserted so that this function may be called
320 * with a value of zero to stop an operation that is already in progress.
321 *
322 *****************************************************************************/
323 unsigned int XUartPs_Recv(XUartPs *InstancePtr,
324                            u8 *BufferPtr, unsigned int NumBytes)
325 {
326         unsigned int ReceivedCount;
327         u32 ImrRegister;
328
329         /*
330          * Assert validates the input arguments
331          */
332         Xil_AssertNonvoid(InstancePtr != NULL);
333         Xil_AssertNonvoid(BufferPtr != NULL);
334         Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
335
336         /*
337          * Disable all the interrupts.
338          * This stops a previous operation that may be interrupt driven
339          */
340         ImrRegister = XUartPs_ReadReg(InstancePtr->Config.BaseAddress,
341                                   XUARTPS_IMR_OFFSET);
342         XUartPs_WriteReg(InstancePtr->Config.BaseAddress, XUARTPS_IDR_OFFSET,
343                 XUARTPS_IXR_MASK);
344
345         /*
346          * Setup the buffer parameters
347          */
348         InstancePtr->ReceiveBuffer.RequestedBytes = NumBytes;
349         InstancePtr->ReceiveBuffer.RemainingBytes = NumBytes;
350         InstancePtr->ReceiveBuffer.NextBytePtr = BufferPtr;
351
352         /*
353          * Receive the data from the device
354          */
355         ReceivedCount = XUartPs_ReceiveBuffer(InstancePtr);
356
357         /*
358          * Restore the interrupt state
359          */
360         XUartPs_WriteReg(InstancePtr->Config.BaseAddress, XUARTPS_IER_OFFSET,
361                 ImrRegister);
362
363         return ReceivedCount;
364 }
365
366 /****************************************************************************/
367 /*
368 *
369 * This function sends a buffer that has been previously specified by setting
370 * up the instance variables of the instance. This function is an internal
371 * function for the XUartPs driver such that it may be called from a shell
372 * function that sets up the buffer or from an interrupt handler.
373 *
374 * This function sends the specified buffer in either polled or interrupt
375 * driven modes. This function is non-blocking.
376 *
377 * In a polled mode, this function only sends as much data as the TX FIFO
378 * can buffer. The application may need to call it repeatedly to send the
379 * entire buffer.
380 *
381 * In interrupt mode, this function starts the sending of the buffer, if not
382 * the entire buffer has been sent, then the interrupt handler continues the
383 * sending until the entire buffer has been sent. A callback function, as
384 * specified by the application, will be called to indicate the completion of
385 * sending.
386 *
387 * @param        InstancePtr is a pointer to the XUartPs instance
388 *
389 * @return       The number of bytes actually sent
390 *
391 * @note         None.
392 *
393 *****************************************************************************/
394 unsigned int XUartPs_SendBuffer(XUartPs *InstancePtr)
395 {
396         unsigned int SentCount = 0;
397         u32 ImrRegister;
398
399         /*
400          * If the TX FIFO is full, send nothing.
401          * Otherwise put bytes into the TX FIFO unil it is full, or all of the
402          * data has been put into the FIFO.
403          */
404         while ((!XUartPs_IsTransmitFull(InstancePtr->Config.BaseAddress)) &&
405                    (InstancePtr->SendBuffer.RemainingBytes > SentCount)) {
406
407                 /*
408                  * Fill the FIFO from the buffer
409                  */
410                 XUartPs_WriteReg(InstancePtr->Config.BaseAddress,
411                                    XUARTPS_FIFO_OFFSET,
412                                    InstancePtr->SendBuffer.
413                                    NextBytePtr[SentCount]);
414
415                 /*
416                  * Incriment the send count.
417                  */
418                 SentCount++;
419         }
420
421         /*
422          * Update the buffer to reflect the bytes that were sent from it
423          */
424         InstancePtr->SendBuffer.NextBytePtr += SentCount;
425         InstancePtr->SendBuffer.RemainingBytes -= SentCount;
426
427         /*
428          * If interrupts are enabled as indicated by the receive interrupt, then
429          * enable the TX FIFO empty interrupt, so further action can be taken
430          * for this sending.
431          */
432         ImrRegister =
433                 XUartPs_ReadReg(InstancePtr->Config.BaseAddress,
434                                   XUARTPS_IMR_OFFSET);
435         if ((ImrRegister & XUARTPS_IXR_RXFULL) ||
436                 (ImrRegister & XUARTPS_IXR_RXEMPTY) ||
437                 (ImrRegister & XUARTPS_IXR_RXOVR)) {
438
439         XUartPs_WriteReg(InstancePtr->Config.BaseAddress,
440                                    XUARTPS_IER_OFFSET,
441                                    ImrRegister | XUARTPS_IXR_TXEMPTY);
442         }
443
444         return SentCount;
445 }
446
447 /****************************************************************************/
448 /*
449 *
450 * This function receives a buffer that has been previously specified by setting
451 * up the instance variables of the instance. This function is an internal
452 * function, and it may be called from a shell function that sets up the buffer
453 * or from an interrupt handler.
454 *
455 * This function attempts to receive a specified number of bytes from the
456 * device and store it into the specified buffer. This function works for
457 * either polled or interrupt driven modes. It is non-blocking.
458 *
459 * In polled mode, this function only receives as much data as in the RX FIFO.
460 * The application may need to call it repeatedly to receive the entire buffer.
461 * Polled mode is the default mode for the driver.
462 *
463 * In interrupt mode, this function starts the receiving, if not the entire
464 * buffer has been received, the interrupt handler will continue until the
465 * entire buffer has been received. A callback function, as specified by the
466 * application, will be called to indicate the completion of the receiving or
467 * error conditions.
468 *
469 * @param        InstancePtr is a pointer to the XUartPs instance
470 *
471 * @return       The number of bytes received.
472 *
473 * @note         None.
474 *
475 *****************************************************************************/
476 unsigned int XUartPs_ReceiveBuffer(XUartPs *InstancePtr)
477 {
478         u32 CsrRegister;
479         unsigned int ReceivedCount = 0;
480
481         /*
482          * Read the Channel Status Register to determine if there is any data in
483          * the RX FIFO
484          */
485         CsrRegister = XUartPs_ReadReg(InstancePtr->Config.BaseAddress,
486                                 XUARTPS_SR_OFFSET);
487
488         /*
489          * Loop until there is no more data in RX FIFO or the specified
490          * number of bytes has been received
491          */
492         while((ReceivedCount < InstancePtr->ReceiveBuffer.RemainingBytes)&&
493                 (0 == (CsrRegister & XUARTPS_SR_RXEMPTY))){
494
495                 InstancePtr->ReceiveBuffer.NextBytePtr[ReceivedCount] =
496                         XUartPs_ReadReg(InstancePtr->Config.
497                                   BaseAddress,
498                                   XUARTPS_FIFO_OFFSET);
499
500                 ReceivedCount++;
501
502                 CsrRegister = XUartPs_ReadReg(InstancePtr->Config.BaseAddress,
503                                                                 XUARTPS_SR_OFFSET);
504         }
505
506         /*
507          * Update the receive buffer to reflect the number of bytes just
508          * received
509          */
510         InstancePtr->ReceiveBuffer.NextBytePtr += ReceivedCount;
511         InstancePtr->ReceiveBuffer.RemainingBytes -= ReceivedCount;
512
513         return ReceivedCount;
514 }
515
516 /*****************************************************************************/
517 /**
518 *
519 * Sets the baud rate for the device. Checks the input value for
520 * validity and also verifies that the requested rate can be configured to
521 * within the maximum error range specified by XUARTPS_MAX_BAUD_ERROR_RATE.
522 * If the provided rate is not possible, the current setting is unchanged.
523 *
524 * @param        InstancePtr is a pointer to the XUartPs instance
525 * @param        BaudRate to be set
526 *
527 * @return
528 *               - XST_SUCCESS if everything configured as expected
529 *               - XST_UART_BAUD_ERROR if the requested rate is not available
530 *                 because there was too much error
531 *
532 * @note         None.
533 *
534 *****************************************************************************/
535 int XUartPs_SetBaudRate(XUartPs *InstancePtr, u32 BaudRate)
536 {
537         u8 IterBAUDDIV;         /* Iterator for available baud divisor values */
538         u32 BRGR_Value;         /* Calculated value for baud rate generator */
539         u32 CalcBaudRate;       /* Calculated baud rate */
540         u32 BaudError;          /* Diff between calculated and requested baud rate */
541         u32 Best_BRGR = 0;      /* Best value for baud rate generator */
542         u8 Best_BAUDDIV = 0;    /* Best value for baud divisor */
543         u32 Best_Error = 0xFFFFFFFF;
544         u32 PercentError;
545         u32 ModeReg;
546         u32 InputClk;
547
548         /*
549          * Asserts validate the input arguments
550          */
551         Xil_AssertNonvoid(InstancePtr != NULL);
552         Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
553         Xil_AssertNonvoid(BaudRate <= XUARTPS_MAX_RATE);
554         Xil_AssertNonvoid(BaudRate >= XUARTPS_MIN_RATE);
555
556         /*
557          * Make sure the baud rate is not impossilby large.
558          * Fastest possible baud rate is Input Clock / 2.
559          */
560         if ((BaudRate * 2) > InstancePtr->Config.InputClockHz) {
561                 return XST_UART_BAUD_ERROR;
562         }
563         /*
564          * Check whether the input clock is divided by 8
565          */
566         ModeReg = XUartPs_ReadReg( InstancePtr->Config.BaseAddress,
567                                  XUARTPS_MR_OFFSET);
568
569         InputClk = InstancePtr->Config.InputClockHz;
570         if(ModeReg & XUARTPS_MR_CLKSEL) {
571                 InputClk = InstancePtr->Config.InputClockHz / 8;
572         }
573
574         /*
575          * Determine the Baud divider. It can be 4to 254.
576          * Loop through all possible combinations
577          */
578         for (IterBAUDDIV = 4; IterBAUDDIV < 255; IterBAUDDIV++) {
579
580                 /*
581                  * Calculate the value for BRGR register
582                  */
583                 BRGR_Value = InputClk / (BaudRate * (IterBAUDDIV + 1));
584
585                 /*
586                  * Calculate the baud rate from the BRGR value
587                  */
588                 CalcBaudRate = InputClk/ (BRGR_Value * (IterBAUDDIV + 1));
589
590                 /*
591                  * Avoid unsigned integer underflow
592                  */
593                 if (BaudRate > CalcBaudRate) {
594                         BaudError = BaudRate - CalcBaudRate;
595                 }
596                 else {
597                         BaudError = CalcBaudRate - BaudRate;
598                 }
599
600                 /*
601                  * Find the calculated baud rate closest to requested baud rate.
602                  */
603                 if (Best_Error > BaudError) {
604
605                         Best_BRGR = BRGR_Value;
606                         Best_BAUDDIV = IterBAUDDIV;
607                         Best_Error = BaudError;
608                 }
609         }
610
611         /*
612          * Make sure the best error is not too large.
613          */
614         PercentError = (Best_Error * 100) / BaudRate;
615         if (XUARTPS_MAX_BAUD_ERROR_RATE < PercentError) {
616                 return XST_UART_BAUD_ERROR;
617         }
618
619         /*
620          * Disable TX and RX to avoid glitches when setting the baud rate.
621          */
622         XUartPs_DisableUart(InstancePtr);
623
624         XUartPs_WriteReg(InstancePtr->Config.BaseAddress,
625                            XUARTPS_BAUDGEN_OFFSET, Best_BRGR);
626         XUartPs_WriteReg(InstancePtr->Config.BaseAddress,
627                            XUARTPS_BAUDDIV_OFFSET, Best_BAUDDIV);
628
629         /*
630          * Enable device
631          */
632         XUartPs_EnableUart(InstancePtr);
633
634         InstancePtr->BaudRate = BaudRate;
635
636         return XST_SUCCESS;
637
638 }
639
640 /****************************************************************************/
641 /**
642 *
643 * This function is a stub handler that is the default handler such that if the
644 * application has not set the handler when interrupts are enabled, this
645 * function will be called.
646 *
647 * @param        CallBackRef is unused by this function.
648 * @param        Event is unused by this function.
649 * @param        ByteCount is unused by this function.
650 *
651 * @return       None.
652 *
653 * @note         None.
654 *
655 *****************************************************************************/
656 static void XUartPs_StubHandler(void *CallBackRef, u32 Event,
657                                  unsigned int ByteCount)
658 {
659         (void) CallBackRef;
660         (void) Event;
661         (void) ByteCount;
662         /*
663          * Assert occurs always since this is a stub and should never be called
664          */
665         Xil_AssertVoidAlways();
666 }
667 /** @} */