William Kane / Generic

Dependents:   LaserioLib

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ad_obj.h Source File

ad_obj.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 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 ** Application Data Object 0xFE (ADI) - Public interfaces
00027 ********************************************************************************
00028 ********************************************************************************
00029 ** Services :
00030 ** AD_Init()                  - Initiate AD object.
00031 ** AD_ProcObjectRequest()     - Object request handling.
00032 ** AD_RemapDone()             - Remap finished.
00033 ** AD_UpdatePdReadData()      - Update of read process data.
00034 ** AD_UpdatePdWriteData()     - Update of write process data.
00035 ********************************************************************************
00036 ********************************************************************************
00037 */
00038 #ifndef AD_OBJ_H
00039 #define AD_OBJ_H
00040 
00041 #include "abcc_td.h"
00042 #include "abp.h"
00043 #include "abcc_ad_if.h"
00044 
00045 /*******************************************************************************
00046 ** Typedefs
00047 ********************************************************************************
00048 */
00049 /*------------------------------------------------------------------------------
00050 **  AD_NO_ERROR                - All OK
00051 **  AD_PD_REDA_SIZE_ERR        - Total process data read size too large.
00052 **                               Check ABCC_CFG_MAX_PROCESS_DATA_SIZE.
00053 **  AD_PD_WRITE_SIZE_ERR       - Total process data write too large.
00054 **                               Check ABCC_CFG_MAX_PROCESS_DATA_SIZE.
00055 **  AD_TOO_MANY_READ_MAPPINGS  -  Read process data map has too many entries.
00056 **                               Check AD_MAX_OF_READ_WRITE_TO_MAP.
00057 **  AD_TOO_MANY_WRITE_MAPPINGS -  Write process data map has too many entries.
00058 **                               Check AD_MAX_OF_WRITE_WRITE_TO_MAP.
00059 **  AD_UNKNOWN_ADI             - Requested ADI could not be found.
00060 **------------------------------------------------------------------------------
00061 */
00062 typedef enum AD_Err
00063 {
00064    AD_NO_ERROR = 0,
00065    AD_PD_READ_SIZE_ERR,
00066    AD_PD_WRITE_SIZE_ERR,
00067    AD_TOO_MANY_READ_MAPPINGS,
00068    AD_TOO_MANY_WRITE_MAPPINGS,
00069    AD_UNKNOWN_ADI
00070 }
00071 AD_ErrType;
00072 
00073 /*******************************************************************************
00074 ** Public Services
00075 ********************************************************************************
00076 */
00077 /*------------------------------------------------------------------------------
00078 **  Initiates the AD object.
00079 **------------------------------------------------------------------------------
00080 ** Arguments:
00081 **    psAdiEntry   - Pointer to used ADI entry table.
00082 **    iNumAdi      - Number of ADI:s in ADI entry table.
00083 **    psDefaultMap - Pointer to default map. Set to NULL if no default map
00084 **                   shall be used.
00085 **
00086 ** Returns:
00087 **    AD_ErrType
00088 **------------------------------------------------------------------------------
00089 */
00090 EXTFUNC AD_ErrType AD_Init( const AD_AdiEntryType* psAdiEntry,
00091                             UINT16 iNumAdi,
00092                             const AD_DefaultMapType* psDefaultMap );
00093 
00094 /*------------------------------------------------------------------------------
00095 **  Retrieve default mapping information from AD object. The AD objects also
00096 **  prepares for network endian conversion if needed. The function may only be
00097 **  called when requested by driver through the callback ABCC_CbfAdiMappingReq()
00098 **------------------------------------------------------------------------------
00099 ** Arguments:
00100 **     ppsAdiEntry    - Pointer to retrieve ADI entry table.
00101 **                      NULL is returned if no default map is available.
00102 **     ppsDefaultMap  - Pointer to retrieve default map information.
00103 **                      NULL is returned if no default map is available.
00104 **
00105 ** Returns:
00106 **    Number of ADI:s in psAdiEntry table.
00107 **------------------------------------------------------------------------------
00108 */
00109 EXTFUNC UINT16 AD_AdiMappingReq( const AD_AdiEntryType** ppsAdiEntry,
00110                                  const AD_DefaultMapType** ppsDefaultMap );
00111 
00112 /*------------------------------------------------------------------------------
00113 ** Indicate to AD object that the remap is finished
00114 **------------------------------------------------------------------------------
00115 ** Arguments:
00116 **    None
00117 **
00118 ** Returns:
00119 **    None
00120 **------------------------------------------------------------------------------
00121 */
00122 #if( ABCC_CFG_REMAP_SUPPORT_ENABLED )
00123 EXTFUNC void AD_RemapDone( void );
00124 #endif
00125 
00126 /*------------------------------------------------------------------------------
00127 ** Process an object request against the Application Data Object.
00128 **------------------------------------------------------------------------------
00129 ** Arguments:
00130 **    psMsgBuffer      - Pointer to ABCC command message.
00131 **
00132 ** Returns:
00133 **    None
00134 **------------------------------------------------------------------------------
00135 */
00136 EXTFUNC void AD_ProcObjectRequest( ABP_MsgType* psMsgBuffer );
00137 
00138 /*------------------------------------------------------------------------------
00139 ** Update AD object with new read process data received from the ABCC.
00140 **------------------------------------------------------------------------------
00141 ** Arguments:
00142 **    pxPdDataBuf      - Pointer read process data buffer.
00143 **
00144 ** Returns:
00145 **    None
00146 **------------------------------------------------------------------------------
00147 */
00148 EXTFUNC void AD_UpdatePdReadData( void* pxPdDataBuf );
00149 
00150 /*------------------------------------------------------------------------------
00151 ** Fetch write process data from AD object.
00152 **------------------------------------------------------------------------------
00153 ** Arguments:
00154 **    pxPdDataBuf       - Pointer write process data buffer.
00155 **
00156 ** Returns:
00157 **    TRUE  -  Write process data buffer is updated.
00158 **    FALSE -  No update was made.
00159 **
00160 **------------------------------------------------------------------------------
00161 */
00162 EXTFUNC BOOL AD_UpdatePdWriteData( void* pxPdDataBuf );
00163 #endif  /* inclusion lock */