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

int u3_security_sector_round ( u3_handle_t device,
enum round_dir  direction,
uint32_t *  size 

Round secure zone sector count to prevered value

Round a number of sectors to a sector count that is allowed for a secure zone on the data partition.

device U3 device handle
direction direction to round(up or down).
size Size value to round. Rounded value is writen back to this variable.
U3_SUCCESS if successful, else U3_FAILURE and an error string can be obtained using u3_error()
See also:

Definition at line 285 of file u3_commands.c.

References u3_send_cmd().

      uint8_t status;
      uint8_t cmd[U3_CMD_LEN] = {
            0xff, 0xA3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00
      uint32_t rounded_size;
      // fill command data
      *((uint32_t *)(cmd+4)) = *size;
      cmd[8] = direction;

      if (u3_send_cmd(device, cmd, U3_DATA_FROM_DEV, sizeof(rounded_size),
            (uint8_t *) &rounded_size, &status) != U3_SUCCESS)
            return U3_FAILURE;

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

      *size = rounded_size;

      return U3_SUCCESS;

Generated by  Doxygen 1.6.0   Back to index