Root/atrf/tools/atspi-txrx/atspi-txrx.c

Source at commit c2dd23840ce5875deca09673fcb8abb8dc3a8e7a created 9 years 1 month ago.
By Werner Almesberger, Moved fw/ and tools/ into atrf/ as well.
1/*
2 * atspi-txrx/atspi-txrx.c - ben-wpan AF86RF230 TX/RX
3 *
4 * Written 2010 by Werner Almesberger
5 * Copyright 2010 Werner Almesberger
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13
14#include <stdlib.h>
15#include <stdio.h>
16#include <usb.h>
17
18#include "at86rf230.h"
19#include "atspi/ep0.h"
20#include "atspi.h"
21
22
23#define FROM_DEV ATSPI_FROM_DEV(0)
24#define TO_DEV ATSPI_TO_DEV(0)
25
26#define BUF_SIZE 256
27
28
29static void usage(const char *name)
30{
31    fprintf(stderr, "%s\n", name);
32    exit(1);
33}
34
35
36int main(int argc, const char **argv)
37{
38    usb_dev_handle *dev;
39
40    if (argc != 1)
41        usage(*argv);
42    dev = atspi_open();
43    if (!dev)
44        return 1;
45
46    atspi_reg_write(dev, REG_TRX_STATE, TRX_CMD_TRX_OFF);
47    sleep(1000);
48
49    return 0;
50}
51

Archive Download this file



interactive