示例#1
0
int
main(void)
{
  u2_init();

  // setup tx gpio bits for GPIOM_FPGA_1 -- fpga debug output
  //hal_gpio_set_sels(GPIO_TX_BANK, "1111111111111111");
  //hal_gpio_set_sels(GPIO_RX_BANK, "1111111111111111");

  putstr("\ntx_only\n");
  
  // Control LEDs
  hal_set_leds(0x0, 0x3);

  if (USE_BUFFER_INTERRUPT)
    pic_register_handler(IRQ_BUFFER,   buffer_irq_handler);

  pic_register_handler(IRQ_OVERRUN,  overrun_irq_handler);
  pic_register_handler(IRQ_UNDERRUN, underrun_irq_handler);

  //pic_register_handler(IRQ_TIMER, timer_irq_handler);
  //hal_set_timeout(timer_delta);

  ethernet_register_link_changed_callback(link_changed_callback);

  ethernet_init();

  // initialize double buffering state machine for DSP RX -> Ethernet
  dbsm_init(&dsp_rx_sm, DSP_RX_BUF_0,
	    &dsp_rx_recv_args, &dsp_rx_send_args,
	    dbsm_nop_inspector);

  // setup receive from ETH
  // bp_receive_to_buf(CPU_RX_BUF, PORT_ETH, 1, 0, BP_LAST_LINE);

#if 0
  if (hwconfig_simulation_p()){
    // If we're simulating, pretend that we got a start command from the host
    u2_mac_addr_t host = {{ 0x00, 0x0A, 0xE4, 0x3E, 0xD2, 0xD5 }};
    start_rx_cmd(&host);
  }
#endif

  start_tx_transfers();		// send constant buffers to DSP TX

  while(1){
    if (!USE_BUFFER_INTERRUPT)
      buffer_irq_handler(0);
  }
}
示例#2
0
文件: test1.c 项目: GREO/GNU-Radio
int
main(void)
{
  int i;

  u2_init();

  // Control LEDs
  output_regs->leds = 0x02;

  // Turn on ADCs
  output_regs->adc_ctrl = 0x0A;

  // Set up TX Chain
  dsp_tx_regs->freq = 0;
  dsp_tx_regs->scale_iq = (1 << 16) | 1;
  dsp_tx_regs->interp_rate = 8;

  // Set up RX Chain
  dsp_rx_regs->freq = 0;
  dsp_rx_regs->scale_iq = (1 << 16) | 1;
  dsp_rx_regs->decim_rate = 8;

  // Set up buffer control, using only 4 for now
  for(i=0;i<4;i++) 
    buffer_state[i] = EMPTY;

  // Set up DSP RX
  buffer_state[0] = FILLING;
  serdes_tx_idle = 1;
  bp_receive_to_buf(0, 1, 1, 10, 509);  // DSP_RX to buffer 0, use 500 lines

  //dsp_rx_regs->run_rx = 1;           // Start DSP_RX
  putstr("Done DSP RX setup\n");

  // Set up serdes RX
  buffer_state[2] = FILLING;
  dsp_tx_idle = 1;
  bp_receive_to_buf(2, PORT, 1, 5, 504);

  while (buffer_pool_status->status == 0)  // wait for completion of DSP RX
    ;

  putstr("Done DSP TX setup\n");
  //dsp_tx_regs->run_tx = 1;

  // register interrupt handler
  pic_register_handler(IRQ_BUFFER, buffer_irq_handler);

  while (1)
    ;

  hal_finish();
  return 1;
}
示例#3
0
void i2c_register_handler(void) {
    pic_register_handler(IRQ_I2C, i2c_irq_handler);
}