feat: frontend add set jtag frequency
This commit is contained in:
@@ -10,7 +10,8 @@
|
||||
</svg>
|
||||
</div>
|
||||
<Teleport to="#ComponentCapabilities" v-if="selectecComponentID === props.componentId">
|
||||
<MotherBoardCaps :jtagAddr="props.boardAddr" :jtagPort="toNumber(props.boardPort)" />
|
||||
<MotherBoardCaps :jtagAddr="props.boardAddr" :jtagPort="toNumber(props.boardPort)" :jtagFreq="jtagFreq"
|
||||
@change-jtag-freq="changeJtagFreq" />
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
@@ -35,6 +36,11 @@ const emit = defineEmits<{
|
||||
const props = withDefaults(defineProps<MotherBoardProps>(), getDefaultProps());
|
||||
const selectecComponentID = inject(CanvasCurrentSelectedComponentID, ref(null));
|
||||
|
||||
const jtagFreq = ref("25 MHz");
|
||||
function changeJtagFreq(text: string) {
|
||||
jtagFreq.value = text;
|
||||
}
|
||||
|
||||
// 计算实际宽高
|
||||
const width = computed(() => 800 * props.size);
|
||||
const height = computed(() => 600 * props.size);
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
<p class="grow">Jtag Addr: {{ eqps.boardAddr }}</p>
|
||||
<p class="grow">Jtag Port: {{ eqps.boardPort.toString() }}</p>
|
||||
<div class="flex justify-between grow">
|
||||
<p>IDCode: 0x{{ jtagIDCode.toString(16).padStart(8, "0").toUpperCase() }}</p>
|
||||
<p>
|
||||
IDCode: 0x{{ jtagIDCode.toString(16).padStart(8, "0").toUpperCase() }}
|
||||
</p>
|
||||
<button class="btn btn-circle w-6 h-6" :onclick="getIDCode">
|
||||
<svg class="icon opacity-70 fill-primary" viewBox="0 0 1024 1024" version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg" p-id="4865" width="200" height="200">
|
||||
@@ -22,16 +24,26 @@
|
||||
@update:bitstream-file="handleBitstreamChange">
|
||||
</UploadCard>
|
||||
<div class="divider"></div>
|
||||
<fieldset class="fieldset w-full">
|
||||
<legend class="fieldset-legend text-sm">边界扫描刷新率 / Hz</legend>
|
||||
<input type="number" class="input validator w-full" required placeholder="Type a number between 1 to 1000" min="1"
|
||||
max="1000" v-model="jtagBoundaryScanFreq" title="Type a number between 1 to 1000" />
|
||||
<p class="validator-hint">输入一个1 ~ 1000的数</p>
|
||||
</fieldset>
|
||||
<button class="btn w-full btn-primary" :class="eqps.enableJtagBoundaryScan ? '' : 'btn-soft'"
|
||||
:onclick="toggleJtagBoundaryScan">
|
||||
{{ eqps.enableJtagBoundaryScan ? "关闭边界扫描" : "启动边界扫描" }}
|
||||
</button>
|
||||
<div class="w-full">
|
||||
<legend class="fieldset-legend text-sm mb-0.3">Jtag运行频率</legend>
|
||||
<select class="select w-full" @change="handleSelectJtagSpeed" :value="props.jtagFreq">
|
||||
<option v-for="option in selectJtagSpeedOptions" :value="option.id">
|
||||
{{ option.text }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-row items-center">
|
||||
<fieldset class="fieldset w-70">
|
||||
<legend class="fieldset-legend text-sm">边界扫描刷新率 / Hz</legend>
|
||||
<input type="number" class="input validator" required placeholder="Type a number between 1 to 1000" min="1"
|
||||
max="1000" v-model="jtagBoundaryScanFreq" title="Type a number between 1 to 1000" />
|
||||
<p class="validator-hint">输入一个1 ~ 1000的数</p>
|
||||
</fieldset>
|
||||
<button class="btn btn-primary grow mx-4" :class="eqps.enableJtagBoundaryScan ? '' : 'btn-soft'"
|
||||
:onclick="toggleJtagBoundaryScan">
|
||||
{{ eqps.enableJtagBoundaryScan ? "关闭边界扫描" : "启动边界扫描" }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -45,10 +57,24 @@ import { computed, ref, watchEffect } from "vue";
|
||||
interface CapsProps {
|
||||
jtagAddr?: string;
|
||||
jtagPort?: number;
|
||||
jtagFreq?: string;
|
||||
}
|
||||
|
||||
const emits = defineEmits<{
|
||||
changeJtagFreq: [text: string];
|
||||
}>();
|
||||
const props = withDefaults(defineProps<CapsProps>(), {});
|
||||
|
||||
const selectJtagSpeedOptions = ref([
|
||||
{ text: "25 MHz", id: 1 },
|
||||
{ text: "12.5 MHz", id: 2 },
|
||||
{ text: "6.25 MHz", id: 3 },
|
||||
{ text: "3.125 MHz", id: 4 },
|
||||
{ text: "1562.5 KHz", id: 5 },
|
||||
{ text: "781.25 KHz", id: 6 },
|
||||
{ text: "390.625 KHz", id: 7 },
|
||||
]);
|
||||
|
||||
// Global Stores
|
||||
const dialog = useDialogStore();
|
||||
const eqps = useEquipments();
|
||||
@@ -68,6 +94,12 @@ function handleBitstreamChange(file: File | undefined) {
|
||||
eqps.jtagBitstream = file;
|
||||
}
|
||||
|
||||
function handleSelectJtagSpeed(event: Event) {
|
||||
const target = event.target as HTMLSelectElement;
|
||||
eqps.jtagSetSpeed(target.selectedIndex);
|
||||
emits("changeJtagFreq", target.value);
|
||||
}
|
||||
|
||||
async function toggleJtagBoundaryScan() {
|
||||
if (eqps.jtagClientMutex.isLocked()) {
|
||||
dialog.warn("Jtag正在被占用");
|
||||
|
||||
Reference in New Issue
Block a user