V4L2框架

怎么写字符设备驱动? 构造file_operations: .open = drv_open .read = drv_read .write = drv_write 2.告诉内核: register_chrdev(主设备号,file_operations, name) 备注:主设备号可以写0,让系统自动分配 有的书不建议使用register_chrdev结构体:因为太老了。可以替换成如下步骤: step1: 分配cdev step2: 设置cdev step3: cdev_add 3.入口函数.:调用 register_chrdev 4.出口函数:调用 unregister_chrdev 对于复杂的字符设备驱动程序,引用分层概念 eg: LCD fbmem.c : 1.file_operations open/read/write 2.register_dev 3.入口和出口 只需要设置硬件相关: 1.分配fb_info 2.设置fb_info 3.注册 4.硬件相关的操作 总结: 怎么写分层驱动? 1.分配结构体 2.设置 3.注册 4.硬件相关操作 V4L2框架: APP: Open read write 核心层: V4l2-dev.c: 1.file_operaions 2.注册…

Leetcode: 9. Palindrome Number

Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome. Example 3:…

Leetcode:7. Reverse Integer

题目: Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 Note: Assume we are dealing with an environment which could only store integers within the 32-bit signed integer range:[-2^31, 2^31 -1]. For the purpose of this…

Leetcode:706. Design HashMap

题目: Design a HashMap without using any built-in hash table libraries. To be specific, your design should include these functions: put(key, value) : Insert a (key, value) pair into the HashMap. If the value already exists in the HashMap, update the value. get(key): Returns the value to which the specified key is mapped, or -1…

Leetcode:705. Design HashSet

题目: Design a HashSet without using any built-in hash table libraries. To be specific, your design should include these functions: add(value): Insert a value into the HashSet. contains(value) : Return whether the value exists in the HashSet or not. remove(value): Remove a value in the HashSet. If the value does not exist in the HashSet,…