diff --git a/recipes-devtools/regs/files/regs.c b/recipes-devtools/regs/files/regs.c
new file mode 100644
index 0000000..93a3532
--- /dev/null
+++ b/recipes-devtools/regs/files/regs.c
@@ -0,0 +1,155 @@
+/*
+ * pcimem.c: Simple program to read/write from/to a pci device from userspace.
+ *
+ *  Copyright (C) 2010, Bill Farrow (bfarrow@beyondelectronics.us)
+ *
+ *  Based on the devmem2.c code
+ *  Copyright (C) 2000, Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl)
+ *
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <signal.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <termios.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+
+#define PRINT_ERROR \
+	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)
+
+void dump_page(uint32_t *vaddr, uint32_t *vbase, uint32_t *pbase){
+	
+	int i =0;
+	uint32_t *end = vaddr + (MAP_SIZE >> 6);
+	uint32_t *start = vaddr;
+
+	while(start  < end) {
+		printf("%p:%08x %08x %08x %08x\n",
+			start - vbase + pbase, start[0], start[1] , start[2], start[3]);
+		start+=4;
+	}
+}
+
+void reg_mod_bits(uint32_t *virt_addr, int data, int  start_bit, int data_len)
+{
+    int mask=0;
+    int value;
+    int i;
+
+    for (i = 0; i < data_len; i++) {
+        mask |= 1 << (start_bit + i);
+    }
+
+    value = *((volatile uint32_t *) virt_addr);
+    value &= ~mask;
+    value |= (data << start_bit) & mask;;
+
+    *((uint32_t *) virt_addr) = value;
+}
+
+void usage(void)
+{
+		fprintf(stderr, "\nUsage:\tregs [Type] [ Offset:Hex ] [ Data:Hex ] [StartBit:Dec] [DataLen:Dec]\n"
+			"\tType    : access operation type : [m]odify, [w]wite, [d]ump\n"
+			"\tOffset  : offset into memory region to act upon\n"
+			"\tData    : data to be written\n"
+			"\tStartbit: Startbit of Addr that want to be modified\n"
+			"\tDataLen : Data length of Data\n\n"
+			"Example:\tRead/Write/Modify register \n"
+			"\tRead    : regs d 0x1b100000           //dump 0x1b100000~0x1b1000f0 \n"
+			"\tWrite   : regs w 0x1b100000 0x1234    //write 0x1b100000=0x1234\n"
+			"\tModify  : regs m 0x1b100000 0x0 29 3  //modify 0x1b100000[29:31]=0\n");
+}
+
+int main(int argc, char **argv) {
+	int fd;
+	void *map_base = NULL;
+        void *virt_addr = NULL;
+	uint32_t read_result =0;
+        uint32_t writeval = 0;
+	uint32_t startbit = 0;
+       	uint32_t datalen = 0;
+	char *filename = NULL;
+	off_t offset = 0;
+	int access_type = 0;
+
+	if(argc < 2) {
+		usage();
+		exit(1);
+	}
+
+	access_type = tolower(argv[1][0]);
+	if((access_type == 'd' && argc < 3) || (access_type == 'w' && argc < 4) || (access_type == 'm' && argc < 6)) {
+		usage();
+		exit(1);
+	}
+
+	filename = "/dev/mem";
+	if((fd = open(filename, O_RDWR | O_SYNC)) == -1) 
+		PRINT_ERROR;
+
+	/* Map one page */
+	offset = strtoul(argv[2], NULL, 16);
+	map_base = mmap(0, 2*MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset & ~MAP_MASK);
+	if(map_base == (void *) -1) 
+		PRINT_ERROR;
+
+	virt_addr = map_base + (offset & MAP_MASK);
+	read_result = *((volatile uint32_t *) virt_addr);
+	printf("Value at 0x%X (%p): 0x%X\n", offset, virt_addr, read_result);
+
+	switch(access_type) {
+		case 'm':
+			writeval = strtoul(argv[3], 0, 16);
+			startbit = strtoul(argv[4], 0, 10);
+			datalen  = strtoul(argv[5], 0, 10);
+			reg_mod_bits((uint32_t *)virt_addr, writeval, startbit, datalen);
+			break;
+		case 'w':
+			writeval = strtoul(argv[3], 0, 16);
+			*((uint32_t *) virt_addr) = writeval;
+			break;
+		case 'd':
+			dump_page(virt_addr, map_base, (uint32_t *)(offset & ~MAP_MASK));
+			return;
+		default:
+			fprintf(stderr, "Illegal data type '%c'.\n", access_type);
+			exit(2);
+	}
+
+	read_result = *((volatile uint32_t *) virt_addr);
+	printf("Written 0x%X; Readback 0x%X\n", writeval, read_result);
+
+	if(munmap(map_base, MAP_SIZE) == -1) 
+		PRINT_ERROR;
+
+	close(fd);
+	return 0;
+}
