📄 eeprom_api.h
字号:
#ifndef EEPROM_API_H
#define EEPROM_API_H
/************************************************************************
*
* EEPROM_api.h
*
* The 'EEPROM_api' module defines the EEPROM device driver
* interface to be used via 'EEPROM' device driver services:
*
* 1) init serial device: configure and initialize EEPROM driver
* 2) open serial device: not used
* 3) close serial device: not used
* 4) read serial device: read EEPROM device
* 5) write serial device: write EEPROM device
* 6) ctrl serial device: not used
*
*
*
* ######################################################################
*
* Copyright (c) 1999-2000 MIPS Technologies, Inc. All rights reserved.
*
* Unpublished rights reserved under the Copyright Laws of the United States of
* America.
*
* This document contains information that is proprietary to MIPS Technologies,
* Inc. ("MIPS Technologies"). Any copying, modifying or use of this information
* (in whole or in part) which is not expressly permitted in writing by MIPS
* Technologies or a contractually-authorized third party is strictly
* prohibited. At a minimum, this information is protected under unfair
* competition laws and the expression of the information contained herein is
* protected under federal copyright laws. Violations thereof may result in
* criminal penalties and fines.
* MIPS Technologies or any contractually-authorized third party reserves the
* right to change the information contained in this document to improve
* function, design or otherwise. MIPS Technologies does not assume any
* liability arising out of the application or use of this information. Any
* license under patent rights or any other intellectual property rights owned
* by MIPS Technologies or third parties shall be conveyed by MIPS Technologies
* or any contractually-authorized third party in a separate license agreement
* between the parties.
* The information contained in this document constitutes one or more of the
* following: commercial computer software, commercial computer software
* documentation or other commercial items. If the user of this information, or
* any related documentation of any kind, including related technical data or
* manuals, is an agency, department, or other entity of the United States
* government ("Government"), the use, duplication, reproduction, release,
* modification, disclosure, or transfer of this information, or any related
* documentation of any kind, is restricted in accordance with Federal
* Acquisition Regulation 12.212 for civilian agencies and Defense Federal
* Acquisition Regulation Supplement 227.7202 for military agencies. The use of
* this information by the Government is further restricted in accordance with
* the terms of the license agreement(s) and/or applicable contract terms and
* conditions covering this information from MIPS Technologies or any
* contractually-authorized third party.
*
************************************************************************/
/************************************************************************
* Include files
************************************************************************/
#include "sysdefs.h"
#include "syserror.h"
/************************************************************************
* EEPROM device driver, ERROR completion codes
*************************************************************************/
typedef enum EEPROM_error_ids
{
ERROR_EEPROM_COMM_ERROR /* Communication error detected */
= ERROR_EEPROM,
ERROR_EEPROM_UNKNOWN_DEVICE, /* Unknown minor device */
ERROR_EEPROM_PARAM_OUT_OF_SPACE, /* offset+length exceeds EEPROM space */
ERROR_EEPROM_READ_ONLY, /* EEPROM is read-only */
/******* ADD NEW IO ERROR TAGS JUST BEFORE THIS LINE ONLY *******/
} t_EEPROM_error_ids;
/************************************************************************
* Parameter definitions
*************************************************************************/
/*
EEPROM read descriptor, to be used with EEPROM-'read' service
*/
typedef struct EEPROM_read_descriptor
{
UINT32 offset ; /* EEPROM byte offset address */
UINT32 length ; /* number of bytes to read */
UINT8 *buffer ; /* pointer for buffer to store read data */
} t_EEPROM_read_descriptor ;
/*
EEPROM write descriptor, to be used with EEPROM-'write' service
*/
typedef struct EEPROM_write_descriptor
{
UINT32 offset ; /* EEPROM byte offset address */
UINT32 length ; /* number of bytes to write */
UINT8 *buffer ; /* pointer for buffer of data to be written */
} t_EEPROM_write_descriptor ;
/************************************************************************
* EEPROM device driver, minor device numbers
*************************************************************************/
typedef enum EEPROM_MINOR_devices
{
EEPROM_MINOR_NM24C09 = 0, /* System: Fairchild, 1024 byte,
upper 512 byte write-protected */
EEPROM_MINOR_SPD000, /* PC-SDRAM */
EEPROM_MINOR_DEVICE_COUNT /* number of minor EEPROM devices */
} t_EEPROM_MINOR_devices ;
/************************************************************************
* EEPROM device driver services, called by IO subsystem
*************************************************************************/
/*
NAME: 'init'
DESCRIPTION:
This service initializes the EEPROM driver to handle all
EEPROM devices on this board environment (set of minor devices)
RETURN VALUES:
'OK' = 0x00
*/
typedef INT32 (*t_EEPROM_init_service)(
UINT32 major, /* IN: major device number */
UINT32 minor, /* not used */
void *p_param ) ; /* not used */
/*
NAME: 'open' NOT USED
DESCRIPTION:
-
RETURN VALUES:
-
*/
/*
NAME: 'close' NOT USED
DESCRIPTION:
-
RETURN VALUES:
-
*/
/*
NAME: 'read'
DESCRIPTION:
This service reads data from a specified location of a specified
EEPROM device.
RETURN VALUES:
'OK' = 0x00: specified EEPROM value read
'ERROR_EEPROM_COMM_ERROR': communication error detected
*/
typedef INT32 (*t_EEPROM_read_service)(
UINT32 major, /* IN: major device number */
UINT32 minor, /* IN: minor device number */
t_EEPROM_read_descriptor *p_param ) ; /* INOUT: read data */
/*
NAME: 'write'
DESCRIPTION:
This service writes data into a specified location of a specified
EEPROM device.
RETURN VALUES:
'OK' = 0x00: specified EEPROM value written
'ERROR_EEPROM_COMM_ERROR': communication error detected
*/
typedef INT32 (*t_EEPROM_write_service)(
UINT32 major, /* IN: major device number */
UINT32 minor, /* IN: minor device number */
t_EEPROM_write_descriptor *p_param ) ; /* OUT: write data */
/*
NAME: 'ctrl' NOT USED
DESCRIPTION:
-
RETURN VALUES:
-
*/
#endif /* #ifndef EEPROM_API_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -