blob: 16cecb5ccdae8d5b05d816369a4895a23e072716 [file] [log] [blame]
Rudolf Marek4aa93cc2010-07-16 20:02:09 +00001/*
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.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
Paul Menzela46a7122013-02-23 18:37:27 +010017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Rudolf Marek4aa93cc2010-07-16 20:02:09 +000018 */
19
Stefan Reinauer3f5f6d82013-05-07 20:35:29 +020020#ifndef _NE2K_H__
21#define _NE2K_H__
Kyösti Mälkkif3390862014-02-26 15:19:04 +020022
23#include <rules.h>
24#include <stdint.h>
25
Rudolf Marek4aa93cc2010-07-16 20:02:09 +000026void ne2k_append_data(unsigned char *d, int len, unsigned int base);
27int ne2k_init(unsigned int eth_nic_base);
28void ne2k_transmit(unsigned int eth_nic_base);
Kyösti Mälkkidbc7bd92014-01-28 11:34:38 +020029
30#ifndef __ROMCC__
31#define ne2k_append_data_byte(d, base) ne2k_append_data(&d, 1, base)
32#endif
Kyösti Mälkkif3390862014-02-26 15:19:04 +020033
34#if CONFIG_CONSOLE_NE2K && (ENV_ROMSTAGE || ENV_RAMSTAGE)
35static inline void __ne2k_init(void) { ne2k_init(CONFIG_CONSOLE_NE2K_IO_PORT); }
36static inline void __ne2k_tx_byte(u8 data) { ne2k_append_data_byte(data, CONFIG_CONSOLE_NE2K_IO_PORT); }
37static inline void __ne2k_tx_flush(void) { ne2k_transmit(CONFIG_CONSOLE_NE2K_IO_PORT); }
38#else
39static inline void __ne2k_init(void) {}
40static inline void __ne2k_tx_byte(u8 data) {}
41static inline void __ne2k_tx_flush(void) {}
42#endif
43
Rudolf Marek4aa93cc2010-07-16 20:02:09 +000044#endif /* _NE2K_H */