Homework Reading Machine Projects Labs

Slides:



Advertisements
Similar presentations
Jim Chen ( 14/06/2011 Hytec Electronics Ltd.
Advertisements

8086 [2] Ahad. Internal! External? 8086 vs _bit Data Bus 20_bit Address 8_bit Data Bus 20_bit Address Only external bus of 8088 is.
1 Homework Reading –Intel 8254 Programmable Interval Timer (PIT) Data Sheet Machine Projects –Continue on MP3 Labs –Continue in labs with your assigned.
1 Homework Reading (linked from my web page) –S and S Extracts –National Semiconductor UART Data Sheet Machine Projects –mp2 due at start of class 12 Labs.
Microprocessor and Microcontroller
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 3: Input/output and co-processors dr.ir. A.C. Verschueren.
ECE 372 – Microcontroller Design Parallel IO Ports - Interrupts
1 Homework Reading –Review previous material on “interrupts” Machine Projects –MP4 Due today –Starting on MP5 (Due at start of Class 28) Labs –Continue.
Interrupts What is an interrupt? What does an interrupt do to the “flow of control” Interrupts used to overlap computation & I/O – Examples would be console.
Implementing interrupt driven IO. Why use interrupt driven IO? Positive points –Allows asynchronous operation of IO events –Good use of resources –Leads.
Network Adapter Driver NCTU High Speed Network Lab.
Communication Lab - Interrupts 1/13 Sequential Programming  Our C++ programs are sequential ( סדרתיים), they start at the first instruction and end at.
1 Homework Reading –PAL, pp , Machine Projects –Finish mp2warmup Questions? –Start mp2 as soon as possible Labs –Continue labs with your.
Homework / Exam Return and Review Exam #1 Reading Machine Projects
INPUT-OUTPUT ORGANIZATION
UNIT 8 Keypad Interface Contact Closure Counter Exceptions (Interrupts and Reset)
PIT: Programmable Interval Timer
Introduction to Embedded Systems Buffering and DMA (Direct Memory Access) Lecture 11.
Real-time Systems Lab, Computer Science and Engineering, ASU Linux Input Systems (ESP – Fall 2014) Computer Science & Engineering Department Arizona State.
Interrupts and DMA CSCI The Role of the Operating System in Performing I/O Two main jobs of a computer are: –Processing –Performing I/O manage and.
FINAL MPX DELIVERABLE Due when you schedule your interview and presentation.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Page 1 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen June 2003 N e v e r s t o p t h i n k i n g. Infineon C868 Hands On Training CAPCOM6.
Joe Blubaugh Diana Mui David Sutherland Matthew Swallow.
Ethernet Driver Changes for NET+OS V5.1. Design Changes Resides in bsp\devices\ethernet directory. Source code broken into more C files. Native driver.
CSNB374: Microprocessor Systems Chapter 5: Procedures and Interrupts.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
PPI-8255.
This material exempt per Department of Commerce license exception TSU Architecture Wizard and PACE Lab 2 Introduction.
7. IRQ and PIC ENGI 3655 Lab Sessions. Richard Khoury2 Textbook Readings  Interrupts ◦ Section
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Transmitter Interrupts Review of Receiver Interrupts How to Handle Transmitter Interrupts? Critical Regions Text: Tanenbaum
Tiva C TM4C123GH6PM UART Embedded Systems ECE 4437 Fall 2015 Team 2:
Application Case Study Christmas Lights Controller
Chip Config & Drivers – Required Drivers:
The HCS12 SCI Subsystem A HCS12 device may have one or two serial communication interface. These two SCI interfaces are referred to as SCI0 and SCI1. The.
Homework Reading Machine Projects
Embedded Microcontroller Systems
Homework / Exam Return and Review Exam #1 Reading Machine Projects
Homework Reading Machine Projects Labs
Homework Reading Continue mp1 Labs Tokheim, Section 13-6 Questions?
CS-401 Computer Architecture & Assembly Language Programming
Microprocessor and Assembly Language
Microprocessor Systems Design I
Homework Reading Machine Projects Labs
EE 107 Fall 2017 Lecture 5 Serial Buses – UART & SPI
Programming the I/O Hardware
Discussions on hw5 Objectives:
Homework Reading (linked from my web page) Machine Projects Labs
The 8085 Microprocessor Architecture
Homework Reading Labs S&S Extracts ,
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
8259 Chip The Intel 8259 is a family of Programmable Interrupt Controllers (PIC) designed and developed for use with the Intel 8085 and Intel 8086 microprocessors.
Interrupt Driven I/O References Text: Tanenbaum ch.1.4.3, ch Receiver Interrupt Program Example:
Discussions on hw5 Objectives:
Programming the I/O Hardware
Assembly Language Programming I: Introduction
Computer System Overview
CS4470 Computer Networking Protocols
Assembly Language Programming II: C Compiler Calling Sequences
Processor Fundamentals
Discussions on HW2 Objectives
X1 & X2 These are also called Crystal Input Pins.
Transmitter Interrupts
Interrupt Source: under
Interrupts and Exception Handling
The 8085 Microprocessor Architecture
Discussions on HW2 Objectives
Presentation transcript:

Homework Reading Machine Projects Labs Review previous material on “interrupts” Machine Projects MP4 Due today Starting on MP5 (Due at start of Class 28) Labs Continue in labs with your assigned section

Discussion of MP4 What did you learn? Did anyone do the optional software UART? Let’s look at the code for it as an exercise

Introduction to MP5 Adding new code to provided tutor “cmds.c” Writing a COM1 port driver for Tutor to use Started and stopped by the application (Tutor) Tutor cycles driver through this sequence: Receives and buffers user entered data (with full duplex echo back to COM1 port) Returns to callback function with receive data buffer Transmits buffer of application data (prompt) Returns to callback function when done

SAPC as Host to a User on COM1 Transmit Character Buffer (Prompt: ) Second Window First Window COM1 COM2 Calls Application Process (Tutor) Driver Code Call- backs User on COM1 Sees prompts and enters data as if on a host connection SYSADMIN Controls SAPC with Tutor and verifies data in from the user on COM1 port Receive Character Buffer (user data)

What Code is Needed? In cmds.c: In comintspack: The spi command function has been written for you Write two call back functions one for processing last interrupt in transmission and re-starting receiver interrupts one for processing last interrupt in receiving and re-starting transmitter interrupts In comintspack: Write init and shutdown for COM1 interrupts Write an interrupt handler for IRQ4 (must handle either a transmit or a receive interrupt each call)

What’s in cmds.c New PC-tutor command Descriptions spi <on|off> spi on calls init_comints to enable COM1 in transmit mode with transmit call back function (to print prompt first) spi off calls shutdown_comints to disable both transmit and receive interrupts

What’s in cmds.c Receive callback function (process_input) Process input completion (print buffer on COM2) Disable input receiving via shutdown_comints() Enable output transmission via init_comints() Transmit callback function (process_output) Disable output transmission via shutdown_comints() Enable input receiving via init_comints() These cause alternate COM1 transmit and receive

What’s in comintspack.h? API symbolic constants /* mode values */ #define TRANSMIT 0 #define RECEIVE 1 API function prototypes void init_comints (int mode, void (*callback)(char *), char *buffer, int size); void shutdown_comints (void); You do NOT modify this file. Use it as-is!

What’s in comintspack.c? Initialize COM1 port (init_comints) Save callback function, buffer, and size in static memory Clear out any characters already received Set the interrupt gate Enable the PIC for the IRQ4 For RX mode, enable RX interrupts in the UART’s IER For TX mode, enable TX interrupts in the UART’s IER This function is called with interrupts disabled

What’s in comintspack.c? Shut down COM1 port (shutdown_comints) Disable the PIC for the COM IRQ Disable both interrupts in the UART’s IER This function is called with interrupts disabled

What’s In comintspack.c? Interrupt Handler (irq4inthandc) Acknowledge the PIC interrupt For Receive Input the character from COM1 Echo the character to COM1 Add to accumulated data in the application buffer On end of line, call callback function passing buffer For Transmit Get the next outgoing character from application buffer If not end of string (‘\0’), output the character Otherwise output CR and call callback function

Comintspack Ladder Diagram API Sysadmin User COM2 COM1 TUTOR COMINTSPACK static storage UART spi on init_comints (tx mode) Write irq4inthandc Confirm Int Read Prompt Character to user * * * Int Read Last Prompt Character to user Transmit callback function shutdown_comints () init_comints (rx mode) Write

Comintspack Ladder Diagram API Sysadmin User COM2 COM1 TUTOR COMINTSPACK static storage UART User enters Character Int Read Echo of character back Write * * * User enters last character (CR) Int Read Echo of last character back Write Receive callback function Print line Read shutdown_comints () init_comints (tx mode) Write Int Read Prompt Character to user ET CETERA

UART Interrupts The UART is a real interrupt driven I/O device At system reset, all interrupt are disabled The UART has four conditions for interrupting We’ll use two alternately - the receiver “data ready” and transmitter “THR empty” interrupts We program the UART to enable them via the COM1 Interrupt Enable Register (IER = 0x3f9)

UART Interrupts The UART interrupts each time it receives a char or the THR goes empty (depending on the interrupt enabled) COM1 is connected to pin IR4 on the PIC, its IRQ is 4. The nn code generated by the PIC for COM1 is 0x24, so its interrupt gate descriptor is IDT[0x24] ISR must send an EOI command to the PIC The ISR must read the received char or write the THR to cause the UART to remove its interrupt The UART hardware detects the inb or outb for the character and completes its interrupt-in-progress

UART Interrupts Two Parts of the Interrupt Handler irq4inthand – the outer assembly language interrupt handler Save registers Call C function irq4inthandc Restore registers iret irq4inthandc - the C interrupt handler Does the work described earlier

Demonstration of Both Windows COM1 COM2 PC-tutor> spi on comints for COM1 on PC-tutor> see me type data^M^M timeon 5 I can still enter a PC-tutor cmd timer on PC-tutor> (1) Timer is operating independently more data1^M^M of the COM1 port with interrupts (2) (3) more data2^M^M timeoff Another PC-tutor command timer off PC-tutor> spi off comints for COM1 off PC-tutor> q Exception 3 at EIP=00100110: Breakpoint ~q Quit handler: killing process 12521 Leaving board #7 Prompt: see me type data more data1 more data2 ~q Quit handler: killing process 12932 Leaving board #-1