Developer World
Spresense SDK Library
v3.3.0-375c679
crashdump.h
1
/****************************************************************************
2
* arch/arm/include/cxd56xx/crashdump.h
3
*
4
* Licensed to the Apache Software Foundation (ASF) under one or more
5
* contributor license agreements. See the NOTICE file distributed with
6
* this work for additional information regarding copyright ownership. The
7
* ASF licenses this file to you under the Apache License, Version 2.0 (the
8
* "License"); you may not use this file except in compliance with the
9
* License. You may obtain a copy of the License at
10
*
11
* http://www.apache.org/licenses/LICENSE-2.0
12
*
13
* Unless required by applicable law or agreed to in writing, software
14
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
* License for the specific language governing permissions and limitations
17
* under the License.
18
*
19
****************************************************************************/
20
21
#ifndef __ARCH_ARM_INCLUDE_CXD56XX_CRASHDUMP_H
22
#define __ARCH_ARM_INCLUDE_CXD56XX_CRASHDUMP_H
23
24
/****************************************************************************
25
* Included Files
26
****************************************************************************/
27
28
#include <nuttx/config.h>
29
30
#include <stdint.h>
31
32
#include <sys/param.h>
33
34
#include <nuttx/irq.h>
35
36
/****************************************************************************
37
* Pre-processor Prototypes
38
****************************************************************************/
39
40
/* Configuration ************************************************************/
41
42
/* The following guides in the amount of the user and interrupt stack
43
* data we can save. The amount of storage left will dictate the actual
44
* number of entries of the user stack data saved.
45
*/
46
47
#define CRASHLOG_SIZE 1024
48
#if CONFIG_ARCH_INTERRUPTSTACK <= 3
49
# define NUMBER_STACKS 1
50
#else
51
# define NUMBER_STACKS 2
52
#endif
53
#define CRASHLOG_LEFTOVER (CRASHLOG_SIZE - sizeof(info_t))
54
#define CONFIG_ISTACK_SIZE (CRASHLOG_LEFTOVER / NUMBER_STACKS / \
55
sizeof(stack_word_t))
56
#define CONFIG_USTACK_SIZE (CRASHLOG_LEFTOVER / NUMBER_STACKS / \
57
sizeof(stack_word_t))
58
59
/* For Assert keep this much of the file name */
60
61
#define MAX_FILE_PATH_LENGTH 40
62
63
/****************************************************************************
64
* Public Types
65
****************************************************************************/
66
67
#ifndef __ASSEMBLY__
68
69
/* Used for stack frame storage */
70
71
typedef
uint32_t stack_word_t;
72
73
/* Stack related data */
74
75
typedef
struct
76
{
77
uint32_t sp;
78
uint32_t top;
79
uint32_t size;
80
}
_stack_t
;
81
82
typedef
struct
83
{
84
_stack_t
user;
85
#if CONFIG_ARCH_INTERRUPTSTACK > 3
86
_stack_t
interrupt;
87
#endif
88
}
crash_stack_t
;
89
90
/* Flags to identify what is in the dump */
91
92
typedef
enum
93
{
94
REGS_PRESENT = 0x01,
95
USERSTACK_PRESENT = 0x02,
96
INTSTACK_PRESENT = 0x04,
97
INVALID_USERSTACK_PTR = 0x20,
98
INVALID_INTSTACK_PTR = 0x40,
99
} fault_flags_t;
100
101
typedef
struct
102
{
103
struct
timespec ts;
/* timestamp */
104
fault_flags_t flags;
/* What is in the dump */
105
uintptr_t current_regs;
/* Used to validate the dump */
106
int
lineno;
/* __LINE__ to up_assert */
107
pid_t pid;
/* Process ID */
108
uint32_t regs[XCPTCONTEXT_REGS];
/* Interrupt register save area */
109
crash_stack_t
stacks;
/* Stack info */
110
#if CONFIG_TASK_NAME_SIZE > 0
111
char
name[CONFIG_TASK_NAME_SIZE + 1];
/* Task name (with NULL
112
* terminator) */
113
#endif
114
char
filename[MAX_FILE_PATH_LENGTH];
/* the Last of chars in
115
* __FILE__ to up_assert */
116
}
info_t
;
117
118
typedef
struct
119
{
120
info_t
info;
121
#if CONFIG_ARCH_INTERRUPTSTACK > 3
122
stack_word_t istack[CONFIG_ISTACK_SIZE];
123
#endif
124
stack_word_t ustack[CONFIG_USTACK_SIZE];
125
}
fullcontext_t
;
126
127
/****************************************************************************
128
* Public Data
129
****************************************************************************/
130
131
#undef EXTERN
132
#if defined(__cplusplus)
133
#define EXTERN extern "C"
134
extern
"C"
135
{
136
#else
137
#define EXTERN extern
138
#endif
139
140
/****************************************************************************
141
* Public Function Prototypes
142
****************************************************************************/
143
144
#undef EXTERN
145
#if defined(__cplusplus)
146
}
147
#endif
148
149
#endif
/* __ASSEMBLY__ */
150
#endif
/* __ARCH_ARM_INCLUDE_CXD56XX_CRASHDUMP_H */
_stack_t
Definition:
crashdump.h:76
crash_stack_t
Definition:
crashdump.h:83
fullcontext_t
Definition:
crashdump.h:119
info_t
Definition:
crashdump.h:102
spresense
nuttx
arch
arm
include
cxd56xx
crashdump.h
Generated by
1.9.4