devmem2-0.0/0000755000000000000000000000000011450303741007574 5ustar devmem2-0.0/devmem2.c0000644000000000000000000000673711450233056011315 0ustar /* * devmem2.c: Simple program to read/write from/to any location in memory. * * Copyright (C) 2000, Jan-Derk Bakker (jdb@lartmaker.nl) * * * This software has been developed for the LART computing board * (http://www.lart.tudelft.nl/). The development has been sponsored by * the Mobile MultiMedia Communications (http://www.mmc.tudelft.nl/) * and Ubiquitous Communications (http://www.ubicom.tudelft.nl/) * projects. * * * This program is free software; you can redistribute it and/or modify * it 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 * */ #include #include #include #include #include #include #include #include #include #include #include #define FATAL do { fprintf(stderr, "Error at line %d, file %s (%d) [%s]\n", \ __LINE__, __FILE__, errno, strerror(errno)); exit(1); } while(0) #define MAP_SIZE 4096UL #define MAP_MASK (MAP_SIZE - 1) int main(int argc, char **argv) { int fd; void *map_base, *virt_addr; unsigned long read_result, writeval; off_t target; int access_type = 'w'; if(argc < 2) { fprintf(stderr, "\nUsage:\t%s { address } [ type [ data ] ]\n" "\taddress : memory address to act upon\n" "\ttype : access operation type : [b]yte, [h]alfword, [w]ord\n" "\tdata : data to be written\n\n", argv[0]); exit(1); } target = strtoul(argv[1], 0, 0); if(argc > 2) access_type = tolower(argv[2][0]); if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) FATAL; printf("/dev/mem opened.\n"); fflush(stdout); /* Map one page */ map_base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, target & ~MAP_MASK); if(map_base == (void *) -1) FATAL; printf("Memory mapped at address %p.\n", map_base); fflush(stdout); virt_addr = map_base + (target & MAP_MASK); switch(access_type) { case 'b': read_result = *((unsigned char *) virt_addr); break; case 'h': read_result = *((unsigned short *) virt_addr); break; case 'w': read_result = *((unsigned long *) virt_addr); break; default: fprintf(stderr, "Illegal data type '%c'.\n", access_type); exit(2); } printf("Value at address 0x%X (%p): 0x%X\n", target, virt_addr, read_result); fflush(stdout); if(argc > 3) { writeval = strtoul(argv[3], 0, 0); switch(access_type) { case 'b': *((unsigned char *) virt_addr) = writeval; read_result = *((unsigned char *) virt_addr); break; case 'h': *((unsigned short *) virt_addr) = writeval; read_result = *((unsigned short *) virt_addr); break; case 'w': *((unsigned long *) virt_addr) = writeval; read_result = *((unsigned long *) virt_addr); break; } printf("Written 0x%X; readback 0x%X\n", writeval, read_result); fflush(stdout); } if(munmap(map_base, MAP_SIZE) == -1) FATAL; close(fd); return 0; } devmem2-0.0/debian/0000755000000000000000000000000011451166354011026 5ustar devmem2-0.0/debian/changelog0000644000000000000000000000026011451165740012674 0ustar devmem2 (0.0-0ubuntu1) maverick; urgency=low * Initial release (LP: #607752) -- Ricardo Salveti de Araujo Mon, 13 Sep 2010 02:18:47 -0300 devmem2-0.0/debian/compat0000644000000000000000000000000211450275170012220 0ustar 7 devmem2-0.0/debian/devmem2.10000644000000000000000000000274311450301124012436 0ustar .\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH DEVMEM2 1 "September 28, 2010" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME devmem2 \- simple program to read/write from/to any location in memory .SH SYNOPSIS .B devmem2 .RI "address [type [data]]" .SH DESCRIPTION .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invode bold face and italics, .\" respectively. \fBdevmem2\fP is a simple program to read/write from/to any location in memory. Useful when debugging embedded boards, e.g. beagleboard. .SH OPTIONS .TP .B address Memory address to act upon. .TP .B type Access operation type: [b]yte, [h]alfword, [w]ord. .TP .B data Data to be written. .SH AUTHOR devmem2 was written by Jan-Derk Bakker . .PP This manual page was written by Ricardo Salveti de Araujo , for the Debian project (and may be used by others). devmem2-0.0/debian/watch0000644000000000000000000000022311450233056012045 0ustar # Upstream does not release versioned tarballs. The latest version can # always be found here: # http://www.lartmaker.nl/lartware/port/devmem2.c devmem2-0.0/debian/rules0000755000000000000000000000020511450301662012073 0ustar #! /usr/bin/make -f %: dh $@ override_dh_auto_clean: rm -f devmem2 override_dh_auto_build: $(CC) $(CFLAGS) devmem2.c -o devmem2 devmem2-0.0/debian/devmem2.manpages0000644000000000000000000000002111450303663014066 0ustar debian/devmem2.1 devmem2-0.0/debian/copyright0000644000000000000000000000234611450301603012751 0ustar Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135 Name: devmem2 Maintainer: Jan-Derk Bakker Source: http://www.lartmaker.nl/lartware/port/devmem2.c Files: debian/* Copyright: 2010, Ricardo Salveti de Araujo License: GPL-2+ Files: devmem2.c Copyright: 2000, Jan-Derk Bakker License: GPL-2+ License: GPL-2+ This program is free software; you can redistribute it and/or modify it 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 package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. devmem2-0.0/debian/control0000644000000000000000000000113511450302441012415 0ustar Source: devmem2 Section: misc Priority: optional Maintainer: Ubuntu Developers Build-Depends: debhelper (>= 7) Standards-Version: 3.9.1 Homepage: http://www.lartmaker.nl/lartware/port/ Vcs-Bzr: lp:~rsalveti/+junk/devmem2 Vcs-Browser: http://bazaar.launchpad.net/~rsalveti/+junk/devmem2/files Package: devmem2 Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: simple program to read/write from/to any location in memory Simple program to read/write from/to any location in memory. Useful when debugging embedded boards, like beagleboard. devmem2-0.0/debian/install0000644000000000000000000000002011450233056012400 0ustar devmem2 usr/bin