Pro*C 错误的详细信息以及解决方法(收下备用)

Oracle Precompiler: Pro*C/C++ Release 3.0 Messages
PCC-02010: found end-of-file while scanning string literal
Cause: A string in a SQL statement, which should be delimited by single quotation marks, was not terminated properly.

Action: Check that all strings are delimited.

PCC-02011: found identifier greater than 128 characters (truncated)
Cause: The precompiler found an identifier that was too long.

Action: Shorten the identifier. SQL identifiers should be limited to 18 characters.

PCC-02012: did not find a matching quote for CHAR constant
Cause: A character constant with a single quotation mark was not terminated.

Action: Terminate the character constant.


PCC-02013: unknown escape sequence
Cause: The precompiler found an escape sequence that it could not process inside a string literal. This error can arise when multi-byte character strings that can contain shift-in or shift-out escape sequences are used.

Action: Correct the string representation.

PCC-02014: syntax error at line num, column colnam, file name
Cause: The precompiler detected an error in C or embedded SQL syntax. This message is followed by a more specific error message.

Action: Correct the syntax error.

PCC-02015: unable to open include file
Cause: The precompiler could not open a header file that was specified using the #include preprocessor directive or the EXEC SQL INCLUDE statement. This can happen if the file specification is inaccurate or if read permission or read access rights on the file or on one or more of the directories in the path were not granted.

Action: Recheck that the file specification is correct, that the file exists, and that read permission has been granted so that the file can be read.

PCC-02016: include file pathname is too long
Cause: The pathname for include files exceeded the maximum length of 80 characters.

Action: Move the include file, or create an environment variable or logical to shorten the pathname.

PCC-02017: unable to open output file
Cause: The precompiler could not open an output file. This could be a generated code output file (.c file) or a listing file. This message can result from many causes. For example:

A pathname for a specified output file contains a non-existent directory.
An operating-system error occurred because the file system or disk is full.
Write permission on the specified directory or directories in the path do not exist.
Action: Track down the cause of the error, as suggested above, and correct it.

PCC-02018: found end-of-file while scanning comment
Cause: A C comment, either in C code or in an embedded SQL statement, was not terminated.

Action: Find the unterminated comment and terminate it with */.

PCC-02019: preprocessor warning at line num, column colnam, file name
Cause: This message indicates that a warning condition occurred as the precompiler was doing the preprocessor pass. A more specific warning message will follow this message.

Action: Correct the condition according to the action specified for the message that follows.

PCC-02020: preprocessor error at line num, column colnam, file name
Cause: This message indicates that an error condition occurred as the precompiler was in the preprocessing phase. A more specific error message will follow this message.

Action: Correct the error according to the action specified for the message that follows.

PCC-02021: found newline while scanning string literal
Cause: A string constant contains a newline character. For example,

char x[] = "Hello
world";

Action: Remove the newline character.


PCC-02022: found end of file while scanning a SQL statement
Cause: The precompiler encountered an end of file while parsing an EXEC SQL statement.

Action: Add the statement terminator(;) or complete the EXEC SQL statement.

PCC-02023: found end of file while scanning a PL/SQL statement
Cause: The precompiler encountered an end of file while parsing a PL/SQL statement (exec sql execute ...).

Action: Complete the PL/SQL statement.

PCC-02024: NCHAR literals are not permitted inside PL/SQL blocks
Cause: The precompiler found a multi-byte character string in an embedded PL/SQL statement. For example, the offending code might look like

exec sql execute
declare
name char(10) := N'Matsuda';
begin
....
end;
end-exec;

Action: Remove multi-byte character string from the PL/SQL block or rewrite the declaration without using NLS_CHAR.

PCC-02025: NLS_LOCAL should be TRUE when using NCHAR literals
Cause: The precompiler detected a multi-byte character host variable (NCHAR literal) when the option NLS_LOCAL was not set to TRUE on the command line. When NLS_LOCAL=TRUE, the runtime library (SQLLIB) performs blank-padding and blank-stripping for host variables that are of multi-byte types.

Action: Specify NLS_LOCAL=TRUE on the command line.

PCC-02035: CMD-LINE: CONFIG= option is invalid in a config file
Cause: A user configuration file inside a user configuration file cannot be specified. That is, nested configuration files cannot be nested.

Action: If there are nested configuration files, move the options from the nested files to the top-level file.

PCC-02040: CMD-LINE: Option selected, but no value provided
Cause: An option on the command line was specified, but a value for it was not included. For example, the offending code might look like:

proc ina=sample1 oname=



could trigger this error message.

Action: Provide a value for the option.


PCC-02041: CMD-LINE: Option does not exist:
Cause: A non-existent option on the command line was specified.

Action: See the Programmer's Guide to the Oracle Precompilers for a list of the valid command-line options and their possible values.

PCC-02043: CMD-LINE: Option syntax is incorrect
Cause: A value for a command-line option was incorrectly specified.

Action: See the Programmer's Guide to the Oracle Precompilers for the correct syntax for specifying command-line option values.

PCC-02044: CMD-LINE: Illegal or out of range value for option: option string
Cause: A value specified for a command-line option was not within the accepted range. For example, the range for the MAXOPENCURSORS option is 5 to 256. If a value outside this range is specified, this message is triggered.

Action: See the Programmer's Guide to the Oracle Precompilers for the ranges that option values can take.

PCC-02045: CMD-LINE: Option is not unique: option name
Cause: An option name was partially specified on the command line that made it non unique. For example, in the command line

proc in=t.pc



the "in" option can imply either the iname or include option.

Action: Provide sufficient characters on the command line to make the option name unique.

PCC-02046: CMD-LINE: Unable to open config file: filename
Cause: A non-existent user configuration file was specified on the command line with the config option.

Action: Provide a valid filename for the configuration file.

PCC-02047: CMD-LINE: Option is not allowed inline: option string
Cause: An option was entered inline that can only be entered on the command line or in a configuration file. For example, the offending code might look like

EXEC ORACLE option (nls_char=<name>;);



The nls_char option can only be entered on the command line or in a configuration file.

Action: Remove the option from the source file, and specify it on the command line.

PCC-02066: CMD-LINE: Could not find or could not open system config file
Cause: The system configuration file has a standard name (pmscfg.h) and a location that is operating-system dependent. On UNIX systems, it is located in the $ORACLE_HOME/proc directory. If a file named pmscfg.h is not found in the standard location, this warning message is issued.

Action: Create a system configuration file in the standard location. The file can be empty. See also the operating system-specific Oracle documentation.

PCC-02081: CMD-LINE: Unterminated option value list or value list was truncated
Cause: An option that takes a list of values was entered. The value list did not have a closing parenthesis. This error may also occur if the list of values entered on a single line was too long and Pro*C truncated it.

Action: Ensure that all value lists are terminated with a closing parenthesis. Split long value lists into individual entries.

PCC-02100: unable to initialize PL/SQL
Cause: The precompiler connected to Oracle but could not invoke the PL/SQL engine. This error can result if an earlier release of Oracle is used without the Procedural Option.

Action: To use PL/SQL, upgrade to a more recent release of Oracle.

PCC-02101: unable to open input file
Cause: The precompiler could not open the input file. This is the .pc file specified in the INAME= option. This means that the file does not exist, that a directory was incorrectly specified in the pathname, or that the person running the precompiler does not have read permission for the file.

This message could also result from operating-system errors. For example, an unmounted file system or disk I/O errors, could trigger this error.

Action: Check that permission to read the file exists and that the full pathname has been specified correctly. Check for operating system-specific problems. See also the operating system-specific Oracle documentation.

PCC-02102: fatal error while doing C preprocessing
Cause: The precompiler issues this message after a more specific message.

Action: Correct the problem specified in the previous message or messages.

PCC-02103: please enter your password:
Cause: The username was specified on the command line without a password. For example:

proc sqlcheck=full iname=sample1.pc userid=scott/

Action: Re-enter the command line, and include the password.

PCC-02104: unable to connect to Oracle
Cause: The precompiler could not connect to Oracle with the username, password, and, if applicable, database link that was supplied. Note that this is a precompiler message, not a run time message. This means that the USERID option value, either on the command line or in a configuration file, was incorrect.

Action: Check that the username and password are current and correct. Run SQL*DBA or SQL*Plus and verify that connection can be made using that username and password.

PCC-02105: unable to open list file
Cause: The precompiler could not open the listing file. This message can result from many causes. For example:

A pathname for a specified listing file contains a non-existent directory.
An operating-system error occurred because the file system or disk is full.
Write permission on the specified directory has not been granted.
Action: Track down the cause of the error, as suggested above, and correct it.

PCC-02106: USERID only used when SQLCHECK=FULL, userid ignored
Cause: The USERID option was specified on the command line, but SQLCHECK was not equal to FULL or SEMANTICS. The USERID has no effect, unless SQLCHECK=FULL or SQLCHECK=SEMANTICS.

Action: This is a warning message only.

PCC-02107: you may not specify PARSE = FULL when CODE = CPP
Cause: The PARSE=FULL and CODE=CPP options were both specified on the command line. The PARSE=FULL option invokes the C parser, which does not understand any C++ constructs generated by the precompiler with CODE=CPP option.

Action: Set the PARSE option to either NONE or PARTIAL if the CODE=CPP option is specified.

PCC-02108: UNSAFE_NULL=YES allowed if MODE=ORACLE and DBMS=V7 or V8
Cause: UNSAFE_NULL=YES was specified on the command line, but either the MODE option was not ORACLE or the DBMS option was not V7 or V8.

Action: Specify MODE=ORACLE and DBMS=V7 or V8 when using UNSAFE_NULL=YES.

PCC-02109: SQLCHECK=NONE is not yet supported, using SYNTAX
Cause: SQLCHECK=NONE was specified on the command line but is not supported in this release. SQLCHECK=SYNTAX was used instead.

Action: This is a warning message only. To avoid this warning, specify SQLCHECK=SYNTAX or SQLCHECK=SEMANTICS.

PCC-02110: DBMS=V6_CHAR is deprecated. Use CHAR_MAP=VARCHAR2, DBMS=V7 instead
Cause: DBMS=V6_CHAR was specified on the command line but is a no longer supported option. The options CHAR_MAP=VARCHAR2 andDBMS=V7 were used instead.

Action: This is a warning message only. To avoid this warning, specify CHAR_MAP=VARCHAR2 and, if required, DBMS=V7.

PCC-02111: CHAR_MAP option ignored. Only CHAR_MAP=VARCHAR2 allowed for DBMS=V6
Cause: DBMS=V6 was specified, and CHAR_MAP was specified with a value other than VARCHAR2. The CHAR_MAP value is ignored.

Action: This is a warning message only. To avoid this warning, specify a DBMS value other than DBMS=V6 or use CHAR_MAP=VARCHAR2.

PCC-02112: OBJECTS option ignored. OBJECTS=YES is not allowed for DBMS=V6 or V7.
Cause: OBJECTS=YES was specified on the Pro*C command line, but the DBMS option value was not valid.

Action: This is a warning message only. To avoid this warning for OBJECTS=YES, use DBMS=V8 or DBMS=NATIVE with a V8 database.

PCC-02129: CMD-LINE: Client supplied static options table is invalid
Cause: This is an internal error message not usually issued.

Action: Call Oracle customer support.


PCC-02132: CMD-LINE: Could not allocate memory
Cause: This is an internal error message not usually issued.

Action: Call Oracle customer support.


PCC-02133: CMD-LINE: Error processing string function
Cause: This is an internal error message not usually issued. It indicates that a C string function, such as strcpy or strlen, returned an error.

Action: Call Oracle customer support.

PCC-02134: CMD-LINE: Null option supplied
Cause: A zero length option was specified on the command line.

Action: Re-enter the command line with a valid option.

PCC-02135: CMD-LINE: User asked for help
Cause: This is a final message that the precompiler issues when information about the command-line options has been requested. For example, if the command

proc ?



is issued to get a list of the current default values for the command-line options, this message appears at the end of the list.

Action: No action required.

PCC-02138: CMD-LINE: Internal consistency error
Cause: This is an internal message for program exceptions. An unexpected condition was encountered by the command-line processor and a consistency check failed. Some possible causes of this message include:

invalid command-line options
memory corruption
Action: Report this error to Worldwide Support after gathering the following information:

the events that led to the error
the attempted operations that led to the error
any unusual circumstances prior to this error
PCC-02144: CMD-LINE: Blank characters are not allowed on either side of an equal sign (=)
Cause: An equal sign (=) was either immediately preceded or followed by a blank character.

Action: Precompile your program again without blank characters on either side of any equal sign (=) on the command line.

PCC-02150: error at line num, column num in file name
Cause: An error was encounter at the given location.

Action: Check the named source file and correct the error using the additional information which follows this error message.

PCC-02151: line num column num file name:
Cause: An error was encounter at the given location.

Action: Check the listed source file and correct the error using the additional information which follows this error message.

PCC-02152: unable to open file name to display or list the source line num
Cause: The file contains an error, but could not be reopened to list or display the incorrect line.

Action: Check that the file is intact and it has read permission. Then rerun the operation.

PCC-02153: open file: name
Cause: A new source file was opened while producing the list file.

Action: No action required; this is an informational message.

PCC-02154: close file: name
Cause: A source file was closed while producing the list file.

Action: No action required; this is an informational message.

PCC-02200: found unrecognized punctuation sequence
Cause: This error indicates that the precompiler parser encountered a badly-formed identifier or keyword.

Action: Correct the syntax.

PCC-02201: found syntax error
Cause: This general message precedes one or more specific messages that detail the nature of the error.

Action: No action required. Correct the errors diagnosed in the following message(s).

PCC-02202: no TYPEDEF name was given
Cause: The precompiler parser encountered a TYPEDEF statement that had no name after the type specification. For example

typedef int;

Action: Correct the syntax.

PCC-02203: found end of file when not expected
Cause: The parser can emit this message when a general syntax error occurs, for example, an unmatched `{' or `('.

Action: Correct the syntax.

PCC-02204: EXEC SQL INCLUDE not permitted from within an included file
Cause: EXEC SQL INCLUDE statements cannot be nested. Also, an EXEC SQL INCLUDE statement cannot be put inside a file that is included using the #include preprocessor command.

Action: Recode the program so that the nested include statement is not required.

PCC-02205: parser error at line num, column colnam, file name
Cause: The precompiler parser encountered a syntax error, either in C code or in SQL code. A more specific message should follow.

Action: No action required for this message. Take the appropriate action for any following messages.


PCC-02206: host variables are not permitted within a DDL statement
Cause: A Data Definition Language statement cannot use host variables. For example, the statement

CREATE TABLE :table_name (c1 char(10));



is illegal, because the name of the table in a CREATE TABLE statement cannot be represented using a host variable.

Action: Use dynamic SQL to create the names of database objects (tables, views, columns, etc.) at runtime. See the Programmer's Guide to the Oracle Precompilers for information about dynamic SQL.

PCC-02207: invalid macro name
Cause: The precompiler parser encountered a #DEFINE directive that had no macro name associated with it. For example,

#define

Action: Correct the syntax.


PCC-02208: no filename specified in #include statement
Cause: The precompiler parser encountered a #INCLUDE directive that had no filename associated with it. For example,

#include

Action: Specify appropriate filename with the #INCLUDE directive, or correct the syntax.

PCC-02209: macro invocation has incorrect number of arguments
Cause: A macro invocation in the source does not have the same number of arguments as the macro definition in the #DEFINE line.

Action: Correct the macro reference or the macro definition.

PCC-02210: C++ punctuation sequences are not permitted
Cause: C++ punctuation sequences are not supported by the Pro*C/C++ precompiler.

Action: Rewrite your C++ code without using punctuation sequences and precompile it again.

PCC-02301: cannot open input file for reading
Cause: The semantic analysis phase of the precompiler could not re-open the input file to generate output code.

Action: Check that the input file and its directory's protections and privileges do not change during precompilation.

PCC-02302: cannot open code generation output file name
Cause: The precompiler was not able to open one or both of the temporary files that are required for code generation. The user executing the precompiler must have write permission (and/or the appropriate privileges) on the current directory.

Action: Check that permission exists to create files in the directory where you precompile.


PCC-02303: cannot open include file
Cause: The precompiler was not able to open a header file specified using the #INCLUDE preprocessor directive or the EXEC SQL INCLUDE statement. This can happen if the file specification is inaccurate or if read permission or read-access rights on the file or on one or more of the directories in the path have not been granted.

Action: Recheck that the file specification is correct, that the file exists, and that read permission has been granted so that the file can be read.


PCC-02304: invalid declaration of C function
Cause: A C function using invalid syntax was declared.

Action: Consult a C programming manual and correct the declaration.

PCC-02305: illegal mixing of new and old style C function declarations
Cause: All C functions using either the traditional style (K&R style) function declarations or the new (ANSI) style must be declared; the two styles cannot be mixed.

Action: Adopt a consist declaration style for functions.

PCC-02306: illegal name of C function
Cause: A C function was declared with a name that is not a legal C identifier.

Action: Use legal C identifiers for all function names.

PCC-02307: void can only be used when single parameter
Cause: A function can be declared or defined using the following syntax:

int func1(void)



to indicate that the function has no parameters. void can be used only once in this case.

Action: Remove the extra voids in the function definition or declaration.

PCC-02308: identifier required in this function definition
Cause: A function definition written in ANSI C must have both the name and the type for all parameters.

Action: Rewrite the function definition so that it contains the name of each parameter.

PCC-02309: illegal formal parameter declaration
Cause: A formal parameter in a function declaration was specified without giving its type.

Action: Rewrite the function declaration and include the types of all parameters in function declarations.

PCC-02310: formal parameter VARCHARs must be declared as pointers
Cause: Many C compilers allow structures to be passed to and returned from functions. Although a VARCHAR is implemented as a C struct, VARCHARs must be passed to a function as pointers.

Action: Take the address of a VARCHAR when it is passed to a function. See the example in the section "Referencing VARCHAR Variables" in the Programmer's Guide to the Oracle Precompilers.

PCC-02311: cannot have VARCHAR bit fields
Cause: Host variables cannot contain bit fields.

Action: Recode the application to remove the bit fields.

PCC-02312: arrays of VARCHAR greater than 2 dimensions not allowed
Cause: A VARCHAR array with more than two dimensions was declared. Multidimensional arrays are not supported as host variables.

Action: Recode the application to remove multidimensional array usage.

PCC-02313: malformed VARCHAR declaration - missing length
Cause: When a VARCHAR is declared, a length specification is mandatory. For example, the following VARCHAR declaration is meaningless, hence illegal:

VARCHAR v1[];

Action: Specify the length for each declared VARCHAR.

PCC-02314: cannot evaluate constant SIZEOF expression
Cause: A SIZEOF operator was used where a precompiler expression was expected. For example, as the length of a VARCHAR.

Action: Eliminate the SIZEOF operator in this instance.

PCC-02315: cannot evaluate expression as a constant.
Cause: The specified expression does not evaluate to a constant. Such expressions are required, for example, as the length of a VARCHAR.

Action: Replace the expression with one that does evaluate to a constant integer.

PCC-02316: illegal operator in constant expression
Cause: A non-arithmetic operator was present in a constant expression.

Action: Rewrite the expression to eliminate the non-arithmetic operator.

PCC-02317: Illegal cast type expression
Cause: A illegal cast is present in the expression.

Action: Remove the illegal cast.

PCC-02318: missing type expression
Cause: The specified expression is missing the declaration of a type.

Action: Specify a type for the expression.

PCC-02319: expression type does not match usage
Cause: The type of a variable does not match its usage. For example, in dynamic SQL, a host variable containing the text of a SQL statement must be declared as a C character type or be equivalenced to the SQL type STRING.

Action: Remove the declaration.

PCC-02320: arithmetic expression does not have correct operand types
Cause: The arithmetic expression must be specified with integral types.

Action: Rewrite the expression using integral types.


PCC-02321: only subtraction between two pointers is permitted
Cause: Pointer values cannot be added, multiplied, or divided. The only arithmetic operation permitted with pointers is subtraction.

Action: Recode to avoid this error message.


PCC-02322: found undefined identifier
Cause: An identifier used in a SQL statement was not defined. For example, a cursor name was referenced that had not been declared, or in a DECLARE CURSOR statement, a statement name was used that had not been PREPAREd.

Action: Check that all SQL identifiers, such as cursor names and statement names, have been defined before use.

PCC-02323: found typedef name used in an expression (expecting a value)
Cause: The name of a typedef was found where a variable was expected.

Action: Rewrite the expression and remove the reference to the typedef.

PCC-02324: found variable name used as a typedef name
Cause: The name of a variable was found where a typedef was expected.

Action: Rewrite the expression and specify the correct typedef reference.

PCC-02325: illegal indirection operation
Cause: An attempt was made to use a non-pointer type as a pointer.

Action: Rewrite the expression.

PCC-02326: illegal structure reference operation
Cause: A structure component using invalid syntax was referenced. For example, a ->; operator was used instead of a required `.' operator.

Action: Correct the invalid reference.


PCC-02327: struct or struct pointer required
Cause: A scalar host variable was used in a context where a structure (or its pointer) is required.

Action: Make the host variable a structure or add more scalar host variables to satisfy the SQL syntax requirements.

PCC-02328: undefined struct member
Cause: A structure component was referenced that was not declared as part of the structure.

Action: Redefine the structure member.

PCC-02329: found reference to undeclared function
Cause: A function was referenced that was not declared. All function references must be declared.

Action: Declare the function.

PCC-02330: expecting an expression of integer type
Cause: The expression does not evaluate to an integer. For example, a SQL FOR expression must evaluate to an integral type.

Action: Rewrite the expression.

PCC-02331: undefined SQL identifier
Cause: All SQL identifiers must be defined before they are used. This message can result when a CURSOR or STATEMENT is not declared (defined) before being referenced.

Action: Define the SQL identifier before it is used.

PCC-02332: attempted to redefine SQL identifier
Cause: A SQL identifier (such as a cursor name) can be defined only once.

Action: Do not redefine the SQL identifier. Use a different name.

PCC-02333: SQL identifier was not declared as a statement
Cause: A SQL statement identifier was referenced in a DECLARE... CURSOR statement that was not PREPAREd.

Action: Check that all SQL statement names have been declared. Remember that SQL statement names are identifiers, not variables, and that they are local to the precompilation unit.

PCC-02334: SQL identifier was not declared as a cursor
Cause: A cursor name was used in an OPEN, FETCH, or CLOSE statement that had not been DECLAREd.

Action: Check that all SQL cursor names have been declared. Remember that cursors are identifiers, not variables, and that they are local to the precompilation unit.

PCC-02335: body of cursor must name statement identifier
Cause: In a Dynamic SQL Method 4 application, the DECLARE... CURSOR statement must name a statement identifier that has been PREPAREd in a preceding statement. The PREPARE statement must physically (not logically) precede the DECLARE command.

Action: This error message is followed by another message that gives the line and column of the reference to the statement. Recode the application.

PCC-02336: host variable expression has invalid type
Cause: The host variable was declared using a C type that is not permitted as a host variable. See the Programmer's Guide to the Oracle Precompilers for a list of the permissible C types for host variables.

Action: Use a permissible host variable type.

PCC-02337: cannot declare multi-dimensioned array for this type
Cause: Host variable arrays of scalars with more than 1 dimension cannot be declared. The only host variables allowed to be multi-dimensioned are CHAR and VARCHAR.

Action: Recode the application because this kind of host variable usage is not possible with database operations.

PCC-02338: structure contains a nested struct or union
Cause: A structure used as a host variable may not have structures or unions nested within it.

Action: Rewrite the variable declaration.

PCC-02339: host variables cannot be of union types
Cause: A C union as a host variable cannot be used.

Action: This error message is followed by another message that gives the line and column of the reference to the illegal union. Recode, using a struct or individual scalar host variables.


PCC-02340: structure contains a bit field
Cause: Bit fields are not allowed in host variables because they are meaningless for database DML operations.

Action: This error message is followed by another message that gives the line and column of the reference to the offending host variable. Recode the application.

PCC-02341: host variable has illegal type
Cause: A host variable has an unpermitted type (i.e.; enum, void, etc).

Action: Rewrite the declaration, using a permissible host variable type.

PCC-02342: using WHERE CURRENT OF on cursor defined without FOR UPDATE clause
Cause: When MODE=Oracle, a cursor defined with a WHERE CURRENT OF clause must also have a FOR UPDATE clause.

Action: Rewrite the cursor definition.

PCC-02343: body of cursor must be a query expression
Cause: A cursor definition must be a SELECT statement.

Action: Rewrite the cursor definition.

PCC-02344: host variable array size mismatch. Using minimum: size
Cause: Host variable arrays in a single statement should all be of equal size.

Action: Redefine the bind variable array lengths to all be the same size.

PCC-02345: SQLCHECK=SEMANTICS must be given when embedded PL/SQL blocks are used
Cause: Embedded PL/SQL blocks require that the command-line flag SQLCHECK=SEMANTICS is used.

Action: Use the SQLCHECK=SEMANTICS option. This also requires that the USERID connect option be given.

PCC-02346: PL/SQL found semantic errors
Cause: A database entity, such as a table or column name, was referenced, that does not exist. This is a compile time error, not a runtime error.

Action: Check that all referenced objects in PL/SQL statements actually exist and that the necessary access permission on them have been granted.

PCC-02347: PL/SQL found syntax errors
Cause: A PL/SQL statement was used illegally.

Action: Check the PL/SQL User's Guide and Reference for the correct syntax.

PCC-02348: indicators are not allowed in EXEC IAF statements
Cause: Indicator variables associated with host variables cannot be used in EXEC IAF statements such as GET and PUT in a user exit.

Action: Eliminate the indicator variables. If feasible (for example with Forms V4), use EXEC TOOLS statements, which do allow indicator variables. See the Programmer's Guide to the Oracle Precompilers for more information of EXEC IAF and EXEC TOOLS statements.

PCC-02349: precision must be specified for this type
Cause: In a VAR or TYPE statement, certain Oracle types require that the precision be specified. For example, VARCHAR2 or CHAR.

Action: Indicate the precision.

PCC-02350: cannot equivalence this SQL type
Cause: Datatype or variable equivalencing to the datatypes NUMBER or DECIMAL cannot be used. See the "Datatype Equivalencing" section in the Programmer's Guide to the Oracle Precompilers for more information.

Action: Use the appropriate datatype for the application.

PCC-02351: illegal datatype equivalencing operation
Cause: The datatype specified could not be equivalenced, or the syntax was incorrect in the VAR or TYPE statement.

Action: See the Programmer's Guide to the Oracle Precompilers for a list of the datatypes that can be equivalenced and the correct syntax of the VAR or TYPE statement.

PCC-02352: out of bounds bind position from PL/SQL
Cause: PL/SQL requested a bind position that does not exist. This is an internal error.

Action: Call Oracle customer support for assistance.

PCC-02353: semantic error at line num, column colnam, file name
Cause: This error message precedes a more specific error message.

Action: No action required. Correct the error(s) reported in the following message(s).

PCC-02354: a file included with #INCLUDE cannot contain SQL statements
Cause: The Pro*C Precompiler reads header files referenced in #INCLUDE directives and uses the values defined in them. But the precompiler never generates code using statements in header files, so use of SQL statements in these files is illegal.

Action: Move the SQL statement(s) into the main body of the application or use EXEC SQL INCLUDE to check that the included file is precompiled.

PCC-02355: invalid or obsolete option, ignored
Cause: A command-line option that is not used in Pro*C Release 2.0 was specified. For example, the option AREASIZE is no longer valid with precompilers used with the Oracle Server.

Action: No action required. This is an informational message.

PCC-02356: Warning at line num, column colnam, file name
Cause: This is a generic warning message. It precedes a more specific warning.

Action: No action required. Correct the error(s) indicated in the following messages.

PCC-02357: function calls may not be used as host variable expressions
Cause: Only objects that are lvalues (that resolve to an address) can be host variables. Because a function call is not an lvalue, one cannot be used in place of a host variable.

Action: Recode the application.

PCC-02358: identifier following ARRAYLEN must be the name of an array
Cause: A declared array must be specified as the argument for an ARRAYLEN statement. Declare the array textually before the ARRAYLEN statement. See the Programmer's Guide to the Oracle Precompilers for the syntax of the ARRAYLEN statement.

Action: Correct the statement, specifying a host array as the argument.

PCC-02359: identifier specifying ARRAYLEN dimension must be a 4-byte integer
Cause: The expression that specifies the ARRAYLEN dimension must evaluate to an integer. For example, the statement

EXEC SQL ARRAYLEN my_array(1.3)



cannot be parsed.

Action: Correct the statement, using an integral dimension.

PCC-02360: this array type is invalid for use with ARRAYLEN statement
Cause: Arrays of some host variables types are not allowed and hence also cannot be used in ARRAYLEN statements. VARCHAR and DATE are examples.

Action: Specify an array with a datatype that can be used in host arrays.

PCC-02361: use of ARRAYLEN with SQL host arrays is ignored
Cause: ARRAYLEN is only valid with arrays that can be bound in PL/SQL blocks.

Action: Use an appropriate array type.

PCC-02362: host variable not declared within SQL Declare Section
Cause: When MODE=ANSI is specified at precompile time, all host variables must be declared inside Declare Sections. Remember that MODE=ANSI refers to ANSI SQL, not ANSI C.

Action: Add the EXEC SQL BEGIN DECLARE SECTION... EXEC SQL END DECLARE SECTION statements around all host variable declarations.

PCC-02363: indicator variable must be a structure
Cause: If the host variable is a structure, the associated indicator variable must also be a structure.

Action: Recode the application to create an indicator variable as a structure.

PCC-02364: host structure and its indicator must have the same number of fields
Cause: When a structure containing indicator variables is declared and associated with a host structure, the indicator structure must contain the same number of fields as the host structure. This is so even when some of the indicators will not be used or even when it would not make sense to do so (for fields constrained as NON NULL, for example).

Action: Redeclare the indicator variable with the correct number of fields.

PCC-02365: indicator array size cannot be smaller than host array size
Cause: An indicator array must have dimension greater than or equal to the corresponding host variable array dimension.

Action: Change the dimension of the indicator array.

PCC-02366: command line argument MODE=ANSI may not be used with DBMS=V6
Cause: The semantics of certain operations (such as character comparison) in Oracle Version 6 are not 100% compliant with the ANSI/ISO SQL standards. When V6 semantics are requested, using the DBMS=V6 or DBMS=V6_CHAR option, precompilation with MODE=ANSI is not permitted.

Action: Do not use ANSI mode with the V6 options.

PCC-02367: indicator variables must be declared as type short
Cause: The only C type allowed for indicator variables is short. An array of indicator variables must be an array of shorts.

Action: Redeclare the indicator variables and/or indicator arrays.

PCC-02368: an EXEC TOOLS host variable context name is not type char
Cause: If a host variable is used to define a context name in an EXEC TOOLS GET CONTEXT or EXEC TOOLS SET CONTEXT statement, the host variable must be a character type.

Action: Redeclare the context name to a host variable of a CHAR type.

PCC-02369: an EXEC TOOLS host pointer variable is not a pointer
Cause: The host variable specifying an EXEC TOOLS context must be a pointer type.

Action: Re-declare the variable, making sure that it is a pointer.


PCC-02370: an EXEC TOOLS MESSAGE host variable is not type char
Cause: If a host variable is used to define a context name in an EXEC TOOLS GET CONTEXT or EXEC TOOLS SET CONTEXT statement, the host variable must be a character type.

Action: Re-declare the message to a host variable of a char type.

PCC-02371: illegal FOR clause
Cause: The argument of a FOR clause must be specified as an integer or as an identifier containing an integer.

Action: Rewrite the FOR clause.

PCC-02372: FOR clause not allowed in a SELECT statement
Cause: A SQL statement containing a SELECT command cannot contain a FOR clause. The meaning of such a statement would be unclear.

Action: Rephrase the SELECT statement, removing the FOR clause.

PCC-02373: invalid declaration in EXEC SQL DECLARE section
Cause: An improper declaration was placed in a Declare Section. This message is usually caused by including an EXEC SQL TYPE or EXEC SQL VAR declaration in a Declare Section.

Action: Move the declaration outside the SQL DECLARE section.


PCC-02374: SQLCHECK value exceeds command line value
Cause: The value assigned to the SQLCHECK option in an EXEC ORACLE statement in a program was greater than the value given either on the command line or greater than the default value if no SQLCHECK option was given on the command line.

The order of the option values is SEMANTICS >; SYNTAX >; NONE.

When this warning message is issued, the original value of SQLCHECK (the default or the command-line value) stays in effect.

Action: Remove or recode the EXEC Oracle option(s) in the .pc source file to avoid this warning message.

PCC-02375: SQL statement found outside the body of a function
Cause: A SQL statement other than a declarative, datatype equivalence or WHENEVER statement was found outside the body of a function when PARSE=FULL.

Action: Move the SQL statement inside the body of a function.

PCC-02376: you may not declare SQLCODE when DEF_SQLCODE = TRUE
Cause: The DEF_SQLCODE option may not be specified if a SQLCODE declaration already explicitly appears in the program.

Action: Remove the SQLCODE declaration from the program or specify DEF_SQLCODE=NO (the default).

PCC-02377: arrays of implicit VARCHARs are not permitted
Cause: An array of implicit VARCHARs was declared when HOST_VARCHAR=TRUE.

Action: Rewrite the implicit VARCHAR declaration without using arrays.

PCC-02378: invalid type for National Language character variable
Cause: A variable declared as a National Language character using the NLS_CHAR option was not declared as a char or implicit VARCHAR.

Action: Declare the variable as a char or implicit VARCHAR or do not specify using the NLS_CHAR option.

PCC-02379: cannot equivalence National Language character variables
Cause: A National Language character variable (specified using the NLS_CHAR option) has undergone datatype equivalencing using either the EXEC SQL VAR or TYPE statements.

Action: Do not equivalence National Language character variables.

PCC-02382: you must specify MODE = ANSI when using NLS_CHAR
Cause: NLS_CHAR was used to specify NLS multi-byte character variables without specifying MODE=ANSI.

Action: Specify MODE=ANSI on the command line when using NLS_LOCAL=TRUE.

PCC-02384: missing array length specifier
Cause: An array declaration was given without an array length specifier.

Action: Provide the length for the array declaration.

PCC-02385: you may not specify DBMS = V6_CHAR when using NLS_CHAR
Cause: The DBMS=V6_CHAR option was specified on the command line while indicating which host variables are to be treated by the precompiler as NLS multi-byte character variables. A multi-byte character string must be null-terminated, but if the DBMS=V6_CHAR option is specified, the precompiler pads the character arrays with blanks up to the length of the array without the null-terminator.

Action: Remove the DBMS=V6_CHAR option from the command line.

PCC-02386: use of the AT clause is not permitted here
Cause: An explicit AT clause was used with an ALLOCATE statement or a FETCH/CLOSE statement also using a SQL_CURSOR declaration.

Action: Remove the AT clause.

PCC-02387: expecting an expression of type sql_cursor
Cause: A host bind variable was used in an ALLOCATE, FETCH or CLOSE statement that was not declared as a result set sql_cursor.

Action: Declare the variable to be of type sql_cursor.

PCC-02388: arrays not allowed in FROM/WHERE clause of SELECT statement
Cause: A host array was used in the WHERE clause of a SELECT-INTO statement.

Action: Rewrite the SELECT statement without using arrays or use a cursor.

PCC-02389: arrays not allowed as input bind variables in SELECT list
Cause: A host array was used in the SELECT list of a SELECT-INTO statement.

Action: Rewrite the SELECT statement without using arrays in SELECT list.

PCC-02390: no EXEC SQL CONTEXT USE statement encountered
Cause: No EXEC SQL CONTEXT USE statement was encountered and the option THREADS=YES was requested.

Action: Ensure that the necessary context variable (of type sql_context) has been declared and that has been ALLOCATEd and USEd prior to any executable SQL statements.

Note:
This error is only detected by Pro*C/C++ (beginning with release 2.2) and
only if PARSE=FULL.

PCC-02391: runtime context variable not of correct type
Cause: The runtime context variable referenced in an EXEC SQL CONTEXT USE statement is not of type SQL_CONTEXT.

Action: Declare your runtime context to be of type SQL_CONTEXT.

PCC-02392: you are already in an EXEC SQL DECLARE SECTION
Cause: A SQL DECLARE SECTION appears nested inside another one.

Action: Do not nest DECLARE SECTIONS. Remove any nested inner ones.

PCC-02393: SQL statement found inside an EXEC SQL DECLARE SECTION
Cause: An executable SQL statement appears inside a DECLARE SECTION.

Action: Move the SQL statement into the body of a function.

PCC-02394: input file name and output filename are identical
Cause: The values of INAME and ONAME are the same, or the default output filename is the same as that specified by ONAME.

Action: Use ONAME to specify a different filename for the output file.

PCC-02395: using arrays of structs requires that the struct be named
Cause: An array of some unnamed struct was used as a host variable. When using arrays of structs, the struct requires a name or tag.

Action: Provide a name for the struct.

PCC-02396: illegal use of arrays inside an array of structs
Cause: An array of a struct that contained arrays of scalars or two-dimensional char or VARCHAR fields was used as a host variable.

Action: Rewrite the struct so that there are no scalar arrays or two-dimensional char or VARCHAR fields.

PCC-02397: VARCHAR declarations not permitted in #include file
Cause: A VARCHAR declaration was found in a file included using a #include form.

Action: Use the EXEC SQL INCLUDE form to include files with VARCHAR declarations instead.

PCC-02398: indicator ignored in this statement for this type
Cause: An indicator variable was used in a host/indicator variable pair for some type in a statement that did not require or need one. Typically, indicator variables are not used in ALLOCATE and FREE statements for types other than object or collection types. They are also not used in OBJECT CREATE/DEREF statements for REF types.

Action: Remove the use of the indicator for the type in the specified statement. It will be ignored otherwise.

PCC-02399: illegal CHAR_MAP option value for DBMS=V6. Option ignored
Cause: A CHAR_MAP option other than CHAR_MAP=VARCHAR2 was specified inline. Since DBMS=V6, this option is ignored for a character or string variable in the offending statement.

Action: Either set DBMS to something other than V6, or specify CHAR_MAP=VARCHAR2.

PCC-02400: this host variable must be declared as a pointer type
Cause: The specified host variable was not declared as a pointer type.

Action: Declare the host variable to be a pointer type.

PCC-02401: host variable arrays of this type are currently not supported
Cause: Host variable arrays of the specified type are not supported.

Action: Rewrite your program so that there are no arrays of this type.

PCC-02402: Pro*C option OBJECTS=YES is required when using the object cache
Cause: The object cache will be used for this host variable, but OBJECTS=NO was specified on the Pro*C command line.

Action: Specify OBJECTS=YES on the Pro*C command line when using the object cache.

PCC-02403: invalid indicator variable type for this host variable
Cause: The type of the indicator variable is not appropriate for the specified host variable.

Action: Change the type of the indicator variable to a valid type. Refer to the "Programmer's Guide to the ORACLE Pro*C/C++ Precompiler" for a discussion of appropriate indicator variable declarations.

PCC-02404: this indicator variable must be declared as a pointer type
Cause: The specified indicator variable was not declared as pointer type.

Action: Declare the indicator variable to be a pointer type.

PCC-02405: variable is of undefined type
Cause: No declaration was found for the type identifier of the variable.

Action: Provide a valid declaration for the type of the host variable. If using objects in your program, check that the OTT-generated header for the object type was #included and that the typefile was specified in the INTYPE option on the Pro*C command line.

PCC-02406: expecting the form 'RETURN[ING] REF INTO :<ref>;' only
Cause: When using the RETURNING clause in an OBJECT CREATE statement, only a single 'REF INTO :<host variable>;' is expected. This error occurs if the expression list to which REF belongs is greater than one or if there are more than one host variables supplied in the into list.

Action: Rewrite the RETURNING clause as per the given specification.

PCC-02407: object and REF types do not match
Cause: In an OBJECT CREATE or DEREF statement, the types of the given Object and its associated REF do not match.

Action: Make sure that the Object and its REF have the same type. The type information is generated by OTT and should appear in the header file which OTT creates.

PCC-02408: expecting an expression of some Object type
Cause: The expression is not an Object type. For example, many host variable expressions in the Navigational statements require that the variable be declared of some Object type.

Action: Rewrite the expression or declare the variable to be an Object.

PCC-02409: expecting an expression of some REF type
Cause: The expression is not a REF type. For example, some host variables in the Navigational CREATE and DEREF statements are required to be declared of some REF type.

Action: Rewrite the expression or declare the variable to be a REF.

PCC-02410: type of a Collections host variable must resolve to OCIColl
Cause: A bind variable for collections did not resolve to the type OCIColl.

Action: Check that the OTT-generated header for the collections type was properly #included in the Pro*C program and that the typefile was specified in the INTYPE option on the Pro*C command line.

PCC-02411: type of an Object REF host variable must resolve to OCIRef
Cause: A bind variable for object REF did not resolve to the type OCIRef.

Action: Check that the OTT-generated header for the object type was properly #included in the Pro*C program and that the typefile was specified in the INTYPE option on the Pro*C command line.

PCC-02412: FOR clause not permitted in OBJECT GET or SET statement
Cause: An explicit FOR clause was used in an OBJECT GET or OBJECT SET statement. Use of the FOR clause is illegal for these statements.

Action: Remove the FOR clause.

PCC-02413: number of attributes does not match number of host variables
Cause: The number of attributes supplied in the attribute list of an OBJECT SET of GET statement does not match the total number of host variables also supplied in that statement.

Action: Either remove some attributes or remove some host variables from the statement in order to make the total count for each the same.


PCC-02414: this attribute does not exist in the specified Object
Cause: An attribute given in the attribute list of an OBJECT SET or GET statement is not a member of the specified object in that statement.

Action: Remove the attribute from the list.

PCC-02415: cannot manipulate Object attributes in an OBJECT GET or SET
Cause: An attempt was made to either GET or SET an attribute of an Object that itself was an Object or REF type.

Action: Remove the attribute from the attribute list in the statement.

PCC-02416: the Object in an OBJECT GET or SET must not be an array
Cause: The Object specified in an OBJECT GET or SET statement is an array which is illegal.

Action: Redeclare the Object so that it is not an array or subscript the Object so that only a single element of the Object array is specified.

PCC-02417: illegal type conversion between attribute and host variable
Cause: An illegal type conversion was attempted in a Navigational GET or SET statement between the type of the Attribute and the type of the Host Variable.

Action: Change the type of either the Attribute or the Host Variable.

PCC-02418: array size mismatch between Object and REF host variables
Cause: The array sizes of the Object and REF variables in an OBJECT CREATE or DEREF do not match.

Action: Adjust the array dimensions of the two host variables so that they are equal to one another.

PCC-02419: host variable arrays not allowed in an OBJECT SET or GET
Cause: An array was found in the host variable list of an OBJECT SET or GET statement.

Action: Only scalars are allowed (except for single dimensioned char or varchar variables) in the host variable list of an OBJECT SET or GET. Make sure to use only scalars in these statements.

PCC-02420: incomplete (or missing) type specification
Cause: An incomplete or perhaps missing type specification was given when declaring a host variable used in some SQL statement.

Action: Provide a complete type definition when declaring host variables intended for use inside any SQL statements.

PCC-02421: this host variable requires the use of an indicator variable
Cause: No indicator variable was provided (or matched) with a specific host variable where one was explicitely required.

Action: Provide an indicator variable for use with the specified host variable in the given SQL statement.
/*************************************************************************** @file power_data.c @brief @attention Created on: 2025-05-12 Author: YL Monitor Software group @description 功率部件的数据缓存处理模块 ****************************************************************************/ /************************ Includes *************************/ /************************ 宏指令 *************************/ #include “power_data.h” /************************ Private types *************************/ /************************ Private constants *************************/ /************************ 功能结构体 *************************/ typedef enum{ CACHE_L1_LOADING = 0xA1,/正在加载数据/ CACHE_L1_READY = 0xA2,/数据就绪/ CACHE_L1_SENT = 0xA2,/数据已上传至LEVEL2/ }ENUM_CACHE_L1_STATUS; typedef enum{ CACHE_L2_SENDING = 0x55,/数据待上传/ CACHE_L2_SENT = 0xAA,/数据已上传/ }ENUM_CACHE_L2_STATUS; /************************ Private macros *************************/ /************************ Private variables *************************/ /************************ 私有变量 ************************/ #if !SERIAL1_DMARx_ENABLE //禁用DMA1读取 0 / 一级数据缓存:用于功率部件接收数据的实时缓存 */ uint8_t power1_data_cache_L1[POWER_DEVICE_DATA_SIZE] = {0}; static SemaphoreHandle_t mutex_RW_Power1_L1 = NULL; /* 一级缓存当前数据写入位置 */ static uint16_t power1_L1_wPos = 0; /* 一级数据缓存状态 */ static uint16_t power1_L1_status = CACHE_L1_LOADING; #endif #if !SERIAL2_DMARx_ENABLE //禁用DMA2读取 0 /* 一级数据缓存:用于功率部件接收数据的实时缓存 / uint8_t power2_data_cache_L1[POWER_DEVICE_DATA_SIZE] = {0}; static SemaphoreHandle_t mutex_RW_Power2_L1 = NULL; / 一级缓存当前数据写入位置 / static uint16_t power2_L1_wPos = 0; / 一级数据缓存状态 */ static uint16_t power2_L1_status = CACHE_L1_LOADING; #endif /* 二级数据缓存:用于系统状态监控 */ static uint8_t power1_data_cache_L2[POWER_DEVICE_DATA_SIZE] = {0}; static uint8_t power2_data_cache_L2[POWER_DEVICE_DATA_SIZE] = {0}; static SemaphoreHandle_t mutex_RW_Power1_L2 = NULL; static SemaphoreHandle_t mutex_RW_Power2_L2 = NULL; /* 二级数据缓存状态 */ static uint8_t power1_L2_status = CACHE_L2_SENDING; static uint8_t power2_L2_status = CACHE_L2_SENDING; /************************ Functions *************************/ /************************ 功能函数 *************************/ /************************************************************ @funName : MD_SwInitPowerData @Input : NULL @Output : @Description : 数据缓存模块软件资源初始化 @Athor : YL Software Group @Version : V0.0.0 @Data : 2025/5/12 ************************************************************/ void MD_SwInitPowerData(void) { #if !SERIAL1_DMARx_ENABLE if(NULL == mutex_RW_Power1_L1) { mutex_RW_Power1_L1 = xSemaphoreCreateBinary(); / 数据读写互斥量创建失败 */ if(NULL == mutex_RW_Power1_L1) { } else { /* 释放数据读写互斥量 */ xSemaphoreGive(mutex_RW_Power1_L1); } } #endif #if SERIAL2_DMARx_ENABLE #else if(NULL == mutex_RW_Power2_L1) { mutex_RW_Power2_L1 = xSemaphoreCreateBinary(); /* 数据读写互斥量创建失败 */ if(NULL == mutex_RW_Power2_L1) { } else { /* 释放数据读写互斥量 */ xSemaphoreGive(mutex_RW_Power2_L1); } } #endif if(NULL == mutex_RW_Power1_L2) { mutex_RW_Power1_L2 = xSemaphoreCreateBinary(); /* 数据读写互斥量创建失败 */ if(NULL == mutex_RW_Power1_L2) { } else { /* 释放数据读写互斥量 */ xSemaphoreGive(mutex_RW_Power1_L2); } } if(NULL == mutex_RW_Power2_L2) { mutex_RW_Power2_L2 = xSemaphoreCreateBinary(); /* 数据读写互斥量创建失败 */ if(NULL == mutex_RW_Power2_L2) { } else { /* 释放数据读写互斥量 */ xSemaphoreGive(mutex_RW_Power2_L2); } } } /************************************************************ @funName : MD_UpdatePowerL2 @Input : device-功率部件序号 @Output : @Description : 更新功率部件二级缓存数据 @Athor : YL Software Group @Version : V0.0.0 @Data : 2025/5/12 *************************************************************/ void MD_UpdatePowerL2(const uint8_t device) { switch(device) { case POWER_DEVICE_1: { #if SERIAL1_DMARx_ENABLE if(BSP_GetRecvSize4Serial1() >= POWER_DEVICE_DATA_SIZE) { uint8_t rbuf[POWER_DEVICE_DATA_SIZE] = {0}; uint16_t rlen = 0; BSP_Recv4Serial1(rbuf, &rlen); if(rlen >= POWER_DEVICE_DATA_SIZE){ portBASE_TYPE xRecvWoken = pdFALSE; xSemaphoreTakeFromISR(mutex_RW_Power1_L2, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); memcpy((uint8_t*)power1_data_cache_L2, (uint8_t*)rbuf, POWER_DEVICE_DATA_SIZE); power1_L2_status = CACHE_L2_SENDING;/* 待发送 */ xRecvWoken = pdFALSE; xSemaphoreGiveFromISR(mutex_RW_Power1_L2, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); } } #else if(CACHE_L1_READY == power1_L1_status) { portBASE_TYPE xRecvWoken = pdFALSE; xSemaphoreTakeFromISR(mutex_RW_Power1_L2, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); memcpy((uint8_t*)power1_data_cache_L2, (uint8_t*)power1_data_cache_L1, POWER_DEVICE_DATA_SIZE); power1_L1_status = CACHE_L1_SENT; power1_L2_status = CACHE_L2_SENDING;/* 待发送 */ xRecvWoken = pdFALSE; xSemaphoreGiveFromISR(mutex_RW_Power1_L2, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); } #endif }break; case POWER_DEVICE_2: { #if SERIAL2_DMARx_ENABLE if(BSP_GetRecvSize4Serial2() >= POWER_DEVICE_DATA_SIZE) { uint8_t rbuf[POWER_DEVICE_DATA_SIZE] = {0}; uint16_t rlen = 0; BSP_Recv4Serial2(rbuf, &rlen); if(rlen >= POWER_DEVICE_DATA_SIZE){ portBASE_TYPE xRecvWoken = pdFALSE; xSemaphoreTakeFromISR(mutex_RW_Power2_L2, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); memcpy((uint8_t*)power2_data_cache_L2, (uint8_t*)rbuf, POWER_DEVICE_DATA_SIZE); power2_L2_status = CACHE_L2_SENDING;/* 待发送 */ xRecvWoken = pdFALSE; xSemaphoreGiveFromISR(mutex_RW_Power2_L2, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); } } #else if(CACHE_L1_READY == power2_L1_status) { portBASE_TYPE xRecvWoken = pdFALSE; xSemaphoreTakeFromISR(mutex_RW_Power2_L2, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); memcpy((uint8_t*)power2_data_cache_L2, (uint8_t*)power2_data_cache_L1, POWER_DEVICE_DATA_SIZE); power1_L1_status = CACHE_L1_SENT; power2_L2_status = CACHE_L2_SENDING;/* 待发送 */ xRecvWoken = pdFALSE; xSemaphoreGiveFromISR(mutex_RW_Power2_L2, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); } #endif }break; } } /************************************************************ @funName : MD_UpdatePowerL1 @Input : device-功率部件序号 bFirst-是否为第一个数据 wbuf-数据 wlen-数据长度 @Output : @Description : 更新功率部件一级缓存数据 @Athor : YL Software Group @Version : V0.0.0 @Data : 2025/5/12 ************************************************************/ //static uint8_t byte = 0; void MD_UpdatePowerL1(const uint8_t device, const bool bFirst, const uint8_t wbuf, const uint16_t wlen) { uint16_t len = wlen; if(wlen <= 0) { return; } switch(device) { case POWER_DEVICE_1: { #if SERIAL1_DMARx_ENABLE #else if(bFirst) { power1_L1_status = CACHE_L1_LOADING; power1_L1_wPos = 0; memset((uint8_t*)power1_data_cache_L1, 0, POWER_DEVICE_DATA_SIZE); } if(len > POWER_DEVICE_DATA_SIZE - power1_L1_wPos) { len = POWER_DEVICE_DATA_SIZE - power1_L1_wPos; } portBASE_TYPE xRecvWoken = pdFALSE; xSemaphoreTakeFromISR(mutex_RW_Power1_L1, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); memcpy((uint8_t*)&power1_data_cache_L1[power1_L1_wPos], wbuf, len); power1_L1_wPos += len; xRecvWoken = pdFALSE; xSemaphoreGiveFromISR(mutex_RW_Power1_L1, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); if(POWER_DEVICE_DATA_SIZE <= power1_L1_wPos) { power1_L1_status = CACHE_L1_READY; } #endif }break; case POWER_DEVICE_2: { #if SERIAL2_DMARx_ENABLE #else if(bFirst) { power2_L1_status = CACHE_L1_LOADING; power2_L1_wPos = 0; memset((uint8_t*)power2_data_cache_L1, 0, POWER_DEVICE_DATA_SIZE); } if(len > POWER_DEVICE_DATA_SIZE - power2_L1_wPos) { len = POWER_DEVICE_DATA_SIZE - power2_L1_wPos; } portBASE_TYPE xRecvWoken = pdFALSE; xSemaphoreTakeFromISR(mutex_RW_Power2_L1, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); memcpy((uint8_t*)&power2_data_cache_L1[power2_L1_wPos], wbuf, len); power2_L1_wPos += len; xRecvWoken = pdFALSE; xSemaphoreGiveFromISR(mutex_RW_Power2_L1, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); if(POWER_DEVICE_DATA_SIZE <= power2_L1_wPos) { power2_L1_status = CACHE_L1_READY; } #endif }break; } } /功率部件一级缓存数据/ /************************************************************ @funName : MD_ReadPowerL2 @Input : device-功率部件序号 rbuf-数据输出缓存 pos-数据读取位置 rlen-数据读取长度 @Output : @Description : 获取功率部件二级缓存数据 @Athor : YL Software Group @Version : V0.0.0 @Data : 2025/5/13 *************************************************************/ bool MD_ReadPowerL2(const uint8_t device, uint8_t *rbuf, const uint16_t pos, const uint16_t rlen) { if(rlen > POWER_DEVICE_DATA_SIZE || pos >= POWER_DEVICE_DATA_SIZE || POWER_DEVICE_DATA_SIZE - pos < rlen) { return false; } switch(device) { case POWER_DEVICE_1: { xSemaphoreTake(mutex_RW_Power1_L2, portMAX_DELAY); memcpy(rbuf, (uint8_t*)&power1_data_cache_L2[pos], rlen); xSemaphoreGive(mutex_RW_Power1_L2); }break; case POWER_DEVICE_2: { xSemaphoreTake(mutex_RW_Power2_L2, portMAX_DELAY); memcpy(rbuf, (uint8_t*)&power2_data_cache_L2[pos], rlen); xSemaphoreGive(mutex_RW_Power2_L2); }break; } return true; } /************************************************************ @funName : MD_GetPowerL2 @Input : device-功率部件序号 rbuf-数据缓存地址 @Output : @Description : 获取功率部件二级缓存地址 @Athor : YL Software Group @Version : V0.0.0 @Data : 2025/5/13 ***********************************************************/ uint8_t MD_GetPowerL2(const uint8_t device) { uint8_t addr = NULL; switch(device) { case POWER_DEVICE_1: { xSemaphoreTake(mutex_RW_Power1_L2, portMAX_DELAY); if(CACHE_L2_SENDING != power1_L2_status) { addr = NULL; } else { power1_L2_status = CACHE_L2_SENT; addr = power1_data_cache_L2; } xSemaphoreGive(mutex_RW_Power1_L2); }break; case POWER_DEVICE_2: { xSemaphoreTake(mutex_RW_Power2_L2, portMAX_DELAY); if(CACHE_L2_SENDING != power2_L2_status) { addr = NULL; } else{ power2_L2_status = CACHE_L2_SENT; addr = power2_data_cache_L2; } xSemaphoreGive(mutex_RW_Power1_L2); }break; } return addr; } /************************ End of file / /************************************************** @file fw_data.h @brief This file contains the macros & function about real data for framework & App. @attention Created on: 2025-05-30 Author: YL Monitor Software group @description ****************************************************************************/ /*************************************************************************** * @file fw_data.h * @brief This file contains the macros & function about real data for framework & App. * **************************************************************************** * @attention * * Created on: 2025-05-30 * Author: YL Monitor Software group * **************************************************************************** * @description * * * ****************************************************************************/ #ifndef __FW_DATA_H_ #define __FW_DATA_H_ #ifdef __cplusplus extern "C" { #endif /************************ Includes *************************/ #include "main.h" /************************ Exportd types ********************/ typedef struct{ uint8_t byte_H; uint8_t byte_L; }Power_Bits16; typedef struct{ uint8_t byte0; uint8_t byte1; uint8_t byte2; uint8_t byte3; }Power_Bits32; /* 功率部件系统参数 */ typedef struct{ /* word 0 */ Power_Bits16 Reserved0; //0-预留 /* word 1 */ Power_Bits16 SYSCTRL; //1-系统控制 /* word 2 */ Power_Bits16 Flag; //2-系统状态标志 /* word 3 */ Power_Bits16 ProtectHard_PROHARD; //3-硬件保护标志 /* word 4 */ Power_Bits16 ProtectSoft_PROSOFT; //4-软件保护标志 /* word 5 */ Power_Bits16 ProtectDrive_PRODRIVE; //5-驱动保护标志 /* word 6 */ Power_Bits16 ProtectComm_PROCOMM; //6-通信保护标志 /* word 7 */ Power_Bits16 INVCTRL; //7-逆变器控制 /* word 8 */ Power_Bits16 Reserved8; //预留 /* word 9 */ Power_Bits16 Reserved9; //预留 /* word 10 */ Power_Bits16 Reserved10; //预留 /* word 11-12 */ Power_Bits32 GPADAT; //GPIO0~31状态 /* word 13-14*/ Power_Bits32 GPBDAT; //GPIO32~63状态 /* word 15-16 */ Power_Bits32 GPCDAT; //GPIO64~87状态 /* word 17 */ Power_Bits16 Reserved17; //预留 /* word 18 */ Power_Bits16 Reserved18; //预留 /* word 19 */ Power_Bits16 Reserved19; //预留 /* word 20 */ Power_Bits16 OSC_CLK_FRQ; //外部晶振频率 /* word 21 */ Power_Bits16 SYS_CLK_FRQ; //系统时钟频率 /* word 22 */ Power_Bits16 SYS_TICK; //定时器时钟基准 /* word 23 */ Power_Bits16 SET_F_PWM; //开关频率 /* word 24 */ Power_Bits16 Reserved24; //预留 /* word 25 */ Power_Bits16 SysMode; //工作模式 /* word 26 */ Power_Bits16 SysState; //工作状态 /* word 27 */ Power_Bits16 SysStartMode; //启动方式 /* word 28*/ Power_Bits16 SysStartStopControl; //启停控制指令来源 /* word 29*/ Power_Bits16 SysCommandSource; //系统频率指令来源 /* word 30*/ Power_Bits16 ModID; //模块编号 /* word 31*/ Power_Bits16 SETUP_UOUT; //电压设定值 /* word 32*/ Power_Bits16 SETUP_IOUT; //电流设定值 /* word 33*/ Power_Bits16 SETUP_FREQ; //频率设定值 /* word 34*/ Power_Bits16 SOFTSTART_TIME; //软件起动时间 /* word 35*/ Power_Bits16 STEP_UOUT; //电压步长 /* word 36*/ Power_Bits16 STEP_IOUT; //电流步长 /* word 37*/ Power_Bits16 STEP_FREQ; //频率步长 /* word 38 */ Power_Bits16 STEP_ANGLE; //相角步长 /* word 39 */ Power_Bits16 POINTCYCLE; //周波点数 /* word 40 */ Power_Bits16 REF_UOUT; //电压给定值 /* word 41 */ Power_Bits16 REF_IOUT; //电流给定值 /* word 42 */ Power_Bits16 REF_FREQ; //频率给定值 /* word 43 */ Power_Bits16 REF_ANGLE; //实时相角 /* word 44 */ Power_Bits16 KPWMA; //A相调制系数 /* word 45 */ Power_Bits16 KPWMB; //B相调制系数 /* word 46 */ Power_Bits16 KPWMC; //C相调制系数 /* word 47 */ Power_Bits16 Effective_Uin; //输入电压有效值 /* word 48 */ Power_Bits16 Effective_Iin; //输入电流有效值 /* word 49 */ Power_Bits16 Effective_Udc; //直流母线电压有效值 /* word 50 */ Power_Bits16 Effective_Uout1; //A相输出电压有效值 /* word 51 */ Power_Bits16 Effective_Uout2; //B相输出电压有效值 /* word 52 */ Power_Bits16 Effective_Uout3; //C相输出电压有效值 /* word 53 */ Power_Bits16 Effective_Iout1; //A相输出电流有效值 /* word 54 */ Power_Bits16 Effective_Iout2; //B相输出电流有效值 /* word 55 */ Power_Bits16 Effective_Iout3; //C相输出电流有效值 /* word 56 */ Power_Bits16 Effective_IL1; //A相电感电流有效值 /* word 57 */ Power_Bits16 Effective_IL2; //B相电感电流有效值 /* word 58 */ Power_Bits16 Effective_IL3; //C相电感电流有效值 /* word 59 */ Power_Bits16 Effective_UinC; //备用电源电压有效值 /* word 60 */ Power_Bits16 Effective_UoutSet; //输出电压设定值(模拟) /* word 61 */ Power_Bits16 Effective_IoutSet; //输出电流设定值(模拟) /* word 62 */ Power_Bits16 Reserved62; //预留 /* word 63 */ Power_Bits16 Effective_FreqSet; //输出电压频率设定值(模拟) /* word 64 */ Power_Bits16 PIDU1_hReference; //PIDU1给定值 /* word 65 */ Power_Bits16 PIDI1_hPresentFeedback; //PIDI1反馈值 /* word 66 */ Power_Bits16 PIDI1_hReference; //PIDI1输出值 /* word 67 */ Power_Bits16 PIDU1_hKp_Gain; //PIDU1参数kp /* word 68*/ Power_Bits16 PIDU1_hKi_Gain; //PIDU1参数ki /* word 69*/ Power_Bits16 PIDU1_hKd_Gain; //PIDU1参数kd /* word 70*/ Power_Bits32 PIDU1_wLower_Limit_Integral; //PIDU1积分下限值 /* word 71*/ Power_Bits32 PIDU1_wUpper_Limit_Integral; //PIDU1积分上限值 /* word 72*/ Power_Bits16 PIDU1_hLower_Limit_Output; //PIDU1输出下限值 /* word 73*/ Power_Bits16 PIDU1_hUpper_Limit_Output; //PIDU1输出上限值 /* word 74*/ Power_Bits16 PIDU2_hReference; //PIDU2给定值 /* word 75*/ Power_Bits16 PIDU2_hPresentFeedback; //PIDU2反馈值 /* word 76*/ Power_Bits16 PIDI2_hReference; //PIDI2输出值 /* word 77*/ Power_Bits16 PIDU2_hKp_Gain; //PIDU2参数kp /* word 78*/ Power_Bits16 PIDU2_hKi_Gain; //PIDU2参数ki /* word 79*/ Power_Bits16 PIDU2_hKd_Gain; //PIDU2参数kd /* word 80*/ Power_Bits32 PIDU2_wLower_Limit_Integral; //PIDU2积分下限值 /* word 81*/ Power_Bits32 PIDU2_wUpper_Limit_Integral; //PIDU2积分上限值 /* word 82*/ Power_Bits16 PIDU2_hLower_Limit_Output; //PIDU2输出下限值 /* word 83*/ Power_Bits16 PIDU2_hUpper_Limit_Output; //PIDU2输出上限值 /* word 84 */ Power_Bits16 PIDI1hReference; //PIDI1给定值 /* word 85 */ Power_Bits16 PIDI1hPresentFeedback; //PIDI1反馈值 /* word 86 */ Power_Bits16 iParkUref_Ds; //PIDI1输出值 /* word 87 */ Power_Bits16 PIDI1_hKp_Gain; //PIDI1参数kp /* word 88*/ Power_Bits16 PIDI1_hKi_Gain; //PIDI1参数ki /* word 89*/ Power_Bits16 PIDI1_hKd_Gain; //PIDI1参数kd /* word 90*/ Power_Bits32 PIDI1_wLower_Limit_Integral; //PIDI1积分下限值 /* word 91*/ Power_Bits32 PIDI1_wUpper_Limit_Integral; //PIDI1积分上限值 /* word 92*/ Power_Bits16 PIDI1_hLower_Limit_Output; //PIDI1输出下限值 /* word 93*/ Power_Bits16 PIDI1_hUpper_Limit_Output; //PIDI1输出上限值 /* word 94 */ Power_Bits16 PIDI2hReference; //PIDI2给定值 /* word 95 */ Power_Bits16 PIDI2_hPresentFeedback; //PIDI2反馈值 /* word 96 */ Power_Bits16 iParkUref_Qs; //输出值 /* word 97 */ Power_Bits16 PIDI2_hKp_Gain; //PIDI2参数kp /* word 98*/ Power_Bits16 PIDI2_hKi_Gain; //PIDI2参数ki /* word 99*/ Power_Bits16 PIDI2_hKd_Gain; //PIDI2参数kd /* word 100*/ Power_Bits32 PIDI2_wLower_Limit_Integral; //PIDI2积分下限值 /* word 101*/ Power_Bits32 PIDI2_wUpper_Limit_Integral; //PIDI2积分上限值 /* word 102*/ Power_Bits16 PIDI2_hLower_Limit_Output; //PIDI2输出下限值 /* word 103*/ Power_Bits16 PIDI2_hUpper_Limit_Output; //PIDI2输出上限值 /* word 104 */ Power_Bits16 PIDPARA_hReference; //PIDPARA给定值 /* word 105 */ Power_Bits16 PIDPARA_hPresentFeedback; //PIDPARA反馈值 /* word 106 */ Power_Bits16 Reserved106; //PIDPARA输出值 /* word 107 */ Power_Bits16 PIDPARA_hKp_Gain; //PIDPARA参数kp /* word 108*/ Power_Bits16 PIDPARA_hKi_Gain; //PIDPARA参数ki /* word 109*/ Power_Bits16 PIDPARA_hKd_Gain; //PIDPARA参数kd /* word 110*/ Power_Bits32 PIDPARA_wLower_Limit_Integral;//PIDPARA积分下限值 /* word 111*/ Power_Bits32 PIDPARA_wUpper_Limit_Integral;//PIDPARA积分上限值 /* word 112*/ Power_Bits16 PIDPARA_hLower_Limit_Output; //PIDPARA输出下限值 /* word 113*/ Power_Bits16 PIDPARA_hUpper_Limit_Output; //PIDPARA输出上限值 /* word 114 */ Power_Bits16 PIDPLL_hReference; //PIDPLL给定值 /* word 115 */ Power_Bits16 PIDPLL_hPresentFeedback; //PIDPLL反馈值 /* word 116 */ Power_Bits16 Reserved116; //PIDPLL输出值 /* word 117 */ Power_Bits16 PIDPLL_hKp_Gain; //PIDPLL参数kp /* word 118*/ Power_Bits16 PIDPLL_hKi_Gain; //PIDPLL参数ki /* word 119*/ Power_Bits16 PIDPLL_hKd_Gain; //PIDPLL参数kd /* word 120*/ Power_Bits32 PIDPLL_wLower_Limit_Integral; //PIDPLL积分下限值 /* word 121*/ Power_Bits32 PIDPLL_wUpper_Limit_Integral; //PIDPLL积分上限值 /* word 122*/ Power_Bits16 PIDPLL_hLower_Limit_Output; //PIDPLL输出下限值 /* word 123*/ Power_Bits16 PIDPLL_hUpper_Limit_Output; //PIDPLL输出上限值 /* word 124 */ Power_Bits16 Reserved124; //输出变压器变比 /* word 125 */ Power_Bits16 Reserved125; //变压器等效电抗 /* word 126 */ Power_Bits16 Reserved126; //变压器等效电阻 /* word 127 */ Power_Bits16 Reserved127; //预留 /* word 128 */ Power_Bits16 FdOverUin_ValLimitHi; //输入过压保护值 /* word 129 */ Power_Bits16 FdUnderUin_ValLimitHi; //输入欠压保护值 /* word 130 */ Power_Bits16 FdOverIin_ValLimitHi; //输入过流保护值 /* word 131 */ Power_Bits16 FdOverUo1_ValLimitHi; //输出过压保护值 /* word 132 */ Power_Bits16 FdOverIo1_ValLimitHi; //输出过流保护值 /* word 133 */ Power_Bits16 FdOverIL1_ValLimitHi; //电感过流保护值 /* word 134 */ Power_Bits16 Reserved134; //短路保护电压动作值 /* word 135 */ Power_Bits16 Reserved135; //短路保护电流动作值 /* word 136 */ Power_Bits16 Reserved136; //短路保护电压返回值 /* word 137 */ Power_Bits16 Reserved137; //短路保护电流返回值 /* word 138 */ Power_Bits16 Reserved138; //短路运行时间 /* word 139 */ Power_Bits16 Reserved139; //110%过载保护限值 /* word 140 */ Power_Bits16 Reserved140; //110%过载保护时间 /* word 141 */ Power_Bits16 Reserved141; //110%过载保护倒计时 /* word 142 */ Power_Bits16 Reserved142; //120%过载保护限值 /* word 143 */ Power_Bits16 Reserved143; //120%过载保护时间 /* word 144 */ Power_Bits16 Reserved144; //120%过载保护倒计时 /* word 145 预留*/ Power_Bits16 Reserved145; /* word 146 AD结果寄存器数据(CH0)*/ Power_Bits16 AdcRegs_ADCRESULT0; /* word 147 */ Power_Bits16 AdcRegs_ADCRESULT1; //AD结果寄存器数据(CH1) /* word 148 */ Power_Bits16 AdcRegs_ADCRESULT2; //AD结果寄存器数据(CH2) /* word 149 */ Power_Bits16 AdcRegs_ADCRESULT3; //AD结果寄存器数据(CH3) /* word 150 */ Power_Bits16 AdcRegs_ADCRESULT4; //AD结果寄存器数据(CH4) /* word 151 */ Power_Bits16 AdcRegs_ADCRESULT5; //AD结果寄存器数据(CH5) /* word 152 */ Power_Bits16 AdcRegs_ADCRESULT6; //AD结果寄存器数据(CH6) /* word 153 */ Power_Bits16 AdcRegs_ADCRESULT7; //AD结果寄存器数据(CH7) /* word 154 */ Power_Bits16 AdcRegs_ADCRESULT8; //AD结果寄存器数据(CH8) /* word 155 */ Power_Bits16 AdcRegs_ADCRESULT9; //AD结果寄存器数据(CH9) /* word 156 */ Power_Bits16 AdcRegs_ADCRESULT10; //AD结果寄存器数据(CH10) /* word 157 */ Power_Bits16 AdcRegs_ADCRESULT11; //AD结果寄存器数据(CH11) /* word 158 */ Power_Bits16 AdcRegs_ADCRESULT12; //AD结果寄存器数据(CH12) /* word 159 */ Power_Bits16 AdcRegs_ADCRESULT13; //AD结果寄存器数据(CH13) /* word 160 */ Power_Bits16 AdcRegs_ADCRESULT14; //AD结果寄存器数据(CH14) /* word 161 */ Power_Bits16 AdcRegs_ADCRESULT15; //AD结果寄存器数据(CH15) /* word 162 预留*/ Power_Bits16 Reserved162; /* word 163 预留*/ Power_Bits16 Reserved163; /* word 164 预留*/ Power_Bits16 Reserved164; /* word 165 预留*/ Power_Bits16 Reserved165; /* word 166 预留*/ Power_Bits16 Reserved166; /* word 167 预留*/ Power_Bits16 Reserved167; /* word 168 预留*/ Power_Bits16 Reserved168; /* word 169预留 */ Power_Bits16 Reserved169; /* word 170 预留*/ Power_Bits16 Reserved170; /* word 171 预留*/ Power_Bits16 Reserved171; /* word 172 预留*/ Power_Bits16 Reserved172; /* word 173 预留*/ Power_Bits16 Reserved173; /* word 174 预留*/ Power_Bits16 Reserved174; /* word 175 预留*/ Power_Bits16 Reserved175; /* word 176 预留*/ Power_Bits16 Reserved176; /* word 177 预留*/ Power_Bits16 Reserved177; /* word 178 预留*/ Power_Bits16 Reserved178; /* word 179 预留*/ Power_Bits16 Reserved179; /* word 180 输入电压传感器采样范围*/ Power_Bits16 PEAK_UIN_SENSOR; /* word 181 输入电流传感器采样范围*/ Power_Bits16 PEAK_IIN_SENSOR; /* word 182 输出电压传感器采样范围*/ Power_Bits16 PEAK_UO_SENSOR; /* word 183 输出电流传感器采样范围*/ Power_Bits16 PEAK_IO_SENSOR; /* word 184 电感电流传感器采样范围*/ Power_Bits16 PEAK_IL_SENSOR; /* word 185 预留*/ Power_Bits16 Reserved185; /* word 186 预留*/ Power_Bits16 Reserved186; /* word 187 预留*/ Power_Bits16 Reserved187; /* word 188 预留*/ Power_Bits16 Reserved188; /* word 189 预留*/ Power_Bits16 Reserved189; /* word 190 通道选择*/ Power_Bits16 ChannelSelect; /* word 191 预留*/ Power_Bits16 Reserved191; /* word 192 预留*/ Power_Bits16 Reserved192; /* word 193 地址偏移量*/ Power_Bits16 AddressOffset; /* word 194 预留*/ Power_Bits16 Reserved194; /* word 195 预留*/ Power_Bits16 Reserved195; /* word 196 预留*/ Power_Bits16 Reserved196; /* word 197 预留*/ Power_Bits16 Reserved197; /* word 198 预留*/ Power_Bits16 Reserved198; /* word 199 网络通讯协议控制*/ Power_Bits16 Modbus_Control_ModbusCtrl; }Power_System_Type; STM32F105 power_data.c程序的二级缓存的400字节的数据准确的映射给fw_data.h程序中的Power_System_Type结构体中,然后去调用结构体的某一个数据,需要频繁访问结构体中的某个字段,可以将其缓存到局部变量中,减少多次访问互斥锁的开销,用标准库写出详细代码和注释,优化的建议也写入代码中,别单独提出来
最新发布
06-06
/*************************************************************************** * @file power_data.c * @brief * **************************************************************************** * @attention * * Created on: 2025-05-12 * Author: YL Monitor Software group * **************************************************************************** * @description * 功率部件的数据缓存处理模块 * * ****************************************************************************/ /************************ Includes *************************/ /************************ 宏指令 *************************/ #include "power_data.h" /************************ Private types *************************/ /************************ Private constants *************************/ /************************ 功能结构体 *************************/ typedef enum{ CACHE_L1_LOADING = 0xA1,/*正在加载数据*/ CACHE_L1_READY = 0xA2,/*数据就绪*/ CACHE_L1_SENT = 0xA2,/*数据已上传至LEVEL2*/ }ENUM_CACHE_L1_STATUS; typedef enum{ CACHE_L2_SENDING = 0x55,/*数据待上传*/ CACHE_L2_SENT = 0xAA,/*数据已上传*/ }ENUM_CACHE_L2_STATUS; /************************ Private macros *************************/ /************************ Private variables *************************/ /************************ 私有变量 *************************/ #if !SERIAL1_DMARx_ENABLE //禁用DMA1读取 0 /* 一级数据缓存:用于功率部件接收数据的实时缓存 */ uint8_t power1_data_cache_L1[POWER_DEVICE_DATA_SIZE] = {0}; static SemaphoreHandle_t mutex_RW_Power1_L1 = NULL; /* 一级缓存当前数据写入位置 */ static uint16_t power1_L1_wPos = 0; /* 一级数据缓存状态 */ static uint16_t power1_L1_status = CACHE_L1_LOADING; #endif #if !SERIAL2_DMARx_ENABLE //禁用DMA2读取 0 /* 一级数据缓存:用于功率部件接收数据的实时缓存 */ uint8_t power2_data_cache_L1[POWER_DEVICE_DATA_SIZE] = {0}; static SemaphoreHandle_t mutex_RW_Power2_L1 = NULL; /* 一级缓存当前数据写入位置 */ static uint16_t power2_L1_wPos = 0; /* 一级数据缓存状态 */ static uint16_t power2_L1_status = CACHE_L1_LOADING; #endif /* 二级数据缓存:用于系统状态监控 */ static uint8_t power1_data_cache_L2[POWER_DEVICE_DATA_SIZE] = {0}; static uint8_t power2_data_cache_L2[POWER_DEVICE_DATA_SIZE] = {0}; static SemaphoreHandle_t mutex_RW_Power1_L2 = NULL; static SemaphoreHandle_t mutex_RW_Power2_L2 = NULL; /* 二级数据缓存状态 */ static uint8_t power1_L2_status = CACHE_L2_SENDING; static uint8_t power2_L2_status = CACHE_L2_SENDING; /************************ Functions *************************/ /************************ 功能函数 *************************/ /************************************************************ * @funName : MD_SwInitPowerData * @Input : NULL * * @Output : ***************** * @Description : 数据缓存模块软件资源初始化 * * ***************** * @Athor : YL Software Group * @Version : V0.0.0 * @Data : 2025/5/12 * *************************************************************/ void MD_SwInitPowerData(void) { #if !SERIAL1_DMARx_ENABLE if(NULL == mutex_RW_Power1_L1) { mutex_RW_Power1_L1 = xSemaphoreCreateBinary(); /* 数据读写互斥量创建失败 */ if(NULL == mutex_RW_Power1_L1) { } else { /* 释放数据读写互斥量 */ xSemaphoreGive(mutex_RW_Power1_L1); } } #endif #if SERIAL2_DMARx_ENABLE #else if(NULL == mutex_RW_Power2_L1) { mutex_RW_Power2_L1 = xSemaphoreCreateBinary(); /* 数据读写互斥量创建失败 */ if(NULL == mutex_RW_Power2_L1) { } else { /* 释放数据读写互斥量 */ xSemaphoreGive(mutex_RW_Power2_L1); } } #endif if(NULL == mutex_RW_Power1_L2) { mutex_RW_Power1_L2 = xSemaphoreCreateBinary(); /* 数据读写互斥量创建失败 */ if(NULL == mutex_RW_Power1_L2) { } else { /* 释放数据读写互斥量 */ xSemaphoreGive(mutex_RW_Power1_L2); } } if(NULL == mutex_RW_Power2_L2) { mutex_RW_Power2_L2 = xSemaphoreCreateBinary(); /* 数据读写互斥量创建失败 */ if(NULL == mutex_RW_Power2_L2) { } else { /* 释放数据读写互斥量 */ xSemaphoreGive(mutex_RW_Power2_L2); } } } /************************************************************ * @funName : MD_UpdatePowerL2 * @Input : device-功率部件序号 * * @Output : ***************** * @Description : 更新功率部件二级缓存数据 * * ***************** * @Athor : YL Software Group * @Version : V0.0.0 * @Data : 2025/5/12 * *************************************************************/ void MD_UpdatePowerL2(const uint8_t device) { switch(device) { case POWER_DEVICE_1: { #if SERIAL1_DMARx_ENABLE if(BSP_GetRecvSize4Serial1() >= POWER_DEVICE_DATA_SIZE) { uint8_t rbuf[POWER_DEVICE_DATA_SIZE] = {0}; uint16_t rlen = 0; BSP_Recv4Serial1(rbuf, &rlen); if(rlen >= POWER_DEVICE_DATA_SIZE){ portBASE_TYPE xRecvWoken = pdFALSE; xSemaphoreTakeFromISR(mutex_RW_Power1_L2, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); memcpy((uint8_t*)power1_data_cache_L2, (uint8_t*)rbuf, POWER_DEVICE_DATA_SIZE); power1_L2_status = CACHE_L2_SENDING;/* 待发送 */ xRecvWoken = pdFALSE; xSemaphoreGiveFromISR(mutex_RW_Power1_L2, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); } } #else if(CACHE_L1_READY == power1_L1_status) { portBASE_TYPE xRecvWoken = pdFALSE; xSemaphoreTakeFromISR(mutex_RW_Power1_L2, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); memcpy((uint8_t*)power1_data_cache_L2, (uint8_t*)power1_data_cache_L1, POWER_DEVICE_DATA_SIZE); power1_L1_status = CACHE_L1_SENT; power1_L2_status = CACHE_L2_SENDING;/* 待发送 */ xRecvWoken = pdFALSE; xSemaphoreGiveFromISR(mutex_RW_Power1_L2, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); } #endif }break; case POWER_DEVICE_2: { #if SERIAL2_DMARx_ENABLE if(BSP_GetRecvSize4Serial2() >= POWER_DEVICE_DATA_SIZE) { uint8_t rbuf[POWER_DEVICE_DATA_SIZE] = {0}; uint16_t rlen = 0; BSP_Recv4Serial2(rbuf, &rlen); if(rlen >= POWER_DEVICE_DATA_SIZE){ portBASE_TYPE xRecvWoken = pdFALSE; xSemaphoreTakeFromISR(mutex_RW_Power2_L2, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); memcpy((uint8_t*)power2_data_cache_L2, (uint8_t*)rbuf, POWER_DEVICE_DATA_SIZE); power2_L2_status = CACHE_L2_SENDING;/* 待发送 */ xRecvWoken = pdFALSE; xSemaphoreGiveFromISR(mutex_RW_Power2_L2, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); } } #else if(CACHE_L1_READY == power2_L1_status) { portBASE_TYPE xRecvWoken = pdFALSE; xSemaphoreTakeFromISR(mutex_RW_Power2_L2, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); memcpy((uint8_t*)power2_data_cache_L2, (uint8_t*)power2_data_cache_L1, POWER_DEVICE_DATA_SIZE); power1_L1_status = CACHE_L1_SENT; power2_L2_status = CACHE_L2_SENDING;/* 待发送 */ xRecvWoken = pdFALSE; xSemaphoreGiveFromISR(mutex_RW_Power2_L2, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); } #endif }break; } } /************************************************************ * @funName : MD_UpdatePowerL1 * @Input : device-功率部件序号 * bFirst-是否为第一个数据 * wbuf-数据 * wlen-数据长度 * * @Output : ***************** * @Description : 更新功率部件一级缓存数据 * * ***************** * @Athor : YL Software Group * @Version : V0.0.0 * @Data : 2025/5/12 * *************************************************************/ //static uint8_t byte = 0; void MD_UpdatePowerL1(const uint8_t device, const bool bFirst, const uint8_t* wbuf, const uint16_t wlen) { uint16_t len = wlen; if(wlen <= 0) { return; } switch(device) { case POWER_DEVICE_1: { #if SERIAL1_DMARx_ENABLE #else if(bFirst) { power1_L1_status = CACHE_L1_LOADING; power1_L1_wPos = 0; memset((uint8_t*)power1_data_cache_L1, 0, POWER_DEVICE_DATA_SIZE); } if(len > POWER_DEVICE_DATA_SIZE - power1_L1_wPos) { len = POWER_DEVICE_DATA_SIZE - power1_L1_wPos; } portBASE_TYPE xRecvWoken = pdFALSE; xSemaphoreTakeFromISR(mutex_RW_Power1_L1, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); memcpy((uint8_t*)&power1_data_cache_L1[power1_L1_wPos], wbuf, len); power1_L1_wPos += len; xRecvWoken = pdFALSE; xSemaphoreGiveFromISR(mutex_RW_Power1_L1, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); if(POWER_DEVICE_DATA_SIZE <= power1_L1_wPos) { power1_L1_status = CACHE_L1_READY; } #endif }break; case POWER_DEVICE_2: { #if SERIAL2_DMARx_ENABLE #else if(bFirst) { power2_L1_status = CACHE_L1_LOADING; power2_L1_wPos = 0; memset((uint8_t*)power2_data_cache_L1, 0, POWER_DEVICE_DATA_SIZE); } if(len > POWER_DEVICE_DATA_SIZE - power2_L1_wPos) { len = POWER_DEVICE_DATA_SIZE - power2_L1_wPos; } portBASE_TYPE xRecvWoken = pdFALSE; xSemaphoreTakeFromISR(mutex_RW_Power2_L1, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); memcpy((uint8_t*)&power2_data_cache_L1[power2_L1_wPos], wbuf, len); power2_L1_wPos += len; xRecvWoken = pdFALSE; xSemaphoreGiveFromISR(mutex_RW_Power2_L1, &xRecvWoken); portYIELD_FROM_ISR(xRecvWoken); if(POWER_DEVICE_DATA_SIZE <= power2_L1_wPos) { power2_L1_status = CACHE_L1_READY; } #endif }break; } } /********************功率部件一级缓存数据********************/ /************************************************************ * @funName : MD_ReadPowerL2 * @Input : device-功率部件序号 * rbuf-数据输出缓存 * pos-数据读取位置 * rlen-数据读取长度 * * @Output : ***************** * @Description : 获取功率部件二级缓存数据 * * ***************** * @Athor : YL Software Group * @Version : V0.0.0 * @Data : 2025/5/13 * *************************************************************/ bool MD_ReadPowerL2(const uint8_t device, uint8_t *rbuf, const uint16_t pos, const uint16_t rlen) { if(rlen > POWER_DEVICE_DATA_SIZE || pos >= POWER_DEVICE_DATA_SIZE || POWER_DEVICE_DATA_SIZE - pos < rlen) { return false; } switch(device) { case POWER_DEVICE_1: { xSemaphoreTake(mutex_RW_Power1_L2, portMAX_DELAY); memcpy(rbuf, (uint8_t*)&power1_data_cache_L2[pos], rlen); xSemaphoreGive(mutex_RW_Power1_L2); }break; case POWER_DEVICE_2: { xSemaphoreTake(mutex_RW_Power2_L2, portMAX_DELAY); memcpy(rbuf, (uint8_t*)&power2_data_cache_L2[pos], rlen); xSemaphoreGive(mutex_RW_Power2_L2); }break; } return true; } /************************************************************ * @funName : MD_GetPowerL2 * @Input : device-功率部件序号 * rbuf-数据缓存地址 * * @Output : ***************** * @Description : 获取功率部件二级缓存地址 * * ***************** * @Athor : YL Software Group * @Version : V0.0.0 * @Data : 2025/5/13 * *************************************************************/ uint8_t* MD_GetPowerL2(const uint8_t device) { uint8_t* addr = NULL; switch(device) { case POWER_DEVICE_1: { xSemaphoreTake(mutex_RW_Power1_L2, portMAX_DELAY); if(CACHE_L2_SENDING != power1_L2_status) { addr = NULL; } else { power1_L2_status = CACHE_L2_SENT; addr = power1_data_cache_L2; } xSemaphoreGive(mutex_RW_Power1_L2); }break; case POWER_DEVICE_2: { xSemaphoreTake(mutex_RW_Power2_L2, portMAX_DELAY); if(CACHE_L2_SENDING != power2_L2_status) { addr = NULL; } else{ power2_L2_status = CACHE_L2_SENT; addr = power2_data_cache_L2; } xSemaphoreGive(mutex_RW_Power1_L2); }break; } return addr; } /************************ End of file *************************/ /*************************************************************************** * @file fw_data.h * @brief This file contains the macros & function about real data for framework & App. * **************************************************************************** * @attention * * Created on: 2025-05-30 * Author: YL Monitor Software group * **************************************************************************** * @description * * * ****************************************************************************/ #ifndef __FW_DATA_H_ #define __FW_DATA_H_ #ifdef __cplusplus extern "C" { #endif /************************ Includes *************************/ #include "main.h" /************************ Exportd types ********************/ typedef struct{ uint8_t byte_H; uint8_t byte_L; }Power_Bits16; typedef struct{ uint8_t byte0; uint8_t byte1; uint8_t byte2; uint8_t byte3; }Power_Bits32; /* 功率部件系统参数 */ typedef struct{ /* word 0 */ Power_Bits16 Reserved0; //0-预留 /* word 1 */ Power_Bits16 SYSCTRL; //1-系统控制 /* word 2 */ Power_Bits16 Flag; //2-系统状态标志 /* word 3 */ Power_Bits16 ProtectHard_PROHARD; //3-硬件保护标志 /* word 4 */ Power_Bits16 ProtectSoft_PROSOFT; //4-软件保护标志 /* word 5 */ Power_Bits16 ProtectDrive_PRODRIVE; //5-驱动保护标志 /* word 6 */ Power_Bits16 ProtectComm_PROCOMM; //6-通信保护标志 /* word 7 */ Power_Bits16 INVCTRL; //7-逆变器控制 /* word 8 */ Power_Bits16 Reserved8; //预留 /* word 9 */ Power_Bits16 Reserved9; //预留 /* word 10 */ Power_Bits16 Reserved10; //预留 /* word 11 */ Power_Bits32 GPADAT_H; //GPIO0~31状态 /* word 12 */ Power_Bits32 GPADAT_L; //GPIO0~31状态 /* word 13*/ Power_Bits32 GPBDAT_H; //GPIO32~63状态 /* word 14 */ Power_Bits32 GPBDAT_L; //GPIO32~63状态 /* word 15 */ Power_Bits32 GPCDAT_H; //GPIO64~87状态 /* word 16 */ Power_Bits32 GPCDAT_L; //GPIO64~87状态 /* word 17 */ Power_Bits16 Reserved17; //预留 /* word 18 */ Power_Bits16 Reserved18; //预留 /* word 19 */ Power_Bits16 Reserved19; //预留 /* word 20 */ Power_Bits16 OSC_CLK_FRQ; //外部晶振频率 /* word 21 */ Power_Bits16 SYS_CLK_FRQ; //系统时钟频率 /* word 22 */ Power_Bits16 SYS_TICK; //定时器时钟基准 /* word 23 */ Power_Bits16 SET_F_PWM; //开关频率 /* word 24 */ Power_Bits16 Reserved24; //预留 /* word 25 */ Power_Bits16 SysMode; //工作模式 /* word 26 */ Power_Bits16 SysState; //工作状态 /* word 27 */ Power_Bits16 SysStartMode; //启动方式 /* word 28*/ Power_Bits16 SysStartStopControl; //启停控制指令来源 /* word 29*/ Power_Bits16 SysCommandSource; //系统频率指令来源 /* word 30*/ Power_Bits16 ModID; //模块编号 /* word 31*/ Power_Bits16 SETUP_UOUT; //电压设定值 /* word 32*/ Power_Bits16 SETUP_IOUT; //电流设定值 /* word 33*/ Power_Bits16 SETUP_FREQ; //频率设定值 /* word 34*/ Power_Bits16 SOFTSTART_TIME; //软件起动时间 /* word 35*/ Power_Bits16 STEP_UOUT; //电压步长 /* word 36*/ Power_Bits16 STEP_IOUT; //电流步长 /* word 37*/ Power_Bits16 STEP_FREQ; //频率步长 /* word 38 */ Power_Bits16 STEP_ANGLE; //相角步长 /* word 39 */ Power_Bits16 POINTCYCLE; //周波点数 /* word 40 */ Power_Bits16 REF_UOUT; //电压给定值 /* word 41 */ Power_Bits16 REF_IOUT; //电流给定值 /* word 42 */ Power_Bits16 REF_FREQ; //频率给定值 /* word 43 */ Power_Bits16 REF_ANGLE; //实时相角 /* word 44 */ Power_Bits16 KPWMA; //A相调制系数 /* word 45 */ Power_Bits16 KPWMB; //B相调制系数 /* word 46 */ Power_Bits16 KPWMC; //C相调制系数 /* word 47 */ Power_Bits16 Effective_Uin; //输入电压有效值 /* word 48 */ Power_Bits16 Effective_Iin; //输入电流有效值 /* word 49 */ Power_Bits16 Effective_Udc; //直流母线电压有效值 /* word 50 */ Power_Bits16 Effective_Uout1; //A相输出电压有效值 /* word 51 */ Power_Bits16 Effective_Uout2; //B相输出电压有效值 /* word 52 */ Power_Bits16 Effective_Uout3; //C相输出电压有效值 /* word 53 */ Power_Bits16 Effective_Iout1; //A相输出电流有效值 /* word 54 */ Power_Bits16 Effective_Iout2; //B相输出电流有效值 /* word 55 */ Power_Bits16 Effective_Iout3; //C相输出电流有效值 /* word 56 */ Power_Bits16 Effective_IL1; //A相电感电流有效值 /* word 57 */ Power_Bits16 Effective_IL2; //B相电感电流有效值 /* word 58 */ Power_Bits16 Effective_IL3; //C相电感电流有效值 /* word 59 */ Power_Bits16 Effective_UinC; //备用电源电压有效值 /* word 60 */ Power_Bits16 Effective_UoutSet; //输出电压设定值(模拟) /* word 61 */ Power_Bits16 Effective_IoutSet; //输出电流设定值(模拟) /* word 62 */ Power_Bits16 Reserved62; //预留 /* word 63 */ Power_Bits16 Effective_FreqSet; //输出电压频率设定值(模拟) /* word 64 */ Power_Bits16 PIDU1_hReference; //PIDU1给定值 /* word 65 */ Power_Bits16 PIDI1_hPresentFeedback; //PIDI1反馈值 /* word 66 */ Power_Bits16 PIDI1_hReference; //PIDI1输出值 /* word 67 */ Power_Bits16 PIDU1_hKp_Gain; //PIDU1参数kp /* word 68*/ Power_Bits16 PIDU1_hKi_Gain; //PIDU1参数ki /* word 69*/ Power_Bits16 PIDU1_hKd_Gain; //PIDU1参数kd /* word 70*/ Power_Bits32 PIDU1_wLower_Limit_Integral; //PIDU1积分下限值 /* word 71*/ Power_Bits32 PIDU1_wUpper_Limit_Integral; //PIDU1积分上限值 /* word 72*/ Power_Bits16 PIDU1_hLower_Limit_Output; //PIDU1输出下限值 /* word 73*/ Power_Bits16 PIDU1_hUpper_Limit_Output; //PIDU1输出上限值 /* word 74*/ Power_Bits16 PIDU2_hReference; //PIDU2给定值 /* word 75*/ Power_Bits16 PIDU2_hPresentFeedback; //PIDU2反馈值 /* word 76*/ Power_Bits16 PIDI2_hReference; //PIDI2输出值 /* word 77*/ Power_Bits16 PIDU2_hKp_Gain; //PIDU2参数kp /* word 78*/ Power_Bits16 PIDU2_hKi_Gain; //PIDU2参数ki /* word 79*/ Power_Bits16 PIDU2_hKd_Gain; //PIDU2参数kd /* word 80*/ Power_Bits32 PIDU2_wLower_Limit_Integral; //PIDU2积分下限值 /* word 81*/ Power_Bits32 PIDU2_wUpper_Limit_Integral; //PIDU2积分上限值 /* word 82*/ Power_Bits16 PIDU2_hLower_Limit_Output; //PIDU2输出下限值 /* word 83*/ Power_Bits16 PIDU2_hUpper_Limit_Output; //PIDU2输出上限值 /* word 84 */ Power_Bits16 PIDI1hReference; //PIDI1给定值 /* word 85 */ Power_Bits16 PIDI1hPresentFeedback; //PIDI1反馈值 /* word 86 */ Power_Bits16 iParkUref_Ds; //PIDI1输出值 /* word 87 */ Power_Bits16 PIDI1_hKp_Gain; //PIDI1参数kp /* word 88*/ Power_Bits16 PIDI1_hKi_Gain; //PIDI1参数ki /* word 89*/ Power_Bits16 PIDI1_hKd_Gain; //PIDI1参数kd /* word 90*/ Power_Bits32 PIDI1_wLower_Limit_Integral; //PIDI1积分下限值 /* word 91*/ Power_Bits32 PIDI1_wUpper_Limit_Integral; //PIDI1积分上限值 /* word 92*/ Power_Bits16 PIDI1_hLower_Limit_Output; //PIDI1输出下限值 /* word 93*/ Power_Bits16 PIDI1_hUpper_Limit_Output; //PIDI1输出上限值 /* word 94 */ Power_Bits16 PIDI2hReference; //PIDI2给定值 /* word 95 */ Power_Bits16 PIDI2_hPresentFeedback; //PIDI2反馈值 /* word 96 */ Power_Bits16 iParkUref_Qs; //输出值 /* word 97 */ Power_Bits16 PIDI2_hKp_Gain; //PIDI2参数kp /* word 98*/ Power_Bits16 PIDI2_hKi_Gain; //PIDI2参数ki /* word 99*/ Power_Bits16 PIDI2_hKd_Gain; //PIDI2参数kd /* word 100*/ Power_Bits32 PIDI2_wLower_Limit_Integral; //PIDI2积分下限值 /* word 101*/ Power_Bits32 PIDI2_wUpper_Limit_Integral; //PIDI2积分上限值 /* word 102*/ Power_Bits16 PIDI2_hLower_Limit_Output; //PIDI2输出下限值 /* word 103*/ Power_Bits16 PIDI2_hUpper_Limit_Output; //PIDI2输出上限值 /* word 104 */ Power_Bits16 PIDPARA_hReference; //PIDPARA给定值 /* word 105 */ Power_Bits16 PIDPARA_hPresentFeedback; //PIDPARA反馈值 /* word 106 */ Power_Bits16 Reserved106; //PIDPARA输出值 /* word 107 */ Power_Bits16 PIDPARA_hKp_Gain; //PIDPARA参数kp /* word 108*/ Power_Bits16 PIDPARA_hKi_Gain; //PIDPARA参数ki /* word 109*/ Power_Bits16 PIDPARA_hKd_Gain; //PIDPARA参数kd /* word 110*/ Power_Bits32 PIDPARA_wLower_Limit_Integral;//PIDPARA积分下限值 /* word 111*/ Power_Bits32 PIDPARA_wUpper_Limit_Integral;//PIDPARA积分上限值 /* word 112*/ Power_Bits16 PIDPARA_hLower_Limit_Output; //PIDPARA输出下限值 /* word 113*/ Power_Bits16 PIDPARA_hUpper_Limit_Output; //PIDPARA输出上限值 /* word 114 */ Power_Bits16 PIDPLL_hReference; //PIDPLL给定值 /* word 115 */ Power_Bits16 PIDPLL_hPresentFeedback; //PIDPLL反馈值 /* word 116 */ Power_Bits16 Reserved116; //PIDPLL输出值 /* word 117 */ Power_Bits16 PIDPLL_hKp_Gain; //PIDPLL参数kp /* word 118*/ Power_Bits16 PIDPLL_hKi_Gain; //PIDPLL参数ki /* word 119*/ Power_Bits16 PIDPLL_hKd_Gain; //PIDPLL参数kd /* word 120*/ Power_Bits32 PIDPLL_wLower_Limit_Integral; //PIDPLL积分下限值 /* word 121*/ Power_Bits32 PIDPLL_wUpper_Limit_Integral; //PIDPLL积分上限值 /* word 122*/ Power_Bits16 PIDPLL_hLower_Limit_Output; //PIDPLL输出下限值 /* word 123*/ Power_Bits16 PIDPLL_hUpper_Limit_Output; //PIDPLL输出上限值 /* word 124 */ Power_Bits16 Reserved124; //输出变压器变比 /* word 125 */ Power_Bits16 Reserved125; //变压器等效电抗 /* word 126 */ Power_Bits16 Reserved126; //变压器等效电阻 /* word 127 */ Power_Bits16 Reserved127; //预留 /* word 128 */ Power_Bits16 FdOverUin_ValLimitHi; //输入过压保护值 /* word 129 */ Power_Bits16 FdUnderUin_ValLimitHi; //输入欠压保护值 /* word 130 */ Power_Bits16 FdOverIin_ValLimitHi; //输入过流保护值 /* word 131 */ Power_Bits16 FdOverUo1_ValLimitHi; //输出过压保护值 /* word 132 */ Power_Bits16 FdOverIo1_ValLimitHi; //输出过流保护值 /* word 133 */ Power_Bits16 FdOverIL1_ValLimitHi; //电感过流保护值 /* word 134 */ Power_Bits16 Reserved134; //短路保护电压动作值 /* word 135 */ Power_Bits16 Reserved135; //短路保护电流动作值 /* word 136 */ Power_Bits16 Reserved136; //短路保护电压返回值 /* word 137 */ Power_Bits16 Reserved137; //短路保护电流返回值 /* word 138 */ Power_Bits16 Reserved138; //短路运行时间 /* word 139 */ Power_Bits16 Reserved139; //110%过载保护限值 /* word 140 */ Power_Bits16 Reserved140; //110%过载保护时间 /* word 141 */ Power_Bits16 Reserved141; //110%过载保护倒计时 /* word 142 */ Power_Bits16 Reserved142; //120%过载保护限值 /* word 143 */ Power_Bits16 Reserved143; //120%过载保护时间 /* word 144 */ Power_Bits16 Reserved144; //120%过载保护倒计时 /* word 145 预留*/ Power_Bits16 Reserved145; /* word 146 AD结果寄存器数据(CH0)*/ Power_Bits16 AdcRegs_ADCRESULT0; /* word 147 */ Power_Bits16 AdcRegs_ADCRESULT1; //AD结果寄存器数据(CH1) /* word 148 */ Power_Bits16 AdcRegs_ADCRESULT2; //AD结果寄存器数据(CH2) /* word 149 */ Power_Bits16 AdcRegs_ADCRESULT3; //AD结果寄存器数据(CH3) /* word 150 */ Power_Bits16 AdcRegs_ADCRESULT4; //AD结果寄存器数据(CH4) /* word 151 */ Power_Bits16 AdcRegs_ADCRESULT5; //AD结果寄存器数据(CH5) /* word 152 */ Power_Bits16 AdcRegs_ADCRESULT6; //AD结果寄存器数据(CH6) /* word 153 */ Power_Bits16 AdcRegs_ADCRESULT7; //AD结果寄存器数据(CH7) /* word 154 */ Power_Bits16 AdcRegs_ADCRESULT8; //AD结果寄存器数据(CH8) /* word 155 */ Power_Bits16 AdcRegs_ADCRESULT9; //AD结果寄存器数据(CH9) /* word 156 */ Power_Bits16 AdcRegs_ADCRESULT10; //AD结果寄存器数据(CH10) /* word 157 */ Power_Bits16 AdcRegs_ADCRESULT11; //AD结果寄存器数据(CH11) /* word 158 */ Power_Bits16 AdcRegs_ADCRESULT12; //AD结果寄存器数据(CH12) /* word 159 */ Power_Bits16 AdcRegs_ADCRESULT13; //AD结果寄存器数据(CH13) /* word 160 */ Power_Bits16 AdcRegs_ADCRESULT14; //AD结果寄存器数据(CH14) /* word 161 */ Power_Bits16 AdcRegs_ADCRESULT15; //AD结果寄存器数据(CH15) /* word 162 预留*/ Power_Bits16 Reserved162; /* word 163 预留*/ Power_Bits16 Reserved163; /* word 164 预留*/ Power_Bits16 Reserved164; /* word 165 预留*/ Power_Bits16 Reserved165; /* word 166 预留*/ Power_Bits16 Reserved166; /* word 167 预留*/ Power_Bits16 Reserved167; /* word 168 预留*/ Power_Bits16 Reserved168; /* word 169预留 */ Power_Bits16 Reserved169; /* word 170 预留*/ Power_Bits16 Reserved170; /* word 171 预留*/ Power_Bits16 Reserved171; /* word 172 预留*/ Power_Bits16 Reserved172; /* word 173 预留*/ Power_Bits16 Reserved173; /* word 174 预留*/ Power_Bits16 Reserved174; /* word 175 预留*/ Power_Bits16 Reserved175; /* word 176 预留*/ Power_Bits16 Reserved176; /* word 177 预留*/ Power_Bits16 Reserved177; /* word 178 预留*/ Power_Bits16 Reserved178; /* word 179 预留*/ Power_Bits16 Reserved179; /* word 180 输入电压传感器采样范围*/ Power_Bits16 PEAK_UIN_SENSOR; /* word 181 输入电流传感器采样范围*/ Power_Bits16 PEAK_IIN_SENSOR; /* word 182 输出电压传感器采样范围*/ Power_Bits16 PEAK_UO_SENSOR; /* word 183 输出电流传感器采样范围*/ Power_Bits16 PEAK_IO_SENSOR; /* word 184 电感电流传感器采样范围*/ Power_Bits16 PEAK_IL_SENSOR; /* word 185 预留*/ Power_Bits16 Reserved185; /* word 186 预留*/ Power_Bits16 Reserved186; /* word 187 预留*/ Power_Bits16 Reserved187; /* word 188 预留*/ Power_Bits16 Reserved188; /* word 189 预留*/ Power_Bits16 Reserved189; /* word 190 通道选择*/ Power_Bits16 ChannelSelect; /* word 191 预留*/ Power_Bits16 Reserved191; /* word 192 预留*/ Power_Bits16 Reserved192; /* word 193 地址偏移量*/ Power_Bits16 AddressOffset; /* word 194 预留*/ Power_Bits16 Reserved194; /* word 195 预留*/ Power_Bits16 Reserved195; /* word 196 预留*/ Power_Bits16 Reserved196; /* word 197 预留*/ Power_Bits16 Reserved197; /* word 198 预留*/ Power_Bits16 Reserved198; /* word 199 网络通讯协议控制*/ Power_Bits16 Modbus_Control_ModbusCtrl; }Power_System_Type; STM32F105 power_data.c程序的二级缓存的400字节的数据准确的映射给fw_data.h程序中的Power_System_Type结构体中,然后去调用结构体的某一个数据,需要频繁访问结构体中的某个字段,可以将其缓存到局部变量中,减少多次访问互斥锁的开销,用标准库写出详细代码和注释,优化的建议也写入代码中,别单独提出来
06-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值