Add macro for checking NULL parameters in a driver

The core of libqiprog consists of action(device *dev), where we dereference
the driver in dev, and call its drv->action. dev and dev-drv cannot be
NULL. To not boilerplate this check in every core function, use a macro to
do the checking.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
libqiprog: Move core functionality to a separate file

We need the ultra-light QiProg core to be separate from the library
initialization and device detection. This allows us to reuse the core in
QiProg devices as well.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>