Skip to content

Commit

Permalink
[datalink] NOT all firmwares use datalink.c
Browse files Browse the repository at this point in the history
this is only used in fixedwing and rotorcraft
Other firmware can/should provide their own dl_parse_msg
  • Loading branch information
flixr committed Jan 31, 2016
1 parent 2eb91be commit 8390478
Show file tree
Hide file tree
Showing 20 changed files with 22 additions and 10 deletions.
Expand Up @@ -5,6 +5,7 @@ ifeq ($(TARGET),ap)
include $(CFG_SHARED)/telemetry_bluegiga.makefile
endif

ap.srcs += subsystems/datalink/datalink.c
ap.srcs += $(SRC_FIRMWARE)/fixedwing_datalink.c $(SRC_FIRMWARE)/ap_downlink.c

# avoid fbw_telemetry_mode error
Expand Down
Expand Up @@ -5,6 +5,7 @@ ifeq ($(TARGET),ap)
include $(CFG_SHARED)/telemetry_transparent.makefile
endif

ap.srcs += subsystems/datalink/datalink.c
ap.srcs += $(SRC_FIRMWARE)/fixedwing_datalink.c $(SRC_FIRMWARE)/ap_downlink.c

# avoid fbw_telemetry_mode error
Expand Down
Expand Up @@ -6,6 +6,7 @@ ifeq ($(TARGET), ap)
include $(CFG_SHARED)/telemetry_transparent_usb.makefile
endif

ap.srcs += subsystems/datalink/datalink.c
ap.srcs += $(SRC_FIRMWARE)/fixedwing_datalink.c $(SRC_FIRMWARE)/ap_downlink.c $(SRC_FIRMWARE)/fbw_downlink.c
# avoid fbw_telemetry_mode error
ap.srcs += $(SRC_FIRMWARE)/fbw_downlink.c
Expand Down
Expand Up @@ -6,6 +6,7 @@ ifeq ($(TARGET), ap)
include $(CFG_SHARED)/telemetry_w5100.makefile
endif

ap.srcs += subsystems/datalink/datalink.c
ap.srcs += $(SRC_FIRMWARE)/fixedwing_datalink.c $(SRC_FIRMWARE)/ap_downlink.c

# avoid fbw_telemetry_mode error
Expand Down
Expand Up @@ -7,6 +7,7 @@ ifeq ($(TARGET),ap)
include $(CFG_SHARED)/telemetry_xbee_api.makefile
endif

ap.srcs += subsystems/datalink/datalink.c
ap.srcs += $(SRC_FIRMWARE)/fixedwing_datalink.c $(SRC_FIRMWARE)/ap_downlink.c

# avoid fbw_telemetry_mode error
Expand Down
Expand Up @@ -6,4 +6,5 @@ ifeq ($(TARGET), ap)
include $(CFG_SHARED)/telemetry_bluegiga.makefile
endif

ap.srcs += subsystems/datalink/datalink.c
ap.srcs += $(SRC_FIRMWARE)/rotorcraft_datalink.c $(SRC_FIRMWARE)/rotorcraft_telemetry.c
Expand Up @@ -7,5 +7,6 @@ ifeq ($(TARGET), ap)
include $(CFG_SHARED)/telemetry_superbitrf.makefile
endif

ap.srcs += subsystems/datalink/datalink.c
# add rotorcraft specific files
ap.srcs += $(SRC_FIRMWARE)/rotorcraft_datalink.c $(SRC_FIRMWARE)/rotorcraft_telemetry.c
Expand Up @@ -9,4 +9,5 @@ ifeq ($(TARGET), ap)
include $(CFG_SHARED)/telemetry_transparent.makefile
endif

ap.srcs += subsystems/datalink/datalink.c
ap.srcs += $(SRC_FIRMWARE)/rotorcraft_datalink.c $(SRC_FIRMWARE)/rotorcraft_telemetry.c
Expand Up @@ -5,4 +5,5 @@ ifeq ($(TARGET), ap)
include $(CFG_SHARED)/telemetry_transparent_udp.makefile
endif

ap.srcs += subsystems/datalink/datalink.c $(SRC_FIRMWARE)/rotorcraft_datalink.c $(SRC_FIRMWARE)/rotorcraft_telemetry.c
ap.srcs += subsystems/datalink/datalink.c
ap.srcs += $(SRC_FIRMWARE)/rotorcraft_datalink.c $(SRC_FIRMWARE)/rotorcraft_telemetry.c
Expand Up @@ -5,4 +5,5 @@ ifeq ($(TARGET), ap)
include $(CFG_SHARED)/telemetry_transparent_usb.makefile
endif

ap.srcs += subsystems/datalink/datalink.c
ap.srcs += $(SRC_FIRMWARE)/rotorcraft_datalink.c $(SRC_FIRMWARE)/rotorcraft_telemetry.c
Expand Up @@ -10,4 +10,5 @@ ifeq ($(TARGET), ap)
include $(CFG_SHARED)/telemetry_xbee_api.makefile
endif

ap.srcs += subsystems/datalink/datalink.c
ap.srcs += $(SRC_FIRMWARE)/rotorcraft_datalink.c $(SRC_FIRMWARE)/rotorcraft_telemetry.c
Expand Up @@ -31,5 +31,5 @@ ifneq ($(MODEM_LED),none)
ap.CFLAGS += -DMODEM_LED=$(MODEM_LED)
endif

ap.srcs += $(SRC_SUBSYSTEMS)/datalink/downlink.c subsystems/datalink/datalink.c $(SRC_SUBSYSTEMS)/datalink/bluegiga.c
ap.srcs += $(SRC_SUBSYSTEMS)/datalink/downlink.c $(SRC_SUBSYSTEMS)/datalink/bluegiga.c
ap.srcs += $(PAPARAZZI_HOME)/var/share/pprzlink/src/pprz_transport.c $(SRC_SUBSYSTEMS)/datalink/telemetry.c
2 changes: 1 addition & 1 deletion conf/firmwares/subsystems/shared/telemetry_ivy.makefile
@@ -1,3 +1,3 @@
$(TARGET).CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_TRANSPORT=ivy_tp -DDOWNLINK_DEVICE=ivy_tp
$(TARGET).srcs += $(PAPARAZZI_HOME)/var/share/pprzlink/src/ivy_transport.c
$(TARGET).srcs += subsystems/datalink/downlink.c subsystems/datalink/datalink.c subsystems/datalink/telemetry.c
$(TARGET).srcs += subsystems/datalink/downlink.c subsystems/datalink/telemetry.c
Expand Up @@ -7,4 +7,4 @@ $(TARGET).CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_DEVICE=superbitrf
$(TARGET).CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=SUPERBITRF

$(TARGET).srcs += peripherals/cyrf6936.c
$(TARGET).srcs += subsystems/datalink/downlink.c subsystems/datalink/datalink.c subsystems/datalink/superbitrf.c $(PAPARAZZI_HOME)/var/share/pprzlink/src/pprz_transport.c subsystems/datalink/telemetry.c
$(TARGET).srcs += subsystems/datalink/downlink.c subsystems/datalink/superbitrf.c $(PAPARAZZI_HOME)/var/share/pprzlink/src/pprz_transport.c subsystems/datalink/telemetry.c
Expand Up @@ -13,5 +13,5 @@ $(TARGET).CFLAGS += -D$(PPRZ_MODEM_PORT_UPPER)_BAUD=$(MODEM_BAUD)

$(TARGET).CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_DEVICE=$(PPRZ_MODEM_PORT_LOWER) -DPPRZ_UART=$(PPRZ_MODEM_PORT_LOWER)
$(TARGET).CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=PPRZ
$(TARGET).srcs += subsystems/datalink/downlink.c subsystems/datalink/datalink.c $(PAPARAZZI_HOME)/var/share/pprzlink/src/pprz_transport.c subsystems/datalink/telemetry.c
$(TARGET).srcs += subsystems/datalink/downlink.c $(PAPARAZZI_HOME)/var/share/pprzlink/src/pprz_transport.c subsystems/datalink/telemetry.c

Expand Up @@ -19,5 +19,5 @@ TELEM_CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=PPRZ


$(TARGET).CFLAGS += $(MODEM_CFLAGS) $(TELEM_CFLAGS)
$(TARGET).srcs += subsystems/datalink/downlink.c subsystems/datalink/datalink.c $(PAPARAZZI_HOME)/var/share/pprzlink/src/pprz_transport.c subsystems/datalink/telemetry.c
$(TARGET).srcs += subsystems/datalink/downlink.c $(PAPARAZZI_HOME)/var/share/pprzlink/src/pprz_transport.c subsystems/datalink/telemetry.c

Expand Up @@ -4,7 +4,7 @@
$(TARGET).CFLAGS += -DDOWNLINK -DDOWNLINK_DEVICE=usb_serial -DPPRZ_UART=usb_serial
$(TARGET).CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=PPRZ -DUSE_USB_SERIAL
$(TARGET).CFLAGS += -DPERIODIC_TELEMETRY
$(TARGET).srcs += subsystems/datalink/downlink.c subsystems/datalink/datalink.c $(PAPARAZZI_HOME)/var/share/pprzlink/src/pprz_transport.c subsystems/datalink/telemetry.c
$(TARGET).srcs += subsystems/datalink/downlink.c $(PAPARAZZI_HOME)/var/share/pprzlink/src/pprz_transport.c subsystems/datalink/telemetry.c

ifeq ($(ARCH), lpc21)
$(TARGET).srcs += $(SRC_ARCH)/usb_ser_hw.c $(SRC_ARCH)/lpcusb/usbhw_lpc.c $(SRC_ARCH)/lpcusb/usbcontrol.c
Expand Down
2 changes: 1 addition & 1 deletion conf/firmwares/subsystems/shared/telemetry_w5100.makefile
Expand Up @@ -10,7 +10,7 @@ W5100_MULTICAST_PORT ?= "1234"
$(TARGET).CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_DEVICE=chip0
$(TARGET).CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=W5100
$(TARGET).CFLAGS += -DW5100_IP=$(W5100_IP) -DW5100_SUBNET=$(W5100_SUBNET) -DW5100_MULTICAST_IP=$(W5100_MULTICAST_IP) -DW5100_MULTICAST_PORT=$(W5100_MULTICAST_PORT)
$(TARGET).srcs += subsystems/datalink/downlink.c subsystems/datalink/datalink.c subsystems/datalink/w5100.c $(PAPARAZZI_HOME)/var/share/pprzlink/src/pprz_transport.c subsystems/datalink/telemetry.c
$(TARGET).srcs += subsystems/datalink/downlink.c subsystems/datalink/w5100.c $(PAPARAZZI_HOME)/var/share/pprzlink/src/pprz_transport.c subsystems/datalink/telemetry.c

ifeq ($(ARCH), lpc21)
# only an issue of setting the DRDY pin in w5100.c, which is stm32 specific
Expand Down
Expand Up @@ -14,4 +14,4 @@ $(TARGET).CFLAGS += -D$(XBEE_MODEM_PORT_UPPER)_BAUD=$(MODEM_BAUD) -DXBEE_BAUD=$(

$(TARGET).CFLAGS += -DDOWNLINK -DPERIODIC_TELEMETRY -DDOWNLINK_DEVICE=$(XBEE_MODEM_PORT_LOWER) -DXBEE_UART=$(XBEE_MODEM_PORT_LOWER)
$(TARGET).CFLAGS += -DDOWNLINK_TRANSPORT=xbee_tp -DDATALINK=XBEE
$(TARGET).srcs += subsystems/datalink/downlink.c subsystems/datalink/datalink.c $(PAPARAZZI_HOME)/var/share/pprzlink/src/xbee_transport.c subsystems/datalink/telemetry.c
$(TARGET).srcs += subsystems/datalink/downlink.c $(PAPARAZZI_HOME)/var/share/pprzlink/src/xbee_transport.c subsystems/datalink/telemetry.c
3 changes: 2 additions & 1 deletion sw/airborne/subsystems/datalink/datalink.c
Expand Up @@ -22,7 +22,8 @@
/**
* @file subsystems/datalink/datalink.c
* Handling of messages coming from ground and other A/Cs.
*
* This is common to the fixedwing and rotorcraft firmwares,
* other firmwares should provide their own dl_parse_msg().
*/

#define DATALINK_C
Expand Down

4 comments on commit 8390478

@kirkscheper
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @flixr,
could you explain this one to me so I don't make this mistake again? I thought you had to be either fixedwing or rotorcraft and the shared folder was for common files. It's not so obvious to me why you need to separate these as you did here.

@flixr
Copy link
Member Author

@flixr flixr commented on 8390478 Feb 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kirkscheper It's also possible to write some other firmwares that are not rotorcraft or fixedwing (although they do cover about 99% of our current use cases).
E.g. I stated to write a rover firmware some time ago (not in master) and there are some other examples (e.g. the simple demo_ahrs_actuators and some test progs that have their own dl_parse_msg.

So the "shared" subsystems should also be usable by those firmwares/targets.
It's also in general nice to try to keep really general stuff separate from from things that might be shared by some firmwares but not truly shared/generic...

@kirkscheper
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see now.

My intention for the subsystems/datalink.c was to be a common file for all firmware not just fixedwing and rotorcraft. Other firmware should define firmware_parse_msg() and not the dl_parse_msg(). My thought was that every firmware would need a certain common set of message parsing such as the pong and the dl_settings ect and the subsystems/datalink.c should contain those otherwise it isn't that useful to have it.

Are there any functions in the subsystems/datalink that are not compatible with your rover? Then I can move them to the firmware specific files but it was my intention that the subsystems/datalink.c is truly shared for all firmware and not what is is currently with this commit.

Let me know what I can do to realize a truly shared datalink parsing function for common messages.

@flixr
Copy link
Member Author

@flixr flixr commented on 8390478 Feb 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, it is actually usable since all the potentially non-shared stuff is ifdef-ed...
Reverted that change and added an emtpy WEAK impl for firmware_parse_msg.

Please sign in to comment.