Lines Matching refs:p_db

41 static BOOLEAN allocate_svc_db_buf(tGATT_SVC_DB *p_db);
42 static void *allocate_attr_in_db(tGATT_SVC_DB *p_db, tBT_UUID *p_uuid, tGATT_PERM perm);
43 static BOOLEAN deallocate_attr_in_db(tGATT_SVC_DB *p_db, void *p_attr);
44 static BOOLEAN copy_extra_byte_in_db(tGATT_SVC_DB *p_db, void **p_dst, UINT16 len);
46 static BOOLEAN gatts_db_add_service_declaration(tGATT_SVC_DB *p_db, tBT_UUID *p_service, BOOLEAN is…
62 BOOLEAN gatts_init_service_db (tGATT_SVC_DB *p_db, tBT_UUID *p_service, BOOLEAN is_pri, in gatts_init_service_db() argument
65 p_db->svc_buffer = fixed_queue_new(SIZE_MAX); in gatts_init_service_db()
67 if (!allocate_svc_db_buf(p_db)) in gatts_init_service_db()
77 p_db->next_handle = s_hdl; in gatts_init_service_db()
78 p_db->end_handle = s_hdl + num_handle; in gatts_init_service_db()
80 return gatts_db_add_service_declaration(p_db, p_service, is_pri); in gatts_init_service_db()
95 tBT_UUID * gatts_get_service_uuid (tGATT_SVC_DB *p_db) in gatts_get_service_uuid() argument
97 if (!p_db || !p_db->p_attr_list) in gatts_get_service_uuid()
105 return &((tGATT_ATTR16 *)p_db->p_attr_list)->p_value->uuid; in gatts_get_service_uuid()
322 tGATT_SVC_DB *p_db, in gatts_db_read_attr_value_by_type() argument
340 if (p_db && p_db->p_attr_list) in gatts_db_read_attr_value_by_type()
342 p_attr = (tGATT_ATTR16 *)p_db->p_attr_list; in gatts_db_read_attr_value_by_type()
440 UINT16 gatts_add_included_service (tGATT_SVC_DB *p_db, UINT16 s_handle, UINT16 e_handle, in gatts_add_included_service() argument
455 if ((p_attr = (tGATT_ATTR16 *) allocate_attr_in_db(p_db, &uuid, GATT_PERM_READ)) != NULL) in gatts_add_included_service()
457 if (copy_extra_byte_in_db(p_db, (void **)&p_attr->p_value, sizeof(tGATT_INCL_SRVC))) in gatts_add_included_service()
467 deallocate_attr_in_db(p_db, p_attr); in gatts_add_included_service()
489 UINT16 gatts_add_characteristic (tGATT_SVC_DB *p_db, tGATT_PERM perm, in gatts_add_characteristic() argument
498 if ((p_char_decl = (tGATT_ATTR16 *)allocate_attr_in_db(p_db, &uuid, GATT_PERM_READ)) != NULL) in gatts_add_characteristic()
500 if (!copy_extra_byte_in_db(p_db, (void **)&p_char_decl->p_value, sizeof(tGATT_CHAR_DECL))) in gatts_add_characteristic()
502 deallocate_attr_in_db(p_db, p_char_decl); in gatts_add_characteristic()
506 p_char_val = (tGATT_ATTR16 *)allocate_attr_in_db(p_db, p_char_uuid, perm); in gatts_add_characteristic()
510 deallocate_attr_in_db(p_db, p_char_decl); in gatts_add_characteristic()
583 UINT16 gatts_add_char_descr (tGATT_SVC_DB *p_db, tGATT_PERM perm, in gatts_add_char_descr() argument
591 if ((p_char_dscptr = (tGATT_ATTR16 *)allocate_attr_in_db(p_db, in gatts_add_char_descr()
628 tGATT_SVC_DB *p_db, in gatts_read_attr_value_by_handle() argument
641 if (p_db && p_db->p_attr_list) in gatts_read_attr_value_by_handle()
643 p_attr = (tGATT_ATTR16 *)p_db->p_attr_list; in gatts_read_attr_value_by_handle()
685 tGATT_STATUS gatts_read_attr_perm_check(tGATT_SVC_DB *p_db, in gatts_read_attr_perm_check() argument
694 if (p_db && p_db->p_attr_list) in gatts_read_attr_perm_check()
696 p_attr = (tGATT_ATTR16 *)p_db->p_attr_list; in gatts_read_attr_perm_check()
731 tGATT_STATUS gatts_write_attr_perm_check (tGATT_SVC_DB *p_db, UINT8 op_code, in gatts_write_attr_perm_check() argument
744 if (p_db != NULL) in gatts_write_attr_perm_check()
746 p_attr = (tGATT_ATTR16 *) p_db->p_attr_list; in gatts_write_attr_perm_check()
910 static void *allocate_attr_in_db(tGATT_SVC_DB *p_db, tBT_UUID *p_uuid, tGATT_PERM perm) in allocate_attr_in_db() argument
930 if (p_db->end_handle <= p_db->next_handle) in allocate_attr_in_db()
933 p_db->end_handle, p_db->next_handle); in allocate_attr_in_db()
937 if (p_db->mem_free < len) in allocate_attr_in_db()
939 if (!allocate_svc_db_buf(p_db)) in allocate_attr_in_db()
945 memset(p_db->p_free_mem, 0, len); in allocate_attr_in_db()
946 p_attr16 = (tGATT_ATTR16 *) p_db->p_free_mem; in allocate_attr_in_db()
955 p_attr32 = (tGATT_ATTR32 *) p_db->p_free_mem; in allocate_attr_in_db()
961 p_attr128 = (tGATT_ATTR128 *) p_db->p_free_mem; in allocate_attr_in_db()
966 p_db->p_free_mem += len; in allocate_attr_in_db()
967 p_db->mem_free -= len; in allocate_attr_in_db()
969 p_attr16->handle = p_db->next_handle++; in allocate_attr_in_db()
974 if (p_db->p_attr_list == NULL) in allocate_attr_in_db()
975 p_db->p_attr_list = p_attr16; in allocate_attr_in_db()
978 p_last = (tGATT_ATTR16 *)p_db->p_attr_list; in allocate_attr_in_db()
1017 static BOOLEAN deallocate_attr_in_db(tGATT_SVC_DB *p_db, void *p_attr) in deallocate_attr_in_db() argument
1022 if (p_db->p_attr_list == NULL) in deallocate_attr_in_db()
1025 p_cur = (tGATT_ATTR16 *) p_db->p_attr_list; in deallocate_attr_in_db()
1037 if (p_cur == p_attr && p_cur == p_db->p_attr_list) in deallocate_attr_in_db()
1039 p_db->p_attr_list = p_cur->p_next; in deallocate_attr_in_db()
1044 p_db->next_handle --; in deallocate_attr_in_db()
1065 static BOOLEAN copy_extra_byte_in_db(tGATT_SVC_DB *p_db, void **p_dst, UINT16 len) in copy_extra_byte_in_db() argument
1069 if (p_db->mem_free < len) in copy_extra_byte_in_db()
1071 if (!allocate_svc_db_buf(p_db)) in copy_extra_byte_in_db()
1078 p = p_db->p_free_mem; in copy_extra_byte_in_db()
1079 p_db->p_free_mem += len; in copy_extra_byte_in_db()
1080 p_db->mem_free -= len; in copy_extra_byte_in_db()
1096 static BOOLEAN allocate_svc_db_buf(tGATT_SVC_DB *p_db) in allocate_svc_db_buf() argument
1102 p_db->p_free_mem = (UINT8 *) p_buf; in allocate_svc_db_buf()
1103 p_db->mem_free = GATT_DB_BUF_SIZE; in allocate_svc_db_buf()
1105 fixed_queue_enqueue(p_db->svc_buffer, p_buf); in allocate_svc_db_buf()
1167 static BOOLEAN gatts_db_add_service_declaration(tGATT_SVC_DB *p_db, tBT_UUID *p_service, BOOLEAN is… in gatts_db_add_service_declaration() argument
1181 if ((p_attr = (tGATT_ATTR16 *)(allocate_attr_in_db(p_db, &uuid, GATT_PERM_READ))) != NULL) in gatts_db_add_service_declaration()
1183 if (copy_extra_byte_in_db (p_db, (void **)&p_attr->p_value, sizeof(tBT_UUID))) in gatts_db_add_service_declaration()