18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 48c2ecf20Sopenharmony_ci * GUS's memory allocation routines / bottom layer 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <linux/slab.h> 88c2ecf20Sopenharmony_ci#include <linux/string.h> 98c2ecf20Sopenharmony_ci#include <sound/core.h> 108c2ecf20Sopenharmony_ci#include <sound/gus.h> 118c2ecf20Sopenharmony_ci#include <sound/info.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#ifdef CONFIG_SND_DEBUG 148c2ecf20Sopenharmony_cistatic void snd_gf1_mem_info_read(struct snd_info_entry *entry, 158c2ecf20Sopenharmony_ci struct snd_info_buffer *buffer); 168c2ecf20Sopenharmony_ci#endif 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_civoid snd_gf1_mem_lock(struct snd_gf1_mem * alloc, int xup) 198c2ecf20Sopenharmony_ci{ 208c2ecf20Sopenharmony_ci if (!xup) { 218c2ecf20Sopenharmony_ci mutex_lock(&alloc->memory_mutex); 228c2ecf20Sopenharmony_ci } else { 238c2ecf20Sopenharmony_ci mutex_unlock(&alloc->memory_mutex); 248c2ecf20Sopenharmony_ci } 258c2ecf20Sopenharmony_ci} 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_cistatic struct snd_gf1_mem_block *snd_gf1_mem_xalloc(struct snd_gf1_mem * alloc, 288c2ecf20Sopenharmony_ci struct snd_gf1_mem_block * block) 298c2ecf20Sopenharmony_ci{ 308c2ecf20Sopenharmony_ci struct snd_gf1_mem_block *pblock, *nblock; 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci nblock = kmalloc(sizeof(struct snd_gf1_mem_block), GFP_KERNEL); 338c2ecf20Sopenharmony_ci if (nblock == NULL) 348c2ecf20Sopenharmony_ci return NULL; 358c2ecf20Sopenharmony_ci *nblock = *block; 368c2ecf20Sopenharmony_ci pblock = alloc->first; 378c2ecf20Sopenharmony_ci while (pblock) { 388c2ecf20Sopenharmony_ci if (pblock->ptr > nblock->ptr) { 398c2ecf20Sopenharmony_ci nblock->prev = pblock->prev; 408c2ecf20Sopenharmony_ci nblock->next = pblock; 418c2ecf20Sopenharmony_ci pblock->prev = nblock; 428c2ecf20Sopenharmony_ci if (pblock == alloc->first) 438c2ecf20Sopenharmony_ci alloc->first = nblock; 448c2ecf20Sopenharmony_ci else 458c2ecf20Sopenharmony_ci nblock->prev->next = nblock; 468c2ecf20Sopenharmony_ci mutex_unlock(&alloc->memory_mutex); 478c2ecf20Sopenharmony_ci return NULL; 488c2ecf20Sopenharmony_ci } 498c2ecf20Sopenharmony_ci pblock = pblock->next; 508c2ecf20Sopenharmony_ci } 518c2ecf20Sopenharmony_ci nblock->next = NULL; 528c2ecf20Sopenharmony_ci if (alloc->last == NULL) { 538c2ecf20Sopenharmony_ci nblock->prev = NULL; 548c2ecf20Sopenharmony_ci alloc->first = alloc->last = nblock; 558c2ecf20Sopenharmony_ci } else { 568c2ecf20Sopenharmony_ci nblock->prev = alloc->last; 578c2ecf20Sopenharmony_ci alloc->last->next = nblock; 588c2ecf20Sopenharmony_ci alloc->last = nblock; 598c2ecf20Sopenharmony_ci } 608c2ecf20Sopenharmony_ci return nblock; 618c2ecf20Sopenharmony_ci} 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ciint snd_gf1_mem_xfree(struct snd_gf1_mem * alloc, struct snd_gf1_mem_block * block) 648c2ecf20Sopenharmony_ci{ 658c2ecf20Sopenharmony_ci if (block->share) { /* ok.. shared block */ 668c2ecf20Sopenharmony_ci block->share--; 678c2ecf20Sopenharmony_ci mutex_unlock(&alloc->memory_mutex); 688c2ecf20Sopenharmony_ci return 0; 698c2ecf20Sopenharmony_ci } 708c2ecf20Sopenharmony_ci if (alloc->first == block) { 718c2ecf20Sopenharmony_ci alloc->first = block->next; 728c2ecf20Sopenharmony_ci if (block->next) 738c2ecf20Sopenharmony_ci block->next->prev = NULL; 748c2ecf20Sopenharmony_ci } else { 758c2ecf20Sopenharmony_ci block->prev->next = block->next; 768c2ecf20Sopenharmony_ci if (block->next) 778c2ecf20Sopenharmony_ci block->next->prev = block->prev; 788c2ecf20Sopenharmony_ci } 798c2ecf20Sopenharmony_ci if (alloc->last == block) { 808c2ecf20Sopenharmony_ci alloc->last = block->prev; 818c2ecf20Sopenharmony_ci if (block->prev) 828c2ecf20Sopenharmony_ci block->prev->next = NULL; 838c2ecf20Sopenharmony_ci } else { 848c2ecf20Sopenharmony_ci block->next->prev = block->prev; 858c2ecf20Sopenharmony_ci if (block->prev) 868c2ecf20Sopenharmony_ci block->prev->next = block->next; 878c2ecf20Sopenharmony_ci } 888c2ecf20Sopenharmony_ci kfree(block->name); 898c2ecf20Sopenharmony_ci kfree(block); 908c2ecf20Sopenharmony_ci return 0; 918c2ecf20Sopenharmony_ci} 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_cistatic struct snd_gf1_mem_block *snd_gf1_mem_look(struct snd_gf1_mem * alloc, 948c2ecf20Sopenharmony_ci unsigned int address) 958c2ecf20Sopenharmony_ci{ 968c2ecf20Sopenharmony_ci struct snd_gf1_mem_block *block; 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci for (block = alloc->first; block; block = block->next) { 998c2ecf20Sopenharmony_ci if (block->ptr == address) { 1008c2ecf20Sopenharmony_ci return block; 1018c2ecf20Sopenharmony_ci } 1028c2ecf20Sopenharmony_ci } 1038c2ecf20Sopenharmony_ci return NULL; 1048c2ecf20Sopenharmony_ci} 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_cistatic struct snd_gf1_mem_block *snd_gf1_mem_share(struct snd_gf1_mem * alloc, 1078c2ecf20Sopenharmony_ci unsigned int *share_id) 1088c2ecf20Sopenharmony_ci{ 1098c2ecf20Sopenharmony_ci struct snd_gf1_mem_block *block; 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci if (!share_id[0] && !share_id[1] && 1128c2ecf20Sopenharmony_ci !share_id[2] && !share_id[3]) 1138c2ecf20Sopenharmony_ci return NULL; 1148c2ecf20Sopenharmony_ci for (block = alloc->first; block; block = block->next) 1158c2ecf20Sopenharmony_ci if (!memcmp(share_id, block->share_id, 1168c2ecf20Sopenharmony_ci sizeof(block->share_id))) 1178c2ecf20Sopenharmony_ci return block; 1188c2ecf20Sopenharmony_ci return NULL; 1198c2ecf20Sopenharmony_ci} 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_cistatic int snd_gf1_mem_find(struct snd_gf1_mem * alloc, 1228c2ecf20Sopenharmony_ci struct snd_gf1_mem_block * block, 1238c2ecf20Sopenharmony_ci unsigned int size, int w_16, int align) 1248c2ecf20Sopenharmony_ci{ 1258c2ecf20Sopenharmony_ci struct snd_gf1_bank_info *info = w_16 ? alloc->banks_16 : alloc->banks_8; 1268c2ecf20Sopenharmony_ci unsigned int idx, boundary; 1278c2ecf20Sopenharmony_ci int size1; 1288c2ecf20Sopenharmony_ci struct snd_gf1_mem_block *pblock; 1298c2ecf20Sopenharmony_ci unsigned int ptr1, ptr2; 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci if (w_16 && align < 2) 1328c2ecf20Sopenharmony_ci align = 2; 1338c2ecf20Sopenharmony_ci block->flags = w_16 ? SNDRV_GF1_MEM_BLOCK_16BIT : 0; 1348c2ecf20Sopenharmony_ci block->owner = SNDRV_GF1_MEM_OWNER_DRIVER; 1358c2ecf20Sopenharmony_ci block->share = 0; 1368c2ecf20Sopenharmony_ci block->share_id[0] = block->share_id[1] = 1378c2ecf20Sopenharmony_ci block->share_id[2] = block->share_id[3] = 0; 1388c2ecf20Sopenharmony_ci block->name = NULL; 1398c2ecf20Sopenharmony_ci block->prev = block->next = NULL; 1408c2ecf20Sopenharmony_ci for (pblock = alloc->first, idx = 0; pblock; pblock = pblock->next) { 1418c2ecf20Sopenharmony_ci while (pblock->ptr >= (boundary = info[idx].address + info[idx].size)) 1428c2ecf20Sopenharmony_ci idx++; 1438c2ecf20Sopenharmony_ci while (pblock->ptr + pblock->size >= (boundary = info[idx].address + info[idx].size)) 1448c2ecf20Sopenharmony_ci idx++; 1458c2ecf20Sopenharmony_ci ptr2 = boundary; 1468c2ecf20Sopenharmony_ci if (pblock->next) { 1478c2ecf20Sopenharmony_ci if (pblock->ptr + pblock->size == pblock->next->ptr) 1488c2ecf20Sopenharmony_ci continue; 1498c2ecf20Sopenharmony_ci if (pblock->next->ptr < boundary) 1508c2ecf20Sopenharmony_ci ptr2 = pblock->next->ptr; 1518c2ecf20Sopenharmony_ci } 1528c2ecf20Sopenharmony_ci ptr1 = ALIGN(pblock->ptr + pblock->size, align); 1538c2ecf20Sopenharmony_ci if (ptr1 >= ptr2) 1548c2ecf20Sopenharmony_ci continue; 1558c2ecf20Sopenharmony_ci size1 = ptr2 - ptr1; 1568c2ecf20Sopenharmony_ci if ((int)size <= size1) { 1578c2ecf20Sopenharmony_ci block->ptr = ptr1; 1588c2ecf20Sopenharmony_ci block->size = size; 1598c2ecf20Sopenharmony_ci return 0; 1608c2ecf20Sopenharmony_ci } 1618c2ecf20Sopenharmony_ci } 1628c2ecf20Sopenharmony_ci while (++idx < 4) { 1638c2ecf20Sopenharmony_ci if (size <= info[idx].size) { 1648c2ecf20Sopenharmony_ci /* I assume that bank address is already aligned.. */ 1658c2ecf20Sopenharmony_ci block->ptr = info[idx].address; 1668c2ecf20Sopenharmony_ci block->size = size; 1678c2ecf20Sopenharmony_ci return 0; 1688c2ecf20Sopenharmony_ci } 1698c2ecf20Sopenharmony_ci } 1708c2ecf20Sopenharmony_ci return -ENOMEM; 1718c2ecf20Sopenharmony_ci} 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_cistruct snd_gf1_mem_block *snd_gf1_mem_alloc(struct snd_gf1_mem * alloc, int owner, 1748c2ecf20Sopenharmony_ci char *name, int size, int w_16, int align, 1758c2ecf20Sopenharmony_ci unsigned int *share_id) 1768c2ecf20Sopenharmony_ci{ 1778c2ecf20Sopenharmony_ci struct snd_gf1_mem_block block, *nblock; 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_ci snd_gf1_mem_lock(alloc, 0); 1808c2ecf20Sopenharmony_ci if (share_id != NULL) { 1818c2ecf20Sopenharmony_ci nblock = snd_gf1_mem_share(alloc, share_id); 1828c2ecf20Sopenharmony_ci if (nblock != NULL) { 1838c2ecf20Sopenharmony_ci if (size != (int)nblock->size) { 1848c2ecf20Sopenharmony_ci /* TODO: remove in the future */ 1858c2ecf20Sopenharmony_ci snd_printk(KERN_ERR "snd_gf1_mem_alloc - share: sizes differ\n"); 1868c2ecf20Sopenharmony_ci goto __std; 1878c2ecf20Sopenharmony_ci } 1888c2ecf20Sopenharmony_ci nblock->share++; 1898c2ecf20Sopenharmony_ci snd_gf1_mem_lock(alloc, 1); 1908c2ecf20Sopenharmony_ci return NULL; 1918c2ecf20Sopenharmony_ci } 1928c2ecf20Sopenharmony_ci } 1938c2ecf20Sopenharmony_ci __std: 1948c2ecf20Sopenharmony_ci if (snd_gf1_mem_find(alloc, &block, size, w_16, align) < 0) { 1958c2ecf20Sopenharmony_ci snd_gf1_mem_lock(alloc, 1); 1968c2ecf20Sopenharmony_ci return NULL; 1978c2ecf20Sopenharmony_ci } 1988c2ecf20Sopenharmony_ci if (share_id != NULL) 1998c2ecf20Sopenharmony_ci memcpy(&block.share_id, share_id, sizeof(block.share_id)); 2008c2ecf20Sopenharmony_ci block.owner = owner; 2018c2ecf20Sopenharmony_ci block.name = kstrdup(name, GFP_KERNEL); 2028c2ecf20Sopenharmony_ci nblock = snd_gf1_mem_xalloc(alloc, &block); 2038c2ecf20Sopenharmony_ci snd_gf1_mem_lock(alloc, 1); 2048c2ecf20Sopenharmony_ci return nblock; 2058c2ecf20Sopenharmony_ci} 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_ciint snd_gf1_mem_free(struct snd_gf1_mem * alloc, unsigned int address) 2088c2ecf20Sopenharmony_ci{ 2098c2ecf20Sopenharmony_ci int result; 2108c2ecf20Sopenharmony_ci struct snd_gf1_mem_block *block; 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_ci snd_gf1_mem_lock(alloc, 0); 2138c2ecf20Sopenharmony_ci if ((block = snd_gf1_mem_look(alloc, address)) != NULL) { 2148c2ecf20Sopenharmony_ci result = snd_gf1_mem_xfree(alloc, block); 2158c2ecf20Sopenharmony_ci snd_gf1_mem_lock(alloc, 1); 2168c2ecf20Sopenharmony_ci return result; 2178c2ecf20Sopenharmony_ci } 2188c2ecf20Sopenharmony_ci snd_gf1_mem_lock(alloc, 1); 2198c2ecf20Sopenharmony_ci return -EINVAL; 2208c2ecf20Sopenharmony_ci} 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ciint snd_gf1_mem_init(struct snd_gus_card * gus) 2238c2ecf20Sopenharmony_ci{ 2248c2ecf20Sopenharmony_ci struct snd_gf1_mem *alloc; 2258c2ecf20Sopenharmony_ci struct snd_gf1_mem_block block; 2268c2ecf20Sopenharmony_ci 2278c2ecf20Sopenharmony_ci alloc = &gus->gf1.mem_alloc; 2288c2ecf20Sopenharmony_ci mutex_init(&alloc->memory_mutex); 2298c2ecf20Sopenharmony_ci alloc->first = alloc->last = NULL; 2308c2ecf20Sopenharmony_ci if (!gus->gf1.memory) 2318c2ecf20Sopenharmony_ci return 0; 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ci memset(&block, 0, sizeof(block)); 2348c2ecf20Sopenharmony_ci block.owner = SNDRV_GF1_MEM_OWNER_DRIVER; 2358c2ecf20Sopenharmony_ci if (gus->gf1.enh_mode) { 2368c2ecf20Sopenharmony_ci block.ptr = 0; 2378c2ecf20Sopenharmony_ci block.size = 1024; 2388c2ecf20Sopenharmony_ci block.name = kstrdup("InterWave LFOs", GFP_KERNEL); 2398c2ecf20Sopenharmony_ci if (snd_gf1_mem_xalloc(alloc, &block) == NULL) 2408c2ecf20Sopenharmony_ci return -ENOMEM; 2418c2ecf20Sopenharmony_ci } 2428c2ecf20Sopenharmony_ci block.ptr = gus->gf1.default_voice_address; 2438c2ecf20Sopenharmony_ci block.size = 4; 2448c2ecf20Sopenharmony_ci block.name = kstrdup("Voice default (NULL's)", GFP_KERNEL); 2458c2ecf20Sopenharmony_ci if (snd_gf1_mem_xalloc(alloc, &block) == NULL) 2468c2ecf20Sopenharmony_ci return -ENOMEM; 2478c2ecf20Sopenharmony_ci#ifdef CONFIG_SND_DEBUG 2488c2ecf20Sopenharmony_ci snd_card_ro_proc_new(gus->card, "gusmem", gus, snd_gf1_mem_info_read); 2498c2ecf20Sopenharmony_ci#endif 2508c2ecf20Sopenharmony_ci return 0; 2518c2ecf20Sopenharmony_ci} 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ciint snd_gf1_mem_done(struct snd_gus_card * gus) 2548c2ecf20Sopenharmony_ci{ 2558c2ecf20Sopenharmony_ci struct snd_gf1_mem *alloc; 2568c2ecf20Sopenharmony_ci struct snd_gf1_mem_block *block, *nblock; 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_ci alloc = &gus->gf1.mem_alloc; 2598c2ecf20Sopenharmony_ci block = alloc->first; 2608c2ecf20Sopenharmony_ci while (block) { 2618c2ecf20Sopenharmony_ci nblock = block->next; 2628c2ecf20Sopenharmony_ci snd_gf1_mem_xfree(alloc, block); 2638c2ecf20Sopenharmony_ci block = nblock; 2648c2ecf20Sopenharmony_ci } 2658c2ecf20Sopenharmony_ci return 0; 2668c2ecf20Sopenharmony_ci} 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_ci#ifdef CONFIG_SND_DEBUG 2698c2ecf20Sopenharmony_cistatic void snd_gf1_mem_info_read(struct snd_info_entry *entry, 2708c2ecf20Sopenharmony_ci struct snd_info_buffer *buffer) 2718c2ecf20Sopenharmony_ci{ 2728c2ecf20Sopenharmony_ci struct snd_gus_card *gus; 2738c2ecf20Sopenharmony_ci struct snd_gf1_mem *alloc; 2748c2ecf20Sopenharmony_ci struct snd_gf1_mem_block *block; 2758c2ecf20Sopenharmony_ci unsigned int total, used; 2768c2ecf20Sopenharmony_ci int i; 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_ci gus = entry->private_data; 2798c2ecf20Sopenharmony_ci alloc = &gus->gf1.mem_alloc; 2808c2ecf20Sopenharmony_ci mutex_lock(&alloc->memory_mutex); 2818c2ecf20Sopenharmony_ci snd_iprintf(buffer, "8-bit banks : \n "); 2828c2ecf20Sopenharmony_ci for (i = 0; i < 4; i++) 2838c2ecf20Sopenharmony_ci snd_iprintf(buffer, "0x%06x (%04ik)%s", alloc->banks_8[i].address, alloc->banks_8[i].size >> 10, i + 1 < 4 ? "," : ""); 2848c2ecf20Sopenharmony_ci snd_iprintf(buffer, "\n" 2858c2ecf20Sopenharmony_ci "16-bit banks : \n "); 2868c2ecf20Sopenharmony_ci for (i = total = 0; i < 4; i++) { 2878c2ecf20Sopenharmony_ci snd_iprintf(buffer, "0x%06x (%04ik)%s", alloc->banks_16[i].address, alloc->banks_16[i].size >> 10, i + 1 < 4 ? "," : ""); 2888c2ecf20Sopenharmony_ci total += alloc->banks_16[i].size; 2898c2ecf20Sopenharmony_ci } 2908c2ecf20Sopenharmony_ci snd_iprintf(buffer, "\n"); 2918c2ecf20Sopenharmony_ci used = 0; 2928c2ecf20Sopenharmony_ci for (block = alloc->first, i = 0; block; block = block->next, i++) { 2938c2ecf20Sopenharmony_ci used += block->size; 2948c2ecf20Sopenharmony_ci snd_iprintf(buffer, "Block %i onboard 0x%x size %i (0x%x):\n", i, block->ptr, block->size, block->size); 2958c2ecf20Sopenharmony_ci if (block->share || 2968c2ecf20Sopenharmony_ci block->share_id[0] || block->share_id[1] || 2978c2ecf20Sopenharmony_ci block->share_id[2] || block->share_id[3]) 2988c2ecf20Sopenharmony_ci snd_iprintf(buffer, " Share : %i [id0 0x%x] [id1 0x%x] [id2 0x%x] [id3 0x%x]\n", 2998c2ecf20Sopenharmony_ci block->share, 3008c2ecf20Sopenharmony_ci block->share_id[0], block->share_id[1], 3018c2ecf20Sopenharmony_ci block->share_id[2], block->share_id[3]); 3028c2ecf20Sopenharmony_ci snd_iprintf(buffer, " Flags :%s\n", 3038c2ecf20Sopenharmony_ci block->flags & SNDRV_GF1_MEM_BLOCK_16BIT ? " 16-bit" : ""); 3048c2ecf20Sopenharmony_ci snd_iprintf(buffer, " Owner : "); 3058c2ecf20Sopenharmony_ci switch (block->owner) { 3068c2ecf20Sopenharmony_ci case SNDRV_GF1_MEM_OWNER_DRIVER: 3078c2ecf20Sopenharmony_ci snd_iprintf(buffer, "driver - %s\n", block->name); 3088c2ecf20Sopenharmony_ci break; 3098c2ecf20Sopenharmony_ci case SNDRV_GF1_MEM_OWNER_WAVE_SIMPLE: 3108c2ecf20Sopenharmony_ci snd_iprintf(buffer, "SIMPLE wave\n"); 3118c2ecf20Sopenharmony_ci break; 3128c2ecf20Sopenharmony_ci case SNDRV_GF1_MEM_OWNER_WAVE_GF1: 3138c2ecf20Sopenharmony_ci snd_iprintf(buffer, "GF1 wave\n"); 3148c2ecf20Sopenharmony_ci break; 3158c2ecf20Sopenharmony_ci case SNDRV_GF1_MEM_OWNER_WAVE_IWFFFF: 3168c2ecf20Sopenharmony_ci snd_iprintf(buffer, "IWFFFF wave\n"); 3178c2ecf20Sopenharmony_ci break; 3188c2ecf20Sopenharmony_ci default: 3198c2ecf20Sopenharmony_ci snd_iprintf(buffer, "unknown\n"); 3208c2ecf20Sopenharmony_ci } 3218c2ecf20Sopenharmony_ci } 3228c2ecf20Sopenharmony_ci snd_iprintf(buffer, " Total: memory = %i, used = %i, free = %i\n", 3238c2ecf20Sopenharmony_ci total, used, total - used); 3248c2ecf20Sopenharmony_ci mutex_unlock(&alloc->memory_mutex); 3258c2ecf20Sopenharmony_ci#if 0 3268c2ecf20Sopenharmony_ci ultra_iprintf(buffer, " Verify: free = %i, max 8-bit block = %i, max 16-bit block = %i\n", 3278c2ecf20Sopenharmony_ci ultra_memory_free_size(card, &card->gf1.mem_alloc), 3288c2ecf20Sopenharmony_ci ultra_memory_free_block(card, &card->gf1.mem_alloc, 0), 3298c2ecf20Sopenharmony_ci ultra_memory_free_block(card, &card->gf1.mem_alloc, 1)); 3308c2ecf20Sopenharmony_ci#endif 3318c2ecf20Sopenharmony_ci} 3328c2ecf20Sopenharmony_ci#endif 333