shmbuf.h

Go to the documentation of this file.
00001 /* 
00002  * Copyright (c) 2009, Texas Instruments Incorporated
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * *  Redistributions of source code must retain the above copyright
00010  *    notice, this list of conditions and the following disclaimer.
00011  *
00012  * *  Redistributions in binary form must reproduce the above copyright
00013  *    notice, this list of conditions and the following disclaimer in the
00014  *    documentation and/or other materials provided with the distribution.
00015  *
00016  * *  Neither the name of Texas Instruments Incorporated nor the names of
00017  *    its contributors may be used to endorse or promote products derived
00018  *    from this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00021  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00022  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00023  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00024  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00025  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00026  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00027  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00028  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00029  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00030  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031  * 
00032  */
00033 
00054 #ifndef SHMBUF_H_
00055 #define SHMBUF_H_
00056 
00059 
00060 #ifdef __cplusplus
00061 extern "C" {
00062 #endif
00063 
00064 #include <ti/xdais/ires_common.h>
00065 #include <ti/sdo/fc/ires/iresman_protocol.h>
00066 #include <ti/sdo/fc/ires/iresman.h>
00067 
00068 
00069 #define SHMBUF_GTNAME "ti.sdo.fc.ires.shmbuf" 
00076 #define SHMBUF_PROTOCOLNAME "ti.sdo.fc.ires.shmbuf"
00077 
00078 
00079 /*
00080  * Note, we wrap the SHMBUF_PROTOCOLVERSION in an ifdef so the
00081  * resource managers and algs get this version data placed in their object
00082  * files.  Apps, which include rman.h, will have this 'NOPROTOCOLREV' defined.
00083  */
00084 #ifndef ti_sdo_fc_ires_NOPROTOCOLREV
00085 
00089 static IRES_ProtocolRevision SHMBUF_PROTOCOLVERSION = {1, 0, 0};
00090 
00091 #endif
00092 
00093 
00100 typedef struct SHMBUF_Params {
00101     IRESMAN_Params iresConfig;
00102 
00103     /* Config params specific to this resource */
00104     Int       bufsize;    /* Size of the buffer */
00105     UInt32    key;        /* Key to identify shared memory object */
00106     UInt32    isScratch;  /* Can the buffer be shared? */
00107 } SHMBUF_Params;
00108 
00109 /*
00110  *  ======== SHMBUF_Obj ========
00111  *  Extension of IRES_Obj. This object holds the state of the logical resource
00112  *  granted to the algorithm.
00113  */
00114 typedef struct SHMBUF_Obj {
00115     IRES_Obj        ires;
00116 
00117     /* Fields specific to this resource */
00118     Void   *base;    /* Base address of assigned memory chunk */
00119     Int     length;  /* Length of assigned memory chunk */
00120 } SHMBUF_Obj;
00121 
00122 /*
00123  *  ======== SHMBUF_Args ========
00124  *  Extends IRES_ProtocolArgs. Used by the algorithm to request this resource.
00125  */
00126 typedef struct SHMBUF_Args {
00127     IRES_ProtocolArgs iresArgs;
00128 
00129     /* Fields filled in by algorithm when requesting this resource */
00130     Int    length;  /* Length of buffer requested */
00131     Int    align;   /* Buffer alignment: 0 (no alignment) or a power of 2 */
00132 } SHMBUF_Args;
00133 
00134 /*
00135  *  ======== SHMBUF_Props ========
00136  *  Implementation of IRES_Properties for the buffer resource, returned
00137  *  by SHMBUF_PROTOCOL.getStaticResourceProperties().
00138  */
00139 typedef struct SHMBUF_Props {
00140     Int         size;    /* Size of this structure */
00141 
00142     /* Fields specific to this resource */
00143     Void   *base;        /* Base address of the shared memory resource */
00144     Int     length;      /* Length of the shared memory resource */
00145     Int     isScratch;   /* Can it be shared? */
00146 } SHMBUF_Props;
00147 
00148 /*
00149  *  ======== SHMBUF_Handle ========
00150  *  Opaque handle to the SHMBUF extension of the IRES_Obj object
00151  */
00152 typedef struct SHMBUF_Obj *SHMBUF_Handle;
00153 
00154 extern SHMBUF_Params SHMBUF_PARAMS;
00155 extern IRESMAN_ConstructFxns SHMBUF_REQFXNS;
00156 extern IRESMAN_Fxns SHMBUF_MGRFXNS;
00157 
00158 
00159 #ifdef __cplusplus
00160 }
00161 #endif /* extern "C" */
00162 
00165 #endif /* SHMBUF_H_ */
00166 
00167 /*
00168  *  @(#) ti.sdo.fc.ires.shmbuf; 1, 0, 0,97; 11-8-2009 20:58:16; /db/atree/library/trees/fc/fc-l04x/src/
00169  */
00170 

Copyright 2009, Texas Instruments Incorporated