📄 pcisim_memdev.h
字号:
#ifndef __pcisim_memdev_H#define __pcisim_memdev_H/* * Copyright (c) 2002 Picture Elements, Inc. * Stephen Williams (steve@picturel.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU * General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */#ident "$Id: pcisim_memdev.h,v 1.4 2003/09/16 23:38:08 steve Exp $"/* * The pci_memory module implements a PCI target memory region with * some extra smarts. Once initialized, the device can be used as a * memory target by other devices on the PCI bus. * * Vendor ID: 0x12c5 (Picture Elements, Inc.) * Device ID: 0xffc0 */typedef struct pcisim_memdev_s *pcisim_memdev_t;#ifdef __cplusplus# define EXTERN_C_START extern "C" {# define EXTERN_C_END }#else# define EXTERN_C_START# define EXTERN_C_END#endifEXTERN_C_START/* * Given a config space base address, open the pcisim_memdev * device. The config address depends on the system configuration, * which attaches idsel signals for the device to the right * places. The device should already have been mapped into the address * space by whatever BIOS is being used. */extern pcisim_memdev_t pcisim_memdev_init(unsigned config);/* * Get the base address of the main memory. This is the address * programmed into BAR0, with the flags removed. This is the address * that can be passed to other devices as pointers. */extern unsigned long pcisim_memdev_start(pcisim_memdev_t xsp);/* * This function causes a region of memory to be filled with a given * value. The "off" parameter is the offset into the memory area, and * the cnt is the number of DWORDS to fill. The fill parameter is the * value to write into the memory. * * The offset must be a multiple of 4, and cnt is the number of * *DWORDS*, not bytes. */extern void pcisim_memdev_fill(pcisim_memdev_t xsp, unsigned long off, unsigned cnt, unsigned long fill);/* * This function does a BYTE compare of two regions within the * memory. The off0 and off1 arguments are the offsets within this * memory of the regions to compare, and the cnt is the number of * bytes to compare. * * This function returns 0 if the regions are identical. */extern int pcisim_memdev_compare(pcisim_memdev_t xsp, unsigned long off0, unsigned long off1, unsigned cnt);/* * These commands tell the memory device to load/save data to/from a * host file. The return code is the number of bytes of I/O, or a * value <0 for an error. */extern int pcisim_memdev_load(pcisim_memdev_t xsp, unsigned long offset, unsigned long count, const char*path);extern int pcisim_memdev_save(pcisim_memdev_t xsp, unsigned long offset, unsigned long count, const char*path);EXTERN_C_END/* * $Log: pcisim_memdev.h,v $ * Revision 1.4 2003/09/16 23:38:08 steve * Add load and save commands. * * Revision 1.3 2002/10/16 16:54:24 steve * Copyright and License notice. * * Revision 1.2 2002/09/08 00:03:10 steve * Reorder compare parameters to be consistent with memcmp * * Revision 1.1 2002/08/22 01:30:06 steve * Add the pcisim memdev device to the library. * */#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -