Peripheral Interface
Bootloader

API for peripheral interfaces. More...

Collaboration diagram for Peripheral Interface:

## Data Structures

struct | peripheral_control_interface_t
| Peripheral control interface. More...
struct | peripheral_byte_inteface_t
| Peripheral abstract byte interface. More...
struct | peripheral_packet_interface_t
| Peripheral Packet Interface. More...
struct | peripheral_descriptor_t
| Peripheral descriptor. More...

## Typedefs

typedef void(* | serial_byte_receive_func_t) (uint8_t)

## Enumerations

enum | _peripheral_types { kPeripheralType_UART = (1 << 0), kPeripheralType_I2CSlave = (1 << 1), kPeripheralType_SPISlave = (1 << 2), kPeripheralType_CAN = (1 << 3), kPeripheralType_USB_HID = (1 << 4), kPeripheralType_USB_CDC = (1 << 5), kPeripheralType_USB_DFU = (1 << 6), kPeripheralType_USB_MSC = (1 << 7) }
| Peripheral type bit mask definitions. More...
enum | pinmux_type_t { kPinmuxType_Default = 0, kPinmuxType_GPIO = 1, kPinmuxType_Peripheral = 2 }
| Pinmux types.
enum | packet_type_t { kPacketType_Command, kPacketType_Data }
| Packet types. More...

## Variables

const peripheral_descriptor_t | g_peripherals []
| Array of all peripherals available in this device.

## Usage Information

API for peripheral interfaces.

## Data Structure Documentation

struct peripheral_control_interface_t

Peripheral control interface.

### Data Fields

bool(* | pollForActivity )(const peripheral_descriptor_t *self)
status_t(* | init )(const peripheral_descriptor_t *self, serial_byte_receive_func_t function)
void(* | shutdown )(const peripheral_descriptor_t *self)
void(* | pump )(const peripheral_descriptor_t *self)

struct peripheral_byte_inteface_t

Peripheral abstract byte interface.

### Data Fields

status_t(* | init )(const peripheral_descriptor_t *self)
status_t(* | read )(const peripheral_descriptor_t *self, uint8_t *buffer, uint32_t requestedBytes)
status_t(* | write )(const peripheral_descriptor_t *self, const uint8_t *buffer, uint32_t byteCount)

struct peripheral_packet_interface_t

Peripheral Packet Interface.

### Data Fields

status_t(* | init )(const peripheral_descriptor_t *self)
status_t(* | readPacket )(const peripheral_descriptor_t *self, uint8_t **packet, uint32_t *packetLength, packet_type_t packetType)
status_t(* | writePacket )(const peripheral_descriptor_t *self, const uint8_t *packet, uint32_t byteCount, packet_type_t packetType)
void(* | abortDataPhase )(const peripheral_descriptor_t *self)
status_t(* | finalize )(const peripheral_descriptor_t *self)
uint32_t(* | getMaxPacketSize )(const peripheral_descriptor_t *self)
void(* | byteReceivedCallback )(uint8_t byte)

struct PeripheralDescriptor

Peripheral descriptor.

Instances of this struct describe a particular instance of a peripheral that is available for bootloading.

Collaboration diagram for peripheral_descriptor_t:
[legend]

### Data Fields

uint32_t | typeMask
| Bit mask identifying the peripheral type. More...
uint32_t | instance
| The instance number of the peripheral.
void(* | pinmuxConfig )(uint32_t instance, pinmux_type_t pinmux)
| Configure pinmux setting for the peripheral.
const peripheral_control_interface_t * | controlInterface
| Control interface for the peripheral.
const peripheral_byte_inteface_t * | byteInterface
| Byte-level interface for the peripheral. More...
const peripheral_packet_interface_t * | packetInterface
| Packet level interface for the peripheral.

#### Field Documentation

const peripheral_byte_inteface_t* byteInterface

Byte-level interface for the peripheral.

May be NULL since not all periperhals support this interface.

uint32_t typeMask

Bit mask identifying the peripheral type.

See _peripheral_types for a list of valid bits.

## Enumeration Type Documentation

enum _peripheral_types

Peripheral type bit mask definitions.

These bit mask constants serve multiple purposes. They are each a unique value that identifies a peripheral type. They are also the mask for the bits used in the bootloader configuration flash region to list available peripherals and control which peripherals are enabled.

enum packet_type_t

Packet types.

Enumerator
kPacketType_Command | Send or expect a command packet.
kPacketType_Data | Send or expect a data packet.