Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
Loading...
Searching...
No Matches
ldrom_hid.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020, 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#ifndef BAREMETAL_PLATFORM_CASCODA_NUVOTON_CHILI2_LDROM_HID_LDROM_HID_H_
30#define BAREMETAL_PLATFORM_CASCODA_NUVOTON_CHILI2_LDROM_HID_LDROM_HID_H_
31
32#include <stdint.h>
33
34#include "ca821x_error.h"
35#include "evbme_messages.h"
36
41{
42 uint8_t startAddr[4];
43 uint32_t data[61];
44};
45//Assert struct is packed even with uint32_t data
46#pragma GCC diagnostic push
47#pragma GCC diagnostic ignored "-Wunused-local-typedefs" //Suppresses warnings
49#pragma GCC diagnostic pop
50
62
67{
68 volatile uint8_t isReady;
69 uint8_t cmdid;
70 uint8_t len;
71 uint8_t dfu_cmdid;
73};
74
75//Assert SerialBuf struct is packed
76ca_static_assert(sizeof(struct SerialBuf) == sizeof(struct dfu_write_cmd_aligned) + 4);
77
78extern struct SerialBuf gRxBuffer;
79extern struct SerialBuf gTxBuffer;
80
81void HID_Init(void);
82void EP2_Handler(void);
83void EP3_Handler(void);
84
85//Functions to unblock IO:
86void RxHandled(void); //Call when a Rx message has been fully processed
87void TxReady(void); //Call when a Tx is ready to send
88
89#endif /* BAREMETAL_PLATFORM_CASCODA_NUVOTON_CHILI2_LDROM_HID_LDROM_HID_H_ */
Global error declarations for use across the Cascoda SDK.
Definitions relating to EVBME API messages.
#define ca_static_assert(x)
Static assert code.
Definition ca821x_error.h:88
void HID_Init(void)
USBD Endpoint Config.
Definition hid_transfer.c:271
struct SerialBuf gRxBuffer
Definition hid_transfer.c:61
struct SerialBuf gTxBuffer
Definition hid_transfer.c:62
void RxHandled(void)
Definition hid_transfer.c:212
void TxReady(void)
Definition hid_transfer.c:218
void EP3_Handler(void)
Definition hid_transfer.c:202
void EP2_Handler(void)
Definition hid_transfer.c:188
Cascoda serialbuffer structure.
Definition ldrom_hid.h:67
uint8_t dfu_cmdid
DFU cmdid.
Definition ldrom_hid.h:71
volatile uint8_t isReady
Is ready to: Tx-Write, Rx-Read.
Definition ldrom_hid.h:68
uint8_t len
Length of data.
Definition ldrom_hid.h:70
uint8_t cmdid
Cascoda command ID = EVBME_DFU_CMD (0xA3)
Definition ldrom_hid.h:69
union dfu_cmd_aligned dfu_cmd
dfu command
Definition ldrom_hid.h:72
Write command to write words of data - aligned for codespace and speed.
Definition ldrom_hid.h:41
uint32_t data[61]
Data to write, must be whole words.
Definition ldrom_hid.h:43
uint8_t startAddr[4]
Start address for writing - must be word aligned.
Definition ldrom_hid.h:42
Check command to validate flash against a checksum.
Definition evbme_messages.h:148
Erase command to erase whole pages.
Definition evbme_messages.h:130
Reboot command to boot into DFU or APROM.
Definition evbme_messages.h:122
Status command used as a reply from the Chili2 to host.
Definition evbme_messages.h:158
Union of all DFU commands - version with dfu_write_cmd_aligned.
Definition ldrom_hid.h:55
struct evbme_dfu_reboot_cmd reboot_cmd
Definition ldrom_hid.h:56
struct evbme_dfu_erase_cmd erase_cmd
Definition ldrom_hid.h:57
struct evbme_dfu_check_cmd check_cmd
Definition ldrom_hid.h:59
struct dfu_write_cmd_aligned write_cmd
Definition ldrom_hid.h:58
struct evbme_dfu_status_cmd status_cmd
Definition ldrom_hid.h:60