i1480-est.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * Intel Wireless UWB Link 1480
  3. * Event Size tables for Wired Adaptors
  4. *
  5. * Copyright (C) 2005-2006 Intel Corporation
  6. * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License version
  10. * 2 as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  20. * 02110-1301, USA.
  21. *
  22. *
  23. * FIXME: docs
  24. */
  25. #include <linux/init.h>
  26. #include <linux/module.h>
  27. #include <linux/usb.h>
  28. #include <linux/uwb.h>
  29. #include "dfu/i1480-dfu.h"
  30. /** Event size table for wEvents 0x00XX */
  31. static struct uwb_est_entry i1480_est_fd00[] = {
  32. /* Anybody expecting this response has to use
  33. * neh->extra_size to specify the real size that will
  34. * come back. */
  35. [i1480_EVT_CONFIRM] = { .size = sizeof(struct i1480_evt_confirm) },
  36. [i1480_CMD_SET_IP_MAS] = { .size = sizeof(struct i1480_evt_confirm) },
  37. #ifdef i1480_RCEB_EXTENDED
  38. [0x09] = {
  39. .size = sizeof(struct i1480_rceb),
  40. .offset = 1 + offsetof(struct i1480_rceb, wParamLength),
  41. },
  42. #endif
  43. };
  44. /** Event size table for wEvents 0x01XX */
  45. static struct uwb_est_entry i1480_est_fd01[] = {
  46. [0xff & i1480_EVT_RM_INIT_DONE] = { .size = sizeof(struct i1480_rceb) },
  47. [0xff & i1480_EVT_DEV_ADD] = { .size = sizeof(struct i1480_rceb) + 9 },
  48. [0xff & i1480_EVT_DEV_RM] = { .size = sizeof(struct i1480_rceb) + 9 },
  49. [0xff & i1480_EVT_DEV_ID_CHANGE] = {
  50. .size = sizeof(struct i1480_rceb) + 2 },
  51. };
  52. static int __init i1480_est_init(void)
  53. {
  54. int result = uwb_est_register(i1480_CET_VS1, 0x00, 0x8086, 0x0c3b,
  55. i1480_est_fd00,
  56. ARRAY_SIZE(i1480_est_fd00));
  57. if (result < 0) {
  58. printk(KERN_ERR "Can't register EST table fd00: %d\n", result);
  59. return result;
  60. }
  61. result = uwb_est_register(i1480_CET_VS1, 0x01, 0x8086, 0x0c3b,
  62. i1480_est_fd01, ARRAY_SIZE(i1480_est_fd01));
  63. if (result < 0) {
  64. printk(KERN_ERR "Can't register EST table fd01: %d\n", result);
  65. return result;
  66. }
  67. return 0;
  68. }
  69. module_init(i1480_est_init);
  70. static void __exit i1480_est_exit(void)
  71. {
  72. uwb_est_unregister(i1480_CET_VS1, 0x00, 0x8086, 0x0c3b,
  73. i1480_est_fd00, ARRAY_SIZE(i1480_est_fd00));
  74. uwb_est_unregister(i1480_CET_VS1, 0x01, 0x8086, 0x0c3b,
  75. i1480_est_fd01, ARRAY_SIZE(i1480_est_fd01));
  76. }
  77. module_exit(i1480_est_exit);
  78. MODULE_AUTHOR("Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>");
  79. MODULE_DESCRIPTION("i1480's Vendor Specific Event Size Tables");
  80. MODULE_LICENSE("GPL");
  81. /**
  82. * USB device ID's that we handle
  83. *
  84. * [so we are loaded when this kind device is connected]
  85. */
  86. static struct usb_device_id __used i1480_est_id_table[] = {
  87. { USB_DEVICE(0x8086, 0xdf3b), },
  88. { USB_DEVICE(0x8086, 0x0c3b), },
  89. { },
  90. };
  91. MODULE_DEVICE_TABLE(usb, i1480_est_id_table);