Hey group!
I currently have this JNI write byte operation:
JNIEXPORT jint JNICALL
Java_com_nextbus_signcontroller_mvc_TechnologicHAL_mmapWriteByte
(JNIEnv *env, jclass obj, jint address, jbyte value)
{
/* Use mmap() to map memory, then write byte to address */
off_t page;
volatile unsigned char *start;
int ret;
int fd;
fd = open("/dev/mem", O_RDWR);
if (fd == -1) return -1;
page = address & PAGE_MASK;
start = (unsigned char*)
mmap(0,getpagesize(),PROT_READ|PROT_WRITE,MAP_SHARED,fd,page);
if (start == MAP_FAILED) {
close(fd);
return -1;
}
*(start + (ADDR_MASK & address)) = value;
ret = munmap((void*)start,getpagesize());
close(fd);
return ret;
}
And I want to make it 32-bit. Is it as easy as making the 'value' parameter a
'jint'?
Thanks so much!
Alex
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|