Enum tockloader_proto::Command [] [src]

pub enum Command<'a> {
    Ping,
    Info,
    Id,
    Reset,
    ErasePage {
        address: u32,
    },
    WritePage {
        address: u32,
        data: &'a [u8],
    },
    EraseExBlock {
        address: u32,
    },
    WriteExPage {
        address: u32,
        data: &'a [u8],
    },
    CrcRxBuffer,
    ReadRange {
        address: u32,
        length: u16,
    },
    ExReadRange {
        address: u32,
        length: u16,
    },
    SetAttr {
        index: u8,
        key: &'a [u8],
        value: &'a [u8],
    },
    GetAttr {
        index: u8,
    },
    CrcIntFlash {
        address: u32,
        length: u32,
    },
    CrcExtFlash {
        address: u32,
        length: u32,
    },
    EraseExPage {
        address: u32,
    },
    ExtFlashInit,
    ClockOut,
    WriteFlashUserPages {
        page1: u32,
        page2: u32,
    },
    ChangeBaud {
        mode: BaudMode,
        baud: u32,
    },
}

Commands supported by the protocol. A bootloader will decode these and a flash tool will encode them.

Variants

Send a PING to the bootloader. It will drop its hp buffer and send back a PONG.

Get info about the bootloader. The result is one byte of length, plus length bytes of string, followed by 192-length zeroes.

Get the Unique ID. Result is 8 bytes of unique ID (but I'm not sure what the result code should be).

Reset all TX and RX buffers.

Erase a page. The RX buffer should contain the address of the start of the 512 byte page. Any non-page-aligned addresses will result in RES_BADADDR. This command is not required before writing a page, it is just an optimisation. It is particularly quick for already empty pages.

Fields of ErasePage

Write a page in internal flash. The RX buffer should contain the 4 byte address of the start of the page, followed by 512 bytes of page.

Fields of WritePage

Erase a block of pages in ex flash. The RX buffer should contain the address of the start of the block. Each block is 8 pages, so 2048 bytes.

Fields of EraseExBlock

Write a page to ex flash. The RX buffer should contain the address of the start of the 256 byte page, followed by 256 bytes of page.

Fields of WriteExPage

Get the length and CRC of the RX buffer. The response is two bytes of little endian length, followed by 4 bytes of crc32.

Read a range from internal flash. The RX buffer should contain a 4 byte address followed by 2 bytes of length. The response will be length bytes long.

Fields of ReadRange

Read a range from external flash. The RX buffer should contain a 4 byte address followed by 2 bytes of length. The response will be length bytes long.

Fields of ExReadRange

Write a payload attribute. The RX buffer should contain a one byte index, 8 bytes of key (null padded), one byte of value length, and valuelength value bytes. valuelength must be less than or equal to 55. The value may contain nulls.

The attribute index must be less than 16.

Fields of SetAttr

Get a payload attribute. The RX buffer should contain a 1 byte index. The result is 8 bytes of key, 1 byte of value length, and 55 bytes of potential value. You must discard 55-valuelength bytes from the end yourself.

Fields of GetAttr

Get the CRC of a range of internal flash. The RX buffer should contain a four byte address and a four byte range. The result will be a four byte crc32.

Fields of CrcIntFlash

Get the CRC of a range of external flash. The RX buffer should contain a four byte address and a four byte range. The result will be a four byte crc32.

Fields of CrcExtFlash

Erase a page in external flash. The RX buffer should contain a 4 byte address pointing to the start of the 256 byte page.

Fields of EraseExPage

Initialise the external flash chip. This sets the page size to 256b.

Go into an infinite loop with the 32khz clock present on pin PA19 (GP6) this is used for clock calibration.

Write the flash user pages (first 4 bytes is first page, second 4 bytes is second page, little endian).

Fields of WriteFlashUserPages

Change the baud rate of the bootloader. The first byte is 0x01 to set a new baud rate. The next 4 bytes are the new baud rate. To allow the bootloader to verify that the new baud rate works, the host must call this command again with the first byte of 0x02 and the next 4 bytes of the new baud rate. If the next command does not match this, the bootloader will revert to the old baud rate.

Fields of ChangeBaud

Trait Implementations

impl<'a> Debug for Command<'a>
[src]

[src]

Formats the value using the given formatter.

impl<'a> PartialEq for Command<'a>
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.