source: trunk/hal/tsar_mips32/hal_special.h @ 12

Last change on this file since 12 was 1, checked in by alain, 8 years ago

First import

File size: 5.8 KB
Line 
1/*
2 * hal_special.h - Generic Special Registers Access API definition.
3 *
4 * Authors   Ghassan Almaless (2008,2009,2010,2011,2012)
5 *           Alain Greiner    (2016)
6 *
7 * Copyright (c)  UPMC Sorbonne Universites
8 *
9 * This file is part of ALMOS-MKH.
10 *
11 * ALMOS-MKH is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; version 2.0 of the License.
14 *
15 * ALMOS-MKH is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24
25#ifndef  _HAL_CPU_H_
26#define  _HAL_CPU_H_
27
28#include <hal_types.h>
29
30/****  Forward declarations  ***/
31
32struct thread_s;
33
34///////////////////////////////////////////////////////////////////////////////////////////
35//      Generic Special Registers Access API (implementation in hal_special.c)
36//
37// ALMOS-MKH uses the following API to access the MMU and other core protected registers.
38///////////////////////////////////////////////////////////////////////////////////////////
39
40/*****************************************************************************************
41 * This function returns the global core identifier from the calling core register.
42 ****************************************************************************************/
43gid_t hal_get_gid();
44
45/*****************************************************************************************
46 * This function returns the content of the calling core cycles counter register.
47 ****************************************************************************************/
48uint32_t hal_time_stamp();
49
50/*****************************************************************************************
51 * This function returns the current thread pointer from the calling core register.
52 ****************************************************************************************/
53struct thread_s * hal_get_current_thread();
54
55/*****************************************************************************************
56 * This function registers a thread pointer in the calling core register.
57 ****************************************************************************************/
58void hal_set_current_thread( struct thread_s * thread );
59
60/*****************************************************************************************
61 * This function writes into the proper core register to enable the floating point unit.
62 ****************************************************************************************/
63void hal_fpu_enable();
64
65/*****************************************************************************************
66 * This function writes into the proper core register to disable the floating point unit.
67 ****************************************************************************************/
68void hal_fpu_disable();
69
70/*****************************************************************************************
71 * This function returns the current value of stack pointer from core register.
72 ****************************************************************************************/
73uint32_t hal_get_stack();
74
75/*****************************************************************************************
76 * This function registers a new value in the core stack pointer and returns previous one.
77 ****************************************************************************************/
78extern inline uint32_t hal_set_stack( void * new_val );
79
80/*****************************************************************************************
81 * This function returns the faulty address in case of address exception.
82 ****************************************************************************************/
83uint32_t hal_get_bad_vaddr();
84
85/*****************************************************************************************
86 * This function makes an uncachable read to a 32 bits variable in local memory.
87 * @ ptr     : pointer on the variable
88 * @ returns the value
89 ****************************************************************************************/
90uint32_t hal_uncached_read( uint32_t * ptr );
91
92/*****************************************************************************************
93 * This function invalidates the cache line containing a given address.
94 * @ ptr     : address in local memory
95 ****************************************************************************************/
96void hal_invalid_dcache_line( void * ptr );
97
98/*****************************************************************************************
99 * This blocking function flushes the write buffer to synchronize all pending writes.
100 ****************************************************************************************/
101void hal_wbflush();
102
103/*****************************************************************************************
104 * This forbids code reordering by the compiler.
105 ****************************************************************************************/
106void hal_rdbar();
107
108/*****************************************************************************************
109 * This function forces the calling core in idle-low-power mode.
110 ****************************************************************************************/
111void hal_core_sleep();
112
113/*****************************************************************************************
114 * This function returns after a fixed delay of  (4 * delay) cycles.
115 ****************************************************************************************/
116void hal_fixed_delay();
117
118
119
120#endif  /* _HAL_SPECIAL_H_ */
Note: See TracBrowser for help on using the repository browser.