运行完成后,新建一个software project编写代码,并初始化thincore_plbw核。其初始化程序如下:
void Initialize_thincore()
{
xc_iface_t *iface;
xc_to_reg_t *face_x1,*face_x2,*face_x3;
xc_to_reg_t *face_x4,*face_x5,*face_x6;
xc_to_reg_t *face_x7,*face_x8,*face_xp,*face_start;
xc_from_reg_t *face_del;
xc_create(&iface, &THINCORE_PLBW_ConfigTable[0]);
xc_get_shmem(iface, "x1", (void **)&face_x1);
xc_get_shmem(iface, "x2", (void **)&face_x2);
xc_get_shmem(iface, "x3", (void **)&face_x3);
xc_get_shmem(iface, "x4", (void **)&face_x4);
xc_get_shmem(iface, "x5", (void **)&face_x5);
xc_get_shmem(iface, "x6", (void **)&face_x6);
xc_get_shmem(iface, "x7", (void **)&face_x7);
xc_get_shmem(iface, "x8", (void **)&face_x8);
xc_get_shmem(iface, "x9", (void **)&face_xp);
xc_get_shmem(iface, "start", (void **)&face_start);
xc_get_shmem(iface, "del", (void **)&face_del);
x1 = (Xuint32 *) face_x1->din;
x2 = (Xuint32 *) face_x2->din;
x3 = (Xuint32 *) face_x3->din;
x4 = (Xuint32 *) face_x4->din;
x5 = (Xuint32 *) face_x5->din;
x6 = (Xuint32 *) face_x6->din;
x7 = (Xuint32 *) face_x7->din;
x8 = (Xuint32 *) face_x8->din;
xp = (Xuint32 *) face_xp->din;
start = (Xuint32 *) face_start->din;
del = (Xuint32 *) face_del->dout;
}
其中x1~xp为全局变量,分别指向thincore核的各个端口的映射地址。 |