diff --git a/docs/code-prettify/run_prettify.js b/docs/code-prettify/run_prettify.js index 014231cd2..4926af255 100644 --- a/docs/code-prettify/run_prettify.js +++ b/docs/code-prettify/run_prettify.js @@ -449,15 +449,19 @@ var IN_GLOBAL_SCOPE = false; "input," + "instance," + "internal," + + "level," + "locate," + "low," + "machine," + "match," + "module," + + "omit," + "on," + "opcode," + "orange," + "output," + + "packet," + + "packets," + "param," + "passive," + "phase," + diff --git a/docs/fpp-spec.html b/docs/fpp-spec.html index 3d25c330b..4d835ec63 100644 --- a/docs/fpp-spec.html +++ b/docs/fpp-spec.html @@ -742,20 +742,45 @@

The F Prime Prime (FPP) Language Specification, Unreleased, after v2.2.1

7.15.3. Examples -
  • 7.16. Topology Import Specifiers +
  • 7.16. Telemetry Packet Group Specifiers
  • +
  • 7.17. Telemetry Packet Specifiers + +
  • +
  • 7.18. Topology Import Specifiers +
  • -
  • 8. Port Instance Identifiers + +
  • +
  • 8. Component Instance Member Identifiers
  • 9. Type Names @@ -1138,15 +1163,19 @@

    3.1. Reserved Words

    input instance internal +level locate low machine match module +omit on opcode orange output +packet +packets param passive phase @@ -3341,6 +3370,9 @@

    5.12.1. Syntax

    A connection graph specifier

  • +

    A telemetry packet group specifier

    +
  • +
  • A topology import specifier

  • @@ -3362,6 +3394,9 @@

    5.12.2. Semantics

    partially numbered topology T'.

  • +

    Check telemetry packet group specifiers for T'.

    +
  • +
  • Apply automatic numbering of ports to T'.

    @@ -3450,6 +3485,32 @@
    +
    Checking-Telemetry-Packet-Group-Specifiers
    +
    +

    FPP checks telemetry packet group specifiers as follows:

    +
    +
    +
      +
    1. +

      Check that no two telemetry packet group specifiers have +the same name.

      +
    2. +
    3. +

      Check that each telemetry packet group specifier is +valid.

      +
    4. +
    +
    +
    +

    Note that a telemetry packet group specifier is not required. +If there is no specifier, then the topology has no packet definitions. +Note also that two or more telemetry packet group specifiers +are allowed. +Each one specifies a way of assigning the telemetry channels +of the topology to packets.

    +
    + +
    Automatic Numbering of Ports

    FPP automatically assigns port numbers as follows.

    @@ -5204,14 +5265,14 @@

    7.3.1. Syntax

    [ unmatched ] -port-instance-id +port-instance-id [ [ expression ] ] -> -port-instance-id +port-instance-id [ [ expression @@ -7072,18 +7133,237 @@

    7.15.3. Examples

    -

    7.16. Topology Import Specifiers

    +

    7.16. Telemetry Packet Group Specifiers

    +
    +

    A telemetry packet group specifier groups the telemetry channels of a +topology into telemetry packets. +A telemetry packet group specifier is part of a +topology definition.

    +
    +
    +

    7.16.1. Syntax

    +
    +

    telemetry packets +identifier +{ telemetry-packet-group-member-sequence } +[ +omit +{ telemetry-channel-identifier-sequence } +]

    +
    +
    +

    telemetry-packet-group-member-sequence is an +element sequence in +which each element is a telemetry packet group member, +and the terminating punctuation is a comma. +A telemetry packet group member is one of the following:

    +
    + +
    +

    telemetry-channel-identifier-sequence is an +element sequence in +which each element is a +telemetry channel identifier, +and the terminating punctuation is a comma.

    +
    +
    +
    +

    7.16.2. Semantics

    +
    +

    FPP recursively resolves any include specifiers in +telemetry-packet-group-member-sequence. +This action converts telemetry-packet-group-member-sequence to a +list L of telemetry packet specifiers, +each of which is a list of telemetry channel identifiers. +FPP then checks the following:

    +
    +
    +
      +
    1. +

      Each telemetry packet specifier in L is +valid,

      +
    2. +
    3. +

      Each telemetry packet specifier in L has +a distinct name and a distinct identifier.

      +
    4. +
    5. +

      For every component instance I available in the enclosing topology, either through +direct specification +or through +import, +for every telemetry channel T that is a member of I, +exactly one of the following is true:

      +
      +
        +
      1. +

        T appears in at least one of the telemetry packet specifiers of L.

        +
      2. +
      3. +

        telemetry-channel-identifier-sequence is present, and T appears in +telemetry-channel-identifier-sequence.

        +
      4. +
      +
      +
    6. +
    +
    +
    +
    +

    7.16.3. Example

    +
    +
    +
    packets Packets {
    +
    +  packet CDH id 0 level 0 {
    +    commandDispatcher.commandsDispatched
    +    rateGroup1Hz.rgMaxTime
    +    fileUplink.filesReceived
    +  }
    +
    +  packet ADCS id 1 level 2 {
    +    adcs.mode
    +    adcs.attitude
    +  }
    +
    +  include "PowerTelemetryPackets.fppi"
    +
    +} omit {
    +  adcs.extraTelemetry
    +}
    +
    +
    +
    +
    +
    +

    7.17. Telemetry Packet Specifiers

    +
    +

    A telemetry packet specifier specifies the format of a data +packet containing telemetry points. +A telemetry packet specifier is part of a +telemetry packet group +specifier, which is in turn part of a +topology definition.

    +
    +
    +

    7.17.1. Syntax

    +
    +

    packet +identifier +[ +id expression +] +level expression +{ telemetry-packet-member-sequence }

    +
    +
    +

    telemetry-packet-member-sequence is an +element sequence in +which each element is a telemetry packet member, +and the terminating punctuation is a comma. +A telemetry packet member is one of the following:

    +
    +
    + +
    +
    +

    A non-annotatable-include-specifier is identical to an +include specifier, +but it is not an +annotatable element.

    +
    +
    +
    +

    7.17.2. Semantics

    +
    +
      +
    1. +

      The optional expression e following id specifies the numeric +identifier for the packet. +If e is present, then the type of e must be +convertible to +Integer, and e must evaluate +to a nonnegative integer. +If e is not present, then the default identifier is either zero (for the +first +packet appearing in a packet group) or the previous packet identifier plus one.

      +
    2. +
    3. +

      The expression e following level specifies the +level of the packet. +The level is a number that governs the sending of the packet. +In the F Prime flight software, sending of packets can be filtered +by level, so that only packets at or below a specified level are sent. +The type of e must be +convertible to +Integer, and e must evaluate +to a nonnegative integer.

      +
    4. +
    5. +

      FPP recursively resolves any include specifiers in +telemetry-packet-member-sequence. +This action converts telemetry-packet-member-sequence to a list L of +telemetry channel identifiers. +For each telemetry channel identifier I in L, +the component instance referred to in I must be +available in the enclosing topology, either through +direct specification +or through +import.

      +
    6. +
    +
    +
    +
    +

    7.17.3. Examples

    +
    +
    +
    @ CDH packet has id 0 and level 0
    +packet CDH id 0 level 0 {
    +  commandDispatcher.commandsDispatched
    +  rateGroup1Hz.rgMaxTime
    +  include "DownlinkTelemetryChannels.fppi"
    +  include "UplinkTelemetryChannels.fppi"
    +}
    +
    +@ Implicit id of ADCS packet is 1. Its level is 2.
    +packet ADCS level 2 {
    +  adcs.mode
    +  adcs.attitude
    +}
    +
    +
    +
    +
    +
    +

    7.18. Topology Import Specifiers

    A topology import specifier imports one topology into another one.

    -

    7.16.1. Syntax

    +

    7.18.1. Syntax

    import qual-ident

    -

    7.16.2. Semantics

    +

    7.18.2. Semantics

    The qualified identifier must refer to @@ -7174,7 +7454,7 @@

    7.16.2. Semantics

    -

    7.16.3. Example

    +

    7.18.3. Example

    topology A {
    @@ -7264,24 +7544,30 @@ 

    7.16.3. Example

    -

    8. Port Instance Identifiers

    +

    8. Component Instance Member Identifiers

    +

    A component instance member identifier refers to a member of a +component instance.

    +
    +
    +

    8.1. Port Instance Identifiers

    +

    A port instance identifier identifies a port instance that is part of a component instance. Port instance identifiers appear in connection graph specifiers.

    -
    -

    8.1. Syntax

    +
    +

    8.1.1. Syntax

    -
    -

    8.2. Semantics

    +
    +

    8.1.2. Semantics

    For each port instance identifier Q . P:

    @@ -7309,8 +7595,8 @@

    8.2. Semantics

    -
    -

    8.3. Examples

    +
    +

    8.1.3. Examples

    a.b
    @@ -7325,6 +7611,69 @@ 

    8.3. Examples

    +
    +

    8.2. Telemetry Channel Identifiers

    +
    +

    A telemetry channel identifier identifies a telemetry channel that is part of +a component instance. Telemetry channel identifiers appear in +telemetry packet group +specifiers and telemetry packet +specifiers.

    +
    +
    +

    8.2.1. Syntax

    + +
    +
    +

    8.2.2. Semantics

    +
    +

    For each telemetry channel identifier Q . T:

    +
    +
    +
      +
    1. +

      The qualified identifier Q must +refer to +a component instance I.

      +
    2. +
    3. +

      I must refer to a component +instance definition I'.

      +
    4. +
    5. +

      I' must refer to a component +definition C.

      +
    6. +
    7. +

      The identifier T +must refer to a +telemetry channel specifier +of C.

      +
    8. +
    +
    +
    +
    +

    8.2.3. Examples

    +
    +
    +
    a.b
    +A.b.c
    +
    +
    +
    +

    In the first example, a names a component instance, and b names a +telemetry channel. +In the second example, A.b names a component instance, and c names a +telemetry channel.

    +
    +
    +
    +

    9. Type Names

    @@ -10582,7 +10931,7 @@

    22.4. Translation Tools

    diff --git a/docs/fpp-users-guide.html b/docs/fpp-users-guide.html index e9edf6138..f194bfd61 100644 --- a/docs/fpp-users-guide.html +++ b/docs/fpp-users-guide.html @@ -14817,7 +14817,7 @@

    diff --git a/docs/index.html b/docs/index.html index 07e30b8d1..9bd7e4b03 100644 --- a/docs/index.html +++ b/docs/index.html @@ -463,7 +463,7 @@

    F Prime Prime (FPP)

    diff --git a/docs/spec/Component-Instance-Member-Identifiers.adoc b/docs/spec/Component-Instance-Member-Identifiers.adoc new file mode 100644 index 000000000..18c61d36d --- /dev/null +++ b/docs/spec/Component-Instance-Member-Identifiers.adoc @@ -0,0 +1,95 @@ +== Component Instance Member Identifiers + +A *component instance member identifier* refers to a member of a +component instance. + +=== Port Instance Identifiers + +A *port instance identifier* identifies a port instance +that is part of a component instance. +Port instance identifiers appear in +<>. + +==== Syntax + +<> +`.` +<> + +==== Semantics + +For each port instance identifier _Q_ `.` _P_: + +. The qualified identifier _Q_ must +<> +a component instance _I_. + +. _I_ must refer to a <>. + +. _I'_ must refer to a <>. + +. The identifier _P_ +must refer to a +<> +of _C_. + +==== Examples + +[source,fpp] +---- +a.b +A.b.c +---- + +In the first example, `a` names a component instance, and `b` names a port +instance. +In the second example, `A.b` names a component instance, and `c` names a +port instance. + +=== Telemetry Channel Identifiers + +A *telemetry channel identifier* identifies a telemetry channel that is part of +a component instance. Telemetry channel identifiers appear in +<> and <>. + +==== Syntax + +<> +`.` +<> + +==== Semantics + +For each telemetry channel identifier _Q_ `.` _T_: + +. The qualified identifier _Q_ must +<> +a component instance _I_. + +. _I_ must refer to a <>. + +. _I'_ must refer to a <>. + +. The identifier _T_ +must refer to a +<> +of _C_. + +==== Examples + +[source,fpp] +---- +a.b +A.b.c +---- + +In the first example, `a` names a component instance, and `b` names a +telemetry channel. +In the second example, `A.b` names a component instance, and `c` names a +telemetry channel. diff --git a/docs/spec/Definitions/Topology-Definitions.adoc b/docs/spec/Definitions/Topology-Definitions.adoc index a89a6e1e7..d29d3dcb9 100644 --- a/docs/spec/Definitions/Topology-Definitions.adoc +++ b/docs/spec/Definitions/Topology-Definitions.adoc @@ -27,6 +27,8 @@ instance specifier>> * A <> +* A <> + * A <> * An <> @@ -40,6 +42,9 @@ according to the following algorithm: <> _T'_. +. <> for _T'_. + . Apply <> @@ -111,6 +116,23 @@ registration connection between two ports, and there is already a command registration connection between those ports, then do not add the connection. +===== Checking-Telemetry-Packet-Group-Specifiers + +FPP checks telemetry packet group specifiers as follows: + +. Check that no two telemetry packet group specifiers have +the same name. + +. Check that each telemetry packet group specifier is +<>. + +Note that a telemetry packet group specifier is not required. +If there is no specifier, then the topology has no packet definitions. +Note also that two or more telemetry packet group specifiers +are allowed. +Each one specifies a way of assigning the telemetry channels +of the topology to packets. + ===== Automatic Numbering of Ports FPP automatically assigns port numbers as follows. diff --git a/docs/spec/Lexical-Elements.adoc b/docs/spec/Lexical-Elements.adoc index bd378178a..2e8178483 100644 --- a/docs/spec/Lexical-Elements.adoc +++ b/docs/spec/Lexical-Elements.adoc @@ -87,15 +87,19 @@ initial input instance internal +level locate low machine match module +omit on opcode orange output +packet +packets param passive phase diff --git a/docs/spec/Port-Instance-Identifiers.adoc b/docs/spec/Port-Instance-Identifiers.adoc deleted file mode 100644 index c67a3a32e..000000000 --- a/docs/spec/Port-Instance-Identifiers.adoc +++ /dev/null @@ -1,44 +0,0 @@ -== Port Instance Identifiers - -A *port instance identifier* identifies a port instance -that is part of a component instance. -Port instance identifiers appear in -<>. - -=== Syntax - -<> -`.` -<> - -=== Semantics - -For each port instance identifier _Q_ `.` _P_: - -. The qualified identifier _Q_ must -<> -a component instance _I_. - -. _I_ must refer to a <>. - -. _I'_ must refer to a <>. - -. The identifier _P_ -must refer to a -<> -of _C_. - -=== Examples - -[source,fpp] ----- -a.b -A.b.c ----- - -In the first example, `a` names a component instance, and `b` names a port -instance. -In the second example, `A.b` names a component instance, and `c` names a -port instance. diff --git a/docs/spec/Specifiers/Connection-Graph-Specifiers.adoc b/docs/spec/Specifiers/Connection-Graph-Specifiers.adoc index 75bb71b8a..252956352 100644 --- a/docs/spec/Specifiers/Connection-Graph-Specifiers.adoc +++ b/docs/spec/Specifiers/Connection-Graph-Specifiers.adoc @@ -37,14 +37,14 @@ A connection is the following: _[_ `unmatched` _]_ -<> +<> _[_ `[` <> `]` _]_ `pass:[->]` -<> +<> _[_ `[` <> diff --git a/docs/spec/Specifiers/Telemetry-Packet-Group-Specifiers.adoc b/docs/spec/Specifiers/Telemetry-Packet-Group-Specifiers.adoc new file mode 100644 index 000000000..6bb2e1e2b --- /dev/null +++ b/docs/spec/Specifiers/Telemetry-Packet-Group-Specifiers.adoc @@ -0,0 +1,84 @@ +=== Telemetry Packet Group Specifiers + +A *telemetry packet group specifier* groups the telemetry channels of a +topology into <>. +A telemetry packet group specifier is part of a +<>. + +==== Syntax + +`telemetry` `packets` +<> +`{` _telemetry-packet-group-member-sequence_ `}` +_[_ +`omit` +`{` _telemetry-channel-identifier-sequence_ `}` +_]_ + +_telemetry-packet-group-member-sequence_ is an +<> in +which each element is a *telemetry packet group member*, +and the terminating punctuation is a comma. +A telemetry packet group member is one of the following: + +* An <>. + +* A <>. + +_telemetry-channel-identifier-sequence_ is an +<> in +which each element is a +<>, +and the terminating punctuation is a comma. + +==== Semantics + +FPP recursively resolves any include specifiers in +_telemetry-packet-group-member-sequence_. +This action converts _telemetry-packet-group-member-sequence_ to a +list _L_ of telemetry packet specifiers, +each of which is a list of telemetry channel identifiers. +FPP then checks the following: + +. Each telemetry packet specifier in _L_ is +<>, + +. Each telemetry packet specifier in _L_ has +a distinct name and a distinct identifier. + +. For every component instance _I_ available in the enclosing topology, either through +<> +or through +<>, +for every telemetry channel _T_ that is a member of _I_, +exactly one of the following is true: + +.. _T_ appears in at least one of the telemetry packet specifiers of _L_. + +.. _telemetry-channel-identifier-sequence_ is present, and _T_ appears in +_telemetry-channel-identifier-sequence_. + +==== Example + +[source,fpp] +---- +packets Packets { + + packet CDH id 0 level 0 { + commandDispatcher.commandsDispatched + rateGroup1Hz.rgMaxTime + fileUplink.filesReceived + } + + packet ADCS id 1 level 2 { + adcs.mode + adcs.attitude + } + + include "PowerTelemetryPackets.fppi" + +} omit { + adcs.extraTelemetry +} +---- diff --git a/docs/spec/Specifiers/Telemetry-Packet-Specifiers.adoc b/docs/spec/Specifiers/Telemetry-Packet-Specifiers.adoc new file mode 100644 index 000000000..2c99392db --- /dev/null +++ b/docs/spec/Specifiers/Telemetry-Packet-Specifiers.adoc @@ -0,0 +1,86 @@ +=== Telemetry Packet Specifiers + +A *telemetry packet specifier* specifies the format of a data +packet containing telemetry points. +A telemetry packet specifier is part of a +<>, which is in turn part of a +<>. + +==== Syntax + +`packet` +<> +_[_ +`id` <> +_]_ +`level` <> +`{` _telemetry-packet-member-sequence_ `}` + +_telemetry-packet-member-sequence_ is an +<> in +which each element is a *telemetry packet member*, +and the terminating punctuation is a comma. +A telemetry packet member is one of the following: + +* _non-annotatable-include-specifier_. + +* _<>_. + +A _non-annotatable-include-specifier_ is identical to an +<>, +but it is not an +<>. + +==== Semantics + +. The optional expression _e_ following `id` specifies the numeric +identifier for the packet. +If _e_ is present, then the type of _e_ must be +<> +<>, and _e_ must evaluate +to a nonnegative integer. +If _e_ is not present, then the default identifier is either zero (for the +first +packet appearing in a packet group) or the previous packet identifier plus one. + +. The expression _e_ following `level` specifies the +*level* of the packet. +The level is a number that governs the sending of the packet. +In the F Prime flight software, sending of packets can be filtered +by level, so that only packets at or below a specified level are sent. +The type of _e_ must be +<> +<>, and _e_ must evaluate +to a nonnegative integer. + +. FPP recursively resolves any include specifiers in +_telemetry-packet-member-sequence_. +This action converts _telemetry-packet-member-sequence_ to a list _L_ of +telemetry channel identifiers. +For each telemetry channel identifier _I_ in _L_, +the component instance referred to in _I_ must be +available in the enclosing topology, either through +<> +or through +<>. + +==== Examples + +[source,fpp] +---- +@ CDH packet has id 0 and level 0 +packet CDH id 0 level 0 { + commandDispatcher.commandsDispatched + rateGroup1Hz.rgMaxTime + include "DownlinkTelemetryChannels.fppi" + include "UplinkTelemetryChannels.fppi" +} + +@ Implicit id of ADCS packet is 1. Its level is 2. +packet ADCS level 2 { + adcs.mode + adcs.attitude +} +---- diff --git a/docs/spec/Specifiers/defs.sh b/docs/spec/Specifiers/defs.sh index f5849157d..7e2bbfef7 100644 --- a/docs/spec/Specifiers/defs.sh +++ b/docs/spec/Specifiers/defs.sh @@ -23,5 +23,7 @@ Port-Matching-Specifiers.adoc Record-Specifiers.adoc State-Machine-Instance-Specifiers.adoc Telemetry-Channel-Specifiers.adoc +Telemetry-Packet-Group-Specifiers.adoc +Telemetry-Packet-Specifiers.adoc Topology-Import-Specifiers.adoc " diff --git a/docs/spec/defs.sh b/docs/spec/defs.sh index 3285c6fbf..f8cd896fd 100644 --- a/docs/spec/defs.sh +++ b/docs/spec/defs.sh @@ -17,7 +17,7 @@ Element-Sequences.adoc Definitions/Definitions.adoc State-Machine-Behavior-Elements/State-Machine-Behavior-Elements.adoc Specifiers/Specifiers.adoc -Port-Instance-Identifiers.adoc +Component-Instance-Member-Identifiers.adoc Type-Names.adoc Expressions/Expressions.adoc Formal-Parameter-Lists.adoc diff --git a/editors/emacs/fpp-mode.el b/editors/emacs/fpp-mode.el index 2a7905a22..74f56f9d1 100644 --- a/editors/emacs/fpp-mode.el +++ b/editors/emacs/fpp-mode.el @@ -35,7 +35,8 @@ (defconst fpp-mode-definition-keywords '("type" "array" "component" "instance" "constant" - "enum" "machine" "module" "port" "state" "struct" "topology") + "enum" "machine" "module" "omit" "packet" "packets" + "port" "state" "struct" "topology") "FPP keywords for definitions.") (defconst fpp-mode-keywords @@ -45,8 +46,8 @@ "drop" "else" "entry" "event" "exit" "false" "fatal" "format" "get" "guard" "guarded" "health" "high" "hook" "id" "if" "import" - "include" "initial" "input" "internal" - "locate" "low" "match" "on" "opcode" "orange" + "include" "initial" "input" "internal" "level" + "locate" "low" "match" "on" "opcode" "orange" "output" "param" "passive" "phase" "priority" "private" "queue" "queued" "raw" "recv" "red" "ref" "reg" "resp" "save" "signal" "serial" "set" "severity" diff --git a/editors/vim/fpp.vim b/editors/vim/fpp.vim index 53f3be206..5dd7e649d 100644 --- a/editors/vim/fpp.vim +++ b/editors/vim/fpp.vim @@ -53,15 +53,19 @@ syn keyword fppKeyword initial syn keyword fppKeyword input syn keyword fppKeyword instance syn keyword fppKeyword internal +syn keyword fppKeyword level syn keyword fppKeyword locate syn keyword fppKeyword low syn keyword fppKeyword machine syn keyword fppKeyword match syn keyword fppKeyword module +syn keyword fppKeyword omit syn keyword fppKeyword on syn keyword fppKeyword opcode syn keyword fppKeyword orange syn keyword fppKeyword output +syn keyword fppKeyword packet +syn keyword fppKeyword packets syn keyword fppKeyword param syn keyword fppKeyword passive syn keyword fppKeyword phase