CN105760318B - A method of based on linux system reading-writing optical module register - Google Patents

A method of based on linux system reading-writing optical module register Download PDF

Info

Publication number
CN105760318B
CN105760318B CN201610086835.2A CN201610086835A CN105760318B CN 105760318 B CN105760318 B CN 105760318B CN 201610086835 A CN201610086835 A CN 201610086835A CN 105760318 B CN105760318 B CN 105760318B
Authority
CN
China
Prior art keywords
read
register
proc
write
optical
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.)
Active
Application number
CN201610086835.2A
Other languages
Chinese (zh)
Other versions
CN105760318A (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.)
Fiberhome Telecommunication Technologies Co Ltd
Original Assignee
Fiberhome Telecommunication Technologies 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 Fiberhome Telecommunication Technologies Co Ltd filed Critical Fiberhome Telecommunication Technologies Co Ltd
Priority to CN201610086835.2A priority Critical patent/CN105760318B/en
Publication of CN105760318A publication Critical patent/CN105760318A/en
Application granted granted Critical
Publication of CN105760318B publication Critical patent/CN105760318B/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/1678Details of memory controller using bus width
    • 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)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a kind of methods based on linux system reading-writing optical module register, comprising: hair message is to kernel, and there are proc files by information for kernel;It is abnormal to return and terminate if message format parsing is incorrect, otherwise judge whether to read DDMI information, if then obtaining DDMI information register value, determines the register of I2C access, hair message to I2C bus read-write register value and terminates;Otherwise, it is determined whether otherwise read-write register value switches the register of I2C access if it is not, abnormal return and terminate, syllable sequence is read and write and adjusted to circulation, and hair message gives I2C bus read-write register value.The present invention, kernel and user's space layer use proc file system interactive mode, for different optical mode block signal batch read-write A0, A2 registers, application layer is portable strong, the difference of maskable read-write register application interface keeps optical module debugging simpler and efficiently, promotes plant produced efficiency.

Description

A method of based on linux system reading-writing optical module register
Technical field
The present invention relates to home gateway fields, and in particular to a kind of side based on linux system reading-writing optical module register Method.
Background technique
Under fiber entering household (FTTH) and the background of the integration of three networks, optical fiber is laid with range and speed rapidly develops, ONU (Optical Network Unit, optical network unit) enters huge numbers of families, optical fiber as Optical Access Network subscriber terminal equipment It includes optical module that access network equipment and the most important difference of Conventional wide band access network equipment, which are optical fiber access network equipments, has photoelectricity Conversion, that is, convert optical signals to electric signal, be then transferred to the function of user.Detection and monitoring to optical module are that optical fiber connects Enter an important link in the test of equipment plant produced, can be achieved by the value of reading-writing optical module register A0, A2 to optical mode The monitoring of block key parameter, these key parameters include: transmitting optical power, received optical power, operating voltage, bias current and Optical mode deblocking temperature etc..
At this stage the method for read-write register mainly use ioctl encapsulation driving layer, application layer in the form of a command or The mode called directly in other modules is realized, since different chip solution optical modules check DDMI (numerical diagnostic optical module) Interface message and the encapsulation of read-write register application layer are multifarious, therefore existing method excessively complexity and poor universality.
In view of this, being badly in need of designing a kind of new method of reading-writing optical module register, the debugging of optical module can be made more It is simple and efficient.
Summary of the invention
The technical problem to be solved by the present invention is to design a kind of new method of reading-writing optical module register, optical mode can be made The debugging of block is simpler and efficient.
In order to solve the above-mentioned technical problem, the technical scheme adopted by the invention is that providing a kind of based on linux system reading The method for writing optical mode block register, comprising the following steps:
S201, application layer send a message to linux kernel by echo or cat order, and linux kernel will handle message The information of acquisition is stored in proc file;
S202, judge whether the message format parsing of application layer transmitting is correct, if correctly, turning S204;Otherwise, turn S203;
S203, abnormal printing return, and terminate;
S204, judge whether to read DDMI information, if so, turning S205;Otherwise, turn S207;
S205, corresponding DDMI information register value is obtained, and carries out digital-to-analogue conversion, turn S206;
S206, the register address for determining I2C access are A0 or A2, send messages to I2C bus read-write register value, and Terminate;
S207, judge whether read-write register value, if so, turning S208;Otherwise, turn S203;
The register address that S208, switching I2C are accessed, circulation, which is read and write, simultaneously adjusts syllable sequence, turns S209;
S209, I2C bus read-write register value is sent messages to, and terminated.
In the above-mentioned technical solutions, proc file system initialization specifically includes the following steps:
In proc file system start-up course, the application layer dynamically load ko file is into the linux kernel;
Call i2c_add_driver function registration I2C device drives;
The linux kernel creates the proc file;
The proc file system is associated with call back function;
User's space layer generates the proc file.
In the above-mentioned technical solutions, the proc file is Generic Optical Info.
In the above-mentioned technical solutions,
Write the method that register sends message are as follows:
echo[i2c_addr][offset][length][value…]>/proc/Generic Optical Info;
The method of read register transmission message are as follows:
echo[i2c_addr][offset][length]>/proc/Generic Optical Info;
Read the method that DDMI information sends message are as follows:
echo c[params]>/proc/Generic Optical Info。
In the above-mentioned technical solutions, the params parameter is transmitting optical power, received optical power, optical mode deblocking temperature, work Make the kernel macrodefinition of voltage, bias current and read register.
In the above-mentioned technical solutions, the method for corresponding DDMI information register value is obtained in S205 are as follows:
cat/proc/Generic Optical Info。
The present invention, linux kernel and the interaction of user's space layer are by the way of the interaction of proc file system, for different factories Family's optical mode block signal batch read-write A0, A2 register, is dynamically loaded into linux kernel, application layer is not necessarily to generation using ko form Code support, portable strong, the difference of maskable optical module producer read-write register application interface keeps optical module debugging simpler It is single and efficient, it is beneficial to the promotion of plant produced efficiency.
Detailed description of the invention
Fig. 1 is the flow chart of proc file system initialization provided in an embodiment of the present invention;
Fig. 2 is the kernel implementation flow chart of reading DDMI information and read-write register function provided in an embodiment of the present invention.
Specific embodiment
The embodiment of the invention provides a kind of method based on linux system reading-writing optical module register, linux kernel and The interaction of user's space layer is dynamically loaded into linux kernel by the way of the interaction of proc file system using ko form, Linux kernel processing module realizes multibyte read-write register by the encapsulation to standard I2C communication interface function.User's space Layer can be used echo order and send message, linux kernel to linux kernel by proc file Generic Optical Info The information that processing module has handled message acquisition is stored in proc file Generic Optical Info, passes through for application layer Cat order is checked.
Proc file system is a kind of file system of no storage, when reading respective file, content dynamic generation, and file It can be associated with kernel function, linux kernel will create read-write proc file Generic Optical Info, user's space layer Linux kernel is sent messages to using echo order, after linux kernel receives message, by the place of proc file process function Information storage is managed to read into proc file Generic Optical Info for application layer.
The present invention is described in detail with specific embodiment with reference to the accompanying drawings of the specification.
As shown in Figure 1, be the flow chart of proc file system initialization, specifically includes the following steps:
In S101, proc file system start-up course, application layer dynamically load ko file is into linux kernel.
S102, i2c_add_driver function registration I2C device drives are called.
S103, linux kernel create proc file Generic Optical Info.
S104, proc file system are associated with call back function.
S105, user's space layer generate proc file Generic Optical Info.
As shown in Fig. 2, being specifically included following to read the kernel implementation flow chart of DDMI information and read-write register function Step:
S201, linux kernel is sent a message to by echo or cat order with application layer, linux kernel, which will have been handled, to disappear The information that breath obtains is stored in proc file Generic Optical Info.
Write the method that register sends message are as follows:
echo[i2c_addr][offset][length][value…]>/proc/Generic Optical Info;
The method of read register transmission message are as follows:
echo[i2c_addr][offset][length]>/proc/Generic Optical Info;
Read the method that DDMI information sends message are as follows:
echo c[params]>/proc/Generic Optical Info。
Wherein, params parameter be transmitting optical power, received optical power, optical mode deblocking temperature, operating voltage, bias current with And the kernel macrodefinition of read register.
After linux kernel receives message, the information for having handled message acquisition is stored in proc file Generic In Optical Info, the method for user's acquisition register value and DDMI information:
cat/proc/Generic Optical Info
S202, judge whether the message format parsing of application layer transmitting is correct, if correctly, turning S204;Otherwise, turn S203。
S203, abnormal printing return, and turn S210.
S204, judge whether to read DDMI information, if so, turning S205;Otherwise, turn S207.
S205, corresponding DDMI information register value is obtained, and carries out digital-to-analogue conversion, turn S206.
S206, the register address (A0 or A2) for determining I2C access, send messages to I2C bus read-write register value, turn S210。
S207, judge whether read-write register value, if so, turning S208;Otherwise, turn S203.
The register address (A0 or A2) that S208, switching I2C are accessed, circulation, which is read and write, simultaneously adjusts syllable sequence, turns S209.
S209, I2C bus read-write register value is sent messages to, turns S210.
S210, end.
The present invention, linux kernel and the interaction of user's space layer are by the way of the interaction of proc file system, for different factories Family's optical mode block signal batch read-write A0, A2 register, is dynamically loaded into linux kernel, application layer is not necessarily to generation using ko form Code support, portable strong, the difference of maskable optical module producer read-write register application interface keeps optical module debugging simpler It is single and efficient, it is beneficial to the promotion of plant produced efficiency.
The present invention is not limited to above-mentioned preferred forms, anyone structure change made under the inspiration of the present invention, The technical schemes that are same or similar to the present invention are fallen within the scope of protection of the present invention.It should be noted that The term used in embodiments of the present invention is only to be not intended to limit the invention merely for for the purpose of describing particular embodiments. Packet is also intended in the embodiment of the present invention and the "an" of singular used in the attached claims, " described " and "the" Most forms are included, unless the context clearly indicates other meaning.It is also understood that term "and/or" used herein is Refer to and includes that one or more associated any or all of project listed may combine.

Claims (4)

1. a kind of method based on linux system reading-writing optical module register, which comprises the following steps:
S201, application layer send a message to linux kernel by echo or cat order, and linux kernel will handle message acquisition Information be stored in proc file;
S202, judge whether the message format parsing of application layer transmitting is correct, if correctly, turning S204;Otherwise, turn S203;
S203, abnormal printing return, and terminate;
S204, judge whether to read DDMI information, if so, turning S205;Otherwise, turn S207;
S205, corresponding DDMI information register value is obtained, and carries out digital-to-analogue conversion, turn S206;
S206, the register address for determining I2C access are A0 or A2, send messages to I2C bus read-write register value, and tie Beam;
S207, judge whether read-write register value, if so, turning S208;Otherwise, turn S203;
The register address that S208, switching I2C are accessed, circulation, which is read and write, simultaneously adjusts syllable sequence, turns S209;
S209, I2C bus read-write register value is sent messages to, and terminated;
The initialization of proc file system specifically includes the following steps:
In proc file system start-up course, the application layer dynamically load ko file is into the linux kernel;
Call i2c_add_driver function registration I2C device drives;
The linux kernel creates the proc file;
The proc file system is associated with call back function;
User's space layer generates the proc file;
The proc file is Generic Optical Info.
2. the method as described in claim 1 based on linux system reading-writing optical module register, which is characterized in that
Write the method that register sends message are as follows:
echo[i2c_addr][offset][length][value…]>/proc/Generic Optical Info;
The method of read register transmission message are as follows:
echo[i2c_addr][offset][length]>/proc/Generic Optical Info;
Read the method that DDMI information sends message are as follows:
echo c[params]>/proc/Generic Optical Info。
3. the method as claimed in claim 2 based on linux system reading-writing optical module register, which is characterized in that described Params parameter is transmitting optical power, received optical power, optical mode deblocking temperature, operating voltage, bias current and read register Kernel macrodefinition.
4. the method as described in claim 1 based on linux system reading-writing optical module register, which is characterized in that in S205 The method for obtaining corresponding DDMI information register value are as follows:
cat/proc/Generic Optical Info。
CN201610086835.2A 2016-02-16 2016-02-16 A method of based on linux system reading-writing optical module register Active CN105760318B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610086835.2A CN105760318B (en) 2016-02-16 2016-02-16 A method of based on linux system reading-writing optical module register

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610086835.2A CN105760318B (en) 2016-02-16 2016-02-16 A method of based on linux system reading-writing optical module register

Publications (2)

Publication Number Publication Date
CN105760318A CN105760318A (en) 2016-07-13
CN105760318B true CN105760318B (en) 2019-03-08

Family

ID=56330715

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610086835.2A Active CN105760318B (en) 2016-02-16 2016-02-16 A method of based on linux system reading-writing optical module register

Country Status (1)

Country Link
CN (1) CN105760318B (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106406752A (en) * 2016-08-29 2017-02-15 深圳新飞通光电子技术有限公司 Method for integrally migrating and storing batch test data by optical module
CN108519947A (en) * 2018-04-02 2018-09-11 郑州云海信息技术有限公司 The method and tool of read-write register under a kind of Linux
US11366913B2 (en) 2018-12-03 2022-06-21 Hewlett-Packard Development Company, L.P. Logic circuitry
WO2021080607A1 (en) 2019-10-25 2021-04-29 Hewlett-Packard Development Company, L.P. Logic circuitry package
US11338586B2 (en) 2018-12-03 2022-05-24 Hewlett-Packard Development Company, L.P. Logic circuitry
CN113165385B (en) 2018-12-03 2022-10-14 惠普发展公司,有限责任合伙企业 Logic circuit system
MX2021006165A (en) 2018-12-03 2021-07-15 Hewlett Packard Development Co Logic circuitry package.
EP3687820B1 (en) 2018-12-03 2022-03-23 Hewlett-Packard Development Company, L.P. Logic circuitry
EP3717262A1 (en) 2018-12-03 2020-10-07 Hewlett-Packard Development Company, L.P. Logic circuitry
US10894423B2 (en) 2018-12-03 2021-01-19 Hewlett-Packard Development Company, L.P. Logic circuitry
MX2021006484A (en) 2018-12-03 2021-07-02 Hewlett Packard Development Co Logic circuitry.
PT3682359T (en) 2018-12-03 2021-02-04 Hewlett Packard Development Co Logic circuitry
EP3695334A1 (en) 2018-12-03 2020-08-19 Hewlett Packard Enterprise Development Company LP Logic circuitry
CN111259618B (en) * 2020-01-10 2023-07-18 何刚 Design verification chip method based on register flow tool

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102394629A (en) * 2000-01-27 2012-03-28 瑞萨电子株式会社 Semiconductor device
CN102455969A (en) * 2010-12-15 2012-05-16 中标软件有限公司 Method for recording Linux serial communication log

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN202631620U (en) * 2012-05-15 2012-12-26 东莞铭普光磁股份有限公司 Optical module intelligent test board

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102394629A (en) * 2000-01-27 2012-03-28 瑞萨电子株式会社 Semiconductor device
CN102455969A (en) * 2010-12-15 2012-05-16 中标软件有限公司 Method for recording Linux serial communication log

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
proc文件***;goodluckwhh;《http://blog.csdn.net/goodluckwhh/article/details/17010029》;20131128;全文

Also Published As

Publication number Publication date
CN105760318A (en) 2016-07-13

Similar Documents

Publication Publication Date Title
CN105760318B (en) A method of based on linux system reading-writing optical module register
US9135130B2 (en) Debugging method, chip, board, and system
CN102694701B (en) Message based method of testing and system
US20170244792A1 (en) Power-Line Carrier Terminal Control Apparatus, System, and Method
EA024623B1 (en) Data transmission method and system and data transmitter
CN111541956A (en) Optical port self-adaption method, device, switch and computer readable storage medium
CN111246406A (en) Short message sending method, system, storage medium and terminal equipment
CN113596017B (en) Protocol analysis method and device, soft gateway and storage medium
US10652185B2 (en) Information sending method and information sending apparatus
CN103874047A (en) Service information finding method and equipment
CN112714082A (en) Ethernet chip for SV and GOOSE communication
EP3107231B1 (en) Data processing method and device
CN111416722B (en) Communication method and device
JP6951380B2 (en) Gateway device, communication method and program
CN111147530B (en) System, switching method, intelligent terminal and storage medium of multi-voice platform
CN115134427B (en) Communication protocol coordination method, device, computer equipment and storage medium
CN114942781A (en) Data format adaptation method and device for data reading
CN111554291B (en) Equipment control method, voice input terminal, voice platform and storage medium
CN110262459B (en) Fault information output control method and system
CN114301981A (en) Chip service agent method and related equipment
CN113300770A (en) Photoelectric port multiplexing device for 4G/5G TDD/FDD base station
CN115963750B (en) Dry and wet node acquisition circuit, method, terminal equipment and computer storage medium
CN111405619B (en) Information processing method, device, equipment and computer readable storage medium
CN203734730U (en) Communication device between stored program controlled telephone switching system and telephone terminal
CN111177977B (en) Data model construction method and device of energy system

Legal Events

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