Lines Matching refs:parser
38 struct msg_parser *parser; in snd_motu_command_dsp_message_parser_new() local
40 parser = devm_kzalloc(&motu->card->card_dev, sizeof(*parser), GFP_KERNEL); in snd_motu_command_dsp_message_parser_new()
41 if (!parser) in snd_motu_command_dsp_message_parser_new()
43 spin_lock_init(&parser->lock); in snd_motu_command_dsp_message_parser_new()
44 motu->message_parser = parser; in snd_motu_command_dsp_message_parser_new()
51 struct msg_parser *parser = motu->message_parser; in snd_motu_command_dsp_message_parser_init() local
53 parser->state = INITIALIZED; in snd_motu_command_dsp_message_parser_init()
59 parser->interval = 4; in snd_motu_command_dsp_message_parser_init()
63 parser->interval = 2; in snd_motu_command_dsp_message_parser_init()
69 parser->interval = 1; in snd_motu_command_dsp_message_parser_init()
86 struct msg_parser *parser = motu->message_parser; in snd_motu_command_dsp_message_parser_parse() local
87 unsigned int interval = parser->interval; in snd_motu_command_dsp_message_parser_parse()
91 spin_lock_irqsave(&parser->lock, flags); in snd_motu_command_dsp_message_parser_parse()
103 switch (parser->state) { in snd_motu_command_dsp_message_parser_parse()
109 parser->value = fragment; in snd_motu_command_dsp_message_parser_parse()
110 parser->message_count = 1; in snd_motu_command_dsp_message_parser_parse()
111 parser->state = FRAGMENT_DETECTED; in snd_motu_command_dsp_message_parser_parse()
117 if (parser->message_count % interval == 0) { in snd_motu_command_dsp_message_parser_parse()
120 parser->value >>= 8; in snd_motu_command_dsp_message_parser_parse()
121 parser->value |= (u64)fragment << 56; in snd_motu_command_dsp_message_parser_parse()
123 if (parser->value == VALUES_AT_IMAGE_END) { in snd_motu_command_dsp_message_parser_parse()
124 parser->state = AVAILABLE; in snd_motu_command_dsp_message_parser_parse()
125 parser->fragment_pos = 0; in snd_motu_command_dsp_message_parser_parse()
126 parser->value_index = 0; in snd_motu_command_dsp_message_parser_parse()
127 parser->message_count = 0; in snd_motu_command_dsp_message_parser_parse()
130 ++parser->message_count; in snd_motu_command_dsp_message_parser_parse()
136 if (parser->message_count % interval == 0) { in snd_motu_command_dsp_message_parser_parse()
139 parser->value >>= 8; in snd_motu_command_dsp_message_parser_parse()
140 parser->value |= (u64)fragment << 56; in snd_motu_command_dsp_message_parser_parse()
141 ++parser->fragment_pos; in snd_motu_command_dsp_message_parser_parse()
143 if (parser->fragment_pos == 4) { in snd_motu_command_dsp_message_parser_parse()
147 if (parser->value_index < in snd_motu_command_dsp_message_parser_parse()
149 u32 val = (u32)(parser->value >> 32); in snd_motu_command_dsp_message_parser_parse()
150 parser->meter.data[parser->value_index] = val; in snd_motu_command_dsp_message_parser_parse()
152 ++parser->value_index; in snd_motu_command_dsp_message_parser_parse()
153 parser->fragment_pos = 0; in snd_motu_command_dsp_message_parser_parse()
156 if (parser->value == VALUES_AT_IMAGE_END) { in snd_motu_command_dsp_message_parser_parse()
157 parser->value_index = 0; in snd_motu_command_dsp_message_parser_parse()
158 parser->fragment_pos = 0; in snd_motu_command_dsp_message_parser_parse()
159 parser->message_count = 0; in snd_motu_command_dsp_message_parser_parse()
162 ++parser->message_count; in snd_motu_command_dsp_message_parser_parse()
169 spin_unlock_irqrestore(&parser->lock, flags); in snd_motu_command_dsp_message_parser_parse()
175 struct msg_parser *parser = motu->message_parser; in snd_motu_command_dsp_message_parser_copy_meter() local
178 spin_lock_irqsave(&parser->lock, flags); in snd_motu_command_dsp_message_parser_copy_meter()
179 memcpy(meter, &parser->meter, sizeof(*meter)); in snd_motu_command_dsp_message_parser_copy_meter()
180 spin_unlock_irqrestore(&parser->lock, flags); in snd_motu_command_dsp_message_parser_copy_meter()