Android 多核心嵌入式多媒體系統設計與實作

Size: px
Start display at page:

Download "Android 多核心嵌入式多媒體系統設計與實作"

Transcription

1 Android 多核心嵌入式多媒體系統設計與實作 Linux Device Driver 架構簡介 賴槿峰 (Chin-Feng Lai) Assistant Professor, institute of CSIE, National Ilan University Sep 29 th MMN Lab. All Rights Reserved 資訊軟體技術人才培訓

2 Outline Introduction The Role of Driver Device Driver Concepts Driver Methods Module Utilities Module Build Infrastructure Lab 2

3 Introduction The Role of Driver Device Driver Concepts Driver Methods Module Utilities Module Build Infrastructure Lab 3 3

4 Introduction Android system and Embedded system File System Linux Kernel (driver) Hardware Bootloader 4

5 Introduction Device Driver in Linux android Kernel distinct black boxes that make a particular piece of hardware respond to a well-defined internal programming interface hide the complexity and variability of the hardware device from the user map standardized calls to device-specific operations that act on real hardware Android is a Linux-based architecture. In addition to the original Linux driver, Android need other additional device driver, like Android Logger, Binder, Low Memory killer, Power Management for android(wakelock), ASHMEM, etc. 5

6 Introduction Android additional kernel driver driver Features Alarm Driver Android Logger (logcat) Low Memory Killer Wakelock (power management) USB Gadget ASHMEM (shared memory) PMEM (memory allocator) X86 Support driver/staging/android 6

7 Introduction The Role of Driver Device Driver Concepts Driver Methods Module Utilities Module Build Infrastructure Lab 7 7

8 The Role of Driver General Driver for Linux kernel A software layer above hardware Provide method to operate hardware Driver provide mechanism, Not policy Provide user more flexible operation 8

9 The Role of Driver Main Driver Type in Linux General GPIO Driver Target specific GPIO driver Audio Driver alsa oss Video Driver v4l v4l2 framebuffer Storage Driver Support for mass storage access Network Driver USB Support network routing and buffer handling HID Mass Storage Printer Hub Video Wireless Controller 9

10 The Role of Driver Linux Driver Architecture Android Application Android Framework Android HAL User Application System Call Interface User Mode open, ioctl, close,read, write Kernel Hardware Android Embedded system Virtual File System (VFS) GPIO Driver Audio Driver Video Driver Device interface Hardware Linux Embedded system Kernel Mode Hardware 10

11 The Role of Driver General GPIO Driver The way we driver the general purpose input output hardware The GPIO driver usually via hardware address mapping to control I/O status GPIO drivers usually are character device type Audio Driver The sound subsystem manage all the sound feature in linux kernel There are different type of hardware specification support in kernel source tree, which locate in kernel/sound There are two main group support sound system, ex : alsa, oss 11

12 The Role of Driver Video Driver Linux Video Device Driver is a middle role of user program and hardware The Video Driver is responsible for pushing decoded raw data to display interface The development of Linux video driver can classify by two group, the one is the video for Linux series(v4l V4L2) and Framebuffer 12

13 Introduction The Role of Driver Device Driver Concepts Driver Methods Module Utilities Module Build Infrastructure Lab 13 13

14 14 Device Driver Concepts

15 Device Driver Concepts Process management Determinate process s life cycle, control process I/O and distribute CPU resource for scheduler. Memory Management Communicate with memory management subsystem, ex: malloc / free File System Kernel support multiple file system Device Control System call will be mapping to corresponding hardware device, every device has unique code to operate, call device driver Networking The kernel provide send/receive mechanism to handle incoming data 15

16 Device Driver Concepts Loadable Modules extend at runtime the set of features offered by the kernel offers support for quite a few different types (or classes) of modules Each module is made up of object code (not linked into a complete executable) that can be dynamically linked to the running kernel by the insmod program and can be unlinked by the rmmod program 16

17 Device Driver Concepts Classes of Devices and Modules The Linux way of looking at devices distinguishes between three fundamental device types char module block module network module the programmer can choose to build huge modules mplementing different drivers in a single chunk of code Good programmers usually create a different module for each new functionality they implement, because decomposition is a key element of scalability and extendability 17

18 Device Driver Concepts Character Devices Modules A character device is one that can be accessed as a stream of bytes Store data through device file Implements at least the open close read write system calls EX : Console (/dev/console) Serial Ports (/dev/ttys0) char devices that look like data areas, and you can move back and forth in them(applications can access the whole acquired image using mmap or lseek) 18

19 Device Driver Concepts Block Devices Modules block devices are accessed by file system nodes in the /dev directory Like a char device, each block device is accessed through a filesystem node In linux, block and char device only differ in the way of data management internally by the kernel a block device can only handle I/O operations that transfer one or more whole blocks (usually 512 bytes in length) 19

20 Device Driver Concepts Network Interface Any data transmission must pass through the interface A network interface is in charge of sending and receiving data packages. A network driver knows nothing about individual connections; it only handles packets. Network driver provide queue function to handle unexpectedly data transfer The Unix way to provide access to interfaces is still by assigning a unique name to them (such as eth0) Communication between the kernel and a network device driver is completely different from that used with char and block drivers. Instead of read and write, the kernel calls functions related to packet transmission. 20

21 Introduction The Role of Driver Device Driver Concepts Driver Methods Module Utilities Module Build Infrastructure Lab 21 21

22 Driver Methods Introduce to basic mechanism for communicating with a device driver from a user space program Device nodes on your file system provide the glue between your userspace application and the device driver Major Number & Minor Number Driver File System Operations Device Nodes and mknod 22

23 Driver Methods Major Number & Minor Number Char devices are accessed through names in the file system. Those names are called special files or device files or simply nodes of the file system tree major : 12-bits & minor : 20-bits (Kernel 2.6) Major number (0~255) The major number identifies the driver associated with the device Minor number (0~255) The minor number is used only by the driver specified by the minor number. 23

24 Driver Methods Major Number & Minor Number C:char driver node B:Block driver node P:Pipe noode 24

25 Driver Methods Major Number & Minor Number Registered devices are visible in /proc/devices Can be used to find free Major Num # cat /proc/devices A list of the most common devices can be found in # kernel_source/documentation/devices.txt Major number : LOCAL/EXPERIMENTAL use 25

26 Driver Methods Major Number & Minor Number In the Kernel, dev_ttype is used to hold device numbers(major & minor) defined in <linux/types.h> dev_t data type (Major and Minor Num) Define in <linux/kdev_t.h> Kernel data type to represent a major / minor number pair Linux 2.6: 32 bit size (major: 12 bits, minor: 20 bits) To obtain the major or minor parts of a dev_t, use: MAJOR(dev_tdev); MINOR(dev_tdev); Major and minor numbers turn them into a dev_t, use: MKDEV(int major_num, int minor_num); 26

27 Driver Methods Major Number & Minor Number - Allocating and Freeing Device Numbers register_chrdev_region(dev_tfirst, unsigned intcount, char*name); first:thebeginning device number of the range you would like to allocate count: The total number of contiguous device numbers name: Device Name alloc_chrdev_region(dev_t*dev,unsignedintfirstminor, unsigned intcount,char*name) dev: An output-only parameter which hold the first number in your allocated range on successful completion first:the requested first minor number to use; it is usually 0. Free Device Number void unregister_chrdev_region(dev_tfirst,unsignedintcount); 27

28 Driver Methods Driver File System Operation Most of the fundamental driver operations involve three important kernel data structures file_operations file and inode After the device driver is loaded into a live kernel, the first action we must take is to prepare the driver for subsequent operations open and release method read and write method ioctl 28

29 Driver Methods Driver File System Operation File_Operations Define in <linux/fs.h> File data structure just like an Object File_operations just like a method in Object File_operations data structure usually name as xxx_fops Every method must point to specific function 29

30 Driver Methods Driver File System Operation File_Operations - File Operations corresponding to user-space I/O function Device File System interface call open, ioctl, release,read,write File operations /*NCKU MMN LAB SAMPLE CODE*/ #include <linux/fs.h> struct memory_dev *memory_devices; int memory_major = 0; struct file_operations memory_fops = {.read = memory_read,.write = memory_write,.open = memory_open,.release = memory_release,.owner = THIS_MODULE, } Define on linux/fs.h Implement file_operaions on your moduls 30

31 Driver Methods Driver File System Operation File structure Define in <linux/fs.h> File represent open file Every open file mapping a specific struct file in kernel-space file refers to the structure and filp to a pointer to the structure. Example: int memory_open(struct inode *inode, struct file *filp) 31

32 Driver Methods Driver File System Operation File structure The most important fields of struct file are shown here, let we face some real C code and describe the field in more detail struct file_operations *f_op The operations associated with the file. The kernel assigns the pointer as part of its implementation of open and then reads it when it needs to dispatch any operations unsigned int f_flags Define in kernel_source/include/linux/fcntl.h A driver should check the flag (O_RDONLY, O_NONBLOCK O_SYNC) mode_t f_mode The file mode identifies the file as either readable or writable(or both) 32

33 Driver Methods Driver File System Operation inode structure The inode structure is used by the kernel internally to represent files. it is different from the file structure The inode structure contains a great deal of information about the file Example:major and minor number etc dev_t i_rdev; For inodes that represent device files, this field contains the actual device number. struct cdev *i_cdev; struct cdev is the kernel s internal structure that represents char devices; this field contains a pointer to that structure when the inode refers to a char device file. 33

34 Driver Methods Driver File System Operation Operation Flow A module runs in kernel space, whereas applications run in user space. This concept is at the base of operating systems theory. Events User space Kernel space Load module insmod Module_init() Open device open open() File_operation Read device Ioctl Ioctl() -> read() Write device Ioctl Ioctl() -> write() Close device Close release() Remove device rmmod Module_exit() 34

35 Driver Methods Driver File System Operation Open and Release method The kernel keeps a counter of how many times a file structure is being used they just increment the counter, when use open method to creates a new file structure The close system call executes the release method only when the counter for the file structure drops to 0, Define in kernel_source/include/linux/module.h MOD_INC_USE_COUNT (increase the counter) MOD_DEC_USE_COUNT (decrease the counter) 35

36 Driver Methods Driver File System Operation Open method Check for device-specific errors Initialize the device if it is being opened for the first time Update the f_op pointer, if necessary Allocate and fill any data structure to be put in filp->private_data Check major and minor number Prototype int (*open)(struct inode *inode, struct file *filp); 36

37 Driver Methods Driver File System Operation release method device_close() or device_release() Deallocate anything that open allocated in filp->private_date Shut down the device on last close Prototype int memory_release(struct inode *inode, struct file *filp) 37

38 Driver Methods Driver File System Operation Before read and write method - Kmalloc Memory management in Linux kernel A call to kmalloc attempts to allocate size bytes of memory void *kmalloc (size_t size, int flags); To free a block of memory void kfree(void *ptr); Flag define in kernel_source/include/linux/slab.h GFP_ATOMIC Used to allocate memory from interrupt handlers and other code outside of a process context Never sleeps. GFP_KERNEL Normal allocation of kernel memory. May sleep GFP_USER Used to allocate memory for userspace pages; it may sleep 38

39 Driver Methods Driver File System Operation read and write method ssize_t read (struct file *filp, char user *buff,size_t count, loff_t *offp) ssize_t write (struct file *filp, const char user *buff,size_t count, loff_t *offp)» filp:file pointer» buff : user buffer holding the data to be written or the empty buffer where the newly read data should be placed. Finally» count: size of the requested data transfer» offp : long offset type object that indicates the file position the user is accessing 39

40 Driver Methods Driver File System Operation read and write method Kernel can t dereference directly from userspace» User-space pointer may not be valid» User-space memory is paged -> page fault» It may provide an open doorway to access memory anywhere in the system Define in kernel_source/include/linux/uaccess.h» unsigned long copy_to_user (void user *to,const void *from,unsigned long count);» unsigned long copy_from_user (void *to,const void user *from,unsigned long count); 40

41 Driver Methods Driver File System Operation read and write method 41

42 Driver Methods Driver File System Operation read method return value equals count -> transfer successfully return value is positive and less than count -> only part of the data has been transferred return value is zero -> EOF return value is negative -> error, check <linux/error.h> write method return value equals count -> write successfully return value is positive and less than count ->only part of the data has been written return value is zero -> nothing was written return value is negative -> error, check <linux/error.h> 42

43 Driver Methods Driver File System Operation ioctl method Most drivers need in addition to the bility to read and write the device the ability to perform various types of hardware control via the device driver. Ioctl() system call provide device-specific command for device driver Prototypes of ioctl function In kernel space» int (*ioctl) (struct inode *inode, struct file *filp,unsigned int cmd, unsigned long arg); In User space» int ioctl(int fd, unsigned long cmd,...); Parameter» inode:inode of the device file» filp:file pointer of the device file» cmd:the I/O command index number explained later» arg:additional optional argument passed by user to driver 43

44 Driver Methods Driver File System Operation ioctl method The cmd magic numbers. See include/asm/ioctl.h and documentation/ioctl-number.txt to avoid used magic numbers Fields in cmd parameter:type,number,direction, size Type(magic number)» Just choose one number,this field is 8 bits wide (_IOC_TYPEBITS) Number(ordinal number)» The ordinal (sequential) number. It s eight bits (_IOC_NRBITS) wide Direction(The direction of data transfer)» _IOC_NONE _IOC_READ _IOC_WRITE Size» Data transfer is seen from the application s point of view» The size of user data» The width of this field is architecture dependent,but is usually 13 or 14 bits 44

45 Driver Methods Driver File System Operation ioctl method Encode» _IO (type, number)» _IOR (type, number, datatype)» _IOW (type, number, datatype)» _IOWR (type, number, datatype) Decode» _IOC_DIR (nr)» _IOC_TYPE (nr)» _IOC_NR (nr)» _IOC_SIZE (nr) 45

46 Driver Methods Driver File System Operation ioctl method Return value» The default error returned when invalid cmd parameter is sent is not quite regulated» POSIX: return ENOTTY (inappropriate ioctl for device)» The other way: return EINVAL (invalid parameter) int access_ok(int type, const void *addr,unsigned long size); Type Addr Size» The first argument should be either VERIFY_READ or VERIFY_WRITE» The addr argument holds a user-space address» size is a byte count. 46

47 Driver Methods Device Nodes and mknod A device node is a special file type in Linux that represents a device Virtually all Linux distributions keep device nodes in a common location, in a directory called /dev A dedicated utility is used to create a device node on a file system. This utility is called mknod. Example: Host$ mknod /dev/mmn c Device name Device type Major number Minor number Host$ ls -l /dev/mmn crw-r--r-- 1 root root 123, 3 Jul /dev/mmn 47

48 Driver Methods For more detail, please refer to the following information and book. Linux Device Driver 3 rd 48

49 Introduction The Role of Driver Device Driver Concepts Driver Methods Module Utilities Module Build Infrastructure Lab 49 49

50 Method Utilities A number of small utilities are used to manage device driver modules.(just for user space) Module Utilities are used to manage the insertion, removal, and listing of device driver modules. We covered the details of the module utilities used for these functions. insmod lsmod modprobe depmod rmmod modinfo 50

51 Method Utilities Insmod The insmod utility is the simplest way to insert a module into a running kernel. You supply a complete pathname, and insmod does the work. Example:How to loads the module hello1.ko into the kernel. Host$ insmod /lib/modules/2.6.14/driver/examples/hello1.ko Many device driver modules can accept parameters to modify their behavior Examples include enabling debug mode, setting verbose reporting, or specifying module-specific options. The insmod utility accepts parameters 51

52 Method Utilities Insmod /* Example Minimal Character Device Driver */ #include <linux/module.h> static int debug_enable = 0; /* Added driver parameter */ module_param(debug_enable, int, 0); /* and these 2 lines */ MODULE_PARM_DESC(debug_enable, "Enable module debug mode."); static int init hello_init(void) static void exit hello_exit(void) module_init(hello_init); module_exit(hello_exit); MODULE_AUTHOR("Chris Hallinan"); MODULE_DESCRIPTION("Hello World Example"); MODULE_LICENSE("GPL"); Driver module code use insmod to insert our example module, and add the debug_enable option Host$ insmod /lib/modules/.../examples/hello1.ko debug_enable=1 Hello Example Init - debug mode is enabled Or, if we omit the optional module parameter: Host$ insmod /lib/modules/.../examples/hello1.ko Hello Example Init - debug mode is disabled 52

53 Method Utilities lsmod The lsmod utility is also quite trivial. It simply displays a formatted list of the modules that are inserted into the kernel Host$ lsmod Module Size Used by ext jbd ext3 loop mmn

54 Method Utilities modprobe The A module depends on the B module. The modprobe utility can discover this relationship and load the dependent modules in the proper order. The following command loads both the A.ko and B.ko driver modules: Host$ modprobe A modprobe can be used to remove modules, use parameter -r Host$ modprobe r A The modprobe utility is driven by a configuration file called modprobe.conf. This enables a system developer to associate devices with device drivers 54

55 Method Utilities depmod The depmod utility plays a key role in this process. When modprobe is executed, it searches for a file called modules.dep in the same location where the modules are installed. The depmod utility creates this module-dependency modules.dep contains a list of all the modules that the kernel build system is configured for, along with dependency information for each. It is a simple file format modules.dep is located on /lib/module/2.6.xxxx 55

56 Method Utilities rmmod This utility is also quite trivial. It simply removes a module from a running kernel It should be noted that, unlike modprobe, rmmod does not remove dependent modules. Use modprobe -r for this. Host$ rmmod hello1 Hello Example Exit 56

57 Method Utilities modinfo Modules information contain full filename of the device driver module, author, and license information These are simply tags for use by the module utilities and do not affect the behavior of the device driver itself Host$ modinfo mmn filename: /lib/modules/.../char/examples/mmn.ko author: madraziw description: MMN lab say Hello World Example license: GPL vermagic: ARMv7 gcc-3.4 Depends:parm: debug_enable:enable module debug mode. (int) Host$ 57

58 Introduction The Role of Driver Device Driver Concepts Driver Methods Module Utilities Module Build Infrastructure Lab 58

59 Module Build Infrastructure A device driver must be compiled against the kernel on which it will execute. Although it is possible to load and execute kernel modules built against a different kernel version. The easiest way to do this is to build the module within the kernel's own source tree. This ensures that as the developer changes the kernel configuration, his custom driver is automatically rebuilt with the correct kernel configuration. It is certainly possible to build your drivers outside of the kernel source tree. When start lab time, we will describe more detail information 59

60 Introduction The Role of Driver Device Driver Concepts Driver Methods Module Utilities Module Build Infrastructure Lab 60 60

61 Lab Lab Purpose Learn how to write application program in the user space and kernel module program in the kernel space and control LED harware on the DevKit8000 led_dev.c The led driver, must be added in kernel source, and built in module type. led_test.c The led user-space program, you can type command to control led. 61

62 Lab LED Driver Edit led_dev.c in kernel source tree {source}/driver/misc/leddev.c Edit Makefile in misc folder {source}/driver/misc/makefile Edit Kconfig in misc folder {source}/driver/misc/kconfig kconfig Prototype Config tristate or bool depend on default y:built in m:module n:no select. 62

63 Lab kconfig config LEDDEV tristate LED Driver default n. 63

64 Lab - Makefile obj$(config_leddev) += leddev.o. 64

65 Lab led_dev.c Lab blank 1 Fill the correct memory address Lab blank 2 Register the device number use MINOR function The input parameter is the major/minor number data structure in inode. Lab blank 3 gpio_fops, you must point to the mapping function. Lab blank 4 gpio_dev, fill the correct file_operation data structure.. 65

66 Blank 1 & 2 The Control Register Address Get device number use MINOR function 66

67 Blank 3 & 4 gpio_fops data structure gpio_dev data structure 67

68 Lab led_test.c The user-space control program Fill the blank, to open the correct device file in /dev/xxx Use arm-none-linux-gnueabi-gcc to compile this program arm-none-linux-gnueabi-gcc led_test.c o led_test. 68

69 Lab step 1. Back to source folder 2. Host$ cp arch/arm/configs/omap3_devkit8000_defconfig.config 3. Host$ make menuconfig 4. Host$ make 5. Host$ make uimage 6. Find led_dev.ko in {source}/ drivers/misc folder and uimage in {source}/arch/arm/boot 7. Copy led_dev.ko led_test uimage to your SDcard 9. Boot the linux on devkit

70 Lab Make menuconfig Device Driver -> Misc devices -> <M> LED Driver. 70

71 Lab Traget$ Ismod led_dev.ko Check /dev/ledcontrol exist or not. 71

72 Lab Let us execute and see result Target$./led_test 2 on Target$./led_test 2 off Target$./led_test 3 on Target$./led_test 3 off. 72

73 Lab Appendix OMAP3530 Hardware Block. 73

74 Lab Appendix GPIO Block Overview. 74

75 Lab Appendix GPIO_OE. 75

76 Lab Appendix GPIO_DATAOUT. 76

77 Lab Appendix GPIO_SETDATAOUT. 77

78 Lab Appendix GPIO_CLEARDATAOUT. 78

Linux Device Drivers

Linux Device Drivers Linux Device Drivers Modules A piece of code that can be added to the kernel at runtime is called a module A device driver is one kind of module Each module is made up of object code that can be dynamically

More information

Character Device Drivers

Character Device Drivers Character Device Drivers 張大緯 CSIE, NCKU The information on the slides are from Linux Device Drivers, Third Edition, by Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman. Copyright 2005 O Reilly

More information

Linux Device Drivers. 3. Char Drivers. 1. Introduction 2. Kernel Modules 3. Char Drivers 4. Advanced Char Drivers 5. Interrupts

Linux Device Drivers. 3. Char Drivers. 1. Introduction 2. Kernel Modules 3. Char Drivers 4. Advanced Char Drivers 5. Interrupts Linux Device Drivers Dr. Wolfgang Koch Friedrich Schiller University Jena Department of Mathematics and Computer Science Jena, Germany wolfgang.koch@uni-jena.de Linux Device Drivers 1. Introduction 2.

More information

Linux Kernel Modules & Device Drivers April 9, 2012

Linux Kernel Modules & Device Drivers April 9, 2012 Linux Kernel Modules & Device Drivers April 9, 2012 Pacific University 1 Resources Linux Device Drivers,3rd Edition, Corbet, Rubini, Kroah- Hartman; O'Reilly kernel 2.6.10 we will use 3.1.9 The current

More information

Kernel Modules. Kartik Gopalan

Kernel Modules. Kartik Gopalan Kernel Modules Kartik Gopalan Kernel Modules Allow code to be added to the kernel, dynamically Only those modules that are needed are loaded. Unload when no longer required - frees up memory and other

More information

Finish up OS topics Group plans

Finish up OS topics Group plans Finish up OS topics Group plans Today Finish up and review Linux device driver stuff Walk example again See how it all goes together Discuss talking to MMIO RTOS (on board) Deferred interrupts Discussion

More information

The device driver (DD) implements these user functions, which translate system calls into device-specific operations that act on real hardware

The device driver (DD) implements these user functions, which translate system calls into device-specific operations that act on real hardware Introduction (Linux Device Drivers, 3rd Edition (www.makelinux.net/ldd3)) Device Drivers -> DD They are a well defined programming interface between the applications and the actual hardware They hide completely

More information

Unix (Linux) Device Drivers

Unix (Linux) Device Drivers Unix (Linux) Device Drivers Kernel module that handles the interaction with an specific hardware device, hiding its operational details behind a common interface Three basic categories Character Block

More information

Step Motor. Step Motor Device Driver. Step Motor. Step Motor (2) Step Motor. Step Motor. source. open loop,

Step Motor. Step Motor Device Driver. Step Motor. Step Motor (2) Step Motor. Step Motor. source. open loop, Step Motor Device Driver Step Motor Step Motor Step Motor source Embedded System Lab. II Embedded System Lab. II 2 Step Motor (2) open loop, : : Pulse, Pulse,, -, +5%, step,, Step Motor Step Motor ( ),

More information

Introduction Reading Writing scull. Linux Device Drivers - char driver

Introduction Reading Writing scull. Linux Device Drivers - char driver Overview 1 2 3 4 Major, minor File Operations The file Structure The inode structure Registraction simplest driver, suitable for most simple devices, follow the book. Jernej Figure: Vičič. (Simple Character

More information

CS5460/6460: Operating Systems. Lecture 24: Device drivers. Anton Burtsev April, 2014

CS5460/6460: Operating Systems. Lecture 24: Device drivers. Anton Burtsev April, 2014 CS5460/6460: Operating Systems Lecture 24: Device drivers Anton Burtsev April, 2014 Device drivers Conceptually Implement interface to hardware Expose some high-level interface to the kernel or applications

More information

CS 423 Operating System Design: Introduction to Linux Kernel Programming (MP1 Q&A)

CS 423 Operating System Design: Introduction to Linux Kernel Programming (MP1 Q&A) CS 423 Operating System Design: Introduction to Linux Kernel Programming (MP1 Q&A) Professor Adam Bates Fall 2018 Learning Objectives: Talk about the relevant skills required in MP1 Announcements: MP1

More information

REVISION HISTORY NUMBER DATE DESCRIPTION NAME

REVISION HISTORY NUMBER DATE DESCRIPTION NAME i ii REVISION HISTORY NUMBER DATE DESCRIPTION NAME iii Contents 1 The structure of a Linux kernel module 1 1.1 Install XV6...................................................... 1 1.2 Compile and load a

More information

Virtual File System (VFS) Implementation in Linux. Tushar B. Kute,

Virtual File System (VFS) Implementation in Linux. Tushar B. Kute, Virtual File System (VFS) Implementation in Linux Tushar B. Kute, http://tusharkute.com Virtual File System The Linux kernel implements the concept of Virtual File System (VFS, originally Virtual Filesystem

More information

Linux Device Driver. Analog/Digital Signal Interfacing

Linux Device Driver. Analog/Digital Signal Interfacing Linux Device Driver Analog/Digital Signal Interfacing User Program & Kernel Interface Loadable Kernel Module(LKM) A new kernel module can be added on the fly (while OS is still running) LKMs are often

More information

Linux Device Drivers. 3. Char Drivers cont. 3. Char Drivers. 1. Introduction 2. Kernel Modules 3. Char Drivers 4. Advanced Char Drivers 5.

Linux Device Drivers. 3. Char Drivers cont. 3. Char Drivers. 1. Introduction 2. Kernel Modules 3. Char Drivers 4. Advanced Char Drivers 5. Linux Device Drivers Dr. Wolfgang Koch Friedrich Schiller University Jena Department of Mathematics and Computer Science Jena, Germany wolfgang.koch@uni-jena.de Linux Device Drivers 1. Introduction 2.

More information

Designing and developing device drivers. Coding drivers

Designing and developing device drivers. Coding drivers Designing and developing device drivers Coding drivers Registering a driver 2 calls to register a driver defined in int register_chrdev_region(dev_t first, unsigned int count, char *name);

More information

USB. Development of a USB device driver working on Linux and Control Interface. Takeshi Fukutani, Shoji Kodani and Tomokazu Takahashi

USB. Development of a USB device driver working on Linux and Control Interface. Takeshi Fukutani, Shoji Kodani and Tomokazu Takahashi Linux USB Development of a USB device driver working on Linux and Control Interface Takeshi Fukutani, Shoji Kodani and Tomokazu Takahashi Recently, it s becoming more popular to utilize Linux for controlling

More information

7.4 Simple example of Linux drivers

7.4 Simple example of Linux drivers 407 7.4 Simple example of Linux drivers In the previous section, we introduce a simple Hello module driver, it is just some information from the serial port output, the board did not correspond to the

More information

Software Layers. Device Drivers 4/15/2013. User

Software Layers. Device Drivers 4/15/2013. User Software Layers Device Drivers User-level I/O software & libraries Device-independent OS software Device drivers Interrupt handlers Hardware User Operating system (kernel) Abstraction via the OS Device

More information

Linux Kernel Module Programming. Tushar B. Kute,

Linux Kernel Module Programming. Tushar B. Kute, Linux Kernel Module Programming Tushar B. Kute, http://tusharkute.com Kernel Modules Kernel modules are piece of code, that can be loaded and unloaded from kernel on demand. Kernel modules offers an easy

More information

MP3: VIRTUAL MEMORY PAGE FAULT MEASUREMENT

MP3: VIRTUAL MEMORY PAGE FAULT MEASUREMENT MP3: VIRTUAL MEMORY PAGE FAULT MEASUREMENT University of Illinois at Urbana-Champaign Department of Computer Science CS423 Fall 2011 Keun Soo Yim GOAL A Linux kernel module to profile VM system events

More information

/dev/hello_world: A Simple Introduction to Device Drivers under Linux

/dev/hello_world: A Simple Introduction to Device Drivers under Linux Published on Linux DevCenter (http://www.linuxdevcenter.com/) See this if you're having trouble printing code examples /dev/hello_world: A Simple Introduction to Device Drivers under Linux by Valerie Henson

More information

What is a Linux Device Driver? Kevin Dankwardt, Ph.D. VP Technology Open Source Careers

What is a Linux Device Driver? Kevin Dankwardt, Ph.D. VP Technology Open Source Careers What is a Linux Device Driver? Kevin Dankwardt, Ph.D. VP Technology Open Source Careers kdankwardt@oscareers.com What does a driver do? Provides a more convenient interface to user-space for the hardware.

More information

7.3 Simplest module for embedded Linux drivers

7.3 Simplest module for embedded Linux drivers 401 7.3 Simplest module for embedded Linux drivers Section 7.1 introduce a simple Linux program Hello World, which is run in user mode applications, we now introduce a run in kernel mode Hello World program,

More information

Device Drivers. CS449 Fall 2017

Device Drivers. CS449 Fall 2017 Device Drivers CS449 Fall 2017 Software Layers User-level I/O so7ware & libraries Device-independent OS so7ware Device drivers Interrupt handlers User OperaEng system (kernel) Hardware Device Drivers User

More information

Linux drivers - Exercise

Linux drivers - Exercise Embedded Realtime Software Linux drivers - Exercise Scope Keywords Prerequisites Contact Learn how to implement a device driver for the Linux OS. Linux, driver Linux basic knowledges Roberto Bucher, roberto.bucher@supsi.ch

More information

Linux Device Drivers IOCTL. March 15, 2018

Linux Device Drivers IOCTL. March 15, 2018 March 15, 2018 Overview Introduction ioctl system call. ioctl short for: Input Output ConTroL, shared interface for devices, Description of ioctl devices are presented with files, input and output devices,

More information

Scrivere device driver su Linux. Better Embedded 2012 Andrea Righi

Scrivere device driver su Linux. Better Embedded 2012 Andrea Righi Scrivere device driver su Linux Agenda Overview Kernel-space vs user-space programming Hello, world! kernel module Writing a character device driver Example(s) Q/A Overview What's a kernel? The kernel

More information

Abstraction via the OS. Device Drivers. Software Layers. Device Drivers. Types of Devices. Mechanism vs. Policy. Jonathan Misurda

Abstraction via the OS. Device Drivers. Software Layers. Device Drivers. Types of Devices. Mechanism vs. Policy. Jonathan Misurda Abstraction via the OS Device Drivers Jonathan Misurda jmisurda@cs.pitt.edu Software Layers level I/O software & libraries Device independent OS software Device drivers Interrupt handlers Hardware Operating

More information

CS 378 (Spring 2003)

CS 378 (Spring 2003) Department of Computer Sciences THE UNIVERSITY OF TEXAS AT AUSTIN CS 378 (Spring 2003) Linux Kernel Programming Yongguang Zhang (ygz@cs.utexas.edu) Copyright 2003, Yongguang Zhang This Lecture Device Driver

More information

Loadable Kernel Module

Loadable Kernel Module Instituto Superior de Engenharia do Porto Mestrado em Engenharia Eletrotécnica e de Computadores Arquitetura de Computadores Loadable Kernel Module The objective of this lesson is to analyze, compile and

More information

Introduction to Operating Systems. Device Drivers. John Franco. Dept. of Electrical Engineering and Computing Systems University of Cincinnati

Introduction to Operating Systems. Device Drivers. John Franco. Dept. of Electrical Engineering and Computing Systems University of Cincinnati Introduction to Operating Systems Device Drivers John Franco Dept. of Electrical Engineering and Computing Systems University of Cincinnati Basic Computer Architecture CPU Main Memory System Bus Channel

More information

Operating systems for embedded systems

Operating systems for embedded systems Operating systems for embedded systems Embedded operating systems How do they differ from desktop operating systems? Programming model Process-based Event-based How is concurrency handled? How are resource

More information

Linux Device Driver in Action (LDDiA)

Linux Device Driver in Action (LDDiA) Linux Device Driver in Action (LDDiA) Duy-Ky Nguyen 2015-04-30 1. On Memory Any unit under user control must have a controller board (CB) with a controller unit (CU) and several devices (Dev.x) doing what

More information

Workspace for '5-linux' Page 1 (row 1, column 1)

Workspace for '5-linux' Page 1 (row 1, column 1) Workspace for '5-linux' Page 1 (row 1, column 1) Workspace for '5-linux' Page 2 (row 2, column 1) ECEN 449 Microprocessor System Design Introduction to Linux 1 Objectives of this Lecture Unit Learn basics

More information

Character Device Drivers One Module - Multiple Devices

Character Device Drivers One Module - Multiple Devices Review from previous classes Three Types: Block, Character, and Network Interface Device Drivers MAJOR & MINOR numbers assigned register_chrdev_region(), alloc_chrdev_region(), unregister_chrdev_region()

More information

we are here Page 1 Recall: How do we Hide I/O Latency? I/O & Storage Layers Recall: C Low level I/O

we are here Page 1 Recall: How do we Hide I/O Latency? I/O & Storage Layers Recall: C Low level I/O CS162 Operating Systems and Systems Programming Lecture 18 Systems October 30 th, 2017 Prof. Anthony D. Joseph http://cs162.eecs.berkeley.edu Recall: How do we Hide I/O Latency? Blocking Interface: Wait

More information

Advanced Operating Systems #13

Advanced Operating Systems #13 http://www.pf.is.s.u-tokyo.ac.jp/class.html Advanced Operating Systems #13 Shinpei Kato Associate Professor Department of Computer Science Graduate School of Information Science and Technology

More information

Operating systems for embedded systems. Embedded Operating Systems

Operating systems for embedded systems. Embedded Operating Systems Operating systems for embedded systems Embedded operating systems How do they differ from desktop operating systems? Programming model Process-based Event-based How is concurrency handled? How are resource

More information

NPTEL Course Jan K. Gopinath Indian Institute of Science

NPTEL Course Jan K. Gopinath Indian Institute of Science Storage Systems NPTEL Course Jan 2012 (Lecture 17) K. Gopinath Indian Institute of Science Accessing Devices/Device Driver Many ways to access devices under linux Non-block based devices ( char ) - stream

More information

Hi Hsiao-Lung Chan, Ph.D. Dept Electrical Engineering Chang Gung University, Taiwan

Hi Hsiao-Lung Chan, Ph.D. Dept Electrical Engineering Chang Gung University, Taiwan Lab: LED Control Hi Hsiao-Lung Chan, Ph.D. Dept Electrical Engineering Chang Gung University, Taiwan chanhl@maili.cgu.edu.twcgu LED control Controlled by I/O ports of GPJ3_0 and GPJ3_1 Control register:

More information

Linux Loadable Kernel Modules (LKM)

Linux Loadable Kernel Modules (LKM) Device Driver Linux Loadable Kernel Modules (LKM) A way dynamically ADD code to the Linux kernel LKM is usually used for dynamically add device drivers filesystem drivers system calls network drivers executable

More information

The Embedded I/O Company TIP700-SW-82 Linux Device Driver User Manual TEWS TECHNOLOGIES GmbH TEWS TECHNOLOGIES LLC

The Embedded I/O Company TIP700-SW-82 Linux Device Driver User Manual TEWS TECHNOLOGIES GmbH TEWS TECHNOLOGIES LLC The Embedded I/O Company TIP700-SW-82 Linux Device Driver Digital Output 24V DC Version 1.2.x User Manual Issue 1.2.1 February 2009 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 Phone: +49 (0) 4101 4058 0 25469

More information

System Call. Preview. System Call. System Call. System Call 9/7/2018

System Call. Preview. System Call. System Call. System Call 9/7/2018 Preview Operating System Structure Monolithic Layered System Microkernel Virtual Machine Process Management Process Models Process Creation Process Termination Process State Process Implementation Operating

More information

Operating System Concepts Ch. 11: File System Implementation

Operating System Concepts Ch. 11: File System Implementation Operating System Concepts Ch. 11: File System Implementation Silberschatz, Galvin & Gagne Introduction When thinking about file system implementation in Operating Systems, it is important to realize the

More information

Kernel Internals. Course Duration: 5 days. Pre-Requisites : Course Objective: Course Outline

Kernel Internals. Course Duration: 5 days. Pre-Requisites : Course Objective: Course Outline Course Duration: 5 days Pre-Requisites : Good C programming skills. Required knowledge Linux as a User Course Objective: To get Kernel and User Space of Linux and related programming Linux Advance Programming

More information

CMPS 105 Systems Programming. Prof. Darrell Long E2.371

CMPS 105 Systems Programming. Prof. Darrell Long E2.371 + CMPS 105 Systems Programming Prof. Darrell Long E2.371 darrell@ucsc.edu + Chapter 3: File I/O 2 + File I/O 3 n What attributes do files need? n Data storage n Byte stream n Named n Non-volatile n Shared

More information

Final Step #7. Memory mapping For Sunday 15/05 23h59

Final Step #7. Memory mapping For Sunday 15/05 23h59 Final Step #7 Memory mapping For Sunday 15/05 23h59 Remove the packet content print in the rx_handler rx_handler shall not print the first X bytes of the packet anymore nor any per-packet message This

More information

we are here I/O & Storage Layers Recall: C Low level I/O Recall: C Low Level Operations CS162 Operating Systems and Systems Programming Lecture 18

we are here I/O & Storage Layers Recall: C Low level I/O Recall: C Low Level Operations CS162 Operating Systems and Systems Programming Lecture 18 I/O & Storage Layers CS162 Operating Systems and Systems Programming Lecture 18 Systems April 2 nd, 2018 Profs. Anthony D. Joseph & Jonathan Ragan-Kelley http://cs162.eecs.berkeley.edu Application / Service

More information

PMON Module An Example of Writing Kernel Module Code for Debian 2.6 on Genesi Pegasos II

PMON Module An Example of Writing Kernel Module Code for Debian 2.6 on Genesi Pegasos II Freescale Semiconductor Application Note AN2744 Rev. 1, 12/2004 PMON Module An Example of Writing Kernel Module Code for Debian 2.6 on Genesi Pegasos II by Maurie Ommerman CPD Applications Freescale Semiconductor,

More information

TIP675-SW-82. Linux Device Driver. 48 TTL I/O Lines with Interrupts Version 1.2.x. User Manual. Issue November 2013

TIP675-SW-82. Linux Device Driver. 48 TTL I/O Lines with Interrupts Version 1.2.x. User Manual. Issue November 2013 The Embedded I/O Company TIP675-SW-82 Linux Device Driver 48 TTL I/O Lines with Interrupts Version 1.2.x User Manual Issue 1.2.5 November 2013 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 25469 Halstenbek, Germany

More information

Design and Implementation of an Asymmetric Multiprocessor Environment Within an SMP System. Roberto Mijat, ARM Santa Clara, October 2, 2007

Design and Implementation of an Asymmetric Multiprocessor Environment Within an SMP System. Roberto Mijat, ARM Santa Clara, October 2, 2007 Design and Implementation of an Asymmetric Multiprocessor Environment Within an SMP System Roberto Mijat, ARM Santa Clara, October 2, 2007 1 Agenda Design Principle ARM11 MPCore TM overview System s considerations

More information

CPSC 8220 FINAL EXAM, SPRING 2016

CPSC 8220 FINAL EXAM, SPRING 2016 CPSC 8220 FINAL EXAM, SPRING 2016 NAME: Questions are short answer and multiple choice. For each of the multiple choice questions, put a CIRCLE around the letter of the ONE correct answer. Make sure that

More information

Fall 2017 :: CSE 306. File Systems Basics. Nima Honarmand

Fall 2017 :: CSE 306. File Systems Basics. Nima Honarmand File Systems Basics Nima Honarmand File and inode File: user-level abstraction of storage (and other) devices Sequence of bytes inode: internal OS data structure representing a file inode stands for index

More information

CSC369 Lecture 2. Larry Zhang

CSC369 Lecture 2. Larry Zhang CSC369 Lecture 2 Larry Zhang 1 Announcements Lecture slides Midterm timing issue Assignment 1 will be out soon! Start early, and ask questions. We will have bonus for groups that finish early. 2 Assignment

More information

CS 453: Operating Systems Programming Project 5 (100 points) Linux Device Driver

CS 453: Operating Systems Programming Project 5 (100 points) Linux Device Driver CS 453: Operating Systems Programming Project 5 (100 points) Linux Device Driver 1 Setup In this assignment, we will write a simple character driver called booga. Please do a git pull --rebase in your

More information

Simple char driver. for Linux. my_first.c: headers. my_first.c: file structure. Calcolatori Elettronici e Sistemi Operativi.

Simple char driver. for Linux. my_first.c: headers. my_first.c: file structure. Calcolatori Elettronici e Sistemi Operativi. Calcolatori Elettronici e Sistemi Operativi Simple char driver Simple char driver for Linux Code organization my_first.c driver code: Headers Macro definitions Device structure definition Globals and module

More information

Files and the Filesystems. Linux Files

Files and the Filesystems. Linux Files Files and the Filesystems Linux Files The file is the most basic and fundamental abstraction in Linux. Linux follows the everything-is-a-file philosophy. Consequently, much interaction occurs via reading

More information

Files. Eric McCreath

Files. Eric McCreath Files Eric McCreath 2 What is a file? Information used by a computer system may be stored on a variety of storage mediums (magnetic disks, magnetic tapes, optical disks, flash disks etc). However, as a

More information

Section 3: File I/O, JSON, Generics. Meghan Cowan

Section 3: File I/O, JSON, Generics. Meghan Cowan Section 3: File I/O, JSON, Generics Meghan Cowan POSIX Family of standards specified by the IEEE Maintains compatibility across variants of Unix-like OS Defines API and standards for basic I/O: file, terminal

More information

N720 OpenLinux Software User Guide Version 1.0

N720 OpenLinux Software User Guide Version 1.0 N720 Hardware User Guide () N720 OpenLinux Software User Guide Version 1.0 Copyright Copyright 2017 Neoway Technology Co., Ltd. All rights reserved. No part of this document may be reproduced or transmitted

More information

Loadable Kernel Modules

Loadable Kernel Modules Loadable Kernel Modules Kevin Dankwardt, Ph.D. kevin.dankwardt@gmail.com Topics 1. Why loadable kernel modules? 2. Using Modules 3. Writing modules 4. Compiling & Installing Modules 5. Example : Simple

More information

File Systems. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

File Systems. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University File Systems Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu SSE3044: Operating Systems, Fall 2016, Jinkyu Jeong (jinkyu@skku.edu) File System Layers

More information

CSE 333 SECTION 3. POSIX I/O Functions

CSE 333 SECTION 3. POSIX I/O Functions CSE 333 SECTION 3 POSIX I/O Functions Administrivia Questions (?) HW1 Due Tonight Exercise 7 due Monday (out later today) POSIX Portable Operating System Interface Family of standards specified by the

More information

CSCE 548 Building Secure Software Dirty COW Race Condition Attack

CSCE 548 Building Secure Software Dirty COW Race Condition Attack CSCE 548 Building Secure Software Dirty COW Race Condition Attack Professor Lisa Luo Spring 2018 Outline Dirty COW vulnerability Memory Mapping using mmap() Map_shared, Map_Private Mapping Read-Only Files

More information

N720 OpenLinux Software User Guide Version 1.2

N720 OpenLinux Software User Guide Version 1.2 N720 Hardware User Guide () N720 OpenLinux Software User Guide Version 1.2 Copyright Copyright 2017 Neoway Technology Co., Ltd. All rights reserved. No part of this document may be reproduced or transmitted

More information

Lecture 3. Introduction to Unix Systems Programming: Unix File I/O System Calls

Lecture 3. Introduction to Unix Systems Programming: Unix File I/O System Calls Lecture 3 Introduction to Unix Systems Programming: Unix File I/O System Calls 1 Unix File I/O 2 Unix System Calls System calls are low level functions the operating system makes available to applications

More information

I/O AND DEVICE HANDLING Operating Systems Design Euiseong Seo

I/O AND DEVICE HANDLING Operating Systems Design Euiseong Seo I/O AND DEVICE HANDLING 2016 Operating Systems Design Euiseong Seo (euiseong@skku.edu) I/O Hardware Incredible variety of I/O devices Common concepts Port Bus (daisy chain or shared direct access) Controller

More information

Parallel System Architectures 2016 Lab Assignment 1: Cache Coherency

Parallel System Architectures 2016 Lab Assignment 1: Cache Coherency Institute of Informatics Computer Systems Architecture Jun Xiao Simon Polstra Dr. Andy Pimentel September 1, 2016 Parallel System Architectures 2016 Lab Assignment 1: Cache Coherency Introduction In this

More information

CS 261 Fall C Introduction. Variables, Memory Model, Pointers, and Debugging. Mike Lam, Professor

CS 261 Fall C Introduction. Variables, Memory Model, Pointers, and Debugging. Mike Lam, Professor CS 261 Fall 2017 Mike Lam, Professor C Introduction Variables, Memory Model, Pointers, and Debugging The C Language Systems language originally developed for Unix Imperative, compiled language with static

More information

CS 0449 Project 4: /dev/rps Due: Friday, December 8, 2017, at 11:59pm

CS 0449 Project 4: /dev/rps Due: Friday, December 8, 2017, at 11:59pm CS 0449 Project 4: /dev/rps Due: Friday, December 8, 2017, at 11:59pm Project Description Standard UNIX and Linux systems come with a few special files like /dev/zero, which returns nothing but zeros when

More information

CARRIER-SW-82. Linux Device Driver. IPAC Carrier Version 2.2.x. User Manual. Issue November 2017

CARRIER-SW-82. Linux Device Driver. IPAC Carrier Version 2.2.x. User Manual. Issue November 2017 The Embedded I/O Company CARRIER-SW-82 Linux Device Driver IPAC Carrier Version 2.2.x User Manual Issue 2.2.0 November 2017 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 25469 Halstenbek, Germany Phone: +49 (0)

More information

Working with Kernel Modules Lab Wind River Systems, Inc

Working with Kernel Modules Lab Wind River Systems, Inc Working with Kernel Modules Lab 2013 Wind River Systems, Inc Working with Kernel Modules Lab Objective In this lab, you will learn how to manage kernel modules in your projects, as well as how to develop

More information

POSIX Shared Memory. Linux/UNIX IPC Programming. Outline. Michael Kerrisk, man7.org c 2017 November 2017

POSIX Shared Memory. Linux/UNIX IPC Programming. Outline. Michael Kerrisk, man7.org c 2017 November 2017 Linux/UNIX IPC Programming POSIX Shared Memory Michael Kerrisk, man7.org c 2017 mtk@man7.org November 2017 Outline 10 POSIX Shared Memory 10-1 10.1 Overview 10-3 10.2 Creating and opening shared memory

More information

Device Drivers Demystified ESC 117. Doug Abbott, Principal Consultant Intellimetrix. Why device drivers? What s a device driver?

Device Drivers Demystified ESC 117. Doug Abbott, Principal Consultant Intellimetrix. Why device drivers? What s a device driver? ESC 117, Principal Consultant Intellimetrix Outline Introduction Why device drivers? What s a device driver? Abstract model of device driver OS agnostic What makes drivers seem complicated? Independently

More information

Project #1 Exceptions and Simple System Calls

Project #1 Exceptions and Simple System Calls Project #1 Exceptions and Simple System Calls Introduction to Operating Systems Assigned: January 21, 2004 CSE421 Due: February 17, 2004 11:59:59 PM The first project is designed to further your understanding

More information

Kernel hacking su Android. Better Embedded Andrea Righi

Kernel hacking su Android. Better Embedded Andrea Righi Kernel hacking su Android Agenda Overview Android Programming Android Power Management Q/A Overview What is Android OS? Linux kernel Android patches Bionic libc Dalvik VM (Java Virtual Machine) Application

More information

Assignment 4 cpe 453 Fall 2018

Assignment 4 cpe 453 Fall 2018 Assignment 4 cpe 453 Fall 2018 Three may keep a secret, if two of them are dead. -- Benjamin Franklin /usr/games/fortune Due, to me, by 4:00pm (end of lab), Friday, November 16th. This assignment may be

More information

Embedded Linux. Session 4: Introduction to the GPIO Kernel API. Martin Aebersold BFH-TI Dipl. El.-Ing. FH.

Embedded Linux. Session 4: Introduction to the GPIO Kernel API. Martin Aebersold BFH-TI Dipl. El.-Ing. FH. Embedded Linux Session 4: Introduction to the GPIO Kernel API Martin Aebersold BFH-TI Dipl. El.-Ing. FH martin.aebersold@bfh.ch Dr. Franz Meyer BFH-TI Prof. em. Franz.Meyer@bfh.ch GPIO General Purpose

More information

Memory Mapping. Sarah Diesburg COP5641

Memory Mapping. Sarah Diesburg COP5641 Memory Mapping Sarah Diesburg COP5641 Memory Mapping Translation of address issued by some device (e.g., CPU or I/O device) to address sent out on memory bus (physical address) Mapping is performed by

More information

CSC369 Lecture 2. Larry Zhang, September 21, 2015

CSC369 Lecture 2. Larry Zhang, September 21, 2015 CSC369 Lecture 2 Larry Zhang, September 21, 2015 1 Volunteer note-taker needed by accessibility service see announcement on Piazza for details 2 Change to office hour to resolve conflict with CSC373 lecture

More information

ECEN 449: Microprocessor System Design Department of Electrical and Computer Engineering Texas A&M University

ECEN 449: Microprocessor System Design Department of Electrical and Computer Engineering Texas A&M University ECEN 449: Microprocessor System Design Department of Electrical and Computer Engineering Texas A&M University Prof. Sunil P. Khatri Lab exercise created and tested by: Abbas Fairouz, Ramu Endluri, He Zhou,

More information

Introduction p. 1 Why Linux? p. 2 Embedded Linux Today p. 3 Open Source and the GPL p. 3 Free Versus Freedom p. 4 Standards and Relevant Bodies p.

Introduction p. 1 Why Linux? p. 2 Embedded Linux Today p. 3 Open Source and the GPL p. 3 Free Versus Freedom p. 4 Standards and Relevant Bodies p. Foreword p. xix Preface p. xxi Acknowledgments p. xxvii About the Author p. xxix Introduction p. 1 Why Linux? p. 2 Embedded Linux Today p. 3 Open Source and the GPL p. 3 Free Versus Freedom p. 4 Standards

More information

CSE 333 SECTION 3. POSIX I/O Functions

CSE 333 SECTION 3. POSIX I/O Functions CSE 333 SECTION 3 POSIX I/O Functions Administrivia Questions (?) HW1 Due Tonight HW2 Due Thursday, July 19 th Midterm on Monday, July 23 th 10:50-11:50 in TBD (And regular exercises in between) POSIX

More information

CS2028 -UNIX INTERNALS

CS2028 -UNIX INTERNALS DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY,SIRUVACHUR-621113. CS2028 -UNIX INTERNALS PART B UNIT 1 1. Explain briefly details about History of UNIX operating system? In 1965, Bell Telephone

More information

Make Your Own Linux Module CS 444/544

Make Your Own Linux Module CS 444/544 Make Your Own Linux Module CS 444/544 Lab Preparation: Running VM! Download the image using - wget http://cslabs.clarkson.edu/oslab/syscall_lab.vdi! Applications -> Accessories-> VirtualBox! In Virtual

More information

TPMC860-SW-82. Linux Device Driver. 4 Channel Isolated Serial Interface RS232 Version 1.4.x. User Manual. Issue 1.4.

TPMC860-SW-82. Linux Device Driver. 4 Channel Isolated Serial Interface RS232 Version 1.4.x. User Manual. Issue 1.4. The Embedded I/O Company TPMC860-SW-82 Linux Device Driver 4 Channel Isolated Serial Interface RS232 Version 1.4.x User Manual Issue 1.4.4 December 2011 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 25469 Halstenbek,

More information

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University Che-Wei Chang chewei@mail.cgu.edu.tw Department of Computer Science and Information Engineering, Chang Gung University l Chapter 10: File System l Chapter 11: Implementing File-Systems l Chapter 12: Mass-Storage

More information

Rights to copy. Dongkun Shin, SKKU

Rights to copy. Dongkun Shin, SKKU Rights to copy Copyright 2004-2019, Bootlin License: Creative Commons Attribution - Share Alike 3.0 https://creativecommons.org/licenses/by-sa/3.0/legalcode You are free: to copy, distribute, display,

More information

OS lpr. www. nfsd gcc emacs ls 1/27/09. Process Management. CS 537 Lecture 3: Processes. Example OS in operation. Why Processes? Simplicity + Speed

OS lpr. www. nfsd gcc emacs ls 1/27/09. Process Management. CS 537 Lecture 3: Processes. Example OS in operation. Why Processes? Simplicity + Speed Process Management CS 537 Lecture 3: Processes Michael Swift This lecture begins a series of topics on processes, threads, and synchronization Today: processes and process management what are the OS units

More information

PFStat. Global notes

PFStat. Global notes PFStat Global notes Counts expand_stack returns in case of error, so the stack_low count needed to be inside transparent huge page, 2 cases : There is no PMD, we should create a transparent one (There

More information

SYSTEM CALL IMPLEMENTATION. CS124 Operating Systems Fall , Lecture 14

SYSTEM CALL IMPLEMENTATION. CS124 Operating Systems Fall , Lecture 14 SYSTEM CALL IMPLEMENTATION CS124 Operating Systems Fall 2017-2018, Lecture 14 2 User Processes and System Calls Previously stated that user applications interact with the kernel via system calls Typically

More information

Radix Tree, IDR APIs and their test suite. Rehas Sachdeva & Sandhya Bankar

Radix Tree, IDR APIs and their test suite. Rehas Sachdeva & Sandhya Bankar Radix Tree, IDR APIs and their test suite Rehas Sachdeva & Sandhya Bankar Introduction Outreachy intern Dec 2016-March 2017 for Linux kernel, mentored by Rik van Riel and Matthew Wilcox. 4th year undergrad

More information

Processes COMPSCI 386

Processes COMPSCI 386 Processes COMPSCI 386 Elements of a Process A process is a program in execution. Distinct processes may be created from the same program, but they are separate execution sequences. call stack heap STACK

More information

OS COMPONENTS OVERVIEW OF UNIX FILE I/O. CS124 Operating Systems Fall , Lecture 2

OS COMPONENTS OVERVIEW OF UNIX FILE I/O. CS124 Operating Systems Fall , Lecture 2 OS COMPONENTS OVERVIEW OF UNIX FILE I/O CS124 Operating Systems Fall 2017-2018, Lecture 2 2 Operating System Components (1) Common components of operating systems: Users: Want to solve problems by using

More information

Processes often need to communicate. CSCB09: Software Tools and Systems Programming. Solution: Pipes. Recall: I/O mechanisms in C

Processes often need to communicate. CSCB09: Software Tools and Systems Programming. Solution: Pipes. Recall: I/O mechanisms in C 2017-03-06 Processes often need to communicate CSCB09: Software Tools and Systems Programming E.g. consider a shell pipeline: ps wc l ps needs to send its output to wc E.g. the different worker processes

More information

University of Texas at Arlington. CSE Spring 2018 Operating Systems Project 4a - The /Proc File Systems and mmap. Instructor: Jia Rao

University of Texas at Arlington. CSE Spring 2018 Operating Systems Project 4a - The /Proc File Systems and mmap. Instructor: Jia Rao University of Texas at Arlington CSE 3320 - Spring 2018 Operating Systems Project 4a - The /Proc File Systems and mmap Instructor: Jia Rao Introduction Points Possible: 100 Handed out: Apr. 20, 2018 Due

More information

Chapter 12 IoT Projects Case Studies. Lesson-01: Introduction

Chapter 12 IoT Projects Case Studies. Lesson-01: Introduction Chapter 12 IoT Projects Case Studies Lesson-01: Introduction 1 1. Real Time Linux 2 Linux 2.6.x Linux known so after Linus Torvalds father of the Linux operating system Linux 2.6.x provides functions for

More information

Kprobes Presentation Overview

Kprobes Presentation Overview Kprobes Presentation Overview This talk is about how using the Linux kprobe kernel debugging API, may be used to subvert the kernels integrity by manipulating jprobes and kretprobes to patch the kernel.

More information