/* aend character c with ZMODEM escape sequence encoding.  */
void zsend_zdle_char(rt_uint16_t ch)
/* aend character c with ZMODEM escape sequence encoding.  */
void zsend_zdle_char(rt_uint16_t ch)
{
    rt_uint16_t res;
    res = ch & 0377;
    switch (res)
    {
    case 0377:
        zsend_byte(res);
        break;
    case ZDLE:
        zsend_byte(ZDLE);
        res ^= 0100;
        zsend_byte(res);
        break;
    case 021:
    case 023:
    case 0221:
    case 0223:
        zsend_byte(ZDLE);
        res ^= 0100;
        zsend_byte(res);
        break;
    default:
        zsend_byte(res);
    }
}