IWifiChip.hal revision 271f2c2d9ca5760a1cdd591bf426127077f6c683
15443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills/*
25443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills * Copyright 2016 The Android Open Source Project
35443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills *
45443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills * Licensed under the Apache License, Version 2.0 (the "License");
55443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills * you may not use this file except in compliance with the License.
65443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills * You may obtain a copy of the License at
75443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills *
85443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills *      http://www.apache.org/licenses/LICENSE-2.0
95443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills *
105443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills * Unless required by applicable law or agreed to in writing, software
115443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills * distributed under the License is distributed on an "AS IS" BASIS,
125443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills * See the License for the specific language governing permissions and
145443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills * limitations under the License.
155443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills */
165443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills
175443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Willspackage android.hardware.wifi@1.0;
185443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills
195443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Willsimport IWifiChipEventCallback;
205443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills
215443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills/**
225443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills * Interface that represents a chip that must be configured as a single unit.
235443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills * The HAL/driver/firmware will be responsible for determining which phy is used
245443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills * to perform operations like NAN, RTT, etc.
255443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills */
265443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Willsinterface IWifiChip {
27271f2c2d9ca5760a1cdd591bf426127077f6c683Roshan Pius  enum IfaceType : uint32_t {
285443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills    STA, AP, P2P,
295443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills    /**
305443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills     * NAN control interface. Datapath support may be queried and created
315443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills     * through this interface.
325443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills     */
335443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills    NAN,
345443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  };
355443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills
365443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  /**
375443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * Set of interface types with the maximum number of interfaces that can have
38271f2c2d9ca5760a1cdd591bf426127077f6c683Roshan Pius   * one of the specified type for a given ChipIfaceCombination. See
39271f2c2d9ca5760a1cdd591bf426127077f6c683Roshan Pius   * ChipIfaceCombination for examples.
405443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   */
41271f2c2d9ca5760a1cdd591bf426127077f6c683Roshan Pius  struct ChipIfaceCombinationLimit {
42271f2c2d9ca5760a1cdd591bf426127077f6c683Roshan Pius    vec<IfaceType> types; // Each IfaceType may occur at most once
435443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills    uint32_t maxIfaces;
445443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  };
455443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills
465443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  /**
475443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * Set of interfaces that can operate concurrently when in a given mode. See
485443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * ChipMode below.
495443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *
505443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * For example:
515443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *   [{STA} <= 2]
525443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *       At most two STA interfaces are supported
535443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *       [], [STA], [STA+STA]
545443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *
555443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *   [{STA} <= 1, {NAN} <= 1, {AP} <= 1]
565443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *       Any combination of STA, NAN, AP
575443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *       [], [STA], [NAN], [AP], [STA+NAN], [STA+AP], [NAN+AP], [STA+NAN+AP]
585443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *
595443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *   [{STA} <= 1, {NAN,P2P} <= 1]
605443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *       Optionally a STA and either NAN or P2P
615443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *       [], [STA], [STA+NAN], [STA+P2P], [NAN], [P2P]
625443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *       Not included [NAN+P2P], [STA+NAN+P2P]
635443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *
645443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *   [{STA} <= 1, {STA,NAN} <= 1]
655443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *       Optionally a STA and either a second STA or a NAN
665443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *       [], [STA], [STA+NAN], [STA+STA], [NAN]
675443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *       Not included [STA+STA+NAN]
685443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   */
69271f2c2d9ca5760a1cdd591bf426127077f6c683Roshan Pius  struct ChipIfaceCombination {
70271f2c2d9ca5760a1cdd591bf426127077f6c683Roshan Pius    vec<ChipIfaceCombinationLimit> limits;
715443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  };
725443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills
735443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  /**
745443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * A mode that the chip can be put in. A mode defines a set of constraints on
755443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * the interfaces that can exist while in that mode. Modes define a unit of
765443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * configuration where all interfaces must be torn down to switch to a
775443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * different mode. Some HALs may only have a single mode, but an example where
785443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * multiple modes would be required is if a chip has different firmwares with
795443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * different capabilities.
805443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *
815443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * When in a mode, it must be possible to perform any combination of creating
825443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * and removing interfaces as long as at least one of the
83271f2c2d9ca5760a1cdd591bf426127077f6c683Roshan Pius   * ChipIfaceCombinations is satisfied. This means that if a chip has two
845443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * available combinations, [{STA} <= 1] and [{AP} <= 1] then it is expected
855443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * that exactly one STA interface or one AP interface can be created, but it
865443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * is not expected that both a STA and AP interface could be created. If it
875443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * was then there would be a single available combination
885443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * [{STA} <=1, {AP} <= 1].
895443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *
905443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * When switching between two available combinations it is expected that
915443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * interfaces only supported by the initial combination will be removed until
925443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * the target combination is also satisfied. At that point new interfaces
935443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * satisfying only the target combination can be added (meaning the initial
945443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * combination limits will no longer satisfied). The addition of these new
955443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * interfaces should not impact the existence of interfaces that satisfy both
965443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * combinations.
975443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *
985443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * For example, a chip with available combinations:
995443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *     [{STA} <= 2, {NAN} <=1] and [{STA} <=1, {NAN} <= 1, {AP} <= 1}]
1005443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * If the chip currently has 3 interfaces STA, STA and NAN and wants to add an
1015443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * AP interface in place of one of the STAs then first one of the STA
1025443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * interfaces must be removed and then the AP interface can be created after
1035443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * the STA had been torn down. During this process the remaining STA and NAN
1045443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * interfaces should not be removed/recreated.
1055443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *
1065443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * If a chip does not support this kind of reconfiguration in this mode then
1075443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * the combinations should be separated into two separate modes. Before
1085443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * switching modes all interfaces will be torn down, the mode switch will be
1095443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * enacted and when it completes the new interfaces will be brought up.
1105443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   */
1115443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  struct ChipMode {
1125443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills    /**
1135443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills     * Id that can be used to put the chip in this mode.
1145443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills     */
1155443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills    ChipModeId id;
1165443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills
1175443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills    /**
1185443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills     * A list of the possible interface combinations that the chip can have
1195443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills     * while in this mode.
1205443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills     */
121271f2c2d9ca5760a1cdd591bf426127077f6c683Roshan Pius    vec<ChipIfaceCombination> availableCombinations;
1225443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  };
1235443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills
1245443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  /**
1255443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * Requests notifications of significant events on this chip. Multiple calls
1265443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * to this will register multiple callbacks each of which will receive all
1275443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * events.
1286f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   *
1296f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   * @param callback An instance of the |IWifiChipEventCallback| HIDL interface
1306f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   *        object.
1315443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   */
1325443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  oneway registerEventCallback(IWifiChipEventCallback callback);
1335443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills
1345443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  /**
1355443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * Get the set of operation modes that the chip supports.
1366f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   *
1376f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   * @return modes List of modes supported by the device.
1385443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   */
1395443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  getAvailableModes() generates (vec<ChipMode> modes);
1405443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills
1415443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  /**
1426f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   * Reconfigure the Chip.
1436f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   * Must trigger |IWifiChipEventCallback.onChipReconfigured| on sucess,
1446f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   * or |IWifiChipEventCallback.onChipReconfigureFailure| on failure.
1455443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   *
1465443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * @param modeId The mode that the chip should switch to, corresponding to the
1476f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   *        id property of the target ChipMode.
1485443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   */
1495443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  oneway configureChip(ChipModeId modeId);
1505443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills
1515443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  /**
1525443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   * Get the current mode that the chip is in.
1536f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   *
1546f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   * @return modeId The mode that the chip is currently configured to,
1556f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   *         corresponding to the id property of the target ChipMode.
1565443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   */
1575443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  getMode() generates (ChipModeId modeId);
1585443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills
1595443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  /**
1606f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   * Request information about the chip.
1616f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   * Must trigger |IWifiChipEventCallback.onChipDebugInfoAvailable| on sucess,
1626f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   * or |IWifiChipEventCallback.onChipDebugInfoFailure| on failure.
1635443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   */
1645443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  oneway requestChipDebugInfo();
1655443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills
1665443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  /**
1676f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   * Request vendor debug info from the driver.
1686f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   * Must trigger |IWifiChipEventCallback.onDriverDebugDumpAvailable| on success,
1696f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   * or |IWifiChipEventCallback.onDriverDebugDumpFailure| on failure.
1705443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   */
1715443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  oneway requestDriverDebugDump();
1725443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills
1735443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  /**
1746f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   * Request vendor debug info from the firmware.
1756f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   * Must trigger |IWifiChipEventCallback.onFirmwareDebugDumpAvailable| on
1766f31d92e59d25130ae67a29022f9255bd19029aeRoshan Pius   * success, or |IWifiChipEventCallback.onFirmwareDebugDumpFailure| on failure.
1775443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills   */
1785443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills  oneway requestFirmwareDebugDump();
1795443a9fc9b7e7f334cd298aea19741290ad55555Mitchell Wills};
180