Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Rethusan committed Jul 25, 2023
1 parent 6524e49 commit 40d7f2c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 40 deletions.
6 changes: 3 additions & 3 deletions platform/panduza_platform/connectors/boundary_scan_ftdi.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def __init__(self,**kwargs):
usb_vendor = kwargs.get('usb_vendor', "0403")
usb_model = kwargs.get('usb_model', "6014")
jtag_frequency = kwargs.get('jtag_frequency', 6E6)
jtag_bsdl_folder = kwargs.get('jtag_bsdl_folder', "/home/rethusan/test/BSDL") #################
jtag_bsdl_folder = kwargs.get('jtag_bsdl_folder', None) #################

# Init engine
self.engine = JtagEngine(frequency=float(jtag_frequency))
Expand Down Expand Up @@ -371,7 +371,7 @@ def write (self, device_number,pin,value):

self.check_device(device_number)
#print (bit_settings)
boundary_reg = bit_settings ###############################
boundary_reg = bit_settings

bit_settings = get_bit_settings(bit_state_dict, boundary_reg)

Expand Down Expand Up @@ -435,7 +435,7 @@ def instruction (self,device_number,mode):
""" function that generate the instruction to control the device wanted """

tab = []
instruct = self.instruct.copy() ###############
instruct = self.instruct.copy()

#print(instruct)
if mode == "extest":
Expand Down
57 changes: 27 additions & 30 deletions platform/panduza_platform/devices/ftdi/ft232h_jtag.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ def _PZA_DEV_interfaces(self):






for device_number in range(0,number_of_devices):
if pins[device_number] is not None:
for pin in pins[device_number]:
Expand Down Expand Up @@ -123,47 +120,47 @@ def get_pins_from_idcode(self,jtag_bsdl_folder):



async def get_pins_from_idcode(jtag_bsdl_folder,jtag_frequency):
# async def get_pins_from_idcode(jtag_bsdl_folder,jtag_frequency):

idcode_modified = []
pins = []
# idcode_modified = []
# pins = []

idcode_bsdl = read_bsdlJson_files.get_idcode_from_bsdl(jtag_bsdl_folder)
pins_bsdl = read_bsdlJson_files.get_pins_from_bsdl(jtag_bsdl_folder)
# idcode_bsdl = read_bsdlJson_files.get_idcode_from_bsdl(jtag_bsdl_folder)
# pins_bsdl = read_bsdlJson_files.get_pins_from_bsdl(jtag_bsdl_folder)

jtag_connector = await ConnectorBoundaryScanFtdi.Get(usb_vendor=USBID_VENDOR,
usb_model=USBID_MODEL,
usb_serial_short=USBID_SERIAL_SHORT,
jtag_bsdl_folder=jtag_bsdl_folder,
jtag_frequency=jtag_frequency)
# jtag_connector = await ConnectorBoundaryScanFtdi.Get(usb_vendor=USBID_VENDOR,
# usb_model=USBID_MODEL,
# usb_serial_short=USBID_SERIAL_SHORT,
# jtag_bsdl_folder=jtag_bsdl_folder,
# jtag_frequency=jtag_frequency)



idcodes_detected = await jtag_connector.get_idcodes()
# idcodes_detected = await jtag_connector.get_idcodes()

# Remove the first 4 bits of the idcodes (= idcode without 4-bit version number)
for n in range (len(idcodes_detected)):
idcode_modified.append(hex(int(idcodes_detected[n][-7:],16)))
# # Remove the first 4 bits of the idcodes (= idcode without 4-bit version number)
# for n in range (len(idcodes_detected)):
# idcode_modified.append(hex(int(idcodes_detected[n][-7:],16)))

for j in range(len(idcode_modified)):
for k in range(len(idcode_bsdl)) :
# for j in range(len(idcode_modified)):
# for k in range(len(idcode_bsdl)) :

if idcode_modified[j] == idcode_bsdl[k]:
pins.append(pins_bsdl[k])
# if idcode_modified[j] == idcode_bsdl[k]:
# pins.append(pins_bsdl[k])

return pins
# return pins




def run_async_function(jtag_bsdl_folder,jtag_frequency):
# loop = asyncio.new_event_loop()
#asyncio.set_event_loop(loop)
print("pookkkkkkk")
pins = asyncio.get_event_loop().run_until_complete(get_pins_from_idcode(jtag_bsdl_folder, jtag_frequency))
print("fiiiiiiiiiiiiiiiiiiiiiiiin")
#return pins
return [ None,["PA5","PA10"],None,["PA5","PA10"]]
# def run_async_function(jtag_bsdl_folder,jtag_frequency):
# # loop = asyncio.new_event_loop()
# #asyncio.set_event_loop(loop)
# print("pookkkkkkk")
# pins = asyncio.get_event_loop().run_until_complete(get_pins_from_idcode(jtag_bsdl_folder, jtag_frequency))
# print("fiiiiiiiiiiiiiiiiiiiiiiiin")
# #return pins
# return [ None,["PA5","PA10"],None,["PA5","PA10"]]



Expand Down
21 changes: 14 additions & 7 deletions platform/panduza_platform/meta_drivers/dio.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,17 @@ async def __poll_trigger(self):

if self.trigger:

v = await self._PZA_DRV_DIO_get_state_active()
await self._update_attribute("state", "active", v, 'always')
# v = await self._PZA_DRV_DIO_get_state_active()
# w = await self._PZA_DRV_DIO_get_state_activeLow()
# x = await self._PZA_DRV_DIO_get_direction_pull()
# y = await self._PZA_DRV_DIO_get_direction_value()

# await self._update_attribute("state", "active", v, 'always')
# await self._update_attribute("state", "active_low", w, 'always')
# await self._update_attribute("direction", "pull", x, 'always')
# await self._update_attribute("direction", "value", y, 'always')

await self.__update_attribute_initial()

self.trigger = False

Expand All @@ -258,12 +267,10 @@ async def __poll_trigger(self):
# return
# if (time.perf_counter() - self.__polling_cycle) > polling_cycle:
# p = False
# p = await self._update_attribute("state", "active_low", await self._PZA_DRV_DIO_get_state_activeLow(), False) or p
# p = await self._update_attribute("state", "active", await self._PZA_DRV_DIO_get_state_active(), False) or p
# p = await self._update_attribute("state", "active_low", await self._PZA_DRV_DIO_get_state_activeLow(), 'always') or p
# p = await self._update_attribute("state", "active", await self._PZA_DRV_DIO_get_state_active(), 'always') or p

# if p:
# await self._push_attribute("state")
# self.__polling_cycle = time.perf_counter()
# self.__polling_cycle = time.perf_counter()



Expand Down

0 comments on commit 40d7f2c

Please sign in to comment.