/** COMTest.c ÀÌ ¸ðµâÀº COM ¸ðµâ API Test ¸¦ À§ÇÑ ·çƾÀÌ´Ù. */ #include "DHL_OSAL.h" #include "DHL_COM.h" //#include "DHL_APITest.h" tDHL_COM_ID s_comtest_id = 0; #define printf DHL_OS_Printf #if COMMENT ____Function___(){} #endif /* ÀÌ ÇÔ¼ö´Â ÀϹÝÀûÀ¸·Î ÀÎÅÍ·´Æ® context¿¡¼­ È£Ãâ µÉ °¡´É¼ºÀÌ ³ô´Ù. */ void COM_rx_callback(UINT8 *pData, UINT32 size) { // pData, size´Â ÇöÀç »ç¿ëµÇÁö ¾Ê´Â´Ù. // ±×³É data available À̶ó´Â »ç½Ç¸¸ ÂüÁ¶ÇÑ´Ù. } #if COMMENT ____UIO_Test___(){} #endif /* */ void COMTest_init(int baudrate) { DHL_COM_Init(); printf("com module init\n"); DHL_COM_RegisterRxCallback(s_comtest_id, COM_rx_callback); printf("set baudrate %d\n", baudrate); DHL_COM_Config(s_comtest_id, eDHL_COM_CT_Baudrate, (void *)baudrate); } /* */ void COMTest_send(...) { DHL_RESULT dhr; UINT8 buf[80]; int len = 0; dhr = DHL_COM_StartTx(s_comtest_id, buf, len); if (dhr) printf("!! com send err %x\n", dhr); } /* sync/async ¸ðµå Á¶Àý. */ void COMTest_setmode(BOOL bAsync) { DHL_COM_Config(s_comtest_id, eDHL_COM_CT_AsyncTxMode, (void *)bAsync); } /* */ void COMTest_uninit(void) { DHL_COM_Uninit(); }