blob: fdd085c9e4223a1cb550fb79fb234ce705fdaf1b (
plain)
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
|
#!/usr/bin/python
import os
# Memory Map
misc_base = 0 << 7
uart_base = 1 << 7
spi_base = 2 << 7
i2c_base = 3 << 7
gpio_base = 4 << 7
settings_base = 5 << 7
# GPIO offset
gpio_pins = 0
gpio_ddr = 4
gpio_ctrl_lo = 8
gpio_ctrl_hi = 12
def set_reg(reg, val):
os.system("./usrp1-e-ctl w %d 1 %d" % (reg,val))
def get_reg(reg):
fin,fout = os.popen4("./usrp1-e-ctl r %d 1" % (reg,))
print fout.read()
# Set DDRs to output
set_reg(gpio_base+gpio_ddr, 0xFFFF)
set_reg(gpio_base+gpio_ddr+2, 0xFFFF)
# Set CTRL to Debug #0 ( A is for debug 0, F is for debug 1 )
set_reg(gpio_base+gpio_ctrl_lo, 0xAAAA)
set_reg(gpio_base+gpio_ctrl_lo+2, 0xAAAA)
set_reg(gpio_base+gpio_ctrl_hi, 0xAAAA)
set_reg(gpio_base+gpio_ctrl_hi+2, 0xAAAA)
|