⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gdb_c_test.c

📁 lwip在ucos上的移植
💻 C
📖 第 1 页 / 共 5 页
字号:
    case LAN_STAT:      {      printp( "\n              -- Status --\n\n" );        printp( "          Baud Rate: %X *\n",   baud_rate_setting[ baud_rate_idx ].rate_code );        printp( "         Xmt-via-BP: %s *\n",   STATUS( XMT_VIA_BP_ENABLED( ) ) );        printp( "         RxRdy Intr: %s *\n",   STATUS( (lan_shadow_imr & M_UART_ISR_RxRDY) ) );   /*** printp( "         TxRdy Intr: %s\n",     STATUS( (lan_shadow_imr & M_UART_ISR_TxRDY) ) ); ***/        printp( "               Echo: %s *\n\n", STATUS( test_echo ) );        printp( "                IMR: %02X\n", (ULONG) lan_shadow_imr );        printp( "                ISR: %02X\n", (ULONG) *P_LAN_ISR );        printp( "                 SR: %02X\n\n", (ULONG) *P_LAN_SR );        printp( "    Input Overflows: %d\n\n", lan_input_queue.overflows );        printp( "         Tx by Intr: %d\n", tx_by_intr  );        printp( "         Tx by Poll: %d\n\n", tx_by_poll );        printp( "         *  Can be set or toggled via Utility %2X.\n\n", (ULONG) LAN_UTIL_CODE );        break;      }    case LAN_IN:      {        switch ( parm_1 )        {          case 0x0C: /* Clear and Reset Queue */            {              lan_init_queue( &lan_input_queue );              printp( "\n\n  Queue CLEARED/RESET ...\n\n" );              break;            }          case 0x0D: /* Display Queue */            {              printp( "\n                        -- Input Queue --\n" );              printp( "\n        Head Index: %8X     Tail Index: %8X\n\n    ",                     (ULONG) lan_input_queue.head_index, (ULONG) lan_input_queue.tail_index );              for ( i = 0; i < MAX_RS232_CHARS; ++i )              {                printp( " %02X", (ULONG) lan_input_queue.buf[ i ] );                if ( 15 == (i % 16) )                {                  int j;                  printp ( "    " );                  for ( j = i - 15; j <= i; j++ )                    {                      if ( lan_input_queue.buf[ j ] >= ' ' &&                          lan_input_queue.buf[ j ] < 127 )                        printp ( "%c", lan_input_queue.buf[ j ] );                      else                        printp ( "." );                    }                  printp( "\n    " );                }                else if ( 7 == (i % 8) )                {                  printp( " " );                }              }              printp( "\n" );              break;            }          case 0x0F: /* Fetch next character in Queue */            {              c = lan_next_queue_char( &lan_input_queue );              if ( c )              {                printp( "\n\n  Next Character: " );                if (  0x21 <= c  &&  c <= 0x7F )                {                  printp( "%c\n\n", (ULONG) c );                }                else if ( 0x20 == ((UCHAR) c) )                {                  printp( "<space>\n\n" );                }                else                {                  printp( "%02X\n\n", (ULONG) c );                }              }              else              {                printp( "\n\n  Input Queue EMPTY ...\n\n" );              }            break;            }          default:            {            printp( "\n\n  *** SYNTAX Error  -  Invalid P2 ...\n\n" );            not_done_code = BOGUS_P2;            break;            }        }      break;      }    case LAN_OUT:      {        switch ( parm_1 )        {          case 0x0C: /* Clear and Reset Queue */            {              lan_init_queue( &lan_output_queue );              printp( "\n\n  Queue CLEARED/RESET ...\n\n" );              break;            }          case 0x0D: /* Display Queue */            {              printp( "\n                       -- Output Queue --\n" );              printp( "\n        Head Index: %8X     Tail Index: %8X\n\n    ",                     (ULONG) lan_output_queue.head_index, (ULONG) lan_output_queue.tail_index );              for ( i = 0; i < MAX_RS232_CHARS; ++i )              {                printp( " %02X", (ULONG) lan_output_queue.buf[ i ] );                if ( 15 == (i % 16) )                {                  int j;                  printp ( "    " );                  for ( j = i - 15; j <= i; j++ )                    {                      if ( lan_output_queue.buf[ j ] >= ' ' &&                          lan_output_queue.buf[ j ] < 127 )                        printp ( "%c", lan_output_queue.buf[ j ] );                      else                        printp ( "." );                    }                  printp( "\n    " );                }                else if ( 7 == (i % 8) )                {                  printp( " " );                }              }              printp( "\n" );              break;            }          case 0x0F: /* Fetch next character in Queue */            {              c = lan_next_queue_char( &lan_output_queue );              if ( c )              {                printp( "\n\n  Next Character: " );                if (  0x21 <= c  &&  c <= 0x7F )                {                  printp( "%c\n\n", (ULONG) c );                }                else if ( 0x20 == c )                {                  printp( "<space>\n\n" );                }                else                {                  printp( "%02X\n\n", (ULONG) c );                }              }              else              {                printp( "\n\n  Input Queue EMPTY ...\n\n" );              }              break;            }          default:            {            printp( "\n\n  *** SYNTAX Error  -  Invalid P2 ...\n\n" );            not_done_code = BOGUS_P2;            break;            }        }        break;      }    case LAN_ECHO:      {        switch ( parm_1 )        {          case 0x0E:            {              test_echo = ENABLED;              printp( "\n\n  Test echo ENABLED ...\n\n" );              break;            }          case 0x0D:            {              test_echo = DISABLED;              printp( "\n\n  Test echo DISABLED ...\n\n" );              break;            }          default:            {              printp( "\n\n  *** SYNTAX Error  -  Invalid P2 ...\n\n" );              not_done_code = BOGUS_P2;              break;            }        }        break;      }    case LAN_PUTC:      {        if ( 0x20 < parm_1  &&  parm_1 < 0x7F )        {          if ( lan_put_char( (UCHAR) parm_1 ) )          {            printp( "\n\n  *** 'lan_put_char' Error ...\n" );          }          else          {            printp( "\n\n  O.K. ...\n" );          }        }        else        {          printp( "\n\n  *** Error  -  character must be in the 0x21-0x7E range ...\n" );          not_done_code = BOGUS_P2;        }        break;      }/***    case LAN_WPM:      {        if ( write_to_protected_mem( (void *) parm_1, (unsigned short) parm_2 ) )        {          printp( "\n  Write to protected memory FAILED ...\n" );        }        break;      }***/    case 0: /* no argument -- print menu */      {        lan_util_menu( );        break;      }    default:      {        parm_2 = 0;  /* to supress compiler warning with 'LAN_WPM' case disabled */        printp( "\n\n  *** SYNTAX Error  -  Invalid P1 ...\n\n" );        not_done_code = BOGUS_P1;        break;      }  } /*  End of 'switch ( opcode )'. */return( not_done_code );}/* end of 'lan_util' *===========================================================================*/                  /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*                  *                                     *                  *         Local Module Functions      *                  *                                     *                  *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*//*----------------------------------------------------------------------------- * * FUNCTION NAME:   lan_reset * * DESCRIPTION:     Resets the LAN UART by strobing the 'RST_LAN_UART' bit in the *                  Shared Control 1 area. * *                             1 _|       ______ *                                |      |      | *                          Bit   |      |      | *                                |      |      | *                             0 _|______|      |______ *                                |---------------------> t * * RETURN VALUE:    None. * * USED GLOBAL VARIABLES: * * AFFECTED GLOBAL VARIABLES/SIDE EFFECTS: * * NOTES:           H/W configuration requires that a byte in the shared *                  control 1 area must be read before being written. * *---------------------------------------------------------------------------*/static  void    lan_reset( void ){  while ( *P_RST_LAN_UART_REG & M_RST_LAN_UART )  {    *P_RST_LAN_UART_REG &= ~M_RST_LAN_UART;     /* 0 */  }  while ( !(*P_RST_LAN_UART_REG & M_RST_LAN_UART) )  {    *P_RST_LAN_UART_REG |= M_RST_LAN_UART;      /* 1 */  }  while ( *P_RST_LAN_UART_REG & M_RST_LAN_UART )  {    *P_RST_LAN_UART_REG &= ~M_RST_LAN_UART;     /* 0 */  }}/* end of 'lan_reset' *===========================================================================*//*----------------------------------------------------------------------------- * * FUNCTION NAME:   lan_configure * * * DESCRIPTION: * * * RETURN VALUE: * * * USED GLOBAL VARIABLES: * * * AFFECTED GLOBAL VARIABLES/SIDE EFFECTS: * * * NOTES: * * * *---------------------------------------------------------------------------*/static  void    lan_configure( void ){  *P_LAN_CR = UART_CR_RESET_MR_PTR;       /*  Points to MR1.        */  *P_LAN_CR = UART_CR_RESET_RVCR;         /*  Receiver disabled.    */  *P_LAN_CR = UART_CR_RESET_XMTR;         /*  Transmitter disabled. */  *P_LAN_CR = UART_CR_RESET_ERROR_STATUS;  *P_LAN_CR = UART_CR_RESET_BRK_CHG_INT;  *P_LAN_MR1 = DEFAULT_LAN_MR1;  *P_LAN_MR2 = DEFAULT_LAN_MR2;  *P_LAN_ACR = DEFAULT_LAN_ACR;  *P_LAN_CSR = UART_CSR_BR_9600;  baud_rate_idx = 2;  *P_LAN_CTUR = DEFAULT_LAN_CTUR;  *P_LAN_CTLR = DEFAULT_LAN_CTLR;  *P_LAN_CR = (UART_CR_START_CNTR_TIMER | UART_CR_ENABLE_XMTR | UART_CR_ENABLE_RCVR);  lan_shadow_imr = UART_IMR_RxRDY;        /*  Enable only 'RxRDY' interrupt from UART. */  *P_LAN_IMR = lan_shadow_imr;  tx_by_intr = 0;  tx_by_poll = 0;  return;}/* end of 'lan_configure' *===========================================================================*//*----------------------------------------------------------------------------- * * FUNCTION NAME:   lan_init_queue * * DESCRIPTION: * * RETURN VALUE:    None. * * USED GLOBAL VARIABLES: * * AFFECTED GLOBAL VARIABLES/SIDE EFFECTS: * * NOTES: * *---------------------------------------------------------------------------*/static  void    lan_init_queue( T_RS232_QUEUE *p_queue ){  long i;    /*    *   We set "head" equal to "tail" implying the queue is empty,    *   BUT the "head" and "tail" should each point to valid queue    *   positions.    */  p_queue->head_index = 0;  p_queue->tail_index = 0;  p_queue->overflows = 0;  p_queue->gdb_packet_start = -1;  p_queue->gdb_packet_end   = -1;  p_queue->gdb_packet_csum1 = -1;  p_queue->gdb_packet_csum2 = -1;  for ( i = 0; i < MAX_RS232_CHARS; ++i )  {    p_queue->buf[ i ] = 0;  }  return;}/* end of 'lan_init_queue' *===========================================================================*//*----------------------------------------------------------------------------- * * FUNCTION NAME:   lan_add_to_queue * * * DESCRIPTION:     Adds the specified character to the tail of the *                  specified queue.  Observes "oldest thrown on floor" *                  rule (i.e. the queue is allowed to "wrap" and the *                  input character is unconditionally placed at the *                  tail of the queue.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -