view cdg-hybrid/cdginc/p_t30.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_t30.val                                                      |
| SOURCE  : "sap\t30.pdf"                                                  |
| LastModified : "2002-04-23"                                              |
| IdAndVersion : "8411.104.98.312"                                         |
| SrcFileTime  : "Thu Nov 29 09:54:28 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_T30_VAL
#define P_T30_VAL


#define CDG_ENTER__P_T30_VAL

#define CDG_ENTER__FILENAME _P_T30_VAL
#define CDG_ENTER__P_T30_VAL__FILE_TYPE CDGINC
#define CDG_ENTER__P_T30_VAL__LAST_MODIFIED _2002_04_23
#define CDG_ENTER__P_T30_VAL__ID_AND_VERSION _8411_104_98_312

#define CDG_ENTER__P_T30_VAL__SRC_FILE_TIME _Thu_Nov_29_09_54_28_2007

#include "CDG_ENTER.h"

#undef CDG_ENTER__P_T30_VAL

#undef CDG_ENTER__FILENAME


/*
 * Value constants for VAL_dir
 */
#define DIR_SND                        (0x0)      /* send fax data                  */
#define DIR_RCV                        (0x1)      /* receive fax data               */

/*
 * Value constants for VAL_sgn
 */
#define SGN_OK                         (0x0)      /* OK                             */
#define SGN_DIS                        (0x1)      /* Digital identification signal  */
#define SGN_CSI                        (0x2)      /* Called subscriber identification */
#define SGN_NSF                        (0x4)      /* Non-standard facilities        */
#define SGN_CFR                        (0x21)     /* Confirmation to receive        */
#define SGN_FTT                        (0x22)     /* Failure to train               */
#define SGN_MCF                        (0x31)     /* Message confirmation           */
#define SGN_RTN                        (0x32)     /* Retrain negative               */
#define SGN_RTP                        (0x33)     /* Retrain positive               */
#define SGN_PIN                        (0x34)     /* Procedure interrupt negative   */
#define SGN_PIP                        (0x35)     /* Procedure interrupt positive   */
#define SGN_FDM                        (0x3f)     /* File diagnostics message       */
#define SGN_DCS                        (0x41)     /* Digital command signal         */
#define SGN_TSI                        (0x42)     /* Transmitting subscriber identification */
#define SGN_SUB                        (0x43)     /* Subaddress                     */
#define SGN_NSS                        (0x44)     /* Non-standard set-up            */
#define SGN_PWDR                       (0x45)     /* Password - receive             */
#define SGN_TCF                        (0x4f)     /* Training check frame           */
#define SGN_CRP                        (0x58)     /* Command repeat                 */
#define SGN_DCN                        (0x5f)     /* Disconnect                     */
#define SGN_EOM                        (0x71)     /* End of message                 */
#define SGN_MPS                        (0x72)     /* Multi-page signal              */
#define SGN_EOP                        (0x74)     /* End of procedure               */
#define SGN_PRI_EOM                    (0x79)     /* Procedure Interrupt - End Of Message */
#define SGN_PRI_MPS                    (0x7a)     /* Procedure Interrupt - MultiPage Signal */
#define SGN_PRI_EOP                    (0x7c)     /* Procedure Interrupt - End Of Procedure */
#define SGN_DTC                        (0x81)     /* Digital transmit command       */
#define SGN_CIG                        (0x82)     /* Calling subscriber identification */
#define SGN_PWDS                       (0x83)     /* Password  - send               */
#define SGN_NSC                        (0x84)     /* Non-standard facilities command */
#define SGN_SEP                        (0x85)     /* Selective Polling              */
#define SGN_FCS_ERR                    (0xf1)     /* FCS error                      */
#define SGN_NO_RES                     (0xf2)     /* No response                    */
#define SGN_CONT                       (0xf3)     /* continue                       */
#define SGN_NOT_USED                   (0xff)     /* Not used                       */

/*
 * Value constants for VAL_cmpl
 */
#define CMPL_EOP                       (0x0)      /* end of procedure               */
#define CMPL_EOM                       (0x1)      /* end of message                 */
#define CMPL_PI                        (0x2)      /* procedure interrupt            */
#define CMPL_DCN                       (0x3)      /* disconnect                     */

/*
 * Value constants for VAL_cause
 */
#define ERR_PH_A_UNSPEC                (0x4d10)   /* unspecified phase A error      */
#define ERR_PH_A_T1_TIMEOUT            (0x4d11)   /* no answer (T30 T1 timeout)     */
#define ERR_PH_B_SND_UNSPEC            (0x4d20)   /* unspecified transmit phase B error */
#define ERR_PH_B_SND_CANT_RCV_OR_SND   (0x4d21)   /* remote cannot receive or send  */
#define ERR_PH_B_SND_COMREC            (0x4d22)   /* COMREC error in transmit phase B */
#define ERR_PH_B_SND_COMREC_INVALID_CMD_RCVD (0x4d23)/* COMREC invalid command received */
#define ERR_PH_B_SND_RSPREC            (0x4d24)   /* RSPREC transmit error phase B  */
#define ERR_PH_B_SND_DCS_RPTD_3_TIMES  (0x4d25)   /* DCS send three times without response */
#define ERR_PH_B_SND_DIS_DTC_RCVD_3_TIMES (0x4d26)/* DIS/DTC received 3 times; DCS not recognized */
#define ERR_PH_B_SND_FTT_2400          (0x4d27)   /* failure to train at 2400 bit/s or +FMS value */
#define ERR_PH_B_SND_INVALID_RESP_RCVD (0x4d28)   /* invalid respones received      */
#define ERR_PH_C_SND_UNSPEC            (0x4d40)   /* unspecified transmit phase C error */
#define ERR_PH_C_SND_UNSPEC_IMAGE_CONV (0x4d41)   /* unspecified image format error */
#define ERR_PH_C_SND_DTE_TO_DTC_DATA_UNDERFLOW (0x4d43)/* DTE to DTC data underflow      */
#define ERR_PH_C_SND_UNRECOG_TRANSP_DATA_CMD (0x4d44)/* unrecognized transparent data command */
#define ERR_PH_C_SND_IMAGE_LINE_LENGTH (0x4d45)   /* image error, line length wrong */
#define ERR_PH_C_SND_IMAGE_PAGE_LENGTH (0x4d46)   /* image error, page length wrong */
#define ERR_PH_C_SND_IMAGE_COMPRESSION_MODE (0x4d47)/* image error, compression mode wrong */
#define ERR_PH_D_SND_UNSPEC            (0x4d50)   /* unspecified transmit phase D error */
#define ERR_PH_D_SND_RSPREC            (0x4d51)   /* RESPREC transmit error phase D */
#define ERR_PH_D_SND_MPS_RPTD_3_TIMES  (0x4d52)   /* no response to MPS repeated 3 times */
#define ERR_PH_D_SND_INVALID_RESP_TO_MPS (0x4d53) /* invalid respones to MPS        */
#define ERR_PH_D_SND_EOP_RPTD_3_TIMES  (0x4d54)   /* no response to EOP repeated 3 times */
#define ERR_PH_D_SND_INVALID_RESP_TO_EOP (0x4d55) /* invalid response to EOP        */
#define ERR_PH_D_SND_EOM_RPTD_3_TIMES  (0x4d56)   /* no response to EOM repeated 3 times */
#define ERR_PH_D_SND_INVALID_RESP_TO_EOM (0x4d57) /* invalid response to EOM        */
#define ERR_PH_D_SND_UNABLE_TO_CONT    (0x4d58)   /* unable to continue after PIN or PIP */
#define ERR_PH_B_RCV_UNSPEC            (0x4d70)   /* unspecified receive phase B error */
#define ERR_PH_B_RCV_RSPREC            (0x4d71)   /* RSPREC receive error phase B   */
#define ERR_PH_B_RCV_COMREC            (0x4d72)   /* COMREC error in receive phase B */
#define ERR_PH_B_RCV_EXP_PAGE_NOT_RCVD (0x4d73)   /* T30 T2 timeout, expected page not received */
#define ERR_PH_B_RCV_T1_TIMEOUT_AFTER_EOM_RCVD (0x4d74)/* T30 T1 timeout after EOM received */
#define ERR_PH_C_RCV_UNSPEC            (0x4d90)   /* unspecified receive phase C error */
#define ERR_PH_C_RCV_EOL_MISSING       (0x4d91)   /* missing EOL after 5 seconds (3.2/T4) */
#define ERR_PH_C_RCV_DCE_TO_DTE_BUFFER_OVERFLOW (0x4d93)/* DCE to DTE buffer overflow     */
#define ERR_PH_C_RCV_BAD_CRC_OR_FRAME  (0x4d94)   /* bad crc or frame (ECM mode)    */
#define ERR_PH_D_RCV_UNSPEC            (0x4da0)   /* unspecified receive phase D error */
#define ERR_PH_D_RCV_RSPREC_INVALID_RESP_RCVD (0x4da1)/* RSPREC invalid respones received */
#define ERR_PH_D_RCV_COMREC_INVALID_RESP_RCVD (0x4da2)/* COMREC invalid respones received */
#define ERR_PH_D_RCV_UNABLE_TO_CONT    (0x4da3)   /* unable to continue after PIN or PIP */
#define ERR_PH_B_SND_RESERVED1         (0xcde0)   /* reserved                       */
#define ERR_PH_B_SND_RESERVED2         (0xcde1)   /* reserved                       */
#define ERR_PH_B_SND_RESERVED3         (0xcde2)   /* reserved                       */
#define ERR_PH_C_SND_RESERVED1         (0xcde3)   /* reserved                       */
#define ERR_PH_C_SND_RESERVED2         (0xcde4)   /* reserved                       */
#define ERR_PH_D_SND_RESERVED1         (0xcde5)   /* reserved                       */
#define ERR_PH_D_SND_RESERVED2         (0xcde6)   /* reserved                       */
#define ERR_PH_D_SND_RESERVED3         (0xcde7)   /* reserved                       */
#define ERR_PH_B_RCV_NO_RESP           (0xcde8)   /* T2 timeout, no response        */
#define ERR_PH_B_RCV_INVALID_RESP_RCVD (0xcde9)   /* invalid respones received      */
#define ERR_PH_B_RCV_RESERVED3         (0xcdea)   /* reserved                       */
#define ERR_PH_C_RCV_RESERVED1         (0xcdeb)   /* reserved                       */
#define ERR_PH_C_RCV_RESERVED2         (0xcdec)   /* reserved                       */
#define ERR_PH_D_RCV_NO_RESP           (0xcded)   /* T2 timeout, no response        */
#define ERR_PH_D_RCV_INVALID_RESP_RCVD (0xcdee)   /* invalid respones received      */
#define ERR_PH_D_RCV_RESERVED3         (0xcdef)   /* reserved                       */
#define ERR_SGN_NOT_ALLOWED            (0xcdf0)   /* signal not allowed             */
#define ERR_CCD_ENC                    (0xcdf1)   /* CCD encoding error             */

/*
 * Value constants for VAL_test_mode
 */
#define TST_OFF                        (0x0)      /* normal                         */
#define TST_BCS                        (0x1)      /* test BCS formatter only        */
#define TST_STUFF                      (0x2)      /* stuffing/destuffing off        */
#define TST_FCS                        (0x4)      /* FCS generating/checking off    */
#define TST_CTRL                       (0x8)      /* Control checking off           */
#define TST_RTC                        (0x10)     /* RTC checking off               */
#define TST_MIR                        (0x20)     /* mirror report strings          */
#define TST_BUF                        (0x80)     /* show contents of buffer        */

/*
 * Value constants for VAL_bitorder
 */
#define FBO_NRM_DATA                   (0x0)      /* no change in bitorder for DATA  frames */
#define FBO_NRM_STATUS                 (0x0)      /* no change in bitorder for STATUS  frames */
#define FBO_REV_DATA                   (0x1)      /* reverse bitorder only for MSG frames */
#define FBO_REV_STATUS                 (0x2)      /* reverse bitorder only for STATUS frames */

/*
 * Value constants for VAL_phase
 */
#define BCS_PHASE                      (0x0)      /* Not a message phase            */
#define MSG_PHASE                      (0x1)      /* Message phase (C)              */

/*
 * Value constants for VAL_dti_conn
 */
#define T30_DISCONNECT_DTI             (0x0)      /* Disconnect DTI from T30        */
#define T30_CONNECT_DTI                (0x1)      /* Connect DTI to T30             */

/*
 * Value constants for VAL_link_id
 */
#define T30_LINK_ID_DEFAULT            (0x0)      /* Default link id                */

/*
 * Value constants for VAL_dti_direction
 */
#define T30_DTI_NORMAL                 (0x0)      /* DTI used normally              */
#define T30_DTI_INVERTED               (0x1)      /* DTI is inverted                */

/*
 * user defined constants
 */
#define CSI_LEN                        (0x14)     
#define NSF_LEN                        (0x5a)     
#define CIG_LEN                        (0x14)     
#define NSC_LEN                        (0x5a)     
#define TSI_LEN                        (0x14)     
#define NSS_LEN                        (0x5a)     
#define PWD_LEN                        (0x14)     
#define SUB_LEN                        (0x14)     
#define SEP_LEN                        (0x14)     
#define T30_ENTITY_NAME_LEN            (0x6)      

#include "CDG_LEAVE.h"


#endif