센서보드 RF IRQ 테스트 중

Fork of stm-spirit1-rf-driver by ST

Committer:
Wolfgang Betz
Date:
Fri Dec 16 13:46:02 2016 +0100
Revision:
44:aedd63cb0ce3
Parent:
43:a512f909514a
Child:
45:2d01cc9bc761
Set 'MAX_PACKET_LEN' to 128

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Wolfgang Betz 34:edda6a7238ec 1 /*
Wolfgang Betz 34:edda6a7238ec 2 * Copyright (c) 2012, STMicroelectronics.
Wolfgang Betz 34:edda6a7238ec 3 * All rights reserved.
Wolfgang Betz 34:edda6a7238ec 4 *
Wolfgang Betz 34:edda6a7238ec 5 * Redistribution and use in source and binary forms, with or without
Wolfgang Betz 34:edda6a7238ec 6 * modification, are permitted provided that the following conditions
Wolfgang Betz 34:edda6a7238ec 7 * are met:
Wolfgang Betz 34:edda6a7238ec 8 * 1. Redistributions of source code must retain the above copyright
Wolfgang Betz 34:edda6a7238ec 9 * notice, this list of conditions and the following disclaimer.
Wolfgang Betz 34:edda6a7238ec 10 * 2. Redistributions in binary form must reproduce the above copyright
Wolfgang Betz 34:edda6a7238ec 11 * notice, this list of conditions and the following disclaimer in the
Wolfgang Betz 34:edda6a7238ec 12 * documentation and/or other materials provided with the distribution.
Wolfgang Betz 34:edda6a7238ec 13 * 3. Neither the name of the Institute nor the names of its contributors
Wolfgang Betz 34:edda6a7238ec 14 * may be used to endorse or promote products derived from this software
Wolfgang Betz 34:edda6a7238ec 15 * without specific prior written permission.
Wolfgang Betz 34:edda6a7238ec 16 *
Wolfgang Betz 34:edda6a7238ec 17 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
Wolfgang Betz 34:edda6a7238ec 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Wolfgang Betz 34:edda6a7238ec 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Wolfgang Betz 34:edda6a7238ec 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
Wolfgang Betz 34:edda6a7238ec 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Wolfgang Betz 34:edda6a7238ec 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
Wolfgang Betz 34:edda6a7238ec 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
Wolfgang Betz 34:edda6a7238ec 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
Wolfgang Betz 34:edda6a7238ec 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
Wolfgang Betz 34:edda6a7238ec 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
Wolfgang Betz 34:edda6a7238ec 27 * SUCH DAMAGE.
Wolfgang Betz 34:edda6a7238ec 28 *
Wolfgang Betz 34:edda6a7238ec 29 * This file is part of the Contiki operating system.
Wolfgang Betz 34:edda6a7238ec 30 *
Wolfgang Betz 34:edda6a7238ec 31 */
Wolfgang Betz 34:edda6a7238ec 32 /*---------------------------------------------------------------------------*/
Wolfgang Betz 34:edda6a7238ec 33 #ifndef __SPIRIT1_CONFIG_H__
Wolfgang Betz 34:edda6a7238ec 34 #define __SPIRIT1_CONFIG_H__
Wolfgang Betz 34:edda6a7238ec 35 /*---------------------------------------------------------------------------*/
Wolfgang Betz 34:edda6a7238ec 36 #include "radio.h"
Wolfgang Betz 34:edda6a7238ec 37 #include "SPIRIT_Config.h"
Wolfgang Betz 34:edda6a7238ec 38 #include "spirit1-const.h"
Wolfgang Betz 34:edda6a7238ec 39 /*---------------------------------------------------------------------------*/
Wolfgang Betz 34:edda6a7238ec 40 #define CCA_THRESHOLD -98.0 /* dBm */
Wolfgang Betz 34:edda6a7238ec 41 #define XTAL_FREQUENCY 50000000 /* Hz */
Wolfgang Betz 34:edda6a7238ec 42 #define SPIRIT_MAX_FIFO_LEN (96) // betzw - WAS: 600
Wolfgang Betz 34:edda6a7238ec 43 /*---------------------------------------------------------------------------*/
Wolfgang Betz 34:edda6a7238ec 44
Wolfgang Betz 44:aedd63cb0ce3 45 /* Sometimes Spirit1 seems to NOT deliver (correctly) the 'IRQ_RX_DATA_READY'
Wolfgang Betz 44:aedd63cb0ce3 46 * event.
Wolfgang Betz 44:aedd63cb0ce3 47 * This can be avoided by reducing the maximum packet length to a value which
Wolfgang Betz 44:aedd63cb0ce3 48 * is lower than the RX FIFO size.
Wolfgang Betz 44:aedd63cb0ce3 49 * The mbed driver currently implements another workaround to this which allows
Wolfgang Betz 44:aedd63cb0ce3 50 * stable packet delivery of packets with maximum length up to 128 bytes
Wolfgang Betz 44:aedd63cb0ce3 51 * (which is the recommended 6LoWPAN payload length).
Wolfgang Betz 44:aedd63cb0ce3 52 * Enable beyond macro if you want to use the version of the driver which avoids
Wolfgang Betz 44:aedd63cb0ce3 53 * FIFO overflows by reducing packet length.
Wolfgang Betz 44:aedd63cb0ce3 54 *
Wolfgang Betz 44:aedd63cb0ce3 55 * NOTE: the non delivery of event 'IRQ_RX_DATA_READY' MUST still be
Wolfgang Betz 44:aedd63cb0ce3 56 * investigated further deeply (both on HW & SW level)!
Wolfgang Betz 44:aedd63cb0ce3 57 * Furthermore, the current limit of 128 bytes should also be overcome,
Wolfgang Betz 44:aedd63cb0ce3 58 * which again requires a further analysis of the RX process, which
Wolfgang Betz 44:aedd63cb0ce3 59 * currently seems to run into RX FIFO (most likely) overflow situations.
Wolfgang Betz 34:edda6a7238ec 60 */
Wolfgang Betz 44:aedd63cb0ce3 61 // #define RX_FIFO_THR_WA
Wolfgang Betz 34:edda6a7238ec 62
Wolfgang Betz 34:edda6a7238ec 63 /**
Wolfgang Betz 34:edda6a7238ec 64 * The MAX_PACKET_LEN is an arbitrary value used to define the two array
Wolfgang Betz 34:edda6a7238ec 65 * spirit_txbuf and spirit_rxbuf.
Wolfgang Betz 34:edda6a7238ec 66 * The SPIRIT1 supports with its packet handler a length of 65,535 bytes,
Wolfgang Betz 34:edda6a7238ec 67 * and in direct mode (without packet handler) there is no limit of data.
Wolfgang Betz 34:edda6a7238ec 68 */
Wolfgang Betz 44:aedd63cb0ce3 69 #ifdef RX_FIFO_THR_WA
Wolfgang Betz 34:edda6a7238ec 70 #define MAX_PACKET_LEN (SPIRIT_MAX_FIFO_LEN-1)
Wolfgang Betz 34:edda6a7238ec 71 #else
Wolfgang Betz 44:aedd63cb0ce3 72 #define MAX_PACKET_LEN (128) // betzw - WAS: SPIRIT_MAX_FIFO_LEN, but LEN_WIDTH is set to 7 so the variable payload length is theoretically from 0 to 255 bytes
Wolfgang Betz 34:edda6a7238ec 73 #endif
Wolfgang Betz 34:edda6a7238ec 74
Wolfgang Betz 34:edda6a7238ec 75 /*---------------------------------------------------------------------------*/
Wolfgang Betz 34:edda6a7238ec 76 /**
Wolfgang Betz 34:edda6a7238ec 77 * Spirit1 IC version
Wolfgang Betz 34:edda6a7238ec 78 */
Wolfgang Betz 34:edda6a7238ec 79 #define SPIRIT1_VERSION SPIRIT_VERSION_3_0
Wolfgang Betz 34:edda6a7238ec 80 /*---------------------------------------------------------------------------*/
Wolfgang Betz 34:edda6a7238ec 81 #endif /* __SPIRIT1_CONFIG_H__ */
Wolfgang Betz 34:edda6a7238ec 82 /*---------------------------------------------------------------------------*/