#include "l8anp_plugin.h"
L8RV __cdecl deviceReadFunc(
L8HWI ifp,
const struct L8ANProgrammerInfo_s * programmer,
const struct L8ANDeviceInfo_s * device,
L8HexLine ** dataPtr
) {
const L8IOPI * iop;
const L8TMPI * tmip;
const L8HEXI * hxip;
// get direct access interface
if ( L8_OK != getInterface<L8IOPI>(ifp, L8IOPI_NAME, &iop) ) {
return L8_ERROR;
}
// get timer interface
if ( L8_OK != getInterface<L8TMPI>(ifp, L8TMPI_NAME, &tmip) ) {
return L8_ERROR;
}
// get hex writer interface
if ( L8_OK != getInterface<L8HEXI>(ifp, L8HEXI_NAME, &hxip) ) {
return L8_ERROR;
}
// ... do work here ...;
return L8_OK;
}
int __cdecl deviceWriteFunc(
L8HWI ifp,
const L8ANProgrammerInfo * programmer,
const L8ANDeviceInfo * device,
L8HexLine * dataPtr
) {
const L8IOPI * iop;
const L8TMPI * tmip;
// get direct access interface
if ( L8_OK != getInterface<L8IOPI>(ifp, L8IOPI_NAME, &iop) ) {
::MessageBox( NULL, "Unable to get raw io interface",
"Missing interface", MB_OK );
return L8_ERROR;
}
// get timer interface
if ( L8_OK != getInterface<L8TMPI>(ifp, L8TMPI_NAME, &tmip) ) {
::MessageBox( NULL, "Unable to get timer interface",
"Missing interface", MB_OK );
return L8_ERROR;
}
// ... do work here ...
return L8_OK;
}
/* list of supported devices */
const L8ANDeviceInfo SUPPORTED[] = {
{ "DEVICE 1", "dev 1 info", deviceReadFunc, deviceWriteFunc, NULL },
{ "DEVICE 2", "dev 2 info", deviceReadFunc, deviceWriteFunc, NULL },
{ NULL, NULL, NULL, NULL, NULL }
};
const char * const P_INFO = ""
"put the programmer info\r\n"
"into this string\r\n"
"";
const L8ANProgrammerInfo INFO = {
"My proto programmer",
P_INFO,
SUPPORTED
};
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
/* entry function */
PLUGIN_ENTRY(ptr) {
*ptr = &INFO;
return L8_OK;
}
|