All of lore.kernel.org
 help / color / mirror / Atom feed
From: ecalvo@2se.es <ecalvo@2se.es>
To: openrisc@lists.librecores.org
Subject: [OpenRISC] tick timer doubt
Date: Mon, 25 Nov 2019 09:20:16 +0100	[thread overview]
Message-ID: <00b501d5a369$2b89ea90$829dbfb0$@2se.es> (raw)
In-Reply-To: <CAAfxs75A61B8H8iBS1ibXo2SGg=fY9jBjsNAucSFASBVP=rp+g@mail.gmail.com>

Hello, 

 

 

Yeah, I think that I have understood what you have sent me in the screenshot. 

 

The example that I am referring is this one: 

 

Example for using the default mode:

int main() {

uint32_t ticks = 0;

uint32_t timerstate;

 <https://www.openrisc.io/newlib/docs/html/group__or1k__timer.html#ga432f34016f4f559c29b0be4fbc87e623> or1k_timer_init(100);

 <https://www.openrisc.io/newlib/docs/html/group__or1k__timer.html#ga369138d63850f2a4dfe216315c31f3d4> or1k_timer_enable();

while (1) {

while (ticks ==  <https://www.openrisc.io/newlib/docs/html/group__or1k__timer.html#ga2baa18c5153c793b7d2a85c6e224cea0> or1k_timer_get_ticks()) { }

timerstate =  <https://www.openrisc.io/newlib/docs/html/group__or1k__timer.html#gab40473a360aa82273575cdbc4381ac93> or1k_timer_disable();

// do something atomar

 <https://www.openrisc.io/newlib/docs/html/group__or1k__timer.html#ga0e392edcf73b9cf1c0279471ae59d241> or1k_timer_restore(timerstate);

if (ticks == 100) {

printf("A second elapsed\n");

 <https://www.openrisc.io/newlib/docs/html/group__or1k__timer.html#ga456bc40cdfbbbdfd62c936c065457cc2> or1k_timer_reset_ticks();

ticks = 0;

}

}

}

It is in the file and also here: https://www.openrisc.io/newlib/docs/html/group__or1k__timer.html#gaf760867d2f9d04f0c101c4c4975b0616

 

Elisa

 

De: Stafford Horne <shorne@gmail.com> 
Enviado el: domingo, 24 de noviembre de 2019 1:05
Para: ecalvo at 2se.es
CC: Openrisc <openrisc@lists.librecores.org>
Asunto: Re: [OpenRISC] tick timer doubt

 

Hello,

 

Which example are you referring to?  Have you been able to read the architecture specification and understand section 15 on tick timer facility?  There ttmr is explained, the value 10000000 I think indicates a pending timer interrupt.

 

See the attached screenshot.

 

-stafford

 

On Fri, Nov 22, 2019, 10:41 PM <ecalvo at 2se.es <mailto:ecalvo@2se.es> > wrote:

Hi!!

 

I have some doubts about the tick timer. Could someone help me? I explain them below

 

*	I don’t understand really well the example of or1k timer control that is in that file: For example, how is ticks variable updated? 
*	If it was updated, I understand that if frequency is 100Hz, a new tick takes place each 0.01 seg and with 100 ticks, a second has elapsed. However, If I compile and run this code and, and I open with gtkwave the generated vcd, I don’t understand why the value of TTMR register is 1000000. Is The value of TTMR register fixed by software using or1k_timer_set_period function? Is it measured in Hz?

 

Thanks in advance

_______________________________________________
OpenRISC mailing list
OpenRISC at lists.librecores.org <mailto:OpenRISC@lists.librecores.org> 
https://lists.librecores.org/listinfo/openrisc

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.librecores.org/pipermail/openrisc/attachments/20191125/a68c89e1/attachment.html>

  reply	other threads:[~2019-11-25  8:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-22 13:41 [OpenRISC] tick timer doubt ecalvo
2019-11-24  0:04 ` Stafford Horne
2019-11-25  8:20   ` ecalvo [this message]
2019-11-25  9:22     ` Stafford Horne
2019-11-25 10:09       ` ecalvo
2019-11-25 13:03         ` Stafford Horne
2019-11-25 13:24           ` ecalvo
2019-11-25 23:12             ` Stafford Horne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='00b501d5a369$2b89ea90$829dbfb0$@2se.es' \
    --to=ecalvo@2se.es \
    --cc=openrisc@lists.librecores.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.