Skip to content

Commit

Permalink
GIT: Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
laborleben committed May 25, 2016
2 parents 0a431ac + 6d8fb94 commit c9b3fad
Show file tree
Hide file tree
Showing 89 changed files with 4,051 additions and 643 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ results.xml

firmware/modules/chipscope/*
!firmware/modules/chipscope/*.xise
!firmware/modules/chipscope/*.xco
!firmware/modules/chipscope/*.xco

examples/mmc3_eth/firmware/vivado/*
!examples/mmc3_eth/firmware/vivado/*.xpr
examples/mmc3_eth/firmware/src/SiTCP

19 changes: 16 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ install:
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH=$HOME/miniconda/bin:$PATH
- conda update --yes conda
- conda install --yes numpy bitarray nose pyyaml
- pip install pyvisa pyvisa-sim
- conda install --yes numpy bitarray nose pyyaml coverage
- pip install pyvisa pyvisa-sim coveralls

#cocotb
- git clone https://github.com/potentialventures/cocotb.git
Expand All @@ -36,4 +36,17 @@ install:
- python setup.py develop

script:
- nosetests tests/test_*.py examples/MIO/tb/test_*.py examples/mio_sram_test/tests/test_*.py examples/mio_pixel/tests/test_*.py
- nosetests --with-coverage --cover-package=basil tests/test_*.py examples/MIO/tb/test_*.py examples/mio_sram_test/tests/test_*.py examples/mio_pixel/tests/test_*.py

after_success:
- coveralls

deploy:
provider: pypi
user: DavidLP
password:
secure: EOfeXP4oyoNLY8Ot2/pX3k2Acvk5Xn0VkBeqXHND/rjm4iveUGrLbMDOffDnvkFgSYQ6PO/UqZjSb8vPd5nQ1Uhw8YyEhXUTPVWOz7ebq/xOmI8DIpFQH24/u7K3D9ygm7mlN3ozz9/6Gvk2VXk8OUT8csMtIJ586FnNBFdq0XVXzneHx6Ppr4GvAvh5Li5dd0ZqL1Cd2JZZyhWbQzidJgBkU1NOD7pRmEPh7dfG23rOEuzHQPyip8PKw86ErbjRD6WevjyFsetT66je3G8+ZSvJIDNVQ95oohhBZ7bRA+VwHnt2MdWxBYSAq7ZxbNmcs5LsvuNiJRyGo9Iue97yKI/EX0GzK/mA0pO/kdu0n1BzXxVePtxBOxLgzmEKs2S0IV45zdlAIfOjs7gLM8mHjiFC6oFuDddKPp5dYRMpOERt3jfQVBbSWpGkN4tcwXZ/1xMm1IxTaU06YQMLKtRqo2N5k9aWMSsvFfagQ44WW658ra/15TdaZyniBCiYQ0a3NDYEpjZX4n4Sh0JDcGqlyOJcpcq+gl2NaIADX+X6Qoe6C7s036LowfoTDh83X72hjvm8smrdGL1op7DQo3dGxwU6FRvf78Qw528v2CkrdTHzIOr5IEuZkh+xGiGJE2UDTwHdq/nAr+O79s2yAakvf/DL/s8ZU+MvZ21dobtnLAg=
on:
tags: true
repo: SiLab-Bonn/basil
distributions: "sdist bdist_wheel"
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ recursive-include docs *
recursive-include examples *
recursive-include firmware *
recursive-include tests *
recursive-include basil *.yaml
global-exclude *.pyc .project .pydevproject build
14 changes: 11 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,17 @@ or install via PyPI into the Python's site-packages folder (for non-developers):
pip install basil_daq==version
where version is a version number (e.g. 2.4.2)
where version is a version number (e.g. 2.4.3)

or install from git, when no PyPI package is available (for non-developers):

.. code-block:: bash
pip install git+https://github.com/SiLab-Bonn/basil.git@branch
where branch is a branch name (e.g. master or v2.4.2).
where branch is a branch name (e.g. master or v2.4.3).

Check `.travis.yml <.travis.yml>`_ for installation/testing hints.

Support
=======
Expand All @@ -65,14 +67,20 @@ Features
============
Firmware:
- very simple single master bus definition
- multiple basic modules (SPI, SEQ, GPIO, I2C)
- multiple basic modules (SPI, SEQ, GPIO, I2C, JTAG)
- multiple interfaces (UART, USB2, USB3, Ethernet)
Software:
- layer structure following hardware
- generation based on yaml file
- register abstract layer (RAL)
- simulator interface allows software test against simulated RTL (thanks to `cocotb <https://github.com/potentialventures/cocotb>`_)

Example Projects:
=================
- `pyBar <https://github.com/SiLab-Bonn/pyBAR>`_ - Bonn ATLAS Readout in Python and C++
- `MCA <https://github.com/SiLab-Bonn/MCA>`_ - Multi Channel Analyzer
- `fe65_p2 <https://github.com/SiLab-Bonn/fe65_p2>`_ - DAQ for FE65P2 prototype

License
============

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.2
2.4.3
36 changes: 36 additions & 0 deletions basil/HL/Arduino.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#
# ------------------------------------------------------------
# Copyright (c) All rights reserved
# SiLab, Institute of Physics, University of Bonn
# ------------------------------------------------------------
#

from basil.HL.RegisterHardwareLayer import HardwareLayer


class Arduino(HardwareLayer):

'''Implement functions to steer the Arduino digital IO using the BASIL Arduino firmware.
'''

def __init__(self, intf, conf):
super(Arduino, self).__init__(intf, conf)

def set_output(self, channel, value):
if value == 'ON':
value = 1
elif value == 'OFF':
value = 0

if value != 0 and value != 1:
raise ValueError('The value for the output has to be ON, OFF, 0 or 1')

if channel == 'ALL':
channel = 99 # All channels are internally channel 99

if channel < 2 or (channel > 13 and channel != 99):
raise ValueError('Arduino supports only 14 IOs and pins 0 and 1 are blocked by Serial communication. %d is out of range' % channel)

self._intf.write('GPIO%d %d' % (channel, value))
if self._intf.read() == 'r': # Wait for response of Arduino
raise RuntimeError('Got no or wrong response from Arduino!')
5 changes: 1 addition & 4 deletions basil/HL/FEI4AdapterCard.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,17 +321,14 @@ def __init__(self, intf, conf):

def init(self):
self._setup_adc(self.SETUP_FLAGS)

self._init.setdefault('no_calibration', False)
# read calibration
if not self._init['no_calibration']:
self.read_eeprom_calibration()
logging.info('Found adapter card: {}'.format('%s with ID %s' % ('Single Chip Adapter Card', self.get_id())))
else:
logging.info('FEI4AdapterCard: Skeeping calibration.')




def read_eeprom_calibration(self, temperature=False): # use default values for temperature, EEPROM values are usually not calibrated and random
'''Reading EEPROM calibration for power regulators and temperature
Expand Down
126 changes: 126 additions & 0 deletions basil/HL/JtagGpio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
#
# ------------------------------------------------------------
# Copyright (c) All rights reserved
# SiLab, Institute of Physics, University of Bonn
# ------------------------------------------------------------
#
import yaml

from basil.HL.HardwareLayer import HardwareLayer
from basil.RL.StdRegister import StdRegister
from basil.utils.BitLogic import BitLogic


class JtagGpio(HardwareLayer):
'''GPIO based JTAG interface
'''
jtag_gpio_yaml = """
name : GPIO
type : StdRegister
driver : None
size : 8
fields:
- name : RESETB
size : 1
offset : 0
- name : TCK
size : 1
offset : 1
- name : TMS
size : 1
offset : 2
- name : TDI
size : 1
offset : 3
- name : TDO
size : 1
offset : 4
"""

def __init__(self, intf, conf):
super(JtagGpio, self).__init__(intf, conf)

cfg = yaml.load(self.jtag_gpio_yaml)
self.reg = StdRegister(driver=None, conf=cfg)

# self.RESETB = 0
# self.TCK = 0
# self.reg['TMS'] = 0
# self.TDI = 0
# self.TD0 = 0

def init(self):
pass

def reset(self):
self.reg['RESETB'] = 0
self._write(tck=False)
self.reg['RESETB'] = 1
self._write(tck=False)
self.tms_reset()

def tms_reset(self):
for _ in range(5):
self.reg['TMS'] = 1
self._write()

self.reg['TMS'] = 0
self._write() # idle

def scan_ir(self, data):
self.reg['TMS'] = 1
self._write()

self.reg['TMS'] = 1
self._write() # select ir

return self._scan(data)

def scan_dr(self, data):

self.reg['TMS'] = 1
self._write() # select dr

return self._scan(data)

def _scan(self, data):

self.reg['TMS'] = 0
self._write() # capture

self.reg['TMS'] = 0
ret_bit = self._write() # shift

ret = []
for dev in range(len(data)):
dev_ret = BitLogic(len(data[dev]))
for bit in range(len(data[dev])):
if dev == len(data) - 1 and bit == len(data[dev]) - 1:
self.reg['TMS'] = 1 # exit1
self.reg['TDI'] = data[dev][bit]
dev_ret[bit] = ret_bit
ret_bit = self._write()
ret.append(dev_ret)

self.reg['TDI'] = 0
self.reg['TMS'] = 1
self._write() # update

self.reg['TMS'] = 0
self._write() # idle

return ret

def _write(self, tck=True):

self._intf.set_data(self.reg.tobytes())

if(tck):
self.reg['TCK'] = 0
self._intf.set_data(self.reg.tobytes())
self.reg['TCK'] = 1
self._intf.set_data(self.reg.tobytes())
self.reg['TCK'] = 0
self._intf.set_data(self.reg.tobytes())

return (self._intf.get_data()[0] & 0b0010000) >> 4 # TODO:
Loading

0 comments on commit c9b3fad

Please sign in to comment.