blob: b52f566896a92877ce52c399a3c39477c1b3b8c2 [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.
Rudolf Marek4aa93cc2010-07-16 20:02:09 +000014 */
15
Stefan Reinauer3f5f6d82013-05-07 20:35:29 +020016#ifndef _NE2K_H__
17#define _NE2K_H__
Kyösti Mälkkif3390862014-02-26 15:19:04 +020018
Kyösti Mälkkif3390862014-02-26 15:19:04 +020019#include <stdint.h>
20
Rudolf Marek4aa93cc2010-07-16 20:02:09 +000021void ne2k_append_data(unsigned char *d, int len, unsigned int base);
22int ne2k_init(unsigned int eth_nic_base);
23void ne2k_transmit(unsigned int eth_nic_base);
Kyösti Mälkkidbc7bd92014-01-28 11:34:38 +020024
Nico Huberafa9aef2017-05-18 16:12:07 +020025#if IS_ENABLED(CONFIG_CONSOLE_NE2K) && (ENV_ROMSTAGE || ENV_RAMSTAGE)
Lee Leahy6a566d72017-03-07 17:45:12 -080026static inline void __ne2k_init(void)
27{
28 ne2k_init(CONFIG_CONSOLE_NE2K_IO_PORT);
29}
30static inline void __ne2k_tx_byte(u8 data)
31{
Kyösti Mälkkic8cf5912018-06-04 06:02:01 +030032 ne2k_append_data(&data, 1, CONFIG_CONSOLE_NE2K_IO_PORT);
Lee Leahy6a566d72017-03-07 17:45:12 -080033}
34static inline void __ne2k_tx_flush(void)
35{
36 ne2k_transmit(CONFIG_CONSOLE_NE2K_IO_PORT);
37}
Kyösti Mälkkif3390862014-02-26 15:19:04 +020038#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
Martin Rothfd277d82016-01-11 12:47:30 -070044#endif /* _NE2K_H__ */