Data management method and device of access control equipment, computer equipment and storage medium
By dividing the access control device into storage areas and reserved areas, and using discrete algorithms to optimize data storage and authentication, the problem of damage to Flash chips caused by repeated writing is solved, thereby improving the response efficiency and reliability of the device.
Patent Information
- Application Number
- CN202211435455.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-16
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2042-11-16
AI Technical Summary
When adding, modifying, or deleting credentials, the Flash chip of existing access control equipment is easily damaged due to the repeated writing of a large amount of credential data, which is especially noticeable in large projects or when there are many temporary visitors.
The Flash chip's storage space is divided into multiple storage areas and reserved areas. A discrete algorithm is used to determine the data storage location to avoid repeated writing to the same sector. The storage and authentication process is optimized through data cache RAM.
This reduces the number of times the Flash chip needs to be erased and rewritten, improves the response and authentication efficiency of access control devices, and reduces the device failure rate.
Smart Images

Figure CN115729469B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data storage, in particular to a data management method and device of an access control device, computer equipment and a storage medium. BACKGROUND
[0002] Early access control generally stores user data and permissions in IC card sectors, but this greatly limits the convenience of card loss, extension, and renewal operations, and users need to carry the card to the property management office for on-site operation.
[0003] With the development of information technology, the new generation of access control often uses a whitelist mode: storing user data, credential numbers, permissions, and other credential data on the access control device, which can achieve remote operation to complete card loss, extension, and renewal operations without the need to take the card to the site for operation.
[0004] The current storage and authentication hardware scheme of the access control device is generally composed of an MCU chip and a Flash chip. The user credential data stored in the access control device is generally stored in the Flash chip in the order of download. However, because the data is stored on the access control device, the access control device will perform an erase operation on the relevant area of the Flash chip before writing data when adding, modifying, or deleting credentials. When the access control device is applied to large projects or projects with many temporary visitors, repeated writing of a large amount of credential data to the same sector will cause the Flash chip to be damaged. SUMMARY
[0005] The purpose of the present application is to provide a data management method and device of an access control device, computer equipment and a storage medium, which aims to solve the problem that the repeated writing of a large amount of credential data to the Flash chip when adding, modifying, or deleting credentials in the existing access control device causes the Flash chip to be easily damaged.
[0006] In a first aspect, the present application provides a data management method of an access control device, comprising:
[0007] Dividing the storage space of the Flash chip to obtain a plurality of storage areas and at least one reserved area;
[0008] Planning a user data structure, wherein the user data structure includes a card serial number, user information, permission information, a valid period, verification data, and an identifier;
[0009] According to the discrete algorithm, the card serial number card_sn1 of the data to be stored this time is input, and the storage area where the data to be stored is stored is confirmed;
[0010] Judging whether there is a storable data area in the storage area to be stored;
[0011] if there is a storable data area in the storage area to be stored, writing the data to be stored into the storage area to be stored,
[0012] if there is no storable data area in the storage area to be stored, writing the data to be stored into the reserved area.
[0013] In a second aspect, an embodiment of the present application provides a data management device of an access control device, comprising:
[0014] a division unit configured to divide a storage space of a Flash chip to obtain a plurality of storage areas and at least one reserved area;
[0015] a planning unit configured to plan a user data structure, wherein the user data structure comprises a card serial number, user information, permission information, a validity period, verification data and an identifier;
[0016] a first finding unit configured to find, according to a discrete algorithm, a card serial number card_sn1 of data to be stored this time, and confirm the storage area to be stored of the data to be stored;
[0017] a first judging unit configured to judge whether there is a storable data area in the storage area to be stored;
[0018] a first storage unit configured to, if there is a storable data area in the storage area to be stored, write the data to be stored into the storage area to be stored,
[0019] a second storage unit configured to, if there is no storable data area in the storage area to be stored, write the data to be stored into the reserved area.
[0020] In a third aspect, an embodiment of the present application provides a computer device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the data management method of the access control device according to the first aspect when executing the computer program.
[0021] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program causes a processor to execute the data management method of the access control device according to the first aspect when the processor executes the computer program.
[0022] The embodiment of the application discloses a data management method and device of an access control equipment, computer equipment and a storage medium. The method comprises the following steps: dividing the storage space of a Flash chip to obtain a plurality of storage areas and at least one reserved area; planning a user data structure, wherein the user data structure comprises a card serial number, user information, permission information, a validity period, check data and an identifier; inputting the card serial number card_sn1 of the current data to be stored according to a discrete algorithm to determine the storage area in which the data to be stored will be stored; determining whether there is a storable data area in the storage area in which the data to be stored will be stored; if there is a storable data area in the storage area in which the data to be stored will be stored, writing the data to be stored into the storage area in which the data to be stored will be stored; and if there is no storable data area in the storage area in which the data to be stored will be stored, writing the data to be stored into the reserved area. The embodiment of the application can reduce the erasing and writing times of the same sector in the Flash chip by first dispersing the user data by using an algorithm and then storing the data in pieces. BRIEF DESCRIPTION OF DRAWINGS
[0023] In order to more clearly illustrate the technical solutions of the embodiments of the application, the following will briefly introduce the drawings needed to be used in the embodiment description. Obviously, the drawings in the following description are some embodiments of the application, and other drawings can also be obtained by those skilled in the art without any creative effort on the basis of these drawings.
[0024] Figure 1 The flowchart of the data management method of the access control equipment provided by the embodiment of the application is shown in the figure.
[0025] Figure 2 The sub-flowchart of the data management method of the access control equipment provided by the embodiment of the application is shown in the figure.
[0026] Figure 3 The sub-flowchart of the data management method of the access control equipment provided by the embodiment of the application is shown in the figure.
[0027] Figure 4 The sub-flowchart of the data management method of the access control equipment provided by the embodiment of the application is shown in the figure.
[0028] Figure 5 The sub-flowchart of the data management method of the access control equipment provided by the embodiment of the application is shown in the figure.
[0029] Figure 6 The schematic block diagram of the data management device of the access control equipment provided by the embodiment of the application is shown in the figure.
[0030] Figure 7 The schematic block diagram of the computer equipment provided by the embodiment of the application is shown in the figure. DETAILED DESCRIPTION
[0031] With reference to the drawings and the embodiments of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are only some of the embodiments of the present application, but not all of the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative efforts are within the scope of the present application.
[0032] It should be understood that the terms "comprise" and "include" as used in the specification and the appended claims indicate the presence of the described features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0033] It should also be understood that the terms used in the present application specification are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in the present application specification and the appended claims, the singular forms "a", "an" and "the" are intended to include the plural forms unless the context clearly indicates otherwise.
[0034] It should be further understood that the term "and / or" as used in the present application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.
[0035] In order to better understand the present application, first, the characteristics of the existing Flash chip are interpreted; the existing Flash chip is composed of sectors, and the number of sectors and the size of the sectors are different depending on the manufacturer and the model; it is assumed that the Flash chip has A sectors, and each sector has B bytes; the minimum unit of Flash erasing and Flash writing is a sector; Flash erasing: the process of changing Flash binary data from 0 to 1, Flash writing: the process of changing Flash binary data from 1 to 0. It is assumed that a certain Flash data is originally 0xFF, and when 0X00 is written successfully, the data returned when reading is 0x00; it is assumed that a certain Flash data is originally 0x00, and when 0xAA is written successfully, the data returned when reading is 0x00 instead of 0xAA, which means that if the correct storage is required, the erasing command should be used to clear the Flash data to 0xFF before writing 0xAA. Based on this characteristic of the Flash chip, the present application will be explained as follows.
[0036] Please refer to Figure 1 , Figure 1 The flowchart of the data management method of the access control device provided by the embodiments of the present application is shown in the figure.
[0037] As Figure 1As shown, the method comprises the data storage method of steps S101-S106.
[0038] S101, dividing the storage space of the Flash chip to obtain a plurality of storage areas and at least one reserved area;
[0039] In this step, the plurality of storage areas are divided into X according to the number, each storage area includes Y sectors, and each reserved area includes N sectors.
[0040] S102, planning a user data structure, wherein the user data structure includes a card serial number, user information, permission information, a valid period, verification data, and an identifier;
[0041] In this step, in order to facilitate the deletion and modification of subsequent data, when designing the user data storage structure, 1 byte of "identifier" is added at the tail of the user data structure. The "identifier" can reflect whether the user data is valid.
[0042] S103, according to the discrete algorithm, the card serial number card_sn1 of the data to be stored this time is input, and the storage area where the data to be stored is stored is confirmed;
[0043] S104, judging whether there is a storable data area in the storage area to be stored, if yes, entering step S105, if not, jumping to step S106;
[0044] S105, writing the data to be stored into the storage area to be stored,
[0045] S106, writing the data to be stored into the reserved area.
[0046] Steps S103-S106 are the process of storing user data. The discrete algorithm can randomly correspond the data to be stored this time to a storage area (X1 is taken as an example in this embodiment) for storage. If there is no storable data area in the storage area X1, the data is stored in the reserved area.
[0047] The discrete algorithm used in this embodiment can avoid the repeated writing of a large number of credential data into the same sector, thereby preventing the damage of the Flash chip.
[0048] The Flash chip of the embodiment is divided into X storage areas and at least one reserved area. When it is confirmed by the discrete algorithm that the to-be-stored data needs to be written into the storage area X1, only the sector data in the storage area X1 needs to be read, or when the read storage area X1 has no storable data area, only the sector data of a reserved area needs to be read. In this way, the number of read and write sectors can be reduced. The prior art needs to read all sectors in sequence when writing to-be-stored data, and then clear and write after reading the sector with a storable data area. This method is relatively wasteful of computing power and causes device response delay. The application effectively solves the problem and improves the response efficiency of the access control device.
[0049] In an embodiment, as shown in Figure 2 The method further includes the data authentication method of steps S201-S204.
[0050] S201, according to the discrete algorithm, the card serial number card_sn2 of the to-be-authenticated data is confirmed to be authenticated in the storage area of the to-be-authenticated data.
[0051] S202, it is judged whether the card serial number card_sn2 is stored in the storage area to be authenticated. If yes, go to step S203, if not, jump to step S204.
[0052] S203, read the user data corresponding to the card serial number card_sn2 in the storage area to be authenticated to determine the authority corresponding to the card serial number card_sn2.
[0053] S204, read the user data corresponding to the card serial number card_sn2 in the reserved area to determine the authority corresponding to the card serial number card_sn2.
[0054] In the embodiment, steps S201-S204 are the process of user data authentication, and the principle is the same as the above-mentioned user data storage method. When it is authenticated whether the card serial number card_sn2 is valid, the card serial number card_sn2 is input, the storage area corresponding to the to-be-authenticated data is confirmed (X2 is taken as an example below), then all user data of the storage area X2 is read and searched, and the corresponding user data is read to determine the authority. If the corresponding card serial number card_sn2 is not found in the storage area X2, it means that the user data corresponding to the card serial number card_sn2 is written in the reserved area, then all user data in the reserved area is read and searched, the user data corresponding to the card serial number card_sn2 is found, and the user information, authority information, validity period, check data and identification of the user data are read, and the authority is determined.
[0055] When the user data of the card serial number card_sn2 is authenticated, the slice area where the card serial number card_sn2 is located is calculated first, and then the slice area is searched, so that the number of comparisons is greatly reduced, and the authentication efficiency is greatly improved.
[0056] It can be understood that in the above data storage method and data authentication method, the read-write sector number of the to-be-stored data during storage and the read-write sector number of the to-be-authenticated data during authentication are both G=N+Y; and the read-write sector number of the prior art under the same Flash chip size is G'=N+X*Y; it can be seen that the present application greatly reduces the read-write computing power compared with the prior art.
[0057] In an embodiment, as shown in FIG. 10, step S105 includes: Figure 3
[0058] S301, acquiring the type of the storable data area in the to-be-stored storage slice area, wherein the type of the storable data area includes an idle data area without stored user data and an invalid data area with stored user data but identified as invalid;
[0059] S302, when the type of the storable data area is the idle data area, writing the to-be-stored data into the idle data area in the to-be-stored storage slice area, and writing the identification of the written to-be-stored data as valid;
[0060] S303, when the type of the storable data area is the invalid data area, first reading all user data of the to-be-stored storage slice area into the data cache RAM of the MCU chip, clearing all user data in the to-be-stored storage slice area, then clearing all user data in the invalid data area in the data cache RAM to obtain an idle data area, writing the to-be-stored data in the idle data area, and writing all user data in the data cache RAM into the cleared to-be-stored storage slice area.
[0061] The embodiment continues to introduce the storage slice area X1 as the stored storage slice area. The storage slice area X1 has two types of storage data area. One is the unused free data area (i.e. 0xFF), and the to-be-stored data can be directly written into the first free data area of 0xFF in the storage slice area X1, and the identification of the to-be-stored data is written as valid, so as to complete the writing. The writing method does not need to clear the sector, thereby reducing the number of sector clearances.
[0062] In an embodiment, as shown in FIG. 10, step S106 includes: Figure 4
[0063] S401, when there is no storage data area in the stored storage slice area;
[0064] S402, judging whether there is a storage data area in the reserved slice area, if yes, entering step S403, if not, jumping to step S404;
[0065] S403, writing the to-be-stored data into the storage data area of the reserved slice area;
[0066] S404, all storage slice areas and reserved slice areas are full, and the to-be-stored data cannot be written.
[0067] In the embodiment, if there is no storage data area in the stored storage slice area, the to-be-stored data is not written in the new storage slice area in sequence, but is directly written in the reserved slice area, which is the difference from the prior art. The embodiment only reads one storage slice area, and if the storage slice area has no storage data area, the to-be-stored data is directly written into the reserved slice area. If multiple reserved slice areas are designed, when one reserved slice area has no storage data area, the next reserved slice area is entered to write the to-be-stored data.
[0068] The embodiment continues to introduce the stored storage area as storage area X1. When the storage area X1 has a storable data area, the writing of the to-be-stored data is performed according to the steps S501-S503. When the storage area X1 has no storable data area, the writing of the next reserved area is entered. If all the reserved areas are full, the to-be-stored data cannot be written. The card serial number of the to-be-stored data can be dispersed to a new storage area for storage. If all the storage areas and the reserved areas are full, the to-be-stored data cannot be written.
[0069] In an embodiment, as shown in FIG. 4, the step S403 includes: Figure 5
[0070] S501, acquiring the type of the storable data area in the reserved area;
[0071] S502, when the storable data area in the reserved area is an idle data area, writing the to-be-stored data into the idle data area in the reserved area, and writing the identification of the to-be-stored data as valid.
[0072] S503, when the storable data area in the reserved area is an invalid data area, first reading all the user data of the reserved area into the data cache RAM of the MCU chip, and clearing all the user data of the reserved area, then clearing all the user data in the invalid data area in the data cache RAM to obtain an idle data area, writing the to-be-stored data into the idle data area, and writing all the user data in the data cache RAM into the cleared reserved area.
[0073] The embodiment writes the to-be-stored data into the reserved area by using the same principle as that of the above S301-S303. That is, the storable data area in the reserved area also has two types. One is an idle data area (0xFF) which is not used. The to-be-stored data can be directly written into the first idle data area with all 0XFF in the reserved area, and the identification of the to-be-stored data is written as valid, so that the writing is completed. This writing method does not need to clear the sectors, and the number of sector clearings is reduced. The other is an invalid data area. The user data in the reserved area is originally stored, but the user data is now invalid. The identification of the user data in the reserved area is invalid. The invalid data area can be used to store the to-be-stored data. The specific writing process is shown in step S503. The invalid data area in the reserved area is cleared to obtain an idle data area by using the data cache RAM. Then the to-be-stored data is written into the first idle data area with all 0XFF. Finally, all the user data in the data cache RAM is written into the cleared reserved area.
[0074] The following will be introduced and explained in combination with specific experimental data:
[0075] Based on typical access control application data, let the total number of bytes in a single sector be B = 4096, and the total number of bytes in a user's data be C = 80.
[0076] A comparison of existing solutions with the present invention for nominal user data capacities of 5000, 1000, 50000, and 100000 shows that the data storage and query bottlenecks of the original low-cost access control solution are effectively resolved by adopting the present invention. See Table 1 below:
[0077] Table 1
[0078]
[0079]
[0080] This invention also provides a data management device for access control equipment, which is used to execute any embodiment of the aforementioned data management method for access control equipment. Specifically, please refer to... Figure 6 , Figure 6 This is a schematic block diagram of the data management device for access control equipment provided in an embodiment of the present invention.
[0081] like Figure 6 As shown, the data management device 600 of the access control equipment includes a data storage module 610 and a data authentication module 620; the data storage module 610 includes: a partitioning unit 601, a planning unit 602, a first search unit 603, a first judgment unit 604, a first storage unit 605 and a second storage unit 606.
[0082] The partitioning unit 611 is used to partition the storage space of the Flash chip to obtain multiple storage areas and at least one reserved area;
[0083] Planning unit 612 is used to plan the user data structure, wherein the user data structure includes card serial number, user information, permission information, validity period, verification data and identifier;
[0084] The first lookup unit 613 is used to determine the storage area where the data to be stored will be stored by inputting the card serial number card_sn1 of the data to be stored in this discrete algorithm.
[0085] The first judgment unit 614 is used to determine whether there is a storable data area in the storage area to be stored;
[0086] The first storage unit 615 is used to write the data to be stored into the storage area to be stored if there is a storable data area within the storage area to be stored.
[0087] The second storage unit 616 is configured to write the data to be stored into the reserved slice area if there is no available data area in the stored slice area.
[0088] The data storage module 610 stores the data to be stored in a slice area according to a discrete algorithm, and stores the data to be stored into the reserved slice area if there is no available data area in the slice area. When writing the data to be stored, only the sector data in the corresponding slice area needs to be read, or when there is no available data area in the slice area, only the sector data in the reserved slice area needs to be read. In this way, the number of sectors to be read and written can be reduced.
[0089] In an embodiment, the data authentication module 620 includes a second searching unit 621, a second judging unit 622, a first authentication unit 623, and a second authentication unit 624.
[0090] The second searching unit 621 is configured to confirm the slice area to be authenticated according to the card serial number card_sn2 of the data to be authenticated.
[0091] The second judging unit 622 is configured to judge whether the slice area to be authenticated stores the card serial number card_sn2.
[0092] The first authentication unit 623 is configured to read the user data corresponding to the card serial number card_sn2 in the slice area to be authenticated to judge the permission corresponding to the card serial number card_sn2 if the card serial number card_sn2 is stored.
[0093] The second authentication unit 624 is configured to read the user data corresponding to the card serial number card_sn2 in the reserved slice area to judge the permission corresponding to the card serial number card_sn2 if the card serial number card_sn2 is not stored.
[0094] When performing credential authentication, the data authentication module 620 first calculates the slice area or the reserved slice area where the credential is located by using an algorithm, and then performs searching, which greatly reduces the number of comparisons and greatly improves the authentication efficiency.
[0095] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and units can refer to the corresponding processes in the foregoing method embodiments, which will not be described herein.
[0096] The data management device of the above-described access control device can be implemented in the form of a computer program, which can run on a computer device as shown in Figure 7 .
[0097] Please refer to Figure 7 .Figure 7 is a schematic block diagram of a computer device provided by an embodiment of the present application. The computer device 700 is a server, which can be a standalone server or a server cluster composed of multiple servers.
[0098] Referring to Figure 7 The computer device 700 includes a processor 702, a memory, and a network interface 705 connected through a system bus 701, wherein the memory can include a non-volatile storage medium 703 and an internal memory 704.
[0099] The non-volatile storage medium 703 can store an operating system 7031 and a computer program 7032. The computer program 7032, when executed, can cause the processor 702 to perform the data management method of the access control device.
[0100] The processor 702 is configured to provide computing and control capabilities to support the operation of the entire computer device 700.
[0101] The internal memory 704 provides an environment for the execution of the computer program 7032 in the non-volatile storage medium 703, and the computer program 7032, when executed by the processor 702, can cause the processor 702 to perform the data management method of the access control device.
[0102] The network interface 705 is configured to perform network communication, such as providing transmission of data information, etc. Those skilled in the art can understand that Figure 7 The structure shown in the figure is only a block diagram of part of the structure related to the present application, and does not constitute a limitation on the computer device 700 to which the present application is applied. The specific computer device 700 can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0103] Those skilled in the art can understand that Figure 7 The embodiment of the computer device shown in the figure does not constitute a limitation on the specific structure of the computer device. In other embodiments, the computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement. For example, in some embodiments, the computer device can only include a memory and a processor. In such embodiments, the structure and function of the memory and the processor are consistent with those of the embodiment shown in Figure 7 , which will not be described here.
[0104] It should be appreciated that in the embodiments of the present application, the processor 702 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic components, discrete hardware components, etc. The general-purpose processor can be a microprocessor or can also be any conventional processor.
[0105] In another embodiment of the present application, a computer readable storage medium is provided. The computer readable storage medium can be a non-volatile computer readable storage medium. The computer readable storage medium stores a computer program, wherein the computer program is executed by a processor to implement the data management method of the access control device according to the embodiments of the present application.
[0106] The storage medium is an entity, non-transient storage medium, for example, can be a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk, and various entity storage media that can store program codes.
[0107] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices, apparatuses and units can refer to the corresponding processes in the foregoing method embodiments, which will not be described herein.
[0108] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited to this. Any person skilled in the art can easily think of various equivalent modifications or replacements within the technical range disclosed by the present application, and these modifications or replacements should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A data management method of an access control device, characterized by, The method comprises the following steps: dividing the storage space of the flash chip to obtain a plurality of storage areas and at least one reserved area; planning a user data structure, wherein the user data structure comprises a card serial number, user information, permission information, a validity period, verification data and an identifier; according to a card serial number card_sn1 of the current data to be stored, determining the storage area in which the data to be stored is to be stored; determining whether there is a storage area in the storage area to be stored; if there is a storage area in the storage area to be stored, writing the data to be stored into the storage area to be stored, if there is no storage area in the storage area to be stored, writing the data to be stored into the reserved area; the data management method of the access control device further comprises the following steps: according to a card serial number card_sn2 of the current data to be authenticated, determining the storage area in which the data to be authenticated is to be authenticated; determining whether the card serial number card_sn2 is stored in the storage area to be authenticated; if the card serial number card_sn2 is stored, reading the user data corresponding to the card serial number card_sn2 in the storage area to be authenticated to determine the permission corresponding to the card serial number card_sn2; if the card serial number card_sn2 is not stored, reading the user data corresponding to the card serial number card_sn2 in the reserved area to determine the permission corresponding to the card serial number card_sn2.
2. The data management method of access control equipment according to claim 1, characterized in that, if there is a storage area in the storage area to be stored, writing the data to be stored into the storage area to be stored, which comprises the following steps: obtaining the type of the storage area in the storage area to be stored, wherein the type of the storage area comprises an idle data area without stored user data and an invalid data area with stored user data but marked as invalid; when the type of the storage area is the idle data area, writing the data to be stored into the idle data area in the storage area to be stored, and marking the written data to be stored as valid; when the type of the storage area is the invalid data area, reading all the user data of the storage area to be stored into the data cache RAM of the MCU chip, clearing all the user data in the storage area to be stored, clearing all the user data in the invalid data area in the data cache RAM to obtain an idle data area, writing the data to be stored into the idle data area, and writing all the user data in the data cache RAM into the cleared storage area to be stored.
3. The data management method of access control equipment according to claim 2, characterized in that, if there is no storage area in the storage area to be stored, writing the data to be stored into the reserved area, which comprises the following steps: when there is no storage area in the storage area to be stored, determining whether there is a storage area in the reserved area, if there is a storage area in the reserved area, writing the data to be stored into the storage area in the reserved area; If there is a storable data area in the reserved area, the to-be-stored data is written into the storable data area of the reserved area, including:
4. The data management method of access control equipment according to claim 3, characterized in that, If there is a storable data area in the reserved area, the to-be-stored data is written into the storable data area of the reserved area, including: Obtaining the type of the storable data area in the reserved area; When the storable data area in the reserved area is the idle data area, the to-be-stored data is written into the idle data area in the reserved area, and the identification of the written to-be-stored data is written as valid; When the storable data area in the reserved area is the invalid data area, all user data of the reserved area is read into the data cache RAM of the MCU chip first, and all user data of the reserved area is cleared, then all user data in the invalid data area is cleared in the data cache RAM to obtain an idle data area, and the to-be-stored data is written into the idle data area, and all user data in the data cache RAM is written into the cleared reserved area.
5. The data management method of access control equipment according to claim 1, characterized in that: Each of the storage areas includes Y sectors, and each of the reserved areas includes N sectors; the number of read-write sectors when the to-be-stored data is stored and the number of read-write sectors when the to-be-authenticated data is authenticated are both G=N+Y.
6. A data management apparatus of an access control device, characterized by comprising: Including: The division unit is configured to divide the storage space of the Flash chip to obtain a plurality of storage areas and at least one reserved area; The planning unit is configured to plan a user data structure, where the user data structure includes a card serial number, user information, permission information, a validity period, verification data, and an identification; The first finding unit is configured to input the card serial number card_sn1 of the to-be-stored data according to a discrete algorithm to determine the storage area in which the to-be-stored data is to be stored; The first judging unit is configured to determine whether there is a storable data area in the storage area in which the to-be-stored data is to be stored; The first storage unit is configured to, if there is a storable data area in the storage area in which the to-be-stored data is to be stored, write the to-be-stored data into the storage area in which the to-be-stored data is to be stored, The second storage unit is configured to, if there is no storable data area in the storage area in which the to-be-stored data is to be stored, write the to-be-stored data into the reserved area. The data management device of the access control device further includes: The second finding unit is configured to input the card serial number card_sn2 of the to-be-authenticated data according to a discrete algorithm to determine the storage area in which the to-be-authenticated data is to be authenticated; The second judging unit is configured to determine whether the card serial number card_sn2 is stored in the storage area in which the to-be-authenticated data is to be authenticated; The first authentication unit is configured to, if the card serial number card_sn2 is stored, read the user data corresponding to the card serial number card_sn2 in the storage area in which the to-be-authenticated data is to be authenticated to determine the permission corresponding to the card serial number card_sn2. A second authentication unit is configured to read user data corresponding to the card serial number card_sn2 in the reserved area if the card serial number card_sn2 is not stored, so as to determine the authority corresponding to the card serial number card_sn2.
7. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the method for data management of the access control device according to any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program causes the processor to execute the method for data management of the access control device according to any one of claims 1 to 5 when the processor executes the computer program.
Citation Information
Patent Citations
Method for implementing hardware driver layer of Nand Flash chip
CN102306124A
Method and device for processing data
CN102968498A
Write-in method and apparatus for monitoring data
CN105518612A