Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PowerPmac "C" functions
#1
Where should I look inside the PowerPmac to find functions available for C - Code?
Reply
#2
brad Wrote:Where should I look inside the PowerPmac to find functions available for C - Code?

(assuming the address of your powerpmac is 192.168.0.200)

http://ftp.192.168.0.200/ppmaclibs/rtpma...tpmacapi.h - API functions available for use for things like getting P and M variables and getting memory pointers

http://ftp.192.168.0.200/ppmaclibs/rtpma...tpmaclib.h - Delta Tau optimized math libraries

http://ftp.192.168.0.200/ppmaclibs/RtPmac/RtGpShm.h - Delta Tau shared memory structures

http://ftp.192.168.0.200/ppmaclibs/GpLib/gplib.h - Library initilization functions and GetResponse (These are not available for Real Time C Code only background C Code). To use these from a C APP you must first call InitLibrary() and should call CloseLibrary() at the end of the C APP. You can use these directly from a CPLC (do not call InitLibrary).
Reply
#3
brad Wrote:Where should I look inside the PowerPmac to find functions available for C - Code?

In firmware dated after August 31st 2008 there are additional “C” functions to get the Gate pointers and you can use their defined structures in “RtGpShm.h”. Below is an example for using them.

Their prototypes are in “rtpmacapi.h. If the gate is not at the index, a NULL pointer is returned. These functions can be used in Rt or background “C” programs.


/*
* GPLinux Power PMAC "C" Template
* To make a standard C Program do the following:
* 1. Copy GpCtpl.c and Makefile to your project directory
* 2. Rename all "GpCtpl" in GpCtpl.c and Makefile to your name
* 3. Then "make clean" and "make", you should have a successful compile
* 4. When no longer debugging, in Makefile change "-g3" to "-02"
*
* Change Log:
* ----------
* Date By Comment
* ------- ------ ----------------------------------------
* 02/13/07 EL Creation
*
*
*
*/


#include "../GpLib/gplib.h"
#include "../RtPmac/RtGpShm.h" // Global Rt/Gp Shared memory pointers
#include "../RtPmac/pRtGpShm.h" // Global Rt/Gp Shared memory pointers


int main(void) {

volatile GateArray1* Gate1;
volatile GateIOStruct* GateIO;

//-------------------------------
// Required Startup Code
//-------------------------------
InitLibrary () ;
//---------------------------------
// Get Shared MEM & IO MEM Ptrs
//---------------------------------
// pshm = GetSharedMemPtr();
// piom = GetIOMemPtr();

//-----------------------------------------------------------
// All 24 bit UMAC bus cards are in
// the upper 24 of 32 bit Power PMAC memeory
// The 1st UMAC bus Gate1 card is at index 4
// Use "sys.Gate1AutoDetect to get the allowed Gate1 indexes
//-----------------------------------------------------------
Gate1 = GetGate1MemPtr(4);
if(Gate1)
{
Gate1->Chan[0].Ctrl |= 0x400000; // Enable AMP (Bit 14 + 8 bit offset)
sleep(2);
Gate1->Chan[0].Ctrl &= 0xFFBFFFFF; // Disable AMP
}
//-------------------------------------------------------------------
// Use "sys.CardIOAutoDetect to get the allowed CardIO/GateIO indexes
//-------------------------------------------------------------------

GateIO = GetGateIOMemPtr(0);
if(GateIO)
{
GateIO->DataReg[3] = 0x5500;
}
CloseLibrary();

return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)