akk@trantor.informatik.uni-erlangen.de (Andy Klingler) (06/12/91)
How do I call GetMiscResource from Lattice/SAS C 5.05 ? I wanted to allocate the serialhardware to be able to play with the bits, but there is no prototype for GetMiscResource in the includes and it even does not appear in amiga.lib. The only thing I could find was a #define MR_ALLOCMISCRESOURCE (LIB_BASE) in resources/misc.h, but I admit this did not help me much. So, what's the trick? --- Andreas Klingler akk@trantor.informatik.uni-erlangen.de Hey hacker! Leave those newsgroups alone!
carolyn@cbmvax.commodore.com (Carolyn Scheppner - CATS) (06/14/91)
In article <1949138e.ARN0d5b@trantor.informatik.uni-erlangen.de> akk@trantor.informatik.uni-erlangen.de (Andy Klingler) writes: >How do I call GetMiscResource from Lattice/SAS C 5.05 ? > >I wanted to allocate the serialhardware to be able to play with the bits, >but there is no prototype for GetMiscResource in the includes and it even >does not appear in amiga.lib. >The only thing I could find was a > >#define MR_ALLOCMISCRESOURCE (LIB_BASE) See my example (rbfhandler I think) in the 1.3 Amiga RKM Libs and Devs. It's in the Exec Interrupts chapter. Since there were no stubs for Get/FreeMiscResource, I used #pragmas coded into the source. Here's a snippet including the pragmas. #ifdef LATTICE #include <proto/all.h> #include <stdlib.h> #include <stdio.h> #include <string.h> int CXBRK(void) { return(0); } /* Disable Lattice CTRL-C handling */ int chkabort(void) { return(0); } /* really */ extern struct Custom far custom; /* defined in amiga.lib */ UBYTE *GetMiscResource(long,UBYTE *); void FreeMiscResource(long); #pragma libcall MiscBase GetMiscResource 6 9002 #pragma libcall MiscBase FreeMiscResource c 001 #else extern struct Custom custom; /* Without pragmas, you must provide C bindings for misc.resource calls. * See the Resources chapter. */ #endif -- ========================================================================== Carolyn Scheppner -- Tech. Mgr. CATS - Commodore Amiga Technical Support PHONE 215-431-9180 {uunet,rutgers}!cbmvax!carolyn carolyn@commodore.com I am fully operational and all of my circuits are funcTiOnINg pperrf... ==========================================================================
forgeas@swinjm.UUCP (Jean-Michel Forgeas) (06/14/91)
In article <1949138e.ARN0d5b@trantor.informatik.uni-erlangen.de>, Andy Klingler writes: > How do I call GetMiscResource from Lattice/SAS C 5.05 ? > [...] > So, what's the trick? I'm using the 2.0 includes/amiga.lib and you can try these lines of code (example about the parallel port). They seem to do the job. //-----------------------------begin------------------------------ #include <resources/misc.h> #include <resources/cia.h> #include <clib/misc_protos.h> #include <pragmas/misc.h> struct Library *MiscBase; CPTR CIAA, CIAB; //-------init if (! (MiscBase = (struct Library *) OpenResource( MISCNAME ))) goto END_ERROR; if (! (CIAA = OpenResource( CIAANAME ))) goto END_ERROR; if (AllocMiscResource( MR_PARALLELPORT, name )) goto END_ERROR; if (! (CIAB = OpenResource( CIABNAME ))) goto END_ERROR; if (AllocMiscResource( MR_PARALLELBITS, name )) goto END_ERROR; //--------cleanup if (CIAB) FreeMiscResource( MR_PARALLELBITS ); if (CIAA) FreeMiscResource( MR_PARALLELPORT ); //------------------------------end----------------------------- -- \___/ Jean-Michel Forgeas \-/ cbmvax!cbmehq!cbmfra!swinjm!forgeas | The Software Winery -^- And, where is the universe ?