1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cc26xx_cc13xx: add ROM Hard-API

This is needed to switch the SCLK_HF source clock safely.

Note: these functions work on cc26x2_cc13x2 and cc26x0, but special care
needs to be taken when calling on cc26x0 some of these functions, as
ADDI_SEM needs to be taken.

Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
This commit is contained in:
Jean Pierre Dudey 2020-04-30 11:28:17 -05:00
parent 951a99dba3
commit 0aeed80eb0
No known key found for this signature in database
GPG Key ID: 631A70D74E41F1AD
3 changed files with 99 additions and 1 deletions

View File

@ -144,8 +144,8 @@ typedef enum IRQn
#define FLASH_BASE 0x00000000 /**< FLASH base address */
#define PERIPH_BASE 0x40000000 /**< Peripheral base address */
#define PERIPH_BASE_NONBUF 0x60000000 /**< Peripheral base address (nonbuf) */
#define ROM_HARD_API_BASE 0x10000048 /**< ROM Hard-API base address */
#define ROM_API_TABLE ((uint32_t *) 0x10000180) /**< ROM API table */
/*@}*/
/**

View File

@ -0,0 +1,97 @@
/*
* Copyright (C) 2020 Locha Inc
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup cpu_cc26xx_cc13xx_definitions
* @{
*
* @file
* @brief CC26xx/CC13xx ROM Hard-API
*
* @author Jean Pierre Dudey <jeandudey@hotmail.com>
*/
#ifndef CC26XX_CC13XX_HARD_API_H
#define CC26XX_CC13XX_HARD_API_H
#include "cc26xx_cc13xx.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief ROM Hard-API
*/
typedef struct {
/** CRC-32 */
uint32_t (* crc32)(uint8_t *data, uint32_t bytecount, uint32_t repeatcount);
uint32_t (* get_fl_size)(void); /**< Get flash size */
uint32_t (* get_chip_id)(void); /**< Get chip ID */
uint32_t (* __reserved0)(uint32_t); /**< Reserved */
uint32_t (* __reserved1)(void); /**< Reserved */
uint32_t (* __reserved2)(uint8_t *, uint32_t, uint32_t); /**< Reserved */
void (* resetdev)(void); /**< Reset device */
uint32_t (* fletcher32)(uint16_t *data, uint16_t wordcount,
uint16_t repeatcount); /**< Fletcher-32 */
/** Min. value */
uint32_t (* min_val)(uint32_t *buffer, uint32_t datacount);
/** Max. value */
uint32_t (* max_val)(uint32_t *databuffer, uint32_t datacount);
/** Mean. value */
uint32_t (* mean_val)(uint32_t *databuffer, uint32_t datacount);
/** Standard deviation value */
uint32_t (* stdd_val)(uint32_t *databuffer, uint32_t datacount);
void (* hf_source_safe_switch)(void); /**< HF source safe-switch */
void (* __reserved3)(uint32_t); /**< Reserved */
void (* __reserved4)(uint32_t); /**< Reserved */
void (* compa_in)(uint8_t signal); /**< Select CompA input */
void (* compa_ref)(uint8_t signal); /**< Select CompA reference */
void (* adc_compb_in)(uint8_t signal); /**< Select ADC CompB input */
#ifdef CPU_VARIANT_X2
void (* dac_vref)(uint8_t signal); /**< Select DAC vref */
#else
void (* compb_ref)(uint8_t signal); /**< Select CompB reference */
#endif
} hard_api_t;
/**
* @brief Hard-API function table
*/
#define HARD_API ((hard_api_t *) ROM_HARD_API_BASE)
/**
* @brief Hard-API functions
* @{
*/
#define rom_hapi_crc32(a, b, c) (HARD_API->crc32((a), (b), (c)))
#define rom_hapi_get_flashsize() (HARD_API->get_fl_size())
#define rom_hapi_get_chipid() (HARD_API->get_chip_id())
#define rom_hapi_reset_device() (HARD_API->resetdev())
#define rom_hapi_fletcher32(a, b, c) (HARD_API->fletcher32((a), (b), (c)))
#define rom_hapi_min_value(a, b) (HARD_API->min_val((a), (b)))
#define rom_hapi_max_value(a, b) (HARD_API->max_val((a), (b)))
#define rom_hapi_mean_value(a, b) (HARD_API->mean_val((a), (b)))
#define rom_hapi_std_deviation_value(a, b) (HARD_API->stdd_val((a), (b)))
#define rom_hapi_hf_source_safe_switch() (HARD_API->hf_source_safe_switch())
#define rom_hapi_select_compa_input(a) (HARD_API->compa_in((a)))
#define rom_hapi_select_compa_ref(a) (HARD_API->compa_ref((a)))
#define rom_hapi_select_adc_compb_input(a) (HARD_API->adc_compb_in((a)))
#ifdef CPU_VARIANT_X2
#define rom_hapi_select_dac_vref(a) (HARD_API->dac_vref((a)))
#else
#define rom_hapi_select_compb_ref(a) (HARD_API->compb_vref((a)))
#endif
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* CC26XX_CC13XX_HARD_API_H */
/** @} */

View File

@ -28,6 +28,7 @@
#include "cc26xx_cc13xx_ccfg.h"
#include "cc26xx_cc13xx_gpio.h"
#include "cc26xx_cc13xx_gpt.h"
#include "cc26xx_cc13xx_hard_api.h"
#include "cc26xx_cc13xx_i2c.h"
#include "cc26xx_cc13xx_ioc.h"
#include "cc26xx_cc13xx_rfc.h"