Linux system star flash drive and upper software interaction method and device
By creating structures for star flash devices in Linux system and setting interface function pointers, the problem that the existing technology cannot adapt to different star flash hardware is solved, the effective interaction between star flash devices and upper-level software modules is realized, and the interaction process is simplified. And adapted to different star flash hardware.
Patent Information
- Application Number
- CN202411325061.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2024-12-27
AI Technical Summary
Existing star flash hardware devices based on Linux systems cannot fully and correctly express star flash related technologies, resulting in the inability to adapt to different star flash hardware and lack mature interactive processes or mechanisms.
By creating a structure for the star flash device in the Linux system, setting the interface function pointer, and using the EXPORT_SYMBOL macro of the upper software module to export the function, the interaction between the star flash device and the upper software module is realized, the star flash hardware attributes are abstracted, and the upper and lower layers are simplified. Interactive logical flow.
It realizes adaptation to different star flash hardware, which is convenient for upper-level software developers to use, simplifies the upper-level and lower-level interactive logic process of star flash technology, and ensures the integrity and accuracy of functions.
Smart Images

Figure CN119201298A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of star flash technology, and in particular to a method and device for interaction between a Linux system star flash driver and upper-layer software. Background Art
[0002] As an emerging short-distance transmission technology, Starflash is increasingly being used in smart cars, smart homes, smart terminals, and smart manufacturing. For example, smart TVs, car-machine interconnection, wearable satellite high-precision positioning devices, wireless headphones, mice, wireless projection devices, etc.
[0003] The driver module of the Star Flash device is generally located in the Linux kernel area, and the interaction between the sub-modules in the kernel area is usually through the mutual call of the exported function symbol table. Existing Star Flash hardware devices based on the Linux system usually use the network card driver module to interact with the upper-level software module, that is, a set of network card data structures are abstracted in the Linux kernel to describe the properties and operations of the network card, and the network card driver module and the upper-level software module set the properties and call operations. However, since it is impossible to fully and correctly express Star Flash related technologies, such as the technical details of scanning and connection in Star Flash technology, the existing technology does not have a mature interaction process or mechanism for Star Flash technology and cannot adapt to different Star Flash hardware. Summary of the invention
[0004] In view of the above-mentioned defects, the technical problem to be solved by the present invention is to provide an interaction method and method between the Linux system Star Flash driver and the upper-level software, so as to solve the problem that the existing technology cannot adapt to different Star Flash hardware.
[0005] To this end, a first aspect of an embodiment of the present application provides a method for interacting between a Linux system star flash driver and upper layer software, comprising the following steps:
[0006] When the Star Flash driver detects the Star Flash device, it calls the device creation registration interface, allocates the Star Flash device structure space in the memory to create the Star Flash device structure, and the Star Flash device structure includes device properties and device driver interface;
[0007] Register the Star Flash device and set the actual interface function pointer of the Star Flash device into the Star Flash device structure;
[0008] The Star Flash driver calls the function exported by the EXPORT_SYMBOL macro of the upper-level software module through the upper-level software interface. The upper-level software module calls the driver function through the function pointer in the Star Flash device structure to realize the interaction between the Star Flash device and the upper-level software module.
[0009] Based on the above technical solution, this application abstracts the hardware properties of Starflash and simplifies the logical process of interaction between the upper and lower layers of Starflash technology. The upper layer only needs to export function symbols, and the lower layer sets the function pointers in the Starflash structure to realize the interaction between the upper and lower layers. It can adapt to different Starflash hardware and is convenient for upper-level software developers to use.
[0010] In the above technical solution, preferably, the device driver interface and the upper-layer software interface respectively include: a device management function, a device discovery function, a device connection function and a transmission function.
[0011] In the above technical solution, preferably, the device management function of the device driver interface includes: enabling a device, disabling a device, setting l2id, setting MTU, obtaining a device status, and obtaining device information.
[0012] In the above technical solution, preferably, the device discovery function of the device driver interface includes: setting device public information, starting broadcasting, stopping broadcasting, setting discovery filter conditions, starting scanning, and stopping scanning.
[0013] In the above technical solution, preferably, the device connection function of the device driver interface includes: establishing a logical link, deleting a logical link, associating a logical link, contacting an associated logical link, and connecting and disconnecting.
[0014] In the above technical solution, preferably, the device management function of the upper-layer software interface includes: allocating device structure memory, releasing device structure memory, registering device, deregistering device, and reporting device online and offline status.
[0015] In the above technical solution, preferably, the device discovery function of the upper-layer software interface includes: reporting of device scanning results.
[0016] In the above technical solution, preferably, the device connection function of the upper-layer software interface includes logical link status reporting and connection status reporting, wherein the logical link status reporting includes new creation, release and association, and the connection status reporting includes new creation and disconnection.
[0017] In the above technical solution, preferably, the transmission function of the upper-layer software interface includes: receiving a new message.
[0018] A second aspect of an embodiment of the present application provides an interactive device between a Linux system star flash driver and an upper layer software module, including:
[0019] The device creation and registration unit is used to allocate a Star Flash device structure space in the memory to create a Star Flash device structure and register the Star Flash device, wherein the Star Flash device structure includes device attributes and a device driver interface; after the Star Flash device is registered, the actual interface function pointer of the Star Flash device is set in the Star Flash device structure;
[0020] The first calling unit is arranged on the upper software module and is used to call the driving function through the actual interface function pointer of the Star Flash device;
[0021] The second calling unit is set on the Xingshan driver and is used to call the function exported by the EXPORT_SYMBOL macro of the upper-level software module through the upper-level software interface.
[0022] It can be seen from the above technical solutions that the method and device for interacting with the Linux system Starflash driver and the upper software module provided by the present invention solves the problem that the prior art cannot fully and correctly express Starflash related technologies and cannot adapt to different Starflash hardware. Compared with the prior art, the present invention has the following beneficial effects:
[0023] This application scheme abstracts the properties of Starflash hardware and simplifies the logical process of interaction between the upper and lower layers of Starflash technology. The upper layer only needs to export function symbols, and the lower layer sets the function pointers in the Starflash structure to realize the interaction between the upper and lower layers. It can adapt to different Starflash hardware and is convenient for upper-level software developers to use. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces and describes the drawings required for use in the embodiments of the present invention or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0025] Figure 1 A flowchart of the method for interaction between the Linux system Star Flash driver and the upper software module provided by the embodiment of the present invention;
[0026] Figure 2 Schematic diagram of state transition in the Markov decision process in an embodiment of the present invention. DETAILED DESCRIPTION
[0030] The following will be combined with the accompanying drawings of the embodiments of the present invention to clearly and completely describe the technical solutions of the embodiments of the present invention. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0031] In order to more clearly explain and illustrate the technical solution and implementation of the present invention, several preferred specific embodiments for implementing the technical solution of the present invention are introduced below.
[0032] It should be noted that the directional words such as "inside, outside", "front, back" and "left, right" in this article are expressed based on the product usage status. Obviously, the use of the corresponding directional words does not constitute a limitation on the protection scope of this scheme.
[0033] NearLink is a new wireless communication technology specifically designed for short-distance data transmission. Compared with traditional technologies such as Bluetooth and Wi-Fi, it has undergone a lot of innovative upgrades, achieving a comprehensive improvement in speed, latency, transmission distance, security, and reliability. In other words, NearLink is actually an enhanced version of the "Wi-Fi + Bluetooth" hybrid.
[0034] Linux is the most widely used advanced operating system for embedded device management. Hardware devices running the Linux operating system can be personal computers, servers, embedded systems, etc. Its hardware mainly includes: motherboard, central processing unit (CPU), memory (RAM), hard disk drive (HDD) or solid state drive (SSD) and input / output (I / O) devices, etc.
[0035] Many applications of Starflash technology are managed under the Linux system. The driver modules of Starflash devices are generally located in the Linux kernel area. The interactions between the sub-modules in the kernel area are generally through mutual calls through the exported function symbol table. However, the current Linux system does not have a mature interaction process or mechanism for Starflash technology, which makes it impossible to fully and correctly express Starflash related technologies. For example, the technical details of scanning and connection in Starflash technology cannot be adapted to different Starflash hardware.
[0036] This application, based on the latest Star Flash technical standards, proposes and implements a set of interaction methods between the Star Flash driver module and the upper software module in the Linux system, including call logic, Star Flash device data structure, upper software interface and Star Flash device driver interface. Through this interaction method, a unified property and operation method for describing the Star Flash device can be provided for the upper software module, which can adapt to different Star Flash hardware for use by upper software module developers.
[0037] The Xingshan driver here refers to the driver program of the Xingshan device, which can also be called the Xingshan driver module. The upper-layer software refers to the software application running on the Linux system host, which can also be called the upper-layer software module.
[0038] The following first introduces a method for interacting between a Linux system Star Flash driver and upper-level software provided by an embodiment of the present application in conjunction with a flowchart.
[0039] like Figure 1 As shown, an interaction method between a Linux system star flash driver and an upper software module provided in an embodiment of the present application includes the following steps:
[0040] Step 110, when the Star Flash driver detects the Star Flash device, it calls the device creation registration interface, allocates the Star Flash device structure space in the memory of the Linux system host, and thus creates a Star Flash device structure.
[0041] In the Linux system, the StarFlash driver is implemented in the form of Linux system kernel modules. These modules can be automatically loaded when the StarFlash device is inserted to identify the insertion of the StarFlash device.
[0042] In this application, the Xingshan device structure includes device properties and device driver interfaces, which will be used continuously in subsequent interaction processes. The specific content will be described in detail later.
[0043] Step 120, the Star Flash driver calls the device to create a registration interface to register the Star Flash device, and sets the actual interface function pointer of the Star Flash device into the Star Flash device structure, so that the upper-level software module can call the actual function of the driver module.
[0044] Interface function pointers usually refer to the addresses of functions in device driver modules that implement specific functions. These functions can be called through pointers to implement device initialization, data transmission, status query and other operations.
[0045] In the context of Starflash technology, interface function pointers may refer to functions related to Starflash communication, such as sending data, receiving data, configuring device parameters, etc. Developers can interact with Starflash devices through these interface functions to achieve the required communication functions. These interface functions are usually defined in the driver module or SDK (Software Development Kit) of the Starflash device and provided to developers for use.
[0046] Step 130, the Star Flash driver calls the function exported by the EXPORT_SYMBOL macro of the upper-level software module through the upper-level software interface. The upper-level software module calls the driver function through the function pointer in the Star Flash device structure, thereby realizing the interaction between the Star Flash device and the upper-level software module.
[0047] The interactive logic framework is as follows Figure 2 shown.
[0048] In Linux systems, the EXPORT_SYMBOL macro is used to export symbols (such as functions or variables) in the kernel so that these symbols can be accessed by kernel modules.
[0049] This application scheme abstracts the properties and operation methods of the Star Flash device into a universal structure for the upper-level software module and the Star Flash driver to set up and use. The data structure of the Star Flash device structure is created by the upper-level software module in the memory space on the Linux system host, and is managed by the upper-level software module and notified to the Star Flash driver for its use.
[0050] The Xingshan device structure includes two parts: device properties and device driver interface.
[0051] Device properties include:
[0052] Device id (identity, unique device identifier);
[0053] Device name;
[0054] Device status;
[0055] Device l2id (layer to id);
[0056] Device MTU (Maximum Transmission Unit);
[0057] Device role.
[0058] The device driver interface consists of multiple interface functions for upper-level software modules to call, including the following:
[0059]
[0060]
[0061] In this application scheme, in order to realize the interactive operation between the Star Flash driver and the upper software module, the upper software module also needs to set the corresponding upper software interface. The upper software interface also includes multiple functions for the Star Flash driver to call, including the following:
[0062]
[0063] After the above definition, this application uses a set of general methods to abstract the hardware properties of Star Flash while fully complying with the current Star Flash technical standards.
[0064] It provides a unified description of the properties and operation methods of the Starflash device for the upper-layer software, which can adapt to different Starflash hardware and facilitate the upper-layer software module to uniformly access and control the Starflash hardware related information. It is used by upper-layer software developers to facilitate upper-layer business development.
[0065] The driver can directly call the function exported by the EXPORT_SYMBOL macro of the upper-level software, and the upper-level software can call the driver function through the function pointer in the device structure, thus realizing the interaction between the upper and lower layers.
[0066] This application simplifies the logical flow of interaction between the upper and lower layers of the Star Flash technology. The upper layer only needs to export function symbols, and the lower layer sets the function pointers in the Star Flash structure to achieve interaction between the upper and lower layers, which is convenient for upper-layer business development.
[0067] Based on the above method, the present application also provides an interactive device between the Linux system star flash driver and the upper layer software, including:
[0068] The device creation and registration unit is used to allocate a Star Flash device structure space in the memory to create a Star Flash device structure and register the Star Flash device, wherein the Star Flash device structure includes device attributes and a device driver interface; after the Star Flash device is registered, the actual interface function pointer of the Star Flash device is set in the Star Flash device structure;
[0069] The first calling unit is arranged on the upper software module and is used to call the driving function through the actual interface function pointer of the Star Flash device;
[0070] The second calling unit is set on the Xingshan driver and is used to call the function exported by the EXPORT_SYMBOL macro of the upper-level software module through the upper-level software interface.
[0071] Based on the description of the above specific embodiments, the method and device for interacting between the Linux system star flash driver and the upper software module provided by the present invention have the following advantages compared with the prior art:
[0072] First, when the Star Flash driver detects the Star Flash device, it allocates the structure space of the Star Flash device in the memory to create the Star Flash device structure, and sets the actual interface function pointer of the Star Flash device into the Star Flash device structure; the Star Flash driver calls the function exported by the EXPORT_SYMBOL macro of the upper-level software module through the upper-level software interface, and the upper-level software module calls the driver function through the function pointer in the Star Flash device structure to realize the interaction between the Star Flash device and the upper-level software module. Therefore, this application abstracts the hardware properties of the Star Flash and simplifies the logical flow of interaction between the upper and lower layers of the Star Flash technology. The upper layer only needs to export function symbols, and the lower layer sets the function pointer in the Star Flash structure to realize the interaction between the upper and lower layers. It can adapt to different Star Flash hardware and is convenient for upper-level software developers to use.
[0073] Second, the Starflash device structure includes device properties and device driver interfaces, which fully and accurately express Starflash related technologies, such as scanning, connection and other technical details in Starflash technology. Therefore, it can be adapted to different Starflash hardware and has a wide range of applications.
[0074] Finally, it should be noted that the terms "comprises", "includes" or any other variants thereof as used herein are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0075] The present invention is not limited to the above-mentioned optimal implementation mode. Anyone should be aware that any structural changes made under the inspiration of the present invention, and any technical solutions that are the same or similar to the present invention, fall within the protection scope of the present invention.
Claims
1. A method for interaction between a Linux system star flash driver and upper layer software, characterized in that: The following steps are involved: When the Star Flash driver detects the Star Flash device, it calls the device creation registration interface, allocates the Star Flash device structure space in the memory to create the Star Flash device structure, and the Star Flash device structure includes device properties and device driver interface; Register the Star Flash device and set the actual interface function pointer of the Star Flash device into the Star Flash device structure; The Star Flash driver calls the function exported by the EXPORT_SYMBOL macro of the upper-level software module through the upper-level software interface. The upper-level software module calls the driver function through the function pointer in the Star Flash device structure to realize the interaction between the Star Flash device and the upper-level software module.
2. The method according to claim 1, characterized in that The device driver interface and the upper layer software interface respectively include: a device management function, a device discovery function, a device connection function and a transmission function.
3. The method according to claim 2, characterized in that The device management functions of the device driver interface include: enabling a device, disabling a device, setting l2id, setting MTU, obtaining device status, and obtaining device information.
4. The method according to claim 2, characterized in that: The device discovery function of the device driver interface includes: setting device public information, starting broadcasting, stopping broadcasting, setting discovery filter conditions, starting scanning, and stopping scanning.
5. The method according to claim 2, characterized in that: The device connection functions of the device driver interface include: establishing a logical link, deleting a logical link, associating a logical link, contacting an associated logical link, and connecting and disconnecting.
6. The method according to claim 2, characterized in that The device management functions of the upper software interface include: allocating device structure memory, releasing device structure memory, registering devices, deregistering devices, and reporting device online and offline status.
7. The method according to claim 2, characterized in that: The device discovery function of the upper-layer software interface includes: reporting device scanning results.
8. The method according to claim 2, characterized in that: The device connection function of the upper layer software interface includes logical link status reporting and connection status reporting, wherein the logical link status reporting includes new creation, release and association, and the connection status reporting includes new creation and disconnection.
9. The method according to claim 2, characterized in that: The transmission function of the upper layer software interface includes: receiving a new message.
10. An interactive device between a Linux system star flash driver and an upper software module, characterized in that: include: The device creation and registration unit is used to allocate a Star Flash device structure space in the memory to create a Star Flash device structure and register the Star Flash device, wherein the Star Flash device structure includes device attributes and a device driver interface; after the Star Flash device is registered, the actual interface function pointer of the Star Flash device is set in the Star Flash device structure; The first calling unit is arranged on the upper software module and is used to call the driving function through the actual interface function pointer of the Star Flash device; The second calling unit is set on the Xingshan driver and is used to call the function exported by the EXPORT_SYMBOL macro of the upper-level software module through the upper-level software interface.
Citation Information
Cited By
Multimedia data transmission system implementation method and device, equipment and storage medium
CN120017882A