cfcnfg.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * Copyright (C) ST-Ericsson AB 2010
  3. * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
  4. * License terms: GNU General Public License (GPL) version 2
  5. */
  6. #ifndef CFCNFG_H_
  7. #define CFCNFG_H_
  8. #include <linux/spinlock.h>
  9. #include <net/caif/caif_layer.h>
  10. #include <net/caif/cfctrl.h>
  11. struct cfcnfg;
  12. /**
  13. * enum cfcnfg_phy_type - Types of physical layers defined in CAIF Stack
  14. *
  15. * @CFPHYTYPE_FRAG: Fragmented frames physical interface.
  16. * @CFPHYTYPE_CAIF: Generic CAIF physical interface
  17. */
  18. enum cfcnfg_phy_type {
  19. CFPHYTYPE_FRAG = 1,
  20. CFPHYTYPE_CAIF,
  21. CFPHYTYPE_MAX
  22. };
  23. /**
  24. * enum cfcnfg_phy_preference - Physical preference HW Abstraction
  25. *
  26. * @CFPHYPREF_UNSPECIFIED: Default physical interface
  27. *
  28. * @CFPHYPREF_LOW_LAT: Default physical interface for low-latency
  29. * traffic
  30. * @CFPHYPREF_HIGH_BW: Default physical interface for high-bandwidth
  31. * traffic
  32. * @CFPHYPREF_LOOP: TEST only Loopback interface simulating modem
  33. * responses.
  34. *
  35. */
  36. enum cfcnfg_phy_preference {
  37. CFPHYPREF_UNSPECIFIED,
  38. CFPHYPREF_LOW_LAT,
  39. CFPHYPREF_HIGH_BW,
  40. CFPHYPREF_LOOP
  41. };
  42. /**
  43. * cfcnfg_create() - Create the CAIF configuration object.
  44. */
  45. struct cfcnfg *cfcnfg_create(void);
  46. /**
  47. * cfcnfg_remove() - Remove the CFCNFG object
  48. * @cfg: config object
  49. */
  50. void cfcnfg_remove(struct cfcnfg *cfg);
  51. /**
  52. * cfcnfg_add_phy_layer() - Adds a physical layer to the CAIF stack.
  53. * @cnfg: Pointer to a CAIF configuration object, created by
  54. * cfcnfg_create().
  55. * @phy_type: Specifies the type of physical interface, e.g.
  56. * CFPHYTYPE_FRAG.
  57. * @dev: Pointer to link layer device
  58. * @phy_layer: Specify the physical layer. The transmit function
  59. * MUST be set in the structure.
  60. * @phyid: The assigned physical ID for this layer, used in
  61. * cfcnfg_add_adapt_layer to specify PHY for the link.
  62. * @pref: The phy (link layer) preference.
  63. * @fcs: Specify if checksum is used in CAIF Framing Layer.
  64. * @stx: Specify if Start Of Frame eXtention is used.
  65. */
  66. void
  67. cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
  68. void *dev, struct cflayer *phy_layer, u16 *phyid,
  69. enum cfcnfg_phy_preference pref,
  70. bool fcs, bool stx);
  71. /**
  72. * cfcnfg_del_phy_layer - Deletes an phy layer from the CAIF stack.
  73. *
  74. * @cnfg: Pointer to a CAIF configuration object, created by
  75. * cfcnfg_create().
  76. * @phy_layer: Adaptation layer to be removed.
  77. */
  78. int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer);
  79. /**
  80. * cfcnfg_del_adapt_layer - Deletes an adaptation layer from the CAIF stack.
  81. *
  82. * @cnfg: Pointer to a CAIF configuration object, created by
  83. * cfcnfg_create().
  84. * @adap_layer: Adaptation layer to be removed.
  85. */
  86. int cfcnfg_del_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer);
  87. /**
  88. * cfcnfg_add_adaptation_layer - Add an adaptation layer to the CAIF stack.
  89. *
  90. * The adaptation Layer is where the interface to application or higher-level
  91. * driver functionality is implemented.
  92. *
  93. * @cnfg: Pointer to a CAIF configuration object, created by
  94. * cfcnfg_create().
  95. * @param: Link setup parameters.
  96. * @adap_layer: Specify the adaptation layer; the receive and
  97. * flow-control functions MUST be set in the structure.
  98. *
  99. */
  100. int
  101. cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg,
  102. struct cfctrl_link_param *param,
  103. struct cflayer *adap_layer);
  104. /**
  105. * cfcnfg_get_phyid() - Get physical ID, given type.
  106. * Returns one of the physical interfaces matching the given type.
  107. * Zero if no match is found.
  108. * @cnfg: Configuration object
  109. * @phy_pref: Caif Link Layer preference
  110. */
  111. struct dev_info *cfcnfg_get_phyid(struct cfcnfg *cnfg,
  112. enum cfcnfg_phy_preference phy_pref);
  113. /**
  114. * cfcnfg_get_named() - Get the Physical Identifier of CAIF Link Layer
  115. * @cnfg: Configuration object
  116. * @name: Name of the Physical Layer (Caif Link Layer)
  117. */
  118. int cfcnfg_get_named(struct cfcnfg *cnfg, char *name);
  119. #endif /* CFCNFG_H_ */