From 5a5955b60e121a2663c9d081b8fc0be08efd6ec3 Mon Sep 17 00:00:00 2001 From: tianjialong Date: Tue, 28 Feb 2023 18:21:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=B2=E5=8F=A3=E9=87=8D=E5=AE=9A=E5=90=91?= =?UTF-8?q?=E7=A7=BB=E6=A4=8D=E5=88=B0zport=E4=B8=AD=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0debug=E7=81=AF=E6=96=B9=E6=B3=95=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0zboard=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MDK-ARM/LWIP.uvguix.29643 | 15 ++- MDK-ARM/LWIP.uvoptx | 232 ++++++++++++++++++++++++---------------------- MDK-ARM/LWIP.uvprojx | 5 + usersrc/usermain.c | 15 +-- usersrc/zboard.h | 11 +++ usersrc/zport.c | 37 ++++++++ usersrc/zport.h | 11 +++ 7 files changed, 202 insertions(+), 124 deletions(-) create mode 100644 usersrc/zboard.h create mode 100644 usersrc/zport.c create mode 100644 usersrc/zport.h diff --git a/MDK-ARM/LWIP.uvguix.29643 b/MDK-ARM/LWIP.uvguix.29643 index 0fd46d2..52af408 100644 --- a/MDK-ARM/LWIP.uvguix.29643 +++ b/MDK-ARM/LWIP.uvguix.29643 @@ -110,8 +110,8 @@ 0 - 282 - 01000000040000000100000001000000010000000100000000000000020000000000000001000000010000000000000028000000280000000100000001000000000000000100000052433A5C55736572735C32393634335C4465736B746F705C705F6C7573746572696E635F63616D6572615F666F63616C6C656E6774685F656E636F6465725F72657365745C5372635C6672656572746F732E63000000000A6672656572746F732E6300000000C5D4F200FFFFFFFF0100000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD5000100000000000000020000007408000066000000000F0000B1020000 + 396 + 01000000040000000100000001000000010000000100000000000000020000000000000001000000010000000000000028000000280000000100000002000000010000000100000052433A5C55736572735C32393634335C4465736B746F705C705F6C7573746572696E635F63616D6572615F666F63616C6C656E6774685F656E636F6465725F72657365745C5372635C6672656572746F732E63000000000A6672656572746F732E6300000000C5D4F200FFFFFFFF56433A5C55736572735C32393634335C4465736B746F705C705F6C7573746572696E635F63616D6572615F666F63616C6C656E6774685F656E636F6465725F72657365745C757365727372635C757365726D61696E2E63000000000A757365726D61696E2E6300000000FFDC7800FFFFFFFF0100000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD5000100000000000000020000007408000066000000000F0000B1020000 @@ -1862,7 +1862,7 @@ 0 100 - 0 + 1 ../Src/freertos.c 44 @@ -1872,6 +1872,15 @@ 0 + + ..\usersrc\usermain.c + 0 + 1 + 1 + 1 + + 0 + diff --git a/MDK-ARM/LWIP.uvoptx b/MDK-ARM/LWIP.uvoptx index 4e1fa95..3c13779 100644 --- a/MDK-ARM/LWIP.uvoptx +++ b/MDK-ARM/LWIP.uvoptx @@ -352,6 +352,18 @@ 0 0 + + 3 + 13 + 1 + 0 + 0 + 0 + ..\usersrc\zport.c + zport.c + 0 + 0 + @@ -362,7 +374,7 @@ 0 4 - 13 + 14 1 0 0 @@ -382,7 +394,7 @@ 0 5 - 14 + 15 1 0 0 @@ -394,7 +406,7 @@ 5 - 15 + 16 1 0 0 @@ -406,7 +418,7 @@ 5 - 16 + 17 1 0 0 @@ -418,7 +430,7 @@ 5 - 17 + 18 1 0 0 @@ -430,7 +442,7 @@ 5 - 18 + 19 1 0 0 @@ -442,7 +454,7 @@ 5 - 19 + 20 1 0 0 @@ -454,7 +466,7 @@ 5 - 20 + 21 1 0 0 @@ -466,7 +478,7 @@ 5 - 21 + 22 1 0 0 @@ -478,7 +490,7 @@ 5 - 22 + 23 1 0 0 @@ -490,7 +502,7 @@ 5 - 23 + 24 1 0 0 @@ -502,7 +514,7 @@ 5 - 24 + 25 1 0 0 @@ -514,7 +526,7 @@ 5 - 25 + 26 1 0 0 @@ -526,7 +538,7 @@ 5 - 26 + 27 1 0 0 @@ -538,7 +550,7 @@ 5 - 27 + 28 1 0 0 @@ -550,7 +562,7 @@ 5 - 28 + 29 1 0 0 @@ -562,7 +574,7 @@ 5 - 29 + 30 1 0 0 @@ -574,7 +586,7 @@ 5 - 30 + 31 1 0 0 @@ -594,7 +606,7 @@ 0 6 - 31 + 32 1 0 0 @@ -614,7 +626,7 @@ 0 7 - 32 + 33 1 0 0 @@ -626,7 +638,7 @@ 7 - 33 + 34 1 0 0 @@ -638,7 +650,7 @@ 7 - 34 + 35 1 0 0 @@ -650,7 +662,7 @@ 7 - 35 + 36 1 0 0 @@ -662,7 +674,7 @@ 7 - 36 + 37 1 0 0 @@ -674,7 +686,7 @@ 7 - 37 + 38 1 0 0 @@ -686,7 +698,7 @@ 7 - 38 + 39 1 0 0 @@ -698,7 +710,7 @@ 7 - 39 + 40 1 0 0 @@ -710,7 +722,7 @@ 7 - 40 + 41 1 0 0 @@ -722,7 +734,7 @@ 7 - 41 + 42 1 0 0 @@ -742,7 +754,7 @@ 0 8 - 42 + 43 1 0 0 @@ -754,7 +766,7 @@ 8 - 43 + 44 1 0 0 @@ -766,7 +778,7 @@ 8 - 44 + 45 1 0 0 @@ -778,7 +790,7 @@ 8 - 45 + 46 1 0 0 @@ -790,7 +802,7 @@ 8 - 46 + 47 1 0 0 @@ -802,7 +814,7 @@ 8 - 47 + 48 1 0 0 @@ -814,7 +826,7 @@ 8 - 48 + 49 1 0 0 @@ -826,7 +838,7 @@ 8 - 49 + 50 1 0 0 @@ -838,7 +850,7 @@ 8 - 50 + 51 1 0 0 @@ -850,7 +862,7 @@ 8 - 51 + 52 1 0 0 @@ -862,7 +874,7 @@ 8 - 52 + 53 1 0 0 @@ -874,7 +886,7 @@ 8 - 53 + 54 1 0 0 @@ -886,7 +898,7 @@ 8 - 54 + 55 1 0 0 @@ -898,7 +910,7 @@ 8 - 55 + 56 1 0 0 @@ -910,7 +922,7 @@ 8 - 56 + 57 1 0 0 @@ -922,7 +934,7 @@ 8 - 57 + 58 1 0 0 @@ -934,7 +946,7 @@ 8 - 58 + 59 1 0 0 @@ -946,7 +958,7 @@ 8 - 59 + 60 1 0 0 @@ -958,7 +970,7 @@ 8 - 60 + 61 1 0 0 @@ -970,7 +982,7 @@ 8 - 61 + 62 1 0 0 @@ -982,7 +994,7 @@ 8 - 62 + 63 1 0 0 @@ -994,7 +1006,7 @@ 8 - 63 + 64 1 0 0 @@ -1006,7 +1018,7 @@ 8 - 64 + 65 1 0 0 @@ -1018,7 +1030,7 @@ 8 - 65 + 66 1 0 0 @@ -1030,7 +1042,7 @@ 8 - 66 + 67 1 0 0 @@ -1042,7 +1054,7 @@ 8 - 67 + 68 1 0 0 @@ -1054,7 +1066,7 @@ 8 - 68 + 69 1 0 0 @@ -1066,7 +1078,7 @@ 8 - 69 + 70 1 0 0 @@ -1078,7 +1090,7 @@ 8 - 70 + 71 1 0 0 @@ -1090,7 +1102,7 @@ 8 - 71 + 72 1 0 0 @@ -1102,7 +1114,7 @@ 8 - 72 + 73 1 0 0 @@ -1114,7 +1126,7 @@ 8 - 73 + 74 1 0 0 @@ -1126,7 +1138,7 @@ 8 - 74 + 75 1 0 0 @@ -1138,7 +1150,7 @@ 8 - 75 + 76 1 0 0 @@ -1150,7 +1162,7 @@ 8 - 76 + 77 1 0 0 @@ -1162,7 +1174,7 @@ 8 - 77 + 78 1 0 0 @@ -1174,7 +1186,7 @@ 8 - 78 + 79 1 0 0 @@ -1186,7 +1198,7 @@ 8 - 79 + 80 1 0 0 @@ -1198,7 +1210,7 @@ 8 - 80 + 81 1 0 0 @@ -1210,7 +1222,7 @@ 8 - 81 + 82 1 0 0 @@ -1222,7 +1234,7 @@ 8 - 82 + 83 1 0 0 @@ -1234,7 +1246,7 @@ 8 - 83 + 84 1 0 0 @@ -1246,7 +1258,7 @@ 8 - 84 + 85 1 0 0 @@ -1258,7 +1270,7 @@ 8 - 85 + 86 1 0 0 @@ -1270,7 +1282,7 @@ 8 - 86 + 87 1 0 0 @@ -1282,7 +1294,7 @@ 8 - 87 + 88 1 0 0 @@ -1294,7 +1306,7 @@ 8 - 88 + 89 1 0 0 @@ -1306,7 +1318,7 @@ 8 - 89 + 90 1 0 0 @@ -1318,7 +1330,7 @@ 8 - 90 + 91 1 0 0 @@ -1330,7 +1342,7 @@ 8 - 91 + 92 1 0 0 @@ -1342,7 +1354,7 @@ 8 - 92 + 93 1 0 0 @@ -1354,7 +1366,7 @@ 8 - 93 + 94 1 0 0 @@ -1366,7 +1378,7 @@ 8 - 94 + 95 1 0 0 @@ -1378,7 +1390,7 @@ 8 - 95 + 96 1 0 0 @@ -1390,7 +1402,7 @@ 8 - 96 + 97 1 0 0 @@ -1402,7 +1414,7 @@ 8 - 97 + 98 1 0 0 @@ -1414,7 +1426,7 @@ 8 - 98 + 99 1 0 0 @@ -1426,7 +1438,7 @@ 8 - 99 + 100 1 0 0 @@ -1438,7 +1450,7 @@ 8 - 100 + 101 1 0 0 @@ -1450,7 +1462,7 @@ 8 - 101 + 102 1 0 0 @@ -1462,7 +1474,7 @@ 8 - 102 + 103 1 0 0 @@ -1474,7 +1486,7 @@ 8 - 103 + 104 1 0 0 @@ -1486,7 +1498,7 @@ 8 - 104 + 105 1 0 0 @@ -1498,7 +1510,7 @@ 8 - 105 + 106 1 0 0 @@ -1510,7 +1522,7 @@ 8 - 106 + 107 1 0 0 @@ -1522,7 +1534,7 @@ 8 - 107 + 108 1 0 0 @@ -1534,7 +1546,7 @@ 8 - 108 + 109 1 0 0 @@ -1546,7 +1558,7 @@ 8 - 109 + 110 1 0 0 @@ -1558,7 +1570,7 @@ 8 - 110 + 111 1 0 0 @@ -1570,7 +1582,7 @@ 8 - 111 + 112 1 0 0 @@ -1582,7 +1594,7 @@ 8 - 112 + 113 1 0 0 @@ -1594,7 +1606,7 @@ 8 - 113 + 114 1 0 0 @@ -1606,7 +1618,7 @@ 8 - 114 + 115 1 0 0 @@ -1618,7 +1630,7 @@ 8 - 115 + 116 1 0 0 @@ -1630,7 +1642,7 @@ 8 - 116 + 117 1 0 0 @@ -1642,7 +1654,7 @@ 8 - 117 + 118 1 0 0 @@ -1654,7 +1666,7 @@ 8 - 118 + 119 1 0 0 @@ -1666,7 +1678,7 @@ 8 - 119 + 120 1 0 0 @@ -1678,7 +1690,7 @@ 8 - 120 + 121 1 0 0 @@ -1690,7 +1702,7 @@ 8 - 121 + 122 1 0 0 @@ -1702,7 +1714,7 @@ 8 - 122 + 123 1 0 0 diff --git a/MDK-ARM/LWIP.uvprojx b/MDK-ARM/LWIP.uvprojx index 7654408..27dec78 100644 --- a/MDK-ARM/LWIP.uvprojx +++ b/MDK-ARM/LWIP.uvprojx @@ -606,6 +606,11 @@ 1 ..\usersrc\usermain.c + + zport.c + 1 + ..\usersrc\zport.c + diff --git a/usersrc/usermain.c b/usersrc/usermain.c index a48d447..d44c3fc 100644 --- a/usersrc/usermain.c +++ b/usersrc/usermain.c @@ -7,24 +7,17 @@ #include "lwip/sys.h" #include "lwip/api.h" #include "main.h" - -int fputc(int ch, FILE *stream) -{ - uint8_t c = ch; - HAL_UART_Transmit(&huart1, &c, 1, 100); - return ch; -} +#include "zport.h" +#include "zboard.h" void user_main() { printf("==============ethernet_sound_acquisition_card=============\r\n"); + printf("version %d.%d", VERSION_MAIN_ID, VERSION_SUB_ID); while (1) { - HAL_GPIO_TogglePin(GPIOF, GPIO_PIN_10); - HAL_Delay(1000); - HAL_GPIO_TogglePin(GPIOF, GPIO_PIN_10); - HAL_Delay(1000); + port_do_debug_light_state(); osDelay(1); } } diff --git a/usersrc/zboard.h b/usersrc/zboard.h new file mode 100644 index 0000000..703dd96 --- /dev/null +++ b/usersrc/zboard.h @@ -0,0 +1,11 @@ +#pragma once + +#define VERSION_MAIN_ID 1 +#define VERSION_SUB_ID 1 + +/*********************************************************************************************************************** + * =======================================================DEBUG======================================================= * + ***********************************************************************************************************************/ +#define DEBUG_UART huart1 //直接使用指令串口作为调试串口 +#define DEBUG_LIGHT_PORT GPIOF +#define DEBUG_LIGHT_PIN GPIO_PIN_10 diff --git a/usersrc/zport.c b/usersrc/zport.c new file mode 100644 index 0000000..ee9e3af --- /dev/null +++ b/usersrc/zport.c @@ -0,0 +1,37 @@ +#include "zport.h" + +#include +#include +#include "zboard.h" + +static uint32_t sys_haspassedms(uint32_t ticket) +{ + uint32_t nowticket = HAL_GetTick(); + if (nowticket >= ticket) + { + return nowticket - ticket; + } + return UINT32_MAX - ticket + nowticket; +} + +///********************************************************************************************************************** +// * ===================================================printf重定向=================================================== * +// **********************************************************************************************************************/ +int fputc(int ch, FILE *stream) +{ + uint8_t c = ch; + HAL_UART_Transmit(&DEBUG_UART, &c, 1, 100); + return ch; +} +///*********************************************************************************************************************** +// * ====================================================调试指示灯===================================================== * +// ***********************************************************************************************************************/ +void port_do_debug_light_state(void) +{ + static uint32_t lastprocess = 0; + if (sys_haspassedms(lastprocess) > 300) + { + lastprocess = HAL_GetTick(); + HAL_GPIO_TogglePin(DEBUG_LIGHT_PORT, DEBUG_LIGHT_PIN); + } +} diff --git a/usersrc/zport.h b/usersrc/zport.h new file mode 100644 index 0000000..d6a6b39 --- /dev/null +++ b/usersrc/zport.h @@ -0,0 +1,11 @@ +#pragma once +#include +#include +#include + +#include "usart.h" + +/*********************************************************************************************************************** + * ====================================================调试指示灯===================================================== * + ***********************************************************************************************************************/ +void port_do_debug_light_state(void);