Skip to content

Commit 089964b

Browse files
committed
Fix memory issues of "display show"
1 parent 373b2e8 commit 089964b

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

k210-freertos/platform/sdk/kendryte-freertos-sdk/lib/arch/include/iomem.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ extern "C"
2525
#include <stdint.h>
2626
#include <stddef.h>
2727

28-
#define FIX_CACHE 0 // LoBo
28+
//#define FIX_CACHE 0 // LoBo
29+
#define FIX_CACHE 1 // TS_
2930
#define IOMEM_BLOCK_SIZE 256
3031

3132
void iomem_free(void *paddr) ;

k210-freertos/platform/sdk/kendryte-freertos-sdk/lib/bsp/device/dmac.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ class k_dma_driver : public dma_driver, public static_object, public exclusive_o
174174
{
175175
C_COMMON_ENTRY;
176176
#if FIX_CACHE
177-
//iomem_free(session_.alloc_mem);
178-
//session_.alloc_mem = NULL;
177+
iomem_free(session_.alloc_mem);
178+
session_.alloc_mem = NULL;
179179
#else
180180
free(session_.alloc_mem);
181181
session_.alloc_mem = NULL;
@@ -188,6 +188,7 @@ class k_dma_driver : public dma_driver, public static_object, public exclusive_o
188188

189189
src_inc = !src_inc;
190190
dest_inc = !dest_inc;
191+
// TS. LOGV("[DMAC]", "count is 0x%X .",(unsigned int) count);
191192
configASSERT(count > 0 && count <= 0x3fffff);
192193
configASSERT((dmac.chen & (1 << channel_)) == 0);
193194

@@ -284,10 +285,10 @@ class k_dma_driver : public dma_driver, public static_object, public exclusive_o
284285
else
285286
{
286287
#if FIX_CACHE
287-
//iomem_free(session_.dest_malloc);
288-
//iomem_free(session_.src_malloc);
289-
//session_.dest_malloc = NULL;
290-
//session_.src_malloc = NULL;
288+
iomem_free(session_.dest_malloc);
289+
iomem_free(session_.src_malloc);
290+
session_.dest_malloc = NULL;
291+
session_.src_malloc = NULL;
291292
uint8_t *src_io = (uint8_t *)src;
292293
uint8_t *dest_io = (uint8_t *)dest;
293294
if(is_memory_cache((uintptr_t)src))
@@ -401,12 +402,12 @@ class k_dma_driver : public dma_driver, public static_object, public exclusive_o
401402
{
402403
C_COMMON_ENTRY;
403404
#if FIX_CACHE
404-
//iomem_free(session_.alloc_mem);
405+
iomem_free(session_.alloc_mem);
405406
#else
406-
//free(session_.alloc_mem);
407+
free(session_.alloc_mem);
407408
#endif
408409

409-
//session_.alloc_mem = NULL;
410+
session_.alloc_mem = NULL;
410411
if (count == 0)
411412
{
412413
if (completion_event) xSemaphoreGive(completion_event);

k210-freertos/platform/sdk/kendryte-freertos-sdk/lib/bsp/device/dvp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class k_dvp_driver : public dvp_driver, public static_object, public exclusive_o
138138
{
139139
configASSERT(index < 2);
140140
#if FIX_CACHE
141-
configASSERT(!is_memory_cache((uintptr_t)output_buffer));
141+
//configASSERT(!is_memory_cache((uintptr_t)output_buffer));
142142
#endif
143143
if (index == 0)
144144
{

k210-freertos/platform/sdk/kendryte-freertos-sdk/lib/bsp/device/spi.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1625,13 +1625,14 @@ int k_spi_driver::write(k_spi_device_driver &device, gsl::span<const uint8_t> bu
16251625
spi_.ssienr = 0x01;
16261626
write_inst_addr(spi_.dr, &buffer_write, device.inst_width_);
16271627
write_inst_addr(spi_.dr, &buffer_write, device.addr_width_);
1628+
//LOGV(TAG, "len = 0x%X, width = 0x%X, tx_frames = 0x%X)", (unsigned int)tx_buffer_len, (unsigned int)device.buffer_width_, (unsigned int) tx_frames);
16281629
SemaphoreHandle_t event_write = xSemaphoreCreateBinary();
16291630

16301631
dma_transmit_async(dma_write, buffer_write, &spi_.dr[0], 1, 0, device.buffer_width_, tx_frames, 4, event_write);
16311632
spi_.ser = device.chip_select_mask_;
16321633
int dma_ret = _wait_DMA_transfer(event_write, NULL, dma_write, 0, SPI_DMA_BLOCK_TIME);
16331634
configASSERT(dma_ret >= 0);
1634-
if (dma_ret < 1) ret = -1;
1635+
//if (dma_ret < 1) ret = -1; // TS. Not work anymore !
16351636

16361637
dma_close(dma_write);
16371638
vSemaphoreDelete(event_write);
@@ -1811,6 +1812,7 @@ void k_spi_driver::fill(k_spi_device_driver &device, uint32_t instruction, uint3
18111812
buffer = (const uint8_t *)&address;
18121813
write_inst_addr(spi_.dr, &buffer, device.addr_width_);
18131814

1815+
LOGV(TAG, ":fill count = 0x%X, value = 0x%X)", (unsigned int) count, (unsigned int)value);
18141816
SemaphoreHandle_t event_write = xSemaphoreCreateBinary();
18151817
dma_transmit_async(dma_write, &value, &spi_.dr[0], 0, 0, sizeof(uint32_t), count, 4, event_write);
18161818

0 commit comments

Comments
 (0)