An audio controller and system for ARM processor platform
By designing the audio controller on the ARM processor platform and using the AMBA bus interface, DMA control module, register module and cross-clock domain processing module, the data interaction between the ARM processor and the HDA link is realized, and the problem of HDA audio on the ARM platform is solved. The problem of insufficient technical applicability is achieved, and efficient audio data interaction and quality assurance are achieved.
Patent Information
- Application Number
- CN202410808731.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-06-21
AI Technical Summary
Existing HDA audio technology is mainly suitable for x86 architecture processor platforms, and it is difficult to realize data interaction on ARM processor platforms, making it difficult to realize data interaction between ARM processors and HDA links.
Design an audio controller for ARM processor platform, including AMBA bus interface, DMA control module, register module, cross-clock domain processing module and HDA link interface control module. Through these modules, the connection between ARM processor and HDA link is realized. Data interaction ensures normal playback and collection of audio data.
It realizes efficient data interaction between the ARM processor and the HDA link, supports the playback and collection of audio data, ensures audio quality, and simplifies the complexity of the audio controller and DMA channel scheduling logic.
Smart Images

Figure CN118394298B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of audio technology, and in particular to an audio controller oriented to an ARM processor platform and an audio transmission system. Background Art
[0002] HDA (High Definition Audio) is an architecture solution for playing and capturing high-fidelity audio. It supports up to 15 codecs working simultaneously, and supports a sampling frequency of up to 192 Hz and a sampling accuracy of up to 32 bits. Therefore, compared with traditional audio technologies (AC97, I2S, etc.), it can provide clearer and more realistic sound. Thanks to this, HDA audio technology is widely used in personal computers, servers and even professional audio equipment. However, the current HDA audio technology is mainly used in x86 architecture processor platforms. The x86 architecture is a complex instruction set architecture. Its instruction set is very redundant and the usage rate varies greatly. Usually, 80% of the instructions used in a typical operation process only account for 20% of the entire processor instruction architecture.
[0003] The ARM (Advanced RISC Machines) architecture is a reduced instruction set architecture. Due to its fixed instruction length, its decoding and execution speed is faster. In addition, due to the rapid development of very large scale integrated circuit (VLSI) technology, it is possible to integrate more registers on the chip, which is very conducive to the development of reduced instruction sets that use a large number of register instructions. In comparison, ARM processor cores or architectures with small size, low power consumption, high performance and relatively lower cost are more easily available. The AMBA (Advanced Microcontroller Bus Architecture) bus is an advanced microcontroller bus architecture and is the communication interface between the ARM processor and other systems on the chip.
[0004] Therefore, how to provide an implementation solution of an HDA controller for an ARM processor platform and realize data interaction between the ARM processor and the HDA link is a problem that those skilled in the art need to solve urgently. Summary of the invention
[0005] The purpose of the present invention is to provide an audio controller for an ARM processor platform, which can realize data interaction between the ARM processor and the HDA link; another purpose of the present invention is to provide an audio transmission system, which can realize data interaction between the ARM processor and the HDA link.
[0006] In order to solve the above technical problems, the present invention provides an audio controller for an ARM processor platform, comprising an AMBA bus interface, a DMA control module, a register module, a cross-clock domain processing module and an HDA link interface control module;
[0007] The register module is connected to the DMA control module, and both the register module and the DMA control module are connected to the AMBA bus interface, and both the register module and the DMA control module are connected to the cross-clock domain processing module, and the cross-clock domain processing module is connected to the HDA link interface control module;
[0008] The AMBA bus interface is used to connect the ARM processor and the main memory through the AMBA bus, and the HDA link interface control module is used to connect the codec, process the data when the data flow is interrupted, and continue to play the audio data in the next frame;
[0009] The DMA channels of the DMA control module are bound to the preset data streams in a one-to-one correspondence. When working, the data streams are bound to the codecs. The authorized DMA channels initiate read and write requests to the main memory through the AMBA bus interface to transfer the audio data corresponding to the data streams.
[0010] The AMBA bus interface, the DMA control module and the register module operate in a first clock domain corresponding to the AMBA bus, the HDA link interface control module operates in a second clock domain corresponding to the codec, and the cross-clock domain processing module is used to coordinate the first clock domain and the second clock domain.
[0011] Optionally, the AMBA bus interface includes an APB Slave interface and an AXI Master interface, the APB Slave interface is connected to the register module, and the AXI Master interface is connected to the DMA control module; the data length of the burst operation corresponding to the AXI Master interface corresponds to the data frame length of the audio data.
[0012] Optionally, the DMA control module includes a BDL acquisition module, an arbitrator and a plurality of DMA channels;
[0013] The BDL acquisition module is used to acquire the BDLE located in the main memory; each of the DMA channels is used to carry corresponding commands, responses and multiple input and output data streams; the arbitrator is used to determine which component of the BDL acquisition module and each of the DMA channels occupies the AXI bus.
[0014] Optionally, the DMA control module is specifically used for:
[0015] When the data length of a single output data stream obtained from the AMBA bus exceeds the maximum load of the output frame, the data exceeding the maximum load is discarded, and the data within the maximum load of the output frame is transferred.
[0016] Optionally, the DMA control module is specifically used for:
[0017] When the total data length of multiple output data streams successively obtained from the AMBA bus exceeds the maximum load of the output frame, the data of the output data streams obtained later are discarded, and the data obtained earlier that does not exceed the maximum load of the output frame are transferred.
[0018] Optionally, the HDA link interface control module includes a reset module, a Codec initialization module, a sending module and a receiving module, the sending module is used to convert parallel audio data and commands into serial data and send them to the codec, and the receiving module is used to collect serial audio data and responses, convert them into parallel data and send them to the main memory.
[0019] Optionally, the driving clock frequency of the sending module is twice the standard driving clock frequency defined in the HDA specification, and the sending module is a rising edge sampling.
[0020] Optionally, it also includes an on-chip FIFO connected to the DMA control module;
[0021] The HDA link interface control module is specifically used for:
[0022] When data in the on-chip FIFO is disconnected, stop sending data to the codec from the disconnection point until the duration of the current frame ends, and discard the data from the disconnection point to the end of the current frame;
[0023] The playback process of the corresponding audio data continues from the next frame.
[0024] Optionally, it further comprises at least two on-chip FIFOs connected to the DMA control module, and the DMA control module alternately transfers data required for different frames to the on-chip FIFOs;
[0025] The HDA link interface control module is specifically used for:
[0026] When the data in the on-chip FIFO corresponding to the current frame is complete, the data corresponding to the current frame is taken out from the on-chip FIFO and sent to the codec.
[0027] The present invention also provides an audio transmission system, comprising an AMBA bus, an ARM processor, a main memory, an HDA link, a codec, and an audio controller as described in any one of the above items;
[0028] The AMBA bus interface connects the ARM processor and the main memory via the AMBA bus, and the HDA link interface control module connects the codec.
[0029] The present invention provides an audio controller for an ARM processor platform, comprising an AMBA bus interface, a DMA control module, a register module, a cross-clock domain processing module and an HDA link interface control module; the register module is connected to the DMA control module, the register module and the DMA control module are both connected to the AMBA bus interface, and the register module and the DMA control module are both connected to the cross-clock domain processing module, and the cross-clock domain processing module is connected to the HDA link interface control module; the AMBA bus interface is used to connect the ARM processor and the main memory by connecting the AMBA bus, and the HDA link interface control module is used to connect the codec; the DMA channel of the DMA control module is bound to the preset data stream in a one-to-one correspondence, the data stream is bound to the codec during operation, and the authorized DMA channel initiates a read and write request to the main memory through the AMBA bus interface to carry audio data corresponding to the data stream; the AMBA bus interface, the DMA control module and the register module work in a first clock domain corresponding to the AMBA bus, the HDA link interface control module works in a second clock domain corresponding to the codec, and the cross-clock domain processing module is used to coordinate the first clock domain and the second clock domain.
[0030] The audio controller is set to connect the codec of HDA to play or collect audio. The designed audio controller is mounted on the AMBA bus. The ARM processor can configure and control the codec by sending and receiving commands / responses to achieve functions such as volume adjustment, codec format configuration, and codec power management. The audio data is managed in a stream manner. The digital signal to be played is managed by the output stream, transported by the DMA control module, output to the stream-bound codec, and converted into an analog signal by the DAC (digital-to-analog converter) in the codec for playback. The collected analog signal is just the opposite. It is managed by the input stream, converted into a digital signal by the ADC (analog-to-digital converter), and then transported to the main memory by DMA to achieve data interaction between the ARM processor and the HDA link. The cross-clock domain processing module is used to coordinate different clock domains to ensure normal data interaction.
[0031] The present invention also provides an audio transmission system, which also has the above-mentioned beneficial effects and will not be described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions of the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0033] Figure 1 A schematic diagram of the structure of an audio controller for an ARM processor platform provided by an embodiment of the present invention;
[0034] Figure 2 for Figure 1 The structural diagram of the DMA control module;
[0035] Figure 3 for Figure 1 Schematic diagram of the clock domain of the audio controller;
[0036] Figure 4 is a reset flow chart of the audio controller in an embodiment of the present invention;
[0037] Figure 5 This is a schematic diagram of a first processing method in which an output data stream exceeds the maximum load of an output frame in an embodiment of the present invention;
[0038] Figure 6 This is a schematic diagram of processing a second output data stream exceeding the maximum load of an output frame in an embodiment of the present invention;
[0039] Figure 7 This is a schematic diagram of the first data flow interruption processing in an embodiment of the present invention;
[0040] Figure 8 Schematic diagram of the second data flow interruption processing in an embodiment of the present invention. DETAILED DESCRIPTION
[0041] The core of the present invention is to provide an audio controller for an ARM processor platform. In the prior art, the current HDA audio technology is mainly used in the x86 architecture processor platform. The x86 architecture is a complex instruction set architecture, and its instruction set is very redundant and the utilization rate varies greatly. The ARM architecture is a reduced instruction set architecture. Due to its fixed instruction length, its decoding and execution speed is faster, and due to the rapid development of very large-scale integrated circuit technology, it is possible to integrate more registers on the chip, which is very conducive to the development of reduced instruction sets that use a large number of register instructions. Therefore, how to provide an implementation scheme of an HDA controller for an ARM processor platform and realize data interaction between the ARM processor and the HDA link is a problem that technicians in this field urgently need to solve.
[0042] The audio controller for ARM processor platform provided by the present invention comprises an AMBA bus interface, a DMA control module, a register module, a cross-clock domain processing module and an HDA link interface control module; the register module is connected to the DMA control module, the register module and the DMA control module are both connected to the AMBA bus interface, and the register module and the DMA control module are both connected to the cross-clock domain processing module, and the cross-clock domain processing module is connected to the HDA link interface control module; the AMBA bus interface is used to connect the ARM processor and the main memory by connecting the AMBA bus, and the HDA link interface control module is used to connect the codec; the DMA channel of the DMA control module is bound to the preset data stream in a one-to-one correspondence, and the data stream is bound to the codec during operation, and the authorized DMA channel initiates a read and write request to the main memory through the AMBA bus interface to carry the audio data corresponding to the data stream; the AMBA bus interface, the DMA control module and the register module work in the first clock domain corresponding to the AMBA bus, the HDA link interface control module works in the second clock domain corresponding to the codec, and the cross-clock domain processing module is used to coordinate the first clock domain and the second clock domain.
[0043] The audio controller is set to connect the codec of HDA to play or collect audio. The designed audio controller is mounted on the AMBA bus. The ARM processor can configure and control the codec by sending and receiving commands / responses to achieve functions such as volume adjustment, codec format configuration, and codec power management. The audio data is managed in a stream manner. The digital signal to be played is managed by the output stream, transported by the DMA control module, output to the stream-bound codec, and converted into an analog signal by the DAC (digital-to-analog converter) in the codec for playback. The collected analog signal is just the opposite. It is managed by the input stream, converted into a digital signal by the ADC (analog-to-digital converter), and then transported to the main memory by DMA to achieve data interaction between the ARM processor and the HDA link. The cross-clock domain processing module is used to coordinate different clock domains to ensure normal data interaction.
[0044] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than 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.
[0045] Embodiment 1
[0046] Please refer to Figures 1 to 3 , Figure 1A schematic diagram of the structure of an audio controller for an ARM processor platform provided by an embodiment of the present invention; Figure 2 for Figure 1 The structural diagram of the DMA control module; Figure 3 for Figure 1 Schematic diagram of the clock domain of the audio controller.
[0047] See also Figure 1 In an embodiment of the present invention, an audio controller for an ARM processor platform includes an AMBA bus interface, a DMA control module, a register module, a cross-clock domain processing module and an HDA link interface control module; the register module is connected to the DMA control module, and the register module and the DMA control module are both connected to the AMBA bus interface, and the register module and the DMA control module are both connected to the cross-clock domain processing module, and the cross-clock domain processing module is connected to the HDA link interface control module; the AMBA bus interface is used to connect the ARM processor and the main memory by connecting the AMBA bus, and the HDA link interface control module Used to connect the codec, process the data when the data flow is interrupted, and continue to play the audio data in the next frame; the DMA channel of the DMA control module is bound to the preset data stream one by one, and the data stream is bound to the codec during operation. The authorized DMA channel initiates a read and write request to the main memory through the AMBA bus interface to carry the audio data corresponding to the data stream; the AMBA bus interface, the DMA control module and the register module work in the first clock domain corresponding to the AMBA bus, the HDA link interface control module works in the second clock domain corresponding to the codec, and the cross-clock domain processing module is used to coordinate the first clock domain and the second clock domain.
[0048] In this embodiment, the audio controller can be specifically used in terminals such as mobile phones, personal computers, and even in the server field. It needs to realize data interaction between the ARM processor and the HDA link. Correspondingly, in this embodiment, the audio controller is provided with an AMBA bus interface connected to the AMBA bus and an HDA link interface control module. In this embodiment, the register module is provided with register instructions. The register module needs to implement some registers defined in the "High Definition Audio Specification, V1.0a" and customized. The ARM processor can control the HDA controller through these registers and obtain the status of the HDA controller.
[0049] The above-mentioned DMA control module is responsible for the data movement between the main memory and the audio controller, including the commands in CORB (Command Outbound Ring Buffer), the responses in RIRB (Response Inbound Ring Buffer), and the audio data to be played or collected. In this embodiment, the DMA channel and the specific data stream are bound together, and each channel will only be responsible for one data stream, that is, the DMA channel is bound to the preset data stream one by one, so that the scheduling logic of the DMA channel can be reduced while ensuring the function of the audio controller, simplifying the complexity of the audio controller. In this embodiment, the register module is connected to the DMA control module, and it has been implemented based on the above-mentioned registers that meet the requirements when the DMA control module moves data. The register module and the DMA control module are both connected to the AMBA bus interface, and the register module and the DMA control module are connected to the HDA link interface control module through the cross-clock domain processing module, so that the DMA control module can realize the data movement between the ARM processor and the HDA link.
[0050] In this embodiment, the AMBA bus interface is used to connect the ARM processor and the main memory by connecting the AMBA bus. The AMBA bus interface generally includes an APB (Advanced Peripheral Bus) Slave interface and an AXI (Advanced extensible interface) Master interface. The APB Slave interface is connected to the register module, and the AXI Master interface is connected to the DMA control module. The ARM processor can query and configure the register module through the APB Slave interface, and realize the interaction between software and data through the AXI Master interface.
[0051] In this embodiment, the data length of the burst operation corresponding to the AXI Master interface corresponds to the data frame length of the audio data. The above-mentioned burst operation is the Burst operation of the AXI bus, and the Burst operation of the AXI bus is very consistent with the organization form of the HDA audio data frame. In this embodiment, it is necessary to calculate the length of the AXI bus Burst operation according to the audio format, that is, the data length of the burst operation corresponding to the AXI Master interface needs to correspond to the data frame length of the audio data, so that one frame of the Burst operation can retrieve one or several frames of audio data, that is, in this embodiment, the data length of the burst operation is usually an integer multiple of the data frame length of the audio data.
[0052] See also Figure 2In this embodiment, the DMA control module includes a BDL acquisition module, an arbitrator and multiple DMA channels; the BDL acquisition module is used to acquire the BDLE located in the main memory; the DMA channel is used to carry commands, responses and multiple input and output data streams; the arbitrator is used to determine which component of the BDL acquisition module and each of the DMA channels occupies the AXI bus.
[0053] The above-mentioned acquisition BDL module is used to acquire BDLE (Buffer Descriptor List Entries) located in the main memory. The BDLE stores the address signal of the input / output data stream in the main memory. Multiple BDLEs will form a BDL. In this embodiment, the acquisition BDL module is used to acquire BDLE to prepare for the subsequent handling of the input and output data streams. In this embodiment, it is stipulated that when the system software writes 0 to the RUN register to stop the data flow, when this acquisition BDL module obtains the authorization of the arbitrator, it will acquire a BDLE from the main memory and then stop working.
[0054] The above-mentioned DMA channel usually includes a command channel (CORB channel), a response channel (RIRB channel), multiple output data stream channels and multiple input data stream channels, so the DMA channel can be used to carry commands, responses and multiple input and output data streams. Each of the above-mentioned DMA channels will be bound to commands, responses, input and output data streams one by one, for example, the channel bound to the command is only used to carry commands, and will not be used to carry responses or data streams. In this embodiment, it is usually stipulated that when the system software writes 0 to the CORBRUN or RIRBDMAEN register to stop the corresponding DMA channel, when the command channel and the response channel obtain the authorization of the arbitrator, they need to read or write a command and response to CORB or RIRB before stopping the operation of these two channels.
[0055] For the input data flow channel and the output data flow channel, if the system software writes 0 to the RUN register to stop the data flow, since the protocol stipulates that the link must complete the transmission of the current frame and the hardware must stop running within 40us, the following scenarios will be discussed: the first one, at this time the transmission has been completed or no request has been initiated or the arbitrator authorization has not been obtained, then the work will be stopped directly; the second one, at this time although the authorization has been obtained, no transmission data has been generated, then the work will be stopped directly; the third one, at this time the transmission data has been generated or the transmission is in progress, then no new transmission data will be generated, and the operation will be stopped after receiving the response to the read request that has been issued.
[0056] The above-mentioned arbitrator is used to determine which of the BDL module and each DMA channel occupies the AXI bus, and the arbitration process usually uses RR arbitration. Of course, the arbitration process is not specifically limited in this embodiment, and it depends on the specific situation. In this embodiment, the HDA link interface control module is used to connect the codec, that is, the HDA link interface control module belongs to the module that interacts with the codec, which is used to realize the reset and release of the HDA link, and collect and play the audio data stream according to the timing defined in the "High Definition Audio Specification, V1.0a". The audio controller provided in this embodiment supports multiple codecs to work simultaneously, which involves the scheduling of multiple output data streams. This embodiment can use a scheduling circuit to handle this problem. The scheduling logic corresponding to the scheduling circuit can be RR scheduling logic, WRR scheduling logic and DRR scheduling logic, etc., which are not specifically limited here.
[0057] In this embodiment, the APB Slave interface is connected to the APB bus, and the AXI Master interface is connected to the AXI bus. A set of AXI buses usually includes multiple channels such as AXI write address channel, AXI write data channel, AXI write response channel, AXI read address channel, and AXI read data channel. The DMA control module in this embodiment includes obtaining a BDLE module and various data channels, but the AXI bus usually has only the above set. Therefore, the DMA control module needs an arbitrator to arbitrate whether to obtain the BDLE module or which data channel obtains the right to use the AXI bus, and performs corresponding operations on the main memory through the corresponding channel.
[0058] In this embodiment, the DMA control module will perform corresponding operations on the main memory through each channel of the AXI bus based on the DMA channel, that is, those who have obtained the right to use the AXI bus can use the AXI Master interface to access the main memory and obtain the BDLE or audio data in the main memory. For example, the DMA channel bound to the output data stream 0 has obtained the right to use the AXI bus, then it can issue a read request to the main memory through the AXI read address channel of the AXI Master interface, and the AXI Slave at the opposite end returns the data of the output data stream 0 through the AXI read data channel. The input data stream initiates a write request to the main memory through the AXI write data channel and AXI write address channel of the AXI Master interface.
[0059] Therefore, the audio controller provided in this embodiment will bind the data stream and the codec to each other when working, and the DMA control module will authorize the DMA channel when sending a request to the data of the main memory, which can be specifically authorized by the above-mentioned arbitrator. The authorized DMA channel will initiate a read and write request to the main memory through the AMBA bus interface, specifically through the corresponding channel of the above-mentioned AXI bus, to realize the transfer of the audio data corresponding to the data stream, and the above-mentioned read and write request includes a read request and a write request.
[0060] In this embodiment, the HDA link interface control module is specifically used to process data when the data flow is interrupted, and continue to play the audio data in the next frame. The specific processing process when the data flow is interrupted will be described in detail in the following fourth embodiment of the invention, and will not be repeated here. In this embodiment, the processing of data by the HDA link interface control module when the data flow is interrupted can effectively reduce the impact of the data flow interruption on the sound playback.
[0061] In this embodiment, the audio controller generally further includes an interrupt and wake-up module, which is used to obtain interrupt and wake-up signals to implement the interrupt and wake-up functions of the controller. The interrupt and wake-up module needs to be connected to the register module.
[0062] Since the clock domain in which the AMBA bus works and the clock domain specified by the codec are clock domains defined by different clock sources, the audio control in this embodiment is provided with a cross-clock domain processing module, the register module and the DMA control module are both connected to the cross-clock domain processing module, and the HDA link interface control module is connected to the register module and the DMA control module through the cross-clock domain processing module.
[0063] See also Figure 3In this embodiment, the above-mentioned AMBA bus interface, DMA control module and register module work in the first clock domain corresponding to the AMBA bus, and usually the above-mentioned interrupt and wake-up module also works in the first clock domain; and the HDA link interface control module works in the second clock domain corresponding to the codec, and the cross-clock domain processing module is used for asynchronous clock processing and coordination of the first clock domain and the second clock domain. That is, in this embodiment, except for the HDA link interface control module and the cross-clock domain processing module, they are all in the first clock domain, such as the clock domain with a frequency of 200 M, and the HDA link interface control module can be in the second clock domain with a frequency of 48 M, and the cross-clock domain processing module is responsible for coordinating the two clock domains. For the control signal, the signal of single-bit data from the slow clock domain to the fast clock, the cross-clock domain processing module can use three-beat processing, and the multi-bit signal cross-clock domain processing module can use DMUX (multiplexer), handshake, asynchronous FIFO (FirstInput FirstOutput, first-in first-out queue) processing, and the data signal cross-clock domain processing module uniformly uses asynchronous FIFO processing to coordinate the first clock domain and the second clock domain. That is, in this embodiment, the cross-clock domain processing module is specifically used to use asynchronous FIFO processing on the data signal to coordinate the first clock domain and the second clock domain. The frequency of the first clock domain and the frequency of the second clock domain can be the same or different. Usually, the frequency of the first clock domain is significantly greater than the frequency of the second clock domain.
[0064] Specifically, in this embodiment, the HDA link interface control module includes a reset module, a Codec initialization module, a sending module and a receiving module. The sending module is used to convert parallel audio data and commands into serial data and send them to the codec. The receiving module is used to collect serial audio data and responses, convert them into parallel data and send them to the main memory.
[0065] The above reset module is usually used for resetting and resetting the HDA link, the Codec initialization module is used for initializing the codec, and the sending module and receiving module are used for playing the collected audio data. The sending module is used to convert the parallel audio data and commands into serial data and send them to the codec, while the receiving module is just the opposite, collecting serial audio data and responses, converting them into parallel data and sending them to the main memory. The above HDA link interface control module usually also includes a frame synchronization signal generation module, which is used to generate a synchronization signal to synchronize each data frame.
[0066] In this embodiment, the outward output logic corresponding to the HDA link interface control module, that is, the driving clock frequency of the logic of the above-mentioned sending module is twice the standard driving clock frequency defined in the HDA specification, and the outward output logic corresponding to the HDA link interface control module, that is, the logic of the sending module is rising edge sampling. According to the definition of "High Definition Audio Specification, V1.0a", the HDA link interface control module needs to implement dual-edge sampling in the outbound (outward output) direction at a clock frequency of 24M. In order to solve the problem of dual-edge sampling in the outbound direction at a clock frequency of 24M as defined in the "High Definition Audio Specification, V1.0a", all outbound logics in this embodiment use a driving clock frequency of 48M, while the inbound logic of rising edge sampling uses a driving clock frequency of 24M. That is, the outward output logic corresponding to the HDA link interface control module, that is, the driving clock frequency of the logic of the sending module is twice the standard driving clock frequency corresponding to the HDA link, and its driving clock frequency is specifically 48M, which adopts rising edge sampling; and the inbound input (inbound) logic that only requires rising edge sampling, that is, the logic of the receiving module specifically adopts a driving clock frequency of 24M, which is equal to the standard driving clock frequency.
[0067] The audio controller for ARM processor platform provided in the present embodiment is provided with an audio controller connected to the codec of HDA to realize the function of playing or collecting audio. The designed audio controller is mounted on the AMBA bus, and the ARM processor can configure and control the codec by sending and receiving commands / responses, and realize functions such as volume adjustment, codec format configuration, and codec power management. The audio data is managed by the stream mode, and the digital signal to be played is managed by the output stream, and is transported by the DMA control module, output to the codec bound by the stream, and converted into an analog signal by the DAC in the codec for playback. The collected analog signal is just the opposite, managed by the input stream, converted into a digital signal by ADC, and then transported to the main memory by DMA, so as to realize the data interaction between the ARM processor and the HDA link. The cross-clock domain processing module is used to coordinate different clock domains to ensure the normal interaction of data.
[0068] The specific contents of the audio controller provided by the present invention will be described in detail in the following embodiments of the invention.
[0069] Embodiment 2
[0070] Please refer to Figure 4 , Figure 4 FIG. 4 is a reset flow chart of the audio controller in an embodiment of the present invention.
[0071] See also Figure 4 In this embodiment, the reset process of the audio controller includes:
[0072] S101: Power-on reset.
[0073] S102: The ARM processor configures the controller reset register via the APB bus to release the audio controller from resetting.
[0074] In this step, after power-on reset, the ARM processor configures the controller reset register (CRST) through the APB bus interface to make the audio controller exit reset, that is, release reset. During the process of audio controller exiting reset, it is usually necessary to keep the value of CRST queried by the ARM processor to be 0.
[0075] S103: Codec initialization.
[0076] When initializing the Codec, each Codec needs to be numbered, and the numbering result needs to be stored in the register module as the address for the ARM processor to communicate with each Codec. The Codec initialization process involves the flipping of the SDI signal polarity of the HDA link interface control module. In this embodiment, GPIO (General-purpose input / output) can be used to implement the flipping of the SDI signal polarity.
[0077] S104: The ARM processor configures the codec format and binds the data stream by sending and receiving commands / responses.
[0078] After the Codec is initialized, the ARM processor can communicate with the Codec through commands and responses, bind the Codec to the data stream, and then play and capture the audio.
[0079] S105: Start the data flow, and the DMA control module starts to transfer the audio data.
[0080] S106: During the data flow startup process, pausing and restarting the data flow according to the instruction.
[0081] S107: The ARM processor configures the CRST register via the APB bus to reset the audio controller.
[0082] Taking audio playback, that is, output data stream, as an example, before starting the output data stream, the ARM processor configures the register through the APB bus interface to set the format of the audio to be played, such as sampling frequency, sampling accuracy and number of channels, etc. The set audio format cannot exceed the maximum load of the output frame, such as 960 bits.
[0083] Embodiment 3
[0084] Please refer to Figure 5 as well as Figure 6 , Figure 5 This is a schematic diagram of a first processing method in which an output data stream exceeds the maximum load of an output frame in an embodiment of the present invention; Figure 6 This is a schematic diagram of processing a second output data stream exceeding the maximum load of an output frame in an embodiment of the present invention.
[0085] Different from the above-mentioned invention embodiment, the present invention embodiment further defines the working process of the audio controller on the basis of the above-mentioned invention embodiment. The rest of the contents have been described in detail in the above-mentioned invention embodiment and will not be repeated here.
[0086] See also Figure 5 When the ARM processor is set incorrectly, causing the length of the output data stream when the DMA control module moves data to exceed the maximum load of the output frame, the first processing flow of this embodiment is as follows Figure 4 As shown, the DMA control module is specifically used for: when the data length of a single output data stream obtained from the AMBA bus exceeds the maximum load of the output frame, discarding the data exceeding the maximum load and carrying the data that does not exceed the maximum load of the output frame. When there is only a single output data stream, the maximum load of the output frame is exceeded, for example, all data exceeding 960 bits are discarded, and only the output data stream that meets the data length requirement is retained for carrying. When the DMA control module carries the output data, the data exceeding the maximum load of the output frame is not carried.
[0087] See also Figure 6 The second processing flow of this embodiment is as follows: Figure 5 As shown, the DMA control module is specifically used for: when the total data length of multiple output data streams obtained from the AMBA bus exceeds the maximum load of the output frame, the data of the output data stream obtained later is discarded, and the data obtained earlier that does not exceed the maximum load of the output frame is carried. When there are multiple output data streams working, and the sum of their data amounts is greater than the maximum load of the output frame, such as 960 bits, the multiple output data streams will be processed as a single output data stream, and only the output data stream that works first will be sent, and the output data stream that works later will not be sent. That is, the data of the output data stream obtained later is discarded, and only the data corresponding to the data stream whose total length does not exceed the maximum load of the output frame is sent. If multiple data streams work at the same time and overflow, it is stipulated that only the data of the output data stream that is output first will be sent.
[0088] For example, at time T0, only output data stream 0 is working, and at time T1, output data streams 0 and 1 are working at the same time but the sum of the data amounts of the two exceeds the maximum load of the output frame 960 bits. In this embodiment, only output data stream 0 is sent, and output data stream 1 is not sent.
[0089] In this embodiment, the ARM processor can start the output data stream by configuring the stream start register (RUN). Before starting to move the audio data located in the main memory, the DMA control module usually needs to obtain the BDLE (Buffer Descriptor List Entries) information in the main memory to obtain the address of the audio data in the main memory.
[0090] The two data stream processing flows provided in this embodiment will be processed in the above manner when starting the data stream to play audio, and after the processing is completed, the error will be reported to the ARM processor.
[0091] Embodiment 4
[0092] Please refer to Figure 7 as well as Figure 8 , Figure 7 This is a schematic diagram of the first data flow interruption processing in an embodiment of the present invention; Figure 8 Schematic diagram of the second data flow interruption processing in an embodiment of the present invention.
[0093] Different from the above-mentioned invention embodiment, the present invention embodiment further defines the working process of the audio controller on the basis of the above-mentioned invention embodiment. The rest of the contents have been described in detail in the above-mentioned invention embodiment and will not be repeated here.
[0094] The DMA control module will retrieve the audio data from the main memory and pass it to the HDA link interface control module for processing after the cross-clock domain processing module sends it to the codec. The HDA link interface control module sends a command before the preset length of a frame, for example, the first 40 bits. If there is no command, it will not send it and the first 40 bits will be empty. After 40 bits, it will start sending audio data until the current frame ends. The HDA protocol stipulates that the time of a frame is 20.833μs, and requires that the output data stream must be continuous within a frame. Otherwise, there will be a problem of interruption, resulting in confusion in the audio format and distortion of the sound. In this regard, this embodiment specifically provides two solutions as follows:
[0095] See also Figure 7, the first one, in this embodiment, the audio controller also includes an on-chip FIFO connected to the DMA control module; the HDA link interface control module is specifically used to: when the data of the on-chip FIFO is interrupted, stop sending data to the codec from the interruption point until the duration of the current frame ends, and discard the data from the interruption point to the end of the current frame; and continue the corresponding audio data playback process from the next frame. The HDA link interface control module usually sends data to the codec Codec when it detects that there is data in the FIFO. When the DMA control module cannot retrieve the data to be sent from the main memory in time at this time, for example, due to bus congestion or insufficient traffic, the data retrieved by the DMA control module includes data that is discontinuous with the previous data, and a flow interruption will occur. In this solution, audio data will no longer be sent to the codec from the interruption point until the duration of the current frame ends. At this time, in order to avoid problems in the subsequent data transmission, it is necessary to discard the data from the interruption point to the end of the current frame, that is, discard the residual data of the current frame that will not be sent in the current frame due to the interruption. At the beginning of the next frame, the HDA link interface control module sends a new frame of data, that is, the corresponding audio data playback process will continue from the next frame. This solution will cause a brief interruption of the audio, but will save software resources.
[0096] See also Figure 8, secondly, in this embodiment, the audio controller also includes at least two on-chip FIFOs connected to the DMA control module, and the DMA control module alternately transfers data required for different frames to the on-chip FIFOs; the HDA link interface control module is specifically used to: when the data in the on-chip FIFO corresponding to the current frame is complete, take out the data corresponding to the current frame from the on-chip FIFO and send it to the codec. That is, in this solution, after the DMA control module carries back a complete frame of data, the audio data is sent to the codec through the HDA link interface control module. This operation requires at least two FIFOs, namely FIFO 1 and FIFO 2. While sending the data of the current frame in FIFO 1, the HDA link interface control module carries the data of the next frame to FIFO 2 through the DMA control module. While sending FIFO 2, the DMA control module retrieves the data of the next frame to FIFO 1, repeats this operation, and implements a ping-pong operation, so that the HDA link interface control module will alternately take out the data corresponding to the current frame from the on-chip FIFO and send it to the codec according to the carrying order of the DMA control module. In this solution, the order in which the DMA control module carries data from the main memory to the FIFO needs to correspond to the order in which the HDA link interface control module sends data in the FIFO. This solution requires more storage resources, but can ensure the integrity of the audio data. When the above-mentioned interruption occurs, since the HDA link interface control module will only send the data in the on-chip FIFO to the codec when the data in the on-chip FIFO is complete, the interruption will only occur between adjacent frames, not within a certain frame. The corresponding playback effect is that the sound will be stuck when the interruption occurs, but it will not cause the loss of sound.
[0097] In the data stream startup process of this embodiment, the output data stream can be paused and restarted by configuring the RUN register. When the data stream is paused, the audio controller usually needs to continue to complete the transmission of the current frame and stop the operation of the stream at the beginning of the next frame. The data stream restart needs to restart from the temporary point.
[0098] Specifically, if there is no need to play or collect audio, the ARM processor can first configure the data stream start register (RUN) to stop the data stream, and then configure CRST to 0 to put the audio controller into a reset state. After the audio controller enters the reset state, all registers of the register module return to their reset states except for the registers related to wake-up. Later, when the codec detects that an interface is inserted, it can send a wake-up request to the audio controller through the SDI signal to set the corresponding state change register. If the wake-up enable bit is 1 at this time, indicating that wake-up can be performed, an interrupt or wake-up event can be generated to notify the ARM processor to write the reset control register (CRST) in the audio controller to exit the reset of the HDA link to support the Codec wake-up function.
[0099] Based on the above settings, the audio controller of this embodiment can support the following features:
[0100] 1. Support sampling frequencies of 44.1 / 48 / 88.2 / 96 / 192 kHz;
[0101] 2. Support 16 / 20 / 24 / 32 bit sampling accuracy;
[0102] 3. The maximum number of channels supported is 16;
[0103] 4. Support multiple Codecs working simultaneously;
[0104] 5. Support Codec wake-up.
[0105] The two data stream interruption processing processes provided in this embodiment can ensure the normal playback of audio data.
[0106] Embodiment 5
[0107] This embodiment also provides an audio transmission system, comprising an AMBA bus, an ARM processor, a main memory, an HDA link, a codec, and the audio controller described in any of the above embodiments; the AMBA bus interface connects the ARM processor and the main memory via the AMBA bus, and the HDA link interface control module connects the codec via the HDA link. The specific contents of the audio controller and its specific connection relationship with the AMBA bus and the HDA link have been described in detail in the above invention embodiments, and will not be repeated here.
[0108] The audio transmission system provided in this embodiment uses the audio controller described in any of the above embodiments, so it can realize data interaction between the ARM processor and the HDA link.
[0109] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0110] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof 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, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0111] The above is a detailed introduction to an audio controller and system for an ARM processor platform provided by the present invention. This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. An audio controller for ARM processor platform, It is characterized in that Including AMBA bus interface, DMA control module, register module, cross-clock domain processing module and HDA link interface control module; The register module is connected to the DMA control module, and both the register module and the DMA control module are connected to the AMBA bus interface, and both the register module and the DMA control module are connected to the cross-clock domain processing module, and the cross-clock domain processing module is connected to the HDA link interface control module; The AMBA bus interface is used to connect the ARM processor and the main memory through the AMBA bus, and the HDA link interface control module is used to connect the codec, process the data when the data flow is interrupted, and continue to play the audio data in the next frame; The DMA channels of the DMA control module are bound to the preset data streams in a one-to-one correspondence. When working, the data streams are bound to the codecs. The authorized DMA channels initiate read and write requests to the main memory through the AMBA bus interface to transfer the audio data corresponding to the data streams. The AMBA bus interface, the DMA control module and the register module operate in a first clock domain corresponding to the AMBA bus, the HDA link interface control module operates in a second clock domain corresponding to the codec, and the cross-clock domain processing module is used to coordinate the first clock domain and the second clock domain.
2. The audio controller according to claim 1, It is characterized in that The AMBA bus interface includes an APB Slave interface and an AXI Master interface, the APB Slave interface is connected to the register module, and the AXI Master interface is connected to the DMA control module; the data length of the burst operation corresponding to the AXI Master interface corresponds to the data frame length of the audio data.
3. The audio controller according to claim 2, It is characterized in that The DMA control module includes a BDL acquisition module, an arbitrator and a plurality of DMA channels; The BDL acquisition module is used to acquire the BDLE located in the main memory; each of the DMA channels is used to carry corresponding commands, responses and multiple input and output data streams; The arbiter is used to determine which component of the acquisition BDL module and each of the DMA channels occupies the AXI bus.
4. The audio controller according to claim 3, It is characterized in that The DMA control module is specifically used for: When the data length of a single output data stream obtained from the AMBA bus exceeds the maximum load of the output frame, the data exceeding the maximum load is discarded, and the data within the maximum load of the output frame is transferred.
5. The audio controller according to claim 3, It is characterized in that The DMA control module is specifically used for: When the total data length of multiple output data streams successively obtained from the AMBA bus exceeds the maximum load of the output frame, the data of the output data streams obtained later are discarded, and the data obtained earlier that does not exceed the maximum load of the output frame are transferred.
6. The audio controller according to claim 1, It is characterized in that The HDA link interface control module includes a reset module, a Codec initialization module, a sending module and a receiving module. The sending module is used to convert parallel audio data and commands into serial data and send them to the codec. The receiving module is used to collect serial audio data and responses, convert them into parallel data and send them to the main memory.
7. The audio controller according to claim 6, It is characterized in that The driving clock frequency of the sending module is twice the standard driving clock frequency defined in the HDA specification, and the sending module is a rising edge sampling.
8. The audio controller according to claim 6, It is characterized in that Also includes an on-chip FIFO connected to the DMA control module; The HDA link interface control module is specifically used for: When data in the on-chip FIFO is disconnected, stop sending data to the codec from the disconnection point until the duration of the current frame ends, and discard the data from the disconnection point to the end of the current frame; The playback process of the corresponding audio data continues from the next frame.
9. The audio controller according to claim 6, It is characterized in that It also includes at least two on-chip FIFOs connected to the DMA control module, and the DMA control module alternately transfers data required for different frames to the on-chip FIFOs; The HDA link interface control module is specifically used for: When the data in the on-chip FIFO corresponding to the current frame is complete, the data corresponding to the current frame is taken out from the on-chip FIFO and sent to the codec.
10. An audio transmission system, It is characterized in that The method comprises an AMBA bus, an ARM processor, a main memory, an HDA link, a codec, and an audio controller as claimed in any one of claims 1 to 9; The AMBA bus interface connects the ARM processor and the main memory via the AMBA bus, and the HDA link interface control module connects the codec.
