Rudolf Marek | 4aa93cc | 2010-07-16 20:02:09 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2010 Rudolf Marek <r.marek@assembler.cz> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Rudolf Marek | 4aa93cc | 2010-07-16 20:02:09 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
Stefan Reinauer | 3f5f6d8 | 2013-05-07 20:35:29 +0200 | [diff] [blame] | 16 | #ifndef _NE2K_H__ |
| 17 | #define _NE2K_H__ |
Kyösti Mälkki | f339086 | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 18 | |
Kyösti Mälkki | f339086 | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 19 | #include <stdint.h> |
| 20 | |
Rudolf Marek | 4aa93cc | 2010-07-16 20:02:09 +0000 | [diff] [blame] | 21 | void ne2k_append_data(unsigned char *d, int len, unsigned int base); |
| 22 | int ne2k_init(unsigned int eth_nic_base); |
| 23 | void ne2k_transmit(unsigned int eth_nic_base); |
Kyösti Mälkki | dbc7bd9 | 2014-01-28 11:34:38 +0200 | [diff] [blame] | 24 | |
Nico Huber | afa9aef | 2017-05-18 16:12:07 +0200 | [diff] [blame] | 25 | #if IS_ENABLED(CONFIG_CONSOLE_NE2K) && (ENV_ROMSTAGE || ENV_RAMSTAGE) |
Lee Leahy | 6a566d7 | 2017-03-07 17:45:12 -0800 | [diff] [blame] | 26 | static inline void __ne2k_init(void) |
| 27 | { |
| 28 | ne2k_init(CONFIG_CONSOLE_NE2K_IO_PORT); |
| 29 | } |
| 30 | static inline void __ne2k_tx_byte(u8 data) |
| 31 | { |
Kyösti Mälkki | c8cf591 | 2018-06-04 06:02:01 +0300 | [diff] [blame] | 32 | ne2k_append_data(&data, 1, CONFIG_CONSOLE_NE2K_IO_PORT); |
Lee Leahy | 6a566d7 | 2017-03-07 17:45:12 -0800 | [diff] [blame] | 33 | } |
| 34 | static inline void __ne2k_tx_flush(void) |
| 35 | { |
| 36 | ne2k_transmit(CONFIG_CONSOLE_NE2K_IO_PORT); |
| 37 | } |
Kyösti Mälkki | f339086 | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 38 | #else |
| 39 | static inline void __ne2k_init(void) {} |
| 40 | static inline void __ne2k_tx_byte(u8 data) {} |
| 41 | static inline void __ne2k_tx_flush(void) {} |
| 42 | #endif |
| 43 | |
Martin Roth | fd277d8 | 2016-01-11 12:47:30 -0700 | [diff] [blame] | 44 | #endif /* _NE2K_H__ */ |