KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
tm.c
1 /*
2  * KM3NeT CLB v2 Firmware
3  * ----------------------
4  *
5  * Copyright 2013 KM3NeT Collaboration
6  *
7  * All Rights Reserved.
8  *
9  *
10  * File : time.c
11  * Created : 8 mrt. 2013
12  * Author : Vincent van Beveren
13  */
14 
15 #include "tm.h"
16 #include "lm32soc/lm32.h"
17 
18 void timeDelay(uint32_t ms)
19 {
20  uint32_t to = timeOutInit(ms);
21  while (!timeOut(to)) {
22 /* register uint32_t ip, im, ie;
23  asm volatile (
24  "rcsr %0, im ;" // read interrupt mask in r15
25  "rcsr %1, ip ;" // read interrupt pending
26  "rcsr %2, ie ;" // read interrupt enable
27  : "=r" (im), "=r" (ip), "=r" (ie));
28  printf("IM: %08x IP: %08x = %08x (ie = %08x)\n", im, ip, im & ip, ie);*/
29  };
30 }
Low level routines for LM32, including interrupt handling.
void timeDelay(uint32_t msec)
Simple busy-wait delay.
Definition: tm.c:18
static uint32_t timeOutInit(uint32_t msec)
Initializes a timeout with the specified no of msecs.
Definition: tm.h:53
static bool timeOut(uint32_t to)
Checks whether or not the timeout has expired.
Definition: tm.h:77
Simple timer functions.