Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
Loading...
Searching...
No Matches
cascoda_chili.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019, Cascoda Ltd.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * 3. Neither the name of the copyright holder nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28/*
29 * Cascoda Interface to Vendor BSP/Library Support Package.
30 * MCU: Nuvoton Nano120
31 * MODULE: Chili 1 (1.2, 1.3)
32 * Internal (Non-Interface)
33*/
37
38#ifndef CASCODA_CHILI_H
39#define CASCODA_CHILI_H
40
41/******************************************************************************/
42/****** Global Variables defined in cascoda_bsp_*.c ******/
43/******************************************************************************/
44extern volatile u8_t WDTimeout; /* Nonzero watchdog timeout if used */
45extern volatile u8_t USBPresent; /* 0: USB not active, 1: USB is active */
46extern volatile u8_t UseExternalClock; /* 0: Use internal clock, 1: Use clock from CA-821x */
47
48/* maximum count delay when switching clocks */
49#define MAX_CLOCK_SWITCH_DELAY 100000
50/* SPI Master Clock Rate [Hz] */
51#define FCLK_SPI 2000000
52/* Use Timer0 as watchdog for POWEROFF mode */
53#define USE_WATCHDOG_POWEROFF 0
54
56{
57 uint32_t volatile *chip_select_gpio;
58 uint32_t volatile *irq_gpio;
59 uint32_t volatile *reset_gpio;
60 struct ca821x_dev *dev;
61};
62
63#define NUM_DEVICES (1)
65
66/* Non-Interface Functions */
67#if defined(USE_UART)
68
69/******************************************************************************/
70/***************************************************************************/
74void CHILI_UARTInit(void);
75
76/******************************************************************************/
77/***************************************************************************/
81void CHILI_UARTDeinit(void);
82#endif /* USE_UART */
83
84/******************************************************************************/
85/***************************************************************************/
90
91/******************************************************************************/
92/***************************************************************************/
96void CHILI_GPIOInit(void);
97
98/******************************************************************************/
99/***************************************************************************/
104
105/******************************************************************************/
106/***************************************************************************/
111
112/******************************************************************************/
113/***************************************************************************/
117void CHILI_CompleteClockInit(void);
118
119/******************************************************************************/
120/***************************************************************************/
124void CHILI_EnableIntOscCal(void);
125
126/******************************************************************************/
127/***************************************************************************/
131void CHILI_DisableIntOscCal(void);
132
133/******************************************************************************/
134/***************************************************************************/
139void CHILI_GPIOPowerDown(u8_t useGPIOforWakeup);
140
141/******************************************************************************/
142/***************************************************************************/
146void CHILI_GPIOPowerUp(void);
147
148/******************************************************************************/
149/***************************************************************************/
153void CHILI_TimersInit(void);
154
155/******************************************************************************/
156/***************************************************************************/
160void CHILI_SystemReInit(void);
161void CHILI_FlashInit(void);
162void CHILI_1msTick(void);
163
164/******************************************************************************/
165/***************************************************************************/
171void CHILI_FastForward(u32_t ticks);
172
173#endif /* CASCODA_CHILI_H */
Declaration of platform abstraction functions.
Type definitions used by Cascoda baremetal drivers.
unsigned long u32_t
Definition cascoda_types.h:50
unsigned char u8_t
Definition cascoda_types.h:46
ca_error
Cascoda error type.
Definition ca821x_error.h:51
volatile u8_t WDTimeout
Definition cascoda_bsp_chili.c:67
void CHILI_FastForward(u32_t ticks)
FastForward time by the given amount.
Definition cascoda_time.c:30
void CHILI_FlashInit(void)
Definition cascoda_dataflash_nano120.c:108
void CHILI_1msTick(void)
1 ms Tick for TMR0_IRQHandler ISR
Definition cascoda_time.c:25
volatile u8_t USBPresent
Definition cascoda_bsp_chili.c:68
void CHILI_CompleteClockInit(void)
Completes Clock (Re-)Initialisation.
Definition cascoda_chili.c:393
void CHILI_GPIOInit(void)
Initialise Essential GPIOs for various Functions.
Definition cascoda_chili.c:132
void CHILI_DisableIntOscCal(void)
Disable Internal Oscillator Calibration.
Definition cascoda_chili.c:428
void CHILI_GPIOEnableInterrupts(void)
Enable GPIO Interrupts.
Definition cascoda_chili.c:258
ca_error CHILI_ClockInit(void)
Select System Clocks depending on Power Source.
Definition cascoda_chili.c:267
void CHILI_TimersInit(void)
(Re-)Initialise System Timers
Definition cascoda_chili.c:435
#define NUM_DEVICES
Definition cascoda_chili.h:63
void CHILI_EnableIntOscCal(void)
Enable Internal Oscillator Calibration.
Definition cascoda_chili.c:414
struct device_link device_list[NUM_DEVICES]
Definition cascoda_bsp_chili.c:73
volatile u8_t UseExternalClock
Definition cascoda_bsp_chili.c:69
void CHILI_GPIOPowerUp(void)
Re-program GPIOs for active Mode after PowerDown.
Definition cascoda_chili.c:231
u32_t CHILI_ADCConversion(u32_t channel, u32_t reference)
Perform ADC Conversion.
Definition cascoda_chili.c:85
void CHILI_GPIOPowerDown(u8_t useGPIOforWakeup)
Re-program GPIOs for PowerDown.
Definition cascoda_chili.c:198
void CHILI_SystemReInit(void)
System Re-Initialisation.
Definition cascoda_chili.c:475
uint8_t channel
Channel we are sniffing on.
Definition sniffer.c:200
CA-821x Device reference struct.
Definition ca821x_api.h:123