[genpinmap] Add missing pins

Fix #31

Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
This commit is contained in:
Frederic.Pillon 2019-01-03 10:25:40 +01:00 committed by Frederic Pillon
parent 0d12a70274
commit 840b8d62cc

View file

@ -50,7 +50,7 @@ def get_gpio_af_num(pintofind, iptofind):
return get_gpio_af_numF1(pintofind, iptofind) return get_gpio_af_numF1(pintofind, iptofind)
# DBG print ('pin to find ' + pintofind) # DBG print ('pin to find ' + pintofind)
i = 0 i = 0
mygpioaf = "NOTFOUND" mygpioaf = ""
for n in xml_gpio.documentElement.childNodes: for n in xml_gpio.documentElement.childNodes:
i += 1 i += 1
j = 0 j = 0
@ -79,27 +79,20 @@ def get_gpio_af_num(pintofind, iptofind):
if myc.nodeType == Node.ELEMENT_NODE: if myc.nodeType == Node.ELEMENT_NODE:
# myc = node of ALTERNATE # myc = node of ALTERNATE
for mygpioaflist in myc.childNodes: for mygpioaflist in myc.childNodes:
mygpioaf += ( if mygpioaflist.data not in mygpioaf:
" " + mygpioaflist.data if mygpioaf != "":
) mygpioaf += " "
mygpioaf += mygpioaflist.data
# print (mygpioaf) # print (mygpioaf)
if mygpioaf == "NOTFOUND": if mygpioaf == "":
print( mygpioaf = "GPIO_AF_NONE"
"GPIO AF not found in " return mygpioaf
+ gpiofile
+ " for "
+ pintofind
+ " and the IP "
+ iptofind
)
# quit()
return mygpioaf.replace("NOTFOUND ", "")
def get_gpio_af_numF1(pintofind, iptofind): def get_gpio_af_numF1(pintofind, iptofind):
# print ('pin to find ' + pintofind + ' ip to find ' + iptofind) # print ('pin to find ' + pintofind + ' ip to find ' + iptofind)
i = 0 i = 0
mygpioaf = "NOTFOUND" mygpioaf = ""
for n in xml_gpio.documentElement.childNodes: for n in xml_gpio.documentElement.childNodes:
i += 1 i += 1
j = 0 j = 0
@ -127,7 +120,9 @@ def get_gpio_af_numF1(pintofind, iptofind):
p.nodeType == Node.ELEMENT_NODE p.nodeType == Node.ELEMENT_NODE
and p.hasChildNodes() is False and p.hasChildNodes() is False
): ):
mygpioaf += " AFIO_NONE" if mygpioaf != "":
mygpioaf += " "
mygpioaf += "AFIO_NONE"
else: else:
for s in p.childNodes: for s in p.childNodes:
if s.nodeType == Node.ELEMENT_NODE: if s.nodeType == Node.ELEMENT_NODE:
@ -143,24 +138,17 @@ def get_gpio_af_numF1(pintofind, iptofind):
for ( for (
mygpioaflist mygpioaflist
) in myc.childNodes: ) in myc.childNodes:
mygpioaf += " " + mygpioaflist.data.replace( if mygpioaf != "":
mygpioaf += " "
mygpioaf += mygpioaflist.data.replace(
"__HAL_", "" "__HAL_", ""
).replace( ).replace(
"_REMAP", "" "_REMAP", ""
) )
# print mygpioaf # print mygpioaf
if mygpioaf == "NOTFOUND": if mygpioaf == "":
print(
"GPIO AF not found in "
+ gpiofile
+ " for "
+ pintofind
+ " and the IP "
+ iptofind
+ " set as AFIO_NONE"
)
mygpioaf = "AFIO_NONE" mygpioaf = "AFIO_NONE"
return mygpioaf.replace("NOTFOUND ", "") return mygpioaf
def store_pin(pin, name): def store_pin(pin, name):
@ -462,7 +450,6 @@ def print_dac():
def print_i2c(lst): def print_i2c(lst):
for p in lst: for p in lst:
result = get_gpio_af_num(p[1], p[2]) result = get_gpio_af_num(p[1], p[2])
if result != "NOTFOUND":
s1 = "%-10s" % (" {" + p[0] + ",") s1 = "%-10s" % (" {" + p[0] + ",")
# 2nd element is the I2C XXX signal # 2nd element is the I2C XXX signal
b = p[2].split("_")[0] b = p[2].split("_")[0]
@ -486,7 +473,6 @@ def print_i2c(lst):
def print_pwm(): def print_pwm():
for p in pwm_list: for p in pwm_list:
result = get_gpio_af_num(p[1], p[2]) result = get_gpio_af_num(p[1], p[2])
if result != "NOTFOUND":
s1 = "%-10s" % (" {" + p[0] + ",") s1 = "%-10s" % (" {" + p[0] + ",")
# 2nd element is the PWM signal # 2nd element is the PWM signal
a = p[2].split("_") a = p[2].split("_")
@ -516,7 +502,6 @@ def print_pwm():
def print_uart(lst): def print_uart(lst):
for p in lst: for p in lst:
result = get_gpio_af_num(p[1], p[2]) result = get_gpio_af_num(p[1], p[2])
if result != "NOTFOUND":
s1 = "%-10s" % (" {" + p[0] + ",") s1 = "%-10s" % (" {" + p[0] + ",")
# 2nd element is the UART_XX signal # 2nd element is the UART_XX signal
b = p[2].split("_")[0] b = p[2].split("_")[0]
@ -540,7 +525,6 @@ def print_uart(lst):
def print_spi(lst): def print_spi(lst):
for p in lst: for p in lst:
result = get_gpio_af_num(p[1], p[2]) result = get_gpio_af_num(p[1], p[2])
if result != "NOTFOUND":
s1 = "%-10s" % (" {" + p[0] + ",") s1 = "%-10s" % (" {" + p[0] + ",")
# 2nd element is the SPI_XXXX signal # 2nd element is the SPI_XXXX signal
instance = p[2].split("_")[0].replace("SPI", "") instance = p[2].split("_")[0].replace("SPI", "")
@ -560,7 +544,6 @@ def print_spi(lst):
def print_can(lst): def print_can(lst):
for p in lst: for p in lst:
result = get_gpio_af_num(p[1], p[2]) result = get_gpio_af_num(p[1], p[2])
if result != "NOTFOUND":
s1 = "%-10s" % (" {" + p[0] + ",") s1 = "%-10s" % (" {" + p[0] + ",")
# 2nd element is the CAN_XX signal # 2nd element is the CAN_XX signal
instance = p[2].split("_")[0].replace("CAN", "") instance = p[2].split("_")[0].replace("CAN", "")
@ -586,7 +569,6 @@ def print_eth():
prev_s = "" prev_s = ""
for p in eth_list: for p in eth_list:
result = get_gpio_af_num(p[1], p[2]) result = get_gpio_af_num(p[1], p[2])
if result != "NOTFOUND":
s1 = "%-10s" % (" {" + p[0] + ",") s1 = "%-10s" % (" {" + p[0] + ",")
# 2nd element is the ETH_XXXX signal # 2nd element is the ETH_XXXX signal
s1 += "ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, " + result + ")}," s1 += "ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, " + result + ")},"
@ -611,7 +593,6 @@ def print_qspi():
prev_s = "" prev_s = ""
for p in qspi_list: for p in qspi_list:
result = get_gpio_af_num(p[1], p[2]) result = get_gpio_af_num(p[1], p[2])
if result != "NOTFOUND":
s1 = "%-10s" % (" {" + p[0] + ",") s1 = "%-10s" % (" {" + p[0] + ",")
# 2nd element is the QUADSPI_XXXX signal # 2nd element is the QUADSPI_XXXX signal
s1 += "QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, " + result + ")}," s1 += "QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, " + result + ")},"