source: soft/giet_vm/giet_libs/libsrl/srl_sched_wait.c @ 814

Last change on this file since 814 was 258, checked in by alain, 11 years ago

This is a major release, including a deep restructuration of code.
The main evolutions are

  • use of the Tsar preloader to load the GIET boot-loader from disk
  • introduction of a FAT32 file system library,
  • use of this fat32 library by the boot-loader to load the map.bin data structure, and the various .elf files
  • reorganisation of drivers (one file per peripheral).
  • introduction of drivers for new peripherals: vci_chbuf_dma and vci_multi_ahci.
  • introduction of a new physical memory allocator in the boot code.

This release has been tested on the tsar_generic_iob architecture,
for the two following mappings: 4c_1p_iob_four.xml and 4c_1p_iob_sort.xml

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1/*
2 * This file is part of MutekH.
3 *
4 * MutekH is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as published
6 * by the Free Software Foundation; version 2.1 of the License.
7 *
8 * MutekH is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with MutekH; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16 * 02110-1301 USA
17 *
18 * Copyright (c) UPMC, Lip6, SoC
19 */
20
21#include "srl_private_types.h"
22#include "srl_sched_wait.h"
23#include "srl_hw_helpers.h"
24#include "stdio.h"
25
26#define endian_cpu32(x) (x)
27
28#define DECLARE_WAIT(name, cmp)                                 \
29                                                                \
30void srl_sched_wait_##name(void * addr, sint32_t val) {         \
31    srl_dcache_flush_addr(addr);                                \
32    if (((sint32_t) * ((unsigned int *) addr)) cmp val)         \
33    return;                                                     \
34    do {                                                        \
35        srl_sched_wait_priv(100);??                             \
36        srl_dcache_flush_addr(addr);                            \
37    } while (((sint32_t) * ((unsigned int *) addr)) cmp val);   \
38}
39
40
41
42DECLARE_WAIT(eq, ==)
43
44DECLARE_WAIT(ne, !=)
45
46DECLARE_WAIT(le, <=)
47
48DECLARE_WAIT(ge, >=)
49
50DECLARE_WAIT(lt, <)
51
52DECLARE_WAIT(gt, >)
53
54    //TODO
55void srl_sched_wait_priv(uint32_t date) {
56    do {
57        context_switch();
58    } while (srl_cycle_count() > date);
59}
60
61void srl_sleep_cycles(uint32_t n) {
62    uint32_t next_run_to = srl_cycle_count() + n;
63
64    while (srl_cycle_count() < next_run_to) {
65        srl_sched_wait_priv(next_run_to);
66    }
67}
68
69
70// Local Variables:
71// tab-width: 4
72// c-basic-offset: 4
73// c-file-offsets:((innamespace . 0)(inline-open . 0))
74// indent-tabs-mode: nil
75// End:
76// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
77
Note: See TracBrowser for help on using the repository browser.