source: trunk/softs/tsar_boot/include/reset_utils.h @ 927

Last change on this file since 927 was 758, checked in by cfuguet, 10 years ago

tsar_boot: improving configuration infrastructure

  • Using hard_config.h which respects the same sintax that the hard_config.h file of all TSAR platforms. This file can be then generated by the GIET-VM genmap tool or written manually.
  • All peripheral drivers have been moved to a drivers directory and they are compiled as a static library. This allows GCC to only include in the final .ELF the object files of used peripherals and not all of them.
  • Example hard_config.h and ldscripts have been introduced in the conf directory.
  • Improving comments in all files
File size: 1.4 KB
RevLine 
[586]1/*
2 * \file    : reset_utils.h
[425]3 * \date    : August 2012
4 * \author  : Cesar Fuguet
5 */
6
[758]7#ifndef RESET_UTILS_H
8#define RESET_UTILS_H
[425]9
10#include <elf-types.h>
[758]11#include <inttypes.h>
[701]12#include <defs.h>
[425]13
[701]14/********************************************************************
15 * Other types definition
16 ********************************************************************/
17
18/*
[758]19 * cache line aligned disk block (sector) buffer
[701]20 */
21struct aligned_blk
22{
23    char b[BLOCK_SIZE];
24} __attribute__((aligned(CACHE_LINE_SIZE)));
25
26/********************************************************************
27 * Utility functions definition
28 ********************************************************************/
29
[758]30/**
31 * \brief processor waits for n cycles
32 */
33static inline void reset_sleep(int cycles)
34{
35    volatile int i;
36    for (i = 0; i < cycles; i++);
37}
[425]38
[758]39/**
40 * \brief returns processor count
41 */
42static inline unsigned int proctime()
43{
44    register unsigned int ret asm ("v0");
45    asm volatile ("mfc0   %0,        $9":"=r" (ret));
46    return ret;
47}
[425]48
[758]49int pread(size_t file_offset, void *buf, size_t nbyte, size_t offset);
[425]50
[758]51void* memcpy(void *_dst, const void *_src, size_t n);
52void* memset(void *_dst, int c, size_t len);
[425]53
[758]54void check_elf_header(Elf32_Ehdr *ehdr);
55void reset_print_elf_phdr(Elf32_Phdr * elf_phdr_ptr);
[425]56
[758]57#endif /* RESET_UTILS_H */
[653]58
[425]59// vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
60
Note: See TracBrowser for help on using the repository browser.