| 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 LIBC_DEVICE_NIC_H_
|
|---|
| 36 | #define LIBC_DEVICE_NIC_H_
|
|---|
| 37 |
|
|---|
| 38 | #include <async.h>
|
|---|
| 39 | #include <net/device.h>
|
|---|
| 40 | #include <net/packet.h>
|
|---|
| 41 | #include <ipc/services.h>
|
|---|
| 42 |
|
|---|
| 43 | typedef enum {
|
|---|
| 44 | NIC_SEND_MESSAGE = 0,
|
|---|
| 45 | NIC_CONNECT_TO_NIL,
|
|---|
| 46 | NIC_GET_STATE,
|
|---|
| 47 | NIC_SET_STATE,
|
|---|
| 48 | NIC_GET_ADDRESS,
|
|---|
| 49 | NIC_SET_ADDRESS,
|
|---|
| 50 | NIC_GET_STATS,
|
|---|
| 51 | NIC_GET_DEVICE_INFO,
|
|---|
| 52 | NIC_GET_CABLE_STATE,
|
|---|
| 53 | NIC_GET_OPERATION_MODE,
|
|---|
| 54 | NIC_SET_OPERATION_MODE,
|
|---|
| 55 | NIC_AUTONEG_ENABLE,
|
|---|
| 56 | NIC_AUTONEG_DISABLE,
|
|---|
| 57 | NIC_AUTONEG_PROBE,
|
|---|
| 58 | NIC_AUTONEG_RESTART,
|
|---|
| 59 | NIC_GET_PAUSE,
|
|---|
| 60 | NIC_SET_PAUSE,
|
|---|
| 61 | NIC_UNICAST_GET_MODE,
|
|---|
| 62 | NIC_UNICAST_SET_MODE,
|
|---|
| 63 | NIC_MULTICAST_GET_MODE,
|
|---|
| 64 | NIC_MULTICAST_SET_MODE,
|
|---|
| 65 | NIC_BROADCAST_GET_MODE,
|
|---|
| 66 | NIC_BROADCAST_SET_MODE,
|
|---|
| 67 | NIC_DEFECTIVE_GET_MODE,
|
|---|
| 68 | NIC_DEFECTIVE_SET_MODE,
|
|---|
| 69 | NIC_BLOCKED_SOURCES_GET,
|
|---|
| 70 | NIC_BLOCKED_SOURCES_SET,
|
|---|
| 71 | NIC_VLAN_GET_MASK,
|
|---|
| 72 | NIC_VLAN_SET_MASK,
|
|---|
| 73 | NIC_VLAN_SET_TAG,
|
|---|
| 74 | NIC_WOL_VIRTUE_ADD,
|
|---|
| 75 | NIC_WOL_VIRTUE_REMOVE,
|
|---|
| 76 | NIC_WOL_VIRTUE_PROBE,
|
|---|
| 77 | NIC_WOL_VIRTUE_LIST,
|
|---|
| 78 | NIC_WOL_VIRTUE_GET_CAPS,
|
|---|
| 79 | NIC_WOL_LOAD_INFO,
|
|---|
| 80 | NIC_OFFLOAD_PROBE,
|
|---|
| 81 | NIC_OFFLOAD_SET,
|
|---|
| 82 | NIC_POLL_GET_MODE,
|
|---|
| 83 | NIC_POLL_SET_MODE,
|
|---|
| 84 | NIC_POLL_NOW
|
|---|
| 85 | } nic_funcs_t;
|
|---|
| 86 |
|
|---|
| 87 | extern int nic_send_frame(async_sess_t *, void *, size_t);
|
|---|
| 88 | extern int nic_connect_to_nil(async_sess_t *, services_t, nic_device_id_t);
|
|---|
| 89 | extern int nic_get_state(async_sess_t *, nic_device_state_t *);
|
|---|
| 90 | extern int nic_set_state(async_sess_t *, nic_device_state_t);
|
|---|
| 91 | extern int nic_get_address(async_sess_t *, nic_address_t *);
|
|---|
| 92 | extern int nic_set_address(async_sess_t *, const nic_address_t *);
|
|---|
| 93 | extern int nic_get_stats(async_sess_t *, nic_device_stats_t *);
|
|---|
| 94 | extern int nic_get_device_info(async_sess_t *, nic_device_info_t *);
|
|---|
| 95 | extern int nic_get_cable_state(async_sess_t *, nic_cable_state_t *);
|
|---|
| 96 |
|
|---|
| 97 | extern int nic_get_operation_mode(async_sess_t *, int *, nic_channel_mode_t *,
|
|---|
| 98 | nic_role_t *);
|
|---|
| 99 | extern int nic_set_operation_mode(async_sess_t *, int, nic_channel_mode_t,
|
|---|
| 100 | nic_role_t);
|
|---|
| 101 | extern int nic_autoneg_enable(async_sess_t *, uint32_t);
|
|---|
| 102 | extern int nic_autoneg_disable(async_sess_t *);
|
|---|
| 103 | extern int nic_autoneg_probe(async_sess_t *, uint32_t *, uint32_t *,
|
|---|
| 104 | nic_result_t *, nic_result_t *);
|
|---|
| 105 | extern int nic_autoneg_restart(async_sess_t *);
|
|---|
| 106 | extern int nic_get_pause(async_sess_t *, nic_result_t *, nic_result_t *,
|
|---|
| 107 | uint16_t *);
|
|---|
| 108 | extern int nic_set_pause(async_sess_t *, int, int, uint16_t);
|
|---|
| 109 |
|
|---|
| 110 | extern int nic_unicast_get_mode(async_sess_t *, nic_unicast_mode_t *, size_t,
|
|---|
| 111 | nic_address_t *, size_t *);
|
|---|
| 112 | extern int nic_unicast_set_mode(async_sess_t *, nic_unicast_mode_t,
|
|---|
| 113 | const nic_address_t *, size_t);
|
|---|
| 114 | extern int nic_multicast_get_mode(async_sess_t *, nic_multicast_mode_t *,
|
|---|
| 115 | size_t, nic_address_t *, size_t *);
|
|---|
| 116 | extern int nic_multicast_set_mode(async_sess_t *, nic_multicast_mode_t,
|
|---|
| 117 | const nic_address_t *, size_t);
|
|---|
| 118 | extern int nic_broadcast_get_mode(async_sess_t *, nic_broadcast_mode_t *);
|
|---|
| 119 | extern int nic_broadcast_set_mode(async_sess_t *, nic_broadcast_mode_t);
|
|---|
| 120 | extern int nic_defective_get_mode(async_sess_t *, uint32_t *);
|
|---|
| 121 | extern int nic_defective_set_mode(async_sess_t *, uint32_t);
|
|---|
| 122 | extern int nic_blocked_sources_get(async_sess_t *, size_t, nic_address_t *,
|
|---|
| 123 | size_t *);
|
|---|
| 124 | extern int nic_blocked_sources_set(async_sess_t *, const nic_address_t *,
|
|---|
| 125 | size_t);
|
|---|
| 126 |
|
|---|
| 127 | extern int nic_vlan_get_mask(async_sess_t *, nic_vlan_mask_t *);
|
|---|
| 128 | extern int nic_vlan_set_mask(async_sess_t *, const nic_vlan_mask_t *);
|
|---|
| 129 | extern int nic_vlan_set_tag(async_sess_t *, uint16_t, bool, bool);
|
|---|
| 130 |
|
|---|
| 131 | extern int nic_wol_virtue_add(async_sess_t *, nic_wv_type_t, const void *,
|
|---|
| 132 | size_t, nic_wv_id_t *);
|
|---|
| 133 | extern int nic_wol_virtue_remove(async_sess_t *, nic_wv_id_t);
|
|---|
| 134 | extern int nic_wol_virtue_probe(async_sess_t *, nic_wv_id_t, nic_wv_type_t *,
|
|---|
| 135 | size_t, void *, size_t *);
|
|---|
| 136 | extern int nic_wol_virtue_list(async_sess_t *, nic_wv_type_t, size_t,
|
|---|
| 137 | nic_wv_id_t *, size_t *);
|
|---|
| 138 | extern int nic_wol_virtue_get_caps(async_sess_t *, nic_wv_type_t, int *);
|
|---|
| 139 | extern int nic_wol_load_info(async_sess_t *, nic_wv_type_t *, size_t, uint8_t *,
|
|---|
| 140 | size_t *);
|
|---|
| 141 |
|
|---|
| 142 | extern int nic_offload_probe(async_sess_t *, uint32_t *, uint32_t *);
|
|---|
| 143 | extern int nic_offload_set(async_sess_t *, uint32_t, uint32_t);
|
|---|
| 144 |
|
|---|
| 145 | extern int nic_poll_get_mode(async_sess_t *, nic_poll_mode_t *,
|
|---|
| 146 | struct timeval *);
|
|---|
| 147 | extern int nic_poll_set_mode(async_sess_t *, nic_poll_mode_t,
|
|---|
| 148 | const struct timeval *);
|
|---|
| 149 | extern int nic_poll_now(async_sess_t *);
|
|---|
| 150 |
|
|---|
| 151 | #endif
|
|---|
| 152 |
|
|---|
| 153 | /** @}
|
|---|
| 154 | */
|
|---|