Daniel
Thanks
--- In "Daniel Perron" <> wrote:
>
> This is a little code I wrote long time ago to get the rtc memory
on the
> TS7200.
>
>
>
> #include<unistd.h>
>
> #include<sys/types.h>
>
> #include<sys/mman.h>
>
> #include<stdio.h>
>
> #include<fcntl.h>
>
> #include<assert.h>
>
> #include "peekpoke.h"
>
> #include "rtc.h"
>
>
>
> volatile unsigned char * RtcAddress=NULL;
>
> volatile unsigned char * RtcData=NULL;
>
> int RtcHandle=-1;
>
>
>
> int InitRtc(void)
>
> {
>
> RtcHandle = open("/dev/mem",O_RDWR);
>
> if(RtcHandle<0) return(0);
>
>
>
>
>
>
>
> RtcAddress= (unsigned char *)
> mmap(0,getpagesize
(),PROT_WRITE|PROT_READ,MAP_SHARED,RtcHandle,0x10800000UL)
> ;
>
> if(RtcAddress == NULL)
>
> {
>
> CloseRtc();
>
> return(0);
>
> }
>
> RtcData = (unsigned char *) mmap(0, getpagesize(),
PROT_READ|PROT_WRITE,
> MAP_SHARED, RtcHandle, 0x11700000UL);
>
> if(RtcData == NULL)
>
> {
>
> CloseRtc();
>
> return(0);
>
> }
>
> return(1);
>
> }
>
>
>
>
>
> void CloseRtc(void)
>
> {
>
> if(RtcAddress)
>
> {
>
> munmap((void *)RtcAddress,getpagesize());
>
> RtcAddress=NULL;
>
> }
>
> if(RtcData)
>
> {
>
> munmap((void *)RtcData,getpagesize());
>
> RtcData=NULL;
>
> }
>
> if(RtcHandle>=0)
>
> {
>
> close(RtcHandle);
>
> RtcHandle=-1;
>
> }
>
> }
>
>
>
> unsigned char ReadRtc(unsigned char address)
>
> {
>
> *RtcAddress= address;
>
> return(*RtcData);
>
> }
>
>
>
> void WriteRtc(unsigned char address, unsigned char value)
>
> {
>
> *RtcAddress= address;
>
> *RtcData = value;
>
> }
>
>
>
>
>
> int ReadRtcBlock(unsigned char address,unsigned char size,unsigned
char *
> block)
>
> {
>
> short loop;
>
> short endp= (short) address + (short) size;
>
> if(endp>128) //can we change that to a bigger value?
>
> {
>
> endp=128;
>
> size= endp - address;
>
> }
>
> for(loop=address;loop<endp;loop++)
>
> *(block++)= ReadRtc(loop);
>
> return(size);
>
> }
>
> int WriteRtcBlock(unsigned char address,unsigned char size,unsigned
char *
> block)
>
> {
>
> short loop;
>
> short endp= (short) address + (short) size;
>
> if(endp>128)
>
> {
>
> endp=128;
>
> size= endp - address;
>
> }
>
> for(loop=address;loop<endp;loop++)
>
> WriteRtc(loop,*(block++));
>
> return(size);
>
> }
>
>
>
>
>
>
>
>
>
>
>
>
> -----Original Message-----
> From:
Behalf Of
> parayam2006
> Sent: Tuesday, April 18, 2006 11:37 AM
> To:
> Subject: [ts-7000] I need Memory Map for RTC TS-5620
>
>
> I Use real Time Clock TS-5620 in TS-7200. I need Memory Address
of Non
> Volatile RAM.
>
> Urgent... please
>
> /*******/
> Only for Spanish People..
> Para los Hipanos.
> Necesito usar la memoria no volatil del Reloj de Tiempo Real del
TS-
> 5600, lo instalé en un 7200 y solo tengo la dirección para un pc
> standard (070 y 071), la necsito para el 7200 arm
>
> Gracias
>
>
>
>
>
>
>
>
> --------------------------------------------------------------------
--------
> --
> YAHOO! GROUPS LINKS
>
> a.. Visit your group "ts-7000" on the web.
>
> b.. To unsubscribe from this group, send an email to:
>
>
> c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service.
>
>
> --------------------------------------------------------------------
--------
> --
>
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|