Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.1:Update
irda
irda-0.9.18-findchip-ppc.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File irda-0.9.18-findchip-ppc.diff of Package irda
Wed Feb 16 18:00:05 CET 2000 - uli@suse.de - added support for PPC (untested, might work on CHRP and PReP) --- findchip/findchip.c +++ findchip/findchip.c @@ -34,7 +34,16 @@ #include <stdlib.h> #include <unistd.h> #include <fcntl.h> + +#ifdef __powerpc__ +#include <asm/io.h> +unsigned long isa_io_base; +#include <sys/mman.h> +#include <fcntl.h> +#else #include <sys/io.h> +#endif + #include <string.h> #include "findchip.h" @@ -122,10 +131,74 @@ } } +#ifdef __powerpc__ + { + FILE *fd1; + int fd2; + unsigned char buffer[1024]; + unsigned long phys_io_base=0; + + fd1=fopen("/proc/cpuinfo","r"); + if(fd1 == NULL) + { + printf("Cannot open /proc/cpuinfo, unable to determine architecture.\n"); + exit(42); + } + + while(fgets(buffer,1024,fd1)) + { +#ifdef PPCIODEBUG + printf("buffer: %s\n",buffer); +#endif + if(strncmp(buffer,"machine",7)==0) + { +#ifdef PPCIODEBUG + printf("found\n"); +#endif + if(strstr(buffer,"CHRP")) + phys_io_base=CHRP_ISA_IO_BASE; + else if(strstr(buffer,"PReP") || strstr(buffer,"PREP")) + phys_io_base=PREP_ISA_IO_BASE; + } + } + fclose(fd1); + if (phys_io_base==0) + { + printf("Unknown architecture (currently supported: CHRP, PREP)\n"); + exit(43); + } + + fd2=open("/dev/mem",O_RDWR); + if(fd2 < 0) + { + printf("Cannot open /dev/mem, unable to mmap IO space.\n"); + exit(44); + } + + isa_io_base=(unsigned int) mmap((caddr_t)0, + 64<<10, + PROT_READ|PROT_WRITE, + MAP_SHARED, + fd2, + phys_io_base); + + if(isa_io_base==(unsigned int)MAP_FAILED) + { + printf("mmap'ing IO space failed.\n"); + close(fd2); + exit(45); + } + + close(fd2); + + } + +#else /* __powerpc__ */ if (ioperm(0x0, 0x3ff, 1)) { perror("Set i/o permission"); exit(0); } +#endif /* Probe the chips! */ do {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor