/* * * Title: cldump * Description: dump the current register values for the Cirrus Logic PCMCIA controler * on the In Hand Electronics ELF board * * this program was developed using the devmem2.c application from Jan-Derk Bakker as a base. * * 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) #define PCCardIndexRegister 0x300003e0 #define PCCardDataRegister 0x300003e1 int main(int argc, char **argv) { int fd; void *map_base, *virt_addr; unsigned long read_result, writeval,i,begin_reg=0,end_reg=0x6; off_t target; int access_type = 'b'; if(argc > 1) { begin_reg = strtoul(argv[1], 0, 0); if(argc > 2) { end_reg = strtoul(argv[2], 0, 0); } } if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) FATAL; for(i=begin_reg;i