Logo Search packages:      
Sourcecode: u3-tool version File versions

int u3_partition_info ( u3_handle_t device,
struct part_info info 

Request partitioning information

This request some information about the partition sizes

device U3 device handle
info Pointer to structure used to return requested info.
U3_SUCCESS if successful, else U3_FAILURE and an error string can be obtained using u3_error()
See also:
'struct part_info'

Definition at line 316 of file u3_commands.c.

References u3_send_cmd().

      uint8_t status;
      uint8_t cmd[U3_CMD_LEN] = {
            0xff, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00
      memset(info, 0, sizeof(struct part_info));
      if (u3_send_cmd(device, cmd, U3_DATA_FROM_DEV, 9,
            (uint8_t *)info, &status) != U3_SUCCESS)
            return U3_FAILURE;

//TODO: Find out if it is possible to define more then 2 partition. if so, make
//this more dynamic
      if (info->partition_count == 2) {
            if (u3_send_cmd(device, cmd, U3_DATA_FROM_DEV, 16,
                  (uint8_t *)info, &status) != U3_SUCCESS)
                  return U3_FAILURE;

      if (status != 0) {
            u3_set_error(device, "Device reported command failed: status %d", status);
            return U3_FAILURE;

      return U3_SUCCESS;

Generated by  Doxygen 1.6.0   Back to index