Compression method of hci bit mask and opcode mapping table, storage medium and device

By compressing the HCI support command bit mask and opcode mapping table using the method of appending a branch control mask to the first byte, the problem of excessive resource consumption in the Bluetooth protocol stack is solved, achieving efficient resource utilization and cost reduction.

CN118972465BActive Publication Date: 2025-11-07BARRY INTERCONNECT INTEGRATED CIRCUIT (SHANGHAI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411078536.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-07
Publication Date
2025-11-07
Estimated Expiration
2044-08-07

AI Technical Summary

Technical Problem

The existing HCI supports command bitmasks and opcode mapping tables, which consume a lot of resources in the Bluetooth protocol stack and cannot meet the requirements of embedded platforms for code size and resource consumption. Furthermore, traditional compression algorithms such as Huffman coding are not very effective.

Method used

The method of appending a branch control mask to the first byte is adopted. The HCI support command bit mask and opcode mapping table are compressed through four types of branch control masks (first branch control mask, second branch control mask, third branch control mask and fourth branch control mask), which respectively represent the number of consecutive opcodes, RFU opcode, opcode that reuses the high byte of the previous opcode and single opcode.

Benefits of technology

Without significantly increasing search CPU overhead, it significantly reduces the resource consumption of the mapping table, lowers costs, and adapts to the upgrade requirements of the Bluetooth specification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118972465B_ABST
    Figure CN118972465B_ABST
Patent Text Reader

Abstract

The application discloses a compression method of HCI support command bit mask and operation code mapping table, a storage medium and equipment, and belongs to the technical field of communication. The method comprises the following steps: sequentially setting a first byte for an operation code according to a bit mask serial number sequence in the mapping table, wherein the first byte comprises a 2-bit branch control mask; according to four combinations of the 2-bit branch control mask, the four combinations are named as a first branch control mask, a second branch control mask, a third branch control mask and a fourth branch control mask; the first branch control mask is used to represent a 2-byte operation code with a continuous quantity of multiple; the second branch control mask is used to represent a 0-byte operation code with a command of RFU; the third branch control mask is used to represent a 1-byte operation code with a high-order byte of a previous operation code; and the fourth branch control mask is used to represent a 1-byte operation code with a continuous quantity of one. According to the application, the size of the HCI support command mapping table is further compressed, and the resource consumption is reduced without significantly increasing the CPU overhead during searching.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of communication technology, in particular to a compression method of HCI support command bit mask and operation code mapping table, storage medium and device. BACKGROUND

[0002] The Bluetooth core specification stipulates a command (Read Local Supported Commands command) for the host (Host) to obtain the status of the supported HCI (Host Controller Interface) commands of the controller end (Controller), and then returns it in the form of a Supported_Commands

[64] byte bit mask, each bit representing a specific command, 1 for support and 0 for non-support. The host protocol stack software needs to control whether to send the corresponding command to the controller end according to this information. Among them, the HCI defined command is identified by OGF (Opcode Group Field, high 6 bits) + OCF (Opcode Command Field, low 10 bits), that is, the operation code OPCODE[2] byte. Obviously, both the host and the controller have a requirement, that is, from the operation code OPCODE[2] byte, to know whether this command is supported, which is mapped to the Supported_Commands

[64] byte mask; or its reverse search.

[0003] However, since the Bluetooth protocol stack, whether the host or the controller, in the application under the embedded platform, requires that the code size, the amount of resources occupied by const static, Flash or RAM, etc. should be as small as possible. Therefore, it is imperative to compress the bit mask and the operation code mapping table. Using the traditional Huffman (Huffman) coding method and other general lossless compression algorithms will result in a larger size of the bit mask and the operation code mapping table, and more space resources are occupied, which cannot adapt to the needs of Bluetooth 5.4 specification and subsequent specification upgrades. SUMMARY

[0004] The present application provides a compression method of HCI support command bit mask and operation code mapping table, storage medium and device, which further compresses the size of the HCI support command bit mask and the operation code mapping table without significantly increasing the CPU overhead during search, thereby reducing the resource consumption, and better adapting to the needs of Bluetooth 5.4 specification and subsequent specification upgrades.

[0005] In order to achieve the above object, the first technical solution of the present application is to provide a compression method of HCI support command bit mask and operation code mapping table, which comprises: sequentially setting a first byte for operation code according to the bit mask serial number order in the mapping table, the first byte containing a 2-bit branch control mask, and according to four combinations of the 2-bit branch control mask, the four combinations are named as first branch control mask, second branch control mask, third branch control mask and fourth branch control mask; the first branch control mask is used to represent 2-byte operation code with a continuous number of multiple; the second branch control mask is used to represent 0-byte operation code with a command of RFU, wherein RFU is Reserved for Future Use; the third branch control mask is used to represent 1-byte operation code with a high byte of a previous operation code; and the fourth branch control mask is used to represent 1-byte operation code with a continuous number of one.

[0006] The second technical solution of the present application is to provide a computer readable storage medium, which stores computer instructions, and the computer instructions are operated to execute the compression method of HCI support command bit mask and operation code mapping table in the first technical solution.

[0007] The third technical solution of the present application is to provide a computer device, which comprises a processor and a memory, and the memory stores computer instructions, and the processor operates the computer instructions to execute the compression method of HCI support command bit mask and operation code mapping table in the first technical solution.

[0008] The technical solution of the present application can achieve the beneficial effects that: the compression method of the present application reduces the size of const static resource, Flash or RAM occupied by HCI support command bit mask and operation code mapping table without significantly increasing the CPU overhead during searching, and reduces the resource consumption and cost. BRIEF DESCRIPTION OF DRAWINGS

[0009] Figure 1 is a schematic diagram of a specific example of HCI support command bit mask and operation code mapping table before compression of the present application;

[0010] Figure 2 is a schematic diagram of a specific embodiment of the compression method of HCI support command bit mask and operation code mapping table of the present application. DETAILED DESCRIPTION

[0011] The preferred embodiments of the present application are described in detail below with reference to the accompanying drawings, so that the advantages and features of the present application can be more easily understood by those skilled in the art, and the protection scope of the present application is more clearly defined.

[0012] Bluetooth core specification defines a command (Read Local Supported Commands command) for Host to get the status of HCI (Host Controller Interface) commands supported by Controller, then returns it using a bit mask Supported_Commands

[64] byte, each bit represents a specific command, 1 for support, 0 for not support. Host protocol stack software needs to control whether to send the corresponding command to the controller according to this information. The command defined by HCI is identified by OGF (Opcode Group Field, high 6 bits) + OCF (Opcode Command Field, low 10 bits), that is, Opcode[2] byte, wherein OGF is the group of operation codes, and only about 6 values are used in the Bluetooth specification, that is, 3 bits; OCF is the command number under the OGF group, which is not distributed continuously but discretely.

[0013] Figure 1 is a schematic diagram of a specific example of the HCI supported command bit mask and opcode mapping table before compression.

[0014] From Figure 1 it can be known that the mapping table defined by the HCI specification mainly records the corresponding opcode in the mapping table according to the bit mask sequence number, however, the order of the Supported_Commands

[64] byte mask defined by the HCI specification does not completely match the value order of OPCODE, and is not arranged in a fixed order due to history, version upgrade and other reasons.

[0015] Obviously, whether it is the host or the controller, there is a demand that whether the command is supported is known by Opcode[2] byte, which is mapped into the Supported_Commands

[64] byte mask; or the reverse search.

[0016] However, the simplest way to store the bit mask and opcode mapping table at present is as follows:

[0017]

[0018] The above way of storing the bit mask and opcode mapping table is: according to the arrangement from the low bit of the low byte in the bit mask to the high bit, and then to the high byte, all the corresponding operation codes Opcode[2] are recorded in a table. In this way, the number of bytes to be stored is: command number * 2 bytes, which is about 332*2=664 bytes under Bluetooth core specification 5.4.

[0019] Due to the Bluetooth protocol stack, whether the host side or the controller side, the application under the embedded platform requires that the code size, the occupation amount of resources such as const static, Flash or RAM are as small as possible. Therefore, it is necessary to compress the mapping table of the bit mask and the operation code. The present application adds the first byte to the operation code by summarizing the rule of the operation code, and then uses the branch control mask in the first byte to reduce the space required for storing the operation code, so as to compress the mapping table of the HCI support command bit mask and the operation code, thereby reducing the size of the mapping table of the HCI support command bit mask and the operation code and the occupied resources.

[0020] Figure 2 is a schematic diagram of one specific embodiment of the compression method of the mapping table of the HCI support command bit mask and the operation code of the present application.

[0021] In one specific embodiment of the present application, the compression method of the mapping table of the HCI support command bit mask and the operation code of the present application includes the process S201 of sequentially adding and setting the first byte to the operation code according to the bit mask serial number order in the mapping table. The first byte contains a 2-bit branch control mask. According to the four combinations of the 2-bit branch control mask, the four combinations are named as the first branch control mask, the second branch control mask, the third branch control mask and the fourth branch control mask.

[0022] In this specific embodiment, the 2-bit branch control mask can have four combinations, which are 0b00, 0b01, 0b10 and 0b11.

[0023] In one specific embodiment of the present application, the mapping table is compressed in byte units.

[0024] In one specific embodiment of the present application, the first byte further contains a 6-bit consecutive number.

[0025] In this specific embodiment, the first byte contains not only the 2-bit branch control mask part, but also the 6-bit operation code consecutive number part. The maximum consecutive number of operation codes that can be described by the 6-bit operation code consecutive number part is 2^6-1=63, which is represented in binary as 0b111111.

[0026] In one specific embodiment of the present application, each use of the branch control mask obtains one or more consecutive operation codes, i.e. an operation code range. Whether it is the first branch control mask, the second branch control mask, the third branch control mask or the fourth branch control mask, each use will obtain one or more consecutive operation codes, i.e. an operation code range.

[0027] In one embodiment of the present application, the compression method of the HCI support command bit mask and opcode mapping table of the present application further comprises a process S202, using the first branch control mask to represent a plurality of 2-byte opcodes in a continuous number.

[0028] In this embodiment, when the first branch control mask is used, a plurality of continuous opcodes, i.e., an opcode range, will be obtained, and each opcode in the opcode range is 2 bytes.

[0029] Specifically, assuming that the continuous number is 15, the space required for storing these opcodes is: continuous number*2 bytes+first byte=15*2+1=31 bytes, i.e., 15 bits of the bit mask are occupied.

[0030] In one embodiment of the present application, the compression method of the HCI support command bit mask and opcode mapping table of the present application further comprises a process S203, using the second branch control mask to represent 0-byte opcodes of commands RFU, wherein RFU is Reserved for Future Use, i.e., reserved for future use.

[0031] In one embodiment of the present application, the opcode of the command RFU is 0x0000, wherein 0x represents hexadecimal.

[0032] Since some bits of the bit mask have not been defined with specific commands, they are reserved for future use, and the commands of this type without defined specific commands are all RFU, and the opcode of the command RFU can be considered as 0 byte.

[0033] Specifically, assuming that the second branch control mask is used once to obtain an opcode range with a continuous number of 7, i.e., 7 RFUs, the space required for storing these opcodes is: continuous number*0 bytes+first byte=7*0+1=1 byte. That is, only 1 byte of space is actually required to store the 7 opcodes, although the 7 RFU opcodes are all 0 bytes, but they correspond to 7 bits of the bit mask, i.e., 7 bits of the bit mask are occupied.

[0034] In one embodiment of the present application, the compression method of the HCI support command bit mask and opcode mapping table of the present application further comprises a process S204, using the third branch control mask to represent 1-byte opcodes that reuse the high byte of the previous opcode.

[0035] In this embodiment, the 1-byte opcode that reuses the high byte of the previous opcode is the low byte of the opcode, and the high byte can reuse the high byte of the previous opcode, and such an opcode only occupies 1 byte.

[0036] Specifically, assuming that the third branch control mask is used, a range of operation codes with a continuous number of 5 is obtained, and the space required for storing these operation codes is: continuous number * 1 byte + first byte = 5 * 1 + 1 = 6 bytes, that is, only 6 bytes of storage space is required to store the 5 operation codes, which occupies 5 bits of the bit mask.

[0037] In one specific embodiment of the present application, the HCI compression method of the command bit mask and the operation code mapping table of the present application further comprises process S205, using the fourth branch control mask to represent a continuous number of 1 byte operation code.

[0038] In one specific embodiment of the present application, using the fourth branch control mask to represent a continuous number of 1 byte operation code comprises: using the 6-bit continuous number part of the first byte to store the 6-bit high part of the operation code.

[0039] In this specific embodiment, when the fourth branch control mask is used, there is no 6-bit continuous number part of the operation code in the first byte, and the 6-bit part is used to store the 6-bit high part of the operation code, i.e. the OGF part, and the operation code continuous number is fixed to only one, which is a 1 byte operation code.

[0040] Specifically, assuming that the fourth branch control mask is used, the operation code continuous number is fixed to 1, and the space required for storing this operation code is: continuous number * 1 byte + first byte = 1 * 1 + 1 = 2 bytes, that is, 1 bit of the bit mask is occupied.

[0041] In one specific embodiment of the present application, different branch control masks correspond to different follow-up bytes. That is, the follow-up byte depends on the branch control mask part of the first byte.

[0042] In one specific embodiment of the present application, different branch control masks correspond to different follow-up bytes, including: when the branch control mask is the first branch control mask, the follow-up byte is a 2 byte operation code; when the branch control mask is the second branch control mask, the follow-up byte is a 0 byte operation code, which is fixed as RFU; when the branch control mask is the third branch control mask, the follow-up byte is a 1 byte operation code low; when the branch control mask is the fourth branch control mask, the follow-up byte is a 1 byte operation code.

[0043] The HCI compression method of the command bit mask and the operation code mapping table of the present application will be described in detail in combination with the specific embodiments of the present application:

[0044]

[0045] The specific explanation of each row is as follows:

[0046] First row (0x00 | 15), 0x04, 0x01, using 0x00 in hexadecimal, the operation code OPCODE is 2 bytes, starting from OPCODE = 0x0401, 15 consecutive OPCODEs (i.e. 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x040D, 0x040E, 0x040F) each occupying the first 15 bits of the bit mask;

[0047] Second row (0x80 | 1), 0x11, using 0x80 in hexadecimal, the operation code OPCODE is 1 byte, starting from 0x0411 by reusing the high bit 0x04 of the previous OPCODE, 1 consecutive OPCODE;

[0048] Third row (0x80 | 1), 0x13, using 0x80 in hexadecimal, the operation code OPCODE is 1 byte, starting from 0x0413 by reusing the high bit 0x04 of the previous OPCODE, 1 consecutive OPCODE;

[0049] Fourth row (0x80 | 1), 0x15, using 0x80 in hexadecimal, the operation code OPCODE is 1 byte, starting from 0x0415 by reusing the high bit 0x04 of the previous OPCODE, 1 consecutive OPCODE;

[0050] Fifth row (0x80 | 1), 0x17, using 0x80 in hexadecimal, the operation code OPCODE is 1 byte, starting from 0x0417 by reusing the high bit 0x04 of the previous OPCODE, 1 consecutive OPCODE;

[0051] Sixth row (0x80 | 5), 0x19, using 0x80 in hexadecimal, the operation code OPCODE is 1 byte, starting from 0x0419 by reusing the high bit 0x04 of the previous OPCODE, 5 consecutive OPCODEs (i.e. 0x0419, 0x041A, 0x041B, 0x041C, 0x041D);

[0052] Seventh row (0x80 | 2), 0x1f, using 0x80 in hexadecimal, the operation code OPCODE is 1 byte, starting from 0x041f by reusing the high bit 0x04 of the previous OPCODE, 2 consecutive OPCODEs (i.e. 0x041f, 0x0420);

[0053] Eighth row (0x40 | 7), using 0x40 in hexadecimal, the operation code OPCODE is 0 bytes, which is RFU, i.e. OPCODE is 0x0000, 7 consecutive RFUs;

[0054] The ninth row (0xC0 | 0x08), 0x01, using 0xC0 in hexadecimal, the OPCODE is 1 byte, the number of continuous bytes in the first byte without the operation code is 6 bits, the 6 bits are used for the high 6 bits of the operation code, i.e., the OGF part, starting from 0x0801, the continuous number is fixed to 1;

[0055] The tenth row (0x80 | 5), 0x03, using 0x80 in hexadecimal, the operation code OPCODE is 1 byte, the high bit 0x08 of the OPCODE before multiplexing, starting from 0x0803, 5 are continuous (i.e., 0x0803, 0x0804, 0x0805, 0x0806, 0x0807).

[0056] By using the compression method, under the Bluetooth Core Specification 5.4, the size of the HCI support command bitmask and the operation code mapping table can be reduced from the original 664 bytes to 179 bytes, the size of the mapping table after compression is about 26.95% of the original, so that the resources occupied by the HCI support command bitmask and the operation code mapping table are greatly reduced. For an embedded platform, the smaller the resource consumption, the lower the cost, and as the embedded products may be used in large quantities, the cost will also be multiplied and greatly reduced.

[0057] The search complexity of the compression method of the present application and the original flat OPCODE method are compared and analyzed as follows:

[0058] The mapping table under the original flat OPCODE method needs to traverse 332 commands and a 664-byte mapping table when searching for a command, so as to obtain the sequence number of the bitmask. If found, the traversal process can be exited in advance.

[0059] The mapping table under the compression method provided by the present application still needs to traverse the entire mapping table when searching for a command, and then determine the operation code OPCODE range and the sequence number of the current hit bitmask after reading 0, 1 or 2 bytes in the subsequent step. When the OPCODE range is hit, the traversal process can be stopped.

[0060] As described above, by using the compression method of the HCI support command bitmask and the operation code mapping table of the present application, the number of traversed bytes is about 27% of the original flat OPCODE method. Although a small number of branches are added, the search speed is increased by about 30% and the search function is increased by about 40 bytes through calculation, which is very significant.

[0061] Since the Bluetooth Core Specification is updated regularly, with the upgrading of the Bluetooth Core Specification, the number of commands will continue to increase, and the compression effect will become more and more obvious.

[0062] In the compression method of the HCI support command bit mask and the operation code mapping table in the application, the HCI support command bit mask and the operation code mapping table size are further compressed without significantly increasing the search time CPU overhead, the resource consumption is reduced, the Bluetooth 5.4 specification and the subsequent specification upgrade needs can be better adapted to, and the cost is also reduced.

[0063] In one specific embodiment of the application, a computer readable storage medium stores computer instructions, and the computer instructions are operated to perform the compression method of the HCI support command bit mask and the operation code mapping table described in any embodiment.

[0064] In one specific embodiment of the application, a computer device includes a processor and a memory, and the memory stores computer instructions, and the processor operates the computer instructions to perform the compression method of the HCI support command bit mask and the operation code mapping table described in any embodiment.

[0065] The above is only an embodiment of the application, and does not limit the patent scope of the application, and any equivalent structural transformation made by using the content of the specification and the drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the application.

Claims

1. A compression method for HCI support command bitmask and opcode mapping table, characterized in that, Comprising: appending a first byte to the operation code in order according to the bit mask sequence number in the mapping table, the first byte containing a 2-bit branch control mask, according to the 2-bit branch control mask, there are four combinations, the four combinations are named as the first branch control mask, the second branch control mask, the third branch control mask and the fourth branch control mask, wherein the first byte also contains a 6-bit consecutive number; using the first branch control mask to represent a 2-byte operation code with multiple consecutive numbers; using the second branch control mask to represent a 0-byte operation code with a command of RFU, wherein RFU is Reserved for Future Use, i.e. reserved for future use; using the third branch control mask to represent a 1-byte operation code multiplexing the high byte of the previous operation code; using the fourth branch control mask to represent a 1-byte operation code with a consecutive number of 1, wherein the using the fourth branch control mask to represent a 1-byte operation code with a consecutive number of 1 includes using the 6-bit consecutive number part of the first byte to store the 6-bit high part of the operation code; wherein different branch control masks correspond to different following bytes, the different branch control masks corresponding to different following bytes include: when the branch control mask is the first branch control mask, the following byte is a 2-byte operation code; when the branch control mask is the second branch control mask, the following byte is a 0-byte operation code, fixed as RFU; when the branch control mask is the third branch control mask, the following byte is a 1-byte operation code low; when the branch control mask is the fourth branch control mask, the following byte is a 1-byte operation code.

2. The compression method of the HCI support command bitmask and operation code mapping table of claim 1, wherein, The mapping table is compressed in byte units.

3. The compression method of the HCI support command bitmask and operation code mapping table of claim 1, wherein, Each use of the branch control mask obtains one or more consecutive operation codes, i.e. an operation code range.

4. The method of claim 1, wherein the HCI support command bitmask and opcode mapping table is compressed, and further comprising: The operation code with the command of RFU is 0x0000, wherein 0x represents hexadecimal.

5. A computer-readable storage medium storing computer instructions, wherein, The computer instructions are operated to perform the compression method of the HCI support command bit mask and operation code mapping table according to any one of claims 1-4.

6. A computer device comprising a processor and a memory, the memory storing computer instructions, wherein, The processor operates the computer instructions to perform the compression method of the HCI support command bit mask and operation code mapping table according to any one of claims 1-4.

Citation Information

Patent Citations

  • Instruction stream compression and decompression method and device

    CN111708574A

  • Method and system for transporting FM data over a Bluetooth HCI link

    US20080051131A1