rp2040js 0.16.1 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ import { BasePeripheral, Peripheral } from './peripheral';
2
+ export declare class RP2040SysInfo extends BasePeripheral implements Peripheral {
3
+ readUint32(offset: number): number;
4
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RP2040SysInfo = void 0;
4
+ const peripheral_1 = require("./peripheral");
5
+ const CHIP_ID = 0;
6
+ const PLATFORM = 0x4;
7
+ const GITREF_RP2040 = 0x40;
8
+ class RP2040SysInfo extends peripheral_1.BasePeripheral {
9
+ readUint32(offset) {
10
+ // All the values here were verified against the silicon
11
+ switch (offset) {
12
+ case CHIP_ID:
13
+ return 0x10002927;
14
+ case PLATFORM:
15
+ return 0x00000002;
16
+ case GITREF_RP2040:
17
+ return 0xe0c912e8;
18
+ }
19
+ return super.readUint32(offset);
20
+ }
21
+ }
22
+ exports.RP2040SysInfo = RP2040SysInfo;
@@ -20,6 +20,7 @@ const rtc_1 = require("./peripherals/rtc");
20
20
  const spi_1 = require("./peripherals/spi");
21
21
  const ssi_1 = require("./peripherals/ssi");
22
22
  const syscfg_1 = require("./peripherals/syscfg");
23
+ const sysinfo_1 = require("./peripherals/sysinfo");
23
24
  const timer_1 = require("./peripherals/timer");
24
25
  const uart_1 = require("./peripherals/uart");
25
26
  const usb_1 = require("./peripherals/usb");
@@ -107,7 +108,7 @@ class RP2040 {
107
108
  this.executeTimer = null;
108
109
  this.peripherals = {
109
110
  0x18000: new ssi_1.RPSSI(this, 'SSI'),
110
- 0x40000: new peripheral_1.UnimplementedPeripheral(this, 'SYSINFO_BASE'),
111
+ 0x40000: new sysinfo_1.RP2040SysInfo(this, 'SYSINFO_BASE'),
111
112
  0x40004: new syscfg_1.RP2040SysCfg(this, 'SYSCFG'),
112
113
  0x40008: new clocks_1.RPClocks(this, 'CLOCKS_BASE'),
113
114
  0x4000c: new reset_1.RPReset(this, 'RESETS_BASE'),
@@ -0,0 +1,4 @@
1
+ import { BasePeripheral, Peripheral } from './peripheral';
2
+ export declare class RP2040SysInfo extends BasePeripheral implements Peripheral {
3
+ readUint32(offset: number): number;
4
+ }
@@ -0,0 +1,18 @@
1
+ import { BasePeripheral } from './peripheral';
2
+ const CHIP_ID = 0;
3
+ const PLATFORM = 0x4;
4
+ const GITREF_RP2040 = 0x40;
5
+ export class RP2040SysInfo extends BasePeripheral {
6
+ readUint32(offset) {
7
+ // All the values here were verified against the silicon
8
+ switch (offset) {
9
+ case CHIP_ID:
10
+ return 0x10002927;
11
+ case PLATFORM:
12
+ return 0x00000002;
13
+ case GITREF_RP2040:
14
+ return 0xe0c912e8;
15
+ }
16
+ return super.readUint32(offset);
17
+ }
18
+ }
@@ -17,6 +17,7 @@ import { RP2040RTC } from './peripherals/rtc';
17
17
  import { RPSPI } from './peripherals/spi';
18
18
  import { RPSSI } from './peripherals/ssi';
19
19
  import { RP2040SysCfg } from './peripherals/syscfg';
20
+ import { RP2040SysInfo } from './peripherals/sysinfo';
20
21
  import { RPTimer } from './peripherals/timer';
21
22
  import { RPUART } from './peripherals/uart';
22
23
  import { RPUSBController } from './peripherals/usb';
@@ -104,7 +105,7 @@ export class RP2040 {
104
105
  this.executeTimer = null;
105
106
  this.peripherals = {
106
107
  0x18000: new RPSSI(this, 'SSI'),
107
- 0x40000: new UnimplementedPeripheral(this, 'SYSINFO_BASE'),
108
+ 0x40000: new RP2040SysInfo(this, 'SYSINFO_BASE'),
108
109
  0x40004: new RP2040SysCfg(this, 'SYSCFG'),
109
110
  0x40008: new RPClocks(this, 'CLOCKS_BASE'),
110
111
  0x4000c: new RPReset(this, 'RESETS_BASE'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rp2040js",
3
- "version": "0.16.1",
3
+ "version": "0.17.0",
4
4
  "description": "Raspberry Pi Pico (RP2040) Emulator",
5
5
  "repository": "https://github.com/wokwi/rp2040js",
6
6
  "keywords": [