- USB CDC 경로 복원: #define Serial Serial1 우회 제거 - rp2040js/avr8js/codemirror/xterm/monaco-editor vendor화 - /vendor 정적 라우팅 추가 (Express 5 catch-all 우회) - 부팅 완료 타임아웃 감지 (Serial 출력 없어도 8초 후 RAF 전환) - 리셋 시 Simulator 재생성으로 주변 장치 상태 초기화 - 시리얼 패널의 내부 메시지를 console.log로 이동
45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
import { BasePeripheral } from './peripheral.js';
|
|
const FRCE_ON = 0x00;
|
|
const FRCE_OFF = 0x04;
|
|
const WDSEL = 0x08;
|
|
const DONE = 0x0c;
|
|
const PSM_BITS_MASK = 0x0001ffff;
|
|
export class RPPSM extends BasePeripheral {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.frceOn = 0;
|
|
this.frceOff = 0;
|
|
this.wdsel = 0;
|
|
}
|
|
readUint32(offset) {
|
|
switch (offset) {
|
|
case FRCE_ON:
|
|
return this.frceOn;
|
|
case FRCE_OFF:
|
|
return this.frceOff;
|
|
case WDSEL:
|
|
return this.wdsel;
|
|
case DONE:
|
|
// Domains are ready unless forced off (FRCE_ON overrides FRCE_OFF)
|
|
return (PSM_BITS_MASK & ~this.frceOff) | (this.frceOn & this.frceOff);
|
|
}
|
|
return super.readUint32(offset);
|
|
}
|
|
writeUint32(offset, value) {
|
|
switch (offset) {
|
|
case FRCE_ON:
|
|
this.frceOn = value & PSM_BITS_MASK;
|
|
break;
|
|
case FRCE_OFF:
|
|
this.frceOff = value & PSM_BITS_MASK;
|
|
break;
|
|
case WDSEL:
|
|
this.wdsel = value & PSM_BITS_MASK;
|
|
break;
|
|
default:
|
|
super.writeUint32(offset, value);
|
|
break;
|
|
}
|
|
}
|
|
}
|