Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 3 5 6 int kprint(char * Emt, ...); int uprint(char *Emt, ...); #define UDR 0x00 #define UDS 0304 #define UFR 0x18 #define CNTL 0x2C

1 3 5 6 int kprint(char * Emt, ...); int uprint(char *Emt, ...); #define UDR 0x00 #define UDS 0304 #define UFR 0x18 #define CNTL 0x2C #define IMSC 0x28 #define MIS 0x40 #define SBUFSIZE 128 typedef volatile struct uart{ char *base; // base address; as char * un n // uart number 0-3 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 char inbu (SBUFSIZE): int indata, inroom, inhead, intail; char outbuf (SBUFSIZE); int outdata, outroom, outhead, outtail; int txon; // 1=TX interrupt is on HUART; UART uart[4); // 4 Urt structures volatile int sline = 0; 23 24 25 26 27 int uart_init() int i; UARI *up: kprintf(\"UART init \"); for (i=0; base = (char*) (0x1011000 + 1*0x1000); 20 31 32 33 34 35 36 37 38 39 *(up->base+0x2C) G= -010; * (up->base+03) = 0x20; up->n = i; up->indata = up->inhead = up->intail = 0; up->inroom = SBUFSIZE; 40 41 42 up->outdata = up->outhead = up->outtail = 0; up->outroom = SBUFSIZE up->txon = 0; } } uart [3] .base = (char *) (0x10009000); // uart3 at Ox10009000 45 47 } void uart_handler (UART *up) 49 50 51 52 53 54 55 56 57 50 59 60 61 62 62 64 65 66 67 u mis; mis = *(up->base+MIS) ; if (mis & Ox10) { do_Ix (up); } if (mis & 0x20) do_ta (up); } - 3 int do_IX (UART *up) char c: color = GREEN; C=* (up->base+UDR); if (c!='') kprintf(\"Ix interrupt: fc \", c); 69 70 71 72 up->inbuf[up->inhead++] = c; up->inhead t= SBUFSIZE up->indata++; up->inroom--; 72 74 75 76 77 78 79 if (c=='') sline++; color=RED; -1 } 80 81 82 int do_tx (UART *up) char c; u mask; tprintf(\"IX interrupt: *); 85 86 if (up->outdata c= 0){ // disable TX interrupt; return *(up->base+IMSC) = 0x10; // mask out tx interrupt up->txon = 0; return; } c = up->inbuf[up->outtail++]; up->outtail t= SBUFSIZE; * (up->base+UDR) = (int); up->outdata- up->outroom++; kprintf(\"%c \", c); . 3 BB 89 90 91 92 92 94 95 96 97 98 99 100 101 102 102 104 105 106 107 100 109 110 111 112 113 114 115 116 117 118 119 120 int ugetc (UART *up) { char c; int SR; while (up->indata ( 0); c = up->inbuf[up->intail++]; up->intail - SBUFSIZE; up->indata--, up->inroom++; return; LE int uuputc (UART *up, char c) { *(up->base+UDR) = (int); *(up->base+IMSC) = 0x20;;>

The following code is part of the device driver for UART.

1. From the function \"uart_handler\", the flag bit for transmitter interrupt (TX) is on bit [a]________ (write down a single decimal digit) on the status register MIS.

2. After the main function runs uart_init(), the variable \"inroom\" will be initialized to [a]________ (write down a 3-digit integer) that indicates full capacity of the input buffer.

3. Suppose there was a single character coming in from a remote PC, the variable \"txon\" would become [a]________ (write down a 1-digit integer).

4. Line 33 tells us that the base address of UART0 is [a]0x ________. (Write down an eight-digit hexadecimal number.)

5. From the function \"uart_handler\", the flag bit for receiver interrupt (RX) is on bit [a]________ (write down a single decimal digit) on the status register MIS.

6. Suppose there was a single character coming in from a remote PC, the variable \"inroom\" would become [a]________ (write down a 3-digit integer).

7. Suppose there was a single character coming in from a remote PC. In the UART hardware, the data is in the register [a]________ (fill in one of the following: MIS, IMSC, UDR, UDS).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

Solve the equation. The letters a, b, and c are constants.

Answered: 1 week ago

Question

Is there any formal training for teaching?

Answered: 1 week ago