dimmdriver.java

来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 66 行

JAVA
66
字号
/*
 * $Id: DIMMDriver.java,v 1.1 2003/11/25 11:42:37 epr Exp $
 */
package org.jnode.driver.smbus;

import java.io.IOException;
import java.security.InvalidParameterException;

import org.apache.log4j.Logger;
import org.jnode.driver.Driver;

/**
 * DIMM device driver.
 * 
 * <p>
 * Title:
 * </p>
 * <p>
 * Description:
 * </p>
 * <p>
 * Licence: GNU LGPL
 * </p>
 * <p>
 * </p>
 * 
 * @author Francois-Frederic Ozog
 * @version 1.0
 */

public class DIMMDriver extends Driver {

	private final Logger log = Logger.getLogger(getClass());
	private SMBus bus;
	private byte address;
	private DIMM dimmDevice;
	private int spdTableLength = 0;
	private byte[] spdTable = null;

	public DIMMDriver(SMBus bus, byte address) {
		this.bus = bus;
		this.address = address;
	}
	protected void stopDevice() throws org.jnode.driver.DriverException {
		/** @todo Implement this org.jnode.driver.Driver abstract method */
	}
	protected void startDevice() throws org.jnode.driver.DriverException {
		dimmDevice = (DIMM) getDevice();
		// now read the SPD table
		try {
			log.debug("Getting SPD Table from " + dimmDevice.getId() + ":");
			spdTableLength = (bus.readByte(address, (byte) 0)) & 0xff;
			log.debug(" length=" + spdTableLength);
			spdTable = new byte[spdTableLength];
			spdTable[0] = (byte) spdTableLength;
			for (int i = 1; i < spdTableLength; i++)
				spdTable[i] = bus.readByte(address, (byte) i);
			dimmDevice.setSPDTable(spdTable);
		} catch (UnsupportedOperationException ex) {
		} catch (IOException ex) {
		} catch (InvalidParameterException ex) {
		}

	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?