CN109656844A - A kind of AT24xx EEPROM driving method and device - Google Patents

A kind of AT24xx EEPROM driving method and device Download PDF

Info

Publication number
CN109656844A
CN109656844A CN201811463769.1A CN201811463769A CN109656844A CN 109656844 A CN109656844 A CN 109656844A CN 201811463769 A CN201811463769 A CN 201811463769A CN 109656844 A CN109656844 A CN 109656844A
Authority
CN
China
Prior art keywords
at24xx
eeprom
function
driving
nuclear structure
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201811463769.1A
Other languages
Chinese (zh)
Other versions
CN109656844B (en
Inventor
王鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhengzhou Yunhai Information Technology Co Ltd
Original Assignee
Zhengzhou Yunhai Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengzhou Yunhai Information Technology Co Ltd filed Critical Zhengzhou Yunhai Information Technology Co Ltd
Priority to CN201811463769.1A priority Critical patent/CN109656844B/en
Publication of CN109656844A publication Critical patent/CN109656844A/en
Application granted granted Critical
Publication of CN109656844B publication Critical patent/CN109656844B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/16Handling requests for interconnection or transfer for access to memory bus
    • G06F13/1668Details of memory controller
    • G06F13/1694Configuration of memory controller to different memory types
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/382Information transfer, e.g. on bus using universal interface adapter
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4063Device-to-bus coupling
    • G06F13/4068Electrical coupling
    • G06F13/4072Drivers or receivers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0016Inter-integrated circuit (I2C)

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Stored Programmes (AREA)

Abstract

The present invention provides a kind of AT24xx EEPROM driving methods, comprising the following steps: instantiation I2C drives nuclear structure body, and the structural body is registered in I2C core;It realizes the encapsulation of local privately owned structural body, and calls device enumeration function defined in nuclear structure body to initialize and save the privately owned structural body in the local, related software and hardware resources are ready;And the handling function collection by device enumeration function registration towards upper layer, and call read/write function to be written and read the I2C interface of the AT24xx EEPROM by the handling function collection towards upper layer.The present invention realizes the general driving for AT24xx series EEPROM, while supporting a variety of matching ways, it is made to have better suitability.

Description

A kind of AT24xx EEPROM driving method and device
Technical field
Present invention relates in general to computer fields, and more particularly, to a kind of AT24xx EEPROM (electrically erasable Programmable read only memory) driving method and device.
Background technique
There are many EEPROM type number of AT24xx series, and application scenarios are also very extensive.But the chip I 2C interface of each of which model Driving is all independently write, when our product uses different model chip, it is necessary to remove the chip for being adapted to specified model Driving.Moreover, having very big similarity in these AT24xx series EEPROM hardware designs from the point of view of software design point, drive Dynamic separate independently writes and code redundancy certainly will be brought to design.In addition, since the EEPROM of AT24xx series puts into city since most Field has gone through for a long time till now, and great changes have taken place in the meantime by Linux, especially ARM After (Advanced RISC Machine, reduced instruction set machine) framework introduces device tree, the matching way of driving is had shifted towards DTS (Device Tree Source, device tree source code), and the chip drives of early stage still use traditional legacy (leaving) Mode results in the AT24xx EEPROM of same series to write in driving in this way and occurs disunity in mode.
Summary of the invention
In consideration of it, the purpose of the embodiment of the present invention is to propose that a kind of general driving for being adapted to all AT24xx series is soft Part, in this way in product iteration, if not having to worry the problem of driving is not adapted to if the AC24xx chip for having replaced different model; Moreover, drive code set, which is write, supports a variety of matching ways, both i2c_table was supported to match, and also supported DTS matching, also prop up Hold ACPI (Advanced Configuration and Power Management Interface, advanced configuration and power supply pipe Manage interface) matching, the wider versatility that such drive code set just has, being not only used in ARM platform can also use X86 platform.
Based on above-mentioned purpose, the one side of the embodiment of the present invention provides a kind of AT24xx EEPROM driving method, including Following steps:
I2C driving nuclear structure body (i2c_driver) is instantiated, and the structural body is registered in I2C core;
It realizes the encapsulation of local privately owned structural body, and calls the initialization of device enumeration function defined in nuclear structure body simultaneously The privately owned structural body in the local is saved, related software and hardware resources are ready;And
Handling function collection by device enumeration function registration towards upper layer, and pass through the handling function collection tune towards upper layer The I2C interface of the AT24xx EEPROM is written and read with read/write function.
In some embodiments, further includes: before instantiation I2C driving nuclear structure body, in the plate grade text of system The plate grade information of the AT24xx EEPROM is added in part.
In some embodiments, the plate grade packet of the AT24xx EEPROM is added in the plate grade file of system It includes: in the case where ARM platform holding equipment tree, the plate grade information of the AT24xx EEPROM is added in DTS file.
In some embodiments, the plate grade information of the AT24xx EEPROM is added in the plate grade file of system also It include: in the case where X86 platform, in DSDT (Differentiated System Description Table, System level gray correlation Different description table) in the addition AT24xx EEPROM plate grade information.
In some embodiments, the instantiation I2C drives nuclear structure body, and the structural body is registered to I2C It include: the of_ that definition expression is the DTS matching way that ARM platform is supported in I2C driving nuclear structure body in core The array of device_id type, and expression are the acpi_device_id types for the ACPI matching way that X86 platform is supported Array.
In some embodiments, the instantiation I2C drives nuclear structure body, and the structural body is registered to I2C In core further include: I2C driving nuclear structure body registration function is called to complete to drive core to I2C in the entrance function of driving The registration of structural body.
In some embodiments, it calls I2C driving nuclear structure body to unload function in export function, can complete pair The unloading of I2C driving nuclear structure body.
In some embodiments, the privately owned structural body in the local includes to need in i2c_client and hardware access engineering The mutual exclusion lock wanted, waiting list, extra buffer software resource.
In some embodiments, the encapsulation for realizing local privately owned structural body, and call in the nuclear structure body The device enumeration function of definition initializes and saves the privately owned structural body in the local, by the ready packet of related software and hardware resources Include: the device enumeration function first determines whether that platform device matching way is the ACPI of the DTS or X86 of ARM, based on described A series of initialization action is carried out with mode.
In some embodiments, the I2C interface of the AT24xx EEPROM is written and read and is with i2c msg Unit.
The another aspect of the embodiment of the present invention provides a kind of AT24xx EEPROM driving device, comprising:
At least one processor;With
Memory, the memory are stored with the program code that processor can be run, and said program code is by processor Implement method as described in any one of the above embodiments when operation.
The present invention has a kind of following advantageous effects: the driving side AT24xx EEPROM provided in an embodiment of the present invention Method and device, which are realized, drives isolated design philosophy in accordance with host driven and peripheral hardware, is adapted to the AT24xx family chip of complete series, And support multi-platform, multi-form device/driver matching way, ARM platform, X86 platform are applicable, have more preferable Suitability, and simplify the realization of device drives, provide maximum convenience for the maintenance upgrade of driving.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with Other embodiments are obtained according to these attached drawings.
Fig. 1 is the flow chart of AT24xx EEPROM driving method according to an embodiment of the present invention;
Fig. 2 is a kind of hardware structural diagram of AT24xx EEPROM driving device according to an embodiment of the present invention.
Specific embodiment
The following describe embodiment of the disclosure.It should be appreciated, however, that the disclosed embodiments are only example, and Other embodiments can take various alternative forms.The drawings are not necessarily drawn to scale;Certain functions may be exaggerated or minimum Change the details to show particular elements.Therefore, specific structure and function details disclosed herein are not necessarily to be construed as restrictive, And it is merely possible to for instructing those skilled in the art to use representative basis of the invention in various ways.As this field is general It is logical the skilled person will understand that, the various features with reference to shown or described by any one attached drawing can with it is one or more other Feature shown in the drawings is combined to produce the embodiment for not being explicitly illustrated or describing.The group of shown feature is combined into typical case Provide representative embodiment.However, the various combinations and modification of the feature consistent with the introduction of the disclosure are for certain spies Fixed application or embodiment may be desired.
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with specific embodiment, and reference The embodiment of the present invention is further described in attached drawing.
I2C agreement is widely used one kind communication protocol in embedded system, is mainly used between CPU and various peripheral hardwares Low-speed data communication.Linux kernel is abstracted using I2C framework (I2C frame), is managed corresponding resource, and with each Kind form provides API (Application Program Interface, application programming interfaces) to all kinds of users.In addition, making Realization for one kind of bus (bus), I2C frame embodies the marrow of Linux device model, is worth research and study.Linux I2C architecture be divided into 3 component parts:
(1) I2C core: I2C core provides the registration of I2C bus driver and device drives, cancellation method, I2C communication The code and detecting devices unrelated with specific adapter on the upper layer method (i.e. Algorithm), detection device address upper layer Code etc.;
(2) I2C bus driver: I2C bus driver is the realization to adapter end in I2C hardware architecture, adapter It can be controlled by CPU, it might even be possible to be directly integrated in inside CPU.I2C bus driver mainly includes I2C data structure The Algorithm data structure i2c_algorithm and control I2C adapter of i2c_adapter, I2C adapter generate communication The function of signal.Via the code of I2C bus driver, we can control I2C adapter and with master mode generate start bit, stop Stop bit, read-write cycle, and to be read and write from DeviceMode, generate ACK etc..
(3) I2C device drives: I2C device drives (also referred to as client driven) are to equipment end in I2C hardware system structure Realization, equipment is generally articulated on the I2C adapter controlled by CPU, exchanges data with CPU by I2C adapter.I2C is set Standby driving mainly includes data structure i2c_driver and i2c_client, it would be desirable to according to specific equipment realize it is therein at Member's function.
There is an i2c catalogue under the drivers catalogue in linux kernel source code, and comprising such as under i2c catalogue Lower file and file: (1) i2c-core.c, this file realizes the function of I2C core and/proc/bus/i2c* connects Mouthful;(2) i2c-dev.c realizes the function of I2C adapter device file;(3) busses file;And (4) algos text Part folder.
By the abstract of I2C framework, consumer can not have to the technical detail for being concerned about I2C bus, it is only necessary to Pass through simple API, so that it may carry out data interaction with slave devices.Under normal circumstances, consumer is to be located at kernel Other drivers (such as HDMI driver, touch screen driver) of state.At the same time, I2C framework Similar interface is provided to user's space also by character device, user space program can access slave by the interface devices.Inside I2C framework, there are tetra- I2C core, I2C busses, I2C algos and I2C muxes moulds Block.I2C core uses the function of the sub- module abstracts I2C controller of I2C adapter and I2C algorithm two, Using I2C client and I2C driver be abstracted I2C slave device function (device in corresponding device model and device driver).In addition, be based on I2C agreement, by smbus module realize SMBus (System Management Bus, System Management Bus) function.I2C algos contains some general I2C algorithm, so-called algorithm Refer to I2C protocol package generation method, and then be combined into I2C read/write (read/write) instruction, under normal circumstances, be all by Hardware realization does not need to pay special attention to the catalogue.I2C muxes for realizing I2C bus multiplex function.
Based on above-mentioned purpose, the embodiment of the invention provides a kind of AT24xx EEPROM driving methods, including following step It is rapid:
It instantiates I2C and drives nuclear structure body i2c_driver, and the structural body is registered in I2C core;
It realizes the encapsulation of local privately owned structural body, and calls device enumeration function (probe letter defined in nuclear structure body Number) it initializes and saves the privately owned structural body in the local, related software and hardware resources are ready;And
Handling function collection by the device enumeration function registration towards upper layer, and pass through the handling function towards upper layer Collection calls read/write function to be written and read the I2C interface of the AT24xx EEPROM.
In some embodiments, method of the invention further include: before instantiation I2C driving nuclear structure body, The plate grade information of AT24xx EEPROM is added in the plate grade file of system.
Hardware feature of the present invention independent of specific SoC and I2C controller, therefore in some embodiments, if The external AT24xx EEPROM of a certain ARM platform, then only need to add corresponding i2c_board_ in plate grade file Info, code are as follows:
Static sttruct i2c_board_info i2c_devs0 [] _ _ initdata=
{I2C_BOARD_INFO(“24c02”,0x57),},
};
In the case where holding equipment tree, a node is simply added in .dts file:
In some embodiments, when X86 platform is driven using the method for the present invention, it is only necessary to be added in DSDT The corresponding plate grade information of AT24xx, code are as follows:
Scope(_SB.PCI0)
{
Device(I2C0)
{
Name(LINK,"\\_SB.PCI0.I2C0")
Method(_PSC,0,NotSerialized)//_PSC:Power State Current
{
Return(GETD(SB10))
}
Method(_PS0,0,NotSerialized)//_PS0:Power State 0
{
LPD0(SB10)
}
Method(_PS3,0,NotSerialized)//_PS3:Power State 3
{
LPD3(SB10)
}
}
In some embodiments, i2c_driver corresponds to a set of driving method, and Major Members function includes probe (), remove (), suspend (), resume () etc., in addition, the id_table of struct i2c_device_id form is The ID table for the I2C equipment that the driving is supported is stored in the distinctive matching way of I2C equipment, the inside, we also realize together.Example The code for changing i2c_driver is as follows:
Static struct i2c_driver at24_driver=
.driver=
.name=" at24 ",
.acpi_match_table=ACPI_PTR (at24_acpi_ids),
.of_match_table=of_match_ptr (at24_of_ids),
},
.probe=at24_probe,
.remove=at24_remove,
.id_table=at24_ids,
};
Wherein, at24_of_ids is the array of an of_device_id type, is the DTS match party that ARM platform is supported Formula, the inside contains " compatible " of all devices of this driving support, for EEPROM defined in matching unit tree Node;At24_acpi_ids is the array of an acpi_device_id type, is the ACPI table that X86 platform is supported With mode, for matching the middle facility information of DSDT file.Finally, calling i2c_ in the entrance function at24_init of driving Driver registration function return i2c_add_driver (&at24_driver) registration of the completion to i2c_driver;Going out I2c_driver is called to unload function i2c_del_driver (&at24_driver in mouth function at24_exit), completion pair The unloading of i2c_driver.
In some embodiments, probe function is the key that initialization hardware, and wherein core code logic is as follows:
Wherein, at24_data structural body is the privately owned structural body in local of AT24xx EEPROM, and the inside contains i2c_ The mutual exclusion lock of client and hardware access process needs, waiting list, extra buffer (buffer) software resource.i2c_ Client is that the I2C device hardware that I2C subsystem provides is abstract, and the inside includes the relevant resource information of hardware, and mutual exclusion lock is used for Multiple upper layer application race access EEPROM hardware are prevented, waiting list optimizes for data transmission procedure, and extra buffer is used In the turnover of local data.Probe () function is exactly to surround at24_data structural body all to prepare related software and hardware resources It is ready.Code logic first determines whether that platform device matching way is the ACPI of the DTS or X86 of ARM, if it is DTS match party Formula is then called of_match_device () function to find from ad24_dt_ids array and is had with the AT24xx to match in DTS Figure number then calls acpi_match_device () function to look for from at24_acpi_ids array if it is ACPI matching way To with the AT24xx concrete model that matches in DSDT;Next it is exactly a series of initialization action, waits at24_data member After whole is ready, just call i2c_set_clientdata () function that the at24_data initialized is saved in i2c_ In dev- > driver_data of client;Register_chrdev () function is for registering the handling function collection towards upper layer At24cxx_fops is defined as follows:
Static struct file_operations at24cxx_fops=
.owner=THIS_MODULE,
.read=at24cxx_read,
.write=at24cxx_write,
};
When upper level applications need to read and write AT24xx EEPROM, it will call and be realized in at24cxx_fops At24cxx_read, at24cxx_write function, to initiate the actual access behavior for being directed to AT24xx EEPROM hardware; Class_create and device_create is dev/at24cxx here for automatically creating device node.
In some embodiments, I2C transmits (read or write) as unit of i2c msg, which contains data Transmit relevant all information, wherein the address of addr expression I2C slave device;Flags indicates that data transmission can be taken The flag of band;Common I2C_M_TEN indicates the slave addresses of support 10-bit, and I2C_M_RD indicates that this time transmission is to read to grasp Make;Len indicates that the length of data transmission, unit are bit (byte).
In some embodiments, I2C data, which transmit related interface, two classes: one kind be using i2c client as parameter, Carry out simple data transmit-receive, including i2c_master_send, i2c_master_recv.This method may only be by standard side Formula sends or receives a certain number of data.
It is another kind of be using i2c adapter and i2c msg as parameter, can more flexible read write data, Including i2c_transfer.Using this method can using struct i2c_msg as parameter, it is primary read or write-in or It reads plus is written, a certain number of data.
The reading function interface that this driving is realized is as follows:
Wherein, it with reference to the Random Eead timing diagram of at24c08 handbook, learns: S Addr Wr [A] Comm [A] S Addr Rd [A] [Data] NAP reads I2C data used here as i2c_smbus_read_byte_data.
It is similar to write function, calls i2c_smbus_write_byte_data to carry out data and writes, be accomplished by
In some embodiments, it can be used to lower test code to test the driving realized according to the method for the present invention, survey Under trying out for example:
void print_usage(char*file)
{
Printf (" %s r addr n ", file);
Printf (" %s w addr val n ", file);
}
int main(int argc,char**argv)
{
int fd;
unsigned char buf[2];
if((argc!=3) && (argc!=4))
{
print_usage(argv[0]);
return-1;
}
Fd=open ("/dev/at24cxx ", O_RDWR);
if(fd<0)
{
printf("can't open/dev/at24cxx\n");
return-1;
}
If (strcmp (argv [1], " r ")==0)
{
Buf [0]=strtoul (argv [2], NULL, 0);
read(fd,buf,1);
Printf (" data:%c, %d, 0x%2x n ", buf [0], buf [0], buf [0]);
}
Else if (strcmp (argv [1], " w ")==0)
{
Buf [0]=strtoul (argv [2], NULL, 0);
Buf [1]=strtoul (argv [3], NULL, 0);
write(fd,buf,2);
}
else
{
print_usage(argv[0]);
return-1;
}
return 0;
}
After tested, can be by this driving, the normal I2C interface for reading and writing AT24C08EEPROM.
Technically in feasible situation, it can be combined with each other above in relation to technical characteristic cited by different embodiments, Or change, add and omit etc., to form the additional embodiment in the scope of the invention.
From above-described embodiment as can be seen that a kind of AT24xx EEPROM driving method provided in an embodiment of the present invention and dress It sets and realizes the design philosophy isolated in accordance with host driven and peripheral hardware driving, be adapted to the AT24xx family chip of complete series, and prop up Multi-platform, multi-form device/driver matching way is held, ARM platform, X86 platform are applicable, have better adaptation Property, and the realization of device drives is simplified, maximum convenience is provided for the maintenance upgrade of driving.
Based on above-mentioned purpose, the second aspect of the embodiment of the present invention proposes a kind of AT24xxEEPROM driving device One embodiment.
The AT24xx EEPROM driving device includes at least one processor and memory, and memory is stored with can be The computer program run on processor, processor execute any one of the above method when executing program.
As shown in Fig. 2, the hardware configuration for one embodiment of AT24xx EEPROM driving device provided by the invention shows It is intended to.
It in the apparatus include processor 201 and memory 202, and can also include: input dress by taking such as Fig. 2 as an example Set 203 and output device 204.
Processor 201, memory 202, input unit 203 and output device 204 can pass through bus or other modes It connects, in Fig. 2 for being connected by bus.
Memory 202 is used as a kind of non-volatile computer readable storage medium storing program for executing, can be used for storing non-volatile software journey Sequence, non-volatile computer executable program and module, such as the driving side the AT24xx EEPROM in the embodiment of the present application Corresponding program instruction/the module of method.Processor 201 is by running the non-volatile software program being stored in memory 202, referring to Order and module realize above method embodiment thereby executing the various function application and data processing of server AT24xx EEPROM driving method.
Memory 202 may include storing program area and storage data area, wherein storing program area can store operation system Application program required for system, at least one function;Storage data area can be stored to be made according to AT24xx EEPROM driving device With the data etc. created.In addition, memory 202 may include high-speed random access memory, it can also include non-volatile Memory, for example, at least a disk memory, flush memory device or other non-volatile solid state memory parts.In some realities It applies in example, optional memory 202 includes the memory remotely located relative to processor 201, these remote memories can lead to Network connection is crossed to local module.The example of above-mentioned network includes but is not limited to internet, intranet, local area network, movement Communication network and combinations thereof.
Input unit 203 can receive the number or character information of input, and generate and AT24xxEEPROM driving device User setting and function control related key signals input.Output device 204 may include that display screen etc. shows equipment.
Corresponding program instruction/the module of one or more of AT24xx EEPROM driving methods is stored in described deposit In reservoir 202, when being executed by the processor 201, the AT24xx EEPROM driving in above-mentioned any means embodiment is executed Method.
Described any one embodiment for executing the AT24xx EEPROM driving device, can achieve corresponding The identical or similar effect of aforementioned any means embodiment.
Finally, it should be noted that those of ordinary skill in the art will appreciate that realizing the whole in above-described embodiment method Or part process, related hardware can be instructed to complete by computer program, the program can be stored in computer can It reads in storage medium, the program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, described to deposit Storage media can be magnetic disk, CD, read-only memory (ROM) or random access memory (RAM) etc..
In addition, typically, it can be various electric terminal equipments, example that the embodiment of the present invention, which discloses described device, equipment etc., Such as mobile phone, personal digital assistant (PDA), tablet computer (PAD), smart television, are also possible to large-scale terminal device, such as service Device etc., therefore protection scope disclosed by the embodiments of the present invention should not limit as certain certain types of device, equipment.The present invention is real Apply example disclose the client can be applied to the combining form of electronic hardware, computer software or both it is above-mentioned any In a kind of electric terminal equipment.
In addition, disclosed method is also implemented as the computer program executed by CPU according to embodiments of the present invention, it should Computer program may be stored in a computer readable storage medium.When the computer program is executed by CPU, the present invention is executed The above-mentioned function of being limited in method disclosed in embodiment.
In addition, above method step and system unit also can use controller and for storing so that controller is real The computer readable storage medium of the computer program of existing above-mentioned steps or Elementary Function is realized.
In addition, it should be appreciated that computer readable storage medium (for example, memory) as described herein can be it is volatile Property memory or nonvolatile memory, or may include both volatile memory and nonvolatile memory.As example And not restrictive, nonvolatile memory may include read-only memory (ROM), programming ROM (PROM), electrically programmable to son ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory.Volatile memory may include arbitrary access Memory (RAM), the RAM can serve as external cache.As an example and not restrictive, RAM can be with more Kind form obtains, such as synchronous random access memory (DRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate SDRAM (DDR SDRAM), enhancing SDRAM (ESDRAM), synchronization link DRAM (SLDRAM) and directly Rambus RAM (DRRAM). The storage equipment of disclosed aspect is intended to the memory of including but not limited to these and other suitable type.
Those skilled in the art will also understand is that, various illustrative logical blocks, mould in conjunction with described in disclosure herein Block, circuit and algorithm steps may be implemented as the combination of electronic hardware, computer software or both.It is hard in order to clearly demonstrate This interchangeability of part and software, with regard to various exemplary components, square, module, circuit and step function to its into General description is gone.This function is implemented as software and is also implemented as hardware depending on concrete application and application To the design constraint of whole system.Those skilled in the art can realize described in various ways for every kind of concrete application Function, but this realization decision should not be interpreted as causing a departure from range disclosed by the embodiments of the present invention.
Various illustrative logical blocks, module and circuit, which can use, in conjunction with described in disclosure herein is designed to The following component of function described here is executed to realize or execute: general processor, digital signal processor (DSP), dedicated collection At circuit (ASIC), field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, divide Any combination of vertical hardware component or these components.General processor can be microprocessor, but alternatively, processing Device can be any conventional processors, controller, microcontroller or state machine.Processor also may be implemented as calculating equipment Combination, for example, the combination of DSP and microprocessor, multi-microprocessor, one or more microprocessors combination DSP and/or any Other this configurations.
The step of method in conjunction with described in disclosure herein or algorithm, can be directly contained in hardware, be held by processor In capable software module or in combination of the two.Software module may reside within RAM memory, flash memory, ROM storage Device, eprom memory, eeprom memory, register, hard disk, removable disk, CD-ROM or known in the art it is any its In the storage medium of its form.Illustrative storage medium is coupled to processor, enables a processor to from the storage medium Information is written to the storage medium in middle reading information.In an alternative, the storage medium can be with processor collection At together.Pocessor and storage media may reside in ASIC.ASIC may reside in user terminal.It is replaced at one In scheme, it is resident in the user terminal that pocessor and storage media can be used as discrete assembly.
In one or more exemplary designs, the function can be real in hardware, software, firmware or any combination thereof It is existing.If realized in software, can be stored in using the function as one or more instruction or code computer-readable It is transmitted on medium or by computer-readable medium.Computer-readable medium includes computer storage media and communication media, The communication media includes any medium for helping for computer program to be transmitted to another position from a position.Storage medium It can be any usable medium that can be accessed by a general purpose or special purpose computer.As an example and not restrictive, the computer Readable medium may include RAM, ROM, EEPROM, CD-ROM or other optical disc memory apparatus, disk storage equipment or other magnetic Property storage equipment, or can be used for carry or storage form be instruct or data structure required program code and can Any other medium accessed by general or specialized computer or general or specialized processor.In addition, any connection is ok It is properly termed as computer-readable medium.For example, if using coaxial cable, optical fiber cable, twisted pair, digital subscriber line (DSL) or such as wireless technology of infrared ray, radio and microwave to send software from website, server or other remote sources, Then above-mentioned coaxial cable, optical fiber cable, twisted pair, DSL or such as wireless technology of infrared ray, radio and microwave are included in The definition of medium.As used herein, disk and CD include compact disk (CD), laser disk, CD, digital versatile disc (DVD), floppy disk, Blu-ray disc, wherein disk usually magnetically reproduce data, and CD using laser optics reproduce data.On The combination for stating content should also be as being included in the range of computer-readable medium.
It is exemplary embodiment disclosed by the invention above, it should be noted that in the sheet limited without departing substantially from claim Under the premise of inventive embodiments scope of disclosure, it may be many modifications and modify.According to open embodiment described herein The function of claim to a method, step and/or movement be not required to the execution of any particular order.In addition, although the present invention is implemented Element disclosed in example can be described or be required in the form of individual, but be unless explicitly limited odd number, it is understood that be multiple.
It should be understood that it is used in the present context, unless the context clearly supports exceptions, singular " one It is a " it is intended to also include plural form.It is to be further understood that "and/or" used herein refers to including one or one Any and all possible combinations of a above project listed in association.
It is for illustration only that the embodiments of the present invention disclose embodiment sequence number, does not represent the advantages or disadvantages of the embodiments.
Those of ordinary skill in the art will appreciate that realizing that all or part of the steps of above-described embodiment can pass through hardware It completes, relevant hardware can also be instructed to complete by program, the program can store in a kind of computer-readable In storage medium, storage medium mentioned above can be read-only memory, disk or CD etc..
Above-described embodiment is the possibility example of embodiment, and is mentioned just to be clearly understood that the principle of the present invention Out.It should be understood by those ordinary skilled in the art that: the discussion of any of the above embodiment is exemplary only, it is not intended that dark Show that range disclosed by the embodiments of the present invention (including claim) is limited to these examples;Under the thinking of the embodiment of the present invention, It can also be combined, and exist present invention as described above between technical characteristic in above embodiments or different embodiments Many other variations of the different aspect of embodiment, for simplicity, they are not provided in details.Therefore, all of the invention real It applies within the spirit and principle of example, any omission, modification, equivalent replacement, improvement for being made etc. should be included in implementation of the present invention Within the protection scope of example.

Claims (10)

1. a kind of AT24xx EEPROM driving method, which comprises the following steps:
It instantiates I2C and drives nuclear structure body, and the structural body is registered in I2C core;
It realizes the encapsulation of local privately owned structural body, and calls the initialization of device enumeration function defined in the nuclear structure body simultaneously The privately owned structural body in the local is saved, related software and hardware resources are ready;And
Handling function collection by the device enumeration function registration towards upper layer, and pass through the handling function collection tune towards upper layer The I2C interface of the AT24xx EEPROM is written and read with read/write function.
2. the method according to claim 1, wherein further include: instantiation I2C driving nuclear structure body it Before, the plate grade information of the AT24xx EEPROM is added in the plate grade file of system.
3. according to the method described in claim 2, adding the plate grade letter of the AT24xx EEPROM in the plate grade file of system Breath includes: the plate grade letter for adding the AT24xx EEPROM in DTS file in the case where ARM platform holding equipment tree Breath.
4. according to the method described in claim 2, it is characterized in that, adding the AT24xx in the plate grade file of system The plate grade information of EEPROM further include: in the case where X86 platform, the plate grade of the AT24xx EEPROM is added in DSDT Information.
5. the method according to claim 1, wherein the instantiation I2C drives nuclear structure body, and will be described It includes: to define the DTS that expression is the support of ARM platform in I2C driving nuclear structure body that structural body, which is registered in I2C core, The array of the of_device_id type of matching way, and expression are the acpi_ for the ACPI matching way that X86 platform is supported The array of device_id type.
6. according to the method described in claim 5, it is characterized in that, the instantiation I2C drives nuclear structure body, and will be described Structural body is registered in I2C core further include: calls I2C driving nuclear structure body registration function complete in the entrance function of driving The registration of pairs of I2C driving nuclear structure body.
7. the method according to claim 1, wherein the privately owned structural body in the local include i2c_client and The mutual exclusion lock that is needed in hardware access engineering, waiting list, extra buffer software resource.
8. the method according to claim 1, wherein the encapsulation for realizing local privately owned structural body, and calling Device enumeration function defined in the nuclear structure body initializes and saves the privately owned structural body in the local, will be related soft or hard Ready part resource includes: that the device enumeration function first determines whether that platform device matching way is the DTS or X86 of ARM ACPI, a series of initialization action is carried out based on the matching way.
9. the method according to the description of claim 7 is characterized in that being written and read to the I2C interface of the AT24xx EEPROM Operation is as unit of i2c msg.
10. a kind of AT24xx EEPROM driving device characterized by comprising
At least one processor;With
Memory, the memory are stored with the program code that processor can be run, and said program code is run by processor When implement method as claimed in any one of claims 1-9 wherein.
CN201811463769.1A 2018-12-03 2018-12-03 AT24xx EEPROM driving method and device Active CN109656844B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811463769.1A CN109656844B (en) 2018-12-03 2018-12-03 AT24xx EEPROM driving method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811463769.1A CN109656844B (en) 2018-12-03 2018-12-03 AT24xx EEPROM driving method and device

Publications (2)

Publication Number Publication Date
CN109656844A true CN109656844A (en) 2019-04-19
CN109656844B CN109656844B (en) 2022-02-22

Family

ID=66112278

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811463769.1A Active CN109656844B (en) 2018-12-03 2018-12-03 AT24xx EEPROM driving method and device

Country Status (1)

Country Link
CN (1) CN109656844B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110908785A (en) * 2019-11-16 2020-03-24 湖南智领通信科技有限公司 Data-driven flattening device driving method based on priority
CN112069113A (en) * 2020-09-04 2020-12-11 龙芯中科技术有限公司 I2C equipment configuration method and system
CN114546500A (en) * 2022-01-28 2022-05-27 郑州信大捷安信息技术股份有限公司 Method and system for realizing password card drive supporting multiple devices
CN114780152A (en) * 2022-03-22 2022-07-22 西安广和通无线软件有限公司 Computing equipment starting method and device
CN114860640A (en) * 2022-04-07 2022-08-05 湖南艾科诺维科技有限公司 FlexSPI interface driving method and system for communication between FPGA and ARM

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102104508A (en) * 2010-12-29 2011-06-22 哈尔滨工业大学 M module low-level (LL) driver layer realization method for M module-based local area network (LAN)-based extensions for instrumentation (LXI) equipment
US20140351489A1 (en) * 2013-05-21 2014-11-27 Stmicroelectronics (Rousset) Sas Mechanism for writing into an eeprom on an i2c bus
US20140347931A1 (en) * 2013-05-21 2014-11-27 Stmicroelectronics (Rousset) Sas Writing into an eeprom on an i2c bus
CN108287804A (en) * 2018-01-25 2018-07-17 郑州云海信息技术有限公司 A kind of I2C controllers driving method and system
CN108536621A (en) * 2018-04-08 2018-09-14 郑州云海信息技术有限公司 SSD1306 OLED driving methods and SPI subsystem
CN108549611A (en) * 2018-04-02 2018-09-18 郑州云海信息技术有限公司 A kind of driving realization method and system based on gt9 family chips

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102104508A (en) * 2010-12-29 2011-06-22 哈尔滨工业大学 M module low-level (LL) driver layer realization method for M module-based local area network (LAN)-based extensions for instrumentation (LXI) equipment
US20140351489A1 (en) * 2013-05-21 2014-11-27 Stmicroelectronics (Rousset) Sas Mechanism for writing into an eeprom on an i2c bus
US20140347931A1 (en) * 2013-05-21 2014-11-27 Stmicroelectronics (Rousset) Sas Writing into an eeprom on an i2c bus
CN108287804A (en) * 2018-01-25 2018-07-17 郑州云海信息技术有限公司 A kind of I2C controllers driving method and system
CN108549611A (en) * 2018-04-02 2018-09-18 郑州云海信息技术有限公司 A kind of driving realization method and system based on gt9 family chips
CN108536621A (en) * 2018-04-08 2018-09-14 郑州云海信息技术有限公司 SSD1306 OLED driving methods and SPI subsystem

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110908785A (en) * 2019-11-16 2020-03-24 湖南智领通信科技有限公司 Data-driven flattening device driving method based on priority
CN112069113A (en) * 2020-09-04 2020-12-11 龙芯中科技术有限公司 I2C equipment configuration method and system
CN112069113B (en) * 2020-09-04 2023-01-06 龙芯中科技术股份有限公司 I2C device configuration method and system
CN114546500A (en) * 2022-01-28 2022-05-27 郑州信大捷安信息技术股份有限公司 Method and system for realizing password card drive supporting multiple devices
CN114780152A (en) * 2022-03-22 2022-07-22 西安广和通无线软件有限公司 Computing equipment starting method and device
CN114780152B (en) * 2022-03-22 2024-03-15 西安广和通无线软件有限公司 Computing device starting method and device
CN114860640A (en) * 2022-04-07 2022-08-05 湖南艾科诺维科技有限公司 FlexSPI interface driving method and system for communication between FPGA and ARM
CN114860640B (en) * 2022-04-07 2023-06-06 湖南艾科诺维科技有限公司 FlexSPI interface driving method and system for FPGA and ARM communication

Also Published As

Publication number Publication date
CN109656844B (en) 2022-02-22

Similar Documents

Publication Publication Date Title
CN109656844A (en) A kind of AT24xx EEPROM driving method and device
CN106598632B (en) Firmware upgrading method and device for optical module
US9940123B1 (en) Updating device code through a bus
US9081703B2 (en) Method and apparatuses for facilitating sharing device connections between a host and client based on the power mode of the host
KR20180050728A (en) Bridging and virtualizing input / output signals on multi-node networks
US11853767B2 (en) Inter-core data processing method, system on chip and electronic device
US11449242B2 (en) Shared storage space access method, device and system and storage medium
CN114327930A (en) System architecture for communication between heterogeneous multi-core and operation method of system architecture
CN112667415B (en) Data calling method and device, readable storage medium and electronic equipment
US20160110207A1 (en) Methods for copying information handling system configuration settings
CN110221840B (en) Function implementation method and device of application program, equipment and storage medium
CN112506676B (en) Inter-process data transmission method, computer device and storage medium
CN107040539B (en) Protocol data packet construction method and device and computer system
CN116257320B (en) DPU-based virtualization configuration management method, device, equipment and medium
CN112486807A (en) Pressure testing method and device, electronic equipment and readable storage medium
JP2008547139A (en) Method, apparatus and system for memory post-write buffer with unidirectional full-duplex interface
CN116450554A (en) Interrupt processing method, root complex device and electronic device
CN115964331A (en) Data access method, device and equipment
CN101876898B (en) Registration method of COM assembly and device thereof
CN114564241A (en) Hardware device access method and device, computer device and storage medium
CN114070892A (en) Data transmission method and device
WO2020064000A1 (en) Method and apparatus for displaying message box, terminal and storage medium
CN116662270B (en) File analysis method and related device
EP3234786B1 (en) Scalable synchronization mechanism for distributed memory
CN115297169B (en) Data processing method, device, electronic equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant