Example #1
0
void cras_hfp_ag_suspend_connected_device(struct cras_bt_device *device)
{
	struct audio_gateway *ag;

	DL_SEARCH_SCALAR(connected_ags, ag, device, device);
	if (ag)
		destroy_audio_gateway(ag);
}
Example #2
0
static int cras_hfp_ag_slc_disconnected(struct hfp_slc_handle *handle)
{
	struct audio_gateway *ag;

	DL_SEARCH_SCALAR(connected_ags, ag, slc_handle, handle);
	if (!ag)
		return -EINVAL;

	destroy_audio_gateway(ag);
	return 0;
}
Example #3
0
/* Callback triggered when SLC is initialized.  */
static int cras_hfp_ag_slc_initialized(struct hfp_slc_handle *handle)
{
	struct audio_gateway *ag;

	DL_SEARCH_SCALAR(connected_ags, ag, slc_handle, handle);
	if (!ag)
		return -EINVAL;

	/* Defer the starting of audio gateway to bt_device. */
	return cras_bt_device_audio_gateway_initialized(ag->device);
}
Example #4
0
int main() {
    int i;
    el els[10], *e, *tmp, *tmp2;
    for(i=0;i<10;i++) els[i].id='a'+i;

    /* test LL macros */
    printf("LL macros\n");
    LL_APPEND(head,&els[0]);
    LL_APPEND(head,&els[1]);
    LL_APPEND(head,&els[2]);
    LL_FOREACH(head,e)
        printf("%c ", e->id);
    printf("\n");
    LL_SEARCH_SCALAR(head, e, id, 'b');
    if (e) printf("search scalar found b\n");
    LL_SEARCH(head, e, &els[0], eltcmp);
    if (e) printf("search found %c\n",e->id);
    LL_FOREACH_SAFE(head,e,tmp) LL_DELETE(head,e);

    printf("\n");

    /* test DL macros */
    printf("DL macros\n");
    DL_APPEND(head,&els[0]);
    DL_APPEND(head,&els[1]);
    DL_APPEND(head,&els[2]);
    DL_FOREACH(head,e)
        printf("%c ", e->id);
    printf("\n");
    DL_SEARCH_SCALAR(head, e, id, 'b');
    if (e) printf("search scalar found b\n");
    DL_SEARCH(head, e, &els[0], eltcmp);
    if (e) printf("search found %c\n",e->id);
    DL_FOREACH_SAFE(head,e,tmp) DL_DELETE(head,e);
    printf("\n");

    /* test CDL macros */
    printf("CDL macros\n");
    CDL_PREPEND(head,&els[0]);
    CDL_PREPEND(head,&els[1]);
    CDL_PREPEND(head,&els[2]);
    CDL_FOREACH(head,e)
        printf("%c ", e->id);
    printf("\n");
    CDL_SEARCH_SCALAR(head, e, id, 'b');
    if (e) printf("search scalar found b\n");
    CDL_SEARCH(head, e, &els[0], eltcmp);
    if (e) printf("search found %c\n",e->id);
    CDL_FOREACH_SAFE(head,e,tmp,tmp2) CDL_DELETE(head,e);


    return 0;
}
Example #5
0
void
packetproc_del_pp_ref(struct packetproc *packetproc, uint32_t processor_id, UNUSED_ATTR uint32_t input_id, uint32_t pp_ref) {
    struct pp *pp;
    HASH_FIND(hh, packetproc->pp_map, &processor_id, sizeof(size_t), pp);
    //TODO: check existance

    struct pp_refs *pp_refs;
    DL_SEARCH_SCALAR(pp->processor_refs, pp_refs, ref, pp_ref); /* its enogh to search based on ref,
                                                                   an input  can referred only by one processor */
    //TODO: check existance
    DL_DELETE(pp->processor_refs, pp_refs);
}
Example #6
0
int cras_hfp_ag_start(struct cras_bt_device *device)
{
	struct audio_gateway *ag;

	DL_SEARCH_SCALAR(connected_ags, ag, device, device);
	if (ag == NULL)
		return -EEXIST;

	ag->info = hfp_info_create();
	ag->idev = hfp_iodev_create(CRAS_STREAM_INPUT, ag->device,
				    ag->slc_handle,
				    ag->profile, ag->info);
	ag->odev = hfp_iodev_create(CRAS_STREAM_OUTPUT, ag->device,
				    ag->slc_handle,
				    ag->profile, ag->info);

	if (!ag->idev && !ag->odev) {
		destroy_audio_gateway(ag);
		return -ENOMEM;
	}

	return 0;
}