35 #include "bootloader_common.h" 51 kPeripheralType_UART = (1 << 0),
52 kPeripheralType_I2CSlave = (1 << 1),
53 kPeripheralType_SPISlave = (1 << 2),
54 kPeripheralType_CAN = (1 << 3),
55 kPeripheralType_USB_HID = (1 << 4),
56 kPeripheralType_USB_CDC = (1 << 5),
57 kPeripheralType_USB_DFU = (1 << 6),
58 kPeripheralType_USB_MSC = (1 << 7)
62 typedef enum _pinmux_types
64 kPinmuxType_Default = 0,
66 kPinmuxType_Peripheral = 2
72 typedef void (*serial_byte_receive_func_t)(uint8_t);
75 typedef struct _peripheral_control_interface
77 bool (*pollForActivity)(
const peripheral_descriptor_t *
self);
78 status_t (*init)(
const peripheral_descriptor_t *
self, serial_byte_receive_func_t
function);
79 void (*shutdown)(
const peripheral_descriptor_t *
self);
80 void (*pump)(
const peripheral_descriptor_t *
self);
84 typedef struct _peripheral_byte_inteface
86 status_t (*init)(
const peripheral_descriptor_t *
self);
87 #ifdef BOOTLOADER_HOST 88 status_t (*read)(
const peripheral_descriptor_t *
self, uint8_t *buffer, uint32_t requestedBytes);
89 #endif // #ifdef BOOTLOADER_HOST 90 status_t (*write)(
const peripheral_descriptor_t *
self,
const uint8_t *buffer, uint32_t byteCount);
94 typedef enum _packet_type
101 typedef struct _peripheral_packet_interface
103 status_t (*init)(
const peripheral_descriptor_t *
self);
104 status_t (*readPacket)(
const peripheral_descriptor_t *
self,
106 uint32_t *packetLength,
108 status_t (*writePacket)(
const peripheral_descriptor_t *
self,
109 const uint8_t *packet,
112 void (*abortDataPhase)(
const peripheral_descriptor_t *
self);
113 status_t (*finalize)(
const peripheral_descriptor_t *
self);
114 uint32_t (*getMaxPacketSize)(
const peripheral_descriptor_t *
self);
115 void (*byteReceivedCallback)(uint8_t byte);
156 #endif // _peripheral_h const peripheral_packet_interface_t * packetInterface
Packet level interface for the peripheral.
Definition: bl_peripheral.h:144
packet_type_t
Packet types.
Definition: bl_peripheral.h:94
Send or expect a data packet.
Definition: bl_peripheral.h:97
uint32_t instance
The instance number of the peripheral.
Definition: bl_peripheral.h:130
const peripheral_descriptor_t g_peripherals[]
Array of all peripherals available in this device.
Definition: MK65F18/src/bus_pal_hardware.c:206
Peripheral control interface.
Definition: bl_peripheral.h:75
Peripheral Packet Interface.
Definition: bl_peripheral.h:101
uint32_t typeMask
Bit mask identifying the peripheral type.
Definition: bl_peripheral.h:127
Send or expect a command packet.
Definition: bl_peripheral.h:96
Peripheral descriptor.
Definition: bl_peripheral.h:122
Peripheral abstract byte interface.
Definition: bl_peripheral.h:84
const peripheral_control_interface_t * controlInterface
Control interface for the peripheral.
Definition: bl_peripheral.h:136
_peripheral_types
Peripheral type bit mask definitions.
Definition: bl_peripheral.h:49
pinmux_type_t
Pinmux types.
Definition: bl_peripheral.h:62
const peripheral_byte_inteface_t * byteInterface
Byte-level interface for the peripheral.
Definition: bl_peripheral.h:141
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:121