Align to current master

This commit is contained in:
Marco Grella 2015-09-04 17:01:04 +02:00
commit 17aafb9daa
217 changed files with 16131 additions and 8628 deletions

8
.gitmodules vendored
View file

@ -4,9 +4,13 @@
[submodule "tools/cc2538-bsl"]
path = tools/cc2538-bsl
url = https://github.com/JelmerT/cc2538-bsl.git
[submodule "cpu/cc26xx/lib/cc26xxware"]
path = cpu/cc26xx/lib/cc26xxware
[submodule "cpu/cc26xx-cc13xx/lib/cc26xxware"]
path = cpu/cc26xx-cc13xx/lib/cc26xxware
url = https://github.com/g-oikonomou/cc26xxware.git
[submodule "cpu/cc26xx-cc13xx/lib/cc13xxware"]
path = cpu/cc26xx-cc13xx/lib/cc13xxware
url = https://github.com/g-oikonomou/cc13xxware.git
[submodule "platform/stm32nucleo-spirit1/stm32cube-lib"]
path = platform/stm32nucleo-spirit1/stm32cube-lib
url = https://github.com/STclab/stm32nucleo-spirit1-lib

View file

@ -10,14 +10,14 @@ before_script:
## Install doxygen
- if [ ${BUILD_CATEGORY:-0} = doxygen ] ; then
sudo add-apt-repository ppa:libreoffice/libreoffice-4-3 -y && sudo apt-get -qq update &&
sudo add-apt-repository ppa:libreoffice/libreoffice-4-4 -y && sudo apt-get -qq update &&
sudo apt-get --no-install-suggests --no-install-recommends -qq install doxygen &&
doxygen --version ;
fi
## Install msp430 toolchain
- sudo apt-get -qq install lib32z1
- $WGET http://adamdunkels.github.io/contiki-fork/mspgcc-4.7.0-compiled.tar.bz2 &&
- $WGET http://simonduq.github.io/resources/mspgcc-4.7.2-compiled.tar.bz2 &&
tar xjf mspgcc*.tar.bz2 -C /tmp/ &&
sudo cp -f -r /tmp/msp430/* /usr/local/ &&
rm -rf /tmp/msp430 mspgcc*.tar.bz2 &&
@ -103,6 +103,7 @@ env:
- BUILD_TYPE='collect'
- BUILD_TYPE='collect-lossy'
- BUILD_TYPE='rpl'
- BUILD_TYPE='large-rpl'
- BUILD_TYPE='rime'
- BUILD_TYPE='ipv6'
- BUILD_TYPE='ip64' MAKE_TARGETS='cooja'

View file

@ -136,7 +136,7 @@ Contiki maintainers to look at!
All code contributions to Contiki are submitted as [Github pull
requests](https://help.github.com/articles/using-pull-requests). Pull
requests will be reviewed and accepted according to the guidelines
found in the [[Pull Request Policy]]
found in the next section.
The basic guidelines to to start a Pull-Request:
* Create a new branch for your modifications. This branch should be based on the latest contiki master branch.
@ -183,6 +183,21 @@ $ git push origin my_new_feature -f
```
* NOTE: To avoid all the pain of selectively picking commits, rebasing and force-pushing - begin your development with a branch OTHER THAN your master branch, and push changes to that branch after any local commits.
Pull Request Merging Policy
---------------------------
Pull requests (PRs) are reviewed by the [merge team](https://github.com/orgs/contiki-os/people).
Generally, PRs require two "+1" before they can be merged by someone on the merge team.
The since Contiki 3.0, the merging policy is the following:
* The PR receives **one "-1"** from a merge team member (along with specific feedback). The PR is closed. A "-1" must be accompanied with a clear explanation why the PR will not be considered for inclusion.
* The PR receives **two "+1"** from merge team members. The PR is merged.
* The PR was inactive for **two months**. A team member may either:
* Comment "Is there any interest for this PR? Is there any work pending on it? If not I will close it in **one month**." Back to initial state in case of activity, close otherwise.
* Comment "I approve this PR. If nobody disapproves within **one month**, I will merge it." Back to initial state in case of activity, merge otherwise.
There is an exception to the rule.
Code that requires esoteric expertise such as some applications, platforms or tools can be merged after a single "+1" from its domain expert.
Travis / Regression testing
---------------------------

View file

@ -1,7 +1,7 @@
The Contiki Operating System
============================
[![Build Status](https://secure.travis-ci.org/contiki-os/contiki.png)](http://travis-ci.org/contiki-os/contiki)
[![Build Status](https://travis-ci.org/contiki-os/contiki.svg?branch=master)](https://travis-ci.org/contiki-os/contiki/branches)
Contiki is an open source operating system that runs on tiny low-power
microcontrollers and makes it possible to develop applications that

View file

@ -0,0 +1,10 @@
codeprop-tmp_src = codeprop-tmp.c
# Enable LARGE MEMORY MODEL supports for WISMOTE and EXP5438 platform
ifeq ($(TARGET),wismote)
TARGET_MEMORY_MODEL = large
endif
ifeq ($(TARGET),exp5438)
TARGET_MEMORY_MODEL = large
endif

View file

@ -104,7 +104,7 @@ coap_receive(void)
coap_new_transaction(message->mid, &UIP_IP_BUF->srcipaddr,
UIP_UDP_BUF->srcport))) {
uint32_t block_num = 0;
uint16_t block_size = REST_MAX_CHUNK_SIZE;
uint16_t block_size = COAP_MAX_BLOCK_SIZE;
uint32_t block_offset = 0;
int32_t new_offset = 0;
@ -125,8 +125,8 @@ coap_receive(void)
if(coap_get_header_block2
(message, &block_num, NULL, &block_size, &block_offset)) {
PRINTF("Blockwise: block request %lu (%u/%u) @ %lu bytes\n",
block_num, block_size, REST_MAX_CHUNK_SIZE, block_offset);
block_size = MIN(block_size, REST_MAX_CHUNK_SIZE);
block_num, block_size, COAP_MAX_BLOCK_SIZE, block_offset);
block_size = MIN(block_size, COAP_MAX_BLOCK_SIZE);
new_offset = block_offset;
}

View file

@ -810,6 +810,7 @@ add_pagewidget(char *text, unsigned char size, char *attrib, unsigned char type,
textptr->name + attriblen + 1, WWW_CONF_MAX_INPUTVALUELEN);
add_forminput((struct inputattrib *)textptr);
textptr->formptr = formptr;
petsciiconv_topetscii(text, strlen(text));
strcpy(textptr->textentry.text, text);
strcpy(textptr->name, attrib);
if(size) {

View file

@ -293,7 +293,7 @@ PROCESS_THREAD(slip_process, ev, data)
tcpip_input();
#endif
} else {
uip_len = 0;
uip_clear_buf();
SLIP_STATISTICS(slip_ip_drop++);
}
#else /* NETSTACK_CONF_WITH_IPV6 */

View file

@ -71,12 +71,8 @@ static uint8_t round_keys[11][AES_128_KEY_LENGTH];
static uint8_t
galois_mul2(uint8_t value)
{
if(value >> 7) {
value = value << 1;
return value ^ 0x1b;
} else {
return value << 1;
}
uint8_t xor_val = (value >> 7) * 0x1b;
return ((value << 1) ^ xor_val);
}
/*---------------------------------------------------------------------------*/
static void

View file

@ -0,0 +1,810 @@
/*
* Copyright (c) 2015, Indian Institute of Science
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
*/
/**
* \file
* MSP430x elfloader.
* \author
* Sumankumar Panchal <suman@ece.iisc.ernet.in>
*
*/
#include "contiki.h"
#include "loader/elfloader.h"
#include "loader/elfloader-arch.h"
#include "cfs/cfs.h"
#include "loader/symtab.h"
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include "dev/flash.h"
#define DEBUG 0
#if DEBUG
#include <stdio.h>
#define PRINTF(...) printf(__VA_ARGS__)
#else
#define PRINTF(...) do {} while(0)
#endif
#define EI_NIDENT 16
struct elf32_ehdr {
unsigned char e_ident[EI_NIDENT]; /* ident bytes */
elf32_half e_type; /* file type */
elf32_half e_machine; /* target machine */
elf32_word e_version; /* file version */
elf32_addr e_entry; /* start address */
elf32_off e_phoff; /* phdr file offset */
elf32_off e_shoff; /* shdr file offset */
elf32_word e_flags; /* file flags */
elf32_half e_ehsize; /* sizeof ehdr */
elf32_half e_phentsize; /* sizeof phdr */
elf32_half e_phnum; /* number phdrs */
elf32_half e_shentsize; /* sizeof shdr */
elf32_half e_shnum; /* number shdrs */
elf32_half e_shstrndx; /* shdr string index */
};
/* Values for e_type. */
#define ET_NONE 0 /* Unknown type. */
#define ET_REL 1 /* Relocatable. */
#define ET_EXEC 2 /* Executable. */
#define ET_DYN 3 /* Shared object. */
#define ET_CORE 4 /* Core file. */
struct elf32_shdr {
elf32_word sh_name; /* section name */
elf32_word sh_type; /* SHT_... */
elf32_word sh_flags; /* SHF_... */
elf32_addr sh_addr; /* virtual address */
elf32_off sh_offset; /* file offset */
elf32_word sh_size; /* section size */
elf32_word sh_link; /* misc info */
elf32_word sh_info; /* misc info */
elf32_word sh_addralign; /* memory alignment */
elf32_word sh_entsize; /* entry size if table */
};
/* sh_type */
#define SHT_NULL 0 /* inactive */
#define SHT_PROGBITS 1 /* program defined information */
#define SHT_SYMTAB 2 /* symbol table section */
#define SHT_STRTAB 3 /* string table section */
#define SHT_RELA 4 /* relocation section with addends*/
#define SHT_HASH 5 /* symbol hash table section */
#define SHT_DYNAMIC 6 /* dynamic section */
#define SHT_NOTE 7 /* note section */
#define SHT_NOBITS 8 /* no space section */
#define SHT_REL 9 /* relation section without addends */
#define SHT_SHLIB 10 /* reserved - purpose unknown */
#define SHT_DYNSYM 11 /* dynamic symbol table section */
#define SHT_LOPROC 0x70000000 /* reserved range for processor */
#define SHT_HIPROC 0x7fffffff /* specific section header types */
#define SHT_LOUSER 0x80000000 /* reserved range for application */
#define SHT_HIUSER 0xffffffff /* specific indexes */
struct elf32_rel {
elf32_addr r_offset; /* Location to be relocated. */
elf32_word r_info; /* Relocation type and symbol index. */
};
struct elf32_sym {
elf32_word st_name; /* String table index of name. */
elf32_addr st_value; /* Symbol value. */
elf32_word st_size; /* Size of associated object. */
unsigned char st_info; /* Type and binding information. */
unsigned char st_other; /* Reserved (not used). */
elf32_half st_shndx; /* Section index of symbol. */
};
#define ELF32_R_SYM(info) ((info) >> 8)
struct relevant_section {
unsigned char number;
unsigned int offset;
char *address;
};
char elfloader_unknown[30]; /* Name that caused link error. */
struct process *const *elfloader_autostart_processes;
static struct relevant_section bss, data, rodata, rodatafar, text, textfar;
static const unsigned char elf_magic_header[] =
{ 0x7f, 0x45, 0x4c, 0x46, /* 0x7f, 'E', 'L', 'F' */
0x01, /* Only 32-bit objects. */
0x01, /* Only LSB data. */
0x01, /* Only ELF version 1. */
};
/* relocation type */
#define R_MSP430_NONE 0
#define R_MSP430_32 1
#define R_MSP430_10_PCREL 2
#define R_MSP430_16 3
#define R_MSP430_16_PCREL 4
#define R_MSP430_16_BYTE 5
#define R_MSP430_16_PCREL_BYTE 6
#define R_MSP430_2X_PCREL 7
#define R_MSP430_RL_PCREL 8
#define R_MSP430X_SRC_BYTE 9
#define R_MSP430X_SRC 10
#define R_MSP430X_DST_BYTE 11
#define R_MSP430X_DST 12
#define R_MSP430X_DST_2ND_BYTE 13
#define R_MSP430X_DST_2ND 14
#define R_MSP430X_PCREL_SRC_BYTE 15
#define R_MSP430X_PCREL_SRC 16
#define R_MSP430X_PCREL_DST_BYTE 17
#define R_MSP430X_PCREL_DST 18
#define R_MSP430X_PCREL_DST_2ND 19
#define R_MSP430X_PCREL_DST_2ND_BYTE 20
#define R_MSP430X_S_BYTE 21
#define R_MSP430X_S 22
#define R_MSP430X_D_BYTE 23
#define R_MSP430X_D 24
#define R_MSP430X_PCREL_D 25
#define R_MSP430X_INDXD 26
#define R_MSP430X_PCREL_INDXD 27
#define R_MSP430_10 28
#define ELF32_R_TYPE(info) ((unsigned char)(info))
static uint16_t datamemory_aligned[ELFLOADER_DATAMEMORY_SIZE / 2 + 1];
static uint8_t *datamemory = (uint8_t *)datamemory_aligned;
#if ELFLOADER_CONF_TEXT_IN_ROM
static const char textmemory[ELFLOADER_TEXTMEMORY_SIZE] = { 0 };
#else /* ELFLOADER_CONF_TEXT_IN_ROM */
static char textmemory[ELFLOADER_TEXTMEMORY_SIZE];
#endif /* ELFLOADER_CONF_TEXT_IN_ROM */
/*---------------------------------------------------------------------------*/
static void
seek_read(int fd, unsigned int offset, char *buf, int len)
{
cfs_seek(fd, offset, CFS_SEEK_SET);
cfs_read(fd, buf, len);
#if DEBUG
{
int i;
PRINTF("seek_read: Read len %d from offset %d\n",
len, offset);
for(i = 0; i < len; ++i) {
PRINTF("%02x ", buf[i]);
}
printf("\n");
}
#endif /* DEBUG */
}
/*---------------------------------------------------------------------------*/
static void *
find_local_symbol(int fd, const char *symbol,
unsigned int symtab, unsigned short symtabsize,
unsigned int strtab)
{
struct elf32_sym s;
unsigned int a;
char name[30];
struct relevant_section *sect;
for(a = symtab; a < symtab + symtabsize; a += sizeof(s)) {
seek_read(fd, a, (char *)&s, sizeof(s));
if(s.st_name != 0) {
seek_read(fd, strtab + s.st_name, name, sizeof(name));
if(strcmp(name, symbol) == 0) {
if(s.st_shndx == bss.number) {
sect = &bss;
} else if(s.st_shndx == data.number) {
sect = &data;
} else if(s.st_shndx == rodatafar.number) {
sect = &rodatafar;
} else if(s.st_shndx == textfar.number) {
sect = &textfar;
} else {
return NULL;
}
return &(sect->address[s.st_value]);
}
}
}
return NULL;
}
/*---------------------------------------------------------------------------*/
static int
relocate_section(int fd,
unsigned int section, unsigned short size,
unsigned int sectionaddr,
char *sectionbase,
unsigned int strs,
unsigned int strtab,
unsigned int symtab, unsigned short symtabsize,
unsigned char using_relas)
{
/*
* sectionbase added; runtime start address of current section
*/
struct elf32_rela rela; /* Now used both for rel and rela data! */
int rel_size = 0;
struct elf32_sym s;
unsigned int a;
char name[30];
char *addr;
struct relevant_section *sect;
/* determine correct relocation entry sizes */
if(using_relas) {
rel_size = sizeof(struct elf32_rela);
} else {
rel_size = sizeof(struct elf32_rel);
}
for(a = section; a < section + size; a += rel_size) {
seek_read(fd, a, (char *)&rela, rel_size);
seek_read(fd,
symtab + sizeof(struct elf32_sym) * ELF32_R_SYM(rela.r_info),
(char *)&s, sizeof(s));
if(s.st_name != 0) {
seek_read(fd, strtab + s.st_name, name, sizeof(name));
PRINTF("name: %s\n", name);
addr = (char *)symtab_lookup(name);
if(addr == NULL) {
PRINTF("name not found in global: %s\n", name);
addr = find_local_symbol(fd, name, symtab, symtabsize, strtab);
PRINTF("found address %p\n", addr);
}
if(addr == NULL) {
if(s.st_shndx == bss.number) {
sect = &bss;
} else if(s.st_shndx == data.number) {
sect = &data;
} else if(s.st_shndx == rodatafar.number) {
sect = &rodatafar;
} else if(s.st_shndx == textfar.number) {
sect = &textfar;
} else {
PRINTF("elfloader unknown name: '%30s'\n", name);
memcpy(elfloader_unknown, name, sizeof(elfloader_unknown));
elfloader_unknown[sizeof(elfloader_unknown) - 1] = 0;
return ELFLOADER_SYMBOL_NOT_FOUND;
}
addr = sect->address;
}
} else {
if(s.st_shndx == bss.number) {
sect = &bss;
} else if(s.st_shndx == data.number) {
sect = &data;
} else if(s.st_shndx == rodatafar.number) {
sect = &rodatafar;
} else if(s.st_shndx == textfar.number) {
sect = &textfar;
} else {
return ELFLOADER_SEGMENT_NOT_FOUND;
}
addr = sect->address;
}
if(!using_relas) {
/* copy addend to rela structure */
seek_read(fd, sectionaddr + rela.r_offset, (char *)&rela.r_addend, 4);
}
elfloader_arch_relocate(fd, sectionaddr, sectionbase, &rela, addr);
}
return ELFLOADER_OK;
}
/*---------------------------------------------------------------------------*/
static void *
find_program_processes(int fd,
unsigned int symtab, unsigned short size,
unsigned int strtab)
{
struct elf32_sym s;
unsigned int a;
char name[30];
for(a = symtab; a < symtab + size; a += sizeof(s)) {
seek_read(fd, a, (char *)&s, sizeof(s));
if(s.st_name != 0) {
seek_read(fd, strtab + s.st_name, name, sizeof(name));
if(strcmp(name, "autostart_processes") == 0) {
return &data.address[s.st_value];
}
}
}
return NULL;
}
/*---------------------------------------------------------------------------*/
void
elfloader_init(void)
{
elfloader_autostart_processes = NULL;
}
/*---------------------------------------------------------------------------*/
int
elfloader_load(int fd)
{
struct elf32_ehdr ehdr;
struct elf32_shdr shdr;
struct elf32_shdr strtable;
unsigned int strs;
unsigned int shdrptr;
unsigned int nameptr;
char name[17];
int i;
unsigned short shdrnum, shdrsize;
unsigned char using_relas = -1;
unsigned short textoff = 0, textfaroff = 0, textsize, textfarsize,
textrelaoff = 0, textrelasize, textfarrelaoff = 0, textfarrelasize;
unsigned short dataoff = 0, datasize, datarelaoff = 0, datarelasize;
unsigned short rodataoff = 0, rodatafaroff = 0, rodatasize, rodatafarsize,
rodatarelaoff = 0, rodatarelasize, rodatafarrelaoff = 0,
rodatafarrelasize;
unsigned short symtaboff = 0, symtabsize;
unsigned short strtaboff = 0, strtabsize;
unsigned short bsssize = 0;
struct process **process;
int ret;
elfloader_unknown[0] = 0;
/* The ELF header is located at the start of the buffer. */
seek_read(fd, 0, (char *)&ehdr, sizeof(ehdr));
/* Make sure that we have a correct and compatible ELF header. */
if(memcmp(ehdr.e_ident, elf_magic_header, sizeof(elf_magic_header)) != 0) {
PRINTF("ELF header problems\n");
return ELFLOADER_BAD_ELF_HEADER;
}
/* Grab the section header. */
shdrptr = ehdr.e_shoff;
seek_read(fd, shdrptr, (char *)&shdr, sizeof(shdr));
/* Get the size and number of entries of the section header. */
shdrsize = ehdr.e_shentsize;
shdrnum = ehdr.e_shnum;
PRINTF("Section header: size %d num %d\n", shdrsize, shdrnum);
/* The string table section: holds the names of the sections. */
seek_read(fd, ehdr.e_shoff + shdrsize * ehdr.e_shstrndx,
(char *)&strtable, sizeof(strtable));
/*
* Get a pointer to the actual table of strings. This table holds
* the names of the sections, not the names of other symbols in the
* file (these are in the sybtam section).
*/
strs = strtable.sh_offset;
PRINTF("Strtable offset %d\n", strs);
/*
* Go through all sections and pick out the relevant ones. The
* ".text" and ".far.text" segments holds the actual code from
* the ELF file. The ".data" segment contains initialized data.
* The ".bss" segment holds the size of the unitialized data segment.
* The ".rodata" and ".far.rodata" segments contains constant data.
* The ".rela[a].text" and ".rela[a].far.text" segments contains
* relocation information for the contents of the ".text" and
* ".far.text" segments, respectively. The ".rela[a].rodata" and
* ".rela[a].far.rodata" segments contains relocation information
* for the contents of the ".rodata" and ".far.rodata" segments,
* respectively. The ".rela[a].data" segment contains relocation
* information for the contents of the ".data" segment. The ".symtab"
* segment contains the symbol table for this file. The ".strtab"
* segment points to the actual string names used by the symbol table.
*
* In addition to grabbing pointers to the relevant sections, we
* also save the section number for resolving addresses in the
* relocator code.
*/
/*
* Initialize the segment sizes to zero so that we can check if
* their sections was found in the file or not.
*/
textsize = textfarsize = textrelasize = textfarrelasize =
datasize = datarelasize = rodatasize = rodatafarsize =
rodatarelasize = rodatafarrelasize = symtabsize = strtabsize = 0;
bss.number = data.number = rodata.number = rodatafar.number =
text.number = textfar.number = -1;
shdrptr = ehdr.e_shoff;
for(i = 0; i < shdrnum; ++i) {
seek_read(fd, shdrptr, (char *)&shdr, sizeof(shdr));
/* The name of the section is contained in the strings table. */
nameptr = strs + shdr.sh_name;
seek_read(fd, nameptr, name, sizeof(name));
PRINTF("Section shdrptr 0x%x, %d + %d type %d\n",
shdrptr,
strs, shdr.sh_name,
(int)shdr.sh_type);
/*
* Match the name of the section with a predefined set of names
* (.text, .far.text, .data, .bss, .rodata, .far.rodata, .rela.text, .rela.far.text,
* .rela.data, .rela.rodata, .rela.far.rodata, .symtab, and .strtab).
*/
if(shdr.sh_type == SHT_SYMTAB) {
PRINTF("symtab\n");
symtaboff = shdr.sh_offset;
symtabsize = shdr.sh_size;
} else if(shdr.sh_type == SHT_STRTAB) {
PRINTF("strtab\n");
strtaboff = shdr.sh_offset;
strtabsize = shdr.sh_size;
} else if(strncmp(name, ".text", 5) == 0) {
textoff = shdr.sh_offset;
textsize = shdr.sh_size;
text.number = i;
text.offset = textoff;
} else if(strncmp(name, ".far.text", 9) == 0) {
textfaroff = shdr.sh_offset;
textfarsize = shdr.sh_size;
textfar.number = i;
textfar.offset = textfaroff;
} else if(strncmp(name, ".rel.text", 9) == 0) {
using_relas = 0;
textrelaoff = shdr.sh_offset;
textrelasize = shdr.sh_size;
} else if(strncmp(name, ".rela.text", 10) == 0) {
using_relas = 1;
textrelaoff = shdr.sh_offset;
textrelasize = shdr.sh_size;
} else if(strncmp(name, ".rela.far.text", 14) == 0) {
using_relas = 1;
textfarrelaoff = shdr.sh_offset;
textfarrelasize = shdr.sh_size;
} else if(strncmp(name, ".data", 5) == 0) {
dataoff = shdr.sh_offset;
datasize = shdr.sh_size;
data.number = i;
data.offset = dataoff;
} else if(strncmp(name, ".rodata", 7) == 0) {
/* read-only data handled the same way as regular text section */
rodataoff = shdr.sh_offset;
rodatasize = shdr.sh_size;
rodata.number = i;
rodata.offset = rodataoff;
} else if(strncmp(name, ".far.rodata", 11) == 0) {
rodatafaroff = shdr.sh_offset;
rodatafarsize = shdr.sh_size;
rodatafar.number = i;
rodatafar.offset = rodataoff;
} else if(strncmp(name, ".rel.rodata", 11) == 0) {
/* using elf32_rel instead of rela */
using_relas = 0;
rodatarelaoff = shdr.sh_offset;
rodatarelasize = shdr.sh_size;
} else if(strncmp(name, ".rela.rodata", 12) == 0) {
using_relas = 1;
rodatarelaoff = shdr.sh_offset;
rodatarelasize = shdr.sh_size;
} else if(strncmp(name, ".rela.far.rodata", 16) == 0) {
using_relas = 1;
rodatafarrelaoff = shdr.sh_offset;
rodatafarrelasize = shdr.sh_size;
} else if(strncmp(name, ".rel.data", 9) == 0) {
/* using elf32_rel instead of rela */
using_relas = 0;
datarelaoff = shdr.sh_offset;
datarelasize = shdr.sh_size;
} else if(strncmp(name, ".rela.data", 10) == 0) {
using_relas = 1;
datarelaoff = shdr.sh_offset;
datarelasize = shdr.sh_size;
} else if(strncmp(name, ".bss", 4) == 0) {
bsssize = shdr.sh_size;
bss.number = i;
bss.offset = 0;
}
/* Move on to the next section header. */
shdrptr += shdrsize;
}
if(symtabsize == 0) {
return ELFLOADER_NO_SYMTAB;
}
if(strtabsize == 0) {
return ELFLOADER_NO_STRTAB;
}
if(textfarsize == 0) {
return ELFLOADER_NO_TEXT;
}
PRINTF("before allocate ram\n");
bss.address = (char *)elfloader_arch_allocate_ram(bsssize + datasize);
data.address = (char *)bss.address + bsssize;
PRINTF("before allocate rom\n");
textfar.address = (char *)elfloader_arch_allocate_rom(textfarsize + rodatafarsize);
rodatafar.address = (char *)textfar.address + textfarsize;
PRINTF("bss base address: bss.address = 0x%08x\n", bss.address);
PRINTF("data base address: data.address = 0x%08x\n", data.address);
PRINTF("textfar base address: textfar.address = 0x%08x\n", textfar.address);
PRINTF("rodatafar base address: rodatafar.address = 0x%08x\n", rodatafar.address);
/* If we have text segment relocations, we process them. */
PRINTF("elfloader: relocate textfar\n");
if(textfarrelasize > 0) {
ret = relocate_section(fd,
textfarrelaoff, textfarrelasize,
textfaroff,
textfar.address,
strs,
strtaboff,
symtaboff, symtabsize, using_relas);
if(ret != ELFLOADER_OK) {
return ret;
}
}
/* If we have any rodata segment relocations, we process them too. */
PRINTF("elfloader: relocate rodata\n");
if(rodatafarrelasize > 0) {
ret = relocate_section(fd,
rodatafarrelaoff, rodatafarrelasize,
rodatafaroff,
rodatafar.address,
strs,
strtaboff,
symtaboff, symtabsize, using_relas);
if(ret != ELFLOADER_OK) {
PRINTF("elfloader: data failed\n");
return ret;
}
}
/* If we have any data segment relocations, we process them too. */
PRINTF("elfloader: relocate data\n");
if(datarelasize > 0) {
ret = relocate_section(fd,
datarelaoff, datarelasize,
dataoff,
data.address,
strs,
strtaboff,
symtaboff, symtabsize, using_relas);
if(ret != ELFLOADER_OK) {
PRINTF("elfloader: data failed\n");
return ret;
}
}
/* Write text and rodata segment into flash and data segment into RAM. */
elfloader_arch_write_rom(fd, textfaroff, textfarsize, textfar.address);
elfloader_arch_write_rom(fd, rodatafaroff, rodatafarsize, rodatafar.address);
memset(bss.address, 0, bsssize);
seek_read(fd, dataoff, data.address, datasize);
PRINTF("elfloader: autostart search\n");
process = (struct process **)find_local_symbol(fd, "autostart_processes",
symtaboff, symtabsize, strtaboff);
if(process != NULL) {
PRINTF("elfloader: autostart found\n");
elfloader_autostart_processes = process;
return ELFLOADER_OK;
} else {
PRINTF("elfloader: no autostart\n");
process = (struct process **)find_program_processes(fd, symtaboff,
symtabsize, strtaboff);
if(process != NULL) {
PRINTF("elfloader: FOUND PRG\n");
}
return ELFLOADER_NO_STARTPOINT;
}
}
/*---------------------------------------------------------------------------*/
void *
elfloader_arch_allocate_ram(int size)
{
return datamemory;
}
/*---------------------------------------------------------------------------*/
void *
elfloader_arch_allocate_rom(int size)
{
#if ELFLOADER_CONF_TEXT_IN_ROM
/* Return an 512-byte aligned pointer. */
return (char *)
((unsigned long)&textmemory[0] & 0xfffffe00) +
(((unsigned long)&textmemory[0] & 0x1ff) == 0 ? 0 : 0x200);
#else /* ELFLOADER_CONF_TEXT_IN_ROM */
return textmemory;
#endif /* ELFLOADER_CONF_TEXT_IN_ROM */
}
/*---------------------------------------------------------------------------*/
#define READSIZE 32
void
elfloader_arch_write_rom(int fd, unsigned short textoff, unsigned int size, char *mem)
{
#if ELFLOADER_CONF_TEXT_IN_ROM
int i;
unsigned int ptr;
unsigned short *flashptr;
flash_setup();
flashptr = (unsigned short *)mem;
cfs_seek(fd, textoff, CFS_SEEK_SET);
for(ptr = 0; ptr < size; ptr += READSIZE) {
/* Read data from file into RAM. */
cfs_read(fd, (unsigned char *)datamemory, READSIZE);
/* Clear flash page on 512 byte boundary. */
if((((unsigned short)flashptr) & 0x01ff) == 0) {
flash_clear(flashptr);
}
/*
* Burn data from RAM into flash ROM. Flash is burned one 16-bit
* word at a time, so we need to be careful when incrementing
* pointers. The flashptr is already a short pointer, so
* incrementing it by one will actually increment the address by
* two.
*/
for(i = 0; i < READSIZE / 2; ++i) {
flash_write(flashptr, ((unsigned short *)datamemory)[i]);
++flashptr;
}
}
flash_done();
#else /* ELFLOADER_CONF_TEXT_IN_ROM */
cfs_seek(fd, textoff, CFS_SEEK_SET);
cfs_read(fd, (unsigned char *)mem, size);
#endif /* ELFLOADER_CONF_TEXT_IN_ROM */
}
/*---------------------------------------------------------------------------*/
/* Relocate an MSP430X ELF section. */
void
elfloader_arch_relocate(int fd, unsigned int sectionoffset,
char *sectionaddr,
struct elf32_rela *rela, char *addr)
{
unsigned int type;
unsigned char instr[2];
type = ELF32_R_TYPE(rela->r_info);
addr += rela->r_addend;
switch(type) {
case R_MSP430_16:
case R_MSP430_16_PCREL:
case R_MSP430_16_BYTE:
case R_MSP430_16_PCREL_BYTE:
cfs_seek(fd, sectionoffset + rela->r_offset, CFS_SEEK_SET);
cfs_write(fd, (char *)&addr, 2);
break;
case R_MSP430_32:
cfs_seek(fd, sectionoffset + rela->r_offset, CFS_SEEK_SET);
cfs_write(fd, (char *)&addr, 2);
break;
case R_MSP430X_S:
case R_MSP430X_S_BYTE:
/* src(19:16) located at positions 11:8 of opcode */
/* src(15:0) located just after opcode */
cfs_seek(fd, sectionoffset + rela->r_offset, CFS_SEEK_SET);
cfs_read(fd, instr, 2);
instr[1] = (int)(instr[1]) & 0xf0 | (((long int)addr >> 8) & 0x0f00);
instr[0] = (int)(instr[0]) & 0xff;
cfs_seek(fd, sectionoffset + rela->r_offset, CFS_SEEK_SET);
cfs_write(fd, instr, 2);
cfs_write(fd, (char *)&addr, 2);
break;
case R_MSP430X_D:
case R_MSP430X_PCREL_D:
case R_MSP430X_D_BYTE:
/* dst(19:16) located at positions 3:0 of opcode */
/* dst(15:0) located just after opcode */
cfs_seek(fd, sectionoffset + rela->r_offset, CFS_SEEK_SET);
cfs_read(fd, instr, 2);
instr[1] = (int)(instr[1]) & 0xff;
instr[0] = (int)(instr[0]) & 0xf0 | (((long int)addr >> 16) & 0x000f);
cfs_seek(fd, sectionoffset + rela->r_offset, CFS_SEEK_SET);
cfs_write(fd, instr, 2);
cfs_write(fd, (char *)&addr, 2);
break;
case R_MSP430X_PCREL_SRC_BYTE:
case R_MSP430X_SRC_BYTE:
case R_MSP430X_PCREL_SRC:
case R_MSP430X_SRC:
/* src(19:16) located at positions 10:7 of extension word */
/* src(15:0) located just after opcode */
cfs_seek(fd, sectionoffset + rela->r_offset, CFS_SEEK_SET);
cfs_read(fd, instr, 2);
/* 4 most-significant bits */
instr[1] = (int)(instr[1]) & 0xf8 | (((long int)addr >> 9) & 0x0780);
instr[0] = (int)(instr[0]) & 0x7f | (((long int)addr >> 9) & 0x0780);
cfs_seek(fd, sectionoffset + rela->r_offset, CFS_SEEK_SET);
cfs_write(fd, instr, 2);
/* 16 least-significant bits */
cfs_seek(fd, sectionoffset + rela->r_offset + 0x04, CFS_SEEK_SET);
cfs_write(fd, (char *)&addr, 2);
break;
case R_MSP430X_DST_BYTE:
case R_MSP430X_PCREL_DST_BYTE:
case R_MSP430X_DST:
case R_MSP430X_PCREL_DST:
/* dst(19:16) located at positions 3:0 of extension word */
/* dst(15:0) located just after opcode */
cfs_seek(fd, sectionoffset + rela->r_offset, CFS_SEEK_SET);
cfs_read(fd, instr, 2);
instr[1] = (int)(instr[1]) & 0xff;
instr[0] = (int)(instr[0]) & 0xf0 | (((long int)addr >> 16) & 0x000f);
cfs_seek(fd, sectionoffset + rela->r_offset, CFS_SEEK_SET);
cfs_write(fd, instr, 2);
cfs_seek(fd, sectionoffset + rela->r_offset + 0x04, CFS_SEEK_SET);
cfs_write(fd, (char *)&addr, 2);
break;
case R_MSP430X_DST_2ND:
case R_MSP430X_PCREL_DST_2ND:
case R_MSP430X_DST_2ND_BYTE:
case R_MSP430X_PCREL_DST_2ND_BYTE:
/* dst(19:16) located at positions 3:0 of extension word */
/* dst(15:0) located after src(15:0) */
cfs_seek(fd, sectionoffset + rela->r_offset, CFS_SEEK_SET);
cfs_read(fd, instr, 2);
instr[1] = (int)(instr[1]) & 0xff;
instr[0] = (int)(instr[0]) & 0xf0 | (((long int)addr >> 16) & 0x000f);
cfs_seek(fd, sectionoffset + rela->r_offset, CFS_SEEK_SET);
cfs_write(fd, instr, 2);
cfs_seek(fd, sectionoffset + rela->r_offset + 0x06, CFS_SEEK_SET);
cfs_write(fd, (char *)&addr, 2);
break;
case R_MSP430X_INDXD:
case R_MSP430X_PCREL_INDXD:
cfs_seek(fd, sectionoffset + rela->r_offset + 0x02, CFS_SEEK_SET);
cfs_write(fd, (char *)&addr, 2);
break;
default:
PRINTF("Unknown relocation type!\n");
break;
}
}
/*---------------------------------------------------------------------------*/

View file

@ -300,7 +300,6 @@ PT_THREAD(handle_dhcp(process_event_t ev, void *data))
}
selecting:
xid++;
s.ticks = CLOCK_SECOND;
do {
while(ev != tcpip_event) {
@ -366,7 +365,6 @@ PT_THREAD(handle_dhcp(process_event_t ev, void *data))
}
/* renewing: */
xid++;
do {
while(ev != tcpip_event) {
tcpip_poll_udp(s.conn);

View file

@ -529,10 +529,7 @@ void
tcpip_input(void)
{
process_post_synch(&tcpip_process, PACKET_INPUT, NULL);
uip_len = 0;
#if NETSTACK_CONF_WITH_IPV6
uip_ext_len = 0;
#endif /*NETSTACK_CONF_WITH_IPV6*/
uip_clear_buf();
}
/*---------------------------------------------------------------------------*/
#if NETSTACK_CONF_WITH_IPV6
@ -548,13 +545,13 @@ tcpip_ipv6_output(void)
if(uip_len > UIP_LINK_MTU) {
UIP_LOG("tcpip_ipv6_output: Packet to big");
uip_len = 0;
uip_clear_buf();
return;
}
if(uip_is_addr_unspecified(&UIP_IP_BUF->destipaddr)){
UIP_LOG("tcpip_ipv6_output: Destination address unspecified");
uip_len = 0;
uip_clear_buf();
return;
}
@ -591,7 +588,7 @@ tcpip_ipv6_output(void)
#else
PRINTF("tcpip_ipv6_output: Destination off-link but no route\n");
#endif /* !UIP_FALLBACK_INTERFACE */
uip_len = 0;
uip_clear_buf();
return;
}
@ -643,7 +640,7 @@ tcpip_ipv6_output(void)
#if UIP_CONF_IPV6_RPL
if(rpl_update_header_final(nexthop)) {
uip_len = 0;
uip_clear_buf();
return;
}
#endif /* UIP_CONF_IPV6_RPL */
@ -651,7 +648,7 @@ tcpip_ipv6_output(void)
if(nbr == NULL) {
#if UIP_ND6_SEND_NA
if((nbr = uip_ds6_nbr_add(nexthop, NULL, 0, NBR_INCOMPLETE)) == NULL) {
uip_len = 0;
uip_clear_buf();
return;
} else {
#if UIP_CONF_IPV6_QUEUE_PKT
@ -689,7 +686,7 @@ tcpip_ipv6_output(void)
uip_packetqueue_set_buflen(&nbr->packethandle, uip_len);
}
#endif /*UIP_CONF_IPV6_QUEUE_PKT*/
uip_len = 0;
uip_clear_buf();
return;
}
/* Send in parallel if we are running NUD (nbc state is either STALE,
@ -719,15 +716,14 @@ tcpip_ipv6_output(void)
}
#endif /*UIP_CONF_IPV6_QUEUE_PKT*/
uip_len = 0;
uip_clear_buf();
return;
}
return;
}
/* Multicast IP destination address. */
tcpip_output(NULL);
uip_len = 0;
uip_ext_len = 0;
uip_clear_buf();
}
#endif /* NETSTACK_CONF_WITH_IPV6 */
/*---------------------------------------------------------------------------*/

View file

@ -1326,6 +1326,22 @@ extern uint8_t uip_ext_len;
extern uint16_t uip_urglen, uip_surglen;
#endif /* UIP_URGDATA > 0 */
/*
* Clear uIP buffer
*
* This function clears the uIP buffer by reseting the uip_len and
* uip_ext_len pointers.
*/
#if NETSTACK_CONF_WITH_IPV6
#define uip_clear_buf() { \
uip_len = 0; \
uip_ext_len = 0; \
}
#else /*NETSTACK_CONF_WITH_IPV6*/
#define uip_clear_buf() { \
uip_len = 0; \
}
#endif /*NETSTACK_CONF_WITH_IPV6*/
/**
* Representation of a uIP TCP connection.

View file

@ -308,7 +308,6 @@ PT_THREAD(handle_dhcp(process_event_t ev, void *data))
}
selecting:
xid++;
s.ticks = CLOCK_SECOND;
do {
while(ev != tcpip_event) {
@ -374,7 +373,6 @@ PT_THREAD(handle_dhcp(process_event_t ev, void *data))
}
/* renewing: */
xid++;
do {
while(ev != tcpip_event) {
tcpip_poll_udp(s.conn);

View file

@ -59,7 +59,7 @@ input_callback(void)
/*PRINTF("SIN: %u\n", uip_len);*/
if(uip_buf[0] == '!') {
PRINTF("Got configuration message of type %c\n", uip_buf[1]);
uip_len = 0;
uip_clear_buf();
#if 0
if(uip_buf[1] == 'P') {
uip_ipaddr_t prefix;
@ -87,7 +87,7 @@ input_callback(void)
slip_send();
}
uip_len = 0;
uip_clear_buf();
} else {
/* Save the last sender received over SLIP to avoid bouncing the
@ -101,7 +101,7 @@ input_callback(void)
uip_len = len;
/* PRINTF("send len %d\n", len); */
} else {
uip_len = 0;
uip_clear_buf();
}
}
}

View file

@ -229,7 +229,7 @@ time_exceeded(void)
/* We don't send out ICMP errors for ICMP messages (unless they are pings). */
if(ICMPBUF->proto == UIP_PROTO_ICMP &&
ICMPBUF->type != ICMP_ECHO) {
uip_len = 0;
uip_clear_buf();
return;
}
/* Copy fields from packet header into payload of this ICMP packet. */

View file

@ -709,7 +709,7 @@ uip_process(uint8_t flag)
}
/* Reset the length variables. */
uip_len = 0;
uip_clear_buf();
uip_slen = 0;
#if UIP_TCP
@ -1589,7 +1589,7 @@ uip_process(uint8_t flag)
uip_add_rcv_nxt(1);
uip_flags = UIP_CONNECTED | UIP_NEWDATA;
uip_connr->len = 0;
uip_len = 0;
uip_clear_buf();
uip_slen = 0;
UIP_APPCALL();
goto appsend;
@ -1934,7 +1934,7 @@ uip_process(uint8_t flag)
return;
drop:
uip_len = 0;
uip_clear_buf();
uip_flags = 0;
return;
}

View file

@ -284,10 +284,10 @@ uip_arp_arpin(void)
{
if(uip_len < sizeof(struct arp_hdr)) {
uip_len = 0;
uip_clear_buf();
return;
}
uip_len = 0;
uip_clear_buf();
switch(BUF->opcode) {
case UIP_HTONS(ARP_REQUEST):

View file

@ -1107,26 +1107,26 @@ icmp_input()
PRINT6ADDR(&UIP_IP_BUF->destipaddr);
PRINTF("\n");
ROLL_TM_STATS_ADD(icmp_bad);
return;
goto discard;
}
if(!uip_is_addr_linklocal_allnodes_mcast(&UIP_IP_BUF->destipaddr)
&& !uip_is_addr_linklocal_allrouters_mcast(&UIP_IP_BUF->destipaddr)) {
PRINTF("ROLL TM: ICMPv6 In, bad destination\n");
ROLL_TM_STATS_ADD(icmp_bad);
return;
goto discard;
}
if(UIP_ICMP_BUF->icode != ROLL_TM_ICMP_CODE) {
PRINTF("ROLL TM: ICMPv6 In, bad ICMP code\n");
ROLL_TM_STATS_ADD(icmp_bad);
return;
goto discard;
}
if(UIP_IP_BUF->ttl != ROLL_TM_IP_HOP_LIMIT) {
PRINTF("ROLL TM: ICMPv6 In, bad TTL\n");
ROLL_TM_STATS_ADD(icmp_bad);
return;
goto discard;
}
#endif
@ -1311,6 +1311,9 @@ drop:
t[1].c++;
}
discard:
uip_len = 0;
return;
}
/*---------------------------------------------------------------------------*/
@ -1380,8 +1383,7 @@ out()
drop:
uip_slen = 0;
uip_len = 0;
uip_ext_len = 0;
uip_clear_buf();
}
/*---------------------------------------------------------------------------*/
static uint8_t

View file

@ -81,7 +81,7 @@ mcast_fwd(void *p)
uip_len = mcast_len;
UIP_IP_BUF->ttl--;
tcpip_output(NULL);
uip_len = 0;
uip_clear_buf();
}
/*---------------------------------------------------------------------------*/
static uint8_t

View file

@ -367,6 +367,9 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length,
num_routes++;
PRINTF("uip_ds6_route_add num %d\n", num_routes);
/* lock this entry so that nexthop is not removed */
nbr_table_lock(nbr_routes, routes);
}
uip_ipaddr_copy(&(r->ipaddr), ipaddr);
@ -423,7 +426,7 @@ uip_ds6_route_rm(uip_ds6_route_t *route)
list_remove(route->neighbor_routes->route_list, neighbor_route);
if(list_head(route->neighbor_routes->route_list) == NULL) {
/* If this was the only route using this neighbor, remove the
neibhor from the table */
neighbor from the table - this implicitly unlocks nexthop */
PRINTF("uip_ds6_route_rm: removing neighbor too\n");
nbr_table_remove(nbr_routes, route->neighbor_routes->route_list);
}

View file

@ -275,6 +275,7 @@ uip_ds6_prefix_add(uip_ipaddr_t *ipaddr, uint8_t ipaddrlen,
PRINTF("Adding prefix ");
PRINT6ADDR(&locprefix->ipaddr);
PRINTF("length %u, vlifetime%lu\n", ipaddrlen, interval);
return locprefix;
}
return NULL;
}

View file

@ -210,12 +210,12 @@ uip_icmp6_error_output(uint8_t type, uint8_t code, uint32_t param) {
/* check if originating packet is not an ICMP error*/
if (uip_ext_len) {
if(UIP_EXT_BUF->next == UIP_PROTO_ICMP6 && UIP_ICMP_BUF->type < 128){
uip_len = 0;
uip_clear_buf();
return;
}
} else {
if(UIP_IP_BUF->proto == UIP_PROTO_ICMP6 && UIP_ICMP_BUF->type < 128){
uip_len = 0;
uip_clear_buf();
return;
}
}
@ -250,7 +250,7 @@ uip_icmp6_error_output(uint8_t type, uint8_t code, uint32_t param) {
/* the source should not be unspecified nor multicast, the check for
multicast is done in uip_process */
if(uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)){
uip_len = 0;
uip_clear_buf();
return;
}
@ -260,7 +260,7 @@ uip_icmp6_error_output(uint8_t type, uint8_t code, uint32_t param) {
if(type == ICMP6_PARAM_PROB && code == ICMP6_PARAMPROB_OPTION){
uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &tmp_ipaddr);
} else {
uip_len = 0;
uip_clear_buf();
return;
}
} else {
@ -385,7 +385,7 @@ echo_reply_input(void)
}
}
uip_len = 0;
uip_clear_buf();
return;
}
/*---------------------------------------------------------------------------*/

View file

@ -127,6 +127,8 @@ static uip_ds6_addr_t *addr; /** Pointer to an interface address */
#if !UIP_CONF_ROUTER // TBD see if we move it to ra_input
static uip_nd6_opt_prefix_info *nd6_opt_prefix_info; /** Pointer to prefix information option in uip_buf */
static uip_ipaddr_t ipaddr;
#endif
#if (!UIP_CONF_ROUTER || UIP_ND6_SEND_RA)
static uip_ds6_prefix_t *prefix; /** Pointer to a prefix list entry */
#endif
@ -321,7 +323,7 @@ create_na:
return;
discard:
uip_len = 0;
uip_clear_buf();
return;
}
#endif /* UIP_ND6_SEND_NA */
@ -360,7 +362,7 @@ uip_nd6_ns_output(uip_ipaddr_t * src, uip_ipaddr_t * dest, uip_ipaddr_t * tgt)
}
if (uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)) {
PRINTF("Dropping NS due to no suitable source address\n");
uip_len = 0;
uip_clear_buf();
return;
}
UIP_IP_BUF->len[1] =
@ -557,7 +559,7 @@ na_input(void)
#endif /*UIP_CONF_IPV6_QUEUE_PKT */
discard:
uip_len = 0;
uip_clear_buf();
return;
}
#endif /* UIP_ND6_SEND_NA */
@ -646,7 +648,7 @@ rs_input(void)
uip_ds6_send_ra_sollicited();
discard:
uip_len = 0;
uip_clear_buf();
return;
}
@ -687,7 +689,6 @@ uip_nd6_ra_output(uip_ipaddr_t * dest)
nd6_opt_offset = UIP_ND6_RA_LEN;
#if !UIP_CONF_ROUTER
/* Prefix list */
for(prefix = uip_ds6_prefix_list;
prefix < uip_ds6_prefix_list + UIP_DS6_PREFIX_NB; prefix++) {
@ -704,7 +705,6 @@ uip_nd6_ra_output(uip_ipaddr_t * dest)
uip_len += UIP_ND6_OPT_PREFIX_INFO_LEN;
}
}
#endif /* !UIP_CONF_ROUTER */
/* Source link-layer option */
create_llao((uint8_t *)UIP_ND6_OPT_HDR_BUF, UIP_ND6_OPT_SLLAO);
@ -1029,7 +1029,7 @@ ra_input(void)
#endif /*UIP_CONF_IPV6_QUEUE_PKT */
discard:
uip_len = 0;
uip_clear_buf();
return;
}
#endif /* !UIP_CONF_ROUTER */

View file

@ -538,8 +538,7 @@ remove_ext_hdr(void)
uip_ext_len, uip_len);
if(uip_len < UIP_IPH_LEN + uip_ext_len) {
PRINTF("ERROR: uip_len too short compared to ext len\n");
uip_ext_len = 0;
uip_len = 0;
uip_clear_buf();
return;
}
memmove(((uint8_t *)UIP_TCP_BUF), (uint8_t *)UIP_TCP_BUF + uip_ext_len,
@ -825,8 +824,7 @@ uip_reass_over(void)
* any RFC, we decided not to include it as it reduces the size of
* the packet.
*/
uip_len = 0;
uip_ext_len = 0;
uip_clear_buf();
memcpy(UIP_IP_BUF, FBUF, UIP_IPH_LEN); /* copy the header for src
and dest address*/
uip_icmp6_error_output(ICMP6_TIME_EXCEEDED, ICMP6_TIME_EXCEED_REASSEMBLY, 0);
@ -971,7 +969,7 @@ uip_process(uint8_t flag)
} else if(flag == UIP_TIMER) {
/* Reset the length variables. */
#if UIP_TCP
uip_len = 0;
uip_clear_buf();
uip_slen = 0;
/* Increase the initial sequence number. */
@ -1456,7 +1454,7 @@ uip_process(uint8_t flag)
UIP_STAT(++uip_stat.icmp.drop);
UIP_STAT(++uip_stat.icmp.typeerr);
UIP_LOG("icmp6: unknown ICMPv6 message.");
uip_len = 0;
uip_clear_buf();
}
if(uip_len > 0) {
@ -1978,7 +1976,7 @@ uip_process(uint8_t flag)
uip_add_rcv_nxt(1);
uip_flags = UIP_CONNECTED | UIP_NEWDATA;
uip_connr->len = 0;
uip_len = 0;
uip_clear_buf();
uip_slen = 0;
UIP_APPCALL();
goto appsend;
@ -2310,8 +2308,7 @@ uip_process(uint8_t flag)
return;
drop:
uip_len = 0;
uip_ext_len = 0;
uip_clear_buf();
uip_ext_bitmap = 0;
uip_flags = 0;
return;

View file

@ -136,11 +136,15 @@ static int we_are_receiving_burst = 0;
/* CCA_SLEEP_TIME is the time between two successive CCA checks. */
/* Add 1 when rtimer ticks are coarse */
#ifdef CONTIKIMAC_CONF_CCA_SLEEP_TIME
#define CCA_SLEEP_TIME CONTIKIMAC_CONF_CCA_SLEEP_TIME
#else
#if RTIMER_ARCH_SECOND > 8000
#define CCA_SLEEP_TIME RTIMER_ARCH_SECOND / 2000
#else
#define CCA_SLEEP_TIME (RTIMER_ARCH_SECOND / 2000) + 1
#endif
#endif /* RTIMER_ARCH_SECOND > 8000 */
#endif /* CONTIKIMAC_CONF_CCA_SLEEP_TIME */
/* CHECK_TIME is the total time it takes to perform CCA_COUNT_MAX
CCAs. */
@ -153,7 +157,11 @@ static int we_are_receiving_burst = 0;
/* LISTEN_TIME_AFTER_PACKET_DETECTED is the time that we keep checking
for activity after a potential packet has been detected by a CCA
check. */
#ifdef CONTIKIMAC_CONF_LISTEN_TIME_AFTER_PACKET_DETECTED
#define LISTEN_TIME_AFTER_PACKET_DETECTED CONTIKIMAC_CONF_LISTEN_TIME_AFTER_PACKET_DETECTED
#else
#define LISTEN_TIME_AFTER_PACKET_DETECTED RTIMER_ARCH_SECOND / 80
#endif
/* MAX_SILENCE_PERIODS is the maximum amount of periods (a period is
CCA_CHECK_TIME + CCA_SLEEP_TIME) that we allow to be silent before
@ -195,6 +203,12 @@ static int we_are_receiving_burst = 0;
to a neighbor for which we have a phase lock. */
#define MAX_PHASE_STROBE_TIME RTIMER_ARCH_SECOND / 60
#ifdef CONTIKIMAC_CONF_SEND_SW_ACK
#define CONTIKIMAC_SEND_SW_ACK CONTIKIMAC_CONF_SEND_SW_ACK
#else
#define CONTIKIMAC_SEND_SW_ACK 0
#endif
#define ACK_LEN 3
#include <stdio.h>
@ -865,10 +879,26 @@ static void
input_packet(void)
{
static struct ctimer ct;
int duplicate = 0;
#if CONTIKIMAC_SEND_SW_ACK
int original_datalen;
uint8_t *original_dataptr;
original_datalen = packetbuf_datalen();
original_dataptr = packetbuf_dataptr();
#endif
if(!we_are_receiving_burst) {
off();
}
if(packetbuf_datalen() == ACK_LEN) {
/* Ignore ack packets */
PRINTF("ContikiMAC: ignored ack\n");
return;
}
/* printf("cycle_start 0x%02x 0x%02x\n", cycle_start, cycle_start % CYCLE_TIME);*/
if(packetbuf_totlen() > 0 && NETSTACK_FRAMER.parse() >= 0) {
@ -896,12 +926,13 @@ input_packet(void)
#if RDC_WITH_DUPLICATE_DETECTION
/* Check for duplicate packet. */
if(mac_sequence_is_duplicate()) {
duplicate = mac_sequence_is_duplicate();
if(duplicate) {
/* Drop the packet. */
/* printf("Drop duplicate ContikiMAC layer packet\n");*/
return;
PRINTF("contikimac: Drop duplicate\n");
} else {
mac_sequence_register_seqno();
}
mac_sequence_register_seqno();
#endif /* RDC_WITH_DUPLICATE_DETECTION */
#if CONTIKIMAC_CONF_COMPOWER
@ -919,7 +950,30 @@ input_packet(void)
#endif /* CONTIKIMAC_CONF_COMPOWER */
PRINTDEBUG("contikimac: data (%u)\n", packetbuf_datalen());
NETSTACK_MAC.input();
#if CONTIKIMAC_SEND_SW_ACK
{
frame802154_t info154;
frame802154_parse(original_dataptr, original_datalen, &info154);
if(info154.fcf.frame_type == FRAME802154_DATAFRAME &&
info154.fcf.ack_required != 0 &&
linkaddr_cmp((linkaddr_t *)&info154.dest_addr,
&linkaddr_node_addr)) {
uint8_t ackdata[ACK_LEN] = {0, 0, 0};
we_are_sending = 1;
ackdata[0] = FRAME802154_ACKFRAME;
ackdata[1] = 0;
ackdata[2] = info154.seq;
NETSTACK_RADIO.send(ackdata, ACK_LEN);
we_are_sending = 0;
}
}
#endif /* CONTIKIMAC_SEND_SW_ACK */
if(!duplicate) {
NETSTACK_MAC.input();
}
return;
} else {
PRINTDEBUG("contikimac: data not for us\n");

View file

@ -40,6 +40,18 @@
#include "lib/list.h"
#include "net/nbr-table.h"
#define DEBUG 0
#if DEBUG
#include <stdio.h>
#include "sys/ctimer.h"
static void handle_periodic_timer(void *ptr);
static struct ctimer periodic_timer;
static uint8_t initialized = 0;
#define PRINTF(...) printf(__VA_ARGS__)
#else
#define PRINTF(...)
#endif
/* List of link-layer addresses of the neighbors, used as key in the tables */
typedef struct nbr_table_key {
struct nbr_table_key *next;
@ -143,6 +155,7 @@ static int
nbr_set_bit(uint8_t *bitmap, nbr_table_t *table, nbr_table_item_t *item, int value)
{
int item_index = index_from_item(table, item);
if(table != NULL && item_index != -1) {
if(value) {
bitmap[item_index] |= 1 << table->index;
@ -229,6 +242,13 @@ nbr_table_allocate(void)
int
nbr_table_register(nbr_table_t *table, nbr_table_callback *callback)
{
#if DEBUG
if(!initialized) {
initialized = 1;
/* schedule a debug printout per minute */
ctimer_set(&periodic_timer, CLOCK_SECOND * 60, handle_periodic_timer, NULL);
}
#endif
if(num_tables < MAX_NUM_TABLES) {
table->index = num_tables++;
table->callback = callback;
@ -331,6 +351,10 @@ nbr_table_remove(nbr_table_t *table, void *item)
int
nbr_table_lock(nbr_table_t *table, void *item)
{
#if DEBUG
int i = index_from_item(table, item);
PRINTF("*** Lock %d\n", i);
#endif
return nbr_set_bit(locked_map, table, item, 1);
}
/*---------------------------------------------------------------------------*/
@ -338,6 +362,10 @@ nbr_table_lock(nbr_table_t *table, void *item)
int
nbr_table_unlock(nbr_table_t *table, void *item)
{
#if DEBUG
int i = index_from_item(table, item);
PRINTF("*** Unlock %d\n", i);
#endif
return nbr_set_bit(locked_map, table, item, 0);
}
/*---------------------------------------------------------------------------*/
@ -348,3 +376,25 @@ nbr_table_get_lladdr(nbr_table_t *table, const void *item)
nbr_table_key_t *key = key_from_item(table, item);
return key != NULL ? &key->lladdr : NULL;
}
/*---------------------------------------------------------------------------*/
#if DEBUG
static void
handle_periodic_timer(void *ptr)
{
int i, j;
/* Printout all neighbors and which tables they are used in */
PRINTF("NBR TABLE:\n");
for(i = 0; i < NBR_TABLE_MAX_NEIGHBORS; i++) {
if(used_map[i] > 0) {
PRINTF(" %02d %02d",i , key_from_index(i)->lladdr.u8[LINKADDR_SIZE - 1]);
for(j = 0; j < num_tables; j++) {
PRINTF(" [%d:%d]", (used_map[i] & (1 << j)) != 0,
(locked_map[i] & (1 << j)) != 0);
}
PRINTF("\n");
}
}
ctimer_reset(&periodic_timer);
}
#endif

View file

@ -1408,10 +1408,4 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
p->dtsn = dio->dtsn;
}
/*---------------------------------------------------------------------------*/
void
rpl_lock_parent(rpl_parent_t *p)
{
nbr_table_lock(rpl_parents, p);
}
/*---------------------------------------------------------------------------*/
/** @} */

View file

@ -175,7 +175,7 @@ dis_input(void)
}
}
}
uip_len = 0;
uip_clear_buf();
}
/*---------------------------------------------------------------------------*/
void
@ -256,7 +256,8 @@ dio_input(void)
PRINTF(", ");
PRINTLLADDR((uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_SENDER));
PRINTF("\n");
return;
goto discard;
}
} else {
PRINTF("RPL: Neighbor already in neighbor cache\n");
@ -306,7 +307,7 @@ dio_input(void)
if(len + i > buffer_length) {
PRINTF("RPL: Invalid DIO packet\n");
RPL_STAT(rpl_stats.malformed_msgs++);
return;
goto discard;
}
PRINTF("RPL: DIO option %u, length: %u\n", subopt_type, len - 2);
@ -316,7 +317,7 @@ dio_input(void)
if(len < 6) {
PRINTF("RPL: Invalid DAG MC, len = %d\n", len);
RPL_STAT(rpl_stats.malformed_msgs++);
return;
goto discard;
}
dio.mc.type = buffer[i + 2];
dio.mc.flags = buffer[i + 3] << 1;
@ -342,14 +343,14 @@ dio_input(void)
dio.mc.obj.energy.energy_est = buffer[i + 7];
} else {
PRINTF("RPL: Unhandled DAG MC type: %u\n", (unsigned)dio.mc.type);
return;
goto discard;
}
break;
case RPL_OPTION_ROUTE_INFO:
if(len < 9) {
PRINTF("RPL: Invalid destination prefix option, len = %d\n", len);
RPL_STAT(rpl_stats.malformed_msgs++);
return;
goto discard;
}
/* The flags field includes the preference value. */
@ -365,7 +366,7 @@ dio_input(void)
} else {
PRINTF("RPL: Invalid route info option, len = %d\n", len);
RPL_STAT(rpl_stats.malformed_msgs++);
return;
goto discard;
}
break;
@ -373,7 +374,7 @@ dio_input(void)
if(len != 16) {
PRINTF("RPL: Invalid DAG configuration option, len = %d\n", len);
RPL_STAT(rpl_stats.malformed_msgs++);
return;
goto discard;
}
/* Path control field not yet implemented - at i + 2 */
@ -395,7 +396,7 @@ dio_input(void)
if(len != 32) {
PRINTF("RPL: Invalid DAG prefix info, len != 32\n");
RPL_STAT(rpl_stats.malformed_msgs++);
return;
goto discard;
}
dio.prefix_info.length = buffer[i + 2];
dio.prefix_info.flags = buffer[i + 3];
@ -418,7 +419,8 @@ dio_input(void)
rpl_process_dio(&from, &dio);
uip_len = 0;
discard:
uip_clear_buf();
}
/*---------------------------------------------------------------------------*/
void
@ -622,7 +624,7 @@ dao_input(void)
if(instance == NULL) {
PRINTF("RPL: Ignoring a DAO for an unknown RPL instance(%u)\n",
instance_id);
return;
goto discard;
}
lifetime = instance->default_lifetime;
@ -637,7 +639,7 @@ dao_input(void)
if(flags & RPL_DAO_D_FLAG) {
if(memcmp(&dag->dag_id, &buffer[pos], sizeof(dag->dag_id))) {
PRINTF("RPL: Ignoring a DAO for a DAG different from ours\n");
return;
goto discard;
}
pos += 16;
}
@ -658,7 +660,7 @@ dao_input(void)
DAG_RANK(parent->rank, instance), DAG_RANK(dag->rank, instance));
parent->rank = INFINITE_RANK;
parent->flags |= RPL_PARENT_FLAG_UPDATED;
return;
goto discard;
}
/* If we get the DAO from our parent, we also have a loop. */
@ -666,7 +668,7 @@ dao_input(void)
PRINTF("RPL: Loop detected when receiving a unicast DAO from our parent\n");
parent->rank = INFINITE_RANK;
parent->flags |= RPL_PARENT_FLAG_UPDATED;
return;
goto discard;
}
}
@ -743,7 +745,7 @@ dao_input(void)
dao_ack_output(instance, &dao_sender_addr, sequence);
}
}
return;
goto discard;
}
PRINTF("RPL: adding DAO route\n");
@ -765,19 +767,17 @@ dao_input(void)
PRINTF(", ");
PRINTLLADDR((uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_SENDER));
PRINTF("\n");
return;
goto discard;
}
} else {
PRINTF("RPL: Neighbor already in neighbor cache\n");
}
rpl_lock_parent(parent);
rep = rpl_add_route(dag, &prefix, prefixlen, &dao_sender_addr);
if(rep == NULL) {
RPL_STAT(rpl_stats.mem_overflows++);
PRINTF("RPL: Could not add a route after receiving a DAO\n");
return;
goto discard;
}
rep->state.lifetime = RPL_LIFETIME(instance, lifetime);
@ -801,7 +801,9 @@ fwd_dao:
dao_ack_output(instance, &dao_sender_addr, sequence);
}
}
uip_len = 0;
discard:
uip_clear_buf();
}
/*---------------------------------------------------------------------------*/
void
@ -931,7 +933,7 @@ dao_ack_input(void)
PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
PRINTF("\n");
#endif /* DEBUG */
uip_len = 0;
uip_clear_buf();
}
/*---------------------------------------------------------------------------*/
void

View file

@ -303,9 +303,6 @@ uip_ds6_route_t *rpl_add_route(rpl_dag_t *dag, uip_ipaddr_t *prefix,
int prefix_len, uip_ipaddr_t *next_hop);
void rpl_purge_routes(void);
/* Lock a parent in the neighbor cache. */
void rpl_lock_parent(rpl_parent_t *p);
/* Objective function. */
rpl_of_t *rpl_find_of(rpl_ocp_t);

View file

@ -89,11 +89,17 @@ rpl_set_mode(enum rpl_mode m)
} else if(m == RPL_MODE_FEATHER) {
PRINTF("RPL: switching to feather mode\n");
mode = m;
if(default_instance != NULL) {
PRINTF("rpl_set_mode: RPL sending DAO with zero lifetime\n");
if(default_instance->current_dag != NULL) {
dao_output(default_instance->current_dag->preferred_parent, RPL_ZERO_LIFETIME);
}
rpl_cancel_dao(default_instance);
} else {
PRINTF("rpl_set_mode: no default instance\n");
}
mode = m;
} else {
mode = m;
}
@ -277,9 +283,9 @@ rpl_ipv6_neighbor_callback(uip_ds6_nbr_t *nbr)
rpl_instance_t *instance;
rpl_instance_t *end;
PRINTF("RPL: Removing neighbor ");
PRINTF("RPL: Neighbor state changed for ");
PRINT6ADDR(&nbr->ipaddr);
PRINTF("\n");
PRINTF(", nscount=%u, state=%u\n", nbr->nscount, nbr->state);
for(instance = &instance_table[0], end = instance + RPL_MAX_INSTANCES; instance < end; ++instance) {
if(instance->used == 1 ) {
p = rpl_find_parent_any_dag(instance, &nbr->ipaddr);

View file

@ -108,7 +108,6 @@ struct rpl_dag;
#define RPL_PARENT_FLAG_LINK_METRIC_VALID 0x2
struct rpl_parent {
struct rpl_parent *next;
struct rpl_dag *dag;
#if RPL_DAG_MC != RPL_DAG_MC_NONE
rpl_metric_container_t mc;

View file

@ -98,9 +98,16 @@ ctimer_init(void)
void
ctimer_set(struct ctimer *c, clock_time_t t,
void (*f)(void *), void *ptr)
{
ctimer_set_with_process(c, t, f, ptr, PROCESS_CURRENT());
}
/*---------------------------------------------------------------------------*/
void
ctimer_set_with_process(struct ctimer *c, clock_time_t t,
void (*f)(void *), void *ptr, struct process *p)
{
PRINTF("ctimer_set %p %u\n", c, (unsigned)t);
c->p = PROCESS_CURRENT();
c->p = p;
c->f = f;
c->ptr = ptr;
if(initialized) {

View file

@ -109,10 +109,28 @@ void ctimer_restart(struct ctimer *c);
* sometime in the future. When the callback timer expires,
* the callback function f will be called with ptr as argument.
*
* This essentially does ctimer_set_process(c, t, f, ptr, PROCESS_CURRENT());
*
*/
void ctimer_set(struct ctimer *c, clock_time_t t,
void (*f)(void *), void *ptr);
/**
* \brief Set a callback timer.
* \param c A pointer to the callback timer.
* \param t The interval before the timer expires.
* \param f A function to be called when the timer expires.
* \param ptr An opaque pointer that will be supplied as an argument to the callback function.
* \param p A pointer to the process the timer belongs to
*
* This function is used to set a callback timer for a time
* sometime in the future. When the callback timer expires,
* the callback function f will be called with ptr as argument.
*
*/
void ctimer_set_with_process(struct ctimer *c, clock_time_t t,
void (*f)(void *), void *ptr, struct process *p);
/**
* \brief Stop a pending callback timer.
* \param c A pointer to the pending callback timer.

View file

@ -181,6 +181,14 @@ etimer_set(struct etimer *et, clock_time_t interval)
}
/*---------------------------------------------------------------------------*/
void
etimer_reset_with_new_interval(struct etimer *et, clock_time_t interval)
{
timer_reset(&et->timer);
et->timer.interval = interval;
add_timer(et);
}
/*---------------------------------------------------------------------------*/
void
etimer_reset(struct etimer *et)
{
timer_reset(&et->timer);

View file

@ -114,6 +114,19 @@ CCIF void etimer_set(struct etimer *et, clock_time_t interval);
*/
CCIF void etimer_reset(struct etimer *et);
/**
* \brief Reset an event timer with a new interval.
* \param et A pointer to the event timer.
* \param interval The interval before the timer expires.
*
* This function very similar to etimer_reset. Opposed to
* etimer_reset it is possible to change the timout.
* This allows accurate, non-periodic timers without drift.
*
* \sa etimer_reset()
*/
void etimer_reset_with_new_interval(struct etimer *et, clock_time_t interval);
/**
* \brief Restart an event timer from the current point in time
* \param et A pointer to the event timer.

View file

@ -61,7 +61,7 @@ typedef int32_t s32_t;
#define HAVE_SNPRINTF
#define snprintf(buf, len, ...) sprintf(buf, __VA_ARGS__)
#define CLOCK_CONF_SECOND 2
#define CLOCK_CONF_SECOND 4
typedef unsigned short clock_time_t;
typedef unsigned short uip_stats_t;

View file

@ -45,11 +45,8 @@ clock_time(void)
* of overhead for cc65 targets.
* On the other hand we want to avoid wrapping around frequently so the idea
* is to reduce the clock resolution to the bare minimum. This is defined by
* the TCP/IP stack using a 1/2 second periodic timer. So CLOCK_CONF_SECOND
* needs to be defined at least as 2.
* The value 2 works out especially nicely as it allows us to implement the
* clock frequency devider below purely in (32 bit) integer arithmetic based
* on the educated guess of CLK_TCK being an even value. */
* the DNS resolver using a 1/4 second timer. So CLOCK_CONF_SECOND needs to
* be defined at least as 4. */
return clock() / (CLK_TCK / CLOCK_CONF_SECOND);
}
/*---------------------------------------------------------------------------*/

View file

@ -486,7 +486,7 @@ transmit(unsigned short transmit_len)
}
/*---------------------------------------------------------------------------*/
static int
send(void *payload, unsigned short payload_len)
send(const void *payload, unsigned short payload_len)
{
prepare(payload, payload_len);
return transmit(payload_len);

View file

@ -0,0 +1,7 @@
TI_XXWARE_PATH = lib/cc13xxware
CONTIKI_CPU_SOURCEFILES += smartrf-settings.c prop-mode.c
CFLAGS += -DCPU_FAMILY_CC13XX=1
include $(CONTIKI_CPU)/Makefile.cc26xx-cc13xx

View file

@ -0,0 +1,3 @@
TI_XXWARE_PATH = lib/cc26xxware
include $(CONTIKI_CPU)/Makefile.cc26xx-cc13xx

View file

@ -8,25 +8,24 @@ NM = arm-none-eabi-nm
SIZE = arm-none-eabi-size
SREC_CAT = srec_cat
CPU_ABS_PATH = cpu/cc26xx
TI_CC26XXWARE_PATH = lib/cc26xxware
TI_CC26XXWARE = $(CONTIKI_CPU)/$(TI_CC26XXWARE_PATH)
CPU_ABS_PATH = cpu/cc26xx-cc13xx
TI_XXWARE = $(CONTIKI_CPU)/$(TI_XXWARE_PATH)
### cc26xxware sources under driverlib will be added to the MODULES list
TI_CC26XXWARE_SRC = $(CPU_ABS_PATH)/$(TI_CC26XXWARE_PATH)/driverlib
TI_XXWARE_SRC = $(CPU_ABS_PATH)/$(TI_XXWARE_PATH)/driverlib
### The directory with startup sources will be added to the CONTIKI_CPU_DIRS
### and the sources therein are added to the sources list explicitly. They are
### also listed explicitly in the linker command (through TARGET_STARTFILES),
### to make sure they always get linked in the image
TI_CC26XXWARE_STARTUP_DIR = $(TI_CC26XXWARE_PATH)/startup_files
TI_CC26XXWARE_STARTUP_SRCS = ccfg.c startup_gcc.c
TI_XXWARE_STARTUP_DIR = $(TI_XXWARE_PATH)/startup_files
TI_XXWARE_STARTUP_SRCS = ccfg.c startup_gcc.c
### MODULES will add some of these to the include path, but we need to add
### them earlier to prevent filename clashes with Contiki core files
CFLAGS += -I$(TI_CC26XXWARE) -I$(CONTIKI)/$(TI_CC26XXWARE_SRC)
CFLAGS += -I$(TI_CC26XXWARE)/inc
MODULES += $(TI_CC26XXWARE_SRC)
CFLAGS += -I$(TI_XXWARE) -I$(CONTIKI)/$(TI_XXWARE_SRC)
CFLAGS += -I$(TI_XXWARE)/inc
MODULES += $(TI_XXWARE_SRC)
LDSCRIPT = $(CONTIKI_CPU)/cc26xx.ld
@ -35,10 +34,6 @@ CFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -fshort-enums -fomit-frame-pointer -fno-strict-aliasing
CFLAGS += -Wall -std=c99
### Workaround for driverlib's cpu.h which tests if defined(gcc)
### Delete if it gets fixed or if we stop using the driverlib
CFLAGS += -Dgcc=__GNUC__
LDFLAGS += -mcpu=cortex-m3 -mthumb -mlittle-endian -nostartfiles
LDFLAGS += -T $(LDSCRIPT)
LDFLAGS += -Wl,--gc-sections,--sort-section=alignment
@ -62,23 +57,24 @@ endif
CLEAN += symbols.c symbols.h *.d *.elf *.hex
### CPU-dependent directories
CONTIKI_CPU_DIRS = . dev dev/rfc-api $(TI_CC26XXWARE_STARTUP_DIR)
CONTIKI_CPU_DIRS = . dev rf-core rf-core/api $(TI_XXWARE_STARTUP_DIR)
### Use the existing debug I/O in cpu/arm/common
CONTIKI_CPU_DIRS += ../arm/common/dbg-io
### CPU-dependent source files
CONTIKI_CPU_SOURCEFILES += clock.c rtimer-arch.c cc26xx-rtc.c uart.c
CONTIKI_CPU_SOURCEFILES += cc26xx-rf.c contiki-watchdog.c
CONTIKI_CPU_SOURCEFILES += clock.c rtimer-arch.c soc-rtc.c uart.c
CONTIKI_CPU_SOURCEFILES += contiki-watchdog.c
CONTIKI_CPU_SOURCEFILES += putchar.c ieee-addr.c batmon-sensor.c
CONTIKI_CPU_SOURCEFILES += slip-arch.c slip.c cc26xx-uart.c lpm.c
CONTIKI_CPU_SOURCEFILES += gpio-interrupt.c oscillators.c
CONTIKI_CPU_SOURCEFILES += rf-core.c rf-ble.c ieee-mode.c
DEBUG_IO_SOURCEFILES += dbg-printf.c dbg-snprintf.c dbg-sprintf.c strformat.c
CONTIKI_SOURCEFILES += $(CONTIKI_CPU_SOURCEFILES) $(DEBUG_IO_SOURCEFILES)
TARGET_START_SOURCEFILES += fault-handlers.c $(TI_CC26XXWARE_STARTUP_SRCS)
TARGET_START_SOURCEFILES += fault-handlers.c $(TI_XXWARE_STARTUP_SRCS)
TARGET_STARTFILES = $(addprefix $(OBJECTDIR)/,$(call oname, $(TARGET_START_SOURCEFILES)))
### Don't treat the .elf as intermediate

View file

@ -44,8 +44,11 @@ MEMORY
*/
FLASH_CCFG (RX) : ORIGIN = 0x0001FFA8, LENGTH = 88
/* RAM Size 20KB (PG2.1) */
/* RAM Size 20KB */
SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00005000
/* Application can use GPRAM region as RAM if cache is disabled in CCFG */
GPRAM (RWX) : ORIGIN = 0x11000000, LENGTH = 0x00002000
}
/*. Highest address of the stack. Used in startup file .*/
@ -99,5 +102,10 @@ SECTIONS
. = . + _Min_Heap_Size;
. = . + _Min_Stack_Size;
. = ALIGN(4);
} >SRAM
} > SRAM
.gpram :
{
} > GPRAM
}

View file

@ -35,30 +35,35 @@
* \defgroup cc26xx-platforms TI CC26xx-powered Platforms
* @{
*
* \defgroup cc26xx The TI CC26xx CPU
* \defgroup cc26xx The TI CC26xx and CC13xx CPUs
*
* This group documents the TI CC26xx and CC13xx CPUs. The two CPU families are
* very similar, with the main difference being related to radio capability.
*
* Documentation in this group should be considered to be applicable to both
* families, unless explicitly stated otherwise.
*
* @{
*
* \addtogroup cc26xx-clocks
* @{
*
* \defgroup cc26xx-software-clock CC26xx Software Clock
* \defgroup cc26xx-software-clock Software Clock
*
* Implementation of the clock module for the cc26xx.
* Implementation of the clock module for the CC26xx and CC13xx.
*
* The software clock uses the facilities provided by the AON RTC driver
* @{
*
* \file
* Software clock implementation for the TI CC26xx
* Software clock implementation for the TI CC13xx/CC26xx
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "ti-lib.h"
/*---------------------------------------------------------------------------*/
static volatile clock_time_t count;
static volatile clock_time_t second_countdown;
static volatile unsigned long secs;
static volatile uint64_t count;
/*---------------------------------------------------------------------------*/
static void
power_domain_on(void)
@ -72,8 +77,6 @@ void
clock_init(void)
{
count = 0;
secs = 0;
second_countdown = CLOCK_SECOND;
/*
* Here, we configure GPT0 Timer A, which we subsequently use in
@ -120,33 +123,50 @@ clock_init(void)
CCIF clock_time_t
clock_time(void)
{
return count;
return (clock_time_t)(count & 0xFFFFFFFF);
}
/*---------------------------------------------------------------------------*/
void
clock_update(void)
{
count++;
bool interrupts_disabled;
uint32_t aon_rtc_secs_now;
uint16_t aon_rtc_ticks_now;
interrupts_disabled = ti_lib_int_master_disable();
aon_rtc_secs_now = HWREG(AON_RTC_BASE + AON_RTC_O_SEC);
aon_rtc_ticks_now = HWREG(AON_RTC_BASE + AON_RTC_O_SUBSEC) >> 16;
/* Convert AON RTC ticks to clock tick counter */
count = (aon_rtc_secs_now * CLOCK_SECOND) + (aon_rtc_ticks_now >> 9);
/* Re-enable interrupts */
if(!interrupts_disabled) {
ti_lib_int_master_enable();
}
if(etimer_pending()) {
etimer_request_poll();
}
if(--second_countdown == 0) {
secs++;
second_countdown = CLOCK_SECOND;
}
}
/*---------------------------------------------------------------------------*/
void
clock_set_seconds(unsigned long sec)
{
secs = sec;
}
/*---------------------------------------------------------------------------*/
CCIF unsigned long
clock_seconds(void)
{
return secs;
bool interrupts_disabled;
uint32_t secs_now;
interrupts_disabled = ti_lib_int_master_disable();
secs_now = ti_lib_aon_rtc_sec_get();
/* Re-enable interrupts */
if(!interrupts_disabled) {
ti_lib_int_master_enable();
}
return (unsigned long)secs_now;
}
/*---------------------------------------------------------------------------*/
void

View file

@ -32,13 +32,13 @@
* \addtogroup cc26xx
* @{
*
* \defgroup cc26xx-char-io CC26xx Character I/O
* \defgroup cc26xx-char-io CC13xx/CC26xx Character I/O
*
* CC26xx CPU-specific functions for debugging and SLIP I/O
* CC13xx/CC26xx CPU-specific functions for debugging and SLIP I/O
* @{
*
* \file
* Header file for the CC26xx Debug I/O module
* Header file for the CC13xx/CC26xx Debug I/O module
*/
#ifndef DBG_H_
#define DBG_H_

View file

@ -33,7 +33,7 @@
* @{
*
* \file
* Driver for the CC26xx AON battery monitor
* Driver for the CC13xx/CC26xx AON battery monitor
*/
/*---------------------------------------------------------------------------*/
#include "contiki-conf.h"

View file

@ -32,13 +32,13 @@
* \addtogroup cc26xx
* @{
*
* \defgroup cc26xx-batmon CC26xx BatMon sensor driver
* \defgroup cc26xx-batmon CC13xx/CC26xx BatMon sensor driver
*
* Driver for the on-chip battery voltage and chip temperature sensor.
* @{
*
* \file
* Header file for the CC26xx battery monitor
* Header file for the CC13xx/CC26xx battery monitor
*/
/*---------------------------------------------------------------------------*/
#ifndef BATMON_SENSOR_H_

View file

@ -27,6 +27,15 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup cc26xx-uart
* @{
*
* \file
* Implementation of the CC13xx/CC26xx UART driver.
*/
/*---------------------------------------------------------------------------*/
#include "contiki-conf.h"
#include "cc26xx-uart.h"
#include "hw_types.h"
@ -41,6 +50,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
/*---------------------------------------------------------------------------*/
/* Which events to trigger a UART interrupt */
#define CC26XX_UART_RX_INTERRUPT_TRIGGERS (UART_INT_RX | UART_INT_RT)
@ -382,3 +392,5 @@ cc26xx_uart_isr(void)
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
/** @} */

View file

@ -31,13 +31,13 @@
* \addtogroup cc26xx
* @{
*
* \defgroup cc26xx-uart CC26xx UARTs
* \defgroup cc26xx-uart CC13xx/CC26xx UARTs
*
* Driver for the CC26xx UART controller
* Driver for the CC13xx/CC26xx UART controller
* @{
*
* \file
* Header file for the CC26xx UART driver
* Header file for the CC13xx/CC26xx UART driver
*/
#ifndef CC26XX_UART_H_
#define CC26XX_UART_H_

View file

@ -31,16 +31,16 @@
* \addtogroup cc26xx-clocks
* @{
*
* \defgroup cc26xx-wdt CC26xx watchdog timer driver
* \defgroup cc26xx-wdt CC13xx/CC26xx watchdog timer driver
*
* Driver for the CC26xx Watchdog Timer
* Driver for the CC13xx/CC26xx Watchdog Timer
*
* This file is not called watchdog.c because the filename is in use by
* TI CC26xxware
* TI CC26xxware/CC13xxware
* @{
*
* \file
* Implementation of the cc26xx watchdog driver.
* Implementation of the CC13xx/CC26xx watchdog driver.
*/
#include "watchdog.h"
#include "ti-lib.h"
@ -75,14 +75,6 @@ watchdog_periodic(void)
ti_lib_watchdog_int_clear();
}
/*---------------------------------------------------------------------------*/
/**
* \brief Stub function to satisfy API requirements
*/
void
watchdog_stop(void)
{
}
/*---------------------------------------------------------------------------*/
/**
* \brief Manually trigger a WDT reboot
*/

View file

@ -28,6 +28,14 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup cc26xx-gpio-interrupts
* @{
*
* \file
* Implementation of CC13xx/CC26xx GPIO interrupt handling.
*/
/*---------------------------------------------------------------------------*/
#include "ioc.h"
#include "gpio-interrupt.h"
#include "sys/energest.h"
@ -94,4 +102,4 @@ gpio_interrupt_isr(void)
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
/** @} */

View file

@ -32,15 +32,15 @@
* \addtogroup cc26xx
* @{
*
* \defgroup cc26xx-gpio-interrupts CC26xx GPIO interrupt handling
* \defgroup cc26xx-gpio-interrupts CC13xx/CC26xx GPIO interrupt handling
*
* The CC26xx GPIO interrupt handler and an API which can be used by other
* parts of the code when they wish to be notified of a GPIO interrupt
* The CC13xx/CC26xx GPIO interrupt handler and an API which can be used by
* other parts of the code when they wish to be notified of a GPIO interrupt
*
* @{
*
* \file
* Header file for the CC26xx GPIO interrupt management
* Header file for the CC13xx/CC26xx GPIO interrupt management
*/
/*---------------------------------------------------------------------------*/
#ifndef GPIO_INTERRUPT_H_

View file

@ -166,7 +166,4 @@ oscillators_switch_to_hf_rc(void)
osc_interface_dis(smph_clk_state);
}
/*---------------------------------------------------------------------------*/
/**
* @}
* @}
*/
/** @} */

View file

@ -32,9 +32,9 @@
* \addtogroup cc26xx
* @{
*
* \defgroup cc26xx-oscillators CC26XX oscillator control
* \defgroup cc26xx-oscillators CC13xx/CC26xx oscillator control
*
* Wrapper around those CC26xxware OSC functions that we need in Contiki.
* Wrapper around CC26xxware/CC13xxware OSC functions that we need in Contiki.
*
* All CC26xxware OSC control requires access to the semaphore module within
* AUX. Thus, in addition to enabling the oscillator interface, we need to
@ -43,7 +43,7 @@
* @{
*
* \file
* Header file for the CC26XX oscillator control
* Header file for the CC13xx/CC26xx oscillator control
*/
/*---------------------------------------------------------------------------*/
#ifndef OSCILLATORS_H_

View file

@ -27,15 +27,15 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup cc26xx-rtc
* \addtogroup cc13xx-cc26xx-rtc
* @{
*
*/
/**
* \file
* Implementation of the CC26xx AON RTC driver
* Implementation of the CC13xx/CC26xx AON RTC driver
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "sys/energest.h"
#include "rtimer.h"
@ -46,16 +46,31 @@
#include <stdint.h>
#include <stdbool.h>
/*---------------------------------------------------------------------------*/
#define cc26xx_rtc_isr(...) AONRTCIntHandler(__VA_ARGS__)
#define soc_rtc_isr(...) AONRTCIntHandler(__VA_ARGS__)
/*---------------------------------------------------------------------------*/
/* Prototype of a function in clock.c. Called every time the handler fires */
void clock_update(void);
/*---------------------------------------------------------------------------*/
#define COMPARE_INCREMENT (RTIMER_SECOND / CLOCK_SECOND)
#define MULTIPLE_512_MASK 0xFFFFFE00
/*---------------------------------------------------------------------------*/
/*
* Used to test timer wraparounds.
*
* Set to 0xFFFFFFFA to test AON RTC second counter wraparound
* Set to 0xFFFA to test AON RTC 16.16 format wraparound
*/
#ifdef SOC_RTC_CONF_START_TICK_COUNT
#define SOC_RTC_START_TICK_COUNT SOC_RTC_CONF_START_TICK_COUNT
#else
#define SOC_RTC_START_TICK_COUNT 0
#endif
/*---------------------------------------------------------------------------*/
void
cc26xx_rtc_init(void)
soc_rtc_init(void)
{
uint32_t compare_value;
bool interrupts_disabled;
uint32_t next;
/* Disable and clear interrupts */
interrupts_disabled = ti_lib_int_master_disable();
@ -63,22 +78,22 @@ cc26xx_rtc_init(void)
ti_lib_aon_rtc_disable();
ti_lib_aon_rtc_event_clear(AON_RTC_CH0);
ti_lib_aon_rtc_event_clear(AON_RTC_CH2);
ti_lib_aon_rtc_event_clear(AON_RTC_CH1);
/* Setup the wakeup event */
ti_lib_aon_event_mcu_wake_up_set(AON_EVENT_MCU_WU0, AON_EVENT_RTC0);
ti_lib_aon_event_mcu_wake_up_set(AON_EVENT_MCU_WU1, AON_EVENT_RTC2);
ti_lib_aon_rtc_combined_event_config(AON_RTC_CH0 | AON_RTC_CH2);
ti_lib_aon_event_mcu_wake_up_set(AON_EVENT_MCU_WU0, AON_EVENT_RTC_CH0);
ti_lib_aon_event_mcu_wake_up_set(AON_EVENT_MCU_WU1, AON_EVENT_RTC_CH1);
ti_lib_aon_rtc_combined_event_config(AON_RTC_CH0 | AON_RTC_CH1);
/* Configure channel 2 in continuous compare, 128 ticks / sec */
ti_lib_aon_rtc_inc_value_ch2_set(RTIMER_SECOND / CLOCK_SECOND);
ti_lib_aon_rtc_mode_ch2_set(AON_RTC_MODE_CH2_CONTINUOUS);
compare_value = (RTIMER_SECOND / CLOCK_SECOND) +
ti_lib_aon_rtc_current_compare_value_get();
ti_lib_aon_rtc_compare_value_set(AON_RTC_CH2, compare_value);
HWREG(AON_RTC_BASE + AON_RTC_O_SEC) = SOC_RTC_START_TICK_COUNT;
/* Enable channel 2 and the RTC */
ti_lib_aon_rtc_channel_enable(AON_RTC_CH2);
next = ti_lib_aon_rtc_current_compare_value_get() + COMPARE_INCREMENT;
/* Configure channel 1 to start generating clock ticks. First tick at 512 */
ti_lib_aon_rtc_compare_value_set(AON_RTC_CH1, next);
/* Enable channel 1 and the RTC */
ti_lib_aon_rtc_channel_enable(AON_RTC_CH1);
ti_lib_aon_rtc_enable();
ti_lib_int_enable(INT_AON_RTC);
@ -90,41 +105,60 @@ cc26xx_rtc_init(void)
}
/*---------------------------------------------------------------------------*/
rtimer_clock_t
cc26xx_rtc_get_next_trigger()
soc_rtc_get_next_trigger()
{
rtimer_clock_t ch2 = ti_lib_aon_rtc_compare_value_get(AON_RTC_CH2);
rtimer_clock_t ch1 = ti_lib_aon_rtc_compare_value_get(AON_RTC_CH1);
if(HWREG(AON_RTC_BASE + AON_RTC_O_CHCTL) & AON_RTC_CHCTL_CH0_EN) {
rtimer_clock_t ch0 = ti_lib_aon_rtc_compare_value_get(AON_RTC_CH2);
rtimer_clock_t ch0 = ti_lib_aon_rtc_compare_value_get(AON_RTC_CH0);
return RTIMER_CLOCK_LT(ch0, ch2) ? ch0 : ch2;
return RTIMER_CLOCK_LT(ch0, ch1) ? ch0 : ch1;
}
return ch2;
return ch1;
}
/*---------------------------------------------------------------------------*/
void
cc26xx_rtc_schedule_one_shot(uint32_t ticks)
soc_rtc_schedule_one_shot(uint32_t channel, uint32_t ticks)
{
if((channel != AON_RTC_CH0) && (channel != AON_RTC_CH1)) {
return;
}
/* Set the channel to fire a one-shot compare event at time==ticks */
ti_lib_aon_rtc_compare_value_set(AON_RTC_CH0, ticks);
ti_lib_aon_rtc_channel_enable(AON_RTC_CH0);
ti_lib_aon_rtc_compare_value_set(channel, ticks);
ti_lib_aon_rtc_channel_enable(channel);
}
/*---------------------------------------------------------------------------*/
/* The AON RTC interrupt handler */
void
cc26xx_rtc_isr(void)
soc_rtc_isr(void)
{
uint32_t now, next;
ENERGEST_ON(ENERGEST_TYPE_IRQ);
if(ti_lib_aon_rtc_event_get(AON_RTC_CH0)) {
ti_lib_aon_rtc_event_clear(AON_RTC_CH0);
rtimer_run_next();
now = ti_lib_aon_rtc_current_compare_value_get();
/* Adjust the s/w tick counter irrespective of which event trigger this */
clock_update();
if(ti_lib_aon_rtc_event_get(AON_RTC_CH1)) {
HWREG(AON_RTC_BASE + AON_RTC_O_EVFLAGS) = AON_RTC_EVFLAGS_CH1;
/*
* We need to keep ticking while we are awake, so we schedule the next
* event on the next 512 tick boundary. If we drop to deep sleep before it
* happens, lpm_drop() will reschedule us in the 'distant' future
*/
next = (now + COMPARE_INCREMENT) & MULTIPLE_512_MASK;
ti_lib_aon_rtc_compare_value_set(AON_RTC_CH1, next);
}
if(ti_lib_aon_rtc_event_get(AON_RTC_CH2)) {
ti_lib_aon_rtc_event_clear(AON_RTC_CH2);
clock_update();
if(ti_lib_aon_rtc_event_get(AON_RTC_CH0)) {
ti_lib_aon_rtc_channel_disable(AON_RTC_CH0);
HWREG(AON_RTC_BASE + AON_RTC_O_EVFLAGS) = AON_RTC_EVFLAGS_CH0;
rtimer_run_next();
}
ENERGEST_OFF(ENERGEST_TYPE_IRQ);

View file

@ -31,34 +31,28 @@
* \addtogroup cc26xx
* @{
*
* \defgroup cc26xx-clocks CC26xx clock and timer subsystem
* \defgroup cc26xx-clocks CC13xx/CC26xx clock and timer subsystem
*
* For the CC26xx cpu we use the AON RTC as the basis for all clocks and timers
* For the CC13xx/CC26xx cpu we use the AON RTC as the basis for all clocks and
* timers
*
* We configure the AON RTC's channel 2 to run in continuous mode, generating
* 128 interrupts / second. In continuous mode, the next compare event is
* scheduled by the hardware automatically; the events are equidistant and
* this also means we don't need the overhead of re-scheduling within the
* interrupt handler
*
* For rtimers, we use the RTC's channel 0 in one-shot compare mode. When the
* compare event fires, we call rtimer_run_next
* We use two of the aviable AON RTC channels. Channel 0 is used by the rtimer
* sub-system. Channel 1 is used by the system clock and the LPM module.
*
* The RTC runs in all power modes except 'shutdown'
*
* \sa cpu/cc26xx/clock.c cpu/cc26xx/rtimer-arch.c
* @{
*
* \defgroup cc26xx-rtc CC26xx AON RTC driver
* \defgroup cc13xx-cc26xx-rtc CC13xx/CC26xx AON RTC driver
*
* Underpins the platform's software clocks and timers
*
* @{
* \file
* Header file for the CC26XX AON RTC driver
* Header file for the CC13xx/CC26xx AON RTC driver
*/
#ifndef CC26XX_RTC_H_
#define CC26XX_RTC_H_
#ifndef SOC_RTC_H_
#define SOC_RTC_H_
/*---------------------------------------------------------------------------*/
#include "contiki.h"
@ -67,12 +61,13 @@
#include <stdint.h>
/*---------------------------------------------------------------------------*/
/**
* \brief Initialise the CC26XX AON RTC module
* \brief Initialise the CC13XX/CC26XX AON RTC module
*
* This timer configures AON RTC channels.
*
* This timer configures the AON RTC's channel 2 to run in continuous mode
* This function must be called before clock_init() and rtimer_init()
*/
void cc26xx_rtc_init(void);
void soc_rtc_init(void);
/**
* \brief Return the time of the next scheduled rtimer event
@ -81,17 +76,24 @@ void cc26xx_rtc_init(void);
* This function will check both AON RTC channels and will only take CH0's
* compare into account if the channel is actually enabled
*/
rtimer_clock_t cc26xx_rtc_get_next_trigger(void);
rtimer_clock_t soc_rtc_get_next_trigger(void);
/**
* \brief Schedule an AON RTC channel 0 one-shot compare event
* \param channel AON_RTC_CH0 or AON_RTC_CH1
* \param t The time when the event will be fired. This is an absolute
* time, in other words the event will fire AT time \e t,
* not IN \e t ticks
*
* Channel AON_RTC_CH0 is reserved for the rtimer. AON_RTC_CH1 is reserved
* for the system clock.
*
* User applications should not use this function. User applications should
* instead use Contiki's timer-related libraries
*/
void cc26xx_rtc_schedule_one_shot(uint32_t t);
void soc_rtc_schedule_one_shot(uint32_t channel, uint32_t t);
/*---------------------------------------------------------------------------*/
#endif /* CC26XX_RTC_H_ */
#endif /* SOC_RTC_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}

View file

@ -34,7 +34,7 @@
* @{
*
* \file
* Driver for the CC26xx IEEE addresses
* Driver for the CC13xx/CC26xx IEEE addresses
*/
/*---------------------------------------------------------------------------*/
#include "contiki-conf.h"

View file

@ -33,7 +33,7 @@
* \addtogroup cc26xx
* @{
*
* \defgroup cc26xx-ieee-addr CC26xx IEEE Address Control
* \defgroup cc26xx-ieee-addr CC13xx/CC26xx IEEE Address Control
*
* Driver for the retrieval of an IEEE address from flash
*

@ -0,0 +1 @@
Subproject commit 63ed52888467ea7d403b0c743852162395232c9e

@ -0,0 +1 @@
Subproject commit 0e82b18bf2c69fb0a40af4d2496db2a3dc721cec

View file

@ -32,12 +32,12 @@
* \addtogroup cc26xx-lpm
* @{
*
* Implementation of CC26xx low-power operation functionality
* Implementation of CC13xx/CC26xx low-power operation functionality
*
* @{
*
* \file
* Driver for CC26xx's low-power operation
* Driver for CC13xx/CC26xx low-power operation
*/
/*---------------------------------------------------------------------------*/
#include "prcm.h"
@ -48,8 +48,11 @@
#include "lib/list.h"
#include "dev/leds.h"
#include "dev/watchdog.h"
#include "dev/cc26xx-rtc.h"
#include "dev/soc-rtc.h"
#include "dev/oscillators.h"
#include <stdint.h>
#include <string.h>
/*---------------------------------------------------------------------------*/
#if ENERGEST_CONF_ON
static unsigned long irq_energest = 0;
@ -72,7 +75,10 @@ LIST(modules_list);
* Don't consider standby mode if the next AON RTC event is scheduled to fire
* in less than STANDBY_MIN_DURATION rtimer ticks
*/
#define STANDBY_MIN_DURATION (RTIMER_SECOND >> 8)
#define STANDBY_MIN_DURATION (RTIMER_SECOND >> 11)
/*---------------------------------------------------------------------------*/
/* Prototype of a function in clock.c. Called every time we come out of DS */
void clock_update(void);
/*---------------------------------------------------------------------------*/
void
lpm_shutdown(uint32_t wakeup_pin, uint32_t io_pull, uint32_t wake_on)
@ -93,10 +99,10 @@ lpm_shutdown(uint32_t wakeup_pin, uint32_t io_pull, uint32_t wake_on)
/* Reset AON even fabric to default wakeup sources */
for(i = AON_EVENT_MCU_WU0; i <= AON_EVENT_MCU_WU3; i++) {
ti_lib_aon_event_mcu_wake_up_set(i, AON_EVENT_NULL);
ti_lib_aon_event_mcu_wake_up_set(i, AON_EVENT_NONE);
}
for(i = AON_EVENT_AUX_WU0; i <= AON_EVENT_AUX_WU2; i++) {
ti_lib_aon_event_aux_wake_up_set(i, AON_EVENT_NULL);
ti_lib_aon_event_aux_wake_up_set(i, AON_EVENT_NONE);
}
ti_lib_sys_ctrl_aon_sync();
@ -222,6 +228,14 @@ wake_up(void)
/* Check operating conditions, optimally choose DCDC versus GLDO */
ti_lib_sys_ctrl_dcdc_voltage_conditional_control();
/*
* We may or may not have been woken up by an AON RTC tick. If not, we need
* to adjust our software tick counter
*/
clock_update();
watchdog_periodic();
/* Notify all registered modules that we've just woken up */
for(module = list_head(modules_list); module != NULL;
module = module->next) {
@ -237,10 +251,11 @@ lpm_drop()
lpm_registered_module_t *module;
uint8_t max_pm = LPM_MODE_MAX_SUPPORTED;
uint8_t module_pm;
clock_time_t next_event;
uint32_t domains = LOCKABLE_DOMAINS;
if(RTIMER_CLOCK_LT(cc26xx_rtc_get_next_trigger(),
if(RTIMER_CLOCK_LT(soc_rtc_get_next_trigger(),
RTIMER_NOW() + STANDBY_MIN_DURATION)) {
lpm_sleep();
return;
@ -269,6 +284,18 @@ lpm_drop()
/* Critical. Don't get interrupted! */
ti_lib_int_master_disable();
/*
* Reschedule AON RTC CH1 to fire an event N ticks before the next etimer
* event
*/
next_event = etimer_next_expiration_time();
if(next_event) {
next_event = next_event - clock_time();
soc_rtc_schedule_one_shot(AON_RTC_CH1, RTIMER_NOW() +
(next_event * (RTIMER_SECOND / CLOCK_SECOND)));
}
/*
* Notify all registered modules that we are dropping to mode X. We do not
* need to do this for simple sleep.
@ -357,7 +384,7 @@ lpm_drop()
while(ti_lib_aon_wuc_power_status_get() & AONWUC_AUX_POWER_ON);
/* Configure the recharge controller */
ti_lib_sys_ctrl_set_recharge_before_power_down(false);
ti_lib_sys_ctrl_set_recharge_before_power_down(XOSC_IN_HIGH_POWER_MODE);
/*
* If both PERIPH and SERIAL PDs are off, request the uLDO as the power
@ -436,6 +463,9 @@ void
lpm_init()
{
list_init(modules_list);
/* Always wake up on any DIO edge detection */
ti_lib_aon_event_mcu_wake_up_set(AON_EVENT_MCU_WU2, AON_EVENT_IO);
}
/*---------------------------------------------------------------------------*/
void

View file

@ -32,14 +32,14 @@
* \addtogroup cc26xx
* @{
*
* \defgroup cc26xx-lpm CC26xx Low-Power management
* \defgroup cc26xx-lpm CC13xx/CC26xx Low-Power management
*
* CC26xx low-power operation
* CC13xx/CC26xx low-power operation
*
* @{
*
* \file
* Header file for the management of CC26xx low-power operation
* Header file for the management of CC13xx/CC26xx low-power operation
*/
/*---------------------------------------------------------------------------*/
#ifndef LPM_H_

View file

@ -37,8 +37,8 @@
*
******************************************************************************/
#ifndef __BLE_CMD_H
#define __BLE_CMD_H
#ifndef BLE_CMD_H_
#define BLE_CMD_H_
#ifndef __RFC_STRUCT
#ifdef __GNUC__
@ -58,35 +58,34 @@
#include "mailbox.h"
#include "common_cmd.h"
typedef struct __RFC_STRUCT rfc_bleMasterPar_s rfc_bleMasterPar_t;
typedef struct __RFC_STRUCT rfc_bleMasterSlavePar_s rfc_bleMasterSlavePar_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_INITIATOR_s rfc_CMD_BLE_INITIATOR_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_TX_TEST_s rfc_CMD_BLE_TX_TEST_t;
typedef struct __RFC_STRUCT rfc_bleRadioOp_s rfc_bleRadioOp_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_SLAVE_s rfc_CMD_BLE_SLAVE_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_MASTER_s rfc_CMD_BLE_MASTER_t;
typedef struct __RFC_STRUCT rfc_bleWhiteListEntry_s rfc_bleWhiteListEntry_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_ADV_s rfc_CMD_BLE_ADV_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_ADV_DIR_s rfc_CMD_BLE_ADV_DIR_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_ADV_NC_s rfc_CMD_BLE_ADV_NC_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_ADV_SCAN_s rfc_CMD_BLE_ADV_SCAN_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_SCANNER_s rfc_CMD_BLE_SCANNER_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_INITIATOR_s rfc_CMD_BLE_INITIATOR_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_GENERIC_RX_s rfc_CMD_BLE_GENERIC_RX_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_TX_TEST_s rfc_CMD_BLE_TX_TEST_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_ADV_PAYLOAD_s rfc_CMD_BLE_ADV_PAYLOAD_t;
typedef struct __RFC_STRUCT rfc_bleMasterSlavePar_s rfc_bleMasterSlavePar_t;
typedef struct __RFC_STRUCT rfc_bleMasterPar_s rfc_bleMasterPar_t;
typedef struct __RFC_STRUCT rfc_bleSlavePar_s rfc_bleSlavePar_t;
typedef struct __RFC_STRUCT rfc_bleAdvPar_s rfc_bleAdvPar_t;
typedef struct __RFC_STRUCT rfc_bleScannerPar_s rfc_bleScannerPar_t;
typedef struct __RFC_STRUCT rfc_bleInitiatorPar_s rfc_bleInitiatorPar_t;
typedef struct __RFC_STRUCT rfc_bleGenericRxPar_s rfc_bleGenericRxPar_t;
typedef struct __RFC_STRUCT rfc_bleTxTestPar_s rfc_bleTxTestPar_t;
typedef struct __RFC_STRUCT rfc_bleInitiatorOutput_s rfc_bleInitiatorOutput_t;
typedef struct __RFC_STRUCT rfc_bleWhiteListEntryWords_s rfc_bleWhiteListEntryWords_t;
typedef struct __RFC_STRUCT rfc_bleMasterSlaveOutput_s rfc_bleMasterSlaveOutput_t;
typedef struct __RFC_STRUCT rfc_bleRxStatus_s rfc_bleRxStatus_t;
typedef struct __RFC_STRUCT rfc_bleRadioOp_s rfc_bleRadioOp_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_ADV_NC_s rfc_CMD_BLE_ADV_NC_t;
typedef struct __RFC_STRUCT rfc_bleTxTestOutput_s rfc_bleTxTestOutput_t;
typedef struct __RFC_STRUCT rfc_bleAdvPar_s rfc_bleAdvPar_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_ADV_SCAN_s rfc_CMD_BLE_ADV_SCAN_t;
typedef struct __RFC_STRUCT rfc_bleAdvOutput_s rfc_bleAdvOutput_t;
typedef struct __RFC_STRUCT rfc_bleScannerOutput_s rfc_bleScannerOutput_t;
typedef struct __RFC_STRUCT rfc_bleSlavePar_s rfc_bleSlavePar_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_ADV_DIR_s rfc_CMD_BLE_ADV_DIR_t;
typedef struct __RFC_STRUCT rfc_bleInitiatorPar_s rfc_bleInitiatorPar_t;
typedef struct __RFC_STRUCT rfc_bleScannerPar_s rfc_bleScannerPar_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_SLAVE_s rfc_CMD_BLE_SLAVE_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_ADV_s rfc_CMD_BLE_ADV_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_SCANNER_s rfc_CMD_BLE_SCANNER_t;
typedef struct __RFC_STRUCT rfc_bleInitiatorOutput_s rfc_bleInitiatorOutput_t;
typedef struct __RFC_STRUCT rfc_bleGenericRxOutput_s rfc_bleGenericRxOutput_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_GENERIC_RX_s rfc_CMD_BLE_GENERIC_RX_t;
typedef struct __RFC_STRUCT rfc_CMD_BLE_ADV_PAYLOAD_s rfc_CMD_BLE_ADV_PAYLOAD_t;
typedef struct __RFC_STRUCT rfc_bleTxTestOutput_s rfc_bleTxTestOutput_t;
typedef struct __RFC_STRUCT rfc_bleWhiteListEntry_s rfc_bleWhiteListEntry_t;
typedef struct __RFC_STRUCT rfc_bleRxStatus_s rfc_bleRxStatus_t;
//! \addtogroup bleRadioOp
//! @{
@ -1079,4 +1078,4 @@ struct __RFC_STRUCT rfc_bleRxStatus_s {
//! @}
//! @}
#endif
#endif /* BLE_CMD_H_ */

View file

@ -7,6 +7,7 @@
*
* Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -36,62 +37,11 @@
*
******************************************************************************/
#ifndef _BLE_MAILBOX_H
#define _BLE_MAILBOX_H
#include "mailbox.h"
/// \name CPE interrupt definitions for BLE
/// Interrupt masks for the CPE interrupt in RDBELL. These are new names for interrupts in mailbox.h,
/// used for compartibility with previous versions with separate interrupt numbers.
///@{
#define IRQN_BLE_TX_DONE IRQN_TX_DONE
#define IRQN_BLE_TX_ACK IRQN_TX_ACK
#define IRQN_BLE_TX_CTRL IRQN_TX_CTRL
#define IRQN_BLE_TX_CTRL_ACK IRQN_TX_CTRL_ACK
#define IRQN_BLE_TX_CTRL_ACK_ACK IRQN_TX_CTRL_ACK_ACK
#define IRQN_BLE_TX_RETRANS IRQN_TX_RETRANS
#define IRQN_BLE_TX_ENTRY_DONE IRQN_TX_ENTRY_DONE
#define IRQN_BLE_TX_BUFFER_CHANGED IRQN_TX_BUFFER_CHANGED
#define IRQN_BLE_RX_OK IRQN_RX_OK
#define IRQN_BLE_RX_NOK IRQN_RX_NOK
#define IRQN_BLE_RX_IGNORED IRQN_RX_IGNORED
#define IRQN_BLE_RX_EMPTY IRQN_RX_EMPTY
#define IRQN_BLE_RX_CTRL IRQN_RX_CTRL
#define IRQN_BLE_RX_CTRL_ACK IRQN_RX_CTRL_ACK
#define IRQN_BLE_RX_BUF_FULL IRQN_RX_BUF_FULL
#define IRQN_BLE_RX_ENTRY_DONE IRQN_RX_ENTRY_DONE
#define IRQ_BLE_TX_DONE (1U << IRQN_BLE_TX_DONE)
#define IRQ_BLE_TX_ACK (1U << IRQN_BLE_TX_ACK)
#define IRQ_BLE_TX_CTRL (1U << IRQN_BLE_TX_CTRL)
#define IRQ_BLE_TX_CTRL_ACK (1U << IRQN_BLE_TX_CTRL_ACK)
#define IRQ_BLE_TX_CTRL_ACK_ACK (1U << IRQN_BLE_TX_CTRL_ACK_ACK)
#define IRQ_BLE_TX_RETRANS (1U << IRQN_BLE_TX_RETRANS)
#define IRQ_BLE_TX_ENTRY_DONE (1U << IRQN_BLE_TX_ENTRY_DONE)
#define IRQ_BLE_TX_BUFFER_CHANGED (1U << IRQN_BLE_TX_BUFFER_CHANGED)
#define IRQ_BLE_RX_OK (1U << IRQN_BLE_RX_OK)
#define IRQ_BLE_RX_NOK (1U << IRQN_BLE_RX_NOK)
#define IRQ_BLE_RX_IGNORED (1U << IRQN_BLE_RX_IGNORED)
#define IRQ_BLE_RX_EMPTY (1U << IRQN_BLE_RX_EMPTY)
#define IRQ_BLE_RX_CTRL (1U << IRQN_BLE_RX_CTRL)
#define IRQ_BLE_RX_CTRL_ACK (1U << IRQN_BLE_RX_CTRL_ACK)
#define IRQ_BLE_RX_BUF_FULL (1U << IRQN_BLE_RX_BUF_FULL)
#define IRQ_BLE_RX_ENTRY_DONE (1U << IRQN_BLE_RX_ENTRY_DONE)
///@}
#ifndef BLE_MAILBOX_H_
#define BLE_MAILBOX_H_
/// \name Radio operation status
/// Radio operation status format:
/// Bits 15:12: Protocol
/// 0001: BLE
/// Bits 11:10: Type
/// 00: Not finished
/// 01: Done successfully
/// 10: Done with error
/// Bits 9:0: Identifier
///@{
/// \name Operation finished normally
///@{
#define BLE_DONE_OK 0x1400 ///< Operation ended normally
@ -116,4 +66,4 @@
///@}
///@}
#endif
#endif /* BLE_MAILBOX_H_ */

View file

@ -1,44 +1,43 @@
/******************************************************************************
* Filename: common_cmd.h
* Revised: $ $
* Revision: $ $
* Revised: 2015-08-04 10:40:45 +0200 (Tue, 04 Aug 2015)
* Revision: 44326
*
* Description: CC26xx API for common/generic commands
*
* Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
* Description: CC13xx API for common/generic commands
*
* Copyright (c) 2015, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 2) Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* 3) Neither the name of the ORGANIZATION nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
#ifndef __COMMON_CMD_H
#define __COMMON_CMD_H
#ifndef COMMON_CMD_H_
#define COMMON_CMD_H_
#ifndef __RFC_STRUCT
#ifdef __GNUC__
@ -57,74 +56,47 @@
#include <stdint.h>
#include "mailbox.h"
typedef struct __RFC_STRUCT rfc_CMD_FG_SCH_IMM_s rfc_CMD_FG_SCH_IMM_t;
typedef struct __RFC_STRUCT rfc_CMD_WRITE_FWPAR_s rfc_CMD_WRITE_FWPAR_t;
typedef struct __RFC_STRUCT rfc_CMD_TX_TEST_s rfc_CMD_TX_TEST_t;
typedef struct __RFC_STRUCT rfc_CMD_RX_TEST_s rfc_CMD_RX_TEST_t;
typedef struct __RFC_STRUCT rfc_CMD_FS_POWERDOWN_s rfc_CMD_FS_POWERDOWN_t;
typedef struct __RFC_STRUCT rfc_CMD_DISARM_RAT_CH_s rfc_CMD_DISARM_RAT_CH_t;
typedef struct __RFC_STRUCT rfc_CMD_SCH_IMM_s rfc_CMD_SCH_IMM_t;
typedef struct __RFC_STRUCT rfc_CMD_ANALOG_POWERDOWN_s rfc_CMD_ANALOG_POWERDOWN_t;
typedef struct __RFC_STRUCT rfc_CMD_SET_RAT_CMP_s rfc_CMD_SET_RAT_CMP_t;
typedef struct __RFC_STRUCT rfc_CMD_FS_OFF_s rfc_CMD_FS_OFF_t;
typedef struct __RFC_STRUCT rfc_CMD_ENABLE_DBG_s rfc_CMD_ENABLE_DBG_t;
typedef struct __RFC_STRUCT rfc_CMD_CLEAR_RX_s rfc_CMD_CLEAR_RX_t;
typedef struct __RFC_STRUCT rfc_CMD_FS_s rfc_CMD_FS_t;
typedef struct __RFC_STRUCT rfc_CMD_FG_COUNT_BRANCH_s rfc_CMD_FG_COUNT_BRANCH_t;
typedef struct __RFC_STRUCT rfc_CMD_GET_FW_INFO_s rfc_CMD_GET_FW_INFO_t;
typedef struct __RFC_STRUCT rfc_CMD_TOPSM_COPY_s rfc_CMD_TOPSM_COPY_t;
typedef struct __RFC_STRUCT rfc_CMD_USER_FUN_s rfc_CMD_USER_FUN_t;
typedef struct __RFC_STRUCT rfc_command_s rfc_command_t;
typedef struct __RFC_STRUCT rfc_CMD_WRITE_ADI0REG_s rfc_CMD_WRITE_ADI0REG_t;
typedef struct __RFC_STRUCT rfc_CMD_FS_POWERUP_s rfc_CMD_FS_POWERUP_t;
typedef struct __RFC_STRUCT rfc_radioOp_s rfc_radioOp_t;
typedef struct __RFC_STRUCT rfc_CMD_NOP_s rfc_CMD_NOP_t;
typedef struct __RFC_STRUCT rfc_CMD_RADIO_SETUP_s rfc_CMD_RADIO_SETUP_t;
typedef struct __RFC_STRUCT rfc_CMD_FS_s rfc_CMD_FS_t;
typedef struct __RFC_STRUCT rfc_CMD_FS_OFF_s rfc_CMD_FS_OFF_t;
typedef struct __RFC_STRUCT rfc_CMD_RX_s rfc_CMD_RX_t;
typedef struct __RFC_STRUCT rfc_CMD_TX_s rfc_CMD_TX_t;
typedef struct __RFC_STRUCT rfc_CMD_RX_TEST_s rfc_CMD_RX_TEST_t;
typedef struct __RFC_STRUCT rfc_CMD_TX_TEST_s rfc_CMD_TX_TEST_t;
typedef struct __RFC_STRUCT rfc_CMD_SYNC_STOP_RAT_s rfc_CMD_SYNC_STOP_RAT_t;
typedef struct __RFC_STRUCT rfc_CMD_ADD_DATA_ENTRY_s rfc_CMD_ADD_DATA_ENTRY_t;
typedef struct __RFC_STRUCT rfc_CMD_FG_COUNT_s rfc_CMD_FG_COUNT_t;
typedef struct __RFC_STRUCT rfc_CMD_MEMCPY_s rfc_CMD_MEMCPY_t;
typedef struct __RFC_STRUCT rfc_CMD_SET_RAT_CPT_s rfc_CMD_SET_RAT_CPT_t;
typedef struct __RFC_STRUCT rfc_CMD_DISABLE_DBG_s rfc_CMD_DISABLE_DBG_t;
typedef struct __RFC_STRUCT rfc_CMD_SYNC_START_RAT_s rfc_CMD_SYNC_START_RAT_t;
typedef struct __RFC_STRUCT rfc_CMD_COUNT_s rfc_CMD_COUNT_t;
typedef struct __RFC_STRUCT rfc_CMD_PATTERN_CHECK_s rfc_CMD_PATTERN_CHECK_t;
typedef struct __RFC_STRUCT rfc_CMD_MODIFY_RFREG_s rfc_CMD_MODIFY_RFREG_t;
typedef struct __RFC_STRUCT rfc_CMD_REMOVE_PENDING_ENTRIES_s rfc_CMD_REMOVE_PENDING_ENTRIES_t;
typedef struct __RFC_STRUCT rfc_CMD_UPDATE_RADIO_SETUP_s rfc_CMD_UPDATE_RADIO_SETUP_t;
typedef struct __RFC_STRUCT rfc_CMD_NOP_s rfc_CMD_NOP_t;
typedef struct __RFC_STRUCT rfc_CMD_STOP_s rfc_CMD_STOP_t;
typedef struct __RFC_STRUCT rfc_CMD_TRIGGER_s rfc_CMD_TRIGGER_t;
typedef struct __RFC_STRUCT rfc_CMD_SET_TRIM_s rfc_CMD_SET_TRIM_t;
typedef struct __RFC_STRUCT rfc_CMD_UPDATE_BAW_FREQ_s rfc_CMD_UPDATE_BAW_FREQ_t;
typedef struct __RFC_STRUCT rfc_CMD_READ_FWPAR_s rfc_CMD_READ_FWPAR_t;
typedef struct __RFC_STRUCT rfc_CMD_REMOVE_DATA_ENTRY_s rfc_CMD_REMOVE_DATA_ENTRY_t;
typedef struct __RFC_STRUCT rfc_CMD_UPDATE_FS_s rfc_CMD_UPDATE_FS_t;
typedef struct __RFC_STRUCT rfc_CMD_ARM_RAT_CH_s rfc_CMD_ARM_RAT_CH_t;
typedef struct __RFC_STRUCT rfc_CMD_WRITE_RFREG_s rfc_CMD_WRITE_RFREG_t;
typedef struct __RFC_STRUCT rfc_CMD_SET_TX_SHAPE_s rfc_CMD_SET_TX_SHAPE_t;
typedef struct __RFC_STRUCT rfc_CMD_READ_ADI1REG_s rfc_CMD_READ_ADI1REG_t;
typedef struct __RFC_STRUCT rfc_CMD_WRITE_ADDR_s rfc_CMD_WRITE_ADDR_t;
typedef struct __RFC_STRUCT rfc_CMD_PING_s rfc_CMD_PING_t;
typedef struct __RFC_STRUCT rfc_CMD_SET_RAT_OUTPUT_s rfc_CMD_SET_RAT_OUTPUT_t;
typedef struct __RFC_STRUCT rfc_CMD_DISABLE_RAT_CH_s rfc_CMD_DISABLE_RAT_CH_t;
typedef struct __RFC_STRUCT rfc_CMD_GET_RSSI_s rfc_CMD_GET_RSSI_t;
typedef struct __RFC_STRUCT rfc_CMD_MEMSET_s rfc_CMD_MEMSET_t;
typedef struct __RFC_STRUCT rfc_CMD_FS_POWERUP_s rfc_CMD_FS_POWERUP_t;
typedef struct __RFC_STRUCT rfc_CMD_FS_POWERDOWN_s rfc_CMD_FS_POWERDOWN_t;
typedef struct __RFC_STRUCT rfc_CMD_SCH_IMM_s rfc_CMD_SCH_IMM_t;
typedef struct __RFC_STRUCT rfc_CMD_COUNT_BRANCH_s rfc_CMD_COUNT_BRANCH_t;
typedef struct __RFC_STRUCT rfc_CMD_PATTERN_CHECK_s rfc_CMD_PATTERN_CHECK_t;
typedef struct __RFC_STRUCT rfc_CMD_TX_POWER_BOOST_s rfc_CMD_TX_POWER_BOOST_t;
typedef struct __RFC_STRUCT rfc_CMD_ABORT_s rfc_CMD_ABORT_t;
typedef struct __RFC_STRUCT rfc_CMD_TX_s rfc_CMD_TX_t;
typedef struct __RFC_STRUCT rfc_radioOp_s rfc_radioOp_t;
typedef struct __RFC_STRUCT rfc_CMD_FORCE_CLK_ENA_s rfc_CMD_FORCE_CLK_ENA_t;
typedef struct __RFC_STRUCT rfc_CMD_STOP_s rfc_CMD_STOP_t;
typedef struct __RFC_STRUCT rfc_CMD_GET_RSSI_s rfc_CMD_GET_RSSI_t;
typedef struct __RFC_STRUCT rfc_CMD_UPDATE_RADIO_SETUP_s rfc_CMD_UPDATE_RADIO_SETUP_t;
typedef struct __RFC_STRUCT rfc_CMD_TRIGGER_s rfc_CMD_TRIGGER_t;
typedef struct __RFC_STRUCT rfc_CMD_GET_FW_INFO_s rfc_CMD_GET_FW_INFO_t;
typedef struct __RFC_STRUCT rfc_CMD_START_RAT_s rfc_CMD_START_RAT_t;
typedef struct __RFC_STRUCT rfc_CMD_READ_RFREG_s rfc_CMD_READ_RFREG_t;
typedef struct __RFC_STRUCT rfc_CMD_RX_s rfc_CMD_RX_t;
typedef struct __RFC_STRUCT rfc_CMD_FG_PATTERN_CHECK_s rfc_CMD_FG_PATTERN_CHECK_t;
typedef struct __RFC_STRUCT rfc_CMD_SET_TX_POWER_s rfc_CMD_SET_TX_POWER_t;
typedef struct __RFC_STRUCT rfc_CMD_BUS_REQUEST_s rfc_CMD_BUS_REQUEST_t;
typedef struct __RFC_STRUCT rfc_CMD_READ_TRIM_s rfc_CMD_READ_TRIM_t;
typedef struct __RFC_STRUCT rfc_CMD_READ_ADI0REG_s rfc_CMD_READ_ADI0REG_t;
typedef struct __RFC_STRUCT rfc_CMD_WRITE_ADI1REG_s rfc_CMD_WRITE_ADI1REG_t;
typedef struct __RFC_STRUCT rfc_CMD_RADIO_SETUP_s rfc_CMD_RADIO_SETUP_t;
typedef struct __RFC_STRUCT rfc_CMD_READ_FS_CAL_s rfc_CMD_READ_FS_CAL_t;
typedef struct __RFC_STRUCT rfc_CMD_FG_NOP_s rfc_CMD_FG_NOP_t;
typedef struct __RFC_STRUCT rfc_CMD_PING_s rfc_CMD_PING_t;
typedef struct __RFC_STRUCT rfc_CMD_ADD_DATA_ENTRY_s rfc_CMD_ADD_DATA_ENTRY_t;
typedef struct __RFC_STRUCT rfc_CMD_REMOVE_DATA_ENTRY_s rfc_CMD_REMOVE_DATA_ENTRY_t;
typedef struct __RFC_STRUCT rfc_CMD_FLUSH_QUEUE_s rfc_CMD_FLUSH_QUEUE_t;
typedef struct __RFC_STRUCT rfc_CMD_CLEAR_RX_s rfc_CMD_CLEAR_RX_t;
typedef struct __RFC_STRUCT rfc_CMD_REMOVE_PENDING_ENTRIES_s rfc_CMD_REMOVE_PENDING_ENTRIES_t;
typedef struct __RFC_STRUCT rfc_CMD_SET_RAT_CMP_s rfc_CMD_SET_RAT_CMP_t;
typedef struct __RFC_STRUCT rfc_CMD_SET_RAT_CPT_s rfc_CMD_SET_RAT_CPT_t;
typedef struct __RFC_STRUCT rfc_CMD_DISABLE_RAT_CH_s rfc_CMD_DISABLE_RAT_CH_t;
typedef struct __RFC_STRUCT rfc_CMD_SET_RAT_OUTPUT_s rfc_CMD_SET_RAT_OUTPUT_t;
typedef struct __RFC_STRUCT rfc_CMD_ARM_RAT_CH_s rfc_CMD_ARM_RAT_CH_t;
typedef struct __RFC_STRUCT rfc_CMD_DISARM_RAT_CH_s rfc_CMD_DISARM_RAT_CH_t;
typedef struct __RFC_STRUCT rfc_CMD_SET_TX_POWER_s rfc_CMD_SET_TX_POWER_t;
typedef struct __RFC_STRUCT rfc_CMD_UPDATE_FS_s rfc_CMD_UPDATE_FS_t;
typedef struct __RFC_STRUCT rfc_CMD_BUS_REQUEST_s rfc_CMD_BUS_REQUEST_t;
//! \addtogroup command
//! @{
@ -217,37 +189,27 @@ struct __RFC_STRUCT rfc_CMD_RADIO_SETUP_s {
//!< 0x06: ANT<br>
//!< 0xFF: Keep existing mode; update overrides only<br>
//!< Others: <i>Reserved</i>
uint8_t __dummy0;
uint8_t loDivider; //!< \brief LO divider setting to use. Supported values: 0 (equivalent to 2), 2, 5, 6, 10, 12, 15,
//!< and 30.<br>
//!< Value of 0 or 2 only supported for devices that support 2.4 GHz operation
struct {
uint16_t frontEndMode:3; //!< \brief 0x00: Differential mode<br>
//!< 0x01: Single-ended mode RFP<br>
//!< 0x02: Single-ended mode RFN<br>
//!< 0x03: Antenna diversity (start RFP)<br>
//!< 0x04: Antenna diversity (start RFN)<br>
//!< 0x05 Single-ended mode RFP with external frontend control on RF pins<br>
//!< 0x06 Single-ended mode RFN with external frontend control on RF pins<br>
//!< 0x05 Single-ended mode RFP with external frontend control on RF pins (RFN and RXTX)<br>
//!< 0x06 Single-ended mode RFN with external frontend control on RF pins (RFP and RXTX)<br>
//!< Others: <i>Reserved</i>
uint16_t biasMode:1; //!< \brief 0: Internal bias<br>
//!< 1: External bias
uint16_t bNoAdi0Setup:1; //!< \brief 0: Program ADI 0 with default values<br>
//!< 1: Do not program ADI 0
uint16_t bNoAdi0Trim:1; //!< \brief 0: Apply trim values to ADI 0<br>
//!< 1: Use default values for ADI 0
uint16_t bNoAdi0Ovr:1; //!< \brief 0: Apply ADI 0 overrides<br>
//!< 1: Ignore ADI 0 overrides
uint16_t bNoAdi1Setup:1; //!< \brief 0: Program ADI 1 with default values<br>
//!< 1: Do not program ADI 1
uint16_t bNoAdi1Trim:1; //!< \brief 0: Apply trim values to ADI 1<br>
//!< 1: Use default values for ADI 1
uint16_t bNoAdi1Ovr:1; //!< \brief 0: Apply ADI 1 overrides<br>
//!< 1: Ignore ADI 1 overrides
uint16_t :6;
uint16_t bNoFsPowerUp:1; //!< \brief 0: Power up frequency synth<br>
//!< 1: Do not power up frequency synth
} config; //!< Configuration options
struct {
uint16_t IB:6; //!< Value to write to the PA power control field at 25 &deg;C
uint16_t GC:2; //!< Value to write to the gain control of the 1st stage of the PA
uint16_t tempCoeff:8; //!< Temperature coefficient for IB. 0: No temperature compensation
uint16_t boost:1; //!< Value of boost bit in synth
uint16_t tempCoeff:7; //!< Temperature coefficient for IB. 0: No temperature compensation
} txPower; //!< Transmit power
uint32_t* pRegOverride; //!< \brief Pointer to a list of hardware and configuration registers to override. If NULL, no
//!< override is used.
@ -282,20 +244,10 @@ struct __RFC_STRUCT rfc_CMD_FS_s {
struct {
uint8_t bTxMode:1; //!< \brief 0: Start synth in Rx mode<br>
//!< 1: Start synth in Tx mode
uint8_t refFreq:6; //!< <i>Reserved</i>
uint8_t refFreq:6; //!< \brief 0: Use default reference frequency<br>
//!< Others: Use reference frequency 24 MHz/<code>refFreq</code>
} synthConf;
struct {
uint8_t bOverrideCalib:1; //!< \brief 0: Use standard calibration settings (ignore calibration settings given in command)<br>
//!< 1: Override calibration settings
uint8_t bSkipTdcCalib:1; //!< \brief 0: Perform TDC calibration<br>
//!< 1: Skip TDC calibration
uint8_t bSkipCoarseCalib:1; //!< \brief 0: Perform coarse calibration<br>
//!< 1: Skip coarse calibration
uint8_t bSkipMidCalib:1; //!< \brief 0: Perform mid calibration<br>
//!< 1: Skip mid calibration
uint8_t coarsePrecal:4; //!< \brief Coarse pre-calibration value to use when <code>bOverrideCalib</code> and
//!< <code>bSkipCoarseCalib</code> are both 1
} calibConf;
uint8_t __dummy0;
uint8_t midPrecal; //!< Mid pre-calibration value to use when <code>bOverrideCalib</code> and <code>bSkipCoarseCalib</code> are both 1
uint8_t ktPrecal; //!< KT pre-calibration value to use when <code>bOverrideCalib</code> and <code>bSkipCoarseCalib</code> are both 1
uint16_t tdcPrecal; //!< TDC pre-calibration value to use when <code>bOverrideCalib</code> and <code>bSkipCoarseCalib</code> are both 1
@ -780,6 +732,41 @@ struct __RFC_STRUCT rfc_CMD_PATTERN_CHECK_s {
//! @}
//! \addtogroup CMD_TX_POWER_BOOST
//! @{
#define CMD_TX_POWER_BOOST 0x0816
struct __RFC_STRUCT rfc_CMD_TX_POWER_BOOST_s {
uint16_t commandNo; //!< The command ID number 0x0816
uint16_t status; //!< \brief An integer telling the status of the command. This value is
//!< updated by the radio CPU during operation and may be read by the
//!< system CPU at any time.
rfc_radioOp_t *pNextOp; //!< Pointer to the next operation to run after this operation is done
ratmr_t startTime; //!< Absolute or relative start time (depending on the value of <code>startTrigger</code>)
struct {
uint8_t triggerType:4; //!< The type of trigger
uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command<br>
//!< 1: CMD_TRIGGER can be used as an alternative trigger
uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action
uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error<br>
//!< 1: A trigger in the past is triggered as soon as possible
} startTrigger; //!< Identification of the trigger that starts the operation
struct {
uint8_t rule:4; //!< Condition for running next command: Rule for how to proceed
uint8_t nSkip:4; //!< Number of skips if the rule involves skipping
} condition;
uint8_t vddrLevel; //!< \brief VDDR level to set<br>
//!< 0xFD: Trim VDDR voltage to normal level (VDDR_TRIM), nominally 1.68 V<br>
//!< 0xFE: Trim VDDR voltage to high level (VDDR_TRIM_H), nominally 1.85 V<br>
//!< 0xFF: Trim VDDR voltage to higher level (VDDR_TRIM_HH), nominally 1.95 V<br>
//!< Other: reserved
uint8_t paTrimValue; //!< \brief Optional power amplifier trim setting manipulation<br>
//!< 0x00-0x1F: Value to write in ADI_0_RF:PACTL0.TRIM register field<br>
//!< 0xFE: Set PACTL0.TRIM to its default value from FCFG1<br>
//!< 0xFF: Do not write PACTL0.TRIM, use the setting that is already applied<br>
};
//! @}
//! \addtogroup CMD_ABORT
//! @{
#define CMD_ABORT 0x0401
@ -1010,7 +997,8 @@ struct __RFC_STRUCT rfc_CMD_SET_TX_POWER_s {
struct {
uint16_t IB:6; //!< Value to write to the PA power control field at 25 &deg;C
uint16_t GC:2; //!< Value to write to the gain control of the 1st stage of the PA
uint16_t tempCoeff:8; //!< Temperature coefficient for IB. 0: No temperature compensation
uint16_t boost:1; //!< Value of boost bit in synth
uint16_t tempCoeff:7; //!< Temperature coefficient for IB. 0: No temperature compensation
} txPower; //!< New Tx power setting
};
@ -1040,4 +1028,4 @@ struct __RFC_STRUCT rfc_CMD_BUS_REQUEST_s {
//! @}
//! @}
#endif
#endif /* COMMON_CMD_H_ */

View file

@ -0,0 +1,213 @@
/******************************************************************************
* Filename: data_entry.h
* Revised: 2015-08-04 11:44:20 +0200 (Tue, 04 Aug 2015)
* Revision: 44329
*
* Description: Definition of API for data exchange
*
* Copyright (c) 2015, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2) Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3) Neither the name of the ORGANIZATION nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
#ifndef DATA_ENTRY_H_
#define DATA_ENTRY_H_
#ifndef __RFC_STRUCT
#ifdef __GNUC__
#define __RFC_STRUCT __attribute__ ((aligned (4)))
#else
#define __RFC_STRUCT
#endif
#endif
//! \addtogroup rfc
//! @{
//! \addtogroup data_entry
//! @{
#include <stdint.h>
#include "mailbox.h"
typedef struct __RFC_STRUCT rfc_dataEntry_s rfc_dataEntry_t;
typedef struct __RFC_STRUCT rfc_dataEntryGeneral_s rfc_dataEntryGeneral_t;
typedef struct __RFC_STRUCT rfc_dataEntryMulti_s rfc_dataEntryMulti_t;
typedef struct __RFC_STRUCT rfc_dataEntryPointer_s rfc_dataEntryPointer_t;
typedef struct __RFC_STRUCT rfc_dataEntryPartial_s rfc_dataEntryPartial_t;
//! \addtogroup dataEntry
//! @{
struct __RFC_STRUCT rfc_dataEntry_s {
uint8_t* pNextEntry; //!< Pointer to next entry in the queue, NULL if this is the last entry
uint8_t status; //!< Indicates status of entry, including whether it is free for the system CPU to write to
struct {
uint8_t type:2; //!< \brief Type of data entry structure<br>
//!< 0: General data entry <br>
//!< 1: Multi-element Rx entry<br>
//!< 2: Pointer entry<br>
//!< 3: Partial read Rx entry
uint8_t lenSz:2; //!< \brief Size of length word in start of each Rx entry element<br>
//!< 0: No length indicator<br>
//!< 1: One byte length indicator<br>
//!< 2: Two bytes length indicator<br>
//!< 3: <i>Reserved</i>
uint8_t irqIntv:4; //!< \brief For partial read Rx entry only: The number of bytes between interrupt generated
//!< by the radio CPU (0: 16 bytes)
} config;
uint16_t length; //!< \brief For pointer entries: Number of bytes in the data buffer pointed to<br>
//!< For other entries: Number of bytes following this length field
};
//! @}
//! \addtogroup dataEntryGeneral
//! @{
//! General data entry structure (type = 0)
struct __RFC_STRUCT rfc_dataEntryGeneral_s {
uint8_t* pNextEntry; //!< Pointer to next entry in the queue, NULL if this is the last entry
uint8_t status; //!< Indicates status of entry, including whether it is free for the system CPU to write to
struct {
uint8_t type:2; //!< \brief Type of data entry structure<br>
//!< 0: General data entry <br>
//!< 1: Multi-element Rx entry<br>
//!< 2: Pointer entry<br>
//!< 3: Partial read Rx entry
uint8_t lenSz:2; //!< \brief Size of length word in start of each Rx entry element<br>
//!< 0: No length indicator<br>
//!< 1: One byte length indicator<br>
//!< 2: Two bytes length indicator<br>
//!< 3: <i>Reserved</i>
uint8_t irqIntv:4; //!< \brief For partial read Rx entry only: The number of bytes between interrupt generated
//!< by the radio CPU (0: 16 bytes)
} config;
uint16_t length; //!< \brief For pointer entries: Number of bytes in the data buffer pointed to<br>
//!< For other entries: Number of bytes following this length field
uint8_t data; //!< First byte of the data array to be received or transmitted
};
//! @}
//! \addtogroup dataEntryMulti
//! @{
//! Multi-element data entry structure (type = 1)
struct __RFC_STRUCT rfc_dataEntryMulti_s {
uint8_t* pNextEntry; //!< Pointer to next entry in the queue, NULL if this is the last entry
uint8_t status; //!< Indicates status of entry, including whether it is free for the system CPU to write to
struct {
uint8_t type:2; //!< \brief Type of data entry structure<br>
//!< 0: General data entry <br>
//!< 1: Multi-element Rx entry<br>
//!< 2: Pointer entry<br>
//!< 3: Partial read Rx entry
uint8_t lenSz:2; //!< \brief Size of length word in start of each Rx entry element<br>
//!< 0: No length indicator<br>
//!< 1: One byte length indicator<br>
//!< 2: Two bytes length indicator<br>
//!< 3: <i>Reserved</i>
uint8_t irqIntv:4; //!< \brief For partial read Rx entry only: The number of bytes between interrupt generated
//!< by the radio CPU (0: 16 bytes)
} config;
uint16_t length; //!< \brief For pointer entries: Number of bytes in the data buffer pointed to<br>
//!< For other entries: Number of bytes following this length field
uint16_t numElements; //!< Number of entry elements committed in the entry
uint16_t nextIndex; //!< Index to the byte after the last byte of the last entry element committed by the radio CPU
uint8_t rxData; //!< First byte of the data array of received data entry elements
};
//! @}
//! \addtogroup dataEntryPointer
//! @{
//! Pointer data entry structure (type = 2)
struct __RFC_STRUCT rfc_dataEntryPointer_s {
uint8_t* pNextEntry; //!< Pointer to next entry in the queue, NULL if this is the last entry
uint8_t status; //!< Indicates status of entry, including whether it is free for the system CPU to write to
struct {
uint8_t type:2; //!< \brief Type of data entry structure<br>
//!< 0: General data entry <br>
//!< 1: Multi-element Rx entry<br>
//!< 2: Pointer entry<br>
//!< 3: Partial read Rx entry
uint8_t lenSz:2; //!< \brief Size of length word in start of each Rx entry element<br>
//!< 0: No length indicator<br>
//!< 1: One byte length indicator<br>
//!< 2: Two bytes length indicator<br>
//!< 3: <i>Reserved</i>
uint8_t irqIntv:4; //!< \brief For partial read Rx entry only: The number of bytes between interrupt generated
//!< by the radio CPU (0: 16 bytes)
} config;
uint16_t length; //!< \brief For pointer entries: Number of bytes in the data buffer pointed to<br>
//!< For other entries: Number of bytes following this length field
uint8_t* pData; //!< Pointer to data buffer of data to be received ro transmitted
};
//! @}
//! \addtogroup dataEntryPartial
//! @{
//! Partial read data entry structure (type = 3)
struct __RFC_STRUCT rfc_dataEntryPartial_s {
uint8_t* pNextEntry; //!< Pointer to next entry in the queue, NULL if this is the last entry
uint8_t status; //!< Indicates status of entry, including whether it is free for the system CPU to write to
struct {
uint8_t type:2; //!< \brief Type of data entry structure<br>
//!< 0: General data entry <br>
//!< 1: Multi-element Rx entry<br>
//!< 2: Pointer entry<br>
//!< 3: Partial read Rx entry
uint8_t lenSz:2; //!< \brief Size of length word in start of each Rx entry element<br>
//!< 0: No length indicator<br>
//!< 1: One byte length indicator<br>
//!< 2: Two bytes length indicator<br>
//!< 3: <i>Reserved</i>
uint8_t irqIntv:4; //!< \brief For partial read Rx entry only: The number of bytes between interrupt generated
//!< by the radio CPU (0: 16 bytes)
} config;
uint16_t length; //!< \brief For pointer entries: Number of bytes in the data buffer pointed to<br>
//!< For other entries: Number of bytes following this length field
struct {
uint16_t numElements:13; //!< Number of entry elements committed in the entry
uint16_t bEntryOpen:1; //!< 1 if the entry contains an element that is still open for appending data
uint16_t bFirstCont:1; //!< 1 if the first element is a continuation of the last packet from the previous entry
uint16_t bLastCont:1; //!< 1 if the packet in the last element continues in the next entry
} pktStatus;
uint16_t nextIndex; //!< Index to the byte after the last byte of the last entry element committed by the radio CPU
uint8_t rxData; //!< First byte of the data array of received data entry elements
};
//! @}
//! @}
//! @}
#endif /* DATA_ENTRY_H_ */

View file

@ -37,8 +37,8 @@
*
******************************************************************************/
#ifndef __IEEE_CMD_H
#define __IEEE_CMD_H
#ifndef IEEE_CMD_H_
#define IEEE_CMD_H_
#ifndef __RFC_STRUCT
#ifdef __GNUC__
@ -59,23 +59,20 @@
#include "common_cmd.h"
typedef struct __RFC_STRUCT rfc_CMD_IEEE_RX_s rfc_CMD_IEEE_RX_t;
typedef struct __RFC_STRUCT rfc_shortAddrEntry_s rfc_shortAddrEntry_t;
typedef struct __RFC_STRUCT rfc_CMD_IEEE_ED_SCAN_s rfc_CMD_IEEE_ED_SCAN_t;
typedef struct __RFC_STRUCT rfc_CMD_IEEE_TX_s rfc_CMD_IEEE_TX_t;
typedef struct __RFC_STRUCT rfc_CMD_IEEE_CSMA_s rfc_CMD_IEEE_CSMA_t;
typedef struct __RFC_STRUCT rfc_ieeeAuxSecCtrl_s rfc_ieeeAuxSecCtrl_t;
typedef struct __RFC_STRUCT rfc_ieeeRxCorrCrc_s rfc_ieeeRxCorrCrc_t;
typedef struct __RFC_STRUCT rfc_CMD_IEEE_RX_ACK_s rfc_CMD_IEEE_RX_ACK_t;
typedef struct __RFC_STRUCT rfc_CMD_IEEE_ABORT_BG_s rfc_CMD_IEEE_ABORT_BG_t;
typedef struct __RFC_STRUCT rfc_CMD_IEEE_ED_SCAN_s rfc_CMD_IEEE_ED_SCAN_t;
typedef struct __RFC_STRUCT rfc_ieeeMacHdr_s rfc_ieeeMacHdr_t;
typedef struct __RFC_STRUCT rfc_CMD_IEEE_ABORT_FG_s rfc_CMD_IEEE_ABORT_FG_t;
typedef struct __RFC_STRUCT rfc_CMD_IEEE_CCA_REQ_s rfc_CMD_IEEE_CCA_REQ_t;
typedef struct __RFC_STRUCT rfc_CMD_IEEE_SETUP_s rfc_CMD_IEEE_SETUP_t;
typedef struct __RFC_STRUCT rfc_ieeeRxOutput_s rfc_ieeeRxOutput_t;
typedef struct __RFC_STRUCT rfc_CMD_IEEE_MOD_SRC_MATCH_s rfc_CMD_IEEE_MOD_SRC_MATCH_t;
typedef struct __RFC_STRUCT rfc_CMD_IEEE_STOP_FG_s rfc_CMD_IEEE_STOP_FG_t;
typedef struct __RFC_STRUCT rfc_CMD_IEEE_TX_s rfc_CMD_IEEE_TX_t;
typedef struct __RFC_STRUCT rfc_CMD_IEEE_MOD_FILT_s rfc_CMD_IEEE_MOD_FILT_t;
typedef struct __RFC_STRUCT rfc_CMD_IEEE_MOD_CCA_s rfc_CMD_IEEE_MOD_CCA_t;
typedef struct __RFC_STRUCT rfc_CMD_IEEE_MOD_FILT_s rfc_CMD_IEEE_MOD_FILT_t;
typedef struct __RFC_STRUCT rfc_CMD_IEEE_MOD_SRC_MATCH_s rfc_CMD_IEEE_MOD_SRC_MATCH_t;
typedef struct __RFC_STRUCT rfc_CMD_IEEE_ABORT_FG_s rfc_CMD_IEEE_ABORT_FG_t;
typedef struct __RFC_STRUCT rfc_CMD_IEEE_STOP_FG_s rfc_CMD_IEEE_STOP_FG_t;
typedef struct __RFC_STRUCT rfc_CMD_IEEE_CCA_REQ_s rfc_CMD_IEEE_CCA_REQ_t;
typedef struct __RFC_STRUCT rfc_ieeeRxOutput_s rfc_ieeeRxOutput_t;
typedef struct __RFC_STRUCT rfc_shortAddrEntry_s rfc_shortAddrEntry_t;
typedef struct __RFC_STRUCT rfc_ieeeRxCorrCrc_s rfc_ieeeRxCorrCrc_t;
//! \addtogroup CMD_IEEE_RX
//! @{
@ -611,4 +608,4 @@ struct __RFC_STRUCT rfc_ieeeRxCorrCrc_s {
//! @}
//! @}
#endif
#endif /* IEEE_CMD_H_ */

View file

@ -7,6 +7,7 @@
*
* Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -36,47 +37,14 @@
*
******************************************************************************/
#ifndef _IEEE_MAILBOX_H
#define _IEEE_MAILBOX_H
#ifndef IEEE_MAILBOX_H_
#define IEEE_MAILBOX_H_
#include "mailbox.h"
/// \name CPE interrupt definitions for IEEE 802.15.4
/// Interrupt masks for the CPE interrupt in RDBELL. These are new names for interrupts in mailbox.h,
/// used for compartibility with previous versions with separate interrupt numbers.
///@{
#define IRQN_IEEE_BG_COMMAND_SUSPENDED IRQN_BG_COMMAND_SUSPENDED
#define IRQN_IEEE_TX_FRAME IRQN_TX_DONE
#define IRQN_IEEE_TX_ACK IRQN_TX_ACK
#define IRQN_IEEE_RX_FRAME IRQN_RX_OK
#define IRQN_IEEE_RX_NOK IRQN_RX_NOK
#define IRQN_IEEE_RX_IGNORED IRQN_RX_IGNORED
#define IRQN_IEEE_RX_BUF_FULL IRQN_RX_BUF_FULL
#define IRQN_IEEE_RX_ENTRY_DONE IRQN_RX_ENTRY_DONE
#define IRQ_IEEE_BG_COMMAND_SUSPENDED (1U << IRQN_IEEE_BG_COMMAND_SUSPENDED)
#define IRQ_IEEE_TX_FRAME (1U << IRQN_IEEE_TX_FRAME)
#define IRQ_IEEE_TX_ACK (1U << IRQN_IEEE_TX_ACK)
#define IRQ_IEEE_RX_FRAME (1U << IRQN_IEEE_RX_FRAME)
#define IRQ_IEEE_RX_NOK (1U << IRQN_IEEE_RX_NOK)
#define IRQ_IEEE_RX_IGNORED (1U << IRQN_IEEE_RX_IGNORED)
#define IRQ_IEEE_RX_BUF_FULL (1U << IRQN_IEEE_RX_BUF_FULL)
#define IRQ_IEEE_RX_ENTRY_DONE (1U << IRQN_IEEE_RX_ENTRY_DONE)
///@}
/// \name Radio operation status
/// Radio operation status format:
/// Bits 15:12: Protocol
/// 0010: IEEE 802.15.4
/// Bits 11:10: Type
/// 00: Not finished
/// 01: Done successfully
/// 10: Done with error
/// Bits 9:0: Identifier
///@{
/// \name Operation not finished
///@{
#define IEEE_SUSPENDED 0x2001 ///< Operation suspended
@ -104,4 +72,4 @@
///@}
///@}
#endif
#endif /* IEEE_MAILBOX_H_ */

View file

@ -1,43 +1,43 @@
/******************************************************************************
* Filename: mailbox.h
* Revised: $ $
* Revision: $ $
* Revised: 2015-06-29 12:59:58 +0200 (Mon, 29 Jun 2015)
* Revision: 44063
*
* Description: Definitions for interface between system and radio CPU
*
* Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2015, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 2) Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* 3) Neither the name of the ORGANIZATION nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
#ifndef _MAILBOX_H
#define _MAILBOX_H
#ifndef MAILBOX_H_
#define MAILBOX_H_
#include <stdint.h>
#include <string.h>
@ -70,7 +70,6 @@ typedef struct {
#define IRQN_TX_RETRANS 9 ///< Packet retransmitted
#define IRQN_TX_ENTRY_DONE 10 ///< Tx queue data entry state changed to Finished
#define IRQN_TX_BUFFER_CHANGED 11 ///< A buffer change is complete
#define IRQN_BG_COMMAND_SUSPENDED 12 ///< A background level radio operation command has been suspended
#define IRQN_RX_OK 16 ///< Packet received with CRC OK, payload, and not to be ignored
#define IRQN_RX_NOK 17 ///< Packet received with CRC error
#define IRQN_RX_IGNORED 18 ///< Packet received with CRC OK, but to be ignored
@ -82,6 +81,7 @@ typedef struct {
#define IRQN_RX_DATA_WRITTEN 24 ///< Data written to partial read Rx buffer
#define IRQN_RX_N_DATA_WRITTEN 25 ///< Specified number of bytes written to partial read Rx buffer
#define IRQN_RX_ABORTED 26 ///< Packet reception stopped before packet was done
#define IRQN_RX_COLLISION_DETECTED 27 ///< A collision was indicated during packet reception
#define IRQN_SYNTH_NO_LOCK 28 ///< The synth has gone out of lock after calibration
#define IRQN_MODULES_UNLOCKED 29 ///< As part of the boot process, the CM0 has opened access to RF core modules and memories
#define IRQN_BOOT_DONE 30 ///< The RF core CPU boot is finished
@ -103,8 +103,6 @@ typedef struct {
#define IRQ_TX_ENTRY_DONE (1U << IRQN_TX_ENTRY_DONE)
#define IRQ_TX_BUFFER_CHANGED (1U << IRQN_TX_BUFFER_CHANGED)
#define IRQ_BG_COMMAND_SUSPENDED (1U << IRQN_BG_COMMAND_SUSPENDED)
#define IRQ_RX_OK (1U << IRQN_RX_OK)
#define IRQ_RX_NOK (1U << IRQN_RX_NOK)
#define IRQ_RX_IGNORED (1U << IRQN_RX_IGNORED)
@ -116,7 +114,7 @@ typedef struct {
#define IRQ_RX_DATA_WRITTEN (1U << IRQN_RX_DATA_WRITTEN)
#define IRQ_RX_N_DATA_WRITTEN (1U << IRQN_RX_N_DATA_WRITTEN)
#define IRQ_RX_ABORTED (1U << IRQN_RX_ABORTED)
#define IRQ_RX_COLLISION_DETECTED (1U << IRQN_RX_COLLISION_DETECTED)
#define IRQ_SYNTH_NO_LOCK (1U << IRQN_SYNTH_NO_LOCK)
#define IRQ_MODULES_UNLOCKED (1U << IRQN_MODULES_UNLOCKED)
#define IRQ_BOOT_DONE (1U << IRQN_BOOT_DONE)
@ -131,7 +129,7 @@ typedef struct {
#define CMDSTA_Pending 0x00 ///< The command has not yet been parsed
#define CMDSTA_Done 0x01 ///< Command successfully parsed
#define CMDSTA_IllegalPointer 0x81 ///< The pointer signaled in CMDR is not valid
#define CMDSTA_IllegalPointer 0x81 ///< The pointer signalled in CMDR is not valid
#define CMDSTA_UnknownCommand 0x82 ///< The command number in the command structure is unknown
#define CMDSTA_UnknownDirCommand 0x83 ///< The command number for a direct command is unknown, or the
///< command is not a direct command
@ -147,248 +145,6 @@ typedef struct {
///< was busy
///@}
/// \name Macros for use with command definition files
/// The script create_command.pl generates header files from command and structure definitions in the
/// *_def.txt files. These are the macros to access the definitions
///@{
/// Get a field from a structure
//
/// Gets a field from a structure defined in a _def.txt file. This may be used both in assignments and
/// references (e.g. GET_FIELD(pCmd1, CMD_TEST, testParam) = GET_FIELD(pCmd2, CMD_DUMMY, dummyParam);)
/// \param[in] ptr
/// Pointer to the structure
/// \param[in] cmd
/// Name of the command or structure as defined in the _def.txt file
/// \param[in] field
/// Name of the accessed field as defined in the _def.txt file
///
#define GET_FIELD(ptr, cmd, field) \
(*((_TYPE_##cmd##_##field *) (((uint8_t *)(ptr)) + (_POSITION_##cmd##_##field))))
/// Get a field from a structure, reading as volatile
//
/// Gets a field from a structure defined in a _def.txt file, reading it as a volatile parameter, which
/// takes into account that it may be changed by the other side. This may be used both in assignments and
/// references (e.g. GET_FIELD(pCmd1, CMD_TEST, testParam) = GET_FIELD(pCmd2, CMD_DUMMY, dummyParam);)
/// \param[in] ptr
/// Pointer to the structure
/// \param[in] cmd
/// Name of the command or structure as defined in the _def.txt file
/// \param[in] field
/// Name of the accessed field as defined in the _def.txt file
///
#define GET_FIELD_V(ptr, cmd, field) \
(*((volatile _TYPE_##cmd##_##field *) (((uint8_t *)(ptr)) + (_POSITION_##cmd##_##field))))
/// Get the pointer to a field from a structure
//
/// Gets the pointer to a field from a structure defined in a _def.txt file.
/// \param[in] ptr
/// Pointer to the structure
/// \param[in] cmd
/// Name of the command or structure as defined in the _def.txt file
/// \param[in] field
/// Name of the accessed field as defined in the _def.txt file
///
#define GET_FIELD_PTR(ptr, cmd, field) \
((_TYPE_##cmd##_##field *) (((uint8_t *)(ptr)) + (_POSITION_##cmd##_##field)))
/// Get the volatile pointer to a field from a structure
//
/// Gets the volatile pointer to a field from a structure defined in a _def.txt file.
/// \param[in] ptr
/// Pointer to the structure
/// \param[in] cmd
/// Name of the command or structure as defined in the _def.txt file
/// \param[in] field
/// Name of the accessed field as defined in the _def.txt file
///
#define GET_FIELD_VPTR(ptr, cmd, field) \
((volatile _TYPE_##cmd##_##field *) (((uint8_t *)(ptr)) + (_POSITION_##cmd##_##field)))
/// Get bits from a bit field
//
/// Returns bits from a bit field defined in a _def.txt file.
/// \param[in] value
/// The value of the entire field that contains the bit field
/// \param[in] cmd
/// Name of the command or structure as defined in the _def.txt file
/// \param[in] field
/// Name of the field that contains the bit field definition as defined in the _def.txt file
/// \param[in] bitfield
/// Name of the bitfield as defined in the _def.txt file
///
#define GET_BITS(value, cmd, field, bitfield) \
(((value) >> (_BITPOS_##cmd##_##field##_##bitfield)) & \
((1U << (_NBITS_##cmd##_##field##_##bitfield)) - 1))
/// Get bits from a bit field as a signed value
//
/// Returns sign extended bits from a bit field defined in a _def.txt file.
/// \param[in] value
/// The value of the entire field that contains the bit field
/// \param[in] cmd
/// Name of the command or structure as defined in the _def.txt file
/// \param[in] field
/// Name of the field that contains the bit field definition as defined in the _def.txt file
/// \param[in] bitfield
/// Name of the bitfield as defined in the _def.txt file
///
#define GET_BITS_S(value, cmd, field, bitfield) \
(((int)(value) << (32 - ((_BITPOS_##cmd##_##field##_##bitfield) + (_NBITS_##cmd##_##field##_##bitfield)))) >> \
(32 - (_NBITS_##cmd##_##field##_##bitfield)))
/// Set bits in a bit field
//
/// Modifies a bit field defined in a _def.txt file.
/// \param[in,out] value
/// The value of the entire field that contains the bit field
/// \param[in] cmd
/// Name of the command or structure as defined in the _def.txt file
/// \param[in] field
/// Name of the field that contains the bit field definition as defined in the _def.txt file
/// \param[in] bitfield
/// Name of the bitfield as defined in the _def.txt file
/// \param[in] bvalue
/// The value to set in the bitfield
///
#define SET_BITS(value, cmd, field, bitfield, bvalue) \
(((value) = ((value) & \
(~(((1U << (_NBITS_##cmd##_##field##_##bitfield)) - 1) << (_BITPOS_##cmd##_##field##_##bitfield))) | \
((bvalue) << (_BITPOS_##cmd##_##field##_##bitfield)))))
/// Get bits from a bit field in a structure
//
/// Returns bits from a bit field in a structure defined in a _def.txt file.
/// \param[in] ptr
/// Pointer to the structure
/// \param[in] cmd
/// Name of the command or structure as defined in the _def.txt file
/// \param[in] field
/// Name of the field that contains the bit field definition as defined in the _def.txt file
/// \param[in] bitfield
/// Name of the bitfield as defined in the _def.txt file
///
#define GET_BITFIELD(ptr, cmd, field, bitfield) \
((*((_TYPE_##cmd##_##field *) ((((uint8_t *)(ptr)) + (_POSITION_##cmd##_##field)))) >> \
((_BITPOS_##cmd##_##field##_##bitfield))) & \
((1U << (_NBITS_##cmd##_##field##_##bitfield)) - 1))
/// Get bits from a bit field in a structure, reading as volatile
//
/// Returns bits from a bit field in a structure defined in a _def.txt file, reading it as a
/// volatile parameter.
/// \param[in] ptr
/// Pointer to the structure
/// \param[in] cmd
/// Name of the command or structure as defined in the _def.txt file
/// \param[in] field
/// Name of the field that contains the bit field definition as defined in the _def.txt file
/// \param[in] bitfield
/// Name of the bitfield as defined in the _def.txt file
///
#define GET_BITFIELD_V(ptr, cmd, field, bitfield) \
((*((volatile _TYPE_##cmd##_##field *) ((((uint8_t *)(ptr)) + (_POSITION_##cmd##_##field)))) >> \
((_BITPOS_##cmd##_##field##_##bitfield))) & \
((1U << (_NBITS_##cmd##_##field##_##bitfield)) - 1))
/// Set bits in a bit field in a structure
//
/// Modifies a bit field in a field in a structure defined in a _def.txt file.
/// \param[in] ptr
/// Pointer to the structure
/// \param[in] cmd
/// Name of the command or structure as defined in the _def.txt file
/// \param[in] field
/// Name of the field that contains the bit field definition as defined in the _def.txt file
/// \param[in] bitfield
/// Name of the bitfield as defined in the _def.txt file
/// \param[in] value
/// The value to set in the bitfield
///
#define SET_BITFIELD(ptr, cmd, field, bitfield, value) \
((*((_TYPE_##cmd##_##field *) (((uint8_t *)(ptr)) + (_POSITION_##cmd##_##field)))) = \
((*((_TYPE_##cmd##_##field *) (((uint8_t *)(ptr)) + (_POSITION_##cmd##_##field)))) & \
(~(((1U << (_NBITS_##cmd##_##field##_##bitfield)) - 1) << (_BITPOS_##cmd##_##field##_##bitfield))) | \
(((uint32_t)(value)) << (_BITPOS_##cmd##_##field##_##bitfield))))
/// Set bits in a bit field in a structure, reading and writing as volatile
//
/// Modifies a bit field in a field in a structure defined in a _def.txt file, accessing it as a volatile
/// parameter.
/// \param[in] ptr
/// Pointer to the structure
/// \param[in] cmd
/// Name of the command or structure as defined in the _def.txt file
/// \param[in] field
/// Name of the field that contains the bit field definition as defined in the _def.txt file
/// \param[in] bitfield
/// Name of the bitfield as defined in the _def.txt file
/// \param[in] value
/// The value to set in the bitfield
///
#define SET_BITFIELD_V(ptr, cmd, field, bitfield, value) \
((*((volatile _TYPE_##cmd##_##field *) (((uint8_t *)(ptr)) + (_POSITION_##cmd##_##field)))) = \
((*((volatile _TYPE_##cmd##_##field *) (((uint8_t *)(ptr)) + (_POSITION_##cmd##_##field)))) & \
(~(((1U << (_NBITS_##cmd##_##field##_##bitfield)) - 1) << (_BITPOS_##cmd##_##field##_##bitfield))) | \
(((uint32_t)(value)) << (_BITPOS_##cmd##_##field##_##bitfield))))
/// Get the value of specific bifield in a field with the remaining bits set to 0
//
/// Returns a bitfield so that the value of the full field can be obtained by bitwise
/// OR between these
/// \param[in] cmd
/// Name of the command or structure as defined in the _def.txt file
/// \param[in] field
/// Name of the field that contains the bit field definition as defined in the _def.txt file
/// \param[in] bitfield
/// Name of the bitfield as defined in the _def.txt file
/// \param[in] value
/// The value to use in the bitfield
///
#define BITVALUE(cmd, field, bitfield, value) \
((((uint32_t)(value)) & ((1U << (_NBITS_##cmd##_##field##_##bitfield)) - 1)) << \
(_BITPOS_##cmd##_##field##_##bitfield))
/// Get the size of a structure
//
/// Gets the size of a structure defined in a _def.txt file.
///
/// \param[in] cmd
/// Name of the command or structure as defined in the _def.txt file
///
#define SIZEOF_STRUCT(cmd) \
(_SIZEOF_##cmd)
/// Get the size of a radio operation command structure
//
/// Gets the size of a radio operation command structure defined in a _def.txt file. The difference from
/// SIZEOF_STRUCT is for legacy reasons only.
///
/// \param[in] cmd
/// Name of the command or structure as defined in the _def.txt file
///
#define SIZEOF_RADIO_OP(cmd) \
(_SIZEOF_##cmd)
/// Initializes a structure to an initialization set
//
/// Sets the value of a structure to its given initialization values
/// \param[in] ptr
/// Pointer to the structure, must be word aligned
/// \param[in] cmd
/// Name of the command or structure as defined in the _def.txt file
/// \param[in] set
/// Index of the set of initializations to use
///
#define INIT_STRUCT(ptr, cmd, set) \
(memcpy(((uint32_t *)(ptr)) + (_START_INIT_WIDX_##cmd), (__init_##cmd[(set)]), \
(_N_INIT_WORDS_##cmd) * sizeof(uint32_t)))
///@}
/// \name Macros for sending direct commands
@ -441,7 +197,6 @@ typedef struct {
/// \name Radio operation status
/// Radio operation status format:
///@{
/// \name Operation not finished
///@{
@ -470,8 +225,8 @@ typedef struct {
#define ERROR_CMDID 0x0805 ///< Next operation has a command ID that is undefined or not a radio
///< operation command
#define ERROR_WRONG_BG 0x0806 ///< FG level command not compatible with running BG level command
#define ERROR_NO_SETUP 0x0807 ///< Operation using Rx or Tx attemted without CMD_RADIO_SETUP
#define ERROR_NO_FS 0x0808 ///< Operation using Rx or Tx attemted without frequency synth configured
#define ERROR_NO_SETUP 0x0807 ///< Operation using Rx or Tx attempted without CMD_RADIO_SETUP
#define ERROR_NO_FS 0x0808 ///< Operation using Rx or Tx attempted without frequency synth configured
#define ERROR_SYNTH_PROG 0x0809 ///< Synthesizer calibration failed
#define ERROR_TXUNF 0x080A ///< Tx underflow observed
#define ERROR_RXOVF 0x080B ///< Rx overflow observed
@ -499,8 +254,6 @@ typedef struct {
#define DATA_ENTRY_UNFINISHED 4 ///< Radio CPU is finished accessing the entry, but packet could not be finished
///@}
/// Difference between length and size of rxData field in multi-element Rx entry
#define DATA_ENTRY_MULTI_LEN_OFFSET (_POSITION_dataEntry_rxData - _POSITION_dataEntry_data)
/// \name Macros for RF register override
@ -547,7 +300,6 @@ typedef struct {
#define MCE_RFE_OVERRIDE(bMceRam, mceRomBank, mceMode, bRfeRam, rfeRomBank, rfeMode) \
(7 | ((!!(bMceRam)) << 8) | (((mceRomBank) & 0x07) << 9) | ((!!(bRfeRam)) << 12) | (((rfeRomBank) & 0x07) << 13) | \
(((mceMode) & 0x00FF) << 16) | (((rfeMode) & 0x00FF) << 24))
#define BAW_OVERRIDE(freqOffset) (0x000B | ((freqOffset) << 16))
#define NEW_OVERRIDE_SEGMENT(address) (((((uintptr_t)(address)) & 0x03FFFFFC) << 6) | 0x000F | \
(((((uintptr_t)(address) >> 24) == 0x20) ? 0x01 : \
(((uintptr_t)(address) >> 24) == 0x21) ? 0x02 : \
@ -562,10 +314,6 @@ typedef struct {
#define END_OVERRIDE 0xFFFFFFFF
#define FWPAR_8BIT_ADDR(cmd, field) (0x1800 | (_POSITION_##cmd##_##field))
#define FWPAR_16BIT_ADDR(cmd, field) (0x1000 | (_POSITION_##cmd##_##field))
#define FWPAR_32BIT_ADDR(cmd, field) (0x0000 | (_POSITION_##cmd##_##field))
/// ADI address-value pair
#define ADI_ADDR_VAL(addr, value) ((((addr) & 0x7F) << 8) | ((value) & 0xFF))
#define ADI_ADDR_VAL_MASK(addr, mask, value) ((((addr) & 0x7F) << 8) | ADI_VAL_MASK(addr, mask, value))
@ -577,4 +325,4 @@ typedef struct {
///@}
#endif
#endif /* MAILBOX_H_ */

View file

@ -0,0 +1,596 @@
/******************************************************************************
* Filename: prop_cmd.h
* Revised: 2015-08-04 10:40:45 +0200 (Tue, 04 Aug 2015)
* Revision: 44326
*
* Description: CC13xx API for Proprietary mode commands
*
* Copyright (c) 2015, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2) Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3) Neither the name of the ORGANIZATION nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
#ifndef PROP_CMD_H_
#define PROP_CMD_H_
#ifndef __RFC_STRUCT
#ifdef __GNUC__
#define __RFC_STRUCT __attribute__ ((aligned (4)))
#else
#define __RFC_STRUCT
#endif
#endif
//! \addtogroup rfc
//! @{
//! \addtogroup prop_cmd
//! @{
#include <stdint.h>
#include "mailbox.h"
#include "common_cmd.h"
typedef struct __RFC_STRUCT rfc_carrierSense_s rfc_carrierSense_t;
typedef struct __RFC_STRUCT rfc_CMD_PROP_TX_s rfc_CMD_PROP_TX_t;
typedef struct __RFC_STRUCT rfc_CMD_PROP_RX_s rfc_CMD_PROP_RX_t;
typedef struct __RFC_STRUCT rfc_CMD_PROP_TX_ADV_s rfc_CMD_PROP_TX_ADV_t;
typedef struct __RFC_STRUCT rfc_CMD_PROP_RX_ADV_s rfc_CMD_PROP_RX_ADV_t;
typedef struct __RFC_STRUCT rfc_CMD_PROP_RADIO_SETUP_s rfc_CMD_PROP_RADIO_SETUP_t;
typedef struct __RFC_STRUCT rfc_CMD_PROP_RADIO_DIV_SETUP_s rfc_CMD_PROP_RADIO_DIV_SETUP_t;
typedef struct __RFC_STRUCT rfc_CMD_PROP_SET_LEN_s rfc_CMD_PROP_SET_LEN_t;
typedef struct __RFC_STRUCT rfc_CMD_PROP_RESTART_RX_s rfc_CMD_PROP_RESTART_RX_t;
typedef struct __RFC_STRUCT rfc_propRxOutput_s rfc_propRxOutput_t;
typedef struct __RFC_STRUCT rfc_propRxStatus_s rfc_propRxStatus_t;
//! \addtogroup carrierSense
//! @{
struct __RFC_STRUCT rfc_carrierSense_s {
struct {
uint8_t bEnaRssi:1; //!< If 1, enable RSSI as a criterion
uint8_t bEnaCorr:1; //!< If 1, enable correlation as a criterion
uint8_t operation:1; //!< \brief 0: Busy if either RSSI or correlation indicates Busy<br>
//!< 1: Busy if both RSSI and correlation indicates Busy
uint8_t busyOp:1; //!< \brief 0: Continue carrier sense on channel Busy<br>
//!< 1: End carrier sense on channel Busy<br>
//!< For an Rx command, the receiver will continue when carrier sense ends, but it will then not end if channel goes Idle
uint8_t idleOp:1; //!< \brief 0: Continue on channel Idle<br>
//!< 1: End on channel Idle
uint8_t timeoutRes:1; //!< \brief 0: Timeout with channel state Invalid treated as Busy<br>
//!< 1: Timeout with channel state Invalid treated as Idle
} csConf;
int8_t rssiThr; //!< RSSI threshold
uint8_t numRssiIdle; //!< \brief Number of consecutive RSSI measurements below the threshold needed before the channel is
//!< declared Idle
uint8_t numRssiBusy; //!< \brief Number of consecutive RSSI measurements above the threshold needed before the channel is
//!< declared Busy
uint16_t corrPeriod; //!< Number of RAT ticks for a correlation observation periods
struct {
uint8_t numCorrInv:4; //!< \brief Number of subsequent correlation tops with maximum <code>corrPeriod</code> RAT
//!< ticks between them needed to go from Idle to Invalid
uint8_t numCorrBusy:4; //!< \brief Number of subsequent correlation tops with maximum <code>corrPeriod</code> RAT
//!< ticks between them needed to go from Invalid to Busy
} corrConfig;
struct {
uint8_t triggerType:4; //!< The type of trigger
uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command<br>
//!< 1: CMD_TRIGGER can be used as an alternative trigger
uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action
uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error<br>
//!< 1: A trigger in the past is triggered as soon as possible
} csEndTrigger; //!< Trigger classifier for ending the carrier sense
ratmr_t csEndTime; //!< Time used together with <code>csEndTrigger</code> for ending the operation
};
//! @}
//! \addtogroup CMD_PROP_TX
//! @{
#define CMD_PROP_TX 0x3801
struct __RFC_STRUCT rfc_CMD_PROP_TX_s {
uint16_t commandNo; //!< The command ID number 0x3801
uint16_t status; //!< \brief An integer telling the status of the command. This value is
//!< updated by the radio CPU during operation and may be read by the
//!< system CPU at any time.
rfc_radioOp_t *pNextOp; //!< Pointer to the next operation to run after this operation is done
ratmr_t startTime; //!< Absolute or relative start time (depending on the value of <code>startTrigger</code>)
struct {
uint8_t triggerType:4; //!< The type of trigger
uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command<br>
//!< 1: CMD_TRIGGER can be used as an alternative trigger
uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action
uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error<br>
//!< 1: A trigger in the past is triggered as soon as possible
} startTrigger; //!< Identification of the trigger that starts the operation
struct {
uint8_t rule:4; //!< Condition for running next command: Rule for how to proceed
uint8_t nSkip:4; //!< Number of skips if the rule involves skipping
} condition;
struct {
uint8_t bFsOff:1; //!< \brief 0: Keep frequency synth on after command<br>
//!< 1: Turn frequency synth off after command
uint8_t :2;
uint8_t bUseCrc:1; //!< \brief 0: Do not append CRC<br>
//!< 1: Append CRC
uint8_t bVarLen:1; //!< \brief 0: Fixed length<br>
//!< 1: Transmit length as first byte
} pktConf;
uint8_t pktLen; //!< Packet length
uint32_t syncWord; //!< Sync word to transmit
uint8_t* pPkt; //!< Pointer to packet
};
//! @}
//! \addtogroup CMD_PROP_RX
//! @{
#define CMD_PROP_RX 0x3802
struct __RFC_STRUCT rfc_CMD_PROP_RX_s {
uint16_t commandNo; //!< The command ID number 0x3802
uint16_t status; //!< \brief An integer telling the status of the command. This value is
//!< updated by the radio CPU during operation and may be read by the
//!< system CPU at any time.
rfc_radioOp_t *pNextOp; //!< Pointer to the next operation to run after this operation is done
ratmr_t startTime; //!< Absolute or relative start time (depending on the value of <code>startTrigger</code>)
struct {
uint8_t triggerType:4; //!< The type of trigger
uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command<br>
//!< 1: CMD_TRIGGER can be used as an alternative trigger
uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action
uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error<br>
//!< 1: A trigger in the past is triggered as soon as possible
} startTrigger; //!< Identification of the trigger that starts the operation
struct {
uint8_t rule:4; //!< Condition for running next command: Rule for how to proceed
uint8_t nSkip:4; //!< Number of skips if the rule involves skipping
} condition;
struct {
uint8_t bFsOff:1; //!< \brief 0: Keep frequency synth on after command<br>
//!< 1: Turn frequency synth off after command
uint8_t bRepeatOk:1; //!< \brief 0: End operation after receiving a packet correctly<br>
//!< 1: Go back to sync search after receiving a packet correctly
uint8_t bRepeatNok:1; //!< \brief 0: End operation after receiving a packet with CRC error<br>
//!< 1: Go back to sync search after receiving a packet with CRC error
uint8_t bUseCrc:1; //!< \brief 0: Do not check CRC<br>
//!< 1: Check CRC
uint8_t bVarLen:1; //!< \brief 0: Fixed length<br>
//!< 1: Receive length as first byte
uint8_t bChkAddress:1; //!< \brief 0: No address check<br>
//!< 1: Check address
uint8_t endType:1; //!< \brief 0: Packet is received to the end if end trigger happens after sync is obtained<br>
//!< 1: Packet reception is stopped if end trigger happens
uint8_t filterOp:1; //!< \brief 0: Stop receiver and restart sync search on address mismatch<br>
//!< 1: Receive packet and mark it as ignored on address mismatch
} pktConf;
struct {
uint8_t bAutoFlushIgnored:1; //!< If 1, automatically discard ignored packets from Rx queue
uint8_t bAutoFlushCrcErr:1; //!< If 1, automatically discard packets with CRC error from Rx queue
uint8_t :1;
uint8_t bIncludeHdr:1; //!< If 1, include the received header or length byte in the stored packet; otherwise discard it
uint8_t bIncludeCrc:1; //!< If 1, include the received CRC field in the stored packet; otherwise discard it
uint8_t bAppendRssi:1; //!< If 1, append an RSSI byte to the packet in the Rx queue
uint8_t bAppendTimestamp:1; //!< If 1, append a timestamp to the packet in the Rx queue
uint8_t bAppendStatus:1; //!< If 1, append a status byte to the packet in the Rx queue
} rxConf; //!< Rx configuration
uint32_t syncWord; //!< Sync word to listen for
uint8_t maxPktLen; //!< \brief Packet length for fixed length, maximum packet length for variable length<br>
//!< 0: Unlimited or unknown length
uint8_t address0; //!< Address
uint8_t address1; //!< \brief Address (set equal to <code>address0</code> to accept only one address. If 0xFF, accept
//!< 0x00 as well)
struct {
uint8_t triggerType:4; //!< The type of trigger
uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command<br>
//!< 1: CMD_TRIGGER can be used as an alternative trigger
uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action
uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error<br>
//!< 1: A trigger in the past is triggered as soon as possible
} endTrigger; //!< Trigger classifier for ending the operation
ratmr_t endTime; //!< Time used together with <code>endTrigger</code> for ending the operation
dataQueue_t* pQueue; //!< Pointer to receive queue
uint8_t* pOutput; //!< Pointer to output structure
};
//! @}
//! \addtogroup CMD_PROP_TX_ADV
//! @{
#define CMD_PROP_TX_ADV 0x3803
struct __RFC_STRUCT rfc_CMD_PROP_TX_ADV_s {
uint16_t commandNo; //!< The command ID number 0x3803
uint16_t status; //!< \brief An integer telling the status of the command. This value is
//!< updated by the radio CPU during operation and may be read by the
//!< system CPU at any time.
rfc_radioOp_t *pNextOp; //!< Pointer to the next operation to run after this operation is done
ratmr_t startTime; //!< Absolute or relative start time (depending on the value of <code>startTrigger</code>)
struct {
uint8_t triggerType:4; //!< The type of trigger
uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command<br>
//!< 1: CMD_TRIGGER can be used as an alternative trigger
uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action
uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error<br>
//!< 1: A trigger in the past is triggered as soon as possible
} startTrigger; //!< Identification of the trigger that starts the operation
struct {
uint8_t rule:4; //!< Condition for running next command: Rule for how to proceed
uint8_t nSkip:4; //!< Number of skips if the rule involves skipping
} condition;
struct {
uint8_t bFsOff:1; //!< \brief 0: Keep frequency synth on after command<br>
//!< 1: Turn frequency synth off after command
uint8_t :2;
uint8_t bUseCrc:1; //!< \brief 0: Do not append CRC<br>
//!< 1: Append CRC
uint8_t bCrcIncSw:1; //!< \brief 0:Do not include sync word in CRC calculation<br>
//!< 1: Include sync word in CRC calculation
uint8_t bCrcIncHdr:1; //!< \brief 0: Do not include header in CRC calculation<br>
//!< 1: Include header in CRC calculation
} pktConf;
uint8_t numHdrBits; //!< Number of bits in header (0&ndash;32)
uint16_t pktLen; //!< Packet length. 0: Unlimited
struct {
uint8_t bExtTxTrig:1; //!< \brief 0: Start packet on a fixed time from the command start trigger<br>
//!< 1: Start packet on an external trigger (input event to RAT)
uint8_t inputMode:2; //!< \brief Input mode if external trigger is used for Tx start<br>
//!< 0: Rising edge<br>
//!< 1: Falling edge<br>
//!< 2: Both edges<br>
//!< 3: <i>Reserved</i>
uint8_t source:5; //!< RAT input event number used for capture if external trigger is used for Tx start
} startConf;
struct {
uint8_t triggerType:4; //!< The type of trigger
uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command<br>
//!< 1: CMD_TRIGGER can be used as an alternative trigger
uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action
uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error<br>
//!< 1: A trigger in the past is triggered as soon as possible
} preTrigger; //!< Trigger for transition from preamble to sync word
ratmr_t preTime; //!< \brief Time used together with <code>preTrigger</code> for transition from preamble to sync
//!< word. If <code>preTrigger.triggerType</code> is set to "now", one preamble as
//!< configured in the setup will be sent. Otherwise, the preamble will be repeated until
//!< this trigger is observed.
uint32_t syncWord; //!< Sync word to transmit
uint8_t* pPkt; //!< Pointer to packet, or Tx queue for unlimited length
};
//! @}
//! \addtogroup CMD_PROP_RX_ADV
//! @{
#define CMD_PROP_RX_ADV 0x3804
struct __RFC_STRUCT rfc_CMD_PROP_RX_ADV_s {
uint16_t commandNo; //!< The command ID number 0x3804
uint16_t status; //!< \brief An integer telling the status of the command. This value is
//!< updated by the radio CPU during operation and may be read by the
//!< system CPU at any time.
rfc_radioOp_t *pNextOp; //!< Pointer to the next operation to run after this operation is done
ratmr_t startTime; //!< Absolute or relative start time (depending on the value of <code>startTrigger</code>)
struct {
uint8_t triggerType:4; //!< The type of trigger
uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command<br>
//!< 1: CMD_TRIGGER can be used as an alternative trigger
uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action
uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error<br>
//!< 1: A trigger in the past is triggered as soon as possible
} startTrigger; //!< Identification of the trigger that starts the operation
struct {
uint8_t rule:4; //!< Condition for running next command: Rule for how to proceed
uint8_t nSkip:4; //!< Number of skips if the rule involves skipping
} condition;
struct {
uint8_t bFsOff:1; //!< \brief 0: Keep frequency synth on after command<br>
//!< 1: Turn frequency synth off after command
uint8_t bRepeatOk:1; //!< \brief 0: End operation after receiving a packet correctly<br>
//!< 1: Go back to sync search after receiving a packet correctly
uint8_t bRepeatNok:1; //!< \brief 0: End operation after receiving a packet with CRC error<br>
//!< 1: Go back to sync search after receiving a packet with CRC error
uint8_t bUseCrc:1; //!< \brief 0: Do not check CRC<br>
//!< 1: Check CRC
uint8_t bCrcIncSw:1; //!< \brief 0: Do not include sync word in CRC calculation<br>
//!< 1: Include sync word in CRC calculation
uint8_t bCrcIncHdr:1; //!< \brief 0: Do not include header in CRC calculation <br>
//!< 1: Include header in CRC calculation
uint8_t endType:1; //!< \brief 0: Packet is received to the end if end trigger happens after sync is obtained<br>
//!< 1: Packet reception is stopped if end trigger happens
uint8_t filterOp:1; //!< \brief 0: Stop receiver and restart sync search on address mismatch<br>
//!< 1: Receive packet and mark it as ignored on address mismatch
} pktConf;
struct {
uint8_t bAutoFlushIgnored:1; //!< If 1, automatically discard ignored packets from Rx queue
uint8_t bAutoFlushCrcErr:1; //!< If 1, automatically discard packets with CRC error from Rx queue
uint8_t :1;
uint8_t bIncludeHdr:1; //!< If 1, include the received header or length byte in the stored packet; otherwise discard it
uint8_t bIncludeCrc:1; //!< If 1, include the received CRC field in the stored packet; otherwise discard it
uint8_t bAppendRssi:1; //!< If 1, append an RSSI byte to the packet in the Rx queue
uint8_t bAppendTimestamp:1; //!< If 1, append a timestamp to the packet in the Rx queue
uint8_t bAppendStatus:1; //!< If 1, append a status byte to the packet in the Rx queue
} rxConf; //!< Rx configuration
uint32_t syncWord0; //!< Sync word to listen for
uint32_t syncWord1; //!< Alternative sync word if non-zero
uint16_t maxPktLen; //!< \brief Packet length for fixed length, maximum packet length for variable length<br>
//!< 0: Unlimited or unknown length
struct {
uint16_t numHdrBits:6; //!< Number of bits in header (0&ndash;32)
uint16_t lenPos:5; //!< Position of length field in header (0&ndash;31)
uint16_t numLenBits:5; //!< Number of bits in length field (0&ndash;16)
} hdrConf;
struct {
uint16_t addrType:1; //!< \brief 0: Address after header<br>
//!< 1: Address in header
uint16_t addrSize:5; //!< \brief If <code>addrType</code> = 0: Address size in bytes<br>
//!< If <code>addrType</code> = 1: Address size in bits
uint16_t addrPos:5; //!< \brief If <code>addrType</code> = 1: Bit position of address in header<br>
//!< If <code>addrType</code> = 0: Non-zero to extend address with sync word identifier
uint16_t numAddr:5; //!< Number of addresses in address list
} addrConf;
int8_t lenOffset; //!< Signed value to add to length field
struct {
uint8_t triggerType:4; //!< The type of trigger
uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command<br>
//!< 1: CMD_TRIGGER can be used as an alternative trigger
uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action
uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error<br>
//!< 1: A trigger in the past is triggered as soon as possible
} endTrigger; //!< Trigger classifier for ending the operation
ratmr_t endTime; //!< Time used together with <code>endTrigger</code> for ending the operation
uint8_t* pAddr; //!< Pointer to address list
dataQueue_t* pQueue; //!< Pointer to receive queue
uint8_t* pOutput; //!< Pointer to output structure
};
//! @}
//! \addtogroup CMD_PROP_RADIO_SETUP
//! @{
#define CMD_PROP_RADIO_SETUP 0x3806
struct __RFC_STRUCT rfc_CMD_PROP_RADIO_SETUP_s {
uint16_t commandNo; //!< The command ID number 0x3806
uint16_t status; //!< \brief An integer telling the status of the command. This value is
//!< updated by the radio CPU during operation and may be read by the
//!< system CPU at any time.
rfc_radioOp_t *pNextOp; //!< Pointer to the next operation to run after this operation is done
ratmr_t startTime; //!< Absolute or relative start time (depending on the value of <code>startTrigger</code>)
struct {
uint8_t triggerType:4; //!< The type of trigger
uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command<br>
//!< 1: CMD_TRIGGER can be used as an alternative trigger
uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action
uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error<br>
//!< 1: A trigger in the past is triggered as soon as possible
} startTrigger; //!< Identification of the trigger that starts the operation
struct {
uint8_t rule:4; //!< Condition for running next command: Rule for how to proceed
uint8_t nSkip:4; //!< Number of skips if the rule involves skipping
} condition;
struct {
uint16_t modType:3; //!< \brief 0: FSK<br>
//!< 1: GFSK<br>
//!< Others: <i>Reserved</i>
uint16_t deviation:13; //!< Deviation (250 Hz steps)
} modulation;
struct {
uint32_t preScale:4; //!< Prescaler value
uint32_t :4;
uint32_t rateWord:21; //!< Rate word
} symbolRate;
uint8_t rxBw; //!< Receiver bandwidth
struct {
uint8_t nPreamBytes:6; //!< \brief 0&ndash;30: Number of preamble bytes<br>
//!< 31: 4 preamble bits
uint8_t preamMode:2; //!< \brief 0: Send 0 as the first preamble bit<br>
//!< 1: Send 1 as the first preamble bit<br>
//!< 2: Send same first bit in preamble and sync word<br>
//!< 3: Send different first bit in preamble and sync word
} preamConf;
struct {
uint16_t nSwBits:6; //!< Number of sync word bits (up to 32)
uint16_t bBitReversal:1; //!< \brief 0: Use positive deviation for 1<br>
//!< 1: Use positive deviation for 0
uint16_t bMsbFirst:1; //!< \brief 0: Least significant bit transmitted first<br>
//!< 1: Most significant bit transmitted first
uint16_t fecMode:4; //!< \brief Select coding<br>
//!< 0: Uncoded binary modulation<br>
//!< 10: Manchester coded binary modulation<br>
//!< Others: <i>Reserved</i>
uint16_t :1;
uint16_t whitenMode:3; //!< \brief 0: No whitening<br>
//!< 1: CC1101/CC2500 compatible whitening<br>
//!< 2: PN9 whitening without byte reversal<br>
//!< 3: <i>Reserved</i><br>
//!< 4: No whitener, 32-bit IEEE 802.15.4g compatible CRC<br>
//!< 5: IEEE 802.15.4g compatible whitener and 32-bit CRC<br>
//!< 6: No whitener, dynamically IEEE 802.15.4g compatible 16-bit or 32-bit CRC<br>
//!< 7: Dynamically IEEE 802.15.4g compatible whitener and 16-bit or 32-bit CRC
} formatConf;
struct {
uint16_t frontEndMode:3; //!< \brief 0x00: Differential mode<br>
//!< 0x01: Single-ended mode RFP<br>
//!< 0x02: Single-ended mode RFN<br>
//!< 0x05 Single-ended mode RFP with external frontend control on RF pins (RFN and RXTX)<br>
//!< 0x06 Single-ended mode RFN with external frontend control on RF pins (RFP and RXTX)<br>
//!< Others: <i>Reserved</i>
uint16_t biasMode:1; //!< \brief 0: Internal bias<br>
//!< 1: External bias
uint16_t :6;
uint16_t bNoFsPowerUp:1; //!< \brief 0: Power up frequency synth<br>
//!< 1: Do not power up frequency synth
} config; //!< Configuration options
uint16_t txPower; //!< Transmit power
uint32_t* pRegOverride; //!< \brief Pointer to a list of hardware and configuration registers to override. If NULL, no
//!< override is used.
};
//! @}
//! \addtogroup CMD_PROP_RADIO_DIV_SETUP
//! @{
#define CMD_PROP_RADIO_DIV_SETUP 0x3807
struct __RFC_STRUCT rfc_CMD_PROP_RADIO_DIV_SETUP_s {
uint16_t commandNo; //!< The command ID number 0x3807
uint16_t status; //!< \brief An integer telling the status of the command. This value is
//!< updated by the radio CPU during operation and may be read by the
//!< system CPU at any time.
rfc_radioOp_t *pNextOp; //!< Pointer to the next operation to run after this operation is done
ratmr_t startTime; //!< Absolute or relative start time (depending on the value of <code>startTrigger</code>)
struct {
uint8_t triggerType:4; //!< The type of trigger
uint8_t bEnaCmd:1; //!< \brief 0: No alternative trigger command<br>
//!< 1: CMD_TRIGGER can be used as an alternative trigger
uint8_t triggerNo:2; //!< The trigger number of the CMD_TRIGGER command that triggers this action
uint8_t pastTrig:1; //!< \brief 0: A trigger in the past is never triggered, or for start of commands, give an error<br>
//!< 1: A trigger in the past is triggered as soon as possible
} startTrigger; //!< Identification of the trigger that starts the operation
struct {
uint8_t rule:4; //!< Condition for running next command: Rule for how to proceed
uint8_t nSkip:4; //!< Number of skips if the rule involves skipping
} condition;
struct {
uint16_t modType:3; //!< \brief 0: FSK<br>
//!< 1: GFSK<br>
//!< Others: <i>Reserved</i>
uint16_t deviation:13; //!< Deviation (250 Hz steps)
} modulation;
struct {
uint32_t preScale:4; //!< Prescaler value
uint32_t :4;
uint32_t rateWord:21; //!< Rate word
} symbolRate;
uint8_t rxBw; //!< Receiver bandwidth
struct {
uint8_t nPreamBytes:6; //!< \brief 0&ndash;30: Number of preamble bytes<br>
//!< 31: 4 preamble bits
uint8_t preamMode:2; //!< \brief 0: Send 0 as the first preamble bit<br>
//!< 1: Send 1 as the first preamble bit<br>
//!< 2: Send same first bit in preamble and sync word<br>
//!< 3: Send different first bit in preamble and sync word
} preamConf;
struct {
uint16_t nSwBits:6; //!< Number of sync word bits (up to 32)
uint16_t bBitReversal:1; //!< \brief 0: Use positive deviation for 1<br>
//!< 1: Use positive deviation for 0
uint16_t bMsbFirst:1; //!< \brief 0: Least significant bit transmitted first<br>
//!< 1: Most significant bit transmitted first
uint16_t fecMode:4; //!< \brief Select coding<br>
//!< 0: Uncoded binary modulation<br>
//!< 10: Manchester coded binary modulation<br>
//!< Others: <i>Reserved</i>
uint16_t :1;
uint16_t whitenMode:3; //!< \brief 0: No whitening<br>
//!< 1: CC1101/CC2500 compatible whitening<br>
//!< 2: PN9 whitening without byte reversal<br>
//!< 3: <i>Reserved</i><br>
//!< 4: No whitener, 32-bit IEEE 802.15.4g compatible CRC<br>
//!< 5: IEEE 802.15.4g compatible whitener and 32-bit CRC<br>
//!< 6: No whitener, dynamically IEEE 802.15.4g compatible 16-bit or 32-bit CRC<br>
//!< 7: Dynamically IEEE 802.15.4g compatible whitener and 16-bit or 32-bit CRC
} formatConf;
struct {
uint16_t frontEndMode:3; //!< \brief 0x00: Differential mode<br>
//!< 0x01: Single-ended mode RFP<br>
//!< 0x02: Single-ended mode RFN<br>
//!< 0x05 Single-ended mode RFP with external frontend control on RF pins (RFN and RXTX)<br>
//!< 0x06 Single-ended mode RFN with external frontend control on RF pins (RFP and RXTX)<br>
//!< Others: <i>Reserved</i>
uint16_t biasMode:1; //!< \brief 0: Internal bias<br>
//!< 1: External bias
uint16_t :6;
uint16_t bNoFsPowerUp:1; //!< \brief 0: Power up frequency synth<br>
//!< 1: Do not power up frequency synth
} config; //!< Configuration options
uint16_t txPower; //!< Transmit power
uint32_t* pRegOverride; //!< \brief Pointer to a list of hardware and configuration registers to override. If NULL, no
//!< override is used.
uint16_t centerFreq; //!< \brief Center frequency of the frequency band used, in MHz; used for calculating some internal Tx and Rx parameters.
//!< For a single channel RF system, this should be set equal to the RF frequency used.
//!< For a multi channel RF system (e.g. frequency hopping spread spectrum), this should be set equal
//!< to the center frequency of the frequency band used.
int16_t intFreq; //!< \brief Intermediate frequency to use for Rx, in MHz on 4.12 signed format. Tx will use same
//!< intermediate frequency if supported, otherwise 0.<br>
//!< 0x8000: Use default.
uint8_t loDivider; //!< LO frequency divider setting to use. Supported values: 2, 5, 6, 10, 12, 15, and 30
};
//! @}
//! \addtogroup CMD_PROP_SET_LEN
//! @{
#define CMD_PROP_SET_LEN 0x3401
struct __RFC_STRUCT rfc_CMD_PROP_SET_LEN_s {
uint16_t commandNo; //!< The command ID number 0x3401
uint16_t rxLen; //!< Payload length to use
};
//! @}
//! \addtogroup CMD_PROP_RESTART_RX
//! @{
#define CMD_PROP_RESTART_RX 0x3402
struct __RFC_STRUCT rfc_CMD_PROP_RESTART_RX_s {
uint16_t commandNo; //!< The command ID number 0x3402
};
//! @}
//! \addtogroup propRxOutput
//! @{
//! Output structure for Rx operations
struct __RFC_STRUCT rfc_propRxOutput_s {
uint16_t nRxOk; //!< Number of packets that have been received with payload, CRC OK and not ignored
uint16_t nRxNok; //!< Number of packets that have been received with CRC error
uint8_t nRxIgnored; //!< Number of packets that have been received with CRC OK and ignored due to address mismatch
uint8_t nRxStopped; //!< Number of packets not received due to illegal length or address mismatch with pktConf.filterOp = 1
uint8_t nRxBufFull; //!< Number of packets that have been received and discarded due to lack of buffer space
int8_t lastRssi; //!< RSSI of last received packet
ratmr_t timeStamp; //!< Time stamp of last received packet
};
//! @}
//! \addtogroup propRxStatus
//! @{
//! Receive status byte that may be appended to message in receive buffer
struct __RFC_STRUCT rfc_propRxStatus_s {
struct {
uint8_t addressInd:5; //!< Index of address found (0 if not applicable)
uint8_t syncWordId:1; //!< 0 for primary sync word, 1 for alternate sync word
uint8_t result:2; //!< \brief 0: Packet received correctly, not ignored<br>
//!< 1: Packet received with CRC error<br>
//!< 2: Packet received correctly, but can be ignored<br>
//!< 3: Packet reception was aborted
} status;
};
//! @}
//! @}
//! @}
#endif /* PROP_CMD_H_ */

View file

@ -0,0 +1,71 @@
/******************************************************************************
* Filename: prop_mailbox.h
* Revised: 2015-06-29 12:59:58 +0200 (Mon, 29 Jun 2015)
* Revision: 44063
*
* Description: Definitions for proprietary mode radio interface
*
* Copyright (c) 2015, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2) Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3) Neither the name of the ORGANIZATION nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
#ifndef PROP_MAILBOX_H_
#define PROP_MAILBOX_H_
/// \name Radio operation status
///@{
/// \name Operation finished normally
///@{
#define PROP_DONE_OK 0x3400 ///< Operation ended normally
#define PROP_DONE_RXTIMEOUT 0x3401 ///< Operation stopped after end trigger while waiting for sync
#define PROP_DONE_BREAK 0x3402 ///< Rx stopped due to time out in the middle of a packet
#define PROP_DONE_ENDED 0x3403 ///< Operation stopped after end trigger during reception
#define PROP_DONE_STOPPED 0x3404 ///< Operation stopped after stop command
#define PROP_DONE_ABORT 0x3405 ///< Operation aborted by abort command
#define PROP_DONE_RXERR 0x3406 ///< Operation ended after receiving packet with CRC error
#define PROP_DONE_IDLE 0x3407 ///< Carrier sense operation ended because of idle channel
#define PROP_DONE_BUSY 0x3408 ///< Carrier sense operation ended because of busy channel
#define PROP_DONE_IDLETIMEOUT 0x3409 ///< Carrier sense operation ended because of time out with csConf.timeoutRes = 1
#define PROP_DONE_BUSYTIMEOUT 0x340A ///< Carrier sense operation ended because of time out with csConf.timeoutRes = 0
///@}
/// \name Operation finished with error
///@{
#define PROP_ERROR_PAR 0x3800 ///< Illegal parameter
#define PROP_ERROR_RXBUF 0x3801 ///< No available Rx buffer at the start of a packet
#define PROP_ERROR_RXFULL 0x3802 ///< Out of Rx buffer during reception in a partial read buffer
#define PROP_ERROR_NO_SETUP 0x3803 ///< Radio was not set up in proprietary mode
#define PROP_ERROR_NO_FS 0x3804 ///< Synth was not programmed when running Rx or Tx
#define PROP_ERROR_RXOVF 0x3805 ///< Rx overflow observed during operation
#define PROP_ERROR_TXUNF 0x3806 ///< Tx underflow observed during operation
///@}
///@}
#endif /* PROP_MAILBOX_H_ */

View file

@ -0,0 +1,124 @@
/*
* Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup rf-core
* @{
*
* \defgroup rf-core-15-4g-modes IEEE 802.15.4g Frequency Bands and Modes
*
* @{
*
* \file
* Header file with descriptors for the various modes of operation defined in
* IEEE 802.15.4g
*/
/*---------------------------------------------------------------------------*/
#ifndef DOT_15_4G_H_
#define DOT_15_4G_H_
/*---------------------------------------------------------------------------*/
#include "contiki-conf.h"
/*---------------------------------------------------------------------------*/
/* IEEE 802.15.4g frequency band identifiers (Table 68f) */
#define DOT_15_4G_FREQUENCY_BAND_169 0 /* 169.400169.475 (Europe) - 169 MHz band */
#define DOT_15_4G_FREQUENCY_BAND_450 1 /* 450470 (US FCC Part 22/90) - 450 MHz band */
#define DOT_15_4G_FREQUENCY_BAND_470 2 /* 470510 (China) - 470 MHz band */
#define DOT_15_4G_FREQUENCY_BAND_780 3 /* 779787 (China) - 780 MHz band */
#define DOT_15_4G_FREQUENCY_BAND_863 4 /* 863870 (Europe) - 863 MHz band */
#define DOT_15_4G_FREQUENCY_BAND_896 5 /* 896901 (US FCC Part 90) - 896 MHz band */
#define DOT_15_4G_FREQUENCY_BAND_901 6 /* 901902 (US FCC Part 24) - 901 MHz band */
#define DOT_15_4G_FREQUENCY_BAND_915 7 /* 902928 (US) - 915 MHz band */
#define DOT_15_4G_FREQUENCY_BAND_917 8 /* 917923.5 (Korea) - 917 MHz band */
#define DOT_15_4G_FREQUENCY_BAND_920 9 /* 920928 (Japan) - 920 MHz band */
#define DOT_15_4G_FREQUENCY_BAND_928 10 /* 928960 (US, non-contiguous) - 928 MHz band */
#define DOT_15_4G_FREQUENCY_BAND_950 11 /* 950958 (Japan) - 950 MHz band */
#define DOT_15_4G_FREQUENCY_BAND_1427 12 /* 14271518 (US and Canada, non-contiguous) - 1427 MHz band */
#define DOT_15_4G_FREQUENCY_BAND_2450 13 /* 24002483.5 2450 MHz band */
/*---------------------------------------------------------------------------*/
/* Default band selection to band 4 - 863MHz */
#ifdef DOT_15_4G_CONF_FREQUENCY_BAND_ID
#define DOT_15_4G_FREQUENCY_BAND_ID DOT_15_4G_CONF_FREQUENCY_BAND_ID
#else
#define DOT_15_4G_FREQUENCY_BAND_ID DOT_15_4G_FREQUENCY_BAND_863
#endif
/*---------------------------------------------------------------------------*/
/*
* Channel count, spacing and other params relating to the selected band. We
* currently only support some of the bands defined in .15.4g and for those
* bands we only support operating mode #1 (Table 134).
*
* DOT_15_4G_CHAN0_FREQUENCY is specified here in KHz
*/
#if DOT_15_4G_FREQUENCY_BAND_ID==DOT_15_4G_FREQUENCY_BAND_470
#define DOT_15_4G_CHANNEL_MAX 198
#define DOT_15_4G_CHANNEL_SPACING 200
#define DOT_15_4G_CHAN0_FREQUENCY 470200
#define PROP_MODE_CONF_LO_DIVIDER 0x0A
#elif DOT_15_4G_FREQUENCY_BAND_ID==DOT_15_4G_FREQUENCY_BAND_780
#define DOT_15_4G_CHANNEL_MAX 38
#define DOT_15_4G_CHANNEL_SPACING 200
#define DOT_15_4G_CHAN0_FREQUENCY 779200
#define PROP_MODE_CONF_LO_DIVIDER 0x06
#elif DOT_15_4G_FREQUENCY_BAND_ID==DOT_15_4G_FREQUENCY_BAND_863
#define DOT_15_4G_CHANNEL_MAX 33
#define DOT_15_4G_CHANNEL_SPACING 200
#define DOT_15_4G_CHAN0_FREQUENCY 863125
#define PROP_MODE_CONF_LO_DIVIDER 0x05
#elif DOT_15_4G_FREQUENCY_BAND_ID==DOT_15_4G_FREQUENCY_BAND_915
#define DOT_15_4G_CHANNEL_MAX 128
#define DOT_15_4G_CHANNEL_SPACING 200
#define DOT_15_4G_CHAN0_FREQUENCY 902200
#define PROP_MODE_CONF_LO_DIVIDER 0x05
#elif DOT_15_4G_FREQUENCY_BAND_ID==DOT_15_4G_FREQUENCY_BAND_920
#define DOT_15_4G_CHANNEL_MAX 37
#define DOT_15_4G_CHANNEL_SPACING 200
#define DOT_15_4G_CHAN0_FREQUENCY 920600
#define PROP_MODE_CONF_LO_DIVIDER 0x05
#elif DOT_15_4G_FREQUENCY_BAND_ID==DOT_15_4G_FREQUENCY_BAND_950
#define DOT_15_4G_CHANNEL_MAX 32
#define DOT_15_4G_CHANNEL_SPACING 200
#define DOT_15_4G_CHAN0_FREQUENCY 951000
#define PROP_MODE_CONF_LO_DIVIDER 0x05
#else
#error The selected frequency band is not supported
#endif
/*---------------------------------------------------------------------------*/
#endif /* DOT_15_4G_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
* @}
*/

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,400 @@
/*
* Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup rf-core-ble
* @{
*
* \file
* Implementation of the CC13xx/CC26xx RF BLE driver
*/
/*---------------------------------------------------------------------------*/
#include "contiki-conf.h"
#include "sys/process.h"
#include "sys/clock.h"
#include "sys/etimer.h"
#include "net/netstack.h"
#include "net/linkaddr.h"
#include "dev/oscillators.h"
#include "rf-core/rf-core.h"
#include "rf-core/rf-ble.h"
#include "rf-core/api/ble_cmd.h"
#include "rf-core/api/common_cmd.h"
#include "ti-lib.h"
/*---------------------------------------------------------------------------*/
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
/*---------------------------------------------------------------------------*/
#ifdef __GNUC__
#define CC_ALIGN_ATTR(n) __attribute__ ((aligned(n)))
#else
#define CC_ALIGN_ATTR(n)
#endif
/*---------------------------------------------------------------------------*/
#define DEBUG 0
#if DEBUG
#define PRINTF(...) printf(__VA_ARGS__)
#else
#define PRINTF(...)
#endif
/*---------------------------------------------------------------------------*/
/* BLE Intervals: Send a burst of advertisements every BLE_ADV_INTERVAL secs */
#define BLE_ADV_INTERVAL (CLOCK_SECOND * 5)
#define BLE_ADV_DUTY_CYCLE (CLOCK_SECOND / 10)
#define BLE_ADV_MESSAGES 10
/* BLE Advertisement-related macros */
#define BLE_ADV_TYPE_DEVINFO 0x01
#define BLE_ADV_TYPE_NAME 0x09
#define BLE_ADV_TYPE_MANUFACTURER 0xFF
#define BLE_ADV_NAME_BUF_LEN 32
#define BLE_ADV_PAYLOAD_BUF_LEN 64
#define BLE_UUID_SIZE 16
/*---------------------------------------------------------------------------*/
static unsigned char ble_params_buf[32] CC_ALIGN_ATTR(4);
static uint8_t ble_mode_on = RF_BLE_IDLE;
static struct etimer ble_adv_et;
static uint8_t payload[BLE_ADV_PAYLOAD_BUF_LEN];
static int p = 0;
static int i;
/*---------------------------------------------------------------------------*/
typedef struct default_ble_tx_power_s {
uint16_t ib:6;
uint16_t gc:2;
uint16_t boost:1;
uint16_t temp_coeff:7;
} default_ble_tx_power_t;
static default_ble_tx_power_t tx_power = { 0x29, 0x00, 0x00, 0x00 };
/*---------------------------------------------------------------------------*/
/* BLE beacond config */
static struct ble_beacond_config {
clock_time_t interval;
char adv_name[BLE_ADV_NAME_BUF_LEN];
} beacond_config = { .interval = BLE_ADV_INTERVAL };
/*---------------------------------------------------------------------------*/
/* BLE overrides */
static uint32_t ble_overrides[] = {
0x00364038, /* Synth: Set RTRIM (POTAILRESTRIM) to 6 */
0x000784A3, /* Synth: Set FREF = 3.43 MHz (24 MHz / 7) */
0xA47E0583, /* Synth: Set loop bandwidth after lock to 80 kHz (K2) */
0xEAE00603, /* Synth: Set loop bandwidth after lock to 80 kHz (K3, LSB) */
0x00010623, /* Synth: Set loop bandwidth after lock to 80 kHz (K3, MSB) */
0x00456088, /* Adjust AGC reference level */
0xFFFFFFFF, /* End of override list */
};
/*---------------------------------------------------------------------------*/
PROCESS(rf_ble_beacon_process, "CC13xx / CC26xx RF BLE Beacon Process");
/*---------------------------------------------------------------------------*/
static int
send_ble_adv_nc(int channel, uint8_t *adv_payload, int adv_payload_len)
{
uint32_t cmd_status;
rfc_CMD_BLE_ADV_NC_t cmd;
rfc_bleAdvPar_t *params;
params = (rfc_bleAdvPar_t *)ble_params_buf;
/* Clear both buffers */
memset(&cmd, 0x00, sizeof(cmd));
memset(ble_params_buf, 0x00, sizeof(ble_params_buf));
/* Adv NC */
cmd.commandNo = CMD_BLE_ADV_NC;
cmd.condition.rule = COND_NEVER;
cmd.whitening.bOverride = 0;
cmd.whitening.init = 0;
cmd.pParams = params;
cmd.channel = channel;
/* Set up BLE Advertisement parameters */
params->pDeviceAddress = (uint16_t *)&linkaddr_node_addr.u8[LINKADDR_SIZE - 2];
params->endTrigger.triggerType = TRIG_NEVER;
params->endTime = TRIG_NEVER;
/* Set up BLE Advertisement parameters */
params = (rfc_bleAdvPar_t *)ble_params_buf;
params->advLen = adv_payload_len;
params->pAdvData = adv_payload;
if(rf_core_send_cmd((uint32_t)&cmd, &cmd_status) == RF_CORE_CMD_ERROR) {
PRINTF("send_ble_adv_nc: Chan=%d CMDSTA=0x%08lx, status=0x%04x\n",
channel, cmd_status, cmd.status);
return RF_CORE_CMD_ERROR;
}
/* Wait until the command is done */
if(rf_core_wait_cmd_done(&cmd) != RF_CORE_CMD_OK) {
PRINTF("send_ble_adv_nc: Chan=%d CMDSTA=0x%08lx, status=0x%04x\n",
channel, cmd_status, cmd.status);
return RF_CORE_CMD_ERROR;
}
return RF_CORE_CMD_OK;
}
/*---------------------------------------------------------------------------*/
void
rf_ble_beacond_config(clock_time_t interval, const char *name)
{
if(RF_BLE_ENABLED == 0) {
return;
}
if(name != NULL) {
if(strlen(name) == 0 || strlen(name) >= BLE_ADV_NAME_BUF_LEN) {
return;
}
memset(beacond_config.adv_name, 0, BLE_ADV_NAME_BUF_LEN);
memcpy(beacond_config.adv_name, name, strlen(name));
}
if(interval != 0) {
beacond_config.interval = interval;
}
}
/*---------------------------------------------------------------------------*/
uint8_t
rf_ble_beacond_start()
{
if(RF_BLE_ENABLED == 0) {
return RF_CORE_CMD_ERROR;
}
if(ti_lib_chipinfo_supports_ble() == false) {
return RF_CORE_CMD_ERROR;
}
if(beacond_config.adv_name[0] == 0) {
return RF_CORE_CMD_ERROR;
}
ble_mode_on = RF_BLE_IDLE;
process_start(&rf_ble_beacon_process, NULL);
return RF_CORE_CMD_OK;
}
/*---------------------------------------------------------------------------*/
uint8_t
rf_ble_is_active()
{
return ble_mode_on;
}
/*---------------------------------------------------------------------------*/
void
rf_ble_beacond_stop()
{
process_exit(&rf_ble_beacon_process);
}
/*---------------------------------------------------------------------------*/
static uint8_t
rf_radio_setup()
{
uint32_t cmd_status;
rfc_CMD_RADIO_SETUP_t cmd;
/* Create radio setup command */
rf_core_init_radio_op((rfc_radioOp_t *)&cmd, sizeof(cmd), CMD_RADIO_SETUP);
cmd.txPower.IB = tx_power.ib;
cmd.txPower.GC = tx_power.gc;
cmd.txPower.tempCoeff = tx_power.temp_coeff;
cmd.txPower.boost = tx_power.boost;
cmd.pRegOverride = ble_overrides;
cmd.mode = 0;
/* Send Radio setup to RF Core */
if(rf_core_send_cmd((uint32_t)&cmd, &cmd_status) != RF_CORE_CMD_OK) {
PRINTF("rf_radio_setup: CMDSTA=0x%08lx, status=0x%04x\n",
cmd_status, cmd.status);
return RF_CORE_CMD_ERROR;
}
/* Wait until radio setup is done */
if(rf_core_wait_cmd_done(&cmd) != RF_CORE_CMD_OK) {
PRINTF("rf_radio_setup: wait, CMDSTA=0x%08lx, status=0x%04x\n",
cmd_status, cmd.status);
return RF_CORE_CMD_ERROR;
}
return RF_CORE_CMD_OK;
}
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(rf_ble_beacon_process, ev, data)
{
uint8_t was_on;
int j;
uint32_t cmd_status;
bool interrupts_disabled;
PROCESS_BEGIN();
while(1) {
etimer_set(&ble_adv_et, beacond_config.interval);
PROCESS_WAIT_EVENT();
if(ev == PROCESS_EVENT_EXIT) {
PROCESS_EXIT();
}
/* Set the adv payload each pass: The device name may have changed */
p = 0;
/* device info */
memset(payload, 0, BLE_ADV_PAYLOAD_BUF_LEN);
payload[p++] = 0x02; /* 2 bytes */
payload[p++] = BLE_ADV_TYPE_DEVINFO;
payload[p++] = 0x1a; /* LE general discoverable + BR/EDR */
payload[p++] = 1 + strlen(beacond_config.adv_name);
payload[p++] = BLE_ADV_TYPE_NAME;
memcpy(&payload[p], beacond_config.adv_name,
strlen(beacond_config.adv_name));
p += strlen(beacond_config.adv_name);
for(i = 0; i < BLE_ADV_MESSAGES; i++) {
/*
* Under ContikiMAC, some IEEE-related operations will be called from an
* interrupt context. We need those to see that we are in BLE mode.
*/
interrupts_disabled = ti_lib_int_master_disable();
ble_mode_on = RF_BLE_ACTIVE;
if(!interrupts_disabled) {
ti_lib_int_master_enable();
}
/*
* Send BLE_ADV_MESSAGES beacon bursts. Each burst on all three
* channels, with a BLE_ADV_DUTY_CYCLE interval between bursts
*
* First, determine our state:
*
* If we are running NullRDC, we are likely in IEEE RX mode. We need to
* abort the IEEE BG Op before entering BLE mode.
* If we are ContikiMAC, we are likely off, in which case we need to
* boot the CPE before entering BLE mode
*/
was_on = rf_core_is_accessible();
if(was_on) {
/*
* We were on: If we are in the process of receiving a frame, abort the
* BLE beacon burst. Otherwise, terminate the primary radio Op so we
* can switch to BLE mode
*/
if(NETSTACK_RADIO.receiving_packet()) {
PRINTF("rf_ble_beacon_process: We were receiving\n");
/* Abort this pass */
break;
}
rf_core_primary_mode_abort();
} else {
/* Request the HF XOSC to source the HF clock. */
oscillators_request_hf_xosc();
/* We were off: Boot the CPE */
if(rf_core_boot() != RF_CORE_CMD_OK) {
PRINTF("rf_ble_beacon_process: rf_core_boot() failed\n");
/* Abort this pass */
break;
}
/* Trigger a switch to the XOSC, so that we can use the FS */
oscillators_switch_to_hf_xosc();
}
/* Enter BLE mode */
if(rf_radio_setup() != RF_CORE_CMD_OK) {
PRINTF("cc26xx_rf_ble_beacon_process: Error entering BLE mode\n");
/* Continue so we can at least try to restore our previous state */
} else {
/* Send advertising packets on all 3 advertising channels */
for(j = 37; j <= 39; j++) {
if(send_ble_adv_nc(j, payload, p) != RF_CORE_CMD_OK) {
PRINTF("cc26xx_rf_ble_beacon_process: Channel=%d, "
"Error advertising\n", j);
/* Break the loop, but don't return just yet */
break;
}
}
}
/* Send a CMD_STOP command to RF Core */
if(rf_core_send_cmd(CMDR_DIR_CMD(CMD_STOP), &cmd_status) != RF_CORE_CMD_OK) {
PRINTF("cc26xx_rf_ble_beacon_process: status=0x%08lx\n", cmd_status);
/* Continue... */
}
if(was_on) {
/* We were on, go back to previous primary mode */
rf_core_primary_mode_restore();
} else {
/* We were off. Shut back off */
rf_core_power_down();
/* Switch HF clock source to the RCOSC to preserve power */
oscillators_switch_to_hf_rc();
}
etimer_set(&ble_adv_et, BLE_ADV_DUTY_CYCLE);
interrupts_disabled = ti_lib_int_master_disable();
ble_mode_on = RF_BLE_IDLE;
if(!interrupts_disabled) {
ti_lib_int_master_enable();
}
/* Wait unless this is the last burst */
if(i < BLE_ADV_MESSAGES - 1) {
PROCESS_WAIT_EVENT();
}
}
interrupts_disabled = ti_lib_int_master_disable();
ble_mode_on = RF_BLE_IDLE;
if(!interrupts_disabled) {
ti_lib_int_master_enable();
}
}
PROCESS_END();
}
/*---------------------------------------------------------------------------*/
/**
* @}
* @}
*/

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
* Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -10,7 +10,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
@ -28,59 +27,35 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup cc26xx
* \addtogroup rf-core
* @{
*
* \defgroup cc26xx-rf CC26xx RF driver
*
* The CC26xx RF has dual capability: It can operate in IEEE 802.15.4 mode at
* 2.4GHz, but it can also operate in BLE mode. This driver provides a fully
* contiki-compliant .15.4 functionality, but it also provides some very basic
* BLE capability.
* \defgroup rf-core-ble CC13xx/CC26xx BLE driver
*
* @{
*/
/**
*
* \file
* Header file for the CC26xx RF driver
* Header file for the CC13xx/CC26xx BLE driver
*/
#ifndef CC26XX_RF_H_
#define CC26XX_RF_H_
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "cc26xx-model.h"
#include "dev/radio.h"
#ifndef RF_BLE_H_
#define RF_BLE_H_
/*---------------------------------------------------------------------------*/
#include "contiki-conf.h"
#include "rf-core/rf-core.h"
#include <stdint.h>
/*---------------------------------------------------------------------------*/
#ifdef CC26XX_RF_CONF_CHANNEL
#define CC26XX_RF_CHANNEL CC26XX_RF_CONF_CHANNEL
#ifdef RF_BLE_CONF_ENABLED
#define RF_BLE_ENABLED RF_BLE_CONF_ENABLED
#else
#define CC26XX_RF_CHANNEL 18
#endif /* CC26XX_RF_CONF_CHANNEL */
#ifdef CC26XX_RF_CONF_AUTOACK
#define CC26XX_RF_AUTOACK CC26XX_RF_CONF_AUTOACK
#else
#define CC26XX_RF_AUTOACK 1
#endif /* CC26XX_RF_CONF_AUTOACK */
#if (CC26XX_RF_CONF_BLE_SUPPORT) && (CC26XX_MODEL_CPU_VARIANT == 2650)
#define CC26XX_RF_BLE_SUPPORT CC26XX_RF_CONF_BLE_SUPPORT
#else
#define CC26XX_RF_BLE_SUPPORT 0
#define RF_BLE_ENABLED 1
#endif
/*---------------------------------------------------------------------------
* RF Config
*---------------------------------------------------------------------------*/
/* Constants */
#define CC26XX_RF_CHANNEL_MIN 11
#define CC26XX_RF_CHANNEL_MAX 26
#define CC26XX_RF_CHANNEL_SPACING 5
#define CC26XX_RF_CHANNEL_SET_ERROR -1
#define CC26XX_RF_MAX_PACKET_LEN 127
#define CC26XX_RF_MIN_PACKET_LEN 4
/*---------------------------------------------------------------------------*/
#define RF_BLE_IDLE 0
#define RF_BLE_ACTIVE 1
/*---------------------------------------------------------------------------*/
/**
* \brief Set the device name to use with the BLE advertisement/beacon daemon
@ -91,24 +66,31 @@
* this function can be used to configure a single parameter at a time if so
* desired.
*/
void cc26xx_rf_ble_beacond_config(clock_time_t interval, const char *name);
void rf_ble_beacond_config(clock_time_t interval, const char *name);
/**
* \brief Start the BLE advertisement/beacon daemon
* \return 1: Success, 0: Failure
* \return RF_CORE_CMD_OK: Success, RF_CORE_CMD_ERROR: Failure
*
* Before calling this function, the name to advertise must first be set by
* calling cc26xx_rf_ble_beacond_set_adv_name(). Otherwise, this function will
* return an error.
* calling rf_ble_beacond_config(). Otherwise, this function will return an
* error.
*/
uint8_t cc26xx_rf_ble_beacond_start(void);
uint8_t rf_ble_beacond_start(void);
/**
* \brief Stop the BLE advertisement/beacon daemon
*/
void cc26xx_rf_ble_beacond_stop(void);
void rf_ble_beacond_stop(void);
/**
* \brief Check whether the BLE beacond is currently active
* \retval 1 The radio is in BLE mode
* \retval 0 The BLE daemon is not active, or disabled
*/
uint8_t rf_ble_is_active(void);
/*---------------------------------------------------------------------------*/
#endif /* CC26XX_RF_H_ */
#endif /* RF_BLE_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}

View file

@ -0,0 +1,518 @@
/*
* Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup rf-core
* @{
*
* \file
* Implementation of the CC13xx/CC26xx RF core driver
*/
/*---------------------------------------------------------------------------*/
#include "contiki-conf.h"
#include "dev/watchdog.h"
#include "sys/process.h"
#include "sys/energest.h"
#include "net/netstack.h"
#include "net/packetbuf.h"
#include "net/rime/rimestats.h"
#include "rf-core/rf-core.h"
#include "ti-lib.h"
/*---------------------------------------------------------------------------*/
/* RF core and RF HAL API */
#include "hw_rfc_dbell.h"
#include "hw_rfc_pwr.h"
/*---------------------------------------------------------------------------*/
/* RF Core Mailbox API */
#include "rf-core/api/mailbox.h"
#include "rf-core/api/common_cmd.h"
#include "rf-core/api/ble_cmd.h"
#include "rf-core/api/ieee_cmd.h"
#include "rf-core/api/data_entry.h"
#include "rf-core/api/ble_mailbox.h"
#include "rf-core/api/ieee_mailbox.h"
#include "rf-core/api/prop_mailbox.h"
#include "rf-core/api/prop_cmd.h"
/*---------------------------------------------------------------------------*/
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
/*---------------------------------------------------------------------------*/
#define DEBUG 0
#if DEBUG
#define PRINTF(...) printf(__VA_ARGS__)
#else
#define PRINTF(...)
#endif
/*---------------------------------------------------------------------------*/
#ifdef __GNUC__
#define CC_ALIGN_ATTR(n) __attribute__ ((aligned(n)))
#else
#define CC_ALIGN_ATTR(n)
#endif
/*---------------------------------------------------------------------------*/
#ifdef RF_CORE_CONF_DEBUG_CRC
#define RF_CORE_DEBUG_CRC RF_CORE_CONF_DEBUG_CRC
#else
#define RF_CORE_DEBUG_CRC DEBUG
#endif
/*---------------------------------------------------------------------------*/
/* RF interrupts */
#define RX_FRAME_IRQ IRQ_RX_ENTRY_DONE
#define ERROR_IRQ IRQ_INTERNAL_ERROR
#define RX_NOK_IRQ IRQ_RX_NOK
/* Those IRQs are enabled all the time */
#if RF_CORE_DEBUG_CRC
#define ENABLED_IRQS (RX_FRAME_IRQ | ERROR_IRQ | RX_NOK_IRQ)
#else
#define ENABLED_IRQS (RX_FRAME_IRQ | ERROR_IRQ)
#endif
#define cc26xx_rf_cpe0_isr RFCCPE0IntHandler
#define cc26xx_rf_cpe1_isr RFCCPE1IntHandler
/*---------------------------------------------------------------------------*/
/* Remember the last Radio Op issued to the radio */
static rfc_radioOp_t *last_radio_op = NULL;
/*---------------------------------------------------------------------------*/
/* A struct holding pointers to the primary mode's abort() and restore() */
static const rf_core_primary_mode_t *primary_mode = NULL;
/*---------------------------------------------------------------------------*/
PROCESS(rf_core_process, "CC13xx / CC26xx RF driver");
/*---------------------------------------------------------------------------*/
#define RF_CORE_CLOCKS_MASK (RFC_PWR_PWMCLKEN_RFC_M | RFC_PWR_PWMCLKEN_CPE_M \
| RFC_PWR_PWMCLKEN_CPERAM_M)
/*---------------------------------------------------------------------------*/
uint8_t
rf_core_is_accessible()
{
if(ti_lib_prcm_rf_ready() &&
ti_lib_prcm_power_domain_status(PRCM_DOMAIN_RFCORE) ==
PRCM_DOMAIN_POWER_ON) {
return RF_CORE_ACCESSIBLE;
}
return RF_CORE_NOT_ACCESSIBLE;
}
/*---------------------------------------------------------------------------*/
uint_fast8_t
rf_core_send_cmd(uint32_t cmd, uint32_t *status)
{
uint32_t timeout_count = 0;
bool interrupts_disabled;
bool is_radio_op = false;
/* If cmd is 4-byte aligned, then it's a radio OP. Clear the status field */
if((cmd & 0x03) == 0) {
is_radio_op = true;
((rfc_radioOp_t *)cmd)->status = RF_CORE_RADIO_OP_STATUS_IDLE;
}
/*
* Make sure ContikiMAC doesn't turn us off from within an interrupt while
* we are accessing RF Core registers
*/
interrupts_disabled = ti_lib_int_master_disable();
if(!rf_core_is_accessible()) {
PRINTF("rf_core_send_cmd: RF was off\n");
if(!interrupts_disabled) {
ti_lib_int_master_enable();
}
return RF_CORE_CMD_ERROR;
}
if(is_radio_op) {
uint16_t command_no = ((rfc_radioOp_t *)cmd)->commandNo;
if((command_no & RF_CORE_COMMAND_PROTOCOL_MASK) != RF_CORE_COMMAND_PROTOCOL_COMMON &&
(command_no & RF_CORE_COMMAND_TYPE_MASK) == RF_CORE_COMMAND_TYPE_RADIO_OP) {
last_radio_op = (rfc_radioOp_t *)cmd;
}
}
HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) = cmd;
do {
*status = HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDSTA);
if(++timeout_count > 50000) {
PRINTF("rf_core_send_cmd: 0x%08lx Timeout\n", cmd);
if(!interrupts_disabled) {
ti_lib_int_master_enable();
}
return RF_CORE_CMD_ERROR;
}
} while(*status == RF_CORE_CMDSTA_PENDING);
if(!interrupts_disabled) {
ti_lib_int_master_enable();
}
/*
* If we reach here the command is no longer pending. It is either completed
* successfully or with error
*/
return (*status & RF_CORE_CMDSTA_RESULT_MASK) == RF_CORE_CMDSTA_DONE;
}
/*---------------------------------------------------------------------------*/
uint_fast8_t
rf_core_wait_cmd_done(void *cmd)
{
volatile rfc_radioOp_t *command = (rfc_radioOp_t *)cmd;
uint32_t timeout_cnt = 0;
/*
* 0xn4nn=DONE, 0x0400=DONE_OK while all other "DONE" values means done
* but with some kind of error (ref. "Common radio operation status codes")
*/
do {
if(++timeout_cnt > 500000) {
return RF_CORE_CMD_ERROR;
}
} while((command->status & RF_CORE_RADIO_OP_MASKED_STATUS)
!= RF_CORE_RADIO_OP_MASKED_STATUS_DONE);
return (command->status & RF_CORE_RADIO_OP_MASKED_STATUS)
== RF_CORE_RADIO_OP_STATUS_DONE_OK;
}
/*---------------------------------------------------------------------------*/
int
rf_core_power_up()
{
uint32_t cmd_status;
bool interrupts_disabled = ti_lib_int_master_disable();
ti_lib_int_pend_clear(INT_RF_CPE0);
ti_lib_int_pend_clear(INT_RF_CPE1);
ti_lib_int_disable(INT_RF_CPE0);
ti_lib_int_disable(INT_RF_CPE1);
/* Enable RF Core power domain */
ti_lib_prcm_power_domain_on(PRCM_DOMAIN_RFCORE);
while(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_RFCORE)
!= PRCM_DOMAIN_POWER_ON);
ti_lib_prcm_domain_enable(PRCM_DOMAIN_RFCORE);
ti_lib_prcm_load_set();
while(!ti_lib_prcm_load_get());
while(!rf_core_is_accessible()) {
PRINTF("rf_core_power_up: Not ready\n");
}
HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0x0;
HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIEN) = 0x0;
ti_lib_int_enable(INT_RF_CPE0);
ti_lib_int_enable(INT_RF_CPE1);
if(!interrupts_disabled) {
ti_lib_int_master_enable();
}
/* Let CPE boot */
HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) = RF_CORE_CLOCKS_MASK;
/* Send ping (to verify RFCore is ready and alive) */
if(rf_core_send_cmd(CMDR_DIR_CMD(CMD_PING), &cmd_status) != RF_CORE_CMD_OK) {
PRINTF("rf_core_power_up: CMD_PING fail, CMDSTA=0x%08lx\n", cmd_status);
return RF_CORE_CMD_ERROR;
}
return RF_CORE_CMD_OK;
}
/*---------------------------------------------------------------------------*/
void
rf_core_power_down()
{
bool interrupts_disabled = ti_lib_int_master_disable();
ti_lib_int_disable(INT_RF_CPE0);
ti_lib_int_disable(INT_RF_CPE1);
if(rf_core_is_accessible()) {
HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0x0;
HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIEN) = 0x0;
}
/* Shut down the RFCORE clock domain in the MCU VD */
ti_lib_prcm_domain_disable(PRCM_DOMAIN_RFCORE);
ti_lib_prcm_load_set();
while(!ti_lib_prcm_load_get());
/* Turn off RFCORE PD */
ti_lib_prcm_power_domain_off(PRCM_DOMAIN_RFCORE);
while(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_RFCORE)
!= PRCM_DOMAIN_POWER_OFF);
ti_lib_int_pend_clear(INT_RF_CPE0);
ti_lib_int_pend_clear(INT_RF_CPE1);
ti_lib_int_enable(INT_RF_CPE0);
ti_lib_int_enable(INT_RF_CPE1);
if(!interrupts_disabled) {
ti_lib_int_master_enable();
}
}
/*---------------------------------------------------------------------------*/
uint8_t
rf_core_set_modesel()
{
uint8_t rv = RF_CORE_CMD_ERROR;
if(ti_lib_chipinfo_chip_family_is_cc26xx()) {
if(ti_lib_chipinfo_supports_ble() == true &&
ti_lib_chipinfo_supports_ieee_802_15_4() == true) {
/* CC2650 */
HWREG(PRCM_BASE + PRCM_O_RFCMODESEL) = PRCM_RFCMODESEL_CURR_MODE5;
rv = RF_CORE_CMD_OK;
} else if(ti_lib_chipinfo_supports_ble() == false &&
ti_lib_chipinfo_supports_ieee_802_15_4() == true) {
/* CC2630 */
HWREG(PRCM_BASE + PRCM_O_RFCMODESEL) = PRCM_RFCMODESEL_CURR_MODE2;
rv = RF_CORE_CMD_OK;
}
} else if(ti_lib_chipinfo_chip_family_is_cc13xx()) {
if(ti_lib_chipinfo_supports_ble() == false &&
ti_lib_chipinfo_supports_ieee_802_15_4() == false) {
/* CC1310 */
HWREG(PRCM_BASE + PRCM_O_RFCMODESEL) = PRCM_RFCMODESEL_CURR_MODE3;
rv = RF_CORE_CMD_OK;
}
}
return rv;
}
/*---------------------------------------------------------------------------*/
uint8_t
rf_core_start_rat()
{
uint32_t cmd_status;
/* Start radio timer (RAT) */
if(rf_core_send_cmd(CMDR_DIR_CMD(CMD_START_RAT), &cmd_status)
!= RF_CORE_CMD_OK) {
PRINTF("rf_core_apply_patches: START_RAT fail, CMDSTA=0x%08lx\n",
cmd_status);
return RF_CORE_CMD_ERROR;
}
return RF_CORE_CMD_OK;
}
/*---------------------------------------------------------------------------*/
uint8_t
rf_core_boot()
{
if(rf_core_power_up() != RF_CORE_CMD_OK) {
PRINTF("rf_core_boot: rf_core_power_up() failed\n");
rf_core_power_down();
return RF_CORE_CMD_ERROR;
}
if(rf_core_start_rat() != RF_CORE_CMD_OK) {
PRINTF("rf_core_boot: rf_core_start_rat() failed\n");
rf_core_power_down();
return RF_CORE_CMD_ERROR;
}
return RF_CORE_CMD_OK;
}
/*---------------------------------------------------------------------------*/
void
rf_core_setup_interrupts()
{
bool interrupts_disabled;
/* We are already turned on by the caller, so this should not happen */
if(!rf_core_is_accessible()) {
PRINTF("setup_interrupts: No access\n");
return;
}
/* Disable interrupts */
interrupts_disabled = ti_lib_int_master_disable();
/* Set all interrupt channels to CPE0 channel, error to CPE1 */
HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEISL) = ERROR_IRQ;
/* Acknowledge configured interrupts */
HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIEN) = ENABLED_IRQS;
/* Clear interrupt flags, active low clear(?) */
HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0x0;
ti_lib_int_pend_clear(INT_RF_CPE0);
ti_lib_int_pend_clear(INT_RF_CPE1);
ti_lib_int_enable(INT_RF_CPE0);
ti_lib_int_enable(INT_RF_CPE1);
if(!interrupts_disabled) {
ti_lib_int_master_enable();
}
}
/*---------------------------------------------------------------------------*/
void
rf_core_cmd_done_en()
{
HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = ENABLED_IRQS;
HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIEN) = ENABLED_IRQS +
IRQ_LAST_COMMAND_DONE;
}
/*---------------------------------------------------------------------------*/
void
rf_core_cmd_done_dis()
{
HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIEN) = ENABLED_IRQS;
}
/*---------------------------------------------------------------------------*/
rfc_radioOp_t *
rf_core_get_last_radio_op()
{
return last_radio_op;
}
/*---------------------------------------------------------------------------*/
void
rf_core_init_radio_op(rfc_radioOp_t *op, uint16_t len, uint16_t command)
{
memset(op, 0, len);
op->commandNo = command;
op->condition.rule = COND_NEVER;
}
/*---------------------------------------------------------------------------*/
void
rf_core_primary_mode_register(const rf_core_primary_mode_t *mode)
{
primary_mode = mode;
}
/*---------------------------------------------------------------------------*/
void
rf_core_primary_mode_abort()
{
if(primary_mode) {
if(primary_mode->abort) {
primary_mode->abort();
}
}
}
/*---------------------------------------------------------------------------*/
uint8_t
rf_core_primary_mode_restore()
{
if(primary_mode) {
if(primary_mode->restore) {
return primary_mode->restore();
}
}
return RF_CORE_CMD_ERROR;
}
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(rf_core_process, ev, data)
{
int len;
PROCESS_BEGIN();
while(1) {
PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL);
do {
watchdog_periodic();
packetbuf_clear();
len = NETSTACK_RADIO.read(packetbuf_dataptr(), PACKETBUF_SIZE);
if(len > 0) {
packetbuf_set_datalen(len);
NETSTACK_RDC.input();
}
} while(len > 0);
}
PROCESS_END();
}
/*---------------------------------------------------------------------------*/
static void
rx_nok_isr(void)
{
RIMESTATS_ADD(badcrc);
PRINTF("RF: Bad CRC\n");
}
/*---------------------------------------------------------------------------*/
void
cc26xx_rf_cpe1_isr(void)
{
ENERGEST_ON(ENERGEST_TYPE_IRQ);
PRINTF("RF Error\n");
if(!rf_core_is_accessible()) {
if(rf_core_power_up() != RF_CORE_CMD_OK) {
return;
}
}
/* Clear interrupt flags */
HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0x0;
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
void
cc26xx_rf_cpe0_isr(void)
{
ENERGEST_ON(ENERGEST_TYPE_IRQ);
if(!rf_core_is_accessible()) {
printf("RF ISR called but RF not ready... PANIC!!\n");
if(rf_core_power_up() != RF_CORE_CMD_OK) {
PRINTF("rf_core_power_up() failed\n");
return;
}
}
ti_lib_int_master_disable();
if(HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) & RX_FRAME_IRQ) {
process_poll(&rf_core_process);
}
if(RF_CORE_DEBUG_CRC) {
if(HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) & RX_NOK_IRQ) {
rx_nok_isr();
}
}
/* Clear interrupt flags */
HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0x0;
ti_lib_int_master_enable();
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
/** @} */

View file

@ -0,0 +1,418 @@
/*
* Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup cc26xx
* @{
*
* \defgroup rf-core CC13xx/CC26xx RF core
*
* Different flavours of chips of the CC13xx/CC26xx family have different
* radio capability. For example, the CC2650 can operate in IEEE 802.15.4 mode
* at 2.4GHz, but it can also operate in BLE mode. The CC1310 only supports
* sub-ghz mode.
*
* However, there are many radio functionalities that are identical across
* all chips. The rf-core driver provides support for this common functionality
*
* @{
*
* \file
* Header file for the CC13xx/CC26xx RF core driver
*/
/*---------------------------------------------------------------------------*/
#ifndef RF_CORE_H_
#define RF_CORE_H_
/*---------------------------------------------------------------------------*/
#include "contiki-conf.h"
#include "rf-core/api/common_cmd.h"
#include <stdint.h>
#include <stdbool.h>
/*---------------------------------------------------------------------------*/
/* The channel to use in IEEE or prop mode. */
#ifdef RF_CORE_CONF_CHANNEL
#define RF_CORE_CHANNEL RF_CORE_CONF_CHANNEL
#else
#define RF_CORE_CHANNEL 25
#endif /* RF_CORE_CONF_IEEE_MODE_CHANNEL */
/*---------------------------------------------------------------------------*/
#define RF_CORE_CMD_ERROR 0
#define RF_CORE_CMD_OK 1
/*---------------------------------------------------------------------------*/
/**
* \brief A data strcuture representing the radio's primary mode of operation
*
* The CC13xx / CC26xx radio supports up to potentially 3 modes: IEEE, Prop and
* BLE. Within Contiki, we assume that the radio is by default in one of IEEE
* or Prop in order to support standard 6LoWPAN / .15.4 operation. The BLE
* mode interrupts this so called "primary" mode in order to send BLE adv
* messages. Once BLE is done advertising, we need to be able to restore the
* previous .15.4 mode. Unfortunately, the only way this can be done with
* NETSTACK_RADIO API is by fully power-cycling the radio, which is something
* we do not want to do.
*
* Thus, we declare a secondary data structure for primary mode drivers (IEEE
* or Prop). We use this data structure to issue "soft off" and "back on"
* commands. Soft off in this context means stopping RX (e.g. the respective
* IEEE RX operation), but without shutting down the RF core (which is what
* NETSTACK_RADIO.off() would have done). We then remember what mode we were
* using in order to be able to re-enter RX mode for this mode.
*
* A NETSTACK_RADIO driver will declare those two functions somewhere within
* its module of implementation. During its init() routine, it will notify
* the RF core module so that the latter can abort and restore operations.
*/
typedef struct rf_core_primary_mode_s {
/**
* \brief A pointer to a function used to abort the current radio op
*/
void (*abort)(void);
/**
* \brief A pointer to a function that will restore the previous radio op
* \return RF_CORE_CMD_OK or RF_CORE_CMD_ERROR
*/
uint8_t (*restore)(void);
} rf_core_primary_mode_t;
/*---------------------------------------------------------------------------*/
/* RF Command status constants - Correspond to values in the CMDSTA register */
#define RF_CORE_CMDSTA_PENDING 0x00
#define RF_CORE_CMDSTA_DONE 0x01
#define RF_CORE_CMDSTA_ILLEGAL_PTR 0x81
#define RF_CORE_CMDSTA_UNKNOWN_CMD 0x82
#define RF_CORE_CMDSTA_UNKNOWN_DIR_CMD 0x83
#define RF_CORE_CMDSTA_CONTEXT_ERR 0x85
#define RF_CORE_CMDSTA_SCHEDULING_ERR 0x86
#define RF_CORE_CMDSTA_PAR_ERR 0x87
#define RF_CORE_CMDSTA_QUEUE_ERR 0x88
#define RF_CORE_CMDSTA_QUEUE_BUSY 0x89
/* Status values starting with 0x8 correspond to errors */
#define RF_CORE_CMDSTA_ERR_MASK 0x80
/* CMDSTA is 32-bits. Return value in bits 7:0 */
#define RF_CORE_CMDSTA_RESULT_MASK 0xFF
#define RF_CORE_RADIO_OP_STATUS_IDLE 0x0000
/*---------------------------------------------------------------------------*/
#define RF_CORE_NOT_ACCESSIBLE 0x00
#define RF_CORE_ACCESSIBLE 0x01
/*---------------------------------------------------------------------------*/
/* RF Radio Op status constants. Field 'status' in Radio Op command struct */
#define RF_CORE_RADIO_OP_STATUS_IDLE 0x0000
#define RF_CORE_RADIO_OP_STATUS_PENDING 0x0001
#define RF_CORE_RADIO_OP_STATUS_ACTIVE 0x0002
#define RF_CORE_RADIO_OP_STATUS_SKIPPED 0x0003
#define RF_CORE_RADIO_OP_STATUS_DONE_OK 0x0400
#define RF_CORE_RADIO_OP_STATUS_DONE_COUNTDOWN 0x0401
#define RF_CORE_RADIO_OP_STATUS_DONE_RXERR 0x0402
#define RF_CORE_RADIO_OP_STATUS_DONE_TIMEOUT 0x0403
#define RF_CORE_RADIO_OP_STATUS_DONE_STOPPED 0x0404
#define RF_CORE_RADIO_OP_STATUS_DONE_ABORT 0x0405
#define RF_CORE_RADIO_OP_STATUS_ERROR_PAST_START 0x0800
#define RF_CORE_RADIO_OP_STATUS_ERROR_START_TRIG 0x0801
#define RF_CORE_RADIO_OP_STATUS_ERROR_CONDITION 0x0802
#define RF_CORE_RADIO_OP_STATUS_ERROR_PAR 0x0803
#define RF_CORE_RADIO_OP_STATUS_ERROR_POINTER 0x0804
#define RF_CORE_RADIO_OP_STATUS_ERROR_CMDID 0x0805
#define RF_CORE_RADIO_OP_STATUS_ERROR_NO_SETUP 0x0807
#define RF_CORE_RADIO_OP_STATUS_ERROR_NO_FS 0x0808
#define RF_CORE_RADIO_OP_STATUS_ERROR_SYNTH_PROG 0x0809
/* Additional Op status values for IEEE mode */
#define RF_CORE_RADIO_OP_STATUS_IEEE_SUSPENDED 0x2001
#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_OK 0x2400
#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_BUSY 0x2401
#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_STOPPED 0x2402
#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_ACK 0x2403
#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_ACKPEND 0x2404
#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_TIMEOUT 0x2405
#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_BGEND 0x2406
#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_ABORT 0x2407
#define RF_CORE_RADIO_OP_STATUS_ERROR_WRONG_BG 0x0806
#define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_PAR 0x2800
#define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_NO_SETUP 0x2801
#define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_NO_FS 0x2802
#define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_SYNTH_PROG 0x2803
#define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_RXOVF 0x2804
#define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_TXUNF 0x2805
/* Op status values for BLE mode */
#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_OK 0x1400
#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_RXTIMEOUT 0x1401
#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_NOSYNC 0x1402
#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_RXERR 0x1403
#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_CONNECT 0x1404
#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_MAXNACK 0x1405
#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_ENDED 0x1406
#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_ABORT 0x1407
#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_STOPPED 0x1408
#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_PAR 0x1800
#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_RXBUF 0x1801
#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_NO_SETUP 0x1802
#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_NO_FS 0x1803
#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_SYNTH_PROG 0x1804
#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_RXOVF 0x1805
#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_TXUNF 0x1806
/* Op status values for proprietary mode */
#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_OK 0x3400
#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_RXTIMEOUT 0x3401
#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_BREAK 0x3402
#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_ENDED 0x3403
#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_STOPPED 0x3404
#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_ABORT 0x3405
#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_RXERR 0x3406
#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_IDLE 0x3407
#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_BUSY 0x3408
#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_IDLETIMEOUT 0x3409
#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_BUSYTIMEOUT 0x340A
#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_PAR 0x3800
#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_RXBUF 0x3801
#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_RXFULL 0x3802
#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_NO_SETUP 0x3803
#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_NO_FS 0x3804
#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_RXOVF 0x3805
#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_TXUNF 0x3806
/* Bits 15:12 signify the protocol */
#define RF_CORE_RADIO_OP_STATUS_PROTO_MASK 0xF000
#define RF_CORE_RADIO_OP_STATUS_PROTO_GENERIC 0x0000
#define RF_CORE_RADIO_OP_STATUS_PROTO_BLE 0x1000
#define RF_CORE_RADIO_OP_STATUS_PROTO_IEEE 0x2000
#define RF_CORE_RADIO_OP_STATUS_PROTO_PROP 0x3000
/* Bits 11:10 signify Running / Done OK / Done with error */
#define RF_CORE_RADIO_OP_MASKED_STATUS 0x0C00
#define RF_CORE_RADIO_OP_MASKED_STATUS_RUNNING 0x0000
#define RF_CORE_RADIO_OP_MASKED_STATUS_DONE 0x0400
#define RF_CORE_RADIO_OP_MASKED_STATUS_ERROR 0x0800
/*---------------------------------------------------------------------------*/
/* Command Types */
#define RF_CORE_COMMAND_TYPE_MASK 0x0C00
#define RF_CORE_COMMAND_TYPE_IMMEDIATE 0x0000
#define RF_CORE_COMMAND_TYPE_RADIO_OP 0x0800
#define RF_CORE_COMMAND_TYPE_IEEE_BG_RADIO_OP 0x0800
#define RF_CORE_COMMAND_TYPE_IEEE_FG_RADIO_OP 0x0C00
#define RF_CORE_COMMAND_PROTOCOL_MASK 0x3000
#define RF_CORE_COMMAND_PROTOCOL_COMMON 0x0000
#define RF_CORE_COMMAND_PROTOCOL_BLE 0x1000
#define RF_CORE_COMMAND_PROTOCOL_IEEE 0x2000
#define RF_CORE_COMMAND_PROTOCOL_PROP 0x3000
/*---------------------------------------------------------------------------*/
/* Make the main driver process visible to mode drivers */
PROCESS_NAME(rf_core_process);
/*---------------------------------------------------------------------------*/
/**
* \brief Check whether the RF core is accessible
* \retval RF_CORE_ACCESSIBLE The core is powered and ready for access
* \retval RF_CORE_NOT_ACCESSIBLE The core is not ready
*
* If this function returns RF_CORE_NOT_ACCESSIBLE, rf_core_power_up() must be
* called before any attempt to access the core.
*/
uint8_t rf_core_is_accessible(void);
/**
* \brief Sends a command to the RF core.
*
* \param cmd The command value or a pointer to a command buffer
* \param status A pointer to a variable which will hold the status
* \return RF_CORE_CMD_OK or RF_CORE_CMD_ERROR
*
* This function supports all three types of command (Radio OP, immediate and
* direct)
*
* For immediate and Radio OPs, cmd is a pointer to the data structure
* containing the command and its parameters. This data structure must be
* 4-byte aligned.
*
* For direct commands, cmd contains the value of the command alongside its
* parameters. This value will be written to CMDSTA verbatim, so the command
* ID must be in the 16 high bits, and the 2 LS bits must be set to 01 by the
* caller.
*
* The caller is responsible of allocating and populating cmd for Radio OP and
* immediate commands
*
* The caller is responsible for allocating status
*
* For immediate commands and radio Ops, this function will set the command's
* status field to RF_CORE_RADIO_OP_STATUS_IDLE before sending it to the RF
*/
uint_fast8_t rf_core_send_cmd(uint32_t cmd, uint32_t *status);
/**
* \brief Block and wait for a Radio op to complete
* \param cmd A pointer to any command's structure
* \retval RF_CORE_CMD_OK the command completed with status _DONE_OK
* \retval RF_CORE_CMD_ERROR Timeout exceeded or the command completed with
* status _DONE_xxx (e.g. RF_CORE_RADIO_OP_STATUS_DONE_TIMEOUT)
*/
uint_fast8_t rf_core_wait_cmd_done(void *cmd);
/**
* \brief Turn on power to the RFC and boot it.
* \return RF_CORE_CMD_OK or RF_CORE_CMD_ERROR
*/
int rf_core_power_up(void);
/**
* \brief Disable RFCORE clock domain in the MCU VD and turn off the RFCORE PD
*/
void rf_core_power_down(void);
/**
* \brief Initialise RF APIs in the RF core
* \return RF_CORE_CMD_OK or RF_CORE_CMD_ERROR
*
* Depending on chip family and capability, this function will set the correct
* value to PRCM.RFCMODESEL
*/
uint8_t rf_core_set_modesel(void);
/**
* \brief Start the CM0 RAT
* \return RF_CORE_CMD_OK or RF_CORE_CMD_ERROR
*
* This function must be called each time the CM0 boots. The boot sequence
* can be performed automatically by calling rf_core_boot() if patches are not
* required. If patches are required then the patches must be applied after
* power up and before calling this function.
*/
uint8_t rf_core_start_rat(void);
/**
* \brief Boot the RF Core
* \return RF_CORE_CMD_OK or RF_CORE_CMD_ERROR
*
* This function will perform the CM0 boot sequence. It will first power it up
* and then start the RAT. If a patch is required, then the mode driver must
* not call this function and perform the sequence manually, applying patches
* after boot and before calling rf_core_start_rat().
*
* The function will return RF_CORE_CMD_ERROR if any of those steps fails. If
* the boot sequence fails to complete, the RF Core will be powered down.
*/
uint8_t rf_core_boot(void);
/**
* \brief Setup RF core interrupts
*/
void rf_core_setup_interrupts(void);
/**
* \brief Enable the LAST_CMD_DONE interrupt.
*
* This is used within TX routines in order to be able to sleep the CM3 and
* wake up after TX has finished
*
* \sa rf_core_cmd_done_dis()
*/
void rf_core_cmd_done_en(void);
/**
* \brief Disable the LAST_CMD_DONE interrupt.
*
* This is used within TX routines after TX has completed
*
* \sa rf_core_cmd_done_en()
*/
void rf_core_cmd_done_dis(void);
/**
* \brief Returns a pointer to the most recent proto-dependent Radio Op
* \return The pointer
*
* The RF Core driver will remember the most recent proto-dependent Radio OP
* issued, so that other modules can inspect its type and state at a subsequent
* stage. The assumption is that those commands will be issued by a function
* that will then return. The following commands will be "remembered"
*
* - All BLE Radio Ops (0x18nn)
* - All Prop Radio Ops (0x38nn)
* - IEEE BG Radio Ops (0x28nn)
*
* The following commands are assumed to be executed synchronously and will
* thus not be remembered by the core and not returned by this function:
*
* - Direct commands
* - Proto-independent commands (including Radio Ops and Immediate ones)
* - IEEE FG Radio Ops (0x2Cxx)
*
* This assumes that all commands will be sent to the radio using
* rf_core_send_cmd()
*/
rfc_radioOp_t *rf_core_get_last_radio_op(void);
/**
* \brief Prepare a buffer to host a Radio Op
* \param buf A pointer to the buffer that will host the Radio Op
* \param len The buffer's length
* \param command The command ID
*
* The caller is responsible to allocate the buffer
*
* This function will not check whether the buffer is large enough to hold the
* command. This is the caller's responsibility
*
* This function will wipe out the buffer's contents.
*/
void rf_core_init_radio_op(rfc_radioOp_t *buf, uint16_t len, uint16_t command);
/**
* \brief Register a primary mode for radio operation
* \param mode A pointer to the struct representing the mode
*
* A normal NESTACK_RADIO driver will normally register itself by calling
* this function during its own init().
*
* \sa rf_core_primary_mode_t
*/
void rf_core_primary_mode_register(const rf_core_primary_mode_t *mode);
/**
* \brief Abort the currently running primary radio op
*/
void rf_core_primary_mode_abort(void);
/**
* \brief Abort the currently running primary radio op
*/
uint8_t rf_core_primary_mode_restore(void);
/*---------------------------------------------------------------------------*/
#endif /* RF_CORE_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
* @}
*/

View file

@ -0,0 +1,205 @@
/*
* Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
#include "rf-core/api/mailbox.h"
#include "rf-core/api/common_cmd.h"
#include "rf-core/api/prop_cmd.h"
/*---------------------------------------------------------------------------*/
/* Overrides for CMD_PROP_RADIO_DIV_SETUP */
uint32_t overrides[] =
{
/* override_synth.xml */
HW32_ARRAY_OVERRIDE(0x6088, 1),
(uint32_t)0x0000001A,
ADI_HALFREG_OVERRIDE(0, 61, 0xF, 0xD),
HW32_ARRAY_OVERRIDE(0x4038, 1),
(uint32_t)0x0000003A,
HW_REG_OVERRIDE(0x4020, 0x7F00),
HW_REG_OVERRIDE(0x4064, 0x0040),
(uint32_t)0x684A3,
(uint32_t)0xC0040141,
(uint32_t)0x0533B107,
(uint32_t)0xA480583,
(uint32_t)0x7AB80603,
ADI_REG_OVERRIDE(1, 4, 0x1F),
ADI_HALFREG_OVERRIDE(1, 7, 0x4, 0x4),
HW_REG_OVERRIDE(0x6084, 0x35F1),
(uint32_t)0x00038883,
(uint32_t)0x00FB88A3,
/* TX power override */
ADI_REG_OVERRIDE(0, 12, 0xF9),
/* Overrides for CRC16 functionality */
(uint32_t)0x943,
(uint32_t)0x963,
(uint32_t)0xFFFFFFFF,
};
/*---------------------------------------------------------------------------*/
/* CMD_PROP_RADIO_DIV_SETUP */
rfc_CMD_PROP_RADIO_DIV_SETUP_t smartrf_settings_cmd_prop_radio_div_setup =
{
.commandNo = 0x3807,
.status = 0x0000,
.pNextOp = 0,
.startTime = 0x00000000,
.startTrigger.triggerType = 0x0,
.startTrigger.bEnaCmd = 0x0,
.startTrigger.triggerNo = 0x0,
.startTrigger.pastTrig = 0x0,
.condition.rule = 0x1,
.condition.nSkip = 0x0,
.modulation.modType = 0x1,
.modulation.deviation = 0x64,
.symbolRate.preScale = 0xf,
.symbolRate.rateWord = 0x8000,
.rxBw = 0x24,
.preamConf.nPreamBytes = 0x3,
.preamConf.preamMode = 0x0,
.formatConf.nSwBits = 0x18,
.formatConf.bBitReversal = 0x0,
.formatConf.bMsbFirst = 0x1,
.formatConf.fecMode = 0x0,
/* 7: .4g mode with dynamic whitening and CRC choice */
.formatConf.whitenMode = 0x7,
.config.frontEndMode = 0x0, /* Differential mode */
.config.biasMode = 0x1, /* External bias*/
.config.bNoFsPowerUp = 0x0,
.txPower = 0x00, /* Driver sets correct value */
.pRegOverride = overrides,
.intFreq = 0x8000,
.centerFreq = 868,
.loDivider = 0x05,
};
/*---------------------------------------------------------------------------*/
/* CMD_FS */
rfc_CMD_FS_t smartrf_settings_cmd_fs =
{
.commandNo = 0x0803,
.status = 0x0000,
.pNextOp = 0,
.startTime = 0x00000000,
.startTrigger.triggerType = 0x0,
.startTrigger.bEnaCmd = 0x0,
.startTrigger.triggerNo = 0x0,
.startTrigger.pastTrig = 0x0,
.condition.rule = 0x1,
.condition.nSkip = 0x0,
.frequency = 868,
.fractFreq = 0x0000,
.synthConf.bTxMode = 0x0,
.synthConf.refFreq = 0x0,
.__dummy0 = 0x00,
.midPrecal = 0x00,
.ktPrecal = 0x00,
.tdcPrecal = 0x0000,
};
/*---------------------------------------------------------------------------*/
/* CMD_PROP_TX_ADV */
rfc_CMD_PROP_TX_ADV_t smartrf_settings_cmd_prop_tx_adv =
{
.commandNo = 0x3803,
.status = 0x0000,
.pNextOp = 0,
.startTime = 0x00000000,
.startTrigger.triggerType = 0x0,
.startTrigger.bEnaCmd = 0x0,
.startTrigger.triggerNo = 0x0,
.startTrigger.pastTrig = 0x0,
.condition.rule = 0x1,
.condition.nSkip = 0x0,
.pktConf.bFsOff = 0x0,
.pktConf.bUseCrc = 0x1,
.pktConf.bCrcIncSw = 0x0, /* .4g mode */
.pktConf.bCrcIncHdr = 0x0, /* .4g mode */
.numHdrBits = 0x10 /* 16: .4g mode */,
.pktLen = 0x0000,
.startConf.bExtTxTrig = 0x0,
.startConf.inputMode = 0x0,
.startConf.source = 0x0,
.preTrigger.triggerType = TRIG_REL_START,
.preTrigger.bEnaCmd = 0x0,
.preTrigger.triggerNo = 0x0,
.preTrigger.pastTrig = 0x1,
.preTime = 0x00000000,
.syncWord = 0x0055904e,
.pPkt = 0,
};
/*---------------------------------------------------------------------------*/
/* CMD_PROP_RX_ADV */
rfc_CMD_PROP_RX_ADV_t smartrf_settings_cmd_prop_rx_adv =
{
.commandNo = 0x3804,
.status = 0x0000,
.pNextOp = 0,
.startTime = 0x00000000,
.startTrigger.triggerType = 0x0,
.startTrigger.bEnaCmd = 0x0,
.startTrigger.triggerNo = 0x0,
.startTrigger.pastTrig = 0x0,
.condition.rule = 0x1,
.condition.nSkip = 0x0,
.pktConf.bFsOff = 0x0,
.pktConf.bRepeatOk = 0x1,
.pktConf.bRepeatNok = 0x1,
.pktConf.bUseCrc = 0x1,
.pktConf.bCrcIncSw = 0x0, /* .4g mode */
.pktConf.bCrcIncHdr = 0x0, /* .4g mode */
.pktConf.endType = 0x0,
.pktConf.filterOp = 0x1,
.rxConf.bAutoFlushIgnored = 0x1,
.rxConf.bAutoFlushCrcErr = 0x1,
.rxConf.bIncludeHdr = 0x0,
.rxConf.bIncludeCrc = 0x0,
.rxConf.bAppendRssi = 0x1,
.rxConf.bAppendTimestamp = 0x0,
.rxConf.bAppendStatus = 0x1,
.syncWord0 = 0x0055904e,
.syncWord1 = 0x00000000,
.maxPktLen = 0x0000, /* To be populated by the driver. */
.hdrConf.numHdrBits = 0x10, /* 16: .4g mode */
.hdrConf.lenPos = 0x0, /* .4g mode */
.hdrConf.numLenBits = 0x0B, /* 11 = 0x0B .4g mode */
.addrConf.addrType = 0x0,
.addrConf.addrSize = 0x0,
.addrConf.addrPos = 0x0,
.addrConf.numAddr = 0x0,
.lenOffset = -4, /* .4g mode */
.endTrigger.triggerType = TRIG_NEVER,
.endTrigger.bEnaCmd = 0x0,
.endTrigger.triggerNo = 0x0,
.endTrigger.pastTrig = 0x0,
.endTime = 0x00000000,
.pAddr = 0,
.pQueue = 0,
.pOutput = 0,
};
/*---------------------------------------------------------------------------*/

View file

@ -0,0 +1,44 @@
/*
* Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
#ifndef SMARTRF_SETTINGS_H_
#define SMARTRF_SETTINGS_H_
/*---------------------------------------------------------------------------*/
#include "rf-core/api/mailbox.h"
#include "rf-core/api/common_cmd.h"
#include "rf-core/api/prop_cmd.h"
/*---------------------------------------------------------------------------*/
extern rfc_CMD_PROP_RADIO_DIV_SETUP_t smartrf_settings_cmd_prop_radio_div_setup;
extern rfc_CMD_FS_t smartrf_settings_cmd_fs;
extern rfc_CMD_PROP_TX_ADV_t smartrf_settings_cmd_prop_tx_adv;
extern rfc_CMD_PROP_RX_ADV_t smartrf_settings_cmd_prop_rx_adv;
/*---------------------------------------------------------------------------*/
#endif // SMARTRF_SETTINGS_H_
/*---------------------------------------------------------------------------*/

View file

@ -33,15 +33,14 @@
* @{
*
* \file
* Implementation of the arch-specific rtimer functions for the cc26xx
*
* Implementation of the arch-specific rtimer functions for the CC13xx/CC26xx
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "sys/energest.h"
#include "sys/rtimer.h"
#include "cpu.h"
#include "dev/cc26xx-rtc.h"
#include "dev/soc-rtc.h"
#include "ti-lib.h"
@ -72,7 +71,7 @@ void
rtimer_arch_schedule(rtimer_clock_t t)
{
/* Convert the rtimer tick value to a value suitable for the AON RTC */
cc26xx_rtc_schedule_one_shot(t);
soc_rtc_schedule_one_shot(AON_RTC_CH0, t);
}
/*---------------------------------------------------------------------------*/
/**

View file

@ -32,20 +32,14 @@
* \addtogroup cc26xx-clocks
* @{
*
* \defgroup cc26xx-rtimer CC26xx rtimer
* \defgroup cc26xx-rtimer CC13xx/CC26xx rtimer
*
* Implementation of the rtimer module for the CC26xx
*
* The rtimer runs on the AON RTC. We set the RTC's channel 2 to continuous
* compare mode, instead of scheduling the next tick interrupt by software.
* This gives us completely equidistant events.
*
* The RTC runs in all power modes (except shutdown)
* Implementation of the rtimer module for the CC13xx/CC26xx
* @{
*/
/**
* \file
* Header file for the CC26xx rtimer driver
* Header file for the CC13xx/CC26xx rtimer driver
*/
/*---------------------------------------------------------------------------*/
#ifndef RTIMER_ARCH_H_

View file

@ -34,7 +34,7 @@
* @{
*
* \file
* Arch-specific SLIP functions for the cc26xx
* Arch-specific SLIP functions for the CC13xx/CC26xx
*/
/*---------------------------------------------------------------------------*/
#include "contiki-conf.h"

View file

@ -31,7 +31,7 @@
* \addtogroup cc26xx
* @{
*
* \defgroup cc26xx-ti-lib TI CC26xxware Glue
* \defgroup cc26xx-ti-lib TI CC26xxware/CC13xxware Glue
*
* Glue file which renames TI CC26xxware functions. Thus, for example,
* PowerCtrlIOFreezeDisable() becomes power_ctrl_io_freeze_disable()
@ -89,7 +89,8 @@
#define ti_lib_aon_rtc_enable(...) AONRTCEnable(__VA_ARGS__)
#define ti_lib_aon_rtc_disable(...) AONRTCDisable(__VA_ARGS__)
#define ti_lib_aon_rtc_status(...) AONRTCStatus(__VA_ARGS__)
#define ti_lib_aon_rtc_active(...) AONRTCActive(__VA_ARGS__)
#define ti_lib_aon_rtc_channel_active(...) AONRTCChannelActive(__VA_ARGS__)
#define ti_lib_aon_rtc_reset(...) AONRTCReset(__VA_ARGS__)
#define ti_lib_aon_rtc_delay_config(...) AONRTCDelayConfig(__VA_ARGS__)
#define ti_lib_aon_rtc_combined_event_config(...) AONRTCCombinedEventConfig(__VA_ARGS__)
@ -107,6 +108,7 @@
#define ti_lib_aon_rtc_compare_value_set(...) AONRTCCompareValueSet(__VA_ARGS__)
#define ti_lib_aon_rtc_compare_value_get(...) AONRTCCompareValueGet(__VA_ARGS__)
#define ti_lib_aon_rtc_current_compare_value_get(...) AONRTCCurrentCompareValueGet(__VA_ARGS__)
#define ti_lib_aon_rtc_current_64_bit_value_get(...) AONRTCCurrent64BitValueGet(__VA_ARGS__)
#define ti_lib_aon_rtc_inc_value_ch2_set(...) AONRTCIncValueCh2Set(__VA_ARGS__)
#define ti_lib_aon_rtc_inc_value_ch2_get(...) AONRTCIncValueCh2Get(__VA_ARGS__)
#define ti_lib_aon_rtc_capture_value_ch1_get(...) AONRTCCaptureValueCh1Get(__VA_ARGS__)
@ -161,6 +163,29 @@
#define ti_lib_cpu_base_pri_set(...) CPUbasepriSet(__VA_ARGS__)
#define ti_lib_cpu_delay(...) CPUdelay(__VA_ARGS__)
/*---------------------------------------------------------------------------*/
/* chipinfo.h */
#include "driverlib/chipinfo.h"
#define ti_lib_chipinfo_get_supported_protocol_bv(...) ChipInfo_GetSupportedProtocol_BV(__VA_ARGS__)
#define ti_lib_chipinfo_supports_ble(...) ChipInfo_SupportsBLE(__VA_ARGS__)
#define ti_lib_chipinfo_supports_ieee_802_15_4(...) ChipInfo_SupportsIEEE_802_15_4(__VA_ARGS__)
#define ti_lib_chipinfo_supports_proprietary(...) ChipInfo_SupportsPROPRIETARY(__VA_ARGS__)
#define ti_lib_chipinfo_get_package_type(...) ChipInfo_GetPackageType(__VA_ARGS__)
#define ti_lib_chipinfo_package_type_is_4x4(...) ChipInfo_PackageTypeIs4x4(__VA_ARGS__)
#define ti_lib_chipinfo_package_type_is_5x5(...) ChipInfo_PackageTypeIs5x5(__VA_ARGS__)
#define ti_lib_chipinfo_package_type_is_7x7(...) ChipInfo_PackageTypeIs7x7(__VA_ARGS__)
#define ti_lib_chipinfo_get_device_id_hw_rev_code(...) ChipInfo_GetDeviceIdHwRevCode(__VA_ARGS__)
#define ti_lib_chipinfo_get_chip_family(...) ChipInfo_GetChipFamily(__VA_ARGS__)
#define ti_lib_chipinfo_chip_family_is_cc26xx(...) ChipInfo_ChipFamilyIsCC26xx(__VA_ARGS__)
#define ti_lib_chipinfo_chip_family_is_cc13xx(...) ChipInfo_ChipFamilyIsCC13xx(__VA_ARGS__)
#define ti_lib_chipinfo_get_hw_revision(...) ChipInfo_GetHwRevision(__VA_ARGS__)
#define ti_lib_chipinfo_hw_revision_is_1_0(...) ChipInfo_HwRevisionIs_1_0(__VA_ARGS__)
#define ti_lib_chipinfo_hw_revision_is_gteq_2_0(...) ChipInfo_HwRevisionIs_GTEQ_2_0(__VA_ARGS__)
#define ti_lib_chipinfo_hw_revision_is_2_0(...) ChipInfo_HwRevisionIs_2_0(__VA_ARGS__)
#define ti_lib_chipinfo_hw_revision_is_2_1(...) ChipInfo_HwRevisionIs_2_1(__VA_ARGS__)
#define ti_lib_chipinfo_hw_revision_is_2_2(...) ChipInfo_HwRevisionIs_2_2(__VA_ARGS__)
#define ti_lib_chipinfo_hw_revision_is_gteq_2_2(...) ChipInfo_HwRevisionIs_GTEQ_2_2( __VA_ARGS__ )
/*---------------------------------------------------------------------------*/
/* ddi.h */
#include "driverlib/ddi.h"
@ -309,7 +334,6 @@
#define ti_lib_prcm_peripheral_deep_sleep_disable(...) PRCMPeripheralDeepSleepDisable(__VA_ARGS__)
#define ti_lib_prcm_power_domain_status(...) PRCMPowerDomainStatus(__VA_ARGS__)
#define ti_lib_prcm_rf_ready(...) PRCMRfReady(__VA_ARGS__)
#define ti_lib_prcm_wdt_reset_status(...) PRCMWdtResetStatus(__VA_ARGS__)
#define ti_lib_prcm_sleep(...) PRCMSleep(__VA_ARGS__)
#define ti_lib_prcm_deep_sleep(...) PRCMDeepSleep(__VA_ARGS__)
#define ti_lib_prcm_cache_retention_enable(...) PRCMCacheRetentionEnable(__VA_ARGS__)
@ -384,10 +408,6 @@
#define ti_lib_rom_flash_protection_set ROM_FlashProtectionSet
#define ti_lib_rom_flash_protection_get ROM_FlashProtectionGet
#define ti_lib_rom_flash_protection_save ROM_FlashProtectionSave
#define ti_lib_rom_flash_sector_erase ROM_FlashSectorErase
#define ti_lib_rom_flash_program ROM_FlashProgram
#define ti_lib_rom_flash_program_nowait ROM_FlashProgramNowait
#define ti_lib_rom_flash_efuse_read_row ROM_FlashEfuseReadRow
#define ti_lib_rom_flash_disable_sectors_for_write ROM_FlashDisableSectorsForWrite
@ -507,8 +527,6 @@
#define ti_lib_hapi_max_value(a, b) HapiMaxValue(a,b)
#define ti_lib_hapi_mean_value(a, b) HapiMeanValue(a,b)
#define ti_lib_hapi_stand_deviation_value(a, b) HapiStandDeviationValue(a,b)
#define ti_lib_hapi_reset_peripheral(a) HapiResetPeripheral(a)
#define ti_lib_hapi_reset_domain(a) HapiResetDomain(a)
#define ti_lib_hapi_hf_source_safe_switch() HapiHFSourceSafeSwitch()
#define ti_lib_hapi_select_comp_a_input(a) HapiSelectCompAInput(a)
#define ti_lib_hapi_select_comp_a_ref(a) HapiSelectCompARef(a)
@ -517,9 +535,6 @@
#define ti_lib_hapi_get_flash_size() HapiGetFlashSize()
#define ti_lib_hapi_sector_erase(a) HapiSectorErase(a)
#define ti_lib_hapi_program_flash(a, b, c) HapiProgramFlash(a, b, c)
#define ti_lib_hapi_get_flash_size() HapiGetFlashSize()
#define ti_lib_hapi_sector_erase(a) HapiSectorErase(a)
#define ti_lib_hapi_program_flash(a, b, c) HapiProgramFlash(a, b, c)
/*---------------------------------------------------------------------------*/
/* sys_ctrl.h */
#include "driverlib/sys_ctrl.h"
@ -578,7 +593,6 @@
#define ti_lib_timer_disable(...) TimerDisable(__VA_ARGS__)
#define ti_lib_timer_configure(...) TimerConfigure(__VA_ARGS__)
#define ti_lib_timer_level_control(...) TimerLevelControl(__VA_ARGS__)
#define ti_lib_timer_trigger_control(...) TimerTriggerControl(__VA_ARGS__)
#define ti_lib_timer_event_control(...) TimerEventControl(__VA_ARGS__)
#define ti_lib_timer_stall_control(...) TimerStallControl(__VA_ARGS__)
#define ti_lib_timer_wait_on_trigger_control(...) TimerWaitOnTriggerControl(__VA_ARGS__)

File diff suppressed because it is too large Load diff

View file

@ -1,623 +0,0 @@
/******************************************************************************
* Filename: ble_cmd_field.h
* Revised: $ $
* Revision: $ $
*
* Description: CC26xx/CC13xx API for Bluetooth Low Energy commands
*
* Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
#ifndef __BLE_CMD_FIELD_H
#define __BLE_CMD_FIELD_H
#include <stdint.h>
#include "mailbox.h"
#include "common_cmd.h"
#define _POSITION_bleRadioOp_channel 14
#define _TYPE_bleRadioOp_channel uint8_t
#define _POSITION_bleRadioOp_whitening 15
#define _TYPE_bleRadioOp_whitening uint8_t
#define _BITPOS_bleRadioOp_whitening_init 0
#define _NBITS_bleRadioOp_whitening_init 7
#define _BITPOS_bleRadioOp_whitening_bOverride 7
#define _NBITS_bleRadioOp_whitening_bOverride 1
#define _POSITION_bleRadioOp_pParams 16
#define _TYPE_bleRadioOp_pParams uint8_t*
#define _POSITION_bleRadioOp_pOutput 20
#define _TYPE_bleRadioOp_pOutput uint8_t*
#define _SIZEOF_bleRadioOp 24
#define _SIZEOF_CMD_BLE_SLAVE 24
#define _SIZEOF_CMD_BLE_MASTER 24
#define _SIZEOF_CMD_BLE_ADV 24
#define _SIZEOF_CMD_BLE_ADV_DIR 24
#define _SIZEOF_CMD_BLE_ADV_NC 24
#define _SIZEOF_CMD_BLE_ADV_SCAN 24
#define _SIZEOF_CMD_BLE_SCANNER 24
#define _SIZEOF_CMD_BLE_INITIATOR 24
#define _SIZEOF_CMD_BLE_GENERIC_RX 24
#define _SIZEOF_CMD_BLE_TX_TEST 24
#define _POSITION_CMD_BLE_ADV_PAYLOAD_payloadType 2
#define _TYPE_CMD_BLE_ADV_PAYLOAD_payloadType uint8_t
#define _POSITION_CMD_BLE_ADV_PAYLOAD_newLen 3
#define _TYPE_CMD_BLE_ADV_PAYLOAD_newLen uint8_t
#define _POSITION_CMD_BLE_ADV_PAYLOAD_pNewData 4
#define _TYPE_CMD_BLE_ADV_PAYLOAD_pNewData uint8_t*
#define _POSITION_CMD_BLE_ADV_PAYLOAD_pParams 8
#define _TYPE_CMD_BLE_ADV_PAYLOAD_pParams uint8_t*
#define _SIZEOF_CMD_BLE_ADV_PAYLOAD 12
#define _POSITION_bleMasterSlavePar_pRxQ 0
#define _TYPE_bleMasterSlavePar_pRxQ dataQueue_t*
#define _POSITION_bleMasterSlavePar_pTxQ 4
#define _TYPE_bleMasterSlavePar_pTxQ dataQueue_t*
#define _POSITION_bleMasterSlavePar_rxConfig 8
#define _TYPE_bleMasterSlavePar_rxConfig uint8_t
#define _BITPOS_bleMasterSlavePar_rxConfig_bAutoFlushIgnored 0
#define _NBITS_bleMasterSlavePar_rxConfig_bAutoFlushIgnored 1
#define _BITPOS_bleMasterSlavePar_rxConfig_bAutoFlushCrcErr 1
#define _NBITS_bleMasterSlavePar_rxConfig_bAutoFlushCrcErr 1
#define _BITPOS_bleMasterSlavePar_rxConfig_bAutoFlushEmpty 2
#define _NBITS_bleMasterSlavePar_rxConfig_bAutoFlushEmpty 1
#define _BITPOS_bleMasterSlavePar_rxConfig_bIncludeLenByte 3
#define _NBITS_bleMasterSlavePar_rxConfig_bIncludeLenByte 1
#define _BITPOS_bleMasterSlavePar_rxConfig_bIncludeCrc 4
#define _NBITS_bleMasterSlavePar_rxConfig_bIncludeCrc 1
#define _BITPOS_bleMasterSlavePar_rxConfig_bAppendRssi 5
#define _NBITS_bleMasterSlavePar_rxConfig_bAppendRssi 1
#define _BITPOS_bleMasterSlavePar_rxConfig_bAppendStatus 6
#define _NBITS_bleMasterSlavePar_rxConfig_bAppendStatus 1
#define _BITPOS_bleMasterSlavePar_rxConfig_bAppendTimestamp 7
#define _NBITS_bleMasterSlavePar_rxConfig_bAppendTimestamp 1
#define _POSITION_bleMasterSlavePar_seqStat 9
#define _TYPE_bleMasterSlavePar_seqStat uint8_t
#define _BITPOS_bleMasterSlavePar_seqStat_lastRxSn 0
#define _NBITS_bleMasterSlavePar_seqStat_lastRxSn 1
#define _BITPOS_bleMasterSlavePar_seqStat_lastTxSn 1
#define _NBITS_bleMasterSlavePar_seqStat_lastTxSn 1
#define _BITPOS_bleMasterSlavePar_seqStat_nextTxSn 2
#define _NBITS_bleMasterSlavePar_seqStat_nextTxSn 1
#define _BITPOS_bleMasterSlavePar_seqStat_bFirstPkt 3
#define _NBITS_bleMasterSlavePar_seqStat_bFirstPkt 1
#define _BITPOS_bleMasterSlavePar_seqStat_bAutoEmpty 4
#define _NBITS_bleMasterSlavePar_seqStat_bAutoEmpty 1
#define _BITPOS_bleMasterSlavePar_seqStat_bLlCtrlTx 5
#define _NBITS_bleMasterSlavePar_seqStat_bLlCtrlTx 1
#define _BITPOS_bleMasterSlavePar_seqStat_bLlCtrlAckRx 6
#define _NBITS_bleMasterSlavePar_seqStat_bLlCtrlAckRx 1
#define _BITPOS_bleMasterSlavePar_seqStat_bLlCtrlAckPending 7
#define _NBITS_bleMasterSlavePar_seqStat_bLlCtrlAckPending 1
#define _POSITION_bleMasterSlavePar_maxNack 10
#define _TYPE_bleMasterSlavePar_maxNack uint8_t
#define _POSITION_bleMasterSlavePar_maxPkt 11
#define _TYPE_bleMasterSlavePar_maxPkt uint8_t
#define _POSITION_bleMasterSlavePar_accessAddress 12
#define _TYPE_bleMasterSlavePar_accessAddress uint32_t
#define _POSITION_bleMasterSlavePar_crcInit0 16
#define _TYPE_bleMasterSlavePar_crcInit0 uint8_t
#define _POSITION_bleMasterSlavePar_crcInit1 17
#define _TYPE_bleMasterSlavePar_crcInit1 uint8_t
#define _POSITION_bleMasterSlavePar_crcInit2 18
#define _TYPE_bleMasterSlavePar_crcInit2 uint8_t
#define _POSITION_bleMasterSlavePar_crcInit 16
#define _TYPE_bleMasterSlavePar_crcInit uint32_t
#define _SIZEOF_bleMasterSlavePar 20
#define _POSITION_bleMasterPar_endTrigger 19
#define _TYPE_bleMasterPar_endTrigger uint8_t
#define _BITPOS_bleMasterPar_endTrigger_triggerType 0
#define _NBITS_bleMasterPar_endTrigger_triggerType 4
#define _BITPOS_bleMasterPar_endTrigger_bEnaCmd 4
#define _NBITS_bleMasterPar_endTrigger_bEnaCmd 1
#define _BITPOS_bleMasterPar_endTrigger_triggerNo 5
#define _NBITS_bleMasterPar_endTrigger_triggerNo 2
#define _BITPOS_bleMasterPar_endTrigger_pastTrig 7
#define _NBITS_bleMasterPar_endTrigger_pastTrig 1
#define _POSITION_bleMasterPar_endTime 20
#define _TYPE_bleMasterPar_endTime ratmr_t
#define _SIZEOF_bleMasterPar 24
#define _POSITION_bleSlavePar_timeoutTrigger 19
#define _TYPE_bleSlavePar_timeoutTrigger uint8_t
#define _BITPOS_bleSlavePar_timeoutTrigger_triggerType 0
#define _NBITS_bleSlavePar_timeoutTrigger_triggerType 4
#define _BITPOS_bleSlavePar_timeoutTrigger_bEnaCmd 4
#define _NBITS_bleSlavePar_timeoutTrigger_bEnaCmd 1
#define _BITPOS_bleSlavePar_timeoutTrigger_triggerNo 5
#define _NBITS_bleSlavePar_timeoutTrigger_triggerNo 2
#define _BITPOS_bleSlavePar_timeoutTrigger_pastTrig 7
#define _NBITS_bleSlavePar_timeoutTrigger_pastTrig 1
#define _POSITION_bleSlavePar_timeoutTime 20
#define _TYPE_bleSlavePar_timeoutTime ratmr_t
#define _POSITION_bleSlavePar_endTrigger 27
#define _TYPE_bleSlavePar_endTrigger uint8_t
#define _BITPOS_bleSlavePar_endTrigger_triggerType 0
#define _NBITS_bleSlavePar_endTrigger_triggerType 4
#define _BITPOS_bleSlavePar_endTrigger_bEnaCmd 4
#define _NBITS_bleSlavePar_endTrigger_bEnaCmd 1
#define _BITPOS_bleSlavePar_endTrigger_triggerNo 5
#define _NBITS_bleSlavePar_endTrigger_triggerNo 2
#define _BITPOS_bleSlavePar_endTrigger_pastTrig 7
#define _NBITS_bleSlavePar_endTrigger_pastTrig 1
#define _POSITION_bleSlavePar_endTime 28
#define _TYPE_bleSlavePar_endTime ratmr_t
#define _SIZEOF_bleSlavePar 32
#define _POSITION_bleAdvPar_pRxQ 0
#define _TYPE_bleAdvPar_pRxQ dataQueue_t*
#define _POSITION_bleAdvPar_rxConfig 4
#define _TYPE_bleAdvPar_rxConfig uint8_t
#define _BITPOS_bleAdvPar_rxConfig_bAutoFlushIgnored 0
#define _NBITS_bleAdvPar_rxConfig_bAutoFlushIgnored 1
#define _BITPOS_bleAdvPar_rxConfig_bAutoFlushCrcErr 1
#define _NBITS_bleAdvPar_rxConfig_bAutoFlushCrcErr 1
#define _BITPOS_bleAdvPar_rxConfig_bAutoFlushEmpty 2
#define _NBITS_bleAdvPar_rxConfig_bAutoFlushEmpty 1
#define _BITPOS_bleAdvPar_rxConfig_bIncludeLenByte 3
#define _NBITS_bleAdvPar_rxConfig_bIncludeLenByte 1
#define _BITPOS_bleAdvPar_rxConfig_bIncludeCrc 4
#define _NBITS_bleAdvPar_rxConfig_bIncludeCrc 1
#define _BITPOS_bleAdvPar_rxConfig_bAppendRssi 5
#define _NBITS_bleAdvPar_rxConfig_bAppendRssi 1
#define _BITPOS_bleAdvPar_rxConfig_bAppendStatus 6
#define _NBITS_bleAdvPar_rxConfig_bAppendStatus 1
#define _BITPOS_bleAdvPar_rxConfig_bAppendTimestamp 7
#define _NBITS_bleAdvPar_rxConfig_bAppendTimestamp 1
#define _POSITION_bleAdvPar_advConfig 5
#define _TYPE_bleAdvPar_advConfig uint8_t
#define _BITPOS_bleAdvPar_advConfig_advFilterPolicy 0
#define _NBITS_bleAdvPar_advConfig_advFilterPolicy 2
#define _BITPOS_bleAdvPar_advConfig_deviceAddrType 2
#define _NBITS_bleAdvPar_advConfig_deviceAddrType 1
#define _BITPOS_bleAdvPar_advConfig_peerAddrType 3
#define _NBITS_bleAdvPar_advConfig_peerAddrType 1
#define _BITPOS_bleAdvPar_advConfig_bStrictLenFilter 4
#define _NBITS_bleAdvPar_advConfig_bStrictLenFilter 1
#define _POSITION_bleAdvPar_advLen 6
#define _TYPE_bleAdvPar_advLen uint8_t
#define _POSITION_bleAdvPar_scanRspLen 7
#define _TYPE_bleAdvPar_scanRspLen uint8_t
#define _POSITION_bleAdvPar_pAdvData 8
#define _TYPE_bleAdvPar_pAdvData uint8_t*
#define _POSITION_bleAdvPar_pScanRspData 12
#define _TYPE_bleAdvPar_pScanRspData uint8_t*
#define _POSITION_bleAdvPar_pDeviceAddress 16
#define _TYPE_bleAdvPar_pDeviceAddress uint16_t*
#define _POSITION_bleAdvPar_pWhiteList 20
#define _TYPE_bleAdvPar_pWhiteList uint32_t*
#define _POSITION_bleAdvPar_endTrigger 27
#define _TYPE_bleAdvPar_endTrigger uint8_t
#define _BITPOS_bleAdvPar_endTrigger_triggerType 0
#define _NBITS_bleAdvPar_endTrigger_triggerType 4
#define _BITPOS_bleAdvPar_endTrigger_bEnaCmd 4
#define _NBITS_bleAdvPar_endTrigger_bEnaCmd 1
#define _BITPOS_bleAdvPar_endTrigger_triggerNo 5
#define _NBITS_bleAdvPar_endTrigger_triggerNo 2
#define _BITPOS_bleAdvPar_endTrigger_pastTrig 7
#define _NBITS_bleAdvPar_endTrigger_pastTrig 1
#define _POSITION_bleAdvPar_endTime 28
#define _TYPE_bleAdvPar_endTime ratmr_t
#define _SIZEOF_bleAdvPar 32
#define _POSITION_bleScannerPar_pRxQ 0
#define _TYPE_bleScannerPar_pRxQ dataQueue_t*
#define _POSITION_bleScannerPar_rxConfig 4
#define _TYPE_bleScannerPar_rxConfig uint8_t
#define _BITPOS_bleScannerPar_rxConfig_bAutoFlushIgnored 0
#define _NBITS_bleScannerPar_rxConfig_bAutoFlushIgnored 1
#define _BITPOS_bleScannerPar_rxConfig_bAutoFlushCrcErr 1
#define _NBITS_bleScannerPar_rxConfig_bAutoFlushCrcErr 1
#define _BITPOS_bleScannerPar_rxConfig_bAutoFlushEmpty 2
#define _NBITS_bleScannerPar_rxConfig_bAutoFlushEmpty 1
#define _BITPOS_bleScannerPar_rxConfig_bIncludeLenByte 3
#define _NBITS_bleScannerPar_rxConfig_bIncludeLenByte 1
#define _BITPOS_bleScannerPar_rxConfig_bIncludeCrc 4
#define _NBITS_bleScannerPar_rxConfig_bIncludeCrc 1
#define _BITPOS_bleScannerPar_rxConfig_bAppendRssi 5
#define _NBITS_bleScannerPar_rxConfig_bAppendRssi 1
#define _BITPOS_bleScannerPar_rxConfig_bAppendStatus 6
#define _NBITS_bleScannerPar_rxConfig_bAppendStatus 1
#define _BITPOS_bleScannerPar_rxConfig_bAppendTimestamp 7
#define _NBITS_bleScannerPar_rxConfig_bAppendTimestamp 1
#define _POSITION_bleScannerPar_scanConfig 5
#define _TYPE_bleScannerPar_scanConfig uint8_t
#define _BITPOS_bleScannerPar_scanConfig_scanFilterPolicy 0
#define _NBITS_bleScannerPar_scanConfig_scanFilterPolicy 1
#define _BITPOS_bleScannerPar_scanConfig_bActiveScan 1
#define _NBITS_bleScannerPar_scanConfig_bActiveScan 1
#define _BITPOS_bleScannerPar_scanConfig_deviceAddrType 2
#define _NBITS_bleScannerPar_scanConfig_deviceAddrType 1
#define _BITPOS_bleScannerPar_scanConfig_bStrictLenFilter 4
#define _NBITS_bleScannerPar_scanConfig_bStrictLenFilter 1
#define _BITPOS_bleScannerPar_scanConfig_bAutoWlIgnore 5
#define _NBITS_bleScannerPar_scanConfig_bAutoWlIgnore 1
#define _BITPOS_bleScannerPar_scanConfig_bEndOnRpt 6
#define _NBITS_bleScannerPar_scanConfig_bEndOnRpt 1
#define _POSITION_bleScannerPar_randomState 6
#define _TYPE_bleScannerPar_randomState uint16_t
#define _POSITION_bleScannerPar_backoffCount 8
#define _TYPE_bleScannerPar_backoffCount uint16_t
#define _POSITION_bleScannerPar_backoffPar 10
#define _TYPE_bleScannerPar_backoffPar uint8_t
#define _BITPOS_bleScannerPar_backoffPar_logUpperLimit 0
#define _NBITS_bleScannerPar_backoffPar_logUpperLimit 4
#define _BITPOS_bleScannerPar_backoffPar_bLastSucceeded 4
#define _NBITS_bleScannerPar_backoffPar_bLastSucceeded 1
#define _BITPOS_bleScannerPar_backoffPar_bLastFailed 5
#define _NBITS_bleScannerPar_backoffPar_bLastFailed 1
#define _POSITION_bleScannerPar_scanReqLen 11
#define _TYPE_bleScannerPar_scanReqLen uint8_t
#define _POSITION_bleScannerPar_pScanReqData 12
#define _TYPE_bleScannerPar_pScanReqData uint8_t*
#define _POSITION_bleScannerPar_pDeviceAddress 16
#define _TYPE_bleScannerPar_pDeviceAddress uint16_t*
#define _POSITION_bleScannerPar_pWhiteList 20
#define _TYPE_bleScannerPar_pWhiteList uint32_t*
#define _POSITION_bleScannerPar_timeoutTrigger 26
#define _TYPE_bleScannerPar_timeoutTrigger uint8_t
#define _BITPOS_bleScannerPar_timeoutTrigger_triggerType 0
#define _NBITS_bleScannerPar_timeoutTrigger_triggerType 4
#define _BITPOS_bleScannerPar_timeoutTrigger_bEnaCmd 4
#define _NBITS_bleScannerPar_timeoutTrigger_bEnaCmd 1
#define _BITPOS_bleScannerPar_timeoutTrigger_triggerNo 5
#define _NBITS_bleScannerPar_timeoutTrigger_triggerNo 2
#define _BITPOS_bleScannerPar_timeoutTrigger_pastTrig 7
#define _NBITS_bleScannerPar_timeoutTrigger_pastTrig 1
#define _POSITION_bleScannerPar_endTrigger 27
#define _TYPE_bleScannerPar_endTrigger uint8_t
#define _BITPOS_bleScannerPar_endTrigger_triggerType 0
#define _NBITS_bleScannerPar_endTrigger_triggerType 4
#define _BITPOS_bleScannerPar_endTrigger_bEnaCmd 4
#define _NBITS_bleScannerPar_endTrigger_bEnaCmd 1
#define _BITPOS_bleScannerPar_endTrigger_triggerNo 5
#define _NBITS_bleScannerPar_endTrigger_triggerNo 2
#define _BITPOS_bleScannerPar_endTrigger_pastTrig 7
#define _NBITS_bleScannerPar_endTrigger_pastTrig 1
#define _POSITION_bleScannerPar_timeoutTime 28
#define _TYPE_bleScannerPar_timeoutTime ratmr_t
#define _POSITION_bleScannerPar_endTime 32
#define _TYPE_bleScannerPar_endTime ratmr_t
#define _SIZEOF_bleScannerPar 36
#define _POSITION_bleInitiatorPar_pRxQ 0
#define _TYPE_bleInitiatorPar_pRxQ dataQueue_t*
#define _POSITION_bleInitiatorPar_rxConfig 4
#define _TYPE_bleInitiatorPar_rxConfig uint8_t
#define _BITPOS_bleInitiatorPar_rxConfig_bAutoFlushIgnored 0
#define _NBITS_bleInitiatorPar_rxConfig_bAutoFlushIgnored 1
#define _BITPOS_bleInitiatorPar_rxConfig_bAutoFlushCrcErr 1
#define _NBITS_bleInitiatorPar_rxConfig_bAutoFlushCrcErr 1
#define _BITPOS_bleInitiatorPar_rxConfig_bAutoFlushEmpty 2
#define _NBITS_bleInitiatorPar_rxConfig_bAutoFlushEmpty 1
#define _BITPOS_bleInitiatorPar_rxConfig_bIncludeLenByte 3
#define _NBITS_bleInitiatorPar_rxConfig_bIncludeLenByte 1
#define _BITPOS_bleInitiatorPar_rxConfig_bIncludeCrc 4
#define _NBITS_bleInitiatorPar_rxConfig_bIncludeCrc 1
#define _BITPOS_bleInitiatorPar_rxConfig_bAppendRssi 5
#define _NBITS_bleInitiatorPar_rxConfig_bAppendRssi 1
#define _BITPOS_bleInitiatorPar_rxConfig_bAppendStatus 6
#define _NBITS_bleInitiatorPar_rxConfig_bAppendStatus 1
#define _BITPOS_bleInitiatorPar_rxConfig_bAppendTimestamp 7
#define _NBITS_bleInitiatorPar_rxConfig_bAppendTimestamp 1
#define _POSITION_bleInitiatorPar_initConfig 5
#define _TYPE_bleInitiatorPar_initConfig uint8_t
#define _BITPOS_bleInitiatorPar_initConfig_bUseWhiteList 0
#define _NBITS_bleInitiatorPar_initConfig_bUseWhiteList 1
#define _BITPOS_bleInitiatorPar_initConfig_bDynamicWinOffset 1
#define _NBITS_bleInitiatorPar_initConfig_bDynamicWinOffset 1
#define _BITPOS_bleInitiatorPar_initConfig_deviceAddrType 2
#define _NBITS_bleInitiatorPar_initConfig_deviceAddrType 1
#define _BITPOS_bleInitiatorPar_initConfig_peerAddrType 3
#define _NBITS_bleInitiatorPar_initConfig_peerAddrType 1
#define _BITPOS_bleInitiatorPar_initConfig_bStrictLenFilter 4
#define _NBITS_bleInitiatorPar_initConfig_bStrictLenFilter 1
#define _POSITION_bleInitiatorPar_connectReqLen 7
#define _TYPE_bleInitiatorPar_connectReqLen uint8_t
#define _POSITION_bleInitiatorPar_pConnectReqData 8
#define _TYPE_bleInitiatorPar_pConnectReqData uint8_t*
#define _POSITION_bleInitiatorPar_pDeviceAddress 12
#define _TYPE_bleInitiatorPar_pDeviceAddress uint16_t*
#define _POSITION_bleInitiatorPar_pWhiteList 16
#define _TYPE_bleInitiatorPar_pWhiteList uint32_t*
#define _POSITION_bleInitiatorPar_connectTime 20
#define _TYPE_bleInitiatorPar_connectTime ratmr_t
#define _POSITION_bleInitiatorPar_timeoutTrigger 26
#define _TYPE_bleInitiatorPar_timeoutTrigger uint8_t
#define _BITPOS_bleInitiatorPar_timeoutTrigger_triggerType 0
#define _NBITS_bleInitiatorPar_timeoutTrigger_triggerType 4
#define _BITPOS_bleInitiatorPar_timeoutTrigger_bEnaCmd 4
#define _NBITS_bleInitiatorPar_timeoutTrigger_bEnaCmd 1
#define _BITPOS_bleInitiatorPar_timeoutTrigger_triggerNo 5
#define _NBITS_bleInitiatorPar_timeoutTrigger_triggerNo 2
#define _BITPOS_bleInitiatorPar_timeoutTrigger_pastTrig 7
#define _NBITS_bleInitiatorPar_timeoutTrigger_pastTrig 1
#define _POSITION_bleInitiatorPar_endTrigger 27
#define _TYPE_bleInitiatorPar_endTrigger uint8_t
#define _BITPOS_bleInitiatorPar_endTrigger_triggerType 0
#define _NBITS_bleInitiatorPar_endTrigger_triggerType 4
#define _BITPOS_bleInitiatorPar_endTrigger_bEnaCmd 4
#define _NBITS_bleInitiatorPar_endTrigger_bEnaCmd 1
#define _BITPOS_bleInitiatorPar_endTrigger_triggerNo 5
#define _NBITS_bleInitiatorPar_endTrigger_triggerNo 2
#define _BITPOS_bleInitiatorPar_endTrigger_pastTrig 7
#define _NBITS_bleInitiatorPar_endTrigger_pastTrig 1
#define _POSITION_bleInitiatorPar_timeoutTime 28
#define _TYPE_bleInitiatorPar_timeoutTime ratmr_t
#define _POSITION_bleInitiatorPar_endTime 32
#define _TYPE_bleInitiatorPar_endTime ratmr_t
#define _SIZEOF_bleInitiatorPar 36
#define _POSITION_bleGenericRxPar_pRxQ 0
#define _TYPE_bleGenericRxPar_pRxQ dataQueue_t*
#define _POSITION_bleGenericRxPar_rxConfig 4
#define _TYPE_bleGenericRxPar_rxConfig uint8_t
#define _BITPOS_bleGenericRxPar_rxConfig_bAutoFlushIgnored 0
#define _NBITS_bleGenericRxPar_rxConfig_bAutoFlushIgnored 1
#define _BITPOS_bleGenericRxPar_rxConfig_bAutoFlushCrcErr 1
#define _NBITS_bleGenericRxPar_rxConfig_bAutoFlushCrcErr 1
#define _BITPOS_bleGenericRxPar_rxConfig_bAutoFlushEmpty 2
#define _NBITS_bleGenericRxPar_rxConfig_bAutoFlushEmpty 1
#define _BITPOS_bleGenericRxPar_rxConfig_bIncludeLenByte 3
#define _NBITS_bleGenericRxPar_rxConfig_bIncludeLenByte 1
#define _BITPOS_bleGenericRxPar_rxConfig_bIncludeCrc 4
#define _NBITS_bleGenericRxPar_rxConfig_bIncludeCrc 1
#define _BITPOS_bleGenericRxPar_rxConfig_bAppendRssi 5
#define _NBITS_bleGenericRxPar_rxConfig_bAppendRssi 1
#define _BITPOS_bleGenericRxPar_rxConfig_bAppendStatus 6
#define _NBITS_bleGenericRxPar_rxConfig_bAppendStatus 1
#define _BITPOS_bleGenericRxPar_rxConfig_bAppendTimestamp 7
#define _NBITS_bleGenericRxPar_rxConfig_bAppendTimestamp 1
#define _POSITION_bleGenericRxPar_bRepeat 5
#define _TYPE_bleGenericRxPar_bRepeat uint8_t
#define _POSITION_bleGenericRxPar_accessAddress 8
#define _TYPE_bleGenericRxPar_accessAddress uint32_t
#define _POSITION_bleGenericRxPar_crcInit0 12
#define _TYPE_bleGenericRxPar_crcInit0 uint8_t
#define _POSITION_bleGenericRxPar_crcInit1 13
#define _TYPE_bleGenericRxPar_crcInit1 uint8_t
#define _POSITION_bleGenericRxPar_crcInit2 14
#define _TYPE_bleGenericRxPar_crcInit2 uint8_t
#define _POSITION_bleGenericRxPar_crcInit 12
#define _TYPE_bleGenericRxPar_crcInit uint32_t
#define _POSITION_bleGenericRxPar_endTrigger 15
#define _TYPE_bleGenericRxPar_endTrigger uint8_t
#define _BITPOS_bleGenericRxPar_endTrigger_triggerType 0
#define _NBITS_bleGenericRxPar_endTrigger_triggerType 4
#define _BITPOS_bleGenericRxPar_endTrigger_bEnaCmd 4
#define _NBITS_bleGenericRxPar_endTrigger_bEnaCmd 1
#define _BITPOS_bleGenericRxPar_endTrigger_triggerNo 5
#define _NBITS_bleGenericRxPar_endTrigger_triggerNo 2
#define _BITPOS_bleGenericRxPar_endTrigger_pastTrig 7
#define _NBITS_bleGenericRxPar_endTrigger_pastTrig 1
#define _POSITION_bleGenericRxPar_endTime 16
#define _TYPE_bleGenericRxPar_endTime ratmr_t
#define _SIZEOF_bleGenericRxPar 20
#define _POSITION_bleTxTestPar_numPackets 0
#define _TYPE_bleTxTestPar_numPackets uint16_t
#define _POSITION_bleTxTestPar_payloadLength 2
#define _TYPE_bleTxTestPar_payloadLength uint8_t
#define _POSITION_bleTxTestPar_packetType 3
#define _TYPE_bleTxTestPar_packetType uint8_t
#define _POSITION_bleTxTestPar_period 4
#define _TYPE_bleTxTestPar_period ratmr_t
#define _POSITION_bleTxTestPar_config 8
#define _TYPE_bleTxTestPar_config uint8_t
#define _BITPOS_bleTxTestPar_config_bOverrideDefault 0
#define _NBITS_bleTxTestPar_config_bOverrideDefault 1
#define _BITPOS_bleTxTestPar_config_bUsePrbs9 1
#define _NBITS_bleTxTestPar_config_bUsePrbs9 1
#define _BITPOS_bleTxTestPar_config_bUsePrbs15 2
#define _NBITS_bleTxTestPar_config_bUsePrbs15 1
#define _POSITION_bleTxTestPar_byteVal 9
#define _TYPE_bleTxTestPar_byteVal uint8_t
#define _POSITION_bleTxTestPar_endTrigger 11
#define _TYPE_bleTxTestPar_endTrigger uint8_t
#define _BITPOS_bleTxTestPar_endTrigger_triggerType 0
#define _NBITS_bleTxTestPar_endTrigger_triggerType 4
#define _BITPOS_bleTxTestPar_endTrigger_bEnaCmd 4
#define _NBITS_bleTxTestPar_endTrigger_bEnaCmd 1
#define _BITPOS_bleTxTestPar_endTrigger_triggerNo 5
#define _NBITS_bleTxTestPar_endTrigger_triggerNo 2
#define _BITPOS_bleTxTestPar_endTrigger_pastTrig 7
#define _NBITS_bleTxTestPar_endTrigger_pastTrig 1
#define _POSITION_bleTxTestPar_endTime 12
#define _TYPE_bleTxTestPar_endTime ratmr_t
#define _SIZEOF_bleTxTestPar 16
#define _POSITION_bleMasterSlaveOutput_nTx 0
#define _TYPE_bleMasterSlaveOutput_nTx uint8_t
#define _POSITION_bleMasterSlaveOutput_nTxAck 1
#define _TYPE_bleMasterSlaveOutput_nTxAck uint8_t
#define _POSITION_bleMasterSlaveOutput_nTxCtrl 2
#define _TYPE_bleMasterSlaveOutput_nTxCtrl uint8_t
#define _POSITION_bleMasterSlaveOutput_nTxCtrlAck 3
#define _TYPE_bleMasterSlaveOutput_nTxCtrlAck uint8_t
#define _POSITION_bleMasterSlaveOutput_nTxCtrlAckAck 4
#define _TYPE_bleMasterSlaveOutput_nTxCtrlAckAck uint8_t
#define _POSITION_bleMasterSlaveOutput_nTxRetrans 5
#define _TYPE_bleMasterSlaveOutput_nTxRetrans uint8_t
#define _POSITION_bleMasterSlaveOutput_nTxEntryDone 6
#define _TYPE_bleMasterSlaveOutput_nTxEntryDone uint8_t
#define _POSITION_bleMasterSlaveOutput_nRxOk 7
#define _TYPE_bleMasterSlaveOutput_nRxOk uint8_t
#define _POSITION_bleMasterSlaveOutput_nRxCtrl 8
#define _TYPE_bleMasterSlaveOutput_nRxCtrl uint8_t
#define _POSITION_bleMasterSlaveOutput_nRxCtrlAck 9
#define _TYPE_bleMasterSlaveOutput_nRxCtrlAck uint8_t
#define _POSITION_bleMasterSlaveOutput_nRxNok 10
#define _TYPE_bleMasterSlaveOutput_nRxNok uint8_t
#define _POSITION_bleMasterSlaveOutput_nRxIgnored 11
#define _TYPE_bleMasterSlaveOutput_nRxIgnored uint8_t
#define _POSITION_bleMasterSlaveOutput_nRxEmpty 12
#define _TYPE_bleMasterSlaveOutput_nRxEmpty uint8_t
#define _POSITION_bleMasterSlaveOutput_nRxBufFull 13
#define _TYPE_bleMasterSlaveOutput_nRxBufFull uint8_t
#define _POSITION_bleMasterSlaveOutput_lastRssi 14
#define _TYPE_bleMasterSlaveOutput_lastRssi int8_t
#define _POSITION_bleMasterSlaveOutput_pktStatus 15
#define _TYPE_bleMasterSlaveOutput_pktStatus uint8_t
#define _BITPOS_bleMasterSlaveOutput_pktStatus_bTimeStampValid 0
#define _NBITS_bleMasterSlaveOutput_pktStatus_bTimeStampValid 1
#define _BITPOS_bleMasterSlaveOutput_pktStatus_bLastCrcErr 1
#define _NBITS_bleMasterSlaveOutput_pktStatus_bLastCrcErr 1
#define _BITPOS_bleMasterSlaveOutput_pktStatus_bLastIgnored 2
#define _NBITS_bleMasterSlaveOutput_pktStatus_bLastIgnored 1
#define _BITPOS_bleMasterSlaveOutput_pktStatus_bLastEmpty 3
#define _NBITS_bleMasterSlaveOutput_pktStatus_bLastEmpty 1
#define _BITPOS_bleMasterSlaveOutput_pktStatus_bLastCtrl 4
#define _NBITS_bleMasterSlaveOutput_pktStatus_bLastCtrl 1
#define _BITPOS_bleMasterSlaveOutput_pktStatus_bLastMd 5
#define _NBITS_bleMasterSlaveOutput_pktStatus_bLastMd 1
#define _BITPOS_bleMasterSlaveOutput_pktStatus_bLastAck 6
#define _NBITS_bleMasterSlaveOutput_pktStatus_bLastAck 1
#define _POSITION_bleMasterSlaveOutput_timeStamp 16
#define _TYPE_bleMasterSlaveOutput_timeStamp ratmr_t
#define _SIZEOF_bleMasterSlaveOutput 20
#define _POSITION_bleAdvOutput_nTxAdvInd 0
#define _TYPE_bleAdvOutput_nTxAdvInd uint16_t
#define _POSITION_bleAdvOutput_nTxScanRsp 2
#define _TYPE_bleAdvOutput_nTxScanRsp uint8_t
#define _POSITION_bleAdvOutput_nRxScanReq 3
#define _TYPE_bleAdvOutput_nRxScanReq uint8_t
#define _POSITION_bleAdvOutput_nRxConnectReq 4
#define _TYPE_bleAdvOutput_nRxConnectReq uint8_t
#define _POSITION_bleAdvOutput_nRxNok 6
#define _TYPE_bleAdvOutput_nRxNok uint16_t
#define _POSITION_bleAdvOutput_nRxIgnored 8
#define _TYPE_bleAdvOutput_nRxIgnored uint16_t
#define _POSITION_bleAdvOutput_nRxBufFull 10
#define _TYPE_bleAdvOutput_nRxBufFull uint8_t
#define _POSITION_bleAdvOutput_lastRssi 11
#define _TYPE_bleAdvOutput_lastRssi int8_t
#define _POSITION_bleAdvOutput_timeStamp 12
#define _TYPE_bleAdvOutput_timeStamp ratmr_t
#define _SIZEOF_bleAdvOutput 16
#define _POSITION_bleScannerOutput_nTxScanReq 0
#define _TYPE_bleScannerOutput_nTxScanReq uint16_t
#define _POSITION_bleScannerOutput_nBackedOffScanReq 2
#define _TYPE_bleScannerOutput_nBackedOffScanReq uint16_t
#define _POSITION_bleScannerOutput_nRxAdvOk 4
#define _TYPE_bleScannerOutput_nRxAdvOk uint16_t
#define _POSITION_bleScannerOutput_nRxAdvIgnored 6
#define _TYPE_bleScannerOutput_nRxAdvIgnored uint16_t
#define _POSITION_bleScannerOutput_nRxAdvNok 8
#define _TYPE_bleScannerOutput_nRxAdvNok uint16_t
#define _POSITION_bleScannerOutput_nRxScanRspOk 10
#define _TYPE_bleScannerOutput_nRxScanRspOk uint16_t
#define _POSITION_bleScannerOutput_nRxScanRspIgnored 12
#define _TYPE_bleScannerOutput_nRxScanRspIgnored uint16_t
#define _POSITION_bleScannerOutput_nRxScanRspNok 14
#define _TYPE_bleScannerOutput_nRxScanRspNok uint16_t
#define _POSITION_bleScannerOutput_nRxAdvBufFull 16
#define _TYPE_bleScannerOutput_nRxAdvBufFull uint8_t
#define _POSITION_bleScannerOutput_nRxScanRspBufFull 17
#define _TYPE_bleScannerOutput_nRxScanRspBufFull uint8_t
#define _POSITION_bleScannerOutput_lastRssi 18
#define _TYPE_bleScannerOutput_lastRssi int8_t
#define _POSITION_bleScannerOutput_timeStamp 20
#define _TYPE_bleScannerOutput_timeStamp ratmr_t
#define _SIZEOF_bleScannerOutput 24
#define _POSITION_bleInitiatorOutput_nTxConnectReq 0
#define _TYPE_bleInitiatorOutput_nTxConnectReq uint8_t
#define _POSITION_bleInitiatorOutput_nRxAdvOk 1
#define _TYPE_bleInitiatorOutput_nRxAdvOk uint8_t
#define _POSITION_bleInitiatorOutput_nRxAdvIgnored 2
#define _TYPE_bleInitiatorOutput_nRxAdvIgnored uint16_t
#define _POSITION_bleInitiatorOutput_nRxAdvNok 4
#define _TYPE_bleInitiatorOutput_nRxAdvNok uint16_t
#define _POSITION_bleInitiatorOutput_nRxAdvBufFull 6
#define _TYPE_bleInitiatorOutput_nRxAdvBufFull uint8_t
#define _POSITION_bleInitiatorOutput_lastRssi 7
#define _TYPE_bleInitiatorOutput_lastRssi int8_t
#define _POSITION_bleInitiatorOutput_timeStamp 8
#define _TYPE_bleInitiatorOutput_timeStamp ratmr_t
#define _SIZEOF_bleInitiatorOutput 12
#define _POSITION_bleGenericRxOutput_nRxOk 0
#define _TYPE_bleGenericRxOutput_nRxOk uint16_t
#define _POSITION_bleGenericRxOutput_nRxNok 2
#define _TYPE_bleGenericRxOutput_nRxNok uint16_t
#define _POSITION_bleGenericRxOutput_nRxBufFull 4
#define _TYPE_bleGenericRxOutput_nRxBufFull uint16_t
#define _POSITION_bleGenericRxOutput_lastRssi 6
#define _TYPE_bleGenericRxOutput_lastRssi int8_t
#define _POSITION_bleGenericRxOutput_timeStamp 8
#define _TYPE_bleGenericRxOutput_timeStamp ratmr_t
#define _SIZEOF_bleGenericRxOutput 12
#define _POSITION_bleTxTestOutput_nTx 0
#define _TYPE_bleTxTestOutput_nTx uint16_t
#define _SIZEOF_bleTxTestOutput 2
#define _POSITION_bleWhiteListEntry_size 0
#define _TYPE_bleWhiteListEntry_size uint8_t
#define _POSITION_bleWhiteListEntry_conf 1
#define _TYPE_bleWhiteListEntry_conf uint8_t
#define _BITPOS_bleWhiteListEntry_conf_bEnable 0
#define _NBITS_bleWhiteListEntry_conf_bEnable 1
#define _BITPOS_bleWhiteListEntry_conf_addrType 1
#define _NBITS_bleWhiteListEntry_conf_addrType 1
#define _BITPOS_bleWhiteListEntry_conf_bWlIgn 2
#define _NBITS_bleWhiteListEntry_conf_bWlIgn 1
#define _POSITION_bleWhiteListEntry_address 2
#define _TYPE_bleWhiteListEntry_address uint16_t
#define _POSITION_bleWhiteListEntry_addressHi 4
#define _TYPE_bleWhiteListEntry_addressHi uint32_t
#define _SIZEOF_bleWhiteListEntry 8
#define _POSITION_bleRxStatus_status 0
#define _TYPE_bleRxStatus_status uint8_t
#define _BITPOS_bleRxStatus_status_channel 0
#define _NBITS_bleRxStatus_status_channel 6
#define _BITPOS_bleRxStatus_status_bIgnore 6
#define _NBITS_bleRxStatus_status_bIgnore 1
#define _BITPOS_bleRxStatus_status_bCrcErr 7
#define _NBITS_bleRxStatus_status_bCrcErr 1
#define _SIZEOF_bleRxStatus 1
#endif

View file

@ -1,448 +0,0 @@
/******************************************************************************
* Filename: common_cmd_field.h
* Revised: $ $
* Revision: $ $
*
* Description: CC26xx API for common/generic commands
*
* Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
#ifndef __COMMON_CMD_FIELD_H
#define __COMMON_CMD_FIELD_H
#include <stdint.h>
#include "mailbox.h"
#define _POSITION_command_commandNo 0
#define _TYPE_command_commandNo uint16_t
#define _SIZEOF_command 2
#define _POSITION_radioOp_commandNo 0
#define _TYPE_radioOp_commandNo uint16_t
#define _POSITION_radioOp_status 2
#define _TYPE_radioOp_status uint16_t
#define _POSITION_radioOp_pNextOp 4
#define _TYPE_radioOp_pNextOp uint8_t*
#define _POSITION_radioOp_startTime 8
#define _TYPE_radioOp_startTime ratmr_t
#define _POSITION_radioOp_startTrigger 12
#define _TYPE_radioOp_startTrigger uint8_t
#define _BITPOS_radioOp_startTrigger_triggerType 0
#define _NBITS_radioOp_startTrigger_triggerType 4
#define _BITPOS_radioOp_startTrigger_bEnaCmd 4
#define _NBITS_radioOp_startTrigger_bEnaCmd 1
#define _BITPOS_radioOp_startTrigger_triggerNo 5
#define _NBITS_radioOp_startTrigger_triggerNo 2
#define _BITPOS_radioOp_startTrigger_pastTrig 7
#define _NBITS_radioOp_startTrigger_pastTrig 1
#define _POSITION_radioOp_condition 13
#define _TYPE_radioOp_condition uint8_t
#define _BITPOS_radioOp_condition_rule 0
#define _NBITS_radioOp_condition_rule 4
#define _BITPOS_radioOp_condition_nSkip 4
#define _NBITS_radioOp_condition_nSkip 4
#define _SIZEOF_radioOp 14
#define _SIZEOF_CMD_NOP 14
#define _POSITION_CMD_RADIO_SETUP_mode 14
#define _TYPE_CMD_RADIO_SETUP_mode uint8_t
#define _POSITION_CMD_RADIO_SETUP_config 16
#define _TYPE_CMD_RADIO_SETUP_config uint16_t
#define _BITPOS_CMD_RADIO_SETUP_config_frontEndMode 0
#define _NBITS_CMD_RADIO_SETUP_config_frontEndMode 3
#define _BITPOS_CMD_RADIO_SETUP_config_biasMode 3
#define _NBITS_CMD_RADIO_SETUP_config_biasMode 1
#define _BITPOS_CMD_RADIO_SETUP_config_bNoAdi0Setup 4
#define _NBITS_CMD_RADIO_SETUP_config_bNoAdi0Setup 1
#define _BITPOS_CMD_RADIO_SETUP_config_bNoAdi0Trim 5
#define _NBITS_CMD_RADIO_SETUP_config_bNoAdi0Trim 1
#define _BITPOS_CMD_RADIO_SETUP_config_bNoAdi0Ovr 6
#define _NBITS_CMD_RADIO_SETUP_config_bNoAdi0Ovr 1
#define _BITPOS_CMD_RADIO_SETUP_config_bNoAdi1Setup 7
#define _NBITS_CMD_RADIO_SETUP_config_bNoAdi1Setup 1
#define _BITPOS_CMD_RADIO_SETUP_config_bNoAdi1Trim 8
#define _NBITS_CMD_RADIO_SETUP_config_bNoAdi1Trim 1
#define _BITPOS_CMD_RADIO_SETUP_config_bNoAdi1Ovr 9
#define _NBITS_CMD_RADIO_SETUP_config_bNoAdi1Ovr 1
#define _BITPOS_CMD_RADIO_SETUP_config_bNoFsPowerUp 10
#define _NBITS_CMD_RADIO_SETUP_config_bNoFsPowerUp 1
#define _POSITION_CMD_RADIO_SETUP_txPower 18
#define _TYPE_CMD_RADIO_SETUP_txPower uint16_t
#define _BITPOS_CMD_RADIO_SETUP_txPower_IB 0
#define _NBITS_CMD_RADIO_SETUP_txPower_IB 6
#define _BITPOS_CMD_RADIO_SETUP_txPower_GC 6
#define _NBITS_CMD_RADIO_SETUP_txPower_GC 2
#define _BITPOS_CMD_RADIO_SETUP_txPower_tempCoeff 8
#define _NBITS_CMD_RADIO_SETUP_txPower_tempCoeff 8
#define _POSITION_CMD_RADIO_SETUP_pRegOverride 20
#define _TYPE_CMD_RADIO_SETUP_pRegOverride uint32_t*
#define _SIZEOF_CMD_RADIO_SETUP 24
#define _POSITION_CMD_FS_frequency 14
#define _TYPE_CMD_FS_frequency uint16_t
#define _POSITION_CMD_FS_fractFreq 16
#define _TYPE_CMD_FS_fractFreq uint16_t
#define _POSITION_CMD_FS_synthConf 18
#define _TYPE_CMD_FS_synthConf uint8_t
#define _BITPOS_CMD_FS_synthConf_bTxMode 0
#define _NBITS_CMD_FS_synthConf_bTxMode 1
#define _BITPOS_CMD_FS_synthConf_refFreq 1
#define _NBITS_CMD_FS_synthConf_refFreq 6
#define _POSITION_CMD_FS_calibConf 19
#define _TYPE_CMD_FS_calibConf uint8_t
#define _BITPOS_CMD_FS_calibConf_bOverrideCalib 0
#define _NBITS_CMD_FS_calibConf_bOverrideCalib 1
#define _BITPOS_CMD_FS_calibConf_bSkipTdcCalib 1
#define _NBITS_CMD_FS_calibConf_bSkipTdcCalib 1
#define _BITPOS_CMD_FS_calibConf_bSkipCoarseCalib 2
#define _NBITS_CMD_FS_calibConf_bSkipCoarseCalib 1
#define _BITPOS_CMD_FS_calibConf_bSkipMidCalib 3
#define _NBITS_CMD_FS_calibConf_bSkipMidCalib 1
#define _BITPOS_CMD_FS_calibConf_coarsePrecal 4
#define _NBITS_CMD_FS_calibConf_coarsePrecal 4
#define _POSITION_CMD_FS_midPrecal 20
#define _TYPE_CMD_FS_midPrecal uint8_t
#define _POSITION_CMD_FS_ktPrecal 21
#define _TYPE_CMD_FS_ktPrecal uint8_t
#define _POSITION_CMD_FS_tdcPrecal 22
#define _TYPE_CMD_FS_tdcPrecal uint16_t
#define _SIZEOF_CMD_FS 24
#define _SIZEOF_CMD_FS_OFF 14
#define _POSITION_CMD_RX_pktConfig 14
#define _TYPE_CMD_RX_pktConfig uint16_t
#define _BITPOS_CMD_RX_pktConfig_endianness 0
#define _NBITS_CMD_RX_pktConfig_endianness 1
#define _BITPOS_CMD_RX_pktConfig_numHdrBits 1
#define _NBITS_CMD_RX_pktConfig_numHdrBits 6
#define _BITPOS_CMD_RX_pktConfig_bFsOff 7
#define _NBITS_CMD_RX_pktConfig_bFsOff 1
#define _BITPOS_CMD_RX_pktConfig_bUseCrc 8
#define _NBITS_CMD_RX_pktConfig_bUseCrc 1
#define _BITPOS_CMD_RX_pktConfig_bCrcIncSw 9
#define _NBITS_CMD_RX_pktConfig_bCrcIncSw 1
#define _BITPOS_CMD_RX_pktConfig_bCrcIncHdr 10
#define _NBITS_CMD_RX_pktConfig_bCrcIncHdr 1
#define _BITPOS_CMD_RX_pktConfig_bReportCrc 11
#define _NBITS_CMD_RX_pktConfig_bReportCrc 1
#define _BITPOS_CMD_RX_pktConfig_endType 12
#define _NBITS_CMD_RX_pktConfig_endType 1
#define _BITPOS_CMD_RX_pktConfig_bDualSw 13
#define _NBITS_CMD_RX_pktConfig_bDualSw 1
#define _POSITION_CMD_RX_syncWord 16
#define _TYPE_CMD_RX_syncWord uint32_t
#define _POSITION_CMD_RX_syncWord2 20
#define _TYPE_CMD_RX_syncWord2 uint32_t
#define _POSITION_CMD_RX_lenConfig 24
#define _TYPE_CMD_RX_lenConfig uint16_t
#define _BITPOS_CMD_RX_lenConfig_numLenBits 0
#define _NBITS_CMD_RX_lenConfig_numLenBits 4
#define _BITPOS_CMD_RX_lenConfig_lenFieldPos 4
#define _NBITS_CMD_RX_lenConfig_lenFieldPos 5
#define _BITPOS_CMD_RX_lenConfig_lenOffset 9
#define _NBITS_CMD_RX_lenConfig_lenOffset 7
#define _POSITION_CMD_RX_maxLen 26
#define _TYPE_CMD_RX_maxLen uint16_t
#define _POSITION_CMD_RX_pRecPkt 28
#define _TYPE_CMD_RX_pRecPkt uint8_t*
#define _POSITION_CMD_RX_endTime 32
#define _TYPE_CMD_RX_endTime ratmr_t
#define _POSITION_CMD_RX_endTrigger 36
#define _TYPE_CMD_RX_endTrigger uint8_t
#define _BITPOS_CMD_RX_endTrigger_triggerType 0
#define _NBITS_CMD_RX_endTrigger_triggerType 4
#define _BITPOS_CMD_RX_endTrigger_bEnaCmd 4
#define _NBITS_CMD_RX_endTrigger_bEnaCmd 1
#define _BITPOS_CMD_RX_endTrigger_triggerNo 5
#define _NBITS_CMD_RX_endTrigger_triggerNo 2
#define _BITPOS_CMD_RX_endTrigger_pastTrig 7
#define _NBITS_CMD_RX_endTrigger_pastTrig 1
#define _POSITION_CMD_RX_rssi 37
#define _TYPE_CMD_RX_rssi int8_t
#define _POSITION_CMD_RX_recLen 38
#define _TYPE_CMD_RX_recLen uint16_t
#define _POSITION_CMD_RX_timeStamp 40
#define _TYPE_CMD_RX_timeStamp ratmr_t
#define _POSITION_CMD_RX_nRxOk 44
#define _TYPE_CMD_RX_nRxOk uint16_t
#define _POSITION_CMD_RX_nRxNok 46
#define _TYPE_CMD_RX_nRxNok uint16_t
#define _POSITION_CMD_RX_nRx2Ok 48
#define _TYPE_CMD_RX_nRx2Ok uint16_t
#define _POSITION_CMD_RX_nRx2Nok 50
#define _TYPE_CMD_RX_nRx2Nok uint16_t
#define _SIZEOF_CMD_RX 52
#define _POSITION_CMD_TX_pktConfig 14
#define _TYPE_CMD_TX_pktConfig uint16_t
#define _BITPOS_CMD_TX_pktConfig_endianness 0
#define _NBITS_CMD_TX_pktConfig_endianness 1
#define _BITPOS_CMD_TX_pktConfig_numHdrBits 1
#define _NBITS_CMD_TX_pktConfig_numHdrBits 6
#define _BITPOS_CMD_TX_pktConfig_bFsOff 7
#define _NBITS_CMD_TX_pktConfig_bFsOff 1
#define _BITPOS_CMD_TX_pktConfig_bUseCrc 8
#define _NBITS_CMD_TX_pktConfig_bUseCrc 1
#define _BITPOS_CMD_TX_pktConfig_bCrcIncSw 9
#define _NBITS_CMD_TX_pktConfig_bCrcIncSw 1
#define _BITPOS_CMD_TX_pktConfig_bCrcIncHdr 10
#define _NBITS_CMD_TX_pktConfig_bCrcIncHdr 1
#define _POSITION_CMD_TX_syncWord 16
#define _TYPE_CMD_TX_syncWord uint32_t
#define _POSITION_CMD_TX_pTxPkt 20
#define _TYPE_CMD_TX_pTxPkt uint8_t*
#define _POSITION_CMD_TX_pktLen 24
#define _TYPE_CMD_TX_pktLen uint16_t
#define _SIZEOF_CMD_TX 26
#define _POSITION_CMD_RX_TEST_config 14
#define _TYPE_CMD_RX_TEST_config uint8_t
#define _BITPOS_CMD_RX_TEST_config_bEnaFifo 0
#define _NBITS_CMD_RX_TEST_config_bEnaFifo 1
#define _BITPOS_CMD_RX_TEST_config_bFsOff 1
#define _NBITS_CMD_RX_TEST_config_bFsOff 1
#define _BITPOS_CMD_RX_TEST_config_bNoSync 2
#define _NBITS_CMD_RX_TEST_config_bNoSync 1
#define _POSITION_CMD_RX_TEST_endTrigger 15
#define _TYPE_CMD_RX_TEST_endTrigger uint8_t
#define _BITPOS_CMD_RX_TEST_endTrigger_triggerType 0
#define _NBITS_CMD_RX_TEST_endTrigger_triggerType 4
#define _BITPOS_CMD_RX_TEST_endTrigger_bEnaCmd 4
#define _NBITS_CMD_RX_TEST_endTrigger_bEnaCmd 1
#define _BITPOS_CMD_RX_TEST_endTrigger_triggerNo 5
#define _NBITS_CMD_RX_TEST_endTrigger_triggerNo 2
#define _BITPOS_CMD_RX_TEST_endTrigger_pastTrig 7
#define _NBITS_CMD_RX_TEST_endTrigger_pastTrig 1
#define _POSITION_CMD_RX_TEST_syncWord 16
#define _TYPE_CMD_RX_TEST_syncWord uint32_t
#define _POSITION_CMD_RX_TEST_endTime 20
#define _TYPE_CMD_RX_TEST_endTime ratmr_t
#define _SIZEOF_CMD_RX_TEST 24
#define _POSITION_CMD_TX_TEST_config 14
#define _TYPE_CMD_TX_TEST_config uint8_t
#define _BITPOS_CMD_TX_TEST_config_bUseCw 0
#define _NBITS_CMD_TX_TEST_config_bUseCw 1
#define _BITPOS_CMD_TX_TEST_config_bFsOff 1
#define _NBITS_CMD_TX_TEST_config_bFsOff 1
#define _BITPOS_CMD_TX_TEST_config_whitenMode 2
#define _NBITS_CMD_TX_TEST_config_whitenMode 2
#define _POSITION_CMD_TX_TEST_txWord 16
#define _TYPE_CMD_TX_TEST_txWord uint16_t
#define _POSITION_CMD_TX_TEST_endTrigger 19
#define _TYPE_CMD_TX_TEST_endTrigger uint8_t
#define _BITPOS_CMD_TX_TEST_endTrigger_triggerType 0
#define _NBITS_CMD_TX_TEST_endTrigger_triggerType 4
#define _BITPOS_CMD_TX_TEST_endTrigger_bEnaCmd 4
#define _NBITS_CMD_TX_TEST_endTrigger_bEnaCmd 1
#define _BITPOS_CMD_TX_TEST_endTrigger_triggerNo 5
#define _NBITS_CMD_TX_TEST_endTrigger_triggerNo 2
#define _BITPOS_CMD_TX_TEST_endTrigger_pastTrig 7
#define _NBITS_CMD_TX_TEST_endTrigger_pastTrig 1
#define _POSITION_CMD_TX_TEST_syncWord 20
#define _TYPE_CMD_TX_TEST_syncWord uint32_t
#define _POSITION_CMD_TX_TEST_endTime 24
#define _TYPE_CMD_TX_TEST_endTime ratmr_t
#define _SIZEOF_CMD_TX_TEST 28
#define _POSITION_CMD_SYNC_STOP_RAT_rat0 16
#define _TYPE_CMD_SYNC_STOP_RAT_rat0 ratmr_t
#define _SIZEOF_CMD_SYNC_STOP_RAT 20
#define _POSITION_CMD_SYNC_START_RAT_rat0 16
#define _TYPE_CMD_SYNC_START_RAT_rat0 ratmr_t
#define _SIZEOF_CMD_SYNC_START_RAT 20
#define _POSITION_CMD_COUNT_counter 14
#define _TYPE_CMD_COUNT_counter uint16_t
#define _SIZEOF_CMD_COUNT 16
#define _POSITION_CMD_FS_POWERUP_pRegOverride 16
#define _TYPE_CMD_FS_POWERUP_pRegOverride uint32_t*
#define _SIZEOF_CMD_FS_POWERUP 20
#define _SIZEOF_CMD_FS_POWERDOWN 14
#define _POSITION_CMD_SCH_IMM_cmdrVal 16
#define _TYPE_CMD_SCH_IMM_cmdrVal uint32_t
#define _POSITION_CMD_SCH_IMM_cmdstaVal 20
#define _TYPE_CMD_SCH_IMM_cmdstaVal uint32_t
#define _SIZEOF_CMD_SCH_IMM 24
#define _POSITION_CMD_COUNT_BRANCH_counter 14
#define _TYPE_CMD_COUNT_BRANCH_counter uint16_t
#define _POSITION_CMD_COUNT_BRANCH_pNextOpIfOk 16
#define _TYPE_CMD_COUNT_BRANCH_pNextOpIfOk uint8_t*
#define _SIZEOF_CMD_COUNT_BRANCH 20
#define _POSITION_CMD_PATTERN_CHECK_patternOpt 14
#define _TYPE_CMD_PATTERN_CHECK_patternOpt uint16_t
#define _BITPOS_CMD_PATTERN_CHECK_patternOpt_operation 0
#define _NBITS_CMD_PATTERN_CHECK_patternOpt_operation 2
#define _BITPOS_CMD_PATTERN_CHECK_patternOpt_bByteRev 2
#define _NBITS_CMD_PATTERN_CHECK_patternOpt_bByteRev 1
#define _BITPOS_CMD_PATTERN_CHECK_patternOpt_bBitRev 3
#define _NBITS_CMD_PATTERN_CHECK_patternOpt_bBitRev 1
#define _BITPOS_CMD_PATTERN_CHECK_patternOpt_signExtend 4
#define _NBITS_CMD_PATTERN_CHECK_patternOpt_signExtend 5
#define _BITPOS_CMD_PATTERN_CHECK_patternOpt_bRxVal 9
#define _NBITS_CMD_PATTERN_CHECK_patternOpt_bRxVal 1
#define _POSITION_CMD_PATTERN_CHECK_pNextOpIfOk 16
#define _TYPE_CMD_PATTERN_CHECK_pNextOpIfOk uint8_t*
#define _POSITION_CMD_PATTERN_CHECK_pValue 20
#define _TYPE_CMD_PATTERN_CHECK_pValue uint8_t*
#define _POSITION_CMD_PATTERN_CHECK_mask 24
#define _TYPE_CMD_PATTERN_CHECK_mask uint32_t
#define _POSITION_CMD_PATTERN_CHECK_compareVal 28
#define _TYPE_CMD_PATTERN_CHECK_compareVal uint32_t
#define _SIZEOF_CMD_PATTERN_CHECK 32
#define _SIZEOF_CMD_ABORT 2
#define _SIZEOF_CMD_STOP 2
#define _SIZEOF_CMD_GET_RSSI 2
#define _POSITION_CMD_UPDATE_RADIO_SETUP_pRegOverride 4
#define _TYPE_CMD_UPDATE_RADIO_SETUP_pRegOverride uint32_t*
#define _SIZEOF_CMD_UPDATE_RADIO_SETUP 8
#define _POSITION_CMD_TRIGGER_triggerNo 2
#define _TYPE_CMD_TRIGGER_triggerNo uint8_t
#define _SIZEOF_CMD_TRIGGER 3
#define _POSITION_CMD_GET_FW_INFO_versionNo 2
#define _TYPE_CMD_GET_FW_INFO_versionNo uint16_t
#define _POSITION_CMD_GET_FW_INFO_startOffset 4
#define _TYPE_CMD_GET_FW_INFO_startOffset uint16_t
#define _POSITION_CMD_GET_FW_INFO_freeRamSz 6
#define _TYPE_CMD_GET_FW_INFO_freeRamSz uint16_t
#define _POSITION_CMD_GET_FW_INFO_availRatCh 8
#define _TYPE_CMD_GET_FW_INFO_availRatCh uint16_t
#define _SIZEOF_CMD_GET_FW_INFO 10
#define _SIZEOF_CMD_START_RAT 2
#define _SIZEOF_CMD_PING 2
#define _POSITION_CMD_ADD_DATA_ENTRY_pQueue 4
#define _TYPE_CMD_ADD_DATA_ENTRY_pQueue dataQueue_t*
#define _POSITION_CMD_ADD_DATA_ENTRY_pEntry 8
#define _TYPE_CMD_ADD_DATA_ENTRY_pEntry uint8_t*
#define _SIZEOF_CMD_ADD_DATA_ENTRY 12
#define _POSITION_CMD_REMOVE_DATA_ENTRY_pQueue 4
#define _TYPE_CMD_REMOVE_DATA_ENTRY_pQueue dataQueue_t*
#define _POSITION_CMD_REMOVE_DATA_ENTRY_pEntry 8
#define _TYPE_CMD_REMOVE_DATA_ENTRY_pEntry uint8_t*
#define _SIZEOF_CMD_REMOVE_DATA_ENTRY 12
#define _POSITION_CMD_FLUSH_QUEUE_pQueue 4
#define _TYPE_CMD_FLUSH_QUEUE_pQueue dataQueue_t*
#define _POSITION_CMD_FLUSH_QUEUE_pFirstEntry 8
#define _TYPE_CMD_FLUSH_QUEUE_pFirstEntry uint8_t*
#define _SIZEOF_CMD_FLUSH_QUEUE 12
#define _POSITION_CMD_CLEAR_RX_pQueue 4
#define _TYPE_CMD_CLEAR_RX_pQueue dataQueue_t*
#define _SIZEOF_CMD_CLEAR_RX 8
#define _POSITION_CMD_REMOVE_PENDING_ENTRIES_pQueue 4
#define _TYPE_CMD_REMOVE_PENDING_ENTRIES_pQueue dataQueue_t*
#define _POSITION_CMD_REMOVE_PENDING_ENTRIES_pFirstEntry 8
#define _TYPE_CMD_REMOVE_PENDING_ENTRIES_pFirstEntry uint8_t*
#define _SIZEOF_CMD_REMOVE_PENDING_ENTRIES 12
#define _POSITION_CMD_SET_RAT_CMP_ratCh 2
#define _TYPE_CMD_SET_RAT_CMP_ratCh uint8_t
#define _POSITION_CMD_SET_RAT_CMP_compareTime 4
#define _TYPE_CMD_SET_RAT_CMP_compareTime ratmr_t
#define _SIZEOF_CMD_SET_RAT_CMP 8
#define _POSITION_CMD_SET_RAT_CPT_config 2
#define _TYPE_CMD_SET_RAT_CPT_config uint16_t
#define _BITPOS_CMD_SET_RAT_CPT_config_inputSrc 3
#define _NBITS_CMD_SET_RAT_CPT_config_inputSrc 5
#define _BITPOS_CMD_SET_RAT_CPT_config_ratCh 8
#define _NBITS_CMD_SET_RAT_CPT_config_ratCh 4
#define _BITPOS_CMD_SET_RAT_CPT_config_bRepeated 12
#define _NBITS_CMD_SET_RAT_CPT_config_bRepeated 1
#define _BITPOS_CMD_SET_RAT_CPT_config_inputMode 13
#define _NBITS_CMD_SET_RAT_CPT_config_inputMode 2
#define _SIZEOF_CMD_SET_RAT_CPT 4
#define _POSITION_CMD_DISABLE_RAT_CH_ratCh 2
#define _TYPE_CMD_DISABLE_RAT_CH_ratCh uint8_t
#define _SIZEOF_CMD_DISABLE_RAT_CH 3
#define _POSITION_CMD_SET_RAT_OUTPUT_config 2
#define _TYPE_CMD_SET_RAT_OUTPUT_config uint16_t
#define _BITPOS_CMD_SET_RAT_OUTPUT_config_outputSel 2
#define _NBITS_CMD_SET_RAT_OUTPUT_config_outputSel 3
#define _BITPOS_CMD_SET_RAT_OUTPUT_config_outputMode 5
#define _NBITS_CMD_SET_RAT_OUTPUT_config_outputMode 3
#define _BITPOS_CMD_SET_RAT_OUTPUT_config_ratCh 8
#define _NBITS_CMD_SET_RAT_OUTPUT_config_ratCh 4
#define _SIZEOF_CMD_SET_RAT_OUTPUT 4
#define _POSITION_CMD_ARM_RAT_CH_ratCh 2
#define _TYPE_CMD_ARM_RAT_CH_ratCh uint8_t
#define _SIZEOF_CMD_ARM_RAT_CH 3
#define _POSITION_CMD_DISARM_RAT_CH_ratCh 2
#define _TYPE_CMD_DISARM_RAT_CH_ratCh uint8_t
#define _SIZEOF_CMD_DISARM_RAT_CH 3
#define _POSITION_CMD_SET_TX_POWER_txPower 2
#define _TYPE_CMD_SET_TX_POWER_txPower uint16_t
#define _BITPOS_CMD_SET_TX_POWER_txPower_IB 0
#define _NBITS_CMD_SET_TX_POWER_txPower_IB 6
#define _BITPOS_CMD_SET_TX_POWER_txPower_GC 6
#define _NBITS_CMD_SET_TX_POWER_txPower_GC 2
#define _BITPOS_CMD_SET_TX_POWER_txPower_tempCoeff 8
#define _NBITS_CMD_SET_TX_POWER_txPower_tempCoeff 8
#define _SIZEOF_CMD_SET_TX_POWER 4
#define _POSITION_CMD_UPDATE_FS_frequency 2
#define _TYPE_CMD_UPDATE_FS_frequency uint16_t
#define _POSITION_CMD_UPDATE_FS_fractFreq 4
#define _TYPE_CMD_UPDATE_FS_fractFreq uint16_t
#define _SIZEOF_CMD_UPDATE_FS 6
#define _POSITION_CMD_BUS_REQUEST_bSysBusNeeded 2
#define _TYPE_CMD_BUS_REQUEST_bSysBusNeeded uint8_t
#define _SIZEOF_CMD_BUS_REQUEST 3
#endif

View file

@ -1,91 +0,0 @@
/*
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
#ifndef __DATA_ENTRY_H
#define __DATA_ENTRY_H
#include <stdint.h>
#include "mailbox.h"
typedef struct rfc_dataEntry_s rfc_dataEntry_t;
#define _POSITION_dataEntry_pNextEntry 0
#define _TYPE_dataEntry_pNextEntry uint8_t*
#define _POSITION_dataEntry_status 4
#define _TYPE_dataEntry_status uint8_t
#define _POSITION_dataEntry_config 5
#define _TYPE_dataEntry_config uint8_t
#define _BITPOS_dataEntry_config_type 0
#define _NBITS_dataEntry_config_type 2
#define _BITPOS_dataEntry_config_lenSz 2
#define _NBITS_dataEntry_config_lenSz 2
#define _BITPOS_dataEntry_config_irqIntv 4
#define _NBITS_dataEntry_config_irqIntv 4
#define _POSITION_dataEntry_length 6
#define _TYPE_dataEntry_length uint16_t
#define _POSITION_dataEntry_data 8
#define _TYPE_dataEntry_data uint8_t
#define _POSITION_dataEntry_pData 8
#define _TYPE_dataEntry_pData uint8_t*
#define _POSITION_dataEntry_numElements 8
#define _TYPE_dataEntry_numElements uint16_t
#define _POSITION_dataEntry_pktStatus 8
#define _TYPE_dataEntry_pktStatus uint16_t
#define _BITPOS_dataEntry_pktStatus_numElements 0
#define _NBITS_dataEntry_pktStatus_numElements 13
#define _BITPOS_dataEntry_pktStatus_bEntryOpen 13
#define _NBITS_dataEntry_pktStatus_bEntryOpen 1
#define _BITPOS_dataEntry_pktStatus_bFirstCont 14
#define _NBITS_dataEntry_pktStatus_bFirstCont 1
#define _BITPOS_dataEntry_pktStatus_bLastCont 15
#define _NBITS_dataEntry_pktStatus_bLastCont 1
#define _POSITION_dataEntry_nextIndex 10
#define _TYPE_dataEntry_nextIndex uint16_t
#define _POSITION_dataEntry_rxData 12
#define _TYPE_dataEntry_rxData uint8_t
#define _LAST_POSITION_dataEntry 12
#define _LAST_TYPE_dataEntry uint8_t
struct rfc_dataEntry_s {
uint8_t* pNextEntry;
uint8_t status;
struct {
uint8_t type:2;
uint8_t lenSz:2;
uint8_t irqIntv:4;
} config;
uint16_t length;
uint8_t data;
uint8_t __dummy0;
uint16_t nextIndex;
uint8_t rxData;
};
#endif

View file

@ -1,403 +0,0 @@
/******************************************************************************
* Filename: ieee_cmd_field.h
* Revised: $ $
* Revision: $ $
*
* Description: CC26xx/CC13xx API for IEEE 802.15.4 commands
*
* Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
#ifndef __IEEE_CMD_FIELD_H
#define __IEEE_CMD_FIELD_H
#include <stdint.h>
#include "mailbox.h"
#include "common_cmd.h"
#define _POSITION_CMD_IEEE_RX_channel 14
#define _TYPE_CMD_IEEE_RX_channel uint8_t
#define _POSITION_CMD_IEEE_RX_rxConfig 15
#define _TYPE_CMD_IEEE_RX_rxConfig uint8_t
#define _BITPOS_CMD_IEEE_RX_rxConfig_bAutoFlushCrc 0
#define _NBITS_CMD_IEEE_RX_rxConfig_bAutoFlushCrc 1
#define _BITPOS_CMD_IEEE_RX_rxConfig_bAutoFlushIgn 1
#define _NBITS_CMD_IEEE_RX_rxConfig_bAutoFlushIgn 1
#define _BITPOS_CMD_IEEE_RX_rxConfig_bIncludePhyHdr 2
#define _NBITS_CMD_IEEE_RX_rxConfig_bIncludePhyHdr 1
#define _BITPOS_CMD_IEEE_RX_rxConfig_bIncludeCrc 3
#define _NBITS_CMD_IEEE_RX_rxConfig_bIncludeCrc 1
#define _BITPOS_CMD_IEEE_RX_rxConfig_bAppendRssi 4
#define _NBITS_CMD_IEEE_RX_rxConfig_bAppendRssi 1
#define _BITPOS_CMD_IEEE_RX_rxConfig_bAppendCorrCrc 5
#define _NBITS_CMD_IEEE_RX_rxConfig_bAppendCorrCrc 1
#define _BITPOS_CMD_IEEE_RX_rxConfig_bAppendSrcInd 6
#define _NBITS_CMD_IEEE_RX_rxConfig_bAppendSrcInd 1
#define _BITPOS_CMD_IEEE_RX_rxConfig_bAppendTimestamp 7
#define _NBITS_CMD_IEEE_RX_rxConfig_bAppendTimestamp 1
#define _POSITION_CMD_IEEE_RX_pRxQ 16
#define _TYPE_CMD_IEEE_RX_pRxQ dataQueue_t*
#define _POSITION_CMD_IEEE_RX_pOutput 20
#define _TYPE_CMD_IEEE_RX_pOutput uint8_t*
#define _POSITION_CMD_IEEE_RX_frameFiltOpt 24
#define _TYPE_CMD_IEEE_RX_frameFiltOpt uint16_t
#define _BITPOS_CMD_IEEE_RX_frameFiltOpt_frameFiltEn 0
#define _NBITS_CMD_IEEE_RX_frameFiltOpt_frameFiltEn 1
#define _BITPOS_CMD_IEEE_RX_frameFiltOpt_frameFiltStop 1
#define _NBITS_CMD_IEEE_RX_frameFiltOpt_frameFiltStop 1
#define _BITPOS_CMD_IEEE_RX_frameFiltOpt_autoAckEn 2
#define _NBITS_CMD_IEEE_RX_frameFiltOpt_autoAckEn 1
#define _BITPOS_CMD_IEEE_RX_frameFiltOpt_slottedAckEn 3
#define _NBITS_CMD_IEEE_RX_frameFiltOpt_slottedAckEn 1
#define _BITPOS_CMD_IEEE_RX_frameFiltOpt_autoPendEn 4
#define _NBITS_CMD_IEEE_RX_frameFiltOpt_autoPendEn 1
#define _BITPOS_CMD_IEEE_RX_frameFiltOpt_defaultPend 5
#define _NBITS_CMD_IEEE_RX_frameFiltOpt_defaultPend 1
#define _BITPOS_CMD_IEEE_RX_frameFiltOpt_bPendDataReqOnly 6
#define _NBITS_CMD_IEEE_RX_frameFiltOpt_bPendDataReqOnly 1
#define _BITPOS_CMD_IEEE_RX_frameFiltOpt_bPanCoord 7
#define _NBITS_CMD_IEEE_RX_frameFiltOpt_bPanCoord 1
#define _BITPOS_CMD_IEEE_RX_frameFiltOpt_maxFrameVersion 8
#define _NBITS_CMD_IEEE_RX_frameFiltOpt_maxFrameVersion 2
#define _BITPOS_CMD_IEEE_RX_frameFiltOpt_fcfReservedMask 10
#define _NBITS_CMD_IEEE_RX_frameFiltOpt_fcfReservedMask 3
#define _BITPOS_CMD_IEEE_RX_frameFiltOpt_modifyFtFilter 13
#define _NBITS_CMD_IEEE_RX_frameFiltOpt_modifyFtFilter 2
#define _BITPOS_CMD_IEEE_RX_frameFiltOpt_bStrictLenFilter 15
#define _NBITS_CMD_IEEE_RX_frameFiltOpt_bStrictLenFilter 1
#define _POSITION_CMD_IEEE_RX_frameTypes 26
#define _TYPE_CMD_IEEE_RX_frameTypes uint8_t
#define _BITPOS_CMD_IEEE_RX_frameTypes_bAcceptFt0Beacon 0
#define _NBITS_CMD_IEEE_RX_frameTypes_bAcceptFt0Beacon 1
#define _BITPOS_CMD_IEEE_RX_frameTypes_bAcceptFt1Data 1
#define _NBITS_CMD_IEEE_RX_frameTypes_bAcceptFt1Data 1
#define _BITPOS_CMD_IEEE_RX_frameTypes_bAcceptFt2Ack 2
#define _NBITS_CMD_IEEE_RX_frameTypes_bAcceptFt2Ack 1
#define _BITPOS_CMD_IEEE_RX_frameTypes_bAcceptFt3MacCmd 3
#define _NBITS_CMD_IEEE_RX_frameTypes_bAcceptFt3MacCmd 1
#define _BITPOS_CMD_IEEE_RX_frameTypes_bAcceptFt4Reserved 4
#define _NBITS_CMD_IEEE_RX_frameTypes_bAcceptFt4Reserved 1
#define _BITPOS_CMD_IEEE_RX_frameTypes_bAcceptFt5Reserved 5
#define _NBITS_CMD_IEEE_RX_frameTypes_bAcceptFt5Reserved 1
#define _BITPOS_CMD_IEEE_RX_frameTypes_bAcceptFt6Reserved 6
#define _NBITS_CMD_IEEE_RX_frameTypes_bAcceptFt6Reserved 1
#define _BITPOS_CMD_IEEE_RX_frameTypes_bAcceptFt7Reserved 7
#define _NBITS_CMD_IEEE_RX_frameTypes_bAcceptFt7Reserved 1
#define _POSITION_CMD_IEEE_RX_ccaOpt 27
#define _TYPE_CMD_IEEE_RX_ccaOpt uint8_t
#define _BITPOS_CMD_IEEE_RX_ccaOpt_ccaEnEnergy 0
#define _NBITS_CMD_IEEE_RX_ccaOpt_ccaEnEnergy 1
#define _BITPOS_CMD_IEEE_RX_ccaOpt_ccaEnCorr 1
#define _NBITS_CMD_IEEE_RX_ccaOpt_ccaEnCorr 1
#define _BITPOS_CMD_IEEE_RX_ccaOpt_ccaEnSync 2
#define _NBITS_CMD_IEEE_RX_ccaOpt_ccaEnSync 1
#define _BITPOS_CMD_IEEE_RX_ccaOpt_ccaCorrOp 3
#define _NBITS_CMD_IEEE_RX_ccaOpt_ccaCorrOp 1
#define _BITPOS_CMD_IEEE_RX_ccaOpt_ccaSyncOp 4
#define _NBITS_CMD_IEEE_RX_ccaOpt_ccaSyncOp 1
#define _BITPOS_CMD_IEEE_RX_ccaOpt_ccaCorrThr 5
#define _NBITS_CMD_IEEE_RX_ccaOpt_ccaCorrThr 2
#define _POSITION_CMD_IEEE_RX_ccaRssiThr 28
#define _TYPE_CMD_IEEE_RX_ccaRssiThr int8_t
#define _POSITION_CMD_IEEE_RX_numExtEntries 30
#define _TYPE_CMD_IEEE_RX_numExtEntries uint8_t
#define _POSITION_CMD_IEEE_RX_numShortEntries 31
#define _TYPE_CMD_IEEE_RX_numShortEntries uint8_t
#define _POSITION_CMD_IEEE_RX_pExtEntryList 32
#define _TYPE_CMD_IEEE_RX_pExtEntryList uint32_t*
#define _POSITION_CMD_IEEE_RX_pShortEntryList 36
#define _TYPE_CMD_IEEE_RX_pShortEntryList uint32_t*
#define _POSITION_CMD_IEEE_RX_localExtAddr 40
#define _TYPE_CMD_IEEE_RX_localExtAddr uint64_t
#define _POSITION_CMD_IEEE_RX_localShortAddr 48
#define _TYPE_CMD_IEEE_RX_localShortAddr uint16_t
#define _POSITION_CMD_IEEE_RX_localPanID 50
#define _TYPE_CMD_IEEE_RX_localPanID uint16_t
#define _POSITION_CMD_IEEE_RX_endTrigger 55
#define _TYPE_CMD_IEEE_RX_endTrigger uint8_t
#define _BITPOS_CMD_IEEE_RX_endTrigger_triggerType 0
#define _NBITS_CMD_IEEE_RX_endTrigger_triggerType 4
#define _BITPOS_CMD_IEEE_RX_endTrigger_bEnaCmd 4
#define _NBITS_CMD_IEEE_RX_endTrigger_bEnaCmd 1
#define _BITPOS_CMD_IEEE_RX_endTrigger_triggerNo 5
#define _NBITS_CMD_IEEE_RX_endTrigger_triggerNo 2
#define _BITPOS_CMD_IEEE_RX_endTrigger_pastTrig 7
#define _NBITS_CMD_IEEE_RX_endTrigger_pastTrig 1
#define _POSITION_CMD_IEEE_RX_endTime 56
#define _TYPE_CMD_IEEE_RX_endTime ratmr_t
#define _SIZEOF_CMD_IEEE_RX 60
#define _POSITION_CMD_IEEE_ED_SCAN_channel 14
#define _TYPE_CMD_IEEE_ED_SCAN_channel uint8_t
#define _POSITION_CMD_IEEE_ED_SCAN_ccaOpt 15
#define _TYPE_CMD_IEEE_ED_SCAN_ccaOpt uint8_t
#define _BITPOS_CMD_IEEE_ED_SCAN_ccaOpt_ccaEnEnergy 0
#define _NBITS_CMD_IEEE_ED_SCAN_ccaOpt_ccaEnEnergy 1
#define _BITPOS_CMD_IEEE_ED_SCAN_ccaOpt_ccaEnCorr 1
#define _NBITS_CMD_IEEE_ED_SCAN_ccaOpt_ccaEnCorr 1
#define _BITPOS_CMD_IEEE_ED_SCAN_ccaOpt_ccaEnSync 2
#define _NBITS_CMD_IEEE_ED_SCAN_ccaOpt_ccaEnSync 1
#define _BITPOS_CMD_IEEE_ED_SCAN_ccaOpt_ccaCorrOp 3
#define _NBITS_CMD_IEEE_ED_SCAN_ccaOpt_ccaCorrOp 1
#define _BITPOS_CMD_IEEE_ED_SCAN_ccaOpt_ccaSyncOp 4
#define _NBITS_CMD_IEEE_ED_SCAN_ccaOpt_ccaSyncOp 1
#define _BITPOS_CMD_IEEE_ED_SCAN_ccaOpt_ccaCorrThr 5
#define _NBITS_CMD_IEEE_ED_SCAN_ccaOpt_ccaCorrThr 2
#define _POSITION_CMD_IEEE_ED_SCAN_ccaRssiThr 16
#define _TYPE_CMD_IEEE_ED_SCAN_ccaRssiThr int8_t
#define _POSITION_CMD_IEEE_ED_SCAN_maxRssi 18
#define _TYPE_CMD_IEEE_ED_SCAN_maxRssi int8_t
#define _POSITION_CMD_IEEE_ED_SCAN_endTrigger 19
#define _TYPE_CMD_IEEE_ED_SCAN_endTrigger uint8_t
#define _BITPOS_CMD_IEEE_ED_SCAN_endTrigger_triggerType 0
#define _NBITS_CMD_IEEE_ED_SCAN_endTrigger_triggerType 4
#define _BITPOS_CMD_IEEE_ED_SCAN_endTrigger_bEnaCmd 4
#define _NBITS_CMD_IEEE_ED_SCAN_endTrigger_bEnaCmd 1
#define _BITPOS_CMD_IEEE_ED_SCAN_endTrigger_triggerNo 5
#define _NBITS_CMD_IEEE_ED_SCAN_endTrigger_triggerNo 2
#define _BITPOS_CMD_IEEE_ED_SCAN_endTrigger_pastTrig 7
#define _NBITS_CMD_IEEE_ED_SCAN_endTrigger_pastTrig 1
#define _POSITION_CMD_IEEE_ED_SCAN_endTime 20
#define _TYPE_CMD_IEEE_ED_SCAN_endTime ratmr_t
#define _SIZEOF_CMD_IEEE_ED_SCAN 24
#define _POSITION_CMD_IEEE_TX_txOpt 14
#define _TYPE_CMD_IEEE_TX_txOpt uint8_t
#define _BITPOS_CMD_IEEE_TX_txOpt_bIncludePhyHdr 0
#define _NBITS_CMD_IEEE_TX_txOpt_bIncludePhyHdr 1
#define _BITPOS_CMD_IEEE_TX_txOpt_bIncludeCrc 1
#define _NBITS_CMD_IEEE_TX_txOpt_bIncludeCrc 1
#define _BITPOS_CMD_IEEE_TX_txOpt_payloadLenMsb 3
#define _NBITS_CMD_IEEE_TX_txOpt_payloadLenMsb 5
#define _POSITION_CMD_IEEE_TX_payloadLen 15
#define _TYPE_CMD_IEEE_TX_payloadLen uint8_t
#define _POSITION_CMD_IEEE_TX_pPayload 16
#define _TYPE_CMD_IEEE_TX_pPayload uint8_t*
#define _POSITION_CMD_IEEE_TX_timeStamp 20
#define _TYPE_CMD_IEEE_TX_timeStamp ratmr_t
#define _SIZEOF_CMD_IEEE_TX 24
#define _POSITION_CMD_IEEE_CSMA_randomState 14
#define _TYPE_CMD_IEEE_CSMA_randomState uint16_t
#define _POSITION_CMD_IEEE_CSMA_macMaxBE 16
#define _TYPE_CMD_IEEE_CSMA_macMaxBE uint8_t
#define _POSITION_CMD_IEEE_CSMA_macMaxCSMABackoffs 17
#define _TYPE_CMD_IEEE_CSMA_macMaxCSMABackoffs uint8_t
#define _POSITION_CMD_IEEE_CSMA_csmaConfig 18
#define _TYPE_CMD_IEEE_CSMA_csmaConfig uint8_t
#define _BITPOS_CMD_IEEE_CSMA_csmaConfig_initCW 0
#define _NBITS_CMD_IEEE_CSMA_csmaConfig_initCW 5
#define _BITPOS_CMD_IEEE_CSMA_csmaConfig_bSlotted 5
#define _NBITS_CMD_IEEE_CSMA_csmaConfig_bSlotted 1
#define _BITPOS_CMD_IEEE_CSMA_csmaConfig_rxOffMode 6
#define _NBITS_CMD_IEEE_CSMA_csmaConfig_rxOffMode 2
#define _POSITION_CMD_IEEE_CSMA_NB 19
#define _TYPE_CMD_IEEE_CSMA_NB uint8_t
#define _POSITION_CMD_IEEE_CSMA_BE 20
#define _TYPE_CMD_IEEE_CSMA_BE uint8_t
#define _POSITION_CMD_IEEE_CSMA_remainingPeriods 21
#define _TYPE_CMD_IEEE_CSMA_remainingPeriods uint8_t
#define _POSITION_CMD_IEEE_CSMA_lastRssi 22
#define _TYPE_CMD_IEEE_CSMA_lastRssi int8_t
#define _POSITION_CMD_IEEE_CSMA_endTrigger 23
#define _TYPE_CMD_IEEE_CSMA_endTrigger uint8_t
#define _BITPOS_CMD_IEEE_CSMA_endTrigger_triggerType 0
#define _NBITS_CMD_IEEE_CSMA_endTrigger_triggerType 4
#define _BITPOS_CMD_IEEE_CSMA_endTrigger_bEnaCmd 4
#define _NBITS_CMD_IEEE_CSMA_endTrigger_bEnaCmd 1
#define _BITPOS_CMD_IEEE_CSMA_endTrigger_triggerNo 5
#define _NBITS_CMD_IEEE_CSMA_endTrigger_triggerNo 2
#define _BITPOS_CMD_IEEE_CSMA_endTrigger_pastTrig 7
#define _NBITS_CMD_IEEE_CSMA_endTrigger_pastTrig 1
#define _POSITION_CMD_IEEE_CSMA_lastTimeStamp 24
#define _TYPE_CMD_IEEE_CSMA_lastTimeStamp ratmr_t
#define _POSITION_CMD_IEEE_CSMA_endTime 28
#define _TYPE_CMD_IEEE_CSMA_endTime ratmr_t
#define _SIZEOF_CMD_IEEE_CSMA 32
#define _POSITION_CMD_IEEE_RX_ACK_seqNo 14
#define _TYPE_CMD_IEEE_RX_ACK_seqNo uint8_t
#define _POSITION_CMD_IEEE_RX_ACK_endTrigger 15
#define _TYPE_CMD_IEEE_RX_ACK_endTrigger uint8_t
#define _BITPOS_CMD_IEEE_RX_ACK_endTrigger_triggerType 0
#define _NBITS_CMD_IEEE_RX_ACK_endTrigger_triggerType 4
#define _BITPOS_CMD_IEEE_RX_ACK_endTrigger_bEnaCmd 4
#define _NBITS_CMD_IEEE_RX_ACK_endTrigger_bEnaCmd 1
#define _BITPOS_CMD_IEEE_RX_ACK_endTrigger_triggerNo 5
#define _NBITS_CMD_IEEE_RX_ACK_endTrigger_triggerNo 2
#define _BITPOS_CMD_IEEE_RX_ACK_endTrigger_pastTrig 7
#define _NBITS_CMD_IEEE_RX_ACK_endTrigger_pastTrig 1
#define _POSITION_CMD_IEEE_RX_ACK_endTime 16
#define _TYPE_CMD_IEEE_RX_ACK_endTime ratmr_t
#define _SIZEOF_CMD_IEEE_RX_ACK 20
#define _SIZEOF_CMD_IEEE_ABORT_BG 14
#define _POSITION_CMD_IEEE_MOD_CCA_newCcaOpt 2
#define _TYPE_CMD_IEEE_MOD_CCA_newCcaOpt uint8_t
#define _BITPOS_CMD_IEEE_MOD_CCA_newCcaOpt_ccaEnEnergy 0
#define _NBITS_CMD_IEEE_MOD_CCA_newCcaOpt_ccaEnEnergy 1
#define _BITPOS_CMD_IEEE_MOD_CCA_newCcaOpt_ccaEnCorr 1
#define _NBITS_CMD_IEEE_MOD_CCA_newCcaOpt_ccaEnCorr 1
#define _BITPOS_CMD_IEEE_MOD_CCA_newCcaOpt_ccaEnSync 2
#define _NBITS_CMD_IEEE_MOD_CCA_newCcaOpt_ccaEnSync 1
#define _BITPOS_CMD_IEEE_MOD_CCA_newCcaOpt_ccaCorrOp 3
#define _NBITS_CMD_IEEE_MOD_CCA_newCcaOpt_ccaCorrOp 1
#define _BITPOS_CMD_IEEE_MOD_CCA_newCcaOpt_ccaSyncOp 4
#define _NBITS_CMD_IEEE_MOD_CCA_newCcaOpt_ccaSyncOp 1
#define _BITPOS_CMD_IEEE_MOD_CCA_newCcaOpt_ccaCorrThr 5
#define _NBITS_CMD_IEEE_MOD_CCA_newCcaOpt_ccaCorrThr 2
#define _POSITION_CMD_IEEE_MOD_CCA_newCcaRssiThr 3
#define _TYPE_CMD_IEEE_MOD_CCA_newCcaRssiThr int8_t
#define _SIZEOF_CMD_IEEE_MOD_CCA 4
#define _POSITION_CMD_IEEE_MOD_FILT_newFrameFiltOpt 2
#define _TYPE_CMD_IEEE_MOD_FILT_newFrameFiltOpt uint16_t
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_frameFiltEn 0
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_frameFiltEn 1
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_frameFiltStop 1
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_frameFiltStop 1
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_autoAckEn 2
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_autoAckEn 1
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_slottedAckEn 3
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_slottedAckEn 1
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_autoPendEn 4
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_autoPendEn 1
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_defaultPend 5
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_defaultPend 1
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_bPendDataReqOnly 6
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_bPendDataReqOnly 1
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_bPanCoord 7
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_bPanCoord 1
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_maxFrameVersion 8
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_maxFrameVersion 2
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_fcfReservedMask 10
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_fcfReservedMask 3
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_modifyFtFilter 13
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_modifyFtFilter 2
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_bStrictLenFilter 15
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameFiltOpt_bStrictLenFilter 1
#define _POSITION_CMD_IEEE_MOD_FILT_newFrameTypes 4
#define _TYPE_CMD_IEEE_MOD_FILT_newFrameTypes uint8_t
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameTypes_bAcceptFt0Beacon 0
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameTypes_bAcceptFt0Beacon 1
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameTypes_bAcceptFt1Data 1
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameTypes_bAcceptFt1Data 1
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameTypes_bAcceptFt2Ack 2
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameTypes_bAcceptFt2Ack 1
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameTypes_bAcceptFt3MacCmd 3
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameTypes_bAcceptFt3MacCmd 1
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameTypes_bAcceptFt4Reserved 4
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameTypes_bAcceptFt4Reserved 1
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameTypes_bAcceptFt5Reserved 5
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameTypes_bAcceptFt5Reserved 1
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameTypes_bAcceptFt6Reserved 6
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameTypes_bAcceptFt6Reserved 1
#define _BITPOS_CMD_IEEE_MOD_FILT_newFrameTypes_bAcceptFt7Reserved 7
#define _NBITS_CMD_IEEE_MOD_FILT_newFrameTypes_bAcceptFt7Reserved 1
#define _SIZEOF_CMD_IEEE_MOD_FILT 5
#define _POSITION_CMD_IEEE_MOD_SRC_MATCH_options 2
#define _TYPE_CMD_IEEE_MOD_SRC_MATCH_options uint8_t
#define _BITPOS_CMD_IEEE_MOD_SRC_MATCH_options_bEnable 0
#define _NBITS_CMD_IEEE_MOD_SRC_MATCH_options_bEnable 1
#define _BITPOS_CMD_IEEE_MOD_SRC_MATCH_options_srcPend 1
#define _NBITS_CMD_IEEE_MOD_SRC_MATCH_options_srcPend 1
#define _BITPOS_CMD_IEEE_MOD_SRC_MATCH_options_entryType 2
#define _NBITS_CMD_IEEE_MOD_SRC_MATCH_options_entryType 1
#define _POSITION_CMD_IEEE_MOD_SRC_MATCH_entryNo 3
#define _TYPE_CMD_IEEE_MOD_SRC_MATCH_entryNo uint8_t
#define _SIZEOF_CMD_IEEE_MOD_SRC_MATCH 4
#define _SIZEOF_CMD_IEEE_ABORT_FG 2
#define _SIZEOF_CMD_IEEE_STOP_FG 2
#define _POSITION_CMD_IEEE_CCA_REQ_currentRssi 2
#define _TYPE_CMD_IEEE_CCA_REQ_currentRssi int8_t
#define _POSITION_CMD_IEEE_CCA_REQ_maxRssi 3
#define _TYPE_CMD_IEEE_CCA_REQ_maxRssi int8_t
#define _POSITION_CMD_IEEE_CCA_REQ_ccaInfo 4
#define _TYPE_CMD_IEEE_CCA_REQ_ccaInfo uint8_t
#define _BITPOS_CMD_IEEE_CCA_REQ_ccaInfo_ccaState 0
#define _NBITS_CMD_IEEE_CCA_REQ_ccaInfo_ccaState 2
#define _BITPOS_CMD_IEEE_CCA_REQ_ccaInfo_ccaEnergy 2
#define _NBITS_CMD_IEEE_CCA_REQ_ccaInfo_ccaEnergy 2
#define _BITPOS_CMD_IEEE_CCA_REQ_ccaInfo_ccaCorr 4
#define _NBITS_CMD_IEEE_CCA_REQ_ccaInfo_ccaCorr 2
#define _BITPOS_CMD_IEEE_CCA_REQ_ccaInfo_ccaSync 6
#define _NBITS_CMD_IEEE_CCA_REQ_ccaInfo_ccaSync 1
#define _SIZEOF_CMD_IEEE_CCA_REQ 5
#define _POSITION_ieeeRxOutput_nTxAck 0
#define _TYPE_ieeeRxOutput_nTxAck uint8_t
#define _POSITION_ieeeRxOutput_nRxBeacon 1
#define _TYPE_ieeeRxOutput_nRxBeacon uint8_t
#define _POSITION_ieeeRxOutput_nRxData 2
#define _TYPE_ieeeRxOutput_nRxData uint8_t
#define _POSITION_ieeeRxOutput_nRxAck 3
#define _TYPE_ieeeRxOutput_nRxAck uint8_t
#define _POSITION_ieeeRxOutput_nRxMacCmd 4
#define _TYPE_ieeeRxOutput_nRxMacCmd uint8_t
#define _POSITION_ieeeRxOutput_nRxReserved 5
#define _TYPE_ieeeRxOutput_nRxReserved uint8_t
#define _POSITION_ieeeRxOutput_nRxNok 6
#define _TYPE_ieeeRxOutput_nRxNok uint8_t
#define _POSITION_ieeeRxOutput_nRxIgnored 7
#define _TYPE_ieeeRxOutput_nRxIgnored uint8_t
#define _POSITION_ieeeRxOutput_nRxBufFull 8
#define _TYPE_ieeeRxOutput_nRxBufFull uint8_t
#define _POSITION_ieeeRxOutput_lastRssi 9
#define _TYPE_ieeeRxOutput_lastRssi int8_t
#define _POSITION_ieeeRxOutput_maxRssi 10
#define _TYPE_ieeeRxOutput_maxRssi int8_t
#define _POSITION_ieeeRxOutput_beaconTimeStamp 12
#define _TYPE_ieeeRxOutput_beaconTimeStamp ratmr_t
#define _SIZEOF_ieeeRxOutput 16
#define _POSITION_shortAddrEntry_shortAddr 0
#define _TYPE_shortAddrEntry_shortAddr uint16_t
#define _POSITION_shortAddrEntry_panId 2
#define _TYPE_shortAddrEntry_panId uint16_t
#define _SIZEOF_shortAddrEntry 4
#define _POSITION_ieeeRxCorrCrc_status 0
#define _TYPE_ieeeRxCorrCrc_status uint8_t
#define _BITPOS_ieeeRxCorrCrc_status_corr 0
#define _NBITS_ieeeRxCorrCrc_status_corr 6
#define _BITPOS_ieeeRxCorrCrc_status_bIgnore 6
#define _NBITS_ieeeRxCorrCrc_status_bIgnore 1
#define _BITPOS_ieeeRxCorrCrc_status_bCrcErr 7
#define _NBITS_ieeeRxCorrCrc_status_bCrcErr 1
#define _SIZEOF_ieeeRxCorrCrc 1
#endif

@ -1 +0,0 @@
Subproject commit 420ae3682c11619c1340697632b2dc49f7e53037

View file

@ -39,6 +39,10 @@ MSP430 = msp430.c flash.c clock.c leds.c leds-arch.c \
UIPDRIVERS = me.c me_tabs.c slip.c crc16.c
ELFLOADER = elfloader.c elfloader-msp430.c symtab.c
ifeq ($(TARGET_MEMORY_MODEL),large)
ELFLOADER = elfloader-msp430x.c symtab.c
endif
CONTIKI_TARGET_SOURCEFILES += $(MSP430) \
$(SYSAPPS) $(ELFLOADER) \
$(UIPDRIVERS)
@ -151,10 +155,16 @@ endif
ifndef IAR
ifneq (,$(findstring 4.7.,$(shell msp430-gcc -dumpversion)))
ifdef CPU_HAS_MSP430X
TARGET_MEMORY_MODEL ?= medium
ifeq ($(TARGET_MEMORY_MODEL),large)
CFLAGS += -mmemory-model=$(TARGET_MEMORY_MODEL)
CFLAGS += -mcode-region=far -mdata-region=far -msr20 -mc20 -md20
LDFLAGS += -mmemory-model=$(TARGET_MEMORY_MODEL) -mcode-region=far -mdata-region=far -msr20 -mc20 -md20
else
TARGET_MEMORY_MODEL = medium
CFLAGS += -mmemory-model=$(TARGET_MEMORY_MODEL)
CFLAGS += -ffunction-sections -fdata-sections -mcode-region=any
LDFLAGS += -mmemory-model=$(TARGET_MEMORY_MODEL) -Wl,-gc-sections
endif
endif
endif
endif

View file

@ -83,7 +83,7 @@ pollhandler(void)
}
#endif
} else {
uip_len = 0;
uip_clear_buf();
}
}
}

View file

@ -103,7 +103,7 @@ pollhandler(void)
}
#endif /* !NETSTACK_CONF_WITH_IPV6 */
} else {
uip_len = 0;
uip_clear_buf();
}
}
#endif
@ -146,7 +146,7 @@ pollhandler(void)
#endif /* !NETSTACK_CONF_WITH_IPV6 */
} else {
bail:
uip_len = 0;
uip_clear_buf();
}
}
#endif

View file

@ -0,0 +1,166 @@
/*
* Copyright (c) 2015, Weptech elektronik GmbH Germany
* http://www.weptech.de
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*/
#include "cc1200-rf-cfg.h"
#include "cc1200-const.h"
/*
* This is a setup for the following configuration:
*
* 802.15.4g
* =========
* Table 68f: Frequency band identifier 4 (863-870 MHz)
* Table 68g: Modulation scheme identifier 0 (Filtered FSK)
* Table 68h: Mode #1 (50kbps)
*/
/* Base frequency in kHz */
#define RF_CFG_CHAN_CENTER_F0 863125
/* Channel spacing in kHz */
#define RF_CFG_CHAN_SPACING 200
/* The minimum channel */
#define RF_CFG_MIN_CHANNEL 0
/* The maximum channel */
#define RF_CFG_MAX_CHANNEL 33
/* The maximum output power in dBm */
#define RF_CFG_MAX_TXPOWER CC1200_CONST_TX_POWER_MAX
/* The carrier sense level used for CCA in dBm */
#define RF_CFG_CCA_THRESHOLD (-91)
/*---------------------------------------------------------------------------*/
static const char rf_cfg_descriptor[] = "802.15.4g 863-870MHz MR-FSK mode #1";
/*---------------------------------------------------------------------------*/
/*
* Register settings exported from SmartRF Studio using the standard template
* "trxEB RF Settings Performance Line".
*/
// Modulation format = 2-GFSK
// Whitening = false
// Packet length = 255
// Packet length mode = Variable
// Packet bit length = 0
// Symbol rate = 50
// Deviation = 24.948120
// Carrier frequency = 867.999878
// Device address = 0
// Manchester enable = false
// Address config = No address check
// Bit rate = 50
// RX filter BW = 104.166667
static const registerSetting_t preferredSettings[]=
{
{CC1200_IOCFG2, 0x06},
{CC1200_SYNC3, 0x6E},
{CC1200_SYNC2, 0x4E},
{CC1200_SYNC1, 0x90},
{CC1200_SYNC0, 0x4E},
{CC1200_SYNC_CFG1, 0xE5},
{CC1200_SYNC_CFG0, 0x23},
{CC1200_DEVIATION_M, 0x47},
{CC1200_MODCFG_DEV_E, 0x0B},
{CC1200_DCFILT_CFG, 0x56},
/*
* 18.1.1.1 Preamble field
* The Preamble field shall contain phyFSKPreambleLength (as defined in 9.3)
* multiples of the 8-bit sequence 01010101 for filtered 2FSK.
* The Preamble field shall contain phyFSKPreambleLength multiples of the
* 16-bit sequence 0111 0111 0111 0111 for filtered 4FSK.
*
* We need to define this in order to be able to compute e.g. timeouts for the
* MAC layer. According to 9.3, phyFSKPreambleLength can be configured between
* 4 and 1000. We set it to 4. Attention: Once we use a long wake-up preamble,
* the timing parameters have to change accordingly. Will we use a shorter
* preamble for an ACK in this case???
*/
{CC1200_PREAMBLE_CFG1, 0x19},
{CC1200_PREAMBLE_CFG0, 0xBA},
{CC1200_IQIC, 0xC8},
{CC1200_CHAN_BW, 0x84},
{CC1200_MDMCFG1, 0x42},
{CC1200_MDMCFG0, 0x05},
{CC1200_SYMBOL_RATE2, 0x94},
{CC1200_SYMBOL_RATE1, 0x7A},
{CC1200_SYMBOL_RATE0, 0xE1},
{CC1200_AGC_REF, 0x27},
{CC1200_AGC_CS_THR, 0xF1},
{CC1200_AGC_CFG1, 0x11},
{CC1200_AGC_CFG0, 0x90},
{CC1200_FIFO_CFG, 0x00},
{CC1200_FS_CFG, 0x12},
{CC1200_PKT_CFG2, 0x24},
{CC1200_PKT_CFG0, 0x20},
{CC1200_PKT_LEN, 0xFF},
{CC1200_IF_MIX_CFG, 0x18},
{CC1200_TOC_CFG, 0x03},
{CC1200_MDMCFG2, 0x02},
{CC1200_FREQ2, 0x56},
{CC1200_FREQ1, 0xCC},
{CC1200_FREQ0, 0xCC},
{CC1200_IF_ADC1, 0xEE},
{CC1200_IF_ADC0, 0x10},
{CC1200_FS_DIG1, 0x04},
{CC1200_FS_DIG0, 0x50},
{CC1200_FS_CAL1, 0x40},
{CC1200_FS_CAL0, 0x0E},
{CC1200_FS_DIVTWO, 0x03},
{CC1200_FS_DSM0, 0x33},
{CC1200_FS_DVC1, 0xF7},
{CC1200_FS_DVC0, 0x0F},
{CC1200_FS_PFD, 0x00},
{CC1200_FS_PRE, 0x6E},
{CC1200_FS_REG_DIV_CML, 0x1C},
{CC1200_FS_SPARE, 0xAC},
{CC1200_FS_VCO0, 0xB5},
{CC1200_IFAMP, 0x05},
{CC1200_XOSC5, 0x0E},
{CC1200_XOSC1, 0x03},
};
/*---------------------------------------------------------------------------*/
/* Global linkage: symbol name must be different in each exported file! */
const cc1200_rf_cfg_t cc1200_802154g_863_870_fsk_50kbps = {
.cfg_descriptor = rf_cfg_descriptor,
.register_settings = preferredSettings,
.size_of_register_settings = sizeof(preferredSettings),
.tx_pkt_lifetime = (RTIMER_SECOND / 20),
.chan_center_freq0 = RF_CFG_CHAN_CENTER_F0,
.chan_spacing = RF_CFG_CHAN_SPACING,
.min_channel = RF_CFG_MIN_CHANNEL,
.max_channel = RF_CFG_MAX_CHANNEL,
.max_txpower = RF_CFG_MAX_TXPOWER,
.cca_threshold = RF_CFG_CCA_THRESHOLD,
};
/*---------------------------------------------------------------------------*/

157
dev/cc1200/cc1200-arch.h Normal file
View file

@ -0,0 +1,157 @@
/*
* Copyright (c) 2015, Weptech elektronik GmbH Germany
* http://www.weptech.de
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*/
#ifndef CC1200_ARCH_H
#define CC1200_ARCH_H
#include <stdint.h>
/*---------------------------------------------------------------------------*/
/*
* Initialize SPI module & Pins.
*
* The function has to accomplish the following tasks:
* - Enable SPI and configure SPI (CPOL = 0, CPHA = 0)
* - Configure MISO, MOSI, SCLK accordingly
* - Configure GPIOx (input)
* - Configure RESET_N (output high)
* - Configure CSn (output high)
*/
void
cc1200_arch_init(void);
/*---------------------------------------------------------------------------*/
/* Select CC1200 (pull down CSn pin). */
void
cc1200_arch_spi_select(void);
/*---------------------------------------------------------------------------*/
/* De-select CC1200 (release CSn pin). */
void
cc1200_arch_spi_deselect(void);
/*---------------------------------------------------------------------------*/
/*
* Configure port IRQ for GPIO0.
* If rising == 1: configure IRQ for rising edge, else falling edge
* Interrupt has to call cc1200_rx_interrupt()!
*/
void
cc1200_arch_gpio0_setup_irq(int rising);
/*---------------------------------------------------------------------------*/
/*
* Configure port IRQ for GPIO2.
*
* GPIO2 might not be needed at all depending on the driver's
* configuration (see cc1200-conf.h)
*
* If rising == 1: configure IRQ for rising edge, else falling edge
* Interrupt has to call cc1200_rx_interrupt()!
*/
void
cc1200_arch_gpio2_setup_irq(int rising);
/*---------------------------------------------------------------------------*/
/* Reset interrupt flag and enable GPIO0 port IRQ. */
void
cc1200_arch_gpio0_enable_irq(void);
/*---------------------------------------------------------------------------*/
/* Disable GPIO0 port IRQ. */
void
cc1200_arch_gpio0_disable_irq(void);
/*---------------------------------------------------------------------------*/
/*
* Reset interrupt flag and enable GPIO2 port IRQ
*
* GPIO2 might not be needed at all depending on the driver's
* configuration (see cc1200-conf.h)
*/
void
cc1200_arch_gpio2_enable_irq(void);
/*---------------------------------------------------------------------------*/
/*
* Disable GPIO2 port IRQ.
*
* GPIO2 might not be needed at all depending on the driver's
* configuration (see cc1200-conf.h)
*/
void
cc1200_arch_gpio2_disable_irq(void);
/*---------------------------------------------------------------------------*/
/*
* Read back the status of the GPIO0 pin.
* Returns 0 if the pin is low, otherwise 1
*/
int
cc1200_arch_gpio0_read_pin(void);
/*---------------------------------------------------------------------------*/
/*
* Read back the status of the GPIO2 pin.
*
* GPIO2 might not be needed at all depending on the driver's
* configuration (see cc1200-conf.h)
*
* Returns 0 if the pin is low, otherwise 1
*/
int
cc1200_arch_gpio2_read_pin(void);
/*---------------------------------------------------------------------------*/
/*
* Read back the status of the GPIO3 pin.
*
* Currently only used for rf test modes.
*
* Returns 0 if the pin is low, otherwise 1
*/
int
cc1200_arch_gpio3_read_pin(void);
/*---------------------------------------------------------------------------*/
/* Write a single byte via SPI, return response. */
int
cc1200_arch_spi_rw_byte(uint8_t c);
/*---------------------------------------------------------------------------*/
/*
* Write a sequence of bytes while reading back the response.
* Either read_buf or write_buf can be NULL.
*/
int
cc1200_arch_spi_rw(uint8_t *read_buf,
const uint8_t *write_buf,
uint16_t len);
/*---------------------------------------------------------------------------*/
/*
* The CC1200 interrupt handler exported from the cc1200 driver.
*
* To be called by the hardware interrupt handler(s),
* which are defined as part of the cc1200-arch interface.
*/
int
cc1200_rx_interrupt(void);
#endif /* CC1200_ARCH_H */

Some files were not shown because too many files have changed in this diff Show more