mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-09-22 00:56:21 +03:00
Add init_cx()
This initializes the global context pointer, similar to what avrdude's main.c is doing at startup.
This commit is contained in:
@@ -47,11 +47,19 @@ int quell_progress;
|
||||
int ovsigck;
|
||||
const char *partdesc = "";
|
||||
const char *pgmid = "";
|
||||
libavrdude_context *cx;
|
||||
|
||||
static PyObject *msg_cb = NULL;
|
||||
static PyObject *progress_cb = NULL;
|
||||
static void swig_progress(int percent, double etime, const char *hdr, int finish);
|
||||
|
||||
#define mmt_malloc(n) cfg_malloc(__func__, n)
|
||||
|
||||
void init_cx(void) {
|
||||
cx = mmt_malloc(sizeof *cx); // Allocate and initialise context structure
|
||||
(void) avr_ustimestamp(); // Base timestamps from program start
|
||||
}
|
||||
|
||||
void set_msg_callback(PyObject *PyFunc) {
|
||||
if (PyFunc == Py_None) {
|
||||
if (msg_cb)
|
||||
@@ -257,6 +265,8 @@ typedef struct avrmem_alias AVRMEM_ALIAS;
|
||||
typedef struct programmer PROGRAMMER;
|
||||
typedef void pgm_initpgm(PROGRAMMER*);
|
||||
|
||||
void init_cx(void);
|
||||
|
||||
enum msglvl {
|
||||
MSG_EXT_ERROR = (-3), // OS-type error, no -v option, can be suppressed with -qqqqq
|
||||
MSG_ERROR = (-2), // Avrdude error, no -v option, can be suppressed with -qqqq
|
||||
@@ -652,7 +662,6 @@ AVRMEM_ALIAS * avr_find_memalias(const AVRPART *p, const AVRMEM *m_orig);
|
||||
}
|
||||
AVRPART * locate_part_by_signature(const LISTID parts, unsigned char *sig, int sigsize);
|
||||
AVRPART * locate_part_by_signature_pm(const LISTID parts, unsigned char *sig, int sigsize, int prog_modes);
|
||||
const char *avr_prog_modes_str(int pm);
|
||||
|
||||
PROGRAMMER *locate_programmer_set(const LISTID programmers, const char *id, const char **setid);
|
||||
PROGRAMMER *locate_programmer_starts_set(const LISTID programmers, const char *id, const char **setid, AVRPART *prt);
|
||||
|
||||
@@ -51,6 +51,7 @@ else:
|
||||
import swig_avrdude as ad
|
||||
|
||||
def avrdude_init():
|
||||
ad.init_cx()
|
||||
ad.init_config()
|
||||
|
||||
found = False
|
||||
|
||||
@@ -71,6 +71,7 @@ else:
|
||||
|
||||
import swig_avrdude as ad
|
||||
|
||||
ad.init_cx()
|
||||
ad.init_config()
|
||||
|
||||
found = False
|
||||
|
||||
Reference in New Issue
Block a user