src/patch.c
__attribute__((at(0x00219000, "", CHIP_VER_BCM4375B1_BT, FW_VER_S20)))
void decode_mosart(uint8_t *output_buffer, uint32_t *length, uint8_t * packet) {
	uint8_t max = 50;
	uint8_t index = 0;
	while (index < max) {
		output_buffer[index/2] = swap_bits(((packet[index] & 0x40) >> 3) |
				   ((packet[index] & 0x10) >> 2) |
				   ((packet[index] & 0x04) >> 1) |
				   ((packet[index] & 0x01)) |
				   ((packet[index+1] & 0x40) << 1) |
				   ((packet[index+1] & 0x10) << 2) |
				   ((packet[index+1] & 0x04) << 3) |
				   ((packet[index+1] & 0x01) << 4)) ^ 0x5a;
		if (output_buffer[index/2] == 0xa5) {
			break;
		}
		index += 2;
	}
	*length = index/2;
}
/*
Function allowing to decode a Mosart frame (keeps only one bits over two + performs dewhitening + identifies postamble position) 
*/
Function allowing to decode a Mosart frame (keeps only one bits over two + performs dewhitening + identifies postamble position)
Function allowing to decode a Mosart frame ( keeps only one bits over two + performs dewhitening + identifies postamble position )
__attribute__((at(0x00219000, "", CHIP_VER_BCM4375B1_BT, FW_VER_S20)))
void decode_mosart(uint8_t *output_buffer, uint32_t *length, uint8_t * packet) {
	uint8_t max = 50;
	uint8_t index = 0;
	while (index < max) {
		output_buffer[index/2] = swap_bits(((packet[index] & 0x40) >> 3) |
				   ((packet[index] & 0x10) >> 2) |
				   ((packet[index] & 0x04) >> 1) |
				   ((packet[index] & 0x01)) |
				   ((packet[index+1] & 0x40) << 1) |
				   ((packet[index+1] & 0x10) << 2) |
				   ((packet[index+1] & 0x04) << 3) |
				   ((packet[index+1] & 0x01) << 4)) ^ 0x5a;
		if (output_buffer[index/2] == 0xa5) {
			break;
		}
		index += 2;
	}
	*length = index/2;
}
__attribute__ ( ( at ( 0x00219000 , " " , CHIP_VER_BCM4375B1_BT , FW_VER_S20 ) ) ) void decode_mosart ( uint8_t * output_buffer , uint32_t * length , uint8_t * packet ) { uint8_t max = 50 ; uint8_t index = 0 ; while ( index < max ) { output_buffer [ index / 2 ] = swap_bits ( ( ( packet [ index ] & 0x40 ) >> 3 ) | ( ( packet [ index ] & 0x10 ) >> 2 ) | ( ( packet [ index ] & 0x04 ) >> 1 ) | ( ( packet [ index ] & 0x01 ) ) | ( ( packet [ index + 1 ] & 0x40 ) << 1 ) | ( ( packet [ index + 1 ] & 0x10 ) << 2 ) | ( ( packet [ index + 1 ] & 0x04 ) << 3 ) | ( ( packet [ index + 1 ] & 0x01 ) << 4 ) ) ^ 0x5a ; if ( output_buffer [ index / 2 ] == 0xa5 ) { break ; } index += 2 ; } * length = index / 2 ; }
Function allowing to decode a Mosart frame (keeps only one bits over two + performs dewhitening + identifies postamble position)
Function allowing to decode a Mosart frame ( keeps only one bits over two + performs dewhitening + identifies postamble position )