Device-Chip-SDCard

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

 size

       $n_bytes = await $card->size;

    Returns the size of the media card in bytes.

 read_csd

       $data = await $card->read_csd;

    Returns a HASH reference containing decoded fields from the SD card's
    CSD ("card-specific data") register.

    This hash will contain the following fields:

       TAAC
       NSAC
       TRAN_SPEED
       CCC
       READ_BL_LEN
       READ_BL_LEN_PARTIAL

README  view on Meta::CPAN

       R2W_FACTOR
       WRITE_BL_LEN
       WRITE_BL_PARTIAL
       FILE_FORMAT_GRP
       COPY
       PERM_WRITE_PROTECT
       TEMP_WRITE_PROTECT
       FILE_FORMAT

    The hash will also contain the following calculated fields, derived
    from the decoded fields above for convenience of calling code.

       blocks          # number of blocks implied by C_SIZE / C_SIZE_MULT
       bytes           # number of bytes of storage, implied by blocks and READ_BL_LEN

 read_ocr

       $fields = await $card->read_ocr;

    Returns a HASH reference containing decoded fields from the card's OCR
    ("operating conditions register").

    This hash will contain the following fields:

       BUSY
       CCS
       UHS_II
       1V8_ACCEPTED
       3V5, 3V4, 3V3, ..., 2V7

lib/Device/Chip/SDCard.pm  view on Meta::CPAN

   )->followed_by( sub {
      my ( $f ) = @_;
      $self->protocol->release_ss->then( sub { $f } );
   });
}

=head2 read_csd

   $data = await $card->read_csd;

Returns a C<HASH> reference containing decoded fields from the SD card's CSD
("card-specific data") register.

This hash will contain the following fields:

   TAAC
   NSAC
   TRAN_SPEED
   CCC
   READ_BL_LEN
   READ_BL_LEN_PARTIAL

lib/Device/Chip/SDCard.pm  view on Meta::CPAN

   R2W_FACTOR
   WRITE_BL_LEN
   WRITE_BL_PARTIAL
   FILE_FORMAT_GRP
   COPY
   PERM_WRITE_PROTECT
   TEMP_WRITE_PROTECT
   FILE_FORMAT

The hash will also contain the following calculated fields, derived from the
decoded fields above for convenience of calling code.

   blocks          # number of blocks implied by C_SIZE / C_SIZE_MULT
   bytes           # number of bytes of storage, implied by blocks and READ_BL_LEN

=cut

# This code is most annoying to write as it involves lots of bitwise unpacking
# at non-byte boundaries. It's easier (though inefficient) to perform this on
# an array of 128 1-bit values
sub _bits_to_uint ( @vals )

lib/Device/Chip/SDCard.pm  view on Meta::CPAN

   }
   else {
      die "Bad CSD structure version $ver";
   }
}

=head2 read_ocr

   $fields = await $card->read_ocr;

Returns a C<HASH> reference containing decoded fields from the card's OCR
("operating conditions register").

This hash will contain the following fields:

   BUSY
   CCS
   UHS_II
   1V8_ACCEPTED
   3V5, 3V4, 3V3, ..., 2V7



( run in 0.513 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )