Side ch.c
Function reg_read(u32 reg)
reg_read: The function of reg_read is to read a 32-bit value from a specified register address.
parameters: The parameters of this Function. · parameter1: u32 reg - This parameter represents the offset of the register from the base address.
Code Description: The reg_read function is defined as a static inline function, which means it is intended to be used only within the file it is defined in and can be optimized by the compiler for performance. The function takes a single parameter, reg, which is of type u32 (unsigned 32-bit integer). This parameter specifies the offset of the register to be read from a base address, referred to as base_addr.
Inside the function, the ioread32 function is called with the expression (base_addr + reg) as its argument. This expression calculates the actual address of the register by adding the provided offset (reg) to the base address (base_addr). The ioread32 function is responsible for reading a 32-bit value from the specified memory-mapped I/O address. The result of this read operation is then returned by the reg_read function.
This function is typically used in scenarios where direct access to hardware registers is required, such as in device drivers for interacting with hardware components.
Note: It is important to ensure that the base_addr is correctly initialized and points to a valid memory-mapped I/O region before calling this function. Additionally, the reg parameter should be within the valid range of offsets for the specific hardware being accessed to avoid undefined behavior.
Output Example: If the base_addr is set to 0x1000 and reg is 0x04, the function call reg_read(0x04) would read the value from the memory address 0x1004 and return it as a 32-bit unsigned integer. For instance, if the value at that address is 0xDEADBEEF, the function would return 0xDEADBEEF.
graph TD
A[Start reg_read function] --> B[Receive register address]
B --> C[Calculate effective address by adding base address]
C --> D[Read value from calculated address using ioread32]
D --> E[Return read value]
E --> F[End reg_read function]
Function reg_write(u32 reg, u32 value)
reg_write: The function of reg_write is to write a 32-bit value to a specified register address.
parameters: The parameters of this Function. · parameter1: u32 reg - This parameter represents the offset of the register to which the value will be written. It is an unsigned 32-bit integer that specifies the register's address relative to a base address. · parameter2: u32 value - This parameter is the 32-bit value that will be written to the specified register. It is also an unsigned 32-bit integer.
Code Description: The reg_write function is defined as a static inline function, which means it is intended for use only within the file it is defined in and may be optimized by the compiler for performance. The function takes two parameters: 'reg' and 'value'. Inside the function, the iowrite32 function is called, which is responsible for performing the actual write operation. The iowrite32 function takes two arguments: the value to be written and the address of the register. The address is calculated by adding the 'reg' parameter to a predefined base address, 'base_addr'. This allows the function to write the specified value directly to the desired register in memory-mapped I/O space.
Note: It is important to ensure that the base address is correctly initialized before calling this function. Additionally, the function assumes that the register being accessed is valid and that the operation does not violate any hardware constraints. Proper synchronization mechanisms should be employed if this function is called in a multi-threaded environment to prevent race conditions.
graph TD
A[Start reg_write function] --> B[Calculate address by adding reg to base_addr]
B --> C[Write value to calculated address using iowrite32]
C --> D[End reg_write function]
Function SIDE_CH_REG_MULTI_RST_write(u32 Data)
SIDE_CH_REG_MULTI_RST_write: The function of SIDE_CH_REG_MULTI_RST_write is to write a specified value to the SIDE_CH_REG_MULTI_RST register.
parameters: The parameters of this Function. · Data: A 32-bit unsigned integer (u32) that represents the value to be written to the register.
Code Description: The SIDE_CH_REG_MULTI_RST_write function is defined as a static inline function, which means it is intended to be used only within the file it is defined in and can be optimized by the compiler for performance. The function takes a single parameter, Data, which is a 32-bit unsigned integer. Inside the function, the reg_write function is called with two arguments: the address of the SIDE_CH_REG_MULTI_RST register (SIDE_CH_REG_MULTI_RST_ADDR) and the value of Data. This operation effectively writes the value of Data to the specified register address, allowing for the configuration or resetting of the corresponding hardware component.
The use of the static inline specifier suggests that this function is likely to be called frequently, and inlining it can reduce the overhead of function calls, leading to more efficient code execution. The reg_write function is assumed to be a utility function responsible for performing the actual write operation to the hardware register.
Note: It is important to ensure that the value passed to the Data parameter is valid and appropriate for the specific hardware context to avoid unintended behavior. Additionally, this function should be used in accordance with the hardware specifications and initialization sequences to ensure proper operation of the device.
graph TD
A[Start] --> B[Receive Data]
B --> C[Call reg_write function]
C --> D[Write Data to SIDE_CH_REG_MULTI_RST_ADDR]
D --> E[End]
Function SIDE_CH_REG_CONFIG_read(void)
SIDE_CH_REG_CONFIG_read: The function of SIDE_CH_REG_CONFIG_read is to read the value from the SIDE_CH_REG_CONFIG register.
parameters: The parameters of this Function. · There are no parameters for this function.
Code Description: The SIDE_CH_REG_CONFIG_read function is defined as a static inline function, which means it is intended for use only within the file it is declared in and may be optimized by the compiler for performance. The function returns a value of type u32, which is typically a 32-bit unsigned integer. Inside the function, it calls the reg_read function, passing in the address of the SIDE_CH_REG_CONFIG register, denoted by SIDE_CH_REG_CONFIG_ADDR. The reg_read function is responsible for accessing the hardware register at the specified address and retrieving its current value. This value is then returned by the SIDE_CH_REG_CONFIG_read function, allowing the caller to obtain the current configuration settings stored in the SIDE_CH_REG_CONFIG register.
Note: It is important to ensure that the SIDE_CH_REG_CONFIG_ADDR is correctly defined and points to a valid register address in the hardware. Additionally, since this function is static inline, it may be inlined by the compiler, which can lead to performance improvements in scenarios where this function is called frequently.
Output Example: A possible return value of this function could be a 32-bit unsigned integer, such as 0x00000001, which represents the current configuration state of the SIDE_CH_REG_CONFIG register.
graph TD
A[Start SIDE_CH_REG_CONFIG_read function] --> B[Call reg_read function]
B --> C[Read value from SIDE_CH_REG_CONFIG_ADDR]
C --> D[Return value from reg_read]
D --> E[End SIDE_CH_REG_CONFIG_read function]
Function SIDE_CH_REG_CONFIG_write(u32 value)
SIDE_CH_REG_CONFIG_write: The function of SIDE_CH_REG_CONFIG_write is to write a specified value to the SIDE_CH_REG_CONFIG register.
parameters: The parameters of this Function. · value: This is a 32-bit unsigned integer (u32) that represents the value to be written to the register.
Code Description: The SIDE_CH_REG_CONFIG_write function is defined as a static inline function, which means it is intended for use only within the file where it is defined and may be optimized by the compiler for inline expansion. The function takes a single parameter, 'value', which is of type u32. Inside the function, the reg_write function is called with two arguments: SIDE_CH_REG_CONFIG_ADDR and value.
SIDE_CH_REG_CONFIG_ADDR is a constant that represents the memory address of the SIDE_CH_REG_CONFIG register. The reg_write function is responsible for writing the provided value to the specified address. This operation is typically used in hardware programming to configure settings or control registers of a device.
The use of inline functions can improve performance by reducing function call overhead, especially in cases where the function is called frequently. However, since it is static, this function cannot be accessed from other files, ensuring that it is only used in the context of the driver where it is defined.
Note: It is important to ensure that the value being written is appropriate for the register being configured, as writing incorrect values may lead to undefined behavior or malfunction of the hardware. Additionally, this function should be used in a context where the hardware is properly initialized and ready to accept configuration changes.
graph TD
A[Start] --> B[Call SIDE_CH_REG_CONFIG_write function]
B --> C[Receive input value]
C --> D[Execute reg_write function]
D --> E[Write value to SIDE_CH_REG_CONFIG_ADDR]
E --> F[End]
Function SIDE_CH_REG_NUM_DMA_SYMBOL_read(void)
SIDE_CH_REG_NUM_DMA_SYMBOL_read: The function of SIDE_CH_REG_NUM_DMA_SYMBOL_read is to read the value from the DMA symbol register.
parameters: The parameters of this Function. · There are no parameters for this function.
Code Description: The SIDE_CH_REG_NUM_DMA_SYMBOL_read function is defined as a static inline function that returns a 32-bit unsigned integer (u32). The function performs a read operation from a specific hardware register, identified by the constant SIDE_CH_REG_NUM_DMA_SYMBOL_ADDR. This is accomplished by calling the reg_read function, which is responsible for accessing the hardware register at the specified address. The use of the static inline keyword indicates that this function is intended for use only within the file it is defined in, and the compiler may choose to inline the function to optimize performance by eliminating the function call overhead.
Note: It is important to ensure that the SIDE_CH_REG_NUM_DMA_SYMBOL_ADDR is correctly defined and points to a valid memory-mapped register before calling this function. Additionally, this function should be used in a context where the hardware is properly initialized and ready for register access.
Output Example: A possible return value of this function could be a 32-bit integer such as 0x00000001, indicating a specific state or configuration of the DMA symbol register.
graph TD
A[Start] --> B[Call SIDE_CH_REG_NUM_DMA_SYMBOL_read]
B --> C[Execute reg_read function]
C --> D[Read value from SIDE_CH_REG_NUM_DMA_SYMBOL_ADDR]
D --> E[Return value from reg_read]
E --> F[Return value from SIDE_CH_REG_NUM_DMA_SYMBOL_read]
F --> G[End]
Function SIDE_CH_REG_NUM_DMA_SYMBOL_write(u32 value)
SIDE_CH_REG_NUM_DMA_SYMBOL_write: The function of SIDE_CH_REG_NUM_DMA_SYMBOL_write is to write a specified value to the DMA symbol register address.
parameters: The parameters of this Function. · value: This is a 32-bit unsigned integer (u32) that represents the value to be written to the DMA symbol register.
Code Description: The SIDE_CH_REG_NUM_DMA_SYMBOL_write function is defined as a static inline function, which means it is intended to be used only within the file it is defined in and may be optimized by the compiler for performance. The function takes a single parameter, 'value', which is of type u32. Inside the function, the reg_write function is called with two arguments: SIDE_CH_REG_NUM_DMA_SYMBOL_ADDR and value.
SIDE_CH_REG_NUM_DMA_SYMBOL_ADDR is a predefined constant that specifies the memory-mapped address of the DMA symbol register. The reg_write function is responsible for performing the actual write operation to this address, effectively updating the register with the provided value. This function is typically used in scenarios where the DMA (Direct Memory Access) controller needs to be configured or updated with new settings or parameters.
Note: It is important to ensure that the value being written is valid and appropriate for the specific register being accessed. Improper values may lead to undefined behavior or system instability. Additionally, since this function is static inline, it is recommended to include it in performance-critical sections of code where frequent access to the DMA symbol register is required.
graph TD
A[Start] --> B[Call SIDE_CH_REG_NUM_DMA_SYMBOL_write with value]
B --> C[Execute reg_write function]
C --> D[Write value to SIDE_CH_REG_NUM_DMA_SYMBOL_ADDR]
D --> E[End]
Function SIDE_CH_REG_IQ_CAPTURE_read(void)
SIDE_CH_REG_IQ_CAPTURE_read: The function of SIDE_CH_REG_IQ_CAPTURE_read is to read the value from the IQ capture register.
parameters: The parameters of this Function. · There are no parameters for this function.
Code Description: The function SIDE_CH_REG_IQ_CAPTURE_read is defined as a static inline function that returns a 32-bit unsigned integer (u32). It performs a read operation from a specific hardware register identified by the constant SIDE_CH_REG_IQ_CAPTURE_ADDR. The function utilizes the reg_read function, which is presumably defined elsewhere in the codebase, to access the register's value. The use of the static inline specifier indicates that this function is intended for optimization, allowing the compiler to replace calls to this function with the actual code, thereby reducing function call overhead. This function does not take any parameters and directly returns the value read from the register.
Note: It is important to ensure that the SIDE_CH_REG_IQ_CAPTURE_ADDR is correctly defined and points to a valid memory-mapped register before calling this function. Additionally, care should be taken to handle the return value appropriately, as it represents the state of the hardware register at the time of the read operation.
Output Example: A possible return value of the function could be 0x00000001, indicating that the register has a specific state or configuration set.
graph TD
A[Start] --> B[Call SIDE_CH_REG_IQ_CAPTURE_read]
B --> C[Execute reg_read function]
C --> D[Read value from SIDE_CH_REG_IQ_CAPTURE_ADDR]
D --> E[Return value from reg_read]
E --> F[Return value from SIDE_CH_REG_IQ_CAPTURE_read]
F --> G[End]
Function SIDE_CH_REG_IQ_CAPTURE_write(u32 value)
SIDE_CH_REG_IQ_CAPTURE_write: The function of SIDE_CH_REG_IQ_CAPTURE_write is to write a specified value to the IQ capture register of the side channel.
parameters: The parameters of this Function. · value: This is a 32-bit unsigned integer (u32) that represents the data to be written to the IQ capture register.
Code Description: The function SIDE_CH_REG_IQ_CAPTURE_write is defined as a static inline function, which means it is intended to be used only within the file it is declared in and may be optimized by the compiler for performance. The function takes a single parameter, value
, which is of type u32. Inside the function, the reg_write
function is called with two arguments: SIDE_CH_REG_IQ_CAPTURE_ADDR
and value
. The first argument, SIDE_CH_REG_IQ_CAPTURE_ADDR
, is a constant that represents the memory address of the IQ capture register for the side channel. The second argument, value
, is the data that needs to be written to that register. The reg_write
function is responsible for performing the actual write operation to the specified address with the provided value.
Note: It is important to ensure that the value being written is valid and appropriate for the IQ capture register to avoid unintended behavior. Additionally, since this function is static inline, it may not be visible outside of its defining source file, which can help in reducing linkage issues and improving performance.
graph TD
A[Start] --> B[Call SIDE_CH_REG_IQ_CAPTURE_write with value]
B --> C[Execute reg_write function]
C --> D[Write value to SIDE_CH_REG_IQ_CAPTURE_ADDR]
D --> E[End]
Function SIDE_CH_REG_NUM_EQ_read(void)
SIDE_CH_REG_NUM_EQ_read: The function of SIDE_CH_REG_NUM_EQ_read is to read the value from the SIDE_CH_REG_NUM_EQ register.
parameters: The parameters of this Function. · There are no parameters for this function.
Code Description: The SIDE_CH_REG_NUM_EQ_read function is defined as a static inline function that returns a 32-bit unsigned integer (u32). The function does not take any parameters and is designed to read a specific hardware register identified by the constant SIDE_CH_REG_NUM_EQ_ADDR. The function utilizes the reg_read function, which is presumably defined elsewhere in the codebase, to perform the actual read operation from the specified register address. The use of the inline keyword suggests that this function is intended to be optimized by the compiler, potentially reducing function call overhead in performance-critical sections of code.
The function's primary purpose is to provide a straightforward interface for obtaining the current value stored in the SIDE_CH_REG_NUM_EQ register, which may represent a specific configuration or status related to the side channel hardware.
Note: It is important to ensure that the SIDE_CH_REG_NUM_EQ_ADDR is correctly defined and points to a valid register address in the hardware. Improper access to hardware registers can lead to undefined behavior or system instability.
Output Example: A possible return value of the function could be a 32-bit unsigned integer such as 0x0000001A, which represents the current value of the SIDE_CH_REG_NUM_EQ register at the time of the read operation.
graph TD
A[Start] --> B[Call SIDE_CH_REG_NUM_EQ_read]
B --> C[Execute reg_read function]
C --> D[Read value from SIDE_CH_REG_NUM_EQ_ADDR]
D --> E[Return value from reg_read]
E --> F[Return value from SIDE_CH_REG_NUM_EQ_read]
F --> G[End]
Function SIDE_CH_REG_NUM_EQ_write(u32 value)
SIDE_CH_REG_NUM_EQ_write: The function of SIDE_CH_REG_NUM_EQ_write is to write a specified value to the SIDE_CH_REG_NUM_EQ register.
parameters: The parameters of this Function. · value: A 32-bit unsigned integer (u32) that represents the value to be written to the register.
Code Description: The SIDE_CH_REG_NUM_EQ_write function is defined as a static inline function, which means it is intended for use only within the file it is defined in and may be optimized by the compiler for performance. The function takes a single parameter, 'value', which is of type u32. This parameter is the data that will be written to the register.
Inside the function, the reg_write function is called with two arguments: SIDE_CH_REG_NUM_EQ_ADDR and value. Here, SIDE_CH_REG_NUM_EQ_ADDR is a predefined constant that represents the memory address of the SIDE_CH_REG_NUM_EQ register. The reg_write function is responsible for performing the actual write operation to the specified address with the provided value. This operation is crucial for configuring or updating the state of the hardware associated with the SIDE_CH_REG_NUM_EQ register.
Note: It is important to ensure that the value being written is valid and appropriate for the specific hardware context, as writing incorrect values may lead to undefined behavior or hardware malfunctions. Additionally, since this function is static inline, it should be used in contexts where performance is critical, as it allows for inlining and potentially reduces function call overhead.
graph TD
A[Start] --> B[Call SIDE_CH_REG_NUM_EQ_write]
B --> C[Receive value as input]
C --> D[Execute reg_write function]
D --> E[Write value to SIDE_CH_REG_NUM_EQ_ADDR]
E --> F[End]
Function SIDE_CH_REG_FC_TARGET_read(void)
SIDE_CH_REG_FC_TARGET_read: The function of SIDE_CH_REG_FC_TARGET_read is to read the value from the SIDE_CH_REG_FC_TARGET hardware register.
parameters: The parameters of this Function. · There are no parameters for this function.
Code Description: The SIDE_CH_REG_FC_TARGET_read function is defined as a static inline function that returns a 32-bit unsigned integer (u32). The function performs a read operation from a specific hardware register identified by the address SIDE_CH_REG_FC_TARGET_ADDR. This is accomplished by calling the reg_read function, which is responsible for accessing the hardware register at the specified address. The use of the static inline specifier indicates that this function is intended to be used only within the file it is defined in, and the inline keyword suggests that the compiler may replace calls to this function with the function's body to optimize performance.
Note: It is important to ensure that the SIDE_CH_REG_FC_TARGET_ADDR is correctly defined and points to a valid hardware register before calling this function. Additionally, this function should be used in contexts where reading the register value is necessary, such as in device driver implementations or hardware interaction routines.
Output Example: A possible return value of this function could be a 32-bit integer, such as 0x00000001, which represents the current state or configuration of the SIDE_CH_REG_FC_TARGET register.
graph TD
A[Start] --> B[Call SIDE_CH_REG_FC_TARGET_read]
B --> C[Execute reg_read function]
C --> D[Read value from SIDE_CH_REG_FC_TARGET_ADDR]
D --> E[Return value from reg_read]
E --> F[Return value from SIDE_CH_REG_FC_TARGET_read]
F --> G[End]
Function SIDE_CH_REG_FC_TARGET_write(u32 value)
SIDE_CH_REG_FC_TARGET_write: The function of SIDE_CH_REG_FC_TARGET_write is to write a specified value to the SIDE_CH_REG_FC_TARGET register.
parameters: The parameters of this Function. · value: A 32-bit unsigned integer (u32) that represents the value to be written to the register.
Code Description: The SIDE_CH_REG_FC_TARGET_write function is defined as a static inline function, which means it is intended to be used only within the file it is defined in and may be optimized by the compiler for performance. The function takes a single parameter, 'value', which is of type u32. Inside the function, the reg_write function is called with two arguments: the address of the SIDE_CH_REG_FC_TARGET register (denoted by SIDE_CH_REG_FC_TARGET_ADDR) and the value to be written. The reg_write function is responsible for performing the actual write operation to the specified register address. This function is typically used in scenarios where the configuration or control of hardware components associated with the SIDE_CH (side channel) is required.
Note: It is important to ensure that the value being written is appropriate for the specific register and does not violate any hardware constraints. Additionally, this function should be used in contexts where register access is permitted and safe, as improper usage may lead to undefined behavior or hardware malfunctions.
graph TD
A[Start] --> B[Call SIDE_CH_REG_FC_TARGET_write with value]
B --> C[Execute reg_write function]
C --> D[Write value to SIDE_CH_REG_FC_TARGET_ADDR]
D --> E[End]
Function SIDE_CH_REG_ADDR1_TARGET_read(void)
SIDE_CH_REG_ADDR1_TARGET_read: The function of SIDE_CH_REG_ADDR1_TARGET_read is to read the value from the register located at the address defined by SIDE_CH_REG_ADDR1_TARGET_ADDR.
parameters: The parameters of this Function. · There are no parameters for this function.
Code Description: The SIDE_CH_REG_ADDR1_TARGET_read function is defined as a static inline function that returns a 32-bit unsigned integer (u32). The function performs a read operation from a specific hardware register identified by the constant SIDE_CH_REG_ADDR1_TARGET_ADDR. This is achieved by calling the reg_read function, which is responsible for accessing the hardware register and retrieving its current value. The use of the static inline keyword suggests that this function is intended to be optimized by the compiler and is only used within the file where it is defined, promoting efficiency in the code execution.
Note: It is important to ensure that the SIDE_CH_REG_ADDR1_TARGET_ADDR is correctly defined and points to a valid register address before calling this function. Improper usage may lead to undefined behavior or incorrect data retrieval.
Output Example: A possible return value of this function could be a 32-bit integer such as 0x00000001, indicating that the register at the specified address currently holds the value 1.
graph TD
A[Start] --> B[Call SIDE_CH_REG_ADDR1_TARGET_read]
B --> C[Execute reg_read function]
C --> D[Read value from SIDE_CH_REG_ADDR1_TARGET_ADDR]
D --> E[Return value from reg_read]
E --> F[Return value from SIDE_CH_REG_ADDR1_TARGET_read]
F --> G[End]
Function SIDE_CH_REG_ADDR1_TARGET_write(u32 value)
SIDE_CH_REG_ADDR1_TARGET_write: The function of SIDE_CH_REG_ADDR1_TARGET_write is to write a specified value to the SIDE_CH_REG_ADDR1_TARGET register.
parameters: The parameters of this Function. · value: A 32-bit unsigned integer (u32) that represents the data to be written to the register.
Code Description: The SIDE_CH_REG_ADDR1_TARGET_write function is defined as a static inline function, which means it is intended for use only within the file it is defined in and may be optimized by the compiler for performance. The function takes a single parameter, 'value', which is a 32-bit unsigned integer. Within the function, the reg_write function is called, passing two arguments: the address of the SIDE_CH_REG_ADDR1_TARGET register (denoted by SIDE_CH_REG_ADDR1_TARGET_ADDR) and the 'value' parameter. This operation effectively writes the provided value to the specified register address in the hardware, allowing for configuration or control of the associated hardware component.
Note: It is important to ensure that the value being written is appropriate for the specific register being targeted, as writing incorrect values may lead to undefined behavior or hardware malfunctions. Additionally, since this function is static inline, it should be used in contexts where performance is critical, and its usage should be limited to the file scope to avoid naming conflicts.
graph TD
A[Start] --> B[Call SIDE_CH_REG_ADDR1_TARGET_write with value]
B --> C[Execute reg_write function]
C --> D[Write value to SIDE_CH_REG_ADDR1_TARGET_ADDR]
D --> E[End]
Function SIDE_CH_REG_ADDR2_TARGET_read(void)
SIDE_CH_REG_ADDR2_TARGET_read: The function of SIDE_CH_REG_ADDR2_TARGET_read is to read the value from a specific hardware register identified by SIDE_CH_REG_ADDR2_TARGET_ADDR.
parameters: The parameters of this Function. · There are no parameters for this function.
Code Description: The function SIDE_CH_REG_ADDR2_TARGET_read is defined as a static inline function that returns a 32-bit unsigned integer (u32). It utilizes the reg_read function to access the value stored at the hardware register address specified by SIDE_CH_REG_ADDR2_TARGET_ADDR. The use of the static inline qualifier indicates that this function is intended for use only within the file it is defined in, and it may be optimized by the compiler to reduce function call overhead. The reg_read function is assumed to be a predefined function that handles the specifics of reading from the hardware register.
Note: It is important to ensure that the SIDE_CH_REG_ADDR2_TARGET_ADDR is correctly defined and accessible within the context of this function. Additionally, the function should be used in a context where reading from the hardware register is appropriate, as improper use may lead to undefined behavior or incorrect data retrieval.
Output Example: A possible return value of this function could be a 32-bit integer such as 0x00000001, indicating the current state or configuration of the hardware register at the specified address.
graph TD
A[Start] --> B[Call SIDE_CH_REG_ADDR2_TARGET_read]
B --> C[Execute reg_read function]
C --> D[Read value from SIDE_CH_REG_ADDR2_TARGET_ADDR]
D --> E[Return value from reg_read]
E --> F[Return value from SIDE_CH_REG_ADDR2_TARGET_read]
F --> G[End]
Function SIDE_CH_REG_ADDR2_TARGET_write(u32 value)
SIDE_CH_REG_ADDR2_TARGET_write: The function of SIDE_CH_REG_ADDR2_TARGET_write is to write a specified value to the SIDE_CH_REG_ADDR2_TARGET register.
parameters: The parameters of this Function. · value: This is a 32-bit unsigned integer (u32) that represents the data to be written to the register.
Code Description: The SIDE_CH_REG_ADDR2_TARGET_write function is defined as a static inline function, which means it is intended for use only within the file it is defined in and may be optimized by the compiler for performance. The function takes a single parameter, 'value', which is of type u32. This parameter is the value that will be written to the register located at the address defined by SIDE_CH_REG_ADDR2_TARGET_ADDR.
Inside the function, the reg_write function is called with two arguments: SIDE_CH_REG_ADDR2_TARGET_ADDR and value. The reg_write function is responsible for performing the actual write operation to the specified hardware register. The first argument, SIDE_CH_REG_ADDR2_TARGET_ADDR, is a predefined constant that indicates the memory address of the SIDE_CH_REG_ADDR2_TARGET register. The second argument, 'value', is the data that will be stored in that register.
This function is typically used in scenarios where a specific configuration or state needs to be set in the SIDE_CH_REG_ADDR2_TARGET register, which is likely part of a hardware interface or peripheral control.
Note: It is important to ensure that the value being written is appropriate for the register and does not exceed its defined limits. Improper usage may lead to undefined behavior or hardware malfunctions. Additionally, since this function is static inline, it should be included in the compilation unit where it is needed to ensure proper linkage and optimization.
graph TD
A[Start] --> B[Call SIDE_CH_REG_ADDR2_TARGET_write with value]
B --> C[Execute reg_write function]
C --> D[Write value to SIDE_CH_REG_ADDR2_TARGET_ADDR]
D --> E[End]
Function SIDE_CH_REG_IQ_TRIGGER_read(void)
SIDE_CH_REG_IQ_TRIGGER_read: The function of SIDE_CH_REG_IQ_TRIGGER_read is to read the value from the IQ trigger register.
parameters: The parameters of this Function. · There are no parameters for this function.
Code Description: The SIDE_CH_REG_IQ_TRIGGER_read function is defined as a static inline function, which means it is intended for use only within the file it is defined in and can be optimized by the compiler for inline expansion. The function returns a value of type u32, which is typically a 32-bit unsigned integer. Within the function, the reg_read function is called with the argument SIDE_CH_REG_IQ_TRIGGER_ADDR. This indicates that the function is designed to access a specific hardware register, identified by the address SIDE_CH_REG_IQ_TRIGGER_ADDR, and retrieve its current value. The reg_read function is responsible for performing the actual read operation from the specified memory-mapped register.
Note: It is important to ensure that the SIDE_CH_REG_IQ_TRIGGER_ADDR is correctly defined and points to a valid register address in the hardware. Improper usage may lead to undefined behavior or incorrect data being read.
Output Example: A possible return value of the function could be a 32-bit unsigned integer, such as 0x00000001, which represents the current state or configuration of the IQ trigger register.
graph TD
A[Start] --> B[Call SIDE_CH_REG_IQ_TRIGGER_read]
B --> C[Execute reg_read function]
C --> D[Read value from SIDE_CH_REG_IQ_TRIGGER_ADDR]
D --> E[Return value]
E --> F[End]
Function SIDE_CH_REG_IQ_TRIGGER_write(u32 value)
SIDE_CH_REG_IQ_TRIGGER_write: The function of SIDE_CH_REG_IQ_TRIGGER_write is to write a specified value to the IQ trigger register of the side channel.
parameters: The parameters of this Function. · value: A 32-bit unsigned integer (u32) that represents the value to be written to the IQ trigger register.
Code Description: The SIDE_CH_REG_IQ_TRIGGER_write function is defined as a static inline function, which means it is intended to be used only within the file it is defined in and may be optimized by the compiler for performance. The function takes a single parameter, 'value', which is of type u32. This parameter is the data that will be written to the register.
Inside the function, the reg_write function is called with two arguments: SIDE_CH_REG_IQ_TRIGGER_ADDR and value. Here, SIDE_CH_REG_IQ_TRIGGER_ADDR is a predefined constant that represents the memory address of the IQ trigger register. The reg_write function is responsible for performing the actual write operation to the specified address with the provided value. This operation typically involves interacting with hardware registers, which are used to control various aspects of the side channel's functionality.
The use of the static inline qualifier suggests that this function is optimized for speed and is likely to be called frequently in the context of the driver. By inlining the function, the overhead of a function call is eliminated, which can lead to improved performance in critical sections of the code.
Note: It is important to ensure that the value being written is valid and within the acceptable range for the IQ trigger register. Improper values may lead to undefined behavior or malfunction of the side channel. Additionally, this function should be used in accordance with the overall driver architecture and timing requirements to avoid conflicts with other operations that may be accessing the same register.
graph TD
A[Start] --> B[Call SIDE_CH_REG_IQ_TRIGGER_write with value]
B --> C[Execute reg_write function]
C --> D[Write value to SIDE_CH_REG_IQ_TRIGGER_ADDR]
D --> E[End]
Function SIDE_CH_REG_RSSI_TH_read(void)
SIDE_CH_REG_RSSI_TH_read: The function of SIDE_CH_REG_RSSI_TH_read is to read the value from the SIDE_CH_REG_RSSI_TH register.
parameters: The parameters of this Function. · There are no parameters for this function.
Code Description: The SIDE_CH_REG_RSSI_TH_read function is defined as a static inline function that returns a 32-bit unsigned integer (u32). The function does not take any parameters. It performs a read operation from a specific hardware register identified by the constant SIDE_CH_REG_RSSI_TH_ADDR. The function utilizes the reg_read function to access the value stored at this register address. The use of the static inline specifier suggests that this function is intended for performance optimization, allowing the compiler to replace calls to this function with the actual code, thereby reducing function call overhead.
Note: It is important to ensure that the SIDE_CH_REG_RSSI_TH_ADDR is correctly defined and points to a valid register address in the hardware. Additionally, the reg_read function must be properly implemented to handle the register access, as incorrect usage may lead to undefined behavior or incorrect data retrieval.
Output Example: A possible return value of this function could be a 32-bit unsigned integer, such as 0x0000001A, which represents the value read from the SIDE_CH_REG_RSSI_TH register.
graph TD
A[Start] --> B[Call SIDE_CH_REG_RSSI_TH_read]
B --> C[Execute reg_read function]
C --> D[Read value from SIDE_CH_REG_RSSI_TH_ADDR]
D --> E[Return value from reg_read]
E --> F[Return value from SIDE_CH_REG_RSSI_TH_read]
F --> G[End]
Function SIDE_CH_REG_RSSI_TH_write(u32 value)
SIDE_CH_REG_RSSI_TH_write: The function of SIDE_CH_REG_RSSI_TH_write is to write a specified value to the RSSI threshold register of the side channel.
parameters: The parameters of this Function. · value: A 32-bit unsigned integer that represents the value to be written to the RSSI threshold register.
Code Description: The SIDE_CH_REG_RSSI_TH_write function is defined as a static inline function, which means it is intended for use only within the file it is defined in and may be optimized by the compiler for performance. The function takes a single parameter, 'value', which is of type u32 (unsigned 32-bit integer). Inside the function, the reg_write function is called with two arguments: SIDE_CH_REG_RSSI_TH_ADDR and value.
SIDE_CH_REG_RSSI_TH_ADDR is a predefined constant that represents the memory address of the RSSI threshold register for the side channel. The reg_write function is responsible for writing the provided value to the specified address. This operation is typically used in low-level hardware programming, where direct manipulation of hardware registers is necessary to configure or control device behavior.
Note: It is important to ensure that the value being written is within the acceptable range for the RSSI threshold register to avoid unintended behavior. Additionally, this function should only be called when the system is in a state that allows for register modifications, as writing to hardware registers can affect the operation of the device.
graph TD
A[Start] --> B[Call SIDE_CH_REG_RSSI_TH_write with value]
B --> C[Execute reg_write function]
C --> D[Write value to SIDE_CH_REG_RSSI_TH_ADDR]
D --> E[End]
Function SIDE_CH_REG_GAIN_TH_read(void)
SIDE_CH_REG_GAIN_TH_read: The function of SIDE_CH_REG_GAIN_TH_read is to read the value from the SIDE_CH_REG_GAIN_TH register.
parameters: The parameters of this Function. · There are no parameters for this function.
Code Description: The SIDE_CH_REG_GAIN_TH_read function is defined as a static inline function that returns a 32-bit unsigned integer (u32). This function performs a read operation from a specific hardware register identified by the constant SIDE_CH_REG_GAIN_TH_ADDR. The function utilizes the reg_read function, which is presumably defined elsewhere in the codebase, to access the value stored at the address specified by SIDE_CH_REG_GAIN_TH_ADDR. The use of the static inline keyword suggests that this function is intended for performance optimization, allowing the compiler to replace calls to this function with the actual code, thereby reducing function call overhead.
The function does not take any parameters, and it directly returns the result of the reg_read function call. The returned value represents the current state or configuration of the SIDE_CH_REG_GAIN_TH register, which is likely related to gain threshold settings in a side channel processing context.
Note: It is important to ensure that the SIDE_CH_REG_GAIN_TH_ADDR is correctly defined and points to a valid register address before invoking this function. Additionally, the reg_read function must be implemented correctly to handle the hardware-specific details of reading from the register.
Output Example: A possible return value of the function could be a 32-bit integer such as 0x0000001A, which represents the gain threshold value read from the register.
graph TD
A[Start] --> B[Call SIDE_CH_REG_GAIN_TH_read]
B --> C[Execute reg_read function]
C --> D[Read value from SIDE_CH_REG_GAIN_TH_ADDR]
D --> E[Return value]
E --> F[End]
Function SIDE_CH_REG_GAIN_TH_write(u32 value)
SIDE_CH_REG_GAIN_TH_write: The function of SIDE_CH_REG_GAIN_TH_write is to write a specified value to the gain threshold register of the side channel.
parameters: The parameters of this Function. · value: This is a 32-bit unsigned integer (u32) that represents the value to be written to the gain threshold register.
Code Description: The SIDE_CH_REG_GAIN_TH_write function is defined as a static inline function, which means it is intended to be used only within the file where it is defined and can be optimized by the compiler for performance. The function takes a single parameter, 'value', which is of type u32. Inside the function, the reg_write function is called with two arguments: the address of the gain threshold register (SIDE_CH_REG_GAIN_TH_ADDR) and the value to be written. The reg_write function is responsible for performing the actual write operation to the specified hardware register. This function is crucial for configuring the gain threshold in the side channel, allowing for adjustments to be made based on the application's requirements.
Note: When using this function, ensure that the value being written is within the acceptable range for the gain threshold register to avoid unintended behavior. Additionally, since this function is static inline, it should be used in a context where performance is critical, as it may be inlined by the compiler to reduce function call overhead.
graph TD
A[Start] --> B[Call SIDE_CH_REG_GAIN_TH_write]
B --> C[Receive value parameter]
C --> D[Execute reg_write function]
D --> E[Write value to SIDE_CH_REG_GAIN_TH_ADDR]
E --> F[End]
Function SIDE_CH_REG_PRE_TRIGGER_LEN_read(void)
SIDE_CH_REG_PRE_TRIGGER_LEN_read: The function of SIDE_CH_REG_PRE_TRIGGER_LEN_read is to read the value from the pre-trigger length register of the side channel.
parameters: The parameters of this Function. · There are no parameters for this function.
Code Description: The function SIDE_CH_REG_PRE_TRIGGER_LEN_read is defined as a static inline function that returns a 32-bit unsigned integer (u32). It performs a read operation from a specific hardware register identified by the address SIDE_CH_REG_PRE_TRIGGER_LEN_ADDR. The function utilizes the reg_read function, which is presumably defined elsewhere in the codebase, to access the value stored at the specified register address. This function is designed to be efficient, as indicated by its inline definition, allowing the compiler to optimize the function call during compilation. The primary purpose of this function is to retrieve the current value of the pre-trigger length, which is likely used in the context of configuring or monitoring the behavior of a side channel in a hardware system.
Note: It is important to ensure that the SIDE_CH_REG_PRE_TRIGGER_LEN_ADDR is correctly defined and accessible in the context where this function is used. Additionally, the reg_read function must be implemented correctly to handle the hardware interactions appropriately.
Output Example: A possible return value of the function could be a 32-bit integer, such as 0x0000000A, which represents the pre-trigger length currently set in the register.
graph TD
A[Start] --> B[Call SIDE_CH_REG_PRE_TRIGGER_LEN_read]
B --> C[Execute reg_read function]
C --> D[Read value from SIDE_CH_REG_PRE_TRIGGER_LEN_ADDR]
D --> E[Return value from reg_read]
E --> F[Return value from SIDE_CH_REG_PRE_TRIGGER_LEN_read]
F --> G[End]
Function SIDE_CH_REG_PRE_TRIGGER_LEN_write(u32 value)
SIDE_CH_REG_PRE_TRIGGER_LEN_write: The function of SIDE_CH_REG_PRE_TRIGGER_LEN_write is to write a specified value to the pre-trigger length register of the side channel.
parameters: The parameters of this Function. · value: This is a 32-bit unsigned integer (u32) that represents the value to be written to the pre-trigger length register.
Code Description: The SIDE_CH_REG_PRE_TRIGGER_LEN_write function is defined as a static inline function, which means it is intended for use only within the file it is defined in and may be optimized by the compiler for performance. The function takes a single parameter, 'value', which is of type u32. Inside the function, the reg_write function is called with two arguments: the address of the pre-trigger length register (SIDE_CH_REG_PRE_TRIGGER_LEN_ADDR) and the value to be written. The reg_write function is responsible for performing the actual write operation to the specified register address, effectively updating the pre-trigger length setting in the hardware.
This function is crucial for configuring the behavior of the side channel by allowing the user to set the pre-trigger length, which can influence how data is captured or processed in the system. The use of a static inline function helps to reduce function call overhead, making it suitable for performance-critical applications.
Note: When using this function, ensure that the value being written is within the acceptable range for the pre-trigger length register to avoid undefined behavior. Additionally, it is important to ensure that the hardware is properly initialized before attempting to write to the register.
graph TD
A[Start] --> B[Call SIDE_CH_REG_PRE_TRIGGER_LEN_write]
B --> C[Receive value parameter]
C --> D[Execute reg_write function]
D --> E[Write value to SIDE_CH_REG_PRE_TRIGGER_LEN_ADDR]
E --> F[End]
Function SIDE_CH_REG_IQ_LEN_read(void)
SIDE_CH_REG_IQ_LEN_read: The function of SIDE_CH_REG_IQ_LEN_read is to read the value from the SIDE_CH_REG_IQ_LEN register.
parameters: The parameters of this Function. · There are no parameters for this function.
Code Description: The SIDE_CH_REG_IQ_LEN_read function is defined as a static inline function that returns a 32-bit unsigned integer (u32). The function performs a read operation from a specific hardware register identified by the constant SIDE_CH_REG_IQ_LEN_ADDR. This is achieved through the call to the reg_read function, which is responsible for accessing the register's value. The use of the static inline keyword suggests that this function is intended to be used within the same compilation unit and may be optimized by the compiler to reduce function call overhead.
The function does not take any parameters, and its return value is directly obtained from the hardware register, which typically contains configuration or status information relevant to the side channel operations.
Note: It is important to ensure that the SIDE_CH_REG_IQ_LEN_ADDR is correctly defined and points to a valid memory-mapped register. Improper access to this register may lead to undefined behavior or system instability.
Output Example: A possible return value of the function could be a 32-bit integer such as 0x0000001A, which represents the current length value stored in the SIDE_CH_REG_IQ_LEN register.
graph TD
A[Start] --> B[Call SIDE_CH_REG_IQ_LEN_read]
B --> C[Execute reg_read function]
C --> D[Read value from SIDE_CH_REG_IQ_LEN_ADDR]
D --> E[Return value from reg_read]
E --> F[Return value from SIDE_CH_REG_IQ_LEN_read]
F --> G[End]
Function SIDE_CH_REG_IQ_LEN_write(u32 value)
SIDE_CH_REG_IQ_LEN_write: The function of SIDE_CH_REG_IQ_LEN_write is to write a specified value to the SIDE_CH_REG_IQ_LEN register.
parameters: The parameters of this Function. · value: A 32-bit unsigned integer (u32) that represents the data to be written to the register.
Code Description: The SIDE_CH_REG_IQ_LEN_write function is defined as a static inline function, which means it is intended for use only within the file it is defined in and may be optimized by the compiler for performance. The function takes a single parameter, 'value', which is a 32-bit unsigned integer. This value is written to a specific hardware register identified by the constant SIDE_CH_REG_IQ_LEN_ADDR. The actual writing operation is performed by the reg_write function, which is assumed to handle the low-level details of writing to the hardware register. This function is typically used in scenarios where the configuration or state of the SIDE_CH_REG_IQ_LEN register needs to be updated with a new value.
Note: It is important to ensure that the value being written is appropriate for the register's expected range and format. Improper values may lead to undefined behavior or hardware malfunctions. Additionally, since this function is static inline, it may not be visible outside of its defining translation unit, which is a consideration for modular programming and code organization.
graph TD
A[Start] --> B[Call SIDE_CH_REG_IQ_LEN_write with value]
B --> C[Execute reg_write with SIDE_CH_REG_IQ_LEN_ADDR and value]
C --> D[End]
Function SIDE_CH_REG_M_AXIS_DATA_COUNT_read(void)
SIDE_CH_REG_M_AXIS_DATA_COUNT_read: The function of SIDE_CH_REG_M_AXIS_DATA_COUNT_read is to read the value from the register that holds the data count for the master axis of the side channel.
parameters: The parameters of this Function. · There are no parameters for this function.
Code Description: The SIDE_CH_REG_M_AXIS_DATA_COUNT_read function is a static inline function that returns a 32-bit unsigned integer (u32). It performs a read operation from a specific hardware register identified by the address SIDE_CH_REG_M_AXIS_DATA_COUNT_ADDR. The function utilizes the reg_read function to access the value stored at this address. This is typically used in embedded systems or hardware interfacing scenarios where direct register manipulation is necessary to obtain the current data count from the master axis of the side channel.
The use of the static inline keyword indicates that this function is intended to be used only within the file it is defined in, and it may be optimized by the compiler to reduce function call overhead. The return value from this function is the data count value retrieved from the specified register, which is crucial for monitoring or controlling the operation of the side channel.
Note: It is important to ensure that the SIDE_CH_REG_M_AXIS_DATA_COUNT_ADDR is correctly defined and points to a valid register address in the hardware. Improper access to hardware registers can lead to undefined behavior or system instability.
Output Example: A possible return value of this function could be 0x0000000A, indicating that the current data count for the master axis is 10 in decimal form.
graph TD
A[Start] --> B[Call SIDE_CH_REG_M_AXIS_DATA_COUNT_read]
B --> C[Execute reg_read function]
C --> D[Read value from SIDE_CH_REG_M_AXIS_DATA_COUNT_ADDR]
D --> E[Return value from reg_read]
E --> F[End]
Function SIDE_CH_REG_M_AXIS_DATA_COUNT_write(u32 value)
SIDE_CH_REG_M_AXIS_DATA_COUNT_write: The function of SIDE_CH_REG_M_AXIS_DATA_COUNT_write is to write a specified value to the M_AXIS_DATA_COUNT register of the side channel.
parameters: The parameters of this Function. · value: This is a 32-bit unsigned integer (u32) that represents the data to be written to the M_AXIS_DATA_COUNT register.
Code Description: The SIDE_CH_REG_M_AXIS_DATA_COUNT_write function is defined as a static inline function, which means it is intended for use only within the file it is defined in and may be optimized by the compiler for performance. The function takes a single parameter, 'value', which is expected to be a 32-bit unsigned integer.
Inside the function, the reg_write function is called with two arguments: the address of the M_AXIS_DATA_COUNT register (denoted by SIDE_CH_REG_M_AXIS_DATA_COUNT_ADDR) and the 'value' parameter. The reg_write function is responsible for performing the actual write operation to the specified register address. This operation is crucial for configuring or updating the state of the M_AXIS_DATA_COUNT register, which is likely used in the context of managing data flow or processing within the side channel.
Note: It is important to ensure that the value being written is appropriate for the M_AXIS_DATA_COUNT register, as writing incorrect values may lead to undefined behavior or malfunction of the system. Additionally, since this function is static inline, it should be used in contexts where performance is critical, as it allows for faster execution by potentially eliminating function call overhead.
activityDiagram
title Activity Diagram for SIDE_CH_REG_M_AXIS_DATA_COUNT_write Function
start
:Receive value;
:Call reg_write function;
:Write value to SIDE_CH_REG_M_AXIS_DATA_COUNT_ADDR;
end
Function chan_to_ps_callback(void *completion)
chan_to_ps_callback: The function of chan_to_ps_callback is to signal the completion of a task or operation.
parameters: The parameters of this Function. · completion: A pointer to a completion structure that indicates the status of the operation.
Code Description: The function chan_to_ps_callback is defined as a static void function, meaning it is limited in scope to the file in which it is declared and does not return a value. The function takes a single parameter, completion, which is a pointer to a completion structure. Inside the function, the complete function is called with the completion parameter. This indicates that the operation associated with the completion structure has been finished, allowing any waiting processes or threads to proceed. The use of the complete function is typically part of a completion mechanism in asynchronous programming, where it is essential to notify other parts of the system that an operation has completed successfully.
Note: It is important to ensure that the completion pointer passed to chan_to_ps_callback is valid and properly initialized before calling this function. Failure to do so may result in undefined behavior or crashes in the application. Additionally, since this function is static, it cannot be accessed from other files, which helps encapsulate its functionality within the current file.
graph TD
A[Start] --> B[Receive completion parameter]
B --> C[Call complete function with completion]
C --> D[End]
Function chan_to_pl_callback(void *completion)
chan_to_pl_callback: The function of chan_to_pl_callback is to signal the completion of a task or operation.
parameters: The parameters of this Function. · completion: A pointer to a completion structure that indicates the status of the operation.
Code Description: The function chan_to_pl_callback
is defined as a static void function, meaning it is limited in scope to the file in which it is declared and does not return a value. The function takes a single parameter, completion
, which is a pointer to a completion structure. Inside the function, the complete
function is called with the completion
pointer as its argument. The complete
function is typically used in asynchronous programming to indicate that a certain operation has been finished, allowing any waiting processes to proceed. This function is crucial in scenarios where tasks are executed in parallel, and it is necessary to notify other components or threads that they can continue their execution based on the completion of this specific task.
Note: It is important to ensure that the completion
pointer passed to this function is valid and properly initialized before calling chan_to_pl_callback
. Improper use of this function may lead to undefined behavior or application crashes. Additionally, since this function is static, it cannot be called from other files, which helps in encapsulating its functionality within the current file.
graph TD
A[Start] --> B[Receive completion pointer]
B --> C[Call complete function with completion pointer]
C --> D[End]
Function dma_loopback_test(int num_test, int num_dma_symbol)
dma_loopback_test: The function of dma_loopback_test is to perform a DMA loopback test, verifying the integrity of data transfer between devices.
parameters: The parameters of this Function. · parameter1: int num_test - The number of test iterations to perform. · parameter2: int num_dma_symbol - The number of DMA symbols to be transferred in each test.
Code Description: The dma_loopback_test function initiates a series of DMA (Direct Memory Access) operations to test the data transfer capabilities between two devices. It begins by defining necessary variables and structures for DMA operations, including buffers for source and destination data, DMA addresses, and completion structures for synchronization.
The function allocates memory for source and destination buffers based on the number of DMA symbols specified. It initializes these buffers with test data, where the source buffer is filled with a specific pattern, and the destination buffer is initialized to zero.
For each test iteration, the function sets up DMA mappings for both the source and destination buffers. It prepares DMA transactions using the device's preparation functions, which are responsible for setting up the DMA transfer parameters. The function checks for errors during this preparation phase and handles them appropriately.
Once the DMA transactions are prepared, the function submits them for execution and waits for their completion using timeout mechanisms. It verifies the completion status of each DMA transfer, ensuring that the operations were successful.
After the transfers are completed, the function unmaps the DMA buffers and verifies the integrity of the data in the destination buffer against the expected values. If any discrepancies are found, it logs the error and proceeds to clean up the allocated resources.
Finally, the function returns an error code indicating the success or failure of the test, with specific error codes for different failure scenarios.
Note: It is important to ensure that the DMA devices are properly initialized and configured before calling this function. Additionally, memory allocations should be checked for success, and proper cleanup should be performed in case of errors to avoid memory leaks.
Output Example: A possible return value of the function could be 0, indicating success, or a negative integer representing specific error codes such as -3 for source buffer allocation failure or -4 for destination buffer allocation failure.
graph TD
A[Start dma_loopback_test] --> B[Initialize variables]
B --> C[For each test_idx from 0 to num_test]
C --> D[Log current test_idx]
D --> E[Allocate src_buf]
E -->|If allocation fails| F[Go to err_src_buf]
E --> G[Allocate dst_buf]
G -->|If allocation fails| H[Go to err_dst_buf]
G --> I[Initialize test buffers]
I --> J[Set DMA control flags]
J --> K[Map src_buf to DMA]
K -->|If mapping error| L[Go to err_src_buf_dma_mapping]
K --> M[Map dst_buf to DMA]
M -->|If mapping error| N[Go to err_dst_buf_dma_mapping]
M --> O[Initialize scatterlist for src and dst]
O --> P[Prepare DMA transfer for src]
P -->|If preparation fails| Q[Go to err_dst_buf_with_unmap]
P --> R[Prepare DMA transfer for dst]
R -->|If preparation fails| S[Go to err_dst_buf_with_unmap]
R --> T[Initialize completion for src]
T --> U[Submit DMA transfer for src]
U --> V[Initialize completion for dst]
V --> W[Submit DMA transfer for dst]
W --> X[Issue pending DMA transfers]
X --> Y[Wait for completion of src transfer]
Y -->|If timeout| Z[Go to err_dst_buf_with_unmap]
Y --> AA[Check if src transfer is complete]
AA -->|If not complete| AB[Go to err_dst_buf_with_unmap]
AA --> AC[Wait for completion of dst transfer]
AC -->|If timeout| AD[Go to err_dst_buf_with_unmap]
AC --> AE[Check if dst transfer is complete]
AE -->|If not complete| AF[Go to err_dst_buf_with_unmap]
AE --> AG[Unmap src_buf]
AG --> AH[Unmap dst_buf]
AH --> AI[Verify test buffer]
AI --> AJ[Log verification result]
AJ --> AK[Free src_buf]
AK --> AL[Free dst_buf]
AL --> AM[Return error code]
F[Return error code -3] --> AM
H[Return error code -4] --> AM
L[Return error code] --> AM
N[Return error code] --> AM
Q[Return error code] --> AM
S[Return error code] --> AM
Z[Return error code] --> AM
AB[Return error code] --> AM
AD[Return error code] --> AM
AF[Return error code] --> AM
Function init_side_channel(void)
init_side_channel: The function of init_side_channel is to initialize the side information buffer by allocating memory for it.
parameters: The parameters of this Function. · There are no parameters for this function.
Code Description: The init_side_channel function is a static function that is responsible for allocating memory for a buffer used to store side information. The function begins by attempting to allocate memory using the kmalloc function, which is a kernel memory allocation function in the Linux kernel. The size of the memory to be allocated is determined by the variable max_side_info_buf_size, which should be defined elsewhere in the code. The GFP_KERNEL flag indicates that the allocation is for kernel space and may sleep if necessary.
After the memory allocation attempt, the function checks if the allocation was successful by evaluating the pointer side_info_buf. If the allocation fails (i.e., side_info_buf is NULL), the function returns -1 to indicate an error. If the allocation is successful, the function returns 0, indicating that the initialization was successful.
This function is crucial for ensuring that the side information buffer is properly allocated before it is used in other parts of the code, preventing potential null pointer dereferences and ensuring the stability of the system.
Note: It is important to ensure that max_side_info_buf_size is defined and initialized properly before calling this function. Additionally, the allocated memory should be freed appropriately to avoid memory leaks when it is no longer needed.
Output Example: If the memory allocation is successful, the function will return 0. If the allocation fails, it will return -1. For example: - Successful allocation: return value = 0 - Failed allocation: return value = -1
graph TD
A[Start init_side_channel] --> B[Allocate memory for side_info_buf]
B --> C{Memory allocation successful?}
C -->|Yes| D[Return 0]
C -->|No| E[Return -1]
D --> F[End init_side_channel]
E --> F
Function get_side_info(int num_eq, int iq_len)
get_side_info: The function of get_side_info is to retrieve side channel information through DMA (Direct Memory Access) operations.
parameters: The parameters of this Function. · parameter1: int num_eq - Represents the number of equalizers to be processed. · parameter2: int iq_len - Indicates the length of the IQ (In-phase and Quadrature) data.
Code Description: The get_side_info function is designed to manage the process of retrieving side channel information using DMA. It begins by checking if the side_info_buf is initialized; if it is NULL, a warning is logged, and the function returns -1, indicating an error. The function then verifies the completion status of a previous DMA transaction using dma_async_is_tx_complete. If the status is not DMA_COMPLETE, it logs a warning and returns -1.
Next, the function adjusts the scheduling priority of the current process using set_user_nice to ensure timely execution. It calculates the number of DMA symbols per transaction based on the provided iq_len and the number of equalizers. The total number of DMA symbols is read from a hardware register, and the function ensures that the number of symbols is valid; if it is zero, it returns -2.
The function then calculates the size of the side_info_buf and maps it to a DMA address using dma_map_single. If there is a mapping error, it logs a warning and returns -3. A scatter-gather list is initialized, and the DMA address and length are set for the buffer.
The function prepares a DMA transaction using the device_prep_slave_sg method. If the preparation fails, it logs a warning and proceeds to the error handling section. A completion structure is initialized, and a callback function is assigned to handle the completion of the DMA transaction.
The transaction is submitted, and the function checks for submission errors. If there are no errors, it writes the number of DMA symbols to a hardware register to trigger the DMA operation. The function then issues the pending DMA transaction.
The function waits for the completion of the DMA operation with a timeout. If the timeout occurs or if the status is not DMA_COMPLETE, it logs a warning and enters the error handling section. Finally, if the DMA operation completes successfully, the function unmaps the DMA buffer and returns the size of the buffer.
In the error handling section, the function ensures that any allocated DMA resources are properly unmapped before returning an error code.
Note: It is essential to ensure that the side_info_buf is allocated and initialized before calling this function. Additionally, the function assumes that the DMA device and channel have been properly configured prior to invocation.
Output Example: A successful call to get_side_info with valid parameters might return an integer value representing the size of the side_info_buf, such as 64, indicating that 64 bytes of side channel information have been successfully retrieved. If an error occurs, the function may return negative values such as -1, -2, or -3, indicating specific error conditions as described in the code.
graph TD
A[Start get_side_info] --> B[Check if side_info_buf is NULL]
B -->|Yes| C[Log warning side_info_buf is NULL]
C --> D[Return -1]
B -->|No| E[Check DMA status]
E -->|Not complete| F[Log warning status not complete]
F --> D
E -->|Complete| G[Set user nice value]
G --> H[Determine num_dma_symbol_per_trans]
H --> I[Read num_dma_symbol from SIDE_CH_REG_M_AXIS_DATA_COUNT]
I --> J[Calculate num_dma_symbol]
J -->|Zero| K[Return -2]
J -->|Non-zero| L[Calculate side_info_buf_size]
L --> M[Map side_info_buf to DMA]
M -->|Mapping error| N[Log warning DMA mapping error]
N --> D
M -->|No error| O[Initialize scatterlist]
O --> P[Prepare DMA descriptor]
P -->|Descriptor is NULL| Q[Log warning descriptor is NULL]
Q --> R[Go to error handling]
P -->|Descriptor is valid| S[Set callback and submit DMA]
S --> T[Check for submission error]
T -->|Error| U[Log warning DMA submit error]
U --> R
T -->|No error| V[Write num_dma_symbol to register]
V --> W[Issue pending DMA]
W --> X[Wait for completion with timeout]
X -->|Timeout| Y[Log warning timeout occurred]
Y --> R
X -->|Complete| Z[Check DMA completion status]
Z -->|Not complete| AA[Log warning status not complete]
AA --> R
Z -->|Complete| AB[Unmap side_info_buf]
AB --> AC[Return side_info_buf_size]
R[Error handling] --> AD[Unmap side_info_buf]
AD --> AE[Return -100]
D --> AF[End]
AC --> AF
AE --> AF
Function side_ch_nl_recv_msg(struct sk_buff *skb)
side_ch_nl_recv_msg: The function of side_ch_nl_recv_msg is to handle incoming Netlink messages and perform actions based on the received commands.
parameters: The parameters of this function. · parameter1: struct sk_buff *skb - A pointer to the socket buffer that contains the incoming Netlink message.
Code Description: The side_ch_nl_recv_msg function processes incoming Netlink messages by extracting the command and its parameters from the message payload. It begins by defining several local variables, including pointers for the Netlink message header and the output socket buffer, as well as variables for message size, action flags, register types, indices, and values.
The function retrieves the Netlink message header from the socket buffer and extracts the command buffer using the nlmsg_data function. The first four elements of the command buffer are interpreted as the action flag, register type, register index, and register value, respectively.
Based on the action flag, the function performs different operations: - If the action flag is ACTION_SIDE_INFO_GET, it calls the get_side_info function to retrieve side information. The result is stored in the message buffer, and the message size is updated accordingly. - If the action flag is ACTION_REG_READ, it reads the value from a specified register index and stores it in the message buffer. - If the action flag is ACTION_REG_WRITE, it writes a value to the specified register index and updates the message buffer to indicate success. - If the action flag does not match any known commands, it sets an error code in the message buffer.
After processing the command, the function allocates a new socket buffer for the response message. It populates the Netlink message header and copies the message data into the new socket buffer. Finally, it sends the response back to the user process using nlmsg_unicast. If the sending operation fails, an error message is logged.
Note: It is important to ensure that the action flags and register indices are valid to avoid potential errors. The function currently includes commented-out checks for invalid register indices, which should be considered for implementation to enhance robustness.
Output Example: A possible return value in the message buffer could be: - For ACTION_SIDE_INFO_GET with valid parameters: {0, 1, 2, 3, ...} (where the integers represent side information). - For ACTION_REG_READ with a valid register index: {value} (where 'value' is the content read from the register). - For ACTION_REG_WRITE: {0} (indicating success). - For invalid action flags: {-1} (indicating an invalid action).
graph TD
A[Receive Netlink message] --> B[Extract nlmsghdr from skb]
B --> C[Extract command buffer from nlmsg_data]
C --> D[Get action_flag, reg_type, reg_idx, reg_val]
D --> E[Get pid of sending process]
E --> F{Check action_flag}
F -->|ACTION_SIDE_INFO_GET| G[Call get_side_info]
G --> H{Check result}
H -->|res > 0| I[Set msg_size to res]
H -->|res <= 0| J[Set msg_size to 4, msg[0] to -2]
F -->|ACTION_REG_READ| K[Set msg_size to 4]
K --> L[Read register value]
F -->|ACTION_REG_WRITE| M[Set msg_size to 4]
M --> N[Write register value]
F -->|Other| O[Set msg_size to 4, msg[0] to -1]
P[Allocate new skb for response] --> Q{Check allocation success}
Q -->|Success| R[Prepare nlmsg for response]
Q -->|Failure| S[Log error and return]
R --> T[Copy msg to nlmsg_data]
T --> U[Send response back to user]
U --> V{Check send result}
V -->|Success| W[End]
V -->|Failure| X[Log error while sending back]
X --> W
Function dev_probe(struct platform_device *pdev)
dev_probe: The function of dev_probe is to initialize the device and set up necessary resources for operation.
parameters: The parameters of this Function. · parameter1: struct platform_device *pdev - A pointer to the platform device structure representing the device being probed.
Code Description: The dev_probe function is responsible for initializing a device during the probe phase of its lifecycle. It begins by defining a netlink configuration structure, which specifies the input function for receiving messages. The function retrieves the device node associated with the platform device and checks for a matching device ID using the device tree. If a match is found, it proceeds to request and map I/O memory resources for the device. The base address of the mapped memory is obtained using devm_ioremap_resource, and if this operation fails, an error code is returned.
The function then initializes a netlink socket for communication, checking for successful creation. If the socket creation fails, it logs an error and returns an error code. Following this, the function configures the side channel by writing specific values to various registers to set up the device's operational parameters, including disabling any potential actions from the side channel and configuring the capture mode for IQ data.
The function also requests a DMA channel for data transfer. If the request fails, it logs an error and releases any allocated resources. Finally, the function calls init_side_channel to perform additional initialization and returns the result of this call. Throughout the function, various printk statements are used to log the progress and status of the initialization process.
Note: It is important to ensure that the device tree is correctly configured to match the device ID for successful probing. Additionally, proper error handling is crucial to avoid resource leaks and ensure that all allocated resources are released in case of failure.
Output Example: A possible return value of the function could be 0, indicating successful initialization, or a negative error code such as -10, indicating an error in socket creation.
graph TD
A[Start dev_probe function] --> B[Initialize netlink_kernel_cfg]
B --> C[Get device node from platform_device]
C --> D{Check if device node exists}
D -- Yes --> E[Match device node with device IDs]
E --> F{Is match found?}
F -- Yes --> G[Print match message]
G --> H[Set error to 0]
F -- No --> I[Set error to 1]
D -- No --> I
I --> J{Is error non-zero?}
J -- Yes --> K[Return error]
J -- No --> L[Request and map I/O memory]
L --> M[Get resource from platform_device]
M --> N[Map resource to base address]
N --> O{Is base address valid?}
O -- No --> P[Return base address error]
O -- Yes --> Q[Print I/O memory details]
Q --> R[Print success message]
R --> S[Initialize netlink socket]
S --> T{Is socket creation successful?}
T -- No --> U[Print socket creation error]
U --> K
T -- Yes --> V[Print initialization details]
V --> W[Disable potential actions from side channel]
W --> X[Write configuration to side channel registers]
X --> Y{Is iq_len_init greater than 0?}
Y -- Yes --> Z{Is iq_len_init greater than 8187?}
Z -- Yes --> AA[Limit iq_len_init to 8187]
Z -- No --> AB[Write iq capture settings]
Y -- No --> AC[Write default configuration]
AC --> AD[Reset side channel registers]
AD --> AE[Request DMA channel]
AE --> AF{Is DMA channel valid?}
AF -- No --> AG[Print DMA channel error]
AG --> K
AF -- Yes --> AH[Print DMA channel setup success]
AH --> AI[Initialize side channel]
AI --> AJ[Return initialization error]
AJ --> AK[End dev_probe function]
Function dev_remove(struct platform_device *pdev)
dev_remove: The function of dev_remove is to clean up resources associated with a platform device upon its removal.
parameters: The parameters of this Function. · parameter1: struct platform_device *pdev - A pointer to the platform device structure that is being removed.
Code Description: The dev_remove function is responsible for releasing resources allocated for a specific platform device. It begins by printing a newline character to the kernel log for formatting purposes. The function then logs a message indicating the release of the netlink socket associated with the device by calling netlink_kernel_release(nl_sk).
Next, it checks if the pointer chan_to_pl is not NULL, which indicates that a DMA channel is currently allocated. If it is valid, the function logs the address of chan_to_pl and the name of the DMA channel using dma_chan_name(chan_to_pl). The commented-out line suggests that terminating the DMA engine is not recommended as it may interfere with other components (specifically sdr.ko). Instead, the function safely releases the DMA channel by calling dma_release_channel(chan_to_pl).
The same procedure is repeated for chan_to_ps, where the function checks if it is not NULL, logs its address and name, and releases the channel accordingly.
Following the channel releases, the function checks if side_info_buf is not NULL, indicating that a buffer was allocated. If so, it frees the memory associated with side_info_buf using kfree.
Finally, the function logs the base address of the device and indicates successful completion of the cleanup process with a success message. The function concludes by returning 0, signaling that the device removal was handled without errors.
Note: It is important to ensure that the DMA channels are properly released to avoid memory leaks or dangling pointers. The commented-out lines indicate potential pitfalls in terminating the DMA engine, which should be avoided to maintain system stability.
Output Example: A possible appearance of the code's return value would be: 0
graph TD
A[Start dev_remove function] --> B[Print newline]
A --> C[Print release nl_sk message]
C --> D[Release netlink kernel]
D --> E[Print dropped chan_to_pl message]
E --> F{Check if chan_to_pl is not NULL}
F -- Yes --> G[Print dropped channel message for chan_to_pl]
G --> H[Release dma channel for chan_to_pl]
F -- No --> I[Skip releasing chan_to_pl]
E --> J[Print dropped chan_to_ps message]
J --> K{Check if chan_to_ps is not NULL}
K -- Yes --> L[Print dropped channel message for chan_to_ps]
L --> M[Release dma channel for chan_to_ps]
K -- No --> N[Skip releasing chan_to_ps]
O{Check if side_info_buf is not NULL}
O -- Yes --> P[Free side_info_buf memory]
O -- No --> Q[Skip freeing side_info_buf]
R[Print base_addr message]
S[Print succeed message]
T[Return 0]
Q --> R
N --> R
M --> R
H --> R
I --> R
R --> S
S --> T