GP32 Mrmirko's - Time & Directories


no_skill

gp2x! bananas! mayhem! mayham!
Joined
Jan 9, 2004
Messages
734
Age
38
Location
Austria
Website
72dpiarmy.com
hi,

are there any time functions in mrmirko's sdk other than the rtcclock things?

the rtc has a resolution of 1/66 second as far as i can remember, is there anything with a higher one (around 1-10 ms)?

i've tried clock, but it returns 16 all the time (i never thought i'd work, i was just curious).


two other questions:
is there a function to create directories in mirko's sdk?
is it possible to open a file in append mode (doc says no, but it shouldn't be a huge problem, or am i wrong).

thanks in advance, no_skill
 
uhm.. for the append mode.. just seek to the end of file... (the functions the sdk provide don't support an append mode.. the documentation says it all... there's nothing hidden)
about the directory...
dunno... i whish there's something...
 
nihil-00 posted on Jul 28 2004 at 08:33 AM said:
uhm.. for the append mode.. just seek to the end of file... (the functions the sdk provide don't support an append mode.. the documentation says it all... there's nothing hidden)
about the directory...
dunno... i whish there's something...
i've already thought about that, but: when opening with "r" you can only write (at least in theory, dunno if you can still write in mrmirko's).
and with "w" the file content gets deleted, or am i wrong?

loki said:
with rtc you allready have 15,625ms resolution...
if you want more, set up your own timer (timer4 is allready used by the sound mixer) with its own ISR

do you know how to set up a timer+isr with mirko's sdk? (i guess isr means interrupt ? routine).

i think the isr would be just like:
ticks++;

hmm... gotta look through mirko's rtc code.

i don't understand why the rtc doesn't already have a finer resolution (maybe i'm the only one who needs 1-10ms res?!?)
 
Last edited by a moderator:
no_skill posted on Jul 28 2004 at 08:22 AM said:
nihil-00 posted on Jul 28 2004 at 08:33 AM said:
uhm.. for the append mode.. just seek to the end of file... (the functions the sdk provide don't support an append mode.. the documentation says it all... there's nothing hidden)
about the directory...
dunno... i whish there's something...
i've already thought about that, but: when opening with "r" you can only write (at least in theory, dunno if you can still write in mrmirko's).
and with "w" the file content gets deleted, or am i wrong?

loki said:
with rtc you allready have 15,625ms resolution...
if you want more, set up your own timer (timer4 is allready used by the sound mixer) with its own ISR

do you know how to set up a timer+isr with mirko's sdk? (i guess isr means interrupt ? routine).

i think the isr would be just like:
ticks++;

hmm... gotta look through mirko's rtc code.

i don't understand why the rtc doesn't already have a finer resolution (maybe i'm the only one who needs 1-10ms res?!?)
Append Mode:

You can use the "w" mode for it:

#include "gp32.h"
#include "fileio.h"

GPFILE *gpfile;
gpfile = smc_fopen("dev0:\\delete.me","w");
if (gpfile) {
int size=0;
char buffer1[20]="I like ";
char buffer2[20]="my gp32. ";
size=smc_fwrite((u8*)buffer1 ,10, 1,gpfile);
size=smc_fwrite((u8*)buffer2 ,10, 1,gpfile);
smc_fclose(gpfile);
}
// The second buffer is APPENDED to the first ...

The Realtime clock highest resolution is 1/64 sec ticks.
It is cpu clock independent, so i would use this one.
You can use timer 0-3, but the setup is on your own.
( look at soundmixer ho i setup timer4 )
 
Last edited by a moderator:
thanks for replying mirko!


if the append mode is that easy, why don't you have it in the sdk straight away?
and why is the rtc in the sdk not set to a more common value like 1/100 or 1/1000?

and why's there no createdirectory function?

all stuff for 0.90 (+including gp32_prototypes by default)... maybe
 
you sound like you know it. wouldn't be just answering straight away be far more efficient?

eg: just say: the clock is too slow to resolve 1/1000 s
 
max rtc resolution is 1/64s.
but you can setup timers to any resolution you want (up to micro sec)
if you want sample code, take a look at mr.mirko's soundmixer module

read the ref manual, i'm not saying that because i don't want to answer, but because you understand something easier when you have to learn it by yoursefl... (and you dont have to wait for answers. btw:which could be wrong)
anyway the ref manual is gold mine for everything, every devlopper should at least read it once
 
thanks.

i guess rtc & timer are two different things ( i thought the rtc is just a timer set to the rtc speed).

i'll go through the reference (guessing that it's the user manual).
 
no_skill posted on Jul 28 2004 at 10:30 AM said:
thanks for replying mirko!


if the append mode is that easy, why don't you have it in the sdk straight away?
and why is the rtc in the sdk not set to a more common value like 1/100 or 1/1000?

and why's there no createdirectory function?

all stuff for 0.90 (+including gp32_prototypes by default)... maybe
>if the append mode is that easy, why don't you have it in the sdk straight away?

Have a look to the html Manual, all smc functions a described there.
If you dont know, how to handle fwrite, have a look to a libc book.


>and why is the rtc in the sdk not set to a more common value like 1/100 or 1/1000?

The hardware limits the rtc to 1/64 resolution. Please have a look to the Hardware.pdf book next time, before asking ...


>and why's there no createdirectory function?

couse iam to lazy to write this 5 lines of c code :)


>all stuff for 0.90 (+including gp32_prototypes by default)... maybe

maybe...
 
Last edited by a moderator:
uhm...the createdir function would be VERY appreciated :) i don't think you're THAT lazy ;)
 
>>if the append mode is that easy, why don't you have it in the sdk straight away?
>
>Have a look to the html Manual, all smc functions a described there.
>If you dont know, how to handle fwrite, have a look to a libc book.
i still think something elementary like fopen("a") should be in the sdk. instead of having to rewrite this all the time.

>>and why is the rtc in the sdk not set to a more common value like 1/100 or 1/1000?
>
>The hardware limits the rtc to 1/64 resolution. Please have a look to the Hardware.pdf >book next time, before asking ...
kk. you could put that in the manual before other people ask.


>>and why's there no createdirectory function?
>
>couse iam to lazy to write this 5 lines of c code :)
i don't know what i have to do to create a directory on the smc. but the original sdk had function and i think it'd be quite useful.
and again: i know that i can write this 5 lines of code myself, but in my opinion directory creation is one of the jobs of the sdk (as the sdk is a partial standard lib implementation) as well as fopen("a");
 
I don't understand why Mr. Mirko decided to make these RTC functions in the first place. I mean, he says that the real RTC has a resolution of 1/64, but it's not the hardware RTC in the first place, it's just a timer set up to run at the same resolution.

I agree with no_skill that at 1/100 timer would be better, unless someone can think of a good reason otherwise?

Why have a timer to emulate a piece of GP32 hardware that never even worked?
 
rattboi24 posted on Jul 28 2004 at 06:48 PM said:
I don't understand why Mr. Mirko decided to make these RTC functions in the first place. I mean, he says that the real RTC has a resolution of 1/64, but it's not the hardware RTC in the first place, it's just a timer set up to run at the same resolution.

I agree with no_skill that at 1/100 timer would be better, unless someone can think of a good reason otherwise?

Why have a timer to emulate a piece of GP32 hardware that never even worked?
what are you talking about?
rtc is a piece of hardware of the s3c2400 completly different from the timers...
timers resolution depends on FCLK speed, where rtc don't

rtc resolution is enough for most projects (1/64 or 1/100... you are talking of 5ms difference)... and it's woking like a charm, but not when your gp32 is off
 
Last edited by a moderator:
Nevermind,

I reviewed the code again, and this time it made more sense.

It just sets the rTICINT up for resolution, and enables it with rCLKCON |= 0x800;

Then there's a IRQ set up for it, and that's just a basic counter, right?

Sorry before. I looked at the code, but didn't really see any RTC stuff. Didn't know TICINT was for RTC.
 
Back
Top