Lines Matching full:fcs
102 /* SOF, ADDR, CTRL, LEN1, LEN2, ..., FCS, EOF */
296 u8 fcs; member
466 * gsm_fcs_add - update FCS
467 * @fcs: Current FCS
470 * Update the FCS to include c. Uses the algorithm in the specification
474 static inline u8 gsm_fcs_add(u8 fcs, u8 c) in gsm_fcs_add() argument
476 return gsm_fcs8[fcs ^ c]; in gsm_fcs_add()
480 * gsm_fcs_add_block - update FCS for a block
481 * @fcs: Current FCS
485 * Update the FCS to include c. Uses the algorithm in the specification
489 static inline u8 gsm_fcs_add_block(u8 fcs, u8 *c, int len) in gsm_fcs_add_block() argument
492 fcs = gsm_fcs8[fcs ^ *c++]; in gsm_fcs_add_block()
493 return fcs; in gsm_fcs_add_block()
907 #define HDR_LEN 6 /* ADDR CTRL [LEN.2] DATA FCS */
913 * @len: length excluding header and FCS
928 m->data = m->buffer + HDR_LEN - 1; /* Allow for FCS */ in gsm_data_alloc()
1098 u8 *fcs = dp + msg->len; in __gsm_data_queue() local
1115 *fcs = gsm_fcs_add_block(INIT_FCS, dp , msg->data - dp); in __gsm_data_queue()
1118 *fcs = gsm_fcs_add_block(*fcs, msg->data, msg->len); in __gsm_data_queue()
1119 *fcs = 0xFF - *fcs; in __gsm_data_queue()
1124 /* Move the header back and adjust the length, also allow for the FCS in __gsm_data_queue()
2753 * The fcs holds the header FCS but any data FCS must be added here.
2762 if (gsm->fcs != GOOD_FCS) { in gsm_queue()
2765 pr_debug("BAD FCS %02x\n", gsm->fcs); in gsm_queue()
2896 gsm->fcs = INIT_FCS; in gsm0_receive()
2900 gsm->fcs = gsm_fcs_add(gsm->fcs, c); in gsm0_receive()
2905 gsm->fcs = gsm_fcs_add(gsm->fcs, c); in gsm0_receive()
2910 gsm->fcs = gsm_fcs_add(gsm->fcs, c); in gsm0_receive()
2927 gsm->fcs = gsm_fcs_add(gsm->fcs, c); in gsm0_receive()
2947 /* Calculate final FCS for UI frames over all data */ in gsm0_receive()
2949 gsm->fcs = gsm_fcs_add_block(gsm->fcs, gsm->buf, in gsm0_receive()
2955 case GSM0_FCS: /* FCS follows the packet */ in gsm0_receive()
2956 gsm->fcs = gsm_fcs_add(gsm->fcs, c); in gsm0_receive()
3025 /* Remove the FCS from data */ in gsm1_receive()
3028 /* Calculate final FCS for UI frames over all in gsm1_receive()
3029 * data but FCS in gsm1_receive()
3031 gsm->fcs = gsm_fcs_add_block(gsm->fcs, gsm->buf, in gsm1_receive()
3034 /* Add the FCS itself to test against GOOD_FCS */ in gsm1_receive()
3035 gsm->fcs = gsm_fcs_add(gsm->fcs, gsm->buf[gsm->count]); in gsm1_receive()
3069 gsm->fcs = INIT_FCS; in gsm1_receive()
3072 gsm->fcs = gsm_fcs_add(gsm->fcs, c); in gsm1_receive()
3077 gsm->fcs = gsm_fcs_add(gsm->fcs, c); in gsm1_receive()
3083 if (gsm->count > gsm->mru || gsm->count > MAX_MRU) { /* Allow one for the FCS */ in gsm1_receive()