Skip to content
Snippets Groups Projects
Select Git revision
  • edd35de94052c69a9c7a9aaadb32b112d2cd139f
  • master default protected
  • fix-warnings
  • tvbgone-fixes
  • genofire/ble-follow-py
  • schneider/ble-stability-new-phy-adv
  • schneider/ble-stability
  • msgctl/gfx_rle
  • schneider/ble-stability-new-phy
  • add_menu_vibration
  • plaetzchen/ios-workaround
  • blinkisync-as-preload
  • schneider/max30001-pycardium
  • schneider/max30001-epicaridum
  • schneider/max30001
  • schneider/stream-locks
  • schneider/fundamental-test
  • schneider/ble-buffers
  • schneider/maxim-sdk-update
  • ch3/splashscreen
  • koalo/bhi160-works-but-dirty
  • v1.11
  • v1.10
  • v1.9
  • v1.8
  • v1.7
  • v1.6
  • v1.5
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • release-1
  • bootloader-v1
  • v0.0
36 results

overview.rst

Blame
  • Forked from card10 / firmware
    Source project has a limited visibility.
    bl00mbox_plugin_registry.c 3.54 KiB
    //SPDX-License-Identifier: CC0-1.0
    #include "bl00mbox_plugin_registry.h"
    
    bl00mbox_plugin_registry_t * bl00mbox_plugin_registry = NULL;
    uint16_t bl00mbox_plugin_registry_len = 0;
    bool bl00mbox_plugin_registry_is_initialized = false;
    
    static void plugin_add(radspa_descriptor_t * descriptor){
        if(bl00mbox_plugin_registry_len == 65535){
            printf("too many plugins registered");
            abort();
        }
    
        // create plugin registry entry
        bl00mbox_plugin_registry_t * p = malloc(sizeof(bl00mbox_plugin_registry_t));
        if(p == NULL){ printf("bl00mbox: no memory for plugin list"); abort(); }
        p->descriptor = descriptor;
        p->next = NULL;
    
        // go to end of list
        bl00mbox_plugin_registry_t * plast = bl00mbox_plugin_registry;
        if(plast == NULL){
            bl00mbox_plugin_registry = p;
        } else {
            while(plast->next != NULL){ plast = plast->next; }
            plast->next = p;
        }
        bl00mbox_plugin_registry_len++;
    }
    
    uint16_t bl00mbox_plugin_registry_get_plugin_num(void){
        return bl00mbox_plugin_registry_len;
    }
    
    radspa_descriptor_t * bl00mbox_plugin_registry_get_descriptor_from_id(uint32_t id){
        /// searches plugin registry for first descriptor with given id number
        /// and returns pointer to it. returns NULL if no match is found.
        bl00mbox_plugin_registry_t * p = bl00mbox_plugin_registry;
        while(p != NULL){
            if(p->descriptor->id == id) break;
            p = p->next;
        }
        if(p != NULL) return p->descriptor;
        return NULL;
    }
    
    radspa_descriptor_t * bl00mbox_plugin_registry_get_descriptor_from_index(uint32_t index){
        /// returns pointer to descriptor of registry entry at given index.
        /// returns NULL if out of range.
        if(index >= bl00mbox_plugin_registry_len) return NULL;
        bl00mbox_plugin_registry_t * p = bl00mbox_plugin_registry;
        for(uint16_t i = 0; i < index; i++){
            p = p->next;
            if(p == NULL){
                printf("bl00mbox: plugin list length error");
                abort();
            }
        }
        return p->descriptor;
    }
    
    radspa_descriptor_t * bl00mbox_plugin_registry_get_id_from_index(uint32_t index){
        /// returns pointer to descriptor of registry entry at given index.
        /// returns NULL if out of range.
        if(index >= bl00mbox_plugin_registry_len) return NULL;
        bl00mbox_plugin_registry_t * p = bl00mbox_plugin_registry;
        for(uint16_t i = 0; i < index; i++){
            p = p->next;
            if(p == NULL){
                printf("bl00mbox: plugin list length error");