sipo.h
Go to the documentation of this file.
00001 00048 #ifndef DRV_SIPO_H 00049 #define DRV_SIPO_H 00050 00051 #include "hw/hw_sipo.h" 00052 #include "cfg/cfg_sipo.h" 00053 00054 #include <io/kfile.h> 00055 00056 00057 /* 00058 * The following macros are needed to maintain compatibility with older sipo API. 00059 * They can be safely removed once the old API is removed. 00060 */ 00061 00066 #if COMPILER_C99 00067 #define sipo_init(...) PP_CAT(sipo_init ## _, COUNT_PARMS(__VA_ARGS__)) (__VA_ARGS__) 00068 #else 00069 00078 #define sipo_init(args...) PP_CAT(sipo_init ## _, COUNT_PARMS(args)) (args) 00079 00080 #endif 00081 00084 #define SIPO_DATAORDER_START_LSB 1 00085 #define SIPO_DATAORDER_START_MSB 0x80 00086 00087 #if !CONFIG_SIPO_DISABLE_OLD_API 00088 00091 typedef enum SipoBitOrder 00092 { 00093 SIPO_DATAORDER_MSB = 0, 00094 SIPO_DATAORDER_LSB = 1 00095 } SipoBitOrder; 00096 00100 typedef enum SipoClockPol 00101 { 00102 SIPO_START_LOW = 0, 00103 SIPO_START_HIGH = 1 00104 00105 } SipoClkPol; 00106 00110 typedef enum SipoLoadPol 00111 { 00112 SIPO_LOW_TO_HIGH = 0, 00113 SIPO_HIGH_TO_LOW = 1 00114 00115 } SipoLoadPol; 00116 00120 typedef struct Sipo 00121 { 00122 KFile fd; 00123 SipoMap load_device; 00124 SipoLoadPol load_pol; 00125 SipoClkPol clock_pol; 00126 SipoBitOrder bit_order; 00127 00128 } Sipo; 00129 #else /* New api */ 00130 00131 #define SIPO_DATAORDER BV(0) 00132 #define SIPO_DATAORDER_MSB BV(0) ///< Set MSB sipo data order setting 00133 #define SIPO_DATAORDER_LSB 0 ///< Set LSB sipo data order setting 00134 00135 #define SIPO_CLOCK_POL BV(1) 00136 #define SIPO_START_LOW BV(1) ///< Set sipo clock start level high setting 00137 #define SIPO_START_HIGH 0 ///< Set sipo clock start level low setting 00138 00139 #define SIPO_LOAD_LEV BV(2) 00140 #define SIPO_LOW_TO_HIGH BV(2) ///< Set sipo load high signal level setting. 00141 #define SIPO_HIGH_TO_LOW 0 ///< Set sipo load low signal level setting. 00142 00146 typedef struct Sipo 00147 { 00148 KFile fd; 00149 SipoMap device; 00150 uint8_t settings; 00151 } Sipo; 00152 00153 #endif 00154 00158 #define KFT_SIPO MAKE_ID('S', 'I', 'P', 'O') 00159 00163 INLINE Sipo * SIPO_CAST(KFile *fd) 00164 { 00165 ASSERT(fd->_type == KFT_SIPO); 00166 return (Sipo *)fd; 00167 } 00168 00169 void sipo_init_1(Sipo *fd); 00170 void sipo_init_3(Sipo *fd, SipoMap dev, uint8_t settings); 00171 //defgroup sipo_driver 00173 00174 #endif /* DRV_SIPO_H */ 00175
![(please configure the [header_logo] section in trac.ini)](/chrome/site/bertos_logo.png)