const pointer cleanup
This commit is contained in:
16
chopstx.c
16
chopstx.c
@@ -104,9 +104,9 @@
|
|||||||
* System tick
|
* System tick
|
||||||
*/
|
*/
|
||||||
/* SysTick registers. */
|
/* SysTick registers. */
|
||||||
static volatile uint32_t *const SYST_CSR = (uint32_t *const)0xE000E010;
|
static volatile uint32_t *const SYST_CSR = (uint32_t *)0xE000E010;
|
||||||
static volatile uint32_t *const SYST_RVR = (uint32_t *const)0xE000E014;
|
static volatile uint32_t *const SYST_RVR = (uint32_t *)0xE000E014;
|
||||||
static volatile uint32_t *const SYST_CVR = (uint32_t *const)0xE000E018;
|
static volatile uint32_t *const SYST_CVR = (uint32_t *)0xE000E018;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
chx_systick_reset (void)
|
chx_systick_reset (void)
|
||||||
@@ -158,7 +158,7 @@ struct NVIC {
|
|||||||
volatile uint32_t IPR[60];
|
volatile uint32_t IPR[60];
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct NVIC *const NVIC = (struct NVIC *const)0xE000E100;
|
static struct NVIC *const NVIC = (struct NVIC *)0xE000E100;
|
||||||
#define NVIC_ISER(n) (NVIC->ISER[n >> 5])
|
#define NVIC_ISER(n) (NVIC->ISER[n >> 5])
|
||||||
#define NVIC_ICER(n) (NVIC->ICER[n >> 5])
|
#define NVIC_ICER(n) (NVIC->ICER[n >> 5])
|
||||||
#define NVIC_ICPR(n) (NVIC->ICPR[n >> 5])
|
#define NVIC_ICPR(n) (NVIC->ICPR[n >> 5])
|
||||||
@@ -192,12 +192,12 @@ chx_set_intr_prio (uint8_t n)
|
|||||||
| (CPU_EXCEPTION_PRIORITY_INTERRUPT << sh);
|
| (CPU_EXCEPTION_PRIORITY_INTERRUPT << sh);
|
||||||
}
|
}
|
||||||
|
|
||||||
static volatile uint32_t *const ICSR = (uint32_t *const)0xE000ED04;
|
static volatile uint32_t *const ICSR = (uint32_t *)0xE000ED04;
|
||||||
|
|
||||||
/* Priority control. */
|
/* Priority control. */
|
||||||
static uint32_t *const AIRCR = (uint32_t *const)0xE000ED0C;
|
static uint32_t *const AIRCR = (uint32_t *)0xE000ED0C;
|
||||||
static uint32_t *const SHPR2 = (uint32_t *const)0xE000ED1C;
|
static uint32_t *const SHPR2 = (uint32_t *)0xE000ED1C;
|
||||||
static uint32_t *const SHPR3 = (uint32_t *const)0xE000ED20;
|
static uint32_t *const SHPR3 = (uint32_t *)0xE000ED20;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
chx_prio_init (void)
|
chx_prio_init (void)
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ struct GPIO {
|
|||||||
#define GPIOF_BASE (AHB2PERIPH_BASE + 0x1400)
|
#define GPIOF_BASE (AHB2PERIPH_BASE + 0x1400)
|
||||||
#define GPIOF ((struct GPIO *) GPIOF_BASE)
|
#define GPIOF ((struct GPIO *) GPIOF_BASE)
|
||||||
|
|
||||||
static struct GPIO *const GPIO_LED = ((struct GPIO *const) GPIO_LED_BASE);
|
static struct GPIO *const GPIO_LED = ((struct GPIO *)GPIO_LED_BASE);
|
||||||
static struct GPIO *const GPIO_OTHER = ((struct GPIO *const) GPIO_OTHER_BASE);
|
static struct GPIO *const GPIO_OTHER = ((struct GPIO *)GPIO_OTHER_BASE);
|
||||||
|
|
||||||
static chopstx_mutex_t mtx;
|
static chopstx_mutex_t mtx;
|
||||||
static chopstx_cond_t cnd0, cnd1;
|
static chopstx_cond_t cnd0, cnd1;
|
||||||
@@ -450,7 +450,7 @@ struct SCB
|
|||||||
|
|
||||||
#define SCS_BASE (0xE000E000)
|
#define SCS_BASE (0xE000E000)
|
||||||
#define SCB_BASE (SCS_BASE + 0x0D00)
|
#define SCB_BASE (SCS_BASE + 0x0D00)
|
||||||
static struct SCB *const SCB = ((struct SCB *const) SCB_BASE);
|
static struct SCB *const SCB = ((struct SCB *)SCB_BASE);
|
||||||
|
|
||||||
#define SCB_SCR_SLEEPDEEP (1 << 2)
|
#define SCB_SCR_SLEEPDEEP (1 << 2)
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ struct GPIO {
|
|||||||
#define GPIOF_BASE (AHB2PERIPH_BASE + 0x1400)
|
#define GPIOF_BASE (AHB2PERIPH_BASE + 0x1400)
|
||||||
#define GPIOF ((struct GPIO *) GPIOF_BASE)
|
#define GPIOF ((struct GPIO *) GPIOF_BASE)
|
||||||
|
|
||||||
static struct GPIO *const GPIO_LED = ((struct GPIO *const) GPIO_LED_BASE);
|
static struct GPIO *const GPIO_LED = ((struct GPIO *)GPIO_LED_BASE);
|
||||||
static struct GPIO *const GPIO_OTHER = ((struct GPIO *const) GPIO_OTHER_BASE);
|
static struct GPIO *const GPIO_OTHER = ((struct GPIO *)GPIO_OTHER_BASE);
|
||||||
|
|
||||||
static chopstx_mutex_t mtx;
|
static chopstx_mutex_t mtx;
|
||||||
static chopstx_cond_t cnd0, cnd1;
|
static chopstx_cond_t cnd0, cnd1;
|
||||||
@@ -438,7 +438,7 @@ struct SCB
|
|||||||
|
|
||||||
#define SCS_BASE (0xE000E000)
|
#define SCS_BASE (0xE000E000)
|
||||||
#define SCB_BASE (SCS_BASE + 0x0D00)
|
#define SCB_BASE (SCS_BASE + 0x0D00)
|
||||||
static struct SCB *const SCB = ((struct SCB *const) SCB_BASE);
|
static struct SCB *const SCB = ((struct SCB *)SCB_BASE);
|
||||||
|
|
||||||
#define SCB_SCR_SLEEPDEEP (1 << 2)
|
#define SCB_SCR_SLEEPDEEP (1 << 2)
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ struct GPIO {
|
|||||||
|
|
||||||
#define GPIO_SPEAKER_PIN 1
|
#define GPIO_SPEAKER_PIN 1
|
||||||
|
|
||||||
static struct GPIO *const GPIO_LED = ((struct GPIO *const) GPIO_LED_BASE);
|
static struct GPIO *const GPIO_LED = ((struct GPIO *)GPIO_LED_BASE);
|
||||||
static struct GPIO *const GPIO_OTHER = ((struct GPIO *const) GPIO_OTHER_BASE);
|
static struct GPIO *const GPIO_OTHER = ((struct GPIO *)GPIO_OTHER_BASE);
|
||||||
|
|
||||||
static chopstx_mutex_t mtx;
|
static chopstx_mutex_t mtx;
|
||||||
static chopstx_cond_t cnd;
|
static chopstx_cond_t cnd;
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ struct RCC {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define RCC_BASE (AHBPERIPH_BASE + 0x1000)
|
#define RCC_BASE (AHBPERIPH_BASE + 0x1000)
|
||||||
static struct RCC *const RCC = ((struct RCC *const)RCC_BASE);
|
static struct RCC *const RCC = (struct RCC *)RCC_BASE;
|
||||||
|
|
||||||
#define RCC_APB1ENR_USBEN 0x00800000
|
#define RCC_APB1ENR_USBEN 0x00800000
|
||||||
#define RCC_APB1RSTR_USBRST 0x00800000
|
#define RCC_APB1RSTR_USBRST 0x00800000
|
||||||
@@ -163,7 +163,7 @@ struct SYSCFG {
|
|||||||
#define SYSCFG_CFGR1_MEM_MODE 0x03
|
#define SYSCFG_CFGR1_MEM_MODE 0x03
|
||||||
|
|
||||||
#define SYSCFG_BASE (APBPERIPH_BASE + 0x00010000)
|
#define SYSCFG_BASE (APBPERIPH_BASE + 0x00010000)
|
||||||
static struct SYSCFG *const SYSCFG = ((struct SYSCFG *const) SYSCFG_BASE);
|
static struct SYSCFG *const SYSCFG = (struct SYSCFG *)SYSCFG_BASE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct FLASH {
|
struct FLASH {
|
||||||
@@ -179,7 +179,7 @@ struct FLASH {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define FLASH_R_BASE (AHBPERIPH_BASE + 0x2000)
|
#define FLASH_R_BASE (AHBPERIPH_BASE + 0x2000)
|
||||||
static struct FLASH *const FLASH = ((struct FLASH *const) FLASH_R_BASE);
|
static struct FLASH *const FLASH = (struct FLASH *)FLASH_R_BASE;
|
||||||
|
|
||||||
static void __attribute__((used))
|
static void __attribute__((used))
|
||||||
clock_init (void)
|
clock_init (void)
|
||||||
@@ -279,7 +279,7 @@ struct AFIO
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define AFIO_BASE 0x40010000
|
#define AFIO_BASE 0x40010000
|
||||||
static struct AFIO *const AFIO = (struct AFIO *const)AFIO_BASE;
|
static struct AFIO *const AFIO = (struct AFIO *)AFIO_BASE;
|
||||||
|
|
||||||
#define AFIO_MAPR_TIM3_REMAP_PARTIALREMAP 0x00000800
|
#define AFIO_MAPR_TIM3_REMAP_PARTIALREMAP 0x00000800
|
||||||
#define AFIO_MAPR_SWJ_CFG_DISABLE 0x04000000
|
#define AFIO_MAPR_SWJ_CFG_DISABLE 0x04000000
|
||||||
@@ -308,12 +308,12 @@ struct GPIO {
|
|||||||
#define GPIOE ((struct GPIO *) GPIOE_BASE)
|
#define GPIOE ((struct GPIO *) GPIOE_BASE)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct GPIO *const GPIO_LED = ((struct GPIO *const) GPIO_LED_BASE);
|
static struct GPIO *const GPIO_LED = (struct GPIO *)GPIO_LED_BASE;
|
||||||
#ifdef GPIO_USB_BASE
|
#ifdef GPIO_USB_BASE
|
||||||
static struct GPIO *const GPIO_USB = ((struct GPIO *const) GPIO_USB_BASE);
|
static struct GPIO *const GPIO_USB = (struct GPIO *)GPIO_USB_BASE;
|
||||||
#endif
|
#endif
|
||||||
#ifdef GPIO_OTHER_BASE
|
#ifdef GPIO_OTHER_BASE
|
||||||
static struct GPIO *const GPIO_OTHER = ((struct GPIO *const) GPIO_OTHER_BASE);
|
static struct GPIO *const GPIO_OTHER = (struct GPIO *)GPIO_OTHER_BASE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void __attribute__((used))
|
static void __attribute__((used))
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ struct RCC {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define RCC_BASE (AHBPERIPH_BASE + 0x1000)
|
#define RCC_BASE (AHBPERIPH_BASE + 0x1000)
|
||||||
static struct RCC *const RCC = ((struct RCC *const)RCC_BASE);
|
static struct RCC *const RCC = (struct RCC *)RCC_BASE;
|
||||||
|
|
||||||
#define RCC_AHBENR_DMA1EN 0x00000001
|
#define RCC_AHBENR_DMA1EN 0x00000001
|
||||||
#define RCC_AHBENR_CRCEN 0x00000040
|
#define RCC_AHBENR_CRCEN 0x00000040
|
||||||
@@ -38,7 +38,7 @@ struct CRC {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define CRC_BASE (AHBPERIPH_BASE + 0x3000)
|
#define CRC_BASE (AHBPERIPH_BASE + 0x3000)
|
||||||
static struct CRC *const CRC = ((struct CRC *const)CRC_BASE);
|
static struct CRC *const CRC = (struct CRC *)CRC_BASE;
|
||||||
|
|
||||||
|
|
||||||
struct ADC {
|
struct ADC {
|
||||||
@@ -67,8 +67,8 @@ struct ADC {
|
|||||||
#define ADC1_BASE (APB2PERIPH_BASE + 0x2400)
|
#define ADC1_BASE (APB2PERIPH_BASE + 0x2400)
|
||||||
#define ADC2_BASE (APB2PERIPH_BASE + 0x2800)
|
#define ADC2_BASE (APB2PERIPH_BASE + 0x2800)
|
||||||
|
|
||||||
static struct ADC *const ADC1 = (struct ADC *const)ADC1_BASE;
|
static struct ADC *const ADC1 = (struct ADC *)ADC1_BASE;
|
||||||
static struct ADC *const ADC2 = (struct ADC *const)ADC2_BASE;
|
static struct ADC *const ADC2 = (struct ADC *)ADC2_BASE;
|
||||||
|
|
||||||
#define ADC_CR1_DUALMOD_0 0x00010000
|
#define ADC_CR1_DUALMOD_0 0x00010000
|
||||||
#define ADC_CR1_DUALMOD_1 0x00020000
|
#define ADC_CR1_DUALMOD_1 0x00020000
|
||||||
@@ -167,11 +167,11 @@ struct DMA {
|
|||||||
#define DMA_ISR_TEIF7 0x08000000
|
#define DMA_ISR_TEIF7 0x08000000
|
||||||
|
|
||||||
#define DMA1_BASE (AHBPERIPH_BASE + 0x0000)
|
#define DMA1_BASE (AHBPERIPH_BASE + 0x0000)
|
||||||
static struct DMA *const DMA1 = (struct DMA *const)DMA1_BASE;
|
static struct DMA *const DMA1 = (struct DMA *)DMA1_BASE;
|
||||||
|
|
||||||
#define DMA1_Channel1_BASE (AHBPERIPH_BASE + 0x0008)
|
#define DMA1_Channel1_BASE (AHBPERIPH_BASE + 0x0008)
|
||||||
static struct DMA_Channel *const DMA1_Channel1 =
|
static struct DMA_Channel *const DMA1_Channel1 =
|
||||||
(struct DMA_Channel *const)DMA1_Channel1_BASE;
|
(struct DMA_Channel *)DMA1_Channel1_BASE;
|
||||||
|
|
||||||
/* System Control Block */
|
/* System Control Block */
|
||||||
struct SCB
|
struct SCB
|
||||||
@@ -201,4 +201,4 @@ struct SCB
|
|||||||
|
|
||||||
#define SCS_BASE 0xE000E000
|
#define SCS_BASE 0xE000E000
|
||||||
#define SCB_BASE (SCS_BASE + 0x0D00)
|
#define SCB_BASE (SCS_BASE + 0x0D00)
|
||||||
static struct SCB *const SCB = (struct SCB *const)SCB_BASE;
|
static struct SCB *const SCB = (struct SCB *)SCB_BASE;
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ struct SCB
|
|||||||
|
|
||||||
#define SCS_BASE (0xE000E000)
|
#define SCS_BASE (0xE000E000)
|
||||||
#define SCB_BASE (SCS_BASE + 0x0D00)
|
#define SCB_BASE (SCS_BASE + 0x0D00)
|
||||||
static struct SCB *const SCB = ((struct SCB *const) SCB_BASE);
|
static struct SCB *const SCB = (struct SCB *)SCB_BASE;
|
||||||
|
|
||||||
#define SYSRESETREQ 0x04
|
#define SYSRESETREQ 0x04
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ struct SCB
|
|||||||
|
|
||||||
#define SCS_BASE (0xE000E000)
|
#define SCS_BASE (0xE000E000)
|
||||||
#define SCB_BASE (SCS_BASE + 0x0D00)
|
#define SCB_BASE (SCS_BASE + 0x0D00)
|
||||||
static struct SCB *const SCB = ((struct SCB *const) SCB_BASE);
|
static struct SCB *const SCB = (struct SCB *)SCB_BASE;
|
||||||
|
|
||||||
#define SYSRESETREQ 0x04
|
#define SYSRESETREQ 0x04
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ struct USB_CONF {
|
|||||||
uint8_t rsvd2[3]; /* */
|
uint8_t rsvd2[3]; /* */
|
||||||
volatile uint8_t ADDINFO; /* Peripheral Additional Info register */
|
volatile uint8_t ADDINFO; /* Peripheral Additional Info register */
|
||||||
};
|
};
|
||||||
static struct USB_CONF *const USB_CONF = (struct USB_CONF *) 0x40072000;
|
static struct USB_CONF *const USB_CONF = (struct USB_CONF *)0x40072000;
|
||||||
|
|
||||||
struct USB_CTRL0 {
|
struct USB_CTRL0 {
|
||||||
volatile uint8_t OTGCTL; /* OTG Control register */
|
volatile uint8_t OTGCTL; /* OTG Control register */
|
||||||
|
|||||||
Reference in New Issue
Block a user