William Kane / Generic

Dependents:   LaserioLib

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers appl_adi_config.h Source File

appl_adi_config.h

00001 /*******************************************************************************
00002 ********************************************************************************
00003 **                                                                            **
00004 ** ABCC Starter Kit version 2.01.01 (2015-12-14)                              **
00005 **                                                                            **
00006 ** Delivered with:                                                            **
00007 **    ABCC Driver 4.01.01 (2015-12-14)                                        **
00008 **    ABP         7.16.01 (2015-10-14)                                        **
00009 **                                                                            */
00010 /*******************************************************************************
00011 ********************************************************************************
00012 ** COPYRIGHT NOTIFICATION (c) 2015 HMS Industrial Networks AB                 **
00013 **                                                                            **
00014 ** This program is the property of HMS Industrial Networks AB.                **
00015 ** It may not be reproduced, distributed, or used without permission          **
00016 ** of an authorized company official.                                         **
00017 ********************************************************************************
00018 ********************************************************************************
00019 ** Header file for the Application data instances setup and the default map
00020 ********************************************************************************
00021 ********************************************************************************
00022 ** Services:
00023 ********************************************************************************
00024 ********************************************************************************
00025 */
00026 
00027 #ifndef APPL_ADI_CONFIG_H_
00028 #define APPL_ADI_CONFIG_H_
00029 
00030 #include "abcc_td.h"
00031 #include "abp.h"
00032 #include "abcc_drv_cfg.h"
00033 #include "abcc_ad_if.h"
00034 #include "abcc_obj_cfg.h"
00035 
00036 /*******************************************************************************
00037 ** Constants
00038 ********************************************************************************
00039 */
00040 
00041 /*------------------------------------------------------------------------------
00042 ** There are 5 examples of ADI mappings:
00043 **
00044 **         #define APPL_ADI_SETUP_BOARD_SPECIFIC
00045 **         #define APPL_ADI_SETUP_SIMPLE_16
00046 **         #define APPL_ADI_SETUP_SEPARATE_16
00047 **         #define APPL_ADI_SETUP_ALL_TYPES
00048 **         #define APPL_ADI_SETUP_SYNC
00049 **
00050 **         The active setup is chosen by:
00051 **         #define APPL_ACTIVE_ADI_SETUP
00052 **
00053 **         Example: #define APPL_ACTIVE_ADI_SETUP APPL_ADI_SETUP_SIMPLE_16
00054 **
00055 **         Below is a description of each example:
00056 **
00057 **         For a more detailed description of ADI:s and ADI mapping,
00058 **         see abcc_drv/inc/abcc_ad_if.h.
00059 **         ---------------------------------------------------------------------
00060 **         APPL_ADI_SETUP_BOARD_SPECIFIC :  Designed for the HW platform of this
00061 **                                          SW project.
00062 **         ---------------------------------------------------------------------
00063 **         APPL_ADI_SETUP_SIMPLE_16:
00064 **         Implemented in appl_adimap_simple16.c
00065 **
00066 **         AD instance 1: An array of 32 ABP_UINT16 (64 octets mapped to write process data)
00067 **         AD instance 2: An array of 32 ABP_UINT16 (64 octets mapped to read process data)
00068 **         Data is looped since the ADI:s are refering to the same variable.
00069 **         ---------------------------------------------------------------------
00070 **         APPL_ADI_SETUP_SEPARATE_16 ( Get/Set ADI callback example )
00071 **         Implemented in appl_adimap_separate16.c
00072 **         AD instance 10: An array of 32 ABP_UINT16 (64 octets mapped to read process data)
00073 **         AD instance 11: An array of 32 ABP_UINT16 (64 octets mapped to write process data)
00074 **         AD instance 12: ABP_UINT16 (not mapped to process data)
00075 **
00076 **         ADI 10 triggers a callback each time a new value is written from the network.
00077 **         The callback copies the data to ADI 11 ( looped to write process data )
00078 **
00079 **         ADI 11 triggers a callback each time the value is read by the network.
00080 **         The callback also increments ADI 12.
00081 **         ---------------------------------------------------------------------
00082 **         APPL_ADI_SETUP_ALL_TYPES  ( structured ADI:s and bit data types )
00083 **
00084 **         Implemented in appl_adimap_alltypes.c
00085 **
00086 **         AD instance 20:  ABP_UINT32  ( Mapped to read process data )
00087 **         AD instance 21:  ABP_UINT32  ( Mapped to write process data, loops ADI 20 )
00088 **         AD instance 22:  ABP_SINT32  ( Mapped to read process data )
00089 **         AD instance 23:  ABP_SINT32  ( Mapped to write process data, loops ADI 22  )
00090 **         AD instance 24:  ABP_UINT16  ( Mapped to read process data )
00091 **         AD instance 25:  ABP_UINT16  ( Mapped to write process data , loops ADI 24 )
00092 **         AD instance 26:  ABP_SINT16  ( Mapped to read process data )
00093 **         AD instance 27:  ABP_SINT16  ( Mapped to write process data, loops ADI 26  )
00094 **         AD instance 28:  ABP_BITS16  ( Mapped to read process data )
00095 **         AD instance 29:  ABP_BITS16  ( Mapped to write process data, loops ADI 28  )
00096 **         AD instance 30:  ABP_UINT8   ( Mapped to read process data )
00097 **         AD instance 31:  ABP_UINT8   ( Mapped to write process data, loops ADI 30  )
00098 **         AD instance 32:  ABP_SINT8   ( Mapped to read process data )
00099 **         AD instance 33:  ABP_SINT8   ( Mapped to write process data, loops ADI 32  )
00100 **         AD instance 34:  ABP_UINT8   ( Mapped to read process data )
00101 **         AD instance 35:  ABP_UINT8   ( Mapped to write process data, loops ADI 34  )
00102 **         AD instance 36:  ABP_BIT7    ( Mapped to read process data )
00103 **         AD instance 37:  ABP_BIT7    ( Mapped to write process data, loops ADI 36  )
00104 **         AD instance 38:  Structure   ( Mapped to read process data )
00105 **         AD instance 39:  Structure   ( Mapped to write process data, loops ADI 38  )
00106 **
00107 **         THe structure has the following members:
00108 **
00109 **         Index 0: ABP_UINT32
00110 **         Index 1: ABP_SINT32
00111 **         Index 2: ABP_UINT16
00112 **         Index 3: ABP_SINT16
00113 **         Index 4: ABP_BITS16
00114 **         Index 5: ABP_UINT8
00115 **         Index 6: ABP_SINT8
00116 **         Index 7: ABP_BITS8
00117 **         Index 8: ABP_PAD8
00118 **         Index 9: ABP_BIT1
00119 **         Index 10: ABP_BIT2
00120 **         Index 11: ABP_BIT3
00121 **         Index 12: ABP_BIT4
00122 **         Index 13: ABP_BIT5
00123 **         Index 14: ABP_BIT6
00124 **         Index 15: ABP_BIT7
00125 **         Index 16: ABP_PAD4
00126 **
00127 **
00128 **         Note!
00129 **            - The content of the PAD bits are undefined.
00130 **         ---------------------------------------------------------------------
00131 **        APPL_ADI_SETUP_SYNC : Shows an example of how to handle the ADIs when
00132 **                              running a sync application.
00133 **            - The sync example requires the following setup in abcc_drv_cfg.h
00134 **                Using sync signal as source:
00135 **                #define ABCC_CFG_SYNC_ENABLE                       ( TRUE )
00136 **                #define ABCC_CFG_USE_ABCC_SYNC_SIGNAL              ( TRUE )
00137 **                or
00138 **                Using ABCC interrupt:
00139 **                #define ABCC_CFG_SYNC_ENABLE                       ( TRUE )
00140 **                #define ABCC_CFG_USE_ABCC_SYNC_SIGNAL              ( FALSE )
00141 **                #define ABCC_CFG_INT_ENABLED                       ( TRUE )
00142 **
00143 **------------------------------------------------------------------------------
00144 */
00145 #define APPL_ADI_SETUP_BOARD_SPECIFIC  0
00146 #define APPL_ADI_SETUP_SIMPLE_16       1
00147 #define APPL_ADI_SETUP_SEPARATE_16     2
00148 #define APPL_ADI_SETUP_ALL_TYPES       3
00149 #define APPL_ADI_SETUP_SYNC            4
00150 
00151 /*------------------------------------------------------------------------------
00152 ** Active ADI setup to use
00153 **------------------------------------------------------------------------------
00154 */
00155 #ifdef USE_BOARD_SPECIFIC_ADI_SETUP
00156 #define APPL_ACTIVE_ADI_SETUP   APPL_ADI_SETUP_BOARD_SPECIFIC
00157 #else
00158 #define APPL_ACTIVE_ADI_SETUP   APPL_ADI_SETUP_SIMPLE_16
00159 #endif
00160 
00161 /*------------------------------------------------------------------------------
00162 ** If structured data types is used i.e. psStruct != NULL (see example below),
00163 ** this define could be used to indicate that the ABP_TYPE member in
00164 ** AD_AdiEntryType is don't care.
00165 **
00166 ** { 0x60, "Struct", DONT_CARE,   17, DESC, { { NULL, NULL } }, psStruct }
00167 **------------------------------------------------------------------------------
00168 */
00169 #define DONT_CARE  0
00170 
00171 /*------------------------------------------------------------------------------
00172 ** Access descriptor for the ADIs
00173 **------------------------------------------------------------------------------
00174 */
00175 #define APPL_READ_MAP_READ_ACCESS_DESC ( ABP_APPD_DESCR_GET_ACCESS |           \
00176                                          ABP_APPD_DESCR_MAPPABLE_READ_PD )
00177 
00178 #define APPL_READ_MAP_WRITE_ACCESS_DESC ( ABP_APPD_DESCR_GET_ACCESS |          \
00179                                           ABP_APPD_DESCR_SET_ACCESS |          \
00180                                           ABP_APPD_DESCR_MAPPABLE_READ_PD )
00181 
00182 #define APPL_WRITE_MAP_READ_ACCESS_DESC ( ABP_APPD_DESCR_GET_ACCESS |          \
00183                                           ABP_APPD_DESCR_MAPPABLE_WRITE_PD )
00184 
00185 #define APPL_NOT_MAP_READ_ACCESS_DESC ( ABP_APPD_DESCR_GET_ACCESS |            \
00186                                         ABP_APPD_DESCR_MAPPABLE_WRITE_PD )
00187 
00188 #define APPL_NOT_MAP_WRITE_ACCESS_DESC ( ABP_APPD_DESCR_GET_ACCESS |           \
00189                                          ABP_APPD_DESCR_SET_ACCESS )
00190 
00191 /*******************************************************************************
00192 ** Typedefs
00193 ********************************************************************************
00194 */
00195 
00196 /*******************************************************************************
00197 ** Public Globals
00198 ********************************************************************************
00199 */
00200 
00201 /*------------------------------------------------------------------------------
00202 ** List of Application data instances
00203 **------------------------------------------------------------------------------
00204 */
00205 EXTFUNC const AD_AdiEntryType APPL_asAdiEntryList[];
00206 
00207 /*------------------------------------------------------------------------------
00208 ** Default process data map
00209 **------------------------------------------------------------------------------
00210 */
00211 EXTFUNC const AD_DefaultMapType APPL_asAdObjDefaultMap[];
00212 
00213 /*******************************************************************************
00214 ** Public Services
00215 ********************************************************************************
00216 */
00217 
00218 /*------------------------------------------------------------------------------
00219 ** Returns the number of defined Application data instances
00220 **------------------------------------------------------------------------------
00221 ** Arguments:
00222 **    None
00223 **
00224 ** Returns:
00225 **    UINT16 - Number of Application data instances
00226 **------------------------------------------------------------------------------
00227 */
00228 EXTFUNC UINT16 APPL_GetNumAdi( void );
00229 
00230 /*------------------------------------------------------------------------------
00231 ** Interrupt service routine for sync event. There are 2 ways to detect a sync
00232 ** event.
00233 ** 1. Set the SYNCIEN in the ABCC interrupt mask register and call this
00234 **    function from the ABCC_CbfEvent() callback function.
00235 ** 2. Use the the separate sync signal available on the ABCC host connector
00236 **    interface connected to an external interrupt. This is recommended for high
00237 **    performance applications.
00238 **------------------------------------------------------------------------------
00239 ** Arguments:
00240 **    None
00241 **
00242 ** Returns:
00243 **    None
00244 **------------------------------------------------------------------------------
00245 */
00246 #if SYNC_OBJ_ENABLE
00247 EXTFUNC void APPL_SyncIsr( void );
00248 #endif
00249 
00250 #endif  /* inclusion lock */