IC card device driver module code

Publisher:脑电狂徒Latest update time:2011-09-05 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Reference address:IC card device driver module code

Previous article:Principle and software design of real-time clock device X1226
Next article:S3C825A single chip microcomputer structure and software design

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号