Summary of the invention
Purpose of the present invention will solve the deficiency that above-mentioned technology exists just, and a kind of control method of control unit interface of automatic detection Wei root input is provided.
The present invention solves the technical scheme that its technical matters adopts: the control method of the control unit interface of this automatic detection Wei root input, the Wei root module is articulated on bus bridge, be connected with the kernel cpu signal by bus bridge, kernel CPU transmits a clock module to the Wei root module by bus bridge, divides to occur frequently by the WGIN pre-divider to supply the reference clock of Wei root module work; Be used for receiving two external GPIO mouths of external signal, be WGIN_DATA0, WGIN_DATA1, carry out data sampling through sampling clock, collect the data consistent with preset data length, it is the WGIN data length, it is stored in register WGINH_RESULT and WGINL_RESULT, produces an interruption this moment, this interrupts by interrupting enabling to control whether pass to kernel CPU.
Control method of the present invention, it is as follows that the client receives the Wiegand signal step by control unit interface:
Step 1: Wei root (WGIN) initialization:
1. configure the work clock of WGIN, write register WGIN_CLKDIV;
2. data receiver length is set, writes register WGIN_CTRL[7:1];
3. remove WGIN interrupt inquiry sign, write register WGIN_INTFLAG=1;
4. if configuration WGIN interrupts enabling, write register WGIN_CTRL[0]=1, do not enable write 0 if interrupt;
Step 2: Wei root (WGIN) receive interruption service:
1., produce in WGIN and have no progeny, remove the WGIN interrupt identification, prepares next WGIN interruption, write register WGIN-INTFLAG=1;
2., read WGIN result register WGINH_RESULT, WGINL_RESULT; Depositing in this register from read head and passing the complete Wiegand signal of coming.
The effect that the present invention is useful is: the characteristic that the present invention is directed to Wei root acknowledge(ment) signal has well solved above two drawbacks: hardware automatic reception Wei root level signal of the present invention, no longer need master routine to remove the level state of poll GPIO mouth, thereby the phenomenon of data can not occur losing, solve the drawback of inquiry mode.So hardware according to user's configuration, only produces once after receiving all data and interrupts, thereby can not interrupt frequently influencing the course, and has solved the drawback that adopts interrupt mode.
Embodiment
The invention will be further described below in conjunction with drawings and Examples:
Shown in please refer to the drawing 4, the Wei root module is articulated on bus bridge, thereby carries out the signal transmission with kernel CPU.Kernel CPU transmits a clock module to the Wei root module by bus bridge, divides to occur frequently through Wei root frequency divider (WGIN pre-divider) to supply the reference clock of Wei root module work.Two external GPIO mouth (WGIN_DATA0, WGIN_DATA1) receive external signal, carry out data sampling through sampling clock, collect the data consistent with preset data length (WGIN data length), it is stored in high 32 bit registers of register WGINH_RESULT(WGIN result) and low 32 bit registers of WGINL_RESULT(WGIN result) in, produce an interruption this moment, this interrupts by interrupting enabling to control whether pass to kernel CPU.
The user can realize by configuring some simple registers the reception of Wiegand signal.Register description is as follows:
Table 1 has been listed these register names, offset address, access mode and initial value etc.
Table 1WGIN register
Register name |
Offset address |
R/W |
Reset values |
Describe |
WGIN_CLKDIV |
0x00 |
r/w |
0x0a |
Clock sampling frequency division register |
WGIN_CTRL |
0X04 |
r/w |
0x00 |
Control register |
WGIN_INTFLAG |
0x08 |
r/w |
0x00 |
Interrupt identification/zero clearing register |
WGINH_RESULT |
0x0c |
r/w |
0x00 |
The high bit register of transformation result |
WGINL_RESULT |
0x10 |
r/w |
0x00 |
Transformation result is hanged down bit register |
WGIN clock sampling frequency division register (WGIN_CLKDIV):
WGIN clock sampling frequency division register (WGIN_CLKDIV) is determined sample frequency, and its definition sees Table 2.
Table 2WGIN_CLKDIV
Domain name |
The position |
R/W |
Reset values |
Describe |
-- |
31:16 |
-- |
-- |
Keep |
ClkDiv |
15:0 |
r/w |
0x0a |
WGIN clock division number, divider ratio are (WGINClkDiv+1) * 2 |
WGIN control register (WGIN_CTRL):
WGIN_CTRL is used for configuring the control signal of WGIN, describes and sees Table 3.
Table 3WGIN_CTRL
Domain name |
The position |
R/W |
Reset values |
Describe |
-- |
31:9 |
-- |
-- |
Keep |
Start |
8 |
r/w |
0x00 |
Write 1 and start receive data, |
Len |
7:1 |
r/w |
0x00 |
The receive data total length |
IntEn |
0 |
r/w |
0x00 |
Interrupt enable bit is write 1 and is enabled to interrupt |
WGIN interrupt identification/zero clearing register (WGIN_INTFLAG)
WGIN_INTFLAG sees Table 4, is used for reading the interrupt identification of WGIN, and removes the WGIN interrupt identification, and this register is write 1 zero clearing.
Table 4WGIN_INTFLAG
Domain name |
The position |
R/W |
Reset values |
Describe |
-- |
31:1 |
-- |
-- |
Keep |
IntFlag |
0 |
r/w |
0x00 |
Wiegand interrupt identification/zero clearing register |
WGIN transformation result register high 32 (WGINH_RESULT)
WGINH_RESULT sees Table 5, is WGIN transformation result register.In case the user detects or inquires interruption, the user just can read the transformation result (high 32) that this register obtains Wiegand.
Table 5WGINH_RESULT
Name |
Bits |
R/W |
Reset |
Description |
-- |
31:10 |
-- |
-- |
Reserved |
ResultH |
9:0 |
r |
0x00 |
WGIN?conversion?result |
WGIN transformation result register hangs down 32 (WGINL_RESULT)
WGINL_RESULT sees Table 6, if data length surpasses 32, remaining result exists in this register, is WGIN transformation result register.In case the user detects or inquire interruption, the user just can read the transformation result (low 32) that this register obtains Wiegand.
Table 6WGINL_RESULT
Name |
Bits |
R/W |
Reset |
Description |
-- |
31:10 |
-- |
-- |
Reserved |
ResultL |
9:0 |
r |
0x00 |
WGIN?conversion?result |
As Fig. 5, shown in Figure 6, it is as follows that the client receives the Wiegand signal step by this interface:
Step 1: Wei root (WGIN) initialization:
1. configure the work clock of WGIN, write register WGIN_CLKDIV
2. data receiver length is set, writes register WGIN_CTRL[7:1]
3. remove WGIN interrupt inquiry sign, write register WGIN_INTFLAG=1
4. if configuration WGIN interrupts enabling, write register WGIN_CTRL[0]=1, do not enable write 0 if interrupt
Step 2: Wei root (WGIN) receive interruption service
1., produce in WGIN and have no progeny, remove the WGIN interrupt identification, prepares next WGIN interruption, write register WGIN-INTFLAG=1;
2., read WGIN result register WGINH_RESULT, WGINL_RESULT; Depositing in this register from read head and passing the complete Wiegand signal of coming.
Characteristics of the present invention are as follows:
1. the input of Wei root can be passed through register configuration, to save the MEMORY space, reduces system resource;
2. hardware mode is guaranteed the accuracy of receive data;
3. greatly reduce interruption frequency, liberated MCU (Micro Control Unit micro-control unit resource) resource;
4.IP logic is simple, area is less, and cost is lower;
5. can pass through IP, compatible existing existing multiple Wei root input mode.
Terminological interpretation:
Gate control system:
Weigh up again into management control system (ACCESS CONTROL SYSTEM).It is a kind of intellectualized management system of managerial personnel's turnover.Summarize and be exactly: whom is managed when can pass in and out those doors, and provide inquiry form afterwards etc., common gate control system has: the password access system, the non-contact card gate control system, the general name of fingerprint iris palm type bio-identification gate control system etc., gate control system developed very fast in recent years, was widely used in management control system.
Read head:
Read head is exactly card reader, and (read goes out device, scanner, reader, communicator, read write line again) is the module for reading and writing in control system.The read head chip package is got up, mainly communicate by the modes such as Wei Gen or serial ports, IIC and controller, this has just formed simple control system.At present the kind of read head is a lot, mainly comprises three kinds of keyboard-type, induction type and bio-identification.
Door controller:
Door controller is the unidirectional turnover of door or the two-way turnover of door, according to high-performance gate inhibition's controller of technical grade technical requirement design.
MCU:
MCU (Micro Control Unit) Chinese is micro-control unit, claim again one chip microcomputer (Single Chip Microcomputer) or single-chip microcomputer, refer to appearance and development thereof along with large scale integrated circuit, with CPU, RAM, ROM, timer conter and the multiple I/O Interface integration of computing machine on a slice chip, form the computing machine of chip-scale, do various combination for different application scenarios and control.
The GPIO mouth:
This paper refers to the pin of MCU.
The external interrupt mode:
External interrupt mode herein refers to that the GPIO mouth of the MCU in door controller receives the terminal that the level signal sent from read head produces, and then the MCU of controller reads the level of this interruption.
The external inquiry mode:
External inquiry mode herein refers to that the continuous poll of MCU in door controller self is connected to the GPIO mouth signal of read head, as shown in Figure 1.
In addition to the implementation, the present invention can also have other embodiments.All employings are equal to the technical scheme of replacement or equivalent transformation formation, all drop on the protection domain of requirement of the present invention.