view cdg-hybrid/cdginc/p_psi.val @ 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 35f7a1dc9f7d
children
line wrap: on
line source

/*
+--------------------------------------------------------------------------+
| PROJECT : PROTOCOL STACK                                                 |
| FILE    : p_psi.val                                                      |
| SOURCE  : "sap\psi.pdf"                                                  |
| LastModified : "2004-02-09"                                              |
| IdAndVersion : "..01.001"                                                |
| SrcFileTime  : "Thu Nov 29 09:51:16 2007"                                |
| Generated by CCDGEN_2.5.5A on Fri Oct 14 21:41:52 2016                   |
|           !!DO NOT MODIFY!!DO NOT MODIFY!!DO NOT MODIFY!!                |
+--------------------------------------------------------------------------+
*/

/* PRAGMAS
 * PREFIX                 : NONE
 * COMPATIBILITY_DEFINES  : NO (require PREFIX)
 * ALWAYS_ENUM_IN_VAL_FILE: NO
 * ENABLE_GROUP: NO
 * CAPITALIZE_TYPENAME: NO
 */


#ifndef P_PSI_VAL
#define P_PSI_VAL


#define CDG_ENTER__P_PSI_VAL

#define CDG_ENTER__FILENAME _P_PSI_VAL
#define CDG_ENTER__P_PSI_VAL__FILE_TYPE CDGINC
#define CDG_ENTER__P_PSI_VAL__LAST_MODIFIED _2004_02_09
#define CDG_ENTER__P_PSI_VAL__ID_AND_VERSION __01_001

#define CDG_ENTER__P_PSI_VAL__SRC_FILE_TIME _Thu_Nov_29_09_51_16_2007

#include "CDG_ENTER.h"

#undef CDG_ENTER__P_PSI_VAL

#undef CDG_ENTER__FILENAME

#include "p_dio.val"   /* Access values independent from the corresponding h-file. */


/*
 * Value constants for VAL_cause
 */
#define PSICS_SUCCESS                  (0xd300)   /* 0b11010011 00000000 no error   */
#define PSICS_INVALID_PARAMS           (0xd301)   /* 0b11010011 00000001 device number invalid or parameter invalid  */
#define PSICS_INTERNAL_DRV_ERROR       (0xd302)   /* 0b11010011 00000010 A driver function returned DRV_INTERNAL_ERROR */
#define PSICS_DISCONNECT               (0xd303)   /* 0b11010011 00000011 The driver signalled a DRV_SIGTYPE_DISCONNECT */

/*
 * Value constants for VAL_psi_line_states
 */
#define PSI_LINE_STD_NOT_VALID         (0x0)      /* b00000000 no line state request is given */

/*
 * Value constants for VAL_psi_baud_rate
 */
#define DIO4_BAUD_NOT_VALID            (0xffffffff)/* baudrate is not changed        */

/*
 * Value constants for VAL_psi_char_frame
 */
#define DIO_CF_NOT_VALID               (0x0)      /* char frame values are not changed */

/*
 * Value constants for VAL_psi_flow_control
 */
#define DIO_FLOW_NOT_VALID             (0xffffffff)/* flow control value are not changed */

/*
 * Value constants for VAL_psi_mux_mode
 */
#define DIO_MUX_MODE_NOT_VALID         (0xffffffff)/* mux mode is unchanged          */

/*
 * Value constants for VAL_pkt_flag
 */
#define DIO_FLAG_PKT_PROTOCOL          (0x80000000)/* device can transfer information to identify the packet protocol */
#define DIO_FLAG_PKT_PROT_NOT_VALID    (0xffffffff)/* packet flag is not changed     */

/*
 * Value constants for VAL_psi_sleep_mode
 */
#define DIO_SLEEP_NOT_VALID            (0x0)      /* value is not valid             */
#define DIO_SLEEP_NOT_CHAN             (0xff)     /* value is not changed           */

/*
 * Value constants for VAL_psi_guard_per
 */
#define DIO_GUARD_PER_NOT_VALID        (0xff)     /* guard period is not changed    */

/*
 * Value constants for VAL_psi_dev_mode
 */
#define DEV_MODE_NOT_VALID             (0x0)      /* device mode is unchanged       */

/*
 * Value constants for VAL_psi_esc_char
 */
#define ESC_CHAR_NOT_VALID             (0x0)      /* escape character is not changed */

/*
 * Value constants for VAL_pkt_type
 */
#define DIO_PACKET_IPV4                (0x21)     /* IP packet version 4            */
#define DIO_PACKET_VJ_CTCP             (0x2d)     /* IPv4 packet with Van Jacobson compressed TCP/IP header */
#define DIO_PACKET_VJ_UTCP             (0x2f)     /* IPv4 packet with Van Jacobson uncompressed TCP/IP header */
#define DIO_PACKET_IPV6                (0x57)     /* IP packet version 6            */

/*
 * Value constants for VAL_psi_xon
 */
#define XON_NOT_VALID                  (0x0)      /* xon value is unchanged         */

/*
 * Value constants for VAL_psi_xoff
 */
#define XOFF_NOT_VALID                 (0x0)      /* xoff value is unchanged        */

/*
 * Value constants for VAL_psi_n1
 */
#define PSI_MUX_N1_NOT_VALID           (0x0)      /* mux max frame size is not changed */

/*
 * Value constants for VAL_psi_n2
 */
#define PSI_MUX_N2_NOT_VALID           (0x0)      /* number of retransmission is not changed */

/*
 * Value constants for VAL_psi_t1
 */
#define PSI_MUX_T1_NOT_VALID           (0x0)      /* acknowledgement timer is not changed */

/*
 * Value constants for VAL_psi_t2
 */
#define PSI_MUX_T2_NOT_VALID           (0x0)      /* response timer is not changed  */

/*
 * Value constants for VAL_psi_t3
 */
#define PSI_MUX_T3_NOT_VALID           (0x0)      /* wake up response timer is not changed */

/*
 * Value constants for VAL_psi_k
 */
#define PSI_K_NOT_VALID                (0x0)      /* windows size  is not changed   */

/*
 * Value constants for VAL_psi_data_mode
 */
#define DRIVER_MODE_AT                 (0x1)      /* The driver will transmit AT commands. */
#define DRIVER_MODE_DATA               (0x2)      /* The driver  will transmit data. */
#define DRIVER_MODE_AT_DATA            (0x3)      /* The driver will transmit AT commands and data */

/* 
 * enum to UnionController DIO_CAP_UN 
 * CCDGEN:WriteEnum_Count==169
 */
#ifndef __T_ctrl_DIO_CAP_UN__
#define __T_ctrl_DIO_CAP_UN__
typedef enum
{
  ser_cap                        = 0x0,           
  pkt_cap                        = 0x1,           
  mux_cap                        = 0x2            
}T_ctrl_DIO_CAP_UN;
#endif

/* 
 * enum to UnionController DIO_DCB_UN 
 * CCDGEN:WriteEnum_Count==170
 */
#ifndef __T_ctrl_DIO_DCB_UN__
#define __T_ctrl_DIO_DCB_UN__
typedef enum
{
  ser_dcb                        = 0x0,           
  pkt_dcb                        = 0x1,           
  mux_dcb                        = 0x2            
}T_ctrl_DIO_DCB_UN;
#endif

/*
 * user defined constants
 */
#define PSI_PEER_ENTITY_NAME_LENGTH    (0x6)      

#include "CDG_LEAVE.h"


#endif