1SUMMARY = "Bletchley Motor control"
2PR = "r1"
3LICENSE = "Apache-2.0"
4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
5
6inherit obmc-phosphor-systemd
7
8RDEPENDS:${PN} += "bash"
9RDEPENDS:${PN} += "i2c-tools"
10RDEPENDS:${PN} += "libgpiod-tools"
11RDEPENDS:${PN} += "mdio-tools"
12RDEPENDS:${PN} += "bletchley-common-functions"
13
14S = "${WORKDIR}"
15SRC_URI += " \
16    file://motor-ctrl \
17    file://motor-init \
18    file://power-ctrl \
19    "
20
21do_install() {
22        install -d ${D}${sbindir}
23        install -m 0755 ${WORKDIR}/power-ctrl ${D}${sbindir}
24
25        install -d ${D}${libexecdir}
26        install -m 0755 ${WORKDIR}/motor-ctrl ${D}${libexecdir}
27        install -m 0755 ${WORKDIR}/motor-init ${D}${libexecdir}
28}
29
30TGT = "${SYSTEMD_DEFAULT_TARGET}"
31MOTOR_INIT_INSTFMT="../motor-init-calibration@.service:${TGT}.wants/motor-init-calibration@{0}.service"
32PWR_ON_INSTFMT="../host-poweron@.service:obmc-host-starting@{0}.target.wants/host-poweron@{0}.service"
33PWR_OFF_INSTFMT="../host-poweroff@.service:obmc-host-stopping@{0}.target.wants/host-poweroff@{0}.service"
34PWR_RESET_INSTFMT="host-reset@.service:host-reset@{0}.service"
35PWR_CYCLE_INSTFMT="host-cycle@.service:host-cycle@{0}.service"
36AC_ON_INSTFMT="../host-ac-on@.service:obmc-chassis-poweron@{0}.target.requires/host-ac-on@{0}.service"
37AC_OFF_INSTFMT="../host-ac-off@.service:obmc-chassis-poweroff@{0}.target.requires/host-ac-off@{0}.service"
38
39SYSTEMD_SERVICE:${PN} += "motor-init-calibration@.service"
40SYSTEMD_LINK:${PN} += "${@compose_list(d, 'MOTOR_INIT_INSTFMT', 'OBMC_HOST_INSTANCES')}"
41
42SYSTEMD_SERVICE:${PN} += "host-poweron@.service"
43SYSTEMD_LINK:${PN} += "${@compose_list(d, 'PWR_ON_INSTFMT', 'OBMC_HOST_INSTANCES')}"
44
45SYSTEMD_SERVICE:${PN} += "host-poweroff@.service"
46SYSTEMD_LINK:${PN} += "${@compose_list(d, 'PWR_OFF_INSTFMT', 'OBMC_HOST_INSTANCES')}"
47
48SYSTEMD_SERVICE:${PN} += "host-reset@.service"
49SYSTEMD_LINK:${PN} += "${@compose_list(d, 'PWR_RESET_INSTFMT', 'OBMC_HOST_INSTANCES')}"
50
51SYSTEMD_SERVICE:${PN} += "host-cycle@.service"
52SYSTEMD_LINK:${PN} += "${@compose_list(d, 'PWR_CYCLE_INSTFMT', 'OBMC_HOST_INSTANCES')}"
53
54SYSTEMD_SERVICE:${PN} += "host-ac-on@.service"
55SYSTEMD_LINK:${PN} += "${@compose_list(d, 'AC_ON_INSTFMT', 'OBMC_HOST_INSTANCES')}"
56
57SYSTEMD_SERVICE:${PN} += "host-ac-off@.service"
58SYSTEMD_LINK:${PN} += "${@compose_list(d, 'AC_OFF_INSTFMT', 'OBMC_HOST_INSTANCES')}"
59
60