List and wait for switch events.
More...
|
int | switchtec_event_summary_set (struct switchtec_event_summary *sum, enum switchtec_event_id e, int index) |
| Set a bit corresponding to an event in a summary structure. More...
|
|
int | switchtec_event_summary_test (struct switchtec_event_summary *sum, enum switchtec_event_id e, int index) |
| Test if a bit corresponding to an event is set in a summary structure. More...
|
|
int | switchtec_event_summary_iter (struct switchtec_event_summary *sum, enum switchtec_event_id *e, int *idx) |
| Iterate through all set bits in an event summary structure. More...
|
|
int | switchtec_event_check (struct switchtec_dev *dev, struct switchtec_event_summary *chk, struct switchtec_event_summary *res) |
| Check if one or more events have occurred. More...
|
|
enum switchtec_event_type | switchtec_event_info (enum switchtec_event_id e, const char **name, const char **desc) |
| Get the name and description strings as well as the type (global, partition or pff) for a specific event ID. More...
|
|
int | switchtec_event_wait_for (struct switchtec_dev *dev, enum switchtec_event_id e, int index, struct switchtec_event_summary *res, int timeout_ms) |
| Block until a specific event occurs. More...
|
|
int | switchtec_event_summary (struct switchtec_dev *dev, struct switchtec_event_summary *sum) |
| Retrieve a summary of all the events that have occurred in the switch. More...
|
|
int | switchtec_event_ctl (struct switchtec_dev *dev, enum switchtec_event_id e, int index, int flags, uint32_t data[5]) |
| Enable, disable and clear events or retrieve event data. More...
|
|
int | switchtec_event_wait (struct switchtec_dev *dev, int timeout_ms) |
| Wait for any event to occur (typically just an interrupt) More...
|
|
List and wait for switch events.
switchtec_event_info() provides an interface to list all possible switch events. switchtec_event_summary() gives a bitmask of events that have occured since they were last cleared. switchtec_event_ctl() can be used to clear and event or manage what happens when an event occurs. switchtec_event_wait_for() may be used to block until a specific event occurs.
Check if one or more events have occurred.
- Parameters
-
[in] | dev | Switchtec device handle |
[in] | chk | Summary structure with events to check |
[out] | res | Returned current events summary, (may be NULL) |
- Returns
- 1 if one of the events in chk occurred, 0 otherwise or a negative value if an error occurred.
Definition at line 297 of file events.c.
int switchtec_event_ctl |
( |
struct switchtec_dev * |
dev, |
|
|
enum switchtec_event_id |
e, |
|
|
int |
index, |
|
|
int |
flags, |
|
|
uint32_t |
data[5] |
|
) |
| |
Enable, disable and clear events or retrieve event data.
- Parameters
-
[in] | dev | Switchtec device handle |
[in] | e | Event to operate on |
[in] | index | Event index (partition or port, depending on event) |
[in] | flags | Any of the SWITCHTEC_EVT_FLAGs |
[out] | data | Returned event data reported by the switch |
- Returns
- 0 on success, negative on failure
Definition at line 281 of file platform.c.
Get the name and description strings as well as the type (global, partition or pff) for a specific event ID.
- Parameters
-
[in] | e | Event ID to get the strings for |
[out] | name | Name string of the event |
[out] | desc | Description string of the event |
- Returns
- The event type
Definition at line 343 of file events.c.
Retrieve a summary of all the events that have occurred in the switch.
- Parameters
-
[in] | dev | Switchtec device handle |
[out] | sum | Structure to place the result in |
- Returns
- 0 on success, negative on failure
Definition at line 265 of file platform.c.
Iterate through all set bits in an event summary structure.
- Parameters
-
[in] | sum | Summary structure to set the bit in |
[out] | e | Event ID which was set |
[out] | idx | Event index (partition or port, depending on event) |
- Returns
- 1 if a bit is set, 0 otherwise
This function is meant to be called in a loop. It finds the lowest bit set and returns the corresponding event id and index. It then clears that bit in the structure.
Definition at line 248 of file events.c.
Set a bit corresponding to an event in a summary structure.
- Parameters
-
[in] | sum | Summary structure to set the bit in |
[in] | e | Event ID to set |
[in] | index | Event index (partition or port, depending on event) |
- Returns
- 0 on success, or -EINVAL if the index was invalid
Definition at line 175 of file events.c.
Test if a bit corresponding to an event is set in a summary structure.
- Parameters
-
[in] | sum | Summary structure to set the bit in |
[in] | e | Event ID to test |
[in] | index | Event index (partition or port, depending on event) |
- Returns
- 1 if the bit is set, 0 otherwise
Definition at line 219 of file events.c.
int switchtec_event_wait |
( |
struct switchtec_dev * |
dev, |
|
|
int |
timeout_ms |
|
) |
| |
Wait for any event to occur (typically just an interrupt)
- Parameters
-
[in] | dev | Switchtec device handle |
[in] | timeout_ms | Timeout ofter this many milliseconds |
- Returns
- 1 if the event occurred, 0 if it timed out, negative in case of an error
Definition at line 297 of file platform.c.
Block until a specific event occurs.
- Parameters
-
[in] | dev | Switchtec device handle |
[in] | e | Event ID to wait for |
[in] | index | Event index (partition or port) |
[out] | res | Current event summary set, after waiting |
[in] | timeout_ms | Timeout of this many milliseconds |
- Returns
- 1 if the event occurred, 0 on a timeout and a negative number an error.
Definition at line 369 of file events.c.