摘要:
本发明公开了一种基于Linux系统读写光模块寄存器的方法,包括:发消息到内核,内核将信息存在proc文件;若消息格式解析不正确,则异常返回并结束,否则判断是否读取DDMI信息,若是则获取DDMI信息寄存器值,确定I2C访问的寄存器,发消息给I2C总线读写寄存器值并结束;否则,判断是否读写寄存器值,若否,异常返回并结束,否则切换I2C访问的寄存器,循环读写并调整字节序,发消息给I2C总线读写寄存器值. The present invention discloses a Linux-based system to read and write optical module register, comprising: a message to the kernel, there will proc file information; if the message format parsing is not correct, and the end of the abnormal returns, otherwise it is determined whether read DDMI information, if the information is acquired DDMI register values, determined I2C-accessible registers, a message to the I2C bus to read and write register values and ends; otherwise, it is determined whether the read and write register values, if not, and the end of the abnormal returns, otherwise switching I2C access register, read and write cycle and adjust the byte order, a message to the I2C bus to read and write register values. 本发明,内核和用户空间层采用proc文件系统交互方式,针对不同光模块信号批量读写A0,A2寄存器,应用层可移植性强,可屏蔽读写寄存器应用接口的差异,使光模块调试更简单和高效,提升工厂生产效率. The present invention, kernel and user space layer using proc file system interactively, read and write signals A0 optical modules for different batches, A2 register, application portability layer, the shield can read and write registers application interface differences, the optical module and commissioning simple and efficient, improve plant productivity.
展开