diff options
author | Steve Arnold <stephen.arnold42@gmail.com> | 2015-04-11 18:38:39 -0700 |
---|---|---|
committer | Steve Arnold <stephen.arnold42@gmail.com> | 2015-04-11 18:38:39 -0700 |
commit | 4523ce2acb3299a1eeef0cc8ded11ce9a459e2dc (patch) | |
tree | 70c96dc552732347d64cf4297b71d3f89c5de422 /dev-util | |
parent | initial test commit of devmem2 utility (diff) | |
download | arm-4523ce2acb3299a1eeef0cc8ded11ce9a459e2dc.tar.gz arm-4523ce2acb3299a1eeef0cc8ded11ce9a459e2dc.tar.bz2 arm-4523ce2acb3299a1eeef0cc8ded11ce9a459e2dc.zip |
updated ebuild to match upstream makefile changes
Diffstat (limited to 'dev-util')
-rw-r--r-- | dev-util/devmem2/Manifest | 6 | ||||
-rw-r--r-- | dev-util/devmem2/devmem2-20040805.ebuild | 6 | ||||
-rw-r--r-- | dev-util/devmem2/files/Makefile | 7 | ||||
-rw-r--r-- | dev-util/devmem2/files/devmem2.c | 117 |
4 files changed, 70 insertions, 66 deletions
diff --git a/dev-util/devmem2/Manifest b/dev-util/devmem2/Manifest index f4a19e5..7eb249d 100644 --- a/dev-util/devmem2/Manifest +++ b/dev-util/devmem2/Manifest @@ -1,3 +1,3 @@ -AUX Makefile 72 SHA256 e550bd019879bec56592cf44d967f7bda3abd8f75687694a7cc9d9cb8208d02d SHA512 b2b42ae47c9f0724309bce4e4aff611b650f746d17984b131554068e6bcabe67e7c92d885d0cc55034b46ba476e37b4fb3b338a3a3f7c7e3ccef539185db427f WHIRLPOOL 06fbadd1ea7b363d124454ccffe6086ed336b79d66fcdaa62accecde8ac753bce2f4588d3dd9af446261d414363bd119bfeb1552836a033bf94ceaa581f2571b -AUX devmem2.c 3551 SHA256 ec382c90af3ef2f49695ff14a4d6521e58ac482c4e29d6c9ebca8768f699c191 SHA512 e3e46203492a1b4c9a292f59b2d998e79fd40dd82b5b8c99ce52af466819e34b3ccc3234b726560264a744716955fe24d69685760ae431fefef87237b4e5f83d WHIRLPOOL 38e964718116bd52d1ca9e3af950b9730dbcc36e078572c6d32d41cb4ccaa69a9212bae47ebd9a85b6a33216dc229e5d3810f38dda86f4da8e7f6021a08c996a -EBUILD devmem2-20040805.ebuild 566 SHA256 386ec90bd495d490f1ac562b056dc6f7899bb11af681d7322dd06f81b30df125 SHA512 7ffe3138b80ad6e61723ea47ce0274bc8244fdfd3a274cbd228946ad0baa6832338b25be7e751fe18c2fdcca12b1c7cb0c5ae7f1d2ea04f00aad111943b1e80d WHIRLPOOL 16e89f9d540c307b75ff9a43cd085b430782522985bfa7015bedfc0f296b1d33c43882b656d4802e14cf5c389dd8a7a574195b7689ea8a2fe80c684499575070 +AUX Makefile 170 SHA256 053e359680035e82e4bf646a6229927c4762ef50e02333259ead03943df4c549 SHA512 62f34b6d5d4c9b409814fae5a479a1de769b93f585cca0ba24b9c8e825c5f607e780d13bd1b697b666024ded5269fecb625c4d97dc731315095020c9fe01a244 WHIRLPOOL 8d1a682dacef4ca39ab1b4747dabb0df424c990bfcd1fa5b9eecae2c3375e51c8c66b59d19e2e392d426a5a2d0009ae1eaa3b57260ba12b4f83a97564e02d882 +AUX devmem2.c 3895 SHA256 b476a0e2462d4d17343b06de79ea78789380e9d05d6280afb74446a65dee40a5 SHA512 edf0f72081b6ab67734a722113781c945d5678c88716575a58628ab77c00a3e091591dd63c263b6c384ad2e4377c2c5a2d3846672625d6cef0407045e64cdbf2 WHIRLPOOL e5f06ac21415342821256886d34daa86cd5d13b05483fde541779e4df29eda194b22345e5d057ab3f8a30a419814b558f227215142172d7c21b67024e060d463 +EBUILD devmem2-20040805.ebuild 500 SHA256 d57a6ec6af87712d6a1c642f0feeb3cf78efcc2775e164ba314c7d285758dab0 SHA512 b3c7f5fad09cb580d3e8bd55ac6e5dabb4ae17b081ad39603c02adf35a7fc9b7bde0047a2b6b8d705d8e290b75e523554928138e2755e4d57fc8259cc56441f3 WHIRLPOOL 1e90068e677fae0d7ffbda4b957aa2c80758a94d90c3d5fcc4fcc8c012fb34615aaf7d9a2da4e45e2f255a742a8fb595ec0fa871baccae271742baf889d406a4 diff --git a/dev-util/devmem2/devmem2-20040805.ebuild b/dev-util/devmem2/devmem2-20040805.ebuild index 31d0f42..764b255 100644 --- a/dev-util/devmem2/devmem2-20040805.ebuild +++ b/dev-util/devmem2/devmem2-20040805.ebuild @@ -2,6 +2,8 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: $ +EAPI=4 + inherit toolchain-funcs DESCRIPTION="Simple program to read/write from/to any location in memory." @@ -25,7 +27,3 @@ src_compile() { emake CC=$(tc-getCC) || die "make failed..." } -src_install() { - dobin "${WORKDIR}/devmem2" || die "install failed..." -} - diff --git a/dev-util/devmem2/files/Makefile b/dev-util/devmem2/files/Makefile index bdcac70..831c374 100644 --- a/dev-util/devmem2/files/Makefile +++ b/dev-util/devmem2/files/Makefile @@ -2,3 +2,10 @@ SRC=devmem2.c devmem2: $(SRC) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(SRC) + +install: + mkdir -p $(DESTDIR)/usr/bin + install devmem2 $(DESTDIR)/usr/bin + +clean: + rm -f devmem2 diff --git a/dev-util/devmem2/files/devmem2.c b/dev-util/devmem2/files/devmem2.c index 9bcb79d..74e41d2 100644 --- a/dev-util/devmem2/files/devmem2.c +++ b/dev-util/devmem2/files/devmem2.c @@ -20,7 +20,7 @@ * 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 @@ -38,84 +38,83 @@ #include <termios.h> #include <sys/types.h> #include <sys/mman.h> - + #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); + 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(argc > 2) + access_type = tolower(argv[2][0]); if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) FATAL; - printf("/dev/mem opened.\n"); + 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); + 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); + 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%lld (%p): 0x%lu\n", (long long)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; + 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%lu; readback 0x%lu\n", writeval, read_result); + fflush(stdout); + } + + if(munmap(map_base, MAP_SIZE) == -1) FATAL; close(fd); return 0; } - |