RTEMS  5.1
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
17 extern "C" {
18 #endif
19 
20 /* AHBSTAT Registers layout */
21 struct ahbstat_regs {
22  volatile uint32_t status;
23  volatile uint32_t failing;
24 };
25 
26 /* AHB fail interrupt callback to user. This function is declared weak so that
27  * the user can define a function pointer variable containing the address
28  * responsible for handling errors
29  *
30  * minor Index of AHBSTAT hardware
31  * regs Register address of AHBSTAT
32  * status AHBSTAT status register at IRQ
33  * failing_address AHBSTAT Failing address register at IRQ
34  *
35  * * User return
36  * 0: print error onto terminal with printk and reenable AHBSTAT
37  * 1: just re-enable AHBSTAT
38  * 2: just print error
39  * 3: do nothing, let user do custom handling
40  */
41 extern int (*ahbstat_error)(
42  int minor,
43  struct ahbstat_regs *regs,
44  uint32_t status,
45  uint32_t failing_address);
46 
47 /* Get Last received AHB Error
48  *
49  * \param minor Index used to indentify a specific AHBSTAT core
50  * \param status Status register at time of error IRQ was recevied
51  * \param address Failing address register at time of error IRQ
52  *
53  * Return
54  * 0: No error received
55  * 1: Error Received, last status and address stored into argument pointers
56  * -1: No such AHBSTAT device
57  */
58 extern int ahbstat_last_error(int minor, uint32_t *status, uint32_t *address);
59 
60 /* Get AHBSTAT registers address from minor. Can also be used to check if
61  * AHBSTAT hardware is present.
62  *
63  * Return
64  * NULL returned if no such device
65  * non-zero Address to AHBSTAT register
66  */
67 extern struct ahbstat_regs *ahbstat_get_regs(int minor);
68 
69 /* Registers the AHBSTAT driver to the Driver Manager */
70 void ahbstat_register_drv (void);
71 
72 #ifdef __cplusplus
73 }
74 #endif
75 
76 #endif
Definition: ahbstat.h:21