Programming Embedded Systems by Michael Barr & Anthony Massa
Author:Michael Barr & Anthony Massa [Michael Barr]
Language: eng
Format: epub
Tags: COMPUTERS / Hardware / General
ISBN: 9780596553289
Publisher: O'Reilly Media
Published: 2009-02-08T16:00:00+00:00
Struct Overlays
In embedded systems featuring memory-mapped I/O devices, it is sometimes useful to overlay a C struct onto each peripheralâs control and status registers. Benefits of struct overlays are that you can read and write through a pointer to the struct, the register is described nicely by the struct, code can be kept clean, and the compiler does the address construction at compile time.
The following example code shows a struct overlay for a timer peripheral. If a peripheralâs registers do not align correctly, reserved members can be included in the struct. Thus, in the following example, an extra field that youâll never refer to is included at offset 4 so that the control field lies properly at offset 6.
typedef struct { uint16_t count; /* Offset 0 */ uint16_t maxCount; /* Offset 2 */ uint16_t _reserved1; /* Offset 4 */ uint16_t control; /* Offset 6 */ } volatile timer_t; timer_t *pTimer = (timer_t *)(0xABCD0123);
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
| Computer Design | Control Systems |
| DSPs | Embedded Systems |
| Microprocessor Design | PIC Microcontroller |
Embedded Programming with Modern C++ Cookbook by Igor Viarheichyk(4092)
Linux Device Driver Development Cookbook by Rodolfo Giometti(4022)
Implementing Cellular IoT Solutions for Digital Transformation by Dennis McCain(4008)
Embedded Linux Development Using Yocto Project - Third Edition by Otavio Salvador & Daiane Angolini(3869)
TinyML Cookbook by Gian Marco Iodice(3771)
Simplifying 3D Printing with OpenSCAD by Colin Dow(2904)
TinyML Cookbook by Gian Marco Iodice & Ronan Naughton(2659)
Fusion 360 for Makers by Lydia Sloan Cline(2308)
Networking A Beginner's Guide by Bruce Hallberg(2290)
Hands-On Linux for Architects by Denis Salamanca(2132)
Computers For Seniors For Dummies by Nancy C. Muir(2106)
But How Do It Know? by J. Clark Scott(2079)
Raspberry Pi and MQTT Essentials by Dhairya Parikh(2040)
Arduino Project Handbook, Volume 2: 25 Simple Electronics Projects for Beginners by Geddes Mark(1999)
9781803246888-ENHANCING DEEP LEARNING WITH BAYESIAN INFERENCE by Unknown(1971)
Hack and HHVM by Owen Yamauchi(1956)
31 Days Before Your CompTIA A+ Exams (Shanette Luellen's Library) by Benjamin Patrick Conry(1923)
Hands-On Internet of Things with MQTT by Tim Pulver(1828)
MicroPython Projects by Jacob Beningo(1818)