annotate src/ui/bmi/AUITextEntry.h @ 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 cbd9aaba48db
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #ifndef AUITEXTENTRY_H
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 #define AUITEXTENTRY_H
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 /* Key entry information*/
92
c0052fe355d3 src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
5
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 typedef struct
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 {
96
cbd9aaba48db AUITextEntry.h: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 92
diff changeset
8 T_MFW_HND win; /* The editor window */
cbd9aaba48db AUITextEntry.h: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 92
diff changeset
9 U32 update; /* Event to be sent to the window to update it */
cbd9aaba48db AUITextEntry.h: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 92
diff changeset
10 T_ED_DATA *editor; /* Pointer to editor data */
cbd9aaba48db AUITextEntry.h: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 92
diff changeset
11 UBYTE Level; /* Alpha level selected */
cbd9aaba48db AUITextEntry.h: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 92
diff changeset
12 UBYTE Key; /* Alpha mode current key */
cbd9aaba48db AUITextEntry.h: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 92
diff changeset
13 T_MFW_HND editTim; /* The timer for multi-tap */
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 T_AUI_ENTRY_DATA;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
96
cbd9aaba48db AUITextEntry.h: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 92
diff changeset
18 T_AUI_ENTRY_DATA *AUI_entry_Create(T_MFW_HND win, T_ED_DATA *editor, U32 update);
cbd9aaba48db AUITextEntry.h: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 92
diff changeset
19 void AUI_entry_Destroy(T_AUI_ENTRY_DATA *entry_data);
cbd9aaba48db AUITextEntry.h: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 92
diff changeset
20 USHORT AUI_entry_EditChar (T_AUI_ENTRY_DATA *entry_data, USHORT alphachar, BOOL multitap);
cbd9aaba48db AUITextEntry.h: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 92
diff changeset
21 USHORT AUI_entry_EditDigit (T_AUI_ENTRY_DATA *entry_data, UBYTE code);
cbd9aaba48db AUITextEntry.h: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 92
diff changeset
22 USHORT AUI_entry_EventKey (T_AUI_ENTRY_DATA *entry_data, MfwEvt event, MfwKbd *key);
cbd9aaba48db AUITextEntry.h: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 92
diff changeset
23 USHORT AUI_entry_GetKeyChar(T_AUI_ENTRY_DATA *entry_data, T_ED_CASE_PREF casePref);
cbd9aaba48db AUITextEntry.h: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 92
diff changeset
24 void AUI_entry_StopMultitap(T_AUI_ENTRY_DATA *entry_data);
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 #endif