Browse Source

hyplnk example little modify

master
qshi 6 years ago
parent
commit
48df1fd78b
  1. 6
      samples/srio/.cproject
  2. 44
      samples/srio/src/hyplnk.c

6
samples/srio/.cproject

@ -98,6 +98,9 @@
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="driver/of" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
@ -195,6 +198,9 @@
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="driver/of" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>

44
samples/srio/src/hyplnk.c

@ -7,62 +7,60 @@
#include <stdio.h>
#include <string.h>
#include "hyplnk_func.h"
typedef struct hyplnk_test {
int sem;
hpk_addr_cfg_s map_table;
}hyplnk_test_s;
extern int g_master;
static hyplnk_test_s _hpk_test;
static volatile int _sem = 0;
static void __hyplnk_intr(void *arg)
{
hyplnk_test_s *ht = (hyplnk_test_s *)arg;
ht->sem += 1;
*(int*)arg = 1;
}
int hyplnk_task()
{
_hpk_test.sem = 0;
hyplnk_init(&_hpk_test, __hyplnk_intr);
hpk_addr_cfg_s map_table;
hyplnk_init((void *)&_sem, __hyplnk_intr);
/* local remote leng
* 0x40000000 -> 0x0C3000000 4M
* 0x40100000 -> 0xB00000000 252M
* */
_hpk_test.map_table.seg_info[0].local_addr = 0x40000000;
_hpk_test.map_table.seg_info[0].remote_addr = 0x0C300000; //msmc
_hpk_test.map_table.seg_info[0].map_leng = 0x400000; //4M
map_table.seg_info[0].local_addr = 0x40000000;
map_table.seg_info[0].remote_addr = 0x0C300000; //msmc
map_table.seg_info[0].map_leng = 0x400000; //4M
_hpk_test.map_table.seg_info[1].local_addr = 0x40400000;
_hpk_test.map_table.seg_info[1].remote_addr = 0xB0000000; //ddr
_hpk_test.map_table.seg_info[1].map_leng = 0x0FC00000; //252M
map_table.seg_info[1].local_addr = 0x40400000;
map_table.seg_info[1].remote_addr = 0xB0000000; //ddr
map_table.seg_info[1].map_leng = 0x0FC00000; //252M
_hpk_test.map_table.seg_num = 2;
hyplnk_addr_map(&_hpk_test.map_table);
map_table.seg_num = 2;
hyplnk_addr_map(&map_table);
printf("hyplnk func init complete ... \n");
if (g_master) {
printf("master: send data to remote... \n");
memset((void *)0x40000000, 0xA1, _hpk_test.map_table.seg_info[0].map_leng);
memset((void *)0x40400000, 0xA2, _hpk_test.map_table.seg_info[1].map_leng);
memset((void *)0x40000000, 0xA1, map_table.seg_info[0].map_leng);
memset((void *)0x40400000, 0xA2, map_table.seg_info[1].map_leng);
printf("master: send intr to remote... \n");
hyplnk_send_intr_remote();
printf("master: wait slave ack...\n");
while(_hpk_test.sem == 0)
//while(_hpk_test.sem == 0)
while(_sem == 0)
;
} else {
//wait recv intr
printf("slave wait recv intr\n");
while(_hpk_test.sem == 0)
//while(_hpk_test.sem == 0)
while(_sem == 0)
;
printf("slave: send data to remote... \n");
memset((void *)0x40000000, 0xB1, _hpk_test.map_table.seg_info[0].map_leng);
memset((void *)0x40400000, 0xB2, _hpk_test.map_table.seg_info[1].map_leng);
memset((void *)0x40000000, 0xB1, map_table.seg_info[0].map_leng);
memset((void *)0x40400000, 0xB2, map_table.seg_info[1].map_leng);
printf("slave: send intr to remote... \n");
hyplnk_send_intr_remote();

Loading…
Cancel
Save