1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-12-24 18:19:54 +02:00
ben-wpan/atusb/fw/include/atspi/ep0.h
Werner Almesberger 2337557a8c atusd firmware now supports setting the TST pin.
- common/io.h: TST is connected to P0_7
- include/at86rf230.h: added test mode registers REG_CONT_TX_0 (0x36) and
  REG_CONT_TX_1 (0x3d), with their values
- atspi/atspi.c (set_test_mode): set or reset TST and the LED
- atspi/atspi.c (reset_rf): leave test mode
- atspi/atspi.c (test_mode): enter test mode
- atspi/atspi.c (main): flash the LED when in test mode
- include/atspi/ep0.h (enum atspi_requests), atspi/ep0.c (my_setup): new
  command ATSPI_TEST to enter test mode
- include/atspi/ep0.h (EP0ATSPI_MINOR): bumped protocol to version 0.1
- include/at86rf230.h: corrected comment before TRX_CMD field to indicate
  that the register is called TRX_STATE
2010-11-11 02:25:54 -03:00

83 lines
1.7 KiB
C

/*
* include/atspi/ep0.h - EP0 extension protocol
*
* Written 2008-2010 by Werner Almesberger
* Copyright 2008-2010 Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef EP0_H
#define EP0_H
/*
* Direction bRequest wValue wIndex wLength
*
* ->host ATSPI_ID - - 3
* ->host ATSPI_BUILD - - #bytes
* host-> ATSPI_RESET - - 0
*
* host-> ATSPI_RF_RESET - - 0
* ->host ATSPI_POLL_INT - - 1
* host-> ATSPI_TEST - - 0
*
* host-> ATSPI_REG_WRITE value addr 0
* ->host ATSPI_REG_READ - addr 1
* host-> ATSPI_BUF_WRITE - - #bytes
* ->host ATSPI_BUF_READ - - #bytes
* host-> ATSPI_SRAM_WRITE - addr #bytes
* ->host ATSPI_SRAM_READ - addr #bytes
*/
/*
* EP0 protocol:
*
* 0.0 initial release
* 0.1 addition of ATSPI_TEST
*/
#define EP0ATSPI_MAJOR 0 /* EP0 protocol, major revision */
#define EP0ATSPI_MINOR 1 /* EP0 protocol, minor revision */
#define HW_TYPE_100813 0 /* 100813 */
/*
* bmRequestType:
*
* D7 D6..5 D4...0
* | | |
* direction (0 = host->dev)
* type (2 = vendor)
* recipient (0 = device)
*/
#define ATSPI_TO_DEV(req) (0x40 | (req) << 8)
#define ATSPI_FROM_DEV(req) (0xc0 | (req) << 8)
enum atspi_requests {
ATSPI_ID = 0x00,
ATSPI_BUILD,
ATSPI_RESET,
ATSPI_RF_RESET = 0x10,
ATSPI_POLL_INT,
ATSPI_TEST,
ATSPI_REG_WRITE = 0x20,
ATSPI_REG_READ,
ATSPI_BUF_WRITE,
ATSPI_BUF_READ,
ATSPI_SRAM_WRITE,
ATSPI_SRAM_READ,
};
void ep0_init(void);
#endif /* !EP0_H */