예제 #1
0
파일: rtl8169.c 프로젝트: Ga-vin/MINIX3
/*===========================================================================*
 *		            sef_cb_init_fresh                                *
 *===========================================================================*/
static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the rtl8169 driver. */
	long v;

	system_hz = sys_hz();

	v = 0;
	(void) env_parse("instance", "d", 0, &v, 0, 255);
	re_instance = (int) v;

	/* Claim buffer memory now. */
	rl_init_buf(&re_state);

	/* Announce we are up! */
	netdriver_announce();

	return(OK);
}
/*===========================================================================*
 *				rl_init					     *
 *===========================================================================*/
static int rl_init(unsigned int instance, netdriver_addr_t *addr,
	uint32_t *caps, unsigned int *ticks)
{
/* Initialize the rtl8169 driver. */
	re_t *rep;

	/* Initialize driver state. */
	rep = &re_state;
	memset(rep, 0, sizeof(*rep));

	/* Try to find a matching device. */
	if (!rl_probe(rep, instance))
		return ENXIO;

	/* Claim buffer memory now. */
	rl_init_buf(&re_state);

	/* Initialize the device we found. */
	rl_init_hw(rep, addr, instance);

	*caps = NDEV_CAP_MCAST | NDEV_CAP_BCAST | NDEV_CAP_HWADDR;
	*ticks = sys_hz();
	return OK;
}