-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathSetBaudrate.py
More file actions
37 lines (29 loc) · 815 Bytes
/
SetBaudrate.py
File metadata and controls
37 lines (29 loc) · 815 Bytes
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
# SPDX-License-Identifier: GPL-2.0
#
# Nuvoton IGPS: Image Generation And Programming Scripts For Poleg BMC
#
# Copyright (C) 2018 Nuvoton Technologies, All Rights Reserved
#-------------------------------------------------------------------------
import os
import sys
import struct
import ImageProgramming.ProgrammerMonitor
try:
currpath = os.getcwd()
os.chdir(os.path.dirname(os.path.abspath(__file__)))
if len(sys.argv) < 2:
baudrate = 750000
if len(sys.argv) == 2:
try:
baudrate = int(sys.argv[1])
except Exception:
print ("Invalid Parameter")
raise
if len(sys.argv) > 2:
raise Exception("Too many arguments")
ImageProgramming.ProgrammerMonitor.load_monitor()
ImageProgramming.ProgrammerMonitor.set_baudrate(baudrate)
except Exception as e:
print(e)
finally:
os.chdir(currpath)