/* * Copyright (c) 2013 Yasushi Oshima, All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY YASUSHI OSHIMA ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. */ #include #include #include #include #define SRAMDEV "/dev/sram" int getcrtmod() { int sramfd; int i; int ret; struct sram_io sramio; sramio.offset = 0x10; if ((sramfd = open(SRAMDEV,O_RDONLY) ) < 0 ) { return -1; } if (ioctl (sramfd, SIOGSRAM, &sramio) < 0) { perror("ioctl:"); close (sramfd); return -1; } ret = sramio.sram[13]; close (sramfd); return ret; }