RTEMS: bsps/include/grlib/ahbstat.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
ahbstat.h
1/* AHBSTAT driver interface
2 *
3 * COPYRIGHT (c) 2011.
4 * Cobham Gaisler AB.
5 *
6 * The license and distribution terms for this file may be
7 * found in the file LICENSE in this distribution or at
8 * http://www.rtems.org/license/LICENSE.
9 */
10
11#ifndef __AHBSTAT_H__
12#define __AHBSTAT_H__
13
14#include <stdint.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20/* AHBSTAT Registers layout */
21 struct ahbstat_regs {
22 volatile uint32_t status;
23 volatile uint32_t failing;
24 volatile uint32_t status2;
25 volatile uint32_t failing2;
26};
27
28/* AHB fail interrupt callback to user. This function is declared weak so that
29 * the user can define a function pointer variable containing the address
30 * responsible for handling errors
31 *
32 * minor Index of AHBSTAT hardware
33 * regs Register address of AHBSTAT
34 * status AHBSTAT status register at IRQ
35 * failing_address AHBSTAT Failing address register at IRQ
36 *
37 * * User return
38 * 0: print error onto terminal with printk and reenable AHBSTAT
39 * 1: just re-enable AHBSTAT
40 * 2: just print error
41 * 3: do nothing, let user do custom handling
42 */
43extern int (*ahbstat_error)(
44 int minor,
45 struct ahbstat_regs *regs,
46 uint32_t status,
47 uint32_t failing_address);
48
49/* Get Last received AHB Error
50 *
51 * \param minor Index used to indentify a specific AHBSTAT core
52 * \param status Status register at time of error IRQ was recevied
53 * \param address Failing address register at time of error IRQ
54 *
55 * Return
56 * 0: No error received
57 * 1: Error Received, last status and address stored into argument pointers
58 * -1: No such AHBSTAT device
59 */
60extern int ahbstat_last_error(int minor, uint32_t *status, uint32_t *address);
61
62/* Get AHBSTAT registers address from minor. Can also be used to check if
63 * AHBSTAT hardware is present.
64 *
65 * Return
66 * NULL returned if no such device
67 * non-zero Address to AHBSTAT register
68 */
69extern struct ahbstat_regs *ahbstat_get_regs(int minor);
70
71/* Registers the AHBSTAT driver to the Driver Manager */
72void ahbstat_register_drv (void);
73
74#ifdef __cplusplus
75}
76#endif
77
78#endif
ahbstat_regs
Definition: ahbstat.h:21