123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #include "binding.h"
- #include "signal_processing.h"
-
- #include <stdio.h>
-
- static const char * BINDING_HW_STRING = "HW";
- static const char * BINDING_SW_STRING = "SW";
- static const char * UNKOWN_STRING = "UNKOWN_STRING";
-
- void binding_from_value( uint32_t value, uint32_t * binding ) {
- for ( uint32_t i = 0; i < TASK_COUNT; ++i ) {
- binding[ i ] = value & 1;
- value >>= 1;
- }
- }
-
- int binding_get_channel_binding( const uint32_t * connections,
- const uint32_t * binding,
- uint32_t n,
- DataChannelBinding * channel_binding ) {
-
- if ( n >= CHANNEL_COUNT ) {
- printf( "ERROR in %s: %" PRIu32 " not a valid channel number\n",
- __func__, n );
- return 1;
- }
-
- channel_binding->sink = binding[ n ];
- channel_binding->source = binding[ connections[ n ] ];
-
- return 0;
- }
-
- const char * binding_to_string( uint32_t binding ) {
- switch ( binding ) {
- case BINDING_SW: return BINDING_SW_STRING;
- case BINDING_HW: return BINDING_HW_STRING;
- }
-
- return UNKOWN_STRING;
- }
|