![]() |
![]() |
![]() |
ntdisp reference manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
struct NtdStm; struct NtdStmClass; NtdStm * ntd_stm_new (void
); NtdStm * ntd_stm_new_with_device (const gchar *device
); void ntd_stm_set_pid (NtdStm *stm
,guint pid
); guint ntd_stm_get_pid (NtdStm *stm
); void ntd_stm_set_version (NtdStm *stm
,const gchar *version
); const gchar * ntd_stm_get_version (NtdStm *stm
); void ntd_stm_set_code_table (NtdStm *stm
,const guchar *code_table
); const guchar * ntd_stm_get_code_table (NtdStm *stm
); void ntd_stm_set_flash_base (NtdStm *stm
,gulong flash_base
); gulong ntd_stm_get_flash_base (NtdStm *stm
); gboolean ntd_stm_command (NtdStm *stm
,NtdStmCommand command
); gboolean ntd_stm_data (NtdStm *stm
,gconstpointer data
,guint data_size
); NtdStmAnswer ntd_stm_answered (NtdStm *stm
);
"code-table" gpointer : Read / Write "flash-base" gulong : Read / Write "pid" guint : Read / Write "version" gchar* : Read / Write
struct NtdStm;
All fields are private and should not be used directly. Use its public methods instead.
NtdStm * ntd_stm_new (void
);
Creates a new generic NtdStm instance.
Returns : |
the newly created object |
NtdStm * ntd_stm_new_with_device (const gchar *device
);
Creates a new default NtdStm instance and binds it to a NtdSerial device automatically configured with sensible defaults.
|
path to the device to use |
Returns : |
the newly created object |
void ntd_stm_set_pid (NtdStm *stm
,guint pid
);
Sets the product id of stm
to pid
. This is a pure informational
data that can be used for device specific operations.
|
a NtdStm instance |
|
the new product id |
guint ntd_stm_get_pid (NtdStm *stm
);
Gets the product id of stm
.
|
a NtdStm instance |
Returns : |
a product id |
void ntd_stm_set_version (NtdStm *stm
,const gchar *version
);
Sets a new version on stm
.
|
a NtdStm |
|
version (informational) |
const gchar * ntd_stm_get_version (NtdStm *stm
);
Gets the version of stm
. This is an informational string.
|
a NtdStm |
Returns : |
the version |
void ntd_stm_set_code_table (NtdStm *stm
,const guchar *code_table
);
Sets a new code table on stm
.
code_table
must be an array of bytes where every character specifies
the code of a command. The command sequence is specified by the
NtdStmCommand enum type.
NTD_STM_COMMAND_GET
comand (always represented by a %'\0' byte),
must contain the length of the table, itself included.
|
a NtdStm |
|
table of command codes |
const guchar * ntd_stm_get_code_table (NtdStm *stm
);
Gets the code table of stm
. The table is internally owned
and must not be freed or modified.
|
a NtdStm |
Returns : |
the code table array |
void ntd_stm_set_flash_base (NtdStm *stm
,gulong flash_base
);
Sets the start address of the flash on stm
to flash_base
.
This number is used to compute the available flash for write operations:
1 |
flash(available) = "flash-size" + "flash-base" - "write-base" |
|
a NtdStm instance |
|
the new address |
gulong ntd_stm_get_flash_base (NtdStm *stm
);
Gets the base flash address of stm
.
|
a NtdStm instance |
Returns : |
the base flash address |
gboolean ntd_stm_command (NtdStm *stm
,NtdStmCommand command
);
Sends command
, together with the needed protocol stuff, to the
device identified by stm
.
gboolean ntd_stm_data (NtdStm *stm
,gconstpointer data
,guint data_size
);
Sends a chunk of generic data to stm
: this method basically adds
the XOR checksum, as required by the STM protocol.
NtdStmAnswer ntd_stm_answered (NtdStm *stm
);
Checks the response of a packet.
|
a NtdStm |
Returns : |
a constant identifing the response type: NTD_STM_ANSWER_NONE
if timed out, NTD_STM_ANSWER_ACK if 0x79 is received,
NTD_STM_ANSWER_NAK when 0x1F is received,
NTD_STM_ANSWER_UNKNOWN when unknows data is received. |
"code-table"
property"code-table" gpointer : Read / Write
An array of bytes specifying the codes of the available commands: the first byte, instead of being the GET code (always '\0'), is used to specify the length of the array.
"pid"
property"pid" guint : Read / Write
Version of the chip, also known as product id.
Default value: 0