OpenScanDeviceLib
OpenScan Device Programming Interface
Data Structures | Macros | Typedefs | Functions | Variables
OpenScanDeviceLib Internals

Data Structures

struct  OScDevInternal_Interface
 Interface function table for module to call OpenScanLib. More...
 

Macros

#define OScDevInternal_ABI_VERSION   OScDevInternal_MAKE_VERSION(13, 0)
 Binary interface version between device module and OpenScanLib. More...
 
#define OScDevInternal_ENTRY_POINT   OScDev_Module_EntryPoint_v0
 Name of the device module entry point function. More...
 
#define OScDevInternal_ENTRY_POINT_NAME    OScDevInternal_STRINGIFY_EXPANSION(OScDevInternal_ENTRY_POINT)
 Name of the entry point, used to obtain its address.
 
#define OScDevInternal_MAKE_VERSION(major, minor)    (((uint32_t)(major) << 16) | (uint16_t)(minor))
 Create an ABI version number. More...
 
#define OScDevInternal_STRINGIFY(s)   #s
 
#define OScDevInternal_STRINGIFY_EXPANSION(s)   OScDevInternal_STRINGIFY(s)
 

Typedefs

typedef uint32_t(* OScDevInternal_EntryPointPtr) (struct OScDevInternal_Interface ***devif, OScDev_ModuleImpl **impl)
 Pointer to module entry point function.
 

Functions

uint32_t OScDevInternal_ENTRY_POINT_EXPORT OScDevInternal_ENTRY_POINT (struct OScDevInternal_Interface ***devif, OScDev_ModuleImpl **impl)
 Entry point of device module. More...
 

Variables

struct OScDevInternal_InterfaceOScDevInternal_FunctionTable
 Pointer to the interface function table provided by OpenScanLib.
 
OScDev_ModuleImpl OScDevInternal_TheModuleImpl
 Pointer to the module implementation provided by the device module. More...
 

Detailed Description

These are the internal workings of OpenScanDeviceLib; device modules must not use these declarations and definitions directly.

Macro Definition Documentation

◆ OScDevInternal_MAKE_VERSION

#define OScDevInternal_MAKE_VERSION (   major,
  minor 
)     (((uint32_t)(major) << 16) | (uint16_t)(minor))

Create an ABI version number.

See also
OScDevInternal_ABI_VERSION

Definition at line 55 of file OpenScanDeviceLib.h.

◆ OScDevInternal_ABI_VERSION

#define OScDevInternal_ABI_VERSION   OScDevInternal_MAKE_VERSION(13, 0)

Binary interface version between device module and OpenScanLib.

Device modules should not need to be concerned with this version number. It is used to allow OpenScanLib to correctly interact with (or reject) device modules built with different versions of OpenScanDeviceLib.

Since this version number applies to the binary interface, it has no particular relationship to the release version number of OpenScanLib or OpenScanDeviceLib.

The version number is a 32-bit unsigned integer, with the high 16 bits representing the major version and the low 16 bits the minor version.

Device modules written for version x.y will continue to work with a version of OpenScanLib with device ABI version x.z where z >= y, without any special handling. However, it will not work with an OpenScanLib with device ABI version x.w where w < y. This intent leads to the following policy (which may not cover all edge cases):

The minor version must be incremented when one of the following changes are made:

  • A module-to-OpenScanLib call is added at the end of OScDevInternal_Interface
  • A previously required device implementation field becomes optional
  • An optional field is added at the end of a device implementation struct
  • A new enum constant is added (at the end) to an enum type that is not interpreted by modules

The major version must be incremented (and the minor version reset to 0) when any other change is made.

Version numbers should be set correctly for each Git commit. If a related set of changes is to be made over multiple commits, the version number can be set to (-1, 0) in intermediate commits to indicate "experimental".

Definition at line 93 of file OpenScanDeviceLib.h.

◆ OScDevInternal_ENTRY_POINT

#define OScDevInternal_ENTRY_POINT   OScDev_Module_EntryPoint_v0

Name of the device module entry point function.

The name includes a version number in case we want to change the signature or semantics of the entry point. OpenScanLib will only search for entry point names with version number(s) it knows about.

Definition at line 36 of file OpenScanDeviceLibPrivate.h.

Function Documentation

◆ OScDevInternal_ENTRY_POINT()

uint32_t OScDevInternal_ENTRY_POINT_EXPORT OScDevInternal_ENTRY_POINT ( struct OScDevInternal_Interface ***  devif,
OScDev_ModuleImpl **  impl 
)

Entry point of device module.

This function, defined by OpenScanDeviceLib, is called by OpenScanLib after loading the device module. It allows OpenScanLib to check the module's device interface version and obtain the module's implementation function table.

Parameters
[out]devifset to the address of the module's (static) pointer to the device interface function table (after this function returns, OpenScanLib will set the pointer)
[out]implset to the address of the module's implementation function table
Returns
the module's device interface version

Variable Documentation

◆ OScDevInternal_TheModuleImpl

OScDev_ModuleImpl OScDevInternal_TheModuleImpl
extern

Pointer to the module implementation provided by the device module.

See also
OScDev_DEFINE_MODULE_IMPL