| 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> | 
| Sjur Braendeland | 2aa40ae | 2010-06-17 06:55:40 +0000 | [diff] [blame] | 10 | #include <linux/netdevice.h> | 
| Sjur Braendeland | 09009f3 | 2010-03-30 13:56:21 +0000 | [diff] [blame] | 11 | #include <net/caif/caif_layer.h> | 
 | 12 | #include <net/caif/cfctrl.h> | 
 | 13 |  | 
 | 14 | struct cfcnfg; | 
 | 15 |  | 
 | 16 | /** | 
 | 17 |  * enum cfcnfg_phy_type -  Types of physical layers defined in CAIF Stack | 
 | 18 |  * | 
 | 19 |  * @CFPHYTYPE_FRAG:	Fragmented frames physical interface. | 
 | 20 |  * @CFPHYTYPE_CAIF:	Generic CAIF physical interface | 
 | 21 |  */ | 
 | 22 | enum cfcnfg_phy_type { | 
 | 23 | 	CFPHYTYPE_FRAG = 1, | 
 | 24 | 	CFPHYTYPE_CAIF, | 
 | 25 | 	CFPHYTYPE_MAX | 
 | 26 | }; | 
 | 27 |  | 
 | 28 | /** | 
 | 29 |  * enum cfcnfg_phy_preference - Physical preference HW Abstraction | 
 | 30 |  * | 
 | 31 |  * @CFPHYPREF_UNSPECIFIED:	Default physical interface | 
 | 32 |  * | 
 | 33 |  * @CFPHYPREF_LOW_LAT:		Default physical interface for low-latency | 
 | 34 |  *				traffic | 
 | 35 |  * @CFPHYPREF_HIGH_BW:		Default physical interface for high-bandwidth | 
 | 36 |  *				traffic | 
 | 37 |  * @CFPHYPREF_LOOP:		TEST only Loopback interface simulating modem | 
 | 38 |  *				responses. | 
 | 39 |  * | 
 | 40 |  */ | 
 | 41 | enum cfcnfg_phy_preference { | 
 | 42 | 	CFPHYPREF_UNSPECIFIED, | 
 | 43 | 	CFPHYPREF_LOW_LAT, | 
 | 44 | 	CFPHYPREF_HIGH_BW, | 
 | 45 | 	CFPHYPREF_LOOP | 
 | 46 | }; | 
 | 47 |  | 
 | 48 | /** | 
| sjur.brandeland@stericsson.com | bee925d | 2011-05-13 02:44:05 +0000 | [diff] [blame] | 49 |  * cfcnfg_create() - Get the CAIF configuration object given network. | 
 | 50 |  * @net:	Network for the CAIF configuration object. | 
 | 51 |  */ | 
 | 52 | struct cfcnfg *get_cfcnfg(struct net *net); | 
 | 53 |  | 
 | 54 | /** | 
| Sjur Braendeland | 09009f3 | 2010-03-30 13:56:21 +0000 | [diff] [blame] | 55 |  * cfcnfg_create() - Create the CAIF configuration object. | 
 | 56 |  */ | 
 | 57 | struct cfcnfg *cfcnfg_create(void); | 
 | 58 |  | 
 | 59 | /** | 
 | 60 |  * cfcnfg_remove() -  Remove the CFCNFG object | 
 | 61 |  * @cfg: config object | 
 | 62 |  */ | 
 | 63 | void cfcnfg_remove(struct cfcnfg *cfg); | 
 | 64 |  | 
 | 65 | /** | 
 | 66 |  * cfcnfg_add_phy_layer() - Adds a physical layer to the CAIF stack. | 
 | 67 |  * @cnfg:	Pointer to a CAIF configuration object, created by | 
 | 68 |  *		cfcnfg_create(). | 
 | 69 |  * @phy_type:	Specifies the type of physical interface, e.g. | 
 | 70 |  *			CFPHYTYPE_FRAG. | 
 | 71 |  * @dev:	Pointer to link layer device | 
 | 72 |  * @phy_layer:	Specify the physical layer. The transmit function | 
 | 73 |  *		MUST be set in the structure. | 
| Sjur Braendeland | 09009f3 | 2010-03-30 13:56:21 +0000 | [diff] [blame] | 74 |  * @pref:	The phy (link layer) preference. | 
 | 75 |  * @fcs:	Specify if checksum is used in CAIF Framing Layer. | 
| sjur.brandeland@stericsson.com | bee925d | 2011-05-13 02:44:05 +0000 | [diff] [blame] | 76 |  * @stx:	Specify if Start Of Frame eXtention is used. | 
| Sjur Braendeland | 09009f3 | 2010-03-30 13:56:21 +0000 | [diff] [blame] | 77 |  */ | 
 | 78 |  | 
 | 79 | void | 
 | 80 | cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, | 
| Sjur Braendeland | 2aa40ae | 2010-06-17 06:55:40 +0000 | [diff] [blame] | 81 | 		     struct net_device *dev, struct cflayer *phy_layer, | 
| sjur.brandeland@stericsson.com | bee925d | 2011-05-13 02:44:05 +0000 | [diff] [blame] | 82 | 		     enum cfcnfg_phy_preference pref, | 
| Sjur Braendeland | 09009f3 | 2010-03-30 13:56:21 +0000 | [diff] [blame] | 83 | 		     bool fcs, bool stx); | 
 | 84 |  | 
 | 85 | /** | 
 | 86 |  * cfcnfg_del_phy_layer - Deletes an phy layer from the CAIF stack. | 
 | 87 |  * | 
 | 88 |  * @cnfg:	Pointer to a CAIF configuration object, created by | 
 | 89 |  *		cfcnfg_create(). | 
 | 90 |  * @phy_layer:	Adaptation layer to be removed. | 
 | 91 |  */ | 
 | 92 | int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer); | 
 | 93 |  | 
 | 94 | /** | 
| sjur.brandeland@stericsson.com | bd30ce4 | 2011-05-13 02:44:00 +0000 | [diff] [blame] | 95 |  * cfcnfg_set_phy_state() - Set the state of the physical interface device. | 
 | 96 |  * @cnfg:	Configuration object | 
 | 97 |  * @phy_layer:	Physical Layer representation | 
 | 98 |  * @up:	State of device | 
 | 99 |  */ | 
 | 100 | int cfcnfg_set_phy_state(struct cfcnfg *cnfg, struct cflayer *phy_layer, | 
 | 101 | 				bool up); | 
 | 102 |  | 
| Sjur Braendeland | 09009f3 | 2010-03-30 13:56:21 +0000 | [diff] [blame] | 103 | #endif				/* CFCNFG_H_ */ |