Esempio n. 1
0
static void register_listeners(chanend listener_ctl[])
{
  for (int i=0;i<AVB_NUM_LISTENER_UNITS;i++) {
    int core_id = xc_abi_inuint(listener_ctl[i]);
    int num_streams = xc_abi_inuint(listener_ctl[i]);
    for (int j=0;j<num_streams;j++) {
      avb_sink_info_t *sink = &sinks[max_listener_stream_id];
      sink->stream.state = AVB_SINK_STATE_DISABLED;
      sink->listener_ctl = listener_ctl[i];
      sink->stream.core_id = core_id;
      sink->stream.local_id = j;
      sink->stream.flags = 0;
      sink->stream.vlan = AVB_DEFAULT_VLAN;
      sink->stream.srp_talker_attr = mrp_get_attr();
      sink->stream.srp_talker_failed_attr = mrp_get_attr();
      sink->stream.srp_listener_attr = mrp_get_attr();
      mrp_attribute_init(sink->stream.srp_talker_attr, MSRP_TALKER_ADVERTISE, sink);
      mrp_attribute_init(sink->stream.srp_talker_failed_attr, MSRP_TALKER_FAILED, sink);
      mrp_attribute_init(sink->stream.srp_listener_attr, MSRP_LISTENER, sink);
      max_listener_stream_id++;
    }    
    xc_abi_outuint(listener_ctl[i], max_link_id);
    max_link_id++;
  }
  return;
}
Esempio n. 2
0
static void register_talkers(chanend talker_ctl[])
{
  for (int i=0;i<AVB_NUM_TALKER_UNITS;i++) {
    int core_id = xc_abi_inuint(talker_ctl[i]);
    int num_streams = xc_abi_inuint(talker_ctl[i]);
    for (int j=0;j<num_streams;j++) {
      avb_source_info_t *source = &sources[max_talker_stream_id];
      source->stream.state = AVB_SOURCE_STATE_DISABLED;
      source->talker_ctl = talker_ctl[i];
      source->stream.core_id = core_id;
      source->stream.local_id = j;
      source->stream.flags = 0;
      source->stream.streamId[0] = (mac_addr[0] << 24) | (mac_addr[1] << 16) | (mac_addr[2] <<  8) | (mac_addr[3] <<  0);
      source->stream.streamId[1] = (mac_addr[4] << 24) | (mac_addr[5] << 16) | ((source->stream.local_id & 0xffff)<<0);
      source->presentation = AVB_DEFAULT_PRESENTATION_TIME_DELAY_NS;
      source->stream.vlan = AVB_DEFAULT_VLAN;
      source->stream.srp_talker_attr = mrp_get_attr();
      source->stream.srp_talker_failed_attr = mrp_get_attr();
      source->stream.srp_listener_attr = mrp_get_attr();
      mrp_attribute_init(source->stream.srp_talker_attr, MSRP_TALKER_ADVERTISE, source);
      mrp_attribute_init(source->stream.srp_talker_failed_attr, MSRP_TALKER_FAILED, source);
      mrp_attribute_init(source->stream.srp_listener_attr, MSRP_LISTENER, source);
      max_talker_stream_id++;
    }       
  }
  return;
}
Esempio n. 3
0
void avb_mmrp_init(void)
{
  for (int i=0;i<AVB_MAX_MMRP_GROUPS;i++) {
    entries[i].active = 0;
    entries[i].attr = mrp_get_attr();
    mrp_attribute_init(entries[i].attr, MMRP_MAC_VECTOR, &entries[i].addr);
  }
}
Esempio n. 4
0
void avb_mvrp_init(void)
{
  for (int i=0;i<AVB_MAX_NUM_VLAN;i++) {
    entries[i].active = 0;
    entries[i].attr = mrp_get_attr();
    mrp_attribute_init(entries[i].attr, MVRP_VID_VECTOR, &entries[i].vlan);
  }
}
Esempio n. 5
0
void srp_domain_init(void) {
  for(int i=0; i < MRP_NUM_PORTS; i++)
  {
    domain_attr[i] = mrp_get_attr();
    mrp_attribute_init(domain_attr[i], MSRP_DOMAIN_VECTOR, i, 1, NULL);
    srp_domain_boundary_port[i] = 1;
  }
  current_vlan_id_from_domain = AVB_DEFAULT_VLAN;
}
Esempio n. 6
0
void avb_init(chanend media_ctl[],
              chanend listener_ctl[],
              chanend talker_ctl[],
              chanend media_clock_ctl,
              chanend c_mac_rx0,
              chanend c_mac_tx0,
              chanend c_ptp0) 
{

#if AVB_OSC
  OSC_SET_RANGE(avb_source, 0, AVB_NUM_SOURCES-1);
  OSC_SET_RANGE(device_media_clock, 0, AVB_NUM_MEDIA_CLOCKS-1);
  OSC_SET_RANGE(avb_sink, 0, AVB_NUM_SINKS-1);
  OSC_SET_RANGE(media_in, 0, AVB_NUM_MEDIA_INPUTS-1);
  OSC_SET_RANGE(media_out, 0, AVB_NUM_MEDIA_OUTPUTS-1);
#endif

  mac_get_macaddr(c_mac_tx0, mac_addr);

  mrp_init((char *)mac_addr);
  register_talkers(talker_ctl);
  register_listeners(listener_ctl);
  register_media(media_ctl);
  init_media_clock_server(media_clock_ctl);

  avb_1722_maap_init(mac_addr);

#ifdef AVB_ENABLE_1722_1
  {
	  unsigned char serial_number[2] = { 0,1 };
	  avb_1722_1_init(mac_addr, serial_number);
  }
#endif

  c_mac_rx = c_mac_rx0;
  c_mac_tx = c_mac_tx0;
  c_ptp = c_ptp0;

  domain_attr = mrp_get_attr();
  mrp_attribute_init(domain_attr, MSRP_DOMAIN_VECTOR, NULL);

#ifdef AVB_INCLUDE_MMRP
  avb_mmrp_init();
#endif

#ifndef AVB_EXCLUDE_MVRP
  avb_mvrp_init();
#endif

  xc_abi_outuint(c_mac_tx, ETHERNET_TX_INIT_AVB_ROUTER);

  mac_set_custom_filter(c_mac_rx, MAC_FILTER_AVB_CONTROL);
}
Esempio n. 7
0
    if (!matched1 && !matched2 && !matched3 && !matched4) {
      avb_srp_info_t *attribute_info = st->attribute_info;
      if (attribute_info == NULL) __builtin_trap();

      avb_1722_remove_stream_from_table(c_mac_tx, attribute_info->stream_id);
      srp_remove_reservation_entry(attribute_info);
    }

    mrp_debug_dump_attrs();
  }

  return (st->applicant_state == MRP_UNUSED);
}

static void create_propagated_attribute_and_join(mrp_attribute_state *attr, int new) {
  mrp_attribute_state *st = mrp_get_attr();
  avb_srp_info_t *stream_data = attr->attribute_info;
  mrp_attribute_init(st, attr->attribute_type, !attr->port_num, 0, stream_data);
#if 0
  debug_printf("JOIN mrp_attribute_init: %d, %d, STREAM_ID[0]: %x\n", attr->attribute_type, !attr->port_num, stream_data->stream_id[0]);
#endif
  mrp_mad_begin(st);
  mrp_mad_join(st, new);
  st->propagated = 1; // Propagated to other port
}


// TODO: Remove listener bool param and just use the attribute type from the state structure
static void avb_srp_map_join(mrp_attribute_state *attr, int new, int listener)
{
  avb_srp_info_t *attribute_info = attr->attribute_info;