background image

 

To our customers, 

 

Old Company Name in Catalogs and Other Documents 

 

On April 1

st

, 2010, NEC Electronics Corporation merged with Renesas Technology 

Corporation, and Renesas Electronics Corporation took over all the business of both 
companies. Therefore, although the old company name remains in this document, it is a valid 
Renesas Electronics document. We appreciate your understanding. 
 

Renesas Electronics website: 

http://www.renesas.com

 

 
 
 
 

April 1

st

, 2010 

Renesas Electronics Corporation 

 

 
 
 
 

Issued by: 

Renesas Electronics Corporation

 (

http://www.renesas.com

Send any inquiries to 

http://www.renesas.com/inquiry

 

Summary of Contents for Stub Generator REJ10J1822-0101

Page 1: ...ook over all the business of both companies Therefore although the old company name remains in this document it is a valid Renesas Electronics document We appreciate your understanding Renesas Electronics website http www renesas com April 1st 2010 Renesas Electronics Corporation Issued by Renesas Electronics Corporation http www renesas com Send any inquiries to http www renesas com inquiry ...

Page 2: ...ct for an application categorized as Specific or for which the product is not intended where you have failed to obtain the prior written consent of Renesas Electronics The quality grade of each Renesas Electronics product is Standard unless otherwise expressly specified in a Renesas Electronics data sheets or data books etc Standard Computers office equipment communications equipment test and meas...

Page 3: ...Stub Generator V 1 00 User s Manual User s Manual Rev 1 01 2008 03 Renesas Microcomputer Development Environment System ...

Page 4: ......

Page 5: ... such as safety systems or equipment or systems for transportation and traffic healthcare combustion control aerospace and aeronautics nuclear power or undersea communication transmission If you are considering the use of our products for such purposes please contact a Renesas sales office beforehand Renesas shall have no liability for damages arising out of the uses set forth above 8 Notwithstand...

Page 6: ......

Page 7: ...ng the stub generator Notes on Descriptions RPCGEN Abbreviation for the stub generator Prefix Prefix 0x indicates a hexadecimal number Numbers with no prefix are decimal is the directory delimiter Menu Menu item leads to the menu item e g File Save xxxx Custom placeholder in the High performance Embedded Workshop ...

Page 8: ...n defined by the TRON Association The µITRON4 0 specification can be downloaded from the TRON Association homepage http www assoc tron org The copyright of the µITRON specification belongs to the TRON Association 2 Microsoft and Windows are registered trademarks of Microsoft Corporation in the United States and or other countries The formal name of Windows is Microsoft Windows Operating System 3 A...

Page 9: ... 9 4 1 Executing RPCGEN 9 4 2 Options 10 4 2 1 PUBI 10 4 2 2 CLNTS 10 4 2 3 CLNTI 10 4 2 4 SVRS 11 4 2 5 SVRI 11 4 3 Executing RPCGEN as a Build Phase in the High performance Embedded Workshop 12 Section 5 Specifications of a Config File 23 5 1 Definition 23 5 2 Comments 24 5 3 File Locations 25 5 3 1 PUB_INCPATH 25 5 3 2 CLNT_SOURCEPATH 26 5 3 3 CLNT_INCPATH 26 5 3 4 SVR_SOURCEPATH 27 5 3 5 SVR_I...

Page 10: ... of Server Functions 49 6 1 Format 49 6 2 Function Type Directives 52 6 2 1 Function with a Return Value 52 6 2 2 Function without a Return Value 53 6 2 3 When the Return Value is not Representable as a 4 Byte Integer 54 6 3 Function Names 55 6 4 Parameters 56 6 5 Keywords for Input Output 57 6 5 1 IN Input 57 6 5 2 OUT Output 58 6 5 3 INOUT Input and Output 59 6 5 4 REF Passing by Reference 60 6 ...

Page 11: ...Initialization Function 96 8 4 Server Stub Function Table 97 8 5 Server Shutdown Function 99 8 6 Client Initialization Function 100 8 7 Client Shutdown Function 101 8 8 rpc_retval_adr 102 8 9 Config file _public h 104 8 10 Local Variables Used in the Source Code Created by RPCGEN 104 Section 9 Notes 105 Section 10 Error Messages 107 10 1 Format 107 10 2 General 108 10 3 Definition Errors other tha...

Page 12: ...vi ...

Page 13: ...source code of the client and server stubs that are required whenever the remote procedure call RPC facility of the HI7200 MP realtime operating system is to be used A config file is created by using a text editor and then input to RPCGEN which creates the source code of the client and server stubs RPCGEN Configfile Sourcecodeof theclient andserver stubs Figure 1 1 Overview of RPCGEN ...

Page 14: ...m Operating Environment Realtime OS HI7200 MP V 1 00 Release 00 or later Perl environment We have confirmed correct execution of RPCGEN by ActivePerl 5 8 8 820 for Windows x86 produced by ActiveState Software Inc ActivePerl is available for free download from the following Web site http www activestate com Products activeperl Host machine Any machine with Windows XP 32 bits or Windows 2000 as the ...

Page 15: ... renesas com 2 2 Installing RPCGEN The file for downloading has been compressed in the zip format Expanding the zip file generates the files listed in table 2 1 These files must be stored in a suitable folder Table 2 1 Files Provided as RPCGEN Filename Description rpcgen pl Main body of RPCGEN rpcgen_clnt pm rpcgen_svr pm rpcgen_info pm rpcgen_misc pm Package modules for use by the main body of RP...

Page 16: ...Section 2 Installation Rev 1 01 Mar 17 2008 Page 4 of 128 REJ10J1822 0101 ...

Page 17: ...nd Files Generated by RPCGEN 3 1 Functions Generated by RPCGEN Figure 3 1 shows the functions generated by RPCGEN Client Server Client initialization function Client stub functions Client shutdown function Server initialization function Server stub functions Server shutdown function Figure 3 1 Functions Generated by RPCGEN ...

Page 18: ...er function If SVRAUTH has not been specified the API will be the same as that of the server function Specifying CLNTSTUB prevents the creation of a specific client stub function 3 1 2 Server 1 Server initialization function This function starts up the server Specifying SVR_NOINIT prevents the creation of the server initialization function 2 Server shutdown function This function shuts the server ...

Page 19: ... the client and server stubs PUBI option or PUB_INCPATH in the config file When the config file is sample x for example RPCGEN will generate the following files sample_clnt c sample_clnt h sample_svr c sample_svr h sample_private h and sample_public h To temporarily save information during the process of file generation RPCGEN also generates intermediate files in the current directory The names of...

Page 20: ...nction server shutdown function and server stub function table 5 config file _svr h server stub header file This file contains definitions required for use of the server initialization function and server shutdown function The definitions include prototype declarations of the server stub functions server initialization function and server shutdown function 6 config file _public h header file for t...

Page 21: ...ig file refers to a file describing the specifications of the client and server stubs to be generated This file must be created by the user The standard filename extension for the config file is x which must not be omitted when the name is entered in a command line After execution of the above command RPCGEN will generate the C language source files and header files for the client and server stubs...

Page 22: ...H in the config file is ignored 4 2 2 CLNTS Format CLNTS path Description This option is used to specify the path for output of config file _clnt c If this option is used a definition of CLNT_SOURCEPATH in the config file is ignored 4 2 3 CLNTI Format CLNTI path Description This option is used to specify the path for output of config file _clnt h and config file _private h If this option is used a...

Page 23: ...used to specify the path for output of config file _svr c If this option is used a definition of SVR_SOURCEPATH in the config file is ignored 4 2 5 SVRI Format SVRI path Description This option is used to specify the path for output of config file _svr h If this option is used a definition of SVR_INCPATH in the config file is ignored ...

Page 24: ...r which RPCGEN is stored Path to Perl exe Placeholder PERL_INST Description Perl Base directory Directory Directory under which perl exe is stored To define a custom placeholder follow the procedure below Select Setup Customize from the menu bar of the High performance Embedded Workshop Then select the Placeholders tab of the Customize dialog box Choose either Application wide custom placeholders ...

Page 25: ...es must be added as a filename extension to be used in custom build phases Select Project File Extensions from the menu bar of the High performance Embedded Workshop This opens the File Extensions dialog box shown in figure 4 2 Figure 4 2 File Extensions Dialog Box Clicking the Add button opens the Add File Extension dialog box shown in figure 4 3 Add the extension x as shown in the figure ...

Page 26: ...Section 4 Executing RPCGEN Rev 1 01 Mar 17 2008 Page 14 of 128 REJ10J1822 0101 Figure 4 3 Add File Extension Dialog Box ...

Page 27: ...ting the RPCGEN Custom Build Phase Select Build Build Phases from the menu bar of the High performance Embedded Workshop This opens the Build Phases dialog box shown in figure 4 4 Figure 4 4 Build Phases Dialog Box Clicking on the Add button invokes the New Build Phase wizard figure 4 5 ...

Page 28: ...tion 4 Executing RPCGEN Rev 1 01 Mar 17 2008 Page 16 of 128 REJ10J1822 0101 Figure 4 5 New Build Phase Step 1 of 4 Dialog Box Click on Next to go to step 2 Figure 4 6 New Build Phase Step 2 of 4 Dialog Box ...

Page 29: ...EN config file for Select input file group Click on Next to go to step 3 Figure 4 7 New Build Phase Step 3 of 4 Dialog Box Phase name Any name defined by the user rpcgen in this example Command PERL_INST perl exe Default options I RPCGEN_INST RPCGEN_INST rpcgen pl FULLFILE Initial directory FILEDIR Click on Next to go to step 4 ...

Page 30: ... Next the syntax for messages about RPCGEN must be defined After the syntax has been defined the corresponding config file x will be opened in response to double clicking on an RPCGEN error message output in the Build window of the High performance Embedded Workshop In the Build Phases dialog box shown in figure 4 4 select rpcgen and click on the Modify button The Modify rpcgen dialog box opens Se...

Page 31: ...dded Workshop Select Build rpcgen to open the rpcgen Options dialog box figure 4 10 Select the Output Files tab check that the RPCGEN config file folder icon is active and click on the Add button This opens the Add Output File dialog box in which the names of the files output by RPCGEN should be entered For the filenames refer to section 3 2 Files Generated by RPCGEN Figure 4 10 rpcgen Options Dia...

Page 32: ...RPCGEN custom build phase is shown at the bottom of the Build Phases dialog box Use the Move Up button to move rpcgen so that it is above SH C C Library Generator Figure 4 12 Build Phases Dialog Box Build Order Tab Open the Build File Order tab Select RPCGEN config file under File group and check the box for rpcgen under Phase order ...

Page 33: ...Section 4 Executing RPCGEN Rev 1 01 Mar 17 2008 Page 21 of 128 REJ10J1822 0101 Figure 4 13 Build Phases Dialog Box Build File Order Tab Setting of the RPCGEN build phase is now complete ...

Page 34: ...Section 4 Executing RPCGEN Rev 1 01 Mar 17 2008 Page 22 of 128 REJ10J1822 0101 ...

Page 35: ...ngle config file 5 1 Definition Definitions must be written in either of the following formats keyword keyword For certain definitions two or more items can be entered between the braces Example GLOBAL_INCFILE types h rpc_public h A config file can include the following definitions 1 Locations where the files created by RPCGEN will be stored PUB_INCPATH Path to config file _public h CLNT_SOURCEPAT...

Page 36: ...ersion will be assigned 4 Client information CLNT_NOINIT The client initialization function is not to be created CLNT_NOSHUTDOWN The client shutdown function is not to be created CLNT_CALLCHK Facilitates saving the return values of RPC calls CLNT_SECTION Section name to be given to the client stub 5 Server functions RPC_FUNC Server functions Server functions are only defined within the braces of R...

Page 37: ... terminates the processing The following definitions of file locations are available PUB_INCPATH Path to config file _public h CLNT_SOURCEPATH Path to config file _clnt c CLNT_INCPATH Path to config file _clnt h and config file _private h SVR_SOURCEPATH Path to config file _svr c SVR_INCPATH Path to config file _svr h 5 3 1 PUB_INCPATH Format PUB_INCPATH path Description This statement defines the...

Page 38: ...gnored Example CLNT_SOURCEPATH clnt source config file _clnt c will be generated in the clnt source directory under the current directory 5 3 3 CLNT_INCPATH Format CLNT_INCPATH path Description This statement defines the path under which config file _clnt h and config file _private h will be generated When the CLNTI option is used a definition of CLNT_INCPATH is ignored Example CLNT_INCPATH C clnt...

Page 39: ...SVR_SOURCEPATH is ignored Example SVR_SOURCEPATH svr source config file _svr c will be generated in the svr source directory under the current directory 5 3 5 SVR_INCPATH Format SVR_INCPATH path Description This statement defines the path under which config file _svr h will be generated When the SVRI option is used a definition of SVR_INCPATH is ignored Example SVR_INCPATH svr include config file ...

Page 40: ... Table 5 1 Default Include Files Filename Description string h Standard include file for the compiler types h Header file of data type definitions comes with Renesas operating systems such as the HI7200 MP rpc_public h RPC header file that comes with Renesas operating systems such as the HI7200 MP The following definitions are available for controlling the output of include directives GLOBAL_INCFI...

Page 41: ...ed with CLNT_INCFILE in the order of file definition 4 config file _public h generated by RPCGEN only if SVR_AUTH has not been defined 5 config file _clnt h generated by RPCGEN 6 config file _private h generated by RPCGEN 2 config file _svr c 1 Default include files in the order given in table 5 1 2 File s defined with GLOBAL_INCFILE in the order of file definition 3 File s defined with SVR_INCFIL...

Page 42: ...on of the include directive When two or more files are to be specified they must be separated by a space Example GLOBAL_INCFILE math h import include user_public h 5 4 3 CLNT_INCFILE Format CLNT_INCFILE file Δ file Description This statement is for the output of include directives for the specified files to config file _clnt c File s must be specified in the form filename or filename The differenc...

Page 43: ...s for the output of include directives for the specified files to config file _svr c File s must be specified in the form filename or filename The difference between these two formats is as defined in the specification of the include directive When two or more files are to be specified they must be separated by a space Example SVR_INCFILE math h import include user_svr h ...

Page 44: ... function is not to be created SVR_NOSTUBTBL The server stub function table is not to be created SVR_STATIC Use of a static server SVR_SECTION Section name to be given to the server stub SVR_AUTH How the server ID and server version will be assigned 5 5 1 SVR_NAME Format SVR_NAME server name Description This statement defines the server name The defined server name will be applied to the names of ...

Page 45: ... a C language macro is used this macro must have been defined in a file specified by GLOBAL_INCFILE The server ID must of course be consistent across the entire system due to the specifications of the HI7200 MP RPCGEN does not detect duplication of server IDs The ID number is output to config file _public h in the following format define RPCSVR_ID_ server name ID number Server name refers to the s...

Page 46: ...een defined in a file specified by GLOBAL_INCFILE The server version is output to config file _public h in the following format define RPCSVR_VERS_ server name server version SVR_VERSION cannot be omitted if SVR_AUTH has been omitted Also refer to section 5 5 8 SVR_AUTH Example SVR_VERSION 1UL 5 5 4 SVR_NOINIT Format SVR_NOINIT Description If this statement is present RPCGEN will not create the se...

Page 47: ..._info ServerStubList the table defined by rpc_start_server or rpc_start_server_with_paramarea called by the server initialization function If this statement is present RPCGEN will not create the server stub function table Use SVR_NOSTUBTBL when the server initialization function is provided as part of the application Also refer to section 8 4 Server Stub Function Table Example SVR_NOSTUBTBL ...

Page 48: ...pplication The server shutdown function generated by RPCGEN calls rpc_stop_server to stop the server Although rpc_stop_server generally allows specification of a callback function to be executed at the time the server is stopped no callback function is specifiable for the server shutdown function generated by RPCGEN If you wish to use a callback function specify SVR_NOSHUTDOWN and implement the se...

Page 49: ...e section name to be given to the server parameter area Note however that the actual section name will be B followed by the section name given here This section name is not affected by definition of SVR_SECTION The server parameter area information is output to config file _svr c in the following format pragma section section name pragma pack 4 static UINT8 ucServerArea_ server name ALIGNUP4 size ...

Page 50: ...I as the original server function Server IDs and server version information passed to the following functions will be ignored Server initialization function Server shutdown function Client initialization function Client shutdown function RPCGEN outputs the definitions of the server ID and server version to config file _public h Since the client stub functions and server and client initialization a...

Page 51: ...ient shutdown function Client initialization function Server initialization function Anyserver IDs and server versionsin parameters areignored func sameAPI astheoriginal server function Anyserver IDsand server versions in parametersareignored Server IDandserver version Server IDandserver version Server ID Server version Checkthat theserver IDand server versionspecifications ontheclient matchtheser...

Page 52: ... respectively The third and subsequent parameters are the parameters of the actual server function In other words all of the client stub functions have APIs that differ from the server functions To make the client stub functions have the same APIs as the original server functions the user must implement wrapper functions for the client stub functions RPCGEN outputs definitions of the server ID and...

Page 53: ... shutdown function Client initialization function Server initialization function rpcclnt_ server name _func server ID server version Server IDandserver version Server IDandserver version Server IDandserver version Server IDandserver version Server ID Server version configfile _public h Checkthat theserver IDand server versionspecifications ontheclient matchtheserver Figure 5 2 Model 2 Example SVR_...

Page 54: ...the server stubs will be assigned When this definition is omitted one of the section names alphabetical characters listed below will automatically be assigned If SVR_SECTION has been defined the actual section name will be one of the letters listed below followed by section name Program section P Constant section C Non initialized data section B Initialized data section D Example SVR_SECTION C_EXA...

Page 55: ...PC calls CLNT_SECTION Section name to be given to the client stub 5 6 1 CLNT_NOINIT Format CLNT_NOINIT Description RPCGEN creates the following client initialization function in config file _clnt c as the standard INT32 rpcclnt_ server name _init UINT32 __ulRPCServerID UINT32 __ulRPCServerVersion If the CLNT_NOINIT statement is present RPCGEN will not create the client initialization function Use ...

Page 56: ...d as part of the application The client shutdown function generated by RPCGEN calls rpc_disconnect to disconnect the client from the server Although rpc_disconnect generally allows specification of a callback function to be executed at the time the client is disconnected from the server no callback function is specifiable for the client shutdown function generated by RPCGEN If you wish to use a ca...

Page 57: ... saving of the return values of RPC calls rpc_call or rpc_call_copycbk and outputs the API of rpc_retval_adr in config file _clnt h rpc_retval_adr rpc_call rpc_retval_adr must be implemented by the user If this definition is omitted the following code which discards the return value of an RPC call will be created rpc_call For how to implement rpc_retval_adr refer to section 8 8 rpc_retval_adr Exam...

Page 58: ...e client stubs will be assigned When this definition is omitted one of the section names alphabetical characters listed below will automatically be assigned If CLNT_SECTION has been defined the actual section name will be one of the letters listed below followed by the section name Program section P Constant section C Non initialized data section B Initialized data section D Example CLNT_SECTION C...

Page 59: ...g server functions RPC_FUNC Server functions 5 7 1 RPC_FUNC Format RPC_FUNC definitions of server functions Description Enter definitions of server functions between the braces of RPC_FUNC For information on definition statements for server functions refer to section 6 Definitions of Server Functions Example RPC_FUNC int ret func1 IN DFLT int par func2 OUT PTR struct ST ptr ...

Page 60: ...Section 5 Specifications of a Config File Rev 1 01 Mar 17 2008 Page 48 of 128 REJ10J1822 0101 ...

Page 61: ...lue specification of the return value variable to be returned function name parameter option Δ RPCGEN keywords enclosed by are specified in parameter option and directive to extend the return value Example 1 Specification of a server function int func int par The function takes par as an input and returns a value of type int Definition of the server function int ret func IN DFLT int par Descriptio...

Page 62: ... ptr The function takes ptr a pointer to a structure of type ST as an input and does not return a value Definition of the server function func IN PTR struct ST ptr UNACK Description Directive to extend the return value None Specification of the return value None Function name func Parameter directive IN PTR Parameter specification struct ST ptr Option UNACK ...

Page 63: ...N DFLT double inf Description Directive to extend the return value RETEXT Specification of the return value double dret Function name func Parameter directive IN DFLT Parameter specification double inf Option None For details on each of the descriptions refer to the following sections Function type directives 6 2 Function Type Directives Specifying the return value 6 2 Function Type Directives Fun...

Page 64: ...ld the return value Description Variable to hold the return value refers to a local variable used to store the return value in both client and server stubs A parameter of the function may be specified as this variable Example Specification of a server function int func int par The function takes par as an input and returns a value of type int Definition of the server function int ret func IN DFLT ...

Page 65: ...rn Value Description For a function that doesn t have a return value a return value specification must not be made Example Specification of a server function void func struct ST ptr The function has no input and returns a value in the ST structure indicated by ptr Definition of the server function func OUT PTR struct ST ptr ...

Page 66: ... and is then returned When the return value is of the following types however the definition must have an RETEXT directive because the default behavior above is not applicable in these cases 64 bit integer Floating point Structure type object Union type object When a definition has an RETEXT directive code will be generated such that a value is returned from the server to the client by using the s...

Page 67: ...EJ10J1822 0101 6 3 Function Names Description Type the name of the function you wish to use Example Specification of a server function int func int par The function takes par as an input and returns a value of type int Definition of the server function int ret func IN DFLT int par ...

Page 68: ...s for Input Output data type Specify one of the keywords given in section 6 6 Keywords for Data Types parameter specification Define the specification of the original function Table 6 1 lists the available combinations of keywords although details on input output and data types will be described in later sections Note however that REF and DESC cannot be used at the same time Table 6 1 Input Output...

Page 69: ...ng by reference DESC The parameter is not passed from the client to the server Each of these keywords specified with one of the data type keywords listed in section 6 6 works as a declaration of the subsequent parameter specification 6 5 1 IN Input Description This keyword defines a parameter as an input to the server function The parameter is transferred from the client to the server and is then ...

Page 70: ...tion The data output by the server function to the area specified by the parameter are returned to the client This keyword can only be used with the data type keywords PTR and ARY Example Specification of a server function void func struct ST ptr The function has no input and returns a value in the ST structure indicated by ptr Definition of the server function func OUT PTR struct ST ptr ...

Page 71: ...e client to the server and then passed to the server function After that the data output by the server function to the area specified by the parameter are returned to the client This keyword can only be used with the data type keywords PTR and ARY Example Specification of a server function int func struct ST ptr The function takes ptr a pointer to a structure of type ST as an input and returns a v...

Page 72: ...6 1 illustrates the difference between cases with and without REF INPTR struct ST ptr INREFPTR struct ST ptr ptr Parameter tobe passedtothe server function ptr Copying struct ST struct ST ptr struct ST ptr Parameter specifiedintheclient Parameter specifiedintheclient Server parameter area inanon cacheablearea Server parameter area inanon cacheablearea Copying Parameter tobe passedtothe server func...

Page 73: ...nter variable is transferred In this case the pointer points to the same area even after the transfer Note When the device in use does not provide a facility for cache snooping between the CPU cores as is the case for the SH2A DUAL etc the server parameter area must be allocated in a non cacheable area Example Specification of a server function int func struct ST ptr ptr is passed to func as the i...

Page 74: ...keyword specifies that the parameter will not be passed from the client to the server This keyword can also be used with IN Example Specification of a server function int func void While the actual server function has no parameter the client application calls an old API function func which does have a parameter int par Definition of the server function int ret func IN DESC PTR int par ...

Page 75: ...th DFLT IN Description The parameter itself is transferred between the client and server DFLT is only specifiable when the parameter has any of the following types Integer signed short unsigned short signed long unsigned long signed int or unsigned int Character signed char or unsigned char Real number float or double Structure type or union type object that is not an array Example Specification o...

Page 76: ...lient to the server STR is only specifiable when the parameter is of the character type When STR is used with REF the pointer to the string is transferred instead of the string itself For details refer to section 6 5 4 REF Passing by Reference Example Specification of a server function int func const char s The function takes string s as an input and returns a value of type int Definition of the s...

Page 77: ...he server PTR is only specifiable when the parameter is of the pointer type When IN has been selected and REF is used with PTR the pointer value is transferred instead of the data it indicates For details refer to section 6 5 4 REF Passing by Reference Example Specification of a server function void func struct ST ptr The function has no input and returns the structure of type ST that is indicated...

Page 78: ...ows this keyword define a parameter that expresses the first address of the array When ARY is used it must be followed by a definition of COUNT which indicates the number of elements in the array to be passed between the client and the server For details refer to section 6 6 5 COUNT Number of Elements in an Array When IN has been selected and REF is used with ARY the pointer to the array is transf...

Page 79: ... to be passed from the client to the server RPCGEN creates client stub code that makes an RPC call after setting the size of an input IOVEC structure by using an expression of the kind specified in figure 6 2 This must be taken into account when COUNT is defined For example the expression for COUNT must not contain any variables that hold the return value of a function Figures 6 2 and 6 3 show the...

Page 80: ...t ALIGNUP4 sizeof inf if UINT32 inf count 0UL ptr struct ST __pInfo pucParamArea __ulInputParamOffset ret func inf ptr return UINT32 ret Figure 6 3 Code Output to the Server Stub IN for COUNT Examples Example 1 Specification of a server function int func struct ST ptr Pointer ptr to an array of 10 elements of the structure type ST will be passed Definition of the server function int ret func IN AR...

Page 81: ... DFLT int count Example 3 Specification of a server function int func int count struct ST ptr Pointer ptr to an array of count elements of the structure type ST will be passed Definition of the server function int ret func IN DFLT int count IN ARY struct ST ptr COUNT count Example 4 Specification of a server function int func struct ST ptr int p_count Pointer ptr to an array of p_count elements of...

Page 82: ...t func struct INF inf struct ST ptr ptr points to an array to be given to the server function and inf indicates other input information It has a type int member count which indicates the number of elements in the array pointed to by ptr Definition of the server function int ret func IN PTR struct INF inf IN ARY struct ST ptr COUNT inf count ...

Page 83: ...fies the number of elements in the array to be actually output by the server This value must be less than or equal to that specified for the first COUNT RPCGEN creates client stub code that makes an RPC call after setting the size of an input IOVEC structure by using an expression of the kind specified in figure 6 4 RPCGEN also creates server stub code that makes a server function call before sett...

Page 84: ...C __input 1 IOVEC __output 1 __input __ulInputParamCount pBaseAddress UINT8 inf __input __ulInputParamCount ulSize sizeof inf if UINT32 inf count 0UL __output __ulOutputParamCount pBaseAddress UINT8 ptr __output __ulOutputParamCount ulSize sizeof ptr UINT32 inf count rpc_call Figure 6 4 Code Output to the Client Stub OUT for First COUNT ...

Page 85: ... if UINT32 inf count 0UL ptr struct ST __pInfo pucParamArea __ulInputParamOffset ret func inf ptr __pInfo pOutputIOVectorTable __ulOutputParamCount pBaseAddress ptr if UINT32 ret 0UL __pInfo pOutputIOVectorTable __ulOutputParamCount ulSize sizeof ptr UINT32 ret else __pInfo pOutputIOVectorTable __ulOutputParamCount ulSize 0UL __pInfo ulOutputIOVectorTableSize 1UL return UINT32 ret Figure 6 5 Code ...

Page 86: ...ction int func struct ST ptr int p_count ptr points to an array for output that has 10 elements p_count which is the return parameter of func indicates the number of elements to be output Definition of the server function int ret func OUT ARY struct ST ptr COUNT 10 COUNT p_count OUT PTR int p_count Example 3 Specification of a server function int func struct ST ptr ptr points to an array for outpu...

Page 87: ...e return parameter p_count as the number of elements Definition of the server function int ret func OUT ARY struct ST ptr COUNT p_count COUNT p_count INOUT PTR int p_count Example 5 Specification of a server function int func struct ST ptr int count ptr points to an array for output that has count elements func outputs all count elements Definition of the server function int ret func OUT ARY struc...

Page 88: ...ter p_count as the number of elements Definition of the server function int ret func IN PTR struct INF inf OUT ARY struct ST ptr COUNT inf count COUNT p_count OUT PTR int p_count Example 7 Specification of a server function int func struct INF inf struct ST ptr ptr points to an array for output and inf indicates other input information It has a type int member count which indicates the number of e...

Page 89: ...irst COUNT is the COUNT keyword followed by an expression that specifies the number of elements in the array to be passed from the client to the server The second COUNT is the COUNT keyword followed by an expression that specifies the number of elements in the array to be actually output by the server This value must be less than or equal to that specified for the first COUNT RPCGEN creates client...

Page 90: ...UINT8 inf __input __ulInputParamCount ulSize sizeof inf if UINT32 inf count 0UL __input __ulInputParamCount pBaseAddress UINT8 ptr __input __ulInputParamCount ulSize sizeof ptr UINT32 inf count if UINT32 inf count 0UL __output __ulOutputParamCount pBaseAddress UINT8 ptr __output __ulOutputParamCount ulSize sizeof ptr UINT32 inf count rpc_call Figure 6 6 Code Output to the Client Stub INOUT for Fir...

Page 91: ...truct ST __pInfo pucParamArea __ulInputParamOffset __ulInputParamOffset ALIGNUP4 sizeof ptr UINT32 inf count ret func inf ptr __pInfo pOutputIOVectorTable __ulOutputParamCount pBaseAddress ptr if UINT32 ret 0UL __pInfo pOutputIOVectorTable __ulOutputParamCount ulSize sizeof ptr UINT32 ret else __pInfo pOutputIOVectorTable __ulOutputParamCount ulSize 0UL __pInfo ulOutputIOVectorTableSize 1UL return...

Page 92: ...int func struct ST ptr int p_count ptr points to an array for input and output that has 10 elements p_count which is the return parameter of func indicates the number of elements to be output Definition of the server function int ret func INOUT ARY struct ST ptr COUNT 10 COUNT p_count OUT PTR int p_count Example 3 Specification of a server function int func struct ST ptr ptr points to an array for...

Page 93: ...return parameter p_count as the number of elements Definition of the server function int ret func INOUT ARY struct ST ptr COUNT p_count COUNT p_count INOUT PTR int p_count Example 5 Specification of a server function int func struct ST ptr int count ptr points to an array for input and output that has count elements func outputs all count elements Definition of the server function int ret func INO...

Page 94: ...r p_count as the number of elements Definition of the server function int ret func IN PTR struct INF inf INOUT ARY struct ST ptr COUNT inf count COUNT p_count OUT PTR int p_count Example 7 Specification of a server function int func struct INF inf struct ST ptr ptr points to an array for input and output and inf indicates other input information including a type int member count which indicates th...

Page 95: ...ction int ret func IN PTR struct INF inf INOUT ARY struct ST ptr COUNT inf count COUNT ret 6 7 Optional Keywords The following optional keywords are available to control output to the client or server stub for the individual server functions SVRSTUB Server stub SVRFUNC Server function name CLNTSTUB Client stub UNACK Asynchronous call CLNTCOPYCBK RPC call by rpc_call_copycbk Two or more optional ke...

Page 96: ...ts an error and terminates processing 6 7 1 SVRSTUB Server Stub Format SVRSTUB server stub function name Description A server stub provided by the user is to be used so RPCGEN does not create a server stub Example Specification of a server function int func int par The function takes par as an input and returns a value of type int RPCGEN will not create a server stub for func i e will not create f...

Page 97: ...the server stub with a specific name Use SVRFUNC when the name of a function as called by the client does not match the name of the function as called by the server SVRFUNC cannot be used with SVRSTUB Example Specification of a server function int func int par The function takes par as an input and returns a value of type int func on the server however is named func_main Definition of the server f...

Page 98: ...rovided by the user is to be used so RPCGEN does not create a client stub Example Specification of a server function int func int par The function takes par as an input and returns a value of type int RPCGEN will not create a client stub for func because the user will provide this client stub Definition of the server function int ret func IN DFLT int par CLNTSTUB ...

Page 99: ...d RPC calls are made in synchronous mode UNACK cannot be used with CLNTSTUB Note When UNACK is used the return value of the server function must be of type void and the input output keyword for parameters must be IN Example Specification of a server function void func int par The function takes par as an input The client makes RPC calls in asynchronous mode Definition of the server function func I...

Page 100: ...llback functions is mandatory The prototype for the callback functions must conform with the RPC specifications and has to be declared in a file included by the client stub Example Specification of a server function int func struct ST ptr ptr is an array for output and has 10 elements all of which are output by func copy1 is used for transfer from the client to the server while copy2 is used for t...

Page 101: ... a client or server stub for server functions that have parameters of the following types 1 Parameters with data types of undefined size RPCGEN cannot handle parameters with data types that have undefined size When such a parameter is a pointer however using REF allows the creation of stub code for passing of the pointer itself Example Specification of a server function int func void par The funct...

Page 102: ...function int func int ptr The function takes ptr a pointer to a pointer to int type data as an input Definition of the server function int ret func IN PTR int ptr In this case RPCGEN creates code to transfer ptr from the client to the server ptr is a pointer to the target int type data but this data ptr will not be transferred 3 Function pointer RPCGEN does not support server functions whose param...

Page 103: ...s an address in the server RPCGEN does not create any code to transfer the data indicated by the pointer from the server to the client Example Specification of a server function int func int par The return value is a pointer to int type data Definition of the server function int ret func IN DFLT int par In this case ret is a pointer to int type data returned within the server by the server functio...

Page 104: ...Section 7 Server Functions Not Supported by RPCGEN Rev 1 01 Mar 17 2008 Page 92 of 128 REJ10J1822 0101 ...

Page 105: ...cord with the specifications For details on SVR_AUTH refer to section 5 5 8 SVR_AUTH 1 When SVR_AUTH has not been specified Each of the client stub functions has the same API as the actual server function RPCGEN outputs the client stub functions themselves to config file _clnt c but does not output prototype declarations Prepare a header file with the required prototype declarations and specify th...

Page 106: ...AME and server function name refers to server function names defined between the braces of RPC_FUNC The first and second parameters of the client stub functions are the server ID and server version respectively The names of the parameters are fixed to __ulID and __ulVers The third and subsequent parameters are the first and subsequent parameters of the actual server function and their names are th...

Page 107: ...ion names defined between the braces of RPC_FUNC Since the server stub functions are called from within the RPC library the user usually does not need to recognize the APIs of the server stub functions output by RPCGEN If SVRSTUB is used to prevent creation of the server stub functions however the user must implement the server stub functions in accord with the specifications Example Contents of a...

Page 108: ...h SVR_NAME When SVR_NOINIT has been specified RPCGEN does not generate a server initialization function The server initialization function must be provided by the user if one is required The specification of the server initialization function generated by RPCGEN is as follows C language API INT32 rpcsvr_ server name _init rpc_svr_config __config Return value The return value of rpc_start_server or...

Page 109: ...a called by the server initialization function 1 With neither SVR_NOSTUBTBL nor SVR_NOINIT RPCGEN generates the server initialization function and server stub function table Only the server initialization function generated by RPCGEN looks up the server stub function table Thus RPCGEN outputs the server stub function table as static data to config file _svr c 2 Without SVR_NOSTUBTBL and with SVR_N...

Page 110: ...n below is provided in the application and outputs the server initialization function which externally refers to the table to config file _svr c UINT32 const __rpcsvr_ server name _StubTable rpc_server_stub_info server stub function name server stub function name Server name refers to the server name defined with SVR_NAME 4 With SVR_NOSTUBTBL and SVR_NOINIT RPCGEN generates neither a server initia...

Page 111: ...ne is required The specification of the server shutdown function generated by RPCGEN is as follows C language API INT32 rpcsvr_ server name _shutdown UINT32 __ulServerID UINT32 __ulServerVersion Return value The return value of rpc_stop_server Parameter __ulServerID and __ulServerVersion These parameters indicate the server ID and server version respectively When SVR_AUTH has not been specified ho...

Page 112: ...ate a client initialization function The client initialization function must be provided by the user if one is required The specification of the client initialization function generated by RPCGEN is as follows C language API INT32 rpcclnt_ server name _init UINT32 __ulRPCServerID UINT32 __ulRPCServerVersion Return value The return value of rpc_connect Parameter __ulRPCServerID and __ulRPCServerVer...

Page 113: ...red The specification of the client shutdown function generated by RPCGEN is as follows C language API INT32 rpcclnt_ server name _shutdown UINT32 __ulRPCServerID UINT32 __ulRPCServerVersion Return value The return value of rpc_disconnect Parameter __ulRPCServerID and __ulRPCServerVersion These parameters indicate the server ID and server version respectively When SVR_AUTH has not been specified h...

Page 114: ... provided by the user when CLNT_CALLCHK refer to section 5 6 3 CLNT_CALLCHK is specified rpc_retval_adr must be created according to the specification given below C language API INT32 rpc_retval_adr void Specification The address to hold the return value that depends on the context task or non task in which rpc_retval_adr was called is returned ...

Page 115: ...XTSKID 10 Maximum task ID static INT32 retval MAXTSKID 1 Array to hold the return value in the context 0 Non task context 1 to MAXTSKID Task ID INT32 rpc_retval_adr void INT32 retval_adr ID myid if sns_ctx TRUE In a non task context retval_adr retval else In a task context get_tid myid retval_adr retval GET_LOCALID myid return retval_adr ...

Page 116: ... and SVR_VERSION respectively The position of config file _public h depends on whether SVR_AUTH has been specified or not For details refer to section 5 5 8 SVR_AUTH 8 10 Local Variables Used in the Source Code Created by RPCGEN In the source code of the client and server stubs the names of local variables start with two underscores __ In the client and server stubs on the other hand RPCGEN uses t...

Page 117: ...rors except in cases where a fatal error has been detected i e when continuing with current processing is impossible 2 Do not modify the contents of the files generated by RPCGEN Even if the contents of the source files generated by RPCGEN are not as you expected do not modify the files manually This is because files that have been manually modified by the user may be overwritten when RPCGEN is re...

Page 118: ...Section 9 Notes Rev 1 01 Mar 17 2008 Page 106 of 128 REJ10J1822 0101 ...

Page 119: ... in a future implementation A specific keyword is used multiple times The first instance of the keyword to be found is valid A server function with a specific name is declared multiple times An error will be reported on compilation of the generated stub An invalid keyword is specified This is simply ignored SVR_ID server ID is a value with size exceeding 4 bytes An error will be reported on compil...

Page 120: ...ate files in the current directory 10 3 Definition Errors other than RPC_FUNC Illegal keyword definition The definition of parameter keyword is illegal Cannot define both keyword 1 and keyword 2 keyword 1 and keyword 2 must not be specified at the same time 10 4 Definition Errors RPC_FUNC RPC_FUNC Cannot define both keyword 1 and keyword 2 for function name In the definition of function name keywo...

Page 121: ... table 11 1 This is simply because we have assumed that most users will understand these functions not because the functions should necessarily be distributed by the RPC facility Table 11 1 Files Provided for Illustration Server Function Description double atof const char nptr C standard library function stdlib h int atoi const char nptr C standard library function stdlib h with REF ER ref_tsk2 ID...

Page 122: ...CFILE Include files for xxx_svr c CLNT_INCFILE Include files for xxx_clnt c SVR_NAME SMPL Server name SVR_ID 1 Server ID SVR_VERSION 2 Server version SVR_AUTH How to authenticate SVR_NOINIT Don t generate server initialize function SVR_NOSTUBTBL Don t generate server stub function table SVR_NOSHUTDOWN Don t generate server shutdown function SVR_STATIC size section Use static server SVR_SECTION C_S...

Page 123: ...onst char nptr nptr does not have to point to non cached area int ret atoi IN REF STR const char nptr nptr must point to non cached area HI7200 MP service calls renamed from original service call name ER ercd ref_tsk2 IN DFLT ID tskid OUT PTR T_RTSK pk_rtsk ER ercd ref_sem2 IN DFLT ID semid OUT PTR T_RSEM pk_rsem ...

Page 124: ...d as part of the build and therefore any changes made by hand will possibly be lost on a rebuild ifndef _RPC_SMPL_CLNT_H define _RPC_SMPL_CLNT_H ifdef __cplusplus extern C endif INT32 rpcclnt_SMPL_init UINT32 __ulRPCServerID UINT32 __ulRPCServerVersion INT32 rpcclnt_SMPL_shutdown UINT32 __ulRPCServerID UINT32 __ulRPCServerVersion double atof const char nptr int atoi const char nptr ER ref_tsk2 ID ...

Page 125: ...s you really know what you are doing this file was automatically generated by rpcgen pl on 2007 11 28 12 54 Be aware that this file may be generated as part of the build and therefore any changes made by hand will possibly be lost on a rebuild ifndef _RPC_SMPL_PRIVATE_H define _RPC_SMPL_PRIVATE_H enum RPC_SMPL_ATOF RPC_SMPL_ATOI RPC_SMPL_REF_TSK2 RPC_SMPL_REF_SEM2 endif End of _RPC_SMPL_PRIVATE_H ...

Page 126: ... 28 12 54 Be aware that this file may be generated as part of the build and therefore any changes made by hand will possibly be lost on a rebuild include string h include types h include rpc_public h include stdlib h include kernel h include sample_public h include sample_clnt h include sample_private h pragma section C_SAMPLE double atof const char nptr UINT32 __ulLastOutputIOVectorSize rpc_call_...

Page 127: ...orTableSize sizeof __input sizeof IOVEC __info pOutputIOVectorTable __output __info ulOutputIOVectorTableSize sizeof __output sizeof IOVEC __info pulLastOutputIOVectorSize __ulLastOutputIOVectorSize __info pulReturnValue UINT32 __ulReturn __input __ulInputParamCount pBaseAddress UINT8 nptr __input __ulInputParamCount ulSize strlen const char nptr 1UL __output __ulOutputParamCount pBaseAddress ret ...

Page 128: ...OVectorTableSize sizeof __input sizeof IOVEC __info pOutputIOVectorTable NULL __info ulOutputIOVectorTableSize 0UL __info pulLastOutputIOVectorSize __ulLastOutputIOVectorSize __info pulReturnValue UINT32 ret __input __ulInputParamCount pBaseAddress UINT8 nptr __input __ulInputParamCount ulSize sizeof UINT32 rpc_retval_adr rpc_call __info return ret ER ref_tsk2 ID tskid T_RTSK pk_rtsk UINT32 __ulLa...

Page 129: ...OutputIOVectorTableSize sizeof __output sizeof IOVEC __info pulLastOutputIOVectorSize __ulLastOutputIOVectorSize __info pulReturnValue UINT32 ercd __input __ulInputParamCount pBaseAddress tskid __input __ulInputParamCount ulSize sizeof ID __output __ulOutputParamCount pBaseAddress UINT8 pk_rtsk __output __ulOutputParamCount ulSize sizeof pk_rtsk rpc_retval_adr rpc_call __info return ercd ER ref_se...

Page 130: ...ut sizeof IOVEC __info pulLastOutputIOVectorSize __ulLastOutputIOVectorSize __info pulReturnValue UINT32 ercd __input __ulInputParamCount pBaseAddress semid __input __ulInputParamCount ulSize sizeof ID __output __ulOutputParamCount pBaseAddress UINT8 pk_rsem __output __ulOutputParamCount ulSize sizeof pk_rsem rpc_retval_adr rpc_call __info return ercd INT32 rpcclnt_SMPL_init UINT32 __ulRPCServerID...

Page 131: ...Section 11 Samples Rev 1 01 Mar 17 2008 Page 119 of 128 REJ10J1822 0101 ...

Page 132: ...part of the build and therefore any changes made by hand will possibly be lost on a rebuild ifndef _RPC_SMPL_SVR_H define _RPC_SMPL_SVR_H typedef struct UINT32 ulRPCServerID UINT32 ulRPCServerVersion UINT32 ServerStubTaskPriority UINT32 ulStubStackSize UINT32 ulMaxParamAreaSize void pUserDefinedData rpc_svr_config ifdef __cplusplus extern C endif UINT32 rpcsvr_SMPL_atof rpc_server_stub_info __pInf...

Page 133: ...of 128 REJ10J1822 0101 UINT32 rpcsvr_SMPL_ref_sem2 rpc_server_stub_info __pInfo INT32 rpcsvr_SMPL_init rpc_svr_config __config INT32 rpcsvr_SMPL_shutdown UINT32 __ulServerID UINT32 __ulServerVersion ifdef __cplusplus endif endif End of _RPC_SMPL_SVR_H ...

Page 134: ...07 11 28 12 54 Be aware that this file may be generated as part of the build and therefore any changes made by hand will possibly be lost on a rebuild include string h include types h include rpc_public h include stdlib h include kernel h include sample_public h include sample_svr h pragma section C_SAMPLE UINT32 rpcsvr_SMPL_atof rpc_server_stub_info __pInfo const char nptr UINT32 __ulInputParamOf...

Page 135: ...fo pOutputIOVectorTable __ulOutputParamCount ulSize sizeof double __pInfo ulOutputIOVectorTableSize 1UL return UINT32 NULL UINT32 rpcsvr_SMPL_atoi rpc_server_stub_info __pInfo const char nptr UINT32 __ulInputParamOffset 0UL int ret nptr const char __pInfo pucParamArea __ulInputParamOffset ret atoi nptr __pInfo ulOutputIOVectorTableSize 0UL return UINT32 ret UINT32 rpcsvr_SMPL_ref_tsk2 rpc_server_s...

Page 136: ...ulInputParamOffset ercd ref_tsk2 tskid pk_rtsk __pInfo pOutputIOVectorTable __ulOutputParamCount pBaseAddress pk_rtsk __pInfo pOutputIOVectorTable __ulOutputParamCount ulSize sizeof pk_rtsk __pInfo ulOutputIOVectorTableSize 1UL return UINT32 ercd UINT32 rpcsvr_SMPL_ref_sem2 rpc_server_stub_info __pInfo ID semid T_RSEM pk_rsem UINT32 __ulInputParamOffset 0UL UINT32 __ulOutputParamCount 0UL ER ercd ...

Page 137: ...k_rsem __pInfo pOutputIOVectorTable __ulOutputParamCount ulSize sizeof pk_rsem __pInfo ulOutputIOVectorTableSize 1UL return UINT32 ercd static UINT32 const __rpcsvr_SMPL_StubTable rpc_server_stub_info rpcsvr_SMPL_atof rpcsvr_SMPL_atoi rpcsvr_SMPL_ref_tsk2 rpcsvr_SMPL_ref_sem2 INT32 rpcsvr_SMPL_init rpc_svr_config __config rpc_server_info __server_info if __config NULL return 1L __server_info ulRPC...

Page 138: ...StubList __rpcsvr_SMPL_StubTable __server_info ulNumFunctions 4UL __server_info ulStubStackSize __config ulStubStackSize __server_info pUserDefinedData __config pUserDefinedData __server_info ulMaxParamAreaSize __config ulMaxParamAreaSize return rpc_start_server __server_info INT32 rpcsvr_SMPL_shutdown UINT32 __ulServerID UINT32 __ulServerVersion return rpc_stop_server RPCSVR_ID_SMPL RPCSVR_VERS_S...

Page 139: ...ally know what you are doing this file was automatically generated by rpcgen pl on 2007 11 28 12 54 Be aware that this file may be generated as part of the build and therefore any changes made by hand will possibly be lost on a rebuild ifndef _RPC_SMPL_PUBLIC_H define _RPC_SMPL_PUBLIC_H define RPCSVR_ID_SMPL 1 define RPCSVR_VERS_SMPL 2 endif End of _RPC_SMPL_PUBLIC_H ...

Page 140: ...Section 11 Samples Rev 1 01 Mar 17 2008 Page 128 of 128 REJ10J1822 0101 ...

Page 141: ...ator V 1 00 Publication Date Rev 1 01 March 17 2008 Published by Sales Strategic Planning Div Renesas Technology Corp Edited by Customer Support Department Global Strategic Communication Div Renesas Solutions Corp 2008 Renesas Technology Corp All rights reserved Printed in Japan ...

Page 142: ... 7898 Renesas Technology Hong Kong Ltd 7th Floor North Tower World Finance Centre Harbour City Canton Road Tsimshatsui Kowloon Hong Kong Tel 852 2265 6688 Fax 852 2377 3473 Renesas Technology Taiwan Co Ltd 10th Floor No 99 Fushing North Road Taipei Taiwan Tel 886 2 2715 2888 Fax 886 2 3518 3399 Renesas Technology Singapore Pte Ltd 1 Harbour Front Avenue 06 10 Keppel Bay Tower Singapore 098632 Tel ...

Page 143: ......

Page 144: ...1753 Shimonumabe Nakahara ku Kawasaki shi Kanagawa 211 8668 Japan Stub Generator V 1 00 REJ10J1822 0101 User s Manual ...

Reviews: