Fundamentals of embedded software : Where C and assembly meet / Daniel W. Lewis.

By: Lewis, D. WMaterial type: TextTextPublication details: Upper Saddle River, NJ : Prentice Hall, c2002Description: xvi, 266 p. : ill. ; 25 cm. + 1 CD-ROM (4 3/4 in.)ISBN: 0130615897 (alk. paper)Subject(s): Embedded Computer Systems -- Programming | C (Computer program language) | Assembly languages (Electronic computers)DDC classification: 005.133
Contents:
Chapter 1 Introduction 1 1.1 What is an Embedded System? 1 1.2 What's Unique About the Design Goals for Embedded Software? 1.3 What Does "Real-Ume" Mean? 5 1.4 What Does "Multitasking" Mean? 6 1.5 How Powerful Are Embedded Processors? 7 1.6 What Programming Languages Are Used? 7 1.7 What Is a "Real-Time Kernel"? 8 1.8 How Is Btiilding an Embedded Application Unique? 9 1.9 How Big Are Typical Embedded Programs? 11 1.10 The Software Used in This Book 12 Problems 14 Chapter 2 Data Representation 15 2.1 Fixed-Precision Binary Numbers 15 2.1.1 Positional Number Systems 16 2.1.2 Binary-to-Decimal Conversion 17 2.1.3 Decimal-to-Binary Conversion 17 2.1.4 Counting 19 2.1.5 Fixed Precision and Rollover 19 2.1.6 Hexadecimal Representation 20 2.2 Binary Representation of Integers 21 2.2.1 Signed Integers 21 2.2.2 Positive and Negative Representations of the Same Magnitude 22 2.2.3 Interpreting the Value of a 2's-Complement Number 23 2.2.4 More on Range and Overflow 24 2.2.5 2's Complement and Hardware Complexity 25 2.3 Binary Representation of Real Numbers 28 2.3.1 Fixed-Point Representation 28 2.3.2 Fixed-Point Using a Universal 16.16 Format 30 2.3.3 Fixed-Point Using a Universal 32.32 Format 32 2.3.4 Floating-Point Representation 35 2.4 ASCQ Representation of Text 37 2.5 Binary-Coded Dedmai (BCD) 39 Problems 40 C3upter 3 Getting the Most Out of C 43 3.1 Integer Data lypes 43 32 Mixing Data lypes 46 3.3 Usefuliypedefe and Defines 47 3.4 Manipulating Bits in Memory 48 3.4.1 Testing Bits 50 3.4.2 Setting, Clearing, and Inverting Bits 51 3.4.3 Extracting Bits 52 3.4.4 Inserting Bits 52 3.5 Manipulating Bits in I/O Ports 53 3.5.1 Write-Only I/O Ports 53 3.5.2 PortsDifferentiatedby Reads Versus Writes 54 3.5.3 Pbrts Differentiated by Sequential Access 54 3.5.4 Ports Differentiated by Bits in the Written Data 55 3.6 Accessing Memory-Mapped I/O Devices 55 3.6.1 Accessing Data Through a Pointer 55 3.6.2 Arrays, Pointers, and the "Address Or Operator 56 3.7 Structures 58 3.7.1 Packed Structures 59 3.7.2 Bit Fields 60 3.8 Variant Access 61 3.8.1 Casting the Address of an Object 61 3.8.2 Using Unions 63 Problems 63 Chapter 4 A Programmer's View of Computer Organization 65 4.1 Memory 65 4.2 The Central Processing Unit (CPU) 67 4.2.1 The Arithmetic and Logic Unit (ALU) 67 4.2.2 Other Registers 68 4.2.3 The Control Unit 69 4.3 Input/Output (I/O) 70 4.4 Introduction to the Intel Architecture 71 4.4.1 Instruction Formats 72 4.4.2 Instruction Operands 73 4.4.3 Operand Restrictions 74 4.4.4 Registers 75 4.4.5 Ibe Stack 77 4.5 Hie Intel Real Mode Architecture 78 4.5.1 Segmented Addressing 79 4.5.2 Addressing Modes 81 4.6 The Intel Protected Mode Architecture 83 4.6.1 Segment Registers and Hie Global Descriptor Ihble 84 4.6.2 The Flat Memory Model 85 4.6.3 Addressing Modes 85 4.7 Operand and Address-Size Override Prefixes 86 4.8 Hie Intel Data Manipulation Instructions 86 4.8.1 Data Movement, Stack, and I/O Instructions 87 4.8.2 Arithmetic Instructions 89 4.8.3 Bitwise Instructions 91 4.8.4 Shift Instructions 91 Problems 93 Chapter 5 Mixing C and Assembly 96 5.1 Programming in Assembly 96 5.2 Register Usage Conventions 98 5.3 Typical Use of Addressing Options 98 5.3.1 Accessing Data Whose Address is a Constant 99 5.3.2 Accessing Data Whose Address is a Variable 100 5.4 Instruction Sequendng 101 5.4.1 Compound Conditionals 102 5.42 If-Ihen-Else Statements 104 5.4.3 Building Loops 105 5.4.4 Faster Loops with String Instructions 106 5.5 Procedure Call and Return 1(77 5.6 Parameter Passing 108 5.7 Retrieving Parameters 110 5.8 Everything is Pass by Value 112 5.9 Tbmporary Variables 112 Problems 115 Chapter 6 Input/Output Programming 117 6.1 Hie Intel I/O Instructions 118 6.2 Synchronization, Tlransfer Rate, and Latency 118 6.3 Polled Waiting Loops 119 6.4 Intemxpt-Driven I/O 121 6.4.1 The Hardware Response 121 6.4.2 The Interrupt Service Routine 124 6.4.3 Programmable Interrupt Controllers 125 6.4.4 Buffers and Queues 126 6.4.5 Writing Interrupt Service Routines in Assembly 128 6.4.6 Writing Interrupt Service Routines in C 129 6.4.7 Nonmaskable Interrupts 130 6.4.8 Software Interrupts 130 6.4.9 Exceptions 132 6.5 Direct Memory Access 132 6.5.1 Double Buffering 133 6.6 Comparison of Methods 134 Problems 135 Chapter 7 Concurrent Software 138 7.1 Foreground/Background Systems 138 7.1.1 Thread State and Serialization 139 7.1.2 Managing Latency 139 7.1.3 Preventing Interrupt Overrun 143 7.1.4 Moving Work into the Background 144 12 Multithreaded Programming 145 7.2.1 Concurrent Execution of Independent Threads 145 122 Context Switching 146 123 Nonpreemptive (Cooperative) Multitasking 147 12A Preemptive Multitasking 147 13 Shared Resources and Critical Sections 148 7.3.1 Disabling Interrupts 150 132 Disabling Task Switching 150 133 Spin Locks 151 13 A Mutex Objects 152 7.3.5 Semaphores 152 Problems 153 Chapter 8 Sdieduling ISS 8.1 Thread States 155 8.2 Pending Threads 156 8.3 Context Switching 157 8.4 Round-Robin Scheduling 158 8.5 Priority-Based Scheduling 159 8.5.1 Priority Inversion 159 8.5.2 The Priority Inheritance Protocol 160 8.5.3 Hie Priority Ceiling Protocol 161 8.6 Assigning Priorities 161 8.6.1 Deadline-Driven Scheduling 161 8.6.2 Rate-Monotonic Scheduling 162 8.7 Deadlock 163 8.8 Watchdog Hmers 164 Problems 166 Chapter 9 Memory Management 168 9.1 Objects in C 168 9.2 Scope 169 9.2.1 RelBning Local Scope 169 9.2.2 Refining Global Scope 170 9.3 Lifetime 171 9.4 Automatic Allocation 172 9.4.1 Storage Class "Register" 173 9.5 Static Allocation 174 9.6 Three Programs to Distinguish Static from Automatic 174 9.6.1 Object Creation 175 9.6.2 Object Initialization 175 9.6.3 Object Destruction 176 9.7 Dynamic Allocation 177 9.7.1 Fragmentation 178 9.7.2 Memory Allocation Pools 179 9.8 Automatic Allocation with Variable Size (alloca) 179 9.8.1 Variable-Size Arrays 180 9.9 Recursive Functions and Memory Allocation 181 Problems 182 Chapter 10 Shared Memory 189 10.1 Recognizing Shared Objects 189 10.1.1 Shared Global Data 190 10.1.2 Shared Private Data 190 10.1.3 Shared Functions 190 10.2 Reentrant Fimctions 190 10.3 Read-Only Data 191 10.3.1 Type Qualifier "const" 191 10.4 Coding Practices to Avoid 192 10.4.1 Functions That Keep Internal State in Local Static Objects 192 10.4.2 Functions That Return the Address of a Local Static Object 194 10.5 Accessing Shared Memory 195 10.5.1 The Effect of Processor Word Size 196 10.5.2 Read-Only and Write-Only Access 197 10.5.3 Type Qualifier "volatile" 198 Problems 2(H) Chapter 11 System Initializatioii 203 11.1 Memory Layout 203 11.2 The CPU 204 11.2.1 Setting Up a Flat Memory Model 204 11.2.2 Switching into Protected Mode 207 11.3 C Run-Ume Environment 207 11.3.1 Copying from ROM to RAM 208 11.3.2 Zeroing Uninitialized Statics 208 11.3.3 Setting Up a Heap 209 11.4 System Timer 211 11.4.1 Timer 0: Timer Tick 211 11.4.2 Timer 1: Memory Refresh 212 11.4.3 Timer 2: Speaker Frequency 212 11.5 Interrupt System 213 11.5.1 Initializing the IDT 213 11.5.2 Initializing the 8259 PICs 215 11.5.3 Installing a New Interrupt Service Routine 216
Tags from this library: No tags from this library for this title. Log in to add tags.
Star ratings
    Average rating: 0.0 (0 votes)
Holdings
Item type Current library Call number Status Date due Barcode Item holds
General Books General Books Central Library, Sikkim University
General Book Section
005.133 LEW/F (Browse shelf(Opens below)) Available P20827
General Books General Books Central Library, Sikkim University
General Book Section
005.133 LEW/F (Browse shelf(Opens below)) Available P20826
Total holds: 0

Includes index.

Chapter 1 Introduction 1
1.1 What is an Embedded System? 1
1.2 What's Unique About the Design Goals for Embedded Software?
1.3 What Does "Real-Ume" Mean? 5
1.4 What Does "Multitasking" Mean? 6
1.5 How Powerful Are Embedded Processors? 7
1.6 What Programming Languages Are Used? 7
1.7 What Is a "Real-Time Kernel"? 8
1.8 How Is Btiilding an Embedded Application Unique? 9
1.9 How Big Are Typical Embedded Programs? 11
1.10 The Software Used in This Book 12
Problems 14
Chapter 2 Data Representation 15
2.1 Fixed-Precision Binary Numbers 15
2.1.1 Positional Number Systems 16
2.1.2 Binary-to-Decimal Conversion 17
2.1.3 Decimal-to-Binary Conversion 17
2.1.4 Counting 19
2.1.5 Fixed Precision and Rollover 19
2.1.6 Hexadecimal Representation 20
2.2 Binary Representation of Integers 21
2.2.1 Signed Integers 21
2.2.2 Positive and Negative Representations of the Same
Magnitude 22
2.2.3 Interpreting the Value of a 2's-Complement Number 23
2.2.4 More on Range and Overflow 24
2.2.5 2's Complement and Hardware Complexity 25
2.3 Binary Representation of Real Numbers 28
2.3.1 Fixed-Point Representation 28
2.3.2 Fixed-Point Using a Universal 16.16 Format 30
2.3.3 Fixed-Point Using a Universal 32.32 Format 32
2.3.4 Floating-Point Representation 35
2.4 ASCQ Representation of Text 37
2.5 Binary-Coded Dedmai (BCD) 39
Problems 40
C3upter 3 Getting the Most Out of C 43
3.1 Integer Data lypes 43
32 Mixing Data lypes 46
3.3 Usefuliypedefe and Defines 47
3.4 Manipulating Bits in Memory 48
3.4.1 Testing Bits 50
3.4.2 Setting, Clearing, and Inverting Bits 51
3.4.3 Extracting Bits 52
3.4.4 Inserting Bits 52
3.5 Manipulating Bits in I/O Ports 53
3.5.1 Write-Only I/O Ports 53
3.5.2 PortsDifferentiatedby Reads Versus Writes 54
3.5.3 Pbrts Differentiated by Sequential Access 54
3.5.4 Ports Differentiated by Bits in the Written Data 55
3.6 Accessing Memory-Mapped I/O Devices 55
3.6.1 Accessing Data Through a Pointer 55
3.6.2 Arrays, Pointers, and the "Address Or Operator 56
3.7 Structures 58
3.7.1 Packed Structures 59
3.7.2 Bit Fields 60
3.8 Variant Access 61
3.8.1 Casting the Address of an Object 61
3.8.2 Using Unions 63
Problems 63
Chapter 4 A Programmer's View of Computer Organization 65
4.1 Memory 65
4.2 The Central Processing Unit (CPU) 67
4.2.1 The Arithmetic and Logic Unit (ALU) 67
4.2.2 Other Registers 68
4.2.3 The Control Unit 69
4.3 Input/Output (I/O) 70
4.4 Introduction to the Intel Architecture 71
4.4.1 Instruction Formats 72
4.4.2 Instruction Operands 73
4.4.3 Operand Restrictions 74
4.4.4 Registers 75
4.4.5 Ibe Stack 77
4.5 Hie Intel Real Mode Architecture 78
4.5.1 Segmented Addressing 79
4.5.2 Addressing Modes 81
4.6 The Intel Protected Mode Architecture 83
4.6.1 Segment Registers and Hie Global Descriptor Ihble 84
4.6.2 The Flat Memory Model 85
4.6.3 Addressing Modes 85
4.7 Operand and Address-Size Override Prefixes 86
4.8 Hie Intel Data Manipulation Instructions 86
4.8.1 Data Movement, Stack, and I/O Instructions 87
4.8.2 Arithmetic Instructions 89
4.8.3 Bitwise Instructions 91
4.8.4 Shift Instructions 91
Problems 93
Chapter 5 Mixing C and Assembly 96
5.1 Programming in Assembly 96
5.2 Register Usage Conventions 98
5.3 Typical Use of Addressing Options 98
5.3.1 Accessing Data Whose Address is a Constant 99
5.3.2 Accessing Data Whose Address is a Variable 100
5.4 Instruction Sequendng 101
5.4.1 Compound Conditionals 102
5.42 If-Ihen-Else Statements 104
5.4.3 Building Loops 105
5.4.4 Faster Loops with String Instructions 106
5.5 Procedure Call and Return 1(77
5.6 Parameter Passing 108
5.7 Retrieving Parameters 110
5.8 Everything is Pass by Value 112
5.9 Tbmporary Variables 112
Problems 115
Chapter 6 Input/Output Programming 117
6.1 Hie Intel I/O Instructions 118
6.2 Synchronization, Tlransfer Rate, and Latency 118
6.3 Polled Waiting Loops 119
6.4 Intemxpt-Driven I/O 121
6.4.1 The Hardware Response 121
6.4.2 The Interrupt Service Routine 124
6.4.3 Programmable Interrupt Controllers 125
6.4.4 Buffers and Queues 126
6.4.5 Writing Interrupt Service Routines in Assembly 128
6.4.6 Writing Interrupt Service Routines in C 129
6.4.7 Nonmaskable Interrupts 130
6.4.8 Software Interrupts 130
6.4.9 Exceptions 132
6.5 Direct Memory Access 132
6.5.1 Double Buffering 133
6.6 Comparison of Methods 134
Problems 135
Chapter 7 Concurrent Software 138
7.1 Foreground/Background Systems 138
7.1.1 Thread State and Serialization 139
7.1.2 Managing Latency 139
7.1.3 Preventing Interrupt Overrun 143
7.1.4 Moving Work into the Background 144
12 Multithreaded Programming 145
7.2.1 Concurrent Execution of Independent Threads 145
122 Context Switching 146
123 Nonpreemptive (Cooperative) Multitasking 147
12A Preemptive Multitasking 147
13 Shared Resources and Critical Sections 148
7.3.1 Disabling Interrupts 150
132 Disabling Task Switching 150
133 Spin Locks 151
13 A Mutex Objects 152
7.3.5 Semaphores 152
Problems 153
Chapter 8 Sdieduling ISS
8.1 Thread States 155
8.2 Pending Threads 156
8.3 Context Switching 157
8.4 Round-Robin Scheduling 158
8.5 Priority-Based Scheduling 159
8.5.1 Priority Inversion 159
8.5.2 The Priority Inheritance Protocol 160
8.5.3 Hie Priority Ceiling Protocol 161
8.6 Assigning Priorities 161
8.6.1 Deadline-Driven Scheduling 161
8.6.2 Rate-Monotonic Scheduling 162
8.7 Deadlock 163
8.8 Watchdog Hmers 164
Problems 166
Chapter 9 Memory Management 168
9.1 Objects in C 168
9.2 Scope 169
9.2.1 RelBning Local Scope 169
9.2.2 Refining Global Scope 170
9.3 Lifetime 171
9.4 Automatic Allocation 172
9.4.1 Storage Class "Register" 173
9.5 Static Allocation 174
9.6 Three Programs to Distinguish Static from Automatic 174
9.6.1 Object Creation 175
9.6.2 Object Initialization 175
9.6.3 Object Destruction 176
9.7 Dynamic Allocation 177
9.7.1 Fragmentation 178
9.7.2 Memory Allocation Pools 179
9.8 Automatic Allocation with Variable Size (alloca) 179
9.8.1 Variable-Size Arrays 180
9.9 Recursive Functions and Memory Allocation 181
Problems 182
Chapter 10 Shared Memory 189
10.1 Recognizing Shared Objects 189
10.1.1 Shared Global Data 190
10.1.2 Shared Private Data 190
10.1.3 Shared Functions 190
10.2 Reentrant Fimctions 190
10.3 Read-Only Data 191
10.3.1 Type Qualifier "const" 191
10.4 Coding Practices to Avoid 192
10.4.1 Functions That Keep Internal State in Local Static Objects 192
10.4.2 Functions That Return the Address of a Local Static Object 194
10.5 Accessing Shared Memory 195
10.5.1 The Effect of Processor Word Size 196
10.5.2 Read-Only and Write-Only Access 197
10.5.3 Type Qualifier "volatile" 198
Problems 2(H)
Chapter 11 System Initializatioii 203
11.1 Memory Layout 203
11.2 The CPU 204
11.2.1 Setting Up a Flat Memory Model 204
11.2.2 Switching into Protected Mode 207
11.3 C Run-Ume Environment 207
11.3.1 Copying from ROM to RAM 208
11.3.2 Zeroing Uninitialized Statics 208
11.3.3 Setting Up a Heap 209
11.4 System Timer 211
11.4.1 Timer 0: Timer Tick 211
11.4.2 Timer 1: Memory Refresh 212
11.4.3 Timer 2: Speaker Frequency 212
11.5 Interrupt System 213
11.5.1 Initializing the IDT 213
11.5.2 Initializing the 8259 PICs 215
11.5.3 Installing a New Interrupt Service Routine 216

There are no comments on this title.

to post a comment.
SIKKIM UNIVERSITY
University Portal | Contact Librarian | Library Portal

Powered by Koha