DOC PREVIEW
UCLA EE 202A - Embedded System S/W Organization & Static Scheduling

This preview shows page 1-2-3-22-23-24-44-45-46 out of 46 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

10/9/20011Mani SrivastavaUCLA - EE DepartmentRoom: 7702-B Boelter HallEmail: [email protected]: 310-267-2098WWW: http://www.ee.ucla.edu/~mbsCopyright 2001  Mani SrivastavaEmbedded System S/W Organization & Static SchedulingEE202A (Fall 2001): Lecture #32Copyright 2001  Mani SrivastavaReading List for This Lecture Required [Melkonian00] Melkonian, Michael. Get by without an RTOS.Embedded Systems Programming, September 2000. http://www.embedded.com/2000/0009/0009feat4.htm [Lee87] Lee, E.A.; Messerschmitt, D.G. Static scheduling of synchronous data flow programs for digital signal processing.IEEE Trans. on Computers, vol.C-36, (no.1), Jan. 1987. p.24-35. Others [Bhattacharyya99] Bhattacharyya, S.S.; Murthy, P.K.; Lee, E.A.Synthesis of embedded software from synchronous dataflow specifications. Journal of VLSI Signal Processing Systems for Signal, Image, and Video Technology, vol.21, (no.2), KluwerAcademic Publishers, June 1999. p.151-66. http://ptolemy.eecs.berkeley.edu/publications/papers/99/synthesis/10/9/200123Copyright 2001  Mani SrivastavaCourse Project Proposal Due Friday Oct 12 One page proposal describing the proposed project, and listing reference material talk to me for suggestions Individually or groups of two Project may cover any topic of interest in embedded and real-time systems need not be on a topic covered in lectures ties with your research are acceptable A conference-style report and a project presentation on your results will be due at the end of the quarter Submit as proj1.zip or proj1.tgz4Copyright 2001  Mani SrivastavaReal-time Implementation in Software on a Single Processor Typical implementation approaches Synchronous– single program Asynchronous– foreground/background system– multi-tasking10/9/200135Copyright 2001  Mani SrivastavaExample A process controller with following modules a clock tick comes every 20 ms when a clock module must run a control module must run every 40 ms three modules with soft constraints– operator display update– operator input– management information logs6Copyright 2001  Mani SrivastavaSingle Program Approachwhile (1) {wait for clock;do clock module;if (time for control) do control;else if (time for display update) do display;else if (time for operator input) do operator input;else if (time for mgmnt. request) do mgmnt. output;} Must have t1 + max(t2, t3, t4, t5) ≤20 ms may require splitting tasks… gets complex!10/9/200147Copyright 2001  Mani SrivastavaAnother Exampleint main(void) {Init_All();for (;;) {IO_Scan();IO_ProcessOutputs();KBD_Scan();PRN_Print();LCD_Update();RS232_Receive();RS232_Send();TMR_Process();}// should never ever get here// can put some error handling here, just in casereturn (0); // will keep most compilers happy} 8Copyright 2001  Mani SrivastavaObservations on the Single Program Approach Each function called in the infinite loop represents an independent task  Each of these tasks must return in a reasonable time, no matter what thread of code is being executed  We have no idea at what frequency our main loop runs. In fact, the frequency is not constant and can significantly change with the changes in system status (as we are printing a long document or displaying a large bitmap, for example) Mix of periodic and event-driven tasks Most tasks are event driven e.g. IO_ProcessOutputs is an event-driven task dedicated input event queue associated with them• e.g. IO_ProcessOutputs receives events from IO_Scan, RS232_Receive, and KBD_Scan when an output needs to be turned on Others are periodic No trigger event, but may have different periods, and may need to change their period over time10/9/200159Copyright 2001  Mani SrivastavaObservations on the Single Program Approach (contd.) Need some simple means of inter-task communications e.g. may want to stop scanning the inputs after a particular keypad entry and restart the scanning after another entry require a call from a keypad scanner to stop the I/O scanner task e.g. may also want to slow down the execution of some tasks depending on the circumstances say we detect an avalanche of input state changes, and our RS-232 link can no longer cope with sending all these messages like to slow down the I/O scanner task from the RS-232 sending task May need to perform a variety of small but important duties e.g. dim the LCD exactly one minute after the very last key was pressed, flash a cursor on the LCD at a periodic, fixed and exact frequency.  dedicating a separate task to each of these functions is definitely overkill – so handled through timers and TMR_Process 10Copyright 2001  Mani SrivastavaHandling Periodic Tasks with Multiple and Variable Rates Two variables, execution counters and reload value, associated with tasksvolatile unsigned int LCD_ReloadValue = LCD_TASK_DEFAULT_SPEED;volatile unsigned int LCD_ExecCounter = LCD_TASK_DEFAULT_SPEED; How it works? execution counter counts down from reload value in exact timing system, the execution counter is decremented in a fixed frequency interrupt routine in relative timing system, the task itself decrements the counter when it reaches zero, the task is called, otherwise the entry function to the task exits without further processing using a variable rather than a constant for reload value is that this helps us to dynamically manipulate the execution speed of the task setting execution counter to special value TASK_DISABLED prevents task execution  can be set by any other task Issues fair bit pf processing in the interrupt handler need mutually exclusive access to execution counter by task and interrupt code task must be written so that they return in a reasonable time – may need to split10/9/2001611Copyright 2001  Mani SrivastavaHandling Event-driven Tasks Each event driven task has an input event queue e.g. ring buffer with asynchronous GetEvent and PutEvent Unique input event structure for each tasktypedef unsigned int word;typedef struct {word InPtr; /* Head of buffer */word OutPtr; /* Tail of buffer */word Count; /* Counter */EVENT_TYPE Store[BUFFER_SIZE]; /* buffer space */} INPUT_EVENT_QUEUE_TYPE;12Copyright 2001  Mani SrivastavaEvent-driven Tasks (contd.) Sending an event// somewhere in RS232 moduleOUTPUT_EVENT_TYPE OutputEvent; OutputEvent.NewState = 1; // new state - on


View Full Document

UCLA EE 202A - Embedded System S/W Organization & Static Scheduling

Download Embedded System S/W Organization & Static Scheduling
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Embedded System S/W Organization & Static Scheduling and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Embedded System S/W Organization & Static Scheduling 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?