mirror of
https://github.com/andreili/katapult.git
synced 2025-08-23 19:34:06 +02:00
rp2040: Initial import from klipper as is.
Signed-off-by: Alex Malishev <malishev@gmail.com>
This commit is contained in:
parent
98844eac24
commit
65845a8fa3
1267
lib/can2040/can2040.c
Normal file
1267
lib/can2040/can2040.c
Normal file
File diff suppressed because it is too large
Load Diff
79
lib/can2040/can2040.h
Normal file
79
lib/can2040/can2040.h
Normal file
@ -0,0 +1,79 @@
|
||||
#ifndef _CAN2040_H
|
||||
#define _CAN2040_H
|
||||
|
||||
#include <stdint.h> // uint32_t
|
||||
|
||||
struct can2040_msg {
|
||||
uint32_t id;
|
||||
uint32_t dlc;
|
||||
union {
|
||||
uint8_t data[8];
|
||||
uint32_t data32[2];
|
||||
};
|
||||
};
|
||||
|
||||
enum {
|
||||
CAN2040_ID_RTR = 1<<30,
|
||||
CAN2040_ID_EFF = 1<<31,
|
||||
};
|
||||
|
||||
enum {
|
||||
CAN2040_NOTIFY_RX = 1<<20,
|
||||
CAN2040_NOTIFY_TX = 1<<21,
|
||||
CAN2040_NOTIFY_ERROR = 1<<23,
|
||||
};
|
||||
struct can2040;
|
||||
typedef void (*can2040_rx_cb)(struct can2040 *cd, uint32_t notify
|
||||
, struct can2040_msg *msg);
|
||||
|
||||
void can2040_setup(struct can2040 *cd, uint32_t pio_num);
|
||||
void can2040_callback_config(struct can2040 *cd, can2040_rx_cb rx_cb);
|
||||
void can2040_start(struct can2040 *cd, uint32_t sys_clock, uint32_t bitrate
|
||||
, uint32_t gpio_rx, uint32_t gpio_tx);
|
||||
void can2040_shutdown(struct can2040 *cd);
|
||||
void can2040_pio_irq_handler(struct can2040 *cd);
|
||||
int can2040_check_transmit(struct can2040 *cd);
|
||||
int can2040_transmit(struct can2040 *cd, struct can2040_msg *msg);
|
||||
|
||||
|
||||
/****************************************************************
|
||||
* Internal definitions
|
||||
****************************************************************/
|
||||
|
||||
struct can2040_bitunstuffer {
|
||||
uint32_t stuffed_bits, count_stuff;
|
||||
uint32_t unstuffed_bits, count_unstuff;
|
||||
};
|
||||
|
||||
struct can2040_transmit {
|
||||
struct can2040_msg msg;
|
||||
uint32_t crc, stuffed_words, stuffed_data[5];
|
||||
};
|
||||
|
||||
struct can2040 {
|
||||
// Setup
|
||||
uint32_t pio_num;
|
||||
void *pio_hw;
|
||||
uint32_t gpio_rx, gpio_tx;
|
||||
can2040_rx_cb rx_cb;
|
||||
|
||||
// Bit unstuffing
|
||||
struct can2040_bitunstuffer unstuf;
|
||||
uint32_t raw_bit_count;
|
||||
|
||||
// Input data state
|
||||
uint32_t parse_state;
|
||||
uint32_t parse_crc;
|
||||
struct can2040_msg parse_msg;
|
||||
|
||||
// Reporting
|
||||
uint32_t report_state;
|
||||
uint32_t report_eof_key;
|
||||
|
||||
// Transmits
|
||||
uint32_t tx_state;
|
||||
uint32_t tx_pull_pos, tx_push_pos;
|
||||
struct can2040_transmit tx_queue[4];
|
||||
};
|
||||
|
||||
#endif // can2040.h
|
124
lib/rp2040/boot/picoboot.h
Normal file
124
lib/rp2040/boot/picoboot.h
Normal file
@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _BOOT_PICOBOOT_H
|
||||
#define _BOOT_PICOBOOT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef NO_PICO_PLATFORM
|
||||
#include "pico/platform.h"
|
||||
#endif
|
||||
|
||||
/** \file picoboot.h
|
||||
* \defgroup boot_picoboot boot_picoboot
|
||||
*
|
||||
* Header file for the PICOBOOT USB interface exposed by an RP2040 in BOOTSEL mode.
|
||||
*/
|
||||
|
||||
#define PICOBOOT_MAGIC 0x431fd10bu
|
||||
|
||||
// --------------------------------------------
|
||||
// CONTROL REQUESTS FOR THE PICOBOOT INTERFACE
|
||||
// --------------------------------------------
|
||||
|
||||
// size 0 OUT - unstall EPs and reset
|
||||
#define PICOBOOT_IF_RESET 0x41
|
||||
|
||||
// size 16 IN - return the status of the last command
|
||||
#define PICOBOOT_IF_CMD_STATUS 0x42
|
||||
|
||||
// --------------------------------------------------
|
||||
// COMMAND REQUESTS SENT TO THE PICOBOOT OUT ENDPOINT
|
||||
// --------------------------------------------------
|
||||
//
|
||||
// picoboot_cmd structure of size 32 is sent to OUT endpoint
|
||||
// transfer_length bytes are transferred via IN/OUT
|
||||
// device responds on success with 0 length ACK packet set via OUT/IN
|
||||
// device may stall the transferring endpoint in case of error
|
||||
|
||||
enum picoboot_cmd_id {
|
||||
PC_EXCLUSIVE_ACCESS = 0x1,
|
||||
PC_REBOOT = 0x2,
|
||||
PC_FLASH_ERASE = 0x3,
|
||||
PC_READ = 0x84, // either RAM or FLASH
|
||||
PC_WRITE = 5, // either RAM or FLASH (does no erase)
|
||||
PC_EXIT_XIP = 0x6,
|
||||
PC_ENTER_CMD_XIP = 0x7,
|
||||
PC_EXEC = 0x8,
|
||||
PC_VECTORIZE_FLASH = 0x9
|
||||
};
|
||||
|
||||
enum picoboot_status {
|
||||
PICOBOOT_OK = 0,
|
||||
PICOBOOT_UNKNOWN_CMD = 1,
|
||||
PICOBOOT_INVALID_CMD_LENGTH = 2,
|
||||
PICOBOOT_INVALID_TRANSFER_LENGTH = 3,
|
||||
PICOBOOT_INVALID_ADDRESS = 4,
|
||||
PICOBOOT_BAD_ALIGNMENT = 5,
|
||||
PICOBOOT_INTERLEAVED_WRITE = 6,
|
||||
PICOBOOT_REBOOTING = 7,
|
||||
PICOBOOT_UNKNOWN_ERROR = 8,
|
||||
};
|
||||
|
||||
struct __packed picoboot_reboot_cmd {
|
||||
uint32_t dPC; // 0 means reset into bootrom
|
||||
uint32_t dSP;
|
||||
uint32_t dDelayMS;
|
||||
};
|
||||
|
||||
// used for EXEC, VECTORIZE_FLASH
|
||||
struct __packed picoboot_address_only_cmd {
|
||||
uint32_t dAddr;
|
||||
};
|
||||
|
||||
// used for READ, WRITE, FLASH_ERASE
|
||||
struct __packed picoboot_range_cmd {
|
||||
uint32_t dAddr;
|
||||
uint32_t dSize;
|
||||
};
|
||||
|
||||
enum picoboot_exclusive_type {
|
||||
NOT_EXCLUSIVE = 0,
|
||||
EXCLUSIVE,
|
||||
EXCLUSIVE_AND_EJECT
|
||||
};
|
||||
|
||||
struct __packed picoboot_exclusive_cmd {
|
||||
uint8_t bExclusive;
|
||||
};
|
||||
|
||||
// little endian
|
||||
struct __packed __aligned(4) picoboot_cmd {
|
||||
uint32_t dMagic;
|
||||
uint32_t dToken; // an identifier for this token to correlate with a status response
|
||||
uint8_t bCmdId; // top bit set for IN
|
||||
uint8_t bCmdSize; // bytes of actual data in the arg part of this structure
|
||||
uint16_t _unused;
|
||||
uint32_t dTransferLength; // length of IN/OUT transfer (or 0) if none
|
||||
union {
|
||||
uint8_t args[16];
|
||||
struct picoboot_reboot_cmd reboot_cmd;
|
||||
struct picoboot_range_cmd range_cmd;
|
||||
struct picoboot_address_only_cmd address_only_cmd;
|
||||
struct picoboot_exclusive_cmd exclusive_cmd;
|
||||
};
|
||||
};
|
||||
|
||||
static_assert(32 == sizeof(struct picoboot_cmd), "picoboot_cmd must be 32 bytes big");
|
||||
|
||||
struct __packed __aligned(4) picoboot_cmd_status {
|
||||
uint32_t dToken;
|
||||
uint32_t dStatusCode;
|
||||
uint8_t bCmdId;
|
||||
uint8_t bInProgress;
|
||||
uint8_t _pad[6];
|
||||
};
|
||||
|
||||
static_assert(16 == sizeof(struct picoboot_cmd_status), "picoboot_cmd_status must be 16 bytes big");
|
||||
#endif
|
46
lib/rp2040/boot/uf2.h
Normal file
46
lib/rp2040/boot/uf2.h
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _BOOT_UF2_H
|
||||
#define _BOOT_UF2_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
|
||||
/** \file uf2.h
|
||||
* \defgroup boot_uf2 boot_uf2
|
||||
*
|
||||
* Header file for the UF2 format supported by an RP2040 in BOOTSEL mode.
|
||||
*/
|
||||
|
||||
#define UF2_MAGIC_START0 0x0A324655u
|
||||
#define UF2_MAGIC_START1 0x9E5D5157u
|
||||
#define UF2_MAGIC_END 0x0AB16F30u
|
||||
|
||||
#define UF2_FLAG_NOT_MAIN_FLASH 0x00000001u
|
||||
#define UF2_FLAG_FILE_CONTAINER 0x00001000u
|
||||
#define UF2_FLAG_FAMILY_ID_PRESENT 0x00002000u
|
||||
#define UF2_FLAG_MD5_PRESENT 0x00004000u
|
||||
|
||||
#define RP2040_FAMILY_ID 0xe48bff56
|
||||
|
||||
struct uf2_block {
|
||||
// 32 byte header
|
||||
uint32_t magic_start0;
|
||||
uint32_t magic_start1;
|
||||
uint32_t flags;
|
||||
uint32_t target_addr;
|
||||
uint32_t payload_size;
|
||||
uint32_t block_no;
|
||||
uint32_t num_blocks;
|
||||
uint32_t file_size; // or familyID;
|
||||
uint8_t data[476];
|
||||
uint32_t magic_end;
|
||||
};
|
||||
|
||||
static_assert(sizeof(struct uf2_block) == 512, "uf2_block not sector sized");
|
||||
|
||||
#endif
|
100
lib/rp2040/boot_stage2/CMakeLists.txt
Normal file
100
lib/rp2040/boot_stage2/CMakeLists.txt
Normal file
@ -0,0 +1,100 @@
|
||||
# PICO_CMAKE_CONFIG: PICO_DEFAULT_BOOT_STAGE2_FILE, Default boot stage 2 file to use unless overridden by pico_set_boot_stage2 on the TARGET; this setting is useful when explicitly setting the default build from a per board CMake file, group=build
|
||||
# PICO_CMAKE_CONFIG: PICO_DEFAULT_BOOT_STAGE2, Simpler alternative to specifying PICO_DEFAULT_BOOT_STAGE2_FILE where the file is src/rp2_common/boot_stage2/{PICO_DEFAULT_BOOT_STAGE2}.S, default=compile_time_choice, group=build
|
||||
|
||||
if (DEFINED ENV{PICO_DEFAULT_BOOT_STAGE2_FILE})
|
||||
set(PICO_DEFAULT_BOOT_STAGE2_FILE $ENV{PICO_DEFAULT_BOOT_STAGE2_FILE})
|
||||
message("Using PICO_DEFAULT_BOOT_STAGE2_FILE from environment ('${PICO_DEFAULT_BOOT_STAGE2_FILE}')")
|
||||
elif (PICO_DEFAULT_BOOT_STAGE2_FILE)
|
||||
# explicitly set, so cache it
|
||||
set(PICO_DEFAULT_BOOT_STAGE2_FILE "${PICO_DEFAULT_BOOT_STAGE2_FILE}" CACHE STRING "boot stage 2 source file" FORCE)
|
||||
endif()
|
||||
|
||||
set(PICO_BOOT_STAGE2_COMPILE_TIME_CHOICE_NAME compile_time_choice) # local var
|
||||
if (NOT PICO_DEFAULT_BOOT_STAGE2_FILE)
|
||||
if (DEFINED ENV{PICO_DEFAULT_BOOT_STAGE2})
|
||||
set(PICO_DEFAULT_BOOT_STAGE2 $ENV{PICO_DEFAULT_BOOT_STAGE2})
|
||||
message("Using PICO_DEFAULT_BOOT_STAGE2 from environment ('${PICO_DEFAULT_BOOT_STAGE2}')")
|
||||
endif()
|
||||
if (NOT DEFINED PICO_DEFAULT_BOOT_STAGE2)
|
||||
set(PICO_DEFAULT_BOOT_STAGE2 ${PICO_BOOT_STAGE2_COMPILE_TIME_CHOICE_NAME})
|
||||
endif()
|
||||
set(PICO_DEFAULT_BOOT_STAGE2 "${PICO_DEFAULT_BOOT_STAGE2}" CACHE STRING "boot stage 2 short name" FORCE)
|
||||
set(PICO_DEFAULT_BOOT_STAGE2_FILE "${CMAKE_CURRENT_LIST_DIR}/${PICO_DEFAULT_BOOT_STAGE2}.S")
|
||||
endif()
|
||||
|
||||
if (NOT EXISTS ${PICO_DEFAULT_BOOT_STAGE2_FILE})
|
||||
message(FATAL_ERROR "Specified boot stage 2 source '${PICO_DEFAULT_BOOT_STAGE2_FILE}' does not exist.")
|
||||
endif()
|
||||
|
||||
# needed by function below
|
||||
set(PICO_BOOT_STAGE2_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "")
|
||||
|
||||
add_library(boot_stage2_headers INTERFACE)
|
||||
target_include_directories(boot_stage2_headers INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
|
||||
|
||||
# by convention the first source file name without extension is used for the binary info name
|
||||
function(pico_define_boot_stage2 NAME SOURCES)
|
||||
add_executable(${NAME}
|
||||
${SOURCES}
|
||||
)
|
||||
|
||||
# todo bit of an abstraction failure - revisit for Clang support anyway
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_link_options(${NAME} PRIVATE "-nostdlib")
|
||||
else ()
|
||||
target_link_options(${NAME} PRIVATE "--specs=nosys.specs")
|
||||
target_link_options(${NAME} PRIVATE "-nostartfiles")
|
||||
endif ()
|
||||
|
||||
# boot2_helpers include dir
|
||||
target_include_directories(${NAME} PRIVATE ${PICO_BOOT_STAGE2_DIR}/asminclude)
|
||||
|
||||
target_link_libraries(${NAME} hardware_regs boot_stage2_headers)
|
||||
target_link_options(${NAME} PRIVATE "LINKER:--script=${PICO_BOOT_STAGE2_DIR}/boot_stage2.ld")
|
||||
set_target_properties(${NAME} PROPERTIES LINK_DEPENDS ${PICO_BOOT_STAGE2_DIR}/boot_stage2.ld)
|
||||
|
||||
pico_add_dis_output(${NAME})
|
||||
pico_add_map_output(${NAME})
|
||||
|
||||
set(ORIGINAL_BIN ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.bin)
|
||||
set(PADDED_CHECKSUMMED_ASM ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_padded_checksummed.S)
|
||||
|
||||
find_package (Python3 REQUIRED COMPONENTS Interpreter)
|
||||
|
||||
add_custom_target(${NAME}_bin DEPENDS ${ORIGINAL_BIN})
|
||||
add_custom_command(OUTPUT ${ORIGINAL_BIN} DEPENDS ${NAME} COMMAND ${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:${NAME}> ${ORIGINAL_BIN})
|
||||
|
||||
add_custom_target(${NAME}_padded_checksummed_asm DEPENDS ${PADDED_CHECKSUMMED_ASM})
|
||||
add_custom_command(OUTPUT ${PADDED_CHECKSUMMED_ASM} DEPENDS ${ORIGINAL_BIN}
|
||||
COMMAND ${Python3_EXECUTABLE} ${PICO_BOOT_STAGE2_DIR}/pad_checksum -s 0xffffffff ${ORIGINAL_BIN} ${PADDED_CHECKSUMMED_ASM}
|
||||
)
|
||||
|
||||
add_library(${NAME}_library INTERFACE)
|
||||
add_dependencies(${NAME}_library ${NAME}_padded_checksummed_asm)
|
||||
# not strictly (or indeed actually) a link library, but this avoids dependency cycle
|
||||
target_link_libraries(${NAME}_library INTERFACE ${PADDED_CHECKSUMMED_ASM})
|
||||
target_link_libraries(${NAME}_library INTERFACE boot_stage2_headers)
|
||||
|
||||
list(GET SOURCES 0 FIRST_SOURCE)
|
||||
get_filename_component(BOOT_STAGE2_BI_NAME ${FIRST_SOURCE} NAME_WE)
|
||||
|
||||
# we only set the PICO_BUILD_STAGE2_NAME if it isn't 'compile_time_choice'
|
||||
if (NOT BOOT_STAGE2_BI_NAME STREQUAL PICO_BOOT_STAGE2_COMPILE_TIME_CHOICE_NAME)
|
||||
target_compile_definitions(${NAME} INTERFACE
|
||||
-DPICO_BUILD_BOOT_STAGE2_NAME="${BOOT_STAGE2_BI_NAME}")
|
||||
target_compile_definitions(${NAME}_library INTERFACE
|
||||
-DPICO_BUILD_BOOT_STAGE2_NAME="${BOOT_STAGE2_BI_NAME}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
macro(pico_set_boot_stage2 TARGET NAME)
|
||||
get_target_property(target_type ${TARGET} TYPE)
|
||||
if ("EXECUTABLE" STREQUAL "${target_type}")
|
||||
set_target_properties(${TARGET} PROPERTIES PICO_TARGET_BOOT_STAGE2 "${NAME}")
|
||||
else()
|
||||
message(FATAL_ERROR "boot stage 2 implementation must be set on executable not library")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
pico_define_boot_stage2(bs2_default ${PICO_DEFAULT_BOOT_STAGE2_FILE})
|
||||
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _BOOT2_HELPER_EXIT_FROM_BOOT2
|
||||
#define _BOOT2_HELPER_EXIT_FROM_BOOT2
|
||||
|
||||
#include "hardware/regs/m0plus.h"
|
||||
|
||||
// If entered from the bootrom, lr (which we earlier pushed) will be 0,
|
||||
// and we vector through the table at the start of the main flash image.
|
||||
// Any regular function call will have a nonzero value for lr.
|
||||
check_return:
|
||||
pop {r0}
|
||||
cmp r0, #0
|
||||
beq vector_into_flash
|
||||
bx r0
|
||||
vector_into_flash:
|
||||
ldr r0, =(XIP_BASE + 0x100)
|
||||
ldr r1, =(PPB_BASE + M0PLUS_VTOR_OFFSET)
|
||||
str r0, [r1]
|
||||
ldmia r0, {r0, r1}
|
||||
msr msp, r0
|
||||
bx r1
|
||||
|
||||
#endif
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _BOOT2_HELPER_READ_FLASH_SREG
|
||||
#define _BOOT2_HELPER_READ_FLASH_SREG
|
||||
|
||||
#include "boot2_helpers/wait_ssi_ready.S"
|
||||
|
||||
// Pass status read cmd into r0.
|
||||
// Returns status value in r0.
|
||||
.global read_flash_sreg
|
||||
.type read_flash_sreg,%function
|
||||
.thumb_func
|
||||
read_flash_sreg:
|
||||
push {r1, lr}
|
||||
str r0, [r3, #SSI_DR0_OFFSET]
|
||||
// Dummy byte:
|
||||
str r0, [r3, #SSI_DR0_OFFSET]
|
||||
|
||||
bl wait_ssi_ready
|
||||
// Discard first byte and combine the next two
|
||||
ldr r0, [r3, #SSI_DR0_OFFSET]
|
||||
ldr r0, [r3, #SSI_DR0_OFFSET]
|
||||
|
||||
pop {r1, pc}
|
||||
|
||||
#endif
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _BOOT2_HELPER_WAIT_SSI_READY
|
||||
#define _BOOT2_HELPER_WAIT_SSI_READY
|
||||
|
||||
wait_ssi_ready:
|
||||
push {r0, r1, lr}
|
||||
|
||||
// Command is complete when there is nothing left to send
|
||||
// (TX FIFO empty) and SSI is no longer busy (CSn deasserted)
|
||||
1:
|
||||
ldr r1, [r3, #SSI_SR_OFFSET]
|
||||
movs r0, #SSI_SR_TFE_BITS
|
||||
tst r1, r0
|
||||
beq 1b
|
||||
movs r0, #SSI_SR_BUSY_BITS
|
||||
tst r1, r0
|
||||
bne 1b
|
||||
|
||||
pop {r0, r1, pc}
|
||||
|
||||
#endif
|
285
lib/rp2040/boot_stage2/boot2_at25sf128a.S
Normal file
285
lib/rp2040/boot_stage2/boot2_at25sf128a.S
Normal file
@ -0,0 +1,285 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// Second stage boot code
|
||||
// Copyright (c) 2019-2021 Raspberry Pi (Trading) Ltd.
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
//
|
||||
// Device: Adesto AT25SF128A
|
||||
// Based on W25Q080 code: main difference is the QE bit is being set
|
||||
// via command 0x31
|
||||
//
|
||||
// Description: Configures AT25SF128A to run in Quad I/O continuous read XIP mode
|
||||
//
|
||||
// Details: * Check status register 2 to determine if QSPI mode is enabled,
|
||||
// and perform an SR2 programming cycle if necessary.
|
||||
// * Use SSI to perform a dummy 0xEB read command, with the mode
|
||||
// continuation bits set, so that the flash will not require
|
||||
// 0xEB instruction prefix on subsequent reads.
|
||||
// * Configure SSI to write address, mode bits, but no instruction.
|
||||
// SSI + flash are now jointly in a state where continuous reads
|
||||
// can take place.
|
||||
// * Jump to exit pointer passed in via lr. Bootrom passes null,
|
||||
// in which case this code uses a default 256 byte flash offset
|
||||
//
|
||||
// Building: * This code must be position-independent, and use stack only
|
||||
// * The code will be padded to a size of 256 bytes, including a
|
||||
// 4-byte checksum. Therefore code size cannot exceed 252 bytes.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "pico/asm_helper.S"
|
||||
#include "hardware/regs/addressmap.h"
|
||||
#include "hardware/regs/ssi.h"
|
||||
#include "hardware/regs/pads_qspi.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Config section
|
||||
// ----------------------------------------------------------------------------
|
||||
// It should be possible to support most flash devices by modifying this section
|
||||
|
||||
// The serial flash interface will run at clk_sys/PICO_FLASH_SPI_CLKDIV.
|
||||
// This must be a positive, even integer.
|
||||
// The bootrom is very conservative with SPI frequency, but here we should be
|
||||
// as aggressive as possible.
|
||||
|
||||
#ifndef PICO_FLASH_SPI_CLKDIV
|
||||
#define PICO_FLASH_SPI_CLKDIV 4
|
||||
#endif
|
||||
#if PICO_FLASH_SPI_CLKDIV & 1
|
||||
#error PICO_FLASH_SPI_CLKDIV must be even
|
||||
#endif
|
||||
|
||||
// Define interface width: single/dual/quad IO
|
||||
#define FRAME_FORMAT SSI_CTRLR0_SPI_FRF_VALUE_QUAD
|
||||
|
||||
// For W25Q080 this is the "Read data fast quad IO" instruction:
|
||||
#define CMD_READ 0xeb
|
||||
|
||||
// "Mode bits" are 8 special bits sent immediately after
|
||||
// the address bits in a "Read Data Fast Quad I/O" command sequence.
|
||||
// On W25Q080, the four LSBs are don't care, and if MSBs == 0xa, the
|
||||
// next read does not require the 0xeb instruction prefix.
|
||||
#define MODE_CONTINUOUS_READ 0x20
|
||||
|
||||
// The number of address + mode bits, divided by 4 (always 4, not function of
|
||||
// interface width).
|
||||
#define ADDR_L 8
|
||||
|
||||
// How many clocks of Hi-Z following the mode bits. For W25Q080, 4 dummy cycles
|
||||
// are required.
|
||||
#define WAIT_CYCLES 4
|
||||
|
||||
// If defined, we will read status reg, compare to SREG_DATA, and overwrite
|
||||
// with our value if the SR doesn't match.
|
||||
// We do a two-byte write to SR1 (01h cmd) rather than a one-byte write to
|
||||
// SR2 (31h cmd) as the latter command isn't supported by WX25Q080.
|
||||
// This isn't great because it will remove block protections.
|
||||
// A better solution is to use a volatile SR write if your device supports it.
|
||||
#define PROGRAM_STATUS_REG
|
||||
|
||||
#define CMD_WRITE_ENABLE 0x06
|
||||
#define CMD_READ_STATUS 0x05
|
||||
#define CMD_READ_STATUS2 0x35
|
||||
#define CMD_WRITE_STATUS 0x01
|
||||
#define CMD_WRITE_STATUS2 0x31
|
||||
#define SREG_DATA 0x02 // Enable quad-SPI mode
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Start of 2nd Stage Boot Code
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
.syntax unified
|
||||
.cpu cortex-m0plus
|
||||
.thumb
|
||||
|
||||
.section .text
|
||||
|
||||
// The exit point is passed in lr. If entered from bootrom, this will be the
|
||||
// flash address immediately following this second stage (0x10000100).
|
||||
// Otherwise it will be a return address -- second stage being called as a
|
||||
// function by user code, after copying out of XIP region. r3 holds SSI base,
|
||||
// r0...2 used as temporaries. Other GPRs not used.
|
||||
.global _stage2_boot
|
||||
.type _stage2_boot,%function
|
||||
.thumb_func
|
||||
_stage2_boot:
|
||||
push {lr}
|
||||
|
||||
// Set pad configuration:
|
||||
// - SCLK 8mA drive, no slew limiting
|
||||
// - SDx disable input Schmitt to reduce delay
|
||||
|
||||
ldr r3, =PADS_QSPI_BASE
|
||||
movs r0, #(2 << PADS_QSPI_GPIO_QSPI_SCLK_DRIVE_LSB | PADS_QSPI_GPIO_QSPI_SCLK_SLEWFAST_BITS)
|
||||
str r0, [r3, #PADS_QSPI_GPIO_QSPI_SCLK_OFFSET]
|
||||
ldr r0, [r3, #PADS_QSPI_GPIO_QSPI_SD0_OFFSET]
|
||||
movs r1, #PADS_QSPI_GPIO_QSPI_SD0_SCHMITT_BITS
|
||||
bics r0, r1
|
||||
str r0, [r3, #PADS_QSPI_GPIO_QSPI_SD0_OFFSET]
|
||||
str r0, [r3, #PADS_QSPI_GPIO_QSPI_SD1_OFFSET]
|
||||
str r0, [r3, #PADS_QSPI_GPIO_QSPI_SD2_OFFSET]
|
||||
str r0, [r3, #PADS_QSPI_GPIO_QSPI_SD3_OFFSET]
|
||||
|
||||
ldr r3, =XIP_SSI_BASE
|
||||
|
||||
// Disable SSI to allow further config
|
||||
movs r1, #0
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET]
|
||||
|
||||
// Set baud rate
|
||||
movs r1, #PICO_FLASH_SPI_CLKDIV
|
||||
str r1, [r3, #SSI_BAUDR_OFFSET]
|
||||
|
||||
// Set 1-cycle sample delay. If PICO_FLASH_SPI_CLKDIV == 2 then this means,
|
||||
// if the flash launches data on SCLK posedge, we capture it at the time that
|
||||
// the next SCLK posedge is launched. This is shortly before that posedge
|
||||
// arrives at the flash, so data hold time should be ok. For
|
||||
// PICO_FLASH_SPI_CLKDIV > 2 this pretty much has no effect.
|
||||
|
||||
movs r1, #1
|
||||
movs r2, #SSI_RX_SAMPLE_DLY_OFFSET // == 0xf0 so need 8 bits of offset significance
|
||||
str r1, [r3, r2]
|
||||
|
||||
|
||||
// On QSPI parts we usually need a 01h SR-write command to enable QSPI mode
|
||||
// (i.e. turn WPn and HOLDn into IO2/IO3)
|
||||
#ifdef PROGRAM_STATUS_REG
|
||||
program_sregs:
|
||||
#define CTRL0_SPI_TXRX \
|
||||
(7 << SSI_CTRLR0_DFS_32_LSB) | /* 8 bits per data frame */ \
|
||||
(SSI_CTRLR0_TMOD_VALUE_TX_AND_RX << SSI_CTRLR0_TMOD_LSB)
|
||||
|
||||
ldr r1, =(CTRL0_SPI_TXRX)
|
||||
str r1, [r3, #SSI_CTRLR0_OFFSET]
|
||||
|
||||
// Enable SSI and select slave 0
|
||||
movs r1, #1
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET]
|
||||
|
||||
// Check whether SR needs updating
|
||||
movs r0, #CMD_READ_STATUS2
|
||||
bl read_flash_sreg
|
||||
movs r2, #SREG_DATA
|
||||
cmp r0, r2
|
||||
beq skip_sreg_programming
|
||||
|
||||
// Send write enable command
|
||||
movs r1, #CMD_WRITE_ENABLE
|
||||
str r1, [r3, #SSI_DR0_OFFSET]
|
||||
|
||||
// Poll for completion and discard RX
|
||||
bl wait_ssi_ready
|
||||
ldr r1, [r3, #SSI_DR0_OFFSET]
|
||||
|
||||
// Send status write command followed by data bytes
|
||||
movs r1, #CMD_WRITE_STATUS2
|
||||
str r1, [r3, #SSI_DR0_OFFSET]
|
||||
str r2, [r3, #SSI_DR0_OFFSET]
|
||||
|
||||
bl wait_ssi_ready
|
||||
ldr r1, [r3, #SSI_DR0_OFFSET]
|
||||
ldr r1, [r3, #SSI_DR0_OFFSET]
|
||||
ldr r1, [r3, #SSI_DR0_OFFSET]
|
||||
|
||||
// Poll status register for write completion
|
||||
1:
|
||||
movs r0, #CMD_READ_STATUS
|
||||
bl read_flash_sreg
|
||||
movs r1, #1
|
||||
tst r0, r1
|
||||
bne 1b
|
||||
|
||||
skip_sreg_programming:
|
||||
|
||||
// Disable SSI again so that it can be reconfigured
|
||||
movs r1, #0
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET]
|
||||
#endif
|
||||
|
||||
// Currently the flash expects an 8 bit serial command prefix on every
|
||||
// transfer, which is a waste of cycles. Perform a dummy Fast Read Quad I/O
|
||||
// command, with mode bits set such that the flash will not expect a serial
|
||||
// command prefix on *subsequent* transfers. We don't care about the results
|
||||
// of the read, the important part is the mode bits.
|
||||
|
||||
dummy_read:
|
||||
#define CTRLR0_ENTER_XIP \
|
||||
(FRAME_FORMAT /* Quad I/O mode */ \
|
||||
<< SSI_CTRLR0_SPI_FRF_LSB) | \
|
||||
(31 << SSI_CTRLR0_DFS_32_LSB) | /* 32 data bits */ \
|
||||
(SSI_CTRLR0_TMOD_VALUE_EEPROM_READ /* Send INST/ADDR, Receive Data */ \
|
||||
<< SSI_CTRLR0_TMOD_LSB)
|
||||
|
||||
ldr r1, =(CTRLR0_ENTER_XIP)
|
||||
str r1, [r3, #SSI_CTRLR0_OFFSET]
|
||||
|
||||
movs r1, #0x0 // NDF=0 (single 32b read)
|
||||
str r1, [r3, #SSI_CTRLR1_OFFSET]
|
||||
|
||||
#define SPI_CTRLR0_ENTER_XIP \
|
||||
(ADDR_L << SSI_SPI_CTRLR0_ADDR_L_LSB) | /* Address + mode bits */ \
|
||||
(WAIT_CYCLES << SSI_SPI_CTRLR0_WAIT_CYCLES_LSB) | /* Hi-Z dummy clocks following address + mode */ \
|
||||
(SSI_SPI_CTRLR0_INST_L_VALUE_8B \
|
||||
<< SSI_SPI_CTRLR0_INST_L_LSB) | /* 8-bit instruction */ \
|
||||
(SSI_SPI_CTRLR0_TRANS_TYPE_VALUE_1C2A /* Send Command in serial mode then address in Quad I/O mode */ \
|
||||
<< SSI_SPI_CTRLR0_TRANS_TYPE_LSB)
|
||||
|
||||
ldr r1, =(SPI_CTRLR0_ENTER_XIP)
|
||||
ldr r0, =(XIP_SSI_BASE + SSI_SPI_CTRLR0_OFFSET) // SPI_CTRL0 Register
|
||||
str r1, [r0]
|
||||
|
||||
movs r1, #1 // Re-enable SSI
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET]
|
||||
|
||||
movs r1, #CMD_READ
|
||||
str r1, [r3, #SSI_DR0_OFFSET] // Push SPI command into TX FIFO
|
||||
movs r1, #MODE_CONTINUOUS_READ // 32-bit: 24 address bits (we don't care, so 0) and M[7:4]=1010
|
||||
str r1, [r3, #SSI_DR0_OFFSET] // Push Address into TX FIFO - this will trigger the transaction
|
||||
|
||||
// Poll for completion
|
||||
bl wait_ssi_ready
|
||||
|
||||
// The flash is in a state where we can blast addresses in parallel, and get
|
||||
// parallel data back. Now configure the SSI to translate XIP bus accesses
|
||||
// into QSPI transfers of this form.
|
||||
|
||||
movs r1, #0
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET] // Disable SSI (and clear FIFO) to allow further config
|
||||
|
||||
// Note that the INST_L field is used to select what XIP data gets pushed into
|
||||
// the TX FIFO:
|
||||
// INST_L_0_BITS {ADDR[23:0],XIP_CMD[7:0]} Load "mode bits" into XIP_CMD
|
||||
// Anything else {XIP_CMD[7:0],ADDR[23:0]} Load SPI command into XIP_CMD
|
||||
configure_ssi:
|
||||
#define SPI_CTRLR0_XIP \
|
||||
(MODE_CONTINUOUS_READ /* Mode bits to keep flash in continuous read mode */ \
|
||||
<< SSI_SPI_CTRLR0_XIP_CMD_LSB) | \
|
||||
(ADDR_L << SSI_SPI_CTRLR0_ADDR_L_LSB) | /* Total number of address + mode bits */ \
|
||||
(WAIT_CYCLES << SSI_SPI_CTRLR0_WAIT_CYCLES_LSB) | /* Hi-Z dummy clocks following address + mode */ \
|
||||
(SSI_SPI_CTRLR0_INST_L_VALUE_NONE /* Do not send a command, instead send XIP_CMD as mode bits after address */ \
|
||||
<< SSI_SPI_CTRLR0_INST_L_LSB) | \
|
||||
(SSI_SPI_CTRLR0_TRANS_TYPE_VALUE_2C2A /* Send Address in Quad I/O mode (and Command but that is zero bits long) */ \
|
||||
<< SSI_SPI_CTRLR0_TRANS_TYPE_LSB)
|
||||
|
||||
ldr r1, =(SPI_CTRLR0_XIP)
|
||||
ldr r0, =(XIP_SSI_BASE + SSI_SPI_CTRLR0_OFFSET)
|
||||
str r1, [r0]
|
||||
|
||||
movs r1, #1
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET] // Re-enable SSI
|
||||
|
||||
// Bus accesses to the XIP window will now be transparently serviced by the
|
||||
// external flash on cache miss. We are ready to run code from flash.
|
||||
|
||||
// Pull in standard exit routine
|
||||
#include "boot2_helpers/exit_from_boot2.S"
|
||||
|
||||
// Common functions
|
||||
#include "boot2_helpers/wait_ssi_ready.S"
|
||||
#ifdef PROGRAM_STATUS_REG
|
||||
#include "boot2_helpers/read_flash_sreg.S"
|
||||
#endif
|
||||
|
||||
.global literals
|
||||
literals:
|
||||
.ltorg
|
||||
|
||||
.end
|
103
lib/rp2040/boot_stage2/boot2_generic_03h.S
Normal file
103
lib/rp2040/boot_stage2/boot2_generic_03h.S
Normal file
@ -0,0 +1,103 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// Second stage boot code
|
||||
// Copyright (c) 2019-2021 Raspberry Pi (Trading) Ltd.
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
//
|
||||
// Device: Anything which responds to 03h serial read command
|
||||
//
|
||||
// Details: * Configure SSI to translate each APB read into a 03h command
|
||||
// * 8 command clocks, 24 address clocks and 32 data clocks
|
||||
// * This enables you to boot from almost anything: you can pretty
|
||||
// much solder a potato to your PCB, or a piece of cheese
|
||||
// * The tradeoff is performance around 3x worse than QSPI XIP
|
||||
//
|
||||
// Building: * This code must be position-independent, and use stack only
|
||||
// * The code will be padded to a size of 256 bytes, including a
|
||||
// 4-byte checksum. Therefore code size cannot exceed 252 bytes.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
//#include "pico/asm_helper.S"
|
||||
#include "hardware/regs/addressmap.h"
|
||||
#include "hardware/regs/ssi.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Config section
|
||||
// ----------------------------------------------------------------------------
|
||||
// It should be possible to support most flash devices by modifying this section
|
||||
|
||||
// The serial flash interface will run at clk_sys/PICO_FLASH_SPI_CLKDIV.
|
||||
// This must be a positive, even integer.
|
||||
// The bootrom is very conservative with SPI frequency, but here we should be
|
||||
// as aggressive as possible.
|
||||
#ifndef PICO_FLASH_SPI_CLKDIV
|
||||
#define PICO_FLASH_SPI_CLKDIV 4
|
||||
#endif
|
||||
|
||||
#define CMD_READ 0x03
|
||||
|
||||
// Value is number of address bits divided by 4
|
||||
#define ADDR_L 6
|
||||
|
||||
#define CTRLR0_XIP \
|
||||
(SSI_CTRLR0_SPI_FRF_VALUE_STD << SSI_CTRLR0_SPI_FRF_LSB) | /* Standard 1-bit SPI serial frames */ \
|
||||
(31 << SSI_CTRLR0_DFS_32_LSB) | /* 32 clocks per data frame */ \
|
||||
(SSI_CTRLR0_TMOD_VALUE_EEPROM_READ << SSI_CTRLR0_TMOD_LSB) /* Send instr + addr, receive data */
|
||||
|
||||
#define SPI_CTRLR0_XIP \
|
||||
(CMD_READ << SSI_SPI_CTRLR0_XIP_CMD_LSB) | /* Value of instruction prefix */ \
|
||||
(ADDR_L << SSI_SPI_CTRLR0_ADDR_L_LSB) | /* Total number of address + mode bits */ \
|
||||
(2 << SSI_SPI_CTRLR0_INST_L_LSB) | /* 8 bit command prefix (field value is bits divided by 4) */ \
|
||||
(SSI_SPI_CTRLR0_TRANS_TYPE_VALUE_1C1A << SSI_SPI_CTRLR0_TRANS_TYPE_LSB) /* command and address both in serial format */
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Start of 2nd Stage Boot Code
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
.cpu cortex-m0
|
||||
.thumb
|
||||
|
||||
.section .text
|
||||
|
||||
.global _stage2_boot
|
||||
.type _stage2_boot,%function
|
||||
.thumb_func
|
||||
_stage2_boot:
|
||||
push {lr}
|
||||
|
||||
ldr r3, =XIP_SSI_BASE // Use as base address where possible
|
||||
|
||||
// Disable SSI to allow further config
|
||||
mov r1, #0
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET]
|
||||
|
||||
// Set baud rate
|
||||
mov r1, #PICO_FLASH_SPI_CLKDIV
|
||||
str r1, [r3, #SSI_BAUDR_OFFSET]
|
||||
|
||||
ldr r1, =(CTRLR0_XIP)
|
||||
str r1, [r3, #SSI_CTRLR0_OFFSET]
|
||||
|
||||
ldr r1, =(SPI_CTRLR0_XIP)
|
||||
ldr r0, =(XIP_SSI_BASE + SSI_SPI_CTRLR0_OFFSET)
|
||||
str r1, [r0]
|
||||
|
||||
// NDF=0 (single 32b read)
|
||||
mov r1, #0x0
|
||||
str r1, [r3, #SSI_CTRLR1_OFFSET]
|
||||
|
||||
// Re-enable SSI
|
||||
mov r1, #1
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET]
|
||||
|
||||
// We are now in XIP mode. Any bus accesses to the XIP address window will be
|
||||
// translated by the SSI into 03h read commands to the external flash (if cache is missed),
|
||||
// and the data will be returned to the bus.
|
||||
|
||||
// Pull in standard exit routine
|
||||
#include "boot2_helpers/exit_from_boot2.S"
|
||||
|
||||
.global literals
|
||||
literals:
|
||||
.ltorg
|
||||
|
||||
.end
|
262
lib/rp2040/boot_stage2/boot2_is25lp080.S
Normal file
262
lib/rp2040/boot_stage2/boot2_is25lp080.S
Normal file
@ -0,0 +1,262 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright (c) 2019-2021 Raspberry Pi (Trading) Ltd.
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
//
|
||||
// Device: ISSI IS25LP080D
|
||||
// Based on W25Q080 code: main difference is the QE bit being in
|
||||
// SR1 instead of SR2.
|
||||
//
|
||||
// Description: Configures IS25LP080D to run in Quad I/O continuous read XIP mode
|
||||
//
|
||||
// Details: * Check status register to determine if QSPI mode is enabled,
|
||||
// and perform an SR programming cycle if necessary.
|
||||
// * Use SSI to perform a dummy 0xEB read command, with the mode
|
||||
// continuation bits set, so that the flash will not require
|
||||
// 0xEB instruction prefix on subsequent reads.
|
||||
// * Configure SSI to write address, mode bits, but no instruction.
|
||||
// SSI + flash are now jointly in a state where continuous reads
|
||||
// can take place.
|
||||
// * Set VTOR = 0x10000100 (user vector table immediately after
|
||||
// this boot2 image).
|
||||
// * Read stack pointer (MSP) and reset vector from the flash
|
||||
// vector table; set SP and jump, as though the processor had
|
||||
// booted directly from flash.
|
||||
//
|
||||
// Building: * This code must be linked to run at 0x20027f00
|
||||
// * The code will be padded to a size of 256 bytes, including a
|
||||
// 4-byte checksum. Therefore code size cannot exceed 252 bytes.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "pico/asm_helper.S"
|
||||
#include "hardware/regs/addressmap.h"
|
||||
#include "hardware/regs/ssi.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Config section
|
||||
// ----------------------------------------------------------------------------
|
||||
// It should be possible to support most flash devices by modifying this section
|
||||
|
||||
// The serial flash interface will run at clk_sys/PICO_FLASH_SPI_CLKDIV.
|
||||
// This must be a positive, even integer.
|
||||
// The bootrom is very conservative with SPI frequency, but here we should be
|
||||
// as aggressive as possible.
|
||||
#ifndef PICO_FLASH_SPI_CLKDIV
|
||||
#define PICO_FLASH_SPI_CLKDIV 4
|
||||
#endif
|
||||
|
||||
|
||||
// Define interface width: single/dual/quad IO
|
||||
#define FRAME_FORMAT SSI_CTRLR0_SPI_FRF_VALUE_QUAD
|
||||
|
||||
// For W25Q080 this is the "Read data fast quad IO" instruction:
|
||||
#define CMD_READ 0xeb
|
||||
|
||||
// "Mode bits" are 8 special bits sent immediately after
|
||||
// the address bits in a "Read Data Fast Quad I/O" command sequence.
|
||||
// On W25Q080, the four LSBs are don't care, and if MSBs == 0xa, the
|
||||
// next read does not require the 0xeb instruction prefix.
|
||||
#define MODE_CONTINUOUS_READ 0xa0
|
||||
|
||||
// The number of address + mode bits, divided by 4 (always 4, not function of
|
||||
// interface width).
|
||||
#define ADDR_L 8
|
||||
|
||||
// How many clocks of Hi-Z following the mode bits. For W25Q080, 4 dummy cycles
|
||||
// are required.
|
||||
#define WAIT_CYCLES 4
|
||||
|
||||
// If defined, we will read status reg, compare to SREG_DATA, and overwrite
|
||||
// with our value if the SR doesn't match.
|
||||
// This isn't great because it will remove block protections.
|
||||
// A better solution is to use a volatile SR write if your device supports it.
|
||||
#define PROGRAM_STATUS_REG
|
||||
|
||||
#define CMD_WRITE_ENABLE 0x06
|
||||
#define CMD_READ_STATUS 0x05
|
||||
#define CMD_WRITE_STATUS 0x01
|
||||
#define SREG_DATA 0x40 // Enable quad-SPI mode
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Start of 2nd Stage Boot Code
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
.cpu cortex-m0
|
||||
.thumb
|
||||
|
||||
.section .text
|
||||
|
||||
.global _stage2_boot
|
||||
.type _stage2_boot,%function
|
||||
.thumb_func
|
||||
_stage2_boot:
|
||||
push {lr}
|
||||
|
||||
ldr r3, =XIP_SSI_BASE // Use as base address where possible
|
||||
|
||||
// Disable SSI to allow further config
|
||||
mov r1, #0
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET]
|
||||
|
||||
// Set baud rate
|
||||
mov r1, #PICO_FLASH_SPI_CLKDIV
|
||||
str r1, [r3, #SSI_BAUDR_OFFSET]
|
||||
|
||||
// On QSPI parts we usually need a 01h SR-write command to enable QSPI mode
|
||||
// (i.e. turn WPn and HOLDn into IO2/IO3)
|
||||
#ifdef PROGRAM_STATUS_REG
|
||||
program_sregs:
|
||||
#define CTRL0_SPI_TXRX \
|
||||
(7 << SSI_CTRLR0_DFS_32_LSB) | /* 8 bits per data frame */ \
|
||||
(SSI_CTRLR0_TMOD_VALUE_TX_AND_RX << SSI_CTRLR0_TMOD_LSB)
|
||||
|
||||
ldr r1, =(CTRL0_SPI_TXRX)
|
||||
str r1, [r3, #SSI_CTRLR0_OFFSET]
|
||||
|
||||
// Enable SSI and select slave 0
|
||||
mov r1, #1
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET]
|
||||
|
||||
// Check whether SR needs updating
|
||||
ldr r0, =CMD_READ_STATUS
|
||||
bl read_flash_sreg
|
||||
ldr r2, =SREG_DATA
|
||||
cmp r0, r2
|
||||
beq skip_sreg_programming
|
||||
|
||||
// Send write enable command
|
||||
mov r1, #CMD_WRITE_ENABLE
|
||||
str r1, [r3, #SSI_DR0_OFFSET]
|
||||
|
||||
// Poll for completion and discard RX
|
||||
bl wait_ssi_ready
|
||||
ldr r1, [r3, #SSI_DR0_OFFSET]
|
||||
|
||||
// Send status write command followed by data bytes
|
||||
mov r1, #CMD_WRITE_STATUS
|
||||
str r1, [r3, #SSI_DR0_OFFSET]
|
||||
mov r0, #0
|
||||
str r2, [r3, #SSI_DR0_OFFSET]
|
||||
|
||||
bl wait_ssi_ready
|
||||
ldr r1, [r3, #SSI_DR0_OFFSET]
|
||||
ldr r1, [r3, #SSI_DR0_OFFSET]
|
||||
|
||||
// Poll status register for write completion
|
||||
1:
|
||||
ldr r0, =CMD_READ_STATUS
|
||||
bl read_flash_sreg
|
||||
mov r1, #1
|
||||
tst r0, r1
|
||||
bne 1b
|
||||
|
||||
skip_sreg_programming:
|
||||
|
||||
// Send a 0xA3 high-performance-mode instruction
|
||||
// ldr r1, =0xa3
|
||||
// str r1, [r3, #SSI_DR0_OFFSET]
|
||||
// bl wait_ssi_ready
|
||||
|
||||
// Disable SSI again so that it can be reconfigured
|
||||
mov r1, #0
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET]
|
||||
#endif
|
||||
|
||||
|
||||
// First we need to send the initial command to get us in to Fast Read Quad I/O
|
||||
// mode. As this transaction requires a command, we can't send it in XIP mode.
|
||||
// To enter Continuous Read mode as well we need to append 4'b0010 to the address
|
||||
// bits and then add a further 4 don't care bits. We will construct this by
|
||||
// specifying a 28-bit address, with the least significant bits being 4'b0010.
|
||||
// This is just a dummy transaction so we'll perform a read from address zero
|
||||
// and then discard what comes back. All we really care about is that at the
|
||||
// end of the transaction, the flash device is in Continuous Read mode
|
||||
// and from then on will only expect to receive addresses.
|
||||
dummy_read:
|
||||
#define CTRLR0_ENTER_XIP \
|
||||
(FRAME_FORMAT /* Quad I/O mode */ \
|
||||
<< SSI_CTRLR0_SPI_FRF_LSB) | \
|
||||
(31 << SSI_CTRLR0_DFS_32_LSB) | /* 32 data bits */ \
|
||||
(SSI_CTRLR0_TMOD_VALUE_EEPROM_READ /* Send INST/ADDR, Receive Data */ \
|
||||
<< SSI_CTRLR0_TMOD_LSB)
|
||||
|
||||
ldr r1, =(CTRLR0_ENTER_XIP)
|
||||
str r1, [r3, #SSI_CTRLR0_OFFSET]
|
||||
|
||||
mov r1, #0x0 // NDF=0 (single 32b read)
|
||||
str r1, [r3, #SSI_CTRLR1_OFFSET]
|
||||
|
||||
#define SPI_CTRLR0_ENTER_XIP \
|
||||
(ADDR_L << SSI_SPI_CTRLR0_ADDR_L_LSB) | /* Address + mode bits */ \
|
||||
(WAIT_CYCLES << SSI_SPI_CTRLR0_WAIT_CYCLES_LSB) | /* Hi-Z dummy clocks following address + mode */ \
|
||||
(SSI_SPI_CTRLR0_INST_L_VALUE_8B \
|
||||
<< SSI_SPI_CTRLR0_INST_L_LSB) | /* 8-bit instruction */ \
|
||||
(SSI_SPI_CTRLR0_TRANS_TYPE_VALUE_1C2A /* Send Command in serial mode then address in Quad I/O mode */ \
|
||||
<< SSI_SPI_CTRLR0_TRANS_TYPE_LSB)
|
||||
|
||||
ldr r1, =(SPI_CTRLR0_ENTER_XIP)
|
||||
ldr r0, =(XIP_SSI_BASE + SSI_SPI_CTRLR0_OFFSET) // SPI_CTRL0 Register
|
||||
str r1, [r0]
|
||||
|
||||
mov r1, #1 // Re-enable SSI
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET]
|
||||
|
||||
mov r1, #CMD_READ
|
||||
str r1, [r3, #SSI_DR0_OFFSET] // Push SPI command into TX FIFO
|
||||
mov r1, #MODE_CONTINUOUS_READ // 32-bit: 24 address bits (we don't care, so 0) and M[7:4]=1010
|
||||
str r1, [r3, #SSI_DR0_OFFSET] // Push Address into TX FIFO - this will trigger the transaction
|
||||
|
||||
// Poll for completion
|
||||
bl wait_ssi_ready
|
||||
|
||||
// At this point CN# will be deasserted and the SPI clock will not be running.
|
||||
// The Winbond WX25X10CL device will be in continuous read, dual I/O mode and
|
||||
// only expecting address bits after the next CN# assertion. So long as we
|
||||
// send 4'b0010 (and 4 more dummy HiZ bits) after every subsequent 24b address
|
||||
// then the Winbond device will remain in continuous read mode. This is the
|
||||
// ideal mode for Execute-In-Place.
|
||||
// (If we want to exit continuous read mode then we will need to switch back
|
||||
// to APM mode and generate a 28-bit address phase with the extra nibble set
|
||||
// to 4'b0000).
|
||||
|
||||
mov r1, #0
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET] // Disable SSI (and clear FIFO) to allow further config
|
||||
|
||||
// Note that the INST_L field is used to select what XIP data gets pushed into
|
||||
// the TX FIFO:
|
||||
// INST_L_0_BITS {ADDR[23:0],XIP_CMD[7:0]} Load "mode bits" into XIP_CMD
|
||||
// Anything else {XIP_CMD[7:0],ADDR[23:0]} Load SPI command into XIP_CMD
|
||||
configure_ssi:
|
||||
#define SPI_CTRLR0_XIP \
|
||||
(MODE_CONTINUOUS_READ /* Mode bits to keep flash in continuous read mode */ \
|
||||
<< SSI_SPI_CTRLR0_XIP_CMD_LSB) | \
|
||||
(ADDR_L << SSI_SPI_CTRLR0_ADDR_L_LSB) | /* Total number of address + mode bits */ \
|
||||
(WAIT_CYCLES << SSI_SPI_CTRLR0_WAIT_CYCLES_LSB) | /* Hi-Z dummy clocks following address + mode */ \
|
||||
(SSI_SPI_CTRLR0_INST_L_VALUE_NONE /* Do not send a command, instead send XIP_CMD as mode bits after address */ \
|
||||
<< SSI_SPI_CTRLR0_INST_L_LSB) | \
|
||||
(SSI_SPI_CTRLR0_TRANS_TYPE_VALUE_2C2A /* Send Address in Quad I/O mode (and Command but that is zero bits long) */ \
|
||||
<< SSI_SPI_CTRLR0_TRANS_TYPE_LSB)
|
||||
|
||||
ldr r1, =(SPI_CTRLR0_XIP)
|
||||
ldr r0, =(XIP_SSI_BASE + SSI_SPI_CTRLR0_OFFSET)
|
||||
str r1, [r0]
|
||||
|
||||
mov r1, #1
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET] // Re-enable SSI
|
||||
|
||||
// We are now in XIP mode, with all transactions using Dual I/O and only
|
||||
// needing to send 24-bit addresses (plus mode bits) for each read transaction.
|
||||
|
||||
// Pull in standard exit routine
|
||||
#include "boot2_helpers/exit_from_boot2.S"
|
||||
|
||||
// Common functions
|
||||
#include "boot2_helpers/wait_ssi_ready.S"
|
||||
#ifdef PROGRAM_STATUS_REG
|
||||
#include "boot2_helpers/read_flash_sreg.S"
|
||||
#endif
|
||||
|
||||
.global literals
|
||||
literals:
|
||||
.ltorg
|
||||
|
||||
.end
|
53
lib/rp2040/boot_stage2/boot2_usb_blinky.S
Normal file
53
lib/rp2040/boot_stage2/boot2_usb_blinky.S
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
// Stub second stage which calls into USB bootcode, with parameters.
|
||||
// USB boot takes two parameters:
|
||||
// - A GPIO mask for activity LED -- if mask is 0, don't touch GPIOs at all
|
||||
// - A mask of interfaces to disable. Bit 0 disables MSC, bit 1 disables PICOBoot
|
||||
// The bootrom passes 0 for both of these parameters, but user code (or this
|
||||
// second stage) can pass anything.
|
||||
|
||||
#define USB_BOOT_MSD_AND_PICOBOOT 0x0
|
||||
#define USB_BOOT_MSD_ONLY 0x2
|
||||
#define USB_BOOT_PICOBOOT_ONLY 0x1
|
||||
|
||||
// Config
|
||||
#define ACTIVITY_LED 0
|
||||
#define BOOT_MODE USB_BOOT_MSD_AND_PICOBOOT
|
||||
|
||||
.cpu cortex-m0
|
||||
.thumb
|
||||
|
||||
.section .text
|
||||
|
||||
.global _stage2_boot
|
||||
.type _stage2_boot,%function
|
||||
|
||||
.thumb_func
|
||||
_stage2_boot:
|
||||
mov r7, #0x14 // Pointer to _well_known pointer table in ROM
|
||||
ldrh r0, [r7, #0] // Offset 0 is 16 bit pointer to function table
|
||||
ldrh r7, [r7, #4] // Offset 4 is 16 bit pointer to table lookup routine
|
||||
ldr r1, =('U' | ('B' << 8)) // Symbol for USB Boot
|
||||
blx r7
|
||||
cmp r0, #0
|
||||
beq dead
|
||||
|
||||
mov r7, r0
|
||||
ldr r0, =(1u << ACTIVITY_LED) // Mask of which GPIO (or GPIOs) to use
|
||||
mov r1, #BOOT_MODE
|
||||
blx r7
|
||||
|
||||
dead:
|
||||
wfi
|
||||
b dead
|
||||
|
||||
.global literals
|
||||
literals:
|
||||
.ltorg
|
||||
|
||||
.end
|
287
lib/rp2040/boot_stage2/boot2_w25q080.S
Normal file
287
lib/rp2040/boot_stage2/boot2_w25q080.S
Normal file
@ -0,0 +1,287 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// Second stage boot code
|
||||
// Copyright (c) 2019-2021 Raspberry Pi (Trading) Ltd.
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
//
|
||||
// Device: Winbond W25Q080
|
||||
// Also supports W25Q16JV (which has some different SR instructions)
|
||||
// Also supports AT25SF081
|
||||
// Also supports S25FL132K0
|
||||
//
|
||||
// Description: Configures W25Q080 to run in Quad I/O continuous read XIP mode
|
||||
//
|
||||
// Details: * Check status register 2 to determine if QSPI mode is enabled,
|
||||
// and perform an SR2 programming cycle if necessary.
|
||||
// * Use SSI to perform a dummy 0xEB read command, with the mode
|
||||
// continuation bits set, so that the flash will not require
|
||||
// 0xEB instruction prefix on subsequent reads.
|
||||
// * Configure SSI to write address, mode bits, but no instruction.
|
||||
// SSI + flash are now jointly in a state where continuous reads
|
||||
// can take place.
|
||||
// * Jump to exit pointer passed in via lr. Bootrom passes null,
|
||||
// in which case this code uses a default 256 byte flash offset
|
||||
//
|
||||
// Building: * This code must be position-independent, and use stack only
|
||||
// * The code will be padded to a size of 256 bytes, including a
|
||||
// 4-byte checksum. Therefore code size cannot exceed 252 bytes.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
//#include "pico/asm_helper.S"
|
||||
#include "hardware/regs/addressmap.h"
|
||||
#include "hardware/regs/ssi.h"
|
||||
#include "hardware/regs/pads_qspi.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Config section
|
||||
// ----------------------------------------------------------------------------
|
||||
// It should be possible to support most flash devices by modifying this section
|
||||
|
||||
// The serial flash interface will run at clk_sys/PICO_FLASH_SPI_CLKDIV.
|
||||
// This must be a positive, even integer.
|
||||
// The bootrom is very conservative with SPI frequency, but here we should be
|
||||
// as aggressive as possible.
|
||||
|
||||
#ifndef PICO_FLASH_SPI_CLKDIV
|
||||
#define PICO_FLASH_SPI_CLKDIV 4
|
||||
#endif
|
||||
#if PICO_FLASH_SPI_CLKDIV & 1
|
||||
#error PICO_FLASH_SPI_CLKDIV must be even
|
||||
#endif
|
||||
|
||||
// Define interface width: single/dual/quad IO
|
||||
#define FRAME_FORMAT SSI_CTRLR0_SPI_FRF_VALUE_QUAD
|
||||
|
||||
// For W25Q080 this is the "Read data fast quad IO" instruction:
|
||||
#define CMD_READ 0xeb
|
||||
|
||||
// "Mode bits" are 8 special bits sent immediately after
|
||||
// the address bits in a "Read Data Fast Quad I/O" command sequence.
|
||||
// On W25Q080, the four LSBs are don't care, and if MSBs == 0xa, the
|
||||
// next read does not require the 0xeb instruction prefix.
|
||||
#define MODE_CONTINUOUS_READ 0xa0
|
||||
|
||||
// The number of address + mode bits, divided by 4 (always 4, not function of
|
||||
// interface width).
|
||||
#define ADDR_L 8
|
||||
|
||||
// How many clocks of Hi-Z following the mode bits. For W25Q080, 4 dummy cycles
|
||||
// are required.
|
||||
#define WAIT_CYCLES 4
|
||||
|
||||
// If defined, we will read status reg, compare to SREG_DATA, and overwrite
|
||||
// with our value if the SR doesn't match.
|
||||
// We do a two-byte write to SR1 (01h cmd) rather than a one-byte write to
|
||||
// SR2 (31h cmd) as the latter command isn't supported by WX25Q080.
|
||||
// This isn't great because it will remove block protections.
|
||||
// A better solution is to use a volatile SR write if your device supports it.
|
||||
#define PROGRAM_STATUS_REG
|
||||
|
||||
#define CMD_WRITE_ENABLE 0x06
|
||||
#define CMD_READ_STATUS 0x05
|
||||
#define CMD_READ_STATUS2 0x35
|
||||
#define CMD_WRITE_STATUS 0x01
|
||||
#define SREG_DATA 0x02 // Enable quad-SPI mode
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Start of 2nd Stage Boot Code
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
.syntax unified
|
||||
.cpu cortex-m0plus
|
||||
.thumb
|
||||
|
||||
.section .text
|
||||
|
||||
// The exit point is passed in lr. If entered from bootrom, this will be the
|
||||
// flash address immediately following this second stage (0x10000100).
|
||||
// Otherwise it will be a return address -- second stage being called as a
|
||||
// function by user code, after copying out of XIP region. r3 holds SSI base,
|
||||
// r0...2 used as temporaries. Other GPRs not used.
|
||||
.global _stage2_boot
|
||||
.type _stage2_boot,%function
|
||||
.thumb_func
|
||||
_stage2_boot:
|
||||
push {lr}
|
||||
|
||||
// Set pad configuration:
|
||||
// - SCLK 8mA drive, no slew limiting
|
||||
// - SDx disable input Schmitt to reduce delay
|
||||
|
||||
ldr r3, =PADS_QSPI_BASE
|
||||
movs r0, #(2 << PADS_QSPI_GPIO_QSPI_SCLK_DRIVE_LSB | PADS_QSPI_GPIO_QSPI_SCLK_SLEWFAST_BITS)
|
||||
str r0, [r3, #PADS_QSPI_GPIO_QSPI_SCLK_OFFSET]
|
||||
ldr r0, [r3, #PADS_QSPI_GPIO_QSPI_SD0_OFFSET]
|
||||
movs r1, #PADS_QSPI_GPIO_QSPI_SD0_SCHMITT_BITS
|
||||
bics r0, r1
|
||||
str r0, [r3, #PADS_QSPI_GPIO_QSPI_SD0_OFFSET]
|
||||
str r0, [r3, #PADS_QSPI_GPIO_QSPI_SD1_OFFSET]
|
||||
str r0, [r3, #PADS_QSPI_GPIO_QSPI_SD2_OFFSET]
|
||||
str r0, [r3, #PADS_QSPI_GPIO_QSPI_SD3_OFFSET]
|
||||
|
||||
ldr r3, =XIP_SSI_BASE
|
||||
|
||||
// Disable SSI to allow further config
|
||||
movs r1, #0
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET]
|
||||
|
||||
// Set baud rate
|
||||
movs r1, #PICO_FLASH_SPI_CLKDIV
|
||||
str r1, [r3, #SSI_BAUDR_OFFSET]
|
||||
|
||||
// Set 1-cycle sample delay. If PICO_FLASH_SPI_CLKDIV == 2 then this means,
|
||||
// if the flash launches data on SCLK posedge, we capture it at the time that
|
||||
// the next SCLK posedge is launched. This is shortly before that posedge
|
||||
// arrives at the flash, so data hold time should be ok. For
|
||||
// PICO_FLASH_SPI_CLKDIV > 2 this pretty much has no effect.
|
||||
|
||||
movs r1, #1
|
||||
movs r2, #SSI_RX_SAMPLE_DLY_OFFSET // == 0xf0 so need 8 bits of offset significance
|
||||
str r1, [r3, r2]
|
||||
|
||||
|
||||
// On QSPI parts we usually need a 01h SR-write command to enable QSPI mode
|
||||
// (i.e. turn WPn and HOLDn into IO2/IO3)
|
||||
#ifdef PROGRAM_STATUS_REG
|
||||
program_sregs:
|
||||
#define CTRL0_SPI_TXRX \
|
||||
(7 << SSI_CTRLR0_DFS_32_LSB) | /* 8 bits per data frame */ \
|
||||
(SSI_CTRLR0_TMOD_VALUE_TX_AND_RX << SSI_CTRLR0_TMOD_LSB)
|
||||
|
||||
ldr r1, =(CTRL0_SPI_TXRX)
|
||||
str r1, [r3, #SSI_CTRLR0_OFFSET]
|
||||
|
||||
// Enable SSI and select slave 0
|
||||
movs r1, #1
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET]
|
||||
|
||||
// Check whether SR needs updating
|
||||
movs r0, #CMD_READ_STATUS2
|
||||
bl read_flash_sreg
|
||||
movs r2, #SREG_DATA
|
||||
cmp r0, r2
|
||||
beq skip_sreg_programming
|
||||
|
||||
// Send write enable command
|
||||
movs r1, #CMD_WRITE_ENABLE
|
||||
str r1, [r3, #SSI_DR0_OFFSET]
|
||||
|
||||
// Poll for completion and discard RX
|
||||
bl wait_ssi_ready
|
||||
ldr r1, [r3, #SSI_DR0_OFFSET]
|
||||
|
||||
// Send status write command followed by data bytes
|
||||
movs r1, #CMD_WRITE_STATUS
|
||||
str r1, [r3, #SSI_DR0_OFFSET]
|
||||
movs r0, #0
|
||||
str r0, [r3, #SSI_DR0_OFFSET]
|
||||
str r2, [r3, #SSI_DR0_OFFSET]
|
||||
|
||||
bl wait_ssi_ready
|
||||
ldr r1, [r3, #SSI_DR0_OFFSET]
|
||||
ldr r1, [r3, #SSI_DR0_OFFSET]
|
||||
ldr r1, [r3, #SSI_DR0_OFFSET]
|
||||
|
||||
// Poll status register for write completion
|
||||
1:
|
||||
movs r0, #CMD_READ_STATUS
|
||||
bl read_flash_sreg
|
||||
movs r1, #1
|
||||
tst r0, r1
|
||||
bne 1b
|
||||
|
||||
skip_sreg_programming:
|
||||
|
||||
// Disable SSI again so that it can be reconfigured
|
||||
movs r1, #0
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET]
|
||||
#endif
|
||||
|
||||
// Currently the flash expects an 8 bit serial command prefix on every
|
||||
// transfer, which is a waste of cycles. Perform a dummy Fast Read Quad I/O
|
||||
// command, with mode bits set such that the flash will not expect a serial
|
||||
// command prefix on *subsequent* transfers. We don't care about the results
|
||||
// of the read, the important part is the mode bits.
|
||||
|
||||
dummy_read:
|
||||
#define CTRLR0_ENTER_XIP \
|
||||
(FRAME_FORMAT /* Quad I/O mode */ \
|
||||
<< SSI_CTRLR0_SPI_FRF_LSB) | \
|
||||
(31 << SSI_CTRLR0_DFS_32_LSB) | /* 32 data bits */ \
|
||||
(SSI_CTRLR0_TMOD_VALUE_EEPROM_READ /* Send INST/ADDR, Receive Data */ \
|
||||
<< SSI_CTRLR0_TMOD_LSB)
|
||||
|
||||
ldr r1, =(CTRLR0_ENTER_XIP)
|
||||
str r1, [r3, #SSI_CTRLR0_OFFSET]
|
||||
|
||||
movs r1, #0x0 // NDF=0 (single 32b read)
|
||||
str r1, [r3, #SSI_CTRLR1_OFFSET]
|
||||
|
||||
#define SPI_CTRLR0_ENTER_XIP \
|
||||
(ADDR_L << SSI_SPI_CTRLR0_ADDR_L_LSB) | /* Address + mode bits */ \
|
||||
(WAIT_CYCLES << SSI_SPI_CTRLR0_WAIT_CYCLES_LSB) | /* Hi-Z dummy clocks following address + mode */ \
|
||||
(SSI_SPI_CTRLR0_INST_L_VALUE_8B \
|
||||
<< SSI_SPI_CTRLR0_INST_L_LSB) | /* 8-bit instruction */ \
|
||||
(SSI_SPI_CTRLR0_TRANS_TYPE_VALUE_1C2A /* Send Command in serial mode then address in Quad I/O mode */ \
|
||||
<< SSI_SPI_CTRLR0_TRANS_TYPE_LSB)
|
||||
|
||||
ldr r1, =(SPI_CTRLR0_ENTER_XIP)
|
||||
ldr r0, =(XIP_SSI_BASE + SSI_SPI_CTRLR0_OFFSET) // SPI_CTRL0 Register
|
||||
str r1, [r0]
|
||||
|
||||
movs r1, #1 // Re-enable SSI
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET]
|
||||
|
||||
movs r1, #CMD_READ
|
||||
str r1, [r3, #SSI_DR0_OFFSET] // Push SPI command into TX FIFO
|
||||
movs r1, #MODE_CONTINUOUS_READ // 32-bit: 24 address bits (we don't care, so 0) and M[7:4]=1010
|
||||
str r1, [r3, #SSI_DR0_OFFSET] // Push Address into TX FIFO - this will trigger the transaction
|
||||
|
||||
// Poll for completion
|
||||
bl wait_ssi_ready
|
||||
|
||||
// The flash is in a state where we can blast addresses in parallel, and get
|
||||
// parallel data back. Now configure the SSI to translate XIP bus accesses
|
||||
// into QSPI transfers of this form.
|
||||
|
||||
movs r1, #0
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET] // Disable SSI (and clear FIFO) to allow further config
|
||||
|
||||
// Note that the INST_L field is used to select what XIP data gets pushed into
|
||||
// the TX FIFO:
|
||||
// INST_L_0_BITS {ADDR[23:0],XIP_CMD[7:0]} Load "mode bits" into XIP_CMD
|
||||
// Anything else {XIP_CMD[7:0],ADDR[23:0]} Load SPI command into XIP_CMD
|
||||
configure_ssi:
|
||||
#define SPI_CTRLR0_XIP \
|
||||
(MODE_CONTINUOUS_READ /* Mode bits to keep flash in continuous read mode */ \
|
||||
<< SSI_SPI_CTRLR0_XIP_CMD_LSB) | \
|
||||
(ADDR_L << SSI_SPI_CTRLR0_ADDR_L_LSB) | /* Total number of address + mode bits */ \
|
||||
(WAIT_CYCLES << SSI_SPI_CTRLR0_WAIT_CYCLES_LSB) | /* Hi-Z dummy clocks following address + mode */ \
|
||||
(SSI_SPI_CTRLR0_INST_L_VALUE_NONE /* Do not send a command, instead send XIP_CMD as mode bits after address */ \
|
||||
<< SSI_SPI_CTRLR0_INST_L_LSB) | \
|
||||
(SSI_SPI_CTRLR0_TRANS_TYPE_VALUE_2C2A /* Send Address in Quad I/O mode (and Command but that is zero bits long) */ \
|
||||
<< SSI_SPI_CTRLR0_TRANS_TYPE_LSB)
|
||||
|
||||
ldr r1, =(SPI_CTRLR0_XIP)
|
||||
ldr r0, =(XIP_SSI_BASE + SSI_SPI_CTRLR0_OFFSET)
|
||||
str r1, [r0]
|
||||
|
||||
movs r1, #1
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET] // Re-enable SSI
|
||||
|
||||
// Bus accesses to the XIP window will now be transparently serviced by the
|
||||
// external flash on cache miss. We are ready to run code from flash.
|
||||
|
||||
// Pull in standard exit routine
|
||||
#include "boot2_helpers/exit_from_boot2.S"
|
||||
|
||||
// Common functions
|
||||
#include "boot2_helpers/wait_ssi_ready.S"
|
||||
#ifdef PROGRAM_STATUS_REG
|
||||
#include "boot2_helpers/read_flash_sreg.S"
|
||||
#endif
|
||||
|
||||
.global literals
|
||||
literals:
|
||||
.ltorg
|
||||
|
||||
.end
|
196
lib/rp2040/boot_stage2/boot2_w25x10cl.S
Normal file
196
lib/rp2040/boot_stage2/boot2_w25x10cl.S
Normal file
@ -0,0 +1,196 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// Second stage boot code
|
||||
// Copyright (c) 2019-2021 Raspberry Pi (Trading) Ltd.
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
//
|
||||
// Device: Winbond W25X10CL
|
||||
//
|
||||
// Description: Configures W25X10CL to run in Dual I/O continuous read XIP mode
|
||||
//
|
||||
// Details: * Disable SSI
|
||||
// * Configure SSI to generate 8b command + 28b address + 2 wait,
|
||||
// with address and data using dual SPI mode
|
||||
// * Enable SSI
|
||||
// * Generate dummy read with command = 0xBB, top 24b of address
|
||||
// of 0x000000 followed by M[7:0]=0010zzzz (with the HiZ being
|
||||
// generated by 2 wait cycles). This leaves the W25X10CL in
|
||||
// continuous read mode
|
||||
// * Disable SSI
|
||||
// * Configure SSI to generate 0b command + 28b address + 2 wait,
|
||||
// with the extra 4 bits of address LSB being 0x2 to keep the
|
||||
// W25X10CL in continuous read mode forever
|
||||
// * Enable SSI
|
||||
// * Set VTOR = 0x10000100
|
||||
// * Read MSP reset vector from 0x10000100 and write to MSP (this
|
||||
// will also enable XIP mode in the SSI wrapper)
|
||||
// * Read PC reset vector from 0x10000104 and jump to it
|
||||
//
|
||||
// Building: * This code must be linked to run at 0x20000000
|
||||
// * The code will be padded to a size of 256 bytes, including a
|
||||
// 4-byte checksum. Therefore code size cannot exceed 252 bytes.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "pico/asm_helper.S"
|
||||
#include "hardware/regs/addressmap.h"
|
||||
#include "hardware/regs/ssi.h"
|
||||
|
||||
// The serial flash interface will run at clk_sys/PICO_FLASH_SPI_CLKDIV.
|
||||
// This must be an even number.
|
||||
#ifndef PICO_FLASH_SPI_CLKDIV
|
||||
#define PICO_FLASH_SPI_CLKDIV 4
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// The "System Control Block" is a set of internal Cortex-M0+ control registers
|
||||
// that are memory mapped and accessed like any other H/W register. They have
|
||||
// fixed addresses in the address map of every Cortex-M0+ system.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
.equ SCB_VTOR, 0xE000ED08 // RW Vector Table Offset Register
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Winbond W25X10CL Supported Commands
|
||||
// Taken from "w25x10cl_reg_021714.pdf"
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
.equ W25X10CL_CMD_READ_DATA_FAST_DUAL_IO, 0xbb
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Winbond W25X10CL "Mode bits" are 8 special bits sent immediately after
|
||||
// the address bits in a "Read Data Fast Dual I/O" command sequence.
|
||||
// Of M[7:4], they say M[7:6] are reserved (set to zero), and bits M[3:0]
|
||||
// are don't care (we HiZ). Only M[5:4] are used, and they must be set
|
||||
// to M[5:4] = 2'b10 to enable continuous read mode.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
.equ W25X10CL_MODE_CONTINUOUS_READ, 0x20
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Start of 2nd Stage Boot Code
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
.cpu cortex-m0
|
||||
.thumb
|
||||
|
||||
.org 0
|
||||
|
||||
.section .text
|
||||
|
||||
// This code will get copied to 0x20000000 and then executed
|
||||
|
||||
.global _stage2_boot
|
||||
.type _stage2_boot,%function
|
||||
.thumb_func
|
||||
_stage2_boot:
|
||||
push {lr}
|
||||
ldr r3, =XIP_SSI_BASE // Use as base address where possible
|
||||
|
||||
// We are primarily interested in setting up Flash for DSPI XIP w/ continuous read
|
||||
|
||||
mov r1, #0
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET] // Disable SSI to allow further config
|
||||
|
||||
// The Boot ROM sets a very conservative SPI clock frequency to be sure it can
|
||||
// read the initial 256 bytes from any device. Here we can be more aggressive.
|
||||
|
||||
mov r1, #PICO_FLASH_SPI_CLKDIV
|
||||
str r1, [r3, #SSI_BAUDR_OFFSET] // Set SSI Clock
|
||||
|
||||
// First we need to send the initial command to get us in to Fast Read Dual I/O
|
||||
// mode. As this transaction requires a command, we can't send it in XIP mode.
|
||||
// To enter Continuous Read mode as well we need to append 4'b0010 to the address
|
||||
// bits and then add a further 4 don't care bits. We will construct this by
|
||||
// specifying a 28-bit address, with the least significant bits being 4'b0010.
|
||||
// This is just a dummy transaction so we'll perform a read from address zero
|
||||
// and then discard what comes back. All we really care about is that at the
|
||||
// end of the transaction, the Winbond W25X10CL device is in Continuous Read mode
|
||||
// and from then on will only expect to receive addresses.
|
||||
|
||||
#define CTRLR0_ENTER_XIP \
|
||||
(SSI_CTRLR0_SPI_FRF_VALUE_DUAL /* Dual I/O mode */ \
|
||||
<< SSI_CTRLR0_SPI_FRF_LSB) | \
|
||||
(31 << SSI_CTRLR0_DFS_32_LSB) | /* 32 data bits */ \
|
||||
(SSI_CTRLR0_TMOD_VALUE_EEPROM_READ /* Send INST/ADDR, Receive Data */ \
|
||||
<< SSI_CTRLR0_TMOD_LSB)
|
||||
|
||||
ldr r1, =(CTRLR0_ENTER_XIP)
|
||||
str r1, [r3, #SSI_CTRLR0_OFFSET]
|
||||
|
||||
mov r1, #0x0 // NDF=0 (single 32b read)
|
||||
str r1, [r3, #SSI_CTRLR1_OFFSET]
|
||||
|
||||
#define SPI_CTRLR0_ENTER_XIP \
|
||||
(7 << SSI_SPI_CTRLR0_ADDR_L_LSB) | /* Send 28 bits (24 address + 4 mode) */ \
|
||||
(2 << SSI_SPI_CTRLR0_WAIT_CYCLES_LSB) | /* Hi-Z the other 4 mode bits (2 cycles @ dual I/O = 4 bits) */ \
|
||||
(SSI_SPI_CTRLR0_INST_L_VALUE_8B \
|
||||
<< SSI_SPI_CTRLR0_INST_L_LSB) | /* 8-bit instruction */ \
|
||||
(SSI_SPI_CTRLR0_TRANS_TYPE_VALUE_1C2A /* Send Command in serial mode then address in Dual I/O mode */ \
|
||||
<< SSI_SPI_CTRLR0_TRANS_TYPE_LSB)
|
||||
|
||||
ldr r1, =(SPI_CTRLR0_ENTER_XIP)
|
||||
ldr r0, =(XIP_SSI_BASE + SSI_SPI_CTRLR0_OFFSET) // SPI_CTRL0 Register
|
||||
str r1, [r0]
|
||||
|
||||
mov r1, #1 // Re-enable SSI
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET]
|
||||
|
||||
mov r1, #W25X10CL_CMD_READ_DATA_FAST_DUAL_IO // 8b command = 0xBB
|
||||
str r1, [r3, #SSI_DR0_OFFSET] // Push SPI command into TX FIFO
|
||||
mov r1, #0x0000002 // 28-bit Address for dummy read = 0x000000 + 0x2 Mode bits to set M[5:4]=10
|
||||
str r1, [r3, #SSI_DR0_OFFSET] // Push Address into TX FIFO - this will trigger the transaction
|
||||
|
||||
// Now we wait for the read transaction to complete by monitoring the SSI
|
||||
// status register and checking for the "RX FIFO Not Empty" flag to assert.
|
||||
|
||||
mov r1, #SSI_SR_RFNE_BITS
|
||||
00:
|
||||
ldr r0, [r3, #SSI_SR_OFFSET] // Read status register
|
||||
tst r0, r1 // RFNE status flag set?
|
||||
beq 00b // If not then wait
|
||||
|
||||
// At this point CN# will be deasserted and the SPI clock will not be running.
|
||||
// The Winbond WX25X10CL device will be in continuous read, dual I/O mode and
|
||||
// only expecting address bits after the next CN# assertion. So long as we
|
||||
// send 4'b0010 (and 4 more dummy HiZ bits) after every subsequent 24b address
|
||||
// then the Winbond device will remain in continuous read mode. This is the
|
||||
// ideal mode for Execute-In-Place.
|
||||
// (If we want to exit continuous read mode then we will need to switch back
|
||||
// to APM mode and generate a 28-bit address phase with the extra nibble set
|
||||
// to 4'b0000).
|
||||
|
||||
mov r1, #0
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET] // Disable SSI (and clear FIFO) to allow further config
|
||||
|
||||
// Note that the INST_L field is used to select what XIP data gets pushed into
|
||||
// the TX FIFO:
|
||||
// INST_L_0_BITS {ADDR[23:0],XIP_CMD[7:0]} Load "mode bits" into XIP_CMD
|
||||
// Anything else {XIP_CMD[7:0],ADDR[23:0]} Load SPI command into XIP_CMD
|
||||
|
||||
#define SPI_CTRLR0_XIP \
|
||||
(W25X10CL_MODE_CONTINUOUS_READ /* Mode bits to keep Winbond in continuous read mode */ \
|
||||
<< SSI_SPI_CTRLR0_XIP_CMD_LSB) | \
|
||||
(7 << SSI_SPI_CTRLR0_ADDR_L_LSB) | /* Send 28 bits (24 address + 4 mode) */ \
|
||||
(2 << SSI_SPI_CTRLR0_WAIT_CYCLES_LSB) | /* Hi-Z the other 4 mode bits (2 cycles @ dual I/O = 4 bits) */ \
|
||||
(SSI_SPI_CTRLR0_INST_L_VALUE_NONE /* Do not send a command, instead send XIP_CMD as mode bits after address */ \
|
||||
<< SSI_SPI_CTRLR0_INST_L_LSB) | \
|
||||
(SSI_SPI_CTRLR0_TRANS_TYPE_VALUE_2C2A /* Send Address in Dual I/O mode (and Command but that is zero bits long) */ \
|
||||
<< SSI_SPI_CTRLR0_TRANS_TYPE_LSB)
|
||||
|
||||
ldr r1, =(SPI_CTRLR0_XIP)
|
||||
ldr r0, =(XIP_SSI_BASE + SSI_SPI_CTRLR0_OFFSET)
|
||||
str r1, [r0]
|
||||
|
||||
mov r1, #1
|
||||
str r1, [r3, #SSI_SSIENR_OFFSET] // Re-enable SSI
|
||||
|
||||
// We are now in XIP mode, with all transactions using Dual I/O and only
|
||||
// needing to send 24-bit addresses (plus mode bits) for each read transaction.
|
||||
|
||||
// Pull in standard exit routine
|
||||
#include "boot2_helpers/exit_from_boot2.S"
|
||||
|
||||
.global literals
|
||||
literals:
|
||||
.ltorg
|
||||
|
||||
.end
|
13
lib/rp2040/boot_stage2/boot_stage2.ld
Normal file
13
lib/rp2040/boot_stage2/boot_stage2.ld
Normal file
@ -0,0 +1,13 @@
|
||||
MEMORY {
|
||||
/* We are loaded to the top 256 bytes of SRAM, which is above the bootrom
|
||||
stack. Note 4 bytes occupied by checksum. */
|
||||
SRAM(rx) : ORIGIN = 0x20041f00, LENGTH = 252
|
||||
}
|
||||
|
||||
SECTIONS {
|
||||
. = ORIGIN(SRAM);
|
||||
.text : {
|
||||
*(.entry)
|
||||
*(.text)
|
||||
} >SRAM
|
||||
}
|
19
lib/rp2040/boot_stage2/compile_time_choice.S
Normal file
19
lib/rp2040/boot_stage2/compile_time_choice.S
Normal file
@ -0,0 +1,19 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// Second stage boot code
|
||||
// Copyright (c) 2019-2021 Raspberry Pi (Trading) Ltd.
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// This implementation uses the PICO_BOOT_STAGE2_CHOOSE_ preprocessor defines to pick
|
||||
// amongst a menu of known boot stage 2 implementations, allowing the board
|
||||
// configuration header to be able to specify the boot stage 2
|
||||
|
||||
#include "boot_stage2/config.h"
|
||||
|
||||
#ifdef PICO_BUILD_BOOT_STAGE2_NAME
|
||||
// boot stage 2 is configured by cmake, so use the name specified there
|
||||
#error PICO_BUILD_BOOT_STAGE2_NAME should not be defined for compile_time_choice builds
|
||||
#else
|
||||
// boot stage 2 is selected by board config header, and PICO_BOOT_STAGE2_ASM is set in boot_stage2/config.h
|
||||
#include PICO_BOOT_STAGE2_ASM
|
||||
#endif
|
4
lib/rp2040/boot_stage2/doc.h
Normal file
4
lib/rp2040/boot_stage2/doc.h
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* \defgroup boot_stage2 boot_stage2
|
||||
* \brief Second stage boot loaders responsible for setting up external flash
|
||||
*/
|
94
lib/rp2040/boot_stage2/include/boot_stage2/config.h
Normal file
94
lib/rp2040/boot_stage2/include/boot_stage2/config.h
Normal file
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _BOOT_STAGE2_CONFIG_H_
|
||||
#define _BOOT_STAGE2_CONFIG_H_
|
||||
|
||||
// NOTE THIS HEADER IS INCLUDED FROM ASSEMBLY
|
||||
|
||||
#include "pico/config.h"
|
||||
|
||||
// PICO_CONFIG: PICO_BUILD_BOOT_STAGE2_NAME, The name of the boot stage 2 if selected by the build, group=boot_stage2
|
||||
#ifdef PICO_BUILD_BOOT_STAGE2_NAME
|
||||
#define _BOOT_STAGE2_SELECTED
|
||||
#else
|
||||
// check that multiple boot stage 2 options haven't been set...
|
||||
|
||||
// PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_IS25LP080, Select boot2_is25lp080 as the boot stage 2 when no boot stage 2 selection is made by the CMake build, type=bool, default=0, group=boot_stage2
|
||||
#ifndef PICO_BOOT_STAGE2_CHOOSE_IS25LP080
|
||||
#define PICO_BOOT_STAGE2_CHOOSE_IS25LP080 0
|
||||
#elif PICO_BOOT_STAGE2_CHOOSE_IS25LP080
|
||||
#ifdef _BOOT_STAGE2_SELECTED
|
||||
#error multiple boot stage 2 options chosen
|
||||
#endif
|
||||
#define _BOOT_STAGE2_SELECTED
|
||||
#endif
|
||||
// PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_W25Q080, Select boot2_w25q080 as the boot stage 2 when no boot stage 2 selection is made by the CMake build, type=bool, default=0, group=boot_stage2
|
||||
#ifndef PICO_BOOT_STAGE2_CHOOSE_W25Q080
|
||||
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 0
|
||||
#elif PICO_BOOT_STAGE2_CHOOSE_W25Q080
|
||||
#ifdef _BOOT_STAGE2_SELECTED
|
||||
#error multiple boot stage 2 options chosen
|
||||
#endif
|
||||
#define _BOOT_STAGE2_SELECTED
|
||||
#endif
|
||||
// PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_W25X10CL, Select boot2_w25x10cl as the boot stage 2 when no boot stage 2 selection is made by the CMake build, type=bool, default=0, group=boot_stage2
|
||||
#ifndef PICO_BOOT_STAGE2_CHOOSE_W25X10CL
|
||||
#define PICO_BOOT_STAGE2_CHOOSE_W25X10CL 0
|
||||
#elif PICO_BOOT_STAGE2_CHOOSE_W25X10CL
|
||||
#ifdef _BOOT_STAGE2_SELECTED
|
||||
#error multiple boot stage 2 options chosen
|
||||
#endif
|
||||
#define _BOOT_STAGE2_SELECTED
|
||||
#endif
|
||||
// PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_AT25SF128A, Select boot2_at25sf128a as the boot stage 2 when no boot stage 2 selection is made by the CMake build, type=bool, default=0, group=boot_stage2
|
||||
#ifndef PICO_BOOT_STAGE2_CHOOSE_AT25SF128A
|
||||
#define PICO_BOOT_STAGE2_CHOOSE_AT25SF128A 0
|
||||
#elif PICO_BOOT_STAGE2_CHOOSE_AT25SF128A
|
||||
#ifdef _BOOT_STAGE2_SELECTED
|
||||
#error multiple boot stage 2 options chosen
|
||||
#endif
|
||||
#define _BOOT_STAGE2_SELECTED
|
||||
#endif
|
||||
|
||||
// PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H, Select boot2_generic_03h as the boot stage 2 when no boot stage 2 selection is made by the CMake build, type=bool, default=1, group=boot_stage2
|
||||
#if defined(PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H) && PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H
|
||||
#ifdef _BOOT_STAGE2_SELECTED
|
||||
#error multiple boot stage 2 options chosen
|
||||
#endif
|
||||
#define _BOOT_STAGE2_SELECTED
|
||||
#endif
|
||||
|
||||
#endif // PICO_BUILD_BOOT_STAGE2_NAME
|
||||
|
||||
#ifdef PICO_BUILD_BOOT_STAGE2_NAME
|
||||
// boot stage 2 is configured by cmake, so use the name specified there
|
||||
#define PICO_BOOT_STAGE2_NAME PICO_BUILD_BOOT_STAGE2_NAME
|
||||
#else
|
||||
// boot stage 2 is selected by board config header, so we have to do some work
|
||||
#if PICO_BOOT_STAGE2_CHOOSE_IS25LP080
|
||||
#define _BOOT_STAGE2 boot2_is25lp080
|
||||
#elif PICO_BOOT_STAGE2_CHOOSE_W25Q080
|
||||
#define _BOOT_STAGE2 boot2_w25q080
|
||||
#elif PICO_BOOT_STAGE2_CHOOSE_W25X10CL
|
||||
#define _BOOT_STAGE2 boot2_w25x10cl
|
||||
#elif PICO_BOOT_STAGE2_CHOOSE_AT25SF128A
|
||||
#define _BOOT_STAGE2 boot2_at25sf128a
|
||||
#elif !defined(PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H) || PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H
|
||||
#undef PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H
|
||||
#define PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H 1
|
||||
#define _BOOT_STAGE2 boot2_generic_03h
|
||||
#else
|
||||
#error no boot stage 2 is defined by PICO_BOOT_STAGE2_CHOOSE_ macro
|
||||
#endif
|
||||
// we can't include cdefs in assembly, so define our own, but avoid conflict with real ones for c inclusion
|
||||
#define _PICO__STRING(x) #x
|
||||
#define _PICO__XSTRING(x) _PICO__STRING(x)
|
||||
#define _PICO__CONCAT1(x, y) x ## y
|
||||
#define PICO_BOOT_STAGE2_NAME _PICO__XSTRING(_BOOT_STAGE2)
|
||||
#define PICO_BOOT_STAGE2_ASM _PICO__XSTRING(_PICO__CONCAT1(_BOOT_STAGE2,.S))
|
||||
#endif
|
||||
#endif
|
55
lib/rp2040/boot_stage2/pad_checksum
Executable file
55
lib/rp2040/boot_stage2/pad_checksum
Executable file
@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import binascii
|
||||
import struct
|
||||
import sys
|
||||
|
||||
|
||||
def any_int(x):
|
||||
try:
|
||||
return int(x, 0)
|
||||
except:
|
||||
raise argparse.ArgumentTypeError("expected an integer, not '{!r}'".format(x))
|
||||
|
||||
|
||||
def bitrev(x, width):
|
||||
return int("{:0{w}b}".format(x, w=width)[::-1], 2)
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("ifile", help="Input file (binary)")
|
||||
parser.add_argument("ofile", help="Output file (assembly)")
|
||||
parser.add_argument("-p", "--pad", help="Padded size (bytes), including 4-byte checksum, default 256",
|
||||
type=any_int, default=256)
|
||||
parser.add_argument("-s", "--seed", help="Checksum seed value, default 0",
|
||||
type=any_int, default=0)
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
idata = open(args.ifile, "rb").read()
|
||||
except:
|
||||
sys.exit("Could not open input file '{}'".format(args.ifile))
|
||||
|
||||
if len(idata) >= args.pad - 4:
|
||||
sys.exit("Input file size ({} bytes) too large for final size ({} bytes)".format(len(idata), args.pad))
|
||||
|
||||
idata_padded = idata + bytes(args.pad - 4 - len(idata))
|
||||
|
||||
# Our bootrom CRC32 is slightly bass-ackward but it's best to work around for now (FIXME)
|
||||
# 100% worth it to save two Thumb instructions
|
||||
checksum = bitrev(
|
||||
(binascii.crc32(bytes(bitrev(b, 8) for b in idata_padded), args.seed ^ 0xffffffff) ^ 0xffffffff) & 0xffffffff, 32)
|
||||
odata = idata_padded + struct.pack("<L", checksum)
|
||||
|
||||
try:
|
||||
with open(args.ofile, "w") as ofile:
|
||||
ofile.write("// Padded and checksummed version of: {}\n\n".format(args.ifile))
|
||||
ofile.write(".cpu cortex-m0plus\n")
|
||||
ofile.write(".thumb\n\n")
|
||||
ofile.write(".section .boot2, \"ax\"\n\n")
|
||||
for offs in range(0, len(odata), 16):
|
||||
chunk = odata[offs:min(offs + 16, len(odata))]
|
||||
ofile.write(".byte {}\n".format(", ".join("0x{:02x}".format(b) for b in chunk)))
|
||||
except:
|
||||
sys.exit("Could not open output file '{}'".format(args.ofile))
|
109
lib/rp2040/cmsis_include/RP2040.h
Normal file
109
lib/rp2040/cmsis_include/RP2040.h
Normal file
@ -0,0 +1,109 @@
|
||||
/*************************************************************************//**
|
||||
* @file RP2040.h
|
||||
* @brief CMSIS-Core(M) Device Peripheral Access Layer Header File for
|
||||
* Device RP2040
|
||||
* @version V1.0.0
|
||||
* @date 5. May 2021
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* Copyright (c) 2009-2021 Arm Limited. All rights reserved.
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _CMSIS_RP2040_H_
|
||||
#define _CMSIS_RP2040_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* =========================================================================================================================== */
|
||||
/* ================ Interrupt Number Definition ================ */
|
||||
/* =========================================================================================================================== */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/* ======================================= ARM Cortex-M0+ Specific Interrupt Numbers ======================================= */
|
||||
Reset_IRQn = -15, /*!< -15 Reset Vector, invoked on Power up and warm reset */
|
||||
NonMaskableInt_IRQn = -14, /*!< -14 Non maskable Interrupt, cannot be stopped or preempted */
|
||||
HardFault_IRQn = -13, /*!< -13 Hard Fault, all classes of Fault */
|
||||
SVCall_IRQn = -5, /*!< -5 System Service Call via SVC instruction */
|
||||
PendSV_IRQn = -2, /*!< -2 Pendable request for system service */
|
||||
SysTick_IRQn = -1, /*!< -1 System Tick Timer */
|
||||
/* =========================================== RP2040 Specific Interrupt Numbers =========================================== */
|
||||
TIMER_IRQ_0_IRQn = 0, /*!< 0 TIMER_IRQ_0 */
|
||||
TIMER_IRQ_1_IRQn = 1, /*!< 1 TIMER_IRQ_1 */
|
||||
TIMER_IRQ_2_IRQn = 2, /*!< 2 TIMER_IRQ_2 */
|
||||
TIMER_IRQ_3_IRQn = 3, /*!< 3 TIMER_IRQ_3 */
|
||||
PWM_IRQ_WRAP_IRQn = 4, /*!< 4 PWM_IRQ_WRAP */
|
||||
USBCTRL_IRQ_IRQn = 5, /*!< 5 USBCTRL_IRQ */
|
||||
XIP_IRQ_IRQn = 6, /*!< 6 XIP_IRQ */
|
||||
PIO0_IRQ_0_IRQn = 7, /*!< 7 PIO0_IRQ_0 */
|
||||
PIO0_IRQ_1_IRQn = 8, /*!< 8 PIO0_IRQ_1 */
|
||||
PIO1_IRQ_0_IRQn = 9, /*!< 9 PIO1_IRQ_0 */
|
||||
PIO1_IRQ_1_IRQn = 10, /*!< 10 PIO1_IRQ_1 */
|
||||
DMA_IRQ_0_IRQn = 11, /*!< 11 DMA_IRQ_0 */
|
||||
DMA_IRQ_1_IRQn = 12, /*!< 12 DMA_IRQ_1 */
|
||||
IO_IRQ_BANK0_IRQn = 13, /*!< 13 IO_IRQ_BANK0 */
|
||||
IO_IRQ_QSPI_IRQn = 14, /*!< 14 IO_IRQ_QSPI */
|
||||
SIO_IRQ_PROC0_IRQn = 15, /*!< 15 SIO_IRQ_PROC0 */
|
||||
SIO_IRQ_PROC1_IRQn = 16, /*!< 16 SIO_IRQ_PROC1 */
|
||||
CLOCKS_IRQ_IRQn = 17, /*!< 17 CLOCKS_IRQ */
|
||||
SPI0_IRQ_IRQn = 18, /*!< 18 SPI0_IRQ */
|
||||
SPI1_IRQ_IRQn = 19, /*!< 19 SPI1_IRQ */
|
||||
UART0_IRQ_IRQn = 20, /*!< 20 UART0_IRQ */
|
||||
UART1_IRQ_IRQn = 21, /*!< 21 UART1_IRQ */
|
||||
ADC_IRQ_FIFO_IRQn = 22, /*!< 22 ADC_IRQ_FIFO */
|
||||
I2C0_IRQ_IRQn = 23, /*!< 23 I2C0_IRQ */
|
||||
I2C1_IRQ_IRQn = 24, /*!< 24 I2C1_IRQ */
|
||||
RTC_IRQ_IRQn = 25 /*!< 25 RTC_IRQ */
|
||||
} IRQn_Type;
|
||||
|
||||
/* =========================================================================================================================== */
|
||||
/* ================ Processor and Core Peripheral Section ================ */
|
||||
/* =========================================================================================================================== */
|
||||
|
||||
/* ========================== Configuration of the ARM Cortex-M0+ Processor and Core Peripherals =========================== */
|
||||
#define __CM0PLUS_REV 0x0001U /*!< CM0PLUS Core Revision */
|
||||
#define __NVIC_PRIO_BITS 2 /*!< Number of Bits used for Priority Levels */
|
||||
#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */
|
||||
#define __VTOR_PRESENT 1 /*!< Set to 1 if CPU supports Vector Table Offset Register */
|
||||
#define __MPU_PRESENT 1 /*!< MPU present */
|
||||
#define __FPU_PRESENT 0 /*!< FPU present */
|
||||
|
||||
/** @} */ /* End of group Configuration_of_CMSIS */
|
||||
|
||||
#include "core_cm0plus.h" /*!< ARM Cortex-M0+ processor and core peripherals */
|
||||
#include "system_RP2040.h" /*!< RP2040 System */
|
||||
|
||||
#ifndef __IM /*!< Fallback for older CMSIS versions */
|
||||
#define __IM __I
|
||||
#endif
|
||||
#ifndef __OM /*!< Fallback for older CMSIS versions */
|
||||
#define __OM __O
|
||||
#endif
|
||||
#ifndef __IOM /*!< Fallback for older CMSIS versions */
|
||||
#define __IOM __IO
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _CMSIS_RP2040_H */
|
65
lib/rp2040/cmsis_include/system_RP2040.h
Normal file
65
lib/rp2040/cmsis_include/system_RP2040.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*************************************************************************//**
|
||||
* @file system_RP2040.h
|
||||
* @brief CMSIS-Core(M) Device Peripheral Access Layer Header File for
|
||||
* Device RP2040
|
||||
* @version V1.0.0
|
||||
* @date 5. May 2021
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* Copyright (c) 2009-2021 Arm Limited. All rights reserved.
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _CMSIS_SYSTEM_RP2040_H
|
||||
#define _CMSIS_SYSTEM_RP2040_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
\brief Exception / Interrupt Handler Function Prototype
|
||||
*/
|
||||
typedef void(*VECTOR_TABLE_Type)(void);
|
||||
|
||||
/**
|
||||
\brief System Clock Frequency (Core Clock)
|
||||
*/
|
||||
extern uint32_t SystemCoreClock;
|
||||
|
||||
/**
|
||||
\brief Setup the microcontroller system.
|
||||
|
||||
Initialize the System and update the SystemCoreClock variable.
|
||||
*/
|
||||
extern void SystemInit (void);
|
||||
|
||||
|
||||
/**
|
||||
\brief Update SystemCoreClock variable.
|
||||
|
||||
Updates the SystemCoreClock with current core Clock retrieved from cpu registers.
|
||||
*/
|
||||
extern void SystemCoreClockUpdate (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _CMSIS_SYSTEM_RP2040_H */
|
60
lib/rp2040/elf2uf2/elf.h
Normal file
60
lib/rp2040/elf2uf2/elf.h
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _ELF_H
|
||||
#define _ELF_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define ELF_MAGIC 0x464c457fu
|
||||
|
||||
#define EM_ARM 0x28u
|
||||
|
||||
#define EF_ARM_ABI_FLOAT_HARD 0x00000400u
|
||||
|
||||
#define PT_LOAD 0x00000001u
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct elf_header {
|
||||
uint32_t magic;
|
||||
uint8_t arch_class;
|
||||
uint8_t endianness;
|
||||
uint8_t version;
|
||||
uint8_t abi;
|
||||
uint8_t abi_version;
|
||||
uint8_t _pad[7];
|
||||
uint16_t type;
|
||||
uint16_t machine;
|
||||
uint32_t version2;
|
||||
};
|
||||
|
||||
struct elf32_header {
|
||||
struct elf_header common;
|
||||
uint32_t entry;
|
||||
uint32_t ph_offset;
|
||||
uint32_t sh_offset;
|
||||
uint32_t flags;
|
||||
uint16_t eh_size;
|
||||
uint16_t ph_entry_size;
|
||||
uint16_t ph_num;
|
||||
uint16_t sh_entry_size;
|
||||
uint16_t sh_num;
|
||||
uint16_t sh_str_index;
|
||||
};
|
||||
|
||||
struct elf32_ph_entry {
|
||||
uint32_t type;
|
||||
uint32_t offset;
|
||||
uint32_t vaddr;
|
||||
uint32_t paddr;
|
||||
uint32_t filez;
|
||||
uint32_t memsz;
|
||||
uint32_t flags;
|
||||
uint32_t align;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
350
lib/rp2040/elf2uf2/main.cpp
Normal file
350
lib/rp2040/elf2uf2/main.cpp
Normal file
@ -0,0 +1,350 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <cstring>
|
||||
#include <cstdarg>
|
||||
#include <algorithm>
|
||||
#include "boot/uf2.h"
|
||||
#include "elf.h"
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
#define ERROR_ARGS -1
|
||||
#define ERROR_FORMAT -2
|
||||
#define ERROR_INCOMPATIBLE -3
|
||||
#define ERROR_READ_FAILED -4
|
||||
#define ERROR_WRITE_FAILED -5
|
||||
|
||||
static char error_msg[512];
|
||||
static bool verbose;
|
||||
|
||||
static int fail(int code, const char *format, ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vsnprintf(error_msg, sizeof(error_msg), format, args);
|
||||
va_end(args);
|
||||
return code;
|
||||
}
|
||||
|
||||
static int fail_read_error() {
|
||||
return fail(ERROR_READ_FAILED, "Failed to read input file");
|
||||
}
|
||||
|
||||
static int fail_write_error() {
|
||||
return fail(ERROR_WRITE_FAILED, "Failed to write output file");
|
||||
}
|
||||
|
||||
// we require 256 (as this is the page size supported by the device)
|
||||
#define LOG2_PAGE_SIZE 8u
|
||||
#define PAGE_SIZE (1u << LOG2_PAGE_SIZE)
|
||||
|
||||
struct address_range {
|
||||
enum type {
|
||||
CONTENTS, // may have contents
|
||||
NO_CONTENTS, // must be uninitialized
|
||||
IGNORE // will be ignored
|
||||
};
|
||||
address_range(uint32_t from, uint32_t to, type type) : from(from), to(to), type(type) {}
|
||||
address_range() : address_range(0, 0, IGNORE) {}
|
||||
type type;
|
||||
uint32_t to;
|
||||
uint32_t from;
|
||||
};
|
||||
|
||||
typedef std::vector<address_range> address_ranges;
|
||||
|
||||
#define MAIN_RAM_START 0x20000000u
|
||||
#define MAIN_RAM_END 0x20042000u
|
||||
#define FLASH_START 0x10000000u
|
||||
#define FLASH_END 0x15000000u
|
||||
#define XIP_SRAM_START 0x15000000u
|
||||
#define XIP_SRAM_END 0x15004000u
|
||||
#define MAIN_RAM_BANKED_START 0x21000000u
|
||||
#define MAIN_RAM_BANKED_END 0x21040000u
|
||||
|
||||
const address_ranges rp2040_address_ranges_flash {
|
||||
address_range(FLASH_START, FLASH_END, address_range::type::CONTENTS),
|
||||
address_range(MAIN_RAM_START, MAIN_RAM_END, address_range::type::NO_CONTENTS),
|
||||
address_range(MAIN_RAM_BANKED_START, MAIN_RAM_BANKED_END, address_range::type::NO_CONTENTS)
|
||||
};
|
||||
|
||||
const address_ranges rp2040_address_ranges_ram {
|
||||
address_range(MAIN_RAM_START, MAIN_RAM_END, address_range::type::CONTENTS),
|
||||
address_range(XIP_SRAM_START, XIP_SRAM_END, address_range::type::CONTENTS),
|
||||
address_range(0x00000000u, 0x00004000u, address_range::type::IGNORE) // for now we ignore the bootrom if present
|
||||
};
|
||||
|
||||
struct page_fragment {
|
||||
page_fragment(uint32_t file_offset, uint32_t page_offset, uint32_t bytes) : file_offset(file_offset), page_offset(page_offset), bytes(bytes) {}
|
||||
uint32_t file_offset;
|
||||
uint32_t page_offset;
|
||||
uint32_t bytes;
|
||||
};
|
||||
|
||||
static int usage() {
|
||||
fprintf(stderr, "Usage: elf2uf2 (-v) <input ELF file> <output UF2 file>\n");
|
||||
return ERROR_ARGS;
|
||||
}
|
||||
|
||||
static int read_and_check_elf32_header(FILE *in, elf32_header& eh_out) {
|
||||
if (1 != fread(&eh_out, sizeof(eh_out), 1, in)) {
|
||||
return fail(ERROR_READ_FAILED, "Unable to read ELF header");
|
||||
}
|
||||
if (eh_out.common.magic != ELF_MAGIC) {
|
||||
return fail(ERROR_FORMAT, "Not an ELF file");
|
||||
}
|
||||
if (eh_out.common.version != 1 || eh_out.common.version2 != 1) {
|
||||
return fail(ERROR_FORMAT, "Unrecognized ELF version");
|
||||
}
|
||||
if (eh_out.common.arch_class != 1 || eh_out.common.endianness != 1) {
|
||||
return fail(ERROR_INCOMPATIBLE, "Require 32 bit little-endian ELF");
|
||||
}
|
||||
if (eh_out.eh_size != sizeof(struct elf32_header)) {
|
||||
return fail(ERROR_FORMAT, "Invalid ELF32 format");
|
||||
}
|
||||
if (eh_out.common.machine != EM_ARM) {
|
||||
return fail(ERROR_FORMAT, "Not an ARM executable");
|
||||
}
|
||||
if (eh_out.common.abi != 0) {
|
||||
return fail(ERROR_INCOMPATIBLE, "Unrecognized ABI");
|
||||
}
|
||||
if (eh_out.flags & EF_ARM_ABI_FLOAT_HARD) {
|
||||
return fail(ERROR_INCOMPATIBLE, "HARD-FLOAT not supported");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int check_address_range(const address_ranges& valid_ranges, uint32_t addr, uint32_t vaddr, uint32_t size, bool uninitialized, address_range &ar) {
|
||||
for(const auto& range : valid_ranges) {
|
||||
if (range.from <= addr && range.to >= addr + size) {
|
||||
if (range.type == address_range::type::NO_CONTENTS && !uninitialized) {
|
||||
return fail(ERROR_INCOMPATIBLE, "ELF contains memory contents for uninitialized memory");
|
||||
}
|
||||
ar = range;
|
||||
if (verbose) {
|
||||
printf("%s segment %08x->%08x (%08x->%08x)\n", uninitialized ? "Uninitialized" : "Mapped", addr,
|
||||
addr + size, vaddr, vaddr+size);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return fail(ERROR_INCOMPATIBLE, "Memory segment %08x->%08x is outside of valid address range for device", addr, addr+size);
|
||||
}
|
||||
|
||||
int read_and_check_elf32_ph_entries(FILE *in, const elf32_header &eh, const address_ranges& valid_ranges, std::map<uint32_t, std::vector<page_fragment>>& pages) {
|
||||
if (eh.ph_entry_size != sizeof(elf32_ph_entry)) {
|
||||
return fail(ERROR_FORMAT, "Invalid ELF32 program header");
|
||||
}
|
||||
if (eh.ph_num) {
|
||||
std::vector<elf32_ph_entry> entries(eh.ph_num);
|
||||
if (eh.ph_num != fread(&entries[0], sizeof(struct elf32_ph_entry), eh.ph_num, in)) {
|
||||
return fail_read_error();
|
||||
}
|
||||
for(uint i=0;i<eh.ph_num;i++) {
|
||||
elf32_ph_entry& entry = entries[i];
|
||||
if (entry.type == PT_LOAD && entry.memsz) {
|
||||
address_range ar;
|
||||
int rc;
|
||||
uint mapped_size = std::min(entry.filez, entry.memsz);
|
||||
if (mapped_size) {
|
||||
rc = check_address_range(valid_ranges, entry.paddr, entry.vaddr, mapped_size, false, ar);
|
||||
if (rc) return rc;
|
||||
// we don't download uninitialized, generally it is BSS and should be zero-ed by crt0.S, or it may be COPY areas which are undefined
|
||||
if (ar.type != address_range::type::CONTENTS) {
|
||||
if (verbose) printf(" ignored\n");
|
||||
continue;
|
||||
}
|
||||
uint addr = entry.paddr;
|
||||
uint remaining = mapped_size;
|
||||
uint file_offset = entry.offset;
|
||||
while (remaining) {
|
||||
uint off = addr & (PAGE_SIZE - 1);
|
||||
uint len = std::min(remaining, PAGE_SIZE - off);
|
||||
auto &fragments = pages[addr - off]; // list of fragments
|
||||
// note if filesz is zero, we want zero init which is handled because the
|
||||
// statement above creates an empty page fragment list
|
||||
// check overlap with any existing fragments
|
||||
for (const auto &fragment : fragments) {
|
||||
if ((off < fragment.page_offset + fragment.bytes) !=
|
||||
((off + len) <= fragment.page_offset)) {
|
||||
fail(ERROR_FORMAT, "In memory segments overlap");
|
||||
}
|
||||
}
|
||||
fragments.push_back(
|
||||
page_fragment{file_offset,off,len});
|
||||
addr += len;
|
||||
file_offset += len;
|
||||
remaining -= len;
|
||||
}
|
||||
}
|
||||
if (entry.memsz > entry.filez) {
|
||||
// we have some uninitialized data too
|
||||
rc = check_address_range(valid_ranges, entry.paddr + entry.filez, entry.vaddr + entry.filez, entry.memsz - entry.filez, true,
|
||||
ar);
|
||||
if (rc) return rc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int realize_page(FILE *in, const std::vector<page_fragment> &fragments, uint8_t *buf, uint buf_len) {
|
||||
assert(buf_len >= PAGE_SIZE);
|
||||
for(auto& frag : fragments) {
|
||||
assert(frag.page_offset >= 0 && frag.page_offset < PAGE_SIZE && frag.page_offset + frag.bytes <= PAGE_SIZE);
|
||||
if (fseek(in, frag.file_offset, SEEK_SET)) {
|
||||
return fail_read_error();
|
||||
}
|
||||
if (1 != fread(buf + frag.page_offset, frag.bytes, 1, in)) {
|
||||
return fail_read_error();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool is_address_valid(const address_ranges& valid_ranges, uint32_t addr) {
|
||||
for(const auto& range : valid_ranges) {
|
||||
if (range.from <= addr && range.to > addr) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool is_address_initialized(const address_ranges& valid_ranges, uint32_t addr) {
|
||||
for(const auto& range : valid_ranges) {
|
||||
if (range.from <= addr && range.to > addr) {
|
||||
return address_range::type::CONTENTS == range.type;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool is_address_mapped(const std::map<uint32_t, std::vector<page_fragment>>& pages, uint32_t addr) {
|
||||
uint32_t page = addr & ~(PAGE_SIZE - 1);
|
||||
if (!pages.count(page)) return false;
|
||||
// todo check actual address within page
|
||||
return true;
|
||||
}
|
||||
|
||||
int elf2uf2(FILE *in, FILE *out) {
|
||||
elf32_header eh;
|
||||
std::map<uint32_t, std::vector<page_fragment>> pages;
|
||||
int rc = read_and_check_elf32_header(in, eh);
|
||||
bool ram_style = false;
|
||||
address_ranges valid_ranges = {};
|
||||
if (!rc) {
|
||||
ram_style = is_address_initialized(rp2040_address_ranges_ram, eh.entry);
|
||||
if (verbose) {
|
||||
if (ram_style) {
|
||||
printf("Detected RAM binary\n");
|
||||
} else {
|
||||
printf("Detected FLASH binary\n");
|
||||
}
|
||||
}
|
||||
valid_ranges = ram_style ? rp2040_address_ranges_ram : rp2040_address_ranges_flash;
|
||||
rc = read_and_check_elf32_ph_entries(in, eh, valid_ranges, pages);
|
||||
}
|
||||
if (rc) return rc;
|
||||
if (pages.empty()) {
|
||||
return fail(ERROR_INCOMPATIBLE, "The input file has no memory pages");
|
||||
}
|
||||
uint page_num = 0;
|
||||
if (ram_style) {
|
||||
uint32_t expected_ep_main_ram = UINT32_MAX;
|
||||
uint32_t expected_ep_xip_sram = UINT32_MAX;
|
||||
for(auto& page_entry : pages) {
|
||||
if ( ((page_entry.first >= MAIN_RAM_START) && (page_entry.first < MAIN_RAM_END)) && (page_entry.first < expected_ep_main_ram) ) {
|
||||
expected_ep_main_ram = page_entry.first | 0x1;
|
||||
} else if ( ((page_entry.first >= XIP_SRAM_START) && (page_entry.first < XIP_SRAM_END)) && (page_entry.first < expected_ep_xip_sram) ) {
|
||||
expected_ep_xip_sram = page_entry.first | 0x1;
|
||||
}
|
||||
}
|
||||
uint32_t expected_ep = (UINT32_MAX != expected_ep_main_ram) ? expected_ep_main_ram : expected_ep_xip_sram;
|
||||
if (eh.entry == expected_ep_xip_sram) {
|
||||
return fail(ERROR_INCOMPATIBLE, "B0/B1 Boot ROM does not support direct entry into XIP_SRAM\n");
|
||||
} else if (eh.entry != expected_ep) {
|
||||
return fail(ERROR_INCOMPATIBLE, "A RAM binary should have an entry point at the beginning: %08x (not %08x)\n", expected_ep, eh.entry);
|
||||
}
|
||||
static_assert(0 == (MAIN_RAM_START & (PAGE_SIZE - 1)), "");
|
||||
// currently don't require this as entry point is now at the start, we don't know where reset vector is
|
||||
#if 0
|
||||
uint8_t buf[PAGE_SIZE];
|
||||
rc = realize_page(in, pages[MAIN_RAM_START], buf, sizeof(buf));
|
||||
if (rc) return rc;
|
||||
uint32_t sp = ((uint32_t *)buf)[0];
|
||||
uint32_t ip = ((uint32_t *)buf)[1];
|
||||
if (!is_address_mapped(pages, ip)) {
|
||||
return fail(ERROR_INCOMPATIBLE, "Vector table at %08x is invalid: reset vector %08x is not in mapped memory",
|
||||
MAIN_RAM_START, ip);
|
||||
}
|
||||
if (!is_address_valid(valid_ranges, sp - 4)) {
|
||||
return fail(ERROR_INCOMPATIBLE, "Vector table at %08x is invalid: stack pointer %08x is not in RAM",
|
||||
MAIN_RAM_START, sp);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
uf2_block block;
|
||||
block.magic_start0 = UF2_MAGIC_START0;
|
||||
block.magic_start1 = UF2_MAGIC_START1;
|
||||
block.flags = UF2_FLAG_FAMILY_ID_PRESENT;
|
||||
block.payload_size = PAGE_SIZE;
|
||||
block.num_blocks = (uint32_t)pages.size();
|
||||
block.file_size = RP2040_FAMILY_ID;
|
||||
block.magic_end = UF2_MAGIC_END;
|
||||
for(auto& page_entry : pages) {
|
||||
block.target_addr = page_entry.first;
|
||||
block.block_no = page_num++;
|
||||
if (verbose) {
|
||||
printf("Page %d / %d %08x\n", block.block_no, block.num_blocks, block.target_addr);
|
||||
}
|
||||
memset(block.data, 0, sizeof(block.data));
|
||||
rc = realize_page(in, page_entry.second, block.data, sizeof(block.data));
|
||||
if (rc) return rc;
|
||||
if (1 != fwrite(&block, sizeof(uf2_block), 1, out)) {
|
||||
return fail_write_error();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int arg = 1;
|
||||
if (arg < argc && !strcmp(argv[arg], "-v")) {
|
||||
verbose = true;
|
||||
arg++;
|
||||
}
|
||||
if (argc < arg + 2) {
|
||||
return usage();
|
||||
}
|
||||
const char *in_filename = argv[arg++];
|
||||
FILE *in = fopen(in_filename, "rb");
|
||||
if (!in) {
|
||||
fprintf(stderr, "Can't open input file '%s'\n", in_filename);
|
||||
return ERROR_ARGS;
|
||||
}
|
||||
const char *out_filename = argv[arg++];
|
||||
FILE *out = fopen(out_filename, "wb");
|
||||
if (!out) {
|
||||
fprintf(stderr, "Can't open output file '%s'\n", out_filename);
|
||||
return ERROR_ARGS;
|
||||
}
|
||||
|
||||
int rc = elf2uf2(in, out);
|
||||
fclose(in);
|
||||
fclose(out);
|
||||
if (rc) {
|
||||
remove(out_filename);
|
||||
if (error_msg[0]) {
|
||||
fprintf(stderr, "ERROR: %s\n", error_msg);
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
133
lib/rp2040/hardware/address_mapped.h
Normal file
133
lib/rp2040/hardware/address_mapped.h
Normal file
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_ADDRESS_MAPPED_H
|
||||
#define _HARDWARE_ADDRESS_MAPPED_H
|
||||
|
||||
//#include "pico.h"
|
||||
#define __force_inline inline
|
||||
#define static_assert(a,b)
|
||||
#include "hardware/regs/addressmap.h"
|
||||
|
||||
/** \file address_mapped.h
|
||||
* \defgroup hardware_base hardware_base
|
||||
*
|
||||
* Low-level types and (atomic) accessors for memory-mapped hardware registers
|
||||
*
|
||||
* `hardware_base` defines the low level types and access functions for memory mapped hardware registers. It is included
|
||||
* by default by all other hardware libraries.
|
||||
*
|
||||
* The following register access typedefs codify the access type (read/write) and the bus size (8/16/32) of the hardware register.
|
||||
* The register type names are formed by concatenating one from each of the 3 parts A, B, C
|
||||
|
||||
* A | B | C | Meaning
|
||||
* ------|---|---|--------
|
||||
* io_ | | | A Memory mapped IO register
|
||||
* |ro_| | read-only access
|
||||
* |rw_| | read-write access
|
||||
* |wo_| | write-only access (can't actually be enforced via C API)
|
||||
* | | 8| 8-bit wide access
|
||||
* | | 16| 16-bit wide access
|
||||
* | | 32| 32-bit wide access
|
||||
*
|
||||
* When dealing with these types, you will always use a pointer, i.e. `io_rw_32 *some_reg` is a pointer to a read/write
|
||||
* 32 bit register that you can write with `*some_reg = value`, or read with `value = *some_reg`.
|
||||
*
|
||||
* RP2040 hardware is also aliased to provide atomic setting, clear or flipping of a subset of the bits within
|
||||
* a hardware register so that concurrent access by two cores is always consistent with one atomic operation
|
||||
* being performed first, followed by the second.
|
||||
*
|
||||
* See hw_set_bits(), hw_clear_bits() and hw_xor_bits() provide for atomic access via a pointer to a 32 bit register
|
||||
*
|
||||
* Additionally given a pointer to a structure representing a piece of hardware (e.g. `dma_hw_t *dma_hw` for the DMA controller), you can
|
||||
* get an alias to the entire structure such that writing any member (register) within the structure is equivalent
|
||||
* to an atomic operation via hw_set_alias(), hw_clear_alias() or hw_xor_alias()...
|
||||
*
|
||||
* For example `hw_set_alias(dma_hw)->inte1 = 0x80;` will set bit 7 of the INTE1 register of the DMA controller,
|
||||
* leaving the other bits unchanged.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define check_hw_layout(type, member, offset) static_assert(offsetof(type, member) == (offset), "hw offset mismatch")
|
||||
#define check_hw_size(type, size) static_assert(sizeof(type) == (size), "hw size mismatch")
|
||||
|
||||
typedef volatile uint32_t io_rw_32;
|
||||
typedef const volatile uint32_t io_ro_32;
|
||||
typedef volatile uint32_t io_wo_32;
|
||||
typedef volatile uint16_t io_rw_16;
|
||||
typedef const volatile uint16_t io_ro_16;
|
||||
typedef volatile uint16_t io_wo_16;
|
||||
typedef volatile uint8_t io_rw_8;
|
||||
typedef const volatile uint8_t io_ro_8;
|
||||
typedef volatile uint8_t io_wo_8;
|
||||
|
||||
typedef volatile uint8_t *const ioptr;
|
||||
typedef ioptr const const_ioptr;
|
||||
|
||||
// Untyped conversion alias pointer generation macros
|
||||
#define hw_set_alias_untyped(addr) ((void *)(REG_ALIAS_SET_BITS | (uintptr_t)(addr)))
|
||||
#define hw_clear_alias_untyped(addr) ((void *)(REG_ALIAS_CLR_BITS | (uintptr_t)(addr)))
|
||||
#define hw_xor_alias_untyped(addr) ((void *)(REG_ALIAS_XOR_BITS | (uintptr_t)(addr)))
|
||||
|
||||
// Typed conversion alias pointer generation macros
|
||||
#define hw_set_alias(p) ((typeof(p))hw_set_alias_untyped(p))
|
||||
#define hw_clear_alias(p) ((typeof(p))hw_clear_alias_untyped(p))
|
||||
#define hw_xor_alias(p) ((typeof(p))hw_xor_alias_untyped(p))
|
||||
|
||||
/*! \brief Atomically set the specified bits to 1 in a HW register
|
||||
* \ingroup hardware_base
|
||||
*
|
||||
* \param addr Address of writable register
|
||||
* \param mask Bit-mask specifying bits to set
|
||||
*/
|
||||
__force_inline static void hw_set_bits(io_rw_32 *addr, uint32_t mask) {
|
||||
*(io_rw_32 *) hw_set_alias_untyped((volatile void *) addr) = mask;
|
||||
}
|
||||
|
||||
/*! \brief Atomically clear the specified bits to 0 in a HW register
|
||||
* \ingroup hardware_base
|
||||
*
|
||||
* \param addr Address of writable register
|
||||
* \param mask Bit-mask specifying bits to clear
|
||||
*/
|
||||
__force_inline static void hw_clear_bits(io_rw_32 *addr, uint32_t mask) {
|
||||
*(io_rw_32 *) hw_clear_alias_untyped((volatile void *) addr) = mask;
|
||||
}
|
||||
|
||||
/*! \brief Atomically flip the specified bits in a HW register
|
||||
* \ingroup hardware_base
|
||||
*
|
||||
* \param addr Address of writable register
|
||||
* \param mask Bit-mask specifying bits to invert
|
||||
*/
|
||||
__force_inline static void hw_xor_bits(io_rw_32 *addr, uint32_t mask) {
|
||||
*(io_rw_32 *) hw_xor_alias_untyped((volatile void *) addr) = mask;
|
||||
}
|
||||
|
||||
/*! \brief Set new values for a sub-set of the bits in a HW register
|
||||
* \ingroup hardware_base
|
||||
*
|
||||
* Sets destination bits to values specified in \p values, if and only if corresponding bit in \p write_mask is set
|
||||
*
|
||||
* Note: this method allows safe concurrent modification of *different* bits of
|
||||
* a register, but multiple concurrent access to the same bits is still unsafe.
|
||||
*
|
||||
* \param addr Address of writable register
|
||||
* \param values Bits values
|
||||
* \param write_mask Mask of bits to change
|
||||
*/
|
||||
__force_inline static void hw_write_masked(io_rw_32 *addr, uint32_t values, uint32_t write_mask) {
|
||||
hw_xor_bits(addr, (*addr ^ values) & write_mask);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
55
lib/rp2040/hardware/platform_defs.h
Normal file
55
lib/rp2040/hardware/platform_defs.h
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_PLATFORM_DEFS_H
|
||||
#define _HARDWARE_PLATFORM_DEFS_H
|
||||
|
||||
// This header is included from C and assembler - only define macros
|
||||
|
||||
#ifndef _u
|
||||
#ifdef __ASSEMBLER__
|
||||
#define _u(x) x
|
||||
#else
|
||||
#define _u(x) x ## u
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define NUM_CORES _u(2)
|
||||
#define NUM_DMA_CHANNELS _u(12)
|
||||
#define NUM_IRQS _u(32)
|
||||
#define NUM_PIOS _u(2)
|
||||
#define NUM_PIO_STATE_MACHINES _u(4)
|
||||
#define NUM_PWM_SLICES _u(8)
|
||||
#define NUM_SPIN_LOCKS _u(32)
|
||||
#define NUM_UARTS _u(2)
|
||||
#define NUM_I2CS _u(2)
|
||||
#define NUM_SPIS _u(2)
|
||||
|
||||
#define NUM_ADC_CHANNELS _u(5)
|
||||
|
||||
#define NUM_BANK0_GPIOS _u(30)
|
||||
|
||||
#define PIO_INSTRUCTION_COUNT _u(32)
|
||||
|
||||
#define XOSC_MHZ _u(12)
|
||||
|
||||
// PICO_CONFIG: PICO_STACK_SIZE, Stack Size, min=0x100, default=0x800, advanced=true, group=pico_standard_link
|
||||
#ifndef PICO_STACK_SIZE
|
||||
#define PICO_STACK_SIZE _u(0x800)
|
||||
#endif
|
||||
|
||||
// PICO_CONFIG: PICO_HEAP_SIZE, Heap size to reserve, min=0x100, default=0x800, advanced=true, group=pico_standard_link
|
||||
#ifndef PICO_HEAP_SIZE
|
||||
#define PICO_HEAP_SIZE _u(0x800)
|
||||
#endif
|
||||
|
||||
// PICO_CONFIG: PICO_NO_RAM_VECTOR_TABLE, Enable/disable the RAM vector table, type=bool, default=0, advanced=true, group=pico_runtime
|
||||
#ifndef PICO_NO_RAM_VECTOR_TABLE
|
||||
#define PICO_NO_RAM_VECTOR_TABLE 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
314
lib/rp2040/hardware/regs/adc.h
Normal file
314
lib/rp2040/hardware/regs/adc.h
Normal file
@ -0,0 +1,314 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// =============================================================================
|
||||
// Register block : ADC
|
||||
// Version : 2
|
||||
// Bus type : apb
|
||||
// Description : Control and data interface to SAR ADC
|
||||
// =============================================================================
|
||||
#ifndef HARDWARE_REGS_ADC_DEFINED
|
||||
#define HARDWARE_REGS_ADC_DEFINED
|
||||
// =============================================================================
|
||||
// Register : ADC_CS
|
||||
// Description : ADC Control and Status
|
||||
#define ADC_CS_OFFSET _u(0x00000000)
|
||||
#define ADC_CS_BITS _u(0x001f770f)
|
||||
#define ADC_CS_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_CS_RROBIN
|
||||
// Description : Round-robin sampling. 1 bit per channel. Set all bits to 0 to
|
||||
// disable.
|
||||
// Otherwise, the ADC will cycle through each enabled channel in a
|
||||
// round-robin fashion.
|
||||
// The first channel to be sampled will be the one currently
|
||||
// indicated by AINSEL.
|
||||
// AINSEL will be updated after each conversion with the
|
||||
// newly-selected channel.
|
||||
#define ADC_CS_RROBIN_RESET _u(0x00)
|
||||
#define ADC_CS_RROBIN_BITS _u(0x001f0000)
|
||||
#define ADC_CS_RROBIN_MSB _u(20)
|
||||
#define ADC_CS_RROBIN_LSB _u(16)
|
||||
#define ADC_CS_RROBIN_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_CS_AINSEL
|
||||
// Description : Select analog mux input. Updated automatically in round-robin
|
||||
// mode.
|
||||
#define ADC_CS_AINSEL_RESET _u(0x0)
|
||||
#define ADC_CS_AINSEL_BITS _u(0x00007000)
|
||||
#define ADC_CS_AINSEL_MSB _u(14)
|
||||
#define ADC_CS_AINSEL_LSB _u(12)
|
||||
#define ADC_CS_AINSEL_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_CS_ERR_STICKY
|
||||
// Description : Some past ADC conversion encountered an error. Write 1 to
|
||||
// clear.
|
||||
#define ADC_CS_ERR_STICKY_RESET _u(0x0)
|
||||
#define ADC_CS_ERR_STICKY_BITS _u(0x00000400)
|
||||
#define ADC_CS_ERR_STICKY_MSB _u(10)
|
||||
#define ADC_CS_ERR_STICKY_LSB _u(10)
|
||||
#define ADC_CS_ERR_STICKY_ACCESS "WC"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_CS_ERR
|
||||
// Description : The most recent ADC conversion encountered an error; result is
|
||||
// undefined or noisy.
|
||||
#define ADC_CS_ERR_RESET _u(0x0)
|
||||
#define ADC_CS_ERR_BITS _u(0x00000200)
|
||||
#define ADC_CS_ERR_MSB _u(9)
|
||||
#define ADC_CS_ERR_LSB _u(9)
|
||||
#define ADC_CS_ERR_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_CS_READY
|
||||
// Description : 1 if the ADC is ready to start a new conversion. Implies any
|
||||
// previous conversion has completed.
|
||||
// 0 whilst conversion in progress.
|
||||
#define ADC_CS_READY_RESET _u(0x0)
|
||||
#define ADC_CS_READY_BITS _u(0x00000100)
|
||||
#define ADC_CS_READY_MSB _u(8)
|
||||
#define ADC_CS_READY_LSB _u(8)
|
||||
#define ADC_CS_READY_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_CS_START_MANY
|
||||
// Description : Continuously perform conversions whilst this bit is 1. A new
|
||||
// conversion will start immediately after the previous finishes.
|
||||
#define ADC_CS_START_MANY_RESET _u(0x0)
|
||||
#define ADC_CS_START_MANY_BITS _u(0x00000008)
|
||||
#define ADC_CS_START_MANY_MSB _u(3)
|
||||
#define ADC_CS_START_MANY_LSB _u(3)
|
||||
#define ADC_CS_START_MANY_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_CS_START_ONCE
|
||||
// Description : Start a single conversion. Self-clearing. Ignored if start_many
|
||||
// is asserted.
|
||||
#define ADC_CS_START_ONCE_RESET _u(0x0)
|
||||
#define ADC_CS_START_ONCE_BITS _u(0x00000004)
|
||||
#define ADC_CS_START_ONCE_MSB _u(2)
|
||||
#define ADC_CS_START_ONCE_LSB _u(2)
|
||||
#define ADC_CS_START_ONCE_ACCESS "SC"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_CS_TS_EN
|
||||
// Description : Power on temperature sensor. 1 - enabled. 0 - disabled.
|
||||
#define ADC_CS_TS_EN_RESET _u(0x0)
|
||||
#define ADC_CS_TS_EN_BITS _u(0x00000002)
|
||||
#define ADC_CS_TS_EN_MSB _u(1)
|
||||
#define ADC_CS_TS_EN_LSB _u(1)
|
||||
#define ADC_CS_TS_EN_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_CS_EN
|
||||
// Description : Power on ADC and enable its clock.
|
||||
// 1 - enabled. 0 - disabled.
|
||||
#define ADC_CS_EN_RESET _u(0x0)
|
||||
#define ADC_CS_EN_BITS _u(0x00000001)
|
||||
#define ADC_CS_EN_MSB _u(0)
|
||||
#define ADC_CS_EN_LSB _u(0)
|
||||
#define ADC_CS_EN_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : ADC_RESULT
|
||||
// Description : Result of most recent ADC conversion
|
||||
#define ADC_RESULT_OFFSET _u(0x00000004)
|
||||
#define ADC_RESULT_BITS _u(0x00000fff)
|
||||
#define ADC_RESULT_RESET _u(0x00000000)
|
||||
#define ADC_RESULT_MSB _u(11)
|
||||
#define ADC_RESULT_LSB _u(0)
|
||||
#define ADC_RESULT_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : ADC_FCS
|
||||
// Description : FIFO control and status
|
||||
#define ADC_FCS_OFFSET _u(0x00000008)
|
||||
#define ADC_FCS_BITS _u(0x0f0f0f0f)
|
||||
#define ADC_FCS_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_FCS_THRESH
|
||||
// Description : DREQ/IRQ asserted when level >= threshold
|
||||
#define ADC_FCS_THRESH_RESET _u(0x0)
|
||||
#define ADC_FCS_THRESH_BITS _u(0x0f000000)
|
||||
#define ADC_FCS_THRESH_MSB _u(27)
|
||||
#define ADC_FCS_THRESH_LSB _u(24)
|
||||
#define ADC_FCS_THRESH_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_FCS_LEVEL
|
||||
// Description : The number of conversion results currently waiting in the FIFO
|
||||
#define ADC_FCS_LEVEL_RESET _u(0x0)
|
||||
#define ADC_FCS_LEVEL_BITS _u(0x000f0000)
|
||||
#define ADC_FCS_LEVEL_MSB _u(19)
|
||||
#define ADC_FCS_LEVEL_LSB _u(16)
|
||||
#define ADC_FCS_LEVEL_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_FCS_OVER
|
||||
// Description : 1 if the FIFO has been overflowed. Write 1 to clear.
|
||||
#define ADC_FCS_OVER_RESET _u(0x0)
|
||||
#define ADC_FCS_OVER_BITS _u(0x00000800)
|
||||
#define ADC_FCS_OVER_MSB _u(11)
|
||||
#define ADC_FCS_OVER_LSB _u(11)
|
||||
#define ADC_FCS_OVER_ACCESS "WC"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_FCS_UNDER
|
||||
// Description : 1 if the FIFO has been underflowed. Write 1 to clear.
|
||||
#define ADC_FCS_UNDER_RESET _u(0x0)
|
||||
#define ADC_FCS_UNDER_BITS _u(0x00000400)
|
||||
#define ADC_FCS_UNDER_MSB _u(10)
|
||||
#define ADC_FCS_UNDER_LSB _u(10)
|
||||
#define ADC_FCS_UNDER_ACCESS "WC"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_FCS_FULL
|
||||
// Description : None
|
||||
#define ADC_FCS_FULL_RESET _u(0x0)
|
||||
#define ADC_FCS_FULL_BITS _u(0x00000200)
|
||||
#define ADC_FCS_FULL_MSB _u(9)
|
||||
#define ADC_FCS_FULL_LSB _u(9)
|
||||
#define ADC_FCS_FULL_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_FCS_EMPTY
|
||||
// Description : None
|
||||
#define ADC_FCS_EMPTY_RESET _u(0x0)
|
||||
#define ADC_FCS_EMPTY_BITS _u(0x00000100)
|
||||
#define ADC_FCS_EMPTY_MSB _u(8)
|
||||
#define ADC_FCS_EMPTY_LSB _u(8)
|
||||
#define ADC_FCS_EMPTY_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_FCS_DREQ_EN
|
||||
// Description : If 1: assert DMA requests when FIFO contains data
|
||||
#define ADC_FCS_DREQ_EN_RESET _u(0x0)
|
||||
#define ADC_FCS_DREQ_EN_BITS _u(0x00000008)
|
||||
#define ADC_FCS_DREQ_EN_MSB _u(3)
|
||||
#define ADC_FCS_DREQ_EN_LSB _u(3)
|
||||
#define ADC_FCS_DREQ_EN_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_FCS_ERR
|
||||
// Description : If 1: conversion error bit appears in the FIFO alongside the
|
||||
// result
|
||||
#define ADC_FCS_ERR_RESET _u(0x0)
|
||||
#define ADC_FCS_ERR_BITS _u(0x00000004)
|
||||
#define ADC_FCS_ERR_MSB _u(2)
|
||||
#define ADC_FCS_ERR_LSB _u(2)
|
||||
#define ADC_FCS_ERR_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_FCS_SHIFT
|
||||
// Description : If 1: FIFO results are right-shifted to be one byte in size.
|
||||
// Enables DMA to byte buffers.
|
||||
#define ADC_FCS_SHIFT_RESET _u(0x0)
|
||||
#define ADC_FCS_SHIFT_BITS _u(0x00000002)
|
||||
#define ADC_FCS_SHIFT_MSB _u(1)
|
||||
#define ADC_FCS_SHIFT_LSB _u(1)
|
||||
#define ADC_FCS_SHIFT_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_FCS_EN
|
||||
// Description : If 1: write result to the FIFO after each conversion.
|
||||
#define ADC_FCS_EN_RESET _u(0x0)
|
||||
#define ADC_FCS_EN_BITS _u(0x00000001)
|
||||
#define ADC_FCS_EN_MSB _u(0)
|
||||
#define ADC_FCS_EN_LSB _u(0)
|
||||
#define ADC_FCS_EN_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : ADC_FIFO
|
||||
// Description : Conversion result FIFO
|
||||
#define ADC_FIFO_OFFSET _u(0x0000000c)
|
||||
#define ADC_FIFO_BITS _u(0x00008fff)
|
||||
#define ADC_FIFO_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_FIFO_ERR
|
||||
// Description : 1 if this particular sample experienced a conversion error.
|
||||
// Remains in the same location if the sample is shifted.
|
||||
#define ADC_FIFO_ERR_RESET "-"
|
||||
#define ADC_FIFO_ERR_BITS _u(0x00008000)
|
||||
#define ADC_FIFO_ERR_MSB _u(15)
|
||||
#define ADC_FIFO_ERR_LSB _u(15)
|
||||
#define ADC_FIFO_ERR_ACCESS "RF"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_FIFO_VAL
|
||||
// Description : None
|
||||
#define ADC_FIFO_VAL_RESET "-"
|
||||
#define ADC_FIFO_VAL_BITS _u(0x00000fff)
|
||||
#define ADC_FIFO_VAL_MSB _u(11)
|
||||
#define ADC_FIFO_VAL_LSB _u(0)
|
||||
#define ADC_FIFO_VAL_ACCESS "RF"
|
||||
// =============================================================================
|
||||
// Register : ADC_DIV
|
||||
// Description : Clock divider. If non-zero, CS_START_MANY will start
|
||||
// conversions
|
||||
// at regular intervals rather than back-to-back.
|
||||
// The divider is reset when either of these fields are written.
|
||||
// Total period is 1 + INT + FRAC / 256
|
||||
#define ADC_DIV_OFFSET _u(0x00000010)
|
||||
#define ADC_DIV_BITS _u(0x00ffffff)
|
||||
#define ADC_DIV_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_DIV_INT
|
||||
// Description : Integer part of clock divisor.
|
||||
#define ADC_DIV_INT_RESET _u(0x0000)
|
||||
#define ADC_DIV_INT_BITS _u(0x00ffff00)
|
||||
#define ADC_DIV_INT_MSB _u(23)
|
||||
#define ADC_DIV_INT_LSB _u(8)
|
||||
#define ADC_DIV_INT_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_DIV_FRAC
|
||||
// Description : Fractional part of clock divisor. First-order delta-sigma.
|
||||
#define ADC_DIV_FRAC_RESET _u(0x00)
|
||||
#define ADC_DIV_FRAC_BITS _u(0x000000ff)
|
||||
#define ADC_DIV_FRAC_MSB _u(7)
|
||||
#define ADC_DIV_FRAC_LSB _u(0)
|
||||
#define ADC_DIV_FRAC_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : ADC_INTR
|
||||
// Description : Raw Interrupts
|
||||
#define ADC_INTR_OFFSET _u(0x00000014)
|
||||
#define ADC_INTR_BITS _u(0x00000001)
|
||||
#define ADC_INTR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_INTR_FIFO
|
||||
// Description : Triggered when the sample FIFO reaches a certain level.
|
||||
// This level can be programmed via the FCS_THRESH field.
|
||||
#define ADC_INTR_FIFO_RESET _u(0x0)
|
||||
#define ADC_INTR_FIFO_BITS _u(0x00000001)
|
||||
#define ADC_INTR_FIFO_MSB _u(0)
|
||||
#define ADC_INTR_FIFO_LSB _u(0)
|
||||
#define ADC_INTR_FIFO_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : ADC_INTE
|
||||
// Description : Interrupt Enable
|
||||
#define ADC_INTE_OFFSET _u(0x00000018)
|
||||
#define ADC_INTE_BITS _u(0x00000001)
|
||||
#define ADC_INTE_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_INTE_FIFO
|
||||
// Description : Triggered when the sample FIFO reaches a certain level.
|
||||
// This level can be programmed via the FCS_THRESH field.
|
||||
#define ADC_INTE_FIFO_RESET _u(0x0)
|
||||
#define ADC_INTE_FIFO_BITS _u(0x00000001)
|
||||
#define ADC_INTE_FIFO_MSB _u(0)
|
||||
#define ADC_INTE_FIFO_LSB _u(0)
|
||||
#define ADC_INTE_FIFO_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : ADC_INTF
|
||||
// Description : Interrupt Force
|
||||
#define ADC_INTF_OFFSET _u(0x0000001c)
|
||||
#define ADC_INTF_BITS _u(0x00000001)
|
||||
#define ADC_INTF_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_INTF_FIFO
|
||||
// Description : Triggered when the sample FIFO reaches a certain level.
|
||||
// This level can be programmed via the FCS_THRESH field.
|
||||
#define ADC_INTF_FIFO_RESET _u(0x0)
|
||||
#define ADC_INTF_FIFO_BITS _u(0x00000001)
|
||||
#define ADC_INTF_FIFO_MSB _u(0)
|
||||
#define ADC_INTF_FIFO_LSB _u(0)
|
||||
#define ADC_INTF_FIFO_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : ADC_INTS
|
||||
// Description : Interrupt status after masking & forcing
|
||||
#define ADC_INTS_OFFSET _u(0x00000020)
|
||||
#define ADC_INTS_BITS _u(0x00000001)
|
||||
#define ADC_INTS_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ADC_INTS_FIFO
|
||||
// Description : Triggered when the sample FIFO reaches a certain level.
|
||||
// This level can be programmed via the FCS_THRESH field.
|
||||
#define ADC_INTS_FIFO_RESET _u(0x0)
|
||||
#define ADC_INTS_FIFO_BITS _u(0x00000001)
|
||||
#define ADC_INTS_FIFO_MSB _u(0)
|
||||
#define ADC_INTS_FIFO_LSB _u(0)
|
||||
#define ADC_INTS_FIFO_ACCESS "RO"
|
||||
// =============================================================================
|
||||
#endif // HARDWARE_REGS_ADC_DEFINED
|
74
lib/rp2040/hardware/regs/addressmap.h
Normal file
74
lib/rp2040/hardware/regs/addressmap.h
Normal file
@ -0,0 +1,74 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#ifndef _ADDRESSMAP_H_
|
||||
#define _ADDRESSMAP_H_
|
||||
|
||||
#include "hardware/platform_defs.h"
|
||||
|
||||
// Register address offsets for atomic RMW aliases
|
||||
#define REG_ALIAS_RW_BITS (0x0u << 12u)
|
||||
#define REG_ALIAS_XOR_BITS (0x1u << 12u)
|
||||
#define REG_ALIAS_SET_BITS (0x2u << 12u)
|
||||
#define REG_ALIAS_CLR_BITS (0x3u << 12u)
|
||||
|
||||
#define ROM_BASE _u(0x00000000)
|
||||
#define XIP_BASE _u(0x10000000)
|
||||
#define XIP_MAIN_BASE _u(0x10000000)
|
||||
#define XIP_NOALLOC_BASE _u(0x11000000)
|
||||
#define XIP_NOCACHE_BASE _u(0x12000000)
|
||||
#define XIP_NOCACHE_NOALLOC_BASE _u(0x13000000)
|
||||
#define XIP_CTRL_BASE _u(0x14000000)
|
||||
#define XIP_SRAM_BASE _u(0x15000000)
|
||||
#define XIP_SRAM_END _u(0x15004000)
|
||||
#define XIP_SSI_BASE _u(0x18000000)
|
||||
#define SRAM_BASE _u(0x20000000)
|
||||
#define SRAM_STRIPED_BASE _u(0x20000000)
|
||||
#define SRAM_STRIPED_END _u(0x20040000)
|
||||
#define SRAM4_BASE _u(0x20040000)
|
||||
#define SRAM5_BASE _u(0x20041000)
|
||||
#define SRAM_END _u(0x20042000)
|
||||
#define SRAM0_BASE _u(0x21000000)
|
||||
#define SRAM1_BASE _u(0x21010000)
|
||||
#define SRAM2_BASE _u(0x21020000)
|
||||
#define SRAM3_BASE _u(0x21030000)
|
||||
#define SYSINFO_BASE _u(0x40000000)
|
||||
#define SYSCFG_BASE _u(0x40004000)
|
||||
#define CLOCKS_BASE _u(0x40008000)
|
||||
#define RESETS_BASE _u(0x4000c000)
|
||||
#define PSM_BASE _u(0x40010000)
|
||||
#define IO_BANK0_BASE _u(0x40014000)
|
||||
#define IO_QSPI_BASE _u(0x40018000)
|
||||
#define PADS_BANK0_BASE _u(0x4001c000)
|
||||
#define PADS_QSPI_BASE _u(0x40020000)
|
||||
#define XOSC_BASE _u(0x40024000)
|
||||
#define PLL_SYS_BASE _u(0x40028000)
|
||||
#define PLL_USB_BASE _u(0x4002c000)
|
||||
#define BUSCTRL_BASE _u(0x40030000)
|
||||
#define UART0_BASE _u(0x40034000)
|
||||
#define UART1_BASE _u(0x40038000)
|
||||
#define SPI0_BASE _u(0x4003c000)
|
||||
#define SPI1_BASE _u(0x40040000)
|
||||
#define I2C0_BASE _u(0x40044000)
|
||||
#define I2C1_BASE _u(0x40048000)
|
||||
#define ADC_BASE _u(0x4004c000)
|
||||
#define PWM_BASE _u(0x40050000)
|
||||
#define TIMER_BASE _u(0x40054000)
|
||||
#define WATCHDOG_BASE _u(0x40058000)
|
||||
#define RTC_BASE _u(0x4005c000)
|
||||
#define ROSC_BASE _u(0x40060000)
|
||||
#define VREG_AND_CHIP_RESET_BASE _u(0x40064000)
|
||||
#define TBMAN_BASE _u(0x4006c000)
|
||||
#define DMA_BASE _u(0x50000000)
|
||||
#define USBCTRL_DPRAM_BASE _u(0x50100000)
|
||||
#define USBCTRL_BASE _u(0x50100000)
|
||||
#define USBCTRL_REGS_BASE _u(0x50110000)
|
||||
#define PIO0_BASE _u(0x50200000)
|
||||
#define PIO1_BASE _u(0x50300000)
|
||||
#define XIP_AUX_BASE _u(0x50400000)
|
||||
#define SIO_BASE _u(0xd0000000)
|
||||
#define PPB_BASE _u(0xe0000000)
|
||||
|
||||
#endif // _ADDRESSMAP_H_
|
324
lib/rp2040/hardware/regs/busctrl.h
Normal file
324
lib/rp2040/hardware/regs/busctrl.h
Normal file
@ -0,0 +1,324 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// =============================================================================
|
||||
// Register block : BUSCTRL
|
||||
// Version : 1
|
||||
// Bus type : apb
|
||||
// Description : Register block for busfabric control signals and performance
|
||||
// counters
|
||||
// =============================================================================
|
||||
#ifndef HARDWARE_REGS_BUSCTRL_DEFINED
|
||||
#define HARDWARE_REGS_BUSCTRL_DEFINED
|
||||
// =============================================================================
|
||||
// Register : BUSCTRL_BUS_PRIORITY
|
||||
// Description : Set the priority of each master for bus arbitration.
|
||||
#define BUSCTRL_BUS_PRIORITY_OFFSET _u(0x00000000)
|
||||
#define BUSCTRL_BUS_PRIORITY_BITS _u(0x00001111)
|
||||
#define BUSCTRL_BUS_PRIORITY_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : BUSCTRL_BUS_PRIORITY_DMA_W
|
||||
// Description : 0 - low priority, 1 - high priority
|
||||
#define BUSCTRL_BUS_PRIORITY_DMA_W_RESET _u(0x0)
|
||||
#define BUSCTRL_BUS_PRIORITY_DMA_W_BITS _u(0x00001000)
|
||||
#define BUSCTRL_BUS_PRIORITY_DMA_W_MSB _u(12)
|
||||
#define BUSCTRL_BUS_PRIORITY_DMA_W_LSB _u(12)
|
||||
#define BUSCTRL_BUS_PRIORITY_DMA_W_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : BUSCTRL_BUS_PRIORITY_DMA_R
|
||||
// Description : 0 - low priority, 1 - high priority
|
||||
#define BUSCTRL_BUS_PRIORITY_DMA_R_RESET _u(0x0)
|
||||
#define BUSCTRL_BUS_PRIORITY_DMA_R_BITS _u(0x00000100)
|
||||
#define BUSCTRL_BUS_PRIORITY_DMA_R_MSB _u(8)
|
||||
#define BUSCTRL_BUS_PRIORITY_DMA_R_LSB _u(8)
|
||||
#define BUSCTRL_BUS_PRIORITY_DMA_R_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : BUSCTRL_BUS_PRIORITY_PROC1
|
||||
// Description : 0 - low priority, 1 - high priority
|
||||
#define BUSCTRL_BUS_PRIORITY_PROC1_RESET _u(0x0)
|
||||
#define BUSCTRL_BUS_PRIORITY_PROC1_BITS _u(0x00000010)
|
||||
#define BUSCTRL_BUS_PRIORITY_PROC1_MSB _u(4)
|
||||
#define BUSCTRL_BUS_PRIORITY_PROC1_LSB _u(4)
|
||||
#define BUSCTRL_BUS_PRIORITY_PROC1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : BUSCTRL_BUS_PRIORITY_PROC0
|
||||
// Description : 0 - low priority, 1 - high priority
|
||||
#define BUSCTRL_BUS_PRIORITY_PROC0_RESET _u(0x0)
|
||||
#define BUSCTRL_BUS_PRIORITY_PROC0_BITS _u(0x00000001)
|
||||
#define BUSCTRL_BUS_PRIORITY_PROC0_MSB _u(0)
|
||||
#define BUSCTRL_BUS_PRIORITY_PROC0_LSB _u(0)
|
||||
#define BUSCTRL_BUS_PRIORITY_PROC0_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : BUSCTRL_BUS_PRIORITY_ACK
|
||||
// Description : Bus priority acknowledge
|
||||
// Goes to 1 once all arbiters have registered the new global
|
||||
// priority levels.
|
||||
// Arbiters update their local priority when servicing a new
|
||||
// nonsequential access.
|
||||
// In normal circumstances this will happen almost immediately.
|
||||
#define BUSCTRL_BUS_PRIORITY_ACK_OFFSET _u(0x00000004)
|
||||
#define BUSCTRL_BUS_PRIORITY_ACK_BITS _u(0x00000001)
|
||||
#define BUSCTRL_BUS_PRIORITY_ACK_RESET _u(0x00000000)
|
||||
#define BUSCTRL_BUS_PRIORITY_ACK_MSB _u(0)
|
||||
#define BUSCTRL_BUS_PRIORITY_ACK_LSB _u(0)
|
||||
#define BUSCTRL_BUS_PRIORITY_ACK_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : BUSCTRL_PERFCTR0
|
||||
// Description : Bus fabric performance counter 0
|
||||
// Busfabric saturating performance counter 0
|
||||
// Count some event signal from the busfabric arbiters.
|
||||
// Write any value to clear. Select an event to count using
|
||||
// PERFSEL0
|
||||
#define BUSCTRL_PERFCTR0_OFFSET _u(0x00000008)
|
||||
#define BUSCTRL_PERFCTR0_BITS _u(0x00ffffff)
|
||||
#define BUSCTRL_PERFCTR0_RESET _u(0x00000000)
|
||||
#define BUSCTRL_PERFCTR0_MSB _u(23)
|
||||
#define BUSCTRL_PERFCTR0_LSB _u(0)
|
||||
#define BUSCTRL_PERFCTR0_ACCESS "WC"
|
||||
// =============================================================================
|
||||
// Register : BUSCTRL_PERFSEL0
|
||||
// Description : Bus fabric performance event select for PERFCTR0
|
||||
// Select an event for PERFCTR0. Count either contested accesses,
|
||||
// or all accesses, on a downstream port of the main crossbar.
|
||||
// 0x00 -> apb_contested
|
||||
// 0x01 -> apb
|
||||
// 0x02 -> fastperi_contested
|
||||
// 0x03 -> fastperi
|
||||
// 0x04 -> sram5_contested
|
||||
// 0x05 -> sram5
|
||||
// 0x06 -> sram4_contested
|
||||
// 0x07 -> sram4
|
||||
// 0x08 -> sram3_contested
|
||||
// 0x09 -> sram3
|
||||
// 0x0a -> sram2_contested
|
||||
// 0x0b -> sram2
|
||||
// 0x0c -> sram1_contested
|
||||
// 0x0d -> sram1
|
||||
// 0x0e -> sram0_contested
|
||||
// 0x0f -> sram0
|
||||
// 0x10 -> xip_main_contested
|
||||
// 0x11 -> xip_main
|
||||
// 0x12 -> rom_contested
|
||||
// 0x13 -> rom
|
||||
#define BUSCTRL_PERFSEL0_OFFSET _u(0x0000000c)
|
||||
#define BUSCTRL_PERFSEL0_BITS _u(0x0000001f)
|
||||
#define BUSCTRL_PERFSEL0_RESET _u(0x0000001f)
|
||||
#define BUSCTRL_PERFSEL0_MSB _u(4)
|
||||
#define BUSCTRL_PERFSEL0_LSB _u(0)
|
||||
#define BUSCTRL_PERFSEL0_ACCESS "RW"
|
||||
#define BUSCTRL_PERFSEL0_VALUE_APB_CONTESTED _u(0x00)
|
||||
#define BUSCTRL_PERFSEL0_VALUE_APB _u(0x01)
|
||||
#define BUSCTRL_PERFSEL0_VALUE_FASTPERI_CONTESTED _u(0x02)
|
||||
#define BUSCTRL_PERFSEL0_VALUE_FASTPERI _u(0x03)
|
||||
#define BUSCTRL_PERFSEL0_VALUE_SRAM5_CONTESTED _u(0x04)
|
||||
#define BUSCTRL_PERFSEL0_VALUE_SRAM5 _u(0x05)
|
||||
#define BUSCTRL_PERFSEL0_VALUE_SRAM4_CONTESTED _u(0x06)
|
||||
#define BUSCTRL_PERFSEL0_VALUE_SRAM4 _u(0x07)
|
||||
#define BUSCTRL_PERFSEL0_VALUE_SRAM3_CONTESTED _u(0x08)
|
||||
#define BUSCTRL_PERFSEL0_VALUE_SRAM3 _u(0x09)
|
||||
#define BUSCTRL_PERFSEL0_VALUE_SRAM2_CONTESTED _u(0x0a)
|
||||
#define BUSCTRL_PERFSEL0_VALUE_SRAM2 _u(0x0b)
|
||||
#define BUSCTRL_PERFSEL0_VALUE_SRAM1_CONTESTED _u(0x0c)
|
||||
#define BUSCTRL_PERFSEL0_VALUE_SRAM1 _u(0x0d)
|
||||
#define BUSCTRL_PERFSEL0_VALUE_SRAM0_CONTESTED _u(0x0e)
|
||||
#define BUSCTRL_PERFSEL0_VALUE_SRAM0 _u(0x0f)
|
||||
#define BUSCTRL_PERFSEL0_VALUE_XIP_MAIN_CONTESTED _u(0x10)
|
||||
#define BUSCTRL_PERFSEL0_VALUE_XIP_MAIN _u(0x11)
|
||||
#define BUSCTRL_PERFSEL0_VALUE_ROM_CONTESTED _u(0x12)
|
||||
#define BUSCTRL_PERFSEL0_VALUE_ROM _u(0x13)
|
||||
// =============================================================================
|
||||
// Register : BUSCTRL_PERFCTR1
|
||||
// Description : Bus fabric performance counter 1
|
||||
// Busfabric saturating performance counter 1
|
||||
// Count some event signal from the busfabric arbiters.
|
||||
// Write any value to clear. Select an event to count using
|
||||
// PERFSEL1
|
||||
#define BUSCTRL_PERFCTR1_OFFSET _u(0x00000010)
|
||||
#define BUSCTRL_PERFCTR1_BITS _u(0x00ffffff)
|
||||
#define BUSCTRL_PERFCTR1_RESET _u(0x00000000)
|
||||
#define BUSCTRL_PERFCTR1_MSB _u(23)
|
||||
#define BUSCTRL_PERFCTR1_LSB _u(0)
|
||||
#define BUSCTRL_PERFCTR1_ACCESS "WC"
|
||||
// =============================================================================
|
||||
// Register : BUSCTRL_PERFSEL1
|
||||
// Description : Bus fabric performance event select for PERFCTR1
|
||||
// Select an event for PERFCTR1. Count either contested accesses,
|
||||
// or all accesses, on a downstream port of the main crossbar.
|
||||
// 0x00 -> apb_contested
|
||||
// 0x01 -> apb
|
||||
// 0x02 -> fastperi_contested
|
||||
// 0x03 -> fastperi
|
||||
// 0x04 -> sram5_contested
|
||||
// 0x05 -> sram5
|
||||
// 0x06 -> sram4_contested
|
||||
// 0x07 -> sram4
|
||||
// 0x08 -> sram3_contested
|
||||
// 0x09 -> sram3
|
||||
// 0x0a -> sram2_contested
|
||||
// 0x0b -> sram2
|
||||
// 0x0c -> sram1_contested
|
||||
// 0x0d -> sram1
|
||||
// 0x0e -> sram0_contested
|
||||
// 0x0f -> sram0
|
||||
// 0x10 -> xip_main_contested
|
||||
// 0x11 -> xip_main
|
||||
// 0x12 -> rom_contested
|
||||
// 0x13 -> rom
|
||||
#define BUSCTRL_PERFSEL1_OFFSET _u(0x00000014)
|
||||
#define BUSCTRL_PERFSEL1_BITS _u(0x0000001f)
|
||||
#define BUSCTRL_PERFSEL1_RESET _u(0x0000001f)
|
||||
#define BUSCTRL_PERFSEL1_MSB _u(4)
|
||||
#define BUSCTRL_PERFSEL1_LSB _u(0)
|
||||
#define BUSCTRL_PERFSEL1_ACCESS "RW"
|
||||
#define BUSCTRL_PERFSEL1_VALUE_APB_CONTESTED _u(0x00)
|
||||
#define BUSCTRL_PERFSEL1_VALUE_APB _u(0x01)
|
||||
#define BUSCTRL_PERFSEL1_VALUE_FASTPERI_CONTESTED _u(0x02)
|
||||
#define BUSCTRL_PERFSEL1_VALUE_FASTPERI _u(0x03)
|
||||
#define BUSCTRL_PERFSEL1_VALUE_SRAM5_CONTESTED _u(0x04)
|
||||
#define BUSCTRL_PERFSEL1_VALUE_SRAM5 _u(0x05)
|
||||
#define BUSCTRL_PERFSEL1_VALUE_SRAM4_CONTESTED _u(0x06)
|
||||
#define BUSCTRL_PERFSEL1_VALUE_SRAM4 _u(0x07)
|
||||
#define BUSCTRL_PERFSEL1_VALUE_SRAM3_CONTESTED _u(0x08)
|
||||
#define BUSCTRL_PERFSEL1_VALUE_SRAM3 _u(0x09)
|
||||
#define BUSCTRL_PERFSEL1_VALUE_SRAM2_CONTESTED _u(0x0a)
|
||||
#define BUSCTRL_PERFSEL1_VALUE_SRAM2 _u(0x0b)
|
||||
#define BUSCTRL_PERFSEL1_VALUE_SRAM1_CONTESTED _u(0x0c)
|
||||
#define BUSCTRL_PERFSEL1_VALUE_SRAM1 _u(0x0d)
|
||||
#define BUSCTRL_PERFSEL1_VALUE_SRAM0_CONTESTED _u(0x0e)
|
||||
#define BUSCTRL_PERFSEL1_VALUE_SRAM0 _u(0x0f)
|
||||
#define BUSCTRL_PERFSEL1_VALUE_XIP_MAIN_CONTESTED _u(0x10)
|
||||
#define BUSCTRL_PERFSEL1_VALUE_XIP_MAIN _u(0x11)
|
||||
#define BUSCTRL_PERFSEL1_VALUE_ROM_CONTESTED _u(0x12)
|
||||
#define BUSCTRL_PERFSEL1_VALUE_ROM _u(0x13)
|
||||
// =============================================================================
|
||||
// Register : BUSCTRL_PERFCTR2
|
||||
// Description : Bus fabric performance counter 2
|
||||
// Busfabric saturating performance counter 2
|
||||
// Count some event signal from the busfabric arbiters.
|
||||
// Write any value to clear. Select an event to count using
|
||||
// PERFSEL2
|
||||
#define BUSCTRL_PERFCTR2_OFFSET _u(0x00000018)
|
||||
#define BUSCTRL_PERFCTR2_BITS _u(0x00ffffff)
|
||||
#define BUSCTRL_PERFCTR2_RESET _u(0x00000000)
|
||||
#define BUSCTRL_PERFCTR2_MSB _u(23)
|
||||
#define BUSCTRL_PERFCTR2_LSB _u(0)
|
||||
#define BUSCTRL_PERFCTR2_ACCESS "WC"
|
||||
// =============================================================================
|
||||
// Register : BUSCTRL_PERFSEL2
|
||||
// Description : Bus fabric performance event select for PERFCTR2
|
||||
// Select an event for PERFCTR2. Count either contested accesses,
|
||||
// or all accesses, on a downstream port of the main crossbar.
|
||||
// 0x00 -> apb_contested
|
||||
// 0x01 -> apb
|
||||
// 0x02 -> fastperi_contested
|
||||
// 0x03 -> fastperi
|
||||
// 0x04 -> sram5_contested
|
||||
// 0x05 -> sram5
|
||||
// 0x06 -> sram4_contested
|
||||
// 0x07 -> sram4
|
||||
// 0x08 -> sram3_contested
|
||||
// 0x09 -> sram3
|
||||
// 0x0a -> sram2_contested
|
||||
// 0x0b -> sram2
|
||||
// 0x0c -> sram1_contested
|
||||
// 0x0d -> sram1
|
||||
// 0x0e -> sram0_contested
|
||||
// 0x0f -> sram0
|
||||
// 0x10 -> xip_main_contested
|
||||
// 0x11 -> xip_main
|
||||
// 0x12 -> rom_contested
|
||||
// 0x13 -> rom
|
||||
#define BUSCTRL_PERFSEL2_OFFSET _u(0x0000001c)
|
||||
#define BUSCTRL_PERFSEL2_BITS _u(0x0000001f)
|
||||
#define BUSCTRL_PERFSEL2_RESET _u(0x0000001f)
|
||||
#define BUSCTRL_PERFSEL2_MSB _u(4)
|
||||
#define BUSCTRL_PERFSEL2_LSB _u(0)
|
||||
#define BUSCTRL_PERFSEL2_ACCESS "RW"
|
||||
#define BUSCTRL_PERFSEL2_VALUE_APB_CONTESTED _u(0x00)
|
||||
#define BUSCTRL_PERFSEL2_VALUE_APB _u(0x01)
|
||||
#define BUSCTRL_PERFSEL2_VALUE_FASTPERI_CONTESTED _u(0x02)
|
||||
#define BUSCTRL_PERFSEL2_VALUE_FASTPERI _u(0x03)
|
||||
#define BUSCTRL_PERFSEL2_VALUE_SRAM5_CONTESTED _u(0x04)
|
||||
#define BUSCTRL_PERFSEL2_VALUE_SRAM5 _u(0x05)
|
||||
#define BUSCTRL_PERFSEL2_VALUE_SRAM4_CONTESTED _u(0x06)
|
||||
#define BUSCTRL_PERFSEL2_VALUE_SRAM4 _u(0x07)
|
||||
#define BUSCTRL_PERFSEL2_VALUE_SRAM3_CONTESTED _u(0x08)
|
||||
#define BUSCTRL_PERFSEL2_VALUE_SRAM3 _u(0x09)
|
||||
#define BUSCTRL_PERFSEL2_VALUE_SRAM2_CONTESTED _u(0x0a)
|
||||
#define BUSCTRL_PERFSEL2_VALUE_SRAM2 _u(0x0b)
|
||||
#define BUSCTRL_PERFSEL2_VALUE_SRAM1_CONTESTED _u(0x0c)
|
||||
#define BUSCTRL_PERFSEL2_VALUE_SRAM1 _u(0x0d)
|
||||
#define BUSCTRL_PERFSEL2_VALUE_SRAM0_CONTESTED _u(0x0e)
|
||||
#define BUSCTRL_PERFSEL2_VALUE_SRAM0 _u(0x0f)
|
||||
#define BUSCTRL_PERFSEL2_VALUE_XIP_MAIN_CONTESTED _u(0x10)
|
||||
#define BUSCTRL_PERFSEL2_VALUE_XIP_MAIN _u(0x11)
|
||||
#define BUSCTRL_PERFSEL2_VALUE_ROM_CONTESTED _u(0x12)
|
||||
#define BUSCTRL_PERFSEL2_VALUE_ROM _u(0x13)
|
||||
// =============================================================================
|
||||
// Register : BUSCTRL_PERFCTR3
|
||||
// Description : Bus fabric performance counter 3
|
||||
// Busfabric saturating performance counter 3
|
||||
// Count some event signal from the busfabric arbiters.
|
||||
// Write any value to clear. Select an event to count using
|
||||
// PERFSEL3
|
||||
#define BUSCTRL_PERFCTR3_OFFSET _u(0x00000020)
|
||||
#define BUSCTRL_PERFCTR3_BITS _u(0x00ffffff)
|
||||
#define BUSCTRL_PERFCTR3_RESET _u(0x00000000)
|
||||
#define BUSCTRL_PERFCTR3_MSB _u(23)
|
||||
#define BUSCTRL_PERFCTR3_LSB _u(0)
|
||||
#define BUSCTRL_PERFCTR3_ACCESS "WC"
|
||||
// =============================================================================
|
||||
// Register : BUSCTRL_PERFSEL3
|
||||
// Description : Bus fabric performance event select for PERFCTR3
|
||||
// Select an event for PERFCTR3. Count either contested accesses,
|
||||
// or all accesses, on a downstream port of the main crossbar.
|
||||
// 0x00 -> apb_contested
|
||||
// 0x01 -> apb
|
||||
// 0x02 -> fastperi_contested
|
||||
// 0x03 -> fastperi
|
||||
// 0x04 -> sram5_contested
|
||||
// 0x05 -> sram5
|
||||
// 0x06 -> sram4_contested
|
||||
// 0x07 -> sram4
|
||||
// 0x08 -> sram3_contested
|
||||
// 0x09 -> sram3
|
||||
// 0x0a -> sram2_contested
|
||||
// 0x0b -> sram2
|
||||
// 0x0c -> sram1_contested
|
||||
// 0x0d -> sram1
|
||||
// 0x0e -> sram0_contested
|
||||
// 0x0f -> sram0
|
||||
// 0x10 -> xip_main_contested
|
||||
// 0x11 -> xip_main
|
||||
// 0x12 -> rom_contested
|
||||
// 0x13 -> rom
|
||||
#define BUSCTRL_PERFSEL3_OFFSET _u(0x00000024)
|
||||
#define BUSCTRL_PERFSEL3_BITS _u(0x0000001f)
|
||||
#define BUSCTRL_PERFSEL3_RESET _u(0x0000001f)
|
||||
#define BUSCTRL_PERFSEL3_MSB _u(4)
|
||||
#define BUSCTRL_PERFSEL3_LSB _u(0)
|
||||
#define BUSCTRL_PERFSEL3_ACCESS "RW"
|
||||
#define BUSCTRL_PERFSEL3_VALUE_APB_CONTESTED _u(0x00)
|
||||
#define BUSCTRL_PERFSEL3_VALUE_APB _u(0x01)
|
||||
#define BUSCTRL_PERFSEL3_VALUE_FASTPERI_CONTESTED _u(0x02)
|
||||
#define BUSCTRL_PERFSEL3_VALUE_FASTPERI _u(0x03)
|
||||
#define BUSCTRL_PERFSEL3_VALUE_SRAM5_CONTESTED _u(0x04)
|
||||
#define BUSCTRL_PERFSEL3_VALUE_SRAM5 _u(0x05)
|
||||
#define BUSCTRL_PERFSEL3_VALUE_SRAM4_CONTESTED _u(0x06)
|
||||
#define BUSCTRL_PERFSEL3_VALUE_SRAM4 _u(0x07)
|
||||
#define BUSCTRL_PERFSEL3_VALUE_SRAM3_CONTESTED _u(0x08)
|
||||
#define BUSCTRL_PERFSEL3_VALUE_SRAM3 _u(0x09)
|
||||
#define BUSCTRL_PERFSEL3_VALUE_SRAM2_CONTESTED _u(0x0a)
|
||||
#define BUSCTRL_PERFSEL3_VALUE_SRAM2 _u(0x0b)
|
||||
#define BUSCTRL_PERFSEL3_VALUE_SRAM1_CONTESTED _u(0x0c)
|
||||
#define BUSCTRL_PERFSEL3_VALUE_SRAM1 _u(0x0d)
|
||||
#define BUSCTRL_PERFSEL3_VALUE_SRAM0_CONTESTED _u(0x0e)
|
||||
#define BUSCTRL_PERFSEL3_VALUE_SRAM0 _u(0x0f)
|
||||
#define BUSCTRL_PERFSEL3_VALUE_XIP_MAIN_CONTESTED _u(0x10)
|
||||
#define BUSCTRL_PERFSEL3_VALUE_XIP_MAIN _u(0x11)
|
||||
#define BUSCTRL_PERFSEL3_VALUE_ROM_CONTESTED _u(0x12)
|
||||
#define BUSCTRL_PERFSEL3_VALUE_ROM _u(0x13)
|
||||
// =============================================================================
|
||||
#endif // HARDWARE_REGS_BUSCTRL_DEFINED
|
2409
lib/rp2040/hardware/regs/clocks.h
Normal file
2409
lib/rp2040/hardware/regs/clocks.h
Normal file
File diff suppressed because it is too large
Load Diff
5313
lib/rp2040/hardware/regs/dma.h
Normal file
5313
lib/rp2040/hardware/regs/dma.h
Normal file
File diff suppressed because it is too large
Load Diff
50
lib/rp2040/hardware/regs/dreq.h
Normal file
50
lib/rp2040/hardware/regs/dreq.h
Normal file
@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#ifndef _DREQ_H_
|
||||
#define _DREQ_H_
|
||||
|
||||
#define DREQ_PIO0_TX0 0x0
|
||||
#define DREQ_PIO0_TX1 0x1
|
||||
#define DREQ_PIO0_TX2 0x2
|
||||
#define DREQ_PIO0_TX3 0x3
|
||||
#define DREQ_PIO0_RX0 0x4
|
||||
#define DREQ_PIO0_RX1 0x5
|
||||
#define DREQ_PIO0_RX2 0x6
|
||||
#define DREQ_PIO0_RX3 0x7
|
||||
#define DREQ_PIO1_TX0 0x8
|
||||
#define DREQ_PIO1_TX1 0x9
|
||||
#define DREQ_PIO1_TX2 0xa
|
||||
#define DREQ_PIO1_TX3 0xb
|
||||
#define DREQ_PIO1_RX0 0xc
|
||||
#define DREQ_PIO1_RX1 0xd
|
||||
#define DREQ_PIO1_RX2 0xe
|
||||
#define DREQ_PIO1_RX3 0xf
|
||||
#define DREQ_SPI0_TX 0x10
|
||||
#define DREQ_SPI0_RX 0x11
|
||||
#define DREQ_SPI1_TX 0x12
|
||||
#define DREQ_SPI1_RX 0x13
|
||||
#define DREQ_UART0_TX 0x14
|
||||
#define DREQ_UART0_RX 0x15
|
||||
#define DREQ_UART1_TX 0x16
|
||||
#define DREQ_UART1_RX 0x17
|
||||
#define DREQ_PWM_WRAP0 0x18
|
||||
#define DREQ_PWM_WRAP1 0x19
|
||||
#define DREQ_PWM_WRAP2 0x1a
|
||||
#define DREQ_PWM_WRAP3 0x1b
|
||||
#define DREQ_PWM_WRAP4 0x1c
|
||||
#define DREQ_PWM_WRAP5 0x1d
|
||||
#define DREQ_PWM_WRAP6 0x1e
|
||||
#define DREQ_PWM_WRAP7 0x1f
|
||||
#define DREQ_I2C0_TX 0x20
|
||||
#define DREQ_I2C0_RX 0x21
|
||||
#define DREQ_I2C1_TX 0x22
|
||||
#define DREQ_I2C1_RX 0x23
|
||||
#define DREQ_ADC 0x24
|
||||
#define DREQ_XIP_STREAM 0x25
|
||||
#define DREQ_XIP_SSITX 0x26
|
||||
#define DREQ_XIP_SSIRX 0x27
|
||||
|
||||
#endif // _DREQ_H_
|
2639
lib/rp2040/hardware/regs/i2c.h
Normal file
2639
lib/rp2040/hardware/regs/i2c.h
Normal file
File diff suppressed because it is too large
Load Diff
63
lib/rp2040/hardware/regs/intctrl.h
Normal file
63
lib/rp2040/hardware/regs/intctrl.h
Normal file
@ -0,0 +1,63 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#ifndef _INTCTRL_H_
|
||||
#define _INTCTRL_H_
|
||||
|
||||
#define TIMER_IRQ_0 0
|
||||
#define TIMER_IRQ_1 1
|
||||
#define TIMER_IRQ_2 2
|
||||
#define TIMER_IRQ_3 3
|
||||
#define PWM_IRQ_WRAP 4
|
||||
#define USBCTRL_IRQ 5
|
||||
#define XIP_IRQ 6
|
||||
#define PIO0_IRQ_0 7
|
||||
#define PIO0_IRQ_1 8
|
||||
#define PIO1_IRQ_0 9
|
||||
#define PIO1_IRQ_1 10
|
||||
#define DMA_IRQ_0 11
|
||||
#define DMA_IRQ_1 12
|
||||
#define IO_IRQ_BANK0 13
|
||||
#define IO_IRQ_QSPI 14
|
||||
#define SIO_IRQ_PROC0 15
|
||||
#define SIO_IRQ_PROC1 16
|
||||
#define CLOCKS_IRQ 17
|
||||
#define SPI0_IRQ 18
|
||||
#define SPI1_IRQ 19
|
||||
#define UART0_IRQ 20
|
||||
#define UART1_IRQ 21
|
||||
#define ADC_IRQ_FIFO 22
|
||||
#define I2C0_IRQ 23
|
||||
#define I2C1_IRQ 24
|
||||
#define RTC_IRQ 25
|
||||
|
||||
#define isr_timer_0 isr_irq0
|
||||
#define isr_timer_1 isr_irq1
|
||||
#define isr_timer_2 isr_irq2
|
||||
#define isr_timer_3 isr_irq3
|
||||
#define isr_pwm_wrap isr_irq4
|
||||
#define isr_usbctrl isr_irq5
|
||||
#define isr_xip isr_irq6
|
||||
#define isr_pio0_0 isr_irq7
|
||||
#define isr_pio0_1 isr_irq8
|
||||
#define isr_pio1_0 isr_irq9
|
||||
#define isr_pio1_1 isr_irq10
|
||||
#define isr_dma_0 isr_irq11
|
||||
#define isr_dma_1 isr_irq12
|
||||
#define isr_io_bank0 isr_irq13
|
||||
#define isr_io_qspi isr_irq14
|
||||
#define isr_sio_proc0 isr_irq15
|
||||
#define isr_sio_proc1 isr_irq16
|
||||
#define isr_clocks isr_irq17
|
||||
#define isr_spi0 isr_irq18
|
||||
#define isr_spi1 isr_irq19
|
||||
#define isr_uart0 isr_irq20
|
||||
#define isr_uart1 isr_irq21
|
||||
#define isr_adc_fifo isr_irq22
|
||||
#define isr_i2c0 isr_irq23
|
||||
#define isr_i2c1 isr_irq24
|
||||
#define isr_rtc isr_irq25
|
||||
|
||||
#endif // _INTCTRL_H_
|
14937
lib/rp2040/hardware/regs/io_bank0.h
Normal file
14937
lib/rp2040/hardware/regs/io_bank0.h
Normal file
File diff suppressed because it is too large
Load Diff
2931
lib/rp2040/hardware/regs/io_qspi.h
Normal file
2931
lib/rp2040/hardware/regs/io_qspi.h
Normal file
File diff suppressed because it is too large
Load Diff
1149
lib/rp2040/hardware/regs/m0plus.h
Normal file
1149
lib/rp2040/hardware/regs/m0plus.h
Normal file
File diff suppressed because it is too large
Load Diff
2300
lib/rp2040/hardware/regs/pads_bank0.h
Normal file
2300
lib/rp2040/hardware/regs/pads_bank0.h
Normal file
File diff suppressed because it is too large
Load Diff
454
lib/rp2040/hardware/regs/pads_qspi.h
Normal file
454
lib/rp2040/hardware/regs/pads_qspi.h
Normal file
@ -0,0 +1,454 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// =============================================================================
|
||||
// Register block : PADS_QSPI
|
||||
// Version : 1
|
||||
// Bus type : apb
|
||||
// Description : None
|
||||
// =============================================================================
|
||||
#ifndef HARDWARE_REGS_PADS_QSPI_DEFINED
|
||||
#define HARDWARE_REGS_PADS_QSPI_DEFINED
|
||||
// =============================================================================
|
||||
// Register : PADS_QSPI_VOLTAGE_SELECT
|
||||
// Description : Voltage select. Per bank control
|
||||
// 0x0 -> Set voltage to 3.3V (DVDD >= 2V5)
|
||||
// 0x1 -> Set voltage to 1.8V (DVDD <= 1V8)
|
||||
#define PADS_QSPI_VOLTAGE_SELECT_OFFSET _u(0x00000000)
|
||||
#define PADS_QSPI_VOLTAGE_SELECT_BITS _u(0x00000001)
|
||||
#define PADS_QSPI_VOLTAGE_SELECT_RESET _u(0x00000000)
|
||||
#define PADS_QSPI_VOLTAGE_SELECT_MSB _u(0)
|
||||
#define PADS_QSPI_VOLTAGE_SELECT_LSB _u(0)
|
||||
#define PADS_QSPI_VOLTAGE_SELECT_ACCESS "RW"
|
||||
#define PADS_QSPI_VOLTAGE_SELECT_VALUE_3V3 _u(0x0)
|
||||
#define PADS_QSPI_VOLTAGE_SELECT_VALUE_1V8 _u(0x1)
|
||||
// =============================================================================
|
||||
// Register : PADS_QSPI_GPIO_QSPI_SCLK
|
||||
// Description : Pad control register
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_OFFSET _u(0x00000004)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_BITS _u(0x000000ff)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_RESET _u(0x00000056)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SCLK_OD
|
||||
// Description : Output disable. Has priority over output enable from
|
||||
// peripherals
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_OD_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_OD_BITS _u(0x00000080)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_OD_MSB _u(7)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_OD_LSB _u(7)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_OD_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SCLK_IE
|
||||
// Description : Input enable
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_IE_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_IE_BITS _u(0x00000040)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_IE_MSB _u(6)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_IE_LSB _u(6)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_IE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SCLK_DRIVE
|
||||
// Description : Drive strength.
|
||||
// 0x0 -> 2mA
|
||||
// 0x1 -> 4mA
|
||||
// 0x2 -> 8mA
|
||||
// 0x3 -> 12mA
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_DRIVE_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_DRIVE_BITS _u(0x00000030)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_DRIVE_MSB _u(5)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_DRIVE_LSB _u(4)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_DRIVE_ACCESS "RW"
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_DRIVE_VALUE_2MA _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_DRIVE_VALUE_4MA _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_DRIVE_VALUE_8MA _u(0x2)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_DRIVE_VALUE_12MA _u(0x3)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SCLK_PUE
|
||||
// Description : Pull up enable
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_PUE_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_PUE_BITS _u(0x00000008)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_PUE_MSB _u(3)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_PUE_LSB _u(3)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_PUE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SCLK_PDE
|
||||
// Description : Pull down enable
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_PDE_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_PDE_BITS _u(0x00000004)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_PDE_MSB _u(2)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_PDE_LSB _u(2)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_PDE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SCLK_SCHMITT
|
||||
// Description : Enable schmitt trigger
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_SCHMITT_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_SCHMITT_BITS _u(0x00000002)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_SCHMITT_MSB _u(1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_SCHMITT_LSB _u(1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_SCHMITT_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SCLK_SLEWFAST
|
||||
// Description : Slew rate control. 1 = Fast, 0 = Slow
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_SLEWFAST_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_SLEWFAST_BITS _u(0x00000001)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_SLEWFAST_MSB _u(0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_SLEWFAST_LSB _u(0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SCLK_SLEWFAST_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : PADS_QSPI_GPIO_QSPI_SD0
|
||||
// Description : Pad control register
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_OFFSET _u(0x00000008)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_BITS _u(0x000000ff)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_RESET _u(0x00000052)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD0_OD
|
||||
// Description : Output disable. Has priority over output enable from
|
||||
// peripherals
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_OD_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_OD_BITS _u(0x00000080)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_OD_MSB _u(7)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_OD_LSB _u(7)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_OD_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD0_IE
|
||||
// Description : Input enable
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_IE_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_IE_BITS _u(0x00000040)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_IE_MSB _u(6)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_IE_LSB _u(6)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_IE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD0_DRIVE
|
||||
// Description : Drive strength.
|
||||
// 0x0 -> 2mA
|
||||
// 0x1 -> 4mA
|
||||
// 0x2 -> 8mA
|
||||
// 0x3 -> 12mA
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_DRIVE_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_DRIVE_BITS _u(0x00000030)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_DRIVE_MSB _u(5)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_DRIVE_LSB _u(4)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_DRIVE_ACCESS "RW"
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_DRIVE_VALUE_2MA _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_DRIVE_VALUE_4MA _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_DRIVE_VALUE_8MA _u(0x2)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_DRIVE_VALUE_12MA _u(0x3)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD0_PUE
|
||||
// Description : Pull up enable
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_PUE_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_PUE_BITS _u(0x00000008)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_PUE_MSB _u(3)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_PUE_LSB _u(3)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_PUE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD0_PDE
|
||||
// Description : Pull down enable
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_PDE_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_PDE_BITS _u(0x00000004)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_PDE_MSB _u(2)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_PDE_LSB _u(2)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_PDE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD0_SCHMITT
|
||||
// Description : Enable schmitt trigger
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_SCHMITT_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_SCHMITT_BITS _u(0x00000002)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_SCHMITT_MSB _u(1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_SCHMITT_LSB _u(1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_SCHMITT_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD0_SLEWFAST
|
||||
// Description : Slew rate control. 1 = Fast, 0 = Slow
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_SLEWFAST_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_SLEWFAST_BITS _u(0x00000001)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_SLEWFAST_MSB _u(0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_SLEWFAST_LSB _u(0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD0_SLEWFAST_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : PADS_QSPI_GPIO_QSPI_SD1
|
||||
// Description : Pad control register
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_OFFSET _u(0x0000000c)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_BITS _u(0x000000ff)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_RESET _u(0x00000052)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD1_OD
|
||||
// Description : Output disable. Has priority over output enable from
|
||||
// peripherals
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_OD_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_OD_BITS _u(0x00000080)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_OD_MSB _u(7)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_OD_LSB _u(7)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_OD_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD1_IE
|
||||
// Description : Input enable
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_IE_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_IE_BITS _u(0x00000040)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_IE_MSB _u(6)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_IE_LSB _u(6)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_IE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD1_DRIVE
|
||||
// Description : Drive strength.
|
||||
// 0x0 -> 2mA
|
||||
// 0x1 -> 4mA
|
||||
// 0x2 -> 8mA
|
||||
// 0x3 -> 12mA
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_DRIVE_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_DRIVE_BITS _u(0x00000030)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_DRIVE_MSB _u(5)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_DRIVE_LSB _u(4)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_DRIVE_ACCESS "RW"
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_DRIVE_VALUE_2MA _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_DRIVE_VALUE_4MA _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_DRIVE_VALUE_8MA _u(0x2)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_DRIVE_VALUE_12MA _u(0x3)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD1_PUE
|
||||
// Description : Pull up enable
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_PUE_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_PUE_BITS _u(0x00000008)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_PUE_MSB _u(3)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_PUE_LSB _u(3)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_PUE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD1_PDE
|
||||
// Description : Pull down enable
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_PDE_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_PDE_BITS _u(0x00000004)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_PDE_MSB _u(2)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_PDE_LSB _u(2)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_PDE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD1_SCHMITT
|
||||
// Description : Enable schmitt trigger
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_SCHMITT_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_SCHMITT_BITS _u(0x00000002)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_SCHMITT_MSB _u(1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_SCHMITT_LSB _u(1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_SCHMITT_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD1_SLEWFAST
|
||||
// Description : Slew rate control. 1 = Fast, 0 = Slow
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_SLEWFAST_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_SLEWFAST_BITS _u(0x00000001)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_SLEWFAST_MSB _u(0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_SLEWFAST_LSB _u(0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD1_SLEWFAST_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : PADS_QSPI_GPIO_QSPI_SD2
|
||||
// Description : Pad control register
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_OFFSET _u(0x00000010)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_BITS _u(0x000000ff)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_RESET _u(0x00000052)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD2_OD
|
||||
// Description : Output disable. Has priority over output enable from
|
||||
// peripherals
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_OD_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_OD_BITS _u(0x00000080)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_OD_MSB _u(7)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_OD_LSB _u(7)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_OD_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD2_IE
|
||||
// Description : Input enable
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_IE_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_IE_BITS _u(0x00000040)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_IE_MSB _u(6)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_IE_LSB _u(6)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_IE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD2_DRIVE
|
||||
// Description : Drive strength.
|
||||
// 0x0 -> 2mA
|
||||
// 0x1 -> 4mA
|
||||
// 0x2 -> 8mA
|
||||
// 0x3 -> 12mA
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_DRIVE_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_DRIVE_BITS _u(0x00000030)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_DRIVE_MSB _u(5)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_DRIVE_LSB _u(4)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_DRIVE_ACCESS "RW"
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_DRIVE_VALUE_2MA _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_DRIVE_VALUE_4MA _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_DRIVE_VALUE_8MA _u(0x2)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_DRIVE_VALUE_12MA _u(0x3)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD2_PUE
|
||||
// Description : Pull up enable
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_PUE_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_PUE_BITS _u(0x00000008)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_PUE_MSB _u(3)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_PUE_LSB _u(3)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_PUE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD2_PDE
|
||||
// Description : Pull down enable
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_PDE_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_PDE_BITS _u(0x00000004)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_PDE_MSB _u(2)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_PDE_LSB _u(2)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_PDE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD2_SCHMITT
|
||||
// Description : Enable schmitt trigger
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_SCHMITT_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_SCHMITT_BITS _u(0x00000002)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_SCHMITT_MSB _u(1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_SCHMITT_LSB _u(1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_SCHMITT_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD2_SLEWFAST
|
||||
// Description : Slew rate control. 1 = Fast, 0 = Slow
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_SLEWFAST_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_SLEWFAST_BITS _u(0x00000001)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_SLEWFAST_MSB _u(0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_SLEWFAST_LSB _u(0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD2_SLEWFAST_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : PADS_QSPI_GPIO_QSPI_SD3
|
||||
// Description : Pad control register
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_OFFSET _u(0x00000014)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_BITS _u(0x000000ff)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_RESET _u(0x00000052)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD3_OD
|
||||
// Description : Output disable. Has priority over output enable from
|
||||
// peripherals
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_OD_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_OD_BITS _u(0x00000080)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_OD_MSB _u(7)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_OD_LSB _u(7)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_OD_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD3_IE
|
||||
// Description : Input enable
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_IE_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_IE_BITS _u(0x00000040)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_IE_MSB _u(6)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_IE_LSB _u(6)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_IE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD3_DRIVE
|
||||
// Description : Drive strength.
|
||||
// 0x0 -> 2mA
|
||||
// 0x1 -> 4mA
|
||||
// 0x2 -> 8mA
|
||||
// 0x3 -> 12mA
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_DRIVE_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_DRIVE_BITS _u(0x00000030)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_DRIVE_MSB _u(5)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_DRIVE_LSB _u(4)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_DRIVE_ACCESS "RW"
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_DRIVE_VALUE_2MA _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_DRIVE_VALUE_4MA _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_DRIVE_VALUE_8MA _u(0x2)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_DRIVE_VALUE_12MA _u(0x3)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD3_PUE
|
||||
// Description : Pull up enable
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_PUE_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_PUE_BITS _u(0x00000008)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_PUE_MSB _u(3)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_PUE_LSB _u(3)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_PUE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD3_PDE
|
||||
// Description : Pull down enable
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_PDE_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_PDE_BITS _u(0x00000004)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_PDE_MSB _u(2)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_PDE_LSB _u(2)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_PDE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD3_SCHMITT
|
||||
// Description : Enable schmitt trigger
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_SCHMITT_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_SCHMITT_BITS _u(0x00000002)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_SCHMITT_MSB _u(1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_SCHMITT_LSB _u(1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_SCHMITT_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SD3_SLEWFAST
|
||||
// Description : Slew rate control. 1 = Fast, 0 = Slow
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_SLEWFAST_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_SLEWFAST_BITS _u(0x00000001)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_SLEWFAST_MSB _u(0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_SLEWFAST_LSB _u(0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SD3_SLEWFAST_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : PADS_QSPI_GPIO_QSPI_SS
|
||||
// Description : Pad control register
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_OFFSET _u(0x00000018)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_BITS _u(0x000000ff)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_RESET _u(0x0000005a)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SS_OD
|
||||
// Description : Output disable. Has priority over output enable from
|
||||
// peripherals
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_OD_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_OD_BITS _u(0x00000080)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_OD_MSB _u(7)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_OD_LSB _u(7)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_OD_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SS_IE
|
||||
// Description : Input enable
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_IE_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_IE_BITS _u(0x00000040)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_IE_MSB _u(6)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_IE_LSB _u(6)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_IE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SS_DRIVE
|
||||
// Description : Drive strength.
|
||||
// 0x0 -> 2mA
|
||||
// 0x1 -> 4mA
|
||||
// 0x2 -> 8mA
|
||||
// 0x3 -> 12mA
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_DRIVE_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_DRIVE_BITS _u(0x00000030)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_DRIVE_MSB _u(5)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_DRIVE_LSB _u(4)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_DRIVE_ACCESS "RW"
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_DRIVE_VALUE_2MA _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_DRIVE_VALUE_4MA _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_DRIVE_VALUE_8MA _u(0x2)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_DRIVE_VALUE_12MA _u(0x3)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SS_PUE
|
||||
// Description : Pull up enable
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_PUE_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_PUE_BITS _u(0x00000008)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_PUE_MSB _u(3)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_PUE_LSB _u(3)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_PUE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SS_PDE
|
||||
// Description : Pull down enable
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_PDE_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_PDE_BITS _u(0x00000004)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_PDE_MSB _u(2)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_PDE_LSB _u(2)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_PDE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SS_SCHMITT
|
||||
// Description : Enable schmitt trigger
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_SCHMITT_RESET _u(0x1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_SCHMITT_BITS _u(0x00000002)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_SCHMITT_MSB _u(1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_SCHMITT_LSB _u(1)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_SCHMITT_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PADS_QSPI_GPIO_QSPI_SS_SLEWFAST
|
||||
// Description : Slew rate control. 1 = Fast, 0 = Slow
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_SLEWFAST_RESET _u(0x0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_SLEWFAST_BITS _u(0x00000001)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_SLEWFAST_MSB _u(0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_SLEWFAST_LSB _u(0)
|
||||
#define PADS_QSPI_GPIO_QSPI_SS_SLEWFAST_ACCESS "RW"
|
||||
// =============================================================================
|
||||
#endif // HARDWARE_REGS_PADS_QSPI_DEFINED
|
2762
lib/rp2040/hardware/regs/pio.h
Normal file
2762
lib/rp2040/hardware/regs/pio.h
Normal file
File diff suppressed because it is too large
Load Diff
135
lib/rp2040/hardware/regs/pll.h
Normal file
135
lib/rp2040/hardware/regs/pll.h
Normal file
@ -0,0 +1,135 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// =============================================================================
|
||||
// Register block : PLL
|
||||
// Version : 1
|
||||
// Bus type : apb
|
||||
// Description : None
|
||||
// =============================================================================
|
||||
#ifndef HARDWARE_REGS_PLL_DEFINED
|
||||
#define HARDWARE_REGS_PLL_DEFINED
|
||||
// =============================================================================
|
||||
// Register : PLL_CS
|
||||
// Description : Control and Status
|
||||
// GENERAL CONSTRAINTS:
|
||||
// Reference clock frequency min=5MHz, max=800MHz
|
||||
// Feedback divider min=16, max=320
|
||||
// VCO frequency min=400MHz, max=1600MHz
|
||||
#define PLL_CS_OFFSET _u(0x00000000)
|
||||
#define PLL_CS_BITS _u(0x8000013f)
|
||||
#define PLL_CS_RESET _u(0x00000001)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PLL_CS_LOCK
|
||||
// Description : PLL is locked
|
||||
#define PLL_CS_LOCK_RESET _u(0x0)
|
||||
#define PLL_CS_LOCK_BITS _u(0x80000000)
|
||||
#define PLL_CS_LOCK_MSB _u(31)
|
||||
#define PLL_CS_LOCK_LSB _u(31)
|
||||
#define PLL_CS_LOCK_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PLL_CS_BYPASS
|
||||
// Description : Passes the reference clock to the output instead of the divided
|
||||
// VCO. The VCO continues to run so the user can switch between
|
||||
// the reference clock and the divided VCO but the output will
|
||||
// glitch when doing so.
|
||||
#define PLL_CS_BYPASS_RESET _u(0x0)
|
||||
#define PLL_CS_BYPASS_BITS _u(0x00000100)
|
||||
#define PLL_CS_BYPASS_MSB _u(8)
|
||||
#define PLL_CS_BYPASS_LSB _u(8)
|
||||
#define PLL_CS_BYPASS_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PLL_CS_REFDIV
|
||||
// Description : Divides the PLL input reference clock.
|
||||
// Behaviour is undefined for div=0.
|
||||
// PLL output will be unpredictable during refdiv changes, wait
|
||||
// for lock=1 before using it.
|
||||
#define PLL_CS_REFDIV_RESET _u(0x01)
|
||||
#define PLL_CS_REFDIV_BITS _u(0x0000003f)
|
||||
#define PLL_CS_REFDIV_MSB _u(5)
|
||||
#define PLL_CS_REFDIV_LSB _u(0)
|
||||
#define PLL_CS_REFDIV_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : PLL_PWR
|
||||
// Description : Controls the PLL power modes.
|
||||
#define PLL_PWR_OFFSET _u(0x00000004)
|
||||
#define PLL_PWR_BITS _u(0x0000002d)
|
||||
#define PLL_PWR_RESET _u(0x0000002d)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PLL_PWR_VCOPD
|
||||
// Description : PLL VCO powerdown
|
||||
// To save power set high when PLL output not required or
|
||||
// bypass=1.
|
||||
#define PLL_PWR_VCOPD_RESET _u(0x1)
|
||||
#define PLL_PWR_VCOPD_BITS _u(0x00000020)
|
||||
#define PLL_PWR_VCOPD_MSB _u(5)
|
||||
#define PLL_PWR_VCOPD_LSB _u(5)
|
||||
#define PLL_PWR_VCOPD_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PLL_PWR_POSTDIVPD
|
||||
// Description : PLL post divider powerdown
|
||||
// To save power set high when PLL output not required or
|
||||
// bypass=1.
|
||||
#define PLL_PWR_POSTDIVPD_RESET _u(0x1)
|
||||
#define PLL_PWR_POSTDIVPD_BITS _u(0x00000008)
|
||||
#define PLL_PWR_POSTDIVPD_MSB _u(3)
|
||||
#define PLL_PWR_POSTDIVPD_LSB _u(3)
|
||||
#define PLL_PWR_POSTDIVPD_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PLL_PWR_DSMPD
|
||||
// Description : PLL DSM powerdown
|
||||
// Nothing is achieved by setting this low.
|
||||
#define PLL_PWR_DSMPD_RESET _u(0x1)
|
||||
#define PLL_PWR_DSMPD_BITS _u(0x00000004)
|
||||
#define PLL_PWR_DSMPD_MSB _u(2)
|
||||
#define PLL_PWR_DSMPD_LSB _u(2)
|
||||
#define PLL_PWR_DSMPD_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PLL_PWR_PD
|
||||
// Description : PLL powerdown
|
||||
// To save power set high when PLL output not required.
|
||||
#define PLL_PWR_PD_RESET _u(0x1)
|
||||
#define PLL_PWR_PD_BITS _u(0x00000001)
|
||||
#define PLL_PWR_PD_MSB _u(0)
|
||||
#define PLL_PWR_PD_LSB _u(0)
|
||||
#define PLL_PWR_PD_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : PLL_FBDIV_INT
|
||||
// Description : Feedback divisor
|
||||
// (note: this PLL does not support fractional division)
|
||||
// see ctrl reg description for constraints
|
||||
#define PLL_FBDIV_INT_OFFSET _u(0x00000008)
|
||||
#define PLL_FBDIV_INT_BITS _u(0x00000fff)
|
||||
#define PLL_FBDIV_INT_RESET _u(0x00000000)
|
||||
#define PLL_FBDIV_INT_MSB _u(11)
|
||||
#define PLL_FBDIV_INT_LSB _u(0)
|
||||
#define PLL_FBDIV_INT_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : PLL_PRIM
|
||||
// Description : Controls the PLL post dividers for the primary output
|
||||
// (note: this PLL does not have a secondary output)
|
||||
// the primary output is driven from VCO divided by
|
||||
// postdiv1*postdiv2
|
||||
#define PLL_PRIM_OFFSET _u(0x0000000c)
|
||||
#define PLL_PRIM_BITS _u(0x00077000)
|
||||
#define PLL_PRIM_RESET _u(0x00077000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PLL_PRIM_POSTDIV1
|
||||
// Description : divide by 1-7
|
||||
#define PLL_PRIM_POSTDIV1_RESET _u(0x7)
|
||||
#define PLL_PRIM_POSTDIV1_BITS _u(0x00070000)
|
||||
#define PLL_PRIM_POSTDIV1_MSB _u(18)
|
||||
#define PLL_PRIM_POSTDIV1_LSB _u(16)
|
||||
#define PLL_PRIM_POSTDIV1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PLL_PRIM_POSTDIV2
|
||||
// Description : divide by 1-7
|
||||
#define PLL_PRIM_POSTDIV2_RESET _u(0x7)
|
||||
#define PLL_PRIM_POSTDIV2_BITS _u(0x00007000)
|
||||
#define PLL_PRIM_POSTDIV2_MSB _u(14)
|
||||
#define PLL_PRIM_POSTDIV2_LSB _u(12)
|
||||
#define PLL_PRIM_POSTDIV2_ACCESS "RW"
|
||||
// =============================================================================
|
||||
#endif // HARDWARE_REGS_PLL_DEFINED
|
584
lib/rp2040/hardware/regs/psm.h
Normal file
584
lib/rp2040/hardware/regs/psm.h
Normal file
@ -0,0 +1,584 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// =============================================================================
|
||||
// Register block : PSM
|
||||
// Version : 1
|
||||
// Bus type : apb
|
||||
// Description : None
|
||||
// =============================================================================
|
||||
#ifndef HARDWARE_REGS_PSM_DEFINED
|
||||
#define HARDWARE_REGS_PSM_DEFINED
|
||||
// =============================================================================
|
||||
// Register : PSM_FRCE_ON
|
||||
// Description : Force block out of reset (i.e. power it on)
|
||||
#define PSM_FRCE_ON_OFFSET _u(0x00000000)
|
||||
#define PSM_FRCE_ON_BITS _u(0x0001ffff)
|
||||
#define PSM_FRCE_ON_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_ON_PROC1
|
||||
// Description : None
|
||||
#define PSM_FRCE_ON_PROC1_RESET _u(0x0)
|
||||
#define PSM_FRCE_ON_PROC1_BITS _u(0x00010000)
|
||||
#define PSM_FRCE_ON_PROC1_MSB _u(16)
|
||||
#define PSM_FRCE_ON_PROC1_LSB _u(16)
|
||||
#define PSM_FRCE_ON_PROC1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_ON_PROC0
|
||||
// Description : None
|
||||
#define PSM_FRCE_ON_PROC0_RESET _u(0x0)
|
||||
#define PSM_FRCE_ON_PROC0_BITS _u(0x00008000)
|
||||
#define PSM_FRCE_ON_PROC0_MSB _u(15)
|
||||
#define PSM_FRCE_ON_PROC0_LSB _u(15)
|
||||
#define PSM_FRCE_ON_PROC0_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_ON_SIO
|
||||
// Description : None
|
||||
#define PSM_FRCE_ON_SIO_RESET _u(0x0)
|
||||
#define PSM_FRCE_ON_SIO_BITS _u(0x00004000)
|
||||
#define PSM_FRCE_ON_SIO_MSB _u(14)
|
||||
#define PSM_FRCE_ON_SIO_LSB _u(14)
|
||||
#define PSM_FRCE_ON_SIO_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_ON_VREG_AND_CHIP_RESET
|
||||
// Description : None
|
||||
#define PSM_FRCE_ON_VREG_AND_CHIP_RESET_RESET _u(0x0)
|
||||
#define PSM_FRCE_ON_VREG_AND_CHIP_RESET_BITS _u(0x00002000)
|
||||
#define PSM_FRCE_ON_VREG_AND_CHIP_RESET_MSB _u(13)
|
||||
#define PSM_FRCE_ON_VREG_AND_CHIP_RESET_LSB _u(13)
|
||||
#define PSM_FRCE_ON_VREG_AND_CHIP_RESET_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_ON_XIP
|
||||
// Description : None
|
||||
#define PSM_FRCE_ON_XIP_RESET _u(0x0)
|
||||
#define PSM_FRCE_ON_XIP_BITS _u(0x00001000)
|
||||
#define PSM_FRCE_ON_XIP_MSB _u(12)
|
||||
#define PSM_FRCE_ON_XIP_LSB _u(12)
|
||||
#define PSM_FRCE_ON_XIP_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_ON_SRAM5
|
||||
// Description : None
|
||||
#define PSM_FRCE_ON_SRAM5_RESET _u(0x0)
|
||||
#define PSM_FRCE_ON_SRAM5_BITS _u(0x00000800)
|
||||
#define PSM_FRCE_ON_SRAM5_MSB _u(11)
|
||||
#define PSM_FRCE_ON_SRAM5_LSB _u(11)
|
||||
#define PSM_FRCE_ON_SRAM5_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_ON_SRAM4
|
||||
// Description : None
|
||||
#define PSM_FRCE_ON_SRAM4_RESET _u(0x0)
|
||||
#define PSM_FRCE_ON_SRAM4_BITS _u(0x00000400)
|
||||
#define PSM_FRCE_ON_SRAM4_MSB _u(10)
|
||||
#define PSM_FRCE_ON_SRAM4_LSB _u(10)
|
||||
#define PSM_FRCE_ON_SRAM4_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_ON_SRAM3
|
||||
// Description : None
|
||||
#define PSM_FRCE_ON_SRAM3_RESET _u(0x0)
|
||||
#define PSM_FRCE_ON_SRAM3_BITS _u(0x00000200)
|
||||
#define PSM_FRCE_ON_SRAM3_MSB _u(9)
|
||||
#define PSM_FRCE_ON_SRAM3_LSB _u(9)
|
||||
#define PSM_FRCE_ON_SRAM3_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_ON_SRAM2
|
||||
// Description : None
|
||||
#define PSM_FRCE_ON_SRAM2_RESET _u(0x0)
|
||||
#define PSM_FRCE_ON_SRAM2_BITS _u(0x00000100)
|
||||
#define PSM_FRCE_ON_SRAM2_MSB _u(8)
|
||||
#define PSM_FRCE_ON_SRAM2_LSB _u(8)
|
||||
#define PSM_FRCE_ON_SRAM2_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_ON_SRAM1
|
||||
// Description : None
|
||||
#define PSM_FRCE_ON_SRAM1_RESET _u(0x0)
|
||||
#define PSM_FRCE_ON_SRAM1_BITS _u(0x00000080)
|
||||
#define PSM_FRCE_ON_SRAM1_MSB _u(7)
|
||||
#define PSM_FRCE_ON_SRAM1_LSB _u(7)
|
||||
#define PSM_FRCE_ON_SRAM1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_ON_SRAM0
|
||||
// Description : None
|
||||
#define PSM_FRCE_ON_SRAM0_RESET _u(0x0)
|
||||
#define PSM_FRCE_ON_SRAM0_BITS _u(0x00000040)
|
||||
#define PSM_FRCE_ON_SRAM0_MSB _u(6)
|
||||
#define PSM_FRCE_ON_SRAM0_LSB _u(6)
|
||||
#define PSM_FRCE_ON_SRAM0_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_ON_ROM
|
||||
// Description : None
|
||||
#define PSM_FRCE_ON_ROM_RESET _u(0x0)
|
||||
#define PSM_FRCE_ON_ROM_BITS _u(0x00000020)
|
||||
#define PSM_FRCE_ON_ROM_MSB _u(5)
|
||||
#define PSM_FRCE_ON_ROM_LSB _u(5)
|
||||
#define PSM_FRCE_ON_ROM_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_ON_BUSFABRIC
|
||||
// Description : None
|
||||
#define PSM_FRCE_ON_BUSFABRIC_RESET _u(0x0)
|
||||
#define PSM_FRCE_ON_BUSFABRIC_BITS _u(0x00000010)
|
||||
#define PSM_FRCE_ON_BUSFABRIC_MSB _u(4)
|
||||
#define PSM_FRCE_ON_BUSFABRIC_LSB _u(4)
|
||||
#define PSM_FRCE_ON_BUSFABRIC_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_ON_RESETS
|
||||
// Description : None
|
||||
#define PSM_FRCE_ON_RESETS_RESET _u(0x0)
|
||||
#define PSM_FRCE_ON_RESETS_BITS _u(0x00000008)
|
||||
#define PSM_FRCE_ON_RESETS_MSB _u(3)
|
||||
#define PSM_FRCE_ON_RESETS_LSB _u(3)
|
||||
#define PSM_FRCE_ON_RESETS_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_ON_CLOCKS
|
||||
// Description : None
|
||||
#define PSM_FRCE_ON_CLOCKS_RESET _u(0x0)
|
||||
#define PSM_FRCE_ON_CLOCKS_BITS _u(0x00000004)
|
||||
#define PSM_FRCE_ON_CLOCKS_MSB _u(2)
|
||||
#define PSM_FRCE_ON_CLOCKS_LSB _u(2)
|
||||
#define PSM_FRCE_ON_CLOCKS_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_ON_XOSC
|
||||
// Description : None
|
||||
#define PSM_FRCE_ON_XOSC_RESET _u(0x0)
|
||||
#define PSM_FRCE_ON_XOSC_BITS _u(0x00000002)
|
||||
#define PSM_FRCE_ON_XOSC_MSB _u(1)
|
||||
#define PSM_FRCE_ON_XOSC_LSB _u(1)
|
||||
#define PSM_FRCE_ON_XOSC_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_ON_ROSC
|
||||
// Description : None
|
||||
#define PSM_FRCE_ON_ROSC_RESET _u(0x0)
|
||||
#define PSM_FRCE_ON_ROSC_BITS _u(0x00000001)
|
||||
#define PSM_FRCE_ON_ROSC_MSB _u(0)
|
||||
#define PSM_FRCE_ON_ROSC_LSB _u(0)
|
||||
#define PSM_FRCE_ON_ROSC_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : PSM_FRCE_OFF
|
||||
// Description : Force into reset (i.e. power it off)
|
||||
#define PSM_FRCE_OFF_OFFSET _u(0x00000004)
|
||||
#define PSM_FRCE_OFF_BITS _u(0x0001ffff)
|
||||
#define PSM_FRCE_OFF_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_OFF_PROC1
|
||||
// Description : None
|
||||
#define PSM_FRCE_OFF_PROC1_RESET _u(0x0)
|
||||
#define PSM_FRCE_OFF_PROC1_BITS _u(0x00010000)
|
||||
#define PSM_FRCE_OFF_PROC1_MSB _u(16)
|
||||
#define PSM_FRCE_OFF_PROC1_LSB _u(16)
|
||||
#define PSM_FRCE_OFF_PROC1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_OFF_PROC0
|
||||
// Description : None
|
||||
#define PSM_FRCE_OFF_PROC0_RESET _u(0x0)
|
||||
#define PSM_FRCE_OFF_PROC0_BITS _u(0x00008000)
|
||||
#define PSM_FRCE_OFF_PROC0_MSB _u(15)
|
||||
#define PSM_FRCE_OFF_PROC0_LSB _u(15)
|
||||
#define PSM_FRCE_OFF_PROC0_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_OFF_SIO
|
||||
// Description : None
|
||||
#define PSM_FRCE_OFF_SIO_RESET _u(0x0)
|
||||
#define PSM_FRCE_OFF_SIO_BITS _u(0x00004000)
|
||||
#define PSM_FRCE_OFF_SIO_MSB _u(14)
|
||||
#define PSM_FRCE_OFF_SIO_LSB _u(14)
|
||||
#define PSM_FRCE_OFF_SIO_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_OFF_VREG_AND_CHIP_RESET
|
||||
// Description : None
|
||||
#define PSM_FRCE_OFF_VREG_AND_CHIP_RESET_RESET _u(0x0)
|
||||
#define PSM_FRCE_OFF_VREG_AND_CHIP_RESET_BITS _u(0x00002000)
|
||||
#define PSM_FRCE_OFF_VREG_AND_CHIP_RESET_MSB _u(13)
|
||||
#define PSM_FRCE_OFF_VREG_AND_CHIP_RESET_LSB _u(13)
|
||||
#define PSM_FRCE_OFF_VREG_AND_CHIP_RESET_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_OFF_XIP
|
||||
// Description : None
|
||||
#define PSM_FRCE_OFF_XIP_RESET _u(0x0)
|
||||
#define PSM_FRCE_OFF_XIP_BITS _u(0x00001000)
|
||||
#define PSM_FRCE_OFF_XIP_MSB _u(12)
|
||||
#define PSM_FRCE_OFF_XIP_LSB _u(12)
|
||||
#define PSM_FRCE_OFF_XIP_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_OFF_SRAM5
|
||||
// Description : None
|
||||
#define PSM_FRCE_OFF_SRAM5_RESET _u(0x0)
|
||||
#define PSM_FRCE_OFF_SRAM5_BITS _u(0x00000800)
|
||||
#define PSM_FRCE_OFF_SRAM5_MSB _u(11)
|
||||
#define PSM_FRCE_OFF_SRAM5_LSB _u(11)
|
||||
#define PSM_FRCE_OFF_SRAM5_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_OFF_SRAM4
|
||||
// Description : None
|
||||
#define PSM_FRCE_OFF_SRAM4_RESET _u(0x0)
|
||||
#define PSM_FRCE_OFF_SRAM4_BITS _u(0x00000400)
|
||||
#define PSM_FRCE_OFF_SRAM4_MSB _u(10)
|
||||
#define PSM_FRCE_OFF_SRAM4_LSB _u(10)
|
||||
#define PSM_FRCE_OFF_SRAM4_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_OFF_SRAM3
|
||||
// Description : None
|
||||
#define PSM_FRCE_OFF_SRAM3_RESET _u(0x0)
|
||||
#define PSM_FRCE_OFF_SRAM3_BITS _u(0x00000200)
|
||||
#define PSM_FRCE_OFF_SRAM3_MSB _u(9)
|
||||
#define PSM_FRCE_OFF_SRAM3_LSB _u(9)
|
||||
#define PSM_FRCE_OFF_SRAM3_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_OFF_SRAM2
|
||||
// Description : None
|
||||
#define PSM_FRCE_OFF_SRAM2_RESET _u(0x0)
|
||||
#define PSM_FRCE_OFF_SRAM2_BITS _u(0x00000100)
|
||||
#define PSM_FRCE_OFF_SRAM2_MSB _u(8)
|
||||
#define PSM_FRCE_OFF_SRAM2_LSB _u(8)
|
||||
#define PSM_FRCE_OFF_SRAM2_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_OFF_SRAM1
|
||||
// Description : None
|
||||
#define PSM_FRCE_OFF_SRAM1_RESET _u(0x0)
|
||||
#define PSM_FRCE_OFF_SRAM1_BITS _u(0x00000080)
|
||||
#define PSM_FRCE_OFF_SRAM1_MSB _u(7)
|
||||
#define PSM_FRCE_OFF_SRAM1_LSB _u(7)
|
||||
#define PSM_FRCE_OFF_SRAM1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_OFF_SRAM0
|
||||
// Description : None
|
||||
#define PSM_FRCE_OFF_SRAM0_RESET _u(0x0)
|
||||
#define PSM_FRCE_OFF_SRAM0_BITS _u(0x00000040)
|
||||
#define PSM_FRCE_OFF_SRAM0_MSB _u(6)
|
||||
#define PSM_FRCE_OFF_SRAM0_LSB _u(6)
|
||||
#define PSM_FRCE_OFF_SRAM0_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_OFF_ROM
|
||||
// Description : None
|
||||
#define PSM_FRCE_OFF_ROM_RESET _u(0x0)
|
||||
#define PSM_FRCE_OFF_ROM_BITS _u(0x00000020)
|
||||
#define PSM_FRCE_OFF_ROM_MSB _u(5)
|
||||
#define PSM_FRCE_OFF_ROM_LSB _u(5)
|
||||
#define PSM_FRCE_OFF_ROM_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_OFF_BUSFABRIC
|
||||
// Description : None
|
||||
#define PSM_FRCE_OFF_BUSFABRIC_RESET _u(0x0)
|
||||
#define PSM_FRCE_OFF_BUSFABRIC_BITS _u(0x00000010)
|
||||
#define PSM_FRCE_OFF_BUSFABRIC_MSB _u(4)
|
||||
#define PSM_FRCE_OFF_BUSFABRIC_LSB _u(4)
|
||||
#define PSM_FRCE_OFF_BUSFABRIC_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_OFF_RESETS
|
||||
// Description : None
|
||||
#define PSM_FRCE_OFF_RESETS_RESET _u(0x0)
|
||||
#define PSM_FRCE_OFF_RESETS_BITS _u(0x00000008)
|
||||
#define PSM_FRCE_OFF_RESETS_MSB _u(3)
|
||||
#define PSM_FRCE_OFF_RESETS_LSB _u(3)
|
||||
#define PSM_FRCE_OFF_RESETS_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_OFF_CLOCKS
|
||||
// Description : None
|
||||
#define PSM_FRCE_OFF_CLOCKS_RESET _u(0x0)
|
||||
#define PSM_FRCE_OFF_CLOCKS_BITS _u(0x00000004)
|
||||
#define PSM_FRCE_OFF_CLOCKS_MSB _u(2)
|
||||
#define PSM_FRCE_OFF_CLOCKS_LSB _u(2)
|
||||
#define PSM_FRCE_OFF_CLOCKS_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_OFF_XOSC
|
||||
// Description : None
|
||||
#define PSM_FRCE_OFF_XOSC_RESET _u(0x0)
|
||||
#define PSM_FRCE_OFF_XOSC_BITS _u(0x00000002)
|
||||
#define PSM_FRCE_OFF_XOSC_MSB _u(1)
|
||||
#define PSM_FRCE_OFF_XOSC_LSB _u(1)
|
||||
#define PSM_FRCE_OFF_XOSC_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_FRCE_OFF_ROSC
|
||||
// Description : None
|
||||
#define PSM_FRCE_OFF_ROSC_RESET _u(0x0)
|
||||
#define PSM_FRCE_OFF_ROSC_BITS _u(0x00000001)
|
||||
#define PSM_FRCE_OFF_ROSC_MSB _u(0)
|
||||
#define PSM_FRCE_OFF_ROSC_LSB _u(0)
|
||||
#define PSM_FRCE_OFF_ROSC_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : PSM_WDSEL
|
||||
// Description : Set to 1 if this peripheral should be reset when the watchdog
|
||||
// fires.
|
||||
#define PSM_WDSEL_OFFSET _u(0x00000008)
|
||||
#define PSM_WDSEL_BITS _u(0x0001ffff)
|
||||
#define PSM_WDSEL_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_WDSEL_PROC1
|
||||
// Description : None
|
||||
#define PSM_WDSEL_PROC1_RESET _u(0x0)
|
||||
#define PSM_WDSEL_PROC1_BITS _u(0x00010000)
|
||||
#define PSM_WDSEL_PROC1_MSB _u(16)
|
||||
#define PSM_WDSEL_PROC1_LSB _u(16)
|
||||
#define PSM_WDSEL_PROC1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_WDSEL_PROC0
|
||||
// Description : None
|
||||
#define PSM_WDSEL_PROC0_RESET _u(0x0)
|
||||
#define PSM_WDSEL_PROC0_BITS _u(0x00008000)
|
||||
#define PSM_WDSEL_PROC0_MSB _u(15)
|
||||
#define PSM_WDSEL_PROC0_LSB _u(15)
|
||||
#define PSM_WDSEL_PROC0_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_WDSEL_SIO
|
||||
// Description : None
|
||||
#define PSM_WDSEL_SIO_RESET _u(0x0)
|
||||
#define PSM_WDSEL_SIO_BITS _u(0x00004000)
|
||||
#define PSM_WDSEL_SIO_MSB _u(14)
|
||||
#define PSM_WDSEL_SIO_LSB _u(14)
|
||||
#define PSM_WDSEL_SIO_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_WDSEL_VREG_AND_CHIP_RESET
|
||||
// Description : None
|
||||
#define PSM_WDSEL_VREG_AND_CHIP_RESET_RESET _u(0x0)
|
||||
#define PSM_WDSEL_VREG_AND_CHIP_RESET_BITS _u(0x00002000)
|
||||
#define PSM_WDSEL_VREG_AND_CHIP_RESET_MSB _u(13)
|
||||
#define PSM_WDSEL_VREG_AND_CHIP_RESET_LSB _u(13)
|
||||
#define PSM_WDSEL_VREG_AND_CHIP_RESET_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_WDSEL_XIP
|
||||
// Description : None
|
||||
#define PSM_WDSEL_XIP_RESET _u(0x0)
|
||||
#define PSM_WDSEL_XIP_BITS _u(0x00001000)
|
||||
#define PSM_WDSEL_XIP_MSB _u(12)
|
||||
#define PSM_WDSEL_XIP_LSB _u(12)
|
||||
#define PSM_WDSEL_XIP_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_WDSEL_SRAM5
|
||||
// Description : None
|
||||
#define PSM_WDSEL_SRAM5_RESET _u(0x0)
|
||||
#define PSM_WDSEL_SRAM5_BITS _u(0x00000800)
|
||||
#define PSM_WDSEL_SRAM5_MSB _u(11)
|
||||
#define PSM_WDSEL_SRAM5_LSB _u(11)
|
||||
#define PSM_WDSEL_SRAM5_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_WDSEL_SRAM4
|
||||
// Description : None
|
||||
#define PSM_WDSEL_SRAM4_RESET _u(0x0)
|
||||
#define PSM_WDSEL_SRAM4_BITS _u(0x00000400)
|
||||
#define PSM_WDSEL_SRAM4_MSB _u(10)
|
||||
#define PSM_WDSEL_SRAM4_LSB _u(10)
|
||||
#define PSM_WDSEL_SRAM4_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_WDSEL_SRAM3
|
||||
// Description : None
|
||||
#define PSM_WDSEL_SRAM3_RESET _u(0x0)
|
||||
#define PSM_WDSEL_SRAM3_BITS _u(0x00000200)
|
||||
#define PSM_WDSEL_SRAM3_MSB _u(9)
|
||||
#define PSM_WDSEL_SRAM3_LSB _u(9)
|
||||
#define PSM_WDSEL_SRAM3_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_WDSEL_SRAM2
|
||||
// Description : None
|
||||
#define PSM_WDSEL_SRAM2_RESET _u(0x0)
|
||||
#define PSM_WDSEL_SRAM2_BITS _u(0x00000100)
|
||||
#define PSM_WDSEL_SRAM2_MSB _u(8)
|
||||
#define PSM_WDSEL_SRAM2_LSB _u(8)
|
||||
#define PSM_WDSEL_SRAM2_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_WDSEL_SRAM1
|
||||
// Description : None
|
||||
#define PSM_WDSEL_SRAM1_RESET _u(0x0)
|
||||
#define PSM_WDSEL_SRAM1_BITS _u(0x00000080)
|
||||
#define PSM_WDSEL_SRAM1_MSB _u(7)
|
||||
#define PSM_WDSEL_SRAM1_LSB _u(7)
|
||||
#define PSM_WDSEL_SRAM1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_WDSEL_SRAM0
|
||||
// Description : None
|
||||
#define PSM_WDSEL_SRAM0_RESET _u(0x0)
|
||||
#define PSM_WDSEL_SRAM0_BITS _u(0x00000040)
|
||||
#define PSM_WDSEL_SRAM0_MSB _u(6)
|
||||
#define PSM_WDSEL_SRAM0_LSB _u(6)
|
||||
#define PSM_WDSEL_SRAM0_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_WDSEL_ROM
|
||||
// Description : None
|
||||
#define PSM_WDSEL_ROM_RESET _u(0x0)
|
||||
#define PSM_WDSEL_ROM_BITS _u(0x00000020)
|
||||
#define PSM_WDSEL_ROM_MSB _u(5)
|
||||
#define PSM_WDSEL_ROM_LSB _u(5)
|
||||
#define PSM_WDSEL_ROM_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_WDSEL_BUSFABRIC
|
||||
// Description : None
|
||||
#define PSM_WDSEL_BUSFABRIC_RESET _u(0x0)
|
||||
#define PSM_WDSEL_BUSFABRIC_BITS _u(0x00000010)
|
||||
#define PSM_WDSEL_BUSFABRIC_MSB _u(4)
|
||||
#define PSM_WDSEL_BUSFABRIC_LSB _u(4)
|
||||
#define PSM_WDSEL_BUSFABRIC_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_WDSEL_RESETS
|
||||
// Description : None
|
||||
#define PSM_WDSEL_RESETS_RESET _u(0x0)
|
||||
#define PSM_WDSEL_RESETS_BITS _u(0x00000008)
|
||||
#define PSM_WDSEL_RESETS_MSB _u(3)
|
||||
#define PSM_WDSEL_RESETS_LSB _u(3)
|
||||
#define PSM_WDSEL_RESETS_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_WDSEL_CLOCKS
|
||||
// Description : None
|
||||
#define PSM_WDSEL_CLOCKS_RESET _u(0x0)
|
||||
#define PSM_WDSEL_CLOCKS_BITS _u(0x00000004)
|
||||
#define PSM_WDSEL_CLOCKS_MSB _u(2)
|
||||
#define PSM_WDSEL_CLOCKS_LSB _u(2)
|
||||
#define PSM_WDSEL_CLOCKS_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_WDSEL_XOSC
|
||||
// Description : None
|
||||
#define PSM_WDSEL_XOSC_RESET _u(0x0)
|
||||
#define PSM_WDSEL_XOSC_BITS _u(0x00000002)
|
||||
#define PSM_WDSEL_XOSC_MSB _u(1)
|
||||
#define PSM_WDSEL_XOSC_LSB _u(1)
|
||||
#define PSM_WDSEL_XOSC_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_WDSEL_ROSC
|
||||
// Description : None
|
||||
#define PSM_WDSEL_ROSC_RESET _u(0x0)
|
||||
#define PSM_WDSEL_ROSC_BITS _u(0x00000001)
|
||||
#define PSM_WDSEL_ROSC_MSB _u(0)
|
||||
#define PSM_WDSEL_ROSC_LSB _u(0)
|
||||
#define PSM_WDSEL_ROSC_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : PSM_DONE
|
||||
// Description : Indicates the peripheral's registers are ready to access.
|
||||
#define PSM_DONE_OFFSET _u(0x0000000c)
|
||||
#define PSM_DONE_BITS _u(0x0001ffff)
|
||||
#define PSM_DONE_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_DONE_PROC1
|
||||
// Description : None
|
||||
#define PSM_DONE_PROC1_RESET _u(0x0)
|
||||
#define PSM_DONE_PROC1_BITS _u(0x00010000)
|
||||
#define PSM_DONE_PROC1_MSB _u(16)
|
||||
#define PSM_DONE_PROC1_LSB _u(16)
|
||||
#define PSM_DONE_PROC1_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_DONE_PROC0
|
||||
// Description : None
|
||||
#define PSM_DONE_PROC0_RESET _u(0x0)
|
||||
#define PSM_DONE_PROC0_BITS _u(0x00008000)
|
||||
#define PSM_DONE_PROC0_MSB _u(15)
|
||||
#define PSM_DONE_PROC0_LSB _u(15)
|
||||
#define PSM_DONE_PROC0_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_DONE_SIO
|
||||
// Description : None
|
||||
#define PSM_DONE_SIO_RESET _u(0x0)
|
||||
#define PSM_DONE_SIO_BITS _u(0x00004000)
|
||||
#define PSM_DONE_SIO_MSB _u(14)
|
||||
#define PSM_DONE_SIO_LSB _u(14)
|
||||
#define PSM_DONE_SIO_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_DONE_VREG_AND_CHIP_RESET
|
||||
// Description : None
|
||||
#define PSM_DONE_VREG_AND_CHIP_RESET_RESET _u(0x0)
|
||||
#define PSM_DONE_VREG_AND_CHIP_RESET_BITS _u(0x00002000)
|
||||
#define PSM_DONE_VREG_AND_CHIP_RESET_MSB _u(13)
|
||||
#define PSM_DONE_VREG_AND_CHIP_RESET_LSB _u(13)
|
||||
#define PSM_DONE_VREG_AND_CHIP_RESET_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_DONE_XIP
|
||||
// Description : None
|
||||
#define PSM_DONE_XIP_RESET _u(0x0)
|
||||
#define PSM_DONE_XIP_BITS _u(0x00001000)
|
||||
#define PSM_DONE_XIP_MSB _u(12)
|
||||
#define PSM_DONE_XIP_LSB _u(12)
|
||||
#define PSM_DONE_XIP_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_DONE_SRAM5
|
||||
// Description : None
|
||||
#define PSM_DONE_SRAM5_RESET _u(0x0)
|
||||
#define PSM_DONE_SRAM5_BITS _u(0x00000800)
|
||||
#define PSM_DONE_SRAM5_MSB _u(11)
|
||||
#define PSM_DONE_SRAM5_LSB _u(11)
|
||||
#define PSM_DONE_SRAM5_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_DONE_SRAM4
|
||||
// Description : None
|
||||
#define PSM_DONE_SRAM4_RESET _u(0x0)
|
||||
#define PSM_DONE_SRAM4_BITS _u(0x00000400)
|
||||
#define PSM_DONE_SRAM4_MSB _u(10)
|
||||
#define PSM_DONE_SRAM4_LSB _u(10)
|
||||
#define PSM_DONE_SRAM4_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_DONE_SRAM3
|
||||
// Description : None
|
||||
#define PSM_DONE_SRAM3_RESET _u(0x0)
|
||||
#define PSM_DONE_SRAM3_BITS _u(0x00000200)
|
||||
#define PSM_DONE_SRAM3_MSB _u(9)
|
||||
#define PSM_DONE_SRAM3_LSB _u(9)
|
||||
#define PSM_DONE_SRAM3_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_DONE_SRAM2
|
||||
// Description : None
|
||||
#define PSM_DONE_SRAM2_RESET _u(0x0)
|
||||
#define PSM_DONE_SRAM2_BITS _u(0x00000100)
|
||||
#define PSM_DONE_SRAM2_MSB _u(8)
|
||||
#define PSM_DONE_SRAM2_LSB _u(8)
|
||||
#define PSM_DONE_SRAM2_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_DONE_SRAM1
|
||||
// Description : None
|
||||
#define PSM_DONE_SRAM1_RESET _u(0x0)
|
||||
#define PSM_DONE_SRAM1_BITS _u(0x00000080)
|
||||
#define PSM_DONE_SRAM1_MSB _u(7)
|
||||
#define PSM_DONE_SRAM1_LSB _u(7)
|
||||
#define PSM_DONE_SRAM1_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_DONE_SRAM0
|
||||
// Description : None
|
||||
#define PSM_DONE_SRAM0_RESET _u(0x0)
|
||||
#define PSM_DONE_SRAM0_BITS _u(0x00000040)
|
||||
#define PSM_DONE_SRAM0_MSB _u(6)
|
||||
#define PSM_DONE_SRAM0_LSB _u(6)
|
||||
#define PSM_DONE_SRAM0_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_DONE_ROM
|
||||
// Description : None
|
||||
#define PSM_DONE_ROM_RESET _u(0x0)
|
||||
#define PSM_DONE_ROM_BITS _u(0x00000020)
|
||||
#define PSM_DONE_ROM_MSB _u(5)
|
||||
#define PSM_DONE_ROM_LSB _u(5)
|
||||
#define PSM_DONE_ROM_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_DONE_BUSFABRIC
|
||||
// Description : None
|
||||
#define PSM_DONE_BUSFABRIC_RESET _u(0x0)
|
||||
#define PSM_DONE_BUSFABRIC_BITS _u(0x00000010)
|
||||
#define PSM_DONE_BUSFABRIC_MSB _u(4)
|
||||
#define PSM_DONE_BUSFABRIC_LSB _u(4)
|
||||
#define PSM_DONE_BUSFABRIC_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_DONE_RESETS
|
||||
// Description : None
|
||||
#define PSM_DONE_RESETS_RESET _u(0x0)
|
||||
#define PSM_DONE_RESETS_BITS _u(0x00000008)
|
||||
#define PSM_DONE_RESETS_MSB _u(3)
|
||||
#define PSM_DONE_RESETS_LSB _u(3)
|
||||
#define PSM_DONE_RESETS_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_DONE_CLOCKS
|
||||
// Description : None
|
||||
#define PSM_DONE_CLOCKS_RESET _u(0x0)
|
||||
#define PSM_DONE_CLOCKS_BITS _u(0x00000004)
|
||||
#define PSM_DONE_CLOCKS_MSB _u(2)
|
||||
#define PSM_DONE_CLOCKS_LSB _u(2)
|
||||
#define PSM_DONE_CLOCKS_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_DONE_XOSC
|
||||
// Description : None
|
||||
#define PSM_DONE_XOSC_RESET _u(0x0)
|
||||
#define PSM_DONE_XOSC_BITS _u(0x00000002)
|
||||
#define PSM_DONE_XOSC_MSB _u(1)
|
||||
#define PSM_DONE_XOSC_LSB _u(1)
|
||||
#define PSM_DONE_XOSC_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : PSM_DONE_ROSC
|
||||
// Description : None
|
||||
#define PSM_DONE_ROSC_RESET _u(0x0)
|
||||
#define PSM_DONE_ROSC_BITS _u(0x00000001)
|
||||
#define PSM_DONE_ROSC_MSB _u(0)
|
||||
#define PSM_DONE_ROSC_LSB _u(0)
|
||||
#define PSM_DONE_ROSC_ACCESS "RO"
|
||||
// =============================================================================
|
||||
#endif // HARDWARE_REGS_PSM_DEFINED
|
1505
lib/rp2040/hardware/regs/pwm.h
Normal file
1505
lib/rp2040/hardware/regs/pwm.h
Normal file
File diff suppressed because it is too large
Load Diff
637
lib/rp2040/hardware/regs/resets.h
Normal file
637
lib/rp2040/hardware/regs/resets.h
Normal file
@ -0,0 +1,637 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// =============================================================================
|
||||
// Register block : RESETS
|
||||
// Version : 1
|
||||
// Bus type : apb
|
||||
// Description : None
|
||||
// =============================================================================
|
||||
#ifndef HARDWARE_REGS_RESETS_DEFINED
|
||||
#define HARDWARE_REGS_RESETS_DEFINED
|
||||
// =============================================================================
|
||||
// Register : RESETS_RESET
|
||||
// Description : Reset control. If a bit is set it means the peripheral is in
|
||||
// reset. 0 means the peripheral's reset is deasserted.
|
||||
#define RESETS_RESET_OFFSET _u(0x00000000)
|
||||
#define RESETS_RESET_BITS _u(0x01ffffff)
|
||||
#define RESETS_RESET_RESET _u(0x01ffffff)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_USBCTRL
|
||||
// Description : None
|
||||
#define RESETS_RESET_USBCTRL_RESET _u(0x1)
|
||||
#define RESETS_RESET_USBCTRL_BITS _u(0x01000000)
|
||||
#define RESETS_RESET_USBCTRL_MSB _u(24)
|
||||
#define RESETS_RESET_USBCTRL_LSB _u(24)
|
||||
#define RESETS_RESET_USBCTRL_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_UART1
|
||||
// Description : None
|
||||
#define RESETS_RESET_UART1_RESET _u(0x1)
|
||||
#define RESETS_RESET_UART1_BITS _u(0x00800000)
|
||||
#define RESETS_RESET_UART1_MSB _u(23)
|
||||
#define RESETS_RESET_UART1_LSB _u(23)
|
||||
#define RESETS_RESET_UART1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_UART0
|
||||
// Description : None
|
||||
#define RESETS_RESET_UART0_RESET _u(0x1)
|
||||
#define RESETS_RESET_UART0_BITS _u(0x00400000)
|
||||
#define RESETS_RESET_UART0_MSB _u(22)
|
||||
#define RESETS_RESET_UART0_LSB _u(22)
|
||||
#define RESETS_RESET_UART0_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_TIMER
|
||||
// Description : None
|
||||
#define RESETS_RESET_TIMER_RESET _u(0x1)
|
||||
#define RESETS_RESET_TIMER_BITS _u(0x00200000)
|
||||
#define RESETS_RESET_TIMER_MSB _u(21)
|
||||
#define RESETS_RESET_TIMER_LSB _u(21)
|
||||
#define RESETS_RESET_TIMER_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_TBMAN
|
||||
// Description : None
|
||||
#define RESETS_RESET_TBMAN_RESET _u(0x1)
|
||||
#define RESETS_RESET_TBMAN_BITS _u(0x00100000)
|
||||
#define RESETS_RESET_TBMAN_MSB _u(20)
|
||||
#define RESETS_RESET_TBMAN_LSB _u(20)
|
||||
#define RESETS_RESET_TBMAN_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_SYSINFO
|
||||
// Description : None
|
||||
#define RESETS_RESET_SYSINFO_RESET _u(0x1)
|
||||
#define RESETS_RESET_SYSINFO_BITS _u(0x00080000)
|
||||
#define RESETS_RESET_SYSINFO_MSB _u(19)
|
||||
#define RESETS_RESET_SYSINFO_LSB _u(19)
|
||||
#define RESETS_RESET_SYSINFO_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_SYSCFG
|
||||
// Description : None
|
||||
#define RESETS_RESET_SYSCFG_RESET _u(0x1)
|
||||
#define RESETS_RESET_SYSCFG_BITS _u(0x00040000)
|
||||
#define RESETS_RESET_SYSCFG_MSB _u(18)
|
||||
#define RESETS_RESET_SYSCFG_LSB _u(18)
|
||||
#define RESETS_RESET_SYSCFG_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_SPI1
|
||||
// Description : None
|
||||
#define RESETS_RESET_SPI1_RESET _u(0x1)
|
||||
#define RESETS_RESET_SPI1_BITS _u(0x00020000)
|
||||
#define RESETS_RESET_SPI1_MSB _u(17)
|
||||
#define RESETS_RESET_SPI1_LSB _u(17)
|
||||
#define RESETS_RESET_SPI1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_SPI0
|
||||
// Description : None
|
||||
#define RESETS_RESET_SPI0_RESET _u(0x1)
|
||||
#define RESETS_RESET_SPI0_BITS _u(0x00010000)
|
||||
#define RESETS_RESET_SPI0_MSB _u(16)
|
||||
#define RESETS_RESET_SPI0_LSB _u(16)
|
||||
#define RESETS_RESET_SPI0_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_RTC
|
||||
// Description : None
|
||||
#define RESETS_RESET_RTC_RESET _u(0x1)
|
||||
#define RESETS_RESET_RTC_BITS _u(0x00008000)
|
||||
#define RESETS_RESET_RTC_MSB _u(15)
|
||||
#define RESETS_RESET_RTC_LSB _u(15)
|
||||
#define RESETS_RESET_RTC_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_PWM
|
||||
// Description : None
|
||||
#define RESETS_RESET_PWM_RESET _u(0x1)
|
||||
#define RESETS_RESET_PWM_BITS _u(0x00004000)
|
||||
#define RESETS_RESET_PWM_MSB _u(14)
|
||||
#define RESETS_RESET_PWM_LSB _u(14)
|
||||
#define RESETS_RESET_PWM_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_PLL_USB
|
||||
// Description : None
|
||||
#define RESETS_RESET_PLL_USB_RESET _u(0x1)
|
||||
#define RESETS_RESET_PLL_USB_BITS _u(0x00002000)
|
||||
#define RESETS_RESET_PLL_USB_MSB _u(13)
|
||||
#define RESETS_RESET_PLL_USB_LSB _u(13)
|
||||
#define RESETS_RESET_PLL_USB_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_PLL_SYS
|
||||
// Description : None
|
||||
#define RESETS_RESET_PLL_SYS_RESET _u(0x1)
|
||||
#define RESETS_RESET_PLL_SYS_BITS _u(0x00001000)
|
||||
#define RESETS_RESET_PLL_SYS_MSB _u(12)
|
||||
#define RESETS_RESET_PLL_SYS_LSB _u(12)
|
||||
#define RESETS_RESET_PLL_SYS_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_PIO1
|
||||
// Description : None
|
||||
#define RESETS_RESET_PIO1_RESET _u(0x1)
|
||||
#define RESETS_RESET_PIO1_BITS _u(0x00000800)
|
||||
#define RESETS_RESET_PIO1_MSB _u(11)
|
||||
#define RESETS_RESET_PIO1_LSB _u(11)
|
||||
#define RESETS_RESET_PIO1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_PIO0
|
||||
// Description : None
|
||||
#define RESETS_RESET_PIO0_RESET _u(0x1)
|
||||
#define RESETS_RESET_PIO0_BITS _u(0x00000400)
|
||||
#define RESETS_RESET_PIO0_MSB _u(10)
|
||||
#define RESETS_RESET_PIO0_LSB _u(10)
|
||||
#define RESETS_RESET_PIO0_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_PADS_QSPI
|
||||
// Description : None
|
||||
#define RESETS_RESET_PADS_QSPI_RESET _u(0x1)
|
||||
#define RESETS_RESET_PADS_QSPI_BITS _u(0x00000200)
|
||||
#define RESETS_RESET_PADS_QSPI_MSB _u(9)
|
||||
#define RESETS_RESET_PADS_QSPI_LSB _u(9)
|
||||
#define RESETS_RESET_PADS_QSPI_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_PADS_BANK0
|
||||
// Description : None
|
||||
#define RESETS_RESET_PADS_BANK0_RESET _u(0x1)
|
||||
#define RESETS_RESET_PADS_BANK0_BITS _u(0x00000100)
|
||||
#define RESETS_RESET_PADS_BANK0_MSB _u(8)
|
||||
#define RESETS_RESET_PADS_BANK0_LSB _u(8)
|
||||
#define RESETS_RESET_PADS_BANK0_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_JTAG
|
||||
// Description : None
|
||||
#define RESETS_RESET_JTAG_RESET _u(0x1)
|
||||
#define RESETS_RESET_JTAG_BITS _u(0x00000080)
|
||||
#define RESETS_RESET_JTAG_MSB _u(7)
|
||||
#define RESETS_RESET_JTAG_LSB _u(7)
|
||||
#define RESETS_RESET_JTAG_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_IO_QSPI
|
||||
// Description : None
|
||||
#define RESETS_RESET_IO_QSPI_RESET _u(0x1)
|
||||
#define RESETS_RESET_IO_QSPI_BITS _u(0x00000040)
|
||||
#define RESETS_RESET_IO_QSPI_MSB _u(6)
|
||||
#define RESETS_RESET_IO_QSPI_LSB _u(6)
|
||||
#define RESETS_RESET_IO_QSPI_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_IO_BANK0
|
||||
// Description : None
|
||||
#define RESETS_RESET_IO_BANK0_RESET _u(0x1)
|
||||
#define RESETS_RESET_IO_BANK0_BITS _u(0x00000020)
|
||||
#define RESETS_RESET_IO_BANK0_MSB _u(5)
|
||||
#define RESETS_RESET_IO_BANK0_LSB _u(5)
|
||||
#define RESETS_RESET_IO_BANK0_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_I2C1
|
||||
// Description : None
|
||||
#define RESETS_RESET_I2C1_RESET _u(0x1)
|
||||
#define RESETS_RESET_I2C1_BITS _u(0x00000010)
|
||||
#define RESETS_RESET_I2C1_MSB _u(4)
|
||||
#define RESETS_RESET_I2C1_LSB _u(4)
|
||||
#define RESETS_RESET_I2C1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_I2C0
|
||||
// Description : None
|
||||
#define RESETS_RESET_I2C0_RESET _u(0x1)
|
||||
#define RESETS_RESET_I2C0_BITS _u(0x00000008)
|
||||
#define RESETS_RESET_I2C0_MSB _u(3)
|
||||
#define RESETS_RESET_I2C0_LSB _u(3)
|
||||
#define RESETS_RESET_I2C0_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DMA
|
||||
// Description : None
|
||||
#define RESETS_RESET_DMA_RESET _u(0x1)
|
||||
#define RESETS_RESET_DMA_BITS _u(0x00000004)
|
||||
#define RESETS_RESET_DMA_MSB _u(2)
|
||||
#define RESETS_RESET_DMA_LSB _u(2)
|
||||
#define RESETS_RESET_DMA_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_BUSCTRL
|
||||
// Description : None
|
||||
#define RESETS_RESET_BUSCTRL_RESET _u(0x1)
|
||||
#define RESETS_RESET_BUSCTRL_BITS _u(0x00000002)
|
||||
#define RESETS_RESET_BUSCTRL_MSB _u(1)
|
||||
#define RESETS_RESET_BUSCTRL_LSB _u(1)
|
||||
#define RESETS_RESET_BUSCTRL_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_ADC
|
||||
// Description : None
|
||||
#define RESETS_RESET_ADC_RESET _u(0x1)
|
||||
#define RESETS_RESET_ADC_BITS _u(0x00000001)
|
||||
#define RESETS_RESET_ADC_MSB _u(0)
|
||||
#define RESETS_RESET_ADC_LSB _u(0)
|
||||
#define RESETS_RESET_ADC_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : RESETS_WDSEL
|
||||
// Description : Watchdog select. If a bit is set then the watchdog will reset
|
||||
// this peripheral when the watchdog fires.
|
||||
#define RESETS_WDSEL_OFFSET _u(0x00000004)
|
||||
#define RESETS_WDSEL_BITS _u(0x01ffffff)
|
||||
#define RESETS_WDSEL_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_USBCTRL
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_USBCTRL_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_USBCTRL_BITS _u(0x01000000)
|
||||
#define RESETS_WDSEL_USBCTRL_MSB _u(24)
|
||||
#define RESETS_WDSEL_USBCTRL_LSB _u(24)
|
||||
#define RESETS_WDSEL_USBCTRL_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_UART1
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_UART1_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_UART1_BITS _u(0x00800000)
|
||||
#define RESETS_WDSEL_UART1_MSB _u(23)
|
||||
#define RESETS_WDSEL_UART1_LSB _u(23)
|
||||
#define RESETS_WDSEL_UART1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_UART0
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_UART0_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_UART0_BITS _u(0x00400000)
|
||||
#define RESETS_WDSEL_UART0_MSB _u(22)
|
||||
#define RESETS_WDSEL_UART0_LSB _u(22)
|
||||
#define RESETS_WDSEL_UART0_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_TIMER
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_TIMER_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_TIMER_BITS _u(0x00200000)
|
||||
#define RESETS_WDSEL_TIMER_MSB _u(21)
|
||||
#define RESETS_WDSEL_TIMER_LSB _u(21)
|
||||
#define RESETS_WDSEL_TIMER_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_TBMAN
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_TBMAN_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_TBMAN_BITS _u(0x00100000)
|
||||
#define RESETS_WDSEL_TBMAN_MSB _u(20)
|
||||
#define RESETS_WDSEL_TBMAN_LSB _u(20)
|
||||
#define RESETS_WDSEL_TBMAN_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_SYSINFO
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_SYSINFO_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_SYSINFO_BITS _u(0x00080000)
|
||||
#define RESETS_WDSEL_SYSINFO_MSB _u(19)
|
||||
#define RESETS_WDSEL_SYSINFO_LSB _u(19)
|
||||
#define RESETS_WDSEL_SYSINFO_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_SYSCFG
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_SYSCFG_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_SYSCFG_BITS _u(0x00040000)
|
||||
#define RESETS_WDSEL_SYSCFG_MSB _u(18)
|
||||
#define RESETS_WDSEL_SYSCFG_LSB _u(18)
|
||||
#define RESETS_WDSEL_SYSCFG_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_SPI1
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_SPI1_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_SPI1_BITS _u(0x00020000)
|
||||
#define RESETS_WDSEL_SPI1_MSB _u(17)
|
||||
#define RESETS_WDSEL_SPI1_LSB _u(17)
|
||||
#define RESETS_WDSEL_SPI1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_SPI0
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_SPI0_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_SPI0_BITS _u(0x00010000)
|
||||
#define RESETS_WDSEL_SPI0_MSB _u(16)
|
||||
#define RESETS_WDSEL_SPI0_LSB _u(16)
|
||||
#define RESETS_WDSEL_SPI0_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_RTC
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_RTC_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_RTC_BITS _u(0x00008000)
|
||||
#define RESETS_WDSEL_RTC_MSB _u(15)
|
||||
#define RESETS_WDSEL_RTC_LSB _u(15)
|
||||
#define RESETS_WDSEL_RTC_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_PWM
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_PWM_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_PWM_BITS _u(0x00004000)
|
||||
#define RESETS_WDSEL_PWM_MSB _u(14)
|
||||
#define RESETS_WDSEL_PWM_LSB _u(14)
|
||||
#define RESETS_WDSEL_PWM_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_PLL_USB
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_PLL_USB_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_PLL_USB_BITS _u(0x00002000)
|
||||
#define RESETS_WDSEL_PLL_USB_MSB _u(13)
|
||||
#define RESETS_WDSEL_PLL_USB_LSB _u(13)
|
||||
#define RESETS_WDSEL_PLL_USB_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_PLL_SYS
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_PLL_SYS_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_PLL_SYS_BITS _u(0x00001000)
|
||||
#define RESETS_WDSEL_PLL_SYS_MSB _u(12)
|
||||
#define RESETS_WDSEL_PLL_SYS_LSB _u(12)
|
||||
#define RESETS_WDSEL_PLL_SYS_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_PIO1
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_PIO1_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_PIO1_BITS _u(0x00000800)
|
||||
#define RESETS_WDSEL_PIO1_MSB _u(11)
|
||||
#define RESETS_WDSEL_PIO1_LSB _u(11)
|
||||
#define RESETS_WDSEL_PIO1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_PIO0
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_PIO0_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_PIO0_BITS _u(0x00000400)
|
||||
#define RESETS_WDSEL_PIO0_MSB _u(10)
|
||||
#define RESETS_WDSEL_PIO0_LSB _u(10)
|
||||
#define RESETS_WDSEL_PIO0_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_PADS_QSPI
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_PADS_QSPI_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_PADS_QSPI_BITS _u(0x00000200)
|
||||
#define RESETS_WDSEL_PADS_QSPI_MSB _u(9)
|
||||
#define RESETS_WDSEL_PADS_QSPI_LSB _u(9)
|
||||
#define RESETS_WDSEL_PADS_QSPI_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_PADS_BANK0
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_PADS_BANK0_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_PADS_BANK0_BITS _u(0x00000100)
|
||||
#define RESETS_WDSEL_PADS_BANK0_MSB _u(8)
|
||||
#define RESETS_WDSEL_PADS_BANK0_LSB _u(8)
|
||||
#define RESETS_WDSEL_PADS_BANK0_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_JTAG
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_JTAG_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_JTAG_BITS _u(0x00000080)
|
||||
#define RESETS_WDSEL_JTAG_MSB _u(7)
|
||||
#define RESETS_WDSEL_JTAG_LSB _u(7)
|
||||
#define RESETS_WDSEL_JTAG_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_IO_QSPI
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_IO_QSPI_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_IO_QSPI_BITS _u(0x00000040)
|
||||
#define RESETS_WDSEL_IO_QSPI_MSB _u(6)
|
||||
#define RESETS_WDSEL_IO_QSPI_LSB _u(6)
|
||||
#define RESETS_WDSEL_IO_QSPI_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_IO_BANK0
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_IO_BANK0_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_IO_BANK0_BITS _u(0x00000020)
|
||||
#define RESETS_WDSEL_IO_BANK0_MSB _u(5)
|
||||
#define RESETS_WDSEL_IO_BANK0_LSB _u(5)
|
||||
#define RESETS_WDSEL_IO_BANK0_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_I2C1
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_I2C1_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_I2C1_BITS _u(0x00000010)
|
||||
#define RESETS_WDSEL_I2C1_MSB _u(4)
|
||||
#define RESETS_WDSEL_I2C1_LSB _u(4)
|
||||
#define RESETS_WDSEL_I2C1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_I2C0
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_I2C0_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_I2C0_BITS _u(0x00000008)
|
||||
#define RESETS_WDSEL_I2C0_MSB _u(3)
|
||||
#define RESETS_WDSEL_I2C0_LSB _u(3)
|
||||
#define RESETS_WDSEL_I2C0_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_DMA
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_DMA_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_DMA_BITS _u(0x00000004)
|
||||
#define RESETS_WDSEL_DMA_MSB _u(2)
|
||||
#define RESETS_WDSEL_DMA_LSB _u(2)
|
||||
#define RESETS_WDSEL_DMA_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_BUSCTRL
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_BUSCTRL_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_BUSCTRL_BITS _u(0x00000002)
|
||||
#define RESETS_WDSEL_BUSCTRL_MSB _u(1)
|
||||
#define RESETS_WDSEL_BUSCTRL_LSB _u(1)
|
||||
#define RESETS_WDSEL_BUSCTRL_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_WDSEL_ADC
|
||||
// Description : None
|
||||
#define RESETS_WDSEL_ADC_RESET _u(0x0)
|
||||
#define RESETS_WDSEL_ADC_BITS _u(0x00000001)
|
||||
#define RESETS_WDSEL_ADC_MSB _u(0)
|
||||
#define RESETS_WDSEL_ADC_LSB _u(0)
|
||||
#define RESETS_WDSEL_ADC_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : RESETS_RESET_DONE
|
||||
// Description : Reset done. If a bit is set then a reset done signal has been
|
||||
// returned by the peripheral. This indicates that the
|
||||
// peripheral's registers are ready to be accessed.
|
||||
#define RESETS_RESET_DONE_OFFSET _u(0x00000008)
|
||||
#define RESETS_RESET_DONE_BITS _u(0x01ffffff)
|
||||
#define RESETS_RESET_DONE_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_USBCTRL
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_USBCTRL_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_USBCTRL_BITS _u(0x01000000)
|
||||
#define RESETS_RESET_DONE_USBCTRL_MSB _u(24)
|
||||
#define RESETS_RESET_DONE_USBCTRL_LSB _u(24)
|
||||
#define RESETS_RESET_DONE_USBCTRL_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_UART1
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_UART1_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_UART1_BITS _u(0x00800000)
|
||||
#define RESETS_RESET_DONE_UART1_MSB _u(23)
|
||||
#define RESETS_RESET_DONE_UART1_LSB _u(23)
|
||||
#define RESETS_RESET_DONE_UART1_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_UART0
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_UART0_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_UART0_BITS _u(0x00400000)
|
||||
#define RESETS_RESET_DONE_UART0_MSB _u(22)
|
||||
#define RESETS_RESET_DONE_UART0_LSB _u(22)
|
||||
#define RESETS_RESET_DONE_UART0_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_TIMER
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_TIMER_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_TIMER_BITS _u(0x00200000)
|
||||
#define RESETS_RESET_DONE_TIMER_MSB _u(21)
|
||||
#define RESETS_RESET_DONE_TIMER_LSB _u(21)
|
||||
#define RESETS_RESET_DONE_TIMER_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_TBMAN
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_TBMAN_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_TBMAN_BITS _u(0x00100000)
|
||||
#define RESETS_RESET_DONE_TBMAN_MSB _u(20)
|
||||
#define RESETS_RESET_DONE_TBMAN_LSB _u(20)
|
||||
#define RESETS_RESET_DONE_TBMAN_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_SYSINFO
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_SYSINFO_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_SYSINFO_BITS _u(0x00080000)
|
||||
#define RESETS_RESET_DONE_SYSINFO_MSB _u(19)
|
||||
#define RESETS_RESET_DONE_SYSINFO_LSB _u(19)
|
||||
#define RESETS_RESET_DONE_SYSINFO_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_SYSCFG
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_SYSCFG_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_SYSCFG_BITS _u(0x00040000)
|
||||
#define RESETS_RESET_DONE_SYSCFG_MSB _u(18)
|
||||
#define RESETS_RESET_DONE_SYSCFG_LSB _u(18)
|
||||
#define RESETS_RESET_DONE_SYSCFG_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_SPI1
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_SPI1_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_SPI1_BITS _u(0x00020000)
|
||||
#define RESETS_RESET_DONE_SPI1_MSB _u(17)
|
||||
#define RESETS_RESET_DONE_SPI1_LSB _u(17)
|
||||
#define RESETS_RESET_DONE_SPI1_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_SPI0
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_SPI0_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_SPI0_BITS _u(0x00010000)
|
||||
#define RESETS_RESET_DONE_SPI0_MSB _u(16)
|
||||
#define RESETS_RESET_DONE_SPI0_LSB _u(16)
|
||||
#define RESETS_RESET_DONE_SPI0_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_RTC
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_RTC_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_RTC_BITS _u(0x00008000)
|
||||
#define RESETS_RESET_DONE_RTC_MSB _u(15)
|
||||
#define RESETS_RESET_DONE_RTC_LSB _u(15)
|
||||
#define RESETS_RESET_DONE_RTC_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_PWM
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_PWM_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_PWM_BITS _u(0x00004000)
|
||||
#define RESETS_RESET_DONE_PWM_MSB _u(14)
|
||||
#define RESETS_RESET_DONE_PWM_LSB _u(14)
|
||||
#define RESETS_RESET_DONE_PWM_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_PLL_USB
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_PLL_USB_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_PLL_USB_BITS _u(0x00002000)
|
||||
#define RESETS_RESET_DONE_PLL_USB_MSB _u(13)
|
||||
#define RESETS_RESET_DONE_PLL_USB_LSB _u(13)
|
||||
#define RESETS_RESET_DONE_PLL_USB_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_PLL_SYS
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_PLL_SYS_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_PLL_SYS_BITS _u(0x00001000)
|
||||
#define RESETS_RESET_DONE_PLL_SYS_MSB _u(12)
|
||||
#define RESETS_RESET_DONE_PLL_SYS_LSB _u(12)
|
||||
#define RESETS_RESET_DONE_PLL_SYS_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_PIO1
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_PIO1_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_PIO1_BITS _u(0x00000800)
|
||||
#define RESETS_RESET_DONE_PIO1_MSB _u(11)
|
||||
#define RESETS_RESET_DONE_PIO1_LSB _u(11)
|
||||
#define RESETS_RESET_DONE_PIO1_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_PIO0
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_PIO0_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_PIO0_BITS _u(0x00000400)
|
||||
#define RESETS_RESET_DONE_PIO0_MSB _u(10)
|
||||
#define RESETS_RESET_DONE_PIO0_LSB _u(10)
|
||||
#define RESETS_RESET_DONE_PIO0_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_PADS_QSPI
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_PADS_QSPI_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_PADS_QSPI_BITS _u(0x00000200)
|
||||
#define RESETS_RESET_DONE_PADS_QSPI_MSB _u(9)
|
||||
#define RESETS_RESET_DONE_PADS_QSPI_LSB _u(9)
|
||||
#define RESETS_RESET_DONE_PADS_QSPI_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_PADS_BANK0
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_PADS_BANK0_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_PADS_BANK0_BITS _u(0x00000100)
|
||||
#define RESETS_RESET_DONE_PADS_BANK0_MSB _u(8)
|
||||
#define RESETS_RESET_DONE_PADS_BANK0_LSB _u(8)
|
||||
#define RESETS_RESET_DONE_PADS_BANK0_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_JTAG
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_JTAG_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_JTAG_BITS _u(0x00000080)
|
||||
#define RESETS_RESET_DONE_JTAG_MSB _u(7)
|
||||
#define RESETS_RESET_DONE_JTAG_LSB _u(7)
|
||||
#define RESETS_RESET_DONE_JTAG_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_IO_QSPI
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_IO_QSPI_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_IO_QSPI_BITS _u(0x00000040)
|
||||
#define RESETS_RESET_DONE_IO_QSPI_MSB _u(6)
|
||||
#define RESETS_RESET_DONE_IO_QSPI_LSB _u(6)
|
||||
#define RESETS_RESET_DONE_IO_QSPI_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_IO_BANK0
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_IO_BANK0_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_IO_BANK0_BITS _u(0x00000020)
|
||||
#define RESETS_RESET_DONE_IO_BANK0_MSB _u(5)
|
||||
#define RESETS_RESET_DONE_IO_BANK0_LSB _u(5)
|
||||
#define RESETS_RESET_DONE_IO_BANK0_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_I2C1
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_I2C1_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_I2C1_BITS _u(0x00000010)
|
||||
#define RESETS_RESET_DONE_I2C1_MSB _u(4)
|
||||
#define RESETS_RESET_DONE_I2C1_LSB _u(4)
|
||||
#define RESETS_RESET_DONE_I2C1_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_I2C0
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_I2C0_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_I2C0_BITS _u(0x00000008)
|
||||
#define RESETS_RESET_DONE_I2C0_MSB _u(3)
|
||||
#define RESETS_RESET_DONE_I2C0_LSB _u(3)
|
||||
#define RESETS_RESET_DONE_I2C0_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_DMA
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_DMA_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_DMA_BITS _u(0x00000004)
|
||||
#define RESETS_RESET_DONE_DMA_MSB _u(2)
|
||||
#define RESETS_RESET_DONE_DMA_LSB _u(2)
|
||||
#define RESETS_RESET_DONE_DMA_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_BUSCTRL
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_BUSCTRL_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_BUSCTRL_BITS _u(0x00000002)
|
||||
#define RESETS_RESET_DONE_BUSCTRL_MSB _u(1)
|
||||
#define RESETS_RESET_DONE_BUSCTRL_LSB _u(1)
|
||||
#define RESETS_RESET_DONE_BUSCTRL_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RESETS_RESET_DONE_ADC
|
||||
// Description : None
|
||||
#define RESETS_RESET_DONE_ADC_RESET _u(0x0)
|
||||
#define RESETS_RESET_DONE_ADC_BITS _u(0x00000001)
|
||||
#define RESETS_RESET_DONE_ADC_MSB _u(0)
|
||||
#define RESETS_RESET_DONE_ADC_LSB _u(0)
|
||||
#define RESETS_RESET_DONE_ADC_ACCESS "RO"
|
||||
// =============================================================================
|
||||
#endif // HARDWARE_REGS_RESETS_DEFINED
|
312
lib/rp2040/hardware/regs/rosc.h
Normal file
312
lib/rp2040/hardware/regs/rosc.h
Normal file
@ -0,0 +1,312 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// =============================================================================
|
||||
// Register block : ROSC
|
||||
// Version : 1
|
||||
// Bus type : apb
|
||||
// Description : None
|
||||
// =============================================================================
|
||||
#ifndef HARDWARE_REGS_ROSC_DEFINED
|
||||
#define HARDWARE_REGS_ROSC_DEFINED
|
||||
// =============================================================================
|
||||
// Register : ROSC_CTRL
|
||||
// Description : Ring Oscillator control
|
||||
#define ROSC_CTRL_OFFSET _u(0x00000000)
|
||||
#define ROSC_CTRL_BITS _u(0x00ffffff)
|
||||
#define ROSC_CTRL_RESET _u(0x00000aa0)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_CTRL_ENABLE
|
||||
// Description : On power-up this field is initialised to ENABLE
|
||||
// The system clock must be switched to another source before
|
||||
// setting this field to DISABLE otherwise the chip will lock up
|
||||
// The 12-bit code is intended to give some protection against
|
||||
// accidental writes. An invalid setting will enable the
|
||||
// oscillator.
|
||||
// 0xd1e -> DISABLE
|
||||
// 0xfab -> ENABLE
|
||||
#define ROSC_CTRL_ENABLE_RESET "-"
|
||||
#define ROSC_CTRL_ENABLE_BITS _u(0x00fff000)
|
||||
#define ROSC_CTRL_ENABLE_MSB _u(23)
|
||||
#define ROSC_CTRL_ENABLE_LSB _u(12)
|
||||
#define ROSC_CTRL_ENABLE_ACCESS "RW"
|
||||
#define ROSC_CTRL_ENABLE_VALUE_DISABLE _u(0xd1e)
|
||||
#define ROSC_CTRL_ENABLE_VALUE_ENABLE _u(0xfab)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_CTRL_FREQ_RANGE
|
||||
// Description : Controls the number of delay stages in the ROSC ring
|
||||
// LOW uses stages 0 to 7
|
||||
// MEDIUM uses stages 0 to 5
|
||||
// HIGH uses stages 0 to 3
|
||||
// TOOHIGH uses stages 0 to 1 and should not be used because its
|
||||
// frequency exceeds design specifications
|
||||
// The clock output will not glitch when changing the range up one
|
||||
// step at a time
|
||||
// The clock output will glitch when changing the range down
|
||||
// Note: the values here are gray coded which is why HIGH comes
|
||||
// before TOOHIGH
|
||||
// 0xfa4 -> LOW
|
||||
// 0xfa5 -> MEDIUM
|
||||
// 0xfa7 -> HIGH
|
||||
// 0xfa6 -> TOOHIGH
|
||||
#define ROSC_CTRL_FREQ_RANGE_RESET _u(0xaa0)
|
||||
#define ROSC_CTRL_FREQ_RANGE_BITS _u(0x00000fff)
|
||||
#define ROSC_CTRL_FREQ_RANGE_MSB _u(11)
|
||||
#define ROSC_CTRL_FREQ_RANGE_LSB _u(0)
|
||||
#define ROSC_CTRL_FREQ_RANGE_ACCESS "RW"
|
||||
#define ROSC_CTRL_FREQ_RANGE_VALUE_LOW _u(0xfa4)
|
||||
#define ROSC_CTRL_FREQ_RANGE_VALUE_MEDIUM _u(0xfa5)
|
||||
#define ROSC_CTRL_FREQ_RANGE_VALUE_HIGH _u(0xfa7)
|
||||
#define ROSC_CTRL_FREQ_RANGE_VALUE_TOOHIGH _u(0xfa6)
|
||||
// =============================================================================
|
||||
// Register : ROSC_FREQA
|
||||
// Description : The FREQA & FREQB registers control the frequency by
|
||||
// controlling the drive strength of each stage
|
||||
// The drive strength has 4 levels determined by the number of
|
||||
// bits set
|
||||
// Increasing the number of bits set increases the drive strength
|
||||
// and increases the oscillation frequency
|
||||
// 0 bits set is the default drive strength
|
||||
// 1 bit set doubles the drive strength
|
||||
// 2 bits set triples drive strength
|
||||
// 3 bits set quadruples drive strength
|
||||
#define ROSC_FREQA_OFFSET _u(0x00000004)
|
||||
#define ROSC_FREQA_BITS _u(0xffff7777)
|
||||
#define ROSC_FREQA_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_FREQA_PASSWD
|
||||
// Description : Set to 0x9696 to apply the settings
|
||||
// Any other value in this field will set all drive strengths to 0
|
||||
// 0x9696 -> PASS
|
||||
#define ROSC_FREQA_PASSWD_RESET _u(0x0000)
|
||||
#define ROSC_FREQA_PASSWD_BITS _u(0xffff0000)
|
||||
#define ROSC_FREQA_PASSWD_MSB _u(31)
|
||||
#define ROSC_FREQA_PASSWD_LSB _u(16)
|
||||
#define ROSC_FREQA_PASSWD_ACCESS "RW"
|
||||
#define ROSC_FREQA_PASSWD_VALUE_PASS _u(0x9696)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_FREQA_DS3
|
||||
// Description : Stage 3 drive strength
|
||||
#define ROSC_FREQA_DS3_RESET _u(0x0)
|
||||
#define ROSC_FREQA_DS3_BITS _u(0x00007000)
|
||||
#define ROSC_FREQA_DS3_MSB _u(14)
|
||||
#define ROSC_FREQA_DS3_LSB _u(12)
|
||||
#define ROSC_FREQA_DS3_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_FREQA_DS2
|
||||
// Description : Stage 2 drive strength
|
||||
#define ROSC_FREQA_DS2_RESET _u(0x0)
|
||||
#define ROSC_FREQA_DS2_BITS _u(0x00000700)
|
||||
#define ROSC_FREQA_DS2_MSB _u(10)
|
||||
#define ROSC_FREQA_DS2_LSB _u(8)
|
||||
#define ROSC_FREQA_DS2_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_FREQA_DS1
|
||||
// Description : Stage 1 drive strength
|
||||
#define ROSC_FREQA_DS1_RESET _u(0x0)
|
||||
#define ROSC_FREQA_DS1_BITS _u(0x00000070)
|
||||
#define ROSC_FREQA_DS1_MSB _u(6)
|
||||
#define ROSC_FREQA_DS1_LSB _u(4)
|
||||
#define ROSC_FREQA_DS1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_FREQA_DS0
|
||||
// Description : Stage 0 drive strength
|
||||
#define ROSC_FREQA_DS0_RESET _u(0x0)
|
||||
#define ROSC_FREQA_DS0_BITS _u(0x00000007)
|
||||
#define ROSC_FREQA_DS0_MSB _u(2)
|
||||
#define ROSC_FREQA_DS0_LSB _u(0)
|
||||
#define ROSC_FREQA_DS0_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : ROSC_FREQB
|
||||
// Description : For a detailed description see freqa register
|
||||
#define ROSC_FREQB_OFFSET _u(0x00000008)
|
||||
#define ROSC_FREQB_BITS _u(0xffff7777)
|
||||
#define ROSC_FREQB_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_FREQB_PASSWD
|
||||
// Description : Set to 0x9696 to apply the settings
|
||||
// Any other value in this field will set all drive strengths to 0
|
||||
// 0x9696 -> PASS
|
||||
#define ROSC_FREQB_PASSWD_RESET _u(0x0000)
|
||||
#define ROSC_FREQB_PASSWD_BITS _u(0xffff0000)
|
||||
#define ROSC_FREQB_PASSWD_MSB _u(31)
|
||||
#define ROSC_FREQB_PASSWD_LSB _u(16)
|
||||
#define ROSC_FREQB_PASSWD_ACCESS "RW"
|
||||
#define ROSC_FREQB_PASSWD_VALUE_PASS _u(0x9696)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_FREQB_DS7
|
||||
// Description : Stage 7 drive strength
|
||||
#define ROSC_FREQB_DS7_RESET _u(0x0)
|
||||
#define ROSC_FREQB_DS7_BITS _u(0x00007000)
|
||||
#define ROSC_FREQB_DS7_MSB _u(14)
|
||||
#define ROSC_FREQB_DS7_LSB _u(12)
|
||||
#define ROSC_FREQB_DS7_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_FREQB_DS6
|
||||
// Description : Stage 6 drive strength
|
||||
#define ROSC_FREQB_DS6_RESET _u(0x0)
|
||||
#define ROSC_FREQB_DS6_BITS _u(0x00000700)
|
||||
#define ROSC_FREQB_DS6_MSB _u(10)
|
||||
#define ROSC_FREQB_DS6_LSB _u(8)
|
||||
#define ROSC_FREQB_DS6_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_FREQB_DS5
|
||||
// Description : Stage 5 drive strength
|
||||
#define ROSC_FREQB_DS5_RESET _u(0x0)
|
||||
#define ROSC_FREQB_DS5_BITS _u(0x00000070)
|
||||
#define ROSC_FREQB_DS5_MSB _u(6)
|
||||
#define ROSC_FREQB_DS5_LSB _u(4)
|
||||
#define ROSC_FREQB_DS5_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_FREQB_DS4
|
||||
// Description : Stage 4 drive strength
|
||||
#define ROSC_FREQB_DS4_RESET _u(0x0)
|
||||
#define ROSC_FREQB_DS4_BITS _u(0x00000007)
|
||||
#define ROSC_FREQB_DS4_MSB _u(2)
|
||||
#define ROSC_FREQB_DS4_LSB _u(0)
|
||||
#define ROSC_FREQB_DS4_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : ROSC_DORMANT
|
||||
// Description : Ring Oscillator pause control
|
||||
// This is used to save power by pausing the ROSC
|
||||
// On power-up this field is initialised to WAKE
|
||||
// An invalid write will also select WAKE
|
||||
// Warning: setup the irq before selecting dormant mode
|
||||
// 0x636f6d61 -> DORMANT
|
||||
// 0x77616b65 -> WAKE
|
||||
#define ROSC_DORMANT_OFFSET _u(0x0000000c)
|
||||
#define ROSC_DORMANT_BITS _u(0xffffffff)
|
||||
#define ROSC_DORMANT_RESET "-"
|
||||
#define ROSC_DORMANT_MSB _u(31)
|
||||
#define ROSC_DORMANT_LSB _u(0)
|
||||
#define ROSC_DORMANT_ACCESS "RW"
|
||||
#define ROSC_DORMANT_VALUE_DORMANT _u(0x636f6d61)
|
||||
#define ROSC_DORMANT_VALUE_WAKE _u(0x77616b65)
|
||||
// =============================================================================
|
||||
// Register : ROSC_DIV
|
||||
// Description : Controls the output divider
|
||||
// set to 0xaa0 + div where
|
||||
// div = 0 divides by 32
|
||||
// div = 1-31 divides by div
|
||||
// any other value sets div=31
|
||||
// this register resets to div=16
|
||||
// 0xaa0 -> PASS
|
||||
#define ROSC_DIV_OFFSET _u(0x00000010)
|
||||
#define ROSC_DIV_BITS _u(0x00000fff)
|
||||
#define ROSC_DIV_RESET "-"
|
||||
#define ROSC_DIV_MSB _u(11)
|
||||
#define ROSC_DIV_LSB _u(0)
|
||||
#define ROSC_DIV_ACCESS "RW"
|
||||
#define ROSC_DIV_VALUE_PASS _u(0xaa0)
|
||||
// =============================================================================
|
||||
// Register : ROSC_PHASE
|
||||
// Description : Controls the phase shifted output
|
||||
#define ROSC_PHASE_OFFSET _u(0x00000014)
|
||||
#define ROSC_PHASE_BITS _u(0x00000fff)
|
||||
#define ROSC_PHASE_RESET _u(0x00000008)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_PHASE_PASSWD
|
||||
// Description : set to 0xaa
|
||||
// any other value enables the output with shift=0
|
||||
#define ROSC_PHASE_PASSWD_RESET _u(0x00)
|
||||
#define ROSC_PHASE_PASSWD_BITS _u(0x00000ff0)
|
||||
#define ROSC_PHASE_PASSWD_MSB _u(11)
|
||||
#define ROSC_PHASE_PASSWD_LSB _u(4)
|
||||
#define ROSC_PHASE_PASSWD_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_PHASE_ENABLE
|
||||
// Description : enable the phase-shifted output
|
||||
// this can be changed on-the-fly
|
||||
#define ROSC_PHASE_ENABLE_RESET _u(0x1)
|
||||
#define ROSC_PHASE_ENABLE_BITS _u(0x00000008)
|
||||
#define ROSC_PHASE_ENABLE_MSB _u(3)
|
||||
#define ROSC_PHASE_ENABLE_LSB _u(3)
|
||||
#define ROSC_PHASE_ENABLE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_PHASE_FLIP
|
||||
// Description : invert the phase-shifted output
|
||||
// this is ignored when div=1
|
||||
#define ROSC_PHASE_FLIP_RESET _u(0x0)
|
||||
#define ROSC_PHASE_FLIP_BITS _u(0x00000004)
|
||||
#define ROSC_PHASE_FLIP_MSB _u(2)
|
||||
#define ROSC_PHASE_FLIP_LSB _u(2)
|
||||
#define ROSC_PHASE_FLIP_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_PHASE_SHIFT
|
||||
// Description : phase shift the phase-shifted output by SHIFT input clocks
|
||||
// this can be changed on-the-fly
|
||||
// must be set to 0 before setting div=1
|
||||
#define ROSC_PHASE_SHIFT_RESET _u(0x0)
|
||||
#define ROSC_PHASE_SHIFT_BITS _u(0x00000003)
|
||||
#define ROSC_PHASE_SHIFT_MSB _u(1)
|
||||
#define ROSC_PHASE_SHIFT_LSB _u(0)
|
||||
#define ROSC_PHASE_SHIFT_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : ROSC_STATUS
|
||||
// Description : Ring Oscillator Status
|
||||
#define ROSC_STATUS_OFFSET _u(0x00000018)
|
||||
#define ROSC_STATUS_BITS _u(0x81011000)
|
||||
#define ROSC_STATUS_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_STATUS_STABLE
|
||||
// Description : Oscillator is running and stable
|
||||
#define ROSC_STATUS_STABLE_RESET _u(0x0)
|
||||
#define ROSC_STATUS_STABLE_BITS _u(0x80000000)
|
||||
#define ROSC_STATUS_STABLE_MSB _u(31)
|
||||
#define ROSC_STATUS_STABLE_LSB _u(31)
|
||||
#define ROSC_STATUS_STABLE_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_STATUS_BADWRITE
|
||||
// Description : An invalid value has been written to CTRL_ENABLE or
|
||||
// CTRL_FREQ_RANGE or FREQA or FREQB or DIV or PHASE or DORMANT
|
||||
#define ROSC_STATUS_BADWRITE_RESET _u(0x0)
|
||||
#define ROSC_STATUS_BADWRITE_BITS _u(0x01000000)
|
||||
#define ROSC_STATUS_BADWRITE_MSB _u(24)
|
||||
#define ROSC_STATUS_BADWRITE_LSB _u(24)
|
||||
#define ROSC_STATUS_BADWRITE_ACCESS "WC"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_STATUS_DIV_RUNNING
|
||||
// Description : post-divider is running
|
||||
// this resets to 0 but transitions to 1 during chip startup
|
||||
#define ROSC_STATUS_DIV_RUNNING_RESET "-"
|
||||
#define ROSC_STATUS_DIV_RUNNING_BITS _u(0x00010000)
|
||||
#define ROSC_STATUS_DIV_RUNNING_MSB _u(16)
|
||||
#define ROSC_STATUS_DIV_RUNNING_LSB _u(16)
|
||||
#define ROSC_STATUS_DIV_RUNNING_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : ROSC_STATUS_ENABLED
|
||||
// Description : Oscillator is enabled but not necessarily running and stable
|
||||
// this resets to 0 but transitions to 1 during chip startup
|
||||
#define ROSC_STATUS_ENABLED_RESET "-"
|
||||
#define ROSC_STATUS_ENABLED_BITS _u(0x00001000)
|
||||
#define ROSC_STATUS_ENABLED_MSB _u(12)
|
||||
#define ROSC_STATUS_ENABLED_LSB _u(12)
|
||||
#define ROSC_STATUS_ENABLED_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : ROSC_RANDOMBIT
|
||||
// Description : This just reads the state of the oscillator output so
|
||||
// randomness is compromised if the ring oscillator is stopped or
|
||||
// run at a harmonic of the bus frequency
|
||||
#define ROSC_RANDOMBIT_OFFSET _u(0x0000001c)
|
||||
#define ROSC_RANDOMBIT_BITS _u(0x00000001)
|
||||
#define ROSC_RANDOMBIT_RESET _u(0x00000001)
|
||||
#define ROSC_RANDOMBIT_MSB _u(0)
|
||||
#define ROSC_RANDOMBIT_LSB _u(0)
|
||||
#define ROSC_RANDOMBIT_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : ROSC_COUNT
|
||||
// Description : A down counter running at the ROSC frequency which counts to
|
||||
// zero and stops.
|
||||
// To start the counter write a non-zero value.
|
||||
// Can be used for short software pauses when setting up time
|
||||
// sensitive hardware.
|
||||
#define ROSC_COUNT_OFFSET _u(0x00000020)
|
||||
#define ROSC_COUNT_BITS _u(0x000000ff)
|
||||
#define ROSC_COUNT_RESET _u(0x00000000)
|
||||
#define ROSC_COUNT_MSB _u(7)
|
||||
#define ROSC_COUNT_LSB _u(0)
|
||||
#define ROSC_COUNT_ACCESS "RW"
|
||||
// =============================================================================
|
||||
#endif // HARDWARE_REGS_ROSC_DEFINED
|
398
lib/rp2040/hardware/regs/rtc.h
Normal file
398
lib/rp2040/hardware/regs/rtc.h
Normal file
@ -0,0 +1,398 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// =============================================================================
|
||||
// Register block : RTC
|
||||
// Version : 1
|
||||
// Bus type : apb
|
||||
// Description : Register block to control RTC
|
||||
// =============================================================================
|
||||
#ifndef HARDWARE_REGS_RTC_DEFINED
|
||||
#define HARDWARE_REGS_RTC_DEFINED
|
||||
// =============================================================================
|
||||
// Register : RTC_CLKDIV_M1
|
||||
// Description : Divider minus 1 for the 1 second counter. Safe to change the
|
||||
// value when RTC is not enabled.
|
||||
#define RTC_CLKDIV_M1_OFFSET _u(0x00000000)
|
||||
#define RTC_CLKDIV_M1_BITS _u(0x0000ffff)
|
||||
#define RTC_CLKDIV_M1_RESET _u(0x00000000)
|
||||
#define RTC_CLKDIV_M1_MSB _u(15)
|
||||
#define RTC_CLKDIV_M1_LSB _u(0)
|
||||
#define RTC_CLKDIV_M1_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : RTC_SETUP_0
|
||||
// Description : RTC setup register 0
|
||||
#define RTC_SETUP_0_OFFSET _u(0x00000004)
|
||||
#define RTC_SETUP_0_BITS _u(0x00ffff1f)
|
||||
#define RTC_SETUP_0_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_SETUP_0_YEAR
|
||||
// Description : Year
|
||||
#define RTC_SETUP_0_YEAR_RESET _u(0x000)
|
||||
#define RTC_SETUP_0_YEAR_BITS _u(0x00fff000)
|
||||
#define RTC_SETUP_0_YEAR_MSB _u(23)
|
||||
#define RTC_SETUP_0_YEAR_LSB _u(12)
|
||||
#define RTC_SETUP_0_YEAR_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_SETUP_0_MONTH
|
||||
// Description : Month (1..12)
|
||||
#define RTC_SETUP_0_MONTH_RESET _u(0x0)
|
||||
#define RTC_SETUP_0_MONTH_BITS _u(0x00000f00)
|
||||
#define RTC_SETUP_0_MONTH_MSB _u(11)
|
||||
#define RTC_SETUP_0_MONTH_LSB _u(8)
|
||||
#define RTC_SETUP_0_MONTH_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_SETUP_0_DAY
|
||||
// Description : Day of the month (1..31)
|
||||
#define RTC_SETUP_0_DAY_RESET _u(0x00)
|
||||
#define RTC_SETUP_0_DAY_BITS _u(0x0000001f)
|
||||
#define RTC_SETUP_0_DAY_MSB _u(4)
|
||||
#define RTC_SETUP_0_DAY_LSB _u(0)
|
||||
#define RTC_SETUP_0_DAY_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : RTC_SETUP_1
|
||||
// Description : RTC setup register 1
|
||||
#define RTC_SETUP_1_OFFSET _u(0x00000008)
|
||||
#define RTC_SETUP_1_BITS _u(0x071f3f3f)
|
||||
#define RTC_SETUP_1_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_SETUP_1_DOTW
|
||||
// Description : Day of the week: 1-Monday...0-Sunday ISO 8601 mod 7
|
||||
#define RTC_SETUP_1_DOTW_RESET _u(0x0)
|
||||
#define RTC_SETUP_1_DOTW_BITS _u(0x07000000)
|
||||
#define RTC_SETUP_1_DOTW_MSB _u(26)
|
||||
#define RTC_SETUP_1_DOTW_LSB _u(24)
|
||||
#define RTC_SETUP_1_DOTW_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_SETUP_1_HOUR
|
||||
// Description : Hours
|
||||
#define RTC_SETUP_1_HOUR_RESET _u(0x00)
|
||||
#define RTC_SETUP_1_HOUR_BITS _u(0x001f0000)
|
||||
#define RTC_SETUP_1_HOUR_MSB _u(20)
|
||||
#define RTC_SETUP_1_HOUR_LSB _u(16)
|
||||
#define RTC_SETUP_1_HOUR_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_SETUP_1_MIN
|
||||
// Description : Minutes
|
||||
#define RTC_SETUP_1_MIN_RESET _u(0x00)
|
||||
#define RTC_SETUP_1_MIN_BITS _u(0x00003f00)
|
||||
#define RTC_SETUP_1_MIN_MSB _u(13)
|
||||
#define RTC_SETUP_1_MIN_LSB _u(8)
|
||||
#define RTC_SETUP_1_MIN_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_SETUP_1_SEC
|
||||
// Description : Seconds
|
||||
#define RTC_SETUP_1_SEC_RESET _u(0x00)
|
||||
#define RTC_SETUP_1_SEC_BITS _u(0x0000003f)
|
||||
#define RTC_SETUP_1_SEC_MSB _u(5)
|
||||
#define RTC_SETUP_1_SEC_LSB _u(0)
|
||||
#define RTC_SETUP_1_SEC_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : RTC_CTRL
|
||||
// Description : RTC Control and status
|
||||
#define RTC_CTRL_OFFSET _u(0x0000000c)
|
||||
#define RTC_CTRL_BITS _u(0x00000113)
|
||||
#define RTC_CTRL_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_CTRL_FORCE_NOTLEAPYEAR
|
||||
// Description : If set, leapyear is forced off.
|
||||
// Useful for years divisible by 100 but not by 400
|
||||
#define RTC_CTRL_FORCE_NOTLEAPYEAR_RESET _u(0x0)
|
||||
#define RTC_CTRL_FORCE_NOTLEAPYEAR_BITS _u(0x00000100)
|
||||
#define RTC_CTRL_FORCE_NOTLEAPYEAR_MSB _u(8)
|
||||
#define RTC_CTRL_FORCE_NOTLEAPYEAR_LSB _u(8)
|
||||
#define RTC_CTRL_FORCE_NOTLEAPYEAR_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_CTRL_LOAD
|
||||
// Description : Load RTC
|
||||
#define RTC_CTRL_LOAD_RESET _u(0x0)
|
||||
#define RTC_CTRL_LOAD_BITS _u(0x00000010)
|
||||
#define RTC_CTRL_LOAD_MSB _u(4)
|
||||
#define RTC_CTRL_LOAD_LSB _u(4)
|
||||
#define RTC_CTRL_LOAD_ACCESS "SC"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_CTRL_RTC_ACTIVE
|
||||
// Description : RTC enabled (running)
|
||||
#define RTC_CTRL_RTC_ACTIVE_RESET "-"
|
||||
#define RTC_CTRL_RTC_ACTIVE_BITS _u(0x00000002)
|
||||
#define RTC_CTRL_RTC_ACTIVE_MSB _u(1)
|
||||
#define RTC_CTRL_RTC_ACTIVE_LSB _u(1)
|
||||
#define RTC_CTRL_RTC_ACTIVE_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_CTRL_RTC_ENABLE
|
||||
// Description : Enable RTC
|
||||
#define RTC_CTRL_RTC_ENABLE_RESET _u(0x0)
|
||||
#define RTC_CTRL_RTC_ENABLE_BITS _u(0x00000001)
|
||||
#define RTC_CTRL_RTC_ENABLE_MSB _u(0)
|
||||
#define RTC_CTRL_RTC_ENABLE_LSB _u(0)
|
||||
#define RTC_CTRL_RTC_ENABLE_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : RTC_IRQ_SETUP_0
|
||||
// Description : Interrupt setup register 0
|
||||
#define RTC_IRQ_SETUP_0_OFFSET _u(0x00000010)
|
||||
#define RTC_IRQ_SETUP_0_BITS _u(0x37ffff1f)
|
||||
#define RTC_IRQ_SETUP_0_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_IRQ_SETUP_0_MATCH_ACTIVE
|
||||
// Description : None
|
||||
#define RTC_IRQ_SETUP_0_MATCH_ACTIVE_RESET "-"
|
||||
#define RTC_IRQ_SETUP_0_MATCH_ACTIVE_BITS _u(0x20000000)
|
||||
#define RTC_IRQ_SETUP_0_MATCH_ACTIVE_MSB _u(29)
|
||||
#define RTC_IRQ_SETUP_0_MATCH_ACTIVE_LSB _u(29)
|
||||
#define RTC_IRQ_SETUP_0_MATCH_ACTIVE_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_IRQ_SETUP_0_MATCH_ENA
|
||||
// Description : Global match enable. Don't change any other value while this
|
||||
// one is enabled
|
||||
#define RTC_IRQ_SETUP_0_MATCH_ENA_RESET _u(0x0)
|
||||
#define RTC_IRQ_SETUP_0_MATCH_ENA_BITS _u(0x10000000)
|
||||
#define RTC_IRQ_SETUP_0_MATCH_ENA_MSB _u(28)
|
||||
#define RTC_IRQ_SETUP_0_MATCH_ENA_LSB _u(28)
|
||||
#define RTC_IRQ_SETUP_0_MATCH_ENA_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_IRQ_SETUP_0_YEAR_ENA
|
||||
// Description : Enable year matching
|
||||
#define RTC_IRQ_SETUP_0_YEAR_ENA_RESET _u(0x0)
|
||||
#define RTC_IRQ_SETUP_0_YEAR_ENA_BITS _u(0x04000000)
|
||||
#define RTC_IRQ_SETUP_0_YEAR_ENA_MSB _u(26)
|
||||
#define RTC_IRQ_SETUP_0_YEAR_ENA_LSB _u(26)
|
||||
#define RTC_IRQ_SETUP_0_YEAR_ENA_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_IRQ_SETUP_0_MONTH_ENA
|
||||
// Description : Enable month matching
|
||||
#define RTC_IRQ_SETUP_0_MONTH_ENA_RESET _u(0x0)
|
||||
#define RTC_IRQ_SETUP_0_MONTH_ENA_BITS _u(0x02000000)
|
||||
#define RTC_IRQ_SETUP_0_MONTH_ENA_MSB _u(25)
|
||||
#define RTC_IRQ_SETUP_0_MONTH_ENA_LSB _u(25)
|
||||
#define RTC_IRQ_SETUP_0_MONTH_ENA_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_IRQ_SETUP_0_DAY_ENA
|
||||
// Description : Enable day matching
|
||||
#define RTC_IRQ_SETUP_0_DAY_ENA_RESET _u(0x0)
|
||||
#define RTC_IRQ_SETUP_0_DAY_ENA_BITS _u(0x01000000)
|
||||
#define RTC_IRQ_SETUP_0_DAY_ENA_MSB _u(24)
|
||||
#define RTC_IRQ_SETUP_0_DAY_ENA_LSB _u(24)
|
||||
#define RTC_IRQ_SETUP_0_DAY_ENA_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_IRQ_SETUP_0_YEAR
|
||||
// Description : Year
|
||||
#define RTC_IRQ_SETUP_0_YEAR_RESET _u(0x000)
|
||||
#define RTC_IRQ_SETUP_0_YEAR_BITS _u(0x00fff000)
|
||||
#define RTC_IRQ_SETUP_0_YEAR_MSB _u(23)
|
||||
#define RTC_IRQ_SETUP_0_YEAR_LSB _u(12)
|
||||
#define RTC_IRQ_SETUP_0_YEAR_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_IRQ_SETUP_0_MONTH
|
||||
// Description : Month (1..12)
|
||||
#define RTC_IRQ_SETUP_0_MONTH_RESET _u(0x0)
|
||||
#define RTC_IRQ_SETUP_0_MONTH_BITS _u(0x00000f00)
|
||||
#define RTC_IRQ_SETUP_0_MONTH_MSB _u(11)
|
||||
#define RTC_IRQ_SETUP_0_MONTH_LSB _u(8)
|
||||
#define RTC_IRQ_SETUP_0_MONTH_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_IRQ_SETUP_0_DAY
|
||||
// Description : Day of the month (1..31)
|
||||
#define RTC_IRQ_SETUP_0_DAY_RESET _u(0x00)
|
||||
#define RTC_IRQ_SETUP_0_DAY_BITS _u(0x0000001f)
|
||||
#define RTC_IRQ_SETUP_0_DAY_MSB _u(4)
|
||||
#define RTC_IRQ_SETUP_0_DAY_LSB _u(0)
|
||||
#define RTC_IRQ_SETUP_0_DAY_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : RTC_IRQ_SETUP_1
|
||||
// Description : Interrupt setup register 1
|
||||
#define RTC_IRQ_SETUP_1_OFFSET _u(0x00000014)
|
||||
#define RTC_IRQ_SETUP_1_BITS _u(0xf71f3f3f)
|
||||
#define RTC_IRQ_SETUP_1_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_IRQ_SETUP_1_DOTW_ENA
|
||||
// Description : Enable day of the week matching
|
||||
#define RTC_IRQ_SETUP_1_DOTW_ENA_RESET _u(0x0)
|
||||
#define RTC_IRQ_SETUP_1_DOTW_ENA_BITS _u(0x80000000)
|
||||
#define RTC_IRQ_SETUP_1_DOTW_ENA_MSB _u(31)
|
||||
#define RTC_IRQ_SETUP_1_DOTW_ENA_LSB _u(31)
|
||||
#define RTC_IRQ_SETUP_1_DOTW_ENA_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_IRQ_SETUP_1_HOUR_ENA
|
||||
// Description : Enable hour matching
|
||||
#define RTC_IRQ_SETUP_1_HOUR_ENA_RESET _u(0x0)
|
||||
#define RTC_IRQ_SETUP_1_HOUR_ENA_BITS _u(0x40000000)
|
||||
#define RTC_IRQ_SETUP_1_HOUR_ENA_MSB _u(30)
|
||||
#define RTC_IRQ_SETUP_1_HOUR_ENA_LSB _u(30)
|
||||
#define RTC_IRQ_SETUP_1_HOUR_ENA_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_IRQ_SETUP_1_MIN_ENA
|
||||
// Description : Enable minute matching
|
||||
#define RTC_IRQ_SETUP_1_MIN_ENA_RESET _u(0x0)
|
||||
#define RTC_IRQ_SETUP_1_MIN_ENA_BITS _u(0x20000000)
|
||||
#define RTC_IRQ_SETUP_1_MIN_ENA_MSB _u(29)
|
||||
#define RTC_IRQ_SETUP_1_MIN_ENA_LSB _u(29)
|
||||
#define RTC_IRQ_SETUP_1_MIN_ENA_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_IRQ_SETUP_1_SEC_ENA
|
||||
// Description : Enable second matching
|
||||
#define RTC_IRQ_SETUP_1_SEC_ENA_RESET _u(0x0)
|
||||
#define RTC_IRQ_SETUP_1_SEC_ENA_BITS _u(0x10000000)
|
||||
#define RTC_IRQ_SETUP_1_SEC_ENA_MSB _u(28)
|
||||
#define RTC_IRQ_SETUP_1_SEC_ENA_LSB _u(28)
|
||||
#define RTC_IRQ_SETUP_1_SEC_ENA_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_IRQ_SETUP_1_DOTW
|
||||
// Description : Day of the week
|
||||
#define RTC_IRQ_SETUP_1_DOTW_RESET _u(0x0)
|
||||
#define RTC_IRQ_SETUP_1_DOTW_BITS _u(0x07000000)
|
||||
#define RTC_IRQ_SETUP_1_DOTW_MSB _u(26)
|
||||
#define RTC_IRQ_SETUP_1_DOTW_LSB _u(24)
|
||||
#define RTC_IRQ_SETUP_1_DOTW_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_IRQ_SETUP_1_HOUR
|
||||
// Description : Hours
|
||||
#define RTC_IRQ_SETUP_1_HOUR_RESET _u(0x00)
|
||||
#define RTC_IRQ_SETUP_1_HOUR_BITS _u(0x001f0000)
|
||||
#define RTC_IRQ_SETUP_1_HOUR_MSB _u(20)
|
||||
#define RTC_IRQ_SETUP_1_HOUR_LSB _u(16)
|
||||
#define RTC_IRQ_SETUP_1_HOUR_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_IRQ_SETUP_1_MIN
|
||||
// Description : Minutes
|
||||
#define RTC_IRQ_SETUP_1_MIN_RESET _u(0x00)
|
||||
#define RTC_IRQ_SETUP_1_MIN_BITS _u(0x00003f00)
|
||||
#define RTC_IRQ_SETUP_1_MIN_MSB _u(13)
|
||||
#define RTC_IRQ_SETUP_1_MIN_LSB _u(8)
|
||||
#define RTC_IRQ_SETUP_1_MIN_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_IRQ_SETUP_1_SEC
|
||||
// Description : Seconds
|
||||
#define RTC_IRQ_SETUP_1_SEC_RESET _u(0x00)
|
||||
#define RTC_IRQ_SETUP_1_SEC_BITS _u(0x0000003f)
|
||||
#define RTC_IRQ_SETUP_1_SEC_MSB _u(5)
|
||||
#define RTC_IRQ_SETUP_1_SEC_LSB _u(0)
|
||||
#define RTC_IRQ_SETUP_1_SEC_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : RTC_RTC_1
|
||||
// Description : RTC register 1.
|
||||
#define RTC_RTC_1_OFFSET _u(0x00000018)
|
||||
#define RTC_RTC_1_BITS _u(0x00ffff1f)
|
||||
#define RTC_RTC_1_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_RTC_1_YEAR
|
||||
// Description : Year
|
||||
#define RTC_RTC_1_YEAR_RESET "-"
|
||||
#define RTC_RTC_1_YEAR_BITS _u(0x00fff000)
|
||||
#define RTC_RTC_1_YEAR_MSB _u(23)
|
||||
#define RTC_RTC_1_YEAR_LSB _u(12)
|
||||
#define RTC_RTC_1_YEAR_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_RTC_1_MONTH
|
||||
// Description : Month (1..12)
|
||||
#define RTC_RTC_1_MONTH_RESET "-"
|
||||
#define RTC_RTC_1_MONTH_BITS _u(0x00000f00)
|
||||
#define RTC_RTC_1_MONTH_MSB _u(11)
|
||||
#define RTC_RTC_1_MONTH_LSB _u(8)
|
||||
#define RTC_RTC_1_MONTH_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_RTC_1_DAY
|
||||
// Description : Day of the month (1..31)
|
||||
#define RTC_RTC_1_DAY_RESET "-"
|
||||
#define RTC_RTC_1_DAY_BITS _u(0x0000001f)
|
||||
#define RTC_RTC_1_DAY_MSB _u(4)
|
||||
#define RTC_RTC_1_DAY_LSB _u(0)
|
||||
#define RTC_RTC_1_DAY_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : RTC_RTC_0
|
||||
// Description : RTC register 0
|
||||
// Read this before RTC 1!
|
||||
#define RTC_RTC_0_OFFSET _u(0x0000001c)
|
||||
#define RTC_RTC_0_BITS _u(0x071f3f3f)
|
||||
#define RTC_RTC_0_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_RTC_0_DOTW
|
||||
// Description : Day of the week
|
||||
#define RTC_RTC_0_DOTW_RESET "-"
|
||||
#define RTC_RTC_0_DOTW_BITS _u(0x07000000)
|
||||
#define RTC_RTC_0_DOTW_MSB _u(26)
|
||||
#define RTC_RTC_0_DOTW_LSB _u(24)
|
||||
#define RTC_RTC_0_DOTW_ACCESS "RF"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_RTC_0_HOUR
|
||||
// Description : Hours
|
||||
#define RTC_RTC_0_HOUR_RESET "-"
|
||||
#define RTC_RTC_0_HOUR_BITS _u(0x001f0000)
|
||||
#define RTC_RTC_0_HOUR_MSB _u(20)
|
||||
#define RTC_RTC_0_HOUR_LSB _u(16)
|
||||
#define RTC_RTC_0_HOUR_ACCESS "RF"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_RTC_0_MIN
|
||||
// Description : Minutes
|
||||
#define RTC_RTC_0_MIN_RESET "-"
|
||||
#define RTC_RTC_0_MIN_BITS _u(0x00003f00)
|
||||
#define RTC_RTC_0_MIN_MSB _u(13)
|
||||
#define RTC_RTC_0_MIN_LSB _u(8)
|
||||
#define RTC_RTC_0_MIN_ACCESS "RF"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_RTC_0_SEC
|
||||
// Description : Seconds
|
||||
#define RTC_RTC_0_SEC_RESET "-"
|
||||
#define RTC_RTC_0_SEC_BITS _u(0x0000003f)
|
||||
#define RTC_RTC_0_SEC_MSB _u(5)
|
||||
#define RTC_RTC_0_SEC_LSB _u(0)
|
||||
#define RTC_RTC_0_SEC_ACCESS "RF"
|
||||
// =============================================================================
|
||||
// Register : RTC_INTR
|
||||
// Description : Raw Interrupts
|
||||
#define RTC_INTR_OFFSET _u(0x00000020)
|
||||
#define RTC_INTR_BITS _u(0x00000001)
|
||||
#define RTC_INTR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_INTR_RTC
|
||||
// Description : None
|
||||
#define RTC_INTR_RTC_RESET _u(0x0)
|
||||
#define RTC_INTR_RTC_BITS _u(0x00000001)
|
||||
#define RTC_INTR_RTC_MSB _u(0)
|
||||
#define RTC_INTR_RTC_LSB _u(0)
|
||||
#define RTC_INTR_RTC_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : RTC_INTE
|
||||
// Description : Interrupt Enable
|
||||
#define RTC_INTE_OFFSET _u(0x00000024)
|
||||
#define RTC_INTE_BITS _u(0x00000001)
|
||||
#define RTC_INTE_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_INTE_RTC
|
||||
// Description : None
|
||||
#define RTC_INTE_RTC_RESET _u(0x0)
|
||||
#define RTC_INTE_RTC_BITS _u(0x00000001)
|
||||
#define RTC_INTE_RTC_MSB _u(0)
|
||||
#define RTC_INTE_RTC_LSB _u(0)
|
||||
#define RTC_INTE_RTC_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : RTC_INTF
|
||||
// Description : Interrupt Force
|
||||
#define RTC_INTF_OFFSET _u(0x00000028)
|
||||
#define RTC_INTF_BITS _u(0x00000001)
|
||||
#define RTC_INTF_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_INTF_RTC
|
||||
// Description : None
|
||||
#define RTC_INTF_RTC_RESET _u(0x0)
|
||||
#define RTC_INTF_RTC_BITS _u(0x00000001)
|
||||
#define RTC_INTF_RTC_MSB _u(0)
|
||||
#define RTC_INTF_RTC_LSB _u(0)
|
||||
#define RTC_INTF_RTC_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : RTC_INTS
|
||||
// Description : Interrupt status after masking & forcing
|
||||
#define RTC_INTS_OFFSET _u(0x0000002c)
|
||||
#define RTC_INTS_BITS _u(0x00000001)
|
||||
#define RTC_INTS_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : RTC_INTS_RTC
|
||||
// Description : None
|
||||
#define RTC_INTS_RTC_RESET _u(0x0)
|
||||
#define RTC_INTS_RTC_BITS _u(0x00000001)
|
||||
#define RTC_INTS_RTC_MSB _u(0)
|
||||
#define RTC_INTS_RTC_LSB _u(0)
|
||||
#define RTC_INTS_RTC_ACCESS "RO"
|
||||
// =============================================================================
|
||||
#endif // HARDWARE_REGS_RTC_DEFINED
|
1656
lib/rp2040/hardware/regs/sio.h
Normal file
1656
lib/rp2040/hardware/regs/sio.h
Normal file
File diff suppressed because it is too large
Load Diff
521
lib/rp2040/hardware/regs/spi.h
Normal file
521
lib/rp2040/hardware/regs/spi.h
Normal file
@ -0,0 +1,521 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// =============================================================================
|
||||
// Register block : SPI
|
||||
// Version : 1
|
||||
// Bus type : apb
|
||||
// Description : None
|
||||
// =============================================================================
|
||||
#ifndef HARDWARE_REGS_SPI_DEFINED
|
||||
#define HARDWARE_REGS_SPI_DEFINED
|
||||
// =============================================================================
|
||||
// Register : SPI_SSPCR0
|
||||
// Description : Control register 0, SSPCR0 on page 3-4
|
||||
#define SPI_SSPCR0_OFFSET _u(0x00000000)
|
||||
#define SPI_SSPCR0_BITS _u(0x0000ffff)
|
||||
#define SPI_SSPCR0_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPCR0_SCR
|
||||
// Description : Serial clock rate. The value SCR is used to generate the
|
||||
// transmit and receive bit rate of the PrimeCell SSP. The bit
|
||||
// rate is: F SSPCLK CPSDVSR x (1+SCR) where CPSDVSR is an even
|
||||
// value from 2-254, programmed through the SSPCPSR register and
|
||||
// SCR is a value from 0-255.
|
||||
#define SPI_SSPCR0_SCR_RESET _u(0x00)
|
||||
#define SPI_SSPCR0_SCR_BITS _u(0x0000ff00)
|
||||
#define SPI_SSPCR0_SCR_MSB _u(15)
|
||||
#define SPI_SSPCR0_SCR_LSB _u(8)
|
||||
#define SPI_SSPCR0_SCR_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPCR0_SPH
|
||||
// Description : SSPCLKOUT phase, applicable to Motorola SPI frame format only.
|
||||
// See Motorola SPI frame format on page 2-10.
|
||||
#define SPI_SSPCR0_SPH_RESET _u(0x0)
|
||||
#define SPI_SSPCR0_SPH_BITS _u(0x00000080)
|
||||
#define SPI_SSPCR0_SPH_MSB _u(7)
|
||||
#define SPI_SSPCR0_SPH_LSB _u(7)
|
||||
#define SPI_SSPCR0_SPH_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPCR0_SPO
|
||||
// Description : SSPCLKOUT polarity, applicable to Motorola SPI frame format
|
||||
// only. See Motorola SPI frame format on page 2-10.
|
||||
#define SPI_SSPCR0_SPO_RESET _u(0x0)
|
||||
#define SPI_SSPCR0_SPO_BITS _u(0x00000040)
|
||||
#define SPI_SSPCR0_SPO_MSB _u(6)
|
||||
#define SPI_SSPCR0_SPO_LSB _u(6)
|
||||
#define SPI_SSPCR0_SPO_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPCR0_FRF
|
||||
// Description : Frame format: 00 Motorola SPI frame format. 01 TI synchronous
|
||||
// serial frame format. 10 National Microwire frame format. 11
|
||||
// Reserved, undefined operation.
|
||||
#define SPI_SSPCR0_FRF_RESET _u(0x0)
|
||||
#define SPI_SSPCR0_FRF_BITS _u(0x00000030)
|
||||
#define SPI_SSPCR0_FRF_MSB _u(5)
|
||||
#define SPI_SSPCR0_FRF_LSB _u(4)
|
||||
#define SPI_SSPCR0_FRF_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPCR0_DSS
|
||||
// Description : Data Size Select: 0000 Reserved, undefined operation. 0001
|
||||
// Reserved, undefined operation. 0010 Reserved, undefined
|
||||
// operation. 0011 4-bit data. 0100 5-bit data. 0101 6-bit data.
|
||||
// 0110 7-bit data. 0111 8-bit data. 1000 9-bit data. 1001 10-bit
|
||||
// data. 1010 11-bit data. 1011 12-bit data. 1100 13-bit data.
|
||||
// 1101 14-bit data. 1110 15-bit data. 1111 16-bit data.
|
||||
#define SPI_SSPCR0_DSS_RESET _u(0x0)
|
||||
#define SPI_SSPCR0_DSS_BITS _u(0x0000000f)
|
||||
#define SPI_SSPCR0_DSS_MSB _u(3)
|
||||
#define SPI_SSPCR0_DSS_LSB _u(0)
|
||||
#define SPI_SSPCR0_DSS_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SPI_SSPCR1
|
||||
// Description : Control register 1, SSPCR1 on page 3-5
|
||||
#define SPI_SSPCR1_OFFSET _u(0x00000004)
|
||||
#define SPI_SSPCR1_BITS _u(0x0000000f)
|
||||
#define SPI_SSPCR1_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPCR1_SOD
|
||||
// Description : Slave-mode output disable. This bit is relevant only in the
|
||||
// slave mode, MS=1. In multiple-slave systems, it is possible for
|
||||
// an PrimeCell SSP master to broadcast a message to all slaves in
|
||||
// the system while ensuring that only one slave drives data onto
|
||||
// its serial output line. In such systems the RXD lines from
|
||||
// multiple slaves could be tied together. To operate in such
|
||||
// systems, the SOD bit can be set if the PrimeCell SSP slave is
|
||||
// not supposed to drive the SSPTXD line: 0 SSP can drive the
|
||||
// SSPTXD output in slave mode. 1 SSP must not drive the SSPTXD
|
||||
// output in slave mode.
|
||||
#define SPI_SSPCR1_SOD_RESET _u(0x0)
|
||||
#define SPI_SSPCR1_SOD_BITS _u(0x00000008)
|
||||
#define SPI_SSPCR1_SOD_MSB _u(3)
|
||||
#define SPI_SSPCR1_SOD_LSB _u(3)
|
||||
#define SPI_SSPCR1_SOD_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPCR1_MS
|
||||
// Description : Master or slave mode select. This bit can be modified only when
|
||||
// the PrimeCell SSP is disabled, SSE=0: 0 Device configured as
|
||||
// master, default. 1 Device configured as slave.
|
||||
#define SPI_SSPCR1_MS_RESET _u(0x0)
|
||||
#define SPI_SSPCR1_MS_BITS _u(0x00000004)
|
||||
#define SPI_SSPCR1_MS_MSB _u(2)
|
||||
#define SPI_SSPCR1_MS_LSB _u(2)
|
||||
#define SPI_SSPCR1_MS_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPCR1_SSE
|
||||
// Description : Synchronous serial port enable: 0 SSP operation disabled. 1 SSP
|
||||
// operation enabled.
|
||||
#define SPI_SSPCR1_SSE_RESET _u(0x0)
|
||||
#define SPI_SSPCR1_SSE_BITS _u(0x00000002)
|
||||
#define SPI_SSPCR1_SSE_MSB _u(1)
|
||||
#define SPI_SSPCR1_SSE_LSB _u(1)
|
||||
#define SPI_SSPCR1_SSE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPCR1_LBM
|
||||
// Description : Loop back mode: 0 Normal serial port operation enabled. 1
|
||||
// Output of transmit serial shifter is connected to input of
|
||||
// receive serial shifter internally.
|
||||
#define SPI_SSPCR1_LBM_RESET _u(0x0)
|
||||
#define SPI_SSPCR1_LBM_BITS _u(0x00000001)
|
||||
#define SPI_SSPCR1_LBM_MSB _u(0)
|
||||
#define SPI_SSPCR1_LBM_LSB _u(0)
|
||||
#define SPI_SSPCR1_LBM_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SPI_SSPDR
|
||||
// Description : Data register, SSPDR on page 3-6
|
||||
#define SPI_SSPDR_OFFSET _u(0x00000008)
|
||||
#define SPI_SSPDR_BITS _u(0x0000ffff)
|
||||
#define SPI_SSPDR_RESET "-"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPDR_DATA
|
||||
// Description : Transmit/Receive FIFO: Read Receive FIFO. Write Transmit FIFO.
|
||||
// You must right-justify data when the PrimeCell SSP is
|
||||
// programmed for a data size that is less than 16 bits. Unused
|
||||
// bits at the top are ignored by transmit logic. The receive
|
||||
// logic automatically right-justifies.
|
||||
#define SPI_SSPDR_DATA_RESET "-"
|
||||
#define SPI_SSPDR_DATA_BITS _u(0x0000ffff)
|
||||
#define SPI_SSPDR_DATA_MSB _u(15)
|
||||
#define SPI_SSPDR_DATA_LSB _u(0)
|
||||
#define SPI_SSPDR_DATA_ACCESS "RWF"
|
||||
// =============================================================================
|
||||
// Register : SPI_SSPSR
|
||||
// Description : Status register, SSPSR on page 3-7
|
||||
#define SPI_SSPSR_OFFSET _u(0x0000000c)
|
||||
#define SPI_SSPSR_BITS _u(0x0000001f)
|
||||
#define SPI_SSPSR_RESET _u(0x00000003)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPSR_BSY
|
||||
// Description : PrimeCell SSP busy flag, RO: 0 SSP is idle. 1 SSP is currently
|
||||
// transmitting and/or receiving a frame or the transmit FIFO is
|
||||
// not empty.
|
||||
#define SPI_SSPSR_BSY_RESET _u(0x0)
|
||||
#define SPI_SSPSR_BSY_BITS _u(0x00000010)
|
||||
#define SPI_SSPSR_BSY_MSB _u(4)
|
||||
#define SPI_SSPSR_BSY_LSB _u(4)
|
||||
#define SPI_SSPSR_BSY_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPSR_RFF
|
||||
// Description : Receive FIFO full, RO: 0 Receive FIFO is not full. 1 Receive
|
||||
// FIFO is full.
|
||||
#define SPI_SSPSR_RFF_RESET _u(0x0)
|
||||
#define SPI_SSPSR_RFF_BITS _u(0x00000008)
|
||||
#define SPI_SSPSR_RFF_MSB _u(3)
|
||||
#define SPI_SSPSR_RFF_LSB _u(3)
|
||||
#define SPI_SSPSR_RFF_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPSR_RNE
|
||||
// Description : Receive FIFO not empty, RO: 0 Receive FIFO is empty. 1 Receive
|
||||
// FIFO is not empty.
|
||||
#define SPI_SSPSR_RNE_RESET _u(0x0)
|
||||
#define SPI_SSPSR_RNE_BITS _u(0x00000004)
|
||||
#define SPI_SSPSR_RNE_MSB _u(2)
|
||||
#define SPI_SSPSR_RNE_LSB _u(2)
|
||||
#define SPI_SSPSR_RNE_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPSR_TNF
|
||||
// Description : Transmit FIFO not full, RO: 0 Transmit FIFO is full. 1 Transmit
|
||||
// FIFO is not full.
|
||||
#define SPI_SSPSR_TNF_RESET _u(0x1)
|
||||
#define SPI_SSPSR_TNF_BITS _u(0x00000002)
|
||||
#define SPI_SSPSR_TNF_MSB _u(1)
|
||||
#define SPI_SSPSR_TNF_LSB _u(1)
|
||||
#define SPI_SSPSR_TNF_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPSR_TFE
|
||||
// Description : Transmit FIFO empty, RO: 0 Transmit FIFO is not empty. 1
|
||||
// Transmit FIFO is empty.
|
||||
#define SPI_SSPSR_TFE_RESET _u(0x1)
|
||||
#define SPI_SSPSR_TFE_BITS _u(0x00000001)
|
||||
#define SPI_SSPSR_TFE_MSB _u(0)
|
||||
#define SPI_SSPSR_TFE_LSB _u(0)
|
||||
#define SPI_SSPSR_TFE_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SPI_SSPCPSR
|
||||
// Description : Clock prescale register, SSPCPSR on page 3-8
|
||||
#define SPI_SSPCPSR_OFFSET _u(0x00000010)
|
||||
#define SPI_SSPCPSR_BITS _u(0x000000ff)
|
||||
#define SPI_SSPCPSR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPCPSR_CPSDVSR
|
||||
// Description : Clock prescale divisor. Must be an even number from 2-254,
|
||||
// depending on the frequency of SSPCLK. The least significant bit
|
||||
// always returns zero on reads.
|
||||
#define SPI_SSPCPSR_CPSDVSR_RESET _u(0x00)
|
||||
#define SPI_SSPCPSR_CPSDVSR_BITS _u(0x000000ff)
|
||||
#define SPI_SSPCPSR_CPSDVSR_MSB _u(7)
|
||||
#define SPI_SSPCPSR_CPSDVSR_LSB _u(0)
|
||||
#define SPI_SSPCPSR_CPSDVSR_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SPI_SSPIMSC
|
||||
// Description : Interrupt mask set or clear register, SSPIMSC on page 3-9
|
||||
#define SPI_SSPIMSC_OFFSET _u(0x00000014)
|
||||
#define SPI_SSPIMSC_BITS _u(0x0000000f)
|
||||
#define SPI_SSPIMSC_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPIMSC_TXIM
|
||||
// Description : Transmit FIFO interrupt mask: 0 Transmit FIFO half empty or
|
||||
// less condition interrupt is masked. 1 Transmit FIFO half empty
|
||||
// or less condition interrupt is not masked.
|
||||
#define SPI_SSPIMSC_TXIM_RESET _u(0x0)
|
||||
#define SPI_SSPIMSC_TXIM_BITS _u(0x00000008)
|
||||
#define SPI_SSPIMSC_TXIM_MSB _u(3)
|
||||
#define SPI_SSPIMSC_TXIM_LSB _u(3)
|
||||
#define SPI_SSPIMSC_TXIM_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPIMSC_RXIM
|
||||
// Description : Receive FIFO interrupt mask: 0 Receive FIFO half full or less
|
||||
// condition interrupt is masked. 1 Receive FIFO half full or less
|
||||
// condition interrupt is not masked.
|
||||
#define SPI_SSPIMSC_RXIM_RESET _u(0x0)
|
||||
#define SPI_SSPIMSC_RXIM_BITS _u(0x00000004)
|
||||
#define SPI_SSPIMSC_RXIM_MSB _u(2)
|
||||
#define SPI_SSPIMSC_RXIM_LSB _u(2)
|
||||
#define SPI_SSPIMSC_RXIM_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPIMSC_RTIM
|
||||
// Description : Receive timeout interrupt mask: 0 Receive FIFO not empty and no
|
||||
// read prior to timeout period interrupt is masked. 1 Receive
|
||||
// FIFO not empty and no read prior to timeout period interrupt is
|
||||
// not masked.
|
||||
#define SPI_SSPIMSC_RTIM_RESET _u(0x0)
|
||||
#define SPI_SSPIMSC_RTIM_BITS _u(0x00000002)
|
||||
#define SPI_SSPIMSC_RTIM_MSB _u(1)
|
||||
#define SPI_SSPIMSC_RTIM_LSB _u(1)
|
||||
#define SPI_SSPIMSC_RTIM_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPIMSC_RORIM
|
||||
// Description : Receive overrun interrupt mask: 0 Receive FIFO written to while
|
||||
// full condition interrupt is masked. 1 Receive FIFO written to
|
||||
// while full condition interrupt is not masked.
|
||||
#define SPI_SSPIMSC_RORIM_RESET _u(0x0)
|
||||
#define SPI_SSPIMSC_RORIM_BITS _u(0x00000001)
|
||||
#define SPI_SSPIMSC_RORIM_MSB _u(0)
|
||||
#define SPI_SSPIMSC_RORIM_LSB _u(0)
|
||||
#define SPI_SSPIMSC_RORIM_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SPI_SSPRIS
|
||||
// Description : Raw interrupt status register, SSPRIS on page 3-10
|
||||
#define SPI_SSPRIS_OFFSET _u(0x00000018)
|
||||
#define SPI_SSPRIS_BITS _u(0x0000000f)
|
||||
#define SPI_SSPRIS_RESET _u(0x00000008)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPRIS_TXRIS
|
||||
// Description : Gives the raw interrupt state, prior to masking, of the
|
||||
// SSPTXINTR interrupt
|
||||
#define SPI_SSPRIS_TXRIS_RESET _u(0x1)
|
||||
#define SPI_SSPRIS_TXRIS_BITS _u(0x00000008)
|
||||
#define SPI_SSPRIS_TXRIS_MSB _u(3)
|
||||
#define SPI_SSPRIS_TXRIS_LSB _u(3)
|
||||
#define SPI_SSPRIS_TXRIS_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPRIS_RXRIS
|
||||
// Description : Gives the raw interrupt state, prior to masking, of the
|
||||
// SSPRXINTR interrupt
|
||||
#define SPI_SSPRIS_RXRIS_RESET _u(0x0)
|
||||
#define SPI_SSPRIS_RXRIS_BITS _u(0x00000004)
|
||||
#define SPI_SSPRIS_RXRIS_MSB _u(2)
|
||||
#define SPI_SSPRIS_RXRIS_LSB _u(2)
|
||||
#define SPI_SSPRIS_RXRIS_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPRIS_RTRIS
|
||||
// Description : Gives the raw interrupt state, prior to masking, of the
|
||||
// SSPRTINTR interrupt
|
||||
#define SPI_SSPRIS_RTRIS_RESET _u(0x0)
|
||||
#define SPI_SSPRIS_RTRIS_BITS _u(0x00000002)
|
||||
#define SPI_SSPRIS_RTRIS_MSB _u(1)
|
||||
#define SPI_SSPRIS_RTRIS_LSB _u(1)
|
||||
#define SPI_SSPRIS_RTRIS_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPRIS_RORRIS
|
||||
// Description : Gives the raw interrupt state, prior to masking, of the
|
||||
// SSPRORINTR interrupt
|
||||
#define SPI_SSPRIS_RORRIS_RESET _u(0x0)
|
||||
#define SPI_SSPRIS_RORRIS_BITS _u(0x00000001)
|
||||
#define SPI_SSPRIS_RORRIS_MSB _u(0)
|
||||
#define SPI_SSPRIS_RORRIS_LSB _u(0)
|
||||
#define SPI_SSPRIS_RORRIS_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SPI_SSPMIS
|
||||
// Description : Masked interrupt status register, SSPMIS on page 3-11
|
||||
#define SPI_SSPMIS_OFFSET _u(0x0000001c)
|
||||
#define SPI_SSPMIS_BITS _u(0x0000000f)
|
||||
#define SPI_SSPMIS_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPMIS_TXMIS
|
||||
// Description : Gives the transmit FIFO masked interrupt state, after masking,
|
||||
// of the SSPTXINTR interrupt
|
||||
#define SPI_SSPMIS_TXMIS_RESET _u(0x0)
|
||||
#define SPI_SSPMIS_TXMIS_BITS _u(0x00000008)
|
||||
#define SPI_SSPMIS_TXMIS_MSB _u(3)
|
||||
#define SPI_SSPMIS_TXMIS_LSB _u(3)
|
||||
#define SPI_SSPMIS_TXMIS_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPMIS_RXMIS
|
||||
// Description : Gives the receive FIFO masked interrupt state, after masking,
|
||||
// of the SSPRXINTR interrupt
|
||||
#define SPI_SSPMIS_RXMIS_RESET _u(0x0)
|
||||
#define SPI_SSPMIS_RXMIS_BITS _u(0x00000004)
|
||||
#define SPI_SSPMIS_RXMIS_MSB _u(2)
|
||||
#define SPI_SSPMIS_RXMIS_LSB _u(2)
|
||||
#define SPI_SSPMIS_RXMIS_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPMIS_RTMIS
|
||||
// Description : Gives the receive timeout masked interrupt state, after
|
||||
// masking, of the SSPRTINTR interrupt
|
||||
#define SPI_SSPMIS_RTMIS_RESET _u(0x0)
|
||||
#define SPI_SSPMIS_RTMIS_BITS _u(0x00000002)
|
||||
#define SPI_SSPMIS_RTMIS_MSB _u(1)
|
||||
#define SPI_SSPMIS_RTMIS_LSB _u(1)
|
||||
#define SPI_SSPMIS_RTMIS_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPMIS_RORMIS
|
||||
// Description : Gives the receive over run masked interrupt status, after
|
||||
// masking, of the SSPRORINTR interrupt
|
||||
#define SPI_SSPMIS_RORMIS_RESET _u(0x0)
|
||||
#define SPI_SSPMIS_RORMIS_BITS _u(0x00000001)
|
||||
#define SPI_SSPMIS_RORMIS_MSB _u(0)
|
||||
#define SPI_SSPMIS_RORMIS_LSB _u(0)
|
||||
#define SPI_SSPMIS_RORMIS_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SPI_SSPICR
|
||||
// Description : Interrupt clear register, SSPICR on page 3-11
|
||||
#define SPI_SSPICR_OFFSET _u(0x00000020)
|
||||
#define SPI_SSPICR_BITS _u(0x00000003)
|
||||
#define SPI_SSPICR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPICR_RTIC
|
||||
// Description : Clears the SSPRTINTR interrupt
|
||||
#define SPI_SSPICR_RTIC_RESET _u(0x0)
|
||||
#define SPI_SSPICR_RTIC_BITS _u(0x00000002)
|
||||
#define SPI_SSPICR_RTIC_MSB _u(1)
|
||||
#define SPI_SSPICR_RTIC_LSB _u(1)
|
||||
#define SPI_SSPICR_RTIC_ACCESS "WC"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPICR_RORIC
|
||||
// Description : Clears the SSPRORINTR interrupt
|
||||
#define SPI_SSPICR_RORIC_RESET _u(0x0)
|
||||
#define SPI_SSPICR_RORIC_BITS _u(0x00000001)
|
||||
#define SPI_SSPICR_RORIC_MSB _u(0)
|
||||
#define SPI_SSPICR_RORIC_LSB _u(0)
|
||||
#define SPI_SSPICR_RORIC_ACCESS "WC"
|
||||
// =============================================================================
|
||||
// Register : SPI_SSPDMACR
|
||||
// Description : DMA control register, SSPDMACR on page 3-12
|
||||
#define SPI_SSPDMACR_OFFSET _u(0x00000024)
|
||||
#define SPI_SSPDMACR_BITS _u(0x00000003)
|
||||
#define SPI_SSPDMACR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPDMACR_TXDMAE
|
||||
// Description : Transmit DMA Enable. If this bit is set to 1, DMA for the
|
||||
// transmit FIFO is enabled.
|
||||
#define SPI_SSPDMACR_TXDMAE_RESET _u(0x0)
|
||||
#define SPI_SSPDMACR_TXDMAE_BITS _u(0x00000002)
|
||||
#define SPI_SSPDMACR_TXDMAE_MSB _u(1)
|
||||
#define SPI_SSPDMACR_TXDMAE_LSB _u(1)
|
||||
#define SPI_SSPDMACR_TXDMAE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPDMACR_RXDMAE
|
||||
// Description : Receive DMA Enable. If this bit is set to 1, DMA for the
|
||||
// receive FIFO is enabled.
|
||||
#define SPI_SSPDMACR_RXDMAE_RESET _u(0x0)
|
||||
#define SPI_SSPDMACR_RXDMAE_BITS _u(0x00000001)
|
||||
#define SPI_SSPDMACR_RXDMAE_MSB _u(0)
|
||||
#define SPI_SSPDMACR_RXDMAE_LSB _u(0)
|
||||
#define SPI_SSPDMACR_RXDMAE_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SPI_SSPPERIPHID0
|
||||
// Description : Peripheral identification registers, SSPPeriphID0-3 on page
|
||||
// 3-13
|
||||
#define SPI_SSPPERIPHID0_OFFSET _u(0x00000fe0)
|
||||
#define SPI_SSPPERIPHID0_BITS _u(0x000000ff)
|
||||
#define SPI_SSPPERIPHID0_RESET _u(0x00000022)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPPERIPHID0_PARTNUMBER0
|
||||
// Description : These bits read back as 0x22
|
||||
#define SPI_SSPPERIPHID0_PARTNUMBER0_RESET _u(0x22)
|
||||
#define SPI_SSPPERIPHID0_PARTNUMBER0_BITS _u(0x000000ff)
|
||||
#define SPI_SSPPERIPHID0_PARTNUMBER0_MSB _u(7)
|
||||
#define SPI_SSPPERIPHID0_PARTNUMBER0_LSB _u(0)
|
||||
#define SPI_SSPPERIPHID0_PARTNUMBER0_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SPI_SSPPERIPHID1
|
||||
// Description : Peripheral identification registers, SSPPeriphID0-3 on page
|
||||
// 3-13
|
||||
#define SPI_SSPPERIPHID1_OFFSET _u(0x00000fe4)
|
||||
#define SPI_SSPPERIPHID1_BITS _u(0x000000ff)
|
||||
#define SPI_SSPPERIPHID1_RESET _u(0x00000010)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPPERIPHID1_DESIGNER0
|
||||
// Description : These bits read back as 0x1
|
||||
#define SPI_SSPPERIPHID1_DESIGNER0_RESET _u(0x1)
|
||||
#define SPI_SSPPERIPHID1_DESIGNER0_BITS _u(0x000000f0)
|
||||
#define SPI_SSPPERIPHID1_DESIGNER0_MSB _u(7)
|
||||
#define SPI_SSPPERIPHID1_DESIGNER0_LSB _u(4)
|
||||
#define SPI_SSPPERIPHID1_DESIGNER0_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPPERIPHID1_PARTNUMBER1
|
||||
// Description : These bits read back as 0x0
|
||||
#define SPI_SSPPERIPHID1_PARTNUMBER1_RESET _u(0x0)
|
||||
#define SPI_SSPPERIPHID1_PARTNUMBER1_BITS _u(0x0000000f)
|
||||
#define SPI_SSPPERIPHID1_PARTNUMBER1_MSB _u(3)
|
||||
#define SPI_SSPPERIPHID1_PARTNUMBER1_LSB _u(0)
|
||||
#define SPI_SSPPERIPHID1_PARTNUMBER1_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SPI_SSPPERIPHID2
|
||||
// Description : Peripheral identification registers, SSPPeriphID0-3 on page
|
||||
// 3-13
|
||||
#define SPI_SSPPERIPHID2_OFFSET _u(0x00000fe8)
|
||||
#define SPI_SSPPERIPHID2_BITS _u(0x000000ff)
|
||||
#define SPI_SSPPERIPHID2_RESET _u(0x00000034)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPPERIPHID2_REVISION
|
||||
// Description : These bits return the peripheral revision
|
||||
#define SPI_SSPPERIPHID2_REVISION_RESET _u(0x3)
|
||||
#define SPI_SSPPERIPHID2_REVISION_BITS _u(0x000000f0)
|
||||
#define SPI_SSPPERIPHID2_REVISION_MSB _u(7)
|
||||
#define SPI_SSPPERIPHID2_REVISION_LSB _u(4)
|
||||
#define SPI_SSPPERIPHID2_REVISION_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPPERIPHID2_DESIGNER1
|
||||
// Description : These bits read back as 0x4
|
||||
#define SPI_SSPPERIPHID2_DESIGNER1_RESET _u(0x4)
|
||||
#define SPI_SSPPERIPHID2_DESIGNER1_BITS _u(0x0000000f)
|
||||
#define SPI_SSPPERIPHID2_DESIGNER1_MSB _u(3)
|
||||
#define SPI_SSPPERIPHID2_DESIGNER1_LSB _u(0)
|
||||
#define SPI_SSPPERIPHID2_DESIGNER1_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SPI_SSPPERIPHID3
|
||||
// Description : Peripheral identification registers, SSPPeriphID0-3 on page
|
||||
// 3-13
|
||||
#define SPI_SSPPERIPHID3_OFFSET _u(0x00000fec)
|
||||
#define SPI_SSPPERIPHID3_BITS _u(0x000000ff)
|
||||
#define SPI_SSPPERIPHID3_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPPERIPHID3_CONFIGURATION
|
||||
// Description : These bits read back as 0x00
|
||||
#define SPI_SSPPERIPHID3_CONFIGURATION_RESET _u(0x00)
|
||||
#define SPI_SSPPERIPHID3_CONFIGURATION_BITS _u(0x000000ff)
|
||||
#define SPI_SSPPERIPHID3_CONFIGURATION_MSB _u(7)
|
||||
#define SPI_SSPPERIPHID3_CONFIGURATION_LSB _u(0)
|
||||
#define SPI_SSPPERIPHID3_CONFIGURATION_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SPI_SSPPCELLID0
|
||||
// Description : PrimeCell identification registers, SSPPCellID0-3 on page 3-16
|
||||
#define SPI_SSPPCELLID0_OFFSET _u(0x00000ff0)
|
||||
#define SPI_SSPPCELLID0_BITS _u(0x000000ff)
|
||||
#define SPI_SSPPCELLID0_RESET _u(0x0000000d)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPPCELLID0_SSPPCELLID0
|
||||
// Description : These bits read back as 0x0D
|
||||
#define SPI_SSPPCELLID0_SSPPCELLID0_RESET _u(0x0d)
|
||||
#define SPI_SSPPCELLID0_SSPPCELLID0_BITS _u(0x000000ff)
|
||||
#define SPI_SSPPCELLID0_SSPPCELLID0_MSB _u(7)
|
||||
#define SPI_SSPPCELLID0_SSPPCELLID0_LSB _u(0)
|
||||
#define SPI_SSPPCELLID0_SSPPCELLID0_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SPI_SSPPCELLID1
|
||||
// Description : PrimeCell identification registers, SSPPCellID0-3 on page 3-16
|
||||
#define SPI_SSPPCELLID1_OFFSET _u(0x00000ff4)
|
||||
#define SPI_SSPPCELLID1_BITS _u(0x000000ff)
|
||||
#define SPI_SSPPCELLID1_RESET _u(0x000000f0)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPPCELLID1_SSPPCELLID1
|
||||
// Description : These bits read back as 0xF0
|
||||
#define SPI_SSPPCELLID1_SSPPCELLID1_RESET _u(0xf0)
|
||||
#define SPI_SSPPCELLID1_SSPPCELLID1_BITS _u(0x000000ff)
|
||||
#define SPI_SSPPCELLID1_SSPPCELLID1_MSB _u(7)
|
||||
#define SPI_SSPPCELLID1_SSPPCELLID1_LSB _u(0)
|
||||
#define SPI_SSPPCELLID1_SSPPCELLID1_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SPI_SSPPCELLID2
|
||||
// Description : PrimeCell identification registers, SSPPCellID0-3 on page 3-16
|
||||
#define SPI_SSPPCELLID2_OFFSET _u(0x00000ff8)
|
||||
#define SPI_SSPPCELLID2_BITS _u(0x000000ff)
|
||||
#define SPI_SSPPCELLID2_RESET _u(0x00000005)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPPCELLID2_SSPPCELLID2
|
||||
// Description : These bits read back as 0x05
|
||||
#define SPI_SSPPCELLID2_SSPPCELLID2_RESET _u(0x05)
|
||||
#define SPI_SSPPCELLID2_SSPPCELLID2_BITS _u(0x000000ff)
|
||||
#define SPI_SSPPCELLID2_SSPPCELLID2_MSB _u(7)
|
||||
#define SPI_SSPPCELLID2_SSPPCELLID2_LSB _u(0)
|
||||
#define SPI_SSPPCELLID2_SSPPCELLID2_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SPI_SSPPCELLID3
|
||||
// Description : PrimeCell identification registers, SSPPCellID0-3 on page 3-16
|
||||
#define SPI_SSPPCELLID3_OFFSET _u(0x00000ffc)
|
||||
#define SPI_SSPPCELLID3_BITS _u(0x000000ff)
|
||||
#define SPI_SSPPCELLID3_RESET _u(0x000000b1)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SPI_SSPPCELLID3_SSPPCELLID3
|
||||
// Description : These bits read back as 0xB1
|
||||
#define SPI_SSPPCELLID3_SSPPCELLID3_RESET _u(0xb1)
|
||||
#define SPI_SSPPCELLID3_SSPPCELLID3_BITS _u(0x000000ff)
|
||||
#define SPI_SSPPCELLID3_SSPPCELLID3_MSB _u(7)
|
||||
#define SPI_SSPPCELLID3_SSPPCELLID3_LSB _u(0)
|
||||
#define SPI_SSPPCELLID3_SSPPCELLID3_ACCESS "RO"
|
||||
// =============================================================================
|
||||
#endif // HARDWARE_REGS_SPI_DEFINED
|
809
lib/rp2040/hardware/regs/ssi.h
Normal file
809
lib/rp2040/hardware/regs/ssi.h
Normal file
@ -0,0 +1,809 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// =============================================================================
|
||||
// Register block : SSI
|
||||
// Version : 1
|
||||
// Bus type : apb
|
||||
// Description : DW_apb_ssi has the following features:
|
||||
// * APB interface – Allows for easy integration into a
|
||||
// DesignWare Synthesizable Components for AMBA 2
|
||||
// implementation.
|
||||
// * APB3 and APB4 protocol support.
|
||||
// * Scalable APB data bus width – Supports APB data bus widths
|
||||
// of 8, 16, and 32 bits.
|
||||
// * Serial-master or serial-slave operation – Enables serial
|
||||
// communication with serial-master or serial-slave peripheral
|
||||
// devices.
|
||||
// * Programmable Dual/Quad/Octal SPI support in Master Mode.
|
||||
// * Dual Data Rate (DDR) and Read Data Strobe (RDS) Support -
|
||||
// Enables the DW_apb_ssi master to perform operations with the
|
||||
// device in DDR and RDS modes when working in Dual/Quad/Octal
|
||||
// mode of operation.
|
||||
// * Data Mask Support - Enables the DW_apb_ssi to selectively
|
||||
// update the bytes in the device. This feature is applicable
|
||||
// only in enhanced SPI modes.
|
||||
// * eXecute-In-Place (XIP) support - Enables the DW_apb_ssi
|
||||
// master to behave as a memory mapped I/O and fetches the data
|
||||
// from the device based on the APB read request. This feature
|
||||
// is applicable only in enhanced SPI modes.
|
||||
// * DMA Controller Interface – Enables the DW_apb_ssi to
|
||||
// interface to a DMA controller over the bus using a
|
||||
// handshaking interface for transfer requests.
|
||||
// * Independent masking of interrupts – Master collision,
|
||||
// transmit FIFO overflow, transmit FIFO empty, receive FIFO
|
||||
// full, receive FIFO underflow, and receive FIFO overflow
|
||||
// interrupts can all be masked independently.
|
||||
// * Multi-master contention detection – Informs the processor
|
||||
// of multiple serial-master accesses on the serial bus.
|
||||
// * Bypass of meta-stability flip-flops for synchronous clocks
|
||||
// – When the APB clock (pclk) and the DW_apb_ssi serial clock
|
||||
// (ssi_clk) are synchronous, meta-stable flip-flops are not
|
||||
// used when transferring control signals across these clock
|
||||
// domains.
|
||||
// * Programmable delay on the sample time of the received
|
||||
// serial data bit (rxd); enables programmable control of
|
||||
// routing delays resulting in higher serial data-bit rates.
|
||||
// * Programmable features:
|
||||
// - Serial interface operation – Choice of Motorola SPI, Texas
|
||||
// Instruments Synchronous Serial Protocol or National
|
||||
// Semiconductor Microwire.
|
||||
// - Clock bit-rate – Dynamic control of the serial bit rate of
|
||||
// the data transfer; used in only serial-master mode of
|
||||
// operation.
|
||||
// - Data Item size (4 to 32 bits) – Item size of each data
|
||||
// transfer under the control of the programmer.
|
||||
// * Configured features:
|
||||
// - FIFO depth – 16 words deep. The FIFO width is fixed at 32
|
||||
// bits.
|
||||
// - 1 slave select output.
|
||||
// - Hardware slave-select – Dedicated hardware slave-select
|
||||
// line.
|
||||
// - Combined interrupt line - one combined interrupt line from
|
||||
// the DW_apb_ssi to the interrupt controller.
|
||||
// - Interrupt polarity – active high interrupt lines.
|
||||
// - Serial clock polarity – low serial-clock polarity directly
|
||||
// after reset.
|
||||
// - Serial clock phase – capture on first edge of serial-clock
|
||||
// directly after reset.
|
||||
// =============================================================================
|
||||
#ifndef HARDWARE_REGS_SSI_DEFINED
|
||||
#define HARDWARE_REGS_SSI_DEFINED
|
||||
// =============================================================================
|
||||
// Register : SSI_CTRLR0
|
||||
// Description : Control register 0
|
||||
#define SSI_CTRLR0_OFFSET _u(0x00000000)
|
||||
#define SSI_CTRLR0_BITS _u(0x017fffff)
|
||||
#define SSI_CTRLR0_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_CTRLR0_SSTE
|
||||
// Description : Slave select toggle enable
|
||||
#define SSI_CTRLR0_SSTE_RESET _u(0x0)
|
||||
#define SSI_CTRLR0_SSTE_BITS _u(0x01000000)
|
||||
#define SSI_CTRLR0_SSTE_MSB _u(24)
|
||||
#define SSI_CTRLR0_SSTE_LSB _u(24)
|
||||
#define SSI_CTRLR0_SSTE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_CTRLR0_SPI_FRF
|
||||
// Description : SPI frame format
|
||||
// 0x0 -> Standard 1-bit SPI frame format; 1 bit per SCK,
|
||||
// full-duplex
|
||||
// 0x1 -> Dual-SPI frame format; two bits per SCK, half-duplex
|
||||
// 0x2 -> Quad-SPI frame format; four bits per SCK, half-duplex
|
||||
#define SSI_CTRLR0_SPI_FRF_RESET _u(0x0)
|
||||
#define SSI_CTRLR0_SPI_FRF_BITS _u(0x00600000)
|
||||
#define SSI_CTRLR0_SPI_FRF_MSB _u(22)
|
||||
#define SSI_CTRLR0_SPI_FRF_LSB _u(21)
|
||||
#define SSI_CTRLR0_SPI_FRF_ACCESS "RW"
|
||||
#define SSI_CTRLR0_SPI_FRF_VALUE_STD _u(0x0)
|
||||
#define SSI_CTRLR0_SPI_FRF_VALUE_DUAL _u(0x1)
|
||||
#define SSI_CTRLR0_SPI_FRF_VALUE_QUAD _u(0x2)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_CTRLR0_DFS_32
|
||||
// Description : Data frame size in 32b transfer mode
|
||||
// Value of n -> n+1 clocks per frame.
|
||||
#define SSI_CTRLR0_DFS_32_RESET _u(0x00)
|
||||
#define SSI_CTRLR0_DFS_32_BITS _u(0x001f0000)
|
||||
#define SSI_CTRLR0_DFS_32_MSB _u(20)
|
||||
#define SSI_CTRLR0_DFS_32_LSB _u(16)
|
||||
#define SSI_CTRLR0_DFS_32_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_CTRLR0_CFS
|
||||
// Description : Control frame size
|
||||
// Value of n -> n+1 clocks per frame.
|
||||
#define SSI_CTRLR0_CFS_RESET _u(0x0)
|
||||
#define SSI_CTRLR0_CFS_BITS _u(0x0000f000)
|
||||
#define SSI_CTRLR0_CFS_MSB _u(15)
|
||||
#define SSI_CTRLR0_CFS_LSB _u(12)
|
||||
#define SSI_CTRLR0_CFS_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_CTRLR0_SRL
|
||||
// Description : Shift register loop (test mode)
|
||||
#define SSI_CTRLR0_SRL_RESET _u(0x0)
|
||||
#define SSI_CTRLR0_SRL_BITS _u(0x00000800)
|
||||
#define SSI_CTRLR0_SRL_MSB _u(11)
|
||||
#define SSI_CTRLR0_SRL_LSB _u(11)
|
||||
#define SSI_CTRLR0_SRL_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_CTRLR0_SLV_OE
|
||||
// Description : Slave output enable
|
||||
#define SSI_CTRLR0_SLV_OE_RESET _u(0x0)
|
||||
#define SSI_CTRLR0_SLV_OE_BITS _u(0x00000400)
|
||||
#define SSI_CTRLR0_SLV_OE_MSB _u(10)
|
||||
#define SSI_CTRLR0_SLV_OE_LSB _u(10)
|
||||
#define SSI_CTRLR0_SLV_OE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_CTRLR0_TMOD
|
||||
// Description : Transfer mode
|
||||
// 0x0 -> Both transmit and receive
|
||||
// 0x1 -> Transmit only (not for FRF == 0, standard SPI mode)
|
||||
// 0x2 -> Receive only (not for FRF == 0, standard SPI mode)
|
||||
// 0x3 -> EEPROM read mode (TX then RX; RX starts after control
|
||||
// data TX'd)
|
||||
#define SSI_CTRLR0_TMOD_RESET _u(0x0)
|
||||
#define SSI_CTRLR0_TMOD_BITS _u(0x00000300)
|
||||
#define SSI_CTRLR0_TMOD_MSB _u(9)
|
||||
#define SSI_CTRLR0_TMOD_LSB _u(8)
|
||||
#define SSI_CTRLR0_TMOD_ACCESS "RW"
|
||||
#define SSI_CTRLR0_TMOD_VALUE_TX_AND_RX _u(0x0)
|
||||
#define SSI_CTRLR0_TMOD_VALUE_TX_ONLY _u(0x1)
|
||||
#define SSI_CTRLR0_TMOD_VALUE_RX_ONLY _u(0x2)
|
||||
#define SSI_CTRLR0_TMOD_VALUE_EEPROM_READ _u(0x3)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_CTRLR0_SCPOL
|
||||
// Description : Serial clock polarity
|
||||
#define SSI_CTRLR0_SCPOL_RESET _u(0x0)
|
||||
#define SSI_CTRLR0_SCPOL_BITS _u(0x00000080)
|
||||
#define SSI_CTRLR0_SCPOL_MSB _u(7)
|
||||
#define SSI_CTRLR0_SCPOL_LSB _u(7)
|
||||
#define SSI_CTRLR0_SCPOL_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_CTRLR0_SCPH
|
||||
// Description : Serial clock phase
|
||||
#define SSI_CTRLR0_SCPH_RESET _u(0x0)
|
||||
#define SSI_CTRLR0_SCPH_BITS _u(0x00000040)
|
||||
#define SSI_CTRLR0_SCPH_MSB _u(6)
|
||||
#define SSI_CTRLR0_SCPH_LSB _u(6)
|
||||
#define SSI_CTRLR0_SCPH_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_CTRLR0_FRF
|
||||
// Description : Frame format
|
||||
#define SSI_CTRLR0_FRF_RESET _u(0x0)
|
||||
#define SSI_CTRLR0_FRF_BITS _u(0x00000030)
|
||||
#define SSI_CTRLR0_FRF_MSB _u(5)
|
||||
#define SSI_CTRLR0_FRF_LSB _u(4)
|
||||
#define SSI_CTRLR0_FRF_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_CTRLR0_DFS
|
||||
// Description : Data frame size
|
||||
#define SSI_CTRLR0_DFS_RESET _u(0x0)
|
||||
#define SSI_CTRLR0_DFS_BITS _u(0x0000000f)
|
||||
#define SSI_CTRLR0_DFS_MSB _u(3)
|
||||
#define SSI_CTRLR0_DFS_LSB _u(0)
|
||||
#define SSI_CTRLR0_DFS_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SSI_CTRLR1
|
||||
// Description : Master Control register 1
|
||||
#define SSI_CTRLR1_OFFSET _u(0x00000004)
|
||||
#define SSI_CTRLR1_BITS _u(0x0000ffff)
|
||||
#define SSI_CTRLR1_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_CTRLR1_NDF
|
||||
// Description : Number of data frames
|
||||
#define SSI_CTRLR1_NDF_RESET _u(0x0000)
|
||||
#define SSI_CTRLR1_NDF_BITS _u(0x0000ffff)
|
||||
#define SSI_CTRLR1_NDF_MSB _u(15)
|
||||
#define SSI_CTRLR1_NDF_LSB _u(0)
|
||||
#define SSI_CTRLR1_NDF_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SSI_SSIENR
|
||||
// Description : SSI Enable
|
||||
#define SSI_SSIENR_OFFSET _u(0x00000008)
|
||||
#define SSI_SSIENR_BITS _u(0x00000001)
|
||||
#define SSI_SSIENR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_SSIENR_SSI_EN
|
||||
// Description : SSI enable
|
||||
#define SSI_SSIENR_SSI_EN_RESET _u(0x0)
|
||||
#define SSI_SSIENR_SSI_EN_BITS _u(0x00000001)
|
||||
#define SSI_SSIENR_SSI_EN_MSB _u(0)
|
||||
#define SSI_SSIENR_SSI_EN_LSB _u(0)
|
||||
#define SSI_SSIENR_SSI_EN_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SSI_MWCR
|
||||
// Description : Microwire Control
|
||||
#define SSI_MWCR_OFFSET _u(0x0000000c)
|
||||
#define SSI_MWCR_BITS _u(0x00000007)
|
||||
#define SSI_MWCR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_MWCR_MHS
|
||||
// Description : Microwire handshaking
|
||||
#define SSI_MWCR_MHS_RESET _u(0x0)
|
||||
#define SSI_MWCR_MHS_BITS _u(0x00000004)
|
||||
#define SSI_MWCR_MHS_MSB _u(2)
|
||||
#define SSI_MWCR_MHS_LSB _u(2)
|
||||
#define SSI_MWCR_MHS_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_MWCR_MDD
|
||||
// Description : Microwire control
|
||||
#define SSI_MWCR_MDD_RESET _u(0x0)
|
||||
#define SSI_MWCR_MDD_BITS _u(0x00000002)
|
||||
#define SSI_MWCR_MDD_MSB _u(1)
|
||||
#define SSI_MWCR_MDD_LSB _u(1)
|
||||
#define SSI_MWCR_MDD_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_MWCR_MWMOD
|
||||
// Description : Microwire transfer mode
|
||||
#define SSI_MWCR_MWMOD_RESET _u(0x0)
|
||||
#define SSI_MWCR_MWMOD_BITS _u(0x00000001)
|
||||
#define SSI_MWCR_MWMOD_MSB _u(0)
|
||||
#define SSI_MWCR_MWMOD_LSB _u(0)
|
||||
#define SSI_MWCR_MWMOD_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SSI_SER
|
||||
// Description : Slave enable
|
||||
// For each bit:
|
||||
// 0 -> slave not selected
|
||||
// 1 -> slave selected
|
||||
#define SSI_SER_OFFSET _u(0x00000010)
|
||||
#define SSI_SER_BITS _u(0x00000001)
|
||||
#define SSI_SER_RESET _u(0x00000000)
|
||||
#define SSI_SER_MSB _u(0)
|
||||
#define SSI_SER_LSB _u(0)
|
||||
#define SSI_SER_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SSI_BAUDR
|
||||
// Description : Baud rate
|
||||
#define SSI_BAUDR_OFFSET _u(0x00000014)
|
||||
#define SSI_BAUDR_BITS _u(0x0000ffff)
|
||||
#define SSI_BAUDR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_BAUDR_SCKDV
|
||||
// Description : SSI clock divider
|
||||
#define SSI_BAUDR_SCKDV_RESET _u(0x0000)
|
||||
#define SSI_BAUDR_SCKDV_BITS _u(0x0000ffff)
|
||||
#define SSI_BAUDR_SCKDV_MSB _u(15)
|
||||
#define SSI_BAUDR_SCKDV_LSB _u(0)
|
||||
#define SSI_BAUDR_SCKDV_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SSI_TXFTLR
|
||||
// Description : TX FIFO threshold level
|
||||
#define SSI_TXFTLR_OFFSET _u(0x00000018)
|
||||
#define SSI_TXFTLR_BITS _u(0x000000ff)
|
||||
#define SSI_TXFTLR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_TXFTLR_TFT
|
||||
// Description : Transmit FIFO threshold
|
||||
#define SSI_TXFTLR_TFT_RESET _u(0x00)
|
||||
#define SSI_TXFTLR_TFT_BITS _u(0x000000ff)
|
||||
#define SSI_TXFTLR_TFT_MSB _u(7)
|
||||
#define SSI_TXFTLR_TFT_LSB _u(0)
|
||||
#define SSI_TXFTLR_TFT_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SSI_RXFTLR
|
||||
// Description : RX FIFO threshold level
|
||||
#define SSI_RXFTLR_OFFSET _u(0x0000001c)
|
||||
#define SSI_RXFTLR_BITS _u(0x000000ff)
|
||||
#define SSI_RXFTLR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_RXFTLR_RFT
|
||||
// Description : Receive FIFO threshold
|
||||
#define SSI_RXFTLR_RFT_RESET _u(0x00)
|
||||
#define SSI_RXFTLR_RFT_BITS _u(0x000000ff)
|
||||
#define SSI_RXFTLR_RFT_MSB _u(7)
|
||||
#define SSI_RXFTLR_RFT_LSB _u(0)
|
||||
#define SSI_RXFTLR_RFT_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SSI_TXFLR
|
||||
// Description : TX FIFO level
|
||||
#define SSI_TXFLR_OFFSET _u(0x00000020)
|
||||
#define SSI_TXFLR_BITS _u(0x000000ff)
|
||||
#define SSI_TXFLR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_TXFLR_TFTFL
|
||||
// Description : Transmit FIFO level
|
||||
#define SSI_TXFLR_TFTFL_RESET _u(0x00)
|
||||
#define SSI_TXFLR_TFTFL_BITS _u(0x000000ff)
|
||||
#define SSI_TXFLR_TFTFL_MSB _u(7)
|
||||
#define SSI_TXFLR_TFTFL_LSB _u(0)
|
||||
#define SSI_TXFLR_TFTFL_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SSI_RXFLR
|
||||
// Description : RX FIFO level
|
||||
#define SSI_RXFLR_OFFSET _u(0x00000024)
|
||||
#define SSI_RXFLR_BITS _u(0x000000ff)
|
||||
#define SSI_RXFLR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_RXFLR_RXTFL
|
||||
// Description : Receive FIFO level
|
||||
#define SSI_RXFLR_RXTFL_RESET _u(0x00)
|
||||
#define SSI_RXFLR_RXTFL_BITS _u(0x000000ff)
|
||||
#define SSI_RXFLR_RXTFL_MSB _u(7)
|
||||
#define SSI_RXFLR_RXTFL_LSB _u(0)
|
||||
#define SSI_RXFLR_RXTFL_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SSI_SR
|
||||
// Description : Status register
|
||||
#define SSI_SR_OFFSET _u(0x00000028)
|
||||
#define SSI_SR_BITS _u(0x0000007f)
|
||||
#define SSI_SR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_SR_DCOL
|
||||
// Description : Data collision error
|
||||
#define SSI_SR_DCOL_RESET _u(0x0)
|
||||
#define SSI_SR_DCOL_BITS _u(0x00000040)
|
||||
#define SSI_SR_DCOL_MSB _u(6)
|
||||
#define SSI_SR_DCOL_LSB _u(6)
|
||||
#define SSI_SR_DCOL_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_SR_TXE
|
||||
// Description : Transmission error
|
||||
#define SSI_SR_TXE_RESET _u(0x0)
|
||||
#define SSI_SR_TXE_BITS _u(0x00000020)
|
||||
#define SSI_SR_TXE_MSB _u(5)
|
||||
#define SSI_SR_TXE_LSB _u(5)
|
||||
#define SSI_SR_TXE_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_SR_RFF
|
||||
// Description : Receive FIFO full
|
||||
#define SSI_SR_RFF_RESET _u(0x0)
|
||||
#define SSI_SR_RFF_BITS _u(0x00000010)
|
||||
#define SSI_SR_RFF_MSB _u(4)
|
||||
#define SSI_SR_RFF_LSB _u(4)
|
||||
#define SSI_SR_RFF_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_SR_RFNE
|
||||
// Description : Receive FIFO not empty
|
||||
#define SSI_SR_RFNE_RESET _u(0x0)
|
||||
#define SSI_SR_RFNE_BITS _u(0x00000008)
|
||||
#define SSI_SR_RFNE_MSB _u(3)
|
||||
#define SSI_SR_RFNE_LSB _u(3)
|
||||
#define SSI_SR_RFNE_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_SR_TFE
|
||||
// Description : Transmit FIFO empty
|
||||
#define SSI_SR_TFE_RESET _u(0x0)
|
||||
#define SSI_SR_TFE_BITS _u(0x00000004)
|
||||
#define SSI_SR_TFE_MSB _u(2)
|
||||
#define SSI_SR_TFE_LSB _u(2)
|
||||
#define SSI_SR_TFE_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_SR_TFNF
|
||||
// Description : Transmit FIFO not full
|
||||
#define SSI_SR_TFNF_RESET _u(0x0)
|
||||
#define SSI_SR_TFNF_BITS _u(0x00000002)
|
||||
#define SSI_SR_TFNF_MSB _u(1)
|
||||
#define SSI_SR_TFNF_LSB _u(1)
|
||||
#define SSI_SR_TFNF_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_SR_BUSY
|
||||
// Description : SSI busy flag
|
||||
#define SSI_SR_BUSY_RESET _u(0x0)
|
||||
#define SSI_SR_BUSY_BITS _u(0x00000001)
|
||||
#define SSI_SR_BUSY_MSB _u(0)
|
||||
#define SSI_SR_BUSY_LSB _u(0)
|
||||
#define SSI_SR_BUSY_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SSI_IMR
|
||||
// Description : Interrupt mask
|
||||
#define SSI_IMR_OFFSET _u(0x0000002c)
|
||||
#define SSI_IMR_BITS _u(0x0000003f)
|
||||
#define SSI_IMR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_IMR_MSTIM
|
||||
// Description : Multi-master contention interrupt mask
|
||||
#define SSI_IMR_MSTIM_RESET _u(0x0)
|
||||
#define SSI_IMR_MSTIM_BITS _u(0x00000020)
|
||||
#define SSI_IMR_MSTIM_MSB _u(5)
|
||||
#define SSI_IMR_MSTIM_LSB _u(5)
|
||||
#define SSI_IMR_MSTIM_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_IMR_RXFIM
|
||||
// Description : Receive FIFO full interrupt mask
|
||||
#define SSI_IMR_RXFIM_RESET _u(0x0)
|
||||
#define SSI_IMR_RXFIM_BITS _u(0x00000010)
|
||||
#define SSI_IMR_RXFIM_MSB _u(4)
|
||||
#define SSI_IMR_RXFIM_LSB _u(4)
|
||||
#define SSI_IMR_RXFIM_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_IMR_RXOIM
|
||||
// Description : Receive FIFO overflow interrupt mask
|
||||
#define SSI_IMR_RXOIM_RESET _u(0x0)
|
||||
#define SSI_IMR_RXOIM_BITS _u(0x00000008)
|
||||
#define SSI_IMR_RXOIM_MSB _u(3)
|
||||
#define SSI_IMR_RXOIM_LSB _u(3)
|
||||
#define SSI_IMR_RXOIM_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_IMR_RXUIM
|
||||
// Description : Receive FIFO underflow interrupt mask
|
||||
#define SSI_IMR_RXUIM_RESET _u(0x0)
|
||||
#define SSI_IMR_RXUIM_BITS _u(0x00000004)
|
||||
#define SSI_IMR_RXUIM_MSB _u(2)
|
||||
#define SSI_IMR_RXUIM_LSB _u(2)
|
||||
#define SSI_IMR_RXUIM_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_IMR_TXOIM
|
||||
// Description : Transmit FIFO overflow interrupt mask
|
||||
#define SSI_IMR_TXOIM_RESET _u(0x0)
|
||||
#define SSI_IMR_TXOIM_BITS _u(0x00000002)
|
||||
#define SSI_IMR_TXOIM_MSB _u(1)
|
||||
#define SSI_IMR_TXOIM_LSB _u(1)
|
||||
#define SSI_IMR_TXOIM_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_IMR_TXEIM
|
||||
// Description : Transmit FIFO empty interrupt mask
|
||||
#define SSI_IMR_TXEIM_RESET _u(0x0)
|
||||
#define SSI_IMR_TXEIM_BITS _u(0x00000001)
|
||||
#define SSI_IMR_TXEIM_MSB _u(0)
|
||||
#define SSI_IMR_TXEIM_LSB _u(0)
|
||||
#define SSI_IMR_TXEIM_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SSI_ISR
|
||||
// Description : Interrupt status
|
||||
#define SSI_ISR_OFFSET _u(0x00000030)
|
||||
#define SSI_ISR_BITS _u(0x0000003f)
|
||||
#define SSI_ISR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_ISR_MSTIS
|
||||
// Description : Multi-master contention interrupt status
|
||||
#define SSI_ISR_MSTIS_RESET _u(0x0)
|
||||
#define SSI_ISR_MSTIS_BITS _u(0x00000020)
|
||||
#define SSI_ISR_MSTIS_MSB _u(5)
|
||||
#define SSI_ISR_MSTIS_LSB _u(5)
|
||||
#define SSI_ISR_MSTIS_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_ISR_RXFIS
|
||||
// Description : Receive FIFO full interrupt status
|
||||
#define SSI_ISR_RXFIS_RESET _u(0x0)
|
||||
#define SSI_ISR_RXFIS_BITS _u(0x00000010)
|
||||
#define SSI_ISR_RXFIS_MSB _u(4)
|
||||
#define SSI_ISR_RXFIS_LSB _u(4)
|
||||
#define SSI_ISR_RXFIS_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_ISR_RXOIS
|
||||
// Description : Receive FIFO overflow interrupt status
|
||||
#define SSI_ISR_RXOIS_RESET _u(0x0)
|
||||
#define SSI_ISR_RXOIS_BITS _u(0x00000008)
|
||||
#define SSI_ISR_RXOIS_MSB _u(3)
|
||||
#define SSI_ISR_RXOIS_LSB _u(3)
|
||||
#define SSI_ISR_RXOIS_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_ISR_RXUIS
|
||||
// Description : Receive FIFO underflow interrupt status
|
||||
#define SSI_ISR_RXUIS_RESET _u(0x0)
|
||||
#define SSI_ISR_RXUIS_BITS _u(0x00000004)
|
||||
#define SSI_ISR_RXUIS_MSB _u(2)
|
||||
#define SSI_ISR_RXUIS_LSB _u(2)
|
||||
#define SSI_ISR_RXUIS_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_ISR_TXOIS
|
||||
// Description : Transmit FIFO overflow interrupt status
|
||||
#define SSI_ISR_TXOIS_RESET _u(0x0)
|
||||
#define SSI_ISR_TXOIS_BITS _u(0x00000002)
|
||||
#define SSI_ISR_TXOIS_MSB _u(1)
|
||||
#define SSI_ISR_TXOIS_LSB _u(1)
|
||||
#define SSI_ISR_TXOIS_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_ISR_TXEIS
|
||||
// Description : Transmit FIFO empty interrupt status
|
||||
#define SSI_ISR_TXEIS_RESET _u(0x0)
|
||||
#define SSI_ISR_TXEIS_BITS _u(0x00000001)
|
||||
#define SSI_ISR_TXEIS_MSB _u(0)
|
||||
#define SSI_ISR_TXEIS_LSB _u(0)
|
||||
#define SSI_ISR_TXEIS_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SSI_RISR
|
||||
// Description : Raw interrupt status
|
||||
#define SSI_RISR_OFFSET _u(0x00000034)
|
||||
#define SSI_RISR_BITS _u(0x0000003f)
|
||||
#define SSI_RISR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_RISR_MSTIR
|
||||
// Description : Multi-master contention raw interrupt status
|
||||
#define SSI_RISR_MSTIR_RESET _u(0x0)
|
||||
#define SSI_RISR_MSTIR_BITS _u(0x00000020)
|
||||
#define SSI_RISR_MSTIR_MSB _u(5)
|
||||
#define SSI_RISR_MSTIR_LSB _u(5)
|
||||
#define SSI_RISR_MSTIR_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_RISR_RXFIR
|
||||
// Description : Receive FIFO full raw interrupt status
|
||||
#define SSI_RISR_RXFIR_RESET _u(0x0)
|
||||
#define SSI_RISR_RXFIR_BITS _u(0x00000010)
|
||||
#define SSI_RISR_RXFIR_MSB _u(4)
|
||||
#define SSI_RISR_RXFIR_LSB _u(4)
|
||||
#define SSI_RISR_RXFIR_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_RISR_RXOIR
|
||||
// Description : Receive FIFO overflow raw interrupt status
|
||||
#define SSI_RISR_RXOIR_RESET _u(0x0)
|
||||
#define SSI_RISR_RXOIR_BITS _u(0x00000008)
|
||||
#define SSI_RISR_RXOIR_MSB _u(3)
|
||||
#define SSI_RISR_RXOIR_LSB _u(3)
|
||||
#define SSI_RISR_RXOIR_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_RISR_RXUIR
|
||||
// Description : Receive FIFO underflow raw interrupt status
|
||||
#define SSI_RISR_RXUIR_RESET _u(0x0)
|
||||
#define SSI_RISR_RXUIR_BITS _u(0x00000004)
|
||||
#define SSI_RISR_RXUIR_MSB _u(2)
|
||||
#define SSI_RISR_RXUIR_LSB _u(2)
|
||||
#define SSI_RISR_RXUIR_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_RISR_TXOIR
|
||||
// Description : Transmit FIFO overflow raw interrupt status
|
||||
#define SSI_RISR_TXOIR_RESET _u(0x0)
|
||||
#define SSI_RISR_TXOIR_BITS _u(0x00000002)
|
||||
#define SSI_RISR_TXOIR_MSB _u(1)
|
||||
#define SSI_RISR_TXOIR_LSB _u(1)
|
||||
#define SSI_RISR_TXOIR_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_RISR_TXEIR
|
||||
// Description : Transmit FIFO empty raw interrupt status
|
||||
#define SSI_RISR_TXEIR_RESET _u(0x0)
|
||||
#define SSI_RISR_TXEIR_BITS _u(0x00000001)
|
||||
#define SSI_RISR_TXEIR_MSB _u(0)
|
||||
#define SSI_RISR_TXEIR_LSB _u(0)
|
||||
#define SSI_RISR_TXEIR_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SSI_TXOICR
|
||||
// Description : TX FIFO overflow interrupt clear
|
||||
// Clear-on-read transmit FIFO overflow interrupt
|
||||
#define SSI_TXOICR_OFFSET _u(0x00000038)
|
||||
#define SSI_TXOICR_BITS _u(0x00000001)
|
||||
#define SSI_TXOICR_RESET _u(0x00000000)
|
||||
#define SSI_TXOICR_MSB _u(0)
|
||||
#define SSI_TXOICR_LSB _u(0)
|
||||
#define SSI_TXOICR_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SSI_RXOICR
|
||||
// Description : RX FIFO overflow interrupt clear
|
||||
// Clear-on-read receive FIFO overflow interrupt
|
||||
#define SSI_RXOICR_OFFSET _u(0x0000003c)
|
||||
#define SSI_RXOICR_BITS _u(0x00000001)
|
||||
#define SSI_RXOICR_RESET _u(0x00000000)
|
||||
#define SSI_RXOICR_MSB _u(0)
|
||||
#define SSI_RXOICR_LSB _u(0)
|
||||
#define SSI_RXOICR_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SSI_RXUICR
|
||||
// Description : RX FIFO underflow interrupt clear
|
||||
// Clear-on-read receive FIFO underflow interrupt
|
||||
#define SSI_RXUICR_OFFSET _u(0x00000040)
|
||||
#define SSI_RXUICR_BITS _u(0x00000001)
|
||||
#define SSI_RXUICR_RESET _u(0x00000000)
|
||||
#define SSI_RXUICR_MSB _u(0)
|
||||
#define SSI_RXUICR_LSB _u(0)
|
||||
#define SSI_RXUICR_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SSI_MSTICR
|
||||
// Description : Multi-master interrupt clear
|
||||
// Clear-on-read multi-master contention interrupt
|
||||
#define SSI_MSTICR_OFFSET _u(0x00000044)
|
||||
#define SSI_MSTICR_BITS _u(0x00000001)
|
||||
#define SSI_MSTICR_RESET _u(0x00000000)
|
||||
#define SSI_MSTICR_MSB _u(0)
|
||||
#define SSI_MSTICR_LSB _u(0)
|
||||
#define SSI_MSTICR_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SSI_ICR
|
||||
// Description : Interrupt clear
|
||||
// Clear-on-read all active interrupts
|
||||
#define SSI_ICR_OFFSET _u(0x00000048)
|
||||
#define SSI_ICR_BITS _u(0x00000001)
|
||||
#define SSI_ICR_RESET _u(0x00000000)
|
||||
#define SSI_ICR_MSB _u(0)
|
||||
#define SSI_ICR_LSB _u(0)
|
||||
#define SSI_ICR_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SSI_DMACR
|
||||
// Description : DMA control
|
||||
#define SSI_DMACR_OFFSET _u(0x0000004c)
|
||||
#define SSI_DMACR_BITS _u(0x00000003)
|
||||
#define SSI_DMACR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_DMACR_TDMAE
|
||||
// Description : Transmit DMA enable
|
||||
#define SSI_DMACR_TDMAE_RESET _u(0x0)
|
||||
#define SSI_DMACR_TDMAE_BITS _u(0x00000002)
|
||||
#define SSI_DMACR_TDMAE_MSB _u(1)
|
||||
#define SSI_DMACR_TDMAE_LSB _u(1)
|
||||
#define SSI_DMACR_TDMAE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_DMACR_RDMAE
|
||||
// Description : Receive DMA enable
|
||||
#define SSI_DMACR_RDMAE_RESET _u(0x0)
|
||||
#define SSI_DMACR_RDMAE_BITS _u(0x00000001)
|
||||
#define SSI_DMACR_RDMAE_MSB _u(0)
|
||||
#define SSI_DMACR_RDMAE_LSB _u(0)
|
||||
#define SSI_DMACR_RDMAE_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SSI_DMATDLR
|
||||
// Description : DMA TX data level
|
||||
#define SSI_DMATDLR_OFFSET _u(0x00000050)
|
||||
#define SSI_DMATDLR_BITS _u(0x000000ff)
|
||||
#define SSI_DMATDLR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_DMATDLR_DMATDL
|
||||
// Description : Transmit data watermark level
|
||||
#define SSI_DMATDLR_DMATDL_RESET _u(0x00)
|
||||
#define SSI_DMATDLR_DMATDL_BITS _u(0x000000ff)
|
||||
#define SSI_DMATDLR_DMATDL_MSB _u(7)
|
||||
#define SSI_DMATDLR_DMATDL_LSB _u(0)
|
||||
#define SSI_DMATDLR_DMATDL_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SSI_DMARDLR
|
||||
// Description : DMA RX data level
|
||||
#define SSI_DMARDLR_OFFSET _u(0x00000054)
|
||||
#define SSI_DMARDLR_BITS _u(0x000000ff)
|
||||
#define SSI_DMARDLR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_DMARDLR_DMARDL
|
||||
// Description : Receive data watermark level (DMARDLR+1)
|
||||
#define SSI_DMARDLR_DMARDL_RESET _u(0x00)
|
||||
#define SSI_DMARDLR_DMARDL_BITS _u(0x000000ff)
|
||||
#define SSI_DMARDLR_DMARDL_MSB _u(7)
|
||||
#define SSI_DMARDLR_DMARDL_LSB _u(0)
|
||||
#define SSI_DMARDLR_DMARDL_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SSI_IDR
|
||||
// Description : Identification register
|
||||
#define SSI_IDR_OFFSET _u(0x00000058)
|
||||
#define SSI_IDR_BITS _u(0xffffffff)
|
||||
#define SSI_IDR_RESET _u(0x51535049)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_IDR_IDCODE
|
||||
// Description : Peripheral dentification code
|
||||
#define SSI_IDR_IDCODE_RESET _u(0x51535049)
|
||||
#define SSI_IDR_IDCODE_BITS _u(0xffffffff)
|
||||
#define SSI_IDR_IDCODE_MSB _u(31)
|
||||
#define SSI_IDR_IDCODE_LSB _u(0)
|
||||
#define SSI_IDR_IDCODE_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SSI_SSI_VERSION_ID
|
||||
// Description : Version ID
|
||||
#define SSI_SSI_VERSION_ID_OFFSET _u(0x0000005c)
|
||||
#define SSI_SSI_VERSION_ID_BITS _u(0xffffffff)
|
||||
#define SSI_SSI_VERSION_ID_RESET _u(0x3430312a)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_SSI_VERSION_ID_SSI_COMP_VERSION
|
||||
// Description : SNPS component version (format X.YY)
|
||||
#define SSI_SSI_VERSION_ID_SSI_COMP_VERSION_RESET _u(0x3430312a)
|
||||
#define SSI_SSI_VERSION_ID_SSI_COMP_VERSION_BITS _u(0xffffffff)
|
||||
#define SSI_SSI_VERSION_ID_SSI_COMP_VERSION_MSB _u(31)
|
||||
#define SSI_SSI_VERSION_ID_SSI_COMP_VERSION_LSB _u(0)
|
||||
#define SSI_SSI_VERSION_ID_SSI_COMP_VERSION_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SSI_DR0
|
||||
// Description : Data Register 0 (of 36)
|
||||
#define SSI_DR0_OFFSET _u(0x00000060)
|
||||
#define SSI_DR0_BITS _u(0xffffffff)
|
||||
#define SSI_DR0_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_DR0_DR
|
||||
// Description : First data register of 36
|
||||
#define SSI_DR0_DR_RESET _u(0x00000000)
|
||||
#define SSI_DR0_DR_BITS _u(0xffffffff)
|
||||
#define SSI_DR0_DR_MSB _u(31)
|
||||
#define SSI_DR0_DR_LSB _u(0)
|
||||
#define SSI_DR0_DR_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SSI_RX_SAMPLE_DLY
|
||||
// Description : RX sample delay
|
||||
#define SSI_RX_SAMPLE_DLY_OFFSET _u(0x000000f0)
|
||||
#define SSI_RX_SAMPLE_DLY_BITS _u(0x000000ff)
|
||||
#define SSI_RX_SAMPLE_DLY_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_RX_SAMPLE_DLY_RSD
|
||||
// Description : RXD sample delay (in SCLK cycles)
|
||||
#define SSI_RX_SAMPLE_DLY_RSD_RESET _u(0x00)
|
||||
#define SSI_RX_SAMPLE_DLY_RSD_BITS _u(0x000000ff)
|
||||
#define SSI_RX_SAMPLE_DLY_RSD_MSB _u(7)
|
||||
#define SSI_RX_SAMPLE_DLY_RSD_LSB _u(0)
|
||||
#define SSI_RX_SAMPLE_DLY_RSD_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SSI_SPI_CTRLR0
|
||||
// Description : SPI control
|
||||
#define SSI_SPI_CTRLR0_OFFSET _u(0x000000f4)
|
||||
#define SSI_SPI_CTRLR0_BITS _u(0xff07fb3f)
|
||||
#define SSI_SPI_CTRLR0_RESET _u(0x03000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_SPI_CTRLR0_XIP_CMD
|
||||
// Description : SPI Command to send in XIP mode (INST_L = 8-bit) or to append
|
||||
// to Address (INST_L = 0-bit)
|
||||
#define SSI_SPI_CTRLR0_XIP_CMD_RESET _u(0x03)
|
||||
#define SSI_SPI_CTRLR0_XIP_CMD_BITS _u(0xff000000)
|
||||
#define SSI_SPI_CTRLR0_XIP_CMD_MSB _u(31)
|
||||
#define SSI_SPI_CTRLR0_XIP_CMD_LSB _u(24)
|
||||
#define SSI_SPI_CTRLR0_XIP_CMD_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_SPI_CTRLR0_SPI_RXDS_EN
|
||||
// Description : Read data strobe enable
|
||||
#define SSI_SPI_CTRLR0_SPI_RXDS_EN_RESET _u(0x0)
|
||||
#define SSI_SPI_CTRLR0_SPI_RXDS_EN_BITS _u(0x00040000)
|
||||
#define SSI_SPI_CTRLR0_SPI_RXDS_EN_MSB _u(18)
|
||||
#define SSI_SPI_CTRLR0_SPI_RXDS_EN_LSB _u(18)
|
||||
#define SSI_SPI_CTRLR0_SPI_RXDS_EN_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_SPI_CTRLR0_INST_DDR_EN
|
||||
// Description : Instruction DDR transfer enable
|
||||
#define SSI_SPI_CTRLR0_INST_DDR_EN_RESET _u(0x0)
|
||||
#define SSI_SPI_CTRLR0_INST_DDR_EN_BITS _u(0x00020000)
|
||||
#define SSI_SPI_CTRLR0_INST_DDR_EN_MSB _u(17)
|
||||
#define SSI_SPI_CTRLR0_INST_DDR_EN_LSB _u(17)
|
||||
#define SSI_SPI_CTRLR0_INST_DDR_EN_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_SPI_CTRLR0_SPI_DDR_EN
|
||||
// Description : SPI DDR transfer enable
|
||||
#define SSI_SPI_CTRLR0_SPI_DDR_EN_RESET _u(0x0)
|
||||
#define SSI_SPI_CTRLR0_SPI_DDR_EN_BITS _u(0x00010000)
|
||||
#define SSI_SPI_CTRLR0_SPI_DDR_EN_MSB _u(16)
|
||||
#define SSI_SPI_CTRLR0_SPI_DDR_EN_LSB _u(16)
|
||||
#define SSI_SPI_CTRLR0_SPI_DDR_EN_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_SPI_CTRLR0_WAIT_CYCLES
|
||||
// Description : Wait cycles between control frame transmit and data reception
|
||||
// (in SCLK cycles)
|
||||
#define SSI_SPI_CTRLR0_WAIT_CYCLES_RESET _u(0x00)
|
||||
#define SSI_SPI_CTRLR0_WAIT_CYCLES_BITS _u(0x0000f800)
|
||||
#define SSI_SPI_CTRLR0_WAIT_CYCLES_MSB _u(15)
|
||||
#define SSI_SPI_CTRLR0_WAIT_CYCLES_LSB _u(11)
|
||||
#define SSI_SPI_CTRLR0_WAIT_CYCLES_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_SPI_CTRLR0_INST_L
|
||||
// Description : Instruction length (0/4/8/16b)
|
||||
// 0x0 -> No instruction
|
||||
// 0x1 -> 4-bit instruction
|
||||
// 0x2 -> 8-bit instruction
|
||||
// 0x3 -> 16-bit instruction
|
||||
#define SSI_SPI_CTRLR0_INST_L_RESET _u(0x0)
|
||||
#define SSI_SPI_CTRLR0_INST_L_BITS _u(0x00000300)
|
||||
#define SSI_SPI_CTRLR0_INST_L_MSB _u(9)
|
||||
#define SSI_SPI_CTRLR0_INST_L_LSB _u(8)
|
||||
#define SSI_SPI_CTRLR0_INST_L_ACCESS "RW"
|
||||
#define SSI_SPI_CTRLR0_INST_L_VALUE_NONE _u(0x0)
|
||||
#define SSI_SPI_CTRLR0_INST_L_VALUE_4B _u(0x1)
|
||||
#define SSI_SPI_CTRLR0_INST_L_VALUE_8B _u(0x2)
|
||||
#define SSI_SPI_CTRLR0_INST_L_VALUE_16B _u(0x3)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_SPI_CTRLR0_ADDR_L
|
||||
// Description : Address length (0b-60b in 4b increments)
|
||||
#define SSI_SPI_CTRLR0_ADDR_L_RESET _u(0x0)
|
||||
#define SSI_SPI_CTRLR0_ADDR_L_BITS _u(0x0000003c)
|
||||
#define SSI_SPI_CTRLR0_ADDR_L_MSB _u(5)
|
||||
#define SSI_SPI_CTRLR0_ADDR_L_LSB _u(2)
|
||||
#define SSI_SPI_CTRLR0_ADDR_L_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_SPI_CTRLR0_TRANS_TYPE
|
||||
// Description : Address and instruction transfer format
|
||||
// 0x0 -> Command and address both in standard SPI frame format
|
||||
// 0x1 -> Command in standard SPI format, address in format
|
||||
// specified by FRF
|
||||
// 0x2 -> Command and address both in format specified by FRF
|
||||
// (e.g. Dual-SPI)
|
||||
#define SSI_SPI_CTRLR0_TRANS_TYPE_RESET _u(0x0)
|
||||
#define SSI_SPI_CTRLR0_TRANS_TYPE_BITS _u(0x00000003)
|
||||
#define SSI_SPI_CTRLR0_TRANS_TYPE_MSB _u(1)
|
||||
#define SSI_SPI_CTRLR0_TRANS_TYPE_LSB _u(0)
|
||||
#define SSI_SPI_CTRLR0_TRANS_TYPE_ACCESS "RW"
|
||||
#define SSI_SPI_CTRLR0_TRANS_TYPE_VALUE_1C1A _u(0x0)
|
||||
#define SSI_SPI_CTRLR0_TRANS_TYPE_VALUE_1C2A _u(0x1)
|
||||
#define SSI_SPI_CTRLR0_TRANS_TYPE_VALUE_2C2A _u(0x2)
|
||||
// =============================================================================
|
||||
// Register : SSI_TXD_DRIVE_EDGE
|
||||
// Description : TX drive edge
|
||||
#define SSI_TXD_DRIVE_EDGE_OFFSET _u(0x000000f8)
|
||||
#define SSI_TXD_DRIVE_EDGE_BITS _u(0x000000ff)
|
||||
#define SSI_TXD_DRIVE_EDGE_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SSI_TXD_DRIVE_EDGE_TDE
|
||||
// Description : TXD drive edge
|
||||
#define SSI_TXD_DRIVE_EDGE_TDE_RESET _u(0x00)
|
||||
#define SSI_TXD_DRIVE_EDGE_TDE_BITS _u(0x000000ff)
|
||||
#define SSI_TXD_DRIVE_EDGE_TDE_MSB _u(7)
|
||||
#define SSI_TXD_DRIVE_EDGE_TDE_LSB _u(0)
|
||||
#define SSI_TXD_DRIVE_EDGE_TDE_ACCESS "RW"
|
||||
// =============================================================================
|
||||
#endif // HARDWARE_REGS_SSI_DEFINED
|
257
lib/rp2040/hardware/regs/syscfg.h
Normal file
257
lib/rp2040/hardware/regs/syscfg.h
Normal file
@ -0,0 +1,257 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// =============================================================================
|
||||
// Register block : SYSCFG
|
||||
// Version : 1
|
||||
// Bus type : apb
|
||||
// Description : Register block for various chip control signals
|
||||
// =============================================================================
|
||||
#ifndef HARDWARE_REGS_SYSCFG_DEFINED
|
||||
#define HARDWARE_REGS_SYSCFG_DEFINED
|
||||
// =============================================================================
|
||||
// Register : SYSCFG_PROC0_NMI_MASK
|
||||
// Description : Processor core 0 NMI source mask
|
||||
// Set a bit high to enable NMI from that IRQ
|
||||
#define SYSCFG_PROC0_NMI_MASK_OFFSET _u(0x00000000)
|
||||
#define SYSCFG_PROC0_NMI_MASK_BITS _u(0xffffffff)
|
||||
#define SYSCFG_PROC0_NMI_MASK_RESET _u(0x00000000)
|
||||
#define SYSCFG_PROC0_NMI_MASK_MSB _u(31)
|
||||
#define SYSCFG_PROC0_NMI_MASK_LSB _u(0)
|
||||
#define SYSCFG_PROC0_NMI_MASK_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SYSCFG_PROC1_NMI_MASK
|
||||
// Description : Processor core 1 NMI source mask
|
||||
// Set a bit high to enable NMI from that IRQ
|
||||
#define SYSCFG_PROC1_NMI_MASK_OFFSET _u(0x00000004)
|
||||
#define SYSCFG_PROC1_NMI_MASK_BITS _u(0xffffffff)
|
||||
#define SYSCFG_PROC1_NMI_MASK_RESET _u(0x00000000)
|
||||
#define SYSCFG_PROC1_NMI_MASK_MSB _u(31)
|
||||
#define SYSCFG_PROC1_NMI_MASK_LSB _u(0)
|
||||
#define SYSCFG_PROC1_NMI_MASK_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SYSCFG_PROC_CONFIG
|
||||
// Description : Configuration for processors
|
||||
#define SYSCFG_PROC_CONFIG_OFFSET _u(0x00000008)
|
||||
#define SYSCFG_PROC_CONFIG_BITS _u(0xff000003)
|
||||
#define SYSCFG_PROC_CONFIG_RESET _u(0x10000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_PROC_CONFIG_PROC1_DAP_INSTID
|
||||
// Description : Configure proc1 DAP instance ID.
|
||||
// Recommend that this is NOT changed until you require debug
|
||||
// access in multi-chip environment
|
||||
// WARNING: do not set to 15 as this is reserved for RescueDP
|
||||
#define SYSCFG_PROC_CONFIG_PROC1_DAP_INSTID_RESET _u(0x1)
|
||||
#define SYSCFG_PROC_CONFIG_PROC1_DAP_INSTID_BITS _u(0xf0000000)
|
||||
#define SYSCFG_PROC_CONFIG_PROC1_DAP_INSTID_MSB _u(31)
|
||||
#define SYSCFG_PROC_CONFIG_PROC1_DAP_INSTID_LSB _u(28)
|
||||
#define SYSCFG_PROC_CONFIG_PROC1_DAP_INSTID_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_PROC_CONFIG_PROC0_DAP_INSTID
|
||||
// Description : Configure proc0 DAP instance ID.
|
||||
// Recommend that this is NOT changed until you require debug
|
||||
// access in multi-chip environment
|
||||
// WARNING: do not set to 15 as this is reserved for RescueDP
|
||||
#define SYSCFG_PROC_CONFIG_PROC0_DAP_INSTID_RESET _u(0x0)
|
||||
#define SYSCFG_PROC_CONFIG_PROC0_DAP_INSTID_BITS _u(0x0f000000)
|
||||
#define SYSCFG_PROC_CONFIG_PROC0_DAP_INSTID_MSB _u(27)
|
||||
#define SYSCFG_PROC_CONFIG_PROC0_DAP_INSTID_LSB _u(24)
|
||||
#define SYSCFG_PROC_CONFIG_PROC0_DAP_INSTID_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_PROC_CONFIG_PROC1_HALTED
|
||||
// Description : Indication that proc1 has halted
|
||||
#define SYSCFG_PROC_CONFIG_PROC1_HALTED_RESET _u(0x0)
|
||||
#define SYSCFG_PROC_CONFIG_PROC1_HALTED_BITS _u(0x00000002)
|
||||
#define SYSCFG_PROC_CONFIG_PROC1_HALTED_MSB _u(1)
|
||||
#define SYSCFG_PROC_CONFIG_PROC1_HALTED_LSB _u(1)
|
||||
#define SYSCFG_PROC_CONFIG_PROC1_HALTED_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_PROC_CONFIG_PROC0_HALTED
|
||||
// Description : Indication that proc0 has halted
|
||||
#define SYSCFG_PROC_CONFIG_PROC0_HALTED_RESET _u(0x0)
|
||||
#define SYSCFG_PROC_CONFIG_PROC0_HALTED_BITS _u(0x00000001)
|
||||
#define SYSCFG_PROC_CONFIG_PROC0_HALTED_MSB _u(0)
|
||||
#define SYSCFG_PROC_CONFIG_PROC0_HALTED_LSB _u(0)
|
||||
#define SYSCFG_PROC_CONFIG_PROC0_HALTED_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SYSCFG_PROC_IN_SYNC_BYPASS
|
||||
// Description : For each bit, if 1, bypass the input synchronizer between that
|
||||
// GPIO
|
||||
// and the GPIO input register in the SIO. The input synchronizers
|
||||
// should
|
||||
// generally be unbypassed, to avoid injecting metastabilities
|
||||
// into processors.
|
||||
// If you're feeling brave, you can bypass to save two cycles of
|
||||
// input
|
||||
// latency. This register applies to GPIO 0...29.
|
||||
#define SYSCFG_PROC_IN_SYNC_BYPASS_OFFSET _u(0x0000000c)
|
||||
#define SYSCFG_PROC_IN_SYNC_BYPASS_BITS _u(0x3fffffff)
|
||||
#define SYSCFG_PROC_IN_SYNC_BYPASS_RESET _u(0x00000000)
|
||||
#define SYSCFG_PROC_IN_SYNC_BYPASS_MSB _u(29)
|
||||
#define SYSCFG_PROC_IN_SYNC_BYPASS_LSB _u(0)
|
||||
#define SYSCFG_PROC_IN_SYNC_BYPASS_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SYSCFG_PROC_IN_SYNC_BYPASS_HI
|
||||
// Description : For each bit, if 1, bypass the input synchronizer between that
|
||||
// GPIO
|
||||
// and the GPIO input register in the SIO. The input synchronizers
|
||||
// should
|
||||
// generally be unbypassed, to avoid injecting metastabilities
|
||||
// into processors.
|
||||
// If you're feeling brave, you can bypass to save two cycles of
|
||||
// input
|
||||
// latency. This register applies to GPIO 30...35 (the QSPI IOs).
|
||||
#define SYSCFG_PROC_IN_SYNC_BYPASS_HI_OFFSET _u(0x00000010)
|
||||
#define SYSCFG_PROC_IN_SYNC_BYPASS_HI_BITS _u(0x0000003f)
|
||||
#define SYSCFG_PROC_IN_SYNC_BYPASS_HI_RESET _u(0x00000000)
|
||||
#define SYSCFG_PROC_IN_SYNC_BYPASS_HI_MSB _u(5)
|
||||
#define SYSCFG_PROC_IN_SYNC_BYPASS_HI_LSB _u(0)
|
||||
#define SYSCFG_PROC_IN_SYNC_BYPASS_HI_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : SYSCFG_DBGFORCE
|
||||
// Description : Directly control the SWD debug port of either processor
|
||||
#define SYSCFG_DBGFORCE_OFFSET _u(0x00000014)
|
||||
#define SYSCFG_DBGFORCE_BITS _u(0x000000ff)
|
||||
#define SYSCFG_DBGFORCE_RESET _u(0x00000066)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_DBGFORCE_PROC1_ATTACH
|
||||
// Description : Attach processor 1 debug port to syscfg controls, and
|
||||
// disconnect it from external SWD pads.
|
||||
#define SYSCFG_DBGFORCE_PROC1_ATTACH_RESET _u(0x0)
|
||||
#define SYSCFG_DBGFORCE_PROC1_ATTACH_BITS _u(0x00000080)
|
||||
#define SYSCFG_DBGFORCE_PROC1_ATTACH_MSB _u(7)
|
||||
#define SYSCFG_DBGFORCE_PROC1_ATTACH_LSB _u(7)
|
||||
#define SYSCFG_DBGFORCE_PROC1_ATTACH_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_DBGFORCE_PROC1_SWCLK
|
||||
// Description : Directly drive processor 1 SWCLK, if PROC1_ATTACH is set
|
||||
#define SYSCFG_DBGFORCE_PROC1_SWCLK_RESET _u(0x1)
|
||||
#define SYSCFG_DBGFORCE_PROC1_SWCLK_BITS _u(0x00000040)
|
||||
#define SYSCFG_DBGFORCE_PROC1_SWCLK_MSB _u(6)
|
||||
#define SYSCFG_DBGFORCE_PROC1_SWCLK_LSB _u(6)
|
||||
#define SYSCFG_DBGFORCE_PROC1_SWCLK_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_DBGFORCE_PROC1_SWDI
|
||||
// Description : Directly drive processor 1 SWDIO input, if PROC1_ATTACH is set
|
||||
#define SYSCFG_DBGFORCE_PROC1_SWDI_RESET _u(0x1)
|
||||
#define SYSCFG_DBGFORCE_PROC1_SWDI_BITS _u(0x00000020)
|
||||
#define SYSCFG_DBGFORCE_PROC1_SWDI_MSB _u(5)
|
||||
#define SYSCFG_DBGFORCE_PROC1_SWDI_LSB _u(5)
|
||||
#define SYSCFG_DBGFORCE_PROC1_SWDI_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_DBGFORCE_PROC1_SWDO
|
||||
// Description : Observe the value of processor 1 SWDIO output.
|
||||
#define SYSCFG_DBGFORCE_PROC1_SWDO_RESET "-"
|
||||
#define SYSCFG_DBGFORCE_PROC1_SWDO_BITS _u(0x00000010)
|
||||
#define SYSCFG_DBGFORCE_PROC1_SWDO_MSB _u(4)
|
||||
#define SYSCFG_DBGFORCE_PROC1_SWDO_LSB _u(4)
|
||||
#define SYSCFG_DBGFORCE_PROC1_SWDO_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_DBGFORCE_PROC0_ATTACH
|
||||
// Description : Attach processor 0 debug port to syscfg controls, and
|
||||
// disconnect it from external SWD pads.
|
||||
#define SYSCFG_DBGFORCE_PROC0_ATTACH_RESET _u(0x0)
|
||||
#define SYSCFG_DBGFORCE_PROC0_ATTACH_BITS _u(0x00000008)
|
||||
#define SYSCFG_DBGFORCE_PROC0_ATTACH_MSB _u(3)
|
||||
#define SYSCFG_DBGFORCE_PROC0_ATTACH_LSB _u(3)
|
||||
#define SYSCFG_DBGFORCE_PROC0_ATTACH_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_DBGFORCE_PROC0_SWCLK
|
||||
// Description : Directly drive processor 0 SWCLK, if PROC0_ATTACH is set
|
||||
#define SYSCFG_DBGFORCE_PROC0_SWCLK_RESET _u(0x1)
|
||||
#define SYSCFG_DBGFORCE_PROC0_SWCLK_BITS _u(0x00000004)
|
||||
#define SYSCFG_DBGFORCE_PROC0_SWCLK_MSB _u(2)
|
||||
#define SYSCFG_DBGFORCE_PROC0_SWCLK_LSB _u(2)
|
||||
#define SYSCFG_DBGFORCE_PROC0_SWCLK_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_DBGFORCE_PROC0_SWDI
|
||||
// Description : Directly drive processor 0 SWDIO input, if PROC0_ATTACH is set
|
||||
#define SYSCFG_DBGFORCE_PROC0_SWDI_RESET _u(0x1)
|
||||
#define SYSCFG_DBGFORCE_PROC0_SWDI_BITS _u(0x00000002)
|
||||
#define SYSCFG_DBGFORCE_PROC0_SWDI_MSB _u(1)
|
||||
#define SYSCFG_DBGFORCE_PROC0_SWDI_LSB _u(1)
|
||||
#define SYSCFG_DBGFORCE_PROC0_SWDI_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_DBGFORCE_PROC0_SWDO
|
||||
// Description : Observe the value of processor 0 SWDIO output.
|
||||
#define SYSCFG_DBGFORCE_PROC0_SWDO_RESET "-"
|
||||
#define SYSCFG_DBGFORCE_PROC0_SWDO_BITS _u(0x00000001)
|
||||
#define SYSCFG_DBGFORCE_PROC0_SWDO_MSB _u(0)
|
||||
#define SYSCFG_DBGFORCE_PROC0_SWDO_LSB _u(0)
|
||||
#define SYSCFG_DBGFORCE_PROC0_SWDO_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SYSCFG_MEMPOWERDOWN
|
||||
// Description : Control power downs to memories. Set high to power down
|
||||
// memories.
|
||||
// Use with extreme caution
|
||||
#define SYSCFG_MEMPOWERDOWN_OFFSET _u(0x00000018)
|
||||
#define SYSCFG_MEMPOWERDOWN_BITS _u(0x000000ff)
|
||||
#define SYSCFG_MEMPOWERDOWN_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_MEMPOWERDOWN_ROM
|
||||
// Description : None
|
||||
#define SYSCFG_MEMPOWERDOWN_ROM_RESET _u(0x0)
|
||||
#define SYSCFG_MEMPOWERDOWN_ROM_BITS _u(0x00000080)
|
||||
#define SYSCFG_MEMPOWERDOWN_ROM_MSB _u(7)
|
||||
#define SYSCFG_MEMPOWERDOWN_ROM_LSB _u(7)
|
||||
#define SYSCFG_MEMPOWERDOWN_ROM_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_MEMPOWERDOWN_USB
|
||||
// Description : None
|
||||
#define SYSCFG_MEMPOWERDOWN_USB_RESET _u(0x0)
|
||||
#define SYSCFG_MEMPOWERDOWN_USB_BITS _u(0x00000040)
|
||||
#define SYSCFG_MEMPOWERDOWN_USB_MSB _u(6)
|
||||
#define SYSCFG_MEMPOWERDOWN_USB_LSB _u(6)
|
||||
#define SYSCFG_MEMPOWERDOWN_USB_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_MEMPOWERDOWN_SRAM5
|
||||
// Description : None
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM5_RESET _u(0x0)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM5_BITS _u(0x00000020)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM5_MSB _u(5)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM5_LSB _u(5)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM5_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_MEMPOWERDOWN_SRAM4
|
||||
// Description : None
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM4_RESET _u(0x0)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM4_BITS _u(0x00000010)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM4_MSB _u(4)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM4_LSB _u(4)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM4_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_MEMPOWERDOWN_SRAM3
|
||||
// Description : None
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM3_RESET _u(0x0)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM3_BITS _u(0x00000008)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM3_MSB _u(3)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM3_LSB _u(3)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM3_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_MEMPOWERDOWN_SRAM2
|
||||
// Description : None
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM2_RESET _u(0x0)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM2_BITS _u(0x00000004)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM2_MSB _u(2)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM2_LSB _u(2)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM2_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_MEMPOWERDOWN_SRAM1
|
||||
// Description : None
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM1_RESET _u(0x0)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM1_BITS _u(0x00000002)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM1_MSB _u(1)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM1_LSB _u(1)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSCFG_MEMPOWERDOWN_SRAM0
|
||||
// Description : None
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM0_RESET _u(0x0)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM0_BITS _u(0x00000001)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM0_MSB _u(0)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM0_LSB _u(0)
|
||||
#define SYSCFG_MEMPOWERDOWN_SRAM0_ACCESS "RW"
|
||||
// =============================================================================
|
||||
#endif // HARDWARE_REGS_SYSCFG_DEFINED
|
77
lib/rp2040/hardware/regs/sysinfo.h
Normal file
77
lib/rp2040/hardware/regs/sysinfo.h
Normal file
@ -0,0 +1,77 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// =============================================================================
|
||||
// Register block : SYSINFO
|
||||
// Version : 1
|
||||
// Bus type : apb
|
||||
// Description : None
|
||||
// =============================================================================
|
||||
#ifndef HARDWARE_REGS_SYSINFO_DEFINED
|
||||
#define HARDWARE_REGS_SYSINFO_DEFINED
|
||||
// =============================================================================
|
||||
// Register : SYSINFO_CHIP_ID
|
||||
// Description : JEDEC JEP-106 compliant chip identifier.
|
||||
#define SYSINFO_CHIP_ID_OFFSET _u(0x00000000)
|
||||
#define SYSINFO_CHIP_ID_BITS _u(0xffffffff)
|
||||
#define SYSINFO_CHIP_ID_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSINFO_CHIP_ID_REVISION
|
||||
// Description : None
|
||||
#define SYSINFO_CHIP_ID_REVISION_RESET "-"
|
||||
#define SYSINFO_CHIP_ID_REVISION_BITS _u(0xf0000000)
|
||||
#define SYSINFO_CHIP_ID_REVISION_MSB _u(31)
|
||||
#define SYSINFO_CHIP_ID_REVISION_LSB _u(28)
|
||||
#define SYSINFO_CHIP_ID_REVISION_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSINFO_CHIP_ID_PART
|
||||
// Description : None
|
||||
#define SYSINFO_CHIP_ID_PART_RESET "-"
|
||||
#define SYSINFO_CHIP_ID_PART_BITS _u(0x0ffff000)
|
||||
#define SYSINFO_CHIP_ID_PART_MSB _u(27)
|
||||
#define SYSINFO_CHIP_ID_PART_LSB _u(12)
|
||||
#define SYSINFO_CHIP_ID_PART_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSINFO_CHIP_ID_MANUFACTURER
|
||||
// Description : None
|
||||
#define SYSINFO_CHIP_ID_MANUFACTURER_RESET "-"
|
||||
#define SYSINFO_CHIP_ID_MANUFACTURER_BITS _u(0x00000fff)
|
||||
#define SYSINFO_CHIP_ID_MANUFACTURER_MSB _u(11)
|
||||
#define SYSINFO_CHIP_ID_MANUFACTURER_LSB _u(0)
|
||||
#define SYSINFO_CHIP_ID_MANUFACTURER_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SYSINFO_PLATFORM
|
||||
// Description : Platform register. Allows software to know what environment it
|
||||
// is running in.
|
||||
#define SYSINFO_PLATFORM_OFFSET _u(0x00000004)
|
||||
#define SYSINFO_PLATFORM_BITS _u(0x00000003)
|
||||
#define SYSINFO_PLATFORM_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSINFO_PLATFORM_ASIC
|
||||
// Description : None
|
||||
#define SYSINFO_PLATFORM_ASIC_RESET _u(0x0)
|
||||
#define SYSINFO_PLATFORM_ASIC_BITS _u(0x00000002)
|
||||
#define SYSINFO_PLATFORM_ASIC_MSB _u(1)
|
||||
#define SYSINFO_PLATFORM_ASIC_LSB _u(1)
|
||||
#define SYSINFO_PLATFORM_ASIC_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : SYSINFO_PLATFORM_FPGA
|
||||
// Description : None
|
||||
#define SYSINFO_PLATFORM_FPGA_RESET _u(0x0)
|
||||
#define SYSINFO_PLATFORM_FPGA_BITS _u(0x00000001)
|
||||
#define SYSINFO_PLATFORM_FPGA_MSB _u(0)
|
||||
#define SYSINFO_PLATFORM_FPGA_LSB _u(0)
|
||||
#define SYSINFO_PLATFORM_FPGA_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : SYSINFO_GITREF_RP2040
|
||||
// Description : Git hash of the chip source. Used to identify chip version.
|
||||
#define SYSINFO_GITREF_RP2040_OFFSET _u(0x00000040)
|
||||
#define SYSINFO_GITREF_RP2040_BITS _u(0xffffffff)
|
||||
#define SYSINFO_GITREF_RP2040_RESET "-"
|
||||
#define SYSINFO_GITREF_RP2040_MSB _u(31)
|
||||
#define SYSINFO_GITREF_RP2040_LSB _u(0)
|
||||
#define SYSINFO_GITREF_RP2040_ACCESS "RO"
|
||||
// =============================================================================
|
||||
#endif // HARDWARE_REGS_SYSINFO_DEFINED
|
38
lib/rp2040/hardware/regs/tbman.h
Normal file
38
lib/rp2040/hardware/regs/tbman.h
Normal file
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// =============================================================================
|
||||
// Register block : TBMAN
|
||||
// Version : 1
|
||||
// Bus type : apb
|
||||
// Description : Testbench manager. Allows the programmer to know what
|
||||
// platform their software is running on.
|
||||
// =============================================================================
|
||||
#ifndef HARDWARE_REGS_TBMAN_DEFINED
|
||||
#define HARDWARE_REGS_TBMAN_DEFINED
|
||||
// =============================================================================
|
||||
// Register : TBMAN_PLATFORM
|
||||
// Description : Indicates the type of platform in use
|
||||
#define TBMAN_PLATFORM_OFFSET _u(0x00000000)
|
||||
#define TBMAN_PLATFORM_BITS _u(0x00000003)
|
||||
#define TBMAN_PLATFORM_RESET _u(0x00000005)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TBMAN_PLATFORM_FPGA
|
||||
// Description : Indicates the platform is an FPGA
|
||||
#define TBMAN_PLATFORM_FPGA_RESET _u(0x0)
|
||||
#define TBMAN_PLATFORM_FPGA_BITS _u(0x00000002)
|
||||
#define TBMAN_PLATFORM_FPGA_MSB _u(1)
|
||||
#define TBMAN_PLATFORM_FPGA_LSB _u(1)
|
||||
#define TBMAN_PLATFORM_FPGA_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TBMAN_PLATFORM_ASIC
|
||||
// Description : Indicates the platform is an ASIC
|
||||
#define TBMAN_PLATFORM_ASIC_RESET _u(0x1)
|
||||
#define TBMAN_PLATFORM_ASIC_BITS _u(0x00000001)
|
||||
#define TBMAN_PLATFORM_ASIC_MSB _u(0)
|
||||
#define TBMAN_PLATFORM_ASIC_LSB _u(0)
|
||||
#define TBMAN_PLATFORM_ASIC_ACCESS "RO"
|
||||
// =============================================================================
|
||||
#endif // HARDWARE_REGS_TBMAN_DEFINED
|
332
lib/rp2040/hardware/regs/timer.h
Normal file
332
lib/rp2040/hardware/regs/timer.h
Normal file
@ -0,0 +1,332 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// =============================================================================
|
||||
// Register block : TIMER
|
||||
// Version : 1
|
||||
// Bus type : apb
|
||||
// Description : Controls time and alarms
|
||||
// time is a 64 bit value indicating the time in usec since
|
||||
// power-on
|
||||
// timeh is the top 32 bits of time & timel is the bottom 32
|
||||
// bits
|
||||
// to change time write to timelw before timehw
|
||||
// to read time read from timelr before timehr
|
||||
// An alarm is set by setting alarm_enable and writing to the
|
||||
// corresponding alarm register
|
||||
// When an alarm is pending, the corresponding alarm_running
|
||||
// signal will be high
|
||||
// An alarm can be cancelled before it has finished by clearing
|
||||
// the alarm_enable
|
||||
// When an alarm fires, the corresponding alarm_irq is set and
|
||||
// alarm_running is cleared
|
||||
// To clear the interrupt write a 1 to the corresponding
|
||||
// alarm_irq
|
||||
// =============================================================================
|
||||
#ifndef HARDWARE_REGS_TIMER_DEFINED
|
||||
#define HARDWARE_REGS_TIMER_DEFINED
|
||||
// =============================================================================
|
||||
// Register : TIMER_TIMEHW
|
||||
// Description : Write to bits 63:32 of time
|
||||
// always write timelw before timehw
|
||||
#define TIMER_TIMEHW_OFFSET _u(0x00000000)
|
||||
#define TIMER_TIMEHW_BITS _u(0xffffffff)
|
||||
#define TIMER_TIMEHW_RESET _u(0x00000000)
|
||||
#define TIMER_TIMEHW_MSB _u(31)
|
||||
#define TIMER_TIMEHW_LSB _u(0)
|
||||
#define TIMER_TIMEHW_ACCESS "WF"
|
||||
// =============================================================================
|
||||
// Register : TIMER_TIMELW
|
||||
// Description : Write to bits 31:0 of time
|
||||
// writes do not get copied to time until timehw is written
|
||||
#define TIMER_TIMELW_OFFSET _u(0x00000004)
|
||||
#define TIMER_TIMELW_BITS _u(0xffffffff)
|
||||
#define TIMER_TIMELW_RESET _u(0x00000000)
|
||||
#define TIMER_TIMELW_MSB _u(31)
|
||||
#define TIMER_TIMELW_LSB _u(0)
|
||||
#define TIMER_TIMELW_ACCESS "WF"
|
||||
// =============================================================================
|
||||
// Register : TIMER_TIMEHR
|
||||
// Description : Read from bits 63:32 of time
|
||||
// always read timelr before timehr
|
||||
#define TIMER_TIMEHR_OFFSET _u(0x00000008)
|
||||
#define TIMER_TIMEHR_BITS _u(0xffffffff)
|
||||
#define TIMER_TIMEHR_RESET _u(0x00000000)
|
||||
#define TIMER_TIMEHR_MSB _u(31)
|
||||
#define TIMER_TIMEHR_LSB _u(0)
|
||||
#define TIMER_TIMEHR_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : TIMER_TIMELR
|
||||
// Description : Read from bits 31:0 of time
|
||||
#define TIMER_TIMELR_OFFSET _u(0x0000000c)
|
||||
#define TIMER_TIMELR_BITS _u(0xffffffff)
|
||||
#define TIMER_TIMELR_RESET _u(0x00000000)
|
||||
#define TIMER_TIMELR_MSB _u(31)
|
||||
#define TIMER_TIMELR_LSB _u(0)
|
||||
#define TIMER_TIMELR_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : TIMER_ALARM0
|
||||
// Description : Arm alarm 0, and configure the time it will fire.
|
||||
// Once armed, the alarm fires when TIMER_ALARM0 == TIMELR.
|
||||
// The alarm will disarm itself once it fires, and can
|
||||
// be disarmed early using the ARMED status register.
|
||||
#define TIMER_ALARM0_OFFSET _u(0x00000010)
|
||||
#define TIMER_ALARM0_BITS _u(0xffffffff)
|
||||
#define TIMER_ALARM0_RESET _u(0x00000000)
|
||||
#define TIMER_ALARM0_MSB _u(31)
|
||||
#define TIMER_ALARM0_LSB _u(0)
|
||||
#define TIMER_ALARM0_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : TIMER_ALARM1
|
||||
// Description : Arm alarm 1, and configure the time it will fire.
|
||||
// Once armed, the alarm fires when TIMER_ALARM1 == TIMELR.
|
||||
// The alarm will disarm itself once it fires, and can
|
||||
// be disarmed early using the ARMED status register.
|
||||
#define TIMER_ALARM1_OFFSET _u(0x00000014)
|
||||
#define TIMER_ALARM1_BITS _u(0xffffffff)
|
||||
#define TIMER_ALARM1_RESET _u(0x00000000)
|
||||
#define TIMER_ALARM1_MSB _u(31)
|
||||
#define TIMER_ALARM1_LSB _u(0)
|
||||
#define TIMER_ALARM1_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : TIMER_ALARM2
|
||||
// Description : Arm alarm 2, and configure the time it will fire.
|
||||
// Once armed, the alarm fires when TIMER_ALARM2 == TIMELR.
|
||||
// The alarm will disarm itself once it fires, and can
|
||||
// be disarmed early using the ARMED status register.
|
||||
#define TIMER_ALARM2_OFFSET _u(0x00000018)
|
||||
#define TIMER_ALARM2_BITS _u(0xffffffff)
|
||||
#define TIMER_ALARM2_RESET _u(0x00000000)
|
||||
#define TIMER_ALARM2_MSB _u(31)
|
||||
#define TIMER_ALARM2_LSB _u(0)
|
||||
#define TIMER_ALARM2_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : TIMER_ALARM3
|
||||
// Description : Arm alarm 3, and configure the time it will fire.
|
||||
// Once armed, the alarm fires when TIMER_ALARM3 == TIMELR.
|
||||
// The alarm will disarm itself once it fires, and can
|
||||
// be disarmed early using the ARMED status register.
|
||||
#define TIMER_ALARM3_OFFSET _u(0x0000001c)
|
||||
#define TIMER_ALARM3_BITS _u(0xffffffff)
|
||||
#define TIMER_ALARM3_RESET _u(0x00000000)
|
||||
#define TIMER_ALARM3_MSB _u(31)
|
||||
#define TIMER_ALARM3_LSB _u(0)
|
||||
#define TIMER_ALARM3_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : TIMER_ARMED
|
||||
// Description : Indicates the armed/disarmed status of each alarm.
|
||||
// A write to the corresponding ALARMx register arms the alarm.
|
||||
// Alarms automatically disarm upon firing, but writing ones here
|
||||
// will disarm immediately without waiting to fire.
|
||||
#define TIMER_ARMED_OFFSET _u(0x00000020)
|
||||
#define TIMER_ARMED_BITS _u(0x0000000f)
|
||||
#define TIMER_ARMED_RESET _u(0x00000000)
|
||||
#define TIMER_ARMED_MSB _u(3)
|
||||
#define TIMER_ARMED_LSB _u(0)
|
||||
#define TIMER_ARMED_ACCESS "WC"
|
||||
// =============================================================================
|
||||
// Register : TIMER_TIMERAWH
|
||||
// Description : Raw read from bits 63:32 of time (no side effects)
|
||||
#define TIMER_TIMERAWH_OFFSET _u(0x00000024)
|
||||
#define TIMER_TIMERAWH_BITS _u(0xffffffff)
|
||||
#define TIMER_TIMERAWH_RESET _u(0x00000000)
|
||||
#define TIMER_TIMERAWH_MSB _u(31)
|
||||
#define TIMER_TIMERAWH_LSB _u(0)
|
||||
#define TIMER_TIMERAWH_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : TIMER_TIMERAWL
|
||||
// Description : Raw read from bits 31:0 of time (no side effects)
|
||||
#define TIMER_TIMERAWL_OFFSET _u(0x00000028)
|
||||
#define TIMER_TIMERAWL_BITS _u(0xffffffff)
|
||||
#define TIMER_TIMERAWL_RESET _u(0x00000000)
|
||||
#define TIMER_TIMERAWL_MSB _u(31)
|
||||
#define TIMER_TIMERAWL_LSB _u(0)
|
||||
#define TIMER_TIMERAWL_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : TIMER_DBGPAUSE
|
||||
// Description : Set bits high to enable pause when the corresponding debug
|
||||
// ports are active
|
||||
#define TIMER_DBGPAUSE_OFFSET _u(0x0000002c)
|
||||
#define TIMER_DBGPAUSE_BITS _u(0x00000006)
|
||||
#define TIMER_DBGPAUSE_RESET _u(0x00000007)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TIMER_DBGPAUSE_DBG1
|
||||
// Description : Pause when processor 1 is in debug mode
|
||||
#define TIMER_DBGPAUSE_DBG1_RESET _u(0x1)
|
||||
#define TIMER_DBGPAUSE_DBG1_BITS _u(0x00000004)
|
||||
#define TIMER_DBGPAUSE_DBG1_MSB _u(2)
|
||||
#define TIMER_DBGPAUSE_DBG1_LSB _u(2)
|
||||
#define TIMER_DBGPAUSE_DBG1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TIMER_DBGPAUSE_DBG0
|
||||
// Description : Pause when processor 0 is in debug mode
|
||||
#define TIMER_DBGPAUSE_DBG0_RESET _u(0x1)
|
||||
#define TIMER_DBGPAUSE_DBG0_BITS _u(0x00000002)
|
||||
#define TIMER_DBGPAUSE_DBG0_MSB _u(1)
|
||||
#define TIMER_DBGPAUSE_DBG0_LSB _u(1)
|
||||
#define TIMER_DBGPAUSE_DBG0_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : TIMER_PAUSE
|
||||
// Description : Set high to pause the timer
|
||||
#define TIMER_PAUSE_OFFSET _u(0x00000030)
|
||||
#define TIMER_PAUSE_BITS _u(0x00000001)
|
||||
#define TIMER_PAUSE_RESET _u(0x00000000)
|
||||
#define TIMER_PAUSE_MSB _u(0)
|
||||
#define TIMER_PAUSE_LSB _u(0)
|
||||
#define TIMER_PAUSE_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : TIMER_INTR
|
||||
// Description : Raw Interrupts
|
||||
#define TIMER_INTR_OFFSET _u(0x00000034)
|
||||
#define TIMER_INTR_BITS _u(0x0000000f)
|
||||
#define TIMER_INTR_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TIMER_INTR_ALARM_3
|
||||
// Description : None
|
||||
#define TIMER_INTR_ALARM_3_RESET _u(0x0)
|
||||
#define TIMER_INTR_ALARM_3_BITS _u(0x00000008)
|
||||
#define TIMER_INTR_ALARM_3_MSB _u(3)
|
||||
#define TIMER_INTR_ALARM_3_LSB _u(3)
|
||||
#define TIMER_INTR_ALARM_3_ACCESS "WC"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TIMER_INTR_ALARM_2
|
||||
// Description : None
|
||||
#define TIMER_INTR_ALARM_2_RESET _u(0x0)
|
||||
#define TIMER_INTR_ALARM_2_BITS _u(0x00000004)
|
||||
#define TIMER_INTR_ALARM_2_MSB _u(2)
|
||||
#define TIMER_INTR_ALARM_2_LSB _u(2)
|
||||
#define TIMER_INTR_ALARM_2_ACCESS "WC"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TIMER_INTR_ALARM_1
|
||||
// Description : None
|
||||
#define TIMER_INTR_ALARM_1_RESET _u(0x0)
|
||||
#define TIMER_INTR_ALARM_1_BITS _u(0x00000002)
|
||||
#define TIMER_INTR_ALARM_1_MSB _u(1)
|
||||
#define TIMER_INTR_ALARM_1_LSB _u(1)
|
||||
#define TIMER_INTR_ALARM_1_ACCESS "WC"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TIMER_INTR_ALARM_0
|
||||
// Description : None
|
||||
#define TIMER_INTR_ALARM_0_RESET _u(0x0)
|
||||
#define TIMER_INTR_ALARM_0_BITS _u(0x00000001)
|
||||
#define TIMER_INTR_ALARM_0_MSB _u(0)
|
||||
#define TIMER_INTR_ALARM_0_LSB _u(0)
|
||||
#define TIMER_INTR_ALARM_0_ACCESS "WC"
|
||||
// =============================================================================
|
||||
// Register : TIMER_INTE
|
||||
// Description : Interrupt Enable
|
||||
#define TIMER_INTE_OFFSET _u(0x00000038)
|
||||
#define TIMER_INTE_BITS _u(0x0000000f)
|
||||
#define TIMER_INTE_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TIMER_INTE_ALARM_3
|
||||
// Description : None
|
||||
#define TIMER_INTE_ALARM_3_RESET _u(0x0)
|
||||
#define TIMER_INTE_ALARM_3_BITS _u(0x00000008)
|
||||
#define TIMER_INTE_ALARM_3_MSB _u(3)
|
||||
#define TIMER_INTE_ALARM_3_LSB _u(3)
|
||||
#define TIMER_INTE_ALARM_3_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TIMER_INTE_ALARM_2
|
||||
// Description : None
|
||||
#define TIMER_INTE_ALARM_2_RESET _u(0x0)
|
||||
#define TIMER_INTE_ALARM_2_BITS _u(0x00000004)
|
||||
#define TIMER_INTE_ALARM_2_MSB _u(2)
|
||||
#define TIMER_INTE_ALARM_2_LSB _u(2)
|
||||
#define TIMER_INTE_ALARM_2_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TIMER_INTE_ALARM_1
|
||||
// Description : None
|
||||
#define TIMER_INTE_ALARM_1_RESET _u(0x0)
|
||||
#define TIMER_INTE_ALARM_1_BITS _u(0x00000002)
|
||||
#define TIMER_INTE_ALARM_1_MSB _u(1)
|
||||
#define TIMER_INTE_ALARM_1_LSB _u(1)
|
||||
#define TIMER_INTE_ALARM_1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TIMER_INTE_ALARM_0
|
||||
// Description : None
|
||||
#define TIMER_INTE_ALARM_0_RESET _u(0x0)
|
||||
#define TIMER_INTE_ALARM_0_BITS _u(0x00000001)
|
||||
#define TIMER_INTE_ALARM_0_MSB _u(0)
|
||||
#define TIMER_INTE_ALARM_0_LSB _u(0)
|
||||
#define TIMER_INTE_ALARM_0_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : TIMER_INTF
|
||||
// Description : Interrupt Force
|
||||
#define TIMER_INTF_OFFSET _u(0x0000003c)
|
||||
#define TIMER_INTF_BITS _u(0x0000000f)
|
||||
#define TIMER_INTF_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TIMER_INTF_ALARM_3
|
||||
// Description : None
|
||||
#define TIMER_INTF_ALARM_3_RESET _u(0x0)
|
||||
#define TIMER_INTF_ALARM_3_BITS _u(0x00000008)
|
||||
#define TIMER_INTF_ALARM_3_MSB _u(3)
|
||||
#define TIMER_INTF_ALARM_3_LSB _u(3)
|
||||
#define TIMER_INTF_ALARM_3_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TIMER_INTF_ALARM_2
|
||||
// Description : None
|
||||
#define TIMER_INTF_ALARM_2_RESET _u(0x0)
|
||||
#define TIMER_INTF_ALARM_2_BITS _u(0x00000004)
|
||||
#define TIMER_INTF_ALARM_2_MSB _u(2)
|
||||
#define TIMER_INTF_ALARM_2_LSB _u(2)
|
||||
#define TIMER_INTF_ALARM_2_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TIMER_INTF_ALARM_1
|
||||
// Description : None
|
||||
#define TIMER_INTF_ALARM_1_RESET _u(0x0)
|
||||
#define TIMER_INTF_ALARM_1_BITS _u(0x00000002)
|
||||
#define TIMER_INTF_ALARM_1_MSB _u(1)
|
||||
#define TIMER_INTF_ALARM_1_LSB _u(1)
|
||||
#define TIMER_INTF_ALARM_1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TIMER_INTF_ALARM_0
|
||||
// Description : None
|
||||
#define TIMER_INTF_ALARM_0_RESET _u(0x0)
|
||||
#define TIMER_INTF_ALARM_0_BITS _u(0x00000001)
|
||||
#define TIMER_INTF_ALARM_0_MSB _u(0)
|
||||
#define TIMER_INTF_ALARM_0_LSB _u(0)
|
||||
#define TIMER_INTF_ALARM_0_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : TIMER_INTS
|
||||
// Description : Interrupt status after masking & forcing
|
||||
#define TIMER_INTS_OFFSET _u(0x00000040)
|
||||
#define TIMER_INTS_BITS _u(0x0000000f)
|
||||
#define TIMER_INTS_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TIMER_INTS_ALARM_3
|
||||
// Description : None
|
||||
#define TIMER_INTS_ALARM_3_RESET _u(0x0)
|
||||
#define TIMER_INTS_ALARM_3_BITS _u(0x00000008)
|
||||
#define TIMER_INTS_ALARM_3_MSB _u(3)
|
||||
#define TIMER_INTS_ALARM_3_LSB _u(3)
|
||||
#define TIMER_INTS_ALARM_3_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TIMER_INTS_ALARM_2
|
||||
// Description : None
|
||||
#define TIMER_INTS_ALARM_2_RESET _u(0x0)
|
||||
#define TIMER_INTS_ALARM_2_BITS _u(0x00000004)
|
||||
#define TIMER_INTS_ALARM_2_MSB _u(2)
|
||||
#define TIMER_INTS_ALARM_2_LSB _u(2)
|
||||
#define TIMER_INTS_ALARM_2_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TIMER_INTS_ALARM_1
|
||||
// Description : None
|
||||
#define TIMER_INTS_ALARM_1_RESET _u(0x0)
|
||||
#define TIMER_INTS_ALARM_1_BITS _u(0x00000002)
|
||||
#define TIMER_INTS_ALARM_1_MSB _u(1)
|
||||
#define TIMER_INTS_ALARM_1_LSB _u(1)
|
||||
#define TIMER_INTS_ALARM_1_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : TIMER_INTS_ALARM_0
|
||||
// Description : None
|
||||
#define TIMER_INTS_ALARM_0_RESET _u(0x0)
|
||||
#define TIMER_INTS_ALARM_0_BITS _u(0x00000001)
|
||||
#define TIMER_INTS_ALARM_0_MSB _u(0)
|
||||
#define TIMER_INTS_ALARM_0_LSB _u(0)
|
||||
#define TIMER_INTS_ALARM_0_ACCESS "RO"
|
||||
// =============================================================================
|
||||
#endif // HARDWARE_REGS_TIMER_DEFINED
|
1148
lib/rp2040/hardware/regs/uart.h
Normal file
1148
lib/rp2040/hardware/regs/uart.h
Normal file
File diff suppressed because it is too large
Load Diff
3603
lib/rp2040/hardware/regs/usb.h
Normal file
3603
lib/rp2040/hardware/regs/usb.h
Normal file
File diff suppressed because it is too large
Load Diff
6807
lib/rp2040/hardware/regs/usb_device_dpram.h
Normal file
6807
lib/rp2040/hardware/regs/usb_device_dpram.h
Normal file
File diff suppressed because it is too large
Load Diff
151
lib/rp2040/hardware/regs/vreg_and_chip_reset.h
Normal file
151
lib/rp2040/hardware/regs/vreg_and_chip_reset.h
Normal file
@ -0,0 +1,151 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// =============================================================================
|
||||
// Register block : VREG_AND_CHIP_RESET
|
||||
// Version : 1
|
||||
// Bus type : apb
|
||||
// Description : control and status for on-chip voltage regulator and chip
|
||||
// level reset subsystem
|
||||
// =============================================================================
|
||||
#ifndef HARDWARE_REGS_VREG_AND_CHIP_RESET_DEFINED
|
||||
#define HARDWARE_REGS_VREG_AND_CHIP_RESET_DEFINED
|
||||
// =============================================================================
|
||||
// Register : VREG_AND_CHIP_RESET_VREG
|
||||
// Description : Voltage regulator control and status
|
||||
#define VREG_AND_CHIP_RESET_VREG_OFFSET _u(0x00000000)
|
||||
#define VREG_AND_CHIP_RESET_VREG_BITS _u(0x000010f3)
|
||||
#define VREG_AND_CHIP_RESET_VREG_RESET _u(0x000000b1)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : VREG_AND_CHIP_RESET_VREG_ROK
|
||||
// Description : regulation status
|
||||
// 0=not in regulation, 1=in regulation
|
||||
#define VREG_AND_CHIP_RESET_VREG_ROK_RESET _u(0x0)
|
||||
#define VREG_AND_CHIP_RESET_VREG_ROK_BITS _u(0x00001000)
|
||||
#define VREG_AND_CHIP_RESET_VREG_ROK_MSB _u(12)
|
||||
#define VREG_AND_CHIP_RESET_VREG_ROK_LSB _u(12)
|
||||
#define VREG_AND_CHIP_RESET_VREG_ROK_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : VREG_AND_CHIP_RESET_VREG_VSEL
|
||||
// Description : output voltage select
|
||||
// 0000 to 0101 - 0.80V
|
||||
// 0110 - 0.85V
|
||||
// 0111 - 0.90V
|
||||
// 1000 - 0.95V
|
||||
// 1001 - 1.00V
|
||||
// 1010 - 1.05V
|
||||
// 1011 - 1.10V (default)
|
||||
// 1100 - 1.15V
|
||||
// 1101 - 1.20V
|
||||
// 1110 - 1.25V
|
||||
// 1111 - 1.30V
|
||||
#define VREG_AND_CHIP_RESET_VREG_VSEL_RESET _u(0xb)
|
||||
#define VREG_AND_CHIP_RESET_VREG_VSEL_BITS _u(0x000000f0)
|
||||
#define VREG_AND_CHIP_RESET_VREG_VSEL_MSB _u(7)
|
||||
#define VREG_AND_CHIP_RESET_VREG_VSEL_LSB _u(4)
|
||||
#define VREG_AND_CHIP_RESET_VREG_VSEL_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : VREG_AND_CHIP_RESET_VREG_HIZ
|
||||
// Description : high impedance mode select
|
||||
// 0=not in high impedance mode, 1=in high impedance mode
|
||||
#define VREG_AND_CHIP_RESET_VREG_HIZ_RESET _u(0x0)
|
||||
#define VREG_AND_CHIP_RESET_VREG_HIZ_BITS _u(0x00000002)
|
||||
#define VREG_AND_CHIP_RESET_VREG_HIZ_MSB _u(1)
|
||||
#define VREG_AND_CHIP_RESET_VREG_HIZ_LSB _u(1)
|
||||
#define VREG_AND_CHIP_RESET_VREG_HIZ_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : VREG_AND_CHIP_RESET_VREG_EN
|
||||
// Description : enable
|
||||
// 0=not enabled, 1=enabled
|
||||
#define VREG_AND_CHIP_RESET_VREG_EN_RESET _u(0x1)
|
||||
#define VREG_AND_CHIP_RESET_VREG_EN_BITS _u(0x00000001)
|
||||
#define VREG_AND_CHIP_RESET_VREG_EN_MSB _u(0)
|
||||
#define VREG_AND_CHIP_RESET_VREG_EN_LSB _u(0)
|
||||
#define VREG_AND_CHIP_RESET_VREG_EN_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : VREG_AND_CHIP_RESET_BOD
|
||||
// Description : brown-out detection control
|
||||
#define VREG_AND_CHIP_RESET_BOD_OFFSET _u(0x00000004)
|
||||
#define VREG_AND_CHIP_RESET_BOD_BITS _u(0x000000f1)
|
||||
#define VREG_AND_CHIP_RESET_BOD_RESET _u(0x00000091)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : VREG_AND_CHIP_RESET_BOD_VSEL
|
||||
// Description : threshold select
|
||||
// 0000 - 0.473V
|
||||
// 0001 - 0.516V
|
||||
// 0010 - 0.559V
|
||||
// 0011 - 0.602V
|
||||
// 0100 - 0.645V
|
||||
// 0101 - 0.688V
|
||||
// 0110 - 0.731V
|
||||
// 0111 - 0.774V
|
||||
// 1000 - 0.817V
|
||||
// 1001 - 0.860V (default)
|
||||
// 1010 - 0.903V
|
||||
// 1011 - 0.946V
|
||||
// 1100 - 0.989V
|
||||
// 1101 - 1.032V
|
||||
// 1110 - 1.075V
|
||||
// 1111 - 1.118V
|
||||
#define VREG_AND_CHIP_RESET_BOD_VSEL_RESET _u(0x9)
|
||||
#define VREG_AND_CHIP_RESET_BOD_VSEL_BITS _u(0x000000f0)
|
||||
#define VREG_AND_CHIP_RESET_BOD_VSEL_MSB _u(7)
|
||||
#define VREG_AND_CHIP_RESET_BOD_VSEL_LSB _u(4)
|
||||
#define VREG_AND_CHIP_RESET_BOD_VSEL_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : VREG_AND_CHIP_RESET_BOD_EN
|
||||
// Description : enable
|
||||
// 0=not enabled, 1=enabled
|
||||
#define VREG_AND_CHIP_RESET_BOD_EN_RESET _u(0x1)
|
||||
#define VREG_AND_CHIP_RESET_BOD_EN_BITS _u(0x00000001)
|
||||
#define VREG_AND_CHIP_RESET_BOD_EN_MSB _u(0)
|
||||
#define VREG_AND_CHIP_RESET_BOD_EN_LSB _u(0)
|
||||
#define VREG_AND_CHIP_RESET_BOD_EN_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : VREG_AND_CHIP_RESET_CHIP_RESET
|
||||
// Description : Chip reset control and status
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_OFFSET _u(0x00000008)
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_BITS _u(0x01110100)
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : VREG_AND_CHIP_RESET_CHIP_RESET_PSM_RESTART_FLAG
|
||||
// Description : This is set by psm_restart from the debugger.
|
||||
// Its purpose is to branch bootcode to a safe mode when the
|
||||
// debugger has issued a psm_restart in order to recover from a
|
||||
// boot lock-up.
|
||||
// In the safe mode the debugger can repair the boot code, clear
|
||||
// this flag then reboot the processor.
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_PSM_RESTART_FLAG_RESET _u(0x0)
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_PSM_RESTART_FLAG_BITS _u(0x01000000)
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_PSM_RESTART_FLAG_MSB _u(24)
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_PSM_RESTART_FLAG_LSB _u(24)
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_PSM_RESTART_FLAG_ACCESS "WC"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : VREG_AND_CHIP_RESET_CHIP_RESET_HAD_PSM_RESTART
|
||||
// Description : Last reset was from the debug port
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_HAD_PSM_RESTART_RESET _u(0x0)
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_HAD_PSM_RESTART_BITS _u(0x00100000)
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_HAD_PSM_RESTART_MSB _u(20)
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_HAD_PSM_RESTART_LSB _u(20)
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_HAD_PSM_RESTART_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : VREG_AND_CHIP_RESET_CHIP_RESET_HAD_RUN
|
||||
// Description : Last reset was from the RUN pin
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_HAD_RUN_RESET _u(0x0)
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_HAD_RUN_BITS _u(0x00010000)
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_HAD_RUN_MSB _u(16)
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_HAD_RUN_LSB _u(16)
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_HAD_RUN_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : VREG_AND_CHIP_RESET_CHIP_RESET_HAD_POR
|
||||
// Description : Last reset was from the power-on reset or brown-out detection
|
||||
// blocks
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_HAD_POR_RESET _u(0x0)
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_HAD_POR_BITS _u(0x00000100)
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_HAD_POR_MSB _u(8)
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_HAD_POR_LSB _u(8)
|
||||
#define VREG_AND_CHIP_RESET_CHIP_RESET_HAD_POR_ACCESS "RO"
|
||||
// =============================================================================
|
||||
#endif // HARDWARE_REGS_VREG_AND_CHIP_RESET_DEFINED
|
226
lib/rp2040/hardware/regs/watchdog.h
Normal file
226
lib/rp2040/hardware/regs/watchdog.h
Normal file
@ -0,0 +1,226 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// =============================================================================
|
||||
// Register block : WATCHDOG
|
||||
// Version : 1
|
||||
// Bus type : apb
|
||||
// Description : None
|
||||
// =============================================================================
|
||||
#ifndef HARDWARE_REGS_WATCHDOG_DEFINED
|
||||
#define HARDWARE_REGS_WATCHDOG_DEFINED
|
||||
// =============================================================================
|
||||
// Register : WATCHDOG_CTRL
|
||||
// Description : Watchdog control
|
||||
// The rst_wdsel register determines which subsystems are reset
|
||||
// when the watchdog is triggered.
|
||||
// The watchdog can be triggered in software.
|
||||
#define WATCHDOG_CTRL_OFFSET _u(0x00000000)
|
||||
#define WATCHDOG_CTRL_BITS _u(0xc7ffffff)
|
||||
#define WATCHDOG_CTRL_RESET _u(0x07000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : WATCHDOG_CTRL_TRIGGER
|
||||
// Description : Trigger a watchdog reset
|
||||
#define WATCHDOG_CTRL_TRIGGER_RESET _u(0x0)
|
||||
#define WATCHDOG_CTRL_TRIGGER_BITS _u(0x80000000)
|
||||
#define WATCHDOG_CTRL_TRIGGER_MSB _u(31)
|
||||
#define WATCHDOG_CTRL_TRIGGER_LSB _u(31)
|
||||
#define WATCHDOG_CTRL_TRIGGER_ACCESS "SC"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : WATCHDOG_CTRL_ENABLE
|
||||
// Description : When not enabled the watchdog timer is paused
|
||||
#define WATCHDOG_CTRL_ENABLE_RESET _u(0x0)
|
||||
#define WATCHDOG_CTRL_ENABLE_BITS _u(0x40000000)
|
||||
#define WATCHDOG_CTRL_ENABLE_MSB _u(30)
|
||||
#define WATCHDOG_CTRL_ENABLE_LSB _u(30)
|
||||
#define WATCHDOG_CTRL_ENABLE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : WATCHDOG_CTRL_PAUSE_DBG1
|
||||
// Description : Pause the watchdog timer when processor 1 is in debug mode
|
||||
#define WATCHDOG_CTRL_PAUSE_DBG1_RESET _u(0x1)
|
||||
#define WATCHDOG_CTRL_PAUSE_DBG1_BITS _u(0x04000000)
|
||||
#define WATCHDOG_CTRL_PAUSE_DBG1_MSB _u(26)
|
||||
#define WATCHDOG_CTRL_PAUSE_DBG1_LSB _u(26)
|
||||
#define WATCHDOG_CTRL_PAUSE_DBG1_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : WATCHDOG_CTRL_PAUSE_DBG0
|
||||
// Description : Pause the watchdog timer when processor 0 is in debug mode
|
||||
#define WATCHDOG_CTRL_PAUSE_DBG0_RESET _u(0x1)
|
||||
#define WATCHDOG_CTRL_PAUSE_DBG0_BITS _u(0x02000000)
|
||||
#define WATCHDOG_CTRL_PAUSE_DBG0_MSB _u(25)
|
||||
#define WATCHDOG_CTRL_PAUSE_DBG0_LSB _u(25)
|
||||
#define WATCHDOG_CTRL_PAUSE_DBG0_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : WATCHDOG_CTRL_PAUSE_JTAG
|
||||
// Description : Pause the watchdog timer when JTAG is accessing the bus fabric
|
||||
#define WATCHDOG_CTRL_PAUSE_JTAG_RESET _u(0x1)
|
||||
#define WATCHDOG_CTRL_PAUSE_JTAG_BITS _u(0x01000000)
|
||||
#define WATCHDOG_CTRL_PAUSE_JTAG_MSB _u(24)
|
||||
#define WATCHDOG_CTRL_PAUSE_JTAG_LSB _u(24)
|
||||
#define WATCHDOG_CTRL_PAUSE_JTAG_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : WATCHDOG_CTRL_TIME
|
||||
// Description : Indicates the number of ticks / 2 (see errata RP2040-E1) before
|
||||
// a watchdog reset will be triggered
|
||||
#define WATCHDOG_CTRL_TIME_RESET _u(0x000000)
|
||||
#define WATCHDOG_CTRL_TIME_BITS _u(0x00ffffff)
|
||||
#define WATCHDOG_CTRL_TIME_MSB _u(23)
|
||||
#define WATCHDOG_CTRL_TIME_LSB _u(0)
|
||||
#define WATCHDOG_CTRL_TIME_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : WATCHDOG_LOAD
|
||||
// Description : Load the watchdog timer. The maximum setting is 0xffffff which
|
||||
// corresponds to 0xffffff / 2 ticks before triggering a watchdog
|
||||
// reset (see errata RP2040-E1).
|
||||
#define WATCHDOG_LOAD_OFFSET _u(0x00000004)
|
||||
#define WATCHDOG_LOAD_BITS _u(0x00ffffff)
|
||||
#define WATCHDOG_LOAD_RESET _u(0x00000000)
|
||||
#define WATCHDOG_LOAD_MSB _u(23)
|
||||
#define WATCHDOG_LOAD_LSB _u(0)
|
||||
#define WATCHDOG_LOAD_ACCESS "WF"
|
||||
// =============================================================================
|
||||
// Register : WATCHDOG_REASON
|
||||
// Description : Logs the reason for the last reset. Both bits are zero for the
|
||||
// case of a hardware reset.
|
||||
#define WATCHDOG_REASON_OFFSET _u(0x00000008)
|
||||
#define WATCHDOG_REASON_BITS _u(0x00000003)
|
||||
#define WATCHDOG_REASON_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : WATCHDOG_REASON_FORCE
|
||||
// Description : None
|
||||
#define WATCHDOG_REASON_FORCE_RESET _u(0x0)
|
||||
#define WATCHDOG_REASON_FORCE_BITS _u(0x00000002)
|
||||
#define WATCHDOG_REASON_FORCE_MSB _u(1)
|
||||
#define WATCHDOG_REASON_FORCE_LSB _u(1)
|
||||
#define WATCHDOG_REASON_FORCE_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : WATCHDOG_REASON_TIMER
|
||||
// Description : None
|
||||
#define WATCHDOG_REASON_TIMER_RESET _u(0x0)
|
||||
#define WATCHDOG_REASON_TIMER_BITS _u(0x00000001)
|
||||
#define WATCHDOG_REASON_TIMER_MSB _u(0)
|
||||
#define WATCHDOG_REASON_TIMER_LSB _u(0)
|
||||
#define WATCHDOG_REASON_TIMER_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : WATCHDOG_SCRATCH0
|
||||
// Description : Scratch register. Information persists through soft reset of
|
||||
// the chip.
|
||||
#define WATCHDOG_SCRATCH0_OFFSET _u(0x0000000c)
|
||||
#define WATCHDOG_SCRATCH0_BITS _u(0xffffffff)
|
||||
#define WATCHDOG_SCRATCH0_RESET _u(0x00000000)
|
||||
#define WATCHDOG_SCRATCH0_MSB _u(31)
|
||||
#define WATCHDOG_SCRATCH0_LSB _u(0)
|
||||
#define WATCHDOG_SCRATCH0_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : WATCHDOG_SCRATCH1
|
||||
// Description : Scratch register. Information persists through soft reset of
|
||||
// the chip.
|
||||
#define WATCHDOG_SCRATCH1_OFFSET _u(0x00000010)
|
||||
#define WATCHDOG_SCRATCH1_BITS _u(0xffffffff)
|
||||
#define WATCHDOG_SCRATCH1_RESET _u(0x00000000)
|
||||
#define WATCHDOG_SCRATCH1_MSB _u(31)
|
||||
#define WATCHDOG_SCRATCH1_LSB _u(0)
|
||||
#define WATCHDOG_SCRATCH1_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : WATCHDOG_SCRATCH2
|
||||
// Description : Scratch register. Information persists through soft reset of
|
||||
// the chip.
|
||||
#define WATCHDOG_SCRATCH2_OFFSET _u(0x00000014)
|
||||
#define WATCHDOG_SCRATCH2_BITS _u(0xffffffff)
|
||||
#define WATCHDOG_SCRATCH2_RESET _u(0x00000000)
|
||||
#define WATCHDOG_SCRATCH2_MSB _u(31)
|
||||
#define WATCHDOG_SCRATCH2_LSB _u(0)
|
||||
#define WATCHDOG_SCRATCH2_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : WATCHDOG_SCRATCH3
|
||||
// Description : Scratch register. Information persists through soft reset of
|
||||
// the chip.
|
||||
#define WATCHDOG_SCRATCH3_OFFSET _u(0x00000018)
|
||||
#define WATCHDOG_SCRATCH3_BITS _u(0xffffffff)
|
||||
#define WATCHDOG_SCRATCH3_RESET _u(0x00000000)
|
||||
#define WATCHDOG_SCRATCH3_MSB _u(31)
|
||||
#define WATCHDOG_SCRATCH3_LSB _u(0)
|
||||
#define WATCHDOG_SCRATCH3_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : WATCHDOG_SCRATCH4
|
||||
// Description : Scratch register. Information persists through soft reset of
|
||||
// the chip.
|
||||
#define WATCHDOG_SCRATCH4_OFFSET _u(0x0000001c)
|
||||
#define WATCHDOG_SCRATCH4_BITS _u(0xffffffff)
|
||||
#define WATCHDOG_SCRATCH4_RESET _u(0x00000000)
|
||||
#define WATCHDOG_SCRATCH4_MSB _u(31)
|
||||
#define WATCHDOG_SCRATCH4_LSB _u(0)
|
||||
#define WATCHDOG_SCRATCH4_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : WATCHDOG_SCRATCH5
|
||||
// Description : Scratch register. Information persists through soft reset of
|
||||
// the chip.
|
||||
#define WATCHDOG_SCRATCH5_OFFSET _u(0x00000020)
|
||||
#define WATCHDOG_SCRATCH5_BITS _u(0xffffffff)
|
||||
#define WATCHDOG_SCRATCH5_RESET _u(0x00000000)
|
||||
#define WATCHDOG_SCRATCH5_MSB _u(31)
|
||||
#define WATCHDOG_SCRATCH5_LSB _u(0)
|
||||
#define WATCHDOG_SCRATCH5_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : WATCHDOG_SCRATCH6
|
||||
// Description : Scratch register. Information persists through soft reset of
|
||||
// the chip.
|
||||
#define WATCHDOG_SCRATCH6_OFFSET _u(0x00000024)
|
||||
#define WATCHDOG_SCRATCH6_BITS _u(0xffffffff)
|
||||
#define WATCHDOG_SCRATCH6_RESET _u(0x00000000)
|
||||
#define WATCHDOG_SCRATCH6_MSB _u(31)
|
||||
#define WATCHDOG_SCRATCH6_LSB _u(0)
|
||||
#define WATCHDOG_SCRATCH6_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : WATCHDOG_SCRATCH7
|
||||
// Description : Scratch register. Information persists through soft reset of
|
||||
// the chip.
|
||||
#define WATCHDOG_SCRATCH7_OFFSET _u(0x00000028)
|
||||
#define WATCHDOG_SCRATCH7_BITS _u(0xffffffff)
|
||||
#define WATCHDOG_SCRATCH7_RESET _u(0x00000000)
|
||||
#define WATCHDOG_SCRATCH7_MSB _u(31)
|
||||
#define WATCHDOG_SCRATCH7_LSB _u(0)
|
||||
#define WATCHDOG_SCRATCH7_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : WATCHDOG_TICK
|
||||
// Description : Controls the tick generator
|
||||
#define WATCHDOG_TICK_OFFSET _u(0x0000002c)
|
||||
#define WATCHDOG_TICK_BITS _u(0x000fffff)
|
||||
#define WATCHDOG_TICK_RESET _u(0x00000200)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : WATCHDOG_TICK_COUNT
|
||||
// Description : Count down timer: the remaining number clk_tick cycles before
|
||||
// the next tick is generated.
|
||||
#define WATCHDOG_TICK_COUNT_RESET "-"
|
||||
#define WATCHDOG_TICK_COUNT_BITS _u(0x000ff800)
|
||||
#define WATCHDOG_TICK_COUNT_MSB _u(19)
|
||||
#define WATCHDOG_TICK_COUNT_LSB _u(11)
|
||||
#define WATCHDOG_TICK_COUNT_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : WATCHDOG_TICK_RUNNING
|
||||
// Description : Is the tick generator running?
|
||||
#define WATCHDOG_TICK_RUNNING_RESET "-"
|
||||
#define WATCHDOG_TICK_RUNNING_BITS _u(0x00000400)
|
||||
#define WATCHDOG_TICK_RUNNING_MSB _u(10)
|
||||
#define WATCHDOG_TICK_RUNNING_LSB _u(10)
|
||||
#define WATCHDOG_TICK_RUNNING_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : WATCHDOG_TICK_ENABLE
|
||||
// Description : start / stop tick generation
|
||||
#define WATCHDOG_TICK_ENABLE_RESET _u(0x1)
|
||||
#define WATCHDOG_TICK_ENABLE_BITS _u(0x00000200)
|
||||
#define WATCHDOG_TICK_ENABLE_MSB _u(9)
|
||||
#define WATCHDOG_TICK_ENABLE_LSB _u(9)
|
||||
#define WATCHDOG_TICK_ENABLE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : WATCHDOG_TICK_CYCLES
|
||||
// Description : Total number of clk_tick cycles before the next tick.
|
||||
#define WATCHDOG_TICK_CYCLES_RESET _u(0x000)
|
||||
#define WATCHDOG_TICK_CYCLES_BITS _u(0x000001ff)
|
||||
#define WATCHDOG_TICK_CYCLES_MSB _u(8)
|
||||
#define WATCHDOG_TICK_CYCLES_LSB _u(0)
|
||||
#define WATCHDOG_TICK_CYCLES_ACCESS "RW"
|
||||
// =============================================================================
|
||||
#endif // HARDWARE_REGS_WATCHDOG_DEFINED
|
187
lib/rp2040/hardware/regs/xip.h
Normal file
187
lib/rp2040/hardware/regs/xip.h
Normal file
@ -0,0 +1,187 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// =============================================================================
|
||||
// Register block : XIP
|
||||
// Version : 1
|
||||
// Bus type : ahb
|
||||
// Description : QSPI flash execute-in-place block
|
||||
// =============================================================================
|
||||
#ifndef HARDWARE_REGS_XIP_DEFINED
|
||||
#define HARDWARE_REGS_XIP_DEFINED
|
||||
// =============================================================================
|
||||
// Register : XIP_CTRL
|
||||
// Description : Cache control
|
||||
#define XIP_CTRL_OFFSET _u(0x00000000)
|
||||
#define XIP_CTRL_BITS _u(0x0000000b)
|
||||
#define XIP_CTRL_RESET _u(0x00000003)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : XIP_CTRL_POWER_DOWN
|
||||
// Description : When 1, the cache memories are powered down. They retain state,
|
||||
// but can not be accessed. This reduces static power dissipation.
|
||||
// Writing 1 to this bit forces CTRL_EN to 0, i.e. the cache
|
||||
// cannot
|
||||
// be enabled when powered down.
|
||||
// Cache-as-SRAM accesses will produce a bus error response when
|
||||
// the cache is powered down.
|
||||
#define XIP_CTRL_POWER_DOWN_RESET _u(0x0)
|
||||
#define XIP_CTRL_POWER_DOWN_BITS _u(0x00000008)
|
||||
#define XIP_CTRL_POWER_DOWN_MSB _u(3)
|
||||
#define XIP_CTRL_POWER_DOWN_LSB _u(3)
|
||||
#define XIP_CTRL_POWER_DOWN_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : XIP_CTRL_ERR_BADWRITE
|
||||
// Description : When 1, writes to any alias other than 0x0 (caching,
|
||||
// allocating)
|
||||
// will produce a bus fault. When 0, these writes are silently
|
||||
// ignored.
|
||||
// In either case, writes to the 0x0 alias will deallocate on tag
|
||||
// match,
|
||||
// as usual.
|
||||
#define XIP_CTRL_ERR_BADWRITE_RESET _u(0x1)
|
||||
#define XIP_CTRL_ERR_BADWRITE_BITS _u(0x00000002)
|
||||
#define XIP_CTRL_ERR_BADWRITE_MSB _u(1)
|
||||
#define XIP_CTRL_ERR_BADWRITE_LSB _u(1)
|
||||
#define XIP_CTRL_ERR_BADWRITE_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : XIP_CTRL_EN
|
||||
// Description : When 1, enable the cache. When the cache is disabled, all XIP
|
||||
// accesses
|
||||
// will go straight to the flash, without querying the cache. When
|
||||
// enabled,
|
||||
// cacheable XIP accesses will query the cache, and the flash will
|
||||
// not be accessed if the tag matches and the valid bit is set.
|
||||
//
|
||||
// If the cache is enabled, cache-as-SRAM accesses have no effect
|
||||
// on the
|
||||
// cache data RAM, and will produce a bus error response.
|
||||
#define XIP_CTRL_EN_RESET _u(0x1)
|
||||
#define XIP_CTRL_EN_BITS _u(0x00000001)
|
||||
#define XIP_CTRL_EN_MSB _u(0)
|
||||
#define XIP_CTRL_EN_LSB _u(0)
|
||||
#define XIP_CTRL_EN_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : XIP_FLUSH
|
||||
// Description : Cache Flush control
|
||||
// Write 1 to flush the cache. This clears the tag memory, but
|
||||
// the data memory retains its contents. (This means cache-as-SRAM
|
||||
// contents is not affected by flush or reset.)
|
||||
// Reading will hold the bus (stall the processor) until the flush
|
||||
// completes. Alternatively STAT can be polled until completion.
|
||||
#define XIP_FLUSH_OFFSET _u(0x00000004)
|
||||
#define XIP_FLUSH_BITS _u(0x00000001)
|
||||
#define XIP_FLUSH_RESET _u(0x00000000)
|
||||
#define XIP_FLUSH_MSB _u(0)
|
||||
#define XIP_FLUSH_LSB _u(0)
|
||||
#define XIP_FLUSH_ACCESS "SC"
|
||||
// =============================================================================
|
||||
// Register : XIP_STAT
|
||||
// Description : Cache Status
|
||||
#define XIP_STAT_OFFSET _u(0x00000008)
|
||||
#define XIP_STAT_BITS _u(0x00000007)
|
||||
#define XIP_STAT_RESET _u(0x00000002)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : XIP_STAT_FIFO_FULL
|
||||
// Description : When 1, indicates the XIP streaming FIFO is completely full.
|
||||
// The streaming FIFO is 2 entries deep, so the full and empty
|
||||
// flag allow its level to be ascertained.
|
||||
#define XIP_STAT_FIFO_FULL_RESET _u(0x0)
|
||||
#define XIP_STAT_FIFO_FULL_BITS _u(0x00000004)
|
||||
#define XIP_STAT_FIFO_FULL_MSB _u(2)
|
||||
#define XIP_STAT_FIFO_FULL_LSB _u(2)
|
||||
#define XIP_STAT_FIFO_FULL_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : XIP_STAT_FIFO_EMPTY
|
||||
// Description : When 1, indicates the XIP streaming FIFO is completely empty.
|
||||
#define XIP_STAT_FIFO_EMPTY_RESET _u(0x1)
|
||||
#define XIP_STAT_FIFO_EMPTY_BITS _u(0x00000002)
|
||||
#define XIP_STAT_FIFO_EMPTY_MSB _u(1)
|
||||
#define XIP_STAT_FIFO_EMPTY_LSB _u(1)
|
||||
#define XIP_STAT_FIFO_EMPTY_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : XIP_STAT_FLUSH_READY
|
||||
// Description : Reads as 0 while a cache flush is in progress, and 1 otherwise.
|
||||
// The cache is flushed whenever the XIP block is reset, and also
|
||||
// when requested via the FLUSH register.
|
||||
#define XIP_STAT_FLUSH_READY_RESET _u(0x0)
|
||||
#define XIP_STAT_FLUSH_READY_BITS _u(0x00000001)
|
||||
#define XIP_STAT_FLUSH_READY_MSB _u(0)
|
||||
#define XIP_STAT_FLUSH_READY_LSB _u(0)
|
||||
#define XIP_STAT_FLUSH_READY_ACCESS "RO"
|
||||
// =============================================================================
|
||||
// Register : XIP_CTR_HIT
|
||||
// Description : Cache Hit counter
|
||||
// A 32 bit saturating counter that increments upon each cache
|
||||
// hit,
|
||||
// i.e. when an XIP access is serviced directly from cached data.
|
||||
// Write any value to clear.
|
||||
#define XIP_CTR_HIT_OFFSET _u(0x0000000c)
|
||||
#define XIP_CTR_HIT_BITS _u(0xffffffff)
|
||||
#define XIP_CTR_HIT_RESET _u(0x00000000)
|
||||
#define XIP_CTR_HIT_MSB _u(31)
|
||||
#define XIP_CTR_HIT_LSB _u(0)
|
||||
#define XIP_CTR_HIT_ACCESS "WC"
|
||||
// =============================================================================
|
||||
// Register : XIP_CTR_ACC
|
||||
// Description : Cache Access counter
|
||||
// A 32 bit saturating counter that increments upon each XIP
|
||||
// access,
|
||||
// whether the cache is hit or not. This includes noncacheable
|
||||
// accesses.
|
||||
// Write any value to clear.
|
||||
#define XIP_CTR_ACC_OFFSET _u(0x00000010)
|
||||
#define XIP_CTR_ACC_BITS _u(0xffffffff)
|
||||
#define XIP_CTR_ACC_RESET _u(0x00000000)
|
||||
#define XIP_CTR_ACC_MSB _u(31)
|
||||
#define XIP_CTR_ACC_LSB _u(0)
|
||||
#define XIP_CTR_ACC_ACCESS "WC"
|
||||
// =============================================================================
|
||||
// Register : XIP_STREAM_ADDR
|
||||
// Description : FIFO stream address
|
||||
// The address of the next word to be streamed from flash to the
|
||||
// streaming FIFO.
|
||||
// Increments automatically after each flash access.
|
||||
// Write the initial access address here before starting a
|
||||
// streaming read.
|
||||
#define XIP_STREAM_ADDR_OFFSET _u(0x00000014)
|
||||
#define XIP_STREAM_ADDR_BITS _u(0xfffffffc)
|
||||
#define XIP_STREAM_ADDR_RESET _u(0x00000000)
|
||||
#define XIP_STREAM_ADDR_MSB _u(31)
|
||||
#define XIP_STREAM_ADDR_LSB _u(2)
|
||||
#define XIP_STREAM_ADDR_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : XIP_STREAM_CTR
|
||||
// Description : FIFO stream control
|
||||
// Write a nonzero value to start a streaming read. This will then
|
||||
// progress in the background, using flash idle cycles to transfer
|
||||
// a linear data block from flash to the streaming FIFO.
|
||||
// Decrements automatically (1 at a time) as the stream
|
||||
// progresses, and halts on reaching 0.
|
||||
// Write 0 to halt an in-progress stream, and discard any
|
||||
// in-flight
|
||||
// read, so that a new stream can immediately be started (after
|
||||
// draining the FIFO and reinitialising STREAM_ADDR)
|
||||
#define XIP_STREAM_CTR_OFFSET _u(0x00000018)
|
||||
#define XIP_STREAM_CTR_BITS _u(0x003fffff)
|
||||
#define XIP_STREAM_CTR_RESET _u(0x00000000)
|
||||
#define XIP_STREAM_CTR_MSB _u(21)
|
||||
#define XIP_STREAM_CTR_LSB _u(0)
|
||||
#define XIP_STREAM_CTR_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : XIP_STREAM_FIFO
|
||||
// Description : FIFO stream data
|
||||
// Streamed data is buffered here, for retrieval by the system
|
||||
// DMA.
|
||||
// This FIFO can also be accessed via the XIP_AUX slave, to avoid
|
||||
// exposing
|
||||
// the DMA to bus stalls caused by other XIP traffic.
|
||||
#define XIP_STREAM_FIFO_OFFSET _u(0x0000001c)
|
||||
#define XIP_STREAM_FIFO_BITS _u(0xffffffff)
|
||||
#define XIP_STREAM_FIFO_RESET _u(0x00000000)
|
||||
#define XIP_STREAM_FIFO_MSB _u(31)
|
||||
#define XIP_STREAM_FIFO_LSB _u(0)
|
||||
#define XIP_STREAM_FIFO_ACCESS "RF"
|
||||
// =============================================================================
|
||||
#endif // HARDWARE_REGS_XIP_DEFINED
|
159
lib/rp2040/hardware/regs/xosc.h
Normal file
159
lib/rp2040/hardware/regs/xosc.h
Normal file
@ -0,0 +1,159 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// =============================================================================
|
||||
// Register block : XOSC
|
||||
// Version : 1
|
||||
// Bus type : apb
|
||||
// Description : Controls the crystal oscillator
|
||||
// =============================================================================
|
||||
#ifndef HARDWARE_REGS_XOSC_DEFINED
|
||||
#define HARDWARE_REGS_XOSC_DEFINED
|
||||
// =============================================================================
|
||||
// Register : XOSC_CTRL
|
||||
// Description : Crystal Oscillator Control
|
||||
#define XOSC_CTRL_OFFSET _u(0x00000000)
|
||||
#define XOSC_CTRL_BITS _u(0x00ffffff)
|
||||
#define XOSC_CTRL_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : XOSC_CTRL_ENABLE
|
||||
// Description : On power-up this field is initialised to DISABLE and the chip
|
||||
// runs from the ROSC.
|
||||
// If the chip has subsequently been programmed to run from the
|
||||
// XOSC then setting this field to DISABLE may lock-up the chip.
|
||||
// If this is a concern then run the clk_ref from the ROSC and
|
||||
// enable the clk_sys RESUS feature.
|
||||
// The 12-bit code is intended to give some protection against
|
||||
// accidental writes. An invalid setting will enable the
|
||||
// oscillator.
|
||||
// 0xd1e -> DISABLE
|
||||
// 0xfab -> ENABLE
|
||||
#define XOSC_CTRL_ENABLE_RESET "-"
|
||||
#define XOSC_CTRL_ENABLE_BITS _u(0x00fff000)
|
||||
#define XOSC_CTRL_ENABLE_MSB _u(23)
|
||||
#define XOSC_CTRL_ENABLE_LSB _u(12)
|
||||
#define XOSC_CTRL_ENABLE_ACCESS "RW"
|
||||
#define XOSC_CTRL_ENABLE_VALUE_DISABLE _u(0xd1e)
|
||||
#define XOSC_CTRL_ENABLE_VALUE_ENABLE _u(0xfab)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : XOSC_CTRL_FREQ_RANGE
|
||||
// Description : Frequency range. This resets to 0xAA0 and cannot be changed.
|
||||
// 0xaa0 -> 1_15MHZ
|
||||
// 0xaa1 -> RESERVED_1
|
||||
// 0xaa2 -> RESERVED_2
|
||||
// 0xaa3 -> RESERVED_3
|
||||
#define XOSC_CTRL_FREQ_RANGE_RESET "-"
|
||||
#define XOSC_CTRL_FREQ_RANGE_BITS _u(0x00000fff)
|
||||
#define XOSC_CTRL_FREQ_RANGE_MSB _u(11)
|
||||
#define XOSC_CTRL_FREQ_RANGE_LSB _u(0)
|
||||
#define XOSC_CTRL_FREQ_RANGE_ACCESS "RW"
|
||||
#define XOSC_CTRL_FREQ_RANGE_VALUE_1_15MHZ _u(0xaa0)
|
||||
#define XOSC_CTRL_FREQ_RANGE_VALUE_RESERVED_1 _u(0xaa1)
|
||||
#define XOSC_CTRL_FREQ_RANGE_VALUE_RESERVED_2 _u(0xaa2)
|
||||
#define XOSC_CTRL_FREQ_RANGE_VALUE_RESERVED_3 _u(0xaa3)
|
||||
// =============================================================================
|
||||
// Register : XOSC_STATUS
|
||||
// Description : Crystal Oscillator Status
|
||||
#define XOSC_STATUS_OFFSET _u(0x00000004)
|
||||
#define XOSC_STATUS_BITS _u(0x81001003)
|
||||
#define XOSC_STATUS_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : XOSC_STATUS_STABLE
|
||||
// Description : Oscillator is running and stable
|
||||
#define XOSC_STATUS_STABLE_RESET _u(0x0)
|
||||
#define XOSC_STATUS_STABLE_BITS _u(0x80000000)
|
||||
#define XOSC_STATUS_STABLE_MSB _u(31)
|
||||
#define XOSC_STATUS_STABLE_LSB _u(31)
|
||||
#define XOSC_STATUS_STABLE_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : XOSC_STATUS_BADWRITE
|
||||
// Description : An invalid value has been written to CTRL_ENABLE or
|
||||
// CTRL_FREQ_RANGE or DORMANT
|
||||
#define XOSC_STATUS_BADWRITE_RESET _u(0x0)
|
||||
#define XOSC_STATUS_BADWRITE_BITS _u(0x01000000)
|
||||
#define XOSC_STATUS_BADWRITE_MSB _u(24)
|
||||
#define XOSC_STATUS_BADWRITE_LSB _u(24)
|
||||
#define XOSC_STATUS_BADWRITE_ACCESS "WC"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : XOSC_STATUS_ENABLED
|
||||
// Description : Oscillator is enabled but not necessarily running and stable,
|
||||
// resets to 0
|
||||
#define XOSC_STATUS_ENABLED_RESET "-"
|
||||
#define XOSC_STATUS_ENABLED_BITS _u(0x00001000)
|
||||
#define XOSC_STATUS_ENABLED_MSB _u(12)
|
||||
#define XOSC_STATUS_ENABLED_LSB _u(12)
|
||||
#define XOSC_STATUS_ENABLED_ACCESS "RO"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : XOSC_STATUS_FREQ_RANGE
|
||||
// Description : The current frequency range setting, always reads 0
|
||||
// 0x0 -> 1_15MHZ
|
||||
// 0x1 -> RESERVED_1
|
||||
// 0x2 -> RESERVED_2
|
||||
// 0x3 -> RESERVED_3
|
||||
#define XOSC_STATUS_FREQ_RANGE_RESET "-"
|
||||
#define XOSC_STATUS_FREQ_RANGE_BITS _u(0x00000003)
|
||||
#define XOSC_STATUS_FREQ_RANGE_MSB _u(1)
|
||||
#define XOSC_STATUS_FREQ_RANGE_LSB _u(0)
|
||||
#define XOSC_STATUS_FREQ_RANGE_ACCESS "RO"
|
||||
#define XOSC_STATUS_FREQ_RANGE_VALUE_1_15MHZ _u(0x0)
|
||||
#define XOSC_STATUS_FREQ_RANGE_VALUE_RESERVED_1 _u(0x1)
|
||||
#define XOSC_STATUS_FREQ_RANGE_VALUE_RESERVED_2 _u(0x2)
|
||||
#define XOSC_STATUS_FREQ_RANGE_VALUE_RESERVED_3 _u(0x3)
|
||||
// =============================================================================
|
||||
// Register : XOSC_DORMANT
|
||||
// Description : Crystal Oscillator pause control
|
||||
// This is used to save power by pausing the XOSC
|
||||
// On power-up this field is initialised to WAKE
|
||||
// An invalid write will also select WAKE
|
||||
// WARNING: stop the PLLs before selecting dormant mode
|
||||
// WARNING: setup the irq before selecting dormant mode
|
||||
// 0x636f6d61 -> DORMANT
|
||||
// 0x77616b65 -> WAKE
|
||||
#define XOSC_DORMANT_OFFSET _u(0x00000008)
|
||||
#define XOSC_DORMANT_BITS _u(0xffffffff)
|
||||
#define XOSC_DORMANT_RESET "-"
|
||||
#define XOSC_DORMANT_MSB _u(31)
|
||||
#define XOSC_DORMANT_LSB _u(0)
|
||||
#define XOSC_DORMANT_ACCESS "RW"
|
||||
#define XOSC_DORMANT_VALUE_DORMANT _u(0x636f6d61)
|
||||
#define XOSC_DORMANT_VALUE_WAKE _u(0x77616b65)
|
||||
// =============================================================================
|
||||
// Register : XOSC_STARTUP
|
||||
// Description : Controls the startup delay
|
||||
#define XOSC_STARTUP_OFFSET _u(0x0000000c)
|
||||
#define XOSC_STARTUP_BITS _u(0x00103fff)
|
||||
#define XOSC_STARTUP_RESET _u(0x00000000)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : XOSC_STARTUP_X4
|
||||
// Description : Multiplies the startup_delay by 4. This is of little value to
|
||||
// the user given that the delay can be programmed directly
|
||||
#define XOSC_STARTUP_X4_RESET "-"
|
||||
#define XOSC_STARTUP_X4_BITS _u(0x00100000)
|
||||
#define XOSC_STARTUP_X4_MSB _u(20)
|
||||
#define XOSC_STARTUP_X4_LSB _u(20)
|
||||
#define XOSC_STARTUP_X4_ACCESS "RW"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Field : XOSC_STARTUP_DELAY
|
||||
// Description : in multiples of 256*xtal_period
|
||||
#define XOSC_STARTUP_DELAY_RESET "-"
|
||||
#define XOSC_STARTUP_DELAY_BITS _u(0x00003fff)
|
||||
#define XOSC_STARTUP_DELAY_MSB _u(13)
|
||||
#define XOSC_STARTUP_DELAY_LSB _u(0)
|
||||
#define XOSC_STARTUP_DELAY_ACCESS "RW"
|
||||
// =============================================================================
|
||||
// Register : XOSC_COUNT
|
||||
// Description : A down counter running at the xosc frequency which counts to
|
||||
// zero and stops.
|
||||
// To start the counter write a non-zero value.
|
||||
// Can be used for short software pauses when setting up time
|
||||
// sensitive hardware.
|
||||
#define XOSC_COUNT_OFFSET _u(0x0000001c)
|
||||
#define XOSC_COUNT_BITS _u(0x000000ff)
|
||||
#define XOSC_COUNT_RESET _u(0x00000000)
|
||||
#define XOSC_COUNT_MSB _u(7)
|
||||
#define XOSC_COUNT_LSB _u(0)
|
||||
#define XOSC_COUNT_ACCESS "RW"
|
||||
// =============================================================================
|
||||
#endif // HARDWARE_REGS_XOSC_DEFINED
|
28
lib/rp2040/hardware/structs/adc.h
Normal file
28
lib/rp2040/hardware/structs/adc.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#ifndef _HARDWARE_STRUCTS_ADC_H
|
||||
#define _HARDWARE_STRUCTS_ADC_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/regs/adc.h"
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 cs;
|
||||
io_rw_32 result;
|
||||
io_rw_32 fcs;
|
||||
io_rw_32 fifo;
|
||||
io_rw_32 div;
|
||||
io_rw_32 intr;
|
||||
io_rw_32 inte;
|
||||
io_rw_32 intf;
|
||||
io_rw_32 ints;
|
||||
} adc_hw_t;
|
||||
|
||||
check_hw_layout(adc_hw_t, ints, ADC_INTS_OFFSET);
|
||||
|
||||
#define adc_hw ((adc_hw_t *const)ADC_BASE)
|
||||
|
||||
#endif
|
48
lib/rp2040/hardware/structs/bus_ctrl.h
Normal file
48
lib/rp2040/hardware/structs/bus_ctrl.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#ifndef _HARDWARE_STRUCTS_BUS_CTRL_H
|
||||
#define _HARDWARE_STRUCTS_BUS_CTRL_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/regs/busctrl.h"
|
||||
|
||||
enum bus_ctrl_perf_counter {
|
||||
arbiter_rom_perf_event_access = 19,
|
||||
arbiter_rom_perf_event_access_contested = 18,
|
||||
arbiter_xip_main_perf_event_access = 17,
|
||||
arbiter_xip_main_perf_event_access_contested = 16,
|
||||
arbiter_sram0_perf_event_access = 15,
|
||||
arbiter_sram0_perf_event_access_contested = 14,
|
||||
arbiter_sram1_perf_event_access = 13,
|
||||
arbiter_sram1_perf_event_access_contested = 12,
|
||||
arbiter_sram2_perf_event_access = 11,
|
||||
arbiter_sram2_perf_event_access_contested = 10,
|
||||
arbiter_sram3_perf_event_access = 9,
|
||||
arbiter_sram3_perf_event_access_contested = 8,
|
||||
arbiter_sram4_perf_event_access = 7,
|
||||
arbiter_sram4_perf_event_access_contested = 6,
|
||||
arbiter_sram5_perf_event_access = 5,
|
||||
arbiter_sram5_perf_event_access_contested = 4,
|
||||
arbiter_fastperi_perf_event_access = 3,
|
||||
arbiter_fastperi_perf_event_access_contested = 2,
|
||||
arbiter_apb_perf_event_access = 1,
|
||||
arbiter_apb_perf_event_access_contested = 0
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 priority;
|
||||
io_ro_32 priority_ack;
|
||||
struct {
|
||||
io_rw_32 value;
|
||||
io_rw_32 sel;
|
||||
} counter[4];
|
||||
} bus_ctrl_hw_t;
|
||||
|
||||
check_hw_layout(bus_ctrl_hw_t, counter[0].value, BUSCTRL_PERFCTR0_OFFSET);
|
||||
|
||||
#define bus_ctrl_hw ((bus_ctrl_hw_t *const)BUSCTRL_BASE)
|
||||
|
||||
#endif
|
72
lib/rp2040/hardware/structs/clocks.h
Normal file
72
lib/rp2040/hardware/structs/clocks.h
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_CLOCKS_H
|
||||
#define _HARDWARE_STRUCTS_CLOCKS_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/platform_defs.h"
|
||||
#include "hardware/regs/clocks.h"
|
||||
|
||||
/*! \brief Enumeration identifying a hardware clock
|
||||
* \ingroup hardware_clocks
|
||||
*/
|
||||
/// \tag::clkenum[]
|
||||
enum clock_index {
|
||||
clk_gpout0 = 0, ///< GPIO Muxing 0
|
||||
clk_gpout1, ///< GPIO Muxing 1
|
||||
clk_gpout2, ///< GPIO Muxing 2
|
||||
clk_gpout3, ///< GPIO Muxing 3
|
||||
clk_ref, ///< Watchdog and timers reference clock
|
||||
clk_sys, ///< Processors, bus fabric, memory, memory mapped registers
|
||||
clk_peri, ///< Peripheral clock for UART and SPI
|
||||
clk_usb, ///< USB clock
|
||||
clk_adc, ///< ADC clock
|
||||
clk_rtc, ///< Real time clock
|
||||
CLK_COUNT
|
||||
};
|
||||
/// \end::clkenum[]
|
||||
|
||||
/// \tag::clock_hw[]
|
||||
typedef struct {
|
||||
io_rw_32 ctrl;
|
||||
io_rw_32 div;
|
||||
io_rw_32 selected;
|
||||
} clock_hw_t;
|
||||
/// \end::clock_hw[]
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 ref_khz;
|
||||
io_rw_32 min_khz;
|
||||
io_rw_32 max_khz;
|
||||
io_rw_32 delay;
|
||||
io_rw_32 interval;
|
||||
io_rw_32 src;
|
||||
io_ro_32 status;
|
||||
io_ro_32 result;
|
||||
} fc_hw_t;
|
||||
|
||||
typedef struct {
|
||||
clock_hw_t clk[CLK_COUNT];
|
||||
struct {
|
||||
io_rw_32 ctrl;
|
||||
io_rw_32 status;
|
||||
} resus;
|
||||
fc_hw_t fc0;
|
||||
io_rw_32 wake_en0;
|
||||
io_rw_32 wake_en1;
|
||||
io_rw_32 sleep_en0;
|
||||
io_rw_32 sleep_en1;
|
||||
io_rw_32 enabled0;
|
||||
io_rw_32 enabled1;
|
||||
io_rw_32 intr;
|
||||
io_rw_32 inte;
|
||||
io_rw_32 intf;
|
||||
io_rw_32 ints;
|
||||
} clocks_hw_t;
|
||||
|
||||
#define clocks_hw ((clocks_hw_t *const)CLOCKS_BASE)
|
||||
#endif
|
64
lib/rp2040/hardware/structs/dma.h
Normal file
64
lib/rp2040/hardware/structs/dma.h
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_DMA_H
|
||||
#define _HARDWARE_STRUCTS_DMA_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/platform_defs.h"
|
||||
#include "hardware/regs/dma.h"
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 read_addr;
|
||||
io_rw_32 write_addr;
|
||||
io_rw_32 transfer_count;
|
||||
io_rw_32 ctrl_trig;
|
||||
io_rw_32 al1_ctrl;
|
||||
io_rw_32 al1_read_addr;
|
||||
io_rw_32 al1_write_addr;
|
||||
io_rw_32 al1_transfer_count_trig;
|
||||
io_rw_32 al2_ctrl;
|
||||
io_rw_32 al2_transfer_count;
|
||||
io_rw_32 al2_read_addr;
|
||||
io_rw_32 al2_write_addr_trig;
|
||||
io_rw_32 al3_ctrl;
|
||||
io_rw_32 al3_write_addr;
|
||||
io_rw_32 al3_transfer_count;
|
||||
io_rw_32 al3_read_addr_trig;
|
||||
} dma_channel_hw_t;
|
||||
|
||||
typedef struct {
|
||||
dma_channel_hw_t ch[NUM_DMA_CHANNELS];
|
||||
uint32_t _pad0[16 * (16 - NUM_DMA_CHANNELS)];
|
||||
io_ro_32 intr;
|
||||
io_rw_32 inte0;
|
||||
io_rw_32 intf0;
|
||||
io_rw_32 ints0;
|
||||
uint32_t _pad1[1];
|
||||
io_rw_32 inte1;
|
||||
io_rw_32 intf1;
|
||||
io_rw_32 ints1;
|
||||
io_rw_32 timer[4];
|
||||
io_wo_32 multi_channel_trigger;
|
||||
io_rw_32 sniff_ctrl;
|
||||
io_rw_32 sniff_data;
|
||||
uint32_t _pad2[1];
|
||||
io_ro_32 fifo_levels;
|
||||
io_wo_32 abort;
|
||||
} dma_hw_t;
|
||||
|
||||
typedef struct {
|
||||
struct dma_debug_hw_channel {
|
||||
io_ro_32 ctrdeq;
|
||||
io_ro_32 tcr;
|
||||
uint32_t pad[14];
|
||||
} ch[NUM_DMA_CHANNELS];
|
||||
} dma_debug_hw_t;
|
||||
|
||||
#define dma_hw ((dma_hw_t *const)DMA_BASE)
|
||||
#define dma_debug_hw ((dma_debug_hw_t *const)(DMA_BASE + DMA_CH0_DBG_CTDREQ_OFFSET))
|
||||
|
||||
#endif
|
134
lib/rp2040/hardware/structs/i2c.h
Normal file
134
lib/rp2040/hardware/structs/i2c.h
Normal file
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_I2C_H
|
||||
#define _HARDWARE_STRUCTS_I2C_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/regs/i2c.h"
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 con;
|
||||
io_rw_32 tar;
|
||||
io_rw_32 sar;
|
||||
uint32_t _pad0;
|
||||
io_rw_32 data_cmd;
|
||||
io_rw_32 ss_scl_hcnt;
|
||||
io_rw_32 ss_scl_lcnt;
|
||||
io_rw_32 fs_scl_hcnt;
|
||||
io_rw_32 fs_scl_lcnt;
|
||||
uint32_t _pad1[2];
|
||||
io_rw_32 intr_stat;
|
||||
io_rw_32 intr_mask;
|
||||
io_rw_32 raw_intr_stat;
|
||||
io_rw_32 rx_tl;
|
||||
io_rw_32 tx_tl;
|
||||
io_rw_32 clr_intr;
|
||||
io_rw_32 clr_rx_under;
|
||||
io_rw_32 clr_rx_over;
|
||||
io_rw_32 clr_tx_over;
|
||||
io_rw_32 clr_rd_req;
|
||||
io_rw_32 clr_tx_abrt;
|
||||
io_rw_32 clr_rx_done;
|
||||
io_rw_32 clr_activity;
|
||||
io_rw_32 clr_stop_det;
|
||||
io_rw_32 clr_start_det;
|
||||
io_rw_32 clr_gen_call;
|
||||
io_rw_32 enable;
|
||||
io_rw_32 status;
|
||||
io_rw_32 txflr;
|
||||
io_rw_32 rxflr;
|
||||
io_rw_32 sda_hold;
|
||||
io_rw_32 tx_abrt_source;
|
||||
io_rw_32 slv_data_nack_only;
|
||||
io_rw_32 dma_cr;
|
||||
io_rw_32 dma_tdlr;
|
||||
io_rw_32 dma_rdlr;
|
||||
io_rw_32 sda_setup;
|
||||
io_rw_32 ack_general_call;
|
||||
io_rw_32 enable_status;
|
||||
io_rw_32 fs_spklen;
|
||||
uint32_t _pad2;
|
||||
io_rw_32 clr_restart_det;
|
||||
} i2c_hw_t;
|
||||
|
||||
#define i2c0_hw ((i2c_hw_t *const)I2C0_BASE)
|
||||
#define i2c1_hw ((i2c_hw_t *const)I2C1_BASE)
|
||||
|
||||
// List of configuration constants for the Synopsys I2C hardware (you may see
|
||||
// references to these in I2C register header; these are *fixed* values,
|
||||
// set at hardware design time):
|
||||
|
||||
// IC_ULTRA_FAST_MODE ................ 0x0
|
||||
// IC_UFM_TBUF_CNT_DEFAULT ........... 0x8
|
||||
// IC_UFM_SCL_LOW_COUNT .............. 0x0008
|
||||
// IC_UFM_SCL_HIGH_COUNT ............. 0x0006
|
||||
// IC_TX_TL .......................... 0x0
|
||||
// IC_TX_CMD_BLOCK ................... 0x1
|
||||
// IC_HAS_DMA ........................ 0x1
|
||||
// IC_HAS_ASYNC_FIFO ................. 0x0
|
||||
// IC_SMBUS_ARP ...................... 0x0
|
||||
// IC_FIRST_DATA_BYTE_STATUS ......... 0x1
|
||||
// IC_INTR_IO ........................ 0x1
|
||||
// IC_MASTER_MODE .................... 0x1
|
||||
// IC_DEFAULT_ACK_GENERAL_CALL ....... 0x1
|
||||
// IC_INTR_POL ....................... 0x1
|
||||
// IC_OPTIONAL_SAR ................... 0x0
|
||||
// IC_DEFAULT_TAR_SLAVE_ADDR ......... 0x055
|
||||
// IC_DEFAULT_SLAVE_ADDR ............. 0x055
|
||||
// IC_DEFAULT_HS_SPKLEN .............. 0x1
|
||||
// IC_FS_SCL_HIGH_COUNT .............. 0x0006
|
||||
// IC_HS_SCL_LOW_COUNT ............... 0x0008
|
||||
// IC_DEVICE_ID_VALUE ................ 0x0
|
||||
// IC_10BITADDR_MASTER ............... 0x0
|
||||
// IC_CLK_FREQ_OPTIMIZATION .......... 0x0
|
||||
// IC_DEFAULT_FS_SPKLEN .............. 0x7
|
||||
// IC_ADD_ENCODED_PARAMS ............. 0x0
|
||||
// IC_DEFAULT_SDA_HOLD ............... 0x000001
|
||||
// IC_DEFAULT_SDA_SETUP .............. 0x64
|
||||
// IC_AVOID_RX_FIFO_FLUSH_ON_TX_ABRT . 0x0
|
||||
// IC_CLOCK_PERIOD ................... 100
|
||||
// IC_EMPTYFIFO_HOLD_MASTER_EN ....... 1
|
||||
// IC_RESTART_EN ..................... 0x1
|
||||
// IC_TX_CMD_BLOCK_DEFAULT ........... 0x0
|
||||
// IC_BUS_CLEAR_FEATURE .............. 0x0
|
||||
// IC_CAP_LOADING .................... 100
|
||||
// IC_FS_SCL_LOW_COUNT ............... 0x000d
|
||||
// APB_DATA_WIDTH .................... 32
|
||||
// IC_SDA_STUCK_TIMEOUT_DEFAULT ...... 0xffffffff
|
||||
// IC_SLV_DATA_NACK_ONLY ............. 0x1
|
||||
// IC_10BITADDR_SLAVE ................ 0x0
|
||||
// IC_CLK_TYPE ....................... 0x0
|
||||
// IC_SMBUS_UDID_MSB ................. 0x0
|
||||
// IC_SMBUS_SUSPEND_ALERT ............ 0x0
|
||||
// IC_HS_SCL_HIGH_COUNT .............. 0x0006
|
||||
// IC_SLV_RESTART_DET_EN ............. 0x1
|
||||
// IC_SMBUS .......................... 0x0
|
||||
// IC_OPTIONAL_SAR_DEFAULT ........... 0x0
|
||||
// IC_PERSISTANT_SLV_ADDR_DEFAULT .... 0x0
|
||||
// IC_USE_COUNTS ..................... 0x0
|
||||
// IC_RX_BUFFER_DEPTH ................ 16
|
||||
// IC_SCL_STUCK_TIMEOUT_DEFAULT ...... 0xffffffff
|
||||
// IC_RX_FULL_HLD_BUS_EN ............. 0x1
|
||||
// IC_SLAVE_DISABLE .................. 0x1
|
||||
// IC_RX_TL .......................... 0x0
|
||||
// IC_DEVICE_ID ...................... 0x0
|
||||
// IC_HC_COUNT_VALUES ................ 0x0
|
||||
// I2C_DYNAMIC_TAR_UPDATE ............ 0
|
||||
// IC_SMBUS_CLK_LOW_MEXT_DEFAULT ..... 0xffffffff
|
||||
// IC_SMBUS_CLK_LOW_SEXT_DEFAULT ..... 0xffffffff
|
||||
// IC_HS_MASTER_CODE ................. 0x1
|
||||
// IC_SMBUS_RST_IDLE_CNT_DEFAULT ..... 0xffff
|
||||
// IC_SMBUS_UDID_LSB_DEFAULT ......... 0xffffffff
|
||||
// IC_SS_SCL_HIGH_COUNT .............. 0x0028
|
||||
// IC_SS_SCL_LOW_COUNT ............... 0x002f
|
||||
// IC_MAX_SPEED_MODE ................. 0x2
|
||||
// IC_STAT_FOR_CLK_STRETCH ........... 0x0
|
||||
// IC_STOP_DET_IF_MASTER_ACTIVE ...... 0x0
|
||||
// IC_DEFAULT_UFM_SPKLEN ............. 0x1
|
||||
// IC_TX_BUFFER_DEPTH ................ 16
|
||||
|
||||
#endif
|
28
lib/rp2040/hardware/structs/interp.h
Normal file
28
lib/rp2040/hardware/structs/interp.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_INTERP_H
|
||||
#define _HARDWARE_STRUCTS_INTERP_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/platform_defs.h"
|
||||
#include "hardware/regs/sio.h"
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 accum[2];
|
||||
io_rw_32 base[3];
|
||||
io_ro_32 pop[3];
|
||||
io_ro_32 peek[3];
|
||||
io_rw_32 ctrl[2];
|
||||
io_rw_32 add_raw[2];
|
||||
io_wo_32 base01;
|
||||
} interp_hw_t;
|
||||
|
||||
#define interp_hw_array ((interp_hw_t *)(SIO_BASE + SIO_INTERP0_ACCUM0_OFFSET))
|
||||
#define interp0_hw (&interp_hw_array[0])
|
||||
#define interp1_hw (&interp_hw_array[1])
|
||||
|
||||
#endif
|
35
lib/rp2040/hardware/structs/iobank0.h
Normal file
35
lib/rp2040/hardware/structs/iobank0.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_IOBANK0_H
|
||||
#define _HARDWARE_STRUCTS_IOBANK0_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/platform_defs.h"
|
||||
#include "hardware/regs/io_bank0.h"
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 inte[4];
|
||||
io_rw_32 intf[4];
|
||||
io_rw_32 ints[4];
|
||||
} io_irq_ctrl_hw_t;
|
||||
|
||||
/// \tag::iobank0_hw[]
|
||||
typedef struct {
|
||||
struct {
|
||||
io_rw_32 status;
|
||||
io_rw_32 ctrl;
|
||||
} io[30];
|
||||
io_rw_32 intr[4];
|
||||
io_irq_ctrl_hw_t proc0_irq_ctrl;
|
||||
io_irq_ctrl_hw_t proc1_irq_ctrl;
|
||||
io_irq_ctrl_hw_t dormant_wake_irq_ctrl;
|
||||
} iobank0_hw_t;
|
||||
/// \end::iobank0_hw[]
|
||||
|
||||
#define iobank0_hw ((iobank0_hw_t *const)IO_BANK0_BASE)
|
||||
|
||||
#endif
|
23
lib/rp2040/hardware/structs/ioqspi.h
Normal file
23
lib/rp2040/hardware/structs/ioqspi.h
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_IOQSPI_H
|
||||
#define _HARDWARE_STRUCTS_IOQSPI_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/platform_defs.h"
|
||||
#include "hardware/regs/io_qspi.h"
|
||||
|
||||
typedef struct {
|
||||
struct {
|
||||
io_rw_32 status;
|
||||
io_rw_32 ctrl;
|
||||
} io[6];
|
||||
} ioqspi_hw_t;
|
||||
|
||||
#define ioqspi_hw ((ioqspi_hw_t *const)IO_QSPI_BASE)
|
||||
|
||||
#endif
|
23
lib/rp2040/hardware/structs/mpu.h
Normal file
23
lib/rp2040/hardware/structs/mpu.h
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_MPU_H
|
||||
#define _HARDWARE_STRUCTS_MPU_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/regs/m0plus.h"
|
||||
|
||||
typedef struct {
|
||||
io_ro_32 type;
|
||||
io_rw_32 ctrl;
|
||||
io_rw_32 rnr;
|
||||
io_rw_32 rbar;
|
||||
io_rw_32 rasr;
|
||||
} mpu_hw_t;
|
||||
|
||||
#define mpu_hw ((mpu_hw_t *const)(PPB_BASE + M0PLUS_MPU_TYPE_OFFSET))
|
||||
|
||||
#endif
|
21
lib/rp2040/hardware/structs/pads_qspi.h
Normal file
21
lib/rp2040/hardware/structs/pads_qspi.h
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_PADS_QSPI_H
|
||||
#define _HARDWARE_STRUCTS_PADS_QSPI_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/platform_defs.h"
|
||||
#include "hardware/regs/pads_qspi.h"
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 voltage_select;
|
||||
io_rw_32 io[6];
|
||||
} pads_qspi_hw_t;
|
||||
|
||||
#define pads_qspi_hw ((pads_qspi_hw_t *const)PADS_QSPI_BASE)
|
||||
|
||||
#endif
|
21
lib/rp2040/hardware/structs/padsbank0.h
Normal file
21
lib/rp2040/hardware/structs/padsbank0.h
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_PADSBANK0_H
|
||||
#define _HARDWARE_STRUCTS_PADSBANK0_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/platform_defs.h"
|
||||
#include "hardware/regs/pads_bank0.h"
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 voltage_select;
|
||||
io_rw_32 io[30];
|
||||
} padsbank0_hw_t;
|
||||
|
||||
#define padsbank0_hw ((padsbank0_hw_t *)PADS_BANK0_BASE)
|
||||
|
||||
#endif
|
48
lib/rp2040/hardware/structs/pio.h
Normal file
48
lib/rp2040/hardware/structs/pio.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_PIO_H
|
||||
#define _HARDWARE_STRUCTS_PIO_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/platform_defs.h"
|
||||
#include "hardware/regs/pio.h"
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 ctrl;
|
||||
io_ro_32 fstat;
|
||||
io_rw_32 fdebug;
|
||||
io_ro_32 flevel;
|
||||
io_wo_32 txf[NUM_PIO_STATE_MACHINES];
|
||||
io_ro_32 rxf[NUM_PIO_STATE_MACHINES];
|
||||
io_rw_32 irq;
|
||||
io_wo_32 irq_force;
|
||||
io_rw_32 input_sync_bypass;
|
||||
io_rw_32 dbg_padout;
|
||||
io_rw_32 dbg_padoe;
|
||||
io_rw_32 dbg_cfginfo;
|
||||
io_wo_32 instr_mem[32];
|
||||
struct pio_sm_hw {
|
||||
io_rw_32 clkdiv;
|
||||
io_rw_32 execctrl;
|
||||
io_rw_32 shiftctrl;
|
||||
io_ro_32 addr;
|
||||
io_rw_32 instr;
|
||||
io_rw_32 pinctrl;
|
||||
} sm[NUM_PIO_STATE_MACHINES];
|
||||
io_rw_32 intr;
|
||||
io_rw_32 inte0;
|
||||
io_rw_32 intf0;
|
||||
io_ro_32 ints0;
|
||||
io_rw_32 inte1;
|
||||
io_rw_32 intf1;
|
||||
io_ro_32 ints1;
|
||||
} pio_hw_t;
|
||||
|
||||
#define pio0_hw ((pio_hw_t *const)PIO0_BASE)
|
||||
#define pio1_hw ((pio_hw_t *const)PIO1_BASE)
|
||||
|
||||
#endif
|
25
lib/rp2040/hardware/structs/pll.h
Normal file
25
lib/rp2040/hardware/structs/pll.h
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_PLL_H
|
||||
#define _HARDWARE_STRUCTS_PLL_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/regs/pll.h"
|
||||
|
||||
/// \tag::pll_hw[]
|
||||
typedef struct {
|
||||
io_rw_32 cs;
|
||||
io_rw_32 pwr;
|
||||
io_rw_32 fbdiv_int;
|
||||
io_rw_32 prim;
|
||||
} pll_hw_t;
|
||||
|
||||
#define pll_sys_hw ((pll_hw_t *const)PLL_SYS_BASE)
|
||||
#define pll_usb_hw ((pll_hw_t *const)PLL_USB_BASE)
|
||||
/// \end::pll_hw[]
|
||||
|
||||
#endif
|
23
lib/rp2040/hardware/structs/psm.h
Normal file
23
lib/rp2040/hardware/structs/psm.h
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_PSM_H
|
||||
#define _HARDWARE_STRUCTS_PSM_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/platform_defs.h"
|
||||
#include "hardware/regs/psm.h"
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 frce_on;
|
||||
io_rw_32 frce_off;
|
||||
io_rw_32 wdsel;
|
||||
io_rw_32 done;
|
||||
} psm_hw_t;
|
||||
|
||||
#define psm_hw ((psm_hw_t *const)PSM_BASE)
|
||||
|
||||
#endif
|
33
lib/rp2040/hardware/structs/pwm.h
Normal file
33
lib/rp2040/hardware/structs/pwm.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_PWM_H
|
||||
#define _HARDWARE_STRUCTS_PWM_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/platform_defs.h"
|
||||
#include "hardware/regs/pwm.h"
|
||||
|
||||
typedef struct pwm_slice_hw {
|
||||
io_rw_32 csr;
|
||||
io_rw_32 div;
|
||||
io_rw_32 ctr;
|
||||
io_rw_32 cc;
|
||||
io_rw_32 top;
|
||||
} pwm_slice_hw_t;
|
||||
|
||||
typedef struct {
|
||||
pwm_slice_hw_t slice[NUM_PWM_SLICES];
|
||||
io_rw_32 en;
|
||||
io_rw_32 intr;
|
||||
io_rw_32 inte;
|
||||
io_rw_32 intf;
|
||||
io_rw_32 ints;
|
||||
} pwm_hw_t;
|
||||
|
||||
#define pwm_hw ((pwm_hw_t *const)PWM_BASE)
|
||||
|
||||
#endif
|
22
lib/rp2040/hardware/structs/resets.h
Normal file
22
lib/rp2040/hardware/structs/resets.h
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#ifndef _HARDWARE_STRUCTS_RESETS_H
|
||||
#define _HARDWARE_STRUCTS_RESETS_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/regs/resets.h"
|
||||
|
||||
/// \tag::resets_hw[]
|
||||
typedef struct {
|
||||
io_rw_32 reset;
|
||||
io_rw_32 wdsel;
|
||||
io_rw_32 reset_done;
|
||||
} resets_hw_t;
|
||||
|
||||
#define resets_hw ((resets_hw_t *const)RESETS_BASE)
|
||||
/// \end::resets_hw[]
|
||||
|
||||
#endif
|
29
lib/rp2040/hardware/structs/rosc.h
Normal file
29
lib/rp2040/hardware/structs/rosc.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_ROSC_H
|
||||
#define _HARDWARE_STRUCTS_ROSC_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/platform_defs.h"
|
||||
#include "hardware/regs/rosc.h"
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 ctrl;
|
||||
io_rw_32 freqa;
|
||||
io_rw_32 freqb;
|
||||
io_rw_32 dormant;
|
||||
io_rw_32 div;
|
||||
io_rw_32 phase;
|
||||
io_rw_32 status;
|
||||
io_rw_32 randombit;
|
||||
io_rw_32 count;
|
||||
io_rw_32 dftx;
|
||||
} rosc_hw_t;
|
||||
|
||||
#define rosc_hw ((rosc_hw_t *const)ROSC_BASE)
|
||||
|
||||
#endif
|
31
lib/rp2040/hardware/structs/rtc.h
Normal file
31
lib/rp2040/hardware/structs/rtc.h
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_RTC_H
|
||||
#define _HARDWARE_STRUCTS_RTC_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/platform_defs.h"
|
||||
#include "hardware/regs/rtc.h"
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 clkdiv_m1;
|
||||
io_rw_32 setup_0;
|
||||
io_rw_32 setup_1;
|
||||
io_rw_32 ctrl;
|
||||
io_rw_32 irq_setup_0;
|
||||
io_rw_32 irq_setup_1;
|
||||
io_rw_32 rtc_1;
|
||||
io_rw_32 rtc_0;
|
||||
io_rw_32 intr;
|
||||
io_rw_32 inte;
|
||||
io_rw_32 intf;
|
||||
io_rw_32 ints;
|
||||
} rtc_hw_t;
|
||||
|
||||
#define rtc_hw ((rtc_hw_t *const)RTC_BASE)
|
||||
|
||||
#endif
|
24
lib/rp2040/hardware/structs/scb.h
Normal file
24
lib/rp2040/hardware/structs/scb.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#ifndef _HARDWARE_STRUCTS_SCB_H
|
||||
#define _HARDWARE_STRUCTS_SCB_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/regs/m0plus.h"
|
||||
|
||||
// SCB == System Control Block
|
||||
typedef struct {
|
||||
io_ro_32 cpuid;
|
||||
io_rw_32 icsr;
|
||||
io_rw_32 vtor;
|
||||
io_rw_32 aircr;
|
||||
io_rw_32 scr;
|
||||
// ...
|
||||
} armv6m_scb_t;
|
||||
|
||||
#define scb_hw ((armv6m_scb_t *const)(PPB_BASE + M0PLUS_CPUID_OFFSET))
|
||||
|
||||
#endif
|
61
lib/rp2040/hardware/structs/sio.h
Normal file
61
lib/rp2040/hardware/structs/sio.h
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_SIO_H
|
||||
#define _HARDWARE_STRUCTS_SIO_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/regs/sio.h"
|
||||
#include "hardware/structs/interp.h"
|
||||
|
||||
typedef struct {
|
||||
io_ro_32 cpuid;
|
||||
io_ro_32 gpio_in;
|
||||
io_ro_32 gpio_hi_in;
|
||||
uint32_t _pad;
|
||||
|
||||
io_rw_32 gpio_out;
|
||||
io_wo_32 gpio_set;
|
||||
io_wo_32 gpio_clr;
|
||||
io_wo_32 gpio_togl;
|
||||
|
||||
io_wo_32 gpio_oe;
|
||||
io_wo_32 gpio_oe_set;
|
||||
io_wo_32 gpio_oe_clr;
|
||||
io_wo_32 gpio_oe_togl;
|
||||
|
||||
io_rw_32 gpio_hi_out;
|
||||
io_wo_32 gpio_hi_set;
|
||||
io_wo_32 gpio_hi_clr;
|
||||
io_wo_32 gpio_hi_togl;
|
||||
|
||||
io_wo_32 gpio_hi_oe;
|
||||
io_wo_32 gpio_hi_oe_set;
|
||||
io_wo_32 gpio_hi_oe_clr;
|
||||
io_wo_32 gpio_hi_oe_togl;
|
||||
|
||||
io_rw_32 fifo_st;
|
||||
io_wo_32 fifo_wr;
|
||||
io_ro_32 fifo_rd;
|
||||
io_ro_32 spinlock_st;
|
||||
|
||||
io_rw_32 div_udividend;
|
||||
io_rw_32 div_udivisor;
|
||||
io_rw_32 div_sdividend;
|
||||
io_rw_32 div_sdivisor;
|
||||
|
||||
io_rw_32 div_quotient;
|
||||
io_rw_32 div_remainder;
|
||||
io_rw_32 div_csr;
|
||||
|
||||
uint32_t _pad2;
|
||||
|
||||
interp_hw_t interp[2];
|
||||
} sio_hw_t;
|
||||
|
||||
#define sio_hw ((sio_hw_t *)SIO_BASE)
|
||||
|
||||
#endif
|
29
lib/rp2040/hardware/structs/spi.h
Normal file
29
lib/rp2040/hardware/structs/spi.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_SPI_H
|
||||
#define _HARDWARE_STRUCTS_SPI_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/regs/spi.h"
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 cr0;
|
||||
io_rw_32 cr1;
|
||||
io_rw_32 dr;
|
||||
io_rw_32 sr;
|
||||
io_rw_32 cpsr;
|
||||
io_rw_32 imsc;
|
||||
io_rw_32 ris;
|
||||
io_rw_32 mis;
|
||||
io_rw_32 icr;
|
||||
io_rw_32 dmacr;
|
||||
} spi_hw_t;
|
||||
|
||||
#define spi0_hw ((spi_hw_t *const)SPI0_BASE)
|
||||
#define spi1_hw ((spi_hw_t *const)SPI1_BASE)
|
||||
|
||||
#endif
|
47
lib/rp2040/hardware/structs/ssi.h
Normal file
47
lib/rp2040/hardware/structs/ssi.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_SSI_H
|
||||
#define _HARDWARE_STRUCTS_SSI_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/platform_defs.h"
|
||||
#include "hardware/regs/ssi.h"
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 ctrlr0;
|
||||
io_rw_32 ctrlr1;
|
||||
io_rw_32 ssienr;
|
||||
io_rw_32 mwcr;
|
||||
io_rw_32 ser;
|
||||
io_rw_32 baudr;
|
||||
io_rw_32 txftlr;
|
||||
io_rw_32 rxftlr;
|
||||
io_rw_32 txflr;
|
||||
io_rw_32 rxflr;
|
||||
io_rw_32 sr;
|
||||
io_rw_32 imr;
|
||||
io_rw_32 isr;
|
||||
io_rw_32 risr;
|
||||
io_rw_32 txoicr;
|
||||
io_rw_32 rxoicr;
|
||||
io_rw_32 rxuicr;
|
||||
io_rw_32 msticr;
|
||||
io_rw_32 icr;
|
||||
io_rw_32 dmacr;
|
||||
io_rw_32 dmatdlr;
|
||||
io_rw_32 dmardlr;
|
||||
io_rw_32 idr;
|
||||
io_rw_32 ssi_version_id;
|
||||
io_rw_32 dr0;
|
||||
uint32_t _pad[(0xf0 - 0x60) / 4 - 1];
|
||||
io_rw_32 rx_sample_dly;
|
||||
io_rw_32 spi_ctrlr0;
|
||||
io_rw_32 txd_drive_edge;
|
||||
} ssi_hw_t;
|
||||
|
||||
#define ssi_hw ((ssi_hw_t *const)XIP_SSI_BASE)
|
||||
#endif
|
26
lib/rp2040/hardware/structs/syscfg.h
Normal file
26
lib/rp2040/hardware/structs/syscfg.h
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_SYSCFG_H
|
||||
#define _HARDWARE_STRUCTS_SYSCFG_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/platform_defs.h"
|
||||
#include "hardware/regs/syscfg.h"
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 proc0_nmi_mask;
|
||||
io_rw_32 proc1_nmi_mask;
|
||||
io_rw_32 proc_config;
|
||||
io_rw_32 proc_in_sync_bypass;
|
||||
io_rw_32 proc_in_sync_bypass_hi;
|
||||
io_rw_32 dbgforce;
|
||||
io_rw_32 mempowerdown;
|
||||
} syscfg_hw_t;
|
||||
|
||||
#define syscfg_hw ((syscfg_hw_t *const)SYSCFG_BASE)
|
||||
|
||||
#endif
|
22
lib/rp2040/hardware/structs/systick.h
Normal file
22
lib/rp2040/hardware/structs/systick.h
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_SYSTICK_H
|
||||
#define _HARDWARE_STRUCTS_SYSTICK_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/regs/m0plus.h"
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 csr;
|
||||
io_rw_32 rvr;
|
||||
io_rw_32 cvr;
|
||||
io_ro_32 calib;
|
||||
} systick_hw_t;
|
||||
|
||||
#define systick_hw ((systick_hw_t *const)(PPB_BASE + M0PLUS_SYST_CSR_OFFSET))
|
||||
|
||||
#endif
|
35
lib/rp2040/hardware/structs/timer.h
Normal file
35
lib/rp2040/hardware/structs/timer.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_TIMER_H
|
||||
#define _HARDWARE_STRUCTS_TIMER_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/platform_defs.h"
|
||||
#include "hardware/regs/timer.h"
|
||||
|
||||
#define NUM_TIMERS 4
|
||||
|
||||
typedef struct {
|
||||
io_wo_32 timehw;
|
||||
io_wo_32 timelw;
|
||||
io_ro_32 timehr;
|
||||
io_ro_32 timelr;
|
||||
io_rw_32 alarm[NUM_TIMERS];
|
||||
io_rw_32 armed;
|
||||
io_ro_32 timerawh;
|
||||
io_ro_32 timerawl;
|
||||
io_rw_32 dbgpause;
|
||||
io_rw_32 pause;
|
||||
io_rw_32 intr;
|
||||
io_rw_32 inte;
|
||||
io_rw_32 intf;
|
||||
io_ro_32 ints;
|
||||
} timer_hw_t;
|
||||
|
||||
#define timer_hw ((timer_hw_t *const)TIMER_BASE)
|
||||
|
||||
#endif
|
35
lib/rp2040/hardware/structs/uart.h
Normal file
35
lib/rp2040/hardware/structs/uart.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_UART_H
|
||||
#define _HARDWARE_STRUCTS_UART_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/regs/uart.h"
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 dr;
|
||||
io_rw_32 rsr;
|
||||
uint32_t _pad0[4];
|
||||
io_rw_32 fr;
|
||||
uint32_t _pad1;
|
||||
io_rw_32 ilpr;
|
||||
io_rw_32 ibrd;
|
||||
io_rw_32 fbrd;
|
||||
io_rw_32 lcr_h;
|
||||
io_rw_32 cr;
|
||||
io_rw_32 ifls;
|
||||
io_rw_32 imsc;
|
||||
io_rw_32 ris;
|
||||
io_rw_32 mis;
|
||||
io_rw_32 icr;
|
||||
io_rw_32 dmacr;
|
||||
} uart_hw_t;
|
||||
|
||||
#define uart0_hw ((uart_hw_t *const)UART0_BASE)
|
||||
#define uart1_hw ((uart_hw_t *const)UART1_BASE)
|
||||
|
||||
#endif
|
149
lib/rp2040/hardware/structs/usb.h
Normal file
149
lib/rp2040/hardware/structs/usb.h
Normal file
@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_USB_H
|
||||
#define _HARDWARE_STRUCTS_USB_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/regs/usb.h"
|
||||
|
||||
// 0-15
|
||||
#define USB_NUM_ENDPOINTS 16
|
||||
|
||||
// allow user to restrict number of endpoints available to save RAN
|
||||
#ifndef USB_MAX_ENDPOINTS
|
||||
#define USB_MAX_ENDPOINTS USB_NUM_ENDPOINTS
|
||||
#endif
|
||||
|
||||
// 1-15
|
||||
#define USB_HOST_INTERRUPT_ENDPOINTS (USB_NUM_ENDPOINTS - 1)
|
||||
|
||||
// Endpoint buffer control bits
|
||||
#define USB_BUF_CTRL_FULL 0x00008000u
|
||||
#define USB_BUF_CTRL_LAST 0x00004000u
|
||||
#define USB_BUF_CTRL_DATA0_PID 0x00000000u
|
||||
#define USB_BUF_CTRL_DATA1_PID 0x00002000u
|
||||
#define USB_BUF_CTRL_SEL 0x00001000u
|
||||
#define USB_BUF_CTRL_STALL 0x00000800u
|
||||
#define USB_BUF_CTRL_AVAIL 0x00000400u
|
||||
#define USB_BUF_CTRL_LEN_MASK 0x000003FFu
|
||||
#define USB_BUF_CTRL_LEN_LSB 0
|
||||
|
||||
// ep_inout_ctrl bits
|
||||
#define EP_CTRL_ENABLE_BITS (1u << 31u)
|
||||
#define EP_CTRL_DOUBLE_BUFFERED_BITS (1u << 30)
|
||||
#define EP_CTRL_INTERRUPT_PER_BUFFER (1u << 29)
|
||||
#define EP_CTRL_INTERRUPT_PER_DOUBLE_BUFFER (1u << 28)
|
||||
#define EP_CTRL_INTERRUPT_ON_NAK (1u << 16)
|
||||
#define EP_CTRL_INTERRUPT_ON_STALL (1u << 17)
|
||||
#define EP_CTRL_BUFFER_TYPE_LSB 26
|
||||
#define EP_CTRL_HOST_INTERRUPT_INTERVAL_LSB 16
|
||||
|
||||
#define USB_DPRAM_SIZE 4096
|
||||
|
||||
// PICO_CONFIG: USB_DPRAM_MAX, Set amount of USB RAM used by USB system, min=0, max=4096, default=4096, group=hardware_usb
|
||||
// Allow user to claim some of the USB RAM for themselves
|
||||
#ifndef USB_DPRAM_MAX
|
||||
#define USB_DPRAM_MAX USB_DPRAM_SIZE
|
||||
#endif
|
||||
|
||||
// Define maximum packet sizes
|
||||
#define USB_MAX_ISO_PACKET_SIZE 1023
|
||||
#define USB_MAX_PACKET_SIZE 64
|
||||
|
||||
typedef struct {
|
||||
// 4K of DPSRAM at beginning. Note this supports 8, 16, and 32 bit accesses
|
||||
volatile uint8_t setup_packet[8]; // First 8 bytes are always for setup packets
|
||||
|
||||
// Starts at ep1
|
||||
struct usb_device_dpram_ep_ctrl {
|
||||
io_rw_32 in;
|
||||
io_rw_32 out;
|
||||
} ep_ctrl[USB_NUM_ENDPOINTS - 1];
|
||||
|
||||
// Starts at ep0
|
||||
struct usb_device_dpram_ep_buf_ctrl {
|
||||
io_rw_32 in;
|
||||
io_rw_32 out;
|
||||
} ep_buf_ctrl[USB_NUM_ENDPOINTS];
|
||||
|
||||
// EP0 buffers are fixed. Assumes single buffered mode for EP0
|
||||
uint8_t ep0_buf_a[0x40];
|
||||
uint8_t ep0_buf_b[0x40];
|
||||
|
||||
// Rest of DPRAM can be carved up as needed
|
||||
uint8_t epx_data[USB_DPRAM_MAX - 0x180];
|
||||
} usb_device_dpram_t;
|
||||
|
||||
static_assert(sizeof(usb_device_dpram_t) == USB_DPRAM_MAX, "");
|
||||
static_assert(offsetof(usb_device_dpram_t, epx_data) == 0x180, "");
|
||||
|
||||
typedef struct {
|
||||
// 4K of DPSRAM at beginning. Note this supports 8, 16, and 32 bit accesses
|
||||
volatile uint8_t setup_packet[8]; // First 8 bytes are always for setup packets
|
||||
|
||||
// Interrupt endpoint control 1 -> 15
|
||||
struct usb_host_dpram_ep_ctrl {
|
||||
io_rw_32 ctrl;
|
||||
io_rw_32 spare;
|
||||
} int_ep_ctrl[USB_HOST_INTERRUPT_ENDPOINTS];
|
||||
|
||||
io_rw_32 epx_buf_ctrl;
|
||||
io_rw_32 _spare0;
|
||||
|
||||
// Interrupt endpoint buffer control
|
||||
struct usb_host_dpram_ep_buf_ctrl {
|
||||
io_rw_32 ctrl;
|
||||
io_rw_32 spare;
|
||||
} int_ep_buffer_ctrl[USB_HOST_INTERRUPT_ENDPOINTS];
|
||||
|
||||
io_rw_32 epx_ctrl;
|
||||
|
||||
uint8_t _spare1[124];
|
||||
|
||||
// Should start at 0x180
|
||||
uint8_t epx_data[USB_DPRAM_MAX - 0x180];
|
||||
} usb_host_dpram_t;
|
||||
|
||||
static_assert(sizeof(usb_host_dpram_t) == USB_DPRAM_MAX, "");
|
||||
static_assert(offsetof(usb_host_dpram_t, epx_data) == 0x180, "");
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 dev_addr_ctrl;
|
||||
io_rw_32 int_ep_addr_ctrl[USB_HOST_INTERRUPT_ENDPOINTS];
|
||||
io_rw_32 main_ctrl;
|
||||
io_rw_32 sof_rw;
|
||||
io_ro_32 sof_rd;
|
||||
io_rw_32 sie_ctrl;
|
||||
io_rw_32 sie_status;
|
||||
io_rw_32 int_ep_ctrl;
|
||||
io_rw_32 buf_status;
|
||||
io_rw_32 buf_cpu_should_handle; // for double buff
|
||||
io_rw_32 abort;
|
||||
io_rw_32 abort_done;
|
||||
io_rw_32 ep_stall_arm;
|
||||
io_rw_32 nak_poll;
|
||||
io_rw_32 ep_nak_stall_status;
|
||||
io_rw_32 muxing;
|
||||
io_rw_32 pwr;
|
||||
io_rw_32 phy_direct;
|
||||
io_rw_32 phy_direct_override;
|
||||
io_rw_32 phy_trim;
|
||||
io_rw_32 linestate_tuning;
|
||||
io_rw_32 intr;
|
||||
io_rw_32 inte;
|
||||
io_rw_32 intf;
|
||||
io_rw_32 ints;
|
||||
} usb_hw_t;
|
||||
|
||||
check_hw_layout(usb_hw_t, ints, USB_INTS_OFFSET);
|
||||
|
||||
#define usb_hw ((usb_hw_t *)USBCTRL_REGS_BASE)
|
||||
|
||||
#define usb_dpram ((usb_device_dpram_t *)USBCTRL_DPRAM_BASE)
|
||||
#define usbh_dpram ((usb_host_dpram_t *)USBCTRL_DPRAM_BASE)
|
||||
|
||||
#endif
|
22
lib/rp2040/hardware/structs/vreg_and_chip_reset.h
Normal file
22
lib/rp2040/hardware/structs/vreg_and_chip_reset.h
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_VREG_AND_CHIP_RESET_H
|
||||
#define _HARDWARE_STRUCTS_VREG_AND_CHIP_RESET_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/platform_defs.h"
|
||||
#include "hardware/regs/vreg_and_chip_reset.h"
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 vreg;
|
||||
io_rw_32 bod;
|
||||
io_rw_32 chip_reset;
|
||||
} vreg_and_chip_reset_hw_t;
|
||||
|
||||
#define vreg_and_chip_reset_hw ((vreg_and_chip_reset_hw_t *const)VREG_AND_CHIP_RESET_BASE)
|
||||
|
||||
#endif
|
24
lib/rp2040/hardware/structs/watchdog.h
Normal file
24
lib/rp2040/hardware/structs/watchdog.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_WATCHDOG_H
|
||||
#define _HARDWARE_STRUCTS_WATCHDOG_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/platform_defs.h"
|
||||
#include "hardware/regs/watchdog.h"
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 ctrl;
|
||||
io_wo_32 load;
|
||||
io_ro_32 reason;
|
||||
io_rw_32 scratch[8];
|
||||
io_rw_32 tick;
|
||||
} watchdog_hw_t;
|
||||
|
||||
#define watchdog_hw ((watchdog_hw_t *const)WATCHDOG_BASE)
|
||||
|
||||
#endif
|
29
lib/rp2040/hardware/structs/xip_ctrl.h
Normal file
29
lib/rp2040/hardware/structs/xip_ctrl.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#ifndef _HARDWARE_STRUCTS_XIP_CTRL_H
|
||||
#define _HARDWARE_STRUCTS_XIP_CTRL_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/regs/xip.h"
|
||||
|
||||
typedef struct {
|
||||
io_rw_32 ctrl;
|
||||
io_rw_32 flush;
|
||||
io_rw_32 stat;
|
||||
io_rw_32 ctr_hit;
|
||||
io_rw_32 ctr_acc;
|
||||
io_rw_32 stream_addr;
|
||||
io_rw_32 stream_ctr;
|
||||
io_rw_32 stream_fifo;
|
||||
} xip_ctrl_hw_t;
|
||||
|
||||
#define XIP_STAT_FIFO_FULL 0x4u
|
||||
#define XIP_STAT_FIFO_EMPTY 0x2u
|
||||
#define XIP_STAT_FLUSH_RDY 0x1u
|
||||
|
||||
#define xip_ctrl_hw ((xip_ctrl_hw_t *const)XIP_CTRL_BASE)
|
||||
|
||||
#endif
|
27
lib/rp2040/hardware/structs/xosc.h
Normal file
27
lib/rp2040/hardware/structs/xosc.h
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_STRUCTS_XOSC_H
|
||||
#define _HARDWARE_STRUCTS_XOSC_H
|
||||
|
||||
#include "hardware/address_mapped.h"
|
||||
#include "hardware/platform_defs.h"
|
||||
#include "hardware/regs/xosc.h"
|
||||
|
||||
/// \tag::xosc_hw[]
|
||||
typedef struct {
|
||||
io_rw_32 ctrl;
|
||||
io_rw_32 status;
|
||||
io_rw_32 dormant;
|
||||
io_rw_32 startup;
|
||||
io_rw_32 _reserved[3];
|
||||
io_rw_32 count;
|
||||
} xosc_hw_t;
|
||||
|
||||
#define xosc_hw ((xosc_hw_t *const)XOSC_BASE)
|
||||
/// \end::xosc_hw[]
|
||||
|
||||
#endif
|
139
lib/rp2040/pico/platform.h
Normal file
139
lib/rp2040/pico/platform.h
Normal file
@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _PICO_PLATFORM_H_
|
||||
#define _PICO_PLATFORM_H_
|
||||
|
||||
#include "hardware/platform_defs.h"
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __unix__
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define __not_in_flash(grup)
|
||||
#define __not_in_flash_func(func) func
|
||||
#define __no_inline_not_in_flash_func(func)
|
||||
#define __in_flash(group)
|
||||
#define __scratch_x(group)
|
||||
#define __scratch_y(group)
|
||||
|
||||
#define __packed_aligned
|
||||
#define __packed
|
||||
|
||||
#define __time_critical_func(x) x
|
||||
#define __after_data(group)
|
||||
|
||||
//int running_on_fpga() { return false; }
|
||||
extern void tight_loop_contents();
|
||||
|
||||
#ifndef __STRING
|
||||
#define __STRING(x) #x
|
||||
#endif
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#ifndef __noreturn
|
||||
#define __noreturn __attribute((noreturn))
|
||||
#endif
|
||||
|
||||
#ifndef __unused
|
||||
#define __unused __attribute__((unused))
|
||||
#endif
|
||||
|
||||
#ifndef __noinline
|
||||
#define __noinline __attribute__((noinline))
|
||||
#endif
|
||||
|
||||
#ifndef __aligned
|
||||
#define __aligned(x) __attribute__((aligned(x)))
|
||||
#endif
|
||||
|
||||
#define PICO_WEAK_FUNCTION_DEF(x) _Pragma(__STRING(weak x))
|
||||
#define PICO_WEAK_FUNCTION_IMPL_NAME(x) x
|
||||
|
||||
#else
|
||||
#ifndef __noreturn
|
||||
#define __noreturn __declspec(noreturn)
|
||||
#endif
|
||||
|
||||
#ifndef __unused
|
||||
#define __unused
|
||||
#endif
|
||||
|
||||
#ifndef __noinline
|
||||
#define __noinline __declspec(noinline)
|
||||
#endif
|
||||
|
||||
#ifndef __aligned
|
||||
#define __aligned(x) __declspec(align(x))
|
||||
#endif
|
||||
|
||||
#ifndef __CONCAT
|
||||
#define __CONCAT(x,y) x ## y
|
||||
#endif
|
||||
|
||||
#define __thread __declspec( thread )
|
||||
|
||||
#define PICO_WEAK_FUNCTION_DEF(x) __pragma(comment(linker, __STRING(/alternatename:_##x=_##x##__weak)));
|
||||
#define PICO_WEAK_FUNCTION_IMPL_NAME(x) x ## __weak
|
||||
|
||||
static __noreturn void __builtin_unreachable() {
|
||||
}
|
||||
|
||||
#include <intrin.h>
|
||||
#define __builtin_clz __lzcnt
|
||||
#endif
|
||||
|
||||
#ifndef count_of
|
||||
#define count_of(a) (sizeof(a)/sizeof((a)[0]))
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a, b) ((a)>(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) ((b)>(a)?(a):(b))
|
||||
#endif
|
||||
|
||||
// abort in our case
|
||||
void __noreturn __breakpoint();
|
||||
|
||||
void __noreturn panic_unsupported();
|
||||
|
||||
void __noreturn panic(const char *fmt, ...);
|
||||
|
||||
// arggggghhhh there is a weak function called sem_init used by SDL
|
||||
#define sem_init sem_init_alternative
|
||||
|
||||
extern uint32_t host_safe_hw_ptr_impl(uintptr_t x);
|
||||
// return a 32 bit handle for a raw ptr; DMA chaining for example embeds pointers in 32 bit values
|
||||
// which of course does not work if we're running the code natively on a 64 bit platforms. Therefore
|
||||
// we provide this macro which allows that code to provide a 64->32 bit mapping in host mode
|
||||
#define host_safe_hw_ptr(x) host_safe_hw_ptr_impl((uintptr_t)(x))
|
||||
void *decode_host_safe_hw_ptr(uint32_t ptr);
|
||||
|
||||
#define __fast_mul(a,b) ((a)*(b))
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
static inline int32_t __mul_instruction(int32_t a,int32_t b)
|
||||
{
|
||||
return a*b;
|
||||
}
|
||||
|
||||
static inline void __compiler_memory_barrier(void) {
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
41
lib/rp2040/rp2040.patch
Normal file
41
lib/rp2040/rp2040.patch
Normal file
@ -0,0 +1,41 @@
|
||||
diff --git a/lib/rp2040/boot_stage2/boot2_generic_03h.S b/lib/rp2040/boot_stage2/boot2_generic_03h.S
|
||||
index a10e66abd..cc7e4fbc7 100644
|
||||
--- a/lib/rp2040/boot_stage2/boot2_generic_03h.S
|
||||
+++ b/lib/rp2040/boot_stage2/boot2_generic_03h.S
|
||||
@@ -16,7 +16,7 @@
|
||||
// 4-byte checksum. Therefore code size cannot exceed 252 bytes.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
-#include "pico/asm_helper.S"
|
||||
+//#include "pico/asm_helper.S"
|
||||
#include "hardware/regs/addressmap.h"
|
||||
#include "hardware/regs/ssi.h"
|
||||
|
||||
diff --git a/lib/rp2040/boot_stage2/boot2_w25q080.S b/lib/rp2040/boot_stage2/boot2_w25q080.S
|
||||
index ad3238e2..8fb3def4 100644
|
||||
--- a/lib/rp2040/boot_stage2/boot2_w25q080.S
|
||||
+++ b/lib/rp2040/boot_stage2/boot2_w25q080.S
|
||||
@@ -26,7 +26,7 @@
|
||||
// 4-byte checksum. Therefore code size cannot exceed 252 bytes.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
-#include "pico/asm_helper.S"
|
||||
+//#include "pico/asm_helper.S"
|
||||
#include "hardware/regs/addressmap.h"
|
||||
#include "hardware/regs/ssi.h"
|
||||
#include "hardware/regs/pads_qspi.h"
|
||||
diff --git a/lib/rp2040/hardware/address_mapped.h b/lib/rp2040/hardware/address_mapped.h
|
||||
index b58f1e50..d651f598 100644
|
||||
--- a/lib/rp2040/hardware/address_mapped.h
|
||||
+++ b/lib/rp2040/hardware/address_mapped.h
|
||||
@@ -7,7 +7,9 @@
|
||||
#ifndef _HARDWARE_ADDRESS_MAPPED_H
|
||||
#define _HARDWARE_ADDRESS_MAPPED_H
|
||||
|
||||
-#include "pico.h"
|
||||
+//#include "pico.h"
|
||||
+#define __force_inline inline
|
||||
+#define static_assert(a,b)
|
||||
#include "hardware/regs/addressmap.h"
|
||||
|
||||
/** \file address_mapped.h
|
20
lib/rp2040_flash/Makefile
Normal file
20
lib/rp2040_flash/Makefile
Normal file
@ -0,0 +1,20 @@
|
||||
CC=gcc
|
||||
CFLAGS=-c -Wall -ggdb
|
||||
LDFALGS=
|
||||
SOURCES=main.c picoboot_connection.c
|
||||
OBJECTS=$(SOURCES:.c=.o)
|
||||
LIBS=`pkg-config libusb-1.0 --libs`
|
||||
INCLUDE_DIRS+=-I../rp2040/ `pkg-config libusb-1.0 --cflags`
|
||||
|
||||
EXECUTABLE=rp2040_flash
|
||||
|
||||
all: $(EXECUTABLE)
|
||||
|
||||
$(EXECUTABLE): $(OBJECTS)
|
||||
$(CC) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $(INCLUDE_DIRS) $< -o $@
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS) $(EXECUTABLE)
|
246
lib/rp2040_flash/main.c
Normal file
246
lib/rp2040_flash/main.c
Normal file
@ -0,0 +1,246 @@
|
||||
// Simple rp2040 picoboot based flash tool for use with Klipper
|
||||
//
|
||||
// Copyright (C) 2022 Lasse Dalegaard <dalegaard@gmail.com>
|
||||
//
|
||||
// This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include "picoboot_connection.h"
|
||||
#include "boot/uf2.h"
|
||||
|
||||
#define FLASH_MAX_SIZE (FLASH_END - FLASH_START)
|
||||
#define FLASH_NUM_WRITE_BLOCKS (FLASH_MAX_SIZE / PAGE_SIZE)
|
||||
#define FLASH_NUM_ERASE_BLOCKS (FLASH_MAX_SIZE / FLASH_SECTOR_ERASE_SIZE)
|
||||
|
||||
struct flash_data {
|
||||
size_t num_blocks;
|
||||
uint8_t flash_data[FLASH_MAX_SIZE];
|
||||
bool write_blocks[FLASH_NUM_WRITE_BLOCKS];
|
||||
bool erase_blocks[FLASH_NUM_ERASE_BLOCKS];
|
||||
};
|
||||
|
||||
int load_flash_data(const char *filename, struct flash_data *target) {
|
||||
int rc = 0;
|
||||
FILE *file = fopen(filename, "rb");
|
||||
if (!file) {
|
||||
fprintf(stderr, "Could not open image file %s\n", filename);
|
||||
rc = errno;
|
||||
goto do_exit;
|
||||
}
|
||||
|
||||
target->num_blocks = 0;
|
||||
memset(target->write_blocks, 0, sizeof(target->write_blocks));
|
||||
memset(target->erase_blocks, 0, sizeof(target->erase_blocks));
|
||||
|
||||
struct uf2_block block;
|
||||
|
||||
while (1) {
|
||||
if(fread(&block, sizeof(struct uf2_block), 1, file) != 1) {
|
||||
if (feof(file)) {
|
||||
break;
|
||||
}
|
||||
fprintf(stderr, "Unexpected EOF reading image\n");
|
||||
rc = errno;
|
||||
goto do_exit;
|
||||
}
|
||||
|
||||
// Check magic numbers
|
||||
if (block.magic_start0 != UF2_MAGIC_START0) continue;
|
||||
if (block.magic_start1 != UF2_MAGIC_START1) continue;
|
||||
if (block.magic_end != UF2_MAGIC_END) continue;
|
||||
|
||||
// Check block is valid for flashing
|
||||
// Always family ID.
|
||||
if (!(block.flags & UF2_FLAG_FAMILY_ID_PRESENT)) continue;
|
||||
if (block.file_size != RP2040_FAMILY_ID) continue;
|
||||
if (block.flags & UF2_FLAG_NOT_MAIN_FLASH) continue;
|
||||
if (block.payload_size != PAGE_SIZE) continue;
|
||||
|
||||
// Bounds and alignment checking
|
||||
if (block.target_addr != (block.target_addr & ~(PAGE_SIZE-1))) continue;
|
||||
if (block.target_addr > FLASH_END - PAGE_SIZE) continue;
|
||||
if (block.target_addr < FLASH_START) continue;
|
||||
|
||||
uint32_t offset = block.target_addr - FLASH_START;
|
||||
|
||||
// Copy data and mark the matching write and erase blocks
|
||||
memcpy(&target->flash_data[offset], block.data, PAGE_SIZE);
|
||||
target->write_blocks[offset / PAGE_SIZE] = 1;
|
||||
target->erase_blocks[offset / FLASH_SECTOR_ERASE_SIZE] = 1;
|
||||
|
||||
target->num_blocks++;
|
||||
}
|
||||
|
||||
do_exit:
|
||||
if (file) {
|
||||
fclose(file);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
const char *status_codes_strings[] = {
|
||||
"ok",
|
||||
"unknown command",
|
||||
"bad address alignment",
|
||||
"interleaved write",
|
||||
"invalid address",
|
||||
"invalid cmd length",
|
||||
"invalid transfer length",
|
||||
"rebooting",
|
||||
"unknown error",
|
||||
};
|
||||
|
||||
int report_error(libusb_device_handle *handle, const char *cmd) {
|
||||
struct picoboot_cmd_status status;
|
||||
status.dStatusCode = 0;
|
||||
int rc = picoboot_cmd_status(handle, &status);
|
||||
if (rc) {
|
||||
fprintf(stderr, "Command %s failed, and it was not possible to "
|
||||
"query PICOBOOT status\n", cmd);
|
||||
} else {
|
||||
if (status.dStatusCode == 0) status.dStatusCode = 8;
|
||||
fprintf(stderr, "Command %s failed with status %d: %s\n",
|
||||
cmd, status.dStatusCode,
|
||||
status_codes_strings[status.dStatusCode]);
|
||||
}
|
||||
return 1;
|
||||
};
|
||||
|
||||
int picoboot_flash(libusb_device_handle *handle, struct flash_data *image) {
|
||||
fprintf(stderr, "Resetting interface\n");
|
||||
if (picoboot_reset(handle)) {
|
||||
return report_error(handle, "reset");
|
||||
}
|
||||
|
||||
fprintf(stderr, "Locking\n");
|
||||
if (picoboot_exclusive_access(handle, EXCLUSIVE)) {
|
||||
return report_error(handle, "exclusive_access");
|
||||
}
|
||||
|
||||
fprintf(stderr, "Exiting XIP mode\n");
|
||||
if (picoboot_exit_xip(handle)) {
|
||||
return report_error(handle, "exit_xip");
|
||||
}
|
||||
|
||||
fprintf(stderr, "Erasing\n");
|
||||
for(size_t i = 0; i < FLASH_NUM_ERASE_BLOCKS; i++) {
|
||||
if (!image->erase_blocks[i]) continue;
|
||||
uint32_t addr = FLASH_START + i * FLASH_SECTOR_ERASE_SIZE;
|
||||
if (picoboot_flash_erase(handle, addr, FLASH_SECTOR_ERASE_SIZE)) {
|
||||
return report_error(handle, "flash_erase");
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "Flashing\n");
|
||||
for(size_t i = 0; i < FLASH_NUM_WRITE_BLOCKS; i++) {
|
||||
if (!image->write_blocks[i]) continue;
|
||||
uint32_t addr = FLASH_START + i * PAGE_SIZE;
|
||||
uint8_t *buf = &image->flash_data[i * PAGE_SIZE];
|
||||
if (picoboot_write(handle, addr, buf, PAGE_SIZE)) {
|
||||
return report_error(handle, "write");
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "Rebooting device\n");
|
||||
if (picoboot_reboot(handle, 0, 0, 500)) {
|
||||
return report_error(handle, "reboot");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void print_usage(char *argv[]) {
|
||||
fprintf(stderr, "Usage: %s <uf2 image> [bus addr]\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
libusb_context *ctx = 0;
|
||||
struct libusb_device **devs = 0;
|
||||
libusb_device_handle *handle = 0;
|
||||
struct flash_data *image = malloc(sizeof(struct flash_data));
|
||||
int rc = 0;
|
||||
|
||||
if (argc != 2 && argc != 4) {
|
||||
print_usage(argv);
|
||||
}
|
||||
|
||||
if (load_flash_data(argv[1], image)) {
|
||||
fprintf(stderr, "Could not load flash image, exiting\n");
|
||||
rc = 1;
|
||||
goto do_exit;
|
||||
}
|
||||
fprintf(stderr, "Loaded UF2 image with %lu pages\n", image->num_blocks);
|
||||
|
||||
bool has_target = false;
|
||||
uint8_t target_bus = 0;
|
||||
uint8_t target_address = 0;
|
||||
if(argc == 4) {
|
||||
has_target = true;
|
||||
|
||||
char *endptr;
|
||||
target_bus = strtol(argv[2], &endptr, 10);
|
||||
if (endptr == argv[2] || *endptr != 0) print_usage(argv);
|
||||
|
||||
target_address = strtol(argv[3], &endptr, 10);
|
||||
if (endptr == argv[3] || *endptr != 0) print_usage(argv);
|
||||
}
|
||||
|
||||
if (libusb_init(&ctx)) {
|
||||
fprintf(stderr, "Could not initialize libusb\n");
|
||||
rc = 1;
|
||||
goto do_exit;
|
||||
}
|
||||
|
||||
ssize_t cnt = libusb_get_device_list(ctx, &devs);
|
||||
if (cnt < 0) {
|
||||
fprintf(stderr, "Failed to enumerate USB devices: %s",
|
||||
libusb_strerror(cnt));
|
||||
rc = 1;
|
||||
goto do_exit;
|
||||
}
|
||||
|
||||
for (libusb_device **dev = devs; *dev; ++dev) {
|
||||
if (has_target) {
|
||||
if (target_bus != libusb_get_bus_number(*dev)) continue;
|
||||
if (target_address != libusb_get_device_address(*dev)) continue;
|
||||
}
|
||||
enum picoboot_device_result res = picoboot_open_device(*dev, &handle);
|
||||
if (res == dr_vidpid_bootrom_ok) {
|
||||
break;
|
||||
}
|
||||
if (handle) {
|
||||
libusb_close(handle);
|
||||
handle = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!handle) {
|
||||
fprintf(stderr, "No rp2040 in BOOTSEL mode was found\n");
|
||||
goto do_exit;
|
||||
}
|
||||
|
||||
libusb_device *dev = libusb_get_device(handle);
|
||||
fprintf(stderr, "Found rp2040 device on USB bus %d address %d\n",
|
||||
libusb_get_bus_number(dev), libusb_get_device_address(dev));
|
||||
fprintf(stderr, "Flashing...\n");
|
||||
|
||||
rc = picoboot_flash(handle, image);
|
||||
|
||||
do_exit:
|
||||
if (handle) {
|
||||
libusb_close(handle);
|
||||
}
|
||||
if (devs) {
|
||||
libusb_free_device_list(devs, 1);
|
||||
}
|
||||
if (ctx) {
|
||||
libusb_exit(ctx);
|
||||
}
|
||||
free(image);
|
||||
return rc;
|
||||
}
|
428
lib/rp2040_flash/picoboot_connection.c
Normal file
428
lib/rp2040_flash/picoboot_connection.c
Normal file
@ -0,0 +1,428 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "picoboot_connection.h"
|
||||
|
||||
#if false && !defined(NDEBUG)
|
||||
#define output(format,...) printf(format, __VA_ARGS__)
|
||||
#else
|
||||
#define output(format,...) ((void)0)
|
||||
#endif
|
||||
|
||||
static bool verbose;
|
||||
|
||||
// todo test sparse binary (well actually two range is this)
|
||||
|
||||
#define VENDOR_ID_RASPBERRY_PI 0x2e8au
|
||||
#define PRODUCT_ID_RP2_USBBOOT 0x0003u
|
||||
#define PRODUCT_ID_PICOPROBE 0x0004u
|
||||
#define PRODUCT_ID_MICROPYTHON 0x0005u
|
||||
#define PRODUCT_ID_STDIO_USB 0x000au
|
||||
|
||||
uint32_t crc32_for_byte(uint32_t remainder) {
|
||||
const uint32_t POLYNOMIAL = 0x4C11DB7;
|
||||
remainder <<= 24u;
|
||||
for (uint bit = 8; bit > 0; bit--) {
|
||||
if (remainder & 0x80000000)
|
||||
remainder = (remainder << 1) ^ POLYNOMIAL;
|
||||
else
|
||||
remainder = (remainder << 1);
|
||||
}
|
||||
return remainder;
|
||||
}
|
||||
|
||||
uint32_t crc32_sw(const uint8_t *buf, uint count, uint32_t crc) {
|
||||
static uint32_t table[0x100];
|
||||
if (!table[1]) {
|
||||
for (uint i = 0; i < count_of(table); i++) {
|
||||
table[i] = crc32_for_byte(i);
|
||||
}
|
||||
}
|
||||
for (uint i = 0; i < count; ++i) {
|
||||
crc = (crc << 8u) ^ table[(uint8_t) ((crc >> 24u) ^ buf[i])];
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
|
||||
uint interface;
|
||||
uint out_ep;
|
||||
uint in_ep;
|
||||
|
||||
enum picoboot_device_result picoboot_open_device(libusb_device *device, libusb_device_handle **dev_handle) {
|
||||
struct libusb_device_descriptor desc;
|
||||
struct libusb_config_descriptor *config;
|
||||
|
||||
*dev_handle = NULL;
|
||||
int ret = libusb_get_device_descriptor(device, &desc);
|
||||
if (ret && verbose) {
|
||||
output("Failed to read device descriptor");
|
||||
}
|
||||
if (!ret) {
|
||||
if (desc.idVendor != VENDOR_ID_RASPBERRY_PI) {
|
||||
return dr_vidpid_unknown;
|
||||
}
|
||||
switch (desc.idProduct) {
|
||||
case PRODUCT_ID_MICROPYTHON:
|
||||
return dr_vidpid_micropython;
|
||||
case PRODUCT_ID_PICOPROBE:
|
||||
return dr_vidpid_picoprobe;
|
||||
case PRODUCT_ID_STDIO_USB:
|
||||
return dr_vidpid_stdio_usb;
|
||||
case PRODUCT_ID_RP2_USBBOOT:
|
||||
break;
|
||||
default:
|
||||
return dr_vidpid_unknown;
|
||||
}
|
||||
ret = libusb_get_active_config_descriptor(device, &config);
|
||||
if (ret && verbose) {
|
||||
output("Failed to read config descriptor\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!ret) {
|
||||
ret = libusb_open(device, dev_handle);
|
||||
if (ret && verbose) {
|
||||
output("Failed to open device %d\n", ret);
|
||||
}
|
||||
if (ret) {
|
||||
return dr_vidpid_bootrom_cant_connect;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ret) {
|
||||
if (config->bNumInterfaces == 1) {
|
||||
interface = 0;
|
||||
} else {
|
||||
interface = 1;
|
||||
}
|
||||
if (config->interface[interface].altsetting[0].bInterfaceClass == 0xff &&
|
||||
config->interface[interface].altsetting[0].bNumEndpoints == 2) {
|
||||
out_ep = config->interface[interface].altsetting[0].endpoint[0].bEndpointAddress;
|
||||
in_ep = config->interface[interface].altsetting[0].endpoint[1].bEndpointAddress;
|
||||
}
|
||||
if (out_ep && in_ep && !(out_ep & 0x80u) && (in_ep & 0x80u)) {
|
||||
if (verbose) output("Found PICOBOOT interface\n");
|
||||
ret = libusb_claim_interface(*dev_handle, interface);
|
||||
if (ret) {
|
||||
if (verbose) output("Failed to claim interface\n");
|
||||
return dr_vidpid_bootrom_no_interface;
|
||||
}
|
||||
|
||||
return dr_vidpid_bootrom_ok;
|
||||
} else {
|
||||
if (verbose) output("Did not find PICOBOOT interface\n");
|
||||
return dr_vidpid_bootrom_no_interface;
|
||||
}
|
||||
}
|
||||
|
||||
assert(ret);
|
||||
|
||||
if (*dev_handle) {
|
||||
libusb_close(*dev_handle);
|
||||
*dev_handle = NULL;
|
||||
}
|
||||
|
||||
return dr_error;
|
||||
}
|
||||
|
||||
static bool is_halted(libusb_device_handle *usb_device, int ep) {
|
||||
uint8_t data[2];
|
||||
|
||||
int transferred = libusb_control_transfer(
|
||||
usb_device,
|
||||
/*LIBUSB_REQUEST_TYPE_STANDARD | */LIBUSB_RECIPIENT_ENDPOINT | LIBUSB_ENDPOINT_IN,
|
||||
LIBUSB_REQUEST_GET_STATUS,
|
||||
0, ep,
|
||||
data, sizeof(data),
|
||||
1000);
|
||||
if (transferred != sizeof(data)) {
|
||||
output("Get status failed\n");
|
||||
return false;
|
||||
}
|
||||
if (data[0] & 1) {
|
||||
if (verbose) output("%d was halted\n", ep);
|
||||
return true;
|
||||
}
|
||||
if (verbose) output("%d was not halted\n", ep);
|
||||
return false;
|
||||
}
|
||||
|
||||
int picoboot_reset(libusb_device_handle *usb_device) {
|
||||
if (verbose) output("RESET\n");
|
||||
if (is_halted(usb_device, in_ep))
|
||||
libusb_clear_halt(usb_device, in_ep);
|
||||
if (is_halted(usb_device, out_ep))
|
||||
libusb_clear_halt(usb_device, out_ep);
|
||||
int ret =
|
||||
libusb_control_transfer(usb_device, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_INTERFACE,
|
||||
PICOBOOT_IF_RESET, 0, interface, NULL, 0, 1000);
|
||||
|
||||
if (ret != 0) {
|
||||
output(" ...failed\n");
|
||||
return ret;
|
||||
}
|
||||
if (verbose) output(" ...ok\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int picoboot_cmd_status_verbose(libusb_device_handle *usb_device, struct picoboot_cmd_status *status, bool local_verbose) {
|
||||
struct picoboot_cmd_status s;
|
||||
if (!status) status = &s;
|
||||
|
||||
if (local_verbose) output("CMD_STATUS\n");
|
||||
int ret =
|
||||
libusb_control_transfer(usb_device,
|
||||
LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_INTERFACE | LIBUSB_ENDPOINT_IN,
|
||||
PICOBOOT_IF_CMD_STATUS, 0, interface, (uint8_t *) status, sizeof(*status), 1000);
|
||||
|
||||
if (ret != sizeof(*status)) {
|
||||
output(" ...failed\n");
|
||||
return ret;
|
||||
}
|
||||
if (local_verbose)
|
||||
output(" ... cmd %02x%s tok=%08x status=%d\n", status->bCmdId, status->bInProgress ? " (in progress)" : "",
|
||||
status->dToken, status->dStatusCode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int picoboot_cmd_status(libusb_device_handle *usb_device, struct picoboot_cmd_status *status) {
|
||||
return picoboot_cmd_status_verbose(usb_device, status, verbose);
|
||||
}
|
||||
|
||||
int one_time_bulk_timeout;
|
||||
|
||||
int picoboot_cmd(libusb_device_handle *usb_device, struct picoboot_cmd *cmd, uint8_t *buffer, uint buf_size) {
|
||||
int sent = 0;
|
||||
int ret;
|
||||
|
||||
static int token = 1;
|
||||
cmd->dMagic = PICOBOOT_MAGIC;
|
||||
cmd->dToken = token++;
|
||||
ret = libusb_bulk_transfer(usb_device, out_ep, (uint8_t *) cmd, sizeof(struct picoboot_cmd), &sent, 3000);
|
||||
|
||||
if (ret != 0 || sent != sizeof(struct picoboot_cmd)) {
|
||||
output(" ...failed to send command %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int timeout = 10000;
|
||||
if (one_time_bulk_timeout) {
|
||||
timeout = one_time_bulk_timeout;
|
||||
one_time_bulk_timeout = 0;
|
||||
}
|
||||
if (cmd->dTransferLength != 0) {
|
||||
assert(buf_size >= cmd->dTransferLength);
|
||||
if (cmd->bCmdId & 0x80u) {
|
||||
if (verbose) output(" receive %d...\n", cmd->dTransferLength);
|
||||
int received = 0;
|
||||
ret = libusb_bulk_transfer(usb_device, in_ep, buffer, cmd->dTransferLength, &received, timeout);
|
||||
if (ret != 0 || received != (int) cmd->dTransferLength) {
|
||||
output(" ...failed to receive data %d %d/%d\n", ret, received, cmd->dTransferLength);
|
||||
if (!ret) ret = 1;
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
if (verbose) output(" send %d...\n", cmd->dTransferLength);
|
||||
ret = libusb_bulk_transfer(usb_device, out_ep, buffer, cmd->dTransferLength, &sent, timeout);
|
||||
if (ret != 0 || sent != (int) cmd->dTransferLength) {
|
||||
output(" ...failed to send data %d %d/%d\n", ret, sent, cmd->dTransferLength);
|
||||
if (!ret) ret = 1;
|
||||
picoboot_cmd_status_verbose(usb_device, NULL, true);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ack is in opposite direction
|
||||
int received = 0;
|
||||
uint8_t spoon[64];
|
||||
if (cmd->bCmdId & 0x80u) {
|
||||
if (verbose) output("zero length out\n");
|
||||
ret = libusb_bulk_transfer(usb_device, out_ep, spoon, 1, &received, cmd->dTransferLength == 0 ? timeout : 3000);
|
||||
} else {
|
||||
if (verbose) output("zero length in\n");
|
||||
ret = libusb_bulk_transfer(usb_device, in_ep, spoon, 1, &received, cmd->dTransferLength == 0 ? timeout : 3000);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int picoboot_exclusive_access(libusb_device_handle *usb_device, uint8_t exclusive) {
|
||||
if (verbose) output("EXCLUSIVE ACCESS %d\n", exclusive);
|
||||
struct picoboot_cmd cmd;
|
||||
cmd.bCmdId = PC_EXCLUSIVE_ACCESS;
|
||||
cmd.exclusive_cmd.bExclusive = exclusive;
|
||||
cmd.bCmdSize = sizeof(struct picoboot_exclusive_cmd);
|
||||
cmd.dTransferLength = 0;
|
||||
return picoboot_cmd(usb_device, &cmd, NULL, 0);
|
||||
}
|
||||
|
||||
int picoboot_exit_xip(libusb_device_handle *usb_device) {
|
||||
struct picoboot_cmd cmd;
|
||||
if (verbose) output("EXIT_XIP\n");
|
||||
cmd.bCmdId = PC_EXIT_XIP;
|
||||
cmd.bCmdSize = 0;
|
||||
cmd.dTransferLength = 0;
|
||||
return picoboot_cmd(usb_device, &cmd, NULL, 0);
|
||||
}
|
||||
|
||||
int picoboot_enter_cmd_xip(libusb_device_handle *usb_device) {
|
||||
struct picoboot_cmd cmd;
|
||||
if (verbose) output("ENTER_CMD_XIP\n");
|
||||
cmd.bCmdId = PC_ENTER_CMD_XIP;
|
||||
cmd.bCmdSize = 0;
|
||||
cmd.dTransferLength = 0;
|
||||
return picoboot_cmd(usb_device, &cmd, NULL, 0);
|
||||
}
|
||||
|
||||
int picoboot_reboot(libusb_device_handle *usb_device, uint32_t pc, uint32_t sp, uint32_t delay_ms) {
|
||||
struct picoboot_cmd cmd;
|
||||
if (verbose) output("REBOOT %08x %08x %u\n", (uint) pc, (uint) sp, (uint) delay_ms);
|
||||
cmd.bCmdId = PC_REBOOT;
|
||||
cmd.bCmdSize = sizeof(cmd.reboot_cmd);
|
||||
cmd.dTransferLength = 0;
|
||||
cmd.reboot_cmd.dPC = pc;
|
||||
cmd.reboot_cmd.dSP = sp;
|
||||
cmd.reboot_cmd.dDelayMS = delay_ms;
|
||||
return picoboot_cmd(usb_device, &cmd, NULL, 0);
|
||||
}
|
||||
|
||||
int picoboot_exec(libusb_device_handle *usb_device, uint32_t addr) {
|
||||
struct picoboot_cmd cmd;
|
||||
// shouldn't be necessary any more
|
||||
// addr |= 1u; // Thumb bit
|
||||
if (verbose) output("EXEC %08x\n", (uint) addr);
|
||||
cmd.bCmdId = PC_EXEC;
|
||||
cmd.bCmdSize = sizeof(cmd.address_only_cmd);
|
||||
cmd.dTransferLength = 0;
|
||||
cmd.address_only_cmd.dAddr = addr;
|
||||
return picoboot_cmd(usb_device, &cmd, NULL, 0);
|
||||
}
|
||||
|
||||
int picoboot_flash_erase(libusb_device_handle *usb_device, uint32_t addr, uint32_t len) {
|
||||
struct picoboot_cmd cmd;
|
||||
if (verbose) output("FLASH_ERASE %08x+%08x\n", (uint) addr, (uint) len);
|
||||
cmd.bCmdId = PC_FLASH_ERASE;
|
||||
cmd.bCmdSize = sizeof(cmd.range_cmd);
|
||||
cmd.range_cmd.dAddr = addr;
|
||||
cmd.range_cmd.dSize = len;
|
||||
cmd.dTransferLength = 0;
|
||||
return picoboot_cmd(usb_device, &cmd, NULL, 0);
|
||||
}
|
||||
|
||||
int picoboot_vector(libusb_device_handle *usb_device, uint32_t addr) {
|
||||
struct picoboot_cmd cmd;
|
||||
if (verbose) output("VECTOR %08x\n", (uint) addr);
|
||||
cmd.bCmdId = PC_VECTORIZE_FLASH;
|
||||
cmd.bCmdSize = sizeof(cmd.address_only_cmd);
|
||||
cmd.range_cmd.dAddr = addr;
|
||||
cmd.dTransferLength = 0;
|
||||
return picoboot_cmd(usb_device, &cmd, NULL, 0);
|
||||
}
|
||||
|
||||
int picoboot_write(libusb_device_handle *usb_device, uint32_t addr, uint8_t *buffer, uint32_t len) {
|
||||
struct picoboot_cmd cmd;
|
||||
if (verbose) output("WRITE %08x+%08x\n", (uint) addr, (uint) len);
|
||||
cmd.bCmdId = PC_WRITE;
|
||||
cmd.bCmdSize = sizeof(cmd.range_cmd);
|
||||
cmd.range_cmd.dAddr = addr;
|
||||
cmd.range_cmd.dSize = cmd.dTransferLength = len;
|
||||
return picoboot_cmd(usb_device, &cmd, buffer, len);
|
||||
}
|
||||
|
||||
int picoboot_read(libusb_device_handle *usb_device, uint32_t addr, uint8_t *buffer, uint32_t len) {
|
||||
memset(buffer, 0xaa, len);
|
||||
if (verbose) output("READ %08x+%08x\n", (uint) addr, (uint) len);
|
||||
struct picoboot_cmd cmd;
|
||||
cmd.bCmdId = PC_READ;
|
||||
cmd.bCmdSize = sizeof(cmd.range_cmd);
|
||||
cmd.range_cmd.dAddr = addr;
|
||||
cmd.range_cmd.dSize = cmd.dTransferLength = len;
|
||||
int ret = picoboot_cmd(usb_device, &cmd, buffer, len);
|
||||
if (!ret && len < 256 && verbose) {
|
||||
for (uint32_t i = 0; i < len; i += 32) {
|
||||
output("\t");
|
||||
for (uint32_t j = i; j < MIN(len, i + 32); j++) {
|
||||
output("0x%02x, ", buffer[j]);
|
||||
}
|
||||
output("\n");
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
// Peek/poke via EXEC
|
||||
|
||||
// 00000000 <poke>:
|
||||
// 0: 4801 ldr r0, [pc, #4] ; (8 <data>)
|
||||
// 2: 4902 ldr r1, [pc, #8] ; (c <addr>)
|
||||
// 4: 6008 str r0, [r1, #0]
|
||||
// 6: 4770 bx lr
|
||||
// 00000008 <data>:
|
||||
// 8: 12345678 .word 0x12345678
|
||||
// 0000000c <addr>:
|
||||
// c: 9abcdef0 .word 0x9abcdef0
|
||||
|
||||
|
||||
static const size_t picoboot_poke_cmd_len = 8;
|
||||
static const uint8_t picoboot_poke_cmd[] = {
|
||||
0x01, 0x48, 0x02, 0x49, 0x08, 0x60, 0x70, 0x47
|
||||
};
|
||||
|
||||
// 00000000 <peek>:
|
||||
// 0: 4802 ldr r0, [pc, #8] ; (c <inout>)
|
||||
// 2: 6800 ldr r0, [r0, #0]
|
||||
// 4: 4679 mov r1, pc
|
||||
// 6: 6048 str r0, [r1, #4]
|
||||
// 8: 4770 bx lr
|
||||
// a: 46c0 nop ; (mov r8, r8)
|
||||
// 0000000c <inout>:
|
||||
// c: 0add7355 .word 0x0add7355
|
||||
|
||||
static const size_t picoboot_peek_cmd_len = 12;
|
||||
static const uint8_t picoboot_peek_cmd[] = {
|
||||
0x02, 0x48, 0x00, 0x68, 0x79, 0x46, 0x48, 0x60, 0x70, 0x47, 0xc0, 0x46
|
||||
};
|
||||
|
||||
// TODO better place for this e.g. the USB DPRAM location the controller has already put it in
|
||||
#define PEEK_POKE_CODE_LOC 0x20000000u
|
||||
|
||||
int picoboot_poke(libusb_device_handle *usb_device, uint32_t addr, uint32_t data) {
|
||||
const size_t prog_size = picoboot_poke_cmd_len + 8;
|
||||
uint8_t prog[prog_size];
|
||||
output("POKE (D)%08x -> (A)%08x\n", data, addr);
|
||||
memcpy(prog, picoboot_poke_cmd, picoboot_poke_cmd_len);
|
||||
*(uint32_t *) (prog + picoboot_poke_cmd_len) = data;
|
||||
*(uint32_t *) (prog + picoboot_poke_cmd_len + 4) = addr;
|
||||
|
||||
int ret = picoboot_write(usb_device, PEEK_POKE_CODE_LOC, prog, prog_size);
|
||||
if (ret)
|
||||
return ret;
|
||||
return picoboot_exec(usb_device, PEEK_POKE_CODE_LOC);
|
||||
}
|
||||
|
||||
// TODO haven't checked the store goes to the right address :)
|
||||
int picoboot_peek(libusb_device_handle *usb_device, uint32_t addr, uint32_t *data) {
|
||||
const size_t prog_size = picoboot_peek_cmd_len + 4;
|
||||
uint8_t prog[prog_size];
|
||||
output("PEEK %08x\n", addr);
|
||||
memcpy(prog, picoboot_peek_cmd, picoboot_peek_cmd_len);
|
||||
*(uint32_t *) (prog + picoboot_peek_cmd_len) = addr;
|
||||
|
||||
int ret = picoboot_write(usb_device, PEEK_POKE_CODE_LOC, prog, prog_size);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = picoboot_exec(usb_device, PEEK_POKE_CODE_LOC);
|
||||
if (ret)
|
||||
return ret;
|
||||
return picoboot_read(usb_device, PEEK_POKE_CODE_LOC + picoboot_peek_cmd_len, (uint8_t *) data, sizeof(uint32_t));
|
||||
}
|
||||
#endif
|
111
lib/rp2040_flash/picoboot_connection.h
Normal file
111
lib/rp2040_flash/picoboot_connection.h
Normal file
@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _PICOBOOT_CONNECTION_H
|
||||
#define _PICOBOOT_CONNECTION_H
|
||||
|
||||
// todo we should use fully encapsulate libusb
|
||||
|
||||
#include <assert.h>
|
||||
#include <libusb.h>
|
||||
#include "boot/picoboot.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum picoboot_device_result {
|
||||
dr_vidpid_bootrom_ok,
|
||||
dr_vidpid_bootrom_no_interface,
|
||||
dr_vidpid_bootrom_cant_connect,
|
||||
dr_vidpid_micropython,
|
||||
dr_vidpid_picoprobe,
|
||||
dr_vidpid_unknown,
|
||||
dr_error,
|
||||
dr_vidpid_stdio_usb,
|
||||
};
|
||||
|
||||
enum picoboot_device_result picoboot_open_device(libusb_device *device, libusb_device_handle **dev_handle);
|
||||
|
||||
int picoboot_reset(libusb_device_handle *usb_device);
|
||||
int picoboot_cmd_status_verbose(libusb_device_handle *usb_device, struct picoboot_cmd_status *status,
|
||||
bool local_verbose);
|
||||
int picoboot_cmd_status(libusb_device_handle *usb_device, struct picoboot_cmd_status *status);
|
||||
int picoboot_exclusive_access(libusb_device_handle *usb_device, uint8_t exclusive);
|
||||
int picoboot_enter_cmd_xip(libusb_device_handle *usb_device);
|
||||
int picoboot_exit_xip(libusb_device_handle *usb_device);
|
||||
int picoboot_reboot(libusb_device_handle *usb_device, uint32_t pc, uint32_t sp, uint32_t delay_ms);
|
||||
int picoboot_exec(libusb_device_handle *usb_device, uint32_t addr);
|
||||
int picoboot_flash_erase(libusb_device_handle *usb_device, uint32_t addr, uint32_t len);
|
||||
int picoboot_vector(libusb_device_handle *usb_device, uint32_t addr);
|
||||
int picoboot_write(libusb_device_handle *usb_device, uint32_t addr, uint8_t *buffer, uint32_t len);
|
||||
int picoboot_read(libusb_device_handle *usb_device, uint32_t addr, uint8_t *buffer, uint32_t len);
|
||||
int picoboot_poke(libusb_device_handle *usb_device, uint32_t addr, uint32_t data);
|
||||
int picoboot_peek(libusb_device_handle *usb_device, uint32_t addr, uint32_t *data);
|
||||
|
||||
#define ROM_START 0x00000000
|
||||
#define ROM_END 0x00004000
|
||||
#define FLASH_START 0x10000000
|
||||
#define FLASH_END 0x11000000 // this is maximum
|
||||
#define XIP_SRAM_BASE 0x15000000
|
||||
#define XIP_SRAM_END 0x15004000
|
||||
|
||||
#define SRAM_START 0x20000000
|
||||
#define SRAM_END 0x20042000
|
||||
|
||||
#define SRAM_UNSTRIPED_START 0x21000000
|
||||
#define SRAM_UNSTRIPED_END 0x21040000
|
||||
|
||||
// we require 256 (as this is the page size supported by the device)
|
||||
#define LOG2_PAGE_SIZE 8u
|
||||
#define PAGE_SIZE (1u << LOG2_PAGE_SIZE)
|
||||
#define FLASH_SECTOR_ERASE_SIZE 4096u
|
||||
|
||||
enum memory_type {
|
||||
rom,
|
||||
flash,
|
||||
sram,
|
||||
sram_unstriped,
|
||||
xip_sram,
|
||||
invalid,
|
||||
};
|
||||
|
||||
// inclusive of ends
|
||||
static inline enum memory_type get_memory_type(uint32_t addr) {
|
||||
if (addr >= ROM_START && addr <= ROM_END) {
|
||||
return rom;
|
||||
}
|
||||
if (addr >= FLASH_START && addr <= FLASH_END) {
|
||||
return flash;
|
||||
}
|
||||
if (addr >= SRAM_START && addr <= SRAM_END) {
|
||||
return sram;
|
||||
}
|
||||
if (addr >= SRAM_UNSTRIPED_START && addr <= SRAM_UNSTRIPED_END) {
|
||||
return sram_unstriped;
|
||||
}
|
||||
if (addr >= XIP_SRAM_BASE && addr <= XIP_SRAM_END) {
|
||||
return xip_sram;
|
||||
}
|
||||
return invalid;
|
||||
}
|
||||
|
||||
static inline bool is_transfer_aligned(uint32_t addr) {
|
||||
enum memory_type t = get_memory_type(addr);
|
||||
return t != invalid && !(t == flash && addr & (PAGE_SIZE-1));
|
||||
}
|
||||
|
||||
static inline bool is_size_aligned(uint32_t addr, int size) {
|
||||
#ifndef _MSC_VER
|
||||
assert(__builtin_popcount(size)==1);
|
||||
#endif
|
||||
return !(addr & (size-1));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
104
src/rp2040/Kconfig
Normal file
104
src/rp2040/Kconfig
Normal file
@ -0,0 +1,104 @@
|
||||
# Kconfig settings for STM32 processors
|
||||
|
||||
if MACH_RP2040
|
||||
|
||||
config RP2040_SELECT
|
||||
bool
|
||||
default y
|
||||
select HAVE_GPIO
|
||||
select HAVE_GPIO_ADC
|
||||
select HAVE_GPIO_SPI
|
||||
select HAVE_GPIO_I2C
|
||||
select HAVE_GPIO_BITBANGING
|
||||
select HAVE_STRICT_TIMING
|
||||
select HAVE_CHIPID
|
||||
select HAVE_GPIO_HARD_PWM
|
||||
select HAVE_STEPPER_BOTH_EDGE
|
||||
|
||||
config BOARD_DIRECTORY
|
||||
string
|
||||
default "rp2040"
|
||||
|
||||
config MCU
|
||||
string
|
||||
default "rp2040"
|
||||
|
||||
config CLOCK_FREQ
|
||||
int
|
||||
default 12000000
|
||||
|
||||
config FLASH_SIZE
|
||||
hex
|
||||
default 0x200000
|
||||
|
||||
config RAM_START
|
||||
hex
|
||||
default 0x20000000
|
||||
|
||||
config RAM_SIZE
|
||||
hex
|
||||
default 0x42000
|
||||
|
||||
config STACK_SIZE
|
||||
int
|
||||
default 512
|
||||
|
||||
config FLASH_START
|
||||
hex
|
||||
default 0x10000000
|
||||
|
||||
|
||||
######################################################################
|
||||
# Bootloader options
|
||||
######################################################################
|
||||
|
||||
choice
|
||||
prompt "Flash chip" if LOW_LEVEL_OPTIONS
|
||||
config RP2040_FLASH_W25Q080
|
||||
bool "W25Q080 with CLKDIV 2"
|
||||
config RP2040_FLASH_GENERIC_03
|
||||
bool "GENERIC_03H with CLKDIV 4"
|
||||
endchoice
|
||||
|
||||
config RP2040_STAGE2_FILE
|
||||
string
|
||||
default "boot2_generic_03h.S" if RP2040_FLASH_GENERIC_03
|
||||
default "boot2_w25q080.S"
|
||||
|
||||
config RP2040_STAGE2_CLKDIV
|
||||
int
|
||||
default 4 if RP2040_FLASH_GENERIC_03
|
||||
default 2
|
||||
|
||||
|
||||
######################################################################
|
||||
# Communication inteface
|
||||
######################################################################
|
||||
|
||||
choice
|
||||
prompt "Communication interface"
|
||||
config RP2040_USB
|
||||
bool "USB"
|
||||
select USBSERIAL
|
||||
config RP2040_SERIAL_UART0
|
||||
bool "Serial (on UART0 GPIO1/GPIO0)"
|
||||
select SERIAL
|
||||
config RP2040_CANBUS
|
||||
bool "CAN bus"
|
||||
select CANSERIAL
|
||||
config RP2040_USBCANBUS
|
||||
bool "USB to CAN bus bridge"
|
||||
select USBCANBUS
|
||||
endchoice
|
||||
|
||||
config RP2040_CANBUS_GPIO_RX
|
||||
int "CAN RX gpio number" if CANBUS
|
||||
default 4
|
||||
range 0 29
|
||||
|
||||
config RP2040_CANBUS_GPIO_TX
|
||||
int "CAN TX gpio number" if CANBUS
|
||||
default 5
|
||||
range 0 29
|
||||
|
||||
endif
|
61
src/rp2040/Makefile
Normal file
61
src/rp2040/Makefile
Normal file
@ -0,0 +1,61 @@
|
||||
# Additional RP2040 build rules
|
||||
|
||||
# Setup the toolchain
|
||||
CROSS_PREFIX=arm-none-eabi-
|
||||
|
||||
dirs-y += src/rp2040 src/generic lib/rp2040/elf2uf2 lib/fast-hash lib/can2040
|
||||
|
||||
CFLAGS += -mcpu=cortex-m0plus -mthumb -Ilib/cmsis-core
|
||||
CFLAGS += -Ilib/rp2040 -Ilib/rp2040/cmsis_include -Ilib/fast-hash -Ilib/can2040
|
||||
|
||||
CFLAGS_klipper.elf += --specs=nano.specs --specs=nosys.specs
|
||||
CFLAGS_klipper.elf += -T $(OUT)src/rp2040/rp2040_link.ld
|
||||
$(OUT)klipper.elf: $(OUT)stage2.o $(OUT)src/rp2040/rp2040_link.ld
|
||||
|
||||
# Add source files
|
||||
src-y += rp2040/main.c rp2040/gpio.c rp2040/adc.c generic/crc16_ccitt.c
|
||||
src-y += generic/armcm_boot.c generic/armcm_irq.c generic/armcm_reset.c
|
||||
src-y += generic/timer_irq.c rp2040/timer.c rp2040/bootrom.c
|
||||
src-$(CONFIG_USBSERIAL) += rp2040/usbserial.c generic/usb_cdc.c
|
||||
src-$(CONFIG_USBSERIAL) += rp2040/chipid.c
|
||||
src-$(CONFIG_SERIAL) += rp2040/serial.c generic/serial_irq.c
|
||||
src-$(CONFIG_CANSERIAL) += rp2040/can.c rp2040/chipid.c ../lib/can2040/can2040.c
|
||||
src-$(CONFIG_CANSERIAL) += generic/canserial.c generic/canbus.c
|
||||
src-$(CONFIG_CANSERIAL) += ../lib/fast-hash/fasthash.c
|
||||
src-$(CONFIG_USBCANBUS) += rp2040/can.c rp2040/chipid.c ../lib/can2040/can2040.c
|
||||
src-$(CONFIG_USBCANBUS) += generic/canserial.c generic/usb_canbus.c
|
||||
src-$(CONFIG_USBCANBUS) += ../lib/fast-hash/fasthash.c rp2040/usbserial.c
|
||||
src-$(CONFIG_HAVE_GPIO_HARD_PWM) += rp2040/hard_pwm.c
|
||||
src-$(CONFIG_HAVE_GPIO_SPI) += rp2040/spi.c
|
||||
src-$(CONFIG_HAVE_GPIO_I2C) += rp2040/i2c.c
|
||||
|
||||
# rp2040 stage2 building
|
||||
STAGE2_FILE := $(shell echo $(CONFIG_RP2040_STAGE2_FILE))
|
||||
$(OUT)stage2.o: lib/rp2040/boot_stage2/$(STAGE2_FILE) $(OUT)autoconf.h
|
||||
@echo " Building rp2040 stage2 $@"
|
||||
$(Q)$(CC) $(CFLAGS) -Ilib/rp2040/boot_stage2 -Ilib/rp2040/boot_stage2/asminclude -DPICO_FLASH_SPI_CLKDIV=$(CONFIG_RP2040_STAGE2_CLKDIV) -c $< -o $(OUT)stage2raw1.o
|
||||
$(Q)$(LD) $(OUT)stage2raw1.o --script=lib/rp2040/boot_stage2/boot_stage2.ld -o $(OUT)stage2raw.o
|
||||
$(Q)$(OBJCOPY) -O binary $(OUT)stage2raw.o $(OUT)stage2raw.bin
|
||||
$(Q)lib/rp2040/boot_stage2/pad_checksum -s 0xffffffff $(OUT)stage2raw.bin $(OUT)stage2.S
|
||||
$(Q)$(CC) $(CFLAGS) -c $(OUT)stage2.S -o $(OUT)stage2.o
|
||||
OBJS_klipper.elf += $(OUT)stage2.o
|
||||
|
||||
# Binary output file rules
|
||||
target-y += $(OUT)klipper.uf2
|
||||
|
||||
$(OUT)lib/rp2040/elf2uf2/elf2uf2: lib/rp2040/elf2uf2/main.cpp
|
||||
@echo " Building $@"
|
||||
$(Q)g++ -g -O -Ilib/rp2040 $< -o $@
|
||||
|
||||
$(OUT)klipper.uf2: $(OUT)klipper.elf $(OUT)lib/rp2040/elf2uf2/elf2uf2
|
||||
@echo " Creating uf2 file $@"
|
||||
$(Q)$(OUT)lib/rp2040/elf2uf2/elf2uf2 $< $@
|
||||
|
||||
lib/rp2040_flash/rp2040_flash:
|
||||
@echo " Building rp2040_flash"
|
||||
$(Q)make -C lib/rp2040_flash rp2040_flash
|
||||
|
||||
# Flash rules
|
||||
flash: $(OUT)klipper.uf2 lib/rp2040_flash/rp2040_flash
|
||||
@echo " Flashing $< to $(FLASH_DEVICE)"
|
||||
$(Q)$(PYTHON) ./scripts/flash_usb.py -t $(CONFIG_MCU) -d "$(FLASH_DEVICE)" $(if $(NOSUDO),--no-sudo) $(OUT)klipper.uf2
|
78
src/rp2040/can.c
Normal file
78
src/rp2040/can.c
Normal file
@ -0,0 +1,78 @@
|
||||
// Serial over CAN emulation for rp2040 using can2040 software canbus
|
||||
//
|
||||
// Copyright (C) 2022 Kevin O'Connor <kevin@koconnor.net>
|
||||
//
|
||||
// This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
|
||||
#include <stdint.h> // uint32_t
|
||||
#include <string.h> // memcpy
|
||||
#include "autoconf.h" // CONFIG_CANBUS_FREQUENCY
|
||||
#include "board/armcm_boot.h" // armcm_enable_irq
|
||||
#include "board/io.h" // readl
|
||||
#include "can2040.h" // can2040_setup
|
||||
#include "command.h" // DECL_CONSTANT_STR
|
||||
#include "fasthash.h" // fasthash64
|
||||
#include "generic/canbus.h" // canbus_notify_tx
|
||||
#include "generic/canserial.h" // CANBUS_ID_ADMIN
|
||||
#include "hardware/structs/resets.h" // RESETS_RESET_PIO0_BITS
|
||||
#include "internal.h" // DMA_IRQ_0_IRQn
|
||||
#include "sched.h" // DECL_INIT
|
||||
|
||||
#define GPIO_STR_CAN_RX "gpio" __stringify(CONFIG_RP2040_CANBUS_GPIO_RX)
|
||||
#define GPIO_STR_CAN_TX "gpio" __stringify(CONFIG_RP2040_CANBUS_GPIO_TX)
|
||||
DECL_CONSTANT_STR("RESERVE_PINS_CAN", GPIO_STR_CAN_RX "," GPIO_STR_CAN_TX);
|
||||
|
||||
static struct can2040 cbus;
|
||||
|
||||
// Transmit a packet
|
||||
int
|
||||
canbus_send(struct canbus_msg *msg)
|
||||
{
|
||||
int ret = can2040_transmit(&cbus, (void*)msg);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
return CANMSG_DATA_LEN(msg);
|
||||
}
|
||||
|
||||
// Setup the receive packet filter
|
||||
void
|
||||
canbus_set_filter(uint32_t id)
|
||||
{
|
||||
// Filter not implemented (and not necessary)
|
||||
}
|
||||
|
||||
// can2040 callback function - handle rx and tx notifications
|
||||
static void
|
||||
can2040_cb(struct can2040 *cd, uint32_t notify, struct can2040_msg *msg)
|
||||
{
|
||||
if (notify & CAN2040_NOTIFY_TX) {
|
||||
canbus_notify_tx();
|
||||
return;
|
||||
}
|
||||
if (notify & CAN2040_NOTIFY_RX)
|
||||
canbus_process_data((void*)msg);
|
||||
}
|
||||
|
||||
// Main PIO irq handler
|
||||
void
|
||||
PIOx_IRQHandler(void)
|
||||
{
|
||||
can2040_pio_irq_handler(&cbus);
|
||||
}
|
||||
|
||||
void
|
||||
can_init(void)
|
||||
{
|
||||
// Setup canbus
|
||||
can2040_setup(&cbus, 0);
|
||||
can2040_callback_config(&cbus, can2040_cb);
|
||||
|
||||
// Enable irqs
|
||||
armcm_enable_irq(PIOx_IRQHandler, PIO0_IRQ_0_IRQn, 1);
|
||||
|
||||
// Start canbus
|
||||
uint32_t pclk = get_pclock_frequency(RESETS_RESET_PIO0_RESET);
|
||||
can2040_start(&cbus, pclk, CONFIG_CANBUS_FREQUENCY
|
||||
, CONFIG_RP2040_CANBUS_GPIO_RX, CONFIG_RP2040_CANBUS_GPIO_TX);
|
||||
}
|
||||
DECL_INIT(can_init);
|
135
src/rp2040/chipid.c
Normal file
135
src/rp2040/chipid.c
Normal file
@ -0,0 +1,135 @@
|
||||
// Support for extracting the hardware chip id on rp2040
|
||||
//
|
||||
// Copyright (C) 2021 Lasse Dalegaard <dalegaard@gmail.com>
|
||||
//
|
||||
// This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
|
||||
#include <string.h> // memcpy
|
||||
#include "autoconf.h" // CONFIG_USB_SERIAL_NUMBER_CHIPID
|
||||
#include "board/irq.h" // irq_disable, irq_enable
|
||||
#include "board/canserial.h" // canserial_set_uuid
|
||||
#include "generic/usb_cdc.h" // usb_fill_serial
|
||||
#include "generic/usbstd.h" // usb_string_descriptor
|
||||
#include "sched.h" // DECL_INIT
|
||||
#include "hardware/structs/ioqspi.h" // ioqspi_hw
|
||||
#include "hardware/structs/ssi.h" // ssi_hw
|
||||
#include "internal.h"
|
||||
|
||||
#define CHIP_UID_LEN 8
|
||||
|
||||
static struct {
|
||||
struct usb_string_descriptor desc;
|
||||
uint16_t data[CHIP_UID_LEN * 2];
|
||||
} cdc_chipid;
|
||||
|
||||
struct usb_string_descriptor *
|
||||
usbserial_get_serialid(void)
|
||||
{
|
||||
return &cdc_chipid.desc;
|
||||
}
|
||||
|
||||
// Functions for reading out the flash chip ID. Adapted from the official
|
||||
// Pi SDK.
|
||||
|
||||
static void _ramfunc
|
||||
flash_cs_force(int high)
|
||||
{
|
||||
uint32_t field_val = high ?
|
||||
IO_QSPI_GPIO_QSPI_SS_CTRL_OUTOVER_VALUE_HIGH :
|
||||
IO_QSPI_GPIO_QSPI_SS_CTRL_OUTOVER_VALUE_LOW;
|
||||
hw_write_masked(&ioqspi_hw->io[1].ctrl,
|
||||
field_val << IO_QSPI_GPIO_QSPI_SS_CTRL_OUTOVER_LSB,
|
||||
IO_QSPI_GPIO_QSPI_SS_CTRL_OUTOVER_BITS
|
||||
);
|
||||
}
|
||||
|
||||
// To re-enable XIP we need to call flash_enter_xip. It's available in the
|
||||
// bootrom, but that version is a generic one that works for most devices and
|
||||
// the tradeoff for that is enabling a low performance mode.
|
||||
// Instead we copy out the boot2 XIP enabling stage, and save it in RAM
|
||||
// so we can call it later on.
|
||||
|
||||
#define BOOT2_SIZE 0x100
|
||||
|
||||
static uint8_t boot2_copy[BOOT2_SIZE] __aligned(16);
|
||||
|
||||
static void
|
||||
flash_enter_xip_prepare(void)
|
||||
{
|
||||
void * volatile target = (void *)XIP_BASE; // Avoids warning
|
||||
memcpy(boot2_copy, target, BOOT2_SIZE);
|
||||
barrier();
|
||||
}
|
||||
|
||||
static void _ramfunc
|
||||
flash_enter_xip_perform(void)
|
||||
{
|
||||
((void (*)(void))boot2_copy+1)();
|
||||
}
|
||||
|
||||
#define FLASH_RUID_CMD 0x4B
|
||||
#define FLASH_RUID_DUMMY_BYTES 4
|
||||
#define FLASH_RUID_DATA_BYTES 8
|
||||
#define FLASH_RUID_TOTAL_BYTES (1+FLASH_RUID_DUMMY_BYTES+FLASH_RUID_DATA_BYTES)
|
||||
|
||||
static void _ramfunc
|
||||
read_unique_id(uint8_t *out)
|
||||
{
|
||||
uint8_t txbuf[FLASH_RUID_TOTAL_BYTES] = {0};
|
||||
uint8_t rxbuf[FLASH_RUID_TOTAL_BYTES] = {0};
|
||||
|
||||
uint8_t *txptr = txbuf;
|
||||
uint8_t *rxptr = rxbuf;
|
||||
|
||||
int tx_remaining = FLASH_RUID_TOTAL_BYTES;
|
||||
int rx_remaining = FLASH_RUID_TOTAL_BYTES;
|
||||
|
||||
txbuf[0] = FLASH_RUID_CMD;
|
||||
|
||||
// Set up flash so we can work with it without XIP getting in the way
|
||||
flash_enter_xip_prepare();
|
||||
irq_disable();
|
||||
barrier();
|
||||
connect_internal_flash();
|
||||
flash_exit_xip();
|
||||
flash_cs_force(0);
|
||||
|
||||
while (tx_remaining || rx_remaining) {
|
||||
uint32_t flags = ssi_hw->sr;
|
||||
int can_put = !!(flags & SSI_SR_TFNF_BITS);
|
||||
int can_get = !!(flags & SSI_SR_RFNE_BITS);
|
||||
if (can_put && tx_remaining) {
|
||||
ssi_hw->dr0 = *txptr++;
|
||||
tx_remaining--;
|
||||
}
|
||||
if (can_get && rx_remaining) {
|
||||
*rxptr++ = (uint8_t)ssi_hw->dr0;
|
||||
--rx_remaining;
|
||||
}
|
||||
}
|
||||
|
||||
// Restore XIP
|
||||
flash_cs_force(1);
|
||||
flash_flush_cache();
|
||||
flash_enter_xip_perform();
|
||||
barrier();
|
||||
irq_enable();
|
||||
|
||||
memcpy(out, rxbuf+1+FLASH_RUID_DUMMY_BYTES, FLASH_RUID_DATA_BYTES);
|
||||
}
|
||||
|
||||
void
|
||||
chipid_init(void)
|
||||
{
|
||||
if (!(CONFIG_USB_SERIAL_NUMBER_CHIPID || CONFIG_CANBUS))
|
||||
return;
|
||||
|
||||
uint8_t data[8] = {0};
|
||||
read_unique_id(data);
|
||||
|
||||
if (CONFIG_USB_SERIAL_NUMBER_CHIPID)
|
||||
usb_fill_serial(&cdc_chipid.desc, ARRAY_SIZE(cdc_chipid.data), data);
|
||||
if (CONFIG_CANBUS)
|
||||
canserial_set_uuid(data, CHIP_UID_LEN);
|
||||
}
|
||||
DECL_INIT(chipid_init);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user