Date:2011-09-25 21:57:44 (12 years 2 months ago)
Author:Stefan Schmidt
Commit:54634ded5466868fc19671fc3ebaa9836b2739e1
Message:ieee802154/at86rf230: Add Automatic retransmit form the extended mode

This will handle CSMA/CA for us as well as re-sending frames when no ack comes
in timely.

Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Files: drivers/ieee802154/at86rf230.c (5 diffs)

Change Details

drivers/ieee802154/at86rf230.c
3939
4040#include "at86rf230.h"
4141
42//#define ENABLE_AACK
42#define ENABLE_AACK
4343
4444struct at86rf230_local {
4545    struct spi_device *spi;
...... 
292292    might_sleep();
293293
294294    if (state == STATE_FORCE_TX_ON)
295#ifdef ENABLE_AACK
296        desired_status = STATE_TX_ARET_ON;
297#else
295298        desired_status = STATE_TX_ON;
299#endif
296300    else if (state == STATE_FORCE_TRX_OFF)
297301        desired_status = STATE_TRX_OFF;
298302    else
...... 
320324        pr_debug("%s val2 = %x\n", __func__, val);
321325    } while (val == STATE_TRANSITION_IN_PROGRESS);
322326
327#ifdef ENABLE_AACK
328    /* Make sure we go to TX_ON before we go to STATE_TX_ARET_ON */
329    if (desired_status == STATE_TX_ARET_ON) {
330        rc = at86rf230_write_subreg(lp, SR_TRX_CMD, STATE_TX_ON);
331        if (rc)
332            goto err;
333
334        do {
335            rc = at86rf230_read_subreg(lp, SR_TRX_STATUS, &val);
336            if (rc)
337                goto err;
338            pr_debug("%s val3 = %x\n", __func__, val);
339        } while (val == STATE_TRANSITION_IN_PROGRESS);
340
341        rc = at86rf230_write_subreg(lp, SR_TRX_CMD, desired_status);
342        if (rc)
343            goto err;
344
345        do {
346            rc = at86rf230_read_subreg(lp, SR_TRX_STATUS, &val);
347            if (rc)
348                goto err;
349            pr_debug("%s val4 = %x\n", __func__, val);
350        } while (val == STATE_TRANSITION_IN_PROGRESS);
351    }
352#endif
323353
324354    if (val == desired_status)
325355        return 0;
...... 
415445        udelay(80); /* > 62.5 */
416446        gpio_set_value(lp->slp_tr, 0);
417447    } else {
448        /* FIXME: Stay with STATE_BUSY_TX even if we want to got into
449         * state BUSY_TX_ART. The logic with state and command matching
450         * the same number breaks totally here. */
418451        rc = at86rf230_write_subreg(lp, SR_TRX_CMD, STATE_BUSY_TX);
419452        if (rc)
420453            goto err_rx;
...... 
633666
634667    msleep(100);
635668
669#ifdef ENABLE_AACK
670    rc = at86rf230_write_subreg(lp, SR_TRX_CMD, STATE_TX_ARET_ON);
671#else
636672    rc = at86rf230_write_subreg(lp, SR_TRX_CMD, STATE_TX_ON);
673#endif
637674    if (rc)
638675        return rc;
639676    msleep(1);

Archive Download the corresponding diff file



interactive