Access to functions and data in the RP2040 bootrom. More...

Macros

#define ROM_TABLE_CODE(c1, c2)   ((c1) | ((c2) << 8))
 Return a bootrom lookup code based on two ASCII characters. More...
 

Functions

static uint32_t rom_table_code (uint8_t c1, uint8_t c2)
 Return a bootrom lookup code based on two ASCII characters. More...
 
void * rom_func_lookup (uint32_t code)
 Lookup a bootrom function by code. More...
 
void * rom_data_lookup (uint32_t code)
 Lookup a bootrom address by code. More...
 
bool rom_funcs_lookup (uint32_t *table, unsigned int count)
 Helper function to lookup the addresses of multiple bootrom functions. More...
 
static __force_inline void * rom_func_lookup_inline (uint32_t code)
 Lookup a bootrom function by code. This method is forcibly inlined into the caller for FLASH/RAM sensitive code usage. More...
 
static void reset_usb_boot (uint32_t usb_activity_gpio_pin_mask, uint32_t disable_interface_mask)
 Reboot the device into BOOTSEL mode. More...
 

Detailed Description

Access to functions and data in the RP2040 bootrom.

This header may be included by assembly code

Macro Definition Documentation

◆ ROM_TABLE_CODE

#define ROM_TABLE_CODE (   c1,
  c2 
)    ((c1) | ((c2) << 8))

Return a bootrom lookup code based on two ASCII characters.

These codes are uses to lookup data or function addresses in the bootrom

Parameters
c1the first character
c2the second character
Returns
the 'code' to use in rom_func_lookup() or rom_data_lookup()

Function Documentation

◆ reset_usb_boot()

static void reset_usb_boot ( uint32_t  usb_activity_gpio_pin_mask,
uint32_t  disable_interface_mask 
)
inlinestatic

Reboot the device into BOOTSEL mode.

This function reboots the device into the BOOTSEL mode ('usb boot").

Facilities are provided to enable an "activity light" via GPIO attached LED for the USB Mass Storage Device, and to limit the USB interfaces exposed.

Parameters
usb_activity_gpio_pin_mask0 No pins are used as per a cold boot. Otherwise a single bit set indicating which GPIO pin should be set to output and raised whenever there is mass storage activity from the host.
disable_interface_maskvalue to control exposed interfaces
  • 0 To enable both interfaces (as per a cold boot)
  • 1 To disable the USB Mass Storage Interface
  • 2 To disable the USB PICOBOOT Interface

◆ rom_data_lookup()

void* rom_data_lookup ( uint32_t  code)

Lookup a bootrom address by code.

Parameters
codethe code
Returns
a pointer to the data, or NULL if the code does not match any bootrom function

◆ rom_func_lookup()

void* rom_func_lookup ( uint32_t  code)

Lookup a bootrom function by code.

Parameters
codethe code
Returns
a pointer to the function, or NULL if the code does not match any bootrom function

◆ rom_func_lookup_inline()

static __force_inline void* rom_func_lookup_inline ( uint32_t  code)
static

Lookup a bootrom function by code. This method is forcibly inlined into the caller for FLASH/RAM sensitive code usage.

Parameters
codethe code
Returns
a pointer to the function, or NULL if the code does not match any bootrom function

◆ rom_funcs_lookup()

bool rom_funcs_lookup ( uint32_t *  table,
unsigned int  count 
)

Helper function to lookup the addresses of multiple bootrom functions.

This method looks up the 'codes' in the table, and convert each table entry to the looked up function pointer, if there is a function for that code in the bootrom.

Parameters
tablean IN/OUT array, elements are codes on input, function pointers on success.
countthe number of elements in the table
Returns
true if all the codes were found, and converted to function pointers, false otherwise

◆ rom_table_code()

static uint32_t rom_table_code ( uint8_t  c1,
uint8_t  c2 
)
inlinestatic

Return a bootrom lookup code based on two ASCII characters.

These codes are uses to lookup data or function addresses in the bootrom

Parameters
c1the first character
c2the second character
Returns
the 'code' to use in rom_func_lookup() or rom_data_lookup()