![]() |
![]() |
![]() |
ntdisp reference manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties | Signals |
struct NtdIsp; struct NtdIspClass; void ntd_isp_set_device (NtdIsp *isp
,const gchar *file
); void ntd_isp_set_serial (NtdIsp *isp
,NtdSerial *serial
); NtdSerial * ntd_isp_get_serial (NtdIsp *isp
); void ntd_isp_set_status (NtdIsp *isp
,gint status
); void ntd_isp_clear_status (NtdIsp *isp
); gint ntd_isp_get_status (NtdIsp *isp
); const gchar * ntd_isp_get_message (NtdIsp *isp
); void ntd_isp_status_changed (NtdIsp *isp
); void ntd_isp_progress_notify (NtdIsp *isp
,gdouble fraction
); void ntd_isp_connect (NtdIsp *isp
); void ntd_isp_disconnect (NtdIsp *isp
); void ntd_isp_set_connected (NtdIsp *isp
,gboolean connected
); gboolean ntd_isp_is_connected (NtdIsp *isp
); gboolean ntd_isp_probe (NtdIsp *isp
); gboolean ntd_isp_wipe (NtdIsp *isp
,const gchar *address
,gsize nbytes
); gboolean ntd_isp_download (NtdIsp *isp
,const gchar *address
,gconstpointer buffer
,gsize nbytes
); gboolean ntd_isp_download_file (NtdIsp *isp
,const gchar *address
,const gchar *file
,GError **error
); gboolean ntd_isp_dump (NtdIsp *isp
,const gchar *address
,gpointer *buffer
,gsize *nbytes
); gboolean ntd_isp_dump_file (NtdIsp *isp
,const gchar *address
,gsize nbytes
,const gchar *file
,GError **error
); gboolean ntd_isp_verify (NtdIsp *isp
,const gchar *address
,gconstpointer buffer
,gsize nbytes
); gboolean ntd_isp_verify_file (NtdIsp *isp
,const gchar *address
,const gchar *file
,GError **error
); gboolean ntd_isp_run (NtdIsp *isp
,const gchar *address
);
struct NtdIsp;
All fields are private and should not be used directly. Use its public methods instead.
void ntd_isp_set_device (NtdIsp *isp
,const gchar *file
);
Convenient function to create a new NtdSerial instance and
bind it to isp
(if not yet present) and to initialize it to
the default serial values tipically used by this kind of protocol.
|
a NtdIsp instance |
|
path to the device file |
void ntd_isp_set_serial (NtdIsp *isp
,NtdSerial *serial
);
Sets the "serial" property of isp
to serial
.
NtdSerial * ntd_isp_get_serial (NtdIsp *isp
);
Gets the NtdSerial instance bound to isp
.
|
a NtdIsp instance |
Returns : |
the serial object |
void ntd_isp_set_status (NtdIsp *isp
,gint status
);
Sets the internal status of isp
to status
.
|
a NtdIsp instance |
|
the new status |
void ntd_isp_clear_status (NtdIsp *isp
);
Clears the internal status of isp
, that is set
the "status" property to 0.
|
a NtdIsp instance |
gint ntd_isp_get_status (NtdIsp *isp
);
Gets the internal status of isp
. The internal status is used
to hold the result of the last operation executed on isp
.
|
a NtdIsp instance |
Returns : |
the current status of isp
|
const gchar * ntd_isp_get_message (NtdIsp *isp
);
Gets a descriptive string of the current status of isp
. The
returned value is owned by isp
and should not be changed or freed.
void ntd_isp_status_changed (NtdIsp *isp
);
Emits the "status-changed" signal on isp
.
This function is only useful in NtdIsp implementation.
|
a NtdIsp |
void ntd_isp_progress_notify (NtdIsp *isp
,gdouble fraction
);
Emits the "progress-notify" signal on isp
.
|
a NtdIsp |
|
the new fraction value |
void ntd_isp_connect (NtdIsp *isp
);
Connects the host to isp
, performing any initialization procedure
requested by the underline protocol.
On success, the NtdIsp:status property must be set to 0.
|
a NtdIsp instance |
void ntd_isp_disconnect (NtdIsp *isp
);
Disconnects the host from isp
, performing any finalization procedures
requested by the protocol.
|
a NtdIsp instance |
void ntd_isp_set_connected (NtdIsp *isp
,gboolean connected
);
Forcibly sets the connection flag of isp
to connected
. This function is
reserved for guru use because of its dangerouseness. It is used to skip
some initialization steps performed during the connection phase.
|
a NtdIsp instance |
|
the new flag value |
gboolean ntd_isp_is_connected (NtdIsp *isp
);
Checks for the connection status of isp
.
gboolean ntd_isp_probe (NtdIsp *isp
);
Probes isp
trying to guess the optimal values directly
from the target.
gboolean ntd_isp_wipe (NtdIsp *isp
,const gchar *address
,gsize nbytes
);
Wipes isp
, that is clear the flash on target starting from
address
for nbytes
bytes.
address
can be NULL
, in which case the starting address of
the flash memory will be used.
If nbytes
is set to 0, all the flash memory starting from
address
will be cleared.
gboolean ntd_isp_download (NtdIsp *isp
,const gchar *address
,gconstpointer buffer
,gsize nbytes
);
Downloads, that is move from the host (PC) to the target isp
(the embedded device), the provided binary data, starting from
address
(an ISP dependent value). When address
is NULL
,
this will be the start of the flash memory.
gboolean ntd_isp_download_file (NtdIsp *isp
,const gchar *address
,const gchar *file
,GError **error
);
A convenient wrapper around ntd_isp_download()
that downloads
the content of file
into the isp
chip, starting from address
.
The eventual I/O error will be reported in error
.
address
can be NULL
, in which case the starting address of the
flash memory will be used.
file
can be NULL
, in which case the standard input will be used.
gboolean ntd_isp_dump (NtdIsp *isp
,const gchar *address
,gpointer *buffer
,gsize *nbytes
);
Dumps, that is move from the target isp
(the embedded device) to
the host (PC), the specified portion of memory.
address
can be NULL
, in which case the starting address of the
flash memory will be used.
nbytes
specifies the size of the memory to dump. If initialized
to 0 or if nbytes
is NULL
the flash memory size will be used.
The effective size of the memory dumped will be stored in nbytes
,
if not NULL
.
gboolean ntd_isp_dump_file (NtdIsp *isp
,const gchar *address
,gsize nbytes
,const gchar *file
,GError **error
);
A convenient wrapper around ntd_isp_dump()
that dumps nbytes
bytes of memory starting at address
on the target isp
directly
to file
, providing optional error checking through error
.
address
can be NULL
, in which case the starting address of the
flash memory will be used.
If nbytes
is 0, the portion of memory starting at address
up
to the end of the flash will be dumped.
file
can be NULL
, in which case the standard output will be used.
gboolean ntd_isp_verify (NtdIsp *isp
,const gchar *address
,gconstpointer buffer
,gsize nbytes
);
Verifies that nbytes
bytes at address
address of the device
bound to isp
are the same as nbytes
bytes at buffer
.
This is conceptually equivalent to the following code:
1 2 |
ntd_isp_dump(isp, address, &real_buffer, &nbytes); return memcmp(real_buffer, buffer, nbytes) == 0; |
gboolean ntd_isp_verify_file (NtdIsp *isp
,const gchar *address
,const gchar *file
,GError **error
);
A convenient wrapper around ntd_isp_verify()
that verifies that
the content of file
will match the bytes starting at address
on the target isp
, providing optional error
checking.
address
can be NULL
, in which case the starting address of the
flash memory will be used.
"serial"
property"serial" NtdSerial* : Read / Write
The serial device used by this ISP instance.
"status"
property"status" gint : Read / Write
Status of the last operation.
Allowed values: >= -2147483647
Default value: 0
"progress-notify"
signalvoid user_function (NtdIsp *isp,
gdouble fraction,
gpointer user_data) : Run First
Emitted during the download to notify current progress state.
|
a NtdIsp |
|
the new fraction value |
|
user data set when the signal handler was connected. |