1/*
2 * Robo switch configuration
3 *
4 * Copyright 2004, Broadcom Corporation
5 * All Rights Reserved.
6 *
7 * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8 * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9 * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10 * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
11 *
12 * $Id: switch.c,v 1.1.1.1 2008/10/15 03:28:48 james26_jang Exp $
13 */
14
15#include <stdio.h>
16#include <stdlib.h>
17#include <errno.h>
18#include <syslog.h>
19#include <ctype.h>
20#include <string.h>
21#include <unistd.h>
22#include <sys/stat.h>
23#include <sys/ioctl.h>
24#include <sys/types.h>
25#include <sys/socket.h>
26#include <net/if.h>
27#include <netinet/in.h>
28#include <arpa/inet.h>
29#include <net/if_arp.h>
30#include <bcmnvram.h>
31#include <netconf.h>
32#include <shutils.h>
33#include <rc.h>
34#include <errno.h>
35#include <stdio.h>
36#include <stdlib.h>
37#include <unistd.h>
38#include <fcntl.h>
39#include <strings.h>
40#include <sys/ioctl.h>
41#include <string.h>
42#include <sys/socket.h>
43#include <sys/types.h>
44#define uint32 unsigned long
45#define uint unsigned int
46#define uint8 unsigned char
47#define uint64 unsigned long long
48#include <swmod.h>
49#include <swapi.h>
50#include <nvports.h>
51#include <bcmdevs.h>
52
53
54void setup_switch(void)
55{
56	int portid, max_port = BCM_NUM_PORTS;
57	PORT_ATTRIBS port_attribs;
58	return;
59
60	if ((bcm_api_init())<0) {
61        if (bcm_is_robo())
62        {
63	        fprintf(stderr,"No Robo device found\n");
64        }
65        return;
66	}
67	printf("Initializing Ethernet switch "
68	       "controller (%d ports)\n", max_port);
69	for(portid=1; portid <= max_port;portid++) {
70	    /* get nvram attributes associated with port and set switch regs */
71	    port_attribs = nvGetSwitchPortAttribs(portid);
72	    bcm_set_port_attributes(&port_attribs, portid);
73	}
74	bcm_api_deinit();
75
76}
77
78