static void rocker_test_dma_ctrl(Rocker *r, uint32_t val)

{

    PCIDevice *dev = PCI_DEVICE(r);

    char *buf;

    int i;



    buf = g_malloc(r->test_dma_size);



    if (!buf) {

        DPRINTF("test dma buffer alloc failed");

        return;

    }



    switch (val) {

    case ROCKER_TEST_DMA_CTRL_CLEAR:

        memset(buf, 0, r->test_dma_size);

        break;

    case ROCKER_TEST_DMA_CTRL_FILL:

        memset(buf, 0x96, r->test_dma_size);

        break;

    case ROCKER_TEST_DMA_CTRL_INVERT:

        pci_dma_read(dev, r->test_dma_addr, buf, r->test_dma_size);

        for (i = 0; i < r->test_dma_size; i++) {

            buf[i] = ~buf[i];

        }

        break;

    default:

        DPRINTF("not test dma control val=0x%08x\n", val);

        goto err_out;

    }

    pci_dma_write(dev, r->test_dma_addr, buf, r->test_dma_size);



    rocker_msix_irq(r, ROCKER_MSIX_VEC_TEST);



err_out:

    g_free(buf);

}

static void rocker_test_dma_ctrl(Rocker *r, uint32_t val)

{

    PCIDevice *dev = PCI_DEVICE(r);

    char *buf;

    int i;



    buf = g_malloc(r->test_dma_size);



    if (!buf) {

        DPRINTF("test dma buffer alloc failed");

        return;

    }



    switch (val) {

    case ROCKER_TEST_DMA_CTRL_CLEAR:

        memset(buf, 0, r->test_dma_size);

        break;

    case ROCKER_TEST_DMA_CTRL_FILL:

        memset(buf, 0x96, r->test_dma_size);

        break;

    case ROCKER_TEST_DMA_CTRL_INVERT:

        pci_dma_read(dev, r->test_dma_addr, buf, r->test_dma_size);

        for (i = 0; i < r->test_dma_size; i++) {

            buf[i] = ~buf[i];

        }

        break;

    default:

        DPRINTF("not test dma control val=0x%08x\n", val);

        goto err_out;

    }

    pci_dma_write(dev, r->test_dma_addr, buf, r->test_dma_size);



    rocker_msix_irq(r, ROCKER_MSIX_VEC_TEST);



err_out:

    g_free(buf);

}

    if (!buf) {         DPRINTF("test dma buffer alloc failed");         goto err_out;
static void FUNC_0(Rocker *VAR_0, uint32_t VAR_1)

{

    PCIDevice *dev = PCI_DEVICE(VAR_0);

    char *VAR_2;

    int VAR_3;



    VAR_2 = g_malloc(VAR_0->test_dma_size);



    if (!VAR_2) {

        DPRINTF("test dma buffer alloc failed");

        return;

    }



    switch (VAR_1) {

    case ROCKER_TEST_DMA_CTRL_CLEAR:

        memset(VAR_2, 0, VAR_0->test_dma_size);

        break;

    case ROCKER_TEST_DMA_CTRL_FILL:

        memset(VAR_2, 0x96, VAR_0->test_dma_size);

        break;

    case ROCKER_TEST_DMA_CTRL_INVERT:

        pci_dma_read(dev, VAR_0->test_dma_addr, VAR_2, VAR_0->test_dma_size);

        for (VAR_3 = 0; VAR_3 < VAR_0->test_dma_size; VAR_3++) {

            VAR_2[VAR_3] = ~VAR_2[VAR_3];

        }

        break;

    default:

        DPRINTF("not test dma control VAR_1=0x%08x\n", VAR_1);

        goto err_out;

    }

    pci_dma_write(dev, VAR_0->test_dma_addr, VAR_2, VAR_0->test_dma_size);



    rocker_msix_irq(VAR_0, ROCKER_MSIX_VEC_TEST);



err_out:

    g_free(VAR_2);

}

static void FUNC_0(Rocker *VAR_0, uint32_t VAR_1)
{ PCIDevice *dev = PCI_DEVICE(VAR_0); char *VAR_2; int VAR_3; VAR_2 = g_malloc(VAR_0->test_dma_size); if (!VAR_2) { DPRINTF("test dma buffer alloc failed"); return; } switch (VAR_1) { case ROCKER_TEST_DMA_CTRL_CLEAR:
memset(VAR_2, 0, VAR_0->test_dma_size); break; case ROCKER_TEST_DMA_CTRL_FILL:
memset(VAR_2, 0x96, VAR_0->test_dma_size); break; case ROCKER_TEST_DMA_CTRL_INVERT:
pci_dma_read(dev, VAR_0->test_dma_addr, VAR_2, VAR_0->test_dma_size); for (VAR_3 = 0; VAR_3 < VAR_0->test_dma_size; VAR_3++) { VAR_2[VAR_3] = ~VAR_2[VAR_3]; } break; default:
DPRINTF("not test dma control VAR_1=0x%08x\n", VAR_1); goto err_out; } pci_dma_write(dev, VAR_0->test_dma_addr, VAR_2, VAR_0->test_dma_size); rocker_msix_irq(VAR_0, ROCKER_MSIX_VEC_TEST); err_out:
g_free(VAR_2); }