完成串口调试
添加RTCM库
This commit is contained in:
parent
354bdc8068
commit
b5fed93741
25
.config
25
.config
@ -270,10 +270,14 @@ CONFIG_RT_USING_ULOG=y
|
||||
# CONFIG_ULOG_OUTPUT_LVL_I is not set
|
||||
CONFIG_ULOG_OUTPUT_LVL_D=y
|
||||
CONFIG_ULOG_OUTPUT_LVL=7
|
||||
# CONFIG_ULOG_USING_ISR_LOG is not set
|
||||
CONFIG_ULOG_USING_ISR_LOG=y
|
||||
CONFIG_ULOG_ASSERT_ENABLE=y
|
||||
CONFIG_ULOG_LINE_BUF_SIZE=128
|
||||
# CONFIG_ULOG_USING_ASYNC_OUTPUT is not set
|
||||
CONFIG_ULOG_USING_ASYNC_OUTPUT=y
|
||||
CONFIG_ULOG_ASYNC_OUTPUT_BUF_SIZE=2048
|
||||
CONFIG_ULOG_ASYNC_OUTPUT_BY_THREAD=y
|
||||
CONFIG_ULOG_ASYNC_OUTPUT_THREAD_STACK=1024
|
||||
CONFIG_ULOG_ASYNC_OUTPUT_THREAD_PRIORITY=30
|
||||
|
||||
#
|
||||
# log format
|
||||
@ -499,7 +503,15 @@ CONFIG_ULOG_BACKEND_USING_CONSOLE=y
|
||||
# CONFIG_PKG_USING_SEGGER_RTT is not set
|
||||
# CONFIG_PKG_USING_RDB is not set
|
||||
# CONFIG_PKG_USING_ULOG_EASYFLASH is not set
|
||||
# CONFIG_PKG_USING_ULOG_FILE is not set
|
||||
CONFIG_PKG_USING_ULOG_FILE=y
|
||||
CONFIG_PKG_ULOG_FILE_PATH="/packages/tools/ulog_file"
|
||||
CONFIG_ULOG_FILE_ROOT_PATH="/logs"
|
||||
CONFIG_ULOG_FILE_NAME_BASE="ulog.log"
|
||||
CONFIG_ULOG_FILE_MAX_NUM=5
|
||||
CONFIG_ULOG_FILE_MAX_SIZE=524288
|
||||
CONFIG_PKG_USING_ULOG_FILE_V100=y
|
||||
# CONFIG_PKG_USING_ULOG_FILE_LATEST_VERSION is not set
|
||||
CONFIG_PKG_ULOG_FILE_VER="v1.0.0"
|
||||
# CONFIG_PKG_USING_LOGMGR is not set
|
||||
# CONFIG_PKG_USING_ADBD is not set
|
||||
# CONFIG_PKG_USING_COREMARK is not set
|
||||
@ -589,6 +601,7 @@ CONFIG_ULOG_BACKEND_USING_CONSOLE=y
|
||||
# CONFIG_PKG_USING_CAIRO is not set
|
||||
# CONFIG_PKG_USING_PIXMAN is not set
|
||||
# CONFIG_PKG_USING_PARTITION is not set
|
||||
# CONFIG_PKG_USING_PERF_COUNTER is not set
|
||||
# CONFIG_PKG_USING_FAL is not set
|
||||
# CONFIG_PKG_USING_FLASHDB is not set
|
||||
# CONFIG_PKG_USING_SQLITE is not set
|
||||
@ -798,7 +811,7 @@ CONFIG_SOC_STM32F407ZG=y
|
||||
#
|
||||
CONFIG_BSP_USING_USB_TO_USART=y
|
||||
# CONFIG_BSP_USING_COM2 is not set
|
||||
# CONFIG_BSP_USING_COM3 is not set
|
||||
CONFIG_BSP_USING_COM3=y
|
||||
CONFIG_BSP_USING_SRAM=y
|
||||
# CONFIG_BSP_USING_SPI_FLASH is not set
|
||||
# CONFIG_BSP_USING_EEPROM is not set
|
||||
@ -823,7 +836,9 @@ CONFIG_BSP_USING_UART1=y
|
||||
# CONFIG_BSP_UART1_RX_USING_DMA is not set
|
||||
# CONFIG_BSP_UART1_TX_USING_DMA is not set
|
||||
# CONFIG_BSP_USING_UART2 is not set
|
||||
# CONFIG_BSP_USING_UART3 is not set
|
||||
CONFIG_BSP_USING_UART3=y
|
||||
CONFIG_BSP_UART3_RX_USING_DMA=y
|
||||
# CONFIG_BSP_UART3_TX_USING_DMA is not set
|
||||
# CONFIG_BSP_USING_UART4 is not set
|
||||
# CONFIG_BSP_USING_UART5 is not set
|
||||
# CONFIG_BSP_USING_UART6 is not set
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -40,3 +40,4 @@ RTE/
|
||||
settings/
|
||||
*.uvguix*
|
||||
|
||||
/Release/
|
||||
|
Binary file not shown.
@ -5,7 +5,18 @@
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="113460590584128686" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT ARM Cross GCC Built-in Compiler Settings " parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="37529093409571594" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT ARM Cross GCC Built-in Compiler Settings " parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
</extension>
|
||||
</configuration>
|
||||
<configuration id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.553091094.295091433" name="Release">
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="103830345138989147" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT ARM Cross GCC Built-in Compiler Settings " parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
164
.settings/org.eclipse.cdt.core.prefs
Normal file
164
.settings/org.eclipse.cdt.core.prefs
Normal file
@ -0,0 +1,164 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_assignment=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
|
||||
org.eclipse.cdt.core.formatter.alignment_for_binary_expression=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_compact_if=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=34
|
||||
org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain=18
|
||||
org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list=0
|
||||
org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48
|
||||
org.eclipse.cdt.core.formatter.alignment_for_expression_list=0
|
||||
org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_member_access=0
|
||||
org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=end_of_line
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_block=next_line
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=next_line
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=next_line
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=next_line
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_switch=next_line
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=next_line
|
||||
org.eclipse.cdt.core.formatter.comment.line_up_line_comment_in_blocks_on_first_column=false
|
||||
org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment=1
|
||||
org.eclipse.cdt.core.formatter.comment.never_indent_line_comments_on_first_column=true
|
||||
org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true
|
||||
org.eclipse.cdt.core.formatter.compact_else_if=true
|
||||
org.eclipse.cdt.core.formatter.continuation_indentation=2
|
||||
org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2
|
||||
org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false
|
||||
org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false
|
||||
org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces=0
|
||||
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true
|
||||
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false
|
||||
org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true
|
||||
org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=false
|
||||
org.eclipse.cdt.core.formatter.indent_empty_lines=false
|
||||
org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true
|
||||
org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true
|
||||
org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true
|
||||
org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=false
|
||||
org.eclipse.cdt.core.formatter.indentation.size=4
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
|
||||
org.eclipse.cdt.core.formatter.join_wrapped_lines=true
|
||||
org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=false
|
||||
org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false
|
||||
org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false
|
||||
org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=false
|
||||
org.eclipse.cdt.core.formatter.lineSplit=120
|
||||
org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1
|
||||
org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true
|
||||
org.eclipse.cdt.core.formatter.tabulation.char=space
|
||||
org.eclipse.cdt.core.formatter.tabulation.size=4
|
||||
org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false
|
3
.settings/org.eclipse.cdt.ui.prefs
Normal file
3
.settings/org.eclipse.cdt.ui.prefs
Normal file
@ -0,0 +1,3 @@
|
||||
eclipse.preferences.version=1
|
||||
formatter_profile=org.eclipse.cdt.ui.default.rtt_profile
|
||||
formatter_settings_version=1
|
345
RTK/rtcm.c
Normal file
345
RTK/rtcm.c
Normal file
@ -0,0 +1,345 @@
|
||||
#include "rtklib.h"
|
||||
|
||||
/* function prototypes -------------------------------------------------------*/
|
||||
extern int decode_rtcm3(rtcm_t *rtcm);
|
||||
/* 定义静态数组替换动态数组 */
|
||||
#ifdef STATIC
|
||||
#define RTCM_STATIC
|
||||
#endif
|
||||
|
||||
|
||||
/* 定义静态数组替换动态数组 */
|
||||
/* constants -----------------------------------------------------------------*/
|
||||
#define RTCM3PREAMB 0xD3 /* rtcm ver.3 frame preamble */
|
||||
|
||||
/* initialize rtcm control -----------------------------------------------------
|
||||
* initialize rtcm control struct and reallocate memory for observation and
|
||||
* ephemeris buffer in rtcm control struct
|
||||
* args : rtcm_t *raw IO rtcm control struct
|
||||
* return : status (1:ok,0:memory allocation error)
|
||||
*-----------------------------------------------------------------------------*/
|
||||
extern int init_rtcm(rtcm_t *rtcm)
|
||||
{
|
||||
gtime_t time0 = {0};
|
||||
obsd_t data0 = {{0}};
|
||||
eph_t eph0 = {0, -1, -1};
|
||||
#ifdef ENAGLO
|
||||
geph_t geph0 = {0, -1};
|
||||
#endif
|
||||
// ssr_t ssr0={{{0}}};
|
||||
|
||||
int i, j;
|
||||
|
||||
trace(4, "init_rtcm:\n");
|
||||
|
||||
rtcm->staid = rtcm->stah = rtcm->seqno = 0;
|
||||
// rtcm->outtype = 0;
|
||||
rtcm->time = rtcm->time_s = time0;
|
||||
rtcm->sta.name[0] = rtcm->sta.marker[0] = '\0';
|
||||
rtcm->sta.antdes[0] = rtcm->sta.antsno[0] = '\0';
|
||||
rtcm->sta.rectype[0] = rtcm->sta.recver[0] = rtcm->sta.recsno[0] = '\0';
|
||||
rtcm->sta.antsetup = rtcm->sta.itrf = rtcm->sta.deltype = 0;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
rtcm->sta.pos[i] = rtcm->sta.del[i] = 0.0;
|
||||
}
|
||||
rtcm->sta.hgt = 0.0;
|
||||
//rtcm->dgps = NULL;
|
||||
// for (i=0;i<MAXSAT;i++) {
|
||||
// rtcm->ssr[i]=ssr0;
|
||||
// }
|
||||
// rtcm->msg[0]=rtcm->msgtype[0]=rtcm->opt[0]='\0';
|
||||
for (i = 0; i < 6; i++)
|
||||
rtcm->msmtype[i][0] = '\0';
|
||||
rtcm->obsflag = rtcm->ephsat = 0;
|
||||
for (i = 0; i < MAXSAT; i++)
|
||||
for (j = 0; j < NFREQ + NEXOBS; j++)
|
||||
{
|
||||
rtcm->cp[i][j] = 0.0;
|
||||
rtcm->lock[i][j] = rtcm->loss[i][j] = 0;
|
||||
rtcm->lltime[i][j] = time0;
|
||||
}
|
||||
rtcm->nbit = rtcm->len = 0;
|
||||
rtcm->nbyte = 0;
|
||||
// rtcm->word=0;
|
||||
// for (i=0;i<100;i++) rtcm->nmsg2[i]=0;
|
||||
for (i = 0; i < 400; i++)
|
||||
rtcm->nmsg3[i] = 0;
|
||||
|
||||
rtcm->obs.data = NULL;
|
||||
rtcm->nav.eph = NULL;
|
||||
rtcm->nav.geph = NULL;
|
||||
|
||||
/* reallocate memory for observation and ephemeris buffer */
|
||||
|
||||
#ifndef ENAGLO
|
||||
if (!(rtcm->obs.data = (obsd_t *)malloc(sizeof(obsd_t) * MAXOBS)) ||
|
||||
!(rtcm->nav.eph = (eph_t *)malloc(sizeof(eph_t) * MAXSAT * 1)))
|
||||
#else
|
||||
if (!(rtcm->obs.data = (obsd_t *)malloc(sizeof(obsd_t) * MAXOBS)) ||
|
||||
!(rtcm->nav.eph = (eph_t *)malloc(sizeof(eph_t) * MAXSAT)) ||
|
||||
!(rtcm->nav.geph = (geph_t *)malloc(sizeof(geph_t) * MAXPRNGLO)))
|
||||
#endif
|
||||
{
|
||||
free_rtcm(rtcm);
|
||||
return 0;
|
||||
}
|
||||
rtcm->obs.n = 0;
|
||||
rtcm->nav.n = MAXSAT * 1; /* 接收机星历 (当前星历) */
|
||||
rtcm->nav.ng = MAXPRNGLO;
|
||||
for (i = 0; i < MAXOBS; i++)
|
||||
rtcm->obs.data[i] = data0;
|
||||
for (i = 0; i < MAXSAT * 1; i++)
|
||||
rtcm->nav.eph[i] = eph0;
|
||||
#ifdef ENAGLO
|
||||
for (i = 0; i < MAXPRNGLO; i++)
|
||||
rtcm->nav.geph[i] = geph0;
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
/* initialize rtcm control -----------------------------------------------------
|
||||
* initialize rtcm control struct and reallocate memory for observation and
|
||||
* ephemeris buffer in rtcm control struct
|
||||
* args : rtcm_t *raw IO rtcm control struct
|
||||
* return : status (1:ok,0:memory allocation error)
|
||||
*-----------------------------------------------------------------------------*/
|
||||
extern int init_rtcm_static(rtcm_t *rtcm, char index)
|
||||
{
|
||||
gtime_t time0 = {0};
|
||||
obsd_t data0 = {{0}};
|
||||
eph_t eph0 = {0, -1, -1};
|
||||
extern obsd_t RTCM_obsd_r[MAXOBS];
|
||||
extern obsd_t RTCM_obsd_b[MAXOBS];
|
||||
extern eph_t RTCM_eph_r[MAXSAT];
|
||||
#ifdef ENAGLO
|
||||
extern eph_t RTCM_geph[MAXPRNGLO];
|
||||
geph_t geph0 = {0, -1};
|
||||
#endif
|
||||
// ssr_t ssr0={{{0}}};
|
||||
|
||||
int i, j;
|
||||
|
||||
trace(4, "init_rtcm:\n");
|
||||
|
||||
rtcm->staid = rtcm->stah = rtcm->seqno = 0;
|
||||
// rtcm->outtype = 0;
|
||||
rtcm->time = rtcm->time_s = time0;
|
||||
rtcm->sta.name[0] = rtcm->sta.marker[0] = '\0';
|
||||
rtcm->sta.antdes[0] = rtcm->sta.antsno[0] = '\0';
|
||||
rtcm->sta.rectype[0] = rtcm->sta.recver[0] = rtcm->sta.recsno[0] = '\0';
|
||||
rtcm->sta.antsetup = rtcm->sta.itrf = rtcm->sta.deltype = 0;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
rtcm->sta.pos[i] = rtcm->sta.del[i] = 0.0;
|
||||
}
|
||||
rtcm->sta.hgt = 0.0;
|
||||
//rtcm->dgps = NULL;
|
||||
// for (i=0;i<MAXSAT;i++) {
|
||||
// rtcm->ssr[i]=ssr0;
|
||||
// }
|
||||
// rtcm->msg[0]=rtcm->msgtype[0]=rtcm->opt[0]='\0';
|
||||
for (i = 0; i < 6; i++)
|
||||
rtcm->msmtype[i][0] = '\0';
|
||||
rtcm->obsflag = rtcm->ephsat = 0;
|
||||
for (i = 0; i < MAXSAT; i++)
|
||||
for (j = 0; j < NFREQ + NEXOBS; j++)
|
||||
{
|
||||
rtcm->cp[i][j] = 0.0;
|
||||
rtcm->lock[i][j] = rtcm->loss[i][j] = 0;
|
||||
rtcm->lltime[i][j] = time0;
|
||||
}
|
||||
rtcm->nbit = rtcm->len = 0;
|
||||
rtcm->nbyte = 0;
|
||||
// rtcm->word=0;
|
||||
// for (i=0;i<100;i++) rtcm->nmsg2[i]=0;
|
||||
for (i = 0; i < 400; i++)
|
||||
rtcm->nmsg3[i] = 0;
|
||||
|
||||
rtcm->obs.data = NULL;
|
||||
rtcm->nav.eph = NULL;
|
||||
rtcm->nav.geph = NULL;
|
||||
|
||||
/* reallocate memory for observation and ephemeris buffer */
|
||||
if (index == 0) /* 接收机静态 */
|
||||
{
|
||||
memset(RTCM_obsd_r,0,MAXOBS);
|
||||
memset(RTCM_eph_r,0,MAXSAT);
|
||||
rtcm->obs.data = RTCM_obsd_r;
|
||||
rtcm->nav.eph = RTCM_eph_r;
|
||||
rtcm->obs.n = 0;
|
||||
rtcm->nav.n = MAXSAT * 1; /* 接收机星历 (当前星历) */
|
||||
rtcm->nav.ng = MAXPRNGLO;
|
||||
for (i = 0; i < MAXOBS; i++)
|
||||
rtcm->obs.data[i] = data0;
|
||||
for (i = 0; i < MAXSAT * 1; i++)
|
||||
rtcm->nav.eph[i] = eph0;
|
||||
}
|
||||
else /* 基准站静态 */
|
||||
{
|
||||
memset(RTCM_obsd_b,0,MAXOBS);
|
||||
rtcm->obs.data = RTCM_obsd_b;
|
||||
rtcm->obs.n = 0;
|
||||
rtcm->nav.n = 0; /* 基准站最大星历数量 */
|
||||
rtcm->nav.ng = 0;
|
||||
for (i = 0; i < MAXOBS; i++)
|
||||
rtcm->obs.data[i] = data0;
|
||||
}
|
||||
#ifdef ENAGLO
|
||||
if (index == 0)
|
||||
{
|
||||
memset(RTCM_geph_r,0,MAXPRNGLO);
|
||||
rtcm->nav.geph = RTCM_geph_r;
|
||||
for (i = 0; i < MAXPRNGLO; i++)
|
||||
rtcm->nav.geph[i] = geph0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
/* free rtcm control ----------------------------------------------------------
|
||||
* free observation and ephemeris buffer in rtcm control struct
|
||||
* args : rtcm_t *raw IO rtcm control struct
|
||||
* return : none
|
||||
*-----------------------------------------------------------------------------*/
|
||||
extern void free_rtcm(rtcm_t *rtcm)
|
||||
{
|
||||
trace(4, "free_rtcm:\n");
|
||||
|
||||
/* free memory for observation and ephemeris buffer */
|
||||
#ifndef RTCM_STATIC
|
||||
free(rtcm->obs.data);
|
||||
rtcm->obs.data = NULL;
|
||||
free(rtcm->nav.eph);
|
||||
rtcm->nav.eph = NULL;
|
||||
free(rtcm->nav.geph);
|
||||
rtcm->nav.geph = NULL;
|
||||
#endif
|
||||
rtcm->nav.ng = 0;
|
||||
rtcm->obs.n = 0;
|
||||
rtcm->nav.n = 0;
|
||||
}
|
||||
|
||||
/* input RTCM 3 message from stream --------------------------------------------
|
||||
* fetch next RTCM 3 message and input a message from byte stream
|
||||
* args : rtcm_t *rtcm IO rtcm control struct
|
||||
* uint8_t data I stream data (1 byte)
|
||||
* return : status (-1: error message, 0: no message, 1: input observation data,
|
||||
* 2: input ephemeris, 5: input station pos/ant parameters,
|
||||
* 10: input ssr messages)
|
||||
* notes : before firstly calling the function, time in rtcm control struct has
|
||||
* to be set to the approximate time within 1/2 week in order to resolve
|
||||
* ambiguity of time in rtcm messages.
|
||||
*
|
||||
* to specify input options, set rtcm->opt to the following option
|
||||
* strings separated by spaces.
|
||||
*
|
||||
* -EPHALL : input all ephemerides (default: only new)
|
||||
* -STA=nnn : input only message with STAID=nnn (default: all)
|
||||
* -GLss : select signal ss for GPS MSM (ss=1C,1P,...)
|
||||
* -RLss : select signal ss for GLO MSM (ss=1C,1P,...)
|
||||
* -ELss : select signal ss for GAL MSM (ss=1C,1B,...)
|
||||
* -JLss : select signal ss for QZS MSM (ss=1C,2C,...)
|
||||
* -CLss : select signal ss for BDS MSM (ss=2I,7I,...)
|
||||
* -ILss : select signal ss for IRN MSM (ss=5A,9A,...)
|
||||
* -GALINAV : select I/NAV for Galileo ephemeris (default: all)
|
||||
* -GALFNAV : select F/NAV for Galileo ephemeris (default: all)
|
||||
*
|
||||
* supported RTCM 3 messages (ref [7][10][15][16][17][18])
|
||||
*
|
||||
* TYPE : GPS GLONASS Galileo QZSS BDS SBAS NavIC
|
||||
* ----------------------------------------------------------------------
|
||||
* OBS COMP L1 : 1001~ 1009~ - - - - -
|
||||
* FULL L1 : 1002 1010 - - - - -
|
||||
* COMP L1L2: 1003~ 1011~ - - - - -
|
||||
* FULL L1L2: 1004 1012 - - - - -
|
||||
*
|
||||
* NAV : 1019 1020 1045** 1044 1042 - 1041
|
||||
* - - 1046** - 63* - -
|
||||
*
|
||||
* MSM 1 : 1071~ 1081~ 1091~ 1111~ 1121~ 1101~ 1131~
|
||||
* 2 : 1072~ 1082~ 1092~ 1112~ 1122~ 1102~ 1132~
|
||||
* 3 : 1073~ 1083~ 1093~ 1113~ 1123~ 1103~ 1133~
|
||||
* 4 : 1074 1084 1094 1114 1124 1104 1134
|
||||
* 5 : 1075 1085 1095 1115 1125 1105 1135
|
||||
* 6 : 1076 1086 1096 1116 1126 1106 1136
|
||||
* 7 : 1077 1087 1097 1117 1127 1107 1137
|
||||
*
|
||||
* SSR ORBIT : 1057 1063 1240* 1246* 1258* - -
|
||||
* CLOCK : 1058 1064 1241* 1247* 1259* - -
|
||||
* CODE BIAS: 1059 1065 1242* 1248* 1260* - -
|
||||
* OBT/CLK : 1060 1066 1243* 1249* 1261* - -
|
||||
* URA : 1061 1067 1244* 1250* 1262* - -
|
||||
* HR-CLOCK : 1062 1068 1245* 1251* 1263* - -
|
||||
* PHAS BIAS: 11* - 12* 13* 14* - -
|
||||
*
|
||||
* ANT/RCV INFO : 1007 1008 1033
|
||||
* STA POSITION : 1005 1006
|
||||
*
|
||||
* PROPRIETARY : 4076 (IGS)
|
||||
* ----------------------------------------------------------------------
|
||||
* (* draft, ** 1045:F/NAV,1046:I/NAV, ~ only encode)
|
||||
*
|
||||
* for MSM observation data with multiple signals for a frequency,
|
||||
* a signal is selected according to internal priority. to select
|
||||
* a specified signal, use the input options.
|
||||
*
|
||||
* RTCM 3 message format:
|
||||
* +----------+--------+-----------+--------------------+----------+
|
||||
* | preamble | 000000 | length | data message | parity |
|
||||
* +----------+--------+-----------+--------------------+----------+
|
||||
* |<-- 8 --->|<- 6 -->|<-- 10 --->|<--- length x 8 --->|<-- 24 -->|
|
||||
*
|
||||
*-----------------------------------------------------------------------------*/
|
||||
extern int input_rtcm3(rtcm_t *rtcm, uint8_t data)
|
||||
{
|
||||
trace(5, "input_rtcm3: data=%02x\n", data);
|
||||
|
||||
/* synchronize frame */
|
||||
if (rtcm->nbyte == 0)
|
||||
{
|
||||
if (data != RTCM3PREAMB)
|
||||
return 0;
|
||||
rtcm->buff[rtcm->nbyte++] = data;
|
||||
return 0;
|
||||
}
|
||||
rtcm->buff[rtcm->nbyte++] = data;
|
||||
|
||||
if (rtcm->nbyte == 3)
|
||||
{
|
||||
rtcm->len = getbitu(rtcm->buff, 14, 10) + 3; /* length without parity */
|
||||
}
|
||||
if (rtcm->nbyte < 3 || rtcm->nbyte < rtcm->len + 3)
|
||||
return 0;
|
||||
rtcm->nbyte = 0;
|
||||
|
||||
/* check parity */
|
||||
if (rtk_crc24q(rtcm->buff, rtcm->len) != getbitu(rtcm->buff, rtcm->len * 8, 24))
|
||||
{
|
||||
trace(2, "rtcm3 parity error: len=%d\n", rtcm->len);
|
||||
return 0;
|
||||
}
|
||||
/* decode rtcm3 message */
|
||||
return decode_rtcm3(rtcm);
|
||||
}
|
||||
/* input RTCM 3 message from file ----------------------------------------------
|
||||
* fetch next RTCM 3 message and input a messsage from file
|
||||
* args : rtcm_t *rtcm IO rtcm control struct
|
||||
* FILE *fp I file pointer
|
||||
* return : status (-2: end of file, -1...10: same as above)
|
||||
* notes : same as above
|
||||
*-----------------------------------------------------------------------------*/
|
||||
extern int input_rtcm3f(rtcm_t *rtcm, FILE *fp)
|
||||
{
|
||||
int i, data = 0, ret;
|
||||
|
||||
trace(4, "input_rtcm3f: data=%02x\n", data);
|
||||
|
||||
for (i = 0; i < 4096; i++)
|
||||
{
|
||||
if ((data = fgetc(fp)) == EOF)
|
||||
return -2;
|
||||
if ((ret = input_rtcm3(rtcm, (uint8_t)data)))
|
||||
return ret;
|
||||
}
|
||||
return 0; /* return at every 4k bytes */
|
||||
}
|
2600
RTK/rtcm3.c
Normal file
2600
RTK/rtcm3.c
Normal file
File diff suppressed because it is too large
Load Diff
4516
RTK/rtkcmn.c
Normal file
4516
RTK/rtkcmn.c
Normal file
File diff suppressed because it is too large
Load Diff
1732
RTK/rtklib.h
Normal file
1732
RTK/rtklib.h
Normal file
File diff suppressed because it is too large
Load Diff
36
RTK/static_ram.c
Normal file
36
RTK/static_ram.c
Normal file
@ -0,0 +1,36 @@
|
||||
#include "rtklib.h"
|
||||
|
||||
#ifdef STATIC
|
||||
/* number of parameters (pos,ionos,tropos,hw-bias,phase-bias,real,estimated) */
|
||||
#define NX 87
|
||||
#define NR 9
|
||||
/* global variables ----------------------------------------------------------*/
|
||||
rtksvr_t svr; /* rtk server struct */
|
||||
prcopt_t prcopt; /* processing options */
|
||||
solopt_t solopt[2] = {{0}}; /* solution options */
|
||||
|
||||
/* rtkpos.c */
|
||||
double rtk_x[NX] = {0.0}; /* NX*8 = B */
|
||||
double rtk_P[NX * NX] = {0.0}; /* NX*NX*8 = B */
|
||||
double rtk_xa[NR] = {0.0}; /* NR*8 = B */
|
||||
double rtk_Pa[NR * NR] = {0.0}; /* NR*NR*8 = B */
|
||||
|
||||
/* rtksvr.c */
|
||||
eph_t svr_eph[MAXSAT];
|
||||
#ifdef ENAGLO
|
||||
geph_t svr_geph[NSATGLO];
|
||||
#endif
|
||||
#ifdef ENASBS
|
||||
seph_t svr_seph[NSATSBS];
|
||||
#endif
|
||||
obsd_t svr_obsd[2][MAXOBS];
|
||||
|
||||
/* rtcm.c */
|
||||
obsd_t RTCM_obsd_r[MAXOBS];
|
||||
obsd_t RTCM_obsd_b[MAXOBS];
|
||||
eph_t RTCM_eph_r[MAXSAT];
|
||||
#ifdef ENAGLO
|
||||
geph_t RTCM_geph[MAXPRNGLO];
|
||||
#endif
|
||||
|
||||
#endif
|
@ -13,23 +13,33 @@
|
||||
#include <rtdevice.h>
|
||||
#include <board.h>
|
||||
#include <drv_log.h>
|
||||
#include <dfs_posix.h>
|
||||
#include <dfs.h>
|
||||
#include "user_uart.h"
|
||||
|
||||
|
||||
/* defined the LED0 pin: PF9 */
|
||||
#define LED0_PIN GET_PIN(F, 9)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* set LED0 pin mode to output */
|
||||
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
|
||||
LOG_I("main log");
|
||||
uart3_init();
|
||||
|
||||
|
||||
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
|
||||
while (1)
|
||||
{
|
||||
rt_pin_write(LED0_PIN, PIN_HIGH);
|
||||
rt_thread_mdelay(500);
|
||||
rt_pin_write(LED0_PIN, PIN_LOW);
|
||||
rt_thread_mdelay(500);
|
||||
// LOG_I("log test");
|
||||
|
||||
}
|
||||
}
|
||||
void test_entry()
|
||||
{
|
||||
// const char testbuff[] = "test massage!!!";
|
||||
// rt_device_write(serial3,0,testbuff,strlen(testbuff));
|
||||
}
|
||||
MSH_CMD_EXPORT(test_entry,test_entry);
|
||||
|
||||
|
149
rt-thread/components/utilities/ulog/backend/ulog_file_be.c
Normal file
149
rt-thread/components/utilities/ulog/backend/ulog_file_be.c
Normal file
@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-01-07 ChenYong first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <dfs_posix.h>
|
||||
#include <dfs.h>
|
||||
|
||||
#include <ulog.h>
|
||||
#include "ulog_file.h"
|
||||
|
||||
#define ULOG_FILE_BE_NAME "file"
|
||||
|
||||
#ifndef ULOG_FILE_ROOT_PATH
|
||||
#define ULOG_FILE_ROOT_PATH "/logs"
|
||||
#endif
|
||||
#ifndef ULOG_FILE_NAME_BASE
|
||||
#define ULOG_FILE_NAME_BASE "ulog.log"
|
||||
#endif
|
||||
|
||||
#ifndef ULOG_FILE_MAX_NUM
|
||||
#define ULOG_FILE_MAX_NUM 5
|
||||
#endif
|
||||
#ifndef ULOG_FILE_MAX_SIZE
|
||||
#define ULOG_FILE_MAX_SIZE (1024 * 512)
|
||||
#endif
|
||||
|
||||
#define ULOG_FILE_PATH_LEN 128
|
||||
|
||||
#if defined(ULOG_ASYNC_OUTPUT_THREAD_STACK) && (ULOG_ASYNC_OUTPUT_THREAD_STACK < 2048)
|
||||
#error "The value of ULOG_ASYNC_OUTPUT_THREAD_STACK must be greater than 2048."
|
||||
#endif
|
||||
|
||||
static struct ulog_backend ulog_file;
|
||||
static char g_file_path[ULOG_FILE_PATH_LEN] = {0};
|
||||
static int g_file_fd = -1;
|
||||
|
||||
/* rotate the log file xxx.log.n-1 => xxx.log.n, and xxx.log => xxx.log.0 */
|
||||
static rt_bool_t ulog_file_rotate(void)
|
||||
{
|
||||
#define SUFFIX_LEN 10
|
||||
/* mv xxx.log.n-1 => xxx.log.n, and xxx.log => xxx.log.0 */
|
||||
static char old_path[ULOG_FILE_PATH_LEN], new_path[ULOG_FILE_PATH_LEN];
|
||||
int index = 0, err = 0, file_fd = 0;
|
||||
size_t base_len = 0;
|
||||
rt_bool_t result = RT_FALSE;
|
||||
|
||||
rt_memcpy(old_path, g_file_path, ULOG_FILE_PATH_LEN);
|
||||
rt_memcpy(new_path, g_file_path, ULOG_FILE_PATH_LEN);
|
||||
base_len = rt_strlen(ULOG_FILE_ROOT_PATH) + rt_strlen(ULOG_FILE_NAME_BASE) + 1;
|
||||
|
||||
if (g_file_fd >= 0)
|
||||
{
|
||||
close(g_file_fd);
|
||||
}
|
||||
|
||||
for (index = ULOG_FILE_MAX_NUM - 2; index >= 0; --index)
|
||||
{
|
||||
rt_snprintf(old_path + base_len, SUFFIX_LEN, index ? ".%d" : "", index - 1);
|
||||
rt_snprintf(new_path + base_len, SUFFIX_LEN, ".%d", index);
|
||||
/* remove the old file */
|
||||
if ((file_fd = open(new_path, O_RDONLY)) >= 0)
|
||||
{
|
||||
close(file_fd);
|
||||
unlink(new_path);
|
||||
}
|
||||
/* change the new log file to old file name */
|
||||
if ((file_fd = open(old_path , O_RDONLY)) >= 0)
|
||||
{
|
||||
close(file_fd);
|
||||
err = rename(old_path, new_path);
|
||||
}
|
||||
|
||||
if (err < 0)
|
||||
{
|
||||
result = RT_FALSE;
|
||||
goto __exit;
|
||||
}
|
||||
}
|
||||
|
||||
__exit:
|
||||
/* reopen the file */
|
||||
g_file_fd = open(g_file_path, O_CREAT | O_RDWR | O_APPEND);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void ulog_file_backend_output(struct ulog_backend *backend, rt_uint32_t level,
|
||||
const char *tag, rt_bool_t is_raw, const char *log, size_t len)
|
||||
{
|
||||
size_t file_size = 0;
|
||||
|
||||
/* check log file directory */
|
||||
if (access(ULOG_FILE_ROOT_PATH, 0) < 0)
|
||||
{
|
||||
mkdir(ULOG_FILE_ROOT_PATH, 0);
|
||||
}
|
||||
|
||||
if (g_file_fd < 0)
|
||||
{
|
||||
rt_snprintf(g_file_path, ULOG_FILE_PATH_LEN, "%s/%s", ULOG_FILE_ROOT_PATH, ULOG_FILE_NAME_BASE);
|
||||
g_file_fd = open(g_file_path, O_CREAT | O_RDWR);
|
||||
if (g_file_fd < 0)
|
||||
{
|
||||
rt_kprintf("ulog file(%s) open failed.", g_file_path);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
file_size = lseek(g_file_fd, 0, SEEK_END);
|
||||
if (file_size > ULOG_FILE_MAX_SIZE)
|
||||
{
|
||||
if (!ulog_file_rotate())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
write(g_file_fd, log, len);
|
||||
/* flush file cache */
|
||||
fsync(g_file_fd);
|
||||
}
|
||||
|
||||
/* initialize the ulog file backend */
|
||||
int ulog_file_backend_init(void)
|
||||
{
|
||||
ulog_file.output = ulog_file_backend_output;
|
||||
ulog_backend_register(&ulog_file, ULOG_FILE_BE_NAME, RT_FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* uninitialize the ulog file backend */
|
||||
int ulog_file_backend_deinit(void)
|
||||
{
|
||||
if (g_file_fd >= 0)
|
||||
{
|
||||
close(g_file_fd);
|
||||
g_file_fd = -1;
|
||||
}
|
||||
ulog_backend_unregister(&ulog_file);
|
||||
return 0;
|
||||
}
|
201
rt-thread/components/utilities/ulog_file/LICENSE
Normal file
201
rt-thread/components/utilities/ulog_file/LICENSE
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
63
rt-thread/components/utilities/ulog_file/README.md
Normal file
63
rt-thread/components/utilities/ulog_file/README.md
Normal file
@ -0,0 +1,63 @@
|
||||
# 基于文件系统的 ulog 插件
|
||||
|
||||
## 1、介绍
|
||||
|
||||
该软件包基于 ulog 组件,主要实现 ulog 文件系统后端工功能,并且支持配置参数存储功能 。
|
||||
|
||||
支持功能如下:
|
||||
|
||||
- 支持 ulog 日志存储到文件后端;
|
||||
|
||||
- 支持设置日志文件名,最大数量和大小;
|
||||
- 支持日志文件循环存储功能;
|
||||
|
||||
### 1.1 许可证
|
||||
|
||||
本软件包遵循 Apache 2.0 许可,详见 `LICENSE` 文件。
|
||||
|
||||
### 1.2 依赖
|
||||
|
||||
- RT-Thread ulog 组件
|
||||
|
||||
## 2、如何打开
|
||||
|
||||
使用本软件包需要在 RT-Thread 的包管理器中选择它,具体路径如下:
|
||||
|
||||
```c
|
||||
RT-Thread online packages
|
||||
tools packages --->
|
||||
[*] ulog_file: The ulog file backend by filesystem.
|
||||
(/logs) The root path of the saved file
|
||||
(ulog.log) The base name of the saved file
|
||||
(5) The maximum number of the saved file
|
||||
(524288) The maximum size of a file
|
||||
Version (latest) --->
|
||||
```
|
||||
|
||||
- **The root path of the saved file**:日志文件保存的根路径;
|
||||
- **The base name of the saved file**:日志文件的基础文件名,文件名格式 `ulog.log.x`;
|
||||
- **The maximum number of the saved file**:配置这日志文件最大数量;
|
||||
- **The maximum size of a file**:配置单个日志文件最大长度;
|
||||
|
||||
## 3、使用说明
|
||||
|
||||
### 3.1 文件后端初始化
|
||||
|
||||
```c
|
||||
int ulog_file_backend_init(void);
|
||||
```
|
||||
|
||||
需要在应用层调用 `ulog_file_backend_init()` 初始化函数,即可初始化 ulog 日志文件后端,开启日志输出到文件系统指定文件中;
|
||||
|
||||
### 3.1 文件后端取消初始化
|
||||
|
||||
```c
|
||||
int ulog_file_backend_deinit(void);
|
||||
```
|
||||
|
||||
需要在应用层调用 `ulog_file_backend_deinit()` 函数,可以注销 ulog 文件后端,取消日志输出到文件系统指定文件中;
|
||||
|
||||
## 4、联系方式
|
||||
|
||||
- 维护:ChenYong
|
||||
- 主页:<https://github.com/RT-Thread-packages/ulog_file.git>
|
13
rt-thread/components/utilities/ulog_file/SConscript
Normal file
13
rt-thread/components/utilities/ulog_file/SConscript
Normal file
@ -0,0 +1,13 @@
|
||||
Import('RTT_ROOT')
|
||||
Import('rtconfig')
|
||||
from building import *
|
||||
|
||||
objs = []
|
||||
cwd = GetCurrentDir()
|
||||
list = os.listdir(cwd)
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd, str(Dir('#'))]
|
||||
|
||||
group = DefineGroup('ulog_file', src, depend = ['PKG_USING_ULOG_FILE'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
20
rt-thread/components/utilities/ulog_file/ulog_file.h
Normal file
20
rt-thread/components/utilities/ulog_file/ulog_file.h
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-01-07 ChenYong first version
|
||||
*/
|
||||
|
||||
#ifndef _ULOG_FILE_H_
|
||||
#define _ULOG_FILE_H_
|
||||
|
||||
#define ULOG_FILE_SW_VERSION "1.0.0"
|
||||
#define ULOG_FILE_SW_VERSION_NUM 0x0100000
|
||||
|
||||
int ulog_file_backend_init(void);
|
||||
int ulog_file_backend_deinit(void);
|
||||
|
||||
#endif /* _ULOG_FILE_H_ */
|
15
rtconfig.h
15
rtconfig.h
@ -168,8 +168,14 @@
|
||||
#define RT_USING_ULOG
|
||||
#define ULOG_OUTPUT_LVL_D
|
||||
#define ULOG_OUTPUT_LVL 7
|
||||
#define ULOG_USING_ISR_LOG
|
||||
#define ULOG_ASSERT_ENABLE
|
||||
#define ULOG_LINE_BUF_SIZE 128
|
||||
#define ULOG_USING_ASYNC_OUTPUT
|
||||
#define ULOG_ASYNC_OUTPUT_BUF_SIZE 2048
|
||||
#define ULOG_ASYNC_OUTPUT_BY_THREAD
|
||||
#define ULOG_ASYNC_OUTPUT_THREAD_STACK 1024
|
||||
#define ULOG_ASYNC_OUTPUT_THREAD_PRIORITY 30
|
||||
|
||||
/* log format */
|
||||
|
||||
@ -235,6 +241,12 @@
|
||||
|
||||
/* tools packages */
|
||||
|
||||
#define PKG_USING_ULOG_FILE
|
||||
#define ULOG_FILE_ROOT_PATH "/logs"
|
||||
#define ULOG_FILE_NAME_BASE "ulog.log"
|
||||
#define ULOG_FILE_MAX_NUM 5
|
||||
#define ULOG_FILE_MAX_SIZE 524288
|
||||
#define PKG_USING_ULOG_FILE_V100
|
||||
/* end of tools packages */
|
||||
|
||||
/* system packages */
|
||||
@ -293,6 +305,7 @@
|
||||
/* Onboard Peripheral Drivers */
|
||||
|
||||
#define BSP_USING_USB_TO_USART
|
||||
#define BSP_USING_COM3
|
||||
#define BSP_USING_SRAM
|
||||
|
||||
/* Enable File System */
|
||||
@ -307,6 +320,8 @@
|
||||
#define BSP_USING_GPIO
|
||||
#define BSP_USING_UART
|
||||
#define BSP_USING_UART1
|
||||
#define BSP_USING_UART3
|
||||
#define BSP_UART3_RX_USING_DMA
|
||||
#define BSP_USING_ONCHIP_RTC
|
||||
#define BSP_RTC_USING_LSE
|
||||
#define BSP_USING_SDIO
|
||||
|
68
user_uart/user_uart.c
Normal file
68
user_uart/user_uart.c
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-06-14 fize the first version
|
||||
*/
|
||||
#include "user_uart.h"
|
||||
|
||||
|
||||
|
||||
static rt_err_t uart3_tx_complete(rt_device_t dev, void *buffer)
|
||||
{
|
||||
//todo: uart3_tx_complete sem: do nothing for now.
|
||||
//since dma for tx not enabled,so this callback will not be called at any time.
|
||||
LOG_I("massage sent %s",strlen(buffer));
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
//dev 设备句柄(回调函数参数)
|
||||
//size 缓冲区数据大小(回调函数参数)
|
||||
//still in ISR func,so can only use ulog at asynchronous mode.
|
||||
static rt_err_t uart3_rx_complete(rt_device_t dev, rt_size_t size)
|
||||
{
|
||||
char testbuff[20];
|
||||
uart3_simpack.rx_num=size;
|
||||
rt_sem_release(&uart3_simpack.rx_sem);
|
||||
rt_device_read(serial3,0,testbuff, size);
|
||||
// can only use ulog at asynchronous mode.
|
||||
LOG_I("massage received : %s",testbuff);
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
rt_device_t uart3_init(void)
|
||||
{
|
||||
struct serial_configure config;
|
||||
|
||||
serial3 = rt_device_find(USER_UART_NAME);
|
||||
if (serial3 == RT_NULL)
|
||||
{
|
||||
LOG_E("could not find device: %s", USER_UART_NAME);
|
||||
return RT_NULL;
|
||||
}
|
||||
config.baud_rate = BAUD_RATE_115200; //修改波特率为 115200
|
||||
config.data_bits = DATA_BITS_8; //数据位 8
|
||||
config.stop_bits = STOP_BITS_1; //停止位 1
|
||||
config.bufsz = 2048; //修改缓冲区 buff size 为 2048
|
||||
config.parity = PARITY_NONE; //无奇偶校验位
|
||||
rt_device_control(serial3, RT_DEVICE_CTRL_CONFIG, &config);
|
||||
if ((rt_device_set_tx_complete(serial3, uart3_tx_complete) || rt_device_set_rx_indicate(serial3, uart3_rx_complete))
|
||||
!= RT_EOK)
|
||||
{
|
||||
LOG_E("could not set %s 's rx|tx callback func", USER_UART_NAME);
|
||||
return RT_NULL;
|
||||
}
|
||||
//do not ust dma for rx and tx at same time
|
||||
if ( rt_device_open(serial3, RT_DEVICE_FLAG_INT_TX |RT_DEVICE_FLAG_DMA_RX|RT_DEVICE_OFLAG_RDWR ))
|
||||
{
|
||||
LOG_E("could not open device: %s", USER_UART_NAME);
|
||||
return RT_NULL;
|
||||
}
|
||||
rt_sem_init(&uart3_simpack.rx_sem, "rx3_sem", 0, RT_IPC_FLAG_PRIO);
|
||||
rt_sem_init(&uart3_simpack.tx_sem, "tx3_sem", 0, RT_IPC_FLAG_PRIO);
|
||||
return serial3;
|
||||
}
|
||||
|
38
user_uart/user_uart.h
Normal file
38
user_uart/user_uart.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-06-14 傅小二 the first version
|
||||
*/
|
||||
#ifndef APPLICATIONS_USER_UART_USER_UART_H_
|
||||
#define APPLICATIONS_USER_UART_USER_UART_H_
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include <ulog.h>
|
||||
#include <rtdef.h>
|
||||
|
||||
#define USER_UART_NAME "uart3"
|
||||
|
||||
#define READ_SERIAL3(args...) rt_device_read(serial3,0,args,args)
|
||||
|
||||
rt_device_t serial3;
|
||||
|
||||
struct uart_simpack
|
||||
{
|
||||
rt_size_t rx_num;
|
||||
rt_size_t tx_num;
|
||||
struct rt_semaphore rx_sem; /* 用于接收消息的信号量 */
|
||||
struct rt_semaphore tx_sem; /* 用于发送消息的信号量 */
|
||||
};
|
||||
typedef struct uart_simpack uart_simpack;
|
||||
|
||||
|
||||
uart_simpack uart3_simpack;
|
||||
|
||||
rt_device_t uart3_init(void);
|
||||
|
||||
#endif /* APPLICATIONS_USER_UART_USER_UART_H_ */
|
Loading…
x
Reference in New Issue
Block a user