From: Christopher Peplin Date: Mon, 6 Jan 2014 19:53:42 +0000 (-0500) Subject: Add more documentation. X-Git-Tag: 5.0.2~277^2~4 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=6f243098abadbde2e9b2e5b13a94029960ea2e51;p=apps%2Fagl-service-can-low-level.git Add more documentation. --- diff --git a/src/bitfield/bitfield.h b/src/bitfield/bitfield.h index b3c30f02..df92639a 100644 --- a/src/bitfield/bitfield.h +++ b/src/bitfield/bitfield.h @@ -165,6 +165,18 @@ bool copy_bytes_right_aligned(const uint8_t source[], const uint16_t source_leng const uint16_t offset, const uint16_t byte_count, uint8_t* destination, const uint16_t destination_length); +/* Public: Set the a nibble in the given data array to the new value. + * + * nibble_index - the index of the nibble to retreive. The leftmost nibble is + * index 0. + * value - the value to set in the bit field. + * destination - the destination array. + * destination_length - the total length of the destination array in bytes, + * for range checking. + * + * Returns true if the bit_count is enough to fully represent the value, and + * false if it will not fit. + */ bool set_nibble(const uint16_t nibble_index, const uint8_t value, uint8_t* destination, const uint16_t destination_length); @@ -184,16 +196,16 @@ bool set_bitfield(const uint64_t value, const uint16_t offset, const uint16_t bit_count, uint8_t destination[], uint16_t destination_length); -/* Private: - */ -uint16_t bits_to_bytes(uint32_t bits); - /* Public: Return a right aligned bitmask for a uint64_t. * * bit_count - the number of bits to mask, right aligned. */ uint64_t bitmask(const uint8_t bit_count); +/* Private: + */ +uint16_t bits_to_bytes(uint32_t bits); + /* Private: A union to assist swapping between uint64_t and a uint8_t array. */ typedef union {