Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update how monitoring code is generated and data stored #221

Merged
merged 74 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
1777a34
Update ZynqMonTask.c
pwittich Apr 9, 2024
ac64b8d
start breaking up LocalTasks.c
pwittich Apr 11, 2024
9b6ea79
naming cleanups
pwittich Apr 15, 2024
ca1068c
Cleanup
pwittich Apr 18, 2024
a4b5882
FFLDAQ->FFL4
pwittich May 6, 2024
a66a61c
header file cleanup and snprintf
pwittich May 6, 2024
bb96d61
code cleanup, intermediate
pwittich May 6, 2024
f49c187
clang-format
pwittich May 6, 2024
46ac14f
code that sort of works
pwittich May 7, 2024
673b016
Update Makefile clean target
pwittich May 9, 2024
a22f917
minor tweaks
pwittich May 9, 2024
6dabeab
in progress
pwittich May 19, 2024
490b449
WIP
pwittich May 19, 2024
63d601a
WIP
pwittich May 20, 2024
8cd98a0
bug fixes
pwittich May 20, 2024
59cf552
missing header
pwittich May 20, 2024
2ee56c8
fix rev1 build
pwittich May 20, 2024
4c28a27
formatting
pwittich May 20, 2024
c4e760e
add F2 task
pwittich May 21, 2024
e7cf33c
WIP
pwittich May 22, 2024
dc67bb2
clang-format
pwittich May 22, 2024
1939c57
work in progress
pwittich May 23, 2024
80d34bb
adapt to two sets of data arrays
pwittich May 23, 2024
df67d03
formatting and cleanup
pwittich May 23, 2024
081f873
clang complaint
pwittich May 23, 2024
08f68ef
fix b04 laser off bug and add ff_dump_names
pwittich May 27, 2024
e22dd8a
Merge branch 'MonDataCleanup' of github.com:apollo-lhc/cm_mcu into Mo…
pwittich May 27, 2024
8ca4325
add clock task
pwittich May 28, 2024
5b91e1b
Update SensorControl.c
pwittich May 28, 2024
85053c1
clock mon doesn't crash
pwittich May 28, 2024
663c00f
clang-format
pwittich May 28, 2024
001c597
transition to new i2c mon task
pwittich May 29, 2024
b7ccfc9
bug fixes
pwittich May 30, 2024
afcbbbf
fix rev1 build and format.
pwittich May 30, 2024
e97c1b7
remove _new and clean unused
pwittich May 30, 2024
0ce7788
format checks
pwittich May 30, 2024
5868012
speed up initial check of FF types w 4 byte reads
pwittich May 31, 2024
d258b1e
further cleanups
pwittich May 31, 2024
5bc5d5e
Update SensorControl.c
pwittich May 28, 2024
477812f
Merge branch 'master' into MonDataCleanup
pwittich May 31, 2024
c9b5510
sync yaml files, reimplement disable bit sending
pwittich May 31, 2024
8594fdb
Merge branch 'master' into MonDataCleanup
pwittich May 31, 2024
7625d22
formatting, sizes
pwittich May 31, 2024
788ce06
wip
pwittich Jun 1, 2024
5314718
cleanup and fix Rev1
pwittich Jun 2, 2024
6439b43
Committing clang-format changes
pwittich Jun 2, 2024
fc3e85c
Update xml_generate.py
pwittich Jun 2, 2024
c2f7ae8
update `FireflyType` for live check on 25G
pwittich Jun 2, 2024
dda7452
cleanup
pwittich Jun 2, 2024
eef0448
error checking
pwittich Jun 2, 2024
0930c95
minor tweaks
pwittich Jun 3, 2024
21c8631
allow for different pages for a command
pwittich Jun 3, 2024
3992ba4
cleanup
pwittich Jun 3, 2024
ba989b9
reduce scope and label active low
pwittich Jun 4, 2024
a6cce46
clean up comments
pwittich Jun 4, 2024
c154dbb
clang-format
pwittich Jun 4, 2024
0695e65
WIP
pwittich Jun 5, 2024
6299d1b
per device optical power
pwittich Jun 5, 2024
8ddabb6
add getopt* and byteswap as needed
pwittich Jun 6, 2024
42cd9a5
i2c comms with FF to 400 kHz
pwittich Jun 6, 2024
1a4baf3
new 3.3V FF command
pwittich Jun 7, 2024
9e1bd1f
logging
pwittich Jun 7, 2024
6389eee
update enable_3v8 for passing in mask of pairs
pwittich Jun 7, 2024
35e9390
clang-format
pwittich Jun 7, 2024
7e0cb1a
Update FireflyUtils.c
pwittich Jun 7, 2024
1f7ab84
fix byteswapp on optpow
pwittich Jun 11, 2024
6ce5e59
remove check on 4.0V
pwittich Jun 11, 2024
6b1f40a
housekeeping
pwittich Jun 11, 2024
011d9b9
more monitoring registers
pwittich Jun 11, 2024
338a8f1
clang-format
pwittich Jun 11, 2024
931193a
clean up constants usage
pwittich Jun 11, 2024
21bf341
Update FireflyUtils.c
pwittich Jun 11, 2024
00319b7
Update FireflyUtils.c
pwittich Jun 12, 2024
3bca61c
remove dead code
pwittich Jun 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ Checks: -*,
,readability-uniqueptr-delete-release,
,security*
,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling
,readability-braces-around-statements
,readability-*
WarningsAsErrors: ''
AnalyzeTemporaryDtors: false
HeaderFilterRegex: .*FreeRTOS.*/.*
CheckOptions:
- key: google-readability-braces-around-statements.ShortStatementLines
value: '1'
- key: readability-braces-around-statements.ShortStatementLines
value: '5'
- key: google-readability-function-size.StatementThreshold
value: '800'
- key: google-readability-namespace-comments.ShortNamespaceLines
Expand All @@ -46,4 +48,3 @@ CheckOptions:
- key: modernize-use-nullptr.NullMacros
value: 'NULL'
...

6 changes: 6 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Diagnostics:
ClangTidy:
Add: modernize*
Remove: readability-braces-around-statements
#CompileFlags:
#Add: [-Wunused-parameter]
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,5 @@ projects/cm_mcu/ZynqMon_addresses.c
projects/cm_mcu/ZynqMon_addresses.h
PL_MEM_CM_rev1.xml
PL_MEM_CM_rev2.xml
projects/cm_mcu/MonI2C_addresses.c
projects/cm_mcu/MonI2C_addresses.h
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,15 @@ check-and-reinit-submodules:
release:
@$(MAKE) -C projects/cm_mcu release

check-for-pr: format
@./buildall.sh


# 2nd dollar sign in grep command is to pass along a single dollar sign to egrep itself
format:
run-clang-format.py $(shell git diff --diff-filter=AM --name-only master | egrep '\.[ch]$$')

format-apply:
run-clang-format.py -i $(shell git diff --diff-filter=AM --name-only master | egrep '\.[ch]$$')

.PHONY: all clean $(DIRS) $(DIRSCLEAN) check-and-reinit-submodules
1 change: 1 addition & 0 deletions build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ make COMPILER=clang clean
make -j REV1=1 COMPILER=clang > /dev/null
make COMPILER=clang clean
make -j REV2=1 COMPILER=clang > /dev/null
make format > /dev/null
echo "all build succeeded."

4 changes: 2 additions & 2 deletions common/i2c_reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void initI2C3(const uint32_t sysclockfreq)
// the I2C3 module. The last parameter sets the I2C data transfer rate.
// If false the data rate is set to 100kbps and if true the data rate will
// be set to 400kbps.
MAP_I2CMasterInitExpClk(I2C3_BASE, sysclockfreq, false);
MAP_I2CMasterInitExpClk(I2C3_BASE, sysclockfreq, true);
while (!MAP_SysCtlPeripheralReady(SYSCTL_PERIPH_I2C3))
;

Expand Down Expand Up @@ -212,7 +212,7 @@ void initI2C4(const uint32_t sysclockfreq)
// the I2C4 module. The last parameter sets the I2C data transfer rate.
// If false the data rate is set to 100kbps and if true the data rate will
// be set to 400kbps.
MAP_I2CMasterInitExpClk(I2C4_BASE, sysclockfreq, false);
MAP_I2CMasterInitExpClk(I2C4_BASE, sysclockfreq, true);
while (!MAP_SysCtlPeripheralReady(SYSCTL_PERIPH_I2C4))
;

Expand Down
9 changes: 2 additions & 7 deletions common/power_ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@
* Author: wittich
*/

#include <string.h>

#include "common/power_ctl.h"
#include "common/pinsel.h"
#include "common/utils.h"

#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"

#ifdef USE_FREERTOS
#include "FreeRTOS.h"
#include "FreeRTOS.h" // IWYU pragma: keep
#include "task.h"
#endif // USE_FREERTOS

Expand Down Expand Up @@ -73,7 +68,7 @@ struct gpio_pin_t oks[] = {
//
// ------------------------------------------
// if you update this you need to update N_PS_ENABLES
static const struct gpio_pin_t enables[] = {
static const struct gpio_pin_t enables[N_PS_ENABLES] = {
{ EN_F1_INT, "EN_F1_INT", 1},
{ EN_F2_INT, "EN_F2_INT", 1},
{ EN_1V8, "EN_1V8", 2},
Expand Down
6 changes: 3 additions & 3 deletions common/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
* Created on: May 9, 2019
* Author: wittich
*/
#include <stdint.h>
#include <stddef.h>

#include "common/utils.h"
#include "common/pinsel.h"
#include "common/printf.h"
#include "driverlib/gpio.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/debug.h"
#include "driverlib/eeprom.h"
#include "FreeRTOS.h"
#include "FreeRTOS.h" // IWYU pragma: keep
#include "Tasks.h"

typedef struct error_buffer_t error_buffer_t;
Expand Down
6 changes: 3 additions & 3 deletions common/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include <stdbool.h>
#include <sys/_types.h>

#include "math.h"
#include "stdlib.h"
#include <math.h> // IWYU pragma: keep (for fmaxf, fmax, fmaxl)
#include <stdlib.h> // IWYU pragma: keep (for abs, labs, llabs, fabs, fabsf)

// write, read or toggle GPIO pin by name
void write_gpio_pin(int pin, uint8_t value);
Expand Down Expand Up @@ -127,7 +127,7 @@ bool checkStale(unsigned oldTime, unsigned newTime);

void float_to_ints(float val, int *tens, int *fraction);
// this will suffer from the double evaluation bug
//#define MAX(a,b) (a)>(b)?(a):(b)
// #define MAX(a,b) (a)>(b)?(a):(b)
// instead use these functions and a _generic macro
// this is overkill, but I'm parking it here because I never remember this exists.
inline int max(int const x, int const y)
Expand Down
1 change: 1 addition & 0 deletions projects/cm_mcu/AlarmUtilities.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "AlarmUtilities.h"
#include "Tasks.h"
#include "MonitorTask.h"
#include "FireflyUtils.h"

#include "common/log.h"
#include "common/pinsel.h"
Expand Down
36 changes: 33 additions & 3 deletions projects/cm_mcu/CommandLineTask.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,23 +299,53 @@ static struct command_t commands[] = {
0,
},
#ifdef REV2
{
"ff_cdr_ena",
ff_cdr_enable_status,
"Show FF CDR enable status\r\n",
0,
},
{
"ff_ch_dis",
ff_ch_disable_status,
"Show FF ch disable status\r\n",
0,
},
{
"ff_mux_reset",
ff_mux_reset,
"reset ff muxes, 1 or 2 for F1 or F2\r\n",
1,
},
#endif // REV2
{
"ff_dump_names",
ff_dump_names,
"dump name registers\r\n",
0,
},
{
"ff_optpow",
ff_optpow,
"Showing the FF per-ch optical power \r\n",
"Show avg FF optical power\r\n",
0,
},
{
"ff_optpow_dev",
ff_optpow_dev,
"Show dev FF optical power\r\n",
1,
},
{
"ff_volts",
ff_v3v3,
"Show FF 3v3 mon\r\n",
0,
},
#endif // REV2
{
"ff_temp",
ff_temp,
"Showing FF temperatures\r\n",
"Show FF temperatures\r\n",
0,
},
{"fpga", fpga_ctl, "Show state of FPGAs\r\n",
Expand Down
Loading