Lines Matching refs:state
90 static int dst_ci_command(struct dst_state* state, u8 * data, u8 *ca_string, u8 len, int read) in dst_ci_command() argument
94 mutex_lock(&state->dst_mutex); in dst_ci_command()
95 dst_comm_init(state); in dst_ci_command()
98 if (write_dst(state, data, len)) { in dst_ci_command()
100 dst_error_recovery(state); in dst_ci_command()
103 if ((dst_pio_disable(state)) < 0) { in dst_ci_command()
107 if (read_dst(state, &reply, GET_ACK) < 0) { in dst_ci_command()
109 dst_error_recovery(state); in dst_ci_command()
113 if (! dst_wait_dst_ready(state, LONG_DELAY)) { in dst_ci_command()
117 if (read_dst(state, ca_string, 128) < 0) { /* Try to make this dynamic */ in dst_ci_command()
119 dst_error_recovery(state); in dst_ci_command()
123 mutex_unlock(&state->dst_mutex); in dst_ci_command()
127 mutex_unlock(&state->dst_mutex); in dst_ci_command()
132 static int dst_put_ci(struct dst_state *state, u8 *data, int len, u8 *ca_string, int read) in dst_put_ci() argument
138 if (dst_ci_command(state, data, ca_string, len, read)) { // If error in dst_put_ci()
139 dst_error_recovery(state); in dst_put_ci()
154 static int ca_get_app_info(struct dst_state *state) in ca_get_app_info() argument
160 if ((dst_put_ci(state, command, sizeof(command), state->messages, GET_REPLY)) < 0) { in ca_get_app_info()
167 state->messages[7], (state->messages[8] << 8) | state->messages[9], in ca_get_app_info()
168 (state->messages[10] << 8) | state->messages[11], __func__, (char *)(&state->messages[12])); in ca_get_app_info()
172 length = state->messages[5]; in ca_get_app_info()
180 put_command_and_length(&state->messages[0], CA_APP_INFO, length); in ca_get_app_info()
183 memmove(&state->messages[4], &state->messages[7], 5); in ca_get_app_info()
186 state->messages[9] = str_length; in ca_get_app_info()
187 memmove(&state->messages[10], &state->messages[12], str_length); in ca_get_app_info()
192 static int ca_get_ca_info(struct dst_state *state) in ca_get_ca_info() argument
199 if ((dst_put_ci(state, slot_command, sizeof (slot_command), state->messages, GET_REPLY)) < 0) { in ca_get_ca_info()
207 for (i = 0; i < state->messages[0] + 1; i++) { in ca_get_ca_info()
208 dprintk(verbose, DST_CA_INFO, 0, " 0x%02x", state->messages[i]); in ca_get_ca_info()
213 num_ids = state->messages[in_num_ids_pos]; in ca_get_ca_info()
218 put_command_and_length(&state->messages[0], CA_INFO, num_ids * 2); in ca_get_ca_info()
224 …dprintk(verbose, DST_CA_INFO, 0, " 0x%02x%02x", state->messages[srcPtr + 0], state->messages[srcPt… in ca_get_ca_info()
226 state->messages[dstPtr + 0] = state->messages[srcPtr + 0]; in ca_get_ca_info()
227 state->messages[dstPtr + 1] = state->messages[srcPtr + 1]; in ca_get_ca_info()
236 static int ca_get_slot_caps(struct dst_state *state, struct ca_caps *p_ca_caps, void __user *arg) in ca_get_slot_caps() argument
243 if ((dst_put_ci(state, slot_command, sizeof (slot_command), slot_cap, GET_REPLY)) < 0) { in ca_get_slot_caps()
269 static int ca_get_slot_descr(struct dst_state *state, struct ca_msg *p_ca_message, void __user *arg) in ca_get_slot_descr() argument
275 static int ca_get_slot_info(struct dst_state *state, struct ca_slot_info *p_ca_slot_info, void __us… in ca_get_slot_info() argument
280 u8 *slot_info = state->messages; in ca_get_slot_info()
283 if ((dst_put_ci(state, slot_command, sizeof (slot_command), slot_info, GET_REPLY)) < 0) { in ca_get_slot_info()
315 static int ca_get_message(struct dst_state *state, struct ca_msg *p_ca_message, void __user *arg) in ca_get_message() argument
336 memcpy(p_ca_message->msg, state->messages, 128); in ca_get_message()
341 memcpy(p_ca_message->msg, state->messages, 128); in ca_get_message()
351 static int handle_dst_tag(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_b… in handle_dst_tag() argument
353 if (state->dst_hw_cap & DST_TYPE_HAS_SESSION) { in handle_dst_tag()
379 static int write_to_8820(struct dst_state *state, struct ca_msg *hw_buffer, u8 length, u8 reply) in write_to_8820() argument
381 if ((dst_put_ci(state, hw_buffer->msg, length, hw_buffer->msg, reply)) < 0) { in write_to_8820()
384 rdc_reset_state(state); in write_to_8820()
426 static int ca_set_pmt(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffe… in ca_set_pmt() argument
436 handle_dst_tag(state, p_ca_message, hw_buffer, length); in ca_set_pmt()
440 write_to_8820(state, hw_buffer, (length + tag_length), reply); in ca_set_pmt()
447 static int dst_check_ca_pmt(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw… in dst_check_ca_pmt() argument
456 if ((ca_set_pmt(state, p_ca_message, hw_buffer, 1, GET_REPLY)) < 0) { in dst_check_ca_pmt()
467 if ((ca_set_pmt(state, p_ca_message, hw_buffer, 0, NO_REPLY)) < 0) { in dst_check_ca_pmt()
478 static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, void __user *arg) in ca_send_message() argument
512 if ((ca_set_pmt(state, p_ca_message, hw_buffer, 0, 0)) < 0) { // code simplification started in ca_send_message()
522 if ((dst_check_ca_pmt(state, p_ca_message, hw_buffer)) < 0) { in ca_send_message()
532 if ((ca_get_app_info(state)) < 0) { in ca_send_message()
542 if ((ca_get_ca_info(state)) < 0) { in ca_send_message()
560 struct dst_state *state; in dst_ca_ioctl() local
569 state = (struct dst_state *)dvbdev->priv; in dst_ca_ioctl()
583 if ((ca_send_message(state, p_ca_message, arg)) < 0) { in dst_ca_ioctl()
591 if ((ca_get_message(state, p_ca_message, arg)) < 0) { in dst_ca_ioctl()
600 dst_error_bailout(state); in dst_ca_ioctl()
605 if ((ca_get_slot_info(state, p_ca_slot_info, arg)) < 0) { in dst_ca_ioctl()
614 if ((ca_get_slot_caps(state, p_ca_caps, arg)) < 0) { in dst_ca_ioctl()
623 if ((ca_get_slot_descr(state, p_ca_message, arg)) < 0) { in dst_ca_ioctl()