Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some unnecessary headers #110

Merged
merged 2 commits into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion hw/arm/prusa/prusa-mini.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@
#include "hw/irq.h"
#include "hw/qdev-properties.h"
#include "qemu/error-report.h"
#include "stm32f407/stm32f407_soc.h"
#include "hw/arm/boot.h"
#include "hw/ssi/ssi.h"
#include "hw/loader.h"
#include "utility/ArgHelper.h"
#include "sysemu/runstate.h"
#include "parts/dashboard_types.h"
#include "stm32_common/stm32_shared.h"
#include "stm32_common/stm32_common.h"
#include "stm32_common/stm32_types.h"
#include "hw/arm/armv7m.h"

#define BOOTLOADER_IMAGE "bootloader.bin"

Expand Down
1 change: 0 additions & 1 deletion hw/arm/prusa/stm32_chips/stm32f407xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "../stm32f407/stm32f4xx_adc.h"
#include "../stm32f407/stm32f4xx_adcc.h"
#include "../stm32f407/stm32f2xx_crc.h"
#include "../stm32_common/stm32_f2xx_f4xx_dma.h"
#include "../stm32f407/stm32f2xx_gpio.h"
#include "../stm32f407/stm32f2xx_i2c.h"
#include "../stm32f407/stm32f4xx_iwdg.h"
Expand Down
117 changes: 114 additions & 3 deletions hw/arm/prusa/stm32_common/stm32_f2xx_f4xx_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- F4xx series,
- F2xx series (? - it's modelled off the Pebble QEMU version which supports this.),

Copyright 2021 VintagePC <https://github.com/vintagepc/>
Copyright 2021-2 VintagePC <https://github.com/vintagepc/>

This file is part of Mini404.

Expand All @@ -22,11 +22,123 @@
along with Mini404. If not, see <http://www.gnu.org/licenses/>.
*/

#include "stm32_f2xx_f4xx_dma.h"
#include "qemu/osdep.h"
#include "hw/irq.h"
#include "migration/vmstate.h"
#include "sysemu/dma.h"
#include "qemu/log.h"
#include "hw/sysbus.h"
#include "qemu/timer.h"
#include "exec/memory.h"
#include "stm32_common.h"
#include "stm32_shared.h"

#define STM32_F2xx_DMA_MAX_CHAN 8
#define STM32_F2xx_DMA_CHAN_REGS 6

#define R_DMA_MAX (4+(STM32_F2xx_DMA_MAX_CHAN*STM32_F2xx_DMA_CHAN_REGS))

OBJECT_DECLARE_SIMPLE_TYPE(STM32F2XX_STRUCT_NAME(Dma), STM32F4xx_DMA);

#define _STM32_DMA_INT_BITSET(chan) \
REG_B32(_JOIN2R(FEIF,chan)); \
REG_R(1); \
REG_B32(_JOIN2R(DMEIF,chan)); \
REG_B32(_JOIN2R(TEIF,chan)); \
REG_B32(_JOIN2R(HTIF,chan)); \
REG_B32(_JOIN2R(TCIF,chan));


REGDEF_BLOCK_BEGIN()
_STM32_DMA_INT_BITSET(0)
_STM32_DMA_INT_BITSET(1)
REG_R(4);
_STM32_DMA_INT_BITSET(2)
_STM32_DMA_INT_BITSET(3)
REG_R(4);
REGDEF_BLOCK_END(dma, low_int)

REGDEF_BLOCK_BEGIN()
_STM32_DMA_INT_BITSET(4)
_STM32_DMA_INT_BITSET(5)
REG_R(4);
_STM32_DMA_INT_BITSET(6)
_STM32_DMA_INT_BITSET(7)
REG_R(4);
REGDEF_BLOCK_END(dma, high_int)

#undef _STM32_DMA_INT_BITSET

REGDEF_BLOCK_BEGIN()
REG_B32(EN);
REG_B32(DMEIE);
REG_B32(TEIE);
REG_B32(HTIE);
REG_B32(TCIE);
REG_B32(PFCTRL);
REG_K32(DIR,2);
REG_B32(CIRC);
REG_B32(PINC);
REG_B32(MINC);
REG_K32(PSIZE,2);
REG_K32(MSIZE,2);
REG_B32(PINCOS);
REG_K32(PL,2);
REG_B32(DBM);
REG_B32(CT);
REG_R(1);
REG_K32(PBURST,2);
REG_K32(MBURST,2);
REG_K32(CHSEL,3);
REG_R(4);
REGDEF_BLOCK_END(dma, sxcr)

REGDEF_BLOCK_BEGIN()
REG_K32(FTH,2);
REG_B32(DMDIS);
REG_K32(FS,3);
REG_R(1);
REG_B32(FEIE);
REG_R(24);
REGDEF_BLOCK_END(dma, sxfcr)

#define _STM32_DMA_CHAN_BLK(x) \
REGDEF_NAME(dma, sxcr) _JOIN2R(SCR,x); \
REG_S32(NDTR, 16) _JOIN2R(SNDTR,x); \
uint32_t _JOIN2R(SPAR,x); \
uint32_t _JOIN2R(SM0AR,x); \
uint32_t _JOIN2R(SM1AR,x); \
REGDEF_NAME(dma, sxfcr) _JOIN2R(SFCR,x);



typedef struct STM32F2XX_STRUCT_NAME(Dma) {
STM32Peripheral parent;
MemoryRegion iomem;

union {
struct {
REGDEF_NAME(dma, low_int) LISR; //0x00
REGDEF_NAME(dma, high_int) HISR; //0x04
REGDEF_NAME(dma, low_int) LIFCR; //0x08
REGDEF_NAME(dma, high_int) HIFCR; //0x0C
_STM32_DMA_CHAN_BLK(0) //0x10 - 0x24
_STM32_DMA_CHAN_BLK(1) //0x28 - 0x3C
_STM32_DMA_CHAN_BLK(2) //0x40 - 0x54
_STM32_DMA_CHAN_BLK(3) //0x58 - 0x6C
_STM32_DMA_CHAN_BLK(4) //0x70 - 0x84
_STM32_DMA_CHAN_BLK(5) //0x88 - 0x9C
_STM32_DMA_CHAN_BLK(6) //0xA0 - 0xB4
_STM32_DMA_CHAN_BLK(7) //0xB8 - 0xCC
} defs;
uint32_t raw[R_DMA_MAX];
} regs;

uint32_t original_ndtrs[STM32_F2xx_DMA_MAX_CHAN];

qemu_irq irq[STM32_F2xx_DMA_MAX_CHAN];

} STM32F2XX_STRUCT_NAME(Dma);

enum reg_index {
RI_LISR,
Expand Down Expand Up @@ -484,4 +596,3 @@ stm32_f2xx_f4xx_dma_register_types(void)
}

type_init(stm32_f2xx_f4xx_dma_register_types)

146 changes: 0 additions & 146 deletions hw/arm/prusa/stm32_common/stm32_f2xx_f4xx_dma.h

This file was deleted.

2 changes: 2 additions & 0 deletions hw/arm/prusa/stm32_common/stm32_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ enum STM32_PERIPHS {
STM32_P_GPIO_END = STM32_P_GPIOK + 1U,
STM32_P_ADC_BEGIN = STM32_P_ADC1,
STM32_P_ADC_END = STM32_P_ADC3 + 1U,
STM32_P_USART_BEGIN = STM32_P_UART1,
STM32_P_USART_END = STM32_P_UART8 + 1U,
};
#undef _P

Expand Down
Loading