📄 hdlc.c
字号:
/*************************************************************************/
/* */
/* FILE NAME VERSION */
/* */
/* hdlc.c KS32C5000(A) : version 1.0 */
/* */
/* COMPONENT */
/* */
/* */
/* DESCRIPTION */
/* */
/* Evaluation source code for HDLC control block. */
/* */
/* AUTHOR */
/* */
/* Copyright (C) 1997 Samsung Electronics. */
/* */
/* DATA STRUCTURES */
/* */
/* */
/* FUNCTIONS */
/* */
/* */
/* DEPENDENCIES */
/* */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* hbahn 09-15-1998 Created initial version 1.0 */
/*************************************************************************/
#include "snds.h"
#include "sysconf.h"
#include "uart.h"
#include "pollio.h"
#include "timer.h"
#include "isr.h"
#include "hdlc.h"
/*
* Function : HDLCTest
* Description : HDLC Test Main Function
*/
void HDLCTest(void)
{
char TestItemSel ;
// Select Test Item
do {
Print("\n+---------------------------------------------------+\r") ;
Print("| >>>>> HDLC Block Diagonistic Program <<<<< |\r") ;
Print("| Rev 1.0 (by hbahn, 1998.06.15) |\r") ;
Print("+---------------------------------------------------+\r") ;
Print("| Transfer HDLC Frame - [T] |\r") ;
Print("| Receive HDLC Frame - [R] |\r") ;
Print("| HDLC Ping-Pong Test - [P] |\r") ;
Print("| HDLC Loopback Test - [L] |\r") ;
Print("| View HDLC Status - [V] |\r") ;
Print("| Quit HDLC Test - [Q] |\r") ;
Print("+---------------------------------------------------+\r") ;
Print("\rSelect Test Item : ") ; TestItemSel = get_byte() ;
switch(TestItemSel)
{
case 'T' : case 't' : HdlcFrameTransmitTest() ; break ;
case 'R' : case 'r' : HdlcFrameReceiveTest() ; break ;
case 'P' : case 'p' : HdlcPingPongTest() ; break ;
case 'L' : case 'l' : HdlcLoopbackTest() ; break ;
case 'V' : case 'v' : HDLC_Status() ; break ;
case 'Q' : case 'q' : break ;
default : Print("\nInvalid Test Item Selected") ;
break ;
}
if ( (TestItemSel != 'Q') && (TestItemSel != 'q') )
{
Print("\nPress any key to Continue HDLC Test") ;
get_byte() ;
}
} while ( (TestItemSel != 'Q') && (TestItemSel != 'q') ) ;
}
/*
* Function : HdlcFrameTransmitTest
* Description : HDLC frame transmit test function
*/
void HdlcFrameTransmitTest(void)
{
char TestItemSel ;
do {
Print("\n+---------------------------------------------------+\r") ;
Print("| ***** HDLC Frame Transmit Test ***** |\r") ;
Print("| Rev 2.0 (by hbahn, 1999.06.07) |\r") ;
Print("+---------------------------------------------------+\r") ;
Print("| Tranmit Multi Frame - [M] |\r") ;
Print("| Tranmit Single Frame - [S] |\r") ;
Print("| Quit HDLC Receive Test - [Q] |\r") ;
Print("+---------------------------------------------------+\r") ;
Print("\rSelect Test Item : ") ; TestItemSel = get_byte() ;
switch(TestItemSel)
{
case 'M' : case 'm' : Transmit_Multi_Frame() ; break ;
case 'S' : case 's' : Transmit_Frame() ; break ;
case 'Q' : case 'q' : break ;
default : Print("\nInvalid Test Item Selected") ;
break ;
}
if ( (TestItemSel != 'Q') && (TestItemSel != 'q') )
{
Print("\nPress any key to continue") ;
get_byte() ;
}
} while ( (TestItemSel != 'Q') && (TestItemSel != 'q') ) ;
}
/*
* Function : HdlcFrameReceiveTest
* Description : HDLC frame receive test function
*/
void HdlcFrameReceiveTest(void)
{
char TestItemSel ;
do {
Print("\n+---------------------------------------------------+\r") ;
Print("| ***** HDLC Frame Receive Test ***** |\r") ;
Print("| Rev 2.0 (by hbahn, 1999.06.07) |\r") ;
Print("+---------------------------------------------------+\r") ;
Print("| Receive and View Frame - [V] |\r") ;
Print("| Receive Frame to temp buffer(test only) - [R] |\r") ;
Print("| Quit HDLC Receive Test - [Q] |\r") ;
Print("+---------------------------------------------------+\r") ;
Print("\rSelect Test Item : ") ; TestItemSel = get_byte() ;
switch(TestItemSel)
{
case 'V' : case 'v' : ReceiveAndViewHdlcFrame() ; break ;
case 'R' : case 'r' : HdlcFrameRx() ; break ;
case 'Q' : case 'q' : break ;
default : Print("\n Invalid Test Item Selected") ;
break ;
}
if ( (TestItemSel != 'Q') && (TestItemSel != 'q') )
{
Print("\nPress any key to continue") ;
get_byte() ;
}
} while ( (TestItemSel != 'Q') && (TestItemSel != 'q') ) ;
}
/*
* Function : HdlcPingPongTest
* Description : HDLC Ping-Pong Test Function
*/
void HdlcPingPongTest(void)
{
char TestItemSel ;
do {
Print("\n+---------------------------------------------------+\r") ;
Print("| ***** HDLC Ping-Pong Test ***** |\r") ;
Print("| Rev 2.0 (by hbahn, 1999.06.08) |\r") ;
Print("+---------------------------------------------------+\r") ;
Print("| Ping-Pong Test Server - [S] |\r") ;
Print("| Ping-Pong Test Client - [C] |\r") ;
Print("| Quit HDLC Receive Test - [Q] |\r") ;
Print("+---------------------------------------------------+\r") ;
Print("\rSelect Test Item : ") ; TestItemSel = get_byte() ;
switch(TestItemSel)
{
case 'S' : case 's' : HdlcPingPongTest_Server() ; break ;
case 'C' : case 'c' : HdlcPingPongTest_Client() ; break ;
case 'Q' : case 'q' : break ;
default : Print("\n Invalid Test Item Selected") ;
break ;
}
if ( (TestItemSel != 'Q') && (TestItemSel != 'q') )
{
Print("\nPress any key to continue") ;
get_byte() ;
}
} while ( (TestItemSel != 'Q') && (TestItemSel != 'q') ) ;
}
/*
* Function : HdlcLoopbackTest
* Description : HDLC Loopback Test Function
*/
void HdlcLoopbackTest(void)
{
char TestItemSel ;
do {
Print("\n+---------------------------------------------------+\r") ;
Print("| ***** HDLC LoopBack Test ***** |\r") ;
Print("| Rev 2.0 (by hbahn, 1999.06.07) |\r") ;
Print("+---------------------------------------------------+\r") ;
Print("| HDLC Internal LoopBackTest - [I] |\r") ;
Print("| HDLC Channel-A External LoopBackTest - [A] |\r") ;
Print("| HDLC Channel-B External LoopBackTest - [B] |\r") ;
Print("| Counted Repeat LoopBackTest - [L] |\r") ;
Print("| Quit HDLC LoopBack Test - [Q] |\r") ;
Print("+---------------------------------------------------+\r") ;
Print("\rSelect Test Item : ") ; TestItemSel = get_byte() ;
switch(TestItemSel)
{
case 'I' : case 'i' : HdlcInternalLoopback() ; break ;
case 'A' : case 'a' :
Print("\n\n >>> HDLC channel A External Loopback Test ... ") ;
HdlcExternalLoopback(HDLCA) ;
break ;
case 'B' : case 'b' :
Print("\n\n >>> HDLC channel B External Loopback Test ... ") ;
HdlcExternalLoopback(HDLCB) ;
break ;
case 'L' : case 'l' : RepHdlcLoopback(); break ;
case 'Q' : case 'q' : break ;
default : Print("\nInvalid Test Item Selected") ;
break ;
}
if ( (TestItemSel != 'Q') && (TestItemSel != 'q') )
{
Print("\nPress any key to Continue") ;
get_byte() ;
}
} while ( (TestItemSel != 'Q') && (TestItemSel != 'q') ) ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -