William Kane / Generic

Dependents:   LaserioLib

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers appl_adimap_simple16.c Source File

appl_adimap_simple16.c

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 code is the property of HMS Industrial Networks AB.                   **
00015 ** The source code may not be reproduced, distributed, or used without        **
00016 ** permission. When used together with a product from HMS, permission is      **
00017 ** granted to modify, reproduce and distribute the code in binary form        **
00018 ** without any restrictions.                                                  **
00019 **                                                                            **
00020 ** THE CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. HMS DOES NOT    **
00021 ** WARRANT THAT THE FUNCTIONS OF THE CODE WILL MEET YOUR REQUIREMENTS, OR     **
00022 ** THAT THE OPERATION OF THE CODE WILL BE UNINTERRUPTED OR ERROR-FREE, OR     **
00023 ** THAT DEFECTS IN IT CAN BE CORRECTED.                                       **
00024 ********************************************************************************
00025 ********************************************************************************
00026 ** Example of an ADI setup with an array of 16 bit values
00027 **
00028 ** In abcc_drv_cfg.h make sure that the following definitions are set to:
00029 ** ABCC_CFG_STRUCT_DATA_TYPE     ( FALSE )
00030 ** ABCC_CFG_ADI_GET_SET_CALLBACK ( FALSE )
00031 ********************************************************************************
00032 ********************************************************************************
00033 */
00034 
00035 #include "appl_adi_config.h"
00036 
00037 #if ( APPL_ACTIVE_ADI_SETUP == APPL_ADI_SETUP_SIMPLE_16 )
00038 
00039 #if (  ABCC_CFG_STRUCT_DATA_TYPE || ABCC_CFG_ADI_GET_SET_CALLBACK )
00040    #error ABCC_CFG_ADI_GET_SET_CALLBACK must be set to FALSE and ABCC_CFG_STRUCT_DATA_TYPE set to FALSE in order to run this example
00041 #endif
00042 /*******************************************************************************
00043 ** Constants
00044 ********************************************************************************
00045 */
00046 
00047 /*******************************************************************************
00048 ** Typedefs
00049 ********************************************************************************
00050 */
00051 
00052 /*******************************************************************************
00053 ** Private Globals
00054 ********************************************************************************
00055 */
00056 
00057 /*------------------------------------------------------------------------------
00058 ** Data holder for the ADI instances
00059 **------------------------------------------------------------------------------
00060 */
00061 static UINT16 appl_aiUint16[ 32 ];
00062 
00063 /*------------------------------------------------------------------------------
00064 ** Min, max and default value for appl_aiUint16
00065 **------------------------------------------------------------------------------
00066 */
00067 static AD_UINT16Type appl_sUint16Prop = { { 0, 0xFFFF, 0 } };
00068 
00069 /*******************************************************************************
00070 ** Public Globals
00071 ********************************************************************************
00072 */
00073 
00074 /*------------------------------------------------------------------------------
00075 ** 32 16-bit values as an array
00076 **------------------------------------------------------------------------------
00077 */
00078 
00079 /*-------------------------------------------------------------------------------------------------------------
00080 ** 1. iInstance | 2. pabName | 3. bDataType | 4. bNumOfElements | 5. bDesc | 6. pxValuePtr | 7. pxValuePropPtr
00081 **--------------------------------------------------------------------------------------------------------------
00082 */
00083 const AD_AdiEntryType APPL_asAdiEntryList[] =
00084 {
00085    {  0x1,  "ABP_UINT16_WRITE",   ABP_UINT16,   32, APPL_WRITE_MAP_READ_ACCESS_DESC, { { appl_aiUint16, &appl_sUint16Prop } } },
00086    {  0x2,  "ABP_UINT16_READ",    ABP_UINT16,   32, APPL_READ_MAP_WRITE_ACCESS_DESC,  { { appl_aiUint16, &appl_sUint16Prop } } }
00087 };
00088 
00089 /*------------------------------------------------------------------------------
00090 ** Map all adi:s in both directions
00091 **------------------------------------------------------------------------------
00092 ** 1. AD instance | 2. Direction | 3. Num elements | 4. Start index |
00093 **------------------------------------------------------------------------------
00094 */
00095 const AD_DefaultMapType APPL_asAdObjDefaultMap[] =
00096 {
00097    { 1, PD_WRITE, AD_DEFAULT_MAP_ALL_ELEM, 0 },
00098    { 2, PD_READ,  AD_DEFAULT_MAP_ALL_ELEM, 0 },
00099    { AD_DEFAULT_MAP_END_ENTRY }
00100 };
00101 
00102 /*******************************************************************************
00103 ** Private Services
00104 ********************************************************************************
00105 */
00106 
00107 /*******************************************************************************
00108 ** Public Services
00109 ********************************************************************************
00110 */
00111 
00112 UINT16 APPL_GetNumAdi( void )
00113 {
00114    return( sizeof( APPL_asAdiEntryList ) / sizeof( AD_AdiEntryType ) );
00115 }
00116 
00117 /*******************************************************************************
00118 ** Tasks
00119 ********************************************************************************
00120 */
00121 
00122 #endif