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>
libqiprog: Don't hardcode DCONFIG_DRIVER_USB_MASTER

Move the CONFIG_DRIVER_USB_MASTER to a compiler argument, and don't define
it in software. This allows the same code to be used in QiProg devices with
less effort.

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