Ejemplo n.º 1
0
int portal_serialmux_handler(struct PortalInternal *pint, unsigned int channel, int messageFd)
{
    int i;
    unsigned int fpga_number = (channel >> 8) & 0xFF;
    unsigned int msg_number  = (channel >> 0) & 0xFF;
    fprintf(stderr, "%s:%d channel=%x\n", __FUNCTION__, __LINE__, channel);
    for (i = 0; i < pint->mux_ports_number; i++) {
        PortalInternal *p = pint->mux_ports[i].pint;
	int hdr = pint->map_base[128];
	int reqwords = hdr & 0xffff;
	memcpy((void *)&p->map_base[128], (void *)&pint->map_base[128], 4*reqwords);
        if (fpga_number == p->fpga_number && p->handler) {
            p->handler(p, msg_number, messageFd);
        }
    }
    return -1;
}
Ejemplo n.º 2
0
static int indMsgSource (PortalInternal *pint, const uint32_t portal, const uint32_t data )
{
    if (trace_xsim)
	fprintf(stderr, "%s: portal=%d data=%x pid=%d\n", __FUNCTION__, portal, data, getpid());
    PortalInternal *clientp = pint->mux_ports[portal].pint;
    clientp->map_base[indicationIndex[portal]++] = data;
    uint32_t hdr = clientp->map_base[0];
    int numwords = hdr & 0xFF;

    if (indicationIndex[portal] >= numwords) {
        uint32_t methodId = (hdr >> 16) & 0xFF;
	if (trace_xsim)
            fprintf(stderr, "%s: clientp=%p srcbeats=%d methodwords=%d methodId=%d hdr=%08x\n",
		__FUNCTION__, clientp, indicationIndex[portal], numwords, methodId, hdr);
        if (clientp->handler)
            clientp->handler(clientp, methodId, 0);
        indicationIndex[portal] = 0;
    }