OpenCores
URL https://opencores.org/ocsvn/ao486/ao486/trunk

Subversion Repositories ao486

[/] [ao486/] [trunk/] [syn/] [components/] [sd_card/] [firmware/] [bsp/] [HAL/] [inc/] [sys/] [alt_stack.h] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 alfik
/******************************************************************************
2
*                                                                             *
3
* License Agreement                                                           *
4
*                                                                             *
5
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA.           *
6
* All rights reserved.                                                        *
7
*                                                                             *
8
* Permission is hereby granted, free of charge, to any person obtaining a     *
9
* copy of this software and associated documentation files (the "Software"),  *
10
* to deal in the Software without restriction, including without limitation   *
11
* the rights to use, copy, modify, merge, publish, distribute, sublicense,    *
12
* and/or sell copies of the Software, and to permit persons to whom the       *
13
* Software is furnished to do so, subject to the following conditions:        *
14
*                                                                             *
15
* The above copyright notice and this permission notice shall be included in  *
16
* all copies or substantial portions of the Software.                         *
17
*                                                                             *
18
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  *
19
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,    *
20
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
21
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      *
22
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING     *
23
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER         *
24
* DEALINGS IN THE SOFTWARE.                                                   *
25
*                                                                             *
26
* This agreement shall be governed in all respects by the laws of the State   *
27
* of California and by the laws of the United States of America.              *
28
*                                                                             *
29
******************************************************************************/
30
 
31
#ifndef __ALT_STACK_H__
32
#define __ALT_STACK_H__
33
 
34
/*
35
 * alt_stack.h is the nios2 specific implementation of functions used by the
36
 * stack overflow code.
37
 */
38
 
39
#include "nios2.h"
40
 
41
#include "alt_types.h"
42
 
43
#ifdef __cplusplus
44
extern "C"
45
{
46
#endif /* __cplusplus */
47
 
48
 
49
extern char * alt_stack_limit_value;
50
 
51
#ifdef ALT_EXCEPTION_STACK
52
extern char __alt_exception_stack_pointer[];  /* set by the linker */
53
#endif /* ALT_EXCEPTION_STACK */
54
 
55
 
56
/*
57
 * alt_stack_limit can be called to determine the current value of the stack
58
 * limit register.
59
 */
60
 
61
static ALT_INLINE char * ALT_ALWAYS_INLINE alt_stack_limit (void)
62
{
63
  char * limit;
64
  NIOS2_READ_ET(limit);
65
 
66
  return limit;
67
}
68
 
69
/*
70
 * alt_stack_pointer can be called to determine the current value of the stack
71
 * pointer register.
72
 */
73
 
74
static ALT_INLINE char * ALT_ALWAYS_INLINE alt_stack_pointer (void)
75
{
76
  char * pointer;
77
  NIOS2_READ_SP(pointer);
78
 
79
  return pointer;
80
}
81
 
82
 
83
#ifdef ALT_EXCEPTION_STACK
84
 
85
/*
86
 * alt_exception_stack_pointer returns the normal stack pointer from
87
 * where it is stored on the exception stack (uppermost 4 bytes).  This
88
 * is really only useful during exception processing, and is only
89
 * available if a separate exception stack has been configured.
90
 */
91
 
92
static ALT_INLINE char * ALT_ALWAYS_INLINE alt_exception_stack_pointer (void)
93
{
94
  return (char *) *(alt_u32 *)(__alt_exception_stack_pointer - sizeof(alt_u32));
95
}
96
 
97
#endif /* ALT_EXCEPTION_STACK */
98
 
99
 
100
/*
101
 * alt_set_stack_limit can be called to update the current value of the stack
102
 * limit register.
103
 */
104
 
105
static ALT_INLINE void ALT_ALWAYS_INLINE alt_set_stack_limit (char * limit)
106
{
107
  alt_stack_limit_value = limit;
108
  NIOS2_WRITE_ET(limit);
109
}
110
 
111
/*
112
 * alt_report_stack_overflow reports that a stack overflow happened.
113
 */
114
 
115
static ALT_INLINE void ALT_ALWAYS_INLINE alt_report_stack_overflow (void)
116
{
117
  NIOS2_REPORT_STACK_OVERFLOW();
118
}
119
 
120
 
121
#ifdef __cplusplus
122
}
123
#endif /* __cplusplus */
124
 
125
#endif /* __ALT_STACK_H__ */
126
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.