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