libnile
|
#include <wonderful.h>
#include "hardware.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
Enumerations | |
enum | nile_mcu_native_mode_t { NILE_MCU_NATIVE_MODE_CMD = 0x00 , NILE_MCU_NATIVE_MODE_EEPROM = 0x01 , NILE_MCU_NATIVE_MODE_RTC = 0x02 , NILE_MCU_NATIVE_MODE_CDC = 0x03 , NILE_MCU_NATIVE_MODE_STANDBY = 0xFF } |
Functions | |
bool | nile_mcu_reset (bool to_bootloader) |
Reset the MCU. | |
bool | nile_mcu_boot_wait_ack (void) |
bool | nile_mcu_boot_send_cmd (uint8_t cmd) |
bool | nile_mcu_boot_send_data (const void __far *buffer, uint16_t len, uint8_t flags) |
uint16_t | nile_mcu_boot_recv_data (void __far *buffer, uint16_t buflen, uint8_t flags) |
uint8_t | nile_mcu_boot_get_version (void) |
Get the version of the SPI protocol used. More information is available in the Application Note AN4286. | |
uint16_t | nile_mcu_boot_get_id (void) |
Get the chip ID. More information is available in the Application Note AN4286. | |
bool | nile_mcu_boot_read_memory (uint32_t address, void __far *buffer, uint16_t buflen) |
Request bytes from the MCU's address space. | |
bool | nile_mcu_boot_jump (uint32_t address) |
Request that the MCU branch to a specific address in memory. | |
bool | nile_mcu_boot_write_memory (uint32_t address, const void __far *buffer, uint16_t buflen) |
Write bytes to the MCU's address space (RAM or flash memory). | |
bool | nile_mcu_boot_erase_memory (uint16_t sector_address, uint16_t sector_count) |
Erase pages of the MCU's flash memory. | |
static bool | nile_mcu_boot_erase_all_memory (void) |
Erase all of the MCU's flash memory. | |
static int16_t | nile_mcu_native_send_cmd (uint16_t cmd, const void __far *buffer, int buflen) |
Send a "native protocol" MCU command asynchronously. | |
int16_t | nile_mcu_native_recv_cmd (void __far *buffer, uint16_t buflen) |
Receive the response of a "native protocol" MCU command synchronously. | |
int16_t | nile_mcu_native_recv_cmd_start (uint16_t resplen) |
Start receiving the response of a "native protocol" MCU command asynchronously. | |
int16_t | nile_mcu_native_recv_cmd_finish (void __far *buffer, uint16_t buflen) |
Finish receiving the response of a "native protocol" MCU command. | |
static int16_t | nile_mcu_native_recv_cmd_response_uint8 (void) |
static int16_t | nile_mcu_native_recv_cmd_response_int16 (void) |
static int16_t | nile_mcu_native_mcu_switch_mode (uint8_t mode) |
Switch the mode in which the MCU is operating. | |
static int16_t | nile_mcu_native_mcu_spi_set_speed_sync (uint8_t speed) |
Tell the MCU to operate at a specific SPI speed. | |
static int16_t | nile_mcu_native_mcu_get_uuid_sync (void __far *buffer, uint16_t buflen) |
static int16_t | nile_mcu_native_cdc_read_sync (void __far *buffer, uint16_t buflen) |
static int16_t | nile_mcu_native_cdc_write_sync (const void __wf_cram *buffer, uint16_t buflen) |
static int16_t | nile_mcu_native_cdc_write_async_start (const void __wf_cram *buffer, uint16_t buflen) |
static int16_t | nile_mcu_native_cdc_available_sync (void) |
static int16_t | nile_mcu_native_cdc_available_async_start (const void __wf_cram *buffer, uint16_t buflen) |
static int16_t | nile_mcu_native_cdc_clear_sync (void) |
#define nile_mcu_native_cdc_available_async_finish nile_mcu_native_recv_cmd_response_int16 |
#define nile_mcu_native_cdc_write_async_finish nile_mcu_native_recv_cmd_response_int16 |
#define NILE_MCU_NATIVE_CMD | ( | cmd, | |
arg ) |
|
inlinestatic |
bool nile_mcu_boot_erase_memory | ( | uint16_t | sector_address, |
uint16_t | sector_count ) |
Erase pages of the MCU's flash memory.
sector_address | The starting page to erase. |
sector_count | The number of pages to erase. |
uint16_t nile_mcu_boot_get_id | ( | void | ) |
Get the chip ID. More information is available in the Application Note AN4286.
uint8_t nile_mcu_boot_get_version | ( | void | ) |
Get the version of the SPI protocol used. More information is available in the Application Note AN4286.
bool nile_mcu_boot_jump | ( | uint32_t | address | ) |
Request that the MCU branch to a specific address in memory.
address | Address to branch to. |
bool nile_mcu_boot_read_memory | ( | uint32_t | address, |
void __far * | buffer, | ||
uint16_t | buflen ) |
Request bytes from the MCU's address space.
address | MCU address to read data from. |
buffer | Buffer to read data to. |
buflen | Amount of data to read, in bytes (1 - 256). |
uint16_t nile_mcu_boot_recv_data | ( | void __far * | buffer, |
uint16_t | buflen, | ||
uint8_t | flags ) |
bool nile_mcu_boot_send_cmd | ( | uint8_t | cmd | ) |
bool nile_mcu_boot_send_data | ( | const void __far * | buffer, |
uint16_t | len, | ||
uint8_t | flags ) |
bool nile_mcu_boot_wait_ack | ( | void | ) |
bool nile_mcu_boot_write_memory | ( | uint32_t | address, |
const void __far * | buffer, | ||
uint16_t | buflen ) |
Write bytes to the MCU's address space (RAM or flash memory).
address | MCU address to write data to. |
buffer | Buffer to write data from. |
buflen | Amount of data to write, in bytes (1 - 256). |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
int16_t nile_mcu_native_recv_cmd | ( | void __far * | buffer, |
uint16_t | buflen ) |
Receive the response of a "native protocol" MCU command synchronously.
If the response size exceeds the size of the buffer, the remaining bytes are consumed and skipped.
buffer | Buffer to receive response to. |
buflen | The size of the buffer. |
int16_t nile_mcu_native_recv_cmd_finish | ( | void __far * | buffer, |
uint16_t | buflen ) |
Finish receiving the response of a "native protocol" MCU command.
buffer | Buffer to copy response to. |
buflen | The size of the buffer. |
|
inlinestatic |
|
inlinestatic |
int16_t nile_mcu_native_recv_cmd_start | ( | uint16_t | resplen | ) |
Start receiving the response of a "native protocol" MCU command asynchronously.
resplen | The maximum size of the response. |
|
inlinestatic |
Send a "native protocol" MCU command asynchronously.
cmd | Command. |
buffer | Optional parameter buffer. |
buflen | Size of the parameter buffer (0 - 512 bytes). |
bool nile_mcu_reset | ( | bool | to_bootloader | ) |
Reset the MCU.
to_bootloader | If true, the MCU is restarted into bootloader mode, allowing use of the nile_mcu_boot functions. If false, the MCU is restarted into the existing firmware flashed on it. |