RTEMS 6.1-rc4
Loading...
Searching...
No Matches
ahbstat.h
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/* AHBSTAT driver interface
4 *
5 * COPYRIGHT (c) 2011.
6 * Cobham Gaisler AB.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#ifndef __AHBSTAT_H__
31#define __AHBSTAT_H__
32
33#include <stdint.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/* AHBSTAT Registers layout */
41 volatile uint32_t status;
42 volatile uint32_t failing;
43 volatile uint32_t status2;
44 volatile uint32_t failing2;
45};
46
47/* AHB fail interrupt callback to user. This function is declared weak so that
48 * the user can define a function pointer variable containing the address
49 * responsible for handling errors
50 *
51 * minor Index of AHBSTAT hardware
52 * regs Register address of AHBSTAT
53 * status AHBSTAT status register at IRQ
54 * failing_address AHBSTAT Failing address register at IRQ
55 *
56 * * User return
57 * 0: print error onto terminal with printk and reenable AHBSTAT
58 * 1: just re-enable AHBSTAT
59 * 2: just print error
60 * 3: do nothing, let user do custom handling
61 */
62extern int (*ahbstat_error)(
63 int minor,
64 struct ahbstat_regs *regs,
65 uint32_t status,
66 uint32_t failing_address);
67
68/* Get Last received AHB Error
69 *
70 * \param minor Index used to indentify a specific AHBSTAT core
71 * \param status Status register at time of error IRQ was recevied
72 * \param address Failing address register at time of error IRQ
73 *
74 * Return
75 * 0: No error received
76 * 1: Error Received, last status and address stored into argument pointers
77 * -1: No such AHBSTAT device
78 */
79extern int ahbstat_last_error(int minor, uint32_t *status, uint32_t *address);
80
81/* Get AHBSTAT registers address from minor. Can also be used to check if
82 * AHBSTAT hardware is present.
83 *
84 * Return
85 * NULL returned if no such device
86 * non-zero Address to AHBSTAT register
87 */
88extern struct ahbstat_regs *ahbstat_get_regs(int minor);
89
90/* Registers the AHBSTAT driver to the Driver Manager */
91void ahbstat_register_drv (void);
92
93#ifdef __cplusplus
94}
95#endif
96
97#endif
Definition: ahbstat.h:40