OpenCores
URL https://opencores.org/ocsvn/funbase_ip_library/funbase_ip_library/trunk

Subversion Repositories funbase_ip_library

[/] [funbase_ip_library/] [trunk/] [TUT/] [soc/] [hibi_pe_dma_example_1/] [1.0/] [src/] [cpu0/] [main.c] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
/*
2
 * file   main.c
3
 * date   2012-02-21
4
 * author Lasse Lehtonen
5
 *
6
 */
7
 
8
#include <stdio.h>
9
#include <stdlib.h>
10
#include <string.h>
11
 
12
#include "system.h"
13
#include "hpd_functions.h"
14
 
15
int main()
16
{
17
  int       n = 0;
18
  int       n_received  = 0;
19
  const int buf_size    = 500;
20
  char      buffer[buf_size];
21
 
22
  memset((void*)buffer, 0, buf_size);
23
 
24
  printf("CPU0: starts\n");
25
 
26
  // Initialize with defaults from hpd_config.c
27
  hpd_initialize();
28
 
29
  // Start stream channel 1
30
  hpd_rx_stream_reinit(1);
31
 
32
 
33
  while(1) {
34
        // Check if stream channel 1 has received any words
35
    if((n = hpd_rx_stream_poll(1))) {
36
 
37
      // Read the words
38
      hpd_rx_stream_read(1, n, (void*)(0x80000000 |
39
                                       ((int)buffer + (n_received << 2))));
40
 
41
      n_received += n;
42
      printf("CPU0: \"%s\"\n", buffer);
43
 
44
      // Send something to CPU1
45
      hpd_tx_send_copy((int)buffer + (n_received - 4) * 4, 4, 0x207);
46
    }
47
 
48
  }
49
 
50
  printf("CPU0: retires!\n");
51
  while(1); return 0;
52
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.