Here we take the IC card commonly used in public telephones as an example to illustrate the entire IC card device driver module through the implemented code.
(1) Determination of data structure
Edit the header file ICDATA.H to determine the common data structure used in the driver module program. The ultimate goal of the driver module is to read and write card data processing, so a standardized and neat data structure is necessary. You can define a data structure to implement the card data storage area, data address index, control flag, etc., such as:
In this way, in the driver module, only one statement, struct ICDATA iccdata, is needed to define all the card processing data structure definitions, and ic_fops defines the device operation mapping function structure. From this data structure, we have realized the opening, reading, writing and monitoring functions of the IC card device.
(2) Hardware interface control line control subfunction
These functions are used to control card reset, clock and other signals.
The above is one of the hardware control interface operation functions using the hardware system platform we developed as an example, which is used to control the reset signal of the IC card to 1. For different hardware platforms, the internal operation methods of the function are different. Other similar operation functions include:
(3) Implementation of module initialization function
The module initialization function is an essential processing function in the module development process, which is used to implement device initialization, interrupt initialization and processing, device registration, etc. In the above function, initicdata(&icdata) is first used to implement the initialization of card data, and then the queue data is defined. Then the interrupt processing function is bound, interrupt application and interrupt initialization are performed. Finally, the application of IC card character device is implemented. The device name is IC.
Previous article:Principle and software design of real-time clock device X1226
Next article:S3C825A single chip microcomputer structure and software design
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- I received the book on the basics of power supply design and I feel it is necessary to share it
- IEC61000-4-5 coupling mode
- Brushless servo, no Hall drive, electric vehicle controller (with Hall sine wave)
- [AT-START-F403A Review] 5. Simulate the SPI screen and find a problem
- [RT-Thread Reading Notes] RT-Thread Reading Notes Summary
- Build it yourself? Huawei is openly recruiting "lithography engineers"
- ST announces price increase
- [Smart Wardrobe] Material Unboxing ESP32-S3-BOX
- A valve is used in the water supply of the product. The valve is opened when water is used and closed when water is not used. How to measure the force of the opening and closing valve?
- Taiwan Sun Yat-sen University ASIC Laboratory Comprehensive Script Tutorial