All pastes #816765 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-12-14 23:38 UTC
rendered paste body
static int
eeprom_rdsr (char *status)
{
    int ret = 0;
    unsigned char cmd = EEPROM_RDSR;
    unsigned long flag;

    local_irq_save(flag);

    if ((ret = ifx_ssc_cs_low(EEPROM_CS)))
        goto out;

    if ((ret = ifx_ssc_txrx(&cmd, 1, status, 1)) < 0)
        goto out;

out:
    ifx_ssc_cs_high(EEPROM_CS);
    local_irq_restore(flag);
    
    return ret;
}

static inline int
eeprom_wip_over (void)
{
    int ret = 0;
    unsigned char status;

    while (1)
    {
        ret = eeprom_rdsr(&status);
        printk("status %x \n", status);

        if ((status & 1) != 0)
        {
            printk("read back status not zero %x\n", status);
        } else {
            if (ret)
                printk("read back status fails %d\n", ret);
            break;
        }
    }

    return ret;
}