Select one of the symbols to view example projects that use it.
 
Outline
#include "pico.h"
#include "hardware/address_mapped.h"
#include "hardware/regs/tbman.h"
#include "hardware/regs/sysinfo.h"
#define MANUFACTURER_RPI
#define PART_RP4
rp2350_chip_version()
Files
loading...
SourceVuRaspberry Pi Pico SDK and ExamplesPicoSDKsrc/rp2350/pico_platform/platform.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. * * SPDX-License-Identifier: BSD-3-Clause *//* ... */ #include "pico.h" #include "hardware/address_mapped.h" #include "hardware/regs/tbman.h" #include "hardware/regs/sysinfo.h" // Note we leave the FPGA check in by default so that we can run bug repro // binaries coming in from the wild on the FPGA platform. It takes up around // 48 bytes if you include all the calls, so you can pass PICO_NO_FPGA_CHECK=1 // to remove it. The FPGA check is used to skip initialisation of hardware // (mainly clock generators and oscillators) that aren't present on FPGA. #if !PICO_NO_FPGA_CHECK // Inline stub provided in header if this code is unused (so folding can be // done in each TU instead of relying on LTO) bool __attribute__((weak)) running_on_fpga(void) { return (*(io_ro_32 *)TBMAN_BASE) & TBMAN_PLATFORM_FPGA_BITS; }running_on_fpga (void) { ... } /* ... */#endif #if !PICO_NO_SIM_CHECK bool __attribute__((weak)) running_in_sim(void) { return (*(io_ro_32 *)TBMAN_BASE) & TBMAN_PLATFORM_HDLSIM_BITS; }running_in_sim (void) { ... } /* ... */#endif #define MANUFACTURER_RPI 0x927 #define PART_RP4 0x4 uint8_t rp2350_chip_version(void) { // First register of sysinfo is chip id uint32_t chip_id = *((io_ro_32*)(SYSINFO_BASE + SYSINFO_CHIP_ID_OFFSET)); uint32_t __unused manufacturer = chip_id & SYSINFO_CHIP_ID_MANUFACTURER_BITS; uint32_t __unused part = (chip_id & SYSINFO_CHIP_ID_PART_BITS) >> SYSINFO_CHIP_ID_PART_LSB; assert(manufacturer == MANUFACTURER_RPI); assert(part == PART_RP4); // 0 == A0, 1 == A1, 2 == A2 uint version = (chip_id & SYSINFO_CHIP_ID_REVISION_BITS) >> SYSINFO_CHIP_ID_REVISION_LSB; return (uint8_t)version; }{ ... }
Details