Commit 139aab17 authored by Reto Da Forno's avatar Reto Da Forno
Browse files

minor adjustments, new event and command added

parent a7ba9f36
......@@ -230,14 +230,15 @@ typedef struct {
#define DPP_FW_HDR_LEN 4
#define DPP_FW_BLOCK_SIZE 64
#define DPP_FW_BLOCK_SIZE 96 /* must be a multiple of 8 */
typedef struct {
dpp_fw_type_t type : 8;
uint8_t component_id;
uint16_t version;
union {
struct {
uint16_t len; /* total length in bytes */
uint32_t len; /* total length in bytes */
uint32_t crc; /* 32bit CRC over complete FW data ('len' bytes) */
} info;
struct {
......
......@@ -59,16 +59,16 @@ CMD_SX1262_CONF_EVENT_ADD, /* 0x07 | Add new event configuration */
CMD_SX1262_CONF_EVENT_DEL, /* 0x08 | Delete event configuration */ /* @param: TBD */
CMD_SX1262_SET_CODETECTION_THRESHOLD, /* 0x09 | Set the codetection threshold for reporting */ /* @param: number of nodes that need to detect the same events */
CMD_SX1262_SET_CAD_MODE, /* 0x0A | Set channel activity detection mode */ /* @param: mode (0 = disable) */
CMD_SX1262_SET_HEALTH_MSG_PRIORITY, /* 0x0B | Set the priority for health message generation */ /* @param: 0 = low priority, 1 = high priority */
CMD_SX1262_RESERVED_0B,
CMD_SX1262_RESERVED_0C,
CMD_SX1262_RESERVED_0D,
CMD_SX1262_RESERVED_0E,
CMD_SX1262_RESERVED_0F,
CMD_SX1262_RESERVED_10,
CMD_SX1262_RESERVED_11,
CMD_SX1262_RESERVED_12,
CMD_SX1262_FW_OTA_MODE, /* 0x12 | enter FW update mode */ /* @param: 16-bit key */
CMD_SX1262_RESET, /* 0x13 | perform a software reset */
/* Baseboard commands */
......
......@@ -55,3 +55,4 @@ EVENT_SX1262_RTC_ERROR, /* 0x0f | error related to the RTC
EVENT_SX1262_TIMEOUT, /* 0x10 | generic timeout error | error code */
EVENT_SX1262_RESET, /* 0x11 | device reset occurred | reset cause (16-bit) + counter (16-bit) */
EVENT_SX1262_TX_FAILED, /* 0x12 | transmission failed (e.g. due to channel busy or no ACK received) | error code */
EVENT_SX1262_FW_OTA_STATUS, /* 0x13 | firmware update status | status code */
/*
* Copyright (c) 2018, Swiss Federal Institute of Technology (ETH Zurich).
* 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.
*
* Author: Reto Da Forno
*/
#include <stdint.h>
/*---------------------------------------------------------------------------*/
uint32_t crc32(const uint8_t* data, uint16_t num_bytes, uint32_t seed)
{
uint32_t crc = ~seed;
while (num_bytes) {
crc ^= (*data);
uint16_t i = 8;
while (i) {
uint32_t mask = -(crc & 1);
crc = (crc >> 1) ^ (0xedb88320 & mask);
i--;
}
data++;
num_bytes--;
}
return ~crc;
}
/*---------------------------------------------------------------------------*/
......@@ -73,6 +73,7 @@ typedef struct list_meta {
/* --- function prototypes --- */
uint16_t crc16(const uint8_t* data, uint8_t num_bytes, uint16_t init_value);
uint32_t crc32(const uint8_t* data, uint16_t num_bytes, uint32_t seed);
uint32_t hexstr_to_uint32(const char* str);
uint32_t uint16_to_str(uint16_t val, char* out_buffer);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment