| 1 | /*
|
|---|
| 2 | * Copyright (c) 2010 Radim Vansa
|
|---|
| 3 | * All rights reserved.
|
|---|
| 4 | *
|
|---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
|---|
| 6 | * modification, are permitted provided that the following conditions
|
|---|
| 7 | * are met:
|
|---|
| 8 | *
|
|---|
| 9 | * - Redistributions of source code must retain the above copyright
|
|---|
| 10 | * notice, this list of conditions and the following disclaimer.
|
|---|
| 11 | * - Redistributions in binary form must reproduce the above copyright
|
|---|
| 12 | * notice, this list of conditions and the following disclaimer in the
|
|---|
| 13 | * documentation and/or other materials provided with the distribution.
|
|---|
| 14 | * - The name of the author may not be used to endorse or promote products
|
|---|
| 15 | * derived from this software without specific prior written permission.
|
|---|
| 16 | *
|
|---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|---|
| 27 | */
|
|---|
| 28 |
|
|---|
| 29 | /** @addtogroup libc
|
|---|
| 30 | * @{
|
|---|
| 31 | */
|
|---|
| 32 | /** @file
|
|---|
| 33 | */
|
|---|
| 34 |
|
|---|
| 35 | #ifndef LIBDRV_NIC_IFACE_H_
|
|---|
| 36 | #define LIBDRV_NIC_IFACE_H_
|
|---|
| 37 |
|
|---|
| 38 | #include <async.h>
|
|---|
| 39 | #include <nic/nic.h>
|
|---|
| 40 | #include <ipc/common.h>
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 | typedef enum {
|
|---|
| 44 | NIC_EV_ADDR_CHANGED = IPC_FIRST_USER_METHOD,
|
|---|
| 45 | NIC_EV_RECEIVED,
|
|---|
| 46 | NIC_EV_DEVICE_STATE
|
|---|
| 47 | } nic_event_t;
|
|---|
| 48 |
|
|---|
| 49 | extern errno_t nic_send_frame(async_sess_t *, void *, size_t);
|
|---|
| 50 | extern errno_t nic_callback_create(async_sess_t *, async_port_handler_t, void *);
|
|---|
| 51 | extern errno_t nic_get_state(async_sess_t *, nic_device_state_t *);
|
|---|
| 52 | extern errno_t nic_set_state(async_sess_t *, nic_device_state_t);
|
|---|
| 53 | extern errno_t nic_get_address(async_sess_t *, nic_address_t *);
|
|---|
| 54 | extern errno_t nic_set_address(async_sess_t *, const nic_address_t *);
|
|---|
| 55 | extern errno_t nic_get_stats(async_sess_t *, nic_device_stats_t *);
|
|---|
| 56 | extern errno_t nic_get_device_info(async_sess_t *, nic_device_info_t *);
|
|---|
| 57 | extern errno_t nic_get_cable_state(async_sess_t *, nic_cable_state_t *);
|
|---|
| 58 |
|
|---|
| 59 | extern errno_t nic_get_operation_mode(async_sess_t *, int *, nic_channel_mode_t *,
|
|---|
| 60 | nic_role_t *);
|
|---|
| 61 | extern errno_t nic_set_operation_mode(async_sess_t *, int, nic_channel_mode_t,
|
|---|
| 62 | nic_role_t);
|
|---|
| 63 | extern errno_t nic_autoneg_enable(async_sess_t *, uint32_t);
|
|---|
| 64 | extern errno_t nic_autoneg_disable(async_sess_t *);
|
|---|
| 65 | extern errno_t nic_autoneg_probe(async_sess_t *, uint32_t *, uint32_t *,
|
|---|
| 66 | nic_result_t *, nic_result_t *);
|
|---|
| 67 | extern errno_t nic_autoneg_restart(async_sess_t *);
|
|---|
| 68 | extern errno_t nic_get_pause(async_sess_t *, nic_result_t *, nic_result_t *,
|
|---|
| 69 | uint16_t *);
|
|---|
| 70 | extern errno_t nic_set_pause(async_sess_t *, int, int, uint16_t);
|
|---|
| 71 |
|
|---|
| 72 | extern errno_t nic_unicast_get_mode(async_sess_t *, nic_unicast_mode_t *, size_t,
|
|---|
| 73 | nic_address_t *, size_t *);
|
|---|
| 74 | extern errno_t nic_unicast_set_mode(async_sess_t *, nic_unicast_mode_t,
|
|---|
| 75 | const nic_address_t *, size_t);
|
|---|
| 76 | extern errno_t nic_multicast_get_mode(async_sess_t *, nic_multicast_mode_t *,
|
|---|
| 77 | size_t, nic_address_t *, size_t *);
|
|---|
| 78 | extern errno_t nic_multicast_set_mode(async_sess_t *, nic_multicast_mode_t,
|
|---|
| 79 | const nic_address_t *, size_t);
|
|---|
| 80 | extern errno_t nic_broadcast_get_mode(async_sess_t *, nic_broadcast_mode_t *);
|
|---|
| 81 | extern errno_t nic_broadcast_set_mode(async_sess_t *, nic_broadcast_mode_t);
|
|---|
| 82 | extern errno_t nic_defective_get_mode(async_sess_t *, uint32_t *);
|
|---|
| 83 | extern errno_t nic_defective_set_mode(async_sess_t *, uint32_t);
|
|---|
| 84 | extern errno_t nic_blocked_sources_get(async_sess_t *, size_t, nic_address_t *,
|
|---|
| 85 | size_t *);
|
|---|
| 86 | extern errno_t nic_blocked_sources_set(async_sess_t *, const nic_address_t *,
|
|---|
| 87 | size_t);
|
|---|
| 88 |
|
|---|
| 89 | extern errno_t nic_vlan_get_mask(async_sess_t *, nic_vlan_mask_t *);
|
|---|
| 90 | extern errno_t nic_vlan_set_mask(async_sess_t *, const nic_vlan_mask_t *);
|
|---|
| 91 | extern errno_t nic_vlan_set_tag(async_sess_t *, uint16_t, bool, bool);
|
|---|
| 92 |
|
|---|
| 93 | extern errno_t nic_wol_virtue_add(async_sess_t *, nic_wv_type_t, const void *,
|
|---|
| 94 | size_t, nic_wv_id_t *);
|
|---|
| 95 | extern errno_t nic_wol_virtue_remove(async_sess_t *, nic_wv_id_t);
|
|---|
| 96 | extern errno_t nic_wol_virtue_probe(async_sess_t *, nic_wv_id_t, nic_wv_type_t *,
|
|---|
| 97 | size_t, void *, size_t *);
|
|---|
| 98 | extern errno_t nic_wol_virtue_list(async_sess_t *, nic_wv_type_t, size_t,
|
|---|
| 99 | nic_wv_id_t *, size_t *);
|
|---|
| 100 | extern errno_t nic_wol_virtue_get_caps(async_sess_t *, nic_wv_type_t, int *);
|
|---|
| 101 | extern errno_t nic_wol_load_info(async_sess_t *, nic_wv_type_t *, size_t, uint8_t *,
|
|---|
| 102 | size_t *);
|
|---|
| 103 |
|
|---|
| 104 | extern errno_t nic_offload_probe(async_sess_t *, uint32_t *, uint32_t *);
|
|---|
| 105 | extern errno_t nic_offload_set(async_sess_t *, uint32_t, uint32_t);
|
|---|
| 106 |
|
|---|
| 107 | extern errno_t nic_poll_get_mode(async_sess_t *, nic_poll_mode_t *,
|
|---|
| 108 | struct timeval *);
|
|---|
| 109 | extern errno_t nic_poll_set_mode(async_sess_t *, nic_poll_mode_t,
|
|---|
| 110 | const struct timeval *);
|
|---|
| 111 | extern errno_t nic_poll_now(async_sess_t *);
|
|---|
| 112 |
|
|---|
| 113 | #endif
|
|---|
| 114 |
|
|---|
| 115 | /** @}
|
|---|
| 116 | */
|
|---|