// SPDX-License-Identifier: GPL-2.0 // ir-rc5-decoder.c - decoder for RC5(x) and StreamZap protocols // // Copyright (C) 2010 by Mauro Carvalho Chehab // Copyright (C) 2010 by Jarod Wilson <[email protected]> /* * This decoder handles the 14 bit RC5 protocol, 15 bit "StreamZap" protocol * and 20 bit RC5x protocol. */ #include "rc-core-priv.h" #include <linux/module.h> #define RC5_NBITS … #define RC5_SZ_NBITS … #define RC5X_NBITS … #define CHECK_RC5X_NBITS … #define RC5_UNIT … #define RC5_BIT_START … #define RC5_BIT_END … #define RC5X_SPACE … #define RC5_TRAILER … enum rc5_state { … }; /** * ir_rc5_decode() - Decode one RC-5 pulse or space * @dev: the struct rc_dev descriptor of the device * @ev: the struct ir_raw_event descriptor of the pulse/space * * This function returns -EINVAL if the pulse violates the state machine */ static int ir_rc5_decode(struct rc_dev *dev, struct ir_raw_event ev) { … } static const struct ir_raw_timings_manchester ir_rc5_timings = …; static const struct ir_raw_timings_manchester ir_rc5x_timings[2] = …; static const struct ir_raw_timings_manchester ir_rc5_sz_timings = …; /** * ir_rc5_encode() - Encode a scancode as a stream of raw events * * @protocol: protocol variant to encode * @scancode: scancode to encode * @events: array of raw ir events to write into * @max: maximum size of @events * * Returns: The number of events written. * -ENOBUFS if there isn't enough space in the array to fit the * encoding. In this case all @max events will have been written. * -EINVAL if the scancode is ambiguous or invalid. */ static int ir_rc5_encode(enum rc_proto protocol, u32 scancode, struct ir_raw_event *events, unsigned int max) { … } static struct ir_raw_handler rc5_handler = …; static int __init ir_rc5_decode_init(void) { … } static void __exit ir_rc5_decode_exit(void) { … } module_init(…) …; module_exit(ir_rc5_decode_exit); MODULE_LICENSE(…) …; MODULE_AUTHOR(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …;