Makefile: added tests, not working
[beagleboard-validation:scripts.git] / test-pwm / Makefile
1 PWM = am33xx_pwm
2 PINS_A = \
3         P9_22 \
4         P9_21 \
5         P9_14 \
6         P9_16 \
7         P8_19 \
8         P8_13 \
9
10 #       P9_42 \
11 #       P9_28 \
12
13 PINS_B = \
14         P9_31 \
15         P9_29 \
16         P8_34 \
17         P8_36 \
18         P8_45 \
19         P8_46 \
20
21 DTBO_FILES_A = $(foreach device,$(PINS_A),bone_pwm_$(device)-00A0.dtbo)
22 DTBO_FILES_B = $(foreach device,$(PINS_B),bone_pwm_$(device)-00A0.dtbo)
23 DTBO_FILES = $(PWM)-00A0.dtbo $(DTBO_FILES_A) $(DTBO_FILES_B)
24 SLOTS=$(shell ls /sys/devices/bone_capemgr.*/slots)
25
26 all:    $(DTBO_FILES)
27
28 clean:
29         rm $(DTBO_FILES)
30
31 install:
32         install -m 0644 $(DTBO_FILES) /lib/firmware
33
34 load_dtbo_pwm:
35 #       echo $(PWM) > $(SLOTS)
36
37 load_dtbo_pins_a: load_dtbo_pwm
38 #       for pin in $(PINS_A) ; do \
39 #               echo bone_pwm_$$pin > $(SLOTS) ; \
40 #       done;
41
42 test:
43         cat $(SLOTS)
44         for pin in $(PINS_A) ; do \
45                 DUTY=`ls /sys/devices/ocp.*/pwm_test_$$pin*/duty` \
46                 if [ $$? -eq 0 ] ; then \
47                         echo 250000 > $$DUTY ; \
48                 fi; \
49         done;
50
51 %.dtbo: %.dts
52         dtc -O dtb -o $@ -b 0 -@ $<