src/patch.c
__attribute__((at(0x00219100, "", CHIP_VER_BCM4375B1_BT, FW_VER_S20)))
void encode_mosart(uint8_t *output_buffer,uint8_t *data, uint8_t size) {

	for (int i=0;i<size;i++) {
		uint8_t current = swap_bits(data[i] ^ 0x5A);
		output_buffer[i*2] = swap_bits((((current & 0x01) >> 0) << 7) |
				      (((current & 0x01) >> 0) << 6) |
				      (((current & 0x02) >> 1) << 5) |
      				      (((current & 0x02) >> 1) << 4) |
      				      (((current & 0x04) >> 2) << 3) |
    				      (((current & 0x04) >> 2) << 2) |
      				      (((current & 0x08) >> 3) << 1) |
      				      (((current & 0x08) >> 3) << 0));      				      ;
		output_buffer[i*2+1] = swap_bits((((current & 0x10) >> 4) << 7) |
				      (((current & 0x10) >> 4) << 6) |
				      (((current & 0x20) >> 5) << 5) |
      				      (((current & 0x20) >> 5) << 4) |
      				      (((current & 0x40) >> 6) << 3) |
    				      (((current & 0x40) >> 6) << 2) |
      				      (((current & 0x80) >> 7) << 1) |
      				      (((current & 0x80) >> 7) << 0)); 
	}
}
/*
Function allowing to encode a Mosart frame (duplicates every bit + performs whitening )
*/
Function allowing to encode a Mosart frame (duplicates every bit + performs whitening )
Function allowing to encode a Mosart frame ( duplicates every bit + performs whitening )
__attribute__((at(0x00219100, "", CHIP_VER_BCM4375B1_BT, FW_VER_S20)))
void encode_mosart(uint8_t *output_buffer,uint8_t *data, uint8_t size) {
	for (int i=0;i<size;i++) {
		uint8_t current = swap_bits(data[i] ^ 0x5A);
		output_buffer[i*2] = swap_bits((((current & 0x01) >> 0) << 7) |
				      (((current & 0x01) >> 0) << 6) |
				      (((current & 0x02) >> 1) << 5) |
      				      (((current & 0x02) >> 1) << 4) |
      				      (((current & 0x04) >> 2) << 3) |
    				      (((current & 0x04) >> 2) << 2) |
      				      (((current & 0x08) >> 3) << 1) |
      				      (((current & 0x08) >> 3) << 0));      				      ;
		output_buffer[i*2+1] = swap_bits((((current & 0x10) >> 4) << 7) |
				      (((current & 0x10) >> 4) << 6) |
				      (((current & 0x20) >> 5) << 5) |
      				      (((current & 0x20) >> 5) << 4) |
      				      (((current & 0x40) >> 6) << 3) |
    				      (((current & 0x40) >> 6) << 2) |
      				      (((current & 0x80) >> 7) << 1) |
      				      (((current & 0x80) >> 7) << 0)); 
	}
}
__attribute__ ( ( at ( 0x00219100 , " " , CHIP_VER_BCM4375B1_BT , FW_VER_S20 ) ) ) void encode_mosart ( uint8_t * output_buffer , uint8_t * data , uint8_t size ) { for ( int i = 0 ; i < size ; i ++ ) { uint8_t current = swap_bits ( data [ i ] ^ 0x5A ) ; output_buffer [ i * 2 ] = swap_bits ( ( ( ( current & 0x01 ) >> 0 ) << 7 ) | ( ( ( current & 0x01 ) >> 0 ) << 6 ) | ( ( ( current & 0x02 ) >> 1 ) << 5 ) | ( ( ( current & 0x02 ) >> 1 ) << 4 ) | ( ( ( current & 0x04 ) >> 2 ) << 3 ) | ( ( ( current & 0x04 ) >> 2 ) << 2 ) | ( ( ( current & 0x08 ) >> 3 ) << 1 ) | ( ( ( current & 0x08 ) >> 3 ) << 0 ) ) ; ; output_buffer [ i * 2 + 1 ] = swap_bits ( ( ( ( current & 0x10 ) >> 4 ) << 7 ) | ( ( ( current & 0x10 ) >> 4 ) << 6 ) | ( ( ( current & 0x20 ) >> 5 ) << 5 ) | ( ( ( current & 0x20 ) >> 5 ) << 4 ) | ( ( ( current & 0x40 ) >> 6 ) << 3 ) | ( ( ( current & 0x40 ) >> 6 ) << 2 ) | ( ( ( current & 0x80 ) >> 7 ) << 1 ) | ( ( ( current & 0x80 ) >> 7 ) << 0 ) ) ; } }
Function allowing to encode a Mosart frame (duplicates every bit + performs whitening )
Function allowing to encode a Mosart frame ( duplicates every bit + performs whitening )