Skip to content

Commit

Permalink
Fix some rebase issues, fix failing to allocate DMA channel on STM32U5
Browse files Browse the repository at this point in the history
  • Loading branch information
multiplemonomials committed Oct 27, 2023
1 parent fc4bd87 commit d8be1ff
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 10 deletions.
1 change: 0 additions & 1 deletion connectivity/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ if("FEATURE_BLE=1" IN_LIST MBED_TARGET_DEFINITIONS)
add_subdirectory(FEATURE_BLE)
endif()

add_subdirectory(lorawan)
add_subdirectory(drivers)
add_subdirectory(libraries)
add_subdirectory(lwipstack)
Expand Down
3 changes: 0 additions & 3 deletions drivers/include/drivers/SPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -776,9 +776,6 @@ class SPI : private NonCopyable<SPI> {
* Should be called with _peripherals_mutex locked.
*/
static spi_peripheral_s *_alloc();
/// Deallocate the given peripheral.
/// Must be called from a critical section.
static void _dealloc(spi_peripheral_s * peripheral);

/// Deallocate the given peripheral.
/// Should be called with _peripherals_mutex locked.
Expand Down
84 changes: 78 additions & 6 deletions targets/TARGET_STM/stm_dma_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,78 @@ DMA_Channel_TypeDef * stm_get_dma_channel(const DMALinkInfo *dmaLink)
default:
mbed_error(MBED_ERROR_ITEM_NOT_FOUND, "Invalid DMA channel", dmaLink->channelIdx, MBED_FILENAME, __LINE__);
}
#endif
#ifdef GPDMA1
case 1:
switch(dmaLink->channelIdx)
{
#ifdef GPDMA1_Channel0
case 0:
return GPDMA1_Channel0;
#endif
#ifdef GPDMA1_Channel1
case 1:
return GPDMA1_Channel1;
#endif
#ifdef GPDMA1_Channel2
case 2:
return GPDMA1_Channel2;
#endif
#ifdef GPDMA1_Channel3
case 3:
return GPDMA1_Channel3;
#endif
#ifdef GPDMA1_Channel4
case 4:
return GPDMA1_Channel4;
#endif
#ifdef GPDMA1_Channel5
case 5:
return GPDMA1_Channel5;
#endif
#ifdef GPDMA1_Channel6
case 6:
return GPDMA1_Channel6;
#endif
#ifdef GPDMA1_Channel7
case 7:
return GPDMA1_Channel7;
#endif
#ifdef GPDMA1_Channel8
case 8:
return GPDMA1_Channel8;
#endif
#ifdef GPDMA1_Channel9
case 9:
return GPDMA1_Channel9;
#endif
#ifdef GPDMA1_Channel10
case 10:
return GPDMA1_Channel10;
#endif
#ifdef GPDMA1_Channel11
case 11:
return GPDMA1_Channel11;
#endif
#ifdef GPDMA1_Channel12
case 12:
return GPDMA1_Channel12;
#endif
#ifdef GPDMA1_Channel13
case 13:
return GPDMA1_Channel13;
#endif
#ifdef GPDMA1_Channel14
case 14:
return GPDMA1_Channel14;
#endif
#ifdef GPDMA1_Channel15
case 15:
return GPDMA1_Channel15;
#endif
default:
mbed_error(MBED_ERROR_ITEM_NOT_FOUND, "Invalid DMA channel", dmaLink->channelIdx, MBED_FILENAME, __LINE__);
}
#endif
default:
mbed_error(MBED_ERROR_ITEM_NOT_FOUND, "Invalid DMA controller", dmaLink->dmaIdx, MBED_FILENAME, __LINE__);
Expand Down Expand Up @@ -568,14 +640,14 @@ DMA_HandleTypeDef *stm_init_dma_link(const DMALinkInfo *dmaLink, uint32_t direct

switch(memDataAlignment) {
case 4:
dmaHandle->Init.DestDataWidth = DMA_SRC_DATAWIDTH_WORD;
dmaHandle->Init.DestDataWidth = DMA_DEST_DATAWIDTH_BYTE;
break;
case 2:
dmaHandle->Init.DestDataWidth = DMA_SRC_DATAWIDTH_HALFWORD;
dmaHandle->Init.DestDataWidth = DMA_DEST_DATAWIDTH_HALFWORD;
break;
case 1:
default:
dmaHandle->Init.DestDataWidth = DMA_SRC_DATAWIDTH_BYTE;
dmaHandle->Init.DestDataWidth = DMA_DEST_DATAWIDTH_BYTE;
break;

}
Expand All @@ -586,14 +658,14 @@ DMA_HandleTypeDef *stm_init_dma_link(const DMALinkInfo *dmaLink, uint32_t direct

switch(periphDataAlignment) {
case 4:
dmaHandle->Init.DestDataWidth = DMA_SRC_DATAWIDTH_WORD;
dmaHandle->Init.DestDataWidth = DMA_DEST_DATAWIDTH_BYTE;
break;
case 2:
dmaHandle->Init.DestDataWidth = DMA_SRC_DATAWIDTH_HALFWORD;
dmaHandle->Init.DestDataWidth = DMA_DEST_DATAWIDTH_HALFWORD;
break;
case 1:
default:
dmaHandle->Init.DestDataWidth = DMA_SRC_DATAWIDTH_BYTE;
dmaHandle->Init.DestDataWidth = DMA_DEST_DATAWIDTH_BYTE;
break;

}
Expand Down

0 comments on commit d8be1ff

Please sign in to comment.