Пример #1
0
void
network_config_load (void)
{
    /* load settings from eeprom */
#ifdef EEPROM_SUPPORT
  eeprom_restore(mac, uip_ethaddr.addr, 6);
#else 
  memcpy_P(uip_ethaddr.addr, PSTR(CONF_ETHERRAPE_MAC), 6);
#endif

#if defined(BOOTP_SUPPORT)				\
    || (IPV6_SUPPORT && !defined(IPV6_STATIC_SUPPORT))	\
    || DHCP_SUPPORT
    return;

#else

    uip_ipaddr_t ip;
    (void) ip;		/* Keep GCC quiet. */

    /* Configure the IP address. */
#ifdef EEPROM_SUPPORT
    /* Please Note: ip and &ip are NOT the same (cpp hell) */
    eeprom_restore_ip(ip, &ip);
#else
    set_CONF_ETHERRAPE_IP(&ip);
#endif
    uip_sethostaddr(&ip);


    /* Configure prefix length (IPv6). */
#ifdef IPV6_SUPPORT
    uip_setprefixlen(CONF_ENC_IP6_PREFIX_LEN);
#endif


#ifdef IPV4_SUPPORT
    /* Configure the netmask (IPv4). */
#ifdef EEPROM_SUPPORT
    /* Please Note: ip and &ip are NOT the same (cpp hell) */
    eeprom_restore_ip(netmask, &ip);
#else
    set_CONF_ETHERRAPE_IP4_NETMASK(&ip);
#endif
    uip_setnetmask(&ip);
#endif  /* IPV4_SUPPORT */

    /* Configure the default gateway  */
#ifdef EEPROM_SUPPORT
    /* Please Note: ip and &ip are NOT the same (cpp hell) */
    eeprom_restore_ip(gateway, &ip);
#else
    set_CONF_ETHERRAPE_GATEWAY(&ip);
#endif
    uip_setdraddr(&ip);
#endif	/* No autoconfiguration. */
}
Пример #2
0
void
network_config_load (void)
{
  /* load settings from eeprom */
#ifdef EEPROM_SUPPORT
  eeprom_restore (mac, uip_ethaddr.addr, 6);
#else
#if defined(BOOTLOADER_SUPPORT) &&  BOOTLOADER_START_ADDRESS > UINT16_MAX
  uint_farptr_t src = pgm_get_far_address (conf_mac);
  uint8_t *dst = uip_ethaddr.addr;
  for (uint8_t i = 6; i; i--)
    *dst++ = pgm_read_byte_far (src++);
#else
  memcpy_P (uip_ethaddr.addr, conf_mac, 6);
#endif
#endif

#if (defined(IPV4_SUPPORT) && !defined(BOOTP_SUPPORT) && !defined(DHCP_SUPPORT)) || defined(IPV6_STATIC_SUPPORT)
  uip_ipaddr_t ip;

  /* Configure the IP address. */
#ifdef EEPROM_SUPPORT
  /* Please Note: ip and &ip are NOT the same (cpp hell) */
  eeprom_restore_ip (ip, &ip);
#else
  set_CONF_ETHERRAPE_IP (&ip);
#endif
  uip_sethostaddr (&ip);

  /* Configure prefix length (IPv6). */
#ifdef IPV6_SUPPORT
  uip_setprefixlen (CONF_ENC_IP6_PREFIX_LEN);
#endif

#ifdef IPV4_SUPPORT
  /* Configure the netmask (IPv4). */
#ifdef EEPROM_SUPPORT
  /* Please Note: ip and &ip are NOT the same (cpp hell) */
  eeprom_restore_ip (netmask, &ip);
#else
  set_CONF_ETHERRAPE_IP4_NETMASK (&ip);
#endif
  uip_setnetmask (&ip);
#endif /* IPV4_SUPPORT */

  /* Configure the default gateway  */
#ifdef EEPROM_SUPPORT
  /* Please Note: ip and &ip are NOT the same (cpp hell) */
  eeprom_restore_ip (gateway, &ip);
#else
  set_CONF_ETHERRAPE_GATEWAY (&ip);
#endif
  uip_setdraddr (&ip);
#endif /* No autoconfiguration. */
}
Пример #3
0
void dhcp_set_static(void) {
  uip_ipaddr_t ip;
  (void) ip;		/* Keep GCC quiet. */


  /* Configure the IP address. */
#ifdef EEPROM_SUPPORT
  /* Please Note: ip and &ip are NOT the same (cpp hell) */
  eeprom_restore_ip(ip, &ip);
#else
  set_CONF_ETHERRAPE_IP(&ip);
#endif
  uip_sethostaddr(&ip);
  
  
  /* Configure the netmask (IPv4). */
#ifdef EEPROM_SUPPORT
  /* Please Note: ip and &ip are NOT the same (cpp hell) */
  eeprom_restore_ip(netmask, &ip);
#else
  set_CONF_ETHERRAPE_IP4_NETMASK(&ip);
#endif
  uip_setnetmask(&ip);
  
  /* Configure the default gateway  */
#ifdef EEPROM_SUPPORT
  /* Please Note: ip and &ip are NOT the same (cpp hell) */
  eeprom_restore_ip(gateway, &ip);
#else
  set_CONF_ETHERRAPE_GATEWAY(&ip);
#endif
  uip_setdraddr(&ip);
  
  /* Remove the bootp connection */
  uip_udp_remove(uip_udp_conn);

}
Пример #4
0
void
eeprom_init (void)
{
  uip_ipaddr_t ip;
  (void) ip;			/* Keep GCC quiet. */

#ifdef ETHERNET_SUPPORT
  eeprom_save_P (mac, PSTR (CONF_ETHERRAPE_MAC), 6);
#endif

#if (defined(IPV4_SUPPORT) && !defined(BOOTP_SUPPORT) && !defined(DHCP_SUPPORT)) || defined(IPV6_STATIC_SUPPORT)
  set_CONF_ETHERRAPE_IP (&ip);
  eeprom_save (ip, &ip, IPADDR_LEN);
#ifdef ETHERNET_SUPPORT
  set_CONF_ETHERRAPE_GATEWAY (&ip);
  eeprom_save (gateway, &ip, IPADDR_LEN);
#endif

#ifdef IPV4_SUPPORT
  set_CONF_ETHERRAPE_IP4_NETMASK (&ip);
  eeprom_save (netmask, &ip, IPADDR_LEN);
#endif
#endif

#ifdef DNS_SUPPORT
  set_CONF_DNS_SERVER (&ip);
  eeprom_save (dns_server, &ip, IPADDR_LEN);
#endif

#ifdef PAM_SINGLE_USER_EEPROM_SUPPORT
  /* Copy the httpd's password. */
  eeprom_save_P (pam_username, PSTR (PAM_SINGLE_USERNAME), 16);
  eeprom_save_P (pam_password, PSTR (PAM_SINGLE_PASSWORD), 16);
#endif

#ifdef KTY_SUPPORT
  eeprom_save_char (kty_calibration, 0);
#endif

#ifdef STELLA_EEPROM
  uint8_t stella_temp[10] = { 0 };
  eeprom_save (stella_channel_values, stella_temp, 10);
#endif

#ifdef DMX_FXSLOT_SUPPORT
  struct fxslot_struct_stripped fxslots_temp[DMX_FXSLOT_AMOUNT] = { {0,0,0,0,0,0,0} };
  eeprom_save (dmx_fxslots, fxslots_temp, DMX_FXSLOT_AMOUNT*sizeof(struct fxslot_struct_stripped));
#endif

#ifdef SMS77_EEPROM_SUPPORT
  eeprom_save_P (sms77_username, PSTR (CONF_SMS77_USER), SMS77_VALUESIZE);
  eeprom_save_P (sms77_password, PSTR (CONF_SMS77_PASS), SMS77_VALUESIZE);
  eeprom_save_P (sms77_receiver, PSTR (CONF_SMS77_TO), SMS77_VALUESIZE);
  eeprom_save_P (sms77_type, PSTR (CONF_SMS77_TYPE), SMS77_VALUESIZE);
#endif

#ifdef JABBER_EEPROM_SUPPORT
  eeprom_save_P (jabber_username, PSTR (CONF_JABBER_USERNAME),
		 JABBER_VALUESIZE);
  eeprom_save_P (jabber_password, PSTR (CONF_JABBER_PASSWORD),
		 JABBER_VALUESIZE);
  eeprom_save_P (jabber_resource, PSTR (CONF_JABBER_RESOURCE),
		 JABBER_VALUESIZE);
  eeprom_save_P (jabber_hostname, PSTR (CONF_JABBER_HOSTNAME),
		 JABBER_VALUESIZE);
#endif

#ifdef MOTD_SUPPORT
  eeprom_save_P (motd_text, PSTR (CONF_MOTD_DEFAULT), MOTD_VALUESIZE);
#endif
  eeprom_update_chksum ();
}