cfcnfg.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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_disconn_adapt_layer - Disconnects an adaptation layer.
  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_disconn_adapt_layer(struct cfcnfg *cnfg,
  87. struct cflayer *adap_layer);
  88. /**
  89. * cfcnfg_release_adap_layer - Used by client to release the adaptation layer.
  90. *
  91. * @adap_layer: Adaptation layer.
  92. */
  93. void cfcnfg_release_adap_layer(struct cflayer *adap_layer);
  94. /**
  95. * cfcnfg_add_adaptation_layer - Add an adaptation layer to the CAIF stack.
  96. *
  97. * The adaptation Layer is where the interface to application or higher-level
  98. * driver functionality is implemented.
  99. *
  100. * @cnfg: Pointer to a CAIF configuration object, created by
  101. * cfcnfg_create().
  102. * @param: Link setup parameters.
  103. * @adap_layer: Specify the adaptation layer; the receive and
  104. * flow-control functions MUST be set in the structure.
  105. *
  106. */
  107. int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg,
  108. struct cfctrl_link_param *param,
  109. struct cflayer *adap_layer);
  110. /**
  111. * cfcnfg_get_phyid() - Get physical ID, given type.
  112. * Returns one of the physical interfaces matching the given type.
  113. * Zero if no match is found.
  114. * @cnfg: Configuration object
  115. * @phy_pref: Caif Link Layer preference
  116. */
  117. struct dev_info *cfcnfg_get_phyid(struct cfcnfg *cnfg,
  118. enum cfcnfg_phy_preference phy_pref);
  119. /**
  120. * cfcnfg_get_named() - Get the Physical Identifier of CAIF Link Layer
  121. * @cnfg: Configuration object
  122. * @name: Name of the Physical Layer (Caif Link Layer)
  123. */
  124. int cfcnfg_get_named(struct cfcnfg *cnfg, char *name);
  125. #endif /* CFCNFG_H_ */