annotate components/l1_int @ 220:0ed36de51973

ABB semaphore protection overhaul The ABB semaphone protection logic that came with TCS211 from TI was broken in several ways: * Some semaphore-protected functions were called from Application_Initialize() context. NU_Obtain_Semaphore() called with NU_SUSPEND fails with NU_INVALID_SUSPEND in this context, but the return value wasn't checked, and NU_Release_Semaphore() would be called unconditionally at the end. The latter call would increment the semaphore count past 1, making the semaphore no longer binary and thus no longer effective for resource protection. The fix is to check the return value from NU_Obtain_Semaphore() and skip the NU_Release_Semaphore() call if the semaphore wasn't properly obtained. * Some SPI hardware manipulation was being done before entering the semaphore- protected critical section. The fix is to reorder the code: first obtain the semaphore, then do everything else. * In the corner case of L1/DSP recovery, l1_abb_power_on() would call some non-semaphore-protected ABB & SPI init functions. The fix is to skip those calls in the case of recovery. * A few additional corner cases existed, all of which are fixed by making ABB semaphore protection 100% consistent for all ABB functions and code paths. There is still one remaining problem of priority inversion: suppose a low- priority task calls an ABB function, and some medium-priority task just happens to preempt right in the middle of that semaphore-protected ABB operation. Then the high-priority SPI task is locked out for a non-deterministic time until that medium-priority task finishes its work and goes back to sleep. This priority inversion problem remains outstanding for now.
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Apr 2021 20:55:25 +0000
parents 598958aec071
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 # Building l1_int.lib
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 SRCDIR=$SRC/cs/layer1
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 # *_intram.c generation
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 helpers/makeline dep l1_cmplx_intram.c $SRCDIR/cfile/l1_cmplx.c \
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 >> $BUILD_DIR/$LIBNAME/Makefile
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 helpers/makeline cmd sed -n -f $SRCDIR/tools/intram.sed '$<' '>' '$@' \
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 >> $BUILD_DIR/$LIBNAME/Makefile
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 echo >> $BUILD_DIR/$LIBNAME/Makefile
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 helpers/makeline dep l1_sync_intram.c $SRCDIR/cfile/l1_sync.c \
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 >> $BUILD_DIR/$LIBNAME/Makefile
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 helpers/makeline cmd sed -n -f $SRCDIR/tools/intram.sed '$<' '>' '$@' \
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 >> $BUILD_DIR/$LIBNAME/Makefile
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 echo >> $BUILD_DIR/$LIBNAME/Makefile
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 if [ "$GPRS" = 1 ]
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 then
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 helpers/makeline dep l1p_cmpl_intram.c $SRCDIR/p_cfile/l1p_cmpl.c \
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 >> $BUILD_DIR/$LIBNAME/Makefile
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 helpers/makeline cmd sed -n -f $SRCDIR/tools/intram.sed '$<' '>' '$@' \
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 >> $BUILD_DIR/$LIBNAME/Makefile
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 echo >> $BUILD_DIR/$LIBNAME/Makefile
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 helpers/makeline dep l1p_sync_intram.c $SRCDIR/p_cfile/l1p_sync.c \
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 >> $BUILD_DIR/$LIBNAME/Makefile
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 helpers/makeline cmd sed -n -f $SRCDIR/tools/intram.sed '$<' '>' '$@' \
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 >> $BUILD_DIR/$LIBNAME/Makefile
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 echo >> $BUILD_DIR/$LIBNAME/Makefile
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 fi
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 # Compilation
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 CFLAGS="-g -me -pw2 -mt -o -mw"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 CPPFLAGS="-DRV_TRACE_LEVEL_WARNING=2 -DTOOL_CHOICE=0 -D_TMS470"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 # Includes
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 CPPFLAGS="$CPPFLAGS -I../config"
26
598958aec071 components: switch to new Nucleus
Mychaela Falconia <falcon@freecalypso.org>
parents: 23
diff changeset
42 CPPFLAGS="$CPPFLAGS -I$SRC/nucleus"
22
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 CPPFLAGS="$CPPFLAGS -I.."
23
fdc83c1ab3ff components: first automated conversion pass
Mychaela Falconia <falcon@freecalypso.org>
parents: 22
diff changeset
44 CPPFLAGS="$CPPFLAGS -I$SRC/gpf/frame/cust_os"
22
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 CPPFLAGS="$CPPFLAGS -I$SRC/cs/system"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_app"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_app/buzzer"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_app/ffs"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_app/sim"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_app/uart"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 CPPFLAGS="$CPPFLAGS -I$SRC/cs/riviera"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 CPPFLAGS="$CPPFLAGS -I$SRC/cs/riviera/rv"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 CPPFLAGS="$CPPFLAGS -I$SRC/cs/riviera/rvt"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 CPPFLAGS="$CPPFLAGS -I$SRC/cs/services"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 CPPFLAGS="$CPPFLAGS -I$SRC/cs/services/audio"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 CPPFLAGS="$CPPFLAGS -I$SRC/cs/layer1/audio_cust0"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 CPPFLAGS="$CPPFLAGS -I$SRC/cs/layer1/audio_include"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 CPPFLAGS="$CPPFLAGS -I$SRC/cs/layer1/cust0"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 CPPFLAGS="$CPPFLAGS -I$SRC/cs/layer1/hmacs"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 CPPFLAGS="$CPPFLAGS -I$SRC/cs/layer1/include"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 CPPFLAGS="$CPPFLAGS -I$SRC/cs/layer1/p_include"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 CPPFLAGS="$CPPFLAGS -I$SRC/cs/layer1/tm_include"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 CPPFLAGS="$CPPFLAGS -I$SRC/cs/layer1/tm_cust0"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 CPPFLAGS="$CPPFLAGS -I$SRC/cs/layer1/dyn_dwl_include"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 CPPFLAGS="$CPPFLAGS -I$SRC/cs/layer1/tpu_drivers/p_source0"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 CPPFLAGS="$CPPFLAGS -I$SRC/cs/layer1/tpu_drivers/source0"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 CPPFLAGS="$CPPFLAGS -I$SRC/cs/layer1/tpu_drivers/source"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/abb"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/armio"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/clkm"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/conf"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/dma"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/dsp_dwnld"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/inth"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/memif"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/rhea"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/security"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/spi"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/timer"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/uart"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/ulpd"
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 # Source modules
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 cfile_plain $SRCDIR/cfile/l1_func.c
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 cfile_plain $SRCDIR/cfile/l1_drive.c
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 cfile_plain $SRCDIR/cfile/l1_mfmgr.c
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 cfile_plain $SRCDIR/cfile/l1_ctl.c
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 cfile_plain $SRCDIR/audio_cfile/l1audio_func.c
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 cfile_plain $SRCDIR/audio_cfile/l1audio_sync.c
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 #cfile_plain $SRCDIR/gtt_cfile/ctm/viterbi.c
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 #cfile_plain $SRCDIR/gtt_cfile/ctm/wait_for_sync.c
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 cfile_plain $SRCDIR/dl1/dl1_com.c
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 cfile_plain $SRCDIR/cfile/l1_api_hisr.c
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 if [ "$GPRS" = 1 ]
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 then
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 cfile_plain $SRCDIR/p_cfile/l1p_ctl.c
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 cfile_plain $SRCDIR/p_cfile/l1p_func.c
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 cfile_plain $SRCDIR/p_cfile/l1p_driv.c
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 cfile_plain $SRCDIR/cmacs/macs.c
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 fi
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 cfile_plain l1_cmplx_intram.c
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 cfile_plain l1_sync_intram.c
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 if [ "$GPRS" = 1 ]
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 then
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 cfile_plain l1p_cmpl_intram.c
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 cfile_plain l1p_sync_intram.c
7ded024bf471 components: pruned import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 fi