_cdebbuf *capi_message2str(u8 * msg) { _cdebbuf *cdb; _cmsg *cmsg; cdb = cdebbuf_alloc(); if (unlikely(!cdb)) return NULL; if (likely(cdb == g_debbuf)) cmsg = g_cmsg; else cmsg = kmalloc(sizeof(_cmsg), GFP_ATOMIC); if (unlikely(!cmsg)) { cdebbuf_free(cdb); return NULL; } cmsg->m = msg; cmsg->l = 8; cmsg->p = 0; byteTRcpy(cmsg->m + 4, &cmsg->Command); byteTRcpy(cmsg->m + 5, &cmsg->Subcommand); cmsg->par = cpars[command_2_index(cmsg->Command, cmsg->Subcommand)]; cdb = bufprint(cdb, "%-26s ID=%03d #0x%04x LEN=%04d\n", mnames[command_2_index(cmsg->Command, cmsg->Subcommand)], ((unsigned short *) msg)[1], ((unsigned short *) msg)[3], ((unsigned short *) msg)[0]); cdb = protocol_message_2_pars(cdb, cmsg, 1); if (unlikely(cmsg != g_cmsg)) kfree(cmsg); return cdb; }
char *capi_cmsg2str(_cmsg * cmsg) { p = buf; p[0] = 0; cmsg->l = 8; cmsg->p = 0; bufprint("%s ID=%03d #0x%04x LEN=%04d\n", mnames[command_2_index(cmsg->Command, cmsg->Subcommand)], ((__u16 *) cmsg->m)[1], ((__u16 *) cmsg->m)[3], ((__u16 *) cmsg->m)[0]); protocol_message_2_pars(cmsg, 1); return buf; }
/*-------------------------------------------------------*/ char *capi_message2str(__u8 * msg) { _cmsg cmsg; p = buf; p[0] = 0; cmsg.m = msg; cmsg.l = 8; cmsg.p = 0; byteTRcpy(cmsg.m + 4, &cmsg.Command); byteTRcpy(cmsg.m + 5, &cmsg.Subcommand); cmsg.par = cpars[command_2_index(cmsg.Command, cmsg.Subcommand)]; bufprint("%-26s ID=%03d #0x%04x LEN=%04d\n", mnames[command_2_index(cmsg.Command, cmsg.Subcommand)], ((unsigned short *) msg)[1], ((unsigned short *) msg)[3], ((unsigned short *) msg)[0]); protocol_message_2_pars(&cmsg, 1); return buf; }
unsigned capi_cmsg2message(_cmsg * cmsg, u8 * msg) { cmsg->m = msg; cmsg->l = 8; cmsg->p = 0; cmsg->par = cpars[command_2_index(cmsg->Command, cmsg->Subcommand)]; pars_2_message(cmsg); wordTLcpy(msg + 0, &cmsg->l); byteTLcpy(cmsg->m + 4, &cmsg->Command); byteTLcpy(cmsg->m + 5, &cmsg->Subcommand); wordTLcpy(cmsg->m + 2, &cmsg->ApplId); wordTLcpy(cmsg->m + 6, &cmsg->Messagenumber); return 0; }
_cdebbuf *capi_cmsg2str(_cmsg * cmsg) { _cdebbuf *cdb; cdb = cdebbuf_alloc(); if (!cdb) return NULL; cmsg->l = 8; cmsg->p = 0; cdb = bufprint(cdb, "%s ID=%03d #0x%04x LEN=%04d\n", mnames[command_2_index(cmsg->Command, cmsg->Subcommand)], ((u16 *) cmsg->m)[1], ((u16 *) cmsg->m)[3], ((u16 *) cmsg->m)[0]); cdb = protocol_message_2_pars(cdb, cmsg, 1); return cdb; }
unsigned capi_message2cmsg(_cmsg * cmsg, u8 * msg) { memset(cmsg, 0, sizeof(_cmsg)); cmsg->m = msg; cmsg->l = 8; cmsg->p = 0; byteTRcpy(cmsg->m + 4, &cmsg->Command); byteTRcpy(cmsg->m + 5, &cmsg->Subcommand); cmsg->par = cpars[command_2_index(cmsg->Command, cmsg->Subcommand)]; message_2_pars(cmsg); wordTRcpy(msg + 0, &cmsg->l); wordTRcpy(cmsg->m + 2, &cmsg->ApplId); wordTRcpy(cmsg->m + 6, &cmsg->Messagenumber); return 0; }
char *capi_cmd2str(u8 cmd, u8 subcmd) { return mnames[command_2_index(cmd, subcmd)]; }