[En-Nut-Discussion] Doubts about sbi_mmc.c SbiMmCardSelect() return value

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Tue Jun 18 21:00:06 CEST 2013


Hallo,

I think the return value of sbi_mmc.c SbiMmCardSelect() is invers to what
the comments describe:

/*!
 * \brief Activate or deactivate chip select on card slot 0.
 *
 * \param on The card will be selected if 1, deselected if 0.
 *           Any other value can be used to query the status.
 *
 * \return Previous select status. 1 if selected, 0 otherwise.
 */
static int SbiMmCardSelect(int on)
{
    int rc = MMC_CS_IS();

    /* MMC select is low active. */
    if (on == 1) {
        MMC_CS_LO();
    } else if (on == 0) {
        MMC_CS_HI();
    }
    return rc;
}

If select was active (== 0) before, the output register should have been '0'
too. With MMC_CS_IS() we read the output register and return '0' in that
case, opposed to the comment.

I think we should write
    return (rc)?0:1;

Bye

-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------


More information about the En-Nut-Discussion mailing list