1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
/***********************license start***************
* Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
* reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Cavium Networks nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
* This Software, including technical data, may be subject to U.S. export control
* laws, including the U.S. Export Administration Act and its associated
* regulations, and may be subject to export or import regulations in other
* countries.
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
* AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
* SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
* MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
* VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
* CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
* PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
***********************license end**************************************/
#ifndef __CVMX_THUNDER_H__
#define __CVMX_THUNDER_H__
/**
* @file
*
* Interface to the Thunder specific devices
*
* <hr>$Revision: 49448 $<hr>
*
*/
#ifdef __cplusplus
extern "C" {
#endif
#define CVMX_RTC_DS1374_ADDR (0x68)
/*
* Read time-of-day counter.
* This function is called internally by cvmx-rtc functions.
*/
uint32_t cvmx_rtc_ds1374_read(void);
/*
* Write time-of-day counter.
* This function is called internally by cvmx-rtc functions.
*/
int cvmx_rtc_ds1374_write(uint32_t time);
/**
* LAN bypass modes.
*/
typedef enum {
CVMX_LAN_BYPASS_OFF = 0, /**< LAN bypass is disabled, port 0 and port 1
are always connected to Octeon */
CVMX_LAN_BYPASS_GPIO, /**< LAN bypass controlled by GPIO only */
CVMX_LAN_BYPASS_WATCHDOG, /**< LAN bypass controlled by watchdog (and GPIO) */
CVMX_LAN_BYPASS_LAST /* Keep as last entry */
} cvmx_lan_bypass_mode_t;
/**
* Set LAN bypass mode.
*
* Supported modes are:
* - CVMX_LAN_BYPASS_OFF
* <br>LAN ports are connected ( port 0 <--> Octeon <--> port 1 )
*
* - CVMX_LAN_BYPASS_GPIO
* <br>LAN bypass is controlled by software using cvmx_lan_bypass_force() function.
* When transitioning to this mode, default is LAN bypass enabled
* ( port 0 <--> port 1, disconnected from Octeon ).
*
* - CVMX_LAN_BYPASS_WATCHDOG
* <br>LAN bypass is inactive as long as the watchdog is kept alive.
* The default expiration time is 1 second and the function to
* call periodically to prevent watchdog expiration is
* cvmx_lan_bypass_keep_alive().
*
* @param mode LAN bypass mode
*
* @return Error code, or 0 in case of success
*/
int cvmx_lan_bypass_mode_set(cvmx_lan_bypass_mode_t mode);
/**
* Return status of LAN bypass circuit.
*
* @return 1 if ports are in LAN bypass, or 0 if normally connected
*/
int cvmx_lan_bypass_is_active(void);
/**
* Refresh watchdog timer.
*
* Call periodically (less than 1 second) to prevent triggering LAN bypass.
* The alternative cvmx_lan_bypass_keep_alive_ms() is provided for cases
* where a variable interval is required.
*/
void cvmx_lan_bypass_keep_alive(void);
/**
* Refresh watchdog timer, setting a specific expiration interval.
*
* @param interval_ms Interval, in milliseconds, to next watchdog expiration.
*/
void cvmx_lan_bypass_keep_alive_ms(uint32_t interval_ms);
/**
* Control LAN bypass via software.
*
* @param force_bypass Force LAN bypass to active (1) or inactive (0)
*
* @return Error code, or 0 in case of success
*/
int cvmx_lan_bypass_force(int force_bypass);
#ifdef __cplusplus
}
#endif
#endif /* __CVMX_THUNDER_H__ */
|