diff --git a/src/Makefile b/src/Makefile index ab047a9c4..b215cd547 100644 --- a/src/Makefile +++ b/src/Makefile @@ -142,10 +142,6 @@ WS_HOW_HIGH = YES # Values = YES, NO VARIO = YES -# SDCARD -# Values = YES, NO -SDCARD = NO - # RTCLOCK # Values = YES, NO # default = YES (means enabled when available) @@ -229,6 +225,7 @@ ifeq ($(PCB), STD) MCU = atmega64 CPPDEFS += -DF_CPU=$(F_CPU)UL XCURVES = NO + SDCARD = NO endif ifeq ($(PCB), STD128) @@ -236,6 +233,7 @@ ifeq ($(PCB), STD128) TRGT = avr- MCU = atmega128 CPPDEFS += -DF_CPU=$(F_CPU)UL + SDCARD = NO endif ifeq ($(PCB), GRUVIN9X) @@ -248,6 +246,7 @@ ifeq ($(PCB), GRUVIN9X) TRGT = avr- MCU = atmega2560 CPPDEFS += -DF_CPU=$(F_CPU)UL + SDCARD = NO endif ifeq ($(PCB), SKY9X) @@ -265,6 +264,7 @@ ifeq ($(PCB), SKY9X) TRGT = arm-none-eabi- MCU = cortex-m3 CPPDEFS += -Dat91sam3s4 + SDCARD = YES endif ifeq ($(PCB), X9D) @@ -273,6 +273,7 @@ ifeq ($(PCB), X9D) TRGT = arm-none-eabi- MCU = cortex-m3 CPPDEFS += -DHSE_VALUE=12000000 + SDCARD = YES endif ifeq ($(PCB), ACT) @@ -280,6 +281,7 @@ ifeq ($(PCB), ACT) LDSCRIPT = x9d/stm32_flash.ld TRGT = arm-none-eabi- MCU = cortex-m3 + SDCARD = NO endif CC = $(TRGT)gcc @@ -499,6 +501,7 @@ ifeq ($(PCB), X9D) SRC += x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/system_stm32f2xx.c SRC += x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_gpio.c SRC += x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_rcc.c + SRC += x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_spi.c SRC += x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/gcc_ride7/startup_stm32f2xx.s ifeq ($(SDCARD), YES) diff --git a/src/general_menus.cpp b/src/general_menus.cpp index 5b81176d4..87a892c5f 100644 --- a/src/general_menus.cpp +++ b/src/general_menus.cpp @@ -666,8 +666,10 @@ void menuGeneralSdManager(uint8_t event) else if (result == STR_SD_FORMAT) { displayPopup(STR_FORMATTING); closeLogs(); -#if defined(CPUARM) +#if defined(PCBSKY9X) Card_state = SD_ST_DATA; +#endif +#if defined(CPUARM) audioQueue.stopSD(); #endif if (f_mkfs(0, 1, 0) == FR_OK) { diff --git a/src/lcd.cpp b/src/lcd.cpp index d9e1730f1..f97d964ef 100644 --- a/src/lcd.cpp +++ b/src/lcd.cpp @@ -34,7 +34,7 @@ #include "open9x.h" uint8_t displayBuf[DISPLAY_BUF_SIZE]; -#define DISPLAY_END (displayBuf+sizeof(displayBuf)) +#define DISPLAY_END (displayBuf+DISPLAY_PLAN_SIZE) #define ASSERT_IN_DISPLAY(p) assert((p) >= displayBuf && (p) < DISPLAY_END) void lcd_clear() @@ -78,8 +78,6 @@ uint8_t lcdLastPos; #if defined(PCBX9D) #define LCD_BYTE_FILTER(p, keep, add) \ do { \ - ASSERT_IN_DISPLAY(p); \ - ASSERT_IN_DISPLAY(p+DISPLAY_W); \ if (!(flags & GREY1)) \ *(p) = (*(p) & (keep)) + (add); \ if (!(flags & GREY2)) \ @@ -178,7 +176,6 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags) uint8_t b = pgm_read_byte(q--); if (inv) b = ~b & 0x7f; if (p 0) diff --git a/src/open9x.cpp b/src/open9x.cpp index 164692ed1..d1b234fc5 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -284,6 +284,11 @@ void per10ms() if(mixWarning & 2) if(((g_tmr10ms&0xFF)== 64) || ((g_tmr10ms&0xFF)== 72)) AUDIO_MIX_WARNING_2(); if(mixWarning & 4) if(((g_tmr10ms&0xFF)==128) || ((g_tmr10ms&0xFF)==136) || ((g_tmr10ms&0xFF)==144)) AUDIO_MIX_WARNING_3(); +#if defined(SDCARD) + sdPoll10ms(); +#endif + + heartbeat |= HEART_TIMER10ms; } PhaseData *phaseaddress(uint8_t idx) @@ -3053,12 +3058,6 @@ ISR(TIMER_10MS_VECT, ISR_NOBLOCK) // 10ms timer per10ms(); -#if defined(SDCARD) - sdPoll10ms(); -#endif - - heartbeat |= HEART_TIMER10ms; - #if defined(PCBSTD) && (defined(AUDIO) || defined(VOICE)) } // end 10ms event #endif @@ -3389,7 +3388,7 @@ inline void open9xInit(OPEN9X_INIT_ARGS) else { doSplash(); -#if defined(CPUARM) && defined(SDCARD) +#if defined(PCBSKY9X) && defined(SDCARD) for (int i=0; i<500 && !Card_initialized; i++) { CoTickDelay(1); // 2ms } @@ -3447,8 +3446,6 @@ void mixerTask(void * pdata) if (tick10ms) checkTrims(); } - heartbeat |= HEART_TIMER10ms; // TODO not here but in 10ms interrupt! - if (heartbeat == HEART_TIMER_PULSES+HEART_TIMER10ms) { wdt_reset(); heartbeat = 0; diff --git a/src/sdcard.h b/src/sdcard.h index 828111f43..4cf830072 100644 --- a/src/sdcard.h +++ b/src/sdcard.h @@ -74,17 +74,18 @@ inline const pm_char *SDCARD_ERROR(FRESULT result) #if defined(SIMU) #define sdMountPoll() +#define sdPoll10ms() #else extern void sdMountPoll(); #endif -#if defined(CPUARM) && !(defined(SIMU)) +#if defined(CPUARM) && !defined(SIMU) extern "C" { extern uint32_t sd_card_ready(); extern uint32_t sd_card_mounted(); } #else -#define sd_card_ready() (true) +#define sd_card_ready() (true) #define sd_card_mounted() (true) #endif diff --git a/src/simpgmspace.cpp b/src/simpgmspace.cpp index 37ac76e2b..7d1e2033c 100644 --- a/src/simpgmspace.cpp +++ b/src/simpgmspace.cpp @@ -609,13 +609,11 @@ FRESULT f_getcwd (TCHAR *path, UINT sz_path) return FR_OK; } -#if defined(CPUARM) +#if defined(PCBSKY9X) int32_t Card_state = SD_ST_MOUNTED; uint32_t Card_CSD[4]; // TODO elsewhere #endif -#else // TODO no SD quick and dirty! -int32_t Card_state; #endif bool lcd_refresh = true; diff --git a/src/sky9x/audio.cpp b/src/sky9x/audio.cpp index e5083ad37..716cd495d 100644 --- a/src/sky9x/audio.cpp +++ b/src/sky9x/audio.cpp @@ -615,7 +615,8 @@ void AudioQueue::playFile(const char *filename, uint8_t flags, uint8_t id) #if defined(SIMU) printf("playFile(\"%s\")\n", filename); fflush(stdout); #else - if (Card_initialized && !sd_card_mounted()) + + if (!sd_card_mounted()) return; CoEnterMutexSection(audioMutex); diff --git a/src/sky9x/diskio.cpp b/src/sky9x/diskio.cpp index 17fb71e2f..d7a974233 100644 --- a/src/sky9x/diskio.cpp +++ b/src/sky9x/diskio.cpp @@ -1445,11 +1445,3 @@ DRESULT disk_ioctl ( return res; } - - - - - - - - diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/CMSIS END USER LICENCE AGREEMENT.pdf b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/CMSIS END USER LICENCE AGREEMENT.pdf deleted file mode 100644 index e04afaee6..000000000 Binary files a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/CMSIS END USER LICENCE AGREEMENT.pdf and /dev/null differ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Release_Notes.html b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Release_Notes.html deleted file mode 100644 index c3d97b13f..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Release_Notes.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - -Release Notes for STM32F2xx CMSIS - - - - - -
-


-

-
- - - - - - -
- - - - - - - - - -
Back to Release page
-

Release -Notes for STM32F2xx CMSIS

-

Copyright 2012 STMicroelectronics

-

-
-

 

- - - - - - -
-

Contents

-
    -
  1. STM32F2xx CMSIS -update History
  2. -
  3. License
  4. -
- -

STM32F2xx CMSIS -update History

V1.1.3 / 05-March-2012

-

Main -Changes

- -
  • All source files: license disclaimer text update and add link to the License file on ST Internet.

V1.1.2 / 28-December-2011

Main -Changes

-
  • All source files: update disclaimer to add reference to the new license agreement
  • stm32f2xx.h
    • Correct bit definition: RCC_AHB2RSTR_HSAHRST changed to RCC_AHB2RSTR_HASHRST

V1.1.1 / 14-November-2011

Main -Changes

-
  • stm32f2xx.h
    • Add missing bits definition for DAC CR register
    • Add missing bits definition for FSMC BTR1, BTR2, BTR3, BWTR1, BWTR2, BWTR3 and BWTR4 registers
  • Add startup file for TASKING toolchain

V1.1.0 / 23-September-2011

Main -Changes

-
  • stm32f2xx.h
    • Add define for Cortex-M3 revision __CM3_REV
    • Allow -modification of some constants by the application code, definition of -these constants is now bracketed by              #if !defined. The concerned constant are HSE_VALUE, HSI_VALUE and HSE_STARTUP_TIMEOUT.
    • Fix include of stm32f2xx_conf.h file, change "stm32f2xx_conf.h " by "stm32f2xx_conf.h"
    • Correct MII_RMII_SEL bit (in SYSCFG_PMC register) value to 0x00800000
    • Correct RCC_CFGR_PPRE2_DIV16 bit (in RCC_CFGR register) value to 0x0000E000
    • Correct some bits definition to be in line with naming used in the Reference Manual (RM0033)
      • GPIO_OTYPER_IDR_x changed to GPIO_IDR_IDR_x
      • GPIO_OTYPER_ODR_x changed to GPIO_ODR_ODR_x
      • SYSCFG_PMC_MII_RMII changed to SYSCFG_PMC_MII_RMII_SEL
      • RCC_APB2RSTR_SPI1 changed to RCC_APB2RSTR_SPI1RST
      • DBGMCU_APB1_FZ_DBG_IWDEG_STOP changed to DBGMCU_APB1_FZ_DBG_IWDG_STOP
    • GPIO_TypeDef structure: in the comment change AFR[2] address mapping to 0x20-0x24 instead of 0x24-0x28

V1.0.0 / 18-April-2011

Main -Changes

-
  • First official release for STM32F2xx devices
  • stm32f2xx.h
    • Add SYSCFG CMPCR register and bits definition 
    • Peripheral register's definitions: add description and address offset of each register
  • Add startup_stm32f2xx.s startup files for "gcc_ride7" and "TrueSTUDIO" compilers

V1.0.0RC1 / 11-March-2011

Main -Changes

-
  • Official version (V1.0.0) Release Candidate 1
  • stm32f2xx.h
    • Update file's header comments
    • Change "RNG_CR_IM" by "RNG_CR_IE"
    • Update "ETH_MACMIIAR_CR" bits definition
  • system_stm32f2xx.c
    • Implement SystemInit_ExtMemCtl() function
    • Change everywhere "STM3220F_EVAL" by "STM322xG_EVAL"
      • Update SystemCoreClockUpdate() function's header comments
- -
    -
-

License

- - -

Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this package except in compliance with the License. You may obtain a copy of the License at:


Unless -required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See -the License for the specific language governing permissions and -limitations under the License.
-
-
-

For -complete documentation on STM32 Microcontrollers -visit www.st.com/STM32

-
-

-
-
-

 

-
- \ No newline at end of file diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/TASKING/cstart_thumb2.asm b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/TASKING/cstart_thumb2.asm deleted file mode 100644 index 28f43aab0..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/TASKING/cstart_thumb2.asm +++ /dev/null @@ -1,140 +0,0 @@ - - -;; NOTE: To allow the use of this file for both ARMv6M and ARMv7M, -;; we will only use 16-bit Thumb intructions. - - .extern _lc_ub_stack ; usr/sys mode stack pointer - .extern _lc_ue_stack ; symbol required by debugger - .extern _lc_ub_table ; ROM to RAM copy table - .extern main - .extern _Exit - .extern exit - .weak exit - .global __get_argcv - .weak __get_argcv - .extern __argcvbuf - .weak __argcvbuf - ;;.extern __init_hardware - .extern SystemInit - - .if @defined('__PROF_ENABLE__') - .extern __prof_init - .endif - .if @defined('__POSIX__') - .extern posix_main - .extern _posix_boot_stack_top - .endif - - .global _START - - .section .text.cstart - - .thumb -_START: - ;; anticipate possible ROM/RAM remapping - ;; by loading the 'real' program address - ldr r1,=_Next - bx r1 -_Next: - ;; initialize the stack pointer - ldr r1,=_lc_ub_stack ; TODO: make this part of the vector table - mov sp,r1 - - ;; call a user function which initializes function. - bl SystemInit - - ;; copy initialized sections from ROM to RAM - ;; and clear uninitialized data sections in RAM - - ldr r3,=_lc_ub_table - movs r0,#0 -cploop: - ldr r4,[r3,#0] ; load type - ldr r5,[r3,#4] ; dst address - ldr r6,[r3,#8] ; src address - ldr r7,[r3,#12] ; size - - cmp r4,#1 - beq copy - cmp r4,#2 - beq clear - b done - -copy: - subs r7,r7,#1 - ldrb r1,[r6,r7] - strb r1,[r5,r7] - bne copy - - adds r3,r3,#16 - b cploop - -clear: - subs r7,r7,#1 - strb r0,[r5,r7] - bne clear - - adds r3,r3,#16 - b cploop - -done: - - .if @defined('__POSIX__') - - ;; posix stack buffer for system upbringing - ldr r0,=_posix_boot_stack_top - ldr r0, [r0] - mov sp,r0 - - .else - - ;; load r10 with end of USR/SYS stack, which is - ;; needed in case stack overflow checking is on - ;; NOTE: use 16-bit instructions only, for ARMv6M - ldr r0,=_lc_ue_stack - mov r10,r0 - - .endif - - .if @defined('__PROF_ENABLE__') - bl __prof_init - .endif - - .if @defined('__POSIX__') - ;; call posix_main with no arguments - bl posix_main - .else - ;; retrieve argc and argv (default argv[0]==NULL & argc==0) - bl __get_argcv - ldr r1,=__argcvbuf - ;; call main - bl main - .endif - - ;; call exit using the return value from main() - ;; Note. Calling exit will also run all functions - ;; that were supplied through atexit(). - bl exit - -__get_argcv: ; weak definition - movs r0,#0 - bx lr - - .ltorg - .endsec - - .calls '_START', ' ' - .calls '_START','__init_vector_table' - .if @defined('__PROF_ENABLE__') - .calls '_START','__prof_init' - .endif - .if @defined('__POSIX__') - .calls '_START','posix_main' - .else - .calls '_START','__get_argcv' - .calls '_START','main' - .endif - .calls '_START','exit' - .calls '_START','',0 - - .end diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/TrueSTUDIO/startup_stm32f2xx.s b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/TrueSTUDIO/startup_stm32f2xx.s deleted file mode 100644 index 20fd155c6..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/TrueSTUDIO/startup_stm32f2xx.s +++ /dev/null @@ -1,514 +0,0 @@ -/** - ****************************************************************************** - * @file startup_stm32f2xx.s - * @author MCD Application Team - * @version V1.1.3 - * @date 05-March-2012 - * @brief STM32F2xx Devices vector table for Atollic TrueSTUDIO toolchain. - * This module performs: - * - Set the initial SP - * - Set the initial PC == Reset_Handler, - * - Set the vector table entries with the exceptions ISR address - * - Configure the system clock and the external SRAM mounted on - * STM322xG-EVAL board to be used as data memory (optional, - * to be enabled by user) - * - Branches to main in the C library (which eventually - * calls main()). - * After Reset the Cortex-M3 processor is in Thread mode, - * priority is Privileged, and the Stack is set to Main. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - - .syntax unified - .cpu cortex-m3 - .fpu softvfp - .thumb - -.global g_pfnVectors -.global Default_Handler - -/* start address for the initialization values of the .data section. -defined in linker script */ -.word _sidata -/* start address for the .data section. defined in linker script */ -.word _sdata -/* end address for the .data section. defined in linker script */ -.word _edata -/* start address for the .bss section. defined in linker script */ -.word _sbss -/* end address for the .bss section. defined in linker script */ -.word _ebss -/* stack used for SystemInit_ExtMemCtl; always internal RAM used */ - -/** - * @brief This is the code that gets called when the processor first - * starts execution following a reset event. Only the absolutely - * necessary set is performed, after which the application - * supplied main() routine is called. - * @param None - * @retval : None -*/ - - .section .text.Reset_Handler - .weak Reset_Handler - .type Reset_Handler, %function -Reset_Handler: - -/* Copy the data segment initializers from flash to SRAM */ - movs r1, #0 - b LoopCopyDataInit - -CopyDataInit: - ldr r3, =_sidata - ldr r3, [r3, r1] - str r3, [r0, r1] - adds r1, r1, #4 - -LoopCopyDataInit: - ldr r0, =_sdata - ldr r3, =_edata - adds r2, r0, r1 - cmp r2, r3 - bcc CopyDataInit - ldr r2, =_sbss - b LoopFillZerobss -/* Zero fill the bss segment. */ -FillZerobss: - movs r3, #0 - str r3, [r2], #4 - -LoopFillZerobss: - ldr r3, = _ebss - cmp r2, r3 - bcc FillZerobss -/* Call the clock system intitialization function.*/ - bl SystemInit -/* Call static constructors */ - bl __libc_init_array -/* Call the application's entry point.*/ - bl main - bx lr -.size Reset_Handler, .-Reset_Handler - -/** - * @brief This is the code that gets called when the processor receives an - * unexpected interrupt. This simply enters an infinite loop, preserving - * the system state for examination by a debugger. - * @param None - * @retval None -*/ - .section .text.Default_Handler,"ax",%progbits -Default_Handler: -Infinite_Loop: - b Infinite_Loop - .size Default_Handler, .-Default_Handler -/****************************************************************************** -* -* The minimal vector table for a Cortex M3. Note that the proper constructs -* must be placed on this to ensure that it ends up at physical address -* 0x0000.0000. -* -*******************************************************************************/ - .section .isr_vector,"a",%progbits - .type g_pfnVectors, %object - .size g_pfnVectors, .-g_pfnVectors - - -g_pfnVectors: - .word _estack - .word Reset_Handler - .word NMI_Handler - .word HardFault_Handler - .word MemManage_Handler - .word BusFault_Handler - .word UsageFault_Handler - .word 0 - .word 0 - .word 0 - .word 0 - .word SVC_Handler - .word DebugMon_Handler - .word 0 - .word PendSV_Handler - .word SysTick_Handler - - /* External Interrupts */ - .word WWDG_IRQHandler /* Window WatchDog */ - .word PVD_IRQHandler /* PVD through EXTI Line detection */ - .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */ - .word RTC_WKUP_IRQHandler /* RTC Wakeup through the EXTI line */ - .word FLASH_IRQHandler /* FLASH */ - .word RCC_IRQHandler /* RCC */ - .word EXTI0_IRQHandler /* EXTI Line0 */ - .word EXTI1_IRQHandler /* EXTI Line1 */ - .word EXTI2_IRQHandler /* EXTI Line2 */ - .word EXTI3_IRQHandler /* EXTI Line3 */ - .word EXTI4_IRQHandler /* EXTI Line4 */ - .word DMA1_Stream0_IRQHandler /* DMA1 Stream 0 */ - .word DMA1_Stream1_IRQHandler /* DMA1 Stream 1 */ - .word DMA1_Stream2_IRQHandler /* DMA1 Stream 2 */ - .word DMA1_Stream3_IRQHandler /* DMA1 Stream 3 */ - .word DMA1_Stream4_IRQHandler /* DMA1 Stream 4 */ - .word DMA1_Stream5_IRQHandler /* DMA1 Stream 5 */ - .word DMA1_Stream6_IRQHandler /* DMA1 Stream 6 */ - .word ADC_IRQHandler /* ADC1, ADC2 and ADC3s */ - .word CAN1_TX_IRQHandler /* CAN1 TX */ - .word CAN1_RX0_IRQHandler /* CAN1 RX0 */ - .word CAN1_RX1_IRQHandler /* CAN1 RX1 */ - .word CAN1_SCE_IRQHandler /* CAN1 SCE */ - .word EXTI9_5_IRQHandler /* External Line[9:5]s */ - .word TIM1_BRK_TIM9_IRQHandler /* TIM1 Break and TIM9 */ - .word TIM1_UP_TIM10_IRQHandler /* TIM1 Update and TIM10 */ - .word TIM1_TRG_COM_TIM11_IRQHandler /* TIM1 Trigger and Commutation and TIM11 */ - .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ - .word TIM2_IRQHandler /* TIM2 */ - .word TIM3_IRQHandler /* TIM3 */ - .word TIM4_IRQHandler /* TIM4 */ - .word I2C1_EV_IRQHandler /* I2C1 Event */ - .word I2C1_ER_IRQHandler /* I2C1 Error */ - .word I2C2_EV_IRQHandler /* I2C2 Event */ - .word I2C2_ER_IRQHandler /* I2C2 Error */ - .word SPI1_IRQHandler /* SPI1 */ - .word SPI2_IRQHandler /* SPI2 */ - .word USART1_IRQHandler /* USART1 */ - .word USART2_IRQHandler /* USART2 */ - .word USART3_IRQHandler /* USART3 */ - .word EXTI15_10_IRQHandler /* External Line[15:10]s */ - .word RTC_Alarm_IRQHandler /* RTC Alarm (A and B) through EXTI Line */ - .word OTG_FS_WKUP_IRQHandler /* USB OTG FS Wakeup through EXTI line */ - .word TIM8_BRK_TIM12_IRQHandler /* TIM8 Break and TIM12 */ - .word TIM8_UP_TIM13_IRQHandler /* TIM8 Update and TIM13 */ - .word TIM8_TRG_COM_TIM14_IRQHandler /* TIM8 Trigger and Commutation and TIM14 */ - .word TIM8_CC_IRQHandler /* TIM8 Capture Compare */ - .word DMA1_Stream7_IRQHandler /* DMA1 Stream7 */ - .word FSMC_IRQHandler /* FSMC */ - .word SDIO_IRQHandler /* SDIO */ - .word TIM5_IRQHandler /* TIM5 */ - .word SPI3_IRQHandler /* SPI3 */ - .word UART4_IRQHandler /* UART4 */ - .word UART5_IRQHandler /* UART5 */ - .word TIM6_DAC_IRQHandler /* TIM6 and DAC1&2 underrun errors */ - .word TIM7_IRQHandler /* TIM7 */ - .word DMA2_Stream0_IRQHandler /* DMA2 Stream 0 */ - .word DMA2_Stream1_IRQHandler /* DMA2 Stream 1 */ - .word DMA2_Stream2_IRQHandler /* DMA2 Stream 2 */ - .word DMA2_Stream3_IRQHandler /* DMA2 Stream 3 */ - .word DMA2_Stream4_IRQHandler /* DMA2 Stream 4 */ - .word ETH_IRQHandler /* Ethernet */ - .word ETH_WKUP_IRQHandler /* Ethernet Wakeup through EXTI line */ - .word CAN2_TX_IRQHandler /* CAN2 TX */ - .word CAN2_RX0_IRQHandler /* CAN2 RX0 */ - .word CAN2_RX1_IRQHandler /* CAN2 RX1 */ - .word CAN2_SCE_IRQHandler /* CAN2 SCE */ - .word OTG_FS_IRQHandler /* USB OTG FS */ - .word DMA2_Stream5_IRQHandler /* DMA2 Stream 5 */ - .word DMA2_Stream6_IRQHandler /* DMA2 Stream 6 */ - .word DMA2_Stream7_IRQHandler /* DMA2 Stream 7 */ - .word USART6_IRQHandler /* USART6 */ - .word I2C3_EV_IRQHandler /* I2C3 event */ - .word I2C3_ER_IRQHandler /* I2C3 error */ - .word OTG_HS_EP1_OUT_IRQHandler /* USB OTG HS End Point 1 Out */ - .word OTG_HS_EP1_IN_IRQHandler /* USB OTG HS End Point 1 In */ - .word OTG_HS_WKUP_IRQHandler /* USB OTG HS Wakeup through EXTI */ - .word OTG_HS_IRQHandler /* USB OTG HS */ - .word DCMI_IRQHandler /* DCMI */ - .word CRYP_IRQHandler /* CRYP crypto */ - .word HASH_RNG_IRQHandler /* Hash and Rng */ - - -/******************************************************************************* -* -* Provide weak aliases for each Exception handler to the Default_Handler. -* As they are weak aliases, any function with the same name will override -* this definition. -* -*******************************************************************************/ - .weak NMI_Handler - .thumb_set NMI_Handler,Default_Handler - - .weak HardFault_Handler - .thumb_set HardFault_Handler,Default_Handler - - .weak MemManage_Handler - .thumb_set MemManage_Handler,Default_Handler - - .weak BusFault_Handler - .thumb_set BusFault_Handler,Default_Handler - - .weak UsageFault_Handler - .thumb_set UsageFault_Handler,Default_Handler - - .weak SVC_Handler - .thumb_set SVC_Handler,Default_Handler - - .weak DebugMon_Handler - .thumb_set DebugMon_Handler,Default_Handler - - .weak PendSV_Handler - .thumb_set PendSV_Handler,Default_Handler - - .weak SysTick_Handler - .thumb_set SysTick_Handler,Default_Handler - - .weak WWDG_IRQHandler - .thumb_set WWDG_IRQHandler,Default_Handler - - .weak PVD_IRQHandler - .thumb_set PVD_IRQHandler,Default_Handler - - .weak TAMP_STAMP_IRQHandler - .thumb_set TAMP_STAMP_IRQHandler,Default_Handler - - .weak RTC_WKUP_IRQHandler - .thumb_set RTC_WKUP_IRQHandler,Default_Handler - - .weak FLASH_IRQHandler - .thumb_set FLASH_IRQHandler,Default_Handler - - .weak RCC_IRQHandler - .thumb_set RCC_IRQHandler,Default_Handler - - .weak EXTI0_IRQHandler - .thumb_set EXTI0_IRQHandler,Default_Handler - - .weak EXTI1_IRQHandler - .thumb_set EXTI1_IRQHandler,Default_Handler - - .weak EXTI2_IRQHandler - .thumb_set EXTI2_IRQHandler,Default_Handler - - .weak EXTI3_IRQHandler - .thumb_set EXTI3_IRQHandler,Default_Handler - - .weak EXTI4_IRQHandler - .thumb_set EXTI4_IRQHandler,Default_Handler - - .weak DMA1_Stream0_IRQHandler - .thumb_set DMA1_Stream0_IRQHandler,Default_Handler - - .weak DMA1_Stream1_IRQHandler - .thumb_set DMA1_Stream1_IRQHandler,Default_Handler - - .weak DMA1_Stream2_IRQHandler - .thumb_set DMA1_Stream2_IRQHandler,Default_Handler - - .weak DMA1_Stream3_IRQHandler - .thumb_set DMA1_Stream3_IRQHandler,Default_Handler - - .weak DMA1_Stream4_IRQHandler - .thumb_set DMA1_Stream4_IRQHandler,Default_Handler - - .weak DMA1_Stream5_IRQHandler - .thumb_set DMA1_Stream5_IRQHandler,Default_Handler - - .weak DMA1_Stream6_IRQHandler - .thumb_set DMA1_Stream6_IRQHandler,Default_Handler - - .weak ADC_IRQHandler - .thumb_set ADC_IRQHandler,Default_Handler - - .weak CAN1_TX_IRQHandler - .thumb_set CAN1_TX_IRQHandler,Default_Handler - - .weak CAN1_RX0_IRQHandler - .thumb_set CAN1_RX0_IRQHandler,Default_Handler - - .weak CAN1_RX1_IRQHandler - .thumb_set CAN1_RX1_IRQHandler,Default_Handler - - .weak CAN1_SCE_IRQHandler - .thumb_set CAN1_SCE_IRQHandler,Default_Handler - - .weak EXTI9_5_IRQHandler - .thumb_set EXTI9_5_IRQHandler,Default_Handler - - .weak TIM1_BRK_TIM9_IRQHandler - .thumb_set TIM1_BRK_TIM9_IRQHandler,Default_Handler - - .weak TIM1_UP_TIM10_IRQHandler - .thumb_set TIM1_UP_TIM10_IRQHandler,Default_Handler - - .weak TIM1_TRG_COM_TIM11_IRQHandler - .thumb_set TIM1_TRG_COM_TIM11_IRQHandler,Default_Handler - - .weak TIM1_CC_IRQHandler - .thumb_set TIM1_CC_IRQHandler,Default_Handler - - .weak TIM2_IRQHandler - .thumb_set TIM2_IRQHandler,Default_Handler - - .weak TIM3_IRQHandler - .thumb_set TIM3_IRQHandler,Default_Handler - - .weak TIM4_IRQHandler - .thumb_set TIM4_IRQHandler,Default_Handler - - .weak I2C1_EV_IRQHandler - .thumb_set I2C1_EV_IRQHandler,Default_Handler - - .weak I2C1_ER_IRQHandler - .thumb_set I2C1_ER_IRQHandler,Default_Handler - - .weak I2C2_EV_IRQHandler - .thumb_set I2C2_EV_IRQHandler,Default_Handler - - .weak I2C2_ER_IRQHandler - .thumb_set I2C2_ER_IRQHandler,Default_Handler - - .weak SPI1_IRQHandler - .thumb_set SPI1_IRQHandler,Default_Handler - - .weak SPI2_IRQHandler - .thumb_set SPI2_IRQHandler,Default_Handler - - .weak USART1_IRQHandler - .thumb_set USART1_IRQHandler,Default_Handler - - .weak USART2_IRQHandler - .thumb_set USART2_IRQHandler,Default_Handler - - .weak USART3_IRQHandler - .thumb_set USART3_IRQHandler,Default_Handler - - .weak EXTI15_10_IRQHandler - .thumb_set EXTI15_10_IRQHandler,Default_Handler - - .weak RTC_Alarm_IRQHandler - .thumb_set RTC_Alarm_IRQHandler,Default_Handler - - .weak OTG_FS_WKUP_IRQHandler - .thumb_set OTG_FS_WKUP_IRQHandler,Default_Handler - - .weak TIM8_BRK_TIM12_IRQHandler - .thumb_set TIM8_BRK_TIM12_IRQHandler,Default_Handler - - .weak TIM8_UP_TIM13_IRQHandler - .thumb_set TIM8_UP_TIM13_IRQHandler,Default_Handler - - .weak TIM8_TRG_COM_TIM14_IRQHandler - .thumb_set TIM8_TRG_COM_TIM14_IRQHandler,Default_Handler - - .weak TIM8_CC_IRQHandler - .thumb_set TIM8_CC_IRQHandler,Default_Handler - - .weak DMA1_Stream7_IRQHandler - .thumb_set DMA1_Stream7_IRQHandler,Default_Handler - - .weak FSMC_IRQHandler - .thumb_set FSMC_IRQHandler,Default_Handler - - .weak SDIO_IRQHandler - .thumb_set SDIO_IRQHandler,Default_Handler - - .weak TIM5_IRQHandler - .thumb_set TIM5_IRQHandler,Default_Handler - - .weak SPI3_IRQHandler - .thumb_set SPI3_IRQHandler,Default_Handler - - .weak UART4_IRQHandler - .thumb_set UART4_IRQHandler,Default_Handler - - .weak UART5_IRQHandler - .thumb_set UART5_IRQHandler,Default_Handler - - .weak TIM6_DAC_IRQHandler - .thumb_set TIM6_DAC_IRQHandler,Default_Handler - - .weak TIM7_IRQHandler - .thumb_set TIM7_IRQHandler,Default_Handler - - .weak DMA2_Stream0_IRQHandler - .thumb_set DMA2_Stream0_IRQHandler,Default_Handler - - .weak DMA2_Stream1_IRQHandler - .thumb_set DMA2_Stream1_IRQHandler,Default_Handler - - .weak DMA2_Stream2_IRQHandler - .thumb_set DMA2_Stream2_IRQHandler,Default_Handler - - .weak DMA2_Stream3_IRQHandler - .thumb_set DMA2_Stream3_IRQHandler,Default_Handler - - .weak DMA2_Stream4_IRQHandler - .thumb_set DMA2_Stream4_IRQHandler,Default_Handler - - .weak ETH_IRQHandler - .thumb_set ETH_IRQHandler,Default_Handler - - .weak ETH_WKUP_IRQHandler - .thumb_set ETH_WKUP_IRQHandler,Default_Handler - - .weak CAN2_TX_IRQHandler - .thumb_set CAN2_TX_IRQHandler,Default_Handler - - .weak CAN2_RX0_IRQHandler - .thumb_set CAN2_RX0_IRQHandler,Default_Handler - - .weak CAN2_RX1_IRQHandler - .thumb_set CAN2_RX1_IRQHandler,Default_Handler - - .weak CAN2_SCE_IRQHandler - .thumb_set CAN2_SCE_IRQHandler,Default_Handler - - .weak OTG_FS_IRQHandler - .thumb_set OTG_FS_IRQHandler,Default_Handler - - .weak DMA2_Stream5_IRQHandler - .thumb_set DMA2_Stream5_IRQHandler,Default_Handler - - .weak DMA2_Stream6_IRQHandler - .thumb_set DMA2_Stream6_IRQHandler,Default_Handler - - .weak DMA2_Stream7_IRQHandler - .thumb_set DMA2_Stream7_IRQHandler,Default_Handler - - .weak USART6_IRQHandler - .thumb_set USART6_IRQHandler,Default_Handler - - .weak I2C3_EV_IRQHandler - .thumb_set I2C3_EV_IRQHandler,Default_Handler - - .weak I2C3_ER_IRQHandler - .thumb_set I2C3_ER_IRQHandler,Default_Handler - - .weak OTG_HS_EP1_OUT_IRQHandler - .thumb_set OTG_HS_EP1_OUT_IRQHandler,Default_Handler - - .weak OTG_HS_EP1_IN_IRQHandler - .thumb_set OTG_HS_EP1_IN_IRQHandler,Default_Handler - - .weak OTG_HS_WKUP_IRQHandler - .thumb_set OTG_HS_WKUP_IRQHandler,Default_Handler - - .weak OTG_HS_IRQHandler - .thumb_set OTG_HS_IRQHandler,Default_Handler - - .weak DCMI_IRQHandler - .thumb_set DCMI_IRQHandler,Default_Handler - - .weak CRYP_IRQHandler - .thumb_set CRYP_IRQHandler,Default_Handler - - .weak HASH_RNG_IRQHandler - .thumb_set HASH_RNG_IRQHandler,Default_Handler - - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/arm/startup_stm32f2xx.s b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/arm/startup_stm32f2xx.s deleted file mode 100644 index 65757dd85..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/arm/startup_stm32f2xx.s +++ /dev/null @@ -1,512 +0,0 @@ -/** - ****************************************************************************** - * @file startup_stm32f2xx.s - * @author MCD Application Team - * @version V1.1.3 - * @date 05-March-2012 - * @brief STM32F2xx Devices vector table for RIDE7 toolchain. - * This module performs: - * - Set the initial SP - * - Set the initial PC == Reset_Handler, - * - Set the vector table entries with the exceptions ISR address - * - Configure the system clock and the external SRAM mounted on - * STM322xG-EVAL board to be used as data memory (optional, - * to be enabled by user) - * - Branches to main in the C library (which eventually - * calls main()). - * After Reset the Cortex-M3 processor is in Thread mode, - * priority is Privileged, and the Stack is set to Main. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - - .syntax unified - .cpu cortex-m3 - .fpu softvfp - .thumb - -.global g_pfnVectors -.global Default_Handler - -/* start address for the initialization values of the .data section. -defined in linker script */ -.word _sidata -/* start address for the .data section. defined in linker script */ -.word _sdata -/* end address for the .data section. defined in linker script */ -.word _edata -/* start address for the .bss section. defined in linker script */ -.word _sbss -/* end address for the .bss section. defined in linker script */ -.word _ebss -/* stack used for SystemInit_ExtMemCtl; always internal RAM used */ - -/** - * @brief This is the code that gets called when the processor first - * starts execution following a reset event. Only the absolutely - * necessary set is performed, after which the application - * supplied main() routine is called. - * @param None - * @retval : None -*/ - - .section .text.Reset_Handler - .weak Reset_Handler - .type Reset_Handler, %function -Reset_Handler: - -/* Copy the data segment initializers from flash to SRAM */ - movs r1, #0 - b LoopCopyDataInit - -CopyDataInit: - ldr r3, =_sidata - ldr r3, [r3, r1] - str r3, [r0, r1] - adds r1, r1, #4 - -LoopCopyDataInit: - ldr r0, =_sdata - ldr r3, =_edata - adds r2, r0, r1 - cmp r2, r3 - bcc CopyDataInit - ldr r2, =_sbss - b LoopFillZerobss -/* Zero fill the bss segment. */ -FillZerobss: - movs r3, #0 - str r3, [r2], #4 - -LoopFillZerobss: - ldr r3, = _ebss - cmp r2, r3 - bcc FillZerobss -/* Call the clock system intitialization function.*/ - bl SystemInit -/* Call the application's entry point.*/ - bl main - bx lr -.size Reset_Handler, .-Reset_Handler - -/** - * @brief This is the code that gets called when the processor receives an - * unexpected interrupt. This simply enters an infinite loop, preserving - * the system state for examination by a debugger. - * @param None - * @retval None -*/ - .section .text.Default_Handler,"ax",%progbits -Default_Handler: -Infinite_Loop: - b Infinite_Loop - .size Default_Handler, .-Default_Handler -/****************************************************************************** -* -* The minimal vector table for a Cortex M3. Note that the proper constructs -* must be placed on this to ensure that it ends up at physical address -* 0x0000.0000. -* -*******************************************************************************/ - .section .isr_vector,"a",%progbits - .type g_pfnVectors, %object - .size g_pfnVectors, .-g_pfnVectors - - -g_pfnVectors: - .word _estack - .word Reset_Handler - .word NMI_Handler - .word HardFault_Handler - .word MemManage_Handler - .word BusFault_Handler - .word UsageFault_Handler - .word 0 - .word 0 - .word 0 - .word 0 - .word SVC_Handler - .word DebugMon_Handler - .word 0 - .word PendSV_Handler - .word SysTick_Handler - - /* External Interrupts */ - .word WWDG_IRQHandler /* Window WatchDog */ - .word PVD_IRQHandler /* PVD through EXTI Line detection */ - .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */ - .word RTC_WKUP_IRQHandler /* RTC Wakeup through the EXTI line */ - .word FLASH_IRQHandler /* FLASH */ - .word RCC_IRQHandler /* RCC */ - .word EXTI0_IRQHandler /* EXTI Line0 */ - .word EXTI1_IRQHandler /* EXTI Line1 */ - .word EXTI2_IRQHandler /* EXTI Line2 */ - .word EXTI3_IRQHandler /* EXTI Line3 */ - .word EXTI4_IRQHandler /* EXTI Line4 */ - .word DMA1_Stream0_IRQHandler /* DMA1 Stream 0 */ - .word DMA1_Stream1_IRQHandler /* DMA1 Stream 1 */ - .word DMA1_Stream2_IRQHandler /* DMA1 Stream 2 */ - .word DMA1_Stream3_IRQHandler /* DMA1 Stream 3 */ - .word DMA1_Stream4_IRQHandler /* DMA1 Stream 4 */ - .word DMA1_Stream5_IRQHandler /* DMA1 Stream 5 */ - .word DMA1_Stream6_IRQHandler /* DMA1 Stream 6 */ - .word ADC_IRQHandler /* ADC1, ADC2 and ADC3s */ - .word CAN1_TX_IRQHandler /* CAN1 TX */ - .word CAN1_RX0_IRQHandler /* CAN1 RX0 */ - .word CAN1_RX1_IRQHandler /* CAN1 RX1 */ - .word CAN1_SCE_IRQHandler /* CAN1 SCE */ - .word EXTI9_5_IRQHandler /* External Line[9:5]s */ - .word TIM1_BRK_TIM9_IRQHandler /* TIM1 Break and TIM9 */ - .word TIM1_UP_TIM10_IRQHandler /* TIM1 Update and TIM10 */ - .word TIM1_TRG_COM_TIM11_IRQHandler /* TIM1 Trigger and Commutation and TIM11 */ - .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ - .word TIM2_IRQHandler /* TIM2 */ - .word TIM3_IRQHandler /* TIM3 */ - .word TIM4_IRQHandler /* TIM4 */ - .word I2C1_EV_IRQHandler /* I2C1 Event */ - .word I2C1_ER_IRQHandler /* I2C1 Error */ - .word I2C2_EV_IRQHandler /* I2C2 Event */ - .word I2C2_ER_IRQHandler /* I2C2 Error */ - .word SPI1_IRQHandler /* SPI1 */ - .word SPI2_IRQHandler /* SPI2 */ - .word USART1_IRQHandler /* USART1 */ - .word USART2_IRQHandler /* USART2 */ - .word USART3_IRQHandler /* USART3 */ - .word EXTI15_10_IRQHandler /* External Line[15:10]s */ - .word RTC_Alarm_IRQHandler /* RTC Alarm (A and B) through EXTI Line */ - .word OTG_FS_WKUP_IRQHandler /* USB OTG FS Wakeup through EXTI line */ - .word TIM8_BRK_TIM12_IRQHandler /* TIM8 Break and TIM12 */ - .word TIM8_UP_TIM13_IRQHandler /* TIM8 Update and TIM13 */ - .word TIM8_TRG_COM_TIM14_IRQHandler /* TIM8 Trigger and Commutation and TIM14 */ - .word TIM8_CC_IRQHandler /* TIM8 Capture Compare */ - .word DMA1_Stream7_IRQHandler /* DMA1 Stream7 */ - .word FSMC_IRQHandler /* FSMC */ - .word SDIO_IRQHandler /* SDIO */ - .word TIM5_IRQHandler /* TIM5 */ - .word SPI3_IRQHandler /* SPI3 */ - .word UART4_IRQHandler /* UART4 */ - .word UART5_IRQHandler /* UART5 */ - .word TIM6_DAC_IRQHandler /* TIM6 and DAC1&2 underrun errors */ - .word TIM7_IRQHandler /* TIM7 */ - .word DMA2_Stream0_IRQHandler /* DMA2 Stream 0 */ - .word DMA2_Stream1_IRQHandler /* DMA2 Stream 1 */ - .word DMA2_Stream2_IRQHandler /* DMA2 Stream 2 */ - .word DMA2_Stream3_IRQHandler /* DMA2 Stream 3 */ - .word DMA2_Stream4_IRQHandler /* DMA2 Stream 4 */ - .word ETH_IRQHandler /* Ethernet */ - .word ETH_WKUP_IRQHandler /* Ethernet Wakeup through EXTI line */ - .word CAN2_TX_IRQHandler /* CAN2 TX */ - .word CAN2_RX0_IRQHandler /* CAN2 RX0 */ - .word CAN2_RX1_IRQHandler /* CAN2 RX1 */ - .word CAN2_SCE_IRQHandler /* CAN2 SCE */ - .word OTG_FS_IRQHandler /* USB OTG FS */ - .word DMA2_Stream5_IRQHandler /* DMA2 Stream 5 */ - .word DMA2_Stream6_IRQHandler /* DMA2 Stream 6 */ - .word DMA2_Stream7_IRQHandler /* DMA2 Stream 7 */ - .word USART6_IRQHandler /* USART6 */ - .word I2C3_EV_IRQHandler /* I2C3 event */ - .word I2C3_ER_IRQHandler /* I2C3 error */ - .word OTG_HS_EP1_OUT_IRQHandler /* USB OTG HS End Point 1 Out */ - .word OTG_HS_EP1_IN_IRQHandler /* USB OTG HS End Point 1 In */ - .word OTG_HS_WKUP_IRQHandler /* USB OTG HS Wakeup through EXTI */ - .word OTG_HS_IRQHandler /* USB OTG HS */ - .word DCMI_IRQHandler /* DCMI */ - .word CRYP_IRQHandler /* CRYP crypto */ - .word HASH_RNG_IRQHandler /* Hash and Rng */ - - -/******************************************************************************* -* -* Provide weak aliases for each Exception handler to the Default_Handler. -* As they are weak aliases, any function with the same name will override -* this definition. -* -*******************************************************************************/ - .weak NMI_Handler - .thumb_set NMI_Handler,Default_Handler - - .weak HardFault_Handler - .thumb_set HardFault_Handler,Default_Handler - - .weak MemManage_Handler - .thumb_set MemManage_Handler,Default_Handler - - .weak BusFault_Handler - .thumb_set BusFault_Handler,Default_Handler - - .weak UsageFault_Handler - .thumb_set UsageFault_Handler,Default_Handler - - .weak SVC_Handler - .thumb_set SVC_Handler,Default_Handler - - .weak DebugMon_Handler - .thumb_set DebugMon_Handler,Default_Handler - - .weak PendSV_Handler - .thumb_set PendSV_Handler,Default_Handler - - .weak SysTick_Handler - .thumb_set SysTick_Handler,Default_Handler - - .weak WWDG_IRQHandler - .thumb_set WWDG_IRQHandler,Default_Handler - - .weak PVD_IRQHandler - .thumb_set PVD_IRQHandler,Default_Handler - - .weak TAMP_STAMP_IRQHandler - .thumb_set TAMP_STAMP_IRQHandler,Default_Handler - - .weak RTC_WKUP_IRQHandler - .thumb_set RTC_WKUP_IRQHandler,Default_Handler - - .weak FLASH_IRQHandler - .thumb_set FLASH_IRQHandler,Default_Handler - - .weak RCC_IRQHandler - .thumb_set RCC_IRQHandler,Default_Handler - - .weak EXTI0_IRQHandler - .thumb_set EXTI0_IRQHandler,Default_Handler - - .weak EXTI1_IRQHandler - .thumb_set EXTI1_IRQHandler,Default_Handler - - .weak EXTI2_IRQHandler - .thumb_set EXTI2_IRQHandler,Default_Handler - - .weak EXTI3_IRQHandler - .thumb_set EXTI3_IRQHandler,Default_Handler - - .weak EXTI4_IRQHandler - .thumb_set EXTI4_IRQHandler,Default_Handler - - .weak DMA1_Stream0_IRQHandler - .thumb_set DMA1_Stream0_IRQHandler,Default_Handler - - .weak DMA1_Stream1_IRQHandler - .thumb_set DMA1_Stream1_IRQHandler,Default_Handler - - .weak DMA1_Stream2_IRQHandler - .thumb_set DMA1_Stream2_IRQHandler,Default_Handler - - .weak DMA1_Stream3_IRQHandler - .thumb_set DMA1_Stream3_IRQHandler,Default_Handler - - .weak DMA1_Stream4_IRQHandler - .thumb_set DMA1_Stream4_IRQHandler,Default_Handler - - .weak DMA1_Stream5_IRQHandler - .thumb_set DMA1_Stream5_IRQHandler,Default_Handler - - .weak DMA1_Stream6_IRQHandler - .thumb_set DMA1_Stream6_IRQHandler,Default_Handler - - .weak ADC_IRQHandler - .thumb_set ADC_IRQHandler,Default_Handler - - .weak CAN1_TX_IRQHandler - .thumb_set CAN1_TX_IRQHandler,Default_Handler - - .weak CAN1_RX0_IRQHandler - .thumb_set CAN1_RX0_IRQHandler,Default_Handler - - .weak CAN1_RX1_IRQHandler - .thumb_set CAN1_RX1_IRQHandler,Default_Handler - - .weak CAN1_SCE_IRQHandler - .thumb_set CAN1_SCE_IRQHandler,Default_Handler - - .weak EXTI9_5_IRQHandler - .thumb_set EXTI9_5_IRQHandler,Default_Handler - - .weak TIM1_BRK_TIM9_IRQHandler - .thumb_set TIM1_BRK_TIM9_IRQHandler,Default_Handler - - .weak TIM1_UP_TIM10_IRQHandler - .thumb_set TIM1_UP_TIM10_IRQHandler,Default_Handler - - .weak TIM1_TRG_COM_TIM11_IRQHandler - .thumb_set TIM1_TRG_COM_TIM11_IRQHandler,Default_Handler - - .weak TIM1_CC_IRQHandler - .thumb_set TIM1_CC_IRQHandler,Default_Handler - - .weak TIM2_IRQHandler - .thumb_set TIM2_IRQHandler,Default_Handler - - .weak TIM3_IRQHandler - .thumb_set TIM3_IRQHandler,Default_Handler - - .weak TIM4_IRQHandler - .thumb_set TIM4_IRQHandler,Default_Handler - - .weak I2C1_EV_IRQHandler - .thumb_set I2C1_EV_IRQHandler,Default_Handler - - .weak I2C1_ER_IRQHandler - .thumb_set I2C1_ER_IRQHandler,Default_Handler - - .weak I2C2_EV_IRQHandler - .thumb_set I2C2_EV_IRQHandler,Default_Handler - - .weak I2C2_ER_IRQHandler - .thumb_set I2C2_ER_IRQHandler,Default_Handler - - .weak SPI1_IRQHandler - .thumb_set SPI1_IRQHandler,Default_Handler - - .weak SPI2_IRQHandler - .thumb_set SPI2_IRQHandler,Default_Handler - - .weak USART1_IRQHandler - .thumb_set USART1_IRQHandler,Default_Handler - - .weak USART2_IRQHandler - .thumb_set USART2_IRQHandler,Default_Handler - - .weak USART3_IRQHandler - .thumb_set USART3_IRQHandler,Default_Handler - - .weak EXTI15_10_IRQHandler - .thumb_set EXTI15_10_IRQHandler,Default_Handler - - .weak RTC_Alarm_IRQHandler - .thumb_set RTC_Alarm_IRQHandler,Default_Handler - - .weak OTG_FS_WKUP_IRQHandler - .thumb_set OTG_FS_WKUP_IRQHandler,Default_Handler - - .weak TIM8_BRK_TIM12_IRQHandler - .thumb_set TIM8_BRK_TIM12_IRQHandler,Default_Handler - - .weak TIM8_UP_TIM13_IRQHandler - .thumb_set TIM8_UP_TIM13_IRQHandler,Default_Handler - - .weak TIM8_TRG_COM_TIM14_IRQHandler - .thumb_set TIM8_TRG_COM_TIM14_IRQHandler,Default_Handler - - .weak TIM8_CC_IRQHandler - .thumb_set TIM8_CC_IRQHandler,Default_Handler - - .weak DMA1_Stream7_IRQHandler - .thumb_set DMA1_Stream7_IRQHandler,Default_Handler - - .weak FSMC_IRQHandler - .thumb_set FSMC_IRQHandler,Default_Handler - - .weak SDIO_IRQHandler - .thumb_set SDIO_IRQHandler,Default_Handler - - .weak TIM5_IRQHandler - .thumb_set TIM5_IRQHandler,Default_Handler - - .weak SPI3_IRQHandler - .thumb_set SPI3_IRQHandler,Default_Handler - - .weak UART4_IRQHandler - .thumb_set UART4_IRQHandler,Default_Handler - - .weak UART5_IRQHandler - .thumb_set UART5_IRQHandler,Default_Handler - - .weak TIM6_DAC_IRQHandler - .thumb_set TIM6_DAC_IRQHandler,Default_Handler - - .weak TIM7_IRQHandler - .thumb_set TIM7_IRQHandler,Default_Handler - - .weak DMA2_Stream0_IRQHandler - .thumb_set DMA2_Stream0_IRQHandler,Default_Handler - - .weak DMA2_Stream1_IRQHandler - .thumb_set DMA2_Stream1_IRQHandler,Default_Handler - - .weak DMA2_Stream2_IRQHandler - .thumb_set DMA2_Stream2_IRQHandler,Default_Handler - - .weak DMA2_Stream3_IRQHandler - .thumb_set DMA2_Stream3_IRQHandler,Default_Handler - - .weak DMA2_Stream4_IRQHandler - .thumb_set DMA2_Stream4_IRQHandler,Default_Handler - - .weak ETH_IRQHandler - .thumb_set ETH_IRQHandler,Default_Handler - - .weak ETH_WKUP_IRQHandler - .thumb_set ETH_WKUP_IRQHandler,Default_Handler - - .weak CAN2_TX_IRQHandler - .thumb_set CAN2_TX_IRQHandler,Default_Handler - - .weak CAN2_RX0_IRQHandler - .thumb_set CAN2_RX0_IRQHandler,Default_Handler - - .weak CAN2_RX1_IRQHandler - .thumb_set CAN2_RX1_IRQHandler,Default_Handler - - .weak CAN2_SCE_IRQHandler - .thumb_set CAN2_SCE_IRQHandler,Default_Handler - - .weak OTG_FS_IRQHandler - .thumb_set OTG_FS_IRQHandler,Default_Handler - - .weak DMA2_Stream5_IRQHandler - .thumb_set DMA2_Stream5_IRQHandler,Default_Handler - - .weak DMA2_Stream6_IRQHandler - .thumb_set DMA2_Stream6_IRQHandler,Default_Handler - - .weak DMA2_Stream7_IRQHandler - .thumb_set DMA2_Stream7_IRQHandler,Default_Handler - - .weak USART6_IRQHandler - .thumb_set USART6_IRQHandler,Default_Handler - - .weak I2C3_EV_IRQHandler - .thumb_set I2C3_EV_IRQHandler,Default_Handler - - .weak I2C3_ER_IRQHandler - .thumb_set I2C3_ER_IRQHandler,Default_Handler - - .weak OTG_HS_EP1_OUT_IRQHandler - .thumb_set OTG_HS_EP1_OUT_IRQHandler,Default_Handler - - .weak OTG_HS_EP1_IN_IRQHandler - .thumb_set OTG_HS_EP1_IN_IRQHandler,Default_Handler - - .weak OTG_HS_WKUP_IRQHandler - .thumb_set OTG_HS_WKUP_IRQHandler,Default_Handler - - .weak OTG_HS_IRQHandler - .thumb_set OTG_HS_IRQHandler,Default_Handler - - .weak DCMI_IRQHandler - .thumb_set DCMI_IRQHandler,Default_Handler - - .weak CRYP_IRQHandler - .thumb_set CRYP_IRQHandler,Default_Handler - - .weak HASH_RNG_IRQHandler - .thumb_set HASH_RNG_IRQHandler,Default_Handler - - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/iar/startup_stm32f2xx.s b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/iar/startup_stm32f2xx.s deleted file mode 100644 index ba2457912..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/iar/startup_stm32f2xx.s +++ /dev/null @@ -1,629 +0,0 @@ -;/******************** (C) COPYRIGHT 2012 STMicroelectronics ******************** -;* File Name : startup_stm32f2xx.s -;* Author : MCD Application Team -;* Version : V1.1.3 -;* Date : 05-March-2012 -;* Description : STM32F2xx devices vector table for EWARM toolchain. -;* This module performs: -;* - Set the initial SP -;* - Set the initial PC == __iar_program_start, -;* - Set the vector table entries with the exceptions ISR -;* address. -;* - Configure the system clock and the external SRAM mounted on -;* STM322xG-EVAL board to be used as data memory (optional, -;* to be enabled by user) -;* - Branches to main in the C library (which eventually -;* calls main()). -;* After Reset the Cortex-M3 processor is in Thread mode, -;* priority is Privileged, and the Stack is set to Main. -;******************************************************************************** -;* -;* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); -;* You may not use this file except in compliance with the License. -;* You may obtain a copy of the License at: -;* -;* http://www.st.com/software_license_agreement_liberty_v2 -;* -;* Unless required by applicable law or agreed to in writing, software -;* distributed under the License is distributed on an "AS IS" BASIS, -;* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;* See the License for the specific language governing permissions and -;* limitations under the License. -;* -;*******************************************************************************/ -; -; -; The modules in this file are included in the libraries, and may be replaced -; by any user-defined modules that define the PUBLIC symbol _program_start or -; a user defined start symbol. -; To override the cstartup defined in the library, simply add your modified -; version to the workbench project. -; -; The vector table is normally located at address 0. -; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. -; The name "__vector_table" has special meaning for C-SPY: -; it is where the SP start value is found, and the NVIC vector -; table register (VTOR) is initialized to this address if != 0. -; -; Cortex-M version -; - - MODULE ?cstartup - - ;; Forward declaration of sections. - SECTION CSTACK:DATA:NOROOT(3) - - SECTION .intvec:CODE:NOROOT(2) - - EXTERN __iar_program_start - EXTERN SystemInit - PUBLIC __vector_table - - DATA -__vector_table - DCD sfe(CSTACK) - DCD Reset_Handler ; Reset Handler - - DCD NMI_Handler ; NMI Handler - DCD HardFault_Handler ; Hard Fault Handler - DCD MemManage_Handler ; MPU Fault Handler - DCD BusFault_Handler ; Bus Fault Handler - DCD UsageFault_Handler ; Usage Fault Handler - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD SVC_Handler ; SVCall Handler - DCD DebugMon_Handler ; Debug Monitor Handler - DCD 0 ; Reserved - DCD PendSV_Handler ; PendSV Handler - DCD SysTick_Handler ; SysTick Handler - - ; External Interrupts - DCD WWDG_IRQHandler ; Window WatchDog - DCD PVD_IRQHandler ; PVD through EXTI Line detection - DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line - DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line - DCD FLASH_IRQHandler ; FLASH - DCD RCC_IRQHandler ; RCC - DCD EXTI0_IRQHandler ; EXTI Line0 - DCD EXTI1_IRQHandler ; EXTI Line1 - DCD EXTI2_IRQHandler ; EXTI Line2 - DCD EXTI3_IRQHandler ; EXTI Line3 - DCD EXTI4_IRQHandler ; EXTI Line4 - DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 - DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 - DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 - DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 - DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 - DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 - DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 - DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s - DCD CAN1_TX_IRQHandler ; CAN1 TX - DCD CAN1_RX0_IRQHandler ; CAN1 RX0 - DCD CAN1_RX1_IRQHandler ; CAN1 RX1 - DCD CAN1_SCE_IRQHandler ; CAN1 SCE - DCD EXTI9_5_IRQHandler ; External Line[9:5]s - DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9 - DCD TIM1_UP_TIM10_IRQHandler ; TIM1 Update and TIM10 - DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 - DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare - DCD TIM2_IRQHandler ; TIM2 - DCD TIM3_IRQHandler ; TIM3 - DCD TIM4_IRQHandler ; TIM4 - DCD I2C1_EV_IRQHandler ; I2C1 Event - DCD I2C1_ER_IRQHandler ; I2C1 Error - DCD I2C2_EV_IRQHandler ; I2C2 Event - DCD I2C2_ER_IRQHandler ; I2C2 Error - DCD SPI1_IRQHandler ; SPI1 - DCD SPI2_IRQHandler ; SPI2 - DCD USART1_IRQHandler ; USART1 - DCD USART2_IRQHandler ; USART2 - DCD USART3_IRQHandler ; USART3 - DCD EXTI15_10_IRQHandler ; External Line[15:10]s - DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line - DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line - DCD TIM8_BRK_TIM12_IRQHandler ; TIM8 Break and TIM12 - DCD TIM8_UP_TIM13_IRQHandler ; TIM8 Update and TIM13 - DCD TIM8_TRG_COM_TIM14_IRQHandler ; TIM8 Trigger and Commutation and TIM14 - DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare - DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 - DCD FSMC_IRQHandler ; FSMC - DCD SDIO_IRQHandler ; SDIO - DCD TIM5_IRQHandler ; TIM5 - DCD SPI3_IRQHandler ; SPI3 - DCD UART4_IRQHandler ; UART4 - DCD UART5_IRQHandler ; UART5 - DCD TIM6_DAC_IRQHandler ; TIM6 and DAC1&2 underrun errors - DCD TIM7_IRQHandler ; TIM7 - DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 - DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 - DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 - DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 - DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 - DCD ETH_IRQHandler ; Ethernet - DCD ETH_WKUP_IRQHandler ; Ethernet Wakeup through EXTI line - DCD CAN2_TX_IRQHandler ; CAN2 TX - DCD CAN2_RX0_IRQHandler ; CAN2 RX0 - DCD CAN2_RX1_IRQHandler ; CAN2 RX1 - DCD CAN2_SCE_IRQHandler ; CAN2 SCE - DCD OTG_FS_IRQHandler ; USB OTG FS - DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 - DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 - DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 - DCD USART6_IRQHandler ; USART6 - DCD I2C3_EV_IRQHandler ; I2C3 event - DCD I2C3_ER_IRQHandler ; I2C3 error - DCD OTG_HS_EP1_OUT_IRQHandler ; USB OTG HS End Point 1 Out - DCD OTG_HS_EP1_IN_IRQHandler ; USB OTG HS End Point 1 In - DCD OTG_HS_WKUP_IRQHandler ; USB OTG HS Wakeup through EXTI - DCD OTG_HS_IRQHandler ; USB OTG HS - DCD DCMI_IRQHandler ; DCMI - DCD CRYP_IRQHandler ; CRYP crypto - DCD HASH_RNG_IRQHandler ; Hash and Rng - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; Default interrupt handlers. -;; - THUMB - PUBWEAK Reset_Handler - SECTION .text:CODE:REORDER(2) -Reset_Handler - LDR R0, =SystemInit - BLX R0 - LDR R0, =__iar_program_start - BX R0 - - PUBWEAK NMI_Handler - SECTION .text:CODE:REORDER(1) -NMI_Handler - B NMI_Handler - - PUBWEAK HardFault_Handler - SECTION .text:CODE:REORDER(1) -HardFault_Handler - B HardFault_Handler - - PUBWEAK MemManage_Handler - SECTION .text:CODE:REORDER(1) -MemManage_Handler - B MemManage_Handler - - PUBWEAK BusFault_Handler - SECTION .text:CODE:REORDER(1) -BusFault_Handler - B BusFault_Handler - - PUBWEAK UsageFault_Handler - SECTION .text:CODE:REORDER(1) -UsageFault_Handler - B UsageFault_Handler - - PUBWEAK SVC_Handler - SECTION .text:CODE:REORDER(1) -SVC_Handler - B SVC_Handler - - PUBWEAK DebugMon_Handler - SECTION .text:CODE:REORDER(1) -DebugMon_Handler - B DebugMon_Handler - - PUBWEAK PendSV_Handler - SECTION .text:CODE:REORDER(1) -PendSV_Handler - B PendSV_Handler - - PUBWEAK SysTick_Handler - SECTION .text:CODE:REORDER(1) -SysTick_Handler - B SysTick_Handler - - PUBWEAK WWDG_IRQHandler - SECTION .text:CODE:REORDER(1) -WWDG_IRQHandler - B WWDG_IRQHandler - - PUBWEAK PVD_IRQHandler - SECTION .text:CODE:REORDER(1) -PVD_IRQHandler - B PVD_IRQHandler - - PUBWEAK TAMP_STAMP_IRQHandler - SECTION .text:CODE:REORDER(1) -TAMP_STAMP_IRQHandler - B TAMP_STAMP_IRQHandler - - PUBWEAK RTC_WKUP_IRQHandler - SECTION .text:CODE:REORDER(1) -RTC_WKUP_IRQHandler - B RTC_WKUP_IRQHandler - - PUBWEAK FLASH_IRQHandler - SECTION .text:CODE:REORDER(1) -FLASH_IRQHandler - B FLASH_IRQHandler - - PUBWEAK RCC_IRQHandler - SECTION .text:CODE:REORDER(1) -RCC_IRQHandler - B RCC_IRQHandler - - PUBWEAK EXTI0_IRQHandler - SECTION .text:CODE:REORDER(1) -EXTI0_IRQHandler - B EXTI0_IRQHandler - - PUBWEAK EXTI1_IRQHandler - SECTION .text:CODE:REORDER(1) -EXTI1_IRQHandler - B EXTI1_IRQHandler - - PUBWEAK EXTI2_IRQHandler - SECTION .text:CODE:REORDER(1) -EXTI2_IRQHandler - B EXTI2_IRQHandler - - PUBWEAK EXTI3_IRQHandler - SECTION .text:CODE:REORDER(1) -EXTI3_IRQHandler - B EXTI3_IRQHandler - - PUBWEAK EXTI4_IRQHandler - SECTION .text:CODE:REORDER(1) -EXTI4_IRQHandler - B EXTI4_IRQHandler - - PUBWEAK DMA1_Stream0_IRQHandler - SECTION .text:CODE:REORDER(1) -DMA1_Stream0_IRQHandler - B DMA1_Stream0_IRQHandler - - PUBWEAK DMA1_Stream1_IRQHandler - SECTION .text:CODE:REORDER(1) -DMA1_Stream1_IRQHandler - B DMA1_Stream1_IRQHandler - - PUBWEAK DMA1_Stream2_IRQHandler - SECTION .text:CODE:REORDER(1) -DMA1_Stream2_IRQHandler - B DMA1_Stream2_IRQHandler - - PUBWEAK DMA1_Stream3_IRQHandler - SECTION .text:CODE:REORDER(1) -DMA1_Stream3_IRQHandler - B DMA1_Stream3_IRQHandler - - PUBWEAK DMA1_Stream4_IRQHandler - SECTION .text:CODE:REORDER(1) -DMA1_Stream4_IRQHandler - B DMA1_Stream4_IRQHandler - - PUBWEAK DMA1_Stream5_IRQHandler - SECTION .text:CODE:REORDER(1) -DMA1_Stream5_IRQHandler - B DMA1_Stream5_IRQHandler - - PUBWEAK DMA1_Stream6_IRQHandler - SECTION .text:CODE:REORDER(1) -DMA1_Stream6_IRQHandler - B DMA1_Stream6_IRQHandler - - PUBWEAK ADC_IRQHandler - SECTION .text:CODE:REORDER(1) -ADC_IRQHandler - B ADC_IRQHandler - - PUBWEAK CAN1_TX_IRQHandler - SECTION .text:CODE:REORDER(1) -CAN1_TX_IRQHandler - B CAN1_TX_IRQHandler - - PUBWEAK CAN1_RX0_IRQHandler - SECTION .text:CODE:REORDER(1) -CAN1_RX0_IRQHandler - B CAN1_RX0_IRQHandler - - PUBWEAK CAN1_RX1_IRQHandler - SECTION .text:CODE:REORDER(1) -CAN1_RX1_IRQHandler - B CAN1_RX1_IRQHandler - - PUBWEAK CAN1_SCE_IRQHandler - SECTION .text:CODE:REORDER(1) -CAN1_SCE_IRQHandler - B CAN1_SCE_IRQHandler - - PUBWEAK EXTI9_5_IRQHandler - SECTION .text:CODE:REORDER(1) -EXTI9_5_IRQHandler - B EXTI9_5_IRQHandler - - PUBWEAK TIM1_BRK_TIM9_IRQHandler - SECTION .text:CODE:REORDER(1) -TIM1_BRK_TIM9_IRQHandler - B TIM1_BRK_TIM9_IRQHandler - - PUBWEAK TIM1_UP_TIM10_IRQHandler - SECTION .text:CODE:REORDER(1) -TIM1_UP_TIM10_IRQHandler - B TIM1_UP_TIM10_IRQHandler - - PUBWEAK TIM1_TRG_COM_TIM11_IRQHandler - SECTION .text:CODE:REORDER(1) -TIM1_TRG_COM_TIM11_IRQHandler - B TIM1_TRG_COM_TIM11_IRQHandler - - PUBWEAK TIM1_CC_IRQHandler - SECTION .text:CODE:REORDER(1) -TIM1_CC_IRQHandler - B TIM1_CC_IRQHandler - - PUBWEAK TIM2_IRQHandler - SECTION .text:CODE:REORDER(1) -TIM2_IRQHandler - B TIM2_IRQHandler - - PUBWEAK TIM3_IRQHandler - SECTION .text:CODE:REORDER(1) -TIM3_IRQHandler - B TIM3_IRQHandler - - PUBWEAK TIM4_IRQHandler - SECTION .text:CODE:REORDER(1) -TIM4_IRQHandler - B TIM4_IRQHandler - - PUBWEAK I2C1_EV_IRQHandler - SECTION .text:CODE:REORDER(1) -I2C1_EV_IRQHandler - B I2C1_EV_IRQHandler - - PUBWEAK I2C1_ER_IRQHandler - SECTION .text:CODE:REORDER(1) -I2C1_ER_IRQHandler - B I2C1_ER_IRQHandler - - PUBWEAK I2C2_EV_IRQHandler - SECTION .text:CODE:REORDER(1) -I2C2_EV_IRQHandler - B I2C2_EV_IRQHandler - - PUBWEAK I2C2_ER_IRQHandler - SECTION .text:CODE:REORDER(1) -I2C2_ER_IRQHandler - B I2C2_ER_IRQHandler - - PUBWEAK SPI1_IRQHandler - SECTION .text:CODE:REORDER(1) -SPI1_IRQHandler - B SPI1_IRQHandler - - PUBWEAK SPI2_IRQHandler - SECTION .text:CODE:REORDER(1) -SPI2_IRQHandler - B SPI2_IRQHandler - - PUBWEAK USART1_IRQHandler - SECTION .text:CODE:REORDER(1) -USART1_IRQHandler - B USART1_IRQHandler - - PUBWEAK USART2_IRQHandler - SECTION .text:CODE:REORDER(1) -USART2_IRQHandler - B USART2_IRQHandler - - PUBWEAK USART3_IRQHandler - SECTION .text:CODE:REORDER(1) -USART3_IRQHandler - B USART3_IRQHandler - - PUBWEAK EXTI15_10_IRQHandler - SECTION .text:CODE:REORDER(1) -EXTI15_10_IRQHandler - B EXTI15_10_IRQHandler - - PUBWEAK RTC_Alarm_IRQHandler - SECTION .text:CODE:REORDER(1) -RTC_Alarm_IRQHandler - B RTC_Alarm_IRQHandler - - PUBWEAK OTG_FS_WKUP_IRQHandler - SECTION .text:CODE:REORDER(1) -OTG_FS_WKUP_IRQHandler - B OTG_FS_WKUP_IRQHandler - - PUBWEAK TIM8_BRK_TIM12_IRQHandler - SECTION .text:CODE:REORDER(1) -TIM8_BRK_TIM12_IRQHandler - B TIM8_BRK_TIM12_IRQHandler - - PUBWEAK TIM8_UP_TIM13_IRQHandler - SECTION .text:CODE:REORDER(1) -TIM8_UP_TIM13_IRQHandler - B TIM8_UP_TIM13_IRQHandler - - PUBWEAK TIM8_TRG_COM_TIM14_IRQHandler - SECTION .text:CODE:REORDER(1) -TIM8_TRG_COM_TIM14_IRQHandler - B TIM8_TRG_COM_TIM14_IRQHandler - - PUBWEAK TIM8_CC_IRQHandler - SECTION .text:CODE:REORDER(1) -TIM8_CC_IRQHandler - B TIM8_CC_IRQHandler - - PUBWEAK DMA1_Stream7_IRQHandler - SECTION .text:CODE:REORDER(1) -DMA1_Stream7_IRQHandler - B DMA1_Stream7_IRQHandler - - PUBWEAK FSMC_IRQHandler - SECTION .text:CODE:REORDER(1) -FSMC_IRQHandler - B FSMC_IRQHandler - - PUBWEAK SDIO_IRQHandler - SECTION .text:CODE:REORDER(1) -SDIO_IRQHandler - B SDIO_IRQHandler - - PUBWEAK TIM5_IRQHandler - SECTION .text:CODE:REORDER(1) -TIM5_IRQHandler - B TIM5_IRQHandler - - PUBWEAK SPI3_IRQHandler - SECTION .text:CODE:REORDER(1) -SPI3_IRQHandler - B SPI3_IRQHandler - - PUBWEAK UART4_IRQHandler - SECTION .text:CODE:REORDER(1) -UART4_IRQHandler - B UART4_IRQHandler - - PUBWEAK UART5_IRQHandler - SECTION .text:CODE:REORDER(1) -UART5_IRQHandler - B UART5_IRQHandler - - PUBWEAK TIM6_DAC_IRQHandler - SECTION .text:CODE:REORDER(1) -TIM6_DAC_IRQHandler - B TIM6_DAC_IRQHandler - - PUBWEAK TIM7_IRQHandler - SECTION .text:CODE:REORDER(1) -TIM7_IRQHandler - B TIM7_IRQHandler - - PUBWEAK DMA2_Stream0_IRQHandler - SECTION .text:CODE:REORDER(1) -DMA2_Stream0_IRQHandler - B DMA2_Stream0_IRQHandler - - PUBWEAK DMA2_Stream1_IRQHandler - SECTION .text:CODE:REORDER(1) -DMA2_Stream1_IRQHandler - B DMA2_Stream1_IRQHandler - - PUBWEAK DMA2_Stream2_IRQHandler - SECTION .text:CODE:REORDER(1) -DMA2_Stream2_IRQHandler - B DMA2_Stream2_IRQHandler - - PUBWEAK DMA2_Stream3_IRQHandler - SECTION .text:CODE:REORDER(1) -DMA2_Stream3_IRQHandler - B DMA2_Stream3_IRQHandler - - PUBWEAK DMA2_Stream4_IRQHandler - SECTION .text:CODE:REORDER(1) -DMA2_Stream4_IRQHandler - B DMA2_Stream4_IRQHandler - - PUBWEAK ETH_IRQHandler - SECTION .text:CODE:REORDER(1) -ETH_IRQHandler - B ETH_IRQHandler - - PUBWEAK ETH_WKUP_IRQHandler - SECTION .text:CODE:REORDER(1) -ETH_WKUP_IRQHandler - B ETH_WKUP_IRQHandler - - PUBWEAK CAN2_TX_IRQHandler - SECTION .text:CODE:REORDER(1) -CAN2_TX_IRQHandler - B CAN2_TX_IRQHandler - - PUBWEAK CAN2_RX0_IRQHandler - SECTION .text:CODE:REORDER(1) -CAN2_RX0_IRQHandler - B CAN2_RX0_IRQHandler - - PUBWEAK CAN2_RX1_IRQHandler - SECTION .text:CODE:REORDER(1) -CAN2_RX1_IRQHandler - B CAN2_RX1_IRQHandler - - PUBWEAK CAN2_SCE_IRQHandler - SECTION .text:CODE:REORDER(1) -CAN2_SCE_IRQHandler - B CAN2_SCE_IRQHandler - - PUBWEAK OTG_FS_IRQHandler - SECTION .text:CODE:REORDER(1) -OTG_FS_IRQHandler - B OTG_FS_IRQHandler - - PUBWEAK DMA2_Stream5_IRQHandler - SECTION .text:CODE:REORDER(1) -DMA2_Stream5_IRQHandler - B DMA2_Stream5_IRQHandler - - PUBWEAK DMA2_Stream6_IRQHandler - SECTION .text:CODE:REORDER(1) -DMA2_Stream6_IRQHandler - B DMA2_Stream6_IRQHandler - - PUBWEAK DMA2_Stream7_IRQHandler - SECTION .text:CODE:REORDER(1) -DMA2_Stream7_IRQHandler - B DMA2_Stream7_IRQHandler - - PUBWEAK USART6_IRQHandler - SECTION .text:CODE:REORDER(1) -USART6_IRQHandler - B USART6_IRQHandler - - PUBWEAK I2C3_EV_IRQHandler - SECTION .text:CODE:REORDER(1) -I2C3_EV_IRQHandler - B I2C3_EV_IRQHandler - - PUBWEAK I2C3_ER_IRQHandler - SECTION .text:CODE:REORDER(1) -I2C3_ER_IRQHandler - B I2C3_ER_IRQHandler - - PUBWEAK OTG_HS_EP1_OUT_IRQHandler - SECTION .text:CODE:REORDER(1) -OTG_HS_EP1_OUT_IRQHandler - B OTG_HS_EP1_OUT_IRQHandler - - PUBWEAK OTG_HS_EP1_IN_IRQHandler - SECTION .text:CODE:REORDER(1) -OTG_HS_EP1_IN_IRQHandler - B OTG_HS_EP1_IN_IRQHandler - - PUBWEAK OTG_HS_WKUP_IRQHandler - SECTION .text:CODE:REORDER(1) -OTG_HS_WKUP_IRQHandler - B OTG_HS_WKUP_IRQHandler - - PUBWEAK OTG_HS_IRQHandler - SECTION .text:CODE:REORDER(1) -OTG_HS_IRQHandler - B OTG_HS_IRQHandler - - PUBWEAK DCMI_IRQHandler - SECTION .text:CODE:REORDER(1) -DCMI_IRQHandler - B DCMI_IRQHandler - - PUBWEAK CRYP_IRQHandler - SECTION .text:CODE:REORDER(1) -CRYP_IRQHandler - B CRYP_IRQHandler - - PUBWEAK HASH_RNG_IRQHandler - SECTION .text:CODE:REORDER(1) -HASH_RNG_IRQHandler - B HASH_RNG_IRQHandler - - END -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS-SVD_Schema_1_0.xsd b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS-SVD_Schema_1_0.xsd deleted file mode 100644 index 17ace6a5e..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS-SVD_Schema_1_0.xsd +++ /dev/null @@ -1,274 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS_CM4_SIMD.htm b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS_CM4_SIMD.htm deleted file mode 100644 index 7275e0ef2..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS_CM4_SIMD.htm +++ /dev/null @@ -1,3809 +0,0 @@ - - - - CMSIS: Cortex-M4 SIMD Instructions - - - - - - -

CMSIS Support for Cortex-M4 SIMD Instructions

- -

This file describes the Cortex-M4 SIMD instructions supported by CMSIS.

-

Version: 1.00 - 25. November 2010

- -

Information in this file, the accompany manuals, and software is
- Copyright © ARM Ltd.
All rights reserved. -

- -
- -

Revision History

- - -
- -

Contents

- -
    -
  1. About
  2. -
  3. Cortex-M4 SIMD instruction support
  4. -
  5. Examples
  6. -
- - - -

 

-

About

-

- CMSIS provides for the Cortex-M4 a set of functions supporting Cortex-M4 SIMD instructions. -

- -

 

-

Cortex-M4 SIMD instruction support

-

CMSIS supports the following functions for Cortex-M4 instructions: -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameMnemonicDescription
__SADD8SADD8GE setting quad 8-bit signed addition
__QADD8QADD8Q setting quad 8-bit saturating addition
__SHADD8SHADD8Quad 8-bit signed addition with halved results
__UADD8UADD8GE setting quad 8-bit unsigned addition
__UQADD8UQADD8Quad 8-bit unsigned saturating addition
__UHADD8UHADD8Quad 8-bit unsigned addition with halved results
__SSUB8SSUB8GE setting quad 8-bit signed subtraction
__QSUB8QSUB8Q setting quad 8-bit saturating subtract
__SHSUB8SHSUB8Quad 8-bit signed subtraction with halved results
__USUB8USUB8GE setting quad 8-bit unsigned subtract
__UQSUB8UQSUB8Quad 8-bit unsigned saturating subtraction
__UHSUB8UHSUB8Quad 8-bit unsigned subtraction with halved results
__SADD16SADD16GE setting dual 16-bit signed addition
__QADD16QADD16Q setting dual 16-bit saturating addition
__SHADD16SHADD16Dual 16-bit signed addition with halved results
__UADD16UADD16GE setting dual 16-bit unsigned addition
__UQADD16UQADD16Dual 16-bit unsigned saturating addition
__UHADD16UHADD16Dual 16-bit unsigned addition with halved results
__SSUB16SSUB16GE setting dual 16-bit signed subtraction
__QSUB16QSUB16Q setting dual 16-bit saturating subtract
__SHSUB16SHSUB16Dual 16-bit signed subtraction with halved results
__USUB16USUB16GE setting dual 16-bit unsigned subtract
__UQSUB16UQSUB16Dual 16-bit unsigned saturating subtraction
__UHSUB16UHSUB16Dual 16-bit unsigned subtraction with halved results
__SASXSASXGE setting dual 16-bit addition and subtraction with exchange
__QASXQASXQ setting dual 16-bit add and subtract with exchange
__SHASXSHASXDual 16-bit signed addition and subtraction with halved results
__UASXUASXGE setting dual 16-bit unsigned addition and subtraction with exchange
__UQASXUQASXDual 16-bit unsigned saturating addition and subtraction with exchange
__UHASXUHASXDual 16-bit unsigned addition and subtraction with halved results and exchange
__SSAXSSAXGE setting dual 16-bit signed subtraction and addition with exchange
__QSAXQSAXQ setting dual 16-bit subtract and add with exchange
__SHSAXSHSAXDual 16-bit signed subtraction and addition with halved results
__USAXUSAXGE setting dual 16-bit unsigned subtract and add with exchange
__UQSAXUQSAXDual 16-bit unsigned saturating subtraction and addition with exchange
__UHSAXUHSAXDual 16-bit unsigned subtraction and addition with halved results and exchange
__USAD8USAD8Unsigned sum of quad 8-bit unsigned absolute difference
__USADA8USADA8Unsigned sum of quad 8-bit unsigned absolute difference with 32-bit accumulate
__SSAT16SSAT16Q setting dual 16-bit saturate
__USAT16USAT16Q setting dual 16-bit unsigned saturate
__UXTB16UXTB16Dual extract 8-bits and zero-extend to 16-bits
__UXTAB16UXTAB16Extracted 16-bit to 32-bit unsigned addition
__SXTB16SXTB16Dual extract 8-bits and sign extend each to 16-bits
__SXTAB16SXTAB16Dual extracted 8-bit to 16-bit signed addition
__SMUADSMUADQ setting sum of dual 16-bit signed multiply
__SMUADXSMUADXQ setting sum of dual 16-bit signed multiply with exchange
__SMLADSMLADQ setting dual 16-bit signed multiply with single 32-bit accumulator
__SMLADXSMLADXQ setting pre-exchanged dual 16-bit signed multiply with single 32-bit accumulator
__SMLALDSMLALDDual 16-bit signed multiply with single 64-bit accumulator
__SMLALDXSMLALDXDual 16-bit signed multiply with exchange with single 64-bit accumulator
__SMUSDSMUSDDual 16-bit signed multiply returning difference
__SMUSDXSMUSDXDual 16-bit signed multiply with exchange returning difference
__SMLSDSMLSDQ setting dual 16-bit signed multiply subtract with 32-bit accumulate
__SMLSDXSMLSDXQ setting dual 16-bit signed multiply with exchange subtract with 32-bit accumulate
__SMLSLDSMLSLDQ setting dual 16-bit signed multiply subtract with 64-bit accumulate
__SMLSLDXSMLSLDXQ setting dual 16-bit signed multiply with exchange subtract with 64-bit accumulate
__SELSELSelect bytes based on GE bits
__QADDQADDQ setting saturating add
__QSUBQSUB/td> - Q setting saturating subtract
- - - - -

Function __SADD8

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SADD8(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform four 8-bit signed integer additions.
- The GE bits in the APSR are set according to the results of the additions. -
Parameter -
    -
  • val1: first four 8-bit summands.
  • -
  • val2: second four 8-bit summands.
  • -
-
Return Value -

The function returns:

-
    -
  • the addition of the first bytes from each operand, in the first byte of the return value.
  • -
  • the addition of the second bytes of each operand, in the second byte of the return value.
  • -
  • the addition of the third bytes of each operand, in the third byte of the return value.
  • -
  • the addition of the fourth bytes of each operand, in the fourth byte of the return value.
  • -
-

Each bit in APSR.GE is set or cleared for each byte in the return value, depending on - the results of the operation.
- If res is the return value, then: -

-
    -
  • if res[7:0] ≥ 0 then APSR.GE[0] = 1 else 0
  • -
  • if res[15:8] ≥ 0 then APSR.GE[1] = 1 else 0
  • -
  • if res[23:16] ≥ 0 then APSR.GE[2] = 1 else 0
  • -
  • if res[31:24] ≥ 0 then APSR.GE[3] = 1 else 0
  • -
-
Operation -
-res[7:0]   = val1[7:0]   + val2[7:0]
-res[15:8]  = val1[15:8]  + val2[15:8]
-res[23:16] = val1[23:16] + val2[23:16]
-res[31:24] = val1[31:24] + val2[31:24]
-
- -

Function __QADD8

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __QADD8(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform four 8-bit integer additions, saturating the results to - the 8-bit signed integer range -27 ≤ x ≤ 27 - 1. -
Parameter -
    -
  • val1: first four 8-bit summands.
  • -
  • val2: second four 8-bit summands.
  • -
-
Return Value -

The function returns:

-
    -
  • the saturated addition of the first byte of each operand in the first byte of the return value.
  • -
  • the saturated addition of the second byte of each operand in the second byte of the return value.
  • -
  • the saturated addition of the third byte of each operand in the third byte of the return value.
  • -
  • the saturated addition of the fourth byte of each operand in the fourth byte of the return value.
  • -
-

The returned results are saturated to the 16-bit signed integer range -27 ≤ x ≤ 27 - 1. -

-
Operation -
-res[7:0]   = val1[7:0]   + val2[7:0]
-res[15:8]  = val1[15:8]  + val2[15:8]
-res[23:16] = val1[23:16] + val2[23:16]
-res[31:24] = val1[31:24] + val2[31:24]
-
- -

Function __SHADD8

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SHADD8(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform four signed 8-bit integer additions, halving the results. -
Parameter -
    -
  • val1: first four 8-bit summands.
  • -
  • val2: second four 8-bit summands.
  • -
-
Return Value -

The function returns:

-
    -
  • the halved addition of the first bytes from each operand, in the first byte of the return value.
  • -
  • the halved addition of the second bytes from each operand, in the second byte of the return value.
  • -
  • the halved addition fo the third bytes from each operand, in the third byte of the return value.
  • -
  • the halved addition of the fourth bytes from each operand, in the fourth byte of the return value.
  • -
-
Operation -
-res[7:0]   = (val1[7:0]   + val2[7:0])   >> 1
-res[15:8]  = (val1[15:8]  + val2[15:8])  >> 1
-res[23:16] = (val1[23:16] + val2[23:16]) >> 1
-res[31:24] = (val1[31:24] + val2[31:24]) >> 1
-
- -

Function __UADD8

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __UADD8(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform four unsigned 8-bit integer additions.
- The GE bits in the APSR are set according to the results. -
Parameter -
    -
  • val1: first four 8-bit summands for each addition.
  • -
  • val2: second four 8-bit summands for each addition.
  • -
-
Return Value -

The function returns:

-
    -
  • the addition of the first bytes in each operand, in the first byte of the return value.
  • -
  • the addition of the second bytes in each operand, in the second byte of the return value.
  • -
  • the addition of the third bytes in each operand, in the third byte of the return value.
  • -
  • the addition of the fourth bytes in each operand, in the fourth byte of the return value.
  • -
-

Each bit in APSR.GE is set or cleared for each byte in the return value, depending on - the results of the operation.
- If res is the return value, then: -

-
    -
  • if res[7:0] ≥ 0x100 then APSR.GE[0] = 1 else 0
  • -
  • if res[15:8] ≥ 0x100 then APSR.GE[1] = 1 else 0
  • -
  • if res[23:16] ≥ 0x100 then APSR.GE[2] = 1 else 0
  • -
  • if res[31:24] ≥ 0x100 then APSR.GE[3] = 1 else 0
  • -
-
Operation -
-res[7:0]   = val1[7:0]   + val2[7:0]
-res[15:8]  = val1[15:8]  + val2[15:8]
-res[23:16] = val1[23:16] + val2[23:16]
-res[31:24] = val1[31:24] + val2[31:24]
-
- -

Function __UQADD8

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __UQADD8(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform four unsigned 8-bit integer additions, saturating the - results to the 8-bit unsigned integer range 0 ≤ x ≤ 28 - 1. -
Parameter -
    -
  • val1: first four 8-bit summands.
  • -
  • val2: second four 8-bit summands.
  • -
-
Return Value -

The function returns:

-
    -
  • the addition of the first bytes in each operand, in the first byte of the return value.
  • -
  • the addition of the second bytes in each operand, in the second byte of the return value.
  • -
  • the addition of the third bytes in each operand, in the third byte of the return value.
  • -
  • the addition of the fourth bytes in each operand, in the fourth byte of the return value.
  • -
-

The results are saturated to the 8-bit unsigned integer range 0 ≤ x ≤ 28 - 1. -

-
Operation -
-res[7:0]   = val1[7:0]   + val2[7:0]
-res[15:8]  = val1[15:8]  + val2[15:8]
-res[23:16] = val1[23:16] + val2[23:16]
-res[31:24] = val1[31:24] + val2[31:24]
-
- -

Function __UHADD8

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __UHADD8(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform four unsigned 8-bit integer additions, halving the results. -
Parameter -
    -
  • val1: first four 8-bit summands.
  • -
  • val2: second four 8-bit summands.
  • -
-
Return Value -

The function returns:

-
    -
  • the halved addition of the first bytes in each operand, in the first byte of the return value.
  • -
  • the halved addition of the second bytes in each operand, in the second byte of the return value.
  • -
  • the halved addition of the third bytes in each operand, in the third byte of the return value.
  • -
  • the halved addition of the fourth bytes in each operand, in the fourth byte of the return value.
  • -
-
Operation -
-res[7:0]   = (val1[7:0]   + val2[7:0])   >> 1
-res[15:8]  = (val1[15:8]  + val2[15:8])  >> 1
-res[23:16] = (val1[23:16] + val2[23:16]) >> 1
-res[31:24] = (val1[31:24] + val2[31:24]) >> 1
-
- -

Function __SSUB8

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SSUB8(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform four 8-bit signed integer subtractions.
- The GE bits in the APSR are set according to the results. -
Parameter -
    -
  • val1: first four 8-bit operands of each subtraction.
  • -
  • val2: second four 8-bit operands of each subtraction.
  • -
-
Return Value -

The function returns:

-
    -
  • the subtraction of the first byte in the second operand from the first byte in the - first operand, in the first bytes of the return value.
  • -
  • the subtraction of the second byte in the second operand from the second byte in - the first operand, in the second byte of the return value.
  • -
  • the subtraction of the third byte in the second operand from the third byte in the - first operand, in the third byte of the return value.
  • -
  • the subtraction of the fourth byte in the second operand from the fourth byte in - the first operand, in the fourth byte of the return value.
  • -
-

Each bit in APSR.GE is set or cleared for each byte in the return value, depending on - the results of the operation. If res is the return value, then: -

-
    -
  • if res[8:0] ≥ 0 then APSR.GE[0] = 1 else 0
  • -
  • if res[15:8] ≥ 0 then APSR.GE[1] = 1 else 0
  • -
  • if res[23:16] ≥ 0 then APSR.GE[2] = 1 else 0
  • -
  • if res[31:24] ≥ 0 then APSR.GE[3] = 1 else 0
  • -
-
Operation -
-res[7:0]   = val1[7:0]   - val2[7:0]
-res[15:8]  = val1[15:8]  - val2[15:8]
-res[23:16] = val1[23:16] - val2[23:16]
-res[31:24] = val1[31:24] - val2[31:24]
-
- -

Function __QSUB8

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __QADD8(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform four 8-bit integer subtractions, saturating the results - to the 8-bit signed integer range -27 ≤ x ≤ 27 - 1. -
Parameter -
    -
  • val1: first four 8-bit operands.
  • -
  • val2: second four 8-bit operands.
  • -
-
Return Value -

The function returns:

-
    -
  • the subtraction of the first byte in the second operand from the first byte in the - first operand, in the first byte of the return value.
  • -
  • the subtraction of the second byte in the second operand from the second byte in - the first operand, in the second byte of the return value.
  • -
  • the subtraction of the third byte in the second operand from the third byte in the - first operand, in the third byte of the return value.
  • -
  • the subtraction of the fourth byte in the second operand from the fourth byte in - the first operand, in the fourth byte of the return value.
  • -
-

The returned results are saturated to the 8-bit signed integer range -27 ≤ x ≤ 27 - 1. -

-
Operation -
-res[7:0]   = val1[7:0]   - val2[7:0]
-res[15:8]  = val1[15:8]  - val2[15:8]
-res[23:16] = val1[23:16] - val2[23:16]
-res[31:24] = val1[31:24] - val2[31:24]
-
- -

Function __SHSUB8

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SHSUB8(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform four signed 8-bit integer subtractions, halving the - results. -
Parameter -
    -
  • val1: first four 8-bit operands.
  • -
  • val2: second four 8-bit operands.
  • -
-
Return Value -

The function returns:

-
    -
  • the halved subtraction of the first byte in the second operand from the first byte - in the first operand, in the first byte of the return value.
  • -
  • the halved subtraction of the second byte in the second operand from the second - byte in the first operand, in the second byte of the return value.
  • -
  • the halved subtraction of the third byte in the second operand from the third byte - in the first operand, in the third byte of the return value.
  • -
  • the halved subtraction of the fourth byte in the second operand from the fourth - byte in the first operand, in the fourth byte of the return value.
  • -
-
Operation -
-res[7:0]   = (val1[7:0]   - val2[7:0])  >> 1
-res[15:8]  = (val1[15:8]  - val2[15:8]) >> 1
-res[23:16] = (val1[23:16] - val2[23:16] >> 1
-res[31:24] = (val1[31:24] - val2[31:24] >> 1
-
- -

Function __USUB8

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __USUB8(uint32_t val1, uint32_t val2);
-
DescriptionThis function It enables you to perform four 8-bit unsigned integer subtractions.
- The GE bits in the APSR are set according to the results. -
Parameter -
    -
  • val1: first four 8-bit operands.
  • -
  • val2: second four 8-bit operands.
  • -
-
Return Value -

The function returns:

-
    -
  • the subtraction of the first byte in the second operand from the first byte in the - first operand, in the first byte of the return value.
  • -
  • the subtraction of the second byte in the second operand from the second byte in - the first operand, in the second byte of the return value.
  • -
  • the subtraction of the third byte in the second operand from the third byte in the - first operand, in the third byte of the return value.
  • -
  • the subtraction of the fourth byte in the second operand from the fourth byte in - the first operand, in the fourth byte of the return value.
  • -
-

Each bit in APSR.GE is set or cleared for each byte in the return value, depending on - the results of the operation.
- If res is the return value, then: -

-
    -
  • if res[7:0] ≥ 0 then APSR.GE[0] = 1 else 0
  • -
  • if res[15:8] ≥ 0 then APSR.GE[1] = 1 else 0
  • -
  • if res[23:16] ≥ 0 then APSR.GE[2] = 1 else 0
  • -
  • if res[31:24] ≥ 0 then APSR.GE[3] = 1 else 0
  • -
-
Operation -
-res[7:0]   = val1[7:0]   - val2[7:0]
-res[15:8]  = val1[15:8]  - val2[15:8]
-res[23:16] = val1[23:16] - val2[23:16]
-res[31:24] = val1[31:24] - val2[31:24]
-
- -

Function __UQSUB8

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __UQSUB8(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform four unsigned 8-bit integer subtractions, saturating - the results to the 8-bit unsigned integer range 0 ≤ x ≤ 28 - 1. -
Parameter -
    -
  • val1: first four 8-bit operands.
  • -
  • val2: second four 8-bit operands.
  • -
-
Return Value -

The function returns:

-
    -
  • the subtraction of the first byte in the second operand from the first byte in the - first operand, in the first byte of the return value.
  • -
  • the subtraction of the second byte in the second operand from the second byte in - the first operand, in the second byte of the return value.
  • -
  • the subtraction of the third byte in the second operand from the third byte in the - first operand, in the third byte of the return value.
  • -
  • the subtraction of the fourth byte in the second operand from the fourth byte in - the first operand, in the fourth byte of the return value.
  • -
-

The results are saturated to the 8-bit unsigned integer range 0 ≤ x ≤ 28 - 1. -

-
Operation -
-res[7:0]   = val1[7:0]   - val2[7:0]
-res[15:8]  = val1[15:8]  - val2[15:8]
-res[23:16] = val1[23:16] - val2[23:16]
-res[31:24] = val1[31:24] - val2[31:24]
-
- -

Function __UHSUB8

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __UHSUB8(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform four unsigned 8-bit integer subtractions, halving the - results. -
Parameter -
    -
  • val1: first four 8-bit operands.
  • -
  • val2: second four 8-bit operands.
  • -
-
Return Value -

The function returns:

-
    -
  • the halved subtraction of the first byte in the second operand from the first byte - in the first operand, in the first byte of the return value.
  • -
  • the halved subtraction of the second byte in the second operand from the second - byte in the first operand, in the second byte of the return value.
  • -
  • the halved subtraction of the third byte in the second operand from the third byte - in the first operand, in the third byte of the return value.
  • -
  • the halved subtraction of the fourth byte in the second operand from the fourth - byte in the first operand, in the fourth byte of the return value.
  • -
-
Operation -
-res[7:0]   = (val1[7:0]   - val2[7:0])   >> 1
-res[15:8]  = (val1[15:8]  - val2[15:8])  >> 1
-res[23:16] = (val1[23:16] - val2[23:16]) >> 1
-res[31:24] = (val1[31:24] - val2[31:24]) >> 1
-
- -

Function __SADD16

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SADD16(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform two 16-bit signed integer additions.
- The GE bits in the APSR are set according to the results of the additions. -
Parameter -
    -
  • val1: first two 16-bit summands.
  • -
  • val2: second two 16-bit summands.
  • -
-
Return Value -

The function returns:

-
    -
  • the addition of the low halfwords in the low halfword of the return value.
  • -
  • the addition of the high halfwords in the high halfword of the return value.
  • -
-

Each bit in APSR.GE is set or cleared for each byte in the return value, depending on - the results of the operation.
- If res is the return value, then: -

-
    -
  • if res[15:0] ≥ 0 then APSR.GE[1:0] = 11 else 00
  • -
  • if res[31:16] ≥ 0 then APSR.GE[3:2] = 11 else 00
  • -
-
Operation -
-res[15:0]  = val1[15:0]  + val2[15:0]
-res[31:16] = val1[31:16] + val2[31:16]
-
- -

Function __QADD16

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __QADD16(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform two 16-bit integer arithmetic additions in parallel, - saturating the results to the 16-bit signed integer range -215 ≤ x ≤ 215 - 1. -
Parameter -
    -
  • val1: first two 16-bit summands.
  • -
  • val2: second two 16-bit summands.
  • -
-
Return Value -

The function returns:

-
    -
  • the saturated addition of the low halfwords in the low halfword of the return value.
  • -
  • the saturated addition of the high halfwords in the high halfword of the return value.
  • -
-

The returned results are saturated to the 16-bit signed integer - range -215 ≤ x ≤ 215 - 1 -

-
Operation -
-res[15:0]  = val1[15:0]  + val2[15:0]
-res[16:31] = val1[31:16] + val2[31:16]
-
- -

Function __SHADD16

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SHADD16(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform two signed 16-bit integer additions, halving the - results. -
Parameter -
    -
  • val1: first two 16-bit summands.
  • -
  • val2: second two 16-bit summands.
  • -
-
Return Value -

The function returns:

-
    -
  • the halved addition of the low halfwords from each operand, in the low halfword - of the return value.
  • -
  • the halved addition of the high halfwords from each operand, in the high halfword - of the return value.
  • -
-
Operation -
-res[15:0]  = (val1[15:0]  + val2[15:0])  >> 1
-res[31:16] = (val1[31:16] + val2[31:16]) >> 1
-
- -

Function __UADD16

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __UADD16(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform two 16-bit unsigned integer additions.
- The GE bits in the APSR are set according to the results. -
Parameter -
    -
  • val1: first two 16-bit summands for each addition.
  • -
  • val2: second two 16-bit summands for each addition.
  • -
-
Return Value -

The function returns:

-
    -
  • the addition of the low halfwords in each operand, in the low halfword of the - return value.
  • -
  • the addition of the high halfwords in each operand, in the high halfword of the - return value.
  • -
-

Each bit in APSR.GE is set or cleared for each byte in the return value, depending on - the results of the operation.
- If res is the return value, then: -

-
    -
  • if res[15:0] ≥ 0x10000 then APSR.GE[0] = 11 else 00
  • -
  • if res[31:16] ≥ 0x10000 then APSR.GE[1] = 11 else 00
  • -
-
Operation -
-res[15:0]  = val1[15:0]  + val2[15:0]
-res[31:16] = val1[31:16] + val2[31:16]
-
- -

Function __UQADD16

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __UQADD16(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform two unsigned 16-bit integer additions, saturating the - results to the 16-bit unsigned integer range 0 ≤ x ≤ 216 - 1. -
Parameter -
    -
  • val1: first two 16-bit summands.
  • -
  • val2: second two 16-bit summands.
  • -
-
Return Value -

The function returns:

-
    -
  • the addition of the low halfword in the first operand and the low halfword in the - second operand, in the low halfword of the return value.
  • -
  • the addition of the high halfword in the first operand and the high halfword in the - second operand, in the high halfword of the return value.
  • -
-

The results are saturated to the 16-bit unsigned integer - range 0 ≤ x ≤ 216 - 1. -

-
Operation -
-res[15:0]  = val1[15:0]  + val2[15:0]
-res[31:16] = val1[31:16] + val2[31:16]
-
- -

Function __UHADD16

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __UHADD16(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform two unsigned 16-bit integer additions, halving the - results. -
Parameter -
    -
  • val1: first two 16-bit summands.
  • -
  • val2: second two 16-bit summands.
  • -
-
Return Value -

The function returns:

-
    -
  • the halved addition of the low halfwords in each operand, in the low halfword of - the return value.
  • -
  • the halved addition of the high halfwords in each operand, in the high halfword - of the return value.
  • -
-
Operation -
-res[15:0]  = (val1[15:0]  + val2[15:0])  >> 1
-res[31:16] = (val1[31:16] + val2[31:16]) >> 1
-
- -

Function __SSUB16

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SSUB16(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform two 16-bit signed integer subtractions.
- The GE bits in the APSR are set according to the results. -
Parameter -
    -
  • val1: first two 16-bit operands of each subtraction.
  • -
  • val2: second two 16-bit operands of each subtraction.
  • -
-
Return Value -

The function returns:

-
    -
  • the subtraction of the low halfword in the second operand from the low halfword - in the first operand, in the low halfword of the return value.
  • -
  • the subtraction of the high halfword in the second operand from the high halfword - in the first operand, in the high halfword of the return value.
  • -
-

Each bit in APSR.GE is set or cleared for each byte in the return value, depending on - the results of the operation.
- If res is the return value, then: -

-
    -
  • if res[15:0] ≥ 0 then APSR.GE[1:0] = 11 else 00
  • -
  • if res[31:16] ≥ 0 then APSR.GE[3:2] = 11 else 00
  • -
-
Operation -
-res[15:0]  = val1[15:0]  - val2[15:0]
-res[31:16] = val1[31:16] - val2[31:16]
-
- -

Function __QSUB16

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __QSUB16(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform two 16-bit integer subtractions, saturating the - results to the 16-bit signed integer range -215 ≤ x ≤ 215 - 1. -
Parameter -
    -
  • val1: first two 16-bit operands.
  • -
  • val2: second two 16-bit operands.
  • -
-
Return Value -

The function returns:

-
    -
  • the saturated subtraction of the low halfword in the second operand from the low - halfword in the first operand, in the low halfword of the returned result.
  • -
  • the saturated subtraction of the high halfword in the second operand from the high - halfword in the first operand, in the high halfword of the returned result.
  • -
-

The returned results are saturated to the 16-bit signed integer - range -215 ≤ x ≤ 215 - 1. -

-
Operation -
-res[15:0]  = val1[15:0]  - val2[15:0]
-res[31:16] = val1[31:16] - val2[31:16]
-
- -

Function __SHSUB16

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SHSUB16(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform two signed 16-bit integer subtractions, halving the - results. -
Parameter -
    -
  • val1: first two 16-bit operands.
  • -
  • val2: second two 16-bit operands.
  • -
-
Return Value -

The function returns:

-
    -
  • the halved subtraction of the low halfword in the second operand from the low - halfword in the first operand, in the low halfword of the return value.
  • -
  • the halved subtraction of the high halfword in the second operand from the high - halfword in the first operand, in the high halfword of the return value.
  • -
-
Operation -
-res[15:0]  = (val1[15:0]  - val2[15:0])  >> 1
-res[31:16] = (val1[31:16] - val2[31:16]) >> 1
-
- -

Function __USUB16

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __USUB16(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform two 16-bit unsigned integer subtractions.
- The GE bits in the APSR are set according to the results. -
Parameter -
    -
  • val1: first two 16-bit operands.
  • -
  • val2: second two 16-bit operands.
  • -
-
Return Value -

The function returns:

-
    -
  • the subtraction of the low halfword in the second operand from the low halfword - in the first operand, in the low halfword of the return value.
  • -
  • the subtraction of the high halfword in the second operand from the high halfword - in the first operand, in the high halfword of the return value.
  • -
-

Each bit in APSR.GE is set or cleared for each byte in the return value, depending on - the results of the operation.
- If res is the return value, then: -

-
    -
  • if res[15:0] ≥ 0 then APSR.GE[1:0] = 11 else 00
  • -
  • if res[31:16] ≥ 0 then APSR.GE[3:2] = 11 else 00
  • -
-
Operation -
-res[15:0]  = val1[15:0]  - val2[15:0]
-res[31:16] = val1[31:16] - val2[31:16]
-
- -

Function __UQSUB16

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __UQSUB16(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform two unsigned 16-bit integer subtractions, saturating - the results to the 16-bit unsigned integer range 0 ≤ x ≤ 216 - 1. -
Parameter -
    -
  • val1: first two 16-bit operands for each subtraction.
  • -
  • val2: second two 16-bit operands for each subtraction.
  • -
-
Return Value -

The function returns:

-
    -
  • the subtraction of the low halfword in the second operand from the low halfword - in the first operand, in the low halfword of the return value.
  • -
  • the subtraction of the high halfword in the second operand from the high halfword - in the first operand, in the high halfword of the return value.
  • -
-

The results are saturated to the 16-bit unsigned integer range 0 ≤ x ≤ 216 - 1. -

-
Operation -
-res[15:0]  = val1[15:0]  - val2[15:0]
-res[31:16] = val1[31:16] - val2[31:16]
-
- -

Function __UHSUB16

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __UHSUB16(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform two unsigned 16-bit integer subtractions, halving - the results. -
Parameter -
    -
  • val1: first two 16-bit operands.
  • -
  • val2: second two 16-bit operands.
  • -
-
Return Value -

The function returns:

-
    -
  • the halved subtraction of the low halfword in the second operand from the low - halfword in the first operand, in the low halfword of the return value.
  • -
  • the halved subtraction of the high halfword in the second operand from the high - halfword in the first operand, in the high halfword of the return value.
  • -
-
Operation -
-res[15:0]  = (val1[15:0]  - val2[15:0])  >> 1
-res[31:16] = (val1[31:16] - val2[31:16]) >> 1
-
- -

Function __SASX

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SASX(uint32_t val1, uint32_t val2);
-
DescriptionThis function inserts an SASX instruction into the instruction stream generated by the - compiler. It enables you to exchange the halfwords of the second operand, add the high - halfwords and subtract the low halfwords.
- The GE bits in the APRS are set according to the results. -
Parameter -
    -
  • val1: first operand for the subtraction in the low halfword, and the - first operand for the addition in the high halfword.
  • -
  • val2: second operand for the subtraction in the high halfword, and the - second operand for the addition in the low halfword.
  • -
-
Return Value -

The function returns:

-
    -
  • the subtraction of the high halfword in the second operand from the low halfword - in the first operand, in the low halfword of the return value.
  • -
  • the addition of the high halfword in the first operand and the low halfword in the - second operand, in the high halfword of the return value.
  • -
-

Each bit in APSR.GE is set or cleared for each byte in the return value, depending on - the results of the operation.
- If res is the return value, then: -

-
    -
  • if res[15:0] ≥ 0 then APSR.GE[1:0] = 11 else 00
  • -
  • if res[31:16] ≥ 0 then APSR.GE[3:2] = 11 else 00
  • -
-
Operation -
-res[15:0]  = val1[15:0] - val2[31:16]
-res[31:16] = val1[31:16] + val2[15:0]
-
- -

Function __QASX

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __QASX(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to exchange the halfwords of the one operand, then add the high - halfwords and subtract the low halfwords, saturating the results to the 16-bit signed - integer range -215 ≤ x ≤ 215 - 1. -
Parameter -
    -
  • val1: first operand for the subtraction in the low halfword, and the - first operand for the addition in the high halfword.
  • -
  • val2: second operand for the subtraction in the high halfword, and the - second operand for the addition in the low halfword.
  • -
-
Return Value -

The function returns:

-
    -
  • the saturated subtraction of the high halfword in the second operand from the low - halfword in the first operand, in the low halfword of the return value.
  • -
  • the saturated addition of the high halfword in the first operand and the low - halfword in the second operand, in the high halfword of the return value.
  • -
-

The returned results are saturated to the 16-bit signed integer - range -215 ≤ x ≤ 215 - 1. -

-
Operation -
-res[15:0]  = val1[15:0]  - val2[31:16]
-res[31:16] = val1[31:16] + val2[15:0]
-
- -

Function __SHASX

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SHASX(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to exchange the two halfwords of one operand, perform one - signed 16-bit integer addition and one signed 16-bit subtraction, and halve the results. -
Parameter -
    -
  • val1: first 16-bit operands.
  • -
  • val2: second 16-bit operands.
  • -
-
Return Value -

The function returns:

-
    -
  • the halved subtraction of the high halfword in the second operand from the low - halfword in the first operand, in the low halfword of the return value.
  • -
  • the halved subtraction of the low halfword in the second operand from the high - halfword in the first operand, in the high halfword of the return value.
  • -
-
Operation -
-res[15:0]  = (val1[15:0]  - val2[31:16]) >> 1
-res[31:16] = (val1[31:16] - val2[15:0])  >> 1
-
- -

Function __UASX

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __UASX(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to exchange the two halfwords of the second operand, add the - high halfwords and subtract the low halfwords.
- The GE bits in the APSR are set according to the results. -
Parameter -
    -
  • val1: first operand for the subtraction in the low halfword, and the - first operand for the addition in the high halfword.
  • -
  • val2: second operand for the subtraction in the high halfword and the - second operand for the addition in the low halfword.
  • -
-
Return Value -

The function returns:

-
    -
  • the subtraction of the high halfword in the second operand from the low halfword - in the first operand, in the low halfword of the return value.
  • -
  • the addition of the high halfword in the first operand and the low halfword in the - second operand, in the high halfword of the return value.
  • -
-

Each bit in APSR.GE is set or cleared for each byte in the return value, depending on - the results of the operation.
- If res is the return value, then: -

-
    -
  • if res[15:0] ≥ 0 then APSR.GE[1:0] = 11 else 00
  • -
  • if res[31:16] ≥ 0x10000 then APSR.GE[3:2] = 11 else 00
  • -
-
Operation -
-res[15:0]  = val1[15:0]  - val2[31:16]
-res[31:16] = val1[31:16] + val2[15:0]
-
- -

Function __UQASX

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __UQASX(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to exchange the halfwords of the second operand and perform - one unsigned 16-bit integer addition and one unsigned 16-bit subtraction, saturating the - results to the 16-bit unsigned integer range 0 ≤ x ≤ 216 - 1. -
Parameter -
    -
  • val1: first two 16-bit operands.
  • -
  • val2: second two 16-bit operands.
  • -
-
Return Value -

The function returns:

-
    -
  • the subtraction of the high halfword in the second operand from the low halfword - in the first operand, in the low halfword of the return value.
  • -
  • the subtraction of the low halfword in the second operand from the high halfword - in the first operand, in the high halfword of the return value.
  • -
-

The results are saturated to the 16-bit unsigned integer - range 0 ≤ x ≤ 216 - 1. -

-
Operation -
-res[15:0]  = val1[15:0]  - val2[31:16]
-res[31:16] = val1[31:16] + val2[15:0]
-
- -

Function __UHASX

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __UHASX(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to exchange the halfwords of the second operand, add the high - halfwords and subtract the low halfwords, halving the results. -
Parameter -
    -
  • val1: first operand for the subtraction in the low halfword, and the - first operand for the addition in the high halfword.
  • -
  • val2: second operand for the subtraction in the high halfword, and the - second operand for the addition in the low halfword.
  • -
-
Return Value -

The function returns:

-
    -
  • the halved subtraction of the high halfword in the second operand from the low - halfword in the first operand.
  • -
  • the halved addition of the high halfword in the first operand and the low halfword - in the second operand.
  • -
-
Operation -
-res[15:0]  = (val1[15:0]  - val2[31:16]) >> 1
-res[31:16] = (val1[31:16] + val2[15:0])  >> 1
-
- -

Function __SSAX

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SSAX(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to exchange the two halfwords of one operand and perform one - 16-bit integer subtraction and one 16-bit addition.
- The GE bits in the APSR are set according to the results. -
Parameter -
    -
  • val1: first operand for the addition in the low halfword, and the first - operand for the subtraction in the high halfword.
  • -
  • val2: second operand for the addition in the high halfword, and the - second operand for the subtraction in the low halfword.
  • -
-
Return Value -

The function returns:

-
    -
  • the addition of the low halfword in the first operand and the high halfword in the - second operand, in the low halfword of the return value.
  • -
  • the subtraction of the low halfword in the second operand from the high halfword - in the first operand, in the high halfword of the return value.
  • -
-

Each bit in APSR.GE is set or cleared for each byte in the return value, depending on - the results of the operation.
- If res is the return value, then: -

-
    -
  • if res[15:0] ≥ 0 then APSR.GE[1:0] = 11 else 00
  • -
  • if res[31:16] ≥ 0 then APSR.GE[3:2] = 11 else 00
  • -
-
Operation -
-res[15:0]  = val1[15:0]  + val2[31:16]
-res[31:16] = val1[31:16] - val2[15:0]
-
- -

Function __QSAX

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __QSAX(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to exchange the halfwords of one operand, then subtract the - high halfwords and add the low halfwords, saturating the results to the 16-bit signed - integer range -215 ≤ x ≤ 215 - 1. -
Parameter -
    -
  • val1: first operand for the addition in the low halfword, and the first - operand for the subtraction in the high halfword.
  • -
  • val2: second operand for the addition in the high halfword, and the - second operand for the subtraction in the low halfword.
  • -
-
Return Value -

The function returns:

-
    -
  • the saturated addition of the low halfword of the first operand and the high - halfword of the second operand, in the low halfword of the return value.
  • -
  • the saturated subtraction of the low halfword of the second operand from the high - halfword of the first operand, in the high halfword of the return value.
  • -
-

The returned results are saturated to the 16-bit signed integer - range -215 ≤ x ≤ 215 - 1. -

-
Operation -
-res[15:0]  = val1[15:0]  + val2[31:16]
-res[31:16] = val1[31:16] - val2[15:0]
-
- -

Function __SHSAX

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SHSAX(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to exchange the two halfwords of one operand, perform one - signed 16-bit integer subtraction and one signed 16-bit addition, and halve the results. -
Parameter -
    -
  • val1: first 16-bit operands.
  • -
  • val2: second 16-bit operands.
  • -
-
Return Value -

The function returns:

-
    -
  • the halved addition of the low halfword in the first operand and the high halfword - in the second operand, in the low halfword of the return value.
  • -
  • the halved subtraction of the low halfword in the second operand from the high - halfword in the first operand, in the high halfword of the return value.
  • -
-
Operation -
-res[15:0]  = (val1[15:0]  + val2[31:16]) >> 1
-res[31:16] = (val1[31:16] - val2[15:0])  >> 1
-
- -

Function __USAX

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __USAX(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to exchange the halfwords of the second operand, subtract the - high halfwords and add the low halfwords.
- The GE bits in the APSR are set according to the results. -
Parameter -
    -
  • val1: first operand for the addition in the low halfword, and the first - operand for the subtraction in the high halfword.
  • -
  • val2: second operand for the addition in the high halfword, and the - second operand for the subtraction in the low halfword.
  • -
-
Return Value -

The function returns:

-
    -
  • the addition of the low halfword in the first operand and the high halfword in the - second operand, in the low halfword of the return value.
  • -
  • the subtraction of the low halfword in the second operand from the high halfword - in the first operand, in the high halfword of the return value.
  • -
-

Each bit in APSR.GE is set or cleared for each byte in the return value, depending on - the results of the operation.
- If res is the return value, then: -

-
    -
  • if res[15:0] ≥ 0x10000 then APSR.GE[1:0] = 11 else 00
  • -
  • if res[31:16] ≥ 0 then APSR.GE[3:2] = 11 else 00
  • -
-
Operation -
-res[15:0]  = val1[15:0]  + val2[31:16]
-res[31:16] = val1[31:16] - val2[15:0]
-
- -

Function __UQSAX

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __UQSAX(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to exchange the halfwords of the second operand and perform - one unsigned 16-bit integer subtraction and one unsigned 16-bit addition, saturating the - results to the 16-bit unsigned integer range 0 ≤ x ≤ 216 - 1. -
Parameter -
    -
  • val1: first 16-bit operand for the addition in the low halfword, and the - first 16-bit operand for the subtraction in the high halfword.
  • -
  • val2: second 16-bit halfword for the addition in the high halfword, - and the second 16-bit halfword for the subtraction in the low halfword.
  • -
-
Return Value -

The function returns:

-
    -
  • the addition of the low halfword in the first operand and the high halfword in the - second operand, in the low halfword of the return value.
  • -
  • the subtraction of the low halfword in the second operand from the high halfword - in the first operand, in the high halfword of the return value.
  • -
-

The results are saturated to the 16-bit unsigned integer - range 0 ≤ x ≤ 216 - 1. -

-
Operation -
-res[15:0]  = val1[15:0]  + val2[31:16]
-res[31:16] = val1[31:16] - val2[15:0]
-
- -

Function __UHSAX

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __UHSAX(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to exchange the halfwords of the second operand, subtract the - high halfwords and add the low halfwords, halving the results. -
Parameter -
    -
  • val1: first operand for the addition in the low halfword, and the first - operand for the subtraction in the high halfword.
  • -
  • val2: second operand for the addition in the high halfword, and the - second operand for the subtraction in the low halfword.
  • -
-
Return Value -

The function returns:

-
    -
  • the halved addition of the high halfword in the second operand and the low - halfword in the first operand, in the low halfword of the return value.
  • -
  • the halved subtraction of the low halfword in the second operand from the high - halfword in the first operand, in the high halfword of the return value.
  • -
-
Operation -
-res[15:0]  = (val1[15:0]  + val2[31:16]) >> 1
-res[31:16] = (val1[31:16] - val2[15:0])  >> 1
-
- -

Function __USAD8

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __USAD8(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform four unsigned 8-bit subtractions, and add the - absolute values of the differences together, returning the result as a single unsigned - integer. -
Parameter -
    -
  • val1: first four 8-bit operands for the subtractions.
  • -
  • val2: second four 8-bit operands for the subtractions.
  • -
-
Return Value -

The function returns the sum of the absolute differences of:

-
    -
  • the subtraction of the first byte in the second operand from the first byte in the - first operand.
  • -
  • the subtraction of the second byte in the second operand from the second byte in - the first operand.
  • -
  • the subtraction of the third byte in the second operand from the third byte in the - first operand.
  • -
  • the subtraction of the fourth byte in the second operand from the fourth byte in - the first operand.
  • -
-

The sum is returned as a single unsigned integer.

-
Operation -
-absdiff1  = val1[7:0]   - val2[7:0]
-absdiff2  = val1[15:8]  - val2[15:8]
-absdiff3  = val1[23:16] - val2[23:16]
-absdiff4  = val1[31:24] - val2[31:24]
-res[31:0] = absdiff1 + absdiff2 + absdiff3 + absdiff4
-
- -

Function __USADA8

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __USADA8(uint32_t val1, uint32_t val2, uint32_t val3);
-
DescriptionThis function enables you to perform four unsigned 8-bit subtractions, and add the - absolute values of the differences to a 32-bit accumulate operand. -
Parameter -
    -
  • val1: first four 8-bit operands for the subtractions.
  • -
  • val2: second four 8-bit operands for the subtractions.
  • -
  • val3: accumulation value.
  • -
-
Return Value -

The function returns the sum of the absolute differences of the following - bytes, added to the accumulation value:

-
    -
  • the subtraction of the first byte in the second operand from the first byte in the - first operand.
  • -
  • the subtraction of the second byte in the second operand from the second byte in - the first operand.
  • -
  • the subtraction of the third byte in the second operand from the third byte in the - first operand.
  • -
  • the subtraction of the fourth byte in the second operand from the fourth byte in - the first operand.
  • -
-
Operation -
-absdiff1  = val1[7:0]   - val2[7:0]
-absdiff2  = val1[15:8]  - val2[15:8]
-absdiff3  = val1[23:16] - val2[23:16]
-absdiff4  = val1[31:24] - val2[31:24]
-sum       = absdiff1 + absdiff2 + absdiff3 + absdiff4
-res[31:0] = sum[31:0] + val3[31:0]
-
- -

Function __SSAT16

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SSAT16(uint32_t val1, const uint32_t val2);
-
DescriptionThis function enables you to saturate two signed 16-bit values to a selected signed range.
- The Q bit is set if either operation saturates. -
Parameter -
    -
  • val1: two signed 16-bit values to be saturated.
  • -
  • val2: bit position for saturation, an integral constant expression in the - range 1 to 16.
  • -
-
Return Value -

The function returns:

-
    -
  • the signed saturation of the low halfword in val1, saturated to the bit position - specified in val2 and returned in the low halfword of the return value.
  • -
  • the signed saturation of the high halfword in val1, saturated to the bit position - specified in val2 and returned in the high halfword of the return value.
  • -
-
Operation -
-Saturate halfwords in val1 to the signed range specified by the bit position in val2
-
- -

Function __USAT16

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __USAT16(uint32_t val1, const uint32_t val2);
-
DescriptionThis function enables you to saturate two signed 16-bit values to a selected unsigned - range.
- The Q bit is set if either operation saturates. -
Parameter -
    -
  • val1: two 16-bit values that are to be saturated.
  • -
  • val2: bit position for saturation, and must be an integral constant - expression in the range 0 to 15.
  • -
-
Return Value -

The function returns the saturation of the two signed 16-bit values, as non-negative values.

-
    -
  • the saturation of the low halfword in val1, saturated to the bit position - specified in val2 and returned in the low halfword of the return value.
  • -
  • the saturation of the high halfword in val1, saturated to the bit position - specified in val2 and returned in the high halfword of the return value.
  • -
-
Operation -
-Saturate halfwords in val1 to the unsigned range specified by the bit position in val2
-
- -

Function __UXTB16

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __UXTB16(uint32_t val);
-
DescriptionThis function enables you to extract two 8-bit values from an operand and zero-extend - them to 16 bits each. -
Parameter -
    -
  • val1: two 8-bit values in val[7:0] and val[23:16] to be sign-extended.
  • -
-
Return Value -

The function returns the 8-bit values zero-extended to 16-bit values.

-
    -
  • zero-extended value of val[7:0] in the low halfword of the return value.
  • -
  • zero-extended value of val[23:16] in the high halfword of the return value.
  • -
-
Operation -
-res[15:0]  = ZeroExtended(val[7:0]  )
-res[31:16] = ZeroExtended(val[23:16])
-
- -

Function __UXTAB16

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __UXTAB16(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to extract two 8-bit values from one operand, zero-extend them - to 16 bits each, and add the results to two 16-bit values from another operand. -
Parameter -
    -
  • val1: value added to the zero-extended to 16-bit values.
  • -
  • val2: two 8-bit values to be extracted and zero-extended.
  • -
-
Return Value -

The function returns the 8-bit values in val2, zero-extended to 16-bit values - and added to val1.

-
Operation -
-res[15:0]  = ZeroExt(val2[7:0]   to 16 bits) + val1[15:0]
-res[31:16] = ZeroExt(val2[31:16] to 16 bits) + val1[31:16]
-
- -

Function __SXTB16

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SXTB16(uint32_t val);
-
DescriptionThis function enables you to extract two 8-bit values from an operand and sign-extend - them to 16 bits each. -
Parameter -
    -
  • val1: two 8-bit values in val[7:0] and val[23:16] to be sign-extended.
  • -
-
Return Value -

The function returns the 8-bit values sign-extended to 16-bit values.

-
    -
  • sign-extended value of val[7:0] in the low halfword of the return value.
  • -
  • sign-extended value of val[23:16] in the high halfword of the return value.
  • -
-
Operation -
-res[15:0]  = SignExtended(val[7:0]
-res[31:16] = SignExtended(val[23:16]
-
- -

Function __SXTAB16

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SXTAB16(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to extract two 8-bit values from the second operand (at bit - positions [7:0] and [23:16]), sign-extend them to 16-bits each, and add the results to the - first operand. -
Parameter -
    -
  • val1: values added to the zero-extended to 16-bit values.
  • -
  • val2: two 8-bit values to be extracted and zero-extended.
  • -
-
Return Value -

The function returns the addition of val1 and val2, where the 8-bit values in - val2[7:0] and val2[23:16] have been extracted and sign-extended prior to the addition.

-
Operation -
-res[15:0]  = val1[15:0]  + SignExtended(val2[7:0])
-res[31:16] = val1[31:16] + SignExtended(val2[23:16])
-
- -

Function __SMUAD

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SMUAD(uint32_t val1, uint32_t val2);
-
DescriptionThis function It enables you to perform two 16-bit signed multiplications, adding the - products together.
- The Q bit is set if the addition overflows. -
Parameter -
    -
  • val1: first 16-bit operands for each multiplication.
  • -
  • val2: second 16-bit operands for each multiplication.
  • -
-
Return Value -

The function returns the sum of the products of the two 16-bit signed multiplications.

-
Operation -
-p1 = val1[15:0]  * val2[15:0]
-p2 = val1[31:16] * val2[31:16]
-res[31:0] = p1 + p2
-
- -

Function __SMUADX

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SMUADX(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform two 16-bit signed multiplications with exchanged - halfwords of the second operand, adding the products together.
- The Q bit is set if the addition overflows. -
Parameter -
    -
  • val1: first 16-bit operands for each multiplication.
  • -
  • val2: second 16-bit operands for each multiplication.
  • -
-
Return Value -

The function returns the sum of the products of the two 16-bit signed multiplications with exchanged - halfwords of the second operand.

-
Operation -
-p1 = val1[15:0]  * val2[31:16]
-p2 = val1[31:16] * val2[15:0]
-res[31:0] = p1 + p2
-
- -

Function __SMLAD

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SMLAD(uint32_t val1, uint32_t val2, uint32_t val3);
-
DescriptionThis function enables you to perform two signed 16-bit multiplications, adding both - results to a 32-bit accumulate operand.
- The Q bit is set if the addition overflows. Overflow cannot occur during the multiplications. -
Parameter -
    -
  • val1: first 16-bit operands for each multiplication.
  • -
  • val2: second 16-bit operands for each multiplication.
  • -
  • val2: accumulate value.
  • -
-
Return Value -

The function returns the product of each multiplication added to the accumulate - value, as a 32-bit integer.

-
Operation -
-p1 = val1[15:0]  * val2[15:0]
-p2 = val1[31:16] * val2[31:16]
-res[31:0] = p1 + p2 + val3[31:0]
-
- -

Function __SMLADX

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SMLADX(uint32_t val1, uint32_t val2, uint32_t val3);
-
DescriptionThis function enables you to perform two signed 16-bit multiplications with exchanged - halfwords of the second operand, adding both results to a 32-bit accumulate operand.
- The Q bit is set if the addition overflows. Overflow cannot occur during the multiplications. -
Parameter -
    -
  • val1: first 16-bit operands for each multiplication.
  • -
  • val2: second 16-bit operands for each multiplication.
  • -
  • val2: accumulate value.
  • -
-
Return Value -

The function returns the product of each multiplication with exchanged - halfwords of the second operand added to the accumulate value, as a 32-bit integer.

-
Operation -
-p1 = val1[15:0]  * val2[31:16]
-p2 = val1[31:16] * val2[15:0]
-res[31:0] = p1 + p2 + val3[31:0]
-
- -

Function __SMLALD

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint64_t __SMLALD(uint32_t val1, uint32_t val2, uint64_t val3);
-
DescriptionThis function enables you to perform two signed 16-bit multiplications, adding both - results to a 64-bit accumulate operand. Overflow is only possible as a result of the 64-bit - addition. This overflow is not detected if it occurs. Instead, the result wraps around - modulo264. -
Parameter -
    -
  • val1: first 16-bit operands for each multiplication.
  • -
  • val2: second 16-bit operands for each multiplication.
  • -
  • val2: accumulate value.
  • -
-
Return Value -

The function returns the product of each multiplication added to the accumulate value.

-
Operation -
-p1 = val1[15:0]  * val2[15:0]
-p2 = val1[31:16] * val2[31:16]
-sum = p1 + p2 + val3[63:32][31:0]
-res[63:32] = sum[63:32]
-res[31:0]  = sum[31:0]
-
- -

Function __SMLALDX

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-unsigned long long __SMLALDX(uint32_t val1, uint32_t val2, unsigned long long val3);
-
DescriptionThis function enables you to exchange the halfwords of the second operand, and perform - two signed 16-bit multiplications, adding both results to a 64-bit accumulate operand. - Overflow is only possible as a result of the 64-bit addition. This overflow is not detected - if it occurs. Instead, the result wraps around modulo264. -
Parameter -
    -
  • val1: first 16-bit operands for each multiplication.
  • -
  • val2: second 16-bit operands for each multiplication.
  • -
  • val2: accumulate value.
  • -
-
Return Value -

The function returns the product of each multiplication added to the accumulate value.

-
Operation -
-p1 = val1[15:0]  * val2[31:16]
-p2 = val1[31:16] * val2[15:0]
-sum = p1 + p2 + val3[63:32][31:0]
-res[63:32] = sum[63:32]
-res[31:0] = sum[31:0]
-
- -

Function __SMUSD

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SMUSD(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform two 16-bit signed multiplications, taking the - difference of the products by subtracting the high halfword product from the low - halfword product. -
Parameter -
    -
  • val1: first 16-bit operands for each multiplication.
  • -
  • val2: second 16-bit operands for each multiplication.
  • -
-
Return Value -

The function returns the difference of the products of the two 16-bit signed multiplications.

-
Operation -
-p1 = val1[15:0]  * val2[15:0]
-p2 = val1[31:16] * val2[31:16]
-res[31:0] = p1 - p2
-
- -

Function __SMUSDX

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SMUSDX(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to perform two 16-bit signed multiplications, subtracting one - of the products from the other. The halfwords of the second operand are exchanged - before performing the arithmetic. This produces top * bottom and bottom * top - multiplication. -
Parameter -
    -
  • val1: first 16-bit operands for each multiplication.
  • -
  • val2: second 16-bit operands for each multiplication.
  • -
-
Return Value -

The function returns the difference of the products of the two 16-bit signed multiplications.

-
Operation -
-p1 = val1[15:0]  * val2[31:16]
-p2 = val1[31:16] * val2[15:0]
-res[31:0] = p1 - p2
-
- -

Function __SMLSD

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SMLSD(uint32_t val1, uint32_t val2, uint32_t val3);
-
DescriptionThis function enables you to perform two 16-bit signed multiplications, take the - difference of the products, subtracting the high halfword product from the low halfword - product, and add the difference to a 32-bit accumulate operand.
- The Q bit is set if the accumulation overflows. Overflow cannot occur during the multiplications or the - subtraction. -
Parameter -
    -
  • val1: first 16-bit operands for each multiplication.
  • -
  • val2: second 16-bit operands for each multiplication.
  • -
  • val3: accumulate value.
  • -
-
Return Value -

The function returns the difference of the product of each multiplication, added - to the accumulate value.

-
Operation -
-p1 = val1[15:0]  * val2[15:0]
-p2 = val1[31:16] * val2[31:16]
-res[31:0] = p1 - p2 + val3[31:0]
-
- -

Function __SMLSDX

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SMLSDX(uint32_t val1, uint32_t val2, uint32_t val3);
-
DescriptionThis function enables you to exchange the halfwords in the second operand, then perform - two 16-bit signed multiplications. The difference of the products is added to a 32-bit - accumulate operand.
- The Q bit is set if the addition overflows. Overflow cannot occur during the multiplications or the subtraction. -
Parameter -
    -
  • val1: first 16-bit operands for each multiplication.
  • -
  • val2: second 16-bit operands for each multiplication.
  • -
  • val3: accumulate value.
  • -
-
Return Value -

The function returns the difference of the product of each multiplication, added - to the accumulate value.

-
Operation -
-p1 = val1[15:0]  * val2[31:16]
-p2 = val1[31:16] * val2[15:0]
-res[31:0] = p1 - p2 + val3[31:0]
-
- -

Function __SMLSLD

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint64_t __SMLSLD(uint32_t val1, uint32_t val2, uint64_t val3);
-
DescriptionThis function It enables you to perform two 16-bit signed multiplications, take the - difference of the products, subtracting the high halfword product from the low halfword - product, and add the difference to a 64-bit accumulate operand. Overflow cannot occur - during the multiplications or the subtraction. Overflow can occur as a result of the 64-bit - addition, and this overflow is not detected. Instead, the result wraps round to - modulo264. -
Parameter -
    -
  • val1: first 16-bit operands for each multiplication.
  • -
  • val2: second 16-bit operands for each multiplication.
  • -
  • val3: accumulate value.
  • -
-
Return Value -

The function returns the difference of the product of each multiplication, - added to the accumulate value.

-
Operation -
-p1 = val1[15:0]  * val2[15:0]
-p2 = val1[31:16] * val2[31:16]
-res[63:0] = p1 - p2 + val3[63:0]
-
- -

Function __SMLSLDX

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-unsigned long long __SMLSLDX(uint32_t val1, uint32_t val2, unsigned long long val3);
-
DescriptionThis function enables you to exchange the halfwords of the second operand, perform two - 16-bit multiplications, adding the difference of the products to a 64-bit accumulate - operand. Overflow cannot occur during the multiplications or the subtraction. Overflow - can occur as a result of the 64-bit addition, and this overflow is not detected. Instead, - the result wraps round to modulo264. -
Parameter -
    -
  • val1: first 16-bit operands for each multiplication.
  • -
  • val2: second 16-bit operands for each multiplication.
  • -
  • val3: accumulate value.
  • -
-
Return Value -

The function returns the difference of the product of each multiplication, - added to the accumulate value.

-
Operation -
-p1 = val1[15:0]  * val2[31:16]
-p2 = val1[31:16] * val2[15:0]
-res[63:0] = p1 - p2 + val3[63:0]
-
- - -

Function __SEL

- - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __SEL(uint32_t val1, uint32_t val2);
-
DescriptionThis function inserts a SEL instruction into the instruction stream generated by the - compiler. It enables you to select bytes from the input parameters, whereby the bytes - that are selected depend upon the results of previous SIMD instruction function. The - results of previous SIMD instruction function are represented by the Greater than or - Equal flags in the Application Program Status Register (APSR). - The __SEL function works equally well on both halfword and byte operand function - results. This is because halfword operand operations set two (duplicate) GE bits per - value. -
Parameter -
    -
  • val1: four selectable 8-bit values.
  • -
  • val2: four selectable 8-bit values.
  • -
-
Return Value -

The function selects bytes from the input parameters and returns them in the - return value, res, according to the following criteria:

-
    -
  • if APSR.GE[0] == 1 then res[7:0] = val1[7:0] else res[7:0] = val2[7:0]
  • -
  • if APSR.GE[1] == 1 then res[15:8] = val1[15:8] else res[15:8] = val2[15:8]
  • -
  • if APSR.GE[2] == 1 then res[23:16] = val1[23:16] else res[23:16] = val2[23:16]
  • -
  • if APSR.GE[3] == 1 then res[31;24] = val1[31:24] else res = val2[31:24]
  • -
-
- -

Function __QADD

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __QADD(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to obtain the saturating add of two integers.
- The Q bit is set if the operation saturates. -
Parameter -
    -
  • val1: first summand of the saturating add operation.
  • -
  • val2: second summand of the saturating add operation.
  • -
-
Return Value -

The function returns the saturating addition of val1 and val2.

-
Operation -
-res[31:0] = SAT(val1 + SAT(val2 * 2))
-
- -

Function __QSUB

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary -
-uint32_t __QSUB(uint32_t val1, uint32_t val2);
-
DescriptionThis function enables you to obtain the saturating subtraction of two integers.
- The Q bit is set if the operation saturates. -
Parameter -
    -
  • val1: minuend of the saturating subtraction operation.
  • -
  • val2: subtrahend of the saturating subtraction operation.
  • -
-
Return Value -

The function returns the saturating subtraction of val1 and val2.

-
Operation -
-res[31:0] = SAT(val1 - SAT(val2 * 2))
-
- - - -

 

-

Examples

-

Following are some coding examples using the SIMD functions: -

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
AdditionAdd two values using SIMD function
SubtractionSubtract two values using SIMD function
MultiplicationPerforming a multiplication using SIMD function
- - -

Addition

- - - - - - - -
Example -
-uint32_t add_halfwords(uint32_t val1, uint32_t val2)
-{
-   uint32_t res;
-   res = __SADD16(val1, val2);
-   return res;
-}
-
- -

Subtraction

- - - - - - - -
Example -
-uint32_t sub_halfwords(uint32_t val1, uint32_t val2)
-{
-  uint32_t res;
-  res = __SSUB16(val1, val2);
-  return res;
-}
-
- -

Multiplication

- - - - - - - -
Example -
-uint32_t dual_mul_add_products(uint32_t val1, uint32_t val2)
-{
-  uint32_t res;
-  res = __SMUAD(val1, val2);
-  return res;
-}
-
- - - - \ No newline at end of file diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS_Core.htm b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS_Core.htm deleted file mode 100644 index aff81c9bc..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS_Core.htm +++ /dev/null @@ -1,1470 +0,0 @@ - - - - CMSIS: Cortex Microcontroller Software Interface Standard - - - -

Cortex Microcontroller Software Interface Standard

- -

This file describes the Cortex Microcontroller Software Interface Standard (CMSIS).

-

Version: 2.10 - July 2011

- -

Information in this file, the accompany manuals, and software is
- Copyright © ARM Ltd.
All rights reserved. -

- -
- -

Revision History

- - -
- -

Contents

- -
    -
  1. About
  2. -
  3. Coding Rules and Conventions
  4. -
  5. CMSIS Files
  6. -
  7. Core Peripheral Access Layer
  8. -
  9. CMSIS Example
  10. -
  11. CMSIS MISRA-C:2004 Compliance Exceptions
  12. -
- -

About

- -

- The Cortex Microcontroller Software Interface Standard (CMSIS) answers the challenges - that are faced when software components are deployed to physical microcontroller devices based on a - Cortex-M0 or Cortex-M3 processor. The CMSIS will be also expanded to future Cortex-M - processor cores (the term Cortex-M is used to indicate that). The CMSIS is defined in close co-operation - with various silicon and software vendors and provides a common approach to interface to peripherals, - real-time operating systems, and middleware components. -

- -

ARM provides as part of the CMSIS the following software layers that are -available for various compiler implementations:

- - -

These software layers are expanded by Silicon partners with:

- - -

CMSIS defines for a Cortex-M Microcontroller System:

- - -

- By using CMSIS compliant software components, the user can easier re-use template code. - CMSIS is intended to enable the combination of software components from multiple middleware vendors. -

- -

Coding Rules and Conventions

- -

- The following section describes the coding rules and conventions used in the CMSIS - implementation. It contains also information about data types and version number information. -

- -

Essentials

- - -

Recommendations

- -

The CMSIS recommends the following conventions for identifiers.

- - -Comments - - - -

Data Types and IO Type Qualifiers

- -

- The Cortex-M HAL uses the standard types from the standard ANSI C header file - <stdint.h>. IO Type Qualifiers are used to specify the access - to peripheral variables. IO Type Qualifiers are indented to be used for automatic generation of - debug information of peripheral registers. -

- - - - - - - - - - - - - - - - - - - - - - - - -
IO Type Qualifier#defineDescription
__Ivolatile constRead access only
__OvolatileWrite access only
__IOvolatileRead and write access
- -

CMSIS Version Number

-

- File core_cm4.h contains the version number of the CMSIS with the following define: -

- -
-#define __CM4_CMSIS_VERSION_MAIN  (0x02)      /* [31:16] main version       */
-#define __CM4_CMSIS_VERSION_SUB   (0x10)      /* [15:0]  sub version        */
-#define __CM4_CMSIS_VERSION       ((__CM4_CMSIS_VERSION_MAIN << 16) | __CM4_CMSIS_VERSION_SUB)
- -

- File core_cm3.h contains the version number of the CMSIS with the following define: -

- -
-#define __CM3_CMSIS_VERSION_MAIN  (0x02)      /* [31:16] main version       */
-#define __CM3_CMSIS_VERSION_SUB   (0x10)      /* [15:0]  sub version        */
-#define __CM3_CMSIS_VERSION       ((__CM3_CMSIS_VERSION_MAIN << 16) | __CM3_CMSIS_VERSION_SUB)
- -

- File core_cm0.h contains the version number of the CMSIS with the following define: -

- -
-#define __CM0_CMSIS_VERSION_MAIN  (0x02)      /* [31:16] main version       */
-#define __CM0_CMSIS_VERSION_SUB   (0x10)      /* [15:0]  sub version        */
-#define __CM0_CMSIS_VERSION       ((__CM0_CMSIS_VERSION_MAIN << 16) | __CM0_CMSIS_VERSION_SUB)
- - -

CMSIS Cortex Core

-

- File core_cm4.h contains the type of the CMSIS Cortex-M with the following define: -

- -
-#define __CORTEX_M                (0x04)
- -

- File core_cm3.h contains the type of the CMSIS Cortex-M with the following define: -

- -
-#define __CORTEX_M                (0x03)
- -

- File core_cm0.h contains the type of the CMSIS Cortex-M with the following define: -

- -
-#define __CORTEX_M                (0x00)
- - -

CMSIS Files

-

- This section describes the Files provided in context with the CMSIS to access the Cortex-M - hardware and peripherals. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileProviderDescription
device.hDevice specific (provided by silicon partner)Defines the peripherals for the actual device. The file may use - several other include files to define the peripherals of the actual device.
core_cm0.hARM (for RealView ARMCC, IAR, and GNU GCC)Defines the core peripherals for the Cortex-M0 CPU and core peripherals.
core_cm3.hARM (for RealView ARMCC, IAR, and GNU GCC)Defines the core peripherals for the Cortex-M3 CPU and core peripherals.
core_cm4.hARM (for RealView ARMCC, IAR, and GNU GCC)Defines the core peripherals for the Cortex-M4 CPU and core peripherals.
core_cm4_simd.hARM (for RealView ARMCC, IAR, and GNU GCC)Defines the Cortex-M4 Core SIMD functions.
core_cmFunc.hARM (for RealView ARMCC, IAR, and GNU GCC)Defines the Cortex-M Core Register access functions.
core_cmInstr.hARM (for RealView ARMCC, IAR, and GNU GCC)Defines the Cortex-M Core instructions.
startup_deviceARM (adapted by compiler partner / silicon partner)Provides the Cortex-M startup code and the complete (device specific) Interrupt Vector Table
system_deviceARM (adapted by silicon partner)Provides a device specific configuration file for the device. It configures the device initializes - typically the oscillator (PLL) that is part of the microcontroller device
- -

device.h

- -

- The file device.h is provided by the silicon vendor and is the - central include file that the application programmer is using in - the C source code. This file contains: -

- - - -

Interrupt Number Definition

- -

To access the device specific interrupts the device.h file defines IRQn -numbers for the complete device using a enum typedef as shown below:

-
-typedef enum IRQn
-{
-/******  Cortex-M3 Processor Exceptions/Interrupt Numbers ************************************************/
-  NonMaskableInt_IRQn             = -14,      /*!< 2 Non Maskable Interrupt                              */
-  HardFault_IRQn                  = -13,      /*!< 3 Cortex-M3 Hard Fault Interrupt                      */
-  MemoryManagement_IRQn           = -12,      /*!< 4 Cortex-M3 Memory Management Interrupt               */
-  BusFault_IRQn                   = -11,      /*!< 5 Cortex-M3 Bus Fault Interrupt                       */
-  UsageFault_IRQn                 = -10,      /*!< 6 Cortex-M3 Usage Fault Interrupt                     */
-  SVCall_IRQn                     = -5,       /*!< 11 Cortex-M3 SV Call Interrupt                        */
-  DebugMonitor_IRQn               = -4,       /*!< 12 Cortex-M3 Debug Monitor Interrupt                  */
-  PendSV_IRQn                     = -2,       /*!< 14 Cortex-M3 Pend SV Interrupt                        */
-  SysTick_IRQn                    = -1,       /*!< 15 Cortex-M3 System Tick Interrupt                    */
-/******  STM32 specific Interrupt Numbers ****************************************************************/
-  WWDG_STM_IRQn                   = 0,        /*!< Window WatchDog Interrupt                             */
-  PVD_STM_IRQn                    = 1,        /*!< PVD through EXTI Line detection Interrupt             */
-  :
-  :
-  } IRQn_Type;
- - -

Device Specific Defines

-

- The following device implementation specific defines are set in the device header file and are - used for the Cortex-M core configuration options. Some configuration options are reflected - in the CMSIS layer using the #define settings described below. -

-

- Several features in core_cm#.h are configured by the following defines - that must be defined before #include <core_cm#.h> - preprocessor command. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#defineCoreValueDescription
__CM0_REVM00x0000Core revision number ([15:8] revision number, [7:0] patch number)
__CM3_REVM30x0101 | 0x0200Core revision number ([15:8] revision number, [7:0] patch number)
__CM4_REVM40x0000Core revision number ([15:8] revision number, [7:0] patch number)
__NVIC_PRIO_BITSM0, M3, M42 .. 8Number of priority bits implemented in the NVIC (device specific)
__MPU_PRESENTM0, M3, M40 | 1Defines if a MPU is present or not
__FPU_PRESENTM40 | 1Defines if a FPU is present or not
__Vendor_SysTickConfigM0, M3, M40 | 1When this define is setup to 1, the SysTickConfig function - in core_cm3.h is excluded. In this case the device.h - file must contain a vendor specific implementation of this function.
- - -

Device Peripheral Access Layer

-

- Each peripheral uses a prefix which consists of <device abbreviation>_ - and <peripheral name>_ to identify peripheral registers that access this - specific peripheral. The intention of this is to avoid name collisions caused - due to short names. If more than one peripheral of the same type exists, - identifiers have a postfix (digit or letter). For example: -

- - -
Minimal Requiements
-

- To access the peripheral registers and related function in a device the files device.h - and core_cm0.h / core_cm3.h defines as a minimum: -

- - -

- These definitions allow to access the peripheral registers from user code with simple assignments like: -

-
SysTick->CTRL = 0;
- -
Optional Features
-

In addition the device.h file may define:

- - -

core_cm0.h

-

- File core_cm0.h describes the data structures for the Cortex-M0 core peripherals and does - the address mapping of this structures. It also provides basic access to the Cortex-M0 core registers - and core peripherals with efficient functions (defined as static inline). -

-

This file implement the Core Peripheral Access Layer for a Cortex-M0.

-

The define __CMSIS_GENERIC allows to use core_cm0.h in generic - library projects that are device independent. Only core relevant types and defines are used.

- -

core_cm3.h

-

- File core_cm3.h describes the data structures for the Cortex-M3 core peripherals and does - the address mapping of this structures. It also provides basic access to the Cortex-M3 core registers - and core peripherals with efficient functions (defined as static inline). -

-

This file implement the Core Peripheral Access Layer for a Cortex-M3.

-

The define __CMSIS_GENERIC allows to use core_cm3.h in generic - library projects that are device independent. Only core relevant types and defines are used.

- -

core_cm4.h, core_cm4_simd.h

-

- File core_cm4.h describes the data structures for the Cortex-M4 core peripherals and does - the address mapping of this structures. It also provides basic access to the Cortex-M4 core registers - and core peripherals with efficient functions (defined as static inline). -

-

- File core_cm4_simd.h defines Cortex-M4 SIMD instructions. -

-

Together these files implement the Core Peripheral Access Layer for a Cortex-M4.

-

The define __CMSIS_GENERIC allows to use core_cm4.h in generic - library projects that are device independent. Only core relevant types and defines are used.

- -

core_cmFunc.h and core_cmInstr.h

-

- File core_cmFunc.h defines the Cortex-M Core Register access functions (defined as static inline). -

-

- File core_cmInstr.h defines the Cortex-M Core instructions (defined as static inline). -

-

These files are part of the Core Peripheral Access Layer for a Cortex-M.

- -

startup_device

-

- A template file for startup_device is provided by ARM for each supported - compiler. It is adapted by the silicon vendor to include interrupt vectors for all device specific - interrupt handlers. Each interrupt handler is defined as weak function - to an dummy handler. Therefore the interrupt handler can be directly used in application software - without any requirements to adapt the startup_device file. -

-

- The following exception names are fixed and define the start of the vector table for a Cortex-M0: -

-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
- -

- The following exception names are fixed and define the start of the vector table for a Cortex-M3: -

-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     MemManage_Handler         ; MPU Fault Handler
-                DCD     BusFault_Handler          ; Bus Fault Handler
-                DCD     UsageFault_Handler        ; Usage Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     DebugMon_Handler          ; Debug Monitor Handler
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
- -

- In the following examples for device specific interrupts are shown: -

-
-; External Interrupts
-                DCD     WWDG_IRQHandler           ; Window Watchdog
-                DCD     PVD_IRQHandler            ; PVD through EXTI Line detect
-                DCD     TAMPER_IRQHandler         ; Tamper
- -

- Device specific interrupts must have a dummy function that can be overwritten in user code. - Below is an example for this dummy function. -

-
-Default_Handler PROC
-                EXPORT WWDG_IRQHandler   [WEAK]
-                EXPORT PVD_IRQHandler    [WEAK]
-                EXPORT TAMPER_IRQHandler [WEAK]
-                :
-                :
-                WWDG_IRQHandler
-                PVD_IRQHandler
-                TAMPER_IRQHandler
-                :
-                :
-                B .
-                ENDP
- -

- The user application may simply define an interrupt handler function by using the handler name - as shown below. -

-
-void WWDG_IRQHandler(void)
-{
-  :
-  :
-}
- - -

system_device.c

-

- A template file for system_device.c is provided by ARM but adapted by - the silicon vendor to match their actual device. As a minimum requirement - this file must provide a device specific system configuration function and a global variable - that contains the system frequency. It configures the device and initializes typically the - oscillator (PLL) that is part of the microcontroller device. -

-

- The file system_device.c must provide - as a minimum requirement the SystemInit function as shown below. -

- - - - - - - - - - - - - - - - -
Function DefinitionDescription
void SystemInit (void)Setup the microcontroller system. Typically this function configures the - oscillator (PLL) that is part of the microcontroller device. For systems - with variable clock speed it also updates the variable SystemCoreClock.
- SystemInit is called from startup_device file.
void SystemCoreClockUpdate (void)Updates the variable SystemCoreClock and must be called whenever the - core clock is changed during program execution. SystemCoreClockUpdate() - evaluates the clock register settings and calculates the current core clock. -
- -

- Also part of the file system_device.c - is the variable SystemCoreClock which contains the current CPU clock speed shown below. -

- - - - - - - - - - - - -
Variable DefinitionDescription
uint32_t SystemCoreClockContains the system core clock (which is the system clock frequency supplied - to the SysTick timer and the processor core clock). This variable can be - used by the user application to setup the SysTick timer or configure other - parameters. It may also be used by debugger to query the frequency of the - debug timer or configure the trace clock speed.
- SystemCoreClock is initialized with a correct predefined value.

- The compiler must be configured to avoid the removal of this variable in - case that the application program is not using it. It is important for - debug systems that the variable is physically present in memory so that - it can be examined to configure the debugger.
- -

Note

- - - -

Core Peripheral Access Layer

- -

Cortex-M Core Register Access

-

- The following functions are defined in core_cm0.h / core_cm3.h - and provide access to Cortex-M core registers. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Function DefinitionCoreCore RegisterDescription
void __enable_irq (void)M0, M3, M4PRIMASK = 0Global Interrupt enable (using the instruction CPSIE i)
void __disable_irq (void)M0, M3, M4PRIMASK = 1Global Interrupt disable (using the instruction CPSID i)
uint32_t __get_CONTROL (void)M0, M3, M4return CONTROLReturn Control Register Value (using the instruction MRS)
void __set_CONTROL (uint32_t value)M0, M3, M4CONTROL = valueSet CONTROL register value (using the instruction MSR)
uint32_t __get_IPSR (void)M0, M3, M4return IPSRReturn IPSR Register Value (using the instruction MRS)
uint32_t __get_APSR (void)M0, M3, M4return APSRReturn APSR Register Value (using the instruction MRS)
uint32_t __get_xPSR (void)M0, M3, M4return xPSRReturn xPSR Register Value (using the instruction MRS)
uint32_t __get_PSP (void)M0, M3, M4return PSPReturn Process Stack Pointer (using the instruction MRS)
void __set_PSP (uint32_t TopOfProcStack)>M0, M3, M4PSP = TopOfProcStackSet Process Stack Pointer value (using the instruction MSR)
uint32_t __get_MSP (void)M0, M3, M4return MSPReturn Main Stack Pointer (using the instruction MRS)
void __set_MSP (uint32_t TopOfMainStack)M0, M3, M4MSP = TopOfMainStackSet Main Stack Pointer (using the instruction MSR)
uint32_t __get_PRIMASK (void)M0, M3, M4return PRIMASKReturn Priority Mask Register (using the instruction MRS)
void __set_PRIMASK (uint32_t value)M0, M3, M4PRIMASK = valueAssign value to Priority Mask Register (using the instruction MSR)
void __enable_fault_irq (void)M3, M4FAULTMASK = 0Global Fault exception and Interrupt enable (using the instruction CPSIE f)
void __disable_fault_irq (void)M3, M4FAULTMASK = 1Global Fault exception and Interrupt disable (using the instruction CPSID f)
uint32_t __get_BASEPRI (void)M3, M4return BASEPRIReturn Base Priority (using the instruction MRS)
void __set_BASEPRI (uint32_t value)M3, M4BASEPRI = valueSet Base Priority (using the instruction MSR)
uint32_t __get_FAULTMASK (void)M3, M4return FAULTMASKReturn Fault Mask Register (using the instruction MRS)
void __set_FAULTMASK (uint32_t value)M3, M4FAULTMASK = valueAssign value to Fault Mask Register (using the instruction MSR)
uint32_t __get_FPSCR (void)M4return FPSCRReturn Floating Point Status / Control Register
void __set_FPSCR (uint32_t value)M4FPSCR = valueAssign value to Floating Point Status / Control Register
- -

Cortex-M Instruction Access

-

- The following functions are defined in core_cm0.h / core_cm3.hand - generate specific Cortex-M instructions. The functions are implemented in the file - core_cm0.c / core_cm3.c. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameCoreGenerated CPU InstructionDescription
void __NOP (void)M0, M3, M4NOPNo Operation
void __WFI (void)M0, M3, M4WFIWait for Interrupt
void __WFE (void)M0, M3, M4WFEWait for Event
void __SEV (void)M0, M3, M4SEVSet Event
void __ISB (void)M0, M3, M4ISBInstruction Synchronization Barrier
void __DSB (void)M0, M3, M4DSBData Synchronization Barrier
void __DMB (void)M0, M3, M4DMBData Memory Barrier
uint32_t __REV (uint32_t value)M0, M3, M4REVReverse byte order in integer value.
uint32_t __REV16 (uint16_t value)M0, M3, M4REV16Reverse byte order in unsigned short value.
sint32_t __REVSH (sint16_t value)M0, M3, M4REVSHReverse byte order in signed short value with sign extension to integer.
uint32_t __RBIT (uint32_t value)M3, M4RBITReverse bit order of value
uint8_t __LDREXB (uint8_t *addr)M3, M4LDREXBLoad exclusive byte
uint16_t __LDREXH (uint16_t *addr)M3, M4LDREXHLoad exclusive half-word
uint32_t __LDREXW (uint32_t *addr)M3, M4LDREXWLoad exclusive word
uint8_t __STREXB (uint8_t value, uint8_t *addr)M3, M4STREXBStore exclusive byte
uint16_t __STREXH (uint16_t value, uint16_t *addr)M3, M4STREXHStore exclusive half-word
uint32_t __STREXW (uint32_t value, uint32_t *addr)M3, M4STREXWStore exclusive word
void __CLREX (void)M3, M4CLREXRemove the exclusive lock created by __LDREXB, __LDREXH, or __LDREXW
void __SSAT (void)M3, M4SSATsaturate a signed value
void __USAT (void)M3, M4USATsaturate an unsigned value
- - -

NVIC Access Functions

-

- The CMSIS provides access to the NVIC via the register interface structure and several helper - functions that simplify the setup of the NVIC. The CMSIS HAL uses IRQ numbers (IRQn) to - identify the interrupts. The first device interrupt has the IRQn value 0. Therefore negative - IRQn values are used for processor core exceptions. -

-

- For the IRQn values of core exceptions the file device.h provides - the following enum names. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Core Exception enum ValueCoreIRQnDescription
NonMaskableInt_IRQnM0, M3, M4-14Cortex-M Non Maskable Interrupt
HardFault_IRQnM0, M3, M4-13Cortex-M Hard Fault Interrupt
MemoryManagement_IRQnM3, M4-12Cortex-M Memory Management Interrupt
BusFault_IRQnM3, M4-11Cortex-M Bus Fault Interrupt
UsageFault_IRQnM3, M4-10Cortex-M Usage Fault Interrupt
SVCall_IRQnM0, M3, M4-5Cortex-M SV Call Interrupt
DebugMonitor_IRQnM3, M4-4Cortex-M Debug Monitor Interrupt
PendSV_IRQnM0, M3, M4-2Cortex-M Pend SV Interrupt
SysTick_IRQnM0, M3, M4-1Cortex-M System Tick Interrupt
- -

The following functions simplify the setup of the NVIC. -The functions are defined as static inline.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameCoreParameterDescription
void NVIC_SetPriorityGrouping (uint32_t PriorityGroup)M3, M4Priority Grouping ValueSet the Priority Grouping (Groups . Subgroups)
uint32_t NVIC_GetPriorityGrouping (void)M3, M4(void)Get the Priority Grouping (Groups . Subgroups)
void NVIC_EnableIRQ (IRQn_Type IRQn)M0, M3, M4IRQ NumberEnable IRQn
void NVIC_DisableIRQ (IRQn_Type IRQn)M0, M3, M4IRQ NumberDisable IRQn
uint32_t NVIC_GetPendingIRQ (IRQn_Type IRQn)M0, M3, M4IRQ NumberReturn 1 if IRQn is pending else 0
void NVIC_SetPendingIRQ (IRQn_Type IRQn)M0, M3, M4IRQ NumberSet IRQn Pending
void NVIC_ClearPendingIRQ (IRQn_Type IRQn)M0, M3, M4IRQ NumberClear IRQn Pending Status
uint32_t NVIC_GetActive (IRQn_Type IRQn)M3, M4IRQ NumberReturn 1 if IRQn is active else 0
void NVIC_SetPriority (
-   IRQn_Type IRQn,
-   uint32_t priority)
M0, M3, M4IRQ Number, PrioritySet Priority for IRQn
- (not threadsafe for Cortex-M0)
uint32_t NVIC_GetPriority (IRQn_Type IRQn)M0, M3, M4IRQ NumberGet Priority for IRQn
uint32_t NVIC_EncodePriority (
-   uint32_t PriorityGroup,
-   uint32_t PreemptPriority,
-   uint32_t SubPriority)
M3, M4IRQ Number,
- Priority Group,
- Preemptive Priority,
- Sub Priority
Encode priority for given group, preemptive and sub priority
void NVIC_DecodePriority (
-   uint32_t Priority,
-   uint32_t PriorityGroup,
-   uint32_t* pPreemptPriority,
-   uint32_t* pSubPriority)
M3, M4
- Priority,
- Priority Group,
- pointer to Preempt. Priority,
- pointer to Sub Priority
Decode given priority to group, preemptive and sub priority
void NVIC_SystemReset (void)M0, M3, M4(void)Resets the System
-

Note

- - - -

SysTick Configuration Function

- -

The following function is used to configure the SysTick timer and start the -SysTick interrupt.

- - - - - - - - - - - - - - -
NameParameterDescription
uint32_t SysTickConfig (uint32_t ticks)ticks is SysTick counter reload valueSetup the SysTick timer and enable the SysTick interrupt. After this - call the SysTick timer creates interrupts with the specified time interval.

- Return: 0 when successful, 1 on failure.
-
- - -

Cortex-M3 / Cortex-M4 ITM Debug Access

- -

The Cortex-M3 / Cortex-M4 incorporates the Instrumented Trace Macrocell (ITM) that -provides together with the Serial Viewer Output trace capabilities for the -microcontroller system. The ITM has 32 communication channels; two ITM -communication channels are used by CMSIS to output the following information:

- -

Note

- - -

The prototype of the ITM_SendChar routine is shown in the -table below.

- - - - - - - - - - - - - - -
NameParameterDescription
void uint32_t ITM_SendChar(uint32_t chr)character to outputThe function outputs a character via the ITM channel 0. The - function returns when no debugger is connected that has booked the - output. It is blocking when a debugger is connected, but the - previous character send is not transmitted.

- Return: the input character 'chr'. -
- -

- Example for the usage of the ITM Channel 31 for RTOS Kernels: -

-
-  // check if debugger connected and ITM channel enabled for tracing
-  if ((CoreDebug->DEMCR & CoreDebug_DEMCR_TRCENA) &&
-  (ITM->TCR & ITM_TCR_ITMENA) &&
-  (ITM->TER & (1UL << 31))) {
-    // transmit trace data
-    while (ITM->PORT31_U32 == 0);
-    ITM->PORT[31].u8 = task_id;      // id of next task
-    while (ITM->PORT[31].u32 == 0);
-    ITM->PORT[31].u32 = task_status; // status information
-  }
- - -

Cortex-M3 additional Debug Access

- -

CMSIS provides additional debug functions to enlarge the Cortex-M3 Debug Access. -Data can be transmitted via a certain global buffer variable towards the target system.

- -

The buffer variable and the prototypes of the additional functions are shown in the -table below.

- - - - - - - - - - - - - - - - - - - - - - - - -
NameParameterDescription
extern volatile int ITM_RxBuffer Buffer to transmit data towards debug system.

- Value 0x5AA55AA5 indicates that buffer is empty.
int ITM_ReceiveChar (void)noneThe nonblocking functions returns the character stored in - ITM_RxBuffer.

- Return: -1 indicates that no character was received.
int ITM_CheckChar (void)noneThe function checks if a character is available in ITM_RxBuffer.

- Return: 1 indicates that a character is available, 0 indicates that - no character is available.
- - -

CMSIS Example

-

- The following section shows a typical example for using the CMSIS layer in user applications. - The example is based on a STM32F10x Device. -

-
-#include "stm32f10x.h"
-
-volatile uint32_t msTicks;                       /* timeTicks counter */
-
-void SysTick_Handler(void) {
-  msTicks++;                                     /* increment timeTicks counter */
-}
-
-__INLINE static void Delay (uint32_t dlyTicks) {
-  uint32_t curTicks = msTicks;
-
-  while ((msTicks - curTicks) < dlyTicks);
-}
-
-__INLINE static void LED_Config(void) {
-  ;                                              /* Configure the LEDs */
-}
-
-__INLINE static void LED_On (uint32_t led) {
-  ;                                              /* Turn On  LED */
-}
-
-__INLINE static void LED_Off (uint32_t led) {
-  ;                                              /* Turn Off LED */
-}
-
-int main (void) {
-  if (SysTick_Config (SystemCoreClock / 1000)) { /* Setup SysTick for 1 msec interrupts */
-    ;                                            /* Handle Error */
-    while (1);
-  }
-  
-  LED_Config();                                  /* configure the LEDs */                            
- 
-  while(1) {
-    LED_On (0x100);                              /* Turn  on the LED   */
-    Delay (100);                                 /* delay  100 Msec    */
-    LED_Off (0x100);                             /* Turn off the LED   */
-    Delay (100);                                 /* delay  100 Msec    */
-  }
-}
- - -

CMSIS MISRA-C:2004 Compliance Exceptions

-

- CMSIS violates following MISRA-C2004 Rules: -

- - -

  

- - \ No newline at end of file diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS_DebugSupport.htm b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS_DebugSupport.htm deleted file mode 100644 index 96cc60ddb..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS_DebugSupport.htm +++ /dev/null @@ -1,240 +0,0 @@ - - - -CMSIS Debug Support - - - - - - - - -

CMSIS Debug Support

-

This file describes the CMSIS Debug support available with CMSIS (starting V1.30).

-

Version: 1.02 - 25. July 2011

- -

Information in this file, the accompany manuals, and software is
- Copyright © ARM Ltd.
All rights reserved. -

- -
- -

Revision History

- - -
- -

Contents

- -
    -
  1. About
  2. -
  3. Cortex-M3 / Cortex-M4 ITM Debug Access
  4. -
  5. Debug IN / OUT functions
  6. -
  7. ITM Debug Support in Debugger
  8. -
- -

 

-

About

-

- CMSIS provides for Cortex-M3 / Cortex-M4 processor based microcontrollers debug support via the Instrumented Trace Macrocell (ITM). - This document describes the available CMSIS Debug functions and the used methods. -

- -

 

-

Cortex-M3 / Cortex-M4 ITM Debug Access

-

- The Cortex-M3 incorporates the Instrumented Trace Macrocell (ITM) that provides together with - the Serial Viewer Output trace capabilities for the microcontroller system. The ITM has - 32 communication channels which are able to transmit 32 / 16 / 8 bit values; two ITM - communication channels are used by CMSIS to output the following information: -

- - -

 

-

Debug IN / OUT functions

-

CMSIS provides following debug functions:

- - -

ITM_SendChar

-

- ITM_SendChar is used to transmit a character over ITM channel 0 from - the microcontroller system to the debug system.
- Only a 8 bit value is transmitted. -

-
-static __INLINE uint32_t ITM_SendChar (uint32_t ch)
-{
-  /* check if debugger connected and ITM channel enabled for tracing */
-  if ((CoreDebug->DEMCR & CoreDebug_DEMCR_TRCENA)  &&
-      (ITM->TCR & ITM_TCR_ITMENA)                  &&
-      (ITM->TER & (1UL << 0))  ) 
-  {
-    while (ITM->PORT[0].u32 == 0);
-    ITM->PORT[0].u8 = (uint8_t)ch;
-  }  
-  return (ch);
-}
- -

ITM_ReceiveChar

-

- ITM communication channel is only capable for OUT direction. For IN direction - a global variable is used. A simple mechanism detects if a character is received. - The project to test need to be build with debug information. -

- -

- The global variable ITM_RxBuffer is used to transmit a 8 bit value from debug system - to microcontroller system. ITM_RxBuffer is 32 bit wide to - ensure a proper handshake. -

-
-extern volatile int32_t ITM_RxBuffer;                    /* variable to receive characters                             */
-
-

- A dedicated bit pattern is used to determine if ITM_RxBuffer is empty - or contains a valid value. -

-
-#define                 ITM_RXBUFFER_EMPTY    0x5AA55AA5 /* value identifying ITM_RxBuffer is ready for next character */
-
-

- ITM_ReceiveChar is used to receive a 8 bit value from the debug system. The function is nonblocking. - It returns the received character or '-1' if no character was available. -

-
-static __INLINE int32_t ITM_ReceiveChar (void) {
-  int32_t ch = -1;                               /* no character available */
-
-  if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) {
-    ch = ITM_RxBuffer;
-    ITM_RxBuffer = ITM_RXBUFFER_EMPTY;       /* ready for next character */
-  }
-  
-  return (ch); 
-}
-
- -

ITM_CheckChar

-

- ITM_CheckChar is used to check if a character is received. -

-
-static __INLINE int32_t ITM_CheckChar (void) {
-
-  if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) {
-    return (0);                                 /* no character available */
-  } else {
-    return (1);                                 /*    character available */
-  }
-}
- - -

 

-

ITM Debug Support in a Debugger

-

- The Debugger shall offer a dedicated console window for printf style debug input and output using the CMSIS defined ITM methods described above. -

-

Direction: Microcontroller -> Debugger:

- - -

Direction: Debugger -> Microcontroller:

- - - - - \ No newline at end of file diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS_History.htm b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS_History.htm deleted file mode 100644 index a906ae99c..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS_History.htm +++ /dev/null @@ -1,472 +0,0 @@ - - - -CMSIS Version History - - - - - - - - -

CMSIS Version History

-

This document describes the changes between the different CMSIS versions.

-

Version: 2.10 - July 2011

- -

Information in this file, the accompany manuals, and software is
- Copyright © ARM Ltd.
All rights reserved. -

- -
- - -

Contents

- -
    -
  1. Used Toolchains
  2. -
  3. Changes to version V2.00
  4. -
  5. Changes to version V1.30
  6. -
  7. Changes to version V1.20
  8. -
  9. Open Points
  10. -
  11. Limitations
  12. -
- - -

Used Toolchains

-

- Following toolchains have been used for test / verification:. -

- - - -

Changes to version V2.00

- -

Added CMSIS DSP Software Library support for Cortex-M0 based MCUs

-

- The CMSIS DSP Software Library provides now also libraries and examples for Cortex-M0. -

-

- For more information refer to CMSIS DSP Library documentation. -

- -

Added big endian support for DSP library

-

- The CMSIS DSP Software Library provides now also pre-build libraries - and projects for big endian devices. -

-

- For more information refer to CMSIS DSP Library documentation. -

- - -

Simplified folder structure for CMSIS include files

-

- All CMSIS core include files as well as the DSP-Library header files are located in - a single folder ./CMSIS/Include. -

- -

Changed folder structure for Device Support packages

-

- Device Support packages are expected to be in folder ./Device located at the - same level as ./CMSIS. -

-

The new Device folder contains the following subfolders:

- -

Template files are application specific files and are required to be copied to the project prior to use!

- -

Removed CMSIS core source files

-

- The CMSIS core source files core_cm0.c, core_cm3.c, core_cm4.c - containing helper functions for older ARM compiler versions got removed. -

-

- For the ARM Compiler Toolchain version V4.0.677 or later is - required!

- - -

Changes to version V1.30

- -

Added CMSIS DSP Software Library

-

- The CMSIS DSP Software Library is a suite of common signal processing functions targeted - to Cortex-M processor based microcontrollers. Even though the code has been specifically - optimized towards using the extended DSP instruction set of the Cortex-M4 processor, - the library can be compiled for any Cortex-M processor. -

-

- For more information see CMSIS DSP Library documentation. -

- -

Added CMSIS System View Description

-

- The CMSIS System View Description answers the challenges of accurate, detailed and - timely device aware peripheral debugging support for Cortex Microcontroller based - devices by the software development tools vendor community. -

-

- Silicon vendors shall create and maintain a formalized description of the debug view - for all the peripherals contained in their Cortex Microcontroller based devices. - Tool vendors use such descriptions to establish device specific debug support in - their debugging tools. -

-

- A standardized System View Description shall provide a common approach to - capturing peripheral debug related information in a machine readable files. -

-

- For more information see CMSIS System View Description. -

- -

Added Cortex-M4 Core Support

-

- Additional folder CM4, containing the Cortex-M4 core support files, has been added. -

- - -

New naming for Core Support Files

-

- The new Core Support Files are: -

- - -

Changes to version V1.20

- -

Removed CMSIS Middelware packages

-

- CMSIS Middleware is removed and no longer focus of CMSIS. -

- -

SystemFrequency renamed to SystemCoreClock

-

- The variable name SystemCoreClock is more precise than SystemFrequency - because the variable holds the clock value at which the core is running. -

- -

Changed startup concept

-

- The old startup concept (calling SystemInit_ExtMemCtl from startup file and calling SystemInit - from main) has the weakness that it does not work for controllers which need a already - configuerd clock system to configure the external memory controller. -

- -
Changed startup concept
- - - -

Advanced Debug Functions

-

- ITM communication channel is only capable for OUT direction. To allow also communication for - IN direction a simple concept is provided. -

- - -

- For detailed explanation see file CMSIS debug support.htm. -

- - -

Core Register Bit Definitions

-

- Files core_cm3.h and core_cm0.h contain now bit definitions for Core Registers. The name for the - defines correspond with the Cortex-M Technical Reference Manual. -

-

- e.g. SysTick structure with bit definitions -

-
-/** \brief  Structure type to access the System Timer (SysTick).
- */
-typedef struct
-{
-  __IO uint32_t CTRL;                    /*!< Offset: 0x000 (R/W)  SysTick Control and Status Register */
-  __IO uint32_t LOAD;                    /*!< Offset: 0x004 (R/W)  SysTick Reload Value Register       */
-  __IO uint32_t VAL;                     /*!< Offset: 0x008 (R/W)  SysTick Current Value Register      */
-  __I  uint32_t CALIB;                   /*!< Offset: 0x00C (R/ )  SysTick Calibration Register        */
-} SysTick_Type;
-
-/* SysTick Control / Status Register Definitions */
-#define SysTick_CTRL_COUNTFLAG_Pos         16                                             /*!< SysTick CTRL: COUNTFLAG Position */
-#define SysTick_CTRL_COUNTFLAG_Msk         (1UL << SysTick_CTRL_COUNTFLAG_Pos)            /*!< SysTick CTRL: COUNTFLAG Mask */
-
-#define SysTick_CTRL_CLKSOURCE_Pos          2                                             /*!< SysTick CTRL: CLKSOURCE Position */
-#define SysTick_CTRL_CLKSOURCE_Msk         (1UL << SysTick_CTRL_CLKSOURCE_Pos)            /*!< SysTick CTRL: CLKSOURCE Mask */
-
-#define SysTick_CTRL_TICKINT_Pos            1                                             /*!< SysTick CTRL: TICKINT Position */
-#define SysTick_CTRL_TICKINT_Msk           (1UL << SysTick_CTRL_TICKINT_Pos)              /*!< SysTick CTRL: TICKINT Mask */
-
-#define SysTick_CTRL_ENABLE_Pos             0                                             /*!< SysTick CTRL: ENABLE Position */
-#define SysTick_CTRL_ENABLE_Msk            (1UL << SysTick_CTRL_ENABLE_Pos)               /*!< SysTick CTRL: ENABLE Mask */
-
-/* SysTick Reload Register Definitions */
-#define SysTick_LOAD_RELOAD_Pos             0                                             /*!< SysTick LOAD: RELOAD Position */
-#define SysTick_LOAD_RELOAD_Msk            (0xFFFFFFUL << SysTick_LOAD_RELOAD_Pos)        /*!< SysTick LOAD: RELOAD Mask */
-
-/* SysTick Current Register Definitions */
-#define SysTick_VAL_CURRENT_Pos             0                                             /*!< SysTick VAL: CURRENT Position */
-#define SysTick_VAL_CURRENT_Msk            (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos)        /*!< SysTick VAL: CURRENT Mask */
-
-/* SysTick Calibration Register Definitions */
-#define SysTick_CALIB_NOREF_Pos            31                                             /*!< SysTick CALIB: NOREF Position */
-#define SysTick_CALIB_NOREF_Msk            (1UL << SysTick_CALIB_NOREF_Pos)               /*!< SysTick CALIB: NOREF Mask */
-
-#define SysTick_CALIB_SKEW_Pos             30                                             /*!< SysTick CALIB: SKEW Position */
-#define SysTick_CALIB_SKEW_Msk             (1UL << SysTick_CALIB_SKEW_Pos)                /*!< SysTick CALIB: SKEW Mask */
-
-#define SysTick_CALIB_TENMS_Pos             0                                             /*!< SysTick CALIB: TENMS Position */
-#define SysTick_CALIB_TENMS_Msk            (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos)        /*!< SysTick CALIB: TENMS Mask */
-
-/*@} end of group CMSIS_SysTick */
- -

DoxyGen Tags

-

- DoxyGen tags in files core_cm3.[c,h] and core_cm0.[c,h] are reworked to create proper documentation - using DoxyGen. -

- -

Folder Structure

-

- The folder structure is changed to differentiate the single support packages. -

- - - -

Open Points

-

- Following points need to be clarified and solved: -

- - - -

Limitations

-

- The following limitations are not covered with the current CMSIS version: -

- - diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS_Logo_Final.jpg b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS_Logo_Final.jpg deleted file mode 100644 index e04560175..000000000 Binary files a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS_Logo_Final.jpg and /dev/null differ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS_System_View_Description.htm b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS_System_View_Description.htm deleted file mode 100644 index fe5d71f88..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Documentation/CMSIS_System_View_Description.htm +++ /dev/null @@ -1,1157 +0,0 @@ - - - - CMSIS - SVD: Cortex Microcontroller Software Interface Standard - System View Description - - - - - - -

Cortex Microcontroller Software Interface Standard
-System View Description

- -

This file describes the Cortex Microcontroller Software -Interface Standard - System View Description (CMSIS - SVD) concept and syntax.

-

Version: 1.02 - 27. July 2011

- -

Information in this file, the accompany manuals, and software is
- Copyright © ARM Ltd.
All rights reserved. -

- -
- -

Revision History

- - -

 

- -
- -

Contents

- -
    -
  1. About
  2. -
  3. Motivation
  4. -
  5. Requirements
  6. -
  7. Format
  8. -
  9. Example
  10. -
  11. Questions & Answers
  12. -
- -

About

- -

- The Cortex Microcontroller Software Interface Standard - System View - Description (CMSIS - SVD) answers the challenges - of accurate, detailed and timely device aware peripheral debugging support for Cortex - Microcontroller based devices by the software development - tools vendor community. -

-

- Silicon vendors shall create and maintain a formalized description of the - debug view for all the peripherals contained in their Cortex - Microcontroller based devices. Tool vendors use such descriptions to - establish device specific debug support in their debugging tools with minimal turn around times and - manageable effort. Device support across many development tools  is - essential for silicon provider in order to promote new devices and device - variants entering the market. Device aware debug views provide fast and - convenient access to all registers and fields as well as a detailed - description. This enables software developer to - develop and debug code most efficiently and adopt new devices early and - quickly.

-

- A standardized System View Description shall provide a common approach to - capturing peripheral debug related information in a machine readable files. - The scope of the contained information is agreed to match the level usually - provided by silicon vendors in their device reference manuals, however in a - formalized XML based format. There - are other description languages already available. IP-XACT from the SPIRIT - consortium is a prominent example. IP-XACT covers the register description - sufficiently, however it comprises many other aspects of the devices like - ports, bus-protocols, modeling, tool flows, etc. making a direct use of - IP-XACT too complex. The design of the SVD language is - taking some guidance from IP-XACT thus allowing straight forward conversion - from IP-XACT to CMSIS-SVD where IP-XACT device information is already - available.

-

- In a second step the CMSIS-SVD description shall be used for automatically - generating CMSIS compliant a device header file. This enables the - information in the header file to be consistent with what the debugger will - display and CMSIS compliant by construction. The header file generation will - require some additional pieces of information and therefore a future version - of the description will need to include some extensions for this purpose.

-

- Device aware debugging support is only one aspect of device - support essential to software development environments, however it is one of - the most time consuming and error prone ones.

-

Motivation

-

- -The software developer of microcontroller devices is faced with a growing number -of devices with an ever increasing number of peripheral blocks providing a wide -range of distinct and complex functionality. The development of drivers for -these peripherals is in the critical path of every project. Modern debuggers are supporting the software developer in getting the -software to run according to the requirements. A debugger providing peripheral awareness improves the -ability to access and interpret complex configuration and status information of -peripherals. Even though this is only one aspect of device support within microcontroller -development environments it is essential for the successful and timely adoption -of development tools and the device by the market.

-

Today software development environments address device aware -debugging in various ways. They either use documents or proprietary file formats -as input for providing peripheral views in the debuggers. -Extracting peripheral information from written documentation is a very time -consuming, tedious and error prone task. Having a file containing peripheral specific information to generate peripheral views -is going to make device support more affordable, reliable and timely. -The challenge for the tool providers is the support of many -different and incompatible file formats from a growing number of silicon vendors. -For silicon vendors it is time consuming and costly to engage with many tool -provider in order to achieve device support in a wide range of development -environments.

-

Standardizing on a System View Description aims to ease this challenge -by agreeing on a formal XML-based file format. In conjunction with supporting web server infrastructure silicon partner -shall upload and maintain such descriptions in a tool vendor agnostic device -database, hosted e.g. by the web server infrastructure - -cmsis.arm.com . Access control to sensitive information is managed on a per user -basis. This allows silicon vendors to upload information for devices that have -not been made public. 

-

Such an approach provides benefits for silicon and tool vendors as well as -software developers of Cortex-M based microcontroller devices

- -

Requirements

-

The debug description shall capture the information about all -the peripherals contained in a specific device. This section describes which -items of information are deemed relevant for a debugger. Silicon vendors are expected to -provide the System View Description for their devices, matching the information -contained in device reference manuals. The System View Description shall be suitable for straight forward -generation from existing databases like IP-XACT descriptions or SIDSC. The size -of device description is a concern and therefore redundancy in the description -shall be avoided. The size of SVD files affects the efficiency of -distribution as well as the loading time by the development tools. Last but not least manual editing of SVD files shall be possible for -the purpose of customization by SW developers.

-

Required content of the description

-

From a programmer's perspective a peripheral can be seen as a set of registers -with unique names being mapped to fixed addresses allocated -within a defined range of an address space.

-

From a debugger's point of view read accesses to a physical register need to be -executed in order to display its current value. The debugger executes a write -access to a register when a user edits its value. For this purpose the debugger -needs to know about the following additional attributes:

- -

In many cases peripheral registers are partitioned into chunks of bits of -distinct functionality. In this document these chunks are referred to as -field. Each -register that consists of fields shall  be described by a list -of uniquely named fields (Note: field names are not required to be -unique across registers). In order for a debugger to extract the -value of a field from the corresponding register the following attributes are required:

- -

An enumerated value maps a number to a specific descriptive string -representing the semantics of the value of a field. The debugger displays the -descriptive string rather than the number to simplify the access to the -information thus -avoiding the necessity of a look-up in the device reference manual. Each item of -an enumerated value has the following attributes:

- -

The hierarchical structure of the description looks like this:

-

Device =

- - -

One file can only contain a description for a single device or device family -sharing the identical description. Devices consists of a one or more peripherals. -Each peripheral contains -one or more registers, where each register may consist of one or more fields. -The values of a field maybe represented through descriptive strings and detailed -descriptions, the enumerated values.

-

In many cases there are multiple -instances of the same peripheral in a device (e.g. Timer0, Timer1, etc.). For -this reason the description has the concept of deriving a peripheral from a peripheral -that has already been described. The attribute derivedFrom specifies -such a relationship. -Similarly registers or fields can be reused within the device description. The -grouping of  peripherals providing -similar functionality (e.g. Simple Timer, Complex Timer) is controlled via the element groupName. -All peripherals associated with the same group name are collectively listed under this group -in the order they have been specified in the file. -Collecting  -similar or related peripherals into peripheral groups helps structuring the list -of peripherals e.g. in a drop down menu (tool dependent). Devices with a large -set of peripherals will benefit from this additional level of structure.

-

Each of the items (i.e. Device, Peripheral, Register and -Field) owns an description element containing verbose information about -the respective element. The description field plays -an important part in improving the software development productivity. Instead of -searching through the reference manual the detailed explanation from the manual -could become immediately accessible from within the development environment.

-

Details about the exact display format and layout of the peripheral view are -considered beyond the scope of the description. It is up to the tool vendor to -visualize the contained information appropriately. The -silicon vendor provides details about the device's peripherals that is commonly available.

-

System View Description files need to be validated for:

-
    -
  1. syntactical correctness using XML-Schema checking utilities
  2. -
  3. consistency  of the provided information (e.g. multiple registers mapped to the same address, - all registers located within the specified address ranges of a - peripheral, all fields are within the range of the register - size, etc.) by a utility developed by ARM (SVDConv.exe)
  4. -
  5.  semantical correctness of the System View Description - against the silicon specification executed by the silicon vendor
  6. -
-

The SVD description format was extended by numerous elements during the -review period targeting version 1.0 and new extensions are expected for future -versions of this format. A new section named "vendorExtensions" has been added -to the end of the top level to allow silicon vendors and tool partners to -innovate and expand the description in order to overcome limitations of the -current specification until these can be incorporated into new versions of -CMSIS-SVD.
-

- -

 Format

- -

- The following section describes the SVD file format in detail. Each subsection - defines a single hierarchy level of the description and lists all mandatory - and optional language elements for that specific level including type - information for each element. Each element is discussed in more detail and a - brief snippet is provided as an example. The sequence of elements shown - below is binding. Optional elements are highlighted in green, blue elements - are mandatory unless they have been already specified globally on a higher - level.

-

- An XML-schema file is provided alongside this document for syntactical - checking of descriptions being developed.

-

<device schemaVersion="xs:decimal" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD_Schema_1_0.xsd">

-

   <name>xs:Name</name>
-   <version>xs:string</version>
-   <description>xs:string</description>
-
   <addressUnitBits>scaledNonNegativeInteger</addressUnitBits>
-   <width>scaledNonNegativeInteger </width>

-
-   <size>scaledNonNegativeInteger</size>
-
   <access>accessType</access>
-   <resetValue>scaledNonNegativeInteger</resetValue>
-   <resetMask>scaledNonNegativeInteger</resetMask>

-

   <peripherals>
-      ...
-   </peripherals>
-   <vendorExtensions>
-      ...
-    </vendorExtensions>

-

</device>

-

The device provides the outermost frame of the description. All other -elements like peripherals, registers and fields are described inside of this scope. A device contains one or more peripherals. -The optional elements size, access, resetValue and resetMask are used as default values throughout the -device description unless they get overruled on a lower level of the description -(e.g. peripheral or register).

-

Mandatory items:

-

name = the unique name string is used to identify the device. -All devices of a silicon vendor are required to have a unique name. In case an -SVD description covers a family or series of devices, the name of the series or -family is placed here. The device names of the members of the series or family -are listed in <memberDevices>

-

description = string describing main features of a device -(e.g. CPU, clock frequency, peripheral overview, etc.)

-

version = the string is defining the version of the -description for this device. Silicon vendors will maintain the description -throughout the lifecycle of the device and need to ensure that all updated and -released copies have a unique version string indicating the order in which. Note: this must not be used for -detailing the version of the device.

-

 

-

addressUnitBits = defines the number of data bits for each address -increment. The value for Cortex-M based devices is  8 (byte-addressable).

-

width = defines the number of bits for the maximum single -transfer size allowed by the bus interface hence the maximum size of a single -register that can be defined for the address space. This information is relevant -for debuggers when determining the size of debug transfers. The expected value -for Cortex-M based devices is 32.

-

peripherals = next level of description (see next section -for details)

-

Optional Items:

-

size = defines the default bit-width of registers contained -in the device. This element can be overruled by re-specifying the size element on a lower level of the -description.

-

access = defines the default access permissions for all -registers in the device. The allowed tokens are:
-  - read-only: read access is permitted. Write operations have an undefined -result.
-  - write-only: write access is permitted. Read operations have an -undefined result.
-  -read-write: both read and write accesses are permitted. Writes affect -the state of the register and reads return a value related to the register
-  -writeOnce: only the first write after reset has an effect on the -register. Read operations deliver undefined results
-  -read-writeOnce: Read operations deliver a result related to the register -content. Only the first write access to this register after a reset will have an -effect on the register content.

-

resetValue = defines the default value of all registers -after a reset. There are scenarios where SW developers need to know, what the -reset value of a register or field is. Even though listed as optional on this -level of the description, silicon vendors should ensure that this information is -provided for all registers.

-

resetMask = defines those bit positions set to one to be -taken from resetValue element. All other elements are undefined. If a register -does not have a defined reset value the resetMask needs to be set to 0.

-

vendorExtensions = the content and format of this section of -the description is unspecified. Silicon vendors may choose to provide additional -information. The assumption is that by default this section is completely -ignored by the debugger. It is up to the silicon vendor to specify the content -of this section and share the specification with the tool vendors. The new -elements shall be considered for a future version of the description format.

-

Example:

-
<device schemaVersion="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD_Schema_1_0.xsd" >
-  <name>CMSIS_Cortex-M3</name>
-  <version>0.1</version>
-  <description>ARM Cortex-M3 based Microcontroller demonstration device</description>
-  <addressUnitBits>8</addressUnitBits>
-  <width>32</width>
-  <size>32</size>
-  <access>read-write</access>
-  <resetValue>0</resetValue>
-  <resetMask>0xffffffff</resetMask>
-
  <peripherals>
-    ...
-  </peripherals>
-</device>
-

The device description above is at version 0.1 and uniquely identifies the -device by the name "CMSIS_Cortex-M3". The peripherals are memory mapped in a -byte-addressable address space with a bus width of 32 bits. The default size of -the registers contained in the peripherals is set to 32 bits. Unless redefined -for specific peripherals, registers or fields all registers are read-write -accessible. A reset value of 0 valid for all 32 bits as specified by the reset -mask is set for all registers unless overruled at a lower level of the description.

-
-

<peripherals>

-

   <peripheral>
-     ...
-   </peripheral>

-

     ...

-

   <peripheral>
-     ...
-   </peripheral>

-

</peripherals>

-

This construct sets the frame for all peripherals and peripheral groups contained in a device. This -creates a container element which ease-up processing with languages like Java.

-
-

<peripheral derivedFrom="xs:Name">

-

   <name>xs:Name</name>
-   <version>xs:string</name>
-   <description>xs:string </description>
-   <groupName>xs:string</groupName>
-   <prependToName>xs:string</prependToName>
-   <appendToName>xs:string</appendToName>

-   <disableCondition>xs:string</disableCondition>
-   <baseAddress>scaledNonNegativeInteger</baseAddress>
-   <size>scaledNonNegativeInteger</size>
-
   <access>accessType</access>
-   <resetValue>scaledNonNegativeInteger</resetValue>
-   <resetMask>scaledNonNegativeInteger</resetMask>

-

   <addressBlock>
-      <offset>
scaledNonNegativeInteger</offset>
-      <size>
scaledNonNegativeInteger</size>
-      <usage>usageType</usage>
-   </addressBlock>
-
   ...
-
  <addressBlock>
-      <offset>
scaledNonNegativeInteger</offset>
-      <size>
scaledNonNegativeInteger</size>
-      <usage>usageType</usage>
-   </addressBlock>
-   <interrupt>
-      <name>xs:string</name>
-      <value>scaledNonNegativeInteger</value>
-   </interrupt>

-
   <registers>
-   ...
-   </registers>

-

</peripheral>

-

A peripheral encloses the description of one or more registers belonging to -this named peripheral. The address range allocated in the address space for this -peripheral is defined through one or more address ranges. An address range is -specified relative to the base address of the peripheral. This information -allows to display a memory map overview for all peripherals. Please note that -such a memory map does not contain any information for memories and unoccupied -address ranges.

-

Mandatory items:

-

name = name string used to identify the peripheral. Peripheral -names are required to be unique within the scope of a device.

-

baseAddress = lowest address reserved or used by the peripheral

-

description = string providing an overview of the purpose -and functionality of the peripheral

-

addressBlock = a peripheral may occupy one or more disparate -blocks in the address space. An addressBlock is a complex element consisting of -the mandatory elements:
-    offset: specifying the start address of an address block. It -is calculated from the sum of baseAddress and offset
-    size: specifying the number of addressUnitBits being covered -by this address block. The end address of an address block is the sum of start -address and the size - 1.
-    usage: the usage element is of usageType specifying -if the addresses within the specified address block is used for -registers or buffer or is reserved. -
-Note: registers must not be allocated -to an address within a reserved or buffer address range.

-

registers = next lower level of description (see next section -for details)

-

Optional items:

-

derivedFrom = this attribute specifies the name of a peripheral -that has already been described for this device. The description of that device -will be copied. It is mandatory to overwrite the name as well as the -addressOffset. All other specified information will overwrite the respective -elements in the copy.

-

version = the string specifies the version of this -peripheral description.

-

disableCondition = C language compliant logical expression -resulting in a true or false result. If "true" the refresh of the display -for this peripheral is disabled -and related accesses by the debugger are suppressed. Only constants and references to other registers -contained in the description are allowed:  -<peripheral>-><register>-><field> (e.g.: (System->ClockControl->apbEnable == 0)). -Only the following operators are allowed [&&,||, ==, !=, >>, <<, &, |]. Warning! -This feature must only be use in case accesses from the debugger to registers of -un-clocked peripherals result in severe debugging failures. SVD is intended to -be fully static information and not include any run-time computation or -functions such capabilities may be added by the tools but is considered beyond -the scope of this description language.

-

prependToName = all register names of this peripheral have -their names prepended with the string specified

-

appendToName = all register names of this peripheral have -their names appended with the string specified

-

size = defines the default bit-width of registers contained -in the device. This element can be overruled by re-specifying the size element on a lower level of the -description.

-

access = defines the default access permissions for all -registers in the peripheral. The value can be reset on a lower level of the -description. The allowed tokens are:
-  - read-only: read access is permitted. Write operations have an undefined -result.
-  - write-only: write access is permitted. Read operations have an -undefined result.
-  -read-write: both read and write accesses are permitted. Writes affect -the state of the register and reads return a value related to the register
-  -writeOnce: only the first write after reset has an effect on the -register. Read operations deliver undefined results
-  -read-writeOnce: Read operations deliver a result related to the register -content. Only the first write access to this register after a reset will have an -effect on the register content.

-

resetValue = defines the default value of all registers -after a reset but can be set for individual registers and fields on a lower -level of the description.

-

resetMask = defines those bit positions set to one to be -taken from resetValue element. All other elements are undefined. This is the -default value for the whole peripheral but can be readjusted on lower levels. If -a register does not have a defined reset value the resetMask needs to be set to -0.

-

interrupt = is a complex type that consists of the name of -the interrupt and the associated enumeration value. A peripheral can also have -multiple associated interrupts. This entry is mainly intended for information -only purposes in order to display the interrupts and respective interrupt -numbers associated with a peripheral.

-

Example:

-
... 
-    <peripheral>
-       <name>Timer0</name>
-       <version>1.0.32</version>
-       <description>Timer 0 is a simple 16 bit timer counting down ... </description>
-       <baseAddress>0x40000000</baseAddress>
-       <addressBlock>
-         <offset>0x0</offset>
-         <size>0x400</size>
-         <usage>registers</usage>
-       </addressBlock>
-       <interrupt><name>TIM0_INT</name><value>34</value></interrupt>
-       <registers>
-         ...
-       </registers>
-    </peripheral>
-    <peripheral derivedFrom="Timer0">
-      <name>Timer1</name>
-      <baseAddress>0x40000400</baseAddress>
-    </peripheral>
-
-...
-
-

<registers> ... </registers>

-

This construct sets the frame for all registers contained in a peripheral. -This creates container elements which ease-up processing with languages like Java.

-
-

<register derivedFrom=xs:Name>

-

   <dim>scaledNonNegativeInteger</dim>
-   <dimIncrement>scaledNonNegativeInteger</dimIncrement>
-   <dimIndex>xs:string</dimIndex>

-   <name>xs:Name</name>
-   <displayName>xs:string</displayName>
-
   <description>xs:string</description>
-   <alternateGroup>xs:Name</alternateGroup>
-
   <addressOffset>scaledNonNegativeInteger -</addressOffset>
-    <size>scaledNonNegativeInteger</size>
-
   <access>accessType</access>
-  
<resetValue>scaledNonNegativeInteger</resetValue>
-   <resetMask>scaledNonNegativeInteger</resetMask>
-
-
   <modifiedWriteValues>writeValueType</modifiedWriteValues>
-   <writeConstraint>writeConstraintType</writeConstraint>
-   <readAction>readActionType </readAction>

-
   <fields>
-      ...
-   </fields>

-

</register>

-

The definition of registers is the central part of the description. A -register may use its complete size for a single purpose and therefore not -consist of fields. Otherwise the description -of fields is mandatory.

-

Mandatory items:
-

-

name = name string used to identify the register. Register -names are required to be unique within the scope of a peripheral.

-

description = string describing the details of the register.

-

addressOffset = value defining the address of the register relative to -the baseAddress defined by the peripheral the register belongs to.
-

-

The following elements can be omitted if the corresponding value has been set -on a higher level of the description and matches the value required for this register:

-

size =value defining the bit-width of the register

-

access = predefined tokens: read-only, write-only, read-write, -writeOnce, read-writeOnce strings defining the allowed -accesses for this register.

-

resetValue = element defining the value of the register -immediately after a reset.

-

resetMask= element specifying those bits of the resetValue that -are defined (bit positions containing a 0 bit are ignored, bit -positions containing a 1 bit are taken from the corresponding bit position of -the resetValue). If a register does not have a defined reset value the resetMask -needs to be set to 0.

-

Optional items:

-

dim = if this field is specified the value defines the -number of elements in an array of registers.

-

dimIncrement = if dim is specified this element becomes -mandatory and specifies the address increment in between -two neighboring registers of the register array in the address map.

-

dimIndex = this element specifies the substrings within the -register array names that will replace the %s within the register name. By -default the index is a decimal value starting with 0 for the first register. -Examples:
-   <dim>6</dim> <dimIncrement>4</dimIncrement> <dimIndex>A,B,C,D,E,Z</dimIndex> -<name>GPIO_%s_CTRL</name> ...
-   => GPIO_A_CTRL, GPIO_B_CTRL, GPIO_C_CTRL, GPIO_D_CTRL, GPIO_E_CTRL, -GPIO_Z_CTRL
-   <dim>4</dim> <dimIncrement>4</dimIncrement> <dimIndex>3-6</dimIndex> -<name>IRQ%s</name> ...
-   => IRQ3, IRQ4, IRQ5, IRQ6                 

-

displayName = when used, this is the string being used by a -graphical frontend to visualize the register otherwise the name element is used. -Note: the display name may contain special characters and white spaces. It also -uses "%s" as the place holder for the dimIndex substring.

-

alternateGroup = when used, this element specifies a name of -a group that all alternate register with the same name a associated with. At the -same time it indicates that there is a register description allocating the same -absolute address in the address space.

-

modifiedWriteValues = element to describe the manipulation of -data written to a register. If not specified the value written to the field is the -value stored in the field. The other options are bitwise operations:
-  oneToClear: write data bits of one shall clear (set to zero) the -corresponding bit in the register
-  oneToSet: write data bits of one shall set (set to one) the -corresponding bit in the register
-  oneToToggle: write data bits of one shall toggle (invert) the -corresponding bit in the register
-  zeroToClear: write data bits of zero shall clear (set to zero) -the corresponding bit in the register
-  zeroToSet: write data bits of zero shall set (set to one) the -corresponding bit in the register
-  zeroToToggle: write data bits of zero shall toggle (invert) the -corresponding bit in the register
-  clear: after a write operation all bits in the field are cleared (set to -zero)
-  set: after a write operation all bits in the field are set (set to one)
-  modify: after a write operation all bit in the field may be modified -(default)

-

writeConstraint: has a set of options:
-  writeAsRead = if true only the last read value can be written
-  useEnumeratedValues = if true only those values listed in the -enumeratedValues list are considered valid write values
-  minimum = specifies the smallest number to be written to the -register
-  maximum = specifies the largest number to be written to the -register

-

readAction: if set it specifies the side effect following -read operations. If not set the register is not modified following a read -operations. The defined side effects are:
-  clear: indicates that the register is cleared (set to zero) -following a read operation
-  set: indicates that the register is set (set to ones) following a -read operation
-  modify: indicates that the register is modified in some way -after a read operation
-  modifyExternal: indicates that one or more dependent resources -other than the current register -are immediately affected by a read (it is recommended that the register -description specifies these dependencies). Debuggers are not expected to read -this register location unless explicitly instructed by user.

-

fields = next lower level of description (see next section -for details).

-

Optional attribute:

-

derivedFrom = specifies the name of the register to be -replicated. Elements being specified underneath will override the values specified -from the register being derived from. Note that it is mandatory to overwrite at -least name and addressOffset.

-

Example:

-
... 
-       <register>
-         <name>TimerCtrl0</name>
-         <description>Timer Control Register</description>
-         <addressOffset>0x0</addressOffset>
-         <access>read-write</access>
-         <resetValue>0x00008001</resetValue>
-         <resetMask>0x0000ffff</resetMask>
-         <size>32<size>
-         <fields>
-           ...
-         </fields>
-       </register>
-       <register derivedFrom="TimerCtrl0">
-         <name>TimerCtrl1</name>
-         <addressOffset>0x4<addressOffset>
-       </register>
-...
-
-

<fields> ... </fields>

-

This construct sets the frame for all fields contained in a register. -This creates container elements which ease-up processing with languages like Java.

-
-

 <field derivedFrom="xs:Name">

-

   <name>xs:Name</name>
- 
  <description>xs:string</description>
-   -<bitOffset>scaledNonNegativeInteger</bitOffset> -<bitWidth>scaledNonNegativeInteger</bitWidth>
-  
or
-   <lsb>scaledNonNegativeInteger</lsb> <msb>scaledNonNegativeInteger</msb>
-  
or
-   <bitRange>pattern</bitRange>
-   <access>accessType</access>
-
   <modifiedWriteValues>writeValueType</modifiedWriteValues>
-   <writeConstraint>writeConstraintType</writeConstraint>
-   <readAction>readActionType </readAction>

- 
  <enumeratedValues>
-      ...
-   </enumeratedValues>

-

</field>

-

A bit-field has a name that is unique for the register it belongs to. The -position and size within the register is either described by the combination of -the least significant bit's position (lsb) and the most significant bit's -position (msb) or the lsb and the size, specifying the bit-width of the -field.  A field may define an enumeratedValue in order to make the display -more intuitive to read.

-

Mandatory items:

-

name = name string used to identify the field. Field names -are required to be unique within the scope of a register.
-

-

description = string describing the details of the register.
-

-

There are 3 ways to describe a field to be used mutually exclusive:
-a) specifying bitOffset and bitWidth (IP-XACT like)
-b) specifying lsb and msb of the field.
-c) specifying a bit range in the format "[<msb>:<lsb>]"

-

bitOffset = value defining the position of the least significant bit -of the field within the register it belongs to.
-bitWidth = value defining the bit-width of the bitfield within the -register it belongs to.
-

-

-lsb = value defining the bit position of the least significant -bit within the register it belongs to.
-msb = value defining the bit position of the most significant -bit within the register it belongs to. -

-

bitRange = a string in the format: [<msb>:<lsb>]
-

-

Optional items:

-

derivedFrom = the field is cloned -from a previously defined field with a unique name.

-

access = predefined strings defining the allowed -accesses for this register: read-only, write-only, read-write, writeOnce, -read-writeOnce. Can be omitted if it matches the access permission set for the parent register.

-

enumeratedValues = next lower level of description (see next section -for details)

-

modifiedWriteValues = element to describe the manipulation of -data written to a field. If not specified the value written to the field is the -value stored in the field. The other options are bitwise operations:
-  oneToClear: write data bit of one shall clear (set to zero) the -corresponding bit in the field
-  oneToSet: write data bit of one shall set (set to one) the corresponding -bit in the field
-  oneToToggle: write data bit of one shall toggle (invert) the -corresponding bit in the field
-  zeroToClear: write data bit of zero shall clear (set to zero) the -corresponding bit in the field
-  zeroToSet: write data bit of zero shall set (set to one) the -corresponding bit in the field
-  zeroToToggle: write data bit of zero shall toggle (invert) the -corresponding bit in the field
-  clear: after a write operation all bits in the field are cleared (set to -zero)
-  set: after a write operation all bits in the field are set (set to one)
-  modify: after a write operation all bit in the field may be modified -(default)

-

writeConstraint: has a set of options:
-  writeAsRead = if true only the last read value can be written
-  useEnumeratedValues = if true only those values listed in the -enumeratedValues list are considered valid write values
-  minimum = specifies the smallest number to be written to the field
-  maximum = specifies the largest number to be written to the field

-

readAction: if set it specifies the side effect following -read operations. If not set the field is not modified following a read -operations. The defined side effects are:
-  clear: indicates that the field is cleared (set to zero) -following a read operation
-  set: indicates that the field is set (set to ones) following a -read operation
-  modify: indicates that the field is modified in some way after a -read operation  -
-  modifyExternal: indicates that one or more dependent resources -other than this field are immediately affected by a read (it is recommended that -the field description specifies these dependencies). Debuggers are not expected -to read the field unless explicitly instructed by user.

-

Example:

-
...
-         <field>
-           <name>TimerCtrl0_IntSel</name>
-           <description>Select interrupt line that is triggered by timer overflow.</description>
-	   <bitOffset>1</bitOffset>
-           <bitWidth>3</bitWidth>
-           <access>read-write</access>
-	   <resetValue>0x0</resetValue>
-           <modifiedWriteValues>oneToSet</modifiedWriteValues>
-           <writeConstraint>
-              <range>
-                <minimum>0</minimum>
-                <maximum>5</maximum>
-              </range>
-           </writeConstraint>
-           <readAction>clear</readAction>
- 
-           <enumeratedValues>
-              ...
-           </enumeratedValues>
-         </field>
-...
-
-

<enumeratedValues -derivedFrom="xs:Name">

-

   <name>xs:Name</name>
-   <usage>usageType</usage>

-   <enumeratedValue>
-      ...
-   </enumeratedValue>

-

      ... 

-

   <enumeratedValue>
-      ...
-   </enumeratedValue>

-

</enumeratedValues>

-

An enumerated value provides one or more enumeration items (enumeratedValue), defining a map -between all possible values of the bit-field it belongs to and the corresponding -human readable semantics of that value.

-

Mandatory items:
-enumeratedValue = next lower level of description (see next section -for details)

-

Optional items:
-derivedFrom = the enumeratedValues can be copied or derived -from a previously defined enumeratedValue that has been given a unique name.
-name = name string to identify an enumeratedValue. Named -enumeratedValues need to be unique in the scope of a device in order to be reusable -throughout the description of a device.
-usage = possible values are read, write or -read-write. This allows to specify two different enumerated values -depending whether it is to be used for a read or a write access. If not specified the enueratedValues are valid for read and write.

-

Example:

-
...
-           <enumeratedValues>
-              <name>TimerIntSelect</name>
-              <usage>read-write</usage>
-              <enumeratedValue>
-                <name>disabled</name>
-                <description>disabled bit</description>
-                <value>0</value>
-              </enumeratedValue>
-              ...
-              <enumeratedValue>
-                <name>reserved</name>
-	        <description>reserved values. Do not use</description>
-                <isDefault>true</isDefault>
-              </enumeratedValue>
-           </enumeratedValues>
-...
-
-

<enumeratedValue>

-

   <name>xs:name</name>
-   <description>xs:string</description>
-
   <value>scaledNonNegativeInteger</value>
-   -
or
-   <
isDefault>xs:boolean</isDefault>
-

-

</enumeratedValue>

-

An enumeratedValue defines a map between a value and the string reading the -corresponding human readable semantics for that value in a brief and a detailed -version

-

Mandatory items:

-

name= brief string verbally describing the semantics of the value -defined for this enumeratedValue. E.g. used for display in visualization of a bit-field -instead of the value.

-

-value = defines the constant of the bit-field that the name -corresponds to.

-

isDefault = defines the name and description for all other -values that are not explicitly listed

-

Optional item:

-

description = extended string verbally describing the semantics -of the value defined for this enumeratedValue in full detail.

-

Example:

-
...
-         <enumeratedValue>
-            <name>disabled</name>
-            <description>Timer does not generate interrupts</description>
-            <value>0</value>
-         </enumeratedValue>
-         ...
-         <enumeratedValue>
-            <name>enabled</name>
-            <description>Timer does not generate interrupts</description>
-            <isDefault>true</isDefault>
-         </enumeratedValue>
-
-...
-
-

Names

-

Names shall comply with ANSI C variable naming restrictions.

-

Constants

-

Number constants shall be entered in hexadecimal, decimal or binary format.

- -

Comments

-

Comments have the standard XML format "<!--" starts a comment - "-->" terminates a comment

-

Example

-
-<?xml version="1.0" encoding="utf-8"?>
- 
-<device schemaVersion="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD_Schema_1_0.xsd" >
-  <name>Cortex_M3_Sample</name>
-  <version>0.1</version>
-  <description>ARM Cortex-M3 based Microcontroller dummy device</description>
-  <!-- Bus Interface Properties -->
-  <!-- Cortex-M3 is byte addressable -->
-  <addressUnitBits>8</addressUnitBits>
-  <!-- the maximum data bit width accessible within a single transfer is 32bits -->
-  <width>32</width>
-
-  <!-- Register Default Properties -->
-  <!-- the size of the registers is set to a bit width of 32. This can be overruled for individual peripherals and/or registers -->
-  <size>32</size>
-  <!-- the access to all registers is set to be readable and writeable. This can be overruled for individual peripherals and/or registers -->
-  <access>read-write</access>
-  <!-- for demonstration purposes the resetValue for all registers of the device is set to be 0. This can be overruled within the description -->
-  <resetValue>0</resetValue>
-  <!-- the resetMask = 0 specifies that by default no register of this device has a defined reset value -->
-  <resetMask>0</resetMask>
-
-  <peripherals>
-    <peripheral>
-      <name>Timer0</name>
-      <description>A simple 16 bit timer counting down ... </description>
-      <groupName>Timer</groupName>
-      <baseAddress>0x40000000</baseAddress>
-      <!-- the first addressBlock is occupied by registers. The second block is reserved -> no access permission -->
-      <addressBlock>
-        <offset>0</offset>
-        <size>0x8</size>
-        <usage>registers</usage>
-      </addressBlock>
-      <addressBlock>
-        <offset>0x8</offset>
-        <size>0x3f8</size>
-        <usage>reserved</usage>
-      </addressBlock>
-      <interrupt>
-        <name>TIM0_IRQn</name>
-        <value>34</value>
-      </interrupt>
-      <registers>
-        <register> 
-          <name>TimerCtrl0</name>
-          <!-- the display name is an unrestricted string. -->
-          <displayName>Timer Ctrl 0</displayName>
-          <description>Timer Control Register</description>
-          <addressOffset>0x0</addressOffset>
-          <!-- size=32, access=read-write, resetValue=0x0, resetMask=0xffffffff, volatile=false -->
-          <fields>
-            <field>
-              <name>TimerCtrl0_En</name>
-              <description>Enable Bit activates the timer.</description>
-              <!-- Spirit like bit range description: [0:0] -->
-              <bitOffset>0</bitOffset>
-              <bitWidth>1</bitWidth>
-              <!-- Writing 1 enables, writing 0 has no effect -->
-	      <modifiedWriteValues>oneToSet</modifiedWriteValues>
-              <!-- The write constraint is defined to be that only the values provided by the enumeratedValues below are allowed -->
-              <writeConstraint>
-                <useEnumeratedValues>true</useEnumeratedValues>
-              </writeConstraint>
-              <!-- there is no side effect on reads, therefore <readAction> is not set -->
-              <!-- oneBitEnable named enumeration that can be reused in other parts of the description -->
-              <enumeratedValues>
-                <name>oneBitEnable</name>
-                <!-- the same enumerated Values are used for read and write. This default is assumed when this tag is missing -->
-                <usage>read-write</usage>
-                <enumeratedValue>
-                  <name>enabled</name>
-                  <description>Timer is enabled and active</description>
-                  <value>0x0</value>
-                </enumeratedValue>
-                <enumeratedValue>
-                  <name>disabled</name>
-                  <description>Timer is disabled and inactive</description>
-                  <value>0x1</value>
-                </enumeratedValue>
-              </enumeratedValues>
-            </field>
-            <field>
-              <name>TimerCtrl0_Dis</name>
-              <description>Disable Bit deactivates the timer.</description>
-              <!-- Spirit like bit range description: [1:1] -->
-              <bitOffset>1</bitOffset>
-              <bitWidth>1</bitWidth>
-              <!-- Writing 1 sets, writing 0 has no effect -->
-	      <modifiedWriteValues>oneToSet</modifiedWriteValues>
-              <!-- The write constraint is defined to be that only the values provided by the enumeratedValues below are allowed -->
-              <writeConstraint>
-                <useEnumeratedValues>true</useEnumeratedValues>
-              </writeConstraint>
-              <!-- there is no side effect on reads, therefore <readAction> is not set -->
-              <!-- oneBitEnable named enumeration that can be reused in other parts of the description -->
-              <enumeratedValues derivedFrom="oneBitEnable"></enumeratedValues>
-            </field>
-            <field>
-              <name>TimerCtrl0_Int</name>
-              <description>Select interrupt line that is triggered by timer overflow.</description>
-              <!-- the position of the bit field is described in the bitRange style. -->
-              <bitRange>[4:2]</bitRange>
-              <enumeratedValues>
-                <enumeratedValue>
-                  <name>disabled</name>
-                  <description>Timer does not generate interrupts</description>
-                  <value>0</value>
-                </enumeratedValue>
-                <enumeratedValue>
-                  <name>int 0</name>
-                  <description>Timer does generate interrupts on interrupt line 0</description>
-                  <value>1</value>
-                </enumeratedValue>
-                <enumeratedValue>
-                  <name>int 1</name>
-                  <description>Timer does generate interrupts on interrupt line 1</description>
-                  <value>2</value>
-                </enumeratedValue>
-                <enumeratedValue>
-                  <name>int 2</name>
-                  <description>Timer does generate interrupts on interrupt line 2</description>
-                  <value>3</value>
-                </enumeratedValue>
-                <enumeratedValue>
-                  <name>int 3</name>
-                  <description>Timer does generate interrupts on interrupt line 3</description>
-                  <value>4</value>
-                </enumeratedValue>
-                <enumeratedValue>
-                  <name>int 4</name>
-                  <description>Timer does generate interrupts on interrupt line 4</description>
-                  <value>5</value>
-                </enumeratedValue>
-                <!-- this is the default element. All the valid value not listed above (6,7) have the following name and description -->
-                <enumeratedValue>
-                  <name>reserved</name>
-                  <description>Timer is configured incorrectly and the functionality is considered unpredictable</description>
-                  <isDefault>true</isDefault>
-                </enumeratedValue>
-              </enumeratedValues>
-            </field>
-          </fields>
-        </register>
-        <register>
-          <name>TimerCounter0</name>
-          <description>Timer0 16 Bit Counter Register</description>
-          <addressOffset>0x4</addressOffset>
-          <size>16</size>
-        </register>
-        <!-- a copy of the counter register TimerCounter0 with the name="TimerCounter1" and the addressOffset="0x8" -->
-        <register derivedFrom="TimerCounter0">
-          <name>TimerCounter1</name>
-          <addressOffset>0x6</addressOffset>
-        </register>
-        <!-- ... this is a restricted demo example and a real timer peripheral would have more register to be complete -->
-      </registers>
-    </peripheral>
-    <!-- a copy of Timer0 with the name="Timer1 and the baseAddress="0x40000400" -->
-    <peripheral derivedFrom="Timer0">
-      <name>Timer1</name>
-      <baseAddress>0x40000400</baseAddress>
-      <interrupt>
-        <name>TIM1_IRQn</name>
-        <value>35</value>
-      </interrupt>
-    </peripheral>
-  </peripherals>
-</device>
- -

Questions & Answers

-

Is there any relation between the System View Description and the CMSIS -standard?

-

Initiallly there was no immediate link but both initiatives had a common goal: -Create a sound software development eco-system for Cortex-M based -Microcontroller, giving the customers the free choice of devices and software -development environments and all resources required for a successful product -development in a single location. Meanwhile we have started to generate -CMSIS compliant device header files from the same CMSIS-SVD description. We will -introduce a small number of additional description tags in the next version of -the specification. The benefit is the synchronization between symbols used in -the application and the symbols displayed by the debugger. 

-

Why does the format not provide constructs like macros and -conditional statements?

-

It is assumed that the description is generated from other sources and -therefore such concepts would only complicate the language unnecessarily. It is -recommended to use a standard C pre-processor to generate the debug description -format from a redundancy optimized description.

-

Do we need to consider endianess in the description?

-

This should be specified on a device configuration level and is not specific -to the visualization of peripheral details in a System View. Endianess becomes -relevant when using bit fields in the CMSIS compliant device header file.

-

Is the System View Description limited to Cortex-M based devices ?

- - -

There may have been assumptions made about the structure of the device due to -it being developed around a Cortex-M processor. E.g. that all peripherals are -assumed to be memory mapped and to reside in a single address space. It is quite -likely that the description format may also serve other architectures -sufficiently. There is no intent to limit the format to Cortex-M -processor based devices.

- - - \ No newline at end of file diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/README.txt b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/README.txt deleted file mode 100644 index cc69e2ca2..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/README.txt +++ /dev/null @@ -1,34 +0,0 @@ -* ------------------------------------------------------------------- -* Copyright (C) 2011 ARM Limited. All rights reserved. -* -* Date: 25 July 2011 -* Revision: V2.10 -* -* Project: Cortex Microcontroller Software Interface Standard (CMSIS) -* Title: Release Note for CMSIS -* -* ------------------------------------------------------------------- - - -NOTE - Open the index.html file to access CMSIS documentation - - -The Cortex Microcontroller Software Interface Standard (CMSIS) provides a single standard across all -Cortex-Mx processor series vendors. It enables code re-use and code sharing across software projects -and reduces time-to-market for new embedded applications. - -CMSIS is released under the terms of the end user license agreement ("CMSIS END USER LICENCE AGREEMENT.pdf"). -Any user of the software package is bound to the terms and conditions of the end user license agreement. - - -You will find the following sub-directories: - -Documentation - Contains CMSIS documentation. - -DSP_Lib - MDK project files, Examples and source files etc.. to build the - CMSIS DSP Software Library for Cortex-M0, Cortex-M3, Cortex-M4 processors. - -Include - CMSIS Core Support and CMSIS DSP Include Files. - -Lib - CMSIS DSP Binaries ---- \ No newline at end of file diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/index.htm b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/index.htm deleted file mode 100644 index 40e52b373..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/index.htm +++ /dev/null @@ -1,115 +0,0 @@ - - - -CMSIS Release Notes - - - - - - - - -

CMSIS Release Notes

-

Release Notes for CMSIS V2.00

-

November 2010

- -

Information in this file, the accompany manuals, and software is
- Copyright © ARM Ltd.
All rights reserved. -

-

- -
- -

Contents

- - - - - - - \ No newline at end of file diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/Release_Notes.html b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/Release_Notes.html deleted file mode 100644 index 2fea2a827..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/Release_Notes.html +++ /dev/null @@ -1,968 +0,0 @@ - - - - - - - - -Release Notes for STM32F2xx Standard Peripherals Library Drivers - - - - - -
- -

 

- -
- - - - - -
- - - - - - - -
-

Back to Release page

-
-

Release Notes for STM32F2xx Standard - Peripherals Library Drivers

-

Copyright - 2012 STMicroelectronics

-

-
-

 

- - - - -
-

Contents

-
    -
  1. STM32F2xx Standard Peripherals Library Drivers - update History
  2. -
  3. License
  4. -
-

STM32F2xx - Standard Peripherals Library Drivers  update History

V1.1.2 / 05-March-2012

-

Main -Changes

- -
  • All source files: license disclaimer text update and add link to the License file on ST Internet.
  • stm32f2xx_dcmi.c
    • DCMI_GetFlagStatus() function: fix test condition on RISR register, use if (dcmireg == 0x00) instead of if (dcmireg == 0x01)
  • stm32f2xx_pwr.c
    • PWR_PVDLevelConfig() -function: remove value of the voltage threshold corresponding to each -PVD detection level, user should refer to the electrical -characteristics of the STM32 device datasheet to have the correct -value

V1.1.1 / 28-December-2011

Main -Changes

-
  • All source files: update disclaimer to add reference to the new license agreement

V1.1.0 / 07-October-2011

Main -Changes

-
  • stm32f2xx_sdio.h/.c
    • SDIO_SetPowerState() function: fix POWER register configuration, only one access (for read or write) is allowed
  • stm32f2xx_usart.h/.c
    • Update procedure to check on overrun error interrupt pending bit, defines for the following flag are added:
      • USART_IT_ORE_RX: this flag is set if overrun error interrupt occurs and RXNEIE bit is set
      • USART_IT_ORE_ER: this flag is set if overrun error interrupt occurs and EIE bit is set
  • stm32f2xx_i2c.h
    • Add test on I2C3 in IS_I2C_ALL_PERIPH() macro
  • stm32f2xx_tim.c
    • TIM_UpdateRequestConfig(): correct function header's comment 
    • TIM_ICInit(): add assert macros to test if the passed TIM parameter has channel 2, 3 or 4
  • stm32f2xx_rtc.c
    • Remove useless code from RTC_GetDate() function

V1.0.0 / 18-April-2011

Main -Changes

-
  • First official release for STM32F2xx devices
  • All drivers
    • Update file and function's header comments to add more explanation and fix Doxygen tags formatting
  • stm32f2xx_syscfg.h/.c
    • Add 2 functions for Compensation Cell management:
      void SYSCFG_CompensationCellCmd(FunctionalState NewState);
      FlagStatus SYSCFG_GetCompensationCellStatus(void);
  • stm32f2xx_rtc.h
    • RTC_DateTypeDef structure: change RTC_Month and RTC_WeekDay members size to 8bit (instead of 32bit)

V1.0.0RC1 / 18-March-2011

Main -Changes

-
  • Official version (V1.0.0) Release Candidate 1
  • All drivers
    • Add more comments and information about how to use the driver and the functions API
    • Delete registers definition from stm32f2xx_ppp.c and use defines within stm32f2xx.h file
  • stm32f2xx_rcc.h/.c
    • RCC_PLLConfig() function updated to support only Silicon RevisionB and RevisionY (PLLR parameter removed)
  • stm32f2xx_spi.c
    • I2S_Init() function updated to support only the I2S clock scheme available in Silicon RevisionB and RevisionY
  • stm32f2xx_can.h/.c
    • Add 5 new functions
      • 3 -new functions controlling the counter errors: CAN_GetLastErrorCode(), -CAN_GetReceiveErrorCounter() and CAN_GetLSBTransmitErrorCounter()
      • 1 new function to select the CAN operating mode: CAN_OperatingModeRequest()
      • 1 new function to support CAN TT mode: CAN_TTComModeCmd()
        -
    • CAN_TransmitStatus() function updated to support all CAN transmit intermediate states
  • stm32f2xx_adc.h/.c
    • Name of the possible values of ADC_DMAAccessMode parameter modified as below:
      ADC_DMAAccessMode_HalfWord        -> ADC_DMAAccessMode_1 
      ADC_DMAAccessMode_TwoHalfWords -> ADC_DMAAccessMode_2
      ADC_DMAAccessMode_TwoBytes       -> ADC_DMAAccessMode_3
    • ADC_MultiModeDMARequestAfterLastTransferCmd(): the 1st parameter ADCx removed 
  • stm32f2xx_cryp.h/.c
    • CRYP_GetITStatus() function coding updated
    • Add 2 functions for CRYP Context swapping:
      ErrorStatus CRYP_SaveContext(CRYP_Context* CRYP_ContextSave, CRYP_KeyInitTypeDef* CRYP_KeyInitStruct);
      void CRYP_RestoreContext(CRYP_Context* CRYP_ContextRestore);
    • Name of the possible values of CRYP_DMAReq parameter modified as below:
      CRYP_DMAReq_Rx -> CRYP_DMAReq_DataIN
      CRYP_DMAReq_Tx -> CRYP_DMAReq_DataOUT 
  • Add three drivers to provide high level functions for AES, DES and TDES:
    • stm32f2xx_cryp_aes.c: provides high level functions to encrypt and decrypt an input message using AES in ECB/CBC/CTR modes
    • stm32f2xx_cryp_des.c: provides high level functions to encrypt and decrypt an input message using DES in ECB/CBC modes
    • stm32f2xx_cryp_tdes.c: provides high level functions to encrypt and decrypt an input message using TDES in ECB/CBC modes
    • These drivers uses the stm32f2xx_cryp.c/.h driver to access the STM32F2xx CRYP peripheral
  • stm32f2xx_hash.h/.c
    • HASH_GetITStatus() function coding updated
    • Add 2 functions for HASH Context swapping:
      void HASH_ContextSaving(HASH_Context* HASH_ContextSave);
      void HASH_ContextRestoring(HASH_Context* HASH_ContextRestore)
  • Add two drivers to provide high level functions for SHA1 and MD5:
    • stm32f2xx_hash_sha1.c: provides high level functions to compute the HASH SHA1 and HMAC SHA1 Digest of an input message
    • stm32f2xx_hash_md5.c: provides high level functions to compute the HASH MD5 and HMAC MD5 Digest of an input message
    • These drivers uses the stm32f2xx_hash.c/.h driver to access the STM32F2xx HASH peripheral
  • stm32f2xx_rng.h/.c
    • RNG_GetITStatus() function coding updated
    • Add new function:
      void RNG_ClearFlag(uint8_t RNG_FLAG);
  • stm32f2xx_gpio.h
    • Change the name of the parameter GPIO_Mode_AIN by GPIO_Mode_AN
  • stm32f2xx_rtc.h/.c
    • Rename the function RTC_DigitalCalibConfig() to RTC_CoarseCalibConfig() (no change on the parameter name)
    • Rename the function RTC_DigitalCalibCmd() to RTC_CoarseCalibCmd() (no change on the parameter name)
    • Add 3 functions:
      void RTC_DateStructInit(RTC_DateTypeDef* RTC_DateStruct);
      void RTC_TimeStructInit(RTC_TimeTypeDef* RTC_TimeStruct);
      void RTC_AlarmStructInit(RTC_AlarmTypeDef* RTC_AlarmStruct);
       
  • stm32f2xx_flash.h/.c
    • Name of the possible values of OB_BOR parameter modified as below:
      OB_BOR_Level_3    -> OB_BOR_LEVEL3
      OB_BOR_Level_2    -> OB_BOR_LEVEL2
      OB_BOR_Level_1    -> OB_BOR_LEVEL1
      OB_BOR_Level_Off  -> OB_BOR_OFF
    • FLASH_OB_GetBOR() function updated to return the BOR level value as defined in OPTCR register
  • stm32f2xx_i2c.h/.c
    • Add 1 new function:
      • I2C_NACKPositionConfig(): -This function configures the same bit (POS) as I2C_PECPositionConfig() -but is intended to be used in I2C mode while I2C_PECPositionConfig() is -intended to used in SMBUS mode.
  • stm32f2xx_tim.h
    • Change the TIM_DMABurstLength_xBytes definitions to TIM_DMABurstLength_xTansfers
-

License

-

Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this package except in compliance with the License. You may obtain a copy of the License at:


Unless -required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See -the License for the specific language governing permissions and -limitations under the License.
-
-
-

For - complete documentation on STM32 - Microcontrollers visit www.st.com/STM32

-
-

-
- -
- -

 

- -
- - \ No newline at end of file diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/MCD-ST Liberty SW License Agreement V2.pdf b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/MCD-ST Liberty SW License Agreement V2.pdf deleted file mode 100644 index d61f43008..000000000 Binary files a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/MCD-ST Liberty SW License Agreement V2.pdf and /dev/null differ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Release_Notes.html b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Release_Notes.html deleted file mode 100644 index 93880a9e0..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Release_Notes.html +++ /dev/null @@ -1,570 +0,0 @@ - - - - - -Release Notes for STM32F2xx Standard Peripherals Library - - - - - -
-


-

-
- - - - - - -
- - - - - - -
-

Release -Notes for STM32F2xx Standard Peripherals Library

-

Copyright 2012 STMicroelectronics

-

-
-

 

- - - - - - -
-

Contents

-
    -
  1. STM32F2xx Standard Peripheral -Library update History
  2. -
  3. License
  4. -
-

STM32F2xx Standard -Peripherals Library update History

V1.1.0 / 13-April-2012

Main -Changes

-
  • All source files: license disclaimer text update and add link to the License file on ST Internet.
  • STM32F2xx HAL and BSP components update (for more details refer to each component's release notes):
    • CMSIS drivers: update directory structure to be compliant with CMSIS V2.1, full API compatibility maintained vs. V1.0.0
    • Standard Peripherals Drivers: miscellaneous bug fix and enhancement
    • STM322xG_EVAL board drivers: update drivers architecture and folder organization, full API compatibility maintained vs. V4.6.2 (and V4.6.1)
  • Template projects: 
    • Update to be in line with changes made on latest version of the STM32F2xx CMSIS and STM322xG_EVAL drivers
    • Update to use the latest version of the supported toolchains
  • All -examples: 
    • Update to be in line with latest version of STM322xG_EVAL board drivers
    • Miscellaneous bug fix and enhancement
    • -For more details refer to the example's release notes

-

Contents

-

Development Toolchains and Compilers

-
  • IAR Embedded Workbench for ARM (EWARM) toolchain V6.30.7 + J-Link
  • RealView Microcontroller Development Kit (MDK-ARM) toolchain V4.23 + ULINK
  • Raisonance IDE RIDE7 (RIDE) toolchain (RIDE7 IDE:7.36, RKitARM for RIDE7:1.38) + Rlink Pro
  • Atollic TrueSTUDIO toolchain V3.0.0 + ST-LINK
  • TASKING VX-toolset for ARM Cortex-M V4.2r1 + ST-LINK

V1.0.0 / 18-April-2011

Main -Changes

-
  • First official release for STM32F2xx devices

-

Contents

-

Development Toolchains and Compilers

-
  • IAR Embedded Workbench for ARM (EWARM) toolchain V6.10.5
  • RealView Microcontroller Development Kit (MDK-ARM) toolchain V4.20
  • Raisonance IDE RIDE7 (RIDE) toolchain (RIDE7 IDE:7.30.10, RKitARM for RIDE7:1.31.10)
  • Atollic TrueSTUDIO STM32 (TrueSTUDIO) toolchain V2.0.1
  • TASKING VX-toolset for ARM Cortex-M V3.2r1

- -

License

Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this package except in compliance with the License. You may obtain a copy of the License at:


Unless -required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See -the License for the specific language governing permissions and -limitations under the License.
- -
-
-
-

For - complete documentation on STM32 - Microcontrollers visit www.st.com/STM32
-

-
-

-
-
-

 

-
- \ No newline at end of file diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/Release_Notes.html b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/Release_Notes.html deleted file mode 100644 index 95520c402..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/Release_Notes.html +++ /dev/null @@ -1,264 +0,0 @@ - - - - - - - - - - - - - - - - Release Notes for STM32 Evaluation Board Common Drivers - - - - - - - - - - -
-


-

-
- - - - - - -
- - - - - - - - - -
-

Back to Release page

-
-

Release -Notes for STM32 Evaluation Board Common Drivers

-

Copyright -2012 STMicroelectronics

-

-
-

 

- - - - - - -
-

Contents

-
    -
  1. STM32 Evaluation Board Common Drivers -update History
  2. -
  3. License
  4. -
- - -

STM32 Evaluation Board Common Drivers update History

V5.0.2 / 05-March-2012

-

Main -Changes

- -
  • All source files: license disclaimer text update and add link to the License file on ST Internet.

V5.0.1 / 28-December-2011

Main -Changes

-
  • All source files: update disclaimer to add reference to the new license agreement

V5.0.0 / 30-September-2011

-

Main -Changes

- -
  • Update STM32 Evaluation Board Drivers architecture and folder organization, full API compatibility maintained vs. V4.6.2
    • All the HW drivers required for each board are provided within this board folder. The concerned drivers are:
      • stm32_eval_i2c_ee.c\.h: I2C M24CXX EEPROM memory driver
      • stm32_eval_i2c_tsensor.c\.h: I2C LM75 temperature sensor driver
      • stm32_eval_spi_flash.c\.h: SPI M25Pxxx FLASH memory driver
      • stm32_eval_sdio_sd.c\.h: SDIO SD Card memory driver
      • stm32_eval_spi_sd.c\.h: SPI SD Card memory driver 
      • These drivers were moved from \Common to \STM32XXX_EVAL folder(s)
    • \Common folder contains only drivers for the fonts and log module used by the LCD driver
    • stm32_eval.c\.h files removed, as consequence you need to perform the following update on your project configuration  (based on EVAL drivers V4.6.2):
      • In the project files, add your EVAL board driver source file (ex. "stm3210c_eval.c") instead of "stm32_eval.c"
      • Include your EVAL board driver header file (ex. #include "stm3210c_eval.h") instead of #include "stm32_eval.h"
      • If -you are using the EVAL board's LCD, you need to add the include of -the LCD header file (ex: #include "stm3210c_eval_lcd.h")
        • If -you are using the LCD log module, after copying it to the application -folder you have to edit it and update the name of the LCD header file. For more details, refer to the lcd_log_conf_template.h driver description.

V4.6.2 / 22-July-2011

-

Main -Changes

- -
  • STM3210C_EVAL
    • stm3210c_eval_lcd.c: update to support new LCD AM240320D5TOQW01H (controller ILI9325)
  • STM322xG-EVAL
    • stm322xg_eval.h: fix value of the SDIO clock divider (SDIO_TRANSFER_CLK_DIV constant) to 2 instead of 0
    • stm322xg_eval_lcd.c: increase FSMC AddressSetupTime value from 1 to 3 to be compliant with some LCD access timing
    • stm322xg_eval_audio_codec.c: update Codec_CtrlInterface_Init() and Codec_GPIO_Init() functions to not reconfigure the I2C peripheral if it's already enabled and configured (to -avoid configuring the I2C twice when using both Audio codec and IO -Expander drivers in the same application).

V4.6.1 / 18-April-2011

-

Main -Changes

- -
  • Update some STM322xG_EVAL drivers (no change on the API) to fix warnings with TASKING C compiler.
  • Change the Release Notes name to STM32 Evaluation Board Drivers
  • stm322xg_eval.c
    • SD_LowLevel_Init(): change SDIO pins speed configuration to "GPIO_Speed_25MHz"

V4.6.0 / 11-March-2011

-

Main -Changes

- -
  • Official version supporting STM322xG_EVAL evaluation board RevB (for STM32F2xx devices).
  • Common
    • Add -new LCD log utility drivers: The LCD Log module allows to automatically -set a header and footer on any application using the LCD display and -allows to dump user, debug and error messages by using the following -macros: LCD_ErrLog(),    LCD_UsrLog() and LCD_DbgLog().
Note: the STM322xG_EVAL board RevA was wrongly named STM3220F_EVAL

V4.5.0 / 07-March-2011

-

Main -Changes

- -
  • stm32_eval_sdio_sd.c\.h: driver improvement
    • SD Clock increased to 24MHz to improve the data transfer performance.
    • Add -new functions to check the SDIO peripheral and SD Card status at any -time: SD_WaitReadOperation(), SD_WaitWriteOperation(). The -software sequence is little bit changed but without any impact on -driver API. For more details, refer to the stm32_eval_sdio_sd.c -driver description.
    • Add -new structure containing the SD Status register parameters. This -structure is called by the -         - SD_SendSDStatus() function.
    • Transfers mode updated
      • Read/Write Block using Polling and DMA modes
      • Read/Write Multi Blocks using DMA mode only
      • Interrupt mode removed
    • Data transfer functions are managing only fixed Block size (512-byte) 
  • STM32100B-EVAL
    • stm32100b_eval_cec.c: fix some strict ANSI-C errors
  • STM32100E-EVAL
    • stm32100e_eval_cec.c: fix some strict ANSI-C errors
-

V4.4.0 / 31-December-2010

-

Main -Changes

- -
  • Add new directory for STM32L152-EVAL board containing the following files:
    • stm32l152_eval.h/.c, stm32l152_eval_lcd.h/.c, stm32l152_eval_glass_lcd.h/.c, stm32l152_eval_i2c_ee.h/.c
  • Add support for the STM32100E-EVAL Rev B: SPI FLASH CS pin "sFLASH_CS_PIN" changed from PB.02 to PE.06.
  • stm32100e_eval_lcd.h/.c: Add support for "LCD_ILI9325" LCD controller.
  • stm32100e_eval_fsmc_onenand.h/.c driver updated to correct asynchronous and synchronous read operations procedures.
    -
- -

4.3.0 -- 10/15/2010

-
  1. General
- -
  • I2C EEPROM, Temperature Sensor and IOE Expander drivers updated to use the DMA for read/write transfer and add more robustness
  • SD Card (SDIO) driver updated to add more robustness
  • SPI Flash and SD Card (SPI) drivers: SPI MISO pin configuration changed to Input Floating 
- - - -
  1. Utilities
- - - - - -
  • Add new directory for STM32100E-EVAL board containing the following files:
    • stm32100e_eval.h/.c, -stm32100e_eval_lcd.h/.c, stm32100e_eval_cec.h/.c, -stm32100e_eval_fsmc_onenand.h/.c, stm32100e_eval_fsmc_sram.h/.c, -stm32100e_eval_ioe.h/.c
      -
  • Common
    • stm32_eval_sdio_sd.c: -Update the DMA End of Transfer Check loop inside the SD_ReadBlock(), -SD_WriteBlock(), SD_ReadMultiBlocks() and SD_Write MultiBlocks().
    • stm32_eval_i2c_ee.c/.h
      -
      • Enhanced sEE_WaitEepromStandbyState() function for more robustness.
      • Enhanced Read and Write operations to manage I2C limitations.
      • Add Timeout management with user callback implementation which allows recovering from I2C bus errors.
      • Add -critical sections user callbacks allowing to disable then enable -interrupts when I2C operation require to be not interrupted.
    • stm32_eval_i2c_tsensor.c/.h
      -
      • Enhanced I2C communication functions by using DMA for registers Read and Write operations.
      • Add Timeout management with user callback implementation which allows recovering from I2C bus errors.
  • STM32100B_EVAL
    • stm32100b_eval.h: Add LM75 DMA defines.
    • stm32100b_eval_lcd.c: Change "SPI_FLASH" by "sFLASH" in LCD_DrawBMP() function.
  • STM3210B_EVAL
    • stm3210b_eval.h: Add LM75 DMA defines.
    • stm3210b_eval_lcd.c: Change "SPI_FLASH" by "sFLASH" in LCD_DrawBMP() function.
  • STM3210C_EVAL
    • stm3210c_eval.h: Add EEPROM driver Timeout define.
    • stm3210c_eval_lcd.c: Change "SPI_FLASH" by "sFLASH" in LCD_DrawBMP() function.
    • stm3210c_eval_i2c_ioe.c
      • Enhanced I2C communication functions by using DMA for registers Read and Write operations.
      • Add Timeout management with user callback implementation which allows recovering from I2C bus errors.
      • change IOE_I2C_SPEED from "400000" to "300000".
  • STM3210E_EVAL
    • stm3210e_eval.c: change "void SD_WaitForDMAEndOfTransfer(void)" to "uint32_t SD_DMAEndOfTransferStatus(void)".
    • stm3210e_eval.h: Add LM75 DMA defines.
    • stm3210e_eval_fsmc_nand.h: remove "NAND_CMD_AREA_TRUE1" define.
    • stm3210e_eval_fsmc_nand.c: Update FSMC timing in NAND_Init() function to be aligned with AN2784 application note.
    • stm3210e_eval_fsmc_nor.c
      • NOR_Init() function: add FSMC_AsynchronousWait field to FSMC_NORSRAMInitStructure 
    • stm3210e_eval_fsmc_sram.c
      -
      • Update FSMC timing in SRAM_Init() function to be aligned with AN2784 application note.
        -
      • SRAM_Init() function: add FSMC_AsynchronousWait field to FSMC_NORSRAMInitStructure 
    • stm3210e_eval_lcd.c
      • LCD_FSMCConfig() function: add FSMC_AsynchronousWait field to FSMC_NORSRAMInitStructure 
- - -

4.2.0 -- 04/16/2010

-
  1. General
- -
  • I2C EEPROM driver -update to use the DMA to -perform data transfer to/from EEPROM memory.
- -
  1. Utilities
-
  • STM32_EVAL
-
    • stm32_eval_i2c_ee.c: -updated to use the DMA to perform data transfer to/from -EEPROM memory. For more details, refer to the description provided -within this file.
    • stm3210c_eval.c: add low level -functions to configure the DMA (needed for I2C EEPROM driver)
      -
    • stm3210c_eval_ioe.c: add a delay -in IOE_TS_GetState() function to wait till the end of ADC -conversion
    • stm3210e_eval_fsmc_nor.c: add PD6 pin configuration in -NOR_Init() function
    • stm3210b_eval_lcd.c: remove the -second ";" from "static void PutPixel(int16_t x, int16_t y);;" 
-

4.1.0 -- 03/01/2010

-
  1. General
-
  • Add support -for STM32 Low-density Value line (STM32F100x4/6) and -Medium-density Value line (STM32F100x8/B) devices.
  • Add support for the -STMicroelectronics STM32100B-EVAL evaluation board.
-
  1. Utilities
-
  • STM32_EVAL
-
  • Add new directory -"Common" containing a common drivers for all STM32 evaluation boards: -fonts.h/.c, stm32_eval_i2c_ee.h/.c, stm32_eval_spi_flash.h/.c, - stm32_eval_i2c_tsensor.h/.c, - stm32_eval_spi_sd.h/.c -and stm32_eval_sdio_sd.h/.c
  • Add new driver for the -STM32100B-EVAL managing Leds, push button and COM ports.
  • New HDMI CEC High level -driver.
    -
  • For all LCD drivers new fonts has -been added.
  • New FSMC memories -drivers for STM3210E-EVAL board: stm3210e_eval_fsmc_sram.h/.c, stm3210e_eval_fsmc_nor.h/.c -and stm3210e_eval_fsmc_nand.h/.c.

License

-

Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this package except in compliance with the License. You may obtain a copy of the License at:


Unless -required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See -the License for the specific language governing permissions and -limitations under the License.
- -
-
-

For -complete documentation on STM32 Microcontrollers -visit www.st.com/STM32

-
-

-
-
-

 

-
- - \ No newline at end of file diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/fonts.c b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/fonts.c deleted file mode 100644 index 66b6e4dc6..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/fonts.c +++ /dev/null @@ -1,1003 +0,0 @@ -/** - ****************************************************************************** - * @file fonts.c - * @author MCD Application Team - * @version V5.0.2 - * @date 05-March-2012 - * @brief This file provides text fonts for STM32xx-EVAL's LCD driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "fonts.h" - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup Common - * @{ - */ - -/** @addtogroup FONTS - * @brief This file includes the Fonts driver of STM32xx-EVAL boards. - * @{ - */ - -/** @defgroup FONTS_Private_Types - * @{ - */ -/** - * @} - */ - - -/** @defgroup FONTS_Private_Defines - * @{ - */ -/** - * @} - */ - - -/** @defgroup FONTS_Private_Macros - * @{ - */ -/** - * @} - */ - - -/** @defgroup FONTS_Private_Variables - * @{ - */ -const uint16_t ASCII16x24_Table [] = { -/** - * @brief Space ' ' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '!' - */ - 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, - 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, 0x0000, - 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '"' - */ - 0x0000, 0x0000, 0x00CC, 0x00CC, 0x00CC, 0x00CC, 0x00CC, 0x00CC, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '#' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0C60, 0x0C60, - 0x0C60, 0x0630, 0x0630, 0x1FFE, 0x1FFE, 0x0630, 0x0738, 0x0318, - 0x1FFE, 0x1FFE, 0x0318, 0x0318, 0x018C, 0x018C, 0x018C, 0x0000, -/** - * @brief '$' - */ - 0x0000, 0x0080, 0x03E0, 0x0FF8, 0x0E9C, 0x1C8C, 0x188C, 0x008C, - 0x0098, 0x01F8, 0x07E0, 0x0E80, 0x1C80, 0x188C, 0x188C, 0x189C, - 0x0CB8, 0x0FF0, 0x03E0, 0x0080, 0x0080, 0x0000, 0x0000, 0x0000, -/** - * @brief '%' - */ - 0x0000, 0x0000, 0x0000, 0x180E, 0x0C1B, 0x0C11, 0x0611, 0x0611, - 0x0311, 0x0311, 0x019B, 0x018E, 0x38C0, 0x6CC0, 0x4460, 0x4460, - 0x4430, 0x4430, 0x4418, 0x6C18, 0x380C, 0x0000, 0x0000, 0x0000, -/** - * @brief '&' - */ - 0x0000, 0x01E0, 0x03F0, 0x0738, 0x0618, 0x0618, 0x0330, 0x01F0, - 0x00F0, 0x00F8, 0x319C, 0x330E, 0x1E06, 0x1C06, 0x1C06, 0x3F06, - 0x73FC, 0x21F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief ''' - */ - 0x0000, 0x0000, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '(' - */ - 0x0000, 0x0200, 0x0300, 0x0180, 0x00C0, 0x00C0, 0x0060, 0x0060, - 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, - 0x0060, 0x0060, 0x00C0, 0x00C0, 0x0180, 0x0300, 0x0200, 0x0000, -/** - * @brief ')' - */ - 0x0000, 0x0020, 0x0060, 0x00C0, 0x0180, 0x0180, 0x0300, 0x0300, - 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, - 0x0300, 0x0300, 0x0180, 0x0180, 0x00C0, 0x0060, 0x0020, 0x0000, -/** - * @brief '*' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0, - 0x06D8, 0x07F8, 0x01E0, 0x0330, 0x0738, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '+' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, - 0x0180, 0x0180, 0x0180, 0x3FFC, 0x3FFC, 0x0180, 0x0180, 0x0180, - 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief ',' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0180, 0x0180, 0x0100, 0x0100, 0x0080, 0x0000, 0x0000, -/** - * @brief '-' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x07E0, 0x07E0, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '.' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '/' - */ - 0x0000, 0x0C00, 0x0C00, 0x0600, 0x0600, 0x0600, 0x0300, 0x0300, - 0x0300, 0x0380, 0x0180, 0x0180, 0x0180, 0x00C0, 0x00C0, 0x00C0, - 0x0060, 0x0060, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '0' - */ - 0x0000, 0x03E0, 0x07F0, 0x0E38, 0x0C18, 0x180C, 0x180C, 0x180C, - 0x180C, 0x180C, 0x180C, 0x180C, 0x180C, 0x180C, 0x0C18, 0x0E38, - 0x07F0, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '1' - */ - 0x0000, 0x0100, 0x0180, 0x01C0, 0x01F0, 0x0198, 0x0188, 0x0180, - 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, - 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '2' - */ - 0x0000, 0x03E0, 0x0FF8, 0x0C18, 0x180C, 0x180C, 0x1800, 0x1800, - 0x0C00, 0x0600, 0x0300, 0x0180, 0x00C0, 0x0060, 0x0030, 0x0018, - 0x1FFC, 0x1FFC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '3' - */ - 0x0000, 0x01E0, 0x07F8, 0x0E18, 0x0C0C, 0x0C0C, 0x0C00, 0x0600, - 0x03C0, 0x07C0, 0x0C00, 0x1800, 0x1800, 0x180C, 0x180C, 0x0C18, - 0x07F8, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '4' - */ - 0x0000, 0x0C00, 0x0E00, 0x0F00, 0x0F00, 0x0D80, 0x0CC0, 0x0C60, - 0x0C60, 0x0C30, 0x0C18, 0x0C0C, 0x3FFC, 0x3FFC, 0x0C00, 0x0C00, - 0x0C00, 0x0C00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '5' - */ - 0x0000, 0x0FF8, 0x0FF8, 0x0018, 0x0018, 0x000C, 0x03EC, 0x07FC, - 0x0E1C, 0x1C00, 0x1800, 0x1800, 0x1800, 0x180C, 0x0C1C, 0x0E18, - 0x07F8, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '6' - */ - 0x0000, 0x07C0, 0x0FF0, 0x1C38, 0x1818, 0x0018, 0x000C, 0x03CC, - 0x0FEC, 0x0E3C, 0x1C1C, 0x180C, 0x180C, 0x180C, 0x1C18, 0x0E38, - 0x07F0, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '7' - */ - 0x0000, 0x1FFC, 0x1FFC, 0x0C00, 0x0600, 0x0600, 0x0300, 0x0380, - 0x0180, 0x01C0, 0x00C0, 0x00E0, 0x0060, 0x0060, 0x0070, 0x0030, - 0x0030, 0x0030, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '8' - */ - 0x0000, 0x03E0, 0x07F0, 0x0E38, 0x0C18, 0x0C18, 0x0C18, 0x0638, - 0x07F0, 0x07F0, 0x0C18, 0x180C, 0x180C, 0x180C, 0x180C, 0x0C38, - 0x0FF8, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '9' - */ - 0x0000, 0x03E0, 0x07F0, 0x0E38, 0x0C1C, 0x180C, 0x180C, 0x180C, - 0x1C1C, 0x1E38, 0x1BF8, 0x19E0, 0x1800, 0x0C00, 0x0C00, 0x0E1C, - 0x07F8, 0x01F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief ':' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief ';' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0180, 0x0180, 0x0100, 0x0100, 0x0080, 0x0000, 0x0000, 0x0000, -/** - * @brief '<' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1000, 0x1C00, 0x0F80, 0x03E0, 0x00F8, 0x0018, 0x00F8, 0x03E0, - 0x0F80, 0x1C00, 0x1000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '=' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1FF8, 0x0000, 0x0000, 0x0000, 0x1FF8, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '>' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0008, 0x0038, 0x01F0, 0x07C0, 0x1F00, 0x1800, 0x1F00, 0x07C0, - 0x01F0, 0x0038, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '?' - */ - 0x0000, 0x03E0, 0x0FF8, 0x0C18, 0x180C, 0x180C, 0x1800, 0x0C00, - 0x0600, 0x0300, 0x0180, 0x00C0, 0x00C0, 0x00C0, 0x0000, 0x0000, - 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '@' - */ - 0x0000, 0x0000, 0x07E0, 0x1818, 0x2004, 0x29C2, 0x4A22, 0x4411, - 0x4409, 0x4409, 0x4409, 0x2209, 0x1311, 0x0CE2, 0x4002, 0x2004, - 0x1818, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'A' - */ - 0x0000, 0x0380, 0x0380, 0x06C0, 0x06C0, 0x06C0, 0x0C60, 0x0C60, - 0x1830, 0x1830, 0x1830, 0x3FF8, 0x3FF8, 0x701C, 0x600C, 0x600C, - 0xC006, 0xC006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'B' - */ - 0x0000, 0x03FC, 0x0FFC, 0x0C0C, 0x180C, 0x180C, 0x180C, 0x0C0C, - 0x07FC, 0x0FFC, 0x180C, 0x300C, 0x300C, 0x300C, 0x300C, 0x180C, - 0x1FFC, 0x07FC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'C' - */ - 0x0000, 0x07C0, 0x1FF0, 0x3838, 0x301C, 0x700C, 0x6006, 0x0006, - 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x6006, 0x700C, 0x301C, - 0x1FF0, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'D' - */ - 0x0000, 0x03FE, 0x0FFE, 0x0E06, 0x1806, 0x1806, 0x3006, 0x3006, - 0x3006, 0x3006, 0x3006, 0x3006, 0x3006, 0x1806, 0x1806, 0x0E06, - 0x0FFE, 0x03FE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'E' - */ - 0x0000, 0x3FFC, 0x3FFC, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, - 0x1FFC, 0x1FFC, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, - 0x3FFC, 0x3FFC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'F' - */ - 0x0000, 0x3FF8, 0x3FF8, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, - 0x1FF8, 0x1FF8, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, - 0x0018, 0x0018, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'G' - */ - 0x0000, 0x0FE0, 0x3FF8, 0x783C, 0x600E, 0xE006, 0xC007, 0x0003, - 0x0003, 0xFE03, 0xFE03, 0xC003, 0xC007, 0xC006, 0xC00E, 0xF03C, - 0x3FF8, 0x0FE0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'H' - */ - 0x0000, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, - 0x3FFC, 0x3FFC, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, - 0x300C, 0x300C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'I' - */ - 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, - 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, - 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'J' - */ - 0x0000, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, - 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0618, 0x0618, 0x0738, - 0x03F0, 0x01E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'K' - */ - 0x0000, 0x3006, 0x1806, 0x0C06, 0x0606, 0x0306, 0x0186, 0x00C6, - 0x0066, 0x0076, 0x00DE, 0x018E, 0x0306, 0x0606, 0x0C06, 0x1806, - 0x3006, 0x6006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'L' - */ - 0x0000, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, - 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, - 0x1FF8, 0x1FF8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'M' - */ - 0x0000, 0xE00E, 0xF01E, 0xF01E, 0xF01E, 0xD836, 0xD836, 0xD836, - 0xD836, 0xCC66, 0xCC66, 0xCC66, 0xC6C6, 0xC6C6, 0xC6C6, 0xC6C6, - 0xC386, 0xC386, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'N' - */ - 0x0000, 0x300C, 0x301C, 0x303C, 0x303C, 0x306C, 0x306C, 0x30CC, - 0x30CC, 0x318C, 0x330C, 0x330C, 0x360C, 0x360C, 0x3C0C, 0x3C0C, - 0x380C, 0x300C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'O' - */ - 0x0000, 0x07E0, 0x1FF8, 0x381C, 0x700E, 0x6006, 0xC003, 0xC003, - 0xC003, 0xC003, 0xC003, 0xC003, 0xC003, 0x6006, 0x700E, 0x381C, - 0x1FF8, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'P' - */ - 0x0000, 0x0FFC, 0x1FFC, 0x380C, 0x300C, 0x300C, 0x300C, 0x300C, - 0x180C, 0x1FFC, 0x07FC, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, - 0x000C, 0x000C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'Q' - */ - 0x0000, 0x07E0, 0x1FF8, 0x381C, 0x700E, 0x6006, 0xE003, 0xC003, - 0xC003, 0xC003, 0xC003, 0xC003, 0xE007, 0x6306, 0x3F0E, 0x3C1C, - 0x3FF8, 0xF7E0, 0xC000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'R' - */ - 0x0000, 0x0FFE, 0x1FFE, 0x3806, 0x3006, 0x3006, 0x3006, 0x3806, - 0x1FFE, 0x07FE, 0x0306, 0x0606, 0x0C06, 0x1806, 0x1806, 0x3006, - 0x3006, 0x6006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'S' - */ - 0x0000, 0x03E0, 0x0FF8, 0x0C1C, 0x180C, 0x180C, 0x000C, 0x001C, - 0x03F8, 0x0FE0, 0x1E00, 0x3800, 0x3006, 0x3006, 0x300E, 0x1C1C, - 0x0FF8, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'T' - */ - 0x0000, 0x7FFE, 0x7FFE, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, - 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, - 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'U' - */ - 0x0000, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, - 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x1818, - 0x1FF8, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'V' - */ - 0x0000, 0x6003, 0x3006, 0x3006, 0x3006, 0x180C, 0x180C, 0x180C, - 0x0C18, 0x0C18, 0x0E38, 0x0630, 0x0630, 0x0770, 0x0360, 0x0360, - 0x01C0, 0x01C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'W' - */ - 0x0000, 0x6003, 0x61C3, 0x61C3, 0x61C3, 0x3366, 0x3366, 0x3366, - 0x3366, 0x3366, 0x3366, 0x1B6C, 0x1B6C, 0x1B6C, 0x1A2C, 0x1E3C, - 0x0E38, 0x0E38, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'X' - */ - 0x0000, 0xE00F, 0x700C, 0x3018, 0x1830, 0x0C70, 0x0E60, 0x07C0, - 0x0380, 0x0380, 0x03C0, 0x06E0, 0x0C70, 0x1C30, 0x1818, 0x300C, - 0x600E, 0xE007, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'Y' - */ - 0x0000, 0xC003, 0x6006, 0x300C, 0x381C, 0x1838, 0x0C30, 0x0660, - 0x07E0, 0x03C0, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, - 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'Z' - */ - 0x0000, 0x7FFC, 0x7FFC, 0x6000, 0x3000, 0x1800, 0x0C00, 0x0600, - 0x0300, 0x0180, 0x00C0, 0x0060, 0x0030, 0x0018, 0x000C, 0x0006, - 0x7FFE, 0x7FFE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '[' - */ - 0x0000, 0x03E0, 0x03E0, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, - 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, - 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x03E0, 0x03E0, 0x0000, -/** - * @brief '\' - */ - 0x0000, 0x0030, 0x0030, 0x0060, 0x0060, 0x0060, 0x00C0, 0x00C0, - 0x00C0, 0x01C0, 0x0180, 0x0180, 0x0180, 0x0300, 0x0300, 0x0300, - 0x0600, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief ']' - */ - 0x0000, 0x03E0, 0x03E0, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, - 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, - 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x03E0, 0x03E0, 0x0000, -/** - * @brief '^' - */ - 0x0000, 0x0000, 0x01C0, 0x01C0, 0x0360, 0x0360, 0x0360, 0x0630, - 0x0630, 0x0C18, 0x0C18, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '_' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief ''' - */ - 0x0000, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'a' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03F0, 0x07F8, - 0x0C1C, 0x0C0C, 0x0F00, 0x0FF0, 0x0CF8, 0x0C0C, 0x0C0C, 0x0F1C, - 0x0FF8, 0x18F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'b' - */ - 0x0000, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x03D8, 0x0FF8, - 0x0C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0C38, - 0x0FF8, 0x03D8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'c' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03C0, 0x07F0, - 0x0E30, 0x0C18, 0x0018, 0x0018, 0x0018, 0x0018, 0x0C18, 0x0E30, - 0x07F0, 0x03C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'd' - */ - 0x0000, 0x1800, 0x1800, 0x1800, 0x1800, 0x1800, 0x1BC0, 0x1FF0, - 0x1C30, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1C30, - 0x1FF0, 0x1BC0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'e' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03C0, 0x0FF0, - 0x0C30, 0x1818, 0x1FF8, 0x1FF8, 0x0018, 0x0018, 0x1838, 0x1C30, - 0x0FF0, 0x07C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'f' - */ - 0x0000, 0x0F80, 0x0FC0, 0x00C0, 0x00C0, 0x00C0, 0x07F0, 0x07F0, - 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, - 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'g' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0DE0, 0x0FF8, - 0x0E18, 0x0C0C, 0x0C0C, 0x0C0C, 0x0C0C, 0x0C0C, 0x0C0C, 0x0E18, - 0x0FF8, 0x0DE0, 0x0C00, 0x0C0C, 0x061C, 0x07F8, 0x01F0, 0x0000, -/** - * @brief 'h' - */ - 0x0000, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x07D8, 0x0FF8, - 0x1C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, - 0x1818, 0x1818, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'i' - */ - 0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0, - 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, - 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'j' - */ - 0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0, - 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, - 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00F8, 0x0078, 0x0000, -/** - * @brief 'k' - */ - 0x0000, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x0C0C, 0x060C, - 0x030C, 0x018C, 0x00CC, 0x006C, 0x00FC, 0x019C, 0x038C, 0x030C, - 0x060C, 0x0C0C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'l' - */ - 0x0000, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, - 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, - 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'm' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3C7C, 0x7EFF, - 0xE3C7, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, - 0xC183, 0xC183, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'n' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0798, 0x0FF8, - 0x1C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, - 0x1818, 0x1818, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'o' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03C0, 0x0FF0, - 0x0C30, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0C30, - 0x0FF0, 0x03C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'p' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03D8, 0x0FF8, - 0x0C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0C38, - 0x0FF8, 0x03D8, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0000, -/** - * @brief 'q' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1BC0, 0x1FF0, - 0x1C30, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1C30, - 0x1FF0, 0x1BC0, 0x1800, 0x1800, 0x1800, 0x1800, 0x1800, 0x0000, -/** - * @brief 'r' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x07B0, 0x03F0, - 0x0070, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, - 0x0030, 0x0030, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 's' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03E0, 0x03F0, - 0x0E38, 0x0C18, 0x0038, 0x03F0, 0x07C0, 0x0C00, 0x0C18, 0x0E38, - 0x07F0, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 't' - */ - 0x0000, 0x0000, 0x0080, 0x00C0, 0x00C0, 0x00C0, 0x07F0, 0x07F0, - 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, - 0x07C0, 0x0780, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'u' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1818, 0x1818, - 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1C38, - 0x1FF0, 0x19E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'v' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x180C, 0x0C18, - 0x0C18, 0x0C18, 0x0630, 0x0630, 0x0630, 0x0360, 0x0360, 0x0360, - 0x01C0, 0x01C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'w' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x41C1, 0x41C1, - 0x61C3, 0x6363, 0x6363, 0x6363, 0x3636, 0x3636, 0x3636, 0x1C1C, - 0x1C1C, 0x1C1C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'x' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x381C, 0x1C38, - 0x0C30, 0x0660, 0x0360, 0x0360, 0x0360, 0x0360, 0x0660, 0x0C30, - 0x1C38, 0x381C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief 'y' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3018, 0x1830, - 0x1830, 0x1870, 0x0C60, 0x0C60, 0x0CE0, 0x06C0, 0x06C0, 0x0380, - 0x0380, 0x0380, 0x0180, 0x0180, 0x01C0, 0x00F0, 0x0070, 0x0000, -/** - * @brief 'z' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1FFC, 0x1FFC, - 0x0C00, 0x0600, 0x0300, 0x0180, 0x00C0, 0x0060, 0x0030, 0x0018, - 0x1FFC, 0x1FFC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -/** - * @brief '{' - */ - 0x0000, 0x0300, 0x0180, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, - 0x00C0, 0x0060, 0x0060, 0x0030, 0x0060, 0x0040, 0x00C0, 0x00C0, - 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x0180, 0x0300, 0x0000, 0x0000, -/** - * @brief '|' - */ - 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, - 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, - 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, -/** - * @brief '}' - */ - 0x0000, 0x0060, 0x00C0, 0x01C0, 0x0180, 0x0180, 0x0180, 0x0180, - 0x0180, 0x0300, 0x0300, 0x0600, 0x0300, 0x0100, 0x0180, 0x0180, - 0x0180, 0x0180, 0x0180, 0x0180, 0x00C0, 0x0060, 0x0000, 0x0000, -/** - * @brief '~' - */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x10F0, 0x1FF8, 0x0F08, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}; - -const uint16_t ASCII12x12_Table [] = { - 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - 0x0000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x0000,0x2000,0x0000,0x0000, - 0x0000,0x5000,0x5000,0x5000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - 0x0000,0x0900,0x0900,0x1200,0x7f00,0x1200,0x7f00,0x1200,0x2400,0x2400,0x0000,0x0000, - 0x1000,0x3800,0x5400,0x5000,0x5000,0x3800,0x1400,0x5400,0x5400,0x3800,0x1000,0x0000, - 0x0000,0x3080,0x4900,0x4900,0x4a00,0x32c0,0x0520,0x0920,0x0920,0x10c0,0x0000,0x0000, - 0x0000,0x0c00,0x1200,0x1200,0x1400,0x1800,0x2500,0x2300,0x2300,0x1d80,0x0000,0x0000, - 0x0000,0x4000,0x4000,0x4000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - 0x0000,0x0800,0x1000,0x1000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x1000,0x1000, - 0x0000,0x4000,0x2000,0x2000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x2000,0x2000, - 0x0000,0x2000,0x7000,0x2000,0x5000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x0800,0x0800,0x7f00,0x0800,0x0800,0x0000,0x0000,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2000,0x2000,0x4000, - 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7000,0x0000,0x0000,0x0000,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2000,0x0000,0x0000, - 0x0000,0x1000,0x1000,0x1000,0x2000,0x2000,0x2000,0x2000,0x4000,0x4000,0x0000,0x0000, - 0x0000,0x1000,0x2800,0x4400,0x4400,0x4400,0x4400,0x4400,0x2800,0x1000,0x0000,0x0000, - 0x0000,0x1000,0x3000,0x5000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x0000,0x0000, - 0x0000,0x3000,0x4800,0x4400,0x0400,0x0800,0x1000,0x2000,0x4000,0x7c00,0x0000,0x0000, - 0x0000,0x3000,0x4800,0x0400,0x0800,0x1000,0x0800,0x4400,0x4800,0x3000,0x0000,0x0000, - 0x0000,0x0800,0x1800,0x1800,0x2800,0x2800,0x4800,0x7c00,0x0800,0x0800,0x0000,0x0000, - 0x0000,0x3c00,0x2000,0x4000,0x7000,0x4800,0x0400,0x4400,0x4800,0x3000,0x0000,0x0000, - 0x0000,0x1800,0x2400,0x4000,0x5000,0x6800,0x4400,0x4400,0x2800,0x1000,0x0000,0x0000, - 0x0000,0x7c00,0x0400,0x0800,0x1000,0x1000,0x1000,0x2000,0x2000,0x2000,0x0000,0x0000, - 0x0000,0x1000,0x2800,0x4400,0x2800,0x1000,0x2800,0x4400,0x2800,0x1000,0x0000,0x0000, - 0x0000,0x1000,0x2800,0x4400,0x4400,0x2c00,0x1400,0x0400,0x4800,0x3000,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x2000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2000,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x2000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2000,0x2000,0x4000, - 0x0000,0x0000,0x0400,0x0800,0x3000,0x4000,0x3000,0x0800,0x0400,0x0000,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x7c00,0x0000,0x0000,0x7c00,0x0000,0x0000,0x0000,0x0000,0x0000, - 0x0000,0x0000,0x4000,0x2000,0x1800,0x0400,0x1800,0x2000,0x4000,0x0000,0x0000,0x0000, - 0x0000,0x3800,0x6400,0x4400,0x0400,0x0800,0x1000,0x1000,0x0000,0x1000,0x0000,0x0000, - 0x0000,0x0f80,0x1040,0x2ea0,0x51a0,0x5120,0x5120,0x5120,0x5320,0x4dc0,0x2020,0x1040, - 0x0000,0x0800,0x1400,0x1400,0x1400,0x2200,0x3e00,0x2200,0x4100,0x4100,0x0000,0x0000, - 0x0000,0x3c00,0x2200,0x2200,0x2200,0x3c00,0x2200,0x2200,0x2200,0x3c00,0x0000,0x0000, - 0x0000,0x0e00,0x1100,0x2100,0x2000,0x2000,0x2000,0x2100,0x1100,0x0e00,0x0000,0x0000, - 0x0000,0x3c00,0x2200,0x2100,0x2100,0x2100,0x2100,0x2100,0x2200,0x3c00,0x0000,0x0000, - 0x0000,0x3e00,0x2000,0x2000,0x2000,0x3e00,0x2000,0x2000,0x2000,0x3e00,0x0000,0x0000, - 0x0000,0x3e00,0x2000,0x2000,0x2000,0x3c00,0x2000,0x2000,0x2000,0x2000,0x0000,0x0000, - 0x0000,0x0e00,0x1100,0x2100,0x2000,0x2700,0x2100,0x2100,0x1100,0x0e00,0x0000,0x0000, - 0x0000,0x2100,0x2100,0x2100,0x2100,0x3f00,0x2100,0x2100,0x2100,0x2100,0x0000,0x0000, - 0x0000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x0000,0x0000, - 0x0000,0x0800,0x0800,0x0800,0x0800,0x0800,0x0800,0x4800,0x4800,0x3000,0x0000,0x0000, - 0x0000,0x2200,0x2400,0x2800,0x2800,0x3800,0x2800,0x2400,0x2400,0x2200,0x0000,0x0000, - 0x0000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x3e00,0x0000,0x0000, - 0x0000,0x2080,0x3180,0x3180,0x3180,0x2a80,0x2a80,0x2a80,0x2a80,0x2480,0x0000,0x0000, - 0x0000,0x2100,0x3100,0x3100,0x2900,0x2900,0x2500,0x2300,0x2300,0x2100,0x0000,0x0000, - 0x0000,0x0c00,0x1200,0x2100,0x2100,0x2100,0x2100,0x2100,0x1200,0x0c00,0x0000,0x0000, - 0x0000,0x3c00,0x2200,0x2200,0x2200,0x3c00,0x2000,0x2000,0x2000,0x2000,0x0000,0x0000, - 0x0000,0x0c00,0x1200,0x2100,0x2100,0x2100,0x2100,0x2100,0x1600,0x0d00,0x0100,0x0000, - 0x0000,0x3e00,0x2100,0x2100,0x2100,0x3e00,0x2400,0x2200,0x2100,0x2080,0x0000,0x0000, - 0x0000,0x1c00,0x2200,0x2200,0x2000,0x1c00,0x0200,0x2200,0x2200,0x1c00,0x0000,0x0000, - 0x0000,0x3e00,0x0800,0x0800,0x0800,0x0800,0x0800,0x0800,0x0800,0x0800,0x0000,0x0000, - 0x0000,0x2100,0x2100,0x2100,0x2100,0x2100,0x2100,0x2100,0x1200,0x0c00,0x0000,0x0000, - 0x0000,0x4100,0x4100,0x2200,0x2200,0x2200,0x1400,0x1400,0x1400,0x0800,0x0000,0x0000, - 0x0000,0x4440,0x4a40,0x2a40,0x2a80,0x2a80,0x2a80,0x2a80,0x2a80,0x1100,0x0000,0x0000, - 0x0000,0x4100,0x2200,0x1400,0x1400,0x0800,0x1400,0x1400,0x2200,0x4100,0x0000,0x0000, - 0x0000,0x4100,0x2200,0x2200,0x1400,0x0800,0x0800,0x0800,0x0800,0x0800,0x0000,0x0000, - 0x0000,0x7e00,0x0200,0x0400,0x0800,0x1000,0x1000,0x2000,0x4000,0x7e00,0x0000,0x0000, - 0x0000,0x3000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000, - 0x0000,0x4000,0x4000,0x2000,0x2000,0x2000,0x2000,0x2000,0x1000,0x1000,0x0000,0x0000, - 0x0000,0x6000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000, - 0x0000,0x1000,0x2800,0x2800,0x2800,0x4400,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7e00, - 0x4000,0x2000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x3800,0x4400,0x0400,0x3c00,0x4400,0x4400,0x3c00,0x0000,0x0000, - 0x0000,0x4000,0x4000,0x5800,0x6400,0x4400,0x4400,0x4400,0x6400,0x5800,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x3000,0x4800,0x4000,0x4000,0x4000,0x4800,0x3000,0x0000,0x0000, - 0x0000,0x0400,0x0400,0x3400,0x4c00,0x4400,0x4400,0x4400,0x4c00,0x3400,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x3800,0x4400,0x4400,0x7c00,0x4000,0x4400,0x3800,0x0000,0x0000, - 0x0000,0x6000,0x4000,0xe000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x3400,0x4c00,0x4400,0x4400,0x4400,0x4c00,0x3400,0x0400,0x4400, - 0x0000,0x4000,0x4000,0x5800,0x6400,0x4400,0x4400,0x4400,0x4400,0x4400,0x0000,0x0000, - 0x0000,0x4000,0x0000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x0000,0x0000, - 0x0000,0x4000,0x0000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000, - 0x0000,0x4000,0x4000,0x4800,0x5000,0x6000,0x5000,0x5000,0x4800,0x4800,0x0000,0x0000, - 0x0000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x5200,0x6d00,0x4900,0x4900,0x4900,0x4900,0x4900,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x5800,0x6400,0x4400,0x4400,0x4400,0x4400,0x4400,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x3800,0x4400,0x4400,0x4400,0x4400,0x4400,0x3800,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x5800,0x6400,0x4400,0x4400,0x4400,0x6400,0x5800,0x4000,0x4000, - 0x0000,0x0000,0x0000,0x3400,0x4c00,0x4400,0x4400,0x4400,0x4c00,0x3400,0x0400,0x0400, - 0x0000,0x0000,0x0000,0x5000,0x6000,0x4000,0x4000,0x4000,0x4000,0x4000,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x3000,0x4800,0x4000,0x3000,0x0800,0x4800,0x3000,0x0000,0x0000, - 0x0000,0x4000,0x4000,0xe000,0x4000,0x4000,0x4000,0x4000,0x4000,0x6000,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x4400,0x4400,0x4400,0x4400,0x4400,0x4c00,0x3400,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x4400,0x4400,0x2800,0x2800,0x2800,0x2800,0x1000,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x4900,0x4900,0x5500,0x5500,0x5500,0x5500,0x2200,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x4400,0x2800,0x2800,0x1000,0x2800,0x2800,0x4400,0x0000,0x0000, - 0x0000,0x0000,0x0000,0x4400,0x4400,0x2800,0x2800,0x2800,0x1000,0x1000,0x1000,0x1000, - 0x0000,0x0000,0x0000,0x7800,0x0800,0x1000,0x2000,0x2000,0x4000,0x7800,0x0000,0x0000, - 0x0000,0x1000,0x2000,0x2000,0x2000,0x2000,0x4000,0x2000,0x2000,0x2000,0x2000,0x2000, - 0x0000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000, - 0x0000,0x4000,0x2000,0x2000,0x2000,0x2000,0x1000,0x2000,0x2000,0x2000,0x2000,0x2000, - 0x0000,0x0000,0x0000,0x0000,0x7400,0x5800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, - 0x0000,0x0000,0x7000,0x5000,0x5000,0x5000,0x5000,0x5000,0x5000,0x7000,0x0000,0x0000}; - -const uint16_t ASCII8x12_Table [] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x10,0x00, - 0x00,0x00,0x00,0x28,0x28,0x28,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x14,0x14,0x3e,0x14,0x28,0x7c,0x28,0x28,0x00, - 0x00,0x00,0x10,0x38,0x54,0x50,0x38,0x14,0x14,0x54,0x38,0x10, - 0x00,0x00,0x00,0x44,0xa8,0xa8,0x50,0x14,0x1a,0x2a,0x24,0x00, - 0x00,0x00,0x00,0x20,0x50,0x50,0x20,0xe8,0x98,0x98,0x60,0x00, - 0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x40,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, - 0x00,0x00,0x00,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, - 0x00,0x00,0x00,0x40,0xe0,0x40,0xa0,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0xf8,0x20,0x20,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00, - 0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x40,0x80,0x80,0x80,0x00, - 0x00,0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, - 0x00,0x00,0x00,0x20,0x60,0xa0,0x20,0x20,0x20,0x20,0x20,0x00, - 0x00,0x00,0x00,0x60,0x90,0x10,0x10,0x20,0x40,0x80,0xf0,0x00, - 0x00,0x00,0x00,0x60,0x90,0x10,0x60,0x10,0x10,0x90,0x60,0x00, - 0x00,0x00,0x00,0x10,0x30,0x50,0x50,0x90,0xf8,0x10,0x10,0x00, - 0x00,0x00,0x00,0x70,0x40,0x80,0xe0,0x10,0x10,0x90,0x60,0x00, - 0x00,0x00,0x00,0x60,0x90,0x80,0xa0,0xd0,0x90,0x90,0x60,0x00, - 0x00,0x00,0x00,0xf0,0x10,0x20,0x20,0x20,0x40,0x40,0x40,0x00, - 0x00,0x00,0x00,0x60,0x90,0x90,0x60,0x90,0x90,0x90,0x60,0x00, - 0x00,0x00,0x00,0x60,0x90,0x90,0xb0,0x50,0x10,0x90,0x60,0x00, - 0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x40,0x00, - 0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x40,0x40, - 0x00,0x00,0x00,0x00,0x00,0x10,0x60,0x80,0x60,0x10,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x00,0xf0,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x10,0x60,0x80,0x00,0x00, - 0x00,0x00,0x00,0x60,0x90,0x10,0x20,0x40,0x40,0x00,0x40,0x00, - 0x00,0x00,0x00,0x1c,0x22,0x5b,0xa5,0xa5,0xa5,0xa5,0x9e,0x41, - 0x00,0x00,0x00,0x20,0x50,0x50,0x50,0x50,0x70,0x88,0x88,0x00, - 0x00,0x00,0x00,0xf0,0x88,0x88,0xf0,0x88,0x88,0x88,0xf0,0x00, - 0x00,0x00,0x00,0x38,0x44,0x84,0x80,0x80,0x84,0x44,0x38,0x00, - 0x00,0x00,0x00,0xe0,0x90,0x88,0x88,0x88,0x88,0x90,0xe0,0x00, - 0x00,0x00,0x00,0xf8,0x80,0x80,0xf8,0x80,0x80,0x80,0xf8,0x00, - 0x00,0x00,0x00,0x78,0x40,0x40,0x70,0x40,0x40,0x40,0x40,0x00, - 0x00,0x00,0x00,0x38,0x44,0x84,0x80,0x9c,0x84,0x44,0x38,0x00, - 0x00,0x00,0x00,0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x88,0x00, - 0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00, - 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x90,0x90,0x60,0x00, - 0x00,0x00,0x00,0x88,0x90,0xa0,0xe0,0xa0,0x90,0x90,0x88,0x00, - 0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xf0,0x00, - 0x00,0x00,0x00,0x82,0xc6,0xc6,0xaa,0xaa,0xaa,0xaa,0x92,0x00, - 0x00,0x00,0x00,0x84,0xc4,0xa4,0xa4,0x94,0x94,0x8c,0x84,0x00, - 0x00,0x00,0x00,0x30,0x48,0x84,0x84,0x84,0x84,0x48,0x30,0x00, - 0x00,0x00,0x00,0xf0,0x88,0x88,0x88,0xf0,0x80,0x80,0x80,0x00, - 0x00,0x00,0x00,0x30,0x48,0x84,0x84,0x84,0x84,0x58,0x34,0x04, - 0x00,0x00,0x00,0x78,0x44,0x44,0x78,0x50,0x48,0x44,0x42,0x00, - 0x00,0x00,0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x88,0x70,0x00, - 0x00,0x00,0x00,0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, - 0x00,0x00,0x00,0x84,0x84,0x84,0x84,0x84,0x84,0x48,0x30,0x00, - 0x00,0x00,0x00,0x88,0x88,0x50,0x50,0x50,0x50,0x50,0x20,0x00, - 0x00,0x00,0x00,0x92,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0x44,0x00, - 0x00,0x00,0x00,0x84,0x48,0x48,0x30,0x30,0x48,0x48,0x84,0x00, - 0x00,0x00,0x00,0x88,0x50,0x50,0x20,0x20,0x20,0x20,0x20,0x00, - 0x00,0x00,0x00,0xf8,0x08,0x10,0x20,0x20,0x40,0x80,0xf8,0x00, - 0x00,0x00,0x00,0xc0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, - 0x00,0x00,0x00,0x80,0x80,0x40,0x40,0x40,0x40,0x20,0x20,0x00, - 0x00,0x00,0x00,0xc0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, - 0x00,0x00,0x00,0x40,0xa0,0xa0,0xa0,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8, - 0x00,0x00,0x00,0x80,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0xe0,0x10,0x70,0x90,0x90,0x70,0x00, - 0x00,0x00,0x00,0x80,0x80,0xa0,0xd0,0x90,0x90,0xd0,0xa0,0x00, - 0x00,0x00,0x00,0x00,0x00,0x60,0x90,0x80,0x80,0x90,0x60,0x00, - 0x00,0x00,0x00,0x10,0x10,0x50,0xb0,0x90,0x90,0xb0,0x50,0x00, - 0x00,0x00,0x00,0x00,0x00,0x60,0x90,0xf0,0x80,0x90,0x60,0x00, - 0x00,0x00,0x00,0xc0,0x80,0xc0,0x80,0x80,0x80,0x80,0x80,0x00, - 0x00,0x00,0x00,0x00,0x00,0x50,0xb0,0x90,0x90,0xb0,0x50,0x10, - 0x00,0x00,0x00,0x80,0x80,0xa0,0xd0,0x90,0x90,0x90,0x90,0x00, - 0x00,0x00,0x00,0x80,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00, - 0x00,0x00,0x00,0x80,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80, - 0x00,0x00,0x00,0x80,0x80,0x90,0xa0,0xc0,0xa0,0x90,0x90,0x00, - 0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00, - 0x00,0x00,0x00,0x00,0x00,0xa6,0xda,0x92,0x92,0x92,0x92,0x00, - 0x00,0x00,0x00,0x00,0x00,0xa0,0xd0,0x90,0x90,0x90,0x90,0x00, - 0x00,0x00,0x00,0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x60,0x00, - 0x00,0x00,0x00,0x00,0x00,0xa0,0xd0,0x90,0x90,0xd0,0xa0,0x80, - 0x00,0x00,0x00,0x00,0x00,0x50,0xb0,0x90,0x90,0xb0,0x50,0x10, - 0x00,0x00,0x00,0x00,0x00,0xa0,0xc0,0x80,0x80,0x80,0x80,0x00, - 0x00,0x00,0x00,0x00,0x00,0xe0,0x90,0x40,0x20,0x90,0x60,0x00, - 0x00,0x00,0x00,0x80,0x80,0xc0,0x80,0x80,0x80,0x80,0xc0,0x00, - 0x00,0x00,0x00,0x00,0x00,0x90,0x90,0x90,0x90,0xb0,0x50,0x00, - 0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x50,0x50,0x50,0x20,0x00, - 0x00,0x00,0x00,0x00,0x00,0x92,0xaa,0xaa,0xaa,0xaa,0x44,0x00, - 0x00,0x00,0x00,0x00,0x00,0x88,0x50,0x20,0x20,0x50,0x88,0x00, - 0x00,0x00,0x00,0x00,0x00,0x88,0x50,0x50,0x50,0x20,0x20,0x20, - 0x00,0x00,0x00,0x00,0x00,0xf0,0x10,0x20,0x40,0x80,0xf0,0x00, - 0x00,0x00,0x00,0xc0,0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x80, - 0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, - 0x00,0x00,0x00,0xc0,0x40,0x40,0x40,0x20,0x40,0x40,0x40,0x40, - 0x00,0x00,0x00,0x00,0x00,0x00,0xe8,0xb0,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0xe0,0xa0,0xa0,0xa0,0xa0,0xa0,0xe0,0x00}; - -const uint16_t ASCII8x8_Table [] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x40, - 0xa0, 0xa0, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x24, 0x24, 0xfe, 0x48, 0xfc, 0x48, 0x48, - 0x38, 0x54, 0x50, 0x38, 0x14, 0x14, 0x54, 0x38, - 0x44, 0xa8, 0xa8, 0x50, 0x14, 0x1a, 0x2a, 0x24, - 0x10, 0x28, 0x28, 0x10, 0x74, 0x4c, 0x4c, 0x30, - 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, - 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, - 0x00, 0x00, 0x24, 0x18, 0x3c, 0x18, 0x24, 0x00, - 0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, - 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, - 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, - 0x18, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x18, - 0x08, 0x18, 0x28, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x38, 0x44, 0x00, 0x04, 0x08, 0x10, 0x20, 0x7c, - 0x18, 0x24, 0x04, 0x18, 0x04, 0x04, 0x24, 0x18, - 0x04, 0x0c, 0x14, 0x24, 0x44, 0x7e, 0x04, 0x04, - 0x3c, 0x20, 0x20, 0x38, 0x04, 0x04, 0x24, 0x18, - 0x18, 0x24, 0x20, 0x38, 0x24, 0x24, 0x24, 0x18, - 0x3c, 0x04, 0x08, 0x08, 0x08, 0x10, 0x10, 0x10, - 0x18, 0x24, 0x24, 0x18, 0x24, 0x24, 0x24, 0x18, - 0x18, 0x24, 0x24, 0x24, 0x1c, 0x04, 0x24, 0x18, - 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x10, 0x00, - 0x00, 0x00, 0x04, 0x18, 0x20, 0x18, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x00, - 0x00, 0x00, 0x20, 0x18, 0x04, 0x18, 0x20, 0x00, - 0x18, 0x24, 0x04, 0x08, 0x10, 0x10, 0x00, 0x10, - 0x3c, 0x42, 0x99, 0xa5, 0xa5, 0x9d, 0x42, 0x38, - 0x38, 0x44, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, - 0x78, 0x44, 0x44, 0x78, 0x44, 0x44, 0x44, 0x78, - 0x1c, 0x22, 0x42, 0x40, 0x40, 0x42, 0x22, 0x1c, - 0x70, 0x48, 0x44, 0x44, 0x44, 0x44, 0x48, 0x70, - 0x7c, 0x40, 0x40, 0x7c, 0x40, 0x40, 0x40, 0x7c, - 0x3c, 0x20, 0x20, 0x38, 0x20, 0x20, 0x20, 0x20, - 0x1c, 0x22, 0x42, 0x40, 0x4e, 0x42, 0x22, 0x1c, - 0x44, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, 0x44, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x24, 0x24, 0x18, - 0x44, 0x48, 0x50, 0x70, 0x50, 0x48, 0x48, 0x44, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, - 0x82, 0xc6, 0xc6, 0xaa, 0xaa, 0xaa, 0xaa, 0x92, - 0x42, 0x62, 0x52, 0x52, 0x4a, 0x4a, 0x46, 0x42, - 0x18, 0x24, 0x42, 0x42, 0x42, 0x42, 0x24, 0x18, - 0x78, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, - 0x18, 0x24, 0x42, 0x42, 0x42, 0x42, 0x2c, 0x1a, - 0x78, 0x44, 0x44, 0x78, 0x50, 0x48, 0x44, 0x42, - 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x44, 0x38, - 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x18, - 0x44, 0x44, 0x28, 0x28, 0x28, 0x28, 0x28, 0x10, - 0x92, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x44, - 0x42, 0x24, 0x24, 0x18, 0x18, 0x24, 0x24, 0x42, - 0x44, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x7c, 0x04, 0x08, 0x10, 0x10, 0x20, 0x40, 0x7c, - 0x1c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1c, - 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, - 0x1c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x1c, - 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x20, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x04, 0x1c, 0x24, 0x24, 0x1c, - 0x20, 0x20, 0x28, 0x34, 0x24, 0x24, 0x34, 0x28, - 0x00, 0x00, 0x18, 0x24, 0x20, 0x20, 0x24, 0x18, - 0x04, 0x04, 0x14, 0x2c, 0x24, 0x24, 0x2c, 0x14, - 0x00, 0x00, 0x18, 0x24, 0x3c, 0x20, 0x24, 0x18, - 0x00, 0x18, 0x10, 0x10, 0x18, 0x10, 0x10, 0x10, - 0x00, 0x18, 0x24, 0x24, 0x18, 0x04, 0x24, 0x18, - 0x20, 0x20, 0x28, 0x34, 0x24, 0x24, 0x24, 0x24, - 0x10, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x08, 0x00, 0x08, 0x08, 0x08, 0x08, 0x28, 0x10, - 0x20, 0x20, 0x24, 0x28, 0x30, 0x28, 0x24, 0x24, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x00, 0x00, 0xa6, 0xda, 0x92, 0x92, 0x92, 0x92, - 0x00, 0x00, 0x28, 0x34, 0x24, 0x24, 0x24, 0x24, - 0x00, 0x00, 0x18, 0x24, 0x24, 0x24, 0x24, 0x18, - 0x00, 0x28, 0x34, 0x24, 0x38, 0x20, 0x20, 0x20, - 0x00, 0x14, 0x2c, 0x24, 0x1c, 0x04, 0x04, 0x04, - 0x00, 0x00, 0x2c, 0x30, 0x20, 0x20, 0x20, 0x20, - 0x00, 0x00, 0x18, 0x24, 0x10, 0x08, 0x24, 0x18, - 0x00, 0x10, 0x38, 0x10, 0x10, 0x10, 0x10, 0x18, - 0x00, 0x00, 0x24, 0x24, 0x24, 0x24, 0x2c, 0x14, - 0x00, 0x00, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, - 0x00, 0x00, 0x92, 0xaa, 0xaa, 0xaa, 0xaa, 0x44, - 0x00, 0x00, 0x44, 0x28, 0x10, 0x10, 0x28, 0x44, - 0x00, 0x28, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, - 0x00, 0x00, 0x3c, 0x04, 0x08, 0x10, 0x20, 0x3c, - 0x00, 0x08, 0x10, 0x10, 0x20, 0x10, 0x10, 0x08, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x00, 0x10, 0x08, 0x08, 0x04, 0x08, 0x08, 0x10, - 0x00, 0x00, 0x00, 0x60, 0x92, 0x0c, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - - -sFONT Font16x24 = { - ASCII16x24_Table, - 16, /* Width */ - 24, /* Height */ -}; - -sFONT Font12x12 = { - ASCII12x12_Table, - 12, /* Width */ - 12, /* Height */ -}; - -sFONT Font8x12 = { - ASCII8x12_Table, - 8, /* Width */ - 12, /* Height */ -}; - - -sFONT Font8x8 = { - ASCII8x8_Table, - 8, /* Width */ - 8, /* Height */ -}; - -/** - * @} - */ - - -/** @defgroup FONTS_Private_Function_Prototypes - * @{ - */ -/** - * @} - */ - - -/** @defgroup FONTS_Private_Functions - * @{ - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/fonts.h b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/fonts.h deleted file mode 100644 index 6d9f7d2ee..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/fonts.h +++ /dev/null @@ -1,124 +0,0 @@ -/** - ****************************************************************************** - * @file fonts.h - * @author MCD Application Team - * @version V5.0.2 - * @date 05-March-2012 - * @brief Header for fonts.c file - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __FONTS_H -#define __FONTS_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup Common - * @{ - */ - -/** @addtogroup FONTS - * @{ - */ - -/** @defgroup FONTS_Exported_Types - * @{ - */ -typedef struct _tFont -{ - const uint16_t *table; - uint16_t Width; - uint16_t Height; - -} sFONT; - -extern sFONT Font16x24; -extern sFONT Font12x12; -extern sFONT Font8x12; -extern sFONT Font8x8; - -/** - * @} - */ - -/** @defgroup FONTS_Exported_Constants - * @{ - */ -#define LINE(x) ((x) * (((sFONT *)LCD_GetFont())->Height)) - -/** - * @} - */ - -/** @defgroup FONTS_Exported_Macros - * @{ - */ -/** - * @} - */ - -/** @defgroup FONTS_Exported_Functions - * @{ - */ -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* __FONTS_H */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/lcd_log.c b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/lcd_log.c deleted file mode 100644 index f171e0545..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/lcd_log.c +++ /dev/null @@ -1,528 +0,0 @@ -/** - ****************************************************************************** - * @file lcd_log.c - * @author MCD Application Team - * @version V5.0.2 - * @date 05-March-2012 - * @brief This file provides all the LCD Log firmware functions. - * - * The LCD Log module allows to automatically set a header and footer - * on any application using the LCD display and allows to dump user, - * debug and error messages by using the following macros: LCD_ErrLog(), - * LCD_UsrLog() and LCD_DbgLog(). - * - * It supports also the scroll feature by embedding an internal software - * cache for display. This feature allows to dump message sequentially - * on the display even if the number of displayed lines is bigger than - * the total number of line allowed by the display. - * - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "lcd_log.h" - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL -* @{ -*/ - -/** @addtogroup Common - * @{ - */ - -/** @defgroup LCD_LOG -* @brief LCD Log LCD_Application module -* @{ -*/ - -/** @defgroup LCD_LOG_Private_Types -* @{ -*/ -/** -* @} -*/ - - -/** @defgroup LCD_LOG_Private_Defines -* @{ -*/ - -/** -* @} -*/ - - -/** @defgroup LCD_LOG_Private_Macros -* @{ -*/ -/** -* @} -*/ - - -/** @defgroup LCD_LOG_Private_Variables -* @{ -*/ - -LCD_LOG_line LCD_CacheBuffer [LCD_CACHE_DEPTH]; -uint16_t LCD_LineColor; -uint16_t LCD_CacheBuffer_xptr; -uint16_t LCD_CacheBuffer_yptr_top; -uint16_t LCD_CacheBuffer_yptr_bottom; - -uint16_t LCD_CacheBuffer_yptr_top_bak; -uint16_t LCD_CacheBuffer_yptr_bottom_bak; - -FunctionalState LCD_CacheBuffer_yptr_invert; -FunctionalState LCD_ScrollActive; -FunctionalState LCD_Lock; -FunctionalState LCD_Scrolled; -uint16_t LCD_ScrollBackStep; - -/** -* @} -*/ - - -/** @defgroup LCD_LOG_Private_FunctionPrototypes -* @{ -*/ -static void LCD_LOG_UpdateDisplay (void); -/** -* @} -*/ - - -/** @defgroup LCD_LOG_Private_Functions -* @{ -*/ - - -/** -* @brief Init the LCD Log module -* @param None -* @retval None -*/ - -void LCD_LOG_Init ( void) -{ - /* Deinit LCD cache */ - LCD_LOG_DeInit(); - /* Clear the LCD */ - LCD_Clear(Black); -} - -/** -* @brief DeInitializes the LCD Log module. -* @param None -* @retval None -*/ -void LCD_LOG_DeInit(void) -{ - LCD_LineColor = LCD_LOG_DEFAULT_COLOR; - LCD_CacheBuffer_xptr = 0; - LCD_CacheBuffer_yptr_top = 0; - LCD_CacheBuffer_yptr_bottom = 0; - - LCD_CacheBuffer_yptr_top_bak = 0; - LCD_CacheBuffer_yptr_bottom_bak = 0; - - LCD_CacheBuffer_yptr_invert= ENABLE; - LCD_ScrollActive = DISABLE; - LCD_Lock = DISABLE; - LCD_Scrolled = DISABLE; - LCD_ScrollBackStep = 0; -} - -/** -* @brief Display the application header (title) on the LCD screen -* @param Title : pointer to the string to be displayed -* @retval None -*/ -void LCD_LOG_SetHeader (uint8_t *Title) -{ - sFONT *cFont; - uint32_t size = 0 , idx; - uint8_t *ptr = Title; - uint8_t tmp[27]; - - /* center the header */ - while (*ptr++) size ++ ; - - /* truncate extra text */ - if(size > 26) - { - size = 26; - } - - for (idx = 0 ; idx < 27 ; idx ++) - { - tmp[idx] = ' '; - } - - for (idx = 0 ; idx < size ; idx ++) - { - tmp[idx + (27 - size)/2] = Title[idx]; - } - - /* Clear the LCD */ - LCD_Clear(Black); - - /* Set the LCD Font */ - LCD_SetFont (&Font12x12); - - cFont = LCD_GetFont(); - /* Set the LCD Text Color */ - LCD_SetTextColor(White); - LCD_SetBackColor(Blue); - LCD_ClearLine(0); - LCD_DisplayStringLine(cFont->Height, tmp); - LCD_ClearLine(2 * cFont->Height); - - LCD_SetBackColor(Black); - LCD_SetFont (&Font8x12); -} - -/** -* @brief Display the application footer (status) on the LCD screen -* @param Status : pointer to the string to be displayed -* @retval None -*/ -void LCD_LOG_SetFooter(uint8_t *Status) -{ - sFONT *cFont; - uint8_t tmp[40], i; - LCD_SetBackColor(Blue); - cFont = LCD_GetFont(); - - for (i= 0; i< (320/cFont->Width)-1 ; i++) - { - tmp[i] = ' '; - } - - tmp[(320/cFont->Width)-1] = 0; - LCD_DisplayStringLine(LCD_PIXEL_HEIGHT - cFont->Height, tmp); - LCD_DisplayStringLine(LCD_PIXEL_HEIGHT - cFont->Height, Status); - LCD_SetBackColor(Black); -} - -/** -* @brief Clear the Text Zone -* @param None -* @retval None -*/ -void LCD_LOG_ClearTextZone(void) -{ - uint8_t i=0; - sFONT *cFont = LCD_GetFont(); - - for (i= 0 ; i < YWINDOW_SIZE; i++) - { - LCD_ClearLine((i + YWINDOW_MIN) * cFont->Height); - } - - LCD_LOG_DeInit(); -} - -/** -* @brief Redirect the printf to the lcd -* @param c: character to be displayed -* @param f: output file pointer -* @retval None -*/ -PUTCHAR_PROTOTYPE -{ - - sFONT *cFont = LCD_GetFont(); - uint32_t idx; - - if(LCD_Lock == DISABLE) - { - if((LCD_ScrollActive == ENABLE)||(LCD_ScrollActive == ENABLE)) - { - LCD_CacheBuffer_yptr_bottom = LCD_CacheBuffer_yptr_bottom_bak; - LCD_CacheBuffer_yptr_top = LCD_CacheBuffer_yptr_top_bak; - LCD_ScrollActive = DISABLE; - LCD_Scrolled = DISABLE; - LCD_ScrollBackStep = 0; - - } - - if(( LCD_CacheBuffer_xptr < LCD_PIXEL_WIDTH /cFont->Width ) && ( ch != '\n')) - { - LCD_CacheBuffer[LCD_CacheBuffer_yptr_bottom].line[LCD_CacheBuffer_xptr++] = (uint16_t)ch; - } - else - { - if(LCD_CacheBuffer_yptr_top >= LCD_CacheBuffer_yptr_bottom) - { - - if(LCD_CacheBuffer_yptr_invert == DISABLE) - { - LCD_CacheBuffer_yptr_top++; - - if(LCD_CacheBuffer_yptr_top == LCD_CACHE_DEPTH) - { - LCD_CacheBuffer_yptr_top = 0; - } - } - else - { - LCD_CacheBuffer_yptr_invert= DISABLE; - } - } - - for(idx = LCD_CacheBuffer_xptr ; idx < LCD_PIXEL_WIDTH /cFont->Width; idx++) - { - LCD_CacheBuffer[LCD_CacheBuffer_yptr_bottom].line[LCD_CacheBuffer_xptr++] = ' '; - } - LCD_CacheBuffer[LCD_CacheBuffer_yptr_bottom].color = LCD_LineColor; - - LCD_CacheBuffer_xptr = 0; - - LCD_LOG_UpdateDisplay (); - - LCD_CacheBuffer_yptr_bottom ++; - - if (LCD_CacheBuffer_yptr_bottom == LCD_CACHE_DEPTH) - { - LCD_CacheBuffer_yptr_bottom = 0; - LCD_CacheBuffer_yptr_top = 1; - LCD_CacheBuffer_yptr_invert = ENABLE; - } - - if( ch != '\n') - { - LCD_CacheBuffer[LCD_CacheBuffer_yptr_bottom].line[LCD_CacheBuffer_xptr++] = (uint16_t)ch; - } - - } - } - return ch; -} - -/** -* @brief Update the text area display -* @param None -* @retval None -*/ -static void LCD_LOG_UpdateDisplay (void) -{ - uint8_t cnt = 0 ; - uint16_t length = 0 ; - uint16_t ptr = 0, index = 0; - - sFONT *cFont = LCD_GetFont(); - - if((LCD_CacheBuffer_yptr_bottom < (YWINDOW_SIZE -1)) && - (LCD_CacheBuffer_yptr_bottom >= LCD_CacheBuffer_yptr_top)) - { - LCD_SetTextColor(LCD_CacheBuffer[cnt + LCD_CacheBuffer_yptr_bottom].color); - LCD_DisplayStringLine ((YWINDOW_MIN + LCD_CacheBuffer_yptr_bottom) * cFont->Height, - (uint8_t *)(LCD_CacheBuffer[cnt + LCD_CacheBuffer_yptr_bottom].line)); - } - else - { - - if(LCD_CacheBuffer_yptr_bottom < LCD_CacheBuffer_yptr_top) - { - /* Virtual length for rolling */ - length = LCD_CACHE_DEPTH + LCD_CacheBuffer_yptr_bottom ; - } - else - { - length = LCD_CacheBuffer_yptr_bottom; - } - - ptr = length - YWINDOW_SIZE + 1; - - for (cnt = 0 ; cnt < YWINDOW_SIZE ; cnt ++) - { - - index = (cnt + ptr )% LCD_CACHE_DEPTH ; - - LCD_SetTextColor(LCD_CacheBuffer[index].color); - LCD_DisplayStringLine ((cnt + YWINDOW_MIN) * cFont->Height, - (uint8_t *)(LCD_CacheBuffer[index].line)); - - } - } - -} - -#ifdef LCD_SCROLL_ENABLED -/** -* @brief Display previous text frame -* @param None -* @retval Status -*/ -ErrorStatus LCD_LOG_ScrollBack (void) -{ - - if(LCD_ScrollActive == DISABLE) - { - - LCD_CacheBuffer_yptr_bottom_bak = LCD_CacheBuffer_yptr_bottom; - LCD_CacheBuffer_yptr_top_bak = LCD_CacheBuffer_yptr_top; - - - if(LCD_CacheBuffer_yptr_bottom > LCD_CacheBuffer_yptr_top) - { - - if ((LCD_CacheBuffer_yptr_bottom - LCD_CacheBuffer_yptr_top) <= YWINDOW_SIZE) - { - LCD_Lock = DISABLE; - return ERROR; - } - } - LCD_ScrollActive = ENABLE; - - if((LCD_CacheBuffer_yptr_bottom > LCD_CacheBuffer_yptr_top)&& - (LCD_Scrolled == DISABLE )) - { - LCD_CacheBuffer_yptr_bottom--; - LCD_Scrolled = ENABLE; - } - - } - - if(LCD_ScrollActive == ENABLE) - { - LCD_Lock = ENABLE; - - if(LCD_CacheBuffer_yptr_bottom > LCD_CacheBuffer_yptr_top) - { - - if((LCD_CacheBuffer_yptr_bottom - LCD_CacheBuffer_yptr_top) < YWINDOW_SIZE ) - { - LCD_Lock = DISABLE; - return ERROR; - } - - LCD_CacheBuffer_yptr_bottom --; - } - else if(LCD_CacheBuffer_yptr_bottom <= LCD_CacheBuffer_yptr_top) - { - - if((LCD_CACHE_DEPTH - LCD_CacheBuffer_yptr_top + LCD_CacheBuffer_yptr_bottom) < YWINDOW_SIZE) - { - LCD_Lock = DISABLE; - return ERROR; - } - LCD_CacheBuffer_yptr_bottom --; - - if(LCD_CacheBuffer_yptr_bottom == 0xFFFF) - { - LCD_CacheBuffer_yptr_bottom = LCD_CACHE_DEPTH - 2; - } - } - LCD_ScrollBackStep++; - LCD_LOG_UpdateDisplay(); - LCD_Lock = DISABLE; - } - return SUCCESS; -} - -/** -* @brief Display next text frame -* @param None -* @retval Status -*/ -ErrorStatus LCD_LOG_ScrollForward (void) -{ - - if(LCD_ScrollBackStep != 0) - { - if(LCD_ScrollActive == DISABLE) - { - - LCD_CacheBuffer_yptr_bottom_bak = LCD_CacheBuffer_yptr_bottom; - LCD_CacheBuffer_yptr_top_bak = LCD_CacheBuffer_yptr_top; - - if(LCD_CacheBuffer_yptr_bottom > LCD_CacheBuffer_yptr_top) - { - - if ((LCD_CacheBuffer_yptr_bottom - LCD_CacheBuffer_yptr_top) <= YWINDOW_SIZE) - { - LCD_Lock = DISABLE; - return ERROR; - } - } - LCD_ScrollActive = ENABLE; - - if((LCD_CacheBuffer_yptr_bottom > LCD_CacheBuffer_yptr_top)&& - (LCD_Scrolled == DISABLE )) - { - LCD_CacheBuffer_yptr_bottom--; - LCD_Scrolled = ENABLE; - } - - } - - if(LCD_ScrollActive == ENABLE) - { - LCD_Lock = ENABLE; - LCD_ScrollBackStep--; - - if(++LCD_CacheBuffer_yptr_bottom == LCD_CACHE_DEPTH) - { - LCD_CacheBuffer_yptr_bottom = 0; - } - - LCD_LOG_UpdateDisplay(); - LCD_Lock = DISABLE; - - } - return SUCCESS; - } - else // LCD_ScrollBackStep == 0 - { - LCD_Lock = DISABLE; - return ERROR; - } -} -#endif /* LCD_SCROLL_ENABLED */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/lcd_log.h b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/lcd_log.h deleted file mode 100644 index 4fe101b26..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/lcd_log.h +++ /dev/null @@ -1,160 +0,0 @@ -/** - ****************************************************************************** - * @file lcd_log.h - * @author MCD Application Team - * @version V5.0.2 - * @date 05-March-2012 - * @brief header for the lcd_log.c file - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __LCD_LOG_H__ -#define __LCD_LOG_H__ - -/* Includes ------------------------------------------------------------------*/ - -#include "lcd_log_conf.h" - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup Common - * @{ - */ - -/** @addtogroup LCD_LOG - * @{ - */ - -/** @defgroup LCD_LOG - * @brief - * @{ - */ - - -/** @defgroup LCD_LOG_Exported_Defines - * @{ - */ -#ifdef __GNUC__ -/* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf - set to 'Yes') calls __io_putchar() */ -#define PUTCHAR_PROTOTYPE int __io_putchar(int ch) -#else -#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f) -#endif /* __GNUC__ */ - -/** These value can be changed by user */ - -#ifdef LCD_SCROLL_ENABLED - #define LCD_CACHE_DEPTH (YWINDOW_SIZE + CACHE_SIZE) -#else - #define LCD_CACHE_DEPTH YWINDOW_SIZE -#endif -/** - * @} - */ - -/** @defgroup LCD_LOG_Exported_Types - * @{ - */ -typedef struct _LCD_LOG_line -{ - uint8_t line[XWINDOW_MAX]; - uint16_t color; - -}LCD_LOG_line; - -/** - * @} - */ - -/** @defgroup LCD_LOG_Exported_Macros - * @{ - */ -#define LCD_ErrLog(...) LCD_LineColor = Red;\ - printf("ERROR: ") ;\ - printf(__VA_ARGS__);\ - LCD_LineColor = LCD_LOG_DEFAULT_COLOR - -#define LCD_UsrLog(...) LCD_LineColor = LCD_LOG_DEFAULT_COLOR;\ - printf(__VA_ARGS__);\ - - -#define LCD_DbgLog(...) LCD_LineColor = Cyan;\ - printf(__VA_ARGS__);\ - LCD_LineColor = LCD_LOG_DEFAULT_COLOR -/** - * @} - */ - -/** @defgroup LCD_LOG_Exported_Variables - * @{ - */ -extern uint16_t LCD_LineColor; -/** - * @} - */ - -/** @defgroup LCD_LOG_Exported_FunctionsPrototype - * @{ - */ -void LCD_LOG_Init(void); -void LCD_LOG_DeInit(void); -void LCD_LOG_SetHeader(uint8_t *Title); -void LCD_LOG_SetFooter(uint8_t *Status); -void LCD_LOG_ClearTextZone(void); -#ifdef LCD_SCROLL_ENABLED - ErrorStatus LCD_LOG_ScrollBack(void); - ErrorStatus LCD_LOG_ScrollForward(void); -#endif -/** - * @} - */ - - -#endif /* __LCD_LOG_H__ */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/lcd_log_conf_template.h b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/lcd_log_conf_template.h deleted file mode 100644 index 6e8f7e333..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/lcd_log_conf_template.h +++ /dev/null @@ -1,113 +0,0 @@ -/** - ****************************************************************************** - * @file lcd_log_conf_template.h - * @author MCD Application Team - * @version V5.0.2 - * @date 05-March-2012 - * @brief lcd_log configuration template file. - * This file should be copied to the application folder and modified - * as follows: - * - Rename it to 'lcd_log_conf.h'. - * - Update the name of the LCD header file depending on the EVAL board - * you are using (see line32 below). - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __LCD_LOG_CONF_H__ -#define __LCD_LOG_CONF_H__ - -/* Includes ------------------------------------------------------------------*/ -#include "stm32xxx_eval_lcd.h" /* replace 'stm32xxx' with your EVAL board name, ex: stm3210c_eval_lcd.h */ -#include - -/** @addtogroup LCD_LOG - * @{ - */ - -/** @defgroup LCD_LOG - * @brief This file is the - * @{ - */ - - -/** @defgroup LCD_LOG_CONF_Exported_Defines - * @{ - */ -/* Comment the line below to disable the scroll back and forward features */ -#define LCD_SCROLL_ENABLED - -/* Define the LCD default text color */ -#define LCD_LOG_DEFAULT_COLOR LCD_COLOR_WHITE - -/* Define the display window settings */ -#define YWINDOW_MIN 3 -#define YWINDOW_SIZE 12 -#define XWINDOW_MAX 50 - -/* Define the cache depth */ -#define CACHE_SIZE 50 - -/** @defgroup LCD_LOG_CONF_Exported_TypesDefinitions - * @{ - */ - -/** - * @} - */ - - -/** @defgroup LCD_LOG_Exported_Macros - * @{ - */ - - -/** - * @} - */ - -/** @defgroup LCD_LOG_CONF_Exported_Variables - * @{ - */ - -/** - * @} - */ - -/** @defgroup LCD_LOG_CONF_Exported_FunctionsPrototype - * @{ - */ - -/** - * @} - */ - - -#endif /* __LCD_LOG_H__ */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/stm32_eval_legacy.h b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/stm32_eval_legacy.h deleted file mode 100644 index 0a50858c5..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/Common/stm32_eval_legacy.h +++ /dev/null @@ -1,208 +0,0 @@ -/** - ****************************************************************************** - * @file stm32_eval_legacy.h - * @author MCD Application Team - * @version V5.0.2 - * @date 05-March-2012 - * @brief This file contains defines legacy for STM32 EVAL drivers. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __STM32_EVAL_LEGACY_H -#define __STM32_EVAL_LEGACY_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ - -/* Exported types ------------------------------------------------------------*/ -/* Exported constants --------------------------------------------------------*/ -/* STM322xG_EVAL Defines Legacy */ -#ifdef USE_STM3220F_EVAL - #define USE_STM322xG_EVAL -#endif -#define STM3220F_LCD_Init STM322xG_LCD_Init - -/* Button Defines Legacy */ -#define Button_WAKEUP BUTTON_WAKEUP -#define Button_TAMPER BUTTON_TAMPER -#define Button_KEY BUTTON_KEY -#define Button_RIGHT BUTTON_RIGHT -#define Button_LEFT BUTTON_LEFT -#define Button_UP BUTTON_UP -#define Button_DOWN BUTTON_DOWN -#define Button_SEL BUTTON_SEL -#define Mode_GPIO BUTTON_MODE_GPIO -#define Mode_EXTI BUTTON_MODE_EXTI -#define Button_Mode_TypeDef ButtonMode_TypeDef -#define JOY_CENTER JOY_SEL -#define JOY_State_TypeDef JOYState_TypeDef - -/* LCD Defines Legacy */ -#define LCD_RSNWR_GPIO_CLK LCD_NWR_GPIO_CLK -#define LCD_SPI_GPIO_PORT LCD_SPI_SCK_GPIO_PORT -#define LCD_SPI_GPIO_CLK LCD_SPI_SCK_GPIO_CLK -#define R0 LCD_REG_0 -#define R1 LCD_REG_1 -#define R2 LCD_REG_2 -#define R3 LCD_REG_3 -#define R4 LCD_REG_4 -#define R5 LCD_REG_5 -#define R6 LCD_REG_6 -#define R7 LCD_REG_7 -#define R8 LCD_REG_8 -#define R9 LCD_REG_9 -#define R10 LCD_REG_10 -#define R12 LCD_REG_12 -#define R13 LCD_REG_13 -#define R14 LCD_REG_14 -#define R15 LCD_REG_15 -#define R16 LCD_REG_16 -#define R17 LCD_REG_17 -#define R18 LCD_REG_18 -#define R19 LCD_REG_19 -#define R20 LCD_REG_20 -#define R21 LCD_REG_21 -#define R22 LCD_REG_22 -#define R23 LCD_REG_23 -#define R24 LCD_REG_24 -#define R25 LCD_REG_25 -#define R26 LCD_REG_26 -#define R27 LCD_REG_27 -#define R28 LCD_REG_28 -#define R29 LCD_REG_29 -#define R30 LCD_REG_30 -#define R31 LCD_REG_31 -#define R32 LCD_REG_32 -#define R33 LCD_REG_33 -#define R34 LCD_REG_34 -#define R36 LCD_REG_36 -#define R37 LCD_REG_37 -#define R40 LCD_REG_40 -#define R41 LCD_REG_41 -#define R43 LCD_REG_43 -#define R45 LCD_REG_45 -#define R48 LCD_REG_48 -#define R49 LCD_REG_49 -#define R50 LCD_REG_50 -#define R51 LCD_REG_51 -#define R52 LCD_REG_52 -#define R53 LCD_REG_53 -#define R54 LCD_REG_54 -#define R55 LCD_REG_55 -#define R56 LCD_REG_56 -#define R57 LCD_REG_57 -#define R59 LCD_REG_59 -#define R60 LCD_REG_60 -#define R61 LCD_REG_61 -#define R62 LCD_REG_62 -#define R63 LCD_REG_63 -#define R64 LCD_REG_64 -#define R65 LCD_REG_65 -#define R66 LCD_REG_66 -#define R67 LCD_REG_67 -#define R68 LCD_REG_68 -#define R69 LCD_REG_69 -#define R70 LCD_REG_70 -#define R71 LCD_REG_71 -#define R72 LCD_REG_72 -#define R73 LCD_REG_73 -#define R74 LCD_REG_74 -#define R75 LCD_REG_75 -#define R76 LCD_REG_76 -#define R77 LCD_REG_77 -#define R78 LCD_REG_78 -#define R79 LCD_REG_79 -#define R80 LCD_REG_80 -#define R81 LCD_REG_81 -#define R82 LCD_REG_82 -#define R83 LCD_REG_83 -#define R96 LCD_REG_96 -#define R97 LCD_REG_97 -#define R106 LCD_REG_106 -#define R118 LCD_REG_118 -#define R128 LCD_REG_128 -#define R129 LCD_REG_129 -#define R130 LCD_REG_130 -#define R131 LCD_REG_131 -#define R132 LCD_REG_132 -#define R133 LCD_REG_133 -#define R134 LCD_REG_134 -#define R135 LCD_REG_135 -#define R136 LCD_REG_136 -#define R137 LCD_REG_137 -#define R139 LCD_REG_139 -#define R140 LCD_REG_140 -#define R141 LCD_REG_141 -#define R143 LCD_REG_143 -#define R144 LCD_REG_144 -#define R145 LCD_REG_145 -#define R146 LCD_REG_146 -#define R147 LCD_REG_147 -#define R148 LCD_REG_148 -#define R149 LCD_REG_149 -#define R150 LCD_REG_150 -#define R151 LCD_REG_151 -#define R152 LCD_REG_152 -#define R153 LCD_REG_153 -#define R154 LCD_REG_154 -#define R157 LCD_REG_157 -#define R192 LCD_REG_192 -#define R193 LCD_REG_193 -#define R227 LCD_REG_227 -#define R229 LCD_REG_229 -#define R231 LCD_REG_231 -#define R239 LCD_REG_239 -#define White LCD_COLOR_WHITE -#define Black LCD_COLOR_BLACK -#define Grey LCD_COLOR_GREY -#define Blue LCD_COLOR_BLUE -#define Blue2 LCD_COLOR_BLUE2 -#define Red LCD_COLOR_RED -#define Magenta LCD_COLOR_MAGENTA -#define Green LCD_COLOR_GREEN -#define Cyan LCD_COLOR_CYAN -#define Yellow LCD_COLOR_YELLOW -#define Line0 LCD_LINE_0 -#define Line1 LCD_LINE_1 -#define Line2 LCD_LINE_2 -#define Line3 LCD_LINE_3 -#define Line4 LCD_LINE_4 -#define Line5 LCD_LINE_5 -#define Line6 LCD_LINE_6 -#define Line7 LCD_LINE_7 -#define Line8 LCD_LINE_8 -#define Line9 LCD_LINE_9 -#define Horizontal LCD_DIR_HORIZONTAL -#define Vertical LCD_DIR_VERTICAL - -/* Exported macro ------------------------------------------------------------*/ -/* Exported functions --------------------------------------------------------*/ - -#ifdef __cplusplus -} -#endif - -#endif /* __STM32_EVAL_LEGACY_H */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/Release_Notes.html b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/Release_Notes.html deleted file mode 100644 index 606cb0238..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/Release_Notes.html +++ /dev/null @@ -1,273 +0,0 @@ - - - - - - - - - - - - - - - - Release Notes for STM322xG_EVAL Evaluation Board Drivers - - - - - - - - - - -
-


-

-
- - - - - - -
- - - - - - - - - -
-

Back to Release page

-
-

Release -Notes for STM322xG_EVAL Evaluation Board Drivers

-

Copyright -2012 STMicroelectronics

-

-
-

 

- - - - - - -
-

Contents

-
    -
  1. STM322xG_EVAL Evaluation Board Drivers -update History
  2. -
  3. License
  4. -
- - -

STM322xG_EVAL Evaluation Board Drivers update History

V5.0.3 / 05-March-2012

-

Main -Changes

- -
  • All source files: license disclaimer text update and add link to the License file on ST Internet.
  • stm322xg_eval_lcd.c
    • Enhance Gamma Curve settings for ILI9320 controller 
  • stm322xg_eval.c and stm322xg_eval_ioe.c
    • Swap -the order of I2C IOs and alternate function (AF) -configuration: AF configuration should be done before to configure the -IOs.
  • stm322xg_eval_sdio_sd.c
    • In SD_WaitWriteOperation() and SD_WaitReadOperation() functions: reset StopCondition flag after sending CMD12

V5.0.2 / 28-December-2011

Main -Changes

-
  • All source files: update disclaimer to add reference to the new license agreement
  • stm322xg_eval_lcd.c
    • Remove “static” from TextColor and BackColor variables declaration (need to be changed from other application modules) 
  • stm322xg_eval_ioe.h
    • Add -conditional compilation on the default DMA stream(s) used for I2C1 Tx -and Rx transfers, to allow user to change them from application level.

V5.0.1 / 14-November-2011

-

Main -Changes

- -
  • stm322xg_eval_sdio_sd.h
    • SD_CardInfo structure, define CardCapacity variable as 64-bit long (instead of 32-bit)  to support SDHC memory cards with capacity greater than 4 GB.

V5.0.0 / 07-October-2011

-

Main -Changes

- -
  • Update STM32 Evaluation Board Drivers architecture and folder organization, full API compatibility maintained vs. V4.6.2
    • All the HW drivers required for each board are provided within this board folder. The concerned drivers are:
      • stm32_eval_i2c_ee.c\.h: I2C M24Cxx EEPROM memory driver
      • stm32_eval_i2c_tsensor.c\.h: I2C LM75 temperature sensor driver
      • stm32_eval_spi_flash.c\.h: SPI M25Pxxx FLASH memory driver
      • stm32_eval_sdio_sd.c\.h: SDIO SD Card memory driver
      • stm32_eval_spi_sd.c\.h: SPI SD Card memory driver 
      • These drivers were moved from \Common to \STM32XXX_EVAL folder(s)
    • \Common folder contains only drivers for the fonts and log module used by the LCD driver
    • stm32_eval.c\.h files removed, as consequence you need to perform the following update on your project configuration  (based on EVAL drivers V4.6.2):
      • In the project files, add your EVAL board driver source file "stm322xg_eval.c" instead of "stm32_eval.c"
      • Include your EVAL board driver header file #include "stm322xg_eval.h" instead of #include "stm32_eval.h"
      • If -you are using the EVAL board's LCD, you need to add the include of -the LCD header file #include "stm322xg_eval_lcd.h"
        • If -you are using the LCD log module, after copying it to the application -folder you have to edit it and update the name of the LCD header file. For more details, refer to the lcd_log_conf_template.h driver description.
    • stm322xg_eval.h/.c
      • change value of “SDIO_TRANSFER_CLK_DIV” define from 2 to 0 to achieve SD max frequency at 24MHz.
      • Remove SD_DMAEndOfTransferStatus() function as now the DMA transfer is tracked using DMA End of transfer interrupt.
      • Add new define for the SDIO's DMA2 Stream (3 or 6): SD_SDIO_DMA_IRQn and SD_SDIO_DMA_IRQHANDLER.
    • stm322xg_eval_sdio_sd.h/.c
      • Add new function SD_ProcessDMAIRQ() to be called from the DMA end of transfer interrupt. 
      • Add some improvements by handling SDIO errors and adding timeout for different loops.
      • Refer to the driver header file's comments for more information on how to use the provided API.
    • stm322xg_eval_fsmc_sram.c
      • Add IOs config of missing FSMC address lines (FSMC_A21, FSMC_A22 and FSMC_A23).

V4.6.2 / 22-July-2011

-

Main -Changes

- -
  • STM3210C_EVAL
    • stm3210c_eval_lcd.c: update to support new LCD AM240320D5TOQW01H (controller ILI9325)
  • STM322xG-EVAL
    • stm322xg_eval.h: fix value of the SDIO clock divider (SDIO_TRANSFER_CLK_DIV constant) to 2 instead of 0
    • stm322xg_eval_lcd.c: increase FSMC AddressSetupTime value from 1 to 3 to be compliant with some LCD access timing
    • stm322xg_eval_audio_codec.c: update Codec_CtrlInterface_Init() and Codec_GPIO_Init() functions to not reconfigure the I2C peripheral if it's already enabled and configured (to -avoid configuring the I2C twice when using both Audio codec and IO -Expander drivers in the same application).

V4.6.1 / 18-April-2011

-

Main -Changes

- -
  • Update some STM322xG_EVAL drivers (no change on the API) to fix warnings with TASKING C compiler.
  • Change the Release Notes name to STM32 Evaluation Board Drivers
  • stm322xg_eval.c
    • SD_LowLevel_Init(): change SDIO pins speed configuration to "GPIO_Speed_25MHz"

V4.6.0 / 11-March-2011

-

Main -Changes

- -
  • Official version supporting STM322xG_EVAL evaluation board RevB (for STM32F2xx devices).
  • Common
    • Add -new LCD log utility drivers: The LCD Log module allows to automatically -set a header and footer on any application using the LCD display and -allows to dump user, debug and error messages by using the following -macros: LCD_ErrLog(),    LCD_UsrLog() and LCD_DbgLog().
Note: the STM322xG_EVAL board RevA was wrongly named STM3220F_EVAL

V4.5.0 / 07-March-2011

-

Main -Changes

- -
  • stm32_eval_sdio_sd.c\.h: driver improvement
    • SD Clock increased to 24MHz to improve the data transfer performance.
    • Add -new functions to check the SDIO peripheral and SD Card status at any -time: SD_WaitReadOperation(), SD_WaitWriteOperation(). The -software sequence is little bit changed but without any impact on -driver API. For more details, refer to the stm32_eval_sdio_sd.c -driver description.
    • Add -new structure containing the SD Status register parameters. This -structure is called by the -         - SD_SendSDStatus() function.
    • Transfers mode updated
      • Read/Write Block using Polling and DMA modes
      • Read/Write Multi Blocks using DMA mode only
      • Interrupt mode removed
    • Data transfer functions are managing only fixed Block size (512-byte) 
  • STM32100B-EVAL
    • stm32100b_eval_cec.c: fix some strict ANSI-C errors
  • STM32100E-EVAL
    • stm32100e_eval_cec.c: fix some strict ANSI-C errors
-

V4.4.0 / 31-December-2010

-

Main -Changes

- -
  • Add new directory for STM32L152-EVAL board containing the following files:
    • stm32l152_eval.h/.c, stm32l152_eval_lcd.h/.c, stm32l152_eval_glass_lcd.h/.c, stm32l152_eval_i2c_ee.h/.c
  • Add support for the STM32100E-EVAL Rev B: SPI FLASH CS pin "sFLASH_CS_PIN" changed from PB.02 to PE.06.
  • stm32100e_eval_lcd.h/.c: Add support for "LCD_ILI9325" LCD controller.
  • stm32100e_eval_fsmc_onenand.h/.c driver updated to correct asynchronous and synchronous read operations procedures.
    -
- -

4.3.0 -- 10/15/2010

-
  1. General
- -
  • I2C EEPROM, Temperature Sensor and IOE Expander drivers updated to use the DMA for read/write transfer and add more robustness
  • SD Card (SDIO) driver updated to add more robustness
  • SPI Flash and SD Card (SPI) drivers: SPI MISO pin configuration changed to Input Floating 
- - - -
  1. Utilities
- - - - - -
  • Add new directory for STM32100E-EVAL board containing the following files:
    • stm32100e_eval.h/.c, -stm32100e_eval_lcd.h/.c, stm32100e_eval_cec.h/.c, -stm32100e_eval_fsmc_onenand.h/.c, stm32100e_eval_fsmc_sram.h/.c, -stm32100e_eval_ioe.h/.c
      -
  • Common
    • stm32_eval_sdio_sd.c: -Update the DMA End of Transfer Check loop inside the SD_ReadBlock(), -SD_WriteBlock(), SD_ReadMultiBlocks() and SD_Write MultiBlocks().
    • stm32_eval_i2c_ee.c/.h
      -
      • Enhanced sEE_WaitEepromStandbyState() function for more robustness.
      • Enhanced Read and Write operations to manage I2C limitations.
      • Add Timeout management with user callback implementation which allows recovering from I2C bus errors.
      • Add -critical sections user callbacks allowing to disable then enable -interrupts when I2C operation require to be not interrupted.
    • stm32_eval_i2c_tsensor.c/.h
      -
      • Enhanced I2C communication functions by using DMA for registers Read and Write operations.
      • Add Timeout management with user callback implementation which allows recovering from I2C bus errors.
  • STM32100B_EVAL
    • stm32100b_eval.h: Add LM75 DMA defines.
    • stm32100b_eval_lcd.c: Change "SPI_FLASH" by "sFLASH" in LCD_DrawBMP() function.
  • STM3210B_EVAL
    • stm3210b_eval.h: Add LM75 DMA defines.
    • stm3210b_eval_lcd.c: Change "SPI_FLASH" by "sFLASH" in LCD_DrawBMP() function.
  • STM3210C_EVAL
    • stm3210c_eval.h: Add EEPROM driver Timeout define.
    • stm3210c_eval_lcd.c: Change "SPI_FLASH" by "sFLASH" in LCD_DrawBMP() function.
    • stm3210c_eval_i2c_ioe.c
      • Enhanced I2C communication functions by using DMA for registers Read and Write operations.
      • Add Timeout management with user callback implementation which allows recovering from I2C bus errors.
      • change IOE_I2C_SPEED from "400000" to "300000".
  • STM3210E_EVAL
    • stm3210e_eval.c: change "void SD_WaitForDMAEndOfTransfer(void)" to "uint32_t SD_DMAEndOfTransferStatus(void)".
    • stm3210e_eval.h: Add LM75 DMA defines.
    • stm3210e_eval_fsmc_nand.h: remove "NAND_CMD_AREA_TRUE1" define.
    • stm3210e_eval_fsmc_nand.c: Update FSMC timing in NAND_Init() function to be aligned with AN2784 application note.
    • stm3210e_eval_fsmc_nor.c
      • NOR_Init() function: add FSMC_AsynchronousWait field to FSMC_NORSRAMInitStructure 
    • stm3210e_eval_fsmc_sram.c
      -
      • Update FSMC timing in SRAM_Init() function to be aligned with AN2784 application note.
        -
      • SRAM_Init() function: add FSMC_AsynchronousWait field to FSMC_NORSRAMInitStructure 
    • stm3210e_eval_lcd.c
      • LCD_FSMCConfig() function: add FSMC_AsynchronousWait field to FSMC_NORSRAMInitStructure 
- - -

4.2.0 -- 04/16/2010

-
  1. General
- -
  • I2C EEPROM driver -update to use the DMA to -perform data transfer to/from EEPROM memory.
- -
  1. Utilities
-
  • STM32_EVAL
-
    • stm32_eval_i2c_ee.c: -updated to use the DMA to perform data transfer to/from -EEPROM memory. For more details, refer to the description provided -within this file.
    • stm3210c_eval.c: add low level -functions to configure the DMA (needed for I2C EEPROM driver)
      -
    • stm3210c_eval_ioe.c: add a delay -in IOE_TS_GetState() function to wait till the end of ADC -conversion
    • stm3210e_eval_fsmc_nor.c: add PD6 pin configuration in -NOR_Init() function
    • stm3210b_eval_lcd.c: remove the -second ";" from "static void PutPixel(int16_t x, int16_t y);;" 
-

4.1.0 -- 03/01/2010

-
  1. General
-
  • Add support -for STM32 Low-density Value line (STM32F100x4/6) and -Medium-density Value line (STM32F100x8/B) devices.
  • Add support for the -STMicroelectronics STM32100B-EVAL evaluation board.
-
  1. Utilities
-
  • STM32_EVAL
-
  • Add new directory -"Common" containing a common drivers for all STM32 evaluation boards: -fonts.h/.c, stm32_eval_i2c_ee.h/.c, stm32_eval_spi_flash.h/.c, - stm32_eval_i2c_tsensor.h/.c, - stm32_eval_spi_sd.h/.c -and stm32_eval_sdio_sd.h/.c
  • Add new driver for the -STM32100B-EVAL managing Leds, push button and COM ports.
  • New HDMI CEC High level -driver.
    -
  • For all LCD drivers new fonts has -been added.
  • New FSMC memories -drivers for STM3210E-EVAL board: stm3210e_eval_fsmc_sram.h/.c, stm3210e_eval_fsmc_nor.h/.c -and stm3210e_eval_fsmc_nand.h/.c.

License

-

Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this package except in compliance with the License. You may obtain a copy of the License at:


Unless -required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See -the License for the specific language governing permissions and -limitations under the License.
- -
-
-

For -complete documentation on STM32 Microcontrollers -visit www.st.com/STM32

-
-

-
-
-

 

-
- - \ No newline at end of file diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval.c b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval.c deleted file mode 100644 index 9b76f0a5b..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval.c +++ /dev/null @@ -1,737 +0,0 @@ -/** - ****************************************************************************** - * @file stm322xg_eval.c - * @author MCD Application Team - * @version V5.0.3 - * @date 09-March-2012 - * @brief This file provides - * - set of firmware functions to manage Leds, push-button and COM ports - * - low level initialization functions for SD card (on SDIO) and - * serial EEPROM (sEE) - * available on STM322xG-EVAL evaluation board(MB786) RevA and RevB - * from STMicroelectronics. - * - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "stm322xg_eval.h" -#include "stm32f2xx_sdio.h" -#include "stm32f2xx_dma.h" -#include "stm32f2xx_i2c.h" - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL - * @{ - */ - -/** @defgroup STM322xG_EVAL_LOW_LEVEL - * @brief This file provides firmware functions to manage Leds, push-buttons, - * COM ports, SD card on SDIO and serial EEPROM (sEE) available on - * STM322xG-EVAL evaluation board from STMicroelectronics. - * @{ - */ - -/** @defgroup STM322xG_EVAL_LOW_LEVEL_Private_TypesDefinitions - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_LOW_LEVEL_Private_Defines - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_LOW_LEVEL_Private_Macros - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_LOW_LEVEL_Private_Variables - * @{ - */ -GPIO_TypeDef* GPIO_PORT[LEDn] = {LED1_GPIO_PORT, LED2_GPIO_PORT, LED3_GPIO_PORT, - LED4_GPIO_PORT}; -const uint16_t GPIO_PIN[LEDn] = {LED1_PIN, LED2_PIN, LED3_PIN, - LED4_PIN}; -const uint32_t GPIO_CLK[LEDn] = {LED1_GPIO_CLK, LED2_GPIO_CLK, LED3_GPIO_CLK, - LED4_GPIO_CLK}; - -GPIO_TypeDef* BUTTON_PORT[BUTTONn] = {WAKEUP_BUTTON_GPIO_PORT, TAMPER_BUTTON_GPIO_PORT, - KEY_BUTTON_GPIO_PORT}; - -const uint16_t BUTTON_PIN[BUTTONn] = {WAKEUP_BUTTON_PIN, TAMPER_BUTTON_PIN, - KEY_BUTTON_PIN}; - -const uint32_t BUTTON_CLK[BUTTONn] = {WAKEUP_BUTTON_GPIO_CLK, TAMPER_BUTTON_GPIO_CLK, - KEY_BUTTON_GPIO_CLK}; - -const uint16_t BUTTON_EXTI_LINE[BUTTONn] = {WAKEUP_BUTTON_EXTI_LINE, - TAMPER_BUTTON_EXTI_LINE, - KEY_BUTTON_EXTI_LINE}; - -const uint8_t BUTTON_PORT_SOURCE[BUTTONn] = {WAKEUP_BUTTON_EXTI_PORT_SOURCE, - TAMPER_BUTTON_EXTI_PORT_SOURCE, - KEY_BUTTON_EXTI_PORT_SOURCE}; - -const uint8_t BUTTON_PIN_SOURCE[BUTTONn] = {WAKEUP_BUTTON_EXTI_PIN_SOURCE, - TAMPER_BUTTON_EXTI_PIN_SOURCE, - KEY_BUTTON_EXTI_PIN_SOURCE}; -const uint8_t BUTTON_IRQn[BUTTONn] = {WAKEUP_BUTTON_EXTI_IRQn, TAMPER_BUTTON_EXTI_IRQn, - KEY_BUTTON_EXTI_IRQn}; - -USART_TypeDef* COM_USART[COMn] = {EVAL_COM1}; - -GPIO_TypeDef* COM_TX_PORT[COMn] = {EVAL_COM1_TX_GPIO_PORT}; - -GPIO_TypeDef* COM_RX_PORT[COMn] = {EVAL_COM1_RX_GPIO_PORT}; - -const uint32_t COM_USART_CLK[COMn] = {EVAL_COM1_CLK}; - -const uint32_t COM_TX_PORT_CLK[COMn] = {EVAL_COM1_TX_GPIO_CLK}; - -const uint32_t COM_RX_PORT_CLK[COMn] = {EVAL_COM1_RX_GPIO_CLK}; - -const uint16_t COM_TX_PIN[COMn] = {EVAL_COM1_TX_PIN}; - -const uint16_t COM_RX_PIN[COMn] = {EVAL_COM1_RX_PIN}; - -const uint8_t COM_TX_PIN_SOURCE[COMn] = {EVAL_COM1_TX_SOURCE}; - -const uint8_t COM_RX_PIN_SOURCE[COMn] = {EVAL_COM1_RX_SOURCE}; - -const uint8_t COM_TX_AF[COMn] = {EVAL_COM1_TX_AF}; - -const uint8_t COM_RX_AF[COMn] = {EVAL_COM1_RX_AF}; - -DMA_InitTypeDef sEEDMA_InitStructure; -NVIC_InitTypeDef NVIC_InitStructure; - -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_LOW_LEVEL_Private_FunctionPrototypes - * @{ - */ - -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_LOW_LEVEL_Private_Functions - * @{ - */ - -/** - * @brief Configures LED GPIO. - * @param Led: Specifies the Led to be configured. - * This parameter can be one of following parameters: - * @arg LED1 - * @arg LED2 - * @arg LED3 - * @arg LED4 - * @retval None - */ -void STM_EVAL_LEDInit(Led_TypeDef Led) -{ - GPIO_InitTypeDef GPIO_InitStructure; - - /* Enable the GPIO_LED Clock */ - RCC_AHB1PeriphClockCmd(GPIO_CLK[Led], ENABLE); - - - /* Configure the GPIO_LED pin */ - GPIO_InitStructure.GPIO_Pin = GPIO_PIN[Led]; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; - GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_Init(GPIO_PORT[Led], &GPIO_InitStructure); -} - -/** - * @brief Turns selected LED On. - * @param Led: Specifies the Led to be set on. - * This parameter can be one of following parameters: - * @arg LED1 - * @arg LED2 - * @arg LED3 - * @arg LED4 - * @retval None - */ -void STM_EVAL_LEDOn(Led_TypeDef Led) -{ - GPIO_PORT[Led]->BSRRL = GPIO_PIN[Led]; -} - -/** - * @brief Turns selected LED Off. - * @param Led: Specifies the Led to be set off. - * This parameter can be one of following parameters: - * @arg LED1 - * @arg LED2 - * @arg LED3 - * @arg LED4 - * @retval None - */ -void STM_EVAL_LEDOff(Led_TypeDef Led) -{ - GPIO_PORT[Led]->BSRRH = GPIO_PIN[Led]; -} - -/** - * @brief Toggles the selected LED. - * @param Led: Specifies the Led to be toggled. - * This parameter can be one of following parameters: - * @arg LED1 - * @arg LED2 - * @arg LED3 - * @arg LED4 - * @retval None - */ -void STM_EVAL_LEDToggle(Led_TypeDef Led) -{ - GPIO_PORT[Led]->ODR ^= GPIO_PIN[Led]; -} - -/** - * @brief Configures Button GPIO and EXTI Line. - * @param Button: Specifies the Button to be configured. - * This parameter can be one of following parameters: - * @arg BUTTON_WAKEUP: Wakeup Push Button - * @arg BUTTON_TAMPER: Tamper Push Button - * @arg BUTTON_KEY: Key Push Button - * @arg BUTTON_RIGHT: Joystick Right Push Button - * @arg BUTTON_LEFT: Joystick Left Push Button - * @arg BUTTON_UP: Joystick Up Push Button - * @arg BUTTON_DOWN: Joystick Down Push Button - * @arg BUTTON_SEL: Joystick Sel Push Button - * @param Button_Mode: Specifies Button mode. - * This parameter can be one of following parameters: - * @arg BUTTON_MODE_GPIO: Button will be used as simple IO - * @arg BUTTON_MODE_EXTI: Button will be connected to EXTI line with interrupt - * generation capability - * @retval None - */ -void STM_EVAL_PBInit(Button_TypeDef Button, ButtonMode_TypeDef Button_Mode) -{ - GPIO_InitTypeDef GPIO_InitStructure; - EXTI_InitTypeDef EXTI_InitStructure; - NVIC_InitTypeDef NVIC_InitStructure; - - - /* Enable the BUTTON Clock */ - RCC_AHB1PeriphClockCmd(BUTTON_CLK[Button], ENABLE); - RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); - - /* Configure Button pin as input */ - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - GPIO_InitStructure.GPIO_Pin = BUTTON_PIN[Button]; - GPIO_Init(BUTTON_PORT[Button], &GPIO_InitStructure); - - - if (Button_Mode == BUTTON_MODE_EXTI) - { - /* Connect Button EXTI Line to Button GPIO Pin */ - SYSCFG_EXTILineConfig(BUTTON_PORT_SOURCE[Button], BUTTON_PIN_SOURCE[Button]); - - /* Configure Button EXTI line */ - EXTI_InitStructure.EXTI_Line = BUTTON_EXTI_LINE[Button]; - EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; - - if(Button != BUTTON_WAKEUP) - { - EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; - } - else - { - EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; - } - EXTI_InitStructure.EXTI_LineCmd = ENABLE; - EXTI_Init(&EXTI_InitStructure); - - /* Enable and set Button EXTI Interrupt to the lowest priority */ - NVIC_InitStructure.NVIC_IRQChannel = BUTTON_IRQn[Button]; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F; - NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - - NVIC_Init(&NVIC_InitStructure); - } -} - -/** - * @brief Returns the selected Button state. - * @param Button: Specifies the Button to be checked. - * This parameter can be one of following parameters: - * @arg BUTTON_WAKEUP: Wakeup Push Button - * @arg BUTTON_TAMPER: Tamper Push Button - * @arg BUTTON_KEY: Key Push Button - * @arg BUTTON_RIGHT: Joystick Right Push Button - * @arg BUTTON_LEFT: Joystick Left Push Button - * @arg BUTTON_UP: Joystick Up Push Button - * @arg BUTTON_DOWN: Joystick Down Push Button - * @arg BUTTON_SEL: Joystick Sel Push Button - * @retval The Button GPIO pin value. - */ -uint32_t STM_EVAL_PBGetState(Button_TypeDef Button) -{ - return GPIO_ReadInputDataBit(BUTTON_PORT[Button], BUTTON_PIN[Button]); -} - - -/** - * @brief Configures COM port. - * @param COM: Specifies the COM port to be configured. - * This parameter can be one of following parameters: - * @arg COM1 - * @arg COM2 - * @param USART_InitStruct: pointer to a USART_InitTypeDef structure that - * contains the configuration information for the specified USART peripheral. - * @retval None - */ -void STM_EVAL_COMInit(COM_TypeDef COM, USART_InitTypeDef* USART_InitStruct) -{ - GPIO_InitTypeDef GPIO_InitStructure; - - /* Enable GPIO clock */ - RCC_AHB1PeriphClockCmd(COM_TX_PORT_CLK[COM] | COM_RX_PORT_CLK[COM], ENABLE); - - if (COM == COM1) - { - /* Enable UART clock */ - RCC_APB1PeriphClockCmd(COM_USART_CLK[COM], ENABLE); - } - - /* Connect PXx to USARTx_Tx*/ - GPIO_PinAFConfig(COM_TX_PORT[COM], COM_TX_PIN_SOURCE[COM], COM_TX_AF[COM]); - - /* Connect PXx to USARTx_Rx*/ - GPIO_PinAFConfig(COM_RX_PORT[COM], COM_RX_PIN_SOURCE[COM], COM_RX_AF[COM]); - - /* Configure USART Tx as alternate function */ - GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; - - GPIO_InitStructure.GPIO_Pin = COM_TX_PIN[COM]; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_Init(COM_TX_PORT[COM], &GPIO_InitStructure); - - /* Configure USART Rx as alternate function */ - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; - GPIO_InitStructure.GPIO_Pin = COM_RX_PIN[COM]; - GPIO_Init(COM_RX_PORT[COM], &GPIO_InitStructure); - - /* USART configuration */ - USART_Init(COM_USART[COM], USART_InitStruct); - - /* Enable USART */ - USART_Cmd(COM_USART[COM], ENABLE); -} - -/** - * @brief DeInitializes the SDIO interface. - * @param None - * @retval None - */ -void SD_LowLevel_DeInit(void) -{ - GPIO_InitTypeDef GPIO_InitStructure; - - /*!< Disable SDIO Clock */ - SDIO_ClockCmd(DISABLE); - - /*!< Set Power State to OFF */ - SDIO_SetPowerState(SDIO_PowerState_OFF); - - /*!< DeInitializes the SDIO peripheral */ - SDIO_DeInit(); - - /* Disable the SDIO APB2 Clock */ - RCC_APB2PeriphClockCmd(RCC_APB2Periph_SDIO, DISABLE); - - GPIO_PinAFConfig(GPIOC, GPIO_PinSource8, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOC, GPIO_PinSource9, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOC, GPIO_PinSource10, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOC, GPIO_PinSource11, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOC, GPIO_PinSource12, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource2, GPIO_AF_MCO); - - /* Configure PC.08, PC.09, PC.10, PC.11 pins: D0, D1, D2, D3 pins */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - GPIO_Init(GPIOC, &GPIO_InitStructure); - - /* Configure PD.02 CMD line */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; - GPIO_Init(GPIOD, &GPIO_InitStructure); - - /* Configure PC.12 pin: CLK pin */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12; - GPIO_Init(GPIOC, &GPIO_InitStructure); -} - -/** - * @brief Initializes the SD Card and put it into StandBy State (Ready for - * data transfer). - * @param None - * @retval None - */ -void SD_LowLevel_Init(void) -{ - GPIO_InitTypeDef GPIO_InitStructure; - - /* GPIOC and GPIOD Periph clock enable */ - RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOD | SD_DETECT_GPIO_CLK, ENABLE); - - GPIO_PinAFConfig(GPIOC, GPIO_PinSource8, GPIO_AF_SDIO); - GPIO_PinAFConfig(GPIOC, GPIO_PinSource9, GPIO_AF_SDIO); - GPIO_PinAFConfig(GPIOC, GPIO_PinSource10, GPIO_AF_SDIO); - GPIO_PinAFConfig(GPIOC, GPIO_PinSource11, GPIO_AF_SDIO); - GPIO_PinAFConfig(GPIOC, GPIO_PinSource12, GPIO_AF_SDIO); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource2, GPIO_AF_SDIO); - - /* Configure PC.08, PC.09, PC.10, PC.11 pins: D0, D1, D2, D3 pins */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_25MHz; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; - GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; - GPIO_Init(GPIOC, &GPIO_InitStructure); - - /* Configure PD.02 CMD line */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; - GPIO_Init(GPIOD, &GPIO_InitStructure); - - /* Configure PC.12 pin: CLK pin */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - GPIO_Init(GPIOC, &GPIO_InitStructure); - - /*!< Configure SD_SPI_DETECT_PIN pin: SD Card detect pin */ - GPIO_InitStructure.GPIO_Pin = SD_DETECT_PIN; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; - GPIO_Init(SD_DETECT_GPIO_PORT, &GPIO_InitStructure); - - /* Enable the SDIO APB2 Clock */ - RCC_APB2PeriphClockCmd(RCC_APB2Periph_SDIO, ENABLE); - - /* Enable the DMA2 Clock */ - RCC_AHB1PeriphClockCmd(SD_SDIO_DMA_CLK, ENABLE); -} - -/** - * @brief Configures the DMA2 Channel4 for SDIO Tx request. - * @param BufferSRC: pointer to the source buffer - * @param BufferSize: buffer size - * @retval None - */ -void SD_LowLevel_DMA_TxConfig(uint32_t *BufferSRC, uint32_t BufferSize) -{ - DMA_InitTypeDef SDDMA_InitStructure; - - DMA_ClearFlag(SD_SDIO_DMA_STREAM, SD_SDIO_DMA_FLAG_FEIF | SD_SDIO_DMA_FLAG_DMEIF | SD_SDIO_DMA_FLAG_TEIF | SD_SDIO_DMA_FLAG_HTIF | SD_SDIO_DMA_FLAG_TCIF); - - /* DMA2 Stream3 or Stream6 disable */ - DMA_Cmd(SD_SDIO_DMA_STREAM, DISABLE); - - /* DMA2 Stream3 or Stream6 Config */ - DMA_DeInit(SD_SDIO_DMA_STREAM); - - SDDMA_InitStructure.DMA_Channel = SD_SDIO_DMA_CHANNEL; - SDDMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)SDIO_FIFO_ADDRESS; - SDDMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)BufferSRC; - SDDMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral; - SDDMA_InitStructure.DMA_BufferSize = 0; - SDDMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; - SDDMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; - SDDMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word; - SDDMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Word; - SDDMA_InitStructure.DMA_Mode = DMA_Mode_Normal; - SDDMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh; - SDDMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Enable; - SDDMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full; - SDDMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_INC4; - SDDMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_INC4; - DMA_Init(SD_SDIO_DMA_STREAM, &SDDMA_InitStructure); - DMA_ITConfig(SD_SDIO_DMA_STREAM, DMA_IT_TC, ENABLE); - DMA_FlowControllerConfig(SD_SDIO_DMA_STREAM, DMA_FlowCtrl_Peripheral); - - /* DMA2 Stream3 or Stream6 enable */ - DMA_Cmd(SD_SDIO_DMA_STREAM, ENABLE); - -} - -/** - * @brief Configures the DMA2 Channel4 for SDIO Rx request. - * @param BufferDST: pointer to the destination buffer - * @param BufferSize: buffer size - * @retval None - */ -void SD_LowLevel_DMA_RxConfig(uint32_t *BufferDST, uint32_t BufferSize) -{ - DMA_InitTypeDef SDDMA_InitStructure; - - DMA_ClearFlag(SD_SDIO_DMA_STREAM, SD_SDIO_DMA_FLAG_FEIF | SD_SDIO_DMA_FLAG_DMEIF | SD_SDIO_DMA_FLAG_TEIF | SD_SDIO_DMA_FLAG_HTIF | SD_SDIO_DMA_FLAG_TCIF); - - /* DMA2 Stream3 or Stream6 disable */ - DMA_Cmd(SD_SDIO_DMA_STREAM, DISABLE); - - /* DMA2 Stream3 or Stream6 Config */ - DMA_DeInit(SD_SDIO_DMA_STREAM); - - SDDMA_InitStructure.DMA_Channel = SD_SDIO_DMA_CHANNEL; - SDDMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)SDIO_FIFO_ADDRESS; - SDDMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)BufferDST; - SDDMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory; - SDDMA_InitStructure.DMA_BufferSize = 0; - SDDMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; - SDDMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; - SDDMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word; - SDDMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Word; - SDDMA_InitStructure.DMA_Mode = DMA_Mode_Normal; - SDDMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh; - SDDMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Enable; - SDDMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full; - SDDMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_INC4; - SDDMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_INC4; - DMA_Init(SD_SDIO_DMA_STREAM, &SDDMA_InitStructure); - DMA_ITConfig(SD_SDIO_DMA_STREAM, DMA_IT_TC, ENABLE); - DMA_FlowControllerConfig(SD_SDIO_DMA_STREAM, DMA_FlowCtrl_Peripheral); - - /* DMA2 Stream3 or Stream6 enable */ - DMA_Cmd(SD_SDIO_DMA_STREAM, ENABLE); -} - -/** - * @brief DeInitializes peripherals used by the I2C EEPROM driver. - * @param None - * @retval None - */ -void sEE_LowLevel_DeInit(void) -{ - GPIO_InitTypeDef GPIO_InitStructure; - - /* sEE_I2C Peripheral Disable */ - I2C_Cmd(sEE_I2C, DISABLE); - - /* sEE_I2C DeInit */ - I2C_DeInit(sEE_I2C); - - /*!< sEE_I2C Periph clock disable */ - RCC_APB1PeriphClockCmd(sEE_I2C_CLK, DISABLE); - - /*!< GPIO configuration */ - /*!< Configure sEE_I2C pins: SCL */ - GPIO_InitStructure.GPIO_Pin = sEE_I2C_SCL_PIN; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - GPIO_Init(sEE_I2C_SCL_GPIO_PORT, &GPIO_InitStructure); - - /*!< Configure sEE_I2C pins: SDA */ - GPIO_InitStructure.GPIO_Pin = sEE_I2C_SDA_PIN; - GPIO_Init(sEE_I2C_SDA_GPIO_PORT, &GPIO_InitStructure); - - /* Configure and enable I2C DMA TX Stream interrupt */ - NVIC_InitStructure.NVIC_IRQChannel = sEE_I2C_DMA_TX_IRQn; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = sEE_I2C_DMA_PREPRIO; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = sEE_I2C_DMA_SUBPRIO; - NVIC_InitStructure.NVIC_IRQChannelCmd = DISABLE; - NVIC_Init(&NVIC_InitStructure); - - /* Configure and enable I2C DMA RX Stream interrupt */ - NVIC_InitStructure.NVIC_IRQChannel = sEE_I2C_DMA_RX_IRQn; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = sEE_I2C_DMA_PREPRIO; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = sEE_I2C_DMA_SUBPRIO; - NVIC_Init(&NVIC_InitStructure); - - /* Disable and Deinitialize the DMA Streams */ - DMA_Cmd(sEE_I2C_DMA_STREAM_TX, DISABLE); - DMA_Cmd(sEE_I2C_DMA_STREAM_RX, DISABLE); - DMA_DeInit(sEE_I2C_DMA_STREAM_TX); - DMA_DeInit(sEE_I2C_DMA_STREAM_RX); -} - -/** - * @brief Initializes peripherals used by the I2C EEPROM driver. - * @param None - * @retval None - */ -void sEE_LowLevel_Init(void) -{ - GPIO_InitTypeDef GPIO_InitStructure; - - /*!< sEE_I2C Periph clock enable */ - RCC_APB1PeriphClockCmd(sEE_I2C_CLK, ENABLE); - - /*!< sEE_I2C_SCL_GPIO_CLK and sEE_I2C_SDA_GPIO_CLK Periph clock enable */ - RCC_AHB1PeriphClockCmd(sEE_I2C_SCL_GPIO_CLK | sEE_I2C_SDA_GPIO_CLK, ENABLE); - - RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); - - /* Reset sEE_I2C IP */ - RCC_APB1PeriphResetCmd(sEE_I2C_CLK, ENABLE); - - /* Release reset signal of sEE_I2C IP */ - RCC_APB1PeriphResetCmd(sEE_I2C_CLK, DISABLE); - - /*!< GPIO configuration */ - /* Connect PXx to I2C_SCL*/ - GPIO_PinAFConfig(sEE_I2C_SCL_GPIO_PORT, sEE_I2C_SCL_SOURCE, sEE_I2C_SCL_AF); - /* Connect PXx to I2C_SDA*/ - GPIO_PinAFConfig(sEE_I2C_SDA_GPIO_PORT, sEE_I2C_SDA_SOURCE, sEE_I2C_SDA_AF); - - /*!< Configure sEE_I2C pins: SCL */ - GPIO_InitStructure.GPIO_Pin = sEE_I2C_SCL_PIN; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_InitStructure.GPIO_OType = GPIO_OType_OD; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - GPIO_Init(sEE_I2C_SCL_GPIO_PORT, &GPIO_InitStructure); - /*!< Configure sEE_I2C pins: SDA */ - GPIO_InitStructure.GPIO_Pin = sEE_I2C_SDA_PIN; - GPIO_Init(sEE_I2C_SDA_GPIO_PORT, &GPIO_InitStructure); - - - /* Configure and enable I2C DMA TX Channel interrupt */ - NVIC_InitStructure.NVIC_IRQChannel = sEE_I2C_DMA_TX_IRQn; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = sEE_I2C_DMA_PREPRIO; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = sEE_I2C_DMA_SUBPRIO; - NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - NVIC_Init(&NVIC_InitStructure); - - /* Configure and enable I2C DMA RX Channel interrupt */ - NVIC_InitStructure.NVIC_IRQChannel = sEE_I2C_DMA_RX_IRQn; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = sEE_I2C_DMA_PREPRIO; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = sEE_I2C_DMA_SUBPRIO; - NVIC_Init(&NVIC_InitStructure); - - /*!< I2C DMA TX and RX channels configuration */ - /* Enable the DMA clock */ - RCC_AHB1PeriphClockCmd(sEE_I2C_DMA_CLK, ENABLE); - - /* Clear any pending flag on Rx Stream */ - DMA_ClearFlag(sEE_I2C_DMA_STREAM_TX, sEE_TX_DMA_FLAG_FEIF | sEE_TX_DMA_FLAG_DMEIF | sEE_TX_DMA_FLAG_TEIF | \ - sEE_TX_DMA_FLAG_HTIF | sEE_TX_DMA_FLAG_TCIF); - /* Disable the EE I2C Tx DMA stream */ - DMA_Cmd(sEE_I2C_DMA_STREAM_TX, DISABLE); - /* Configure the DMA stream for the EE I2C peripheral TX direction */ - DMA_DeInit(sEE_I2C_DMA_STREAM_TX); - sEEDMA_InitStructure.DMA_Channel = sEE_I2C_DMA_CHANNEL; - sEEDMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)sEE_I2C_DR_Address; - sEEDMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)0; /* This parameter will be configured durig communication */; - sEEDMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral; /* This parameter will be configured durig communication */ - sEEDMA_InitStructure.DMA_BufferSize = 0xFFFF; /* This parameter will be configured durig communication */ - sEEDMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; - sEEDMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; - sEEDMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte; - sEEDMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte; - sEEDMA_InitStructure.DMA_Mode = DMA_Mode_Normal; - sEEDMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh; - sEEDMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Enable; - sEEDMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full; - sEEDMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single; - sEEDMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single; - DMA_Init(sEE_I2C_DMA_STREAM_TX, &sEEDMA_InitStructure); - - /* Clear any pending flag on Rx Stream */ - DMA_ClearFlag(sEE_I2C_DMA_STREAM_RX, sEE_RX_DMA_FLAG_FEIF | sEE_RX_DMA_FLAG_DMEIF | sEE_RX_DMA_FLAG_TEIF | \ - sEE_RX_DMA_FLAG_HTIF | sEE_RX_DMA_FLAG_TCIF); - /* Disable the EE I2C DMA Rx stream */ - DMA_Cmd(sEE_I2C_DMA_STREAM_RX, DISABLE); - /* Configure the DMA stream for the EE I2C peripheral RX direction */ - DMA_DeInit(sEE_I2C_DMA_STREAM_RX); - DMA_Init(sEE_I2C_DMA_STREAM_RX, &sEEDMA_InitStructure); - - /* Enable the DMA Channels Interrupts */ - DMA_ITConfig(sEE_I2C_DMA_STREAM_TX, DMA_IT_TC, ENABLE); - DMA_ITConfig(sEE_I2C_DMA_STREAM_RX, DMA_IT_TC, ENABLE); -} - -/** - * @brief Initializes DMA channel used by the I2C EEPROM driver. - * @param None - * @retval None - */ -void sEE_LowLevel_DMAConfig(uint32_t pBuffer, uint32_t BufferSize, uint32_t Direction) -{ - /* Initialize the DMA with the new parameters */ - if (Direction == sEE_DIRECTION_TX) - { - /* Configure the DMA Tx Stream with the buffer address and the buffer size */ - sEEDMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)pBuffer; - sEEDMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral; - sEEDMA_InitStructure.DMA_BufferSize = (uint32_t)BufferSize; - DMA_Init(sEE_I2C_DMA_STREAM_TX, &sEEDMA_InitStructure); - } - else - { - /* Configure the DMA Rx Stream with the buffer address and the buffer size */ - sEEDMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)pBuffer; - sEEDMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory; - sEEDMA_InitStructure.DMA_BufferSize = (uint32_t)BufferSize; - DMA_Init(sEE_I2C_DMA_STREAM_RX, &sEEDMA_InitStructure); - } -} - -/** - * @} - */ - - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval.h b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval.h deleted file mode 100644 index 52e633317..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval.h +++ /dev/null @@ -1,373 +0,0 @@ -/** - ****************************************************************************** - * @file stm322xg_eval.h - * @author MCD Application Team - * @version V5.0.3 - * @date 09-March-2012 - * @brief This file contains definitions for STM322xG_EVAL's Leds, push-buttons - * and COM ports hardware resources. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __STM322xG_EVAL_H -#define __STM322xG_EVAL_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include "stm32f2xx.h" -#include "stm32_eval_legacy.h" - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL_LOW_LEVEL - * @{ - */ - -/** @defgroup STM322xG_EVAL_LOW_LEVEL_Exported_Types - * @{ - */ -typedef enum -{ - LED1 = 0, - LED2 = 1, - LED3 = 2, - LED4 = 3 -} Led_TypeDef; - -typedef enum -{ - BUTTON_WAKEUP = 0, - BUTTON_TAMPER = 1, - BUTTON_KEY = 2, - BUTTON_RIGHT = 3, - BUTTON_LEFT = 4, - BUTTON_UP = 5, - BUTTON_DOWN = 6, - BUTTON_SEL = 7 -} Button_TypeDef; - -typedef enum -{ - BUTTON_MODE_GPIO = 0, - BUTTON_MODE_EXTI = 1 -} ButtonMode_TypeDef; - -typedef enum -{ - JOY_NONE = 0, - JOY_SEL = 1, - JOY_DOWN = 2, - JOY_LEFT = 3, - JOY_RIGHT = 4, - JOY_UP = 5 -} JOYState_TypeDef -; - -typedef enum -{ - COM1 = 0, - COM2 = 1 -} COM_TypeDef; -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_LOW_LEVEL_Exported_Constants - * @{ - */ - -/** - * @brief Define for STM322xG_EVAL board - */ -#if !defined (USE_STM322xG_EVAL) - #define USE_STM322xG_EVAL -#endif - -/** @addtogroup STM322xG_EVAL_LOW_LEVEL_LED - * @{ - */ -#define LEDn 4 - -#define LED1_PIN GPIO_Pin_6 -#define LED1_GPIO_PORT GPIOG -#define LED1_GPIO_CLK RCC_AHB1Periph_GPIOG - -#define LED2_PIN GPIO_Pin_8 -#define LED2_GPIO_PORT GPIOG -#define LED2_GPIO_CLK RCC_AHB1Periph_GPIOG - -#define LED3_PIN GPIO_Pin_9 -#define LED3_GPIO_PORT GPIOI -#define LED3_GPIO_CLK RCC_AHB1Periph_GPIOI - -#define LED4_PIN GPIO_Pin_7 -#define LED4_GPIO_PORT GPIOC -#define LED4_GPIO_CLK RCC_AHB1Periph_GPIOC - -/** - * @} - */ - -/** @addtogroup STM322xG_EVAL_LOW_LEVEL_BUTTON - * @{ - */ -#define BUTTONn 3 /*!< Joystick pins are connected to - an IO Expander (accessible through - I2C1 interface) */ - -/** - * @brief Wakeup push-button - */ -#define WAKEUP_BUTTON_PIN GPIO_Pin_0 -#define WAKEUP_BUTTON_GPIO_PORT GPIOA -#define WAKEUP_BUTTON_GPIO_CLK RCC_AHB1Periph_GPIOA -#define WAKEUP_BUTTON_EXTI_LINE EXTI_Line0 -#define WAKEUP_BUTTON_EXTI_PORT_SOURCE EXTI_PortSourceGPIOA -#define WAKEUP_BUTTON_EXTI_PIN_SOURCE EXTI_PinSource0 -#define WAKEUP_BUTTON_EXTI_IRQn EXTI0_IRQn - -/** - * @brief Tamper push-button - */ -#define TAMPER_BUTTON_PIN GPIO_Pin_13 -#define TAMPER_BUTTON_GPIO_PORT GPIOC -#define TAMPER_BUTTON_GPIO_CLK RCC_AHB1Periph_GPIOC -#define TAMPER_BUTTON_EXTI_LINE EXTI_Line13 -#define TAMPER_BUTTON_EXTI_PORT_SOURCE EXTI_PortSourceGPIOC -#define TAMPER_BUTTON_EXTI_PIN_SOURCE EXTI_PinSource13 -#define TAMPER_BUTTON_EXTI_IRQn EXTI15_10_IRQn - -/** - * @brief Key push-button - */ -#define KEY_BUTTON_PIN GPIO_Pin_15 -#define KEY_BUTTON_GPIO_PORT GPIOG -#define KEY_BUTTON_GPIO_CLK RCC_AHB1Periph_GPIOG -#define KEY_BUTTON_EXTI_LINE EXTI_Line15 -#define KEY_BUTTON_EXTI_PORT_SOURCE EXTI_PortSourceGPIOG -#define KEY_BUTTON_EXTI_PIN_SOURCE EXTI_PinSource15 -#define KEY_BUTTON_EXTI_IRQn EXTI15_10_IRQn -/** - * @} - */ - -/** @addtogroup STM322xG_EVAL_LOW_LEVEL_COM - * @{ - */ -#define COMn 1 - -/** - * @brief Definition for COM port1, connected to USART3 - */ -#define EVAL_COM1 USART3 -#define EVAL_COM1_CLK RCC_APB1Periph_USART3 -#define EVAL_COM1_TX_PIN GPIO_Pin_10 -#define EVAL_COM1_TX_GPIO_PORT GPIOC -#define EVAL_COM1_TX_GPIO_CLK RCC_AHB1Periph_GPIOC -#define EVAL_COM1_TX_SOURCE GPIO_PinSource10 -#define EVAL_COM1_TX_AF GPIO_AF_USART3 -#define EVAL_COM1_RX_PIN GPIO_Pin_11 -#define EVAL_COM1_RX_GPIO_PORT GPIOC -#define EVAL_COM1_RX_GPIO_CLK RCC_AHB1Periph_GPIOC -#define EVAL_COM1_RX_SOURCE GPIO_PinSource11 -#define EVAL_COM1_RX_AF GPIO_AF_USART3 -#define EVAL_COM1_IRQn USART3_IRQn - -/** - * @} - */ - -/** @addtogroup STM322xG_EVAL_LOW_LEVEL_SD_FLASH - * @{ - */ -/** - * @brief SD FLASH SDIO Interface - */ -#define SD_DETECT_PIN GPIO_Pin_13 /* PH.13 */ -#define SD_DETECT_GPIO_PORT GPIOH /* GPIOH */ -#define SD_DETECT_GPIO_CLK RCC_AHB1Periph_GPIOH - -#define SDIO_FIFO_ADDRESS ((uint32_t)0x40012C80) -/** - * @brief SDIO Intialization Frequency (400KHz max) - */ -#define SDIO_INIT_CLK_DIV ((uint8_t)0x76) -/** - * @brief SDIO Data Transfer Frequency (25MHz max) - */ -#define SDIO_TRANSFER_CLK_DIV ((uint8_t)0x0) - -#define SD_SDIO_DMA DMA2 -#define SD_SDIO_DMA_CLK RCC_AHB1Periph_DMA2 - -#define SD_SDIO_DMA_STREAM3 3 -//#define SD_SDIO_DMA_STREAM6 6 - -#ifdef SD_SDIO_DMA_STREAM3 - #define SD_SDIO_DMA_STREAM DMA2_Stream3 - #define SD_SDIO_DMA_CHANNEL DMA_Channel_4 - #define SD_SDIO_DMA_FLAG_FEIF DMA_FLAG_FEIF3 - #define SD_SDIO_DMA_FLAG_DMEIF DMA_FLAG_DMEIF3 - #define SD_SDIO_DMA_FLAG_TEIF DMA_FLAG_TEIF3 - #define SD_SDIO_DMA_FLAG_HTIF DMA_FLAG_HTIF3 - #define SD_SDIO_DMA_FLAG_TCIF DMA_FLAG_TCIF3 - #define SD_SDIO_DMA_IRQn DMA2_Stream3_IRQn - #define SD_SDIO_DMA_IRQHANDLER DMA2_Stream3_IRQHandler -#elif defined SD_SDIO_DMA_STREAM6 - #define SD_SDIO_DMA_STREAM DMA2_Stream6 - #define SD_SDIO_DMA_CHANNEL DMA_Channel_4 - #define SD_SDIO_DMA_FLAG_FEIF DMA_FLAG_FEIF6 - #define SD_SDIO_DMA_FLAG_DMEIF DMA_FLAG_DMEIF6 - #define SD_SDIO_DMA_FLAG_TEIF DMA_FLAG_TEIF6 - #define SD_SDIO_DMA_FLAG_HTIF DMA_FLAG_HTIF6 - #define SD_SDIO_DMA_FLAG_TCIF DMA_FLAG_TCIF6 - #define SD_SDIO_DMA_IRQn DMA2_Stream6_IRQn - #define SD_SDIO_DMA_IRQHANDLER DMA2_Stream6_IRQHandler -#endif /* SD_SDIO_DMA_STREAM3 */ - -/** - * @} - */ - -/** @addtogroup STM322xG_EVAL_LOW_LEVEL_I2C_EE - * @{ - */ -/** - * @brief I2C EEPROM Interface pins - */ -#define sEE_I2C I2C1 -#define sEE_I2C_CLK RCC_APB1Periph_I2C1 -#define sEE_I2C_SCL_PIN GPIO_Pin_6 /* PB.06 */ -#define sEE_I2C_SCL_GPIO_PORT GPIOB /* GPIOB */ -#define sEE_I2C_SCL_GPIO_CLK RCC_AHB1Periph_GPIOB -#define sEE_I2C_SCL_SOURCE GPIO_PinSource6 -#define sEE_I2C_SCL_AF GPIO_AF_I2C1 -#define sEE_I2C_SDA_PIN GPIO_Pin_9 /* PB.09 */ -#define sEE_I2C_SDA_GPIO_PORT GPIOB /* GPIOB */ -#define sEE_I2C_SDA_GPIO_CLK RCC_AHB1Periph_GPIOB -#define sEE_I2C_SDA_SOURCE GPIO_PinSource9 -#define sEE_I2C_SDA_AF GPIO_AF_I2C1 -#define sEE_M24C64_32 - -#define sEE_I2C_DMA DMA1 -#define sEE_I2C_DMA_CHANNEL DMA_Channel_1 -#define sEE_I2C_DMA_STREAM_TX DMA1_Stream6 -#define sEE_I2C_DMA_STREAM_RX DMA1_Stream0 -#define sEE_I2C_DMA_CLK RCC_AHB1Periph_DMA1 -#define sEE_I2C_DR_Address ((uint32_t)0x40005410) -#define sEE_USE_DMA - -#define sEE_I2C_DMA_TX_IRQn DMA1_Stream6_IRQn -#define sEE_I2C_DMA_RX_IRQn DMA1_Stream0_IRQn -#define sEE_I2C_DMA_TX_IRQHandler DMA1_Stream6_IRQHandler -#define sEE_I2C_DMA_RX_IRQHandler DMA1_Stream0_IRQHandler -#define sEE_I2C_DMA_PREPRIO 0 -#define sEE_I2C_DMA_SUBPRIO 0 - -#define sEE_TX_DMA_FLAG_FEIF DMA_FLAG_FEIF6 -#define sEE_TX_DMA_FLAG_DMEIF DMA_FLAG_DMEIF6 -#define sEE_TX_DMA_FLAG_TEIF DMA_FLAG_TEIF6 -#define sEE_TX_DMA_FLAG_HTIF DMA_FLAG_HTIF6 -#define sEE_TX_DMA_FLAG_TCIF DMA_FLAG_TCIF6 -#define sEE_RX_DMA_FLAG_FEIF DMA_FLAG_FEIF0 -#define sEE_RX_DMA_FLAG_DMEIF DMA_FLAG_DMEIF0 -#define sEE_RX_DMA_FLAG_TEIF DMA_FLAG_TEIF0 -#define sEE_RX_DMA_FLAG_HTIF DMA_FLAG_HTIF0 -#define sEE_RX_DMA_FLAG_TCIF DMA_FLAG_TCIF0 - -#define sEE_DIRECTION_TX 0 -#define sEE_DIRECTION_RX 1 - -/* Time constant for the delay caclulation allowing to have a millisecond - incrementing counter. This value should be equal to (System Clock / 1000). - ie. if system clock = 120MHz then sEE_TIME_CONST should be 120. */ -#define sEE_TIME_CONST 120 -/** - * @} - */ -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_LOW_LEVEL_Exported_Macros - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_LOW_LEVEL_Exported_Functions - * @{ - */ -void STM_EVAL_LEDInit(Led_TypeDef Led); -void STM_EVAL_LEDOn(Led_TypeDef Led); -void STM_EVAL_LEDOff(Led_TypeDef Led); -void STM_EVAL_LEDToggle(Led_TypeDef Led); -void STM_EVAL_PBInit(Button_TypeDef Button, ButtonMode_TypeDef Button_Mode); -uint32_t STM_EVAL_PBGetState(Button_TypeDef Button); -void STM_EVAL_COMInit(COM_TypeDef COM, USART_InitTypeDef* USART_InitStruct); -void SD_LowLevel_DeInit(void); -void SD_LowLevel_Init(void); -void SD_LowLevel_DMA_TxConfig(uint32_t *BufferSRC, uint32_t BufferSize); -void SD_LowLevel_DMA_RxConfig(uint32_t *BufferDST, uint32_t BufferSize); -void sEE_LowLevel_DeInit(void); -void sEE_LowLevel_Init(void); -void sEE_LowLevel_DMAConfig(uint32_t pBuffer, uint32_t BufferSize, uint32_t Direction); -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* __STM322xG_EVAL_H */ -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_audio_codec.c b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_audio_codec.c deleted file mode 100644 index 7f6f2409d..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_audio_codec.c +++ /dev/null @@ -1,1465 +0,0 @@ -/** - ****************************************************************************** - * @file stm322xg_eval_audio_codec.c - * @author MCD Application Team - * @version V5.0.3 - * @date 09-March-2012 - * @brief This file includes the low layer driver for CS43L22 Audio Codec - * available on STM322xG-EVAL evaluation board(MB786) RevA and RevB. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/*============================================================================================================================== - User NOTES -1. How To use this driver: --------------------------- - - This driver supports STM32F2xx devices on STM322xG-EVAL (MB786 RevA) Evaluation boards. - - - Configure the options in file stm322xg_eval_audio_codec.h in the section CONFIGURATION. - Refer to the sections 2 and 3 to have more details on the possible configurations. - - - Call the function EVAL_AUDIO_Init( - OutputDevice: physical output mode (OUTPUT_DEVICE_SPEAKER, - OUTPUT_DEVICE_HEADPHONE, OUTPUT_DEVICE_AUTO or - OUTPUT_DEVICE_BOTH) - Volume: initial volume to be set (0 is min (mute), 100 is max (100%) - AudioFreq: Audio frequency in Hz (8000, 16000, 22500, 32000 ...) - this parameter is relative to the audio file/stream type. - ) - This function configures all the hardware required for the audio application (codec, I2C, I2S, - GPIOs, DMA and interrupt if needed). This function returns 0 if configuration is OK. - if the returned value is different from 0 or the function is stuck then the communication with - the codec or the IOExpander has failed (try to un-plug the power or reset device in this case). - + OUTPUT_DEVICE_SPEAKER: only speaker will be set as output for the audio stream. - + OUTPUT_DEVICE_HEADPHONE: only headphones will be set as output for the audio stream. - + OUTPUT_DEVICE_AUTO: Selection of output device is made through external switch (implemented - into the audio jack on the evaluation board). When the Headphone is connected it is used - as output. When the headphone is disconnected from the audio jack, the output is - automatically switched to Speaker. - + OUTPUT_DEVICE_BOTH: both Speaker and Headphone are used as outputs for the audio stream - at the same time. - - - Call the function EVAL_AUDIO_Play( - pBuffer: pointer to the audio data file address - Size: size of the buffer to be sent in Bytes - ) - to start playing (for the first time) from the audio file/stream. - - - Call the function EVAL_AUDIO_PauseResume( - Cmd: AUDIO_PAUSE (or 0) to pause playing or AUDIO_RESUME (or - any value different from 0) to resume playing. - ) - Note. After calling EVAL_AUDIO_PauseResume() function for pause, only EVAL_AUDIO_PauseResume() should be called - for resume (it is not allowed to call EVAL_AUDIO_Play() in this case). - Note. This function should be called only when the audio file is played or paused (not stopped). - - - For each mode, you may need to implement the relative callback functions into your code. - The Callback functions are named EVAL_AUDIO_XXX_CallBack() and only their prototypes are declared in - the stm322xg_eval_audio_codec.h file. (refer to the example for more details on the callbacks implementations) - - - To Stop playing, to modify the volume level or to mute, use the functions - EVAL_AUDIO_Stop(), EVAL_AUDIO_VolumeCtl() and EVAL_AUDIO_Mute(). - - - The driver API and the callback functions are at the end of the stm322xg_eval_audio_codec.h file. - - - Driver architecture: - -------------------- - This driver is composed of three main layers: - o High Audio Layer: consists of the function API exported in the stm322xg_eval_audio_codec.h file - (EVAL_AUDIO_Init(), EVAL_AUDIO_Play() ...) - o Codec Control layer: consists of the functions API controlling the audio codec (CS43L22) and - included as local functions in file stm322xg_eval_audio_codec.c (Codec_Init(), Codec_Play() ...) - o Media Access Layer (MAL): which consists of functions allowing to access the media containing/ - providing the audio file/stream. These functions are also included as local functions into - the stm322xg_eval_audio_codec.c file (Audio_MAL_Init(), Audio_MAL_Play() ...) - Each set of functions (layer) may be implemented independently of the others and customized when - needed. - -2. Modes description: ---------------------- - + AUDIO_MAL_MODE_NORMAL : is suitable when the audio file is in a memory location. - + AUDIO_MAL_MODE_CIRCULAR: is suitable when the audio data are read either from a - memory location or from a device at real time (double buffer could be used). - -3. DMA interrupts description: ------------------------------- - + EVAL_AUDIO_IT_TC_ENABLE: Enable this define to use the DMA end of transfer interrupt. - then, a callback should be implemented by user to perform specific actions - when the DMA has finished the transfer. - + EVAL_AUDIO_IT_HT_ENABLE: Enable this define to use the DMA end of half transfer interrupt. - then, a callback should be implemented by user to perform specific actions - when the DMA has reached the half of the buffer transfer (generally, it is useful - to load the first half of buffer while DMA is loading from the second half). - + EVAL_AUDIO_IT_ER_ENABLE: Enable this define to manage the cases of error on DMA transfer. - -4. Known Limitations: ---------------------- - 1- When using the Speaker, if the audio file quality is not high enough, the speaker output - may produce high and uncomfortable noise level. To avoid this issue, to use speaker - output properly, try to increase audio file sampling rate (typically higher than 48KHz). - This operation will lead to larger file size. - 2- Communication with the audio codec (through I2C) may be corrupted if it is interrupted by some - user interrupt routines (in this case, interrupts could be disabled just before the start of - communication then re-enabled when it is over). Note that this communication is only done at - the configuration phase (EVAL_AUDIO_Init() or EVAL_AUDIO_Stop()) and when Volume control modification is - performed (EVAL_AUDIO_VolumeCtl() or EVAL_AUDIO_Mute()). When the audio data is played, no communication is - required with the audio codec. - 3- Parsing of audio file is not implemented (in order to determine audio file properties: Mono/Stereo, Data size, - File size, Audio Frequency, Audio Data header size ...). The configuration is fixed for the given audio file. - 4- Mono audio streaming is not supported (in order to play mono audio streams, each data should be sent twice - on the I2S or should be duplicated on the source buffer. Or convert the stream in stereo before playing). - 5- Supports only 16-bit audio data size. -===============================================================================================================================*/ - - -/* Includes ------------------------------------------------------------------*/ -#include "stm322xg_eval_audio_codec.h" - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL_AUDIO_CODEC - * @brief This file includes the low layer driver for CS43L22 Audio Codec - * available on STM322xG-EVAL evaluation board(MB786) RevA and RevB. - * @{ - */ - -/** @defgroup STM322xG_EVAL_AUDIO_CODEC_Private_Types - * @{ - */ -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_AUDIO_CODEC_Private_Defines - * @{ - */ - -/* Mask for the bit EN of the I2S CFGR register */ -#define I2S_ENABLE_MASK 0x0400 - -/* Delay for the Codec to be correctly reset */ -#define CODEC_RESET_DELAY 0x4FFF - -/* Codec audio Standards */ -#ifdef I2S_STANDARD_PHILLIPS - #define CODEC_STANDARD 0x04 - #define I2S_STANDARD I2S_Standard_Phillips -#elif defined(I2S_STANDARD_MSB) - #define CODEC_STANDARD 0x00 - #define I2S_STANDARD I2S_Standard_MSB -#elif defined(I2S_STANDARD_LSB) - #define CODEC_STANDARD 0x08 - #define I2S_STANDARD I2S_Standard_LSB -#else - #error "Error: No audio communication standard selected !" -#endif /* I2S_STANDARD */ - -/* The 7 bits Codec address (sent through I2C interface) */ -#define CODEC_ADDRESS 0x94 /* b00100111 */ -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_AUDIO_CODEC_Private_Macros - * @{ - */ -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_AUDIO_CODEC_Private_Variables - * @{ - */ -/* This structure is declared global because it is handled by two different functions */ -static DMA_InitTypeDef DMA_InitStructure; -DMA_InitTypeDef AUDIO_MAL_DMA_InitStructure; - -uint32_t AudioTotalSize = 0xFFFF; /* This variable holds the total size of the audio file */ -uint32_t AudioRemSize = 0xFFFF; /* This variable holds the remaining data in audio file */ -uint16_t *CurrentPos; /* This variable holds the current position of audio pointer */ - -__IO uint32_t CODECTimeout = CODEC_LONG_TIMEOUT; -__IO uint8_t OutputDev = 0; - -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_AUDIO_CODEC_Private_Function_Prototypes - * @{ - */ -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_AUDIO_CODEC_Private_Functions - * @{ - */ - -/*----------------------------------- - Audio Codec functions - ------------------------------------------*/ -/* High Layer codec functions */ -static uint32_t Codec_Init(uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq); -static uint32_t Codec_DeInit(void); -static uint32_t Codec_Play(void); -static uint32_t Codec_PauseResume(uint32_t Cmd); -static uint32_t Codec_Stop(uint32_t Cmd); -static uint32_t Codec_VolumeCtrl(uint8_t Volume); -static uint32_t Codec_Mute(uint32_t Cmd); -/* Low layer codec functions */ -static void Codec_CtrlInterface_Init(void); -static void Codec_CtrlInterface_DeInit(void); -static void Codec_AudioInterface_Init(uint32_t AudioFreq); -static void Codec_AudioInterface_DeInit(void); -static void Codec_Reset(void); -static uint32_t Codec_WriteRegister(uint8_t RegisterAddr, uint8_t RegisterValue); -static uint32_t Codec_ReadRegister(uint8_t RegisterAddr); -static void Codec_GPIO_Init(void); -static void Codec_GPIO_DeInit(void); -static void Delay(__IO uint32_t nCount); -/*----------------------------------------------------------------------------*/ - -/*----------------------------------- - MAL (Media Access Layer) functions - ------------------------------------------*/ -/* Peripherals configuration functions */ -static void Audio_MAL_Init(void); -static void Audio_MAL_DeInit(void); -static void Audio_MAL_Play(uint32_t Addr, uint32_t Size); -static void Audio_MAL_PauseResume(uint32_t Cmd, uint32_t Addr); -static void Audio_MAL_Stop(void); -/*----------------------------------------------------------------------------*/ - -/** - * @brief Configure the audio peripherals. - * @param OutputDevice: OUTPUT_DEVICE_SPEAKER, OUTPUT_DEVICE_HEADPHONE, - * OUTPUT_DEVICE_BOTH or OUTPUT_DEVICE_AUTO . - * @param Volume: Initial volume level (from 0 (Mute) to 100 (Max)) - * @param AudioFreq: Audio frequency used to play the audio stream. - * @retval 0 if correct communication, else wrong communication - */ -uint32_t EVAL_AUDIO_Init(uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq) -{ - /* Perform low layer Codec initialization */ - if (Codec_Init(OutputDevice, VOLUME_CONVERT(Volume), AudioFreq) != 0) - { - return 1; - } - else - { - /* I2S data transfer preparation: - Prepare the Media to be used for the audio transfer from memory to I2S peripheral */ - Audio_MAL_Init(); - - /* Return 0 when all operations are OK */ - return 0; - } -} - -/** - * @brief Deinitializes all the resources used by the codec (those initialized - * by EVAL_AUDIO_Init() function) EXCEPT the I2C resources since they are - * used by the IOExpander as well (and eventually other modules). - * @param None - * @retval 0 if correct communication, else wrong communication - */ -uint32_t EVAL_AUDIO_DeInit(void) -{ - /* DeInitialize the Media layer */ - Audio_MAL_DeInit(); - - /* DeInitialize Codec */ - Codec_DeInit(); - - return 0; -} - -/** - * @brief Starts playing audio stream from a data buffer for a determined size. - * @param pBuffer: Pointer to the buffer - * @param Size: Number of audio data BYTES. - * @retval 0 if correct communication, else wrong communication - */ -uint32_t EVAL_AUDIO_Play(uint16_t* pBuffer, uint32_t Size) -{ - /* Set the total number of data to be played (count in half-word) */ - AudioTotalSize = Size/2; - - /* Call the audio Codec Play function */ - Codec_Play(); - - /* Update the Media layer and enable it for play */ - Audio_MAL_Play((uint32_t)pBuffer, (uint32_t)(DMA_MAX(AudioTotalSize / 2))); - - /* Update the remaining number of data to be played */ - AudioRemSize = (Size/2) - DMA_MAX(AudioTotalSize); - - /* Update the current audio pointer position */ - CurrentPos = pBuffer + DMA_MAX(AudioTotalSize); - - return 0; -} - -/** - * @brief This function Pauses or Resumes the audio file stream. In case - * of using DMA, the DMA Pause feature is used. In all cases the I2S - * peripheral is disabled. - * - * @WARNING When calling EVAL_AUDIO_PauseResume() function for pause, only - * this function should be called for resume (use of EVAL_AUDIO_Play() - * function for resume could lead to unexpected behavior). - * - * @param Cmd: AUDIO_PAUSE (or 0) to pause, AUDIO_RESUME (or any value different - * from 0) to resume. - * @retval 0 if correct communication, else wrong communication - */ -uint32_t EVAL_AUDIO_PauseResume(uint32_t Cmd) -{ - /* Call the Audio Codec Pause/Resume function */ - if (Codec_PauseResume(Cmd) != 0) - { - return 1; - } - else - { - /* Call the Media layer pause/resume function */ - Audio_MAL_PauseResume(Cmd, 0); - - /* Return 0 if all operations are OK */ - return 0; - } -} - -/** - * @brief Stops audio playing and Power down the Audio Codec. - * @param Option: could be one of the following parameters - * - CODEC_PDWN_SW: for software power off (by writing registers). - * Then no need to reconfigure the Codec after power on. - * - CODEC_PDWN_HW: completely shut down the codec (physically). - * Then need to reconfigure the Codec after power on. - * @retval 0 if correct communication, else wrong communication - */ -uint32_t EVAL_AUDIO_Stop(uint32_t Option) -{ - /* Call Audio Codec Stop function */ - if (Codec_Stop(Option) != 0) - { - return 1; - } - else - { - /* Call Media layer Stop function */ - Audio_MAL_Stop(); - - /* Update the remaining data number */ - AudioRemSize = AudioTotalSize; - - /* Return 0 when all operations are correctly done */ - return 0; - } -} - -/** - * @brief Controls the current audio volume level. - * @param Volume: Volume level to be set in percentage from 0% to 100% (0 for - * Mute and 100 for Max volume level). - * @retval 0 if correct communication, else wrong communication - */ -uint32_t EVAL_AUDIO_VolumeCtl(uint8_t Volume) -{ - /* Call the codec volume control function with converted volume value */ - return (Codec_VolumeCtrl(VOLUME_CONVERT(Volume))); -} - -/** - * @brief Enables or disables the MUTE mode by software - * @param Command: could be AUDIO_MUTE_ON to mute sound or AUDIO_MUTE_OFF to - * unmute the codec and restore previous volume level. - * @retval 0 if correct communication, else wrong communication - */ -uint32_t EVAL_AUDIO_Mute(uint32_t Cmd) -{ - /* Call the Codec Mute function */ - return (Codec_Mute(Cmd)); -} - -/** - * @brief This function handles main Media layer interrupt. - * @param None - * @retval 0 if correct communication, else wrong communication - */ -void Audio_MAL_IRQHandler(void) -{ -#ifndef AUDIO_MAL_MODE_NORMAL - uint16_t *pAddr = (uint16_t *)CurrentPos; - uint32_t Size = AudioRemSize; -#endif /* AUDIO_MAL_MODE_NORMAL */ - -#ifdef AUDIO_MAL_DMA_IT_TC_EN - /* Transfer complete interrupt */ - if (DMA_GetFlagStatus(AUDIO_MAL_DMA_STREAM, AUDIO_MAL_DMA_FLAG_TC) != RESET) - { - #ifdef AUDIO_MAL_MODE_NORMAL - /* Check if the end of file has been reached */ - if (AudioRemSize > 0) - { - /* Wait the DMA Stream to be effectively disabled */ - while (DMA_GetCmdStatus(AUDIO_MAL_DMA_STREAM) != DISABLE) - {} - - /* Clear the Interrupt flag */ - DMA_ClearFlag(AUDIO_MAL_DMA_STREAM, AUDIO_MAL_DMA_FLAG_TC); - - /* Re-Configure the buffer address and size */ - DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t) CurrentPos; - DMA_InitStructure.DMA_BufferSize = (uint32_t) (DMA_MAX(AudioRemSize)); - - /* Configure the DMA Stream with the new parameters */ - DMA_Init(AUDIO_MAL_DMA_STREAM, &DMA_InitStructure); - - /* Enable the I2S DMA Stream*/ - DMA_Cmd(AUDIO_MAL_DMA_STREAM, ENABLE); - - /* Update the current pointer position */ - CurrentPos += DMA_MAX(AudioRemSize); - - /* Update the remaining number of data to be played */ - AudioRemSize -= DMA_MAX(AudioRemSize); - } - else - { - /* Disable the I2S DMA Stream*/ - DMA_Cmd(AUDIO_MAL_DMA_STREAM, DISABLE); - - /* Clear the Interrupt flag */ - DMA_ClearFlag(AUDIO_MAL_DMA_STREAM, AUDIO_MAL_DMA_FLAG_TC); - - /* Manage the remaining file size and new address offset: This function - should be coded by user (its prototype is already declared in stm32_eval_audio_codec.h) */ - EVAL_AUDIO_TransferComplete_CallBack((uint32_t)CurrentPos, 0); - } - - #elif defined(AUDIO_MAL_MODE_CIRCULAR) - /* Manage the remaining file size and new address offset: This function - should be coded by user (its prototype is already declared in stm32_eval_audio_codec.h) */ - EVAL_AUDIO_TransferComplete_CallBack(pAddr, Size); - - /* Clear the Interrupt flag */ - DMA_ClearFlag(AUDIO_MAL_DMA_STREAM, AUDIO_MAL_DMA_FLAG_TC); - #endif /* AUDIO_MAL_MODE_NORMAL */ - } -#endif /* AUDIO_MAL_DMA_IT_TC_EN */ - -#ifdef AUDIO_MAL_DMA_IT_HT_EN - /* Half Transfer complete interrupt */ - if (DMA_GetFlagStatus(AUDIO_MAL_DMA_STREAM, AUDIO_MAL_DMA_FLAG_HT) != RESET) - { - /* Manage the remaining file size and new address offset: This function - should be coded by user (its prototype is already declared in stm32_eval_audio_codec.h) */ - EVAL_AUDIO_HalfTransfer_CallBack((uint32_t)pAddr, Size); - - /* Clear the Interrupt flag */ - DMA_ClearFlag(AUDIO_MAL_DMA_STREAM, AUDIO_MAL_DMA_FLAG_HT); - } -#endif /* AUDIO_MAL_DMA_IT_HT_EN */ - -#ifdef AUDIO_MAL_DMA_IT_TE_EN - /* FIFO Error interrupt */ - if ((DMA_GetFlagStatus(AUDIO_MAL_DMA_STREAM, AUDIO_MAL_DMA_FLAG_TE) != RESET) || \ - (DMA_GetFlagStatus(AUDIO_MAL_DMA_STREAM, AUDIO_MAL_DMA_FLAG_FE) != RESET) || \ - (DMA_GetFlagStatus(AUDIO_MAL_DMA_STREAM, AUDIO_MAL_DMA_FLAG_DME) != RESET)) - - { - /* Manage the error generated on DMA FIFO: This function - should be coded by user (its prototype is already declared in stm32_eval_audio_codec.h) */ - EVAL_AUDIO_Error_CallBack((uint32_t*)&pAddr); - - /* Clear the Interrupt flag */ - DMA_ClearFlag(AUDIO_MAL_DMA_STREAM, AUDIO_MAL_DMA_FLAG_TE | AUDIO_MAL_DMA_FLAG_FE | \ - AUDIO_MAL_DMA_FLAG_DME); - } -#endif /* AUDIO_MAL_DMA_IT_TE_EN */ -} - -/*======================== - - CS43L22 Audio Codec Control Functions - ==============================*/ -/** - * @brief Initializes the audio codec and all related interfaces (control - * interface: I2C and audio interface: I2S) - * @param OutputDevice: can be OUTPUT_DEVICE_SPEAKER, OUTPUT_DEVICE_HEADPHONE, - * OUTPUT_DEVICE_BOTH or OUTPUT_DEVICE_AUTO . - * @param Volume: Initial volume level (from 0 (Mute) to 100 (Max)) - * @param AudioFreq: Audio frequency used to play the audio stream. - * @retval 0 if correct communication, else wrong communication - */ -static uint32_t Codec_Init(uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq) -{ - uint32_t counter = 0; - - /* Configure the Codec related IOs */ - Codec_GPIO_Init(); - - /* Reset the Codec Registers */ - Codec_Reset(); - - /* Initialize the Control interface of the Audio Codec */ - Codec_CtrlInterface_Init(); - - /* Keep Codec powered OFF */ - counter += Codec_WriteRegister(0x02, 0x01); - - switch (OutputDevice) - { - case OUTPUT_DEVICE_SPEAKER: - counter += Codec_WriteRegister(0x04, 0xFA); /* SPK always ON & HP always OFF */ - OutputDev = 0xFA; - break; - - case OUTPUT_DEVICE_HEADPHONE: - counter += Codec_WriteRegister(0x04, 0xAF); /* SPK always OFF & HP always ON */ - OutputDev = 0xAF; - break; - - case OUTPUT_DEVICE_BOTH: - counter += Codec_WriteRegister(0x04, 0xAA); /* SPK always ON & HP always ON */ - OutputDev = 0xAA; - break; - - case OUTPUT_DEVICE_AUTO: - counter += Codec_WriteRegister(0x04, 0x05); /* Detect the HP or the SPK automatically */ - OutputDev = 0x05; - break; - - default: - counter += Codec_WriteRegister(0x04, 0x05); /* Detect the HP or the SPK automatically */ - OutputDev = 0x05; - break; - } - - /* Clock configuration: Auto detection */ - counter += Codec_WriteRegister(0x05, 0x81); - - /* Set the Slave Mode and the audio Standard */ - counter += Codec_WriteRegister(0x06, CODEC_STANDARD); - - /* Set the Master volume */ - Codec_VolumeCtrl(Volume); - - /* If the Speaker is enabled, set the Mono mode and volume attenuation level */ - if (OutputDevice != OUTPUT_DEVICE_HEADPHONE) - { - /* Set the Speaker Mono mode */ - counter += Codec_WriteRegister(0x0F , 0x06); - - /* Set the Speaker attenuation level */ - counter += Codec_WriteRegister(0x24, 0x00); - counter += Codec_WriteRegister(0x25, 0x00); - } - - /* Power on the Codec */ - counter += Codec_WriteRegister(0x02, 0x9E); - - /* Additional configuration for the CODEC. These configurations are done to reduce - the time needed for the Codec to power off. If these configurations are removed, - then a long delay should be added between powering off the Codec and switching - off the I2S peripheral MCLK clock (which is the operating clock for Codec). - If this delay is not inserted, then the codec will not shut down properly and - it results in high noise after shut down. */ - - /* Disable the analog soft ramp */ - counter += Codec_WriteRegister(0x0A, 0x00); - /* Disable the digital soft ramp */ - counter += Codec_WriteRegister(0x0E, 0x04); - /* Disable the limiter attack level */ - counter += Codec_WriteRegister(0x27, 0x00); - /* Adjust Bass and Treble levels */ - counter += Codec_WriteRegister(0x1F, 0x0F); - /* Adjust PCM volume level */ - counter += Codec_WriteRegister(0x1A, 0x0A); - counter += Codec_WriteRegister(0x1B, 0x0A); - - /* Configure the I2S peripheral */ - Codec_AudioInterface_Init(AudioFreq); - - /* Return communication control value */ - return counter; -} - -/** - * @brief Restore the audio codec state to default state and free all used - * resources. - * @param None - * @retval 0 if correct communication, else wrong communication - */ -static uint32_t Codec_DeInit(void) -{ - uint32_t counter = 0; - - /* Reset the Codec Registers */ - Codec_Reset(); - - /* Keep Codec powered OFF */ - counter += Codec_WriteRegister(0x02, 0x01); - - /* Deinitialize all use GPIOs */ - Codec_GPIO_DeInit(); - - /* Disable the Codec control interface */ - Codec_CtrlInterface_DeInit(); - - /* Deinitialize the Codec audio interface (I2S) */ - Codec_AudioInterface_DeInit(); - - /* Return communication control value */ - return counter; -} - -/** - * @brief Start the audio Codec play feature. - * @note For this codec no Play options are required. - * @param None - * @retval 0 if correct communication, else wrong communication - */ -static uint32_t Codec_Play(void) -{ - /* - No actions required on Codec level for play command - */ - - /* Return communication control value */ - return 0; -} - -/** - * @brief Pauses and resumes playing on the audio codec. - * @param Cmd: AUDIO_PAUSE (or 0) to pause, AUDIO_RESUME (or any value different - * from 0) to resume. - * @retval 0 if correct communication, else wrong communication - */ -static uint32_t Codec_PauseResume(uint32_t Cmd) -{ - uint32_t counter = 0; - - /* Pause the audio file playing */ - if (Cmd == AUDIO_PAUSE) - { - /* Mute the output first */ - counter += Codec_Mute(AUDIO_MUTE_ON); - - /* Put the Codec in Power save mode */ - counter += Codec_WriteRegister(0x02, 0x01); - } - else /* AUDIO_RESUME */ - { - /* Unmute the output first */ - counter += Codec_Mute(AUDIO_MUTE_OFF); - - counter += Codec_WriteRegister(0x04, OutputDev); - - /* Exit the Power save mode */ - counter += Codec_WriteRegister(0x02, 0x9E); - } - - return counter; -} - -/** - * @brief Stops audio Codec playing. It powers down the codec. - * @param CodecPdwnMode: selects the power down mode. - * - CODEC_PDWN_SW: only mutes the audio codec. When resuming from this - * mode the codec keeps the previous initialization - * (no need to re-Initialize the codec registers). - * - CODEC_PDWN_HW: Physically power down the codec. When resuming from this - * mode, the codec is set to default configuration - * (user should re-Initialize the codec in order to - * play again the audio stream). - * @retval 0 if correct communication, else wrong communication - */ -static uint32_t Codec_Stop(uint32_t CodecPdwnMode) -{ - uint32_t counter = 0; - - /* Mute the output first */ - Codec_Mute(AUDIO_MUTE_ON); - - if (CodecPdwnMode == CODEC_PDWN_SW) - { - /* Power down the DAC and the speaker (PMDAC and PMSPK bits)*/ - counter += Codec_WriteRegister(0x02, 0x9F); - } - else /* CODEC_PDWN_HW */ - { - /* Power down the DAC components */ - counter += Codec_WriteRegister(0x02, 0x9F); - - /* Wait at least 100us */ - Delay(0xFFF); - - /* Reset The pin */ - IOE_WriteIOPin(AUDIO_RESET_PIN, BitReset); - } - - return counter; -} - -/** - * @brief Sets higher or lower the codec volume level. - * @param Volume: a byte value from 0 to 255 (refer to codec registers - * description for more details). - * @retval 0 if correct communication, else wrong communication - */ -static uint32_t Codec_VolumeCtrl(uint8_t Volume) -{ - uint32_t counter = 0; - - if (Volume > 0xE6) - { - /* Set the Master volume */ - counter += Codec_WriteRegister(0x20, Volume - 0xE7); - counter += Codec_WriteRegister(0x21, Volume - 0xE7); - } - else - { - /* Set the Master volume */ - counter += Codec_WriteRegister(0x20, Volume + 0x19); - counter += Codec_WriteRegister(0x21, Volume + 0x19); - } - - return counter; -} - -/** - * @brief Enables or disables the mute feature on the audio codec. - * @param Cmd: AUDIO_MUTE_ON to enable the mute or AUDIO_MUTE_OFF to disable the - * mute mode. - * @retval 0 if correct communication, else wrong communication - */ -static uint32_t Codec_Mute(uint32_t Cmd) -{ - uint32_t counter = 0; - - /* Set the Mute mode */ - if (Cmd == AUDIO_MUTE_ON) - { - counter += Codec_WriteRegister(0x04, 0xFF); - } - else /* AUDIO_MUTE_OFF Disable the Mute */ - { - counter += Codec_WriteRegister(0x04, OutputDev); - } - - return counter; -} - -/** - * @brief Resets the audio codec. It restores the default configuration of the - * codec (this function shall be called before initializing the codec). - * @note This function calls an external driver function: The IO Expander driver. - * @param None - * @retval None - */ -static void Codec_Reset(void) -{ - /* Configure the IO Expander (to use the Codec Reset pin mapped on the IOExpander) */ - IOE_Config(); - - /* Power Down the codec */ - IOE_WriteIOPin(AUDIO_RESET_PIN, BitReset); - - /* wait for a delay to insure registers erasing */ - Delay(CODEC_RESET_DELAY); - - /* Power on the codec */ - IOE_WriteIOPin(AUDIO_RESET_PIN, BitSet); -} - -/** - * @brief Switch dynamically (while audio file is played) the output target - * (speaker or headphone). - * @note This function modifies a global variable of the audio codec driver: OutputDev. - * @param Output: specifies the audio output target: OUTPUT_DEVICE_SPEAKER, - * OUTPUT_DEVICE_HEADPHONE, OUTPUT_DEVICE_BOTH or OUTPUT_DEVICE_AUTO - * @retval 0 if correct communication, else wrong communication - */ -uint32_t Codec_SwitchOutput(uint8_t Output) -{ - uint8_t counter = 0; - - switch (Output) - { - case OUTPUT_DEVICE_SPEAKER: - counter += Codec_WriteRegister(0x04, 0xFA); /* SPK always ON & HP always OFF */ - OutputDev = 0xFA; - break; - - case OUTPUT_DEVICE_HEADPHONE: - counter += Codec_WriteRegister(0x04, 0xAF); /* SPK always OFF & HP always ON */ - OutputDev = 0xAF; - break; - - case OUTPUT_DEVICE_BOTH: - counter += Codec_WriteRegister(0x04, 0xAA); /* SPK always ON & HP always ON */ - OutputDev = 0xAA; - break; - - case OUTPUT_DEVICE_AUTO: - counter += Codec_WriteRegister(0x04, 0x05); /* Detect the HP or the SPK automatically */ - OutputDev = 0x05; - break; - - default: - counter += Codec_WriteRegister(0x04, 0x05); /* Detect the HP or the SPK automatically */ - OutputDev = 0x05; - break; - } - - return counter; -} - -/** - * @brief Writes a Byte to a given register into the audio codec through the - control interface (I2C) - * @param RegisterAddr: The address (location) of the register to be written. - * @param RegisterValue: the Byte value to be written into destination register. - * @retval 0 if correct communication, else wrong communication - */ -static uint32_t Codec_WriteRegister(uint8_t RegisterAddr, uint8_t RegisterValue) -{ - uint32_t result = 0; - - /*!< While the bus is busy */ - CODECTimeout = CODEC_LONG_TIMEOUT; - while(I2C_GetFlagStatus(CODEC_I2C, I2C_FLAG_BUSY)) - { - if((CODECTimeout--) == 0) return Codec_TIMEOUT_UserCallback(); - } - - /* Start the config sequence */ - I2C_GenerateSTART(CODEC_I2C, ENABLE); - - /* Test on EV5 and clear it */ - CODECTimeout = CODEC_FLAG_TIMEOUT; - while (!I2C_CheckEvent(CODEC_I2C, I2C_EVENT_MASTER_MODE_SELECT)) - { - if((CODECTimeout--) == 0) return Codec_TIMEOUT_UserCallback(); - } - - /* Transmit the slave address and enable writing operation */ - I2C_Send7bitAddress(CODEC_I2C, CODEC_ADDRESS, I2C_Direction_Transmitter); - - /* Test on EV6 and clear it */ - CODECTimeout = CODEC_FLAG_TIMEOUT; - while (!I2C_CheckEvent(CODEC_I2C, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)) - { - if((CODECTimeout--) == 0) return Codec_TIMEOUT_UserCallback(); - } - - /* Transmit the first address for write operation */ - I2C_SendData(CODEC_I2C, RegisterAddr); - - /* Test on EV8 and clear it */ - CODECTimeout = CODEC_FLAG_TIMEOUT; - while (!I2C_CheckEvent(CODEC_I2C, I2C_EVENT_MASTER_BYTE_TRANSMITTING)) - { - if((CODECTimeout--) == 0) return Codec_TIMEOUT_UserCallback(); - } - - /* Prepare the register value to be sent */ - I2C_SendData(CODEC_I2C, RegisterValue); - - /*!< Wait till all data have been physically transferred on the bus */ - CODECTimeout = CODEC_LONG_TIMEOUT; - while(!I2C_GetFlagStatus(CODEC_I2C, I2C_FLAG_BTF)) - { - if((CODECTimeout--) == 0) Codec_TIMEOUT_UserCallback(); - } - - /* End the configuration sequence */ - I2C_GenerateSTOP(CODEC_I2C, ENABLE); - -#ifdef VERIFY_WRITTENDATA - /* Verify that the data has been correctly written */ - result = (Codec_ReadRegister(RegisterAddr) == RegisterValue)? 0:1; -#endif /* VERIFY_WRITTENDATA */ - - /* Return the verifying value: 0 (Passed) or 1 (Failed) */ - return result; -} - -/** - * @brief Reads and returns the value of an audio codec register through the - * control interface (I2C). - * @param RegisterAddr: Address of the register to be read. - * @retval Value of the register to be read or dummy value if the communication - * fails. - */ -static uint32_t Codec_ReadRegister(uint8_t RegisterAddr) -{ - uint32_t result = 0; - - /*!< While the bus is busy */ - CODECTimeout = CODEC_LONG_TIMEOUT; - while(I2C_GetFlagStatus(CODEC_I2C, I2C_FLAG_BUSY)) - { - if((CODECTimeout--) == 0) return Codec_TIMEOUT_UserCallback(); - } - - /* Start the config sequence */ - I2C_GenerateSTART(CODEC_I2C, ENABLE); - - /* Test on EV5 and clear it */ - CODECTimeout = CODEC_FLAG_TIMEOUT; - while (!I2C_CheckEvent(CODEC_I2C, I2C_EVENT_MASTER_MODE_SELECT)) - { - if((CODECTimeout--) == 0) return Codec_TIMEOUT_UserCallback(); - } - - /* Transmit the slave address and enable writing operation */ - I2C_Send7bitAddress(CODEC_I2C, CODEC_ADDRESS, I2C_Direction_Transmitter); - - /* Test on EV6 and clear it */ - CODECTimeout = CODEC_FLAG_TIMEOUT; - while (!I2C_CheckEvent(CODEC_I2C, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)) - { - if((CODECTimeout--) == 0) return Codec_TIMEOUT_UserCallback(); - } - - /* Transmit the register address to be read */ - I2C_SendData(CODEC_I2C, RegisterAddr); - - /* Test on EV8 and clear it */ - CODECTimeout = CODEC_FLAG_TIMEOUT; - while (I2C_GetFlagStatus(CODEC_I2C, I2C_FLAG_BTF) == RESET) - { - if((CODECTimeout--) == 0) return Codec_TIMEOUT_UserCallback(); - } - - /*!< Send STRAT condition a second time */ - I2C_GenerateSTART(CODEC_I2C, ENABLE); - - /*!< Test on EV5 and clear it (cleared by reading SR1 then writing to DR) */ - CODECTimeout = CODEC_FLAG_TIMEOUT; - while(!I2C_CheckEvent(CODEC_I2C, I2C_EVENT_MASTER_MODE_SELECT)) - { - if((CODECTimeout--) == 0) return Codec_TIMEOUT_UserCallback(); - } - - /*!< Send Codec address for read */ - I2C_Send7bitAddress(CODEC_I2C, CODEC_ADDRESS, I2C_Direction_Receiver); - - /* Wait on ADDR flag to be set (ADDR is still not cleared at this level */ - CODECTimeout = CODEC_FLAG_TIMEOUT; - while(I2C_GetFlagStatus(CODEC_I2C, I2C_FLAG_ADDR) == RESET) - { - if((CODECTimeout--) == 0) return Codec_TIMEOUT_UserCallback(); - } - - /*!< Disable Acknowledgment */ - I2C_AcknowledgeConfig(CODEC_I2C, DISABLE); - - /* Clear ADDR register by reading SR1 then SR2 register (SR1 has already been read) */ - (void)CODEC_I2C->SR2; - - /*!< Send STOP Condition */ - I2C_GenerateSTOP(CODEC_I2C, ENABLE); - - /* Wait for the byte to be received */ - CODECTimeout = CODEC_FLAG_TIMEOUT; - while(I2C_GetFlagStatus(CODEC_I2C, I2C_FLAG_RXNE) == RESET) - { - if((CODECTimeout--) == 0) return Codec_TIMEOUT_UserCallback(); - } - - /*!< Read the byte received from the Codec */ - result = I2C_ReceiveData(CODEC_I2C); - - /* Wait to make sure that STOP flag has been cleared */ - CODECTimeout = CODEC_FLAG_TIMEOUT; - while(CODEC_I2C->CR1 & I2C_CR1_STOP) - { - if((CODECTimeout--) == 0) return Codec_TIMEOUT_UserCallback(); - } - - /*!< Re-Enable Acknowledgment to be ready for another reception */ - I2C_AcknowledgeConfig(CODEC_I2C, ENABLE); - - /* Clear AF flag for next communication */ - I2C_ClearFlag(CODEC_I2C, I2C_FLAG_AF); - - /* Return the byte read from Codec */ - return result; -} - -/** - * @brief Initializes the Audio Codec control interface (I2C). - * @param None - * @retval None - */ -static void Codec_CtrlInterface_Init(void) -{ - I2C_InitTypeDef I2C_InitStructure; - - /* Enable the CODEC_I2C peripheral clock */ - RCC_APB1PeriphClockCmd(CODEC_I2C_CLK, ENABLE); - - /* If the I2C peripheral is already enabled, don't reconfigure it */ - if ((CODEC_I2C->CR1 & I2C_CR1_PE) != 0) - { - /* CODEC_I2C peripheral configuration */ - I2C_DeInit(CODEC_I2C); - I2C_InitStructure.I2C_Mode = I2C_Mode_I2C; - I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2; - I2C_InitStructure.I2C_OwnAddress1 = 0x33; - I2C_InitStructure.I2C_Ack = I2C_Ack_Enable; - I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit; - I2C_InitStructure.I2C_ClockSpeed = I2C_SPEED; - - /* Enable the I2C peripheral */ - I2C_Cmd(CODEC_I2C, ENABLE); - - /* Initialize the I2C peripheral */ - I2C_Init(CODEC_I2C, &I2C_InitStructure); - } -} - -/** - * @brief Restore the Audio Codec control interface to its default state. - * This function doesn't de-initialize the I2C because the I2C peripheral - * may be used by other modules. - * @param None - * @retval None - */ -static void Codec_CtrlInterface_DeInit(void) -{ - /* Disable the I2C peripheral */ /* This step is not done here because - the I2C interface can be used by other modules */ - /* I2C_DeInit(CODEC_I2C); */ -} - -/** - * @brief Initializes the Audio Codec audio interface (I2S) - * @note This function assumes that the I2S input clock (through PLL_R in - * Devices RevA/Z and through dedicated PLLI2S_R in Devices RevB/Y) - * is already configured and ready to be used. - * @param AudioFreq: Audio frequency to be configured for the I2S peripheral. - * @retval None - */ -static void Codec_AudioInterface_Init(uint32_t AudioFreq) -{ - I2S_InitTypeDef I2S_InitStructure; - - /* Enable the CODEC_I2S peripheral clock */ - RCC_APB1PeriphClockCmd(CODEC_I2S_CLK, ENABLE); - - /* CODEC_I2S peripheral configuration */ - SPI_I2S_DeInit(CODEC_I2S); - I2S_InitStructure.I2S_AudioFreq = AudioFreq; - I2S_InitStructure.I2S_Standard = I2S_STANDARD; - I2S_InitStructure.I2S_DataFormat = I2S_DataFormat_16b; - I2S_InitStructure.I2S_CPOL = I2S_CPOL_Low; - I2S_InitStructure.I2S_Mode = I2S_Mode_MasterTx; -#ifdef CODEC_MCLK_ENABLED - I2S_InitStructure.I2S_MCLKOutput = I2S_MCLKOutput_Enable; -#elif defined(CODEC_MCLK_DISABLED) - I2S_InitStructure.I2S_MCLKOutput = I2S_MCLKOutput_Disable; -#else - #error "No selection for the MCLK output has been defined !" -#endif /* CODEC_MCLK_ENABLED */ - - /* Initialize the I2S peripheral with the structure above */ - I2S_Init(CODEC_I2S, &I2S_InitStructure); - - /* The I2S peripheral will be enabled only in the EVAL_AUDIO_Play() function - or by user functions if DMA mode not enabled */ -} - -/** - * @brief Restores the Audio Codec audio interface to its default state. - * @param None - * @retval None - */ -static void Codec_AudioInterface_DeInit(void) -{ - /* Disable the CODEC_I2S peripheral (in case it hasn't already been disabled) */ - I2S_Cmd(CODEC_I2S, DISABLE); - - /* Deinitialize the CODEC_I2S peripheral */ - SPI_I2S_DeInit(CODEC_I2S); - - /* Disable the CODEC_I2S peripheral clock */ - RCC_APB1PeriphClockCmd(CODEC_I2S_CLK, DISABLE); -} - -/** - * @brief Initializes IOs used by the Audio Codec (on the control and audio - * interfaces). - * @param None - * @retval None - */ -static void Codec_GPIO_Init(void) -{ - GPIO_InitTypeDef GPIO_InitStructure; - - /* Enable I2S and I2C GPIO clocks */ - RCC_AHB1PeriphClockCmd(CODEC_I2C_GPIO_CLOCK | CODEC_I2S_GPIO_CLOCK, ENABLE); - - /* CODEC_I2C SCL and SDA pins configuration -------------------------------------*/ - /* If the I2C peripheral is already enabled, don't reconfigure it */ - if ((CODEC_I2C->CR1 & I2C_CR1_PE) != 0) - { - GPIO_InitStructure.GPIO_Pin = CODEC_I2C_SCL_PIN | CODEC_I2C_SDA_PIN; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_InitStructure.GPIO_OType = GPIO_OType_OD; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - GPIO_Init(CODEC_I2C_GPIO, &GPIO_InitStructure); - /* Connect pins to Periph */ - GPIO_PinAFConfig(CODEC_I2C_GPIO, CODEC_I2S_SCL_PINSRC, CODEC_I2C_GPIO_AF); - GPIO_PinAFConfig(CODEC_I2C_GPIO, CODEC_I2S_SDA_PINSRC, CODEC_I2C_GPIO_AF); - } - - /* CODEC_I2S pins configuration: WS, SCK and SD pins -----------------------------*/ - GPIO_InitStructure.GPIO_Pin = CODEC_I2S_WS_PIN | CODEC_I2S_SCK_PIN | CODEC_I2S_SD_PIN; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - GPIO_Init(CODEC_I2S_GPIO, &GPIO_InitStructure); - /* Connect pins to I2S peripheral */ - GPIO_PinAFConfig(CODEC_I2S_GPIO, CODEC_I2S_WS_PINSRC, CODEC_I2S_GPIO_AF); - GPIO_PinAFConfig(CODEC_I2S_GPIO, CODEC_I2S_SCK_PINSRC, CODEC_I2S_GPIO_AF); - GPIO_PinAFConfig(CODEC_I2S_GPIO, CODEC_I2S_SD_PINSRC, CODEC_I2S_GPIO_AF); - - #ifdef CODEC_MCLK_ENABLED - /* CODEC_I2S pins configuration: MCK pin */ - GPIO_InitStructure.GPIO_Pin = CODEC_I2S_MCK_PIN; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - GPIO_Init(CODEC_I2S_MCK_GPIO, &GPIO_InitStructure); - /* Connect pins to I2S peripheral */ - GPIO_PinAFConfig(CODEC_I2S_MCK_GPIO, CODEC_I2S_MCK_PINSRC, CODEC_I2S_GPIO_AF); - #endif /* CODEC_MCLK_ENABLED */ -} - -/** - * @brief Restores the IOs used by the Audio Codec interface to their default state. - * @param None - * @retval None - */ -static void Codec_GPIO_DeInit(void) -{ - GPIO_InitTypeDef GPIO_InitStructure; - - /* Deinitialize all the GPIOs used by the driver (EXCEPT the I2C IOs since - they are used by the IOExpander as well) */ - GPIO_InitStructure.GPIO_Pin = CODEC_I2S_WS_PIN | CODEC_I2S_SCK_PIN | CODEC_I2S_SD_PIN; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; - GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - GPIO_Init(CODEC_I2S_GPIO, &GPIO_InitStructure); - /* Disconnect pins from I2S peripheral */ - GPIO_PinAFConfig(CODEC_I2S_GPIO, CODEC_I2S_WS_PIN, 0x00); - GPIO_PinAFConfig(CODEC_I2S_GPIO, CODEC_I2S_SCK_PIN, 0x00); - GPIO_PinAFConfig(CODEC_I2S_GPIO, CODEC_I2S_SD_PIN, 0x00); - -#ifdef CODEC_MCLK_ENABLED - /* CODEC_I2S pins deinitialization: MCK pin */ - GPIO_InitStructure.GPIO_Pin = CODEC_I2S_MCK_PIN; - GPIO_Init(CODEC_I2S_MCK_GPIO, &GPIO_InitStructure); - /* Disconnect pins from I2S peripheral */ - GPIO_PinAFConfig(CODEC_I2S_MCK_GPIO, CODEC_I2S_MCK_PINSRC, CODEC_I2S_GPIO_AF); -#endif /* CODEC_MCLK_ENABLED */ -} - -/** - * @brief Inserts a delay time (not accurate timing). - * @param nCount: specifies the delay time length. - * @retval None - */ -static void Delay( __IO uint32_t nCount) -{ - for (; nCount != 0; nCount--); -} - -#ifdef USE_DEFAULT_TIMEOUT_CALLBACK -/** - * @brief Basic management of the timeout situation. - * @param None - * @retval None - */ -uint32_t Codec_TIMEOUT_UserCallback(void) -{ - /* The following code allows I2C error recovery and return to normal communication - if the error source doesn’t still exist (ie. hardware issue..) */ - I2C_InitTypeDef I2C_InitStructure; - - /* LCD_ErrLog("> I2C Timeout error occurred\n"); */ - - I2C_GenerateSTOP(CODEC_I2C, ENABLE); - I2C_SoftwareResetCmd(CODEC_I2C, ENABLE); - I2C_SoftwareResetCmd(CODEC_I2C, DISABLE); - - /* CODEC_I2C peripheral configuration */ - I2C_DeInit(CODEC_I2C); - I2C_InitStructure.I2C_Mode = I2C_Mode_I2C; - I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2; - I2C_InitStructure.I2C_OwnAddress1 = 0x33; - I2C_InitStructure.I2C_Ack = I2C_Ack_Enable; - I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit; - I2C_InitStructure.I2C_ClockSpeed = I2C_SPEED; - /* Enable the I2C peripheral */ - I2C_Cmd(CODEC_I2C, ENABLE); - I2C_Init(CODEC_I2C, &I2C_InitStructure); - - /* At this stage the I2C error should be recovered and device can communicate - again (except if the error source still exist). - User can implement mechanism (ex. test on max trial number) to manage situation - when the I2C can't recover from current error. */ - - /* LCD_UsrLog("> I2C error recovered.\n"); */ - - return 0; -} -#endif /* USE_DEFAULT_TIMEOUT_CALLBACK */ -/*======================== - - Audio MAL Interface Control Functions - - ==============================*/ - -/** - * @brief Initializes and prepares the Media to perform audio data transfer - * from Media to the I2S peripheral. - * @param None - * @retval None - */ -static void Audio_MAL_Init(void) -{ -#if defined(AUDIO_MAL_DMA_IT_TC_EN) || defined(AUDIO_MAL_DMA_IT_HT_EN) || defined(AUDIO_MAL_DMA_IT_TE_EN) - NVIC_InitTypeDef NVIC_InitStructure; -#endif - - /* Enable the DMA clock */ - RCC_AHB1PeriphClockCmd(AUDIO_MAL_DMA_CLOCK, ENABLE); - - /* Configure the DMA Stream */ - DMA_Cmd(AUDIO_MAL_DMA_STREAM, DISABLE); - DMA_DeInit(AUDIO_MAL_DMA_STREAM); - /* Set the parameters to be configured */ - DMA_InitStructure.DMA_Channel = AUDIO_MAL_DMA_CHANNEL; - DMA_InitStructure.DMA_PeripheralBaseAddr = CODEC_I2S_ADDRESS; - DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)0; /* This field will be configured in play function */ - DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral; - DMA_InitStructure.DMA_BufferSize = (uint32_t)0xFFFE; /* This field will be configured in play function */ - DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; - DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; - DMA_InitStructure.DMA_PeripheralDataSize = AUDIO_MAL_DMA_PERIPH_DATA_SIZE; - DMA_InitStructure.DMA_MemoryDataSize = AUDIO_MAL_DMA_MEM_DATA_SIZE; -#ifdef AUDIO_MAL_MODE_NORMAL - DMA_InitStructure.DMA_Mode = DMA_Mode_Normal; -#elif defined(AUDIO_MAL_MODE_CIRCULAR) - DMA_InitStructure.DMA_Mode = DMA_Mode_Circular; -#else - #error "AUDIO_MAL_MODE_NORMAL or AUDIO_MAL_MODE_CIRCULAR should be selected !!" -#endif /* AUDIO_MAL_MODE_NORMAL */ - DMA_InitStructure.DMA_Priority = DMA_Priority_High; - DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Enable; - DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full; - DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single; - DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single; - DMA_Init(AUDIO_MAL_DMA_STREAM, &DMA_InitStructure); - - /* Enable the selected DMA interrupts (selected in "stm32_eval_audio_codec.h" defines) */ -#ifdef AUDIO_MAL_DMA_IT_TC_EN - DMA_ITConfig(AUDIO_MAL_DMA_STREAM, DMA_IT_TC, ENABLE); -#endif /* AUDIO_MAL_DMA_IT_TC_EN */ -#ifdef AUDIO_MAL_DMA_IT_HT_EN - DMA_ITConfig(AUDIO_MAL_DMA_STREAM, DMA_IT_HT, ENABLE); -#endif /* AUDIO_MAL_DMA_IT_HT_EN */ -#ifdef AUDIO_MAL_DMA_IT_TE_EN - DMA_ITConfig(AUDIO_MAL_DMA_STREAM, DMA_IT_TE | DMA_IT_FE | DMA_IT_DME, ENABLE); -#endif /* AUDIO_MAL_DMA_IT_TE_EN */ - - /* Enable the I2S DMA request */ - SPI_I2S_DMACmd(CODEC_I2S, SPI_I2S_DMAReq_Tx, ENABLE); - -#if defined(AUDIO_MAL_DMA_IT_TC_EN) || defined(AUDIO_MAL_DMA_IT_HT_EN) || defined(AUDIO_MAL_DMA_IT_TE_EN) - /* I2S DMA IRQ Channel configuration */ - NVIC_InitStructure.NVIC_IRQChannel = AUDIO_MAL_DMA_IRQ; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = EVAL_AUDIO_IRQ_PREPRIO; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = EVAL_AUDIO_IRQ_SUBRIO; - NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - NVIC_Init(&NVIC_InitStructure); -#endif -} - -/** - * @brief Restore default state of the used Media. - * @param None - * @retval None - */ -static void Audio_MAL_DeInit(void) -{ -#if defined(AUDIO_MAL_DMA_IT_TC_EN) || defined(AUDIO_MAL_DMA_IT_HT_EN) || defined(AUDIO_MAL_DMA_IT_TE_EN) - NVIC_InitTypeDef NVIC_InitStructure; - - /* Deinitialize the NVIC interrupt for the I2S DMA Stream */ - NVIC_InitStructure.NVIC_IRQChannel = AUDIO_MAL_DMA_IRQ; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = EVAL_AUDIO_IRQ_PREPRIO; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = EVAL_AUDIO_IRQ_SUBRIO; - NVIC_InitStructure.NVIC_IRQChannelCmd = DISABLE; - NVIC_Init(&NVIC_InitStructure); -#endif - - /* Disable the DMA stream before the deinit */ - DMA_Cmd(AUDIO_MAL_DMA_STREAM, DISABLE); - - /* Dinitialize the DMA Stream */ - DMA_DeInit(AUDIO_MAL_DMA_STREAM); - - /* - The DMA clock is not disabled, since it can be used by other streams - */ -} - -/** - * @brief Starts playing audio stream from the audio Media. - * @param None - * @retval None - */ -static void Audio_MAL_Play(uint32_t Addr, uint32_t Size) -{ - /* Configure the buffer address and size */ - DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)Addr; - DMA_InitStructure.DMA_BufferSize = (uint32_t)Size; - - /* Configure the DMA Stream with the new parameters */ - DMA_Init(AUDIO_MAL_DMA_STREAM, &DMA_InitStructure); - - /* Enable the I2S DMA Stream*/ - DMA_Cmd(AUDIO_MAL_DMA_STREAM, ENABLE); - - /* If the I2S peripheral is still not enabled, enable it */ - if ((CODEC_I2S->I2SCFGR & I2S_ENABLE_MASK) == 0) - { - I2S_Cmd(CODEC_I2S, ENABLE); - } -} - -/** - * @brief Pauses or Resumes the audio stream playing from the Media. - * @param Cmd: AUDIO_PAUSE (or 0) to pause, AUDIO_RESUME (or any value different - * from 0) to resume. - * @param Addr: Address from/at which the audio stream should resume/pause. - * @retval None - */ -static void Audio_MAL_PauseResume(uint32_t Cmd, uint32_t Addr) -{ - /* Pause the audio file playing */ - if (Cmd == AUDIO_PAUSE) - { - /* Disable the I2S DMA request */ - SPI_I2S_DMACmd(CODEC_I2S, SPI_I2S_DMAReq_Tx, DISABLE); - - /* Pause the I2S DMA Stream - Note. For the STM32F2xx devices, the DMA implements a pause feature, - by disabling the stream, all configuration is preserved and data - transfer is paused till the next enable of the stream.*/ - DMA_Cmd(AUDIO_MAL_DMA_STREAM, DISABLE); - } - else /* AUDIO_RESUME */ - { - /* Enable the I2S DMA request */ - SPI_I2S_DMACmd(CODEC_I2S, SPI_I2S_DMAReq_Tx, ENABLE); - - /* Resume the I2S DMA Stream - Note. For the STM32F2xx devices, the DMA implements a pause feature, - by disabling the stream, all configuration is preserved and data - transfer is paused till the next enable of the stream.*/ - DMA_Cmd(AUDIO_MAL_DMA_STREAM, ENABLE); - - /* If the I2S peripheral is still not enabled, enable it */ - if ((CODEC_I2S->I2SCFGR & I2S_ENABLE_MASK) == 0) - { - I2S_Cmd(CODEC_I2S, ENABLE); - } - } -} - -/** - * @brief Stops audio stream playing on the used Media. - * @param None - * @retval None - */ -static void Audio_MAL_Stop(void) -{ - /* Stop the Transfer on the I2S side: Stop and disable the DMA stream */ - DMA_Cmd(AUDIO_MAL_DMA_STREAM, DISABLE); - - /* Clear all the DMA flags for the next transfer */ - DMA_ClearFlag(AUDIO_MAL_DMA_STREAM, AUDIO_MAL_DMA_FLAG_TC |AUDIO_MAL_DMA_FLAG_HT | \ - AUDIO_MAL_DMA_FLAG_FE | AUDIO_MAL_DMA_FLAG_TE); - - /* - The I2S DMA requests are not disabled here. - */ - - /* In all modes, disable the I2S peripheral */ - I2S_Cmd(CODEC_I2S, DISABLE); -} - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_audio_codec.h b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_audio_codec.h deleted file mode 100644 index b648678fa..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_audio_codec.h +++ /dev/null @@ -1,278 +0,0 @@ -/** - ****************************************************************************** - * @file stm322xg_eval_audio_codec.h - * @author MCD Application Team - * @version V5.0.3 - * @date 09-March-2012 - * @brief This file contains all the functions prototypes for the - * stm322xg_eval_audio_codec.c driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __STM322xG_EVAL_AUDIOCODEC_H -#define __STM322xG_EVAL_AUDIOCODEC_H - -/* Includes ------------------------------------------------------------------*/ -#include "stm322xg_eval.h" -#include "stm322xg_eval_ioe.h" /* IOExpander driver is included in order to allow - CS43L22 codec reset pin managment on the - evaluation board */ - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL - * @{ - */ - -/** @defgroup STM322xG_EVAL_AUDIO_CODEC - * @{ - */ - - -/** @defgroup STM322xG_EVAL_AUDIO_CODEC_Exported_Types - * @{ - */ - -/** @defgroup STM322xG_EVAL_AUDIO_CODEC_Exported_Constants - * @{ - */ - -/*------------------------------------ - CONFIGURATION: Audio Codec Driver Configuration parameters - ----------------------------------------*/ -/* Audio Transfer mode (DMA, Interrupt or Polling) */ -#define AUDIO_MAL_MODE_NORMAL /* Uncomment this line to enable the audio - Transfer using DMA */ -/* #define AUDIO_MAL_MODE_CIRCULAR */ /* Uncomment this line to enable the audio - Transfer using DMA */ - -/* For the DMA modes select the interrupt that will be used */ -#define AUDIO_MAL_DMA_IT_TC_EN /* Uncomment this line to enable DMA Transfer Complete interrupt */ -/* #define AUDIO_MAL_DMA_IT_HT_EN */ /* Uncomment this line to enable DMA Half Transfer Complete interrupt */ -/* #define AUDIO_MAL_DMA_IT_TE_EN */ /* Uncomment this line to enable DMA Transfer Error interrupt */ - -/* Select the interrupt preemption priority and subpriority for the DMA interrupt */ -#define EVAL_AUDIO_IRQ_PREPRIO 0 /* Select the preemption priority level(0 is the highest) */ -#define EVAL_AUDIO_IRQ_SUBRIO 0 /* Select the sub-priority level (0 is the highest) */ - -/* Uncomment the following line to use the default Codec_TIMEOUT_UserCallback() - function implemented in stm322xg_eval_audio_codec.c file. - Codec_TIMEOUT_UserCallback() function is called whenever a timeout condition - occurs during communication (waiting on an event that doesn't occur, bus - errors, busy devices ...). */ -/* #define USE_DEFAULT_TIMEOUT_CALLBACK */ -/*----------------------------------------------------------------------------*/ - -/*------------------------------------ - OPTIONAL Configuration defines parameters - ----------------------------------------*/ -/* I2C clock speed configuration (in Hz) - WARNING: - Make sure that this define is not already declared in other files (ie. - stm322xg_eval.h file). It can be used in parallel by other modules. */ -#ifndef I2C_SPEED - #define I2C_SPEED 100000 -#endif /* I2C_SPEED */ - -/* Uncomment defines below to select standard for audio communication between - Codec and I2S peripheral */ -#define I2S_STANDARD_PHILLIPS -/* #define I2S_STANDARD_MSB */ -/* #define I2S_STANDARD_LSB */ - -/* Uncomment the defines below to select if the Master clock mode should be - enabled or not */ -#define CODEC_MCLK_ENABLED -/* #deine CODEC_MCLK_DISABLED */ - -/* Uncomment this line to enable verifying data sent to codec after each write - operation */ -#define VERIFY_WRITTENDATA -/*----------------------------------------------------------------------------*/ - -/*----------------------------------- - Hardware Configuration defines parameters - -----------------------------------------*/ -/* I2S peripheral configuration defines */ -#define CODEC_I2S SPI2 -#define CODEC_I2S_CLK RCC_APB1Periph_SPI2 -#define CODEC_I2S_ADDRESS 0x4000380C -#define CODEC_I2S_GPIO_AF GPIO_AF_SPI2 -#define CODEC_I2S_IRQ SPI2_IRQn -#define CODEC_I2S_GPIO_CLOCK (RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOI) -#define CODEC_I2S_WS_PIN GPIO_Pin_0 -#define CODEC_I2S_SCK_PIN GPIO_Pin_1 -#define CODEC_I2S_SD_PIN GPIO_Pin_3 -#define CODEC_I2S_MCK_PIN GPIO_Pin_6 -#define CODEC_I2S_WS_PINSRC GPIO_PinSource0 -#define CODEC_I2S_SCK_PINSRC GPIO_PinSource1 -#define CODEC_I2S_SD_PINSRC GPIO_PinSource3 -#define CODEC_I2S_MCK_PINSRC GPIO_PinSource6 -#define CODEC_I2S_GPIO GPIOI -#define CODEC_I2S_MCK_GPIO GPIOC - - - /* I2S DMA Stream definitions */ - #define AUDIO_MAL_DMA_CLOCK RCC_AHB1Periph_DMA1 - #define AUDIO_MAL_DMA_STREAM DMA1_Stream4 - #define AUDIO_MAL_DMA_CHANNEL DMA_Channel_0 - #define AUDIO_MAL_DMA_IRQ DMA1_Stream4_IRQn - #define AUDIO_MAL_DMA_FLAG_TC DMA_FLAG_TCIF4 - #define AUDIO_MAL_DMA_FLAG_HT DMA_FLAG_HTIF4 - #define AUDIO_MAL_DMA_FLAG_FE DMA_FLAG_FEIF4 - #define AUDIO_MAL_DMA_FLAG_TE DMA_FLAG_TEIF4 - #define AUDIO_MAL_DMA_FLAG_DME DMA_FLAG_DMEIF4 - #define AUDIO_MAL_DMA_PERIPH_DATA_SIZE DMA_PeripheralDataSize_HalfWord - #define AUDIO_MAL_DMA_MEM_DATA_SIZE DMA_MemoryDataSize_HalfWord - #define DMA_MAX_SZE 0xFFFF - - #define Audio_MAL_IRQHandler DMA1_Stream4_IRQHandler - -/* I2C peripheral configuration defines (control interface of the audio codec) */ -#define CODEC_I2C I2C1 -#define CODEC_I2C_CLK RCC_APB1Periph_I2C1 -#define CODEC_I2C_GPIO_CLOCK RCC_AHB1Periph_GPIOB -#define CODEC_I2C_GPIO_AF GPIO_AF_I2C1 -#define CODEC_I2C_GPIO GPIOB -#define CODEC_I2C_SCL_PIN GPIO_Pin_6 -#define CODEC_I2C_SDA_PIN GPIO_Pin_9 -#define CODEC_I2S_SCL_PINSRC GPIO_PinSource6 -#define CODEC_I2S_SDA_PINSRC GPIO_PinSource9 - -/* Maximum Timeout values for flags and events waiting loops. These timeouts are - not based on accurate values, they just guarantee that the application will - not remain stuck if the I2C communication is corrupted. - You may modify these timeout values depending on CPU frequency and application - conditions (interrupts routines ...). */ -#define CODEC_FLAG_TIMEOUT ((uint32_t)0x1000) -#define CODEC_LONG_TIMEOUT ((uint32_t)(300 * CODEC_FLAG_TIMEOUT)) -/*----------------------------------------------------------------------------*/ - -/*----------------------------------- - Audio Codec User defines - -----------------------------------------*/ -/* Codec output DEVICE */ -#define OUTPUT_DEVICE_SPEAKER 1 -#define OUTPUT_DEVICE_HEADPHONE 2 -#define OUTPUT_DEVICE_BOTH 3 -#define OUTPUT_DEVICE_AUTO 4 - -/* Volume Levels values */ -#define DEFAULT_VOLMIN 0x00 -#define DEFAULT_VOLMAX 0xFF -#define DEFAULT_VOLSTEP 0x04 - -#define AUDIO_PAUSE 0 -#define AUDIO_RESUME 1 - -/* Codec POWER DOWN modes */ -#define CODEC_PDWN_HW 1 -#define CODEC_PDWN_SW 2 - -/* MUTE commands */ -#define AUDIO_MUTE_ON 1 -#define AUDIO_MUTE_OFF 0 -/*----------------------------------------------------------------------------*/ -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_AUDIO_CODEC_Exported_Macros - * @{ - */ -#define VOLUME_CONVERT(x) ((Volume > 100)? 100:((uint8_t)((Volume * 255) / 100))) -#define DMA_MAX(x) (((x) <= DMA_MAX_SZE)? (x):DMA_MAX_SZE) - -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_AUDIO_CODEC_Exported_Functions - * @{ - */ - -uint32_t EVAL_AUDIO_Init(uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq); -uint32_t EVAL_AUDIO_DeInit(void); -uint32_t EVAL_AUDIO_Play(uint16_t* pBuffer, uint32_t Size); -uint32_t EVAL_AUDIO_PauseResume(uint32_t Cmd); -uint32_t EVAL_AUDIO_Stop(uint32_t CodecPowerDown_Mode); -uint32_t EVAL_AUDIO_VolumeCtl(uint8_t Volume); -uint32_t EVAL_AUDIO_Mute(uint32_t Command); - -uint32_t Codec_SwitchOutput(uint8_t Output); - -/* User Callbacks: user has to implement these functions in his code if - they are needed. -----------------------------------------------------------*/ - -/* This function is called when the requested data has been completely transferred. - In Normal mode (when the define AUDIO_MAL_MODE_NORMAL is enabled) this function - is called at the end of the whole audio file. - In circular mode (when the define AUDIO_MAL_MODE_CIRCULAR is enabled) this - function is called at the end of the current buffer transmission. */ -void EVAL_AUDIO_TransferComplete_CallBack(uint32_t pBuffer, uint32_t Size); - -/* This function is called when half of the requested buffer has been transferred - This callback is useful in Circular mode only (when AUDIO_MAL_MODE_CIRCULAR - define is enabled)*/ -void EVAL_AUDIO_HalfTransfer_CallBack(uint32_t pBuffer, uint32_t Size); - -/* This function is called when an Interrupt due to transfer error on or peripheral - error occurs. */ -void EVAL_AUDIO_Error_CallBack(void* pData); - -/* Codec_TIMEOUT_UserCallback() function is called whenever a timeout condition - occurs during communication (waiting on an event that doesn't occur, bus - errors, busy devices ...) on the Codec control interface (I2C). - You can use the default timeout callback implementation by uncommenting the - define USE_DEFAULT_TIMEOUT_CALLBACK in stm322xg_eval_audio_codec.h file. - Typically the user implementation of this callback should reset I2C peripheral - and re-initialize communication or in worst case reset all the application. */ -uint32_t Codec_TIMEOUT_UserCallback(void); - -#endif /* __STM322xG_EVAL_AUDIOCODEC_H */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_fsmc_onenand.c b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_fsmc_onenand.c deleted file mode 100644 index fa7522406..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_fsmc_onenand.c +++ /dev/null @@ -1,567 +0,0 @@ -/** - ****************************************************************************** - * @file stm322xg_eval_fsmc_onenand.c - * @author MCD Application Team - * @version V5.0.3 - * @date 09-March-2012 - * @brief This file provides a set of functions needed to drive the - * KFG1216U2A/B-DIB6 OneNAND memory mounted on STM322xG-EVAL evaluation - * board(MB786) RevA. - * - * Note: This memory is not available on the RevB of the board. - * - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "stm322xg_eval_fsmc_onenand.h" - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL_FSMC_ONENAND - * @brief This file provides a set of functions needed to drive the - * KFG1216U2A/B-DIB6 OneNAND memory mounted on STM322xG-EVAL board. - * @{ - */ - -/** @defgroup STM322xG_EVAL_FSMC_ONENAND_Private_Types - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_FSMC_ONENAND_Private_Defines - * @{ - */ -#define BANK1_ONENAND1_ADDR ((uint32_t)0x60000000) -#define ONENAND_BOOTPARTITION_ADDR ((uint32_t)BANK1_ONENAND1_ADDR) - - -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_FSMC_ONENAND_Private_Macros - * @{ - */ -#define OneNAND_WRITE(Address, Data) (*(__IO uint16_t *)(Address) = (Data)) - -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_FSMC_ONENAND_Private_Variables - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_FSMC_ONENAND_Private_Function_Prototypes - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_FSMC_ONENAND_Private_Functions - * @{ - */ - -/** - * @brief Configures the FSMC and GPIOs to interface with the OneNAND memory. - * This function must be called before any write/read operation on the - * OneNAND. - * @param None - * @retval None - */ -void OneNAND_Init(void) -{ - FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure; - FSMC_NORSRAMTimingInitTypeDef p; - GPIO_InitTypeDef GPIO_InitStructure; - - RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOG | RCC_AHB1Periph_GPIOE | - RCC_AHB1Periph_GPIOF | RCC_AHB1Periph_GPIOB, ENABLE); - - RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); - - RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE); - -/*-- GPIO Configuration ------------------------------------------------------*/ - /* OneNAND Data lines configuration */ - GPIO_PinAFConfig(GPIOD, GPIO_PinSource14, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource15, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource0, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource1, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource8, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource9, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource10, GPIO_AF_FSMC); - - GPIO_PinAFConfig(GPIOE, GPIO_PinSource7, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource8, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource9, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource10, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource11, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource12, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource13, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource14, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource15, GPIO_AF_FSMC); - - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_8 | GPIO_Pin_9 | - GPIO_Pin_14 | GPIO_Pin_15 |GPIO_Pin_10; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; - GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; - - GPIO_Init(GPIOD, &GPIO_InitStructure); - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | - GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 |GPIO_Pin_15; - - GPIO_Init(GPIOE, &GPIO_InitStructure); - - /* OneNAND Address lines configuration */ - GPIO_PinAFConfig(GPIOF,GPIO_PinSource0, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF,GPIO_PinSource1, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF,GPIO_PinSource2, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF,GPIO_PinSource3, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF,GPIO_PinSource4, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF,GPIO_PinSource5, GPIO_AF_FSMC); - - GPIO_PinAFConfig(GPIOF,GPIO_PinSource12, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF,GPIO_PinSource13, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF,GPIO_PinSource14, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF,GPIO_PinSource15, GPIO_AF_FSMC); - - GPIO_PinAFConfig(GPIOG,GPIO_PinSource0, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOG,GPIO_PinSource1, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOG,GPIO_PinSource2, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOG,GPIO_PinSource3, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOG,GPIO_PinSource4, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOG,GPIO_PinSource5, GPIO_AF_FSMC); - - GPIO_PinAFConfig(GPIOD,GPIO_PinSource11, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD,GPIO_PinSource12, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD,GPIO_PinSource13, GPIO_AF_FSMC); - - GPIO_PinAFConfig(GPIOE,GPIO_PinSource3, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE,GPIO_PinSource4, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE,GPIO_PinSource5, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE,GPIO_PinSource6, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE,GPIO_PinSource2, GPIO_AF_FSMC); - - GPIO_PinAFConfig(GPIOG,GPIO_PinSource13, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOG,GPIO_PinSource14, GPIO_AF_FSMC); - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | - GPIO_Pin_4 | GPIO_Pin_5 |GPIO_Pin_12 | GPIO_Pin_13 | - GPIO_Pin_14 | GPIO_Pin_15; - - GPIO_Init(GPIOF, &GPIO_InitStructure); - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | - GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_13 | GPIO_Pin_14; - - GPIO_Init(GPIOG, &GPIO_InitStructure); - - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13; - - GPIO_Init(GPIOD, &GPIO_InitStructure); - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4| GPIO_Pin_5 | GPIO_Pin_6; - - GPIO_Init(GPIOE, &GPIO_InitStructure); - - - /* NOE, NWE and CLK configuration */ - GPIO_PinAFConfig(GPIOD,GPIO_PinSource3, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD,GPIO_PinSource4, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD,GPIO_PinSource5, GPIO_AF_FSMC); - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 |GPIO_Pin_5 | GPIO_Pin_3; - - GPIO_Init(GPIOD, &GPIO_InitStructure); - - - /* NE1 configuration */ - GPIO_PinAFConfig(GPIOD, GPIO_PinSource7, GPIO_AF_FSMC); - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7; - - GPIO_Init(GPIOD, &GPIO_InitStructure); - - /* NL configuration */ - GPIO_PinAFConfig(GPIOB,GPIO_PinSource7, GPIO_AF_FSMC); - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7; - GPIO_Init(GPIOB, &GPIO_InitStructure); - - /* NWAIT Configuration */ - GPIO_PinAFConfig(GPIOD,GPIO_PinSource6, GPIO_AF_FSMC); - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6; - GPIO_Init(GPIOD, &GPIO_InitStructure); - - /*-- FSMC Configuration ----------------------------------------------------*/ - p.FSMC_AddressSetupTime = 0x03; - p.FSMC_AddressHoldTime = 0x00; - p.FSMC_DataSetupTime = 0x0C; - p.FSMC_BusTurnAroundDuration = 0x01; - p.FSMC_CLKDivision = 0x2; - p.FSMC_DataLatency = 0x00; - p.FSMC_AccessMode = FSMC_AccessMode_B; - - FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM1; - FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable; - FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_NOR; - FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b; - FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Enable; - FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable; - FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low; - FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable; - FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState; - FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable; - FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable; - FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable; - FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable; - FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p; - FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p; - - FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure); - FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM1, ENABLE); -} - -/** - * @brief Resets the OneNAND memory. - * @param None - * @retval None - */ -void OneNAND_Reset(void) -{ - OneNAND_WRITE(ONENAND_BOOTPARTITION_ADDR, OneNAND_CMD_RESET); -} - -/** - * @brief Reads OneNAND memory's Manufacturer and Device Code. - * @param OneNAND_ID: pointer to a OneNAND_IDTypeDef structure which will hold - * the Manufacturer and Device Code. - * @retval None - */ -void OneNAND_ReadID(OneNAND_IDTypeDef* OneNAND_ID) -{ - uint16_t status = 0x0; - - /* Wait till no ongoing operation */ - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_CONTROLSTATUS); - - while((status & 0x8000) == 0x8000) - { - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_CONTROLSTATUS); - } - - /* Read ID data */ - OneNAND_ID->Manufacturer_ID = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_MANUFACTERID); - OneNAND_ID->Device_ID = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_DEVICEID); - - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_SYSTEMCONFIGURATION) = 0x40E0; -} - -/** - * @brief Unlocks the specified OneNAND memory block (128Kb). - * @param BlockNumber: specifies the block number to be erased. This parameter - * should be between 0 and 511. - * @retval OneNAND memory Interrupt Status. - */ -uint16_t OneNAND_UnlockBlock(uint16_t BlockNumber) -{ - uint16_t status = 0; - - /* Wait till no ongoing operation */ - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_CONTROLSTATUS); - - while((status & 0x8000) == 0x8000) - { - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_CONTROLSTATUS); - } - - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_STARTBLOCKADDRESS) = BlockNumber; - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_INTERRUPT) = 0x0000; - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_COMMAND) = OneNAND_CMD_UNLOCK; - - /* Wait till the command is completed */ - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_INTERRUPT); - - while((status & 0x8000) != 0x8000) - { - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_INTERRUPT); - } - - /* Get the Controller Status */ - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_CONTROLSTATUS); - - return (status); -} - -/** - * @brief Erases the specified OneNAND memory block (128Kb). - * @param BlockNumber: specifies the block number to be erased. This parameter - * should be between 0 and 511. - * @retval OneNAND memory Interrupt Status. - */ -uint16_t OneNAND_EraseBlock(uint16_t BlockNumber) -{ - uint16_t status = 0x0; - - /* Wait till no ongoing operation */ - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_CONTROLSTATUS); - - while((status & 0x8000) == 0x8000) - { - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_CONTROLSTATUS); - } - - /* Erase operation */ - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_STARTADDRESS1) = BlockNumber; - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_INTERRUPT) = 0x0000; - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_COMMAND) = OneNAND_CMD_ERASE; - - /* Wait till no error is generated */ - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_CONTROLSTATUS); - - while((status & 0x0400) == 0x0400) - { - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_CONTROLSTATUS); - } - - /* Wait till the command is completed */ - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_INTERRUPT); - - while((status & 0x8000) != 0x8000) - { - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_INTERRUPT); - } - - /* Get the Controller Status */ - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_CONTROLSTATUS); - - return (status); -} - -/** - * @brief Writes a Half-word buffer to the OneNAND memory. - * @param pBuffer: pointer to buffer. - * @param WriteAddr: OneNAND memory internal address from which the data will be - * written. - * @param NumHalfwordToWrite: number of half-words to write. - * @retval OneNAND memory Controller Status. - */ -uint16_t OneNAND_WriteBuffer(uint16_t* pBuffer, OneNAND_ADDRESS Address, uint32_t NumHalfwordToWrite) -{ - uint32_t datacounter = 0; - uint16_t status = 0; - - /* Load the buffer to be written into the DATA RAM0*/ - for(datacounter = 0; datacounter < NumHalfwordToWrite; datacounter++) - { - *(__IO uint16_t *)((BANK1_ONENAND1_ADDR + OneNAND_DATA_RAM_0_0_ADD) + (2*datacounter)) = pBuffer[datacounter]; - } - - /* Write operation from DATA RAM0 to NAND address*/ - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_STARTADDRESS1) = Address.Block; /* NAND Flash block address*/ - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_STARTADDRESINT8_T) = (uint16_t)(Address.Page << 2); /* NAND Flash start page address */ - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_STARTBUFFER) = OneNAND_DATA_RAM_0_0_REG;/* BufferRAM Sector Count (BSC) and BufferRAM Sector Address (BSA).*/ - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_INTERRUPT) = 0x0000; - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_COMMAND) = OneNAND_CMD_PROGRAM; /* Command */ - - /* Wait till the command is completed */ - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_INTERRUPT); - - while((status & 0x8000) != 0x8000) - { - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_INTERRUPT); - } - - /* Wait till the write interrupt is set */ - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_INTERRUPT); - - while((status & 0x40) != 0x40) - { - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_INTERRUPT); - } - - /* Get the Controller Status */ - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_CONTROLSTATUS); - - return (status); -} - -/** - * @brief Reads a block of data from the OneNAND memory using asynchronous mode. - * @param pBuffer: pointer to the buffer that receives the data read from the - * OneNAND memory. - * @param ReadAddr: OneNAND memory internal address to read from. - * @param NumHalfwordToRead: number of half-words to read. - * @retval None - */ -void OneNAND_AsynchronousRead(uint16_t* pBuffer, OneNAND_ADDRESS Address, uint32_t NumHalfwordToRead) -{ - uint16_t datatmp = 0x0, index = 0; - __IO uint16_t status = 0; - - datatmp = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_SYSTEMCONFIGURATION); - - /* Set the asynchronous read mode */ - OneNAND_WRITE(BANK1_ONENAND1_ADDR + OneNAND_REG_SYSTEMCONFIGURATION, (datatmp& 0x7FFF)); - - /* Load data from the read address to the DATA RAM 1 sector 1 */ - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_STARTADDRESS1) = Address.Block; /* NAND Flash block address*/ - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_STARTADDRESINT8_T) = (uint16_t)(Address.Page << 2); - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_STARTBUFFER) = OneNAND_DATA_RAM_1_0_REG; - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_INTERRUPT) = 0x0000; - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_COMMAND) = OneNAND_CMD_LOAD; /* Command */ - - /* Wait till the command is completed */ - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_INTERRUPT); - - while((status & 0x8000) != 0x8000) - { - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_INTERRUPT); - } - - /* Read Controller status */ - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_CONTROLSTATUS); - - /* Read data */ - for(; NumHalfwordToRead != 0x00; NumHalfwordToRead--) /* While there is data to read */ - { - /* Read a Halfword from the memory */ - *pBuffer++ = *(__IO uint16_t *)((BANK1_ONENAND1_ADDR + OneNAND_DATA_RAM_1_0_ADD)+ 2*index); - index++; - } -} - -/** - * @brief Reads a block of data from the OneNAND memory using synchronous mode. - * @param pBuffer: pointer to the buffer that receives the data read from the - * OneNAND memory. - * @param ReadAddr: OneNAND memory internal address to read from. - * @param NumHalfwordToRead: number of half-words to read. - * @retval None - */ -void OneNAND_SynchronousRead(uint16_t* pBuffer, OneNAND_ADDRESS Address, uint32_t NumHalfwordToRead) -{ - uint16_t index = 0; - __IO uint16_t status = 0; - - /* Set the asynchronous read mode */ - OneNAND_WRITE(BANK1_ONENAND1_ADDR + OneNAND_REG_SYSTEMCONFIGURATION, 0xB4C0); - - - /* Load data from the read address to the DATA RAM 1 sector 1 */ - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_STARTADDRESS1) = Address.Block; /* NAND Flash block address*/ - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_STARTADDRESINT8_T) = (uint16_t)(Address.Page << 2); - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_STARTBUFFER) = OneNAND_DATA_RAM_1_0_REG; - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_INTERRUPT) = 0x0000; - *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_COMMAND) = OneNAND_CMD_LOAD; /* Command */ - - /* Wait till the command is completed */ - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_INTERRUPT); - - while((status & 0x8000) != 0x8000) - { - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_INTERRUPT); - } - - /* Read Controller status */ - status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_CONTROLSTATUS); - - /* Read data */ - for(; NumHalfwordToRead != 0x00; NumHalfwordToRead--) /* While there is data to read */ - { - *pBuffer++ = *(__IO uint16_t *)((BANK1_ONENAND1_ADDR + OneNAND_DATA_RAM_1_0_ADD + 2*index)); - index++; - } -} - -/** - * @brief Reads the OneNAND memory Interrupt status. - * @param None - * @retval OneNAND memory Interrupt Status. - */ -uint16_t OneNAND_ReadStatus(void) -{ - __IO uint16_t status = 0x0; - - /* Read Status */ - return (status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_INTERRUPT)); -} - -/** - * @brief Reads the OneNAND Controller status. - * @param None - * @retval OneNAND Controller Status. - */ -uint16_t OneNAND_ReadControllerStatus(void) -{ - __IO uint16_t status = 0x0; - - /* Read Controller Status */ - return (status = *(__IO uint16_t *)(BANK1_ONENAND1_ADDR + OneNAND_REG_CONTROLSTATUS)); -} - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_fsmc_onenand.h b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_fsmc_onenand.h deleted file mode 100644 index 145777dbc..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_fsmc_onenand.h +++ /dev/null @@ -1,196 +0,0 @@ -/** - ****************************************************************************** - * @file stm322xg_eval_fsmc_onenand.h - * @author MCD Application Team - * @version V5.0.3 - * @date 09-March-2012 - * @brief This file contains all the functions prototypes for the - * stm322xg_eval_fsmc_onenand.c driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __STM322xG_EVAL_FSMC_ONENAND_H -#define __STM322xG_EVAL_FSMC_ONENAND_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include "stm322xg_eval.h" - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL_FSMC_ONENAND - * @{ - */ - -/** @defgroup STM322xG_EVAL_FSMC_ONENAND_Exported_Types - * @{ - */ -typedef struct -{ - uint16_t Manufacturer_ID; - uint16_t Device_ID; -}OneNAND_IDTypeDef; - -/* OneNand Status */ -typedef enum -{ - OneNAND_SUCCESS = 0, - OneNAND_ONGOING, - OneNAND_ERROR, - OneNAND_TIMEOUT -}OneNAND_Status; - -typedef struct -{ - uint16_t Block; - uint16_t Page; -} OneNAND_ADDRESS; - -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_FSMC_ONENAND_Exported_Constants - * @{ - */ -/** - * @brief OneNAND memory command - */ -#define OneNAND_CMD_ERASE ((uint16_t)0x0094) -#define OneNAND_CMD_PROGRAM ((uint16_t)0x0080) -#define OneNAND_CMD_RESET ((uint16_t)0x00F0) -#define OneNAND_CMD_READ_ID ((uint16_t)0x0090) -#define OneNAND_CMD_UNLOCK ((uint16_t)0x0023) -#define OneNAND_CMD_LOAD ((uint16_t)0x0000) - -/** - * @brief OneNand Register description - */ -#define OneNAND_REG_MANUFACTERID ((uint32_t)0x1E000) /* Manufacturer identification */ -#define OneNAND_REG_DEVICEID ((uint32_t)0x1E002) /* Device identification */ -#define OneNAND_REG_DATABUFFERSIZE ((uint32_t)0x1E006) /* Data Buffer size */ -#define OneNAND_REG_BOOTBUFFERSIZE ((uint32_t)0x1E008) /* Boot Buffer size */ -#define OneNAND_REG_AMOUNTOFBUFFERS ((uint32_t)0x1E00A) /* Amount of data/boot buffers */ -#define OneNAND_REG_TECHNOLOGY ((uint32_t)0x1E00C) /* Info about technology */ -#define OneNAND_REG_STARTADDRESS1 ((uint32_t)0x1E200) /* Nand Flash Block Address */ -#define OneNAND_REG_STARTADDRESS3 ((uint32_t)0x1E204) /* Destination Block address for copy back program */ -#define OneNAND_REG_STARTADDRESS4 ((uint32_t)0x1E206) /* Destination Page & sector address for copy back program */ -#define OneNAND_REG_STARTADDRESINT8_T ((uint32_t)0x1E20E) /* Nand Flash Page & sector address */ -#define OneNAND_REG_STARTBUFFER ((uint32_t)0x1E400) /* The meaning is with which buffer to start and how many - buffers to use for the data transfer */ -#define OneNAND_REG_COMMAND ((uint32_t)0x1E440) /* Host control and memory operation commands*/ -#define OneNAND_REG_SYSTEMCONFIGURATION ((uint32_t)0x1E442) /* Memory and host interface configuration */ -#define OneNAND_REG_CONTROLSTATUS ((uint32_t)0x1E480) /* Control status and result of memory operation */ -#define OneNAND_REG_INTERRUPT ((uint32_t)0x1E482) /* Memory Command Completion Interrupt Status */ -#define OneNAND_REG_STARTBLOCKADDRESS ((uint32_t)0x1E498) /* Start memory block address in Write Protection mode */ -#define OneNAND_REG_WRITEPROTECTIONSTATUS ((uint32_t)0x1E49C) /* Current memory Write Protection status */ - -/** - * @brief OneNand Memory partition description - */ -#define OneNAND_DATA_RAM_0_0_ADD ((uint32_t)0x0400) /* DataRAM Main page0/sector0 */ -#define OneNAND_DATA_RAM_0_0_REG ((uint32_t)0x0800) /* DataRAM 0_0 is selected with 4 sector */ - -#define OneNAND_DATA_RAM_0_1_ADD ((uint32_t)0x0600) /* DataRAM Main page0/sector1 */ -#define OneNAND_DATA_RAM_0_1_REG ((uint32_t)0x0900) /* DataRAM 0_1 is selected with 4 sector */ - -#define OneNAND_DATA_RAM_0_2_ADD ((uint32_t)0x0800) /* DataRAM Main page0/sector2 */ -#define OneNAND_DATA_RAM_0_2_REG ((uint32_t)0x0A00) /* DataRAM 0_2 is selected with 4 sector */ - -#define OneNAND_DATA_RAM_0_3_ADD ((uint32_t)0x0A00) /* DataRAM Main page0/sector3 */ -#define OneNAND_DATA_RAM_0_3_REG ((uint32_t)0x0B00) /* DataRAM 0_3 is selected with 4 sector */ - -#define OneNAND_DATA_RAM_1_0_ADD ((uint32_t)0x0C00) /* DataRAM Main page1/sector0 */ -#define OneNAND_DATA_RAM_1_0_REG ((uint32_t)0x0C00) /* DataRAM 1_0 is selected with 4 sector */ - -#define OneNAND_DATA_RAM_1_1_ADD ((uint32_t)0x0E00) /* DataRAM Main page1/sector1 */ -#define OneNAND_DATA_RAM_1_1_REG ((uint32_t)0x0D00) /* DataRAM 1_1 is selected with 4 sector */ - -#define OneNAND_DATA_RAM_1_2_ADD ((uint32_t)0x1000) /* DataRAM Main page1/sector2 */ -#define OneNAND_DATA_RAM_1_2_REG ((uint32_t)0x0E00) /* DataRAM 1_2 is selected with 4 sector */ - -#define OneNAND_DATA_RAM_1_3_ADD ((uint32_t)0x1200) /* DataRAM Main page1/sector3 */ -#define OneNAND_DATA_RAM_1_3_REG ((uint32_t)0x0F00) /* DataRAM 1_3 is selected with 4 sector */ - -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_FSMC_ONENAND_Exported_Macros - * @{ - */ -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_FSMC_ONENAND_Exported_Functions - * @{ - */ -void OneNAND_Init(void); -void OneNAND_Reset(void); -void OneNAND_ReadID(OneNAND_IDTypeDef* OneNAND_ID); -uint16_t OneNAND_UnlockBlock(uint16_t BlockNumber); -uint16_t OneNAND_EraseBlock(uint16_t BlockNumber); -uint16_t OneNAND_WriteBuffer(uint16_t* pBuffer, OneNAND_ADDRESS Address, uint32_t NumHalfwordToWrite); -void OneNAND_AsynchronousRead(uint16_t* pBuffer, OneNAND_ADDRESS Address, uint32_t NumHalfwordToRead); -void OneNAND_SynchronousRead(uint16_t* pBuffer, OneNAND_ADDRESS Address, uint32_t NumHalfwordToRead); -uint16_t OneNAND_ReadStatus(void); -uint16_t OneNAND_ReadControllerStatus(void); - -#ifdef __cplusplus -} -#endif - -#endif /* __STM322xG_EVAL_FSMC_ONENAND_H */ -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_fsmc_psram.c b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_fsmc_psram.c deleted file mode 100644 index c31dc64da..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_fsmc_psram.c +++ /dev/null @@ -1,307 +0,0 @@ -/** - ****************************************************************************** - * @file stm322xg_eval_fsmc_psram.c - * @author MCD Application Team - * @version V5.0.3 - * @date 09-March-2012 - * @brief This file provides a set of functions needed to drive the IS66WV25616BLL - * PSRAM memory mounted on STM322xG-EVAL evaluation board(MB786) RevA. - * - * Note: This memory is not available on the RevB of the board. - * - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "stm322xg_eval_fsmc_psram.h" - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL_FSMC_PSRAM - * @brief This file provides a set of functions needed to drive the - * IS66WV25616BLL PSRAM memory mounted on STM322xG-EVAL board. - * @{ - */ - -/** @defgroup STM322xG_EVAL_FSMC_PSRAM_Private_Types - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_FSMC_PSRAM_Private_Defines - * @{ - */ -/** - * @brief FSMC Bank 1 NOR/SRAM2 - */ -#define Bank1_SRAM2_ADDR ((uint32_t)0x64000000) -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_FSMC_PSRAM_Private_Macros - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_FSMC_PSRAM_Private_Variables - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_FSMC_PSRAM_Private_Function_Prototypes - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_FSMC_PSRAM_Private_Functions - * @{ - */ - -/** - * @brief Configures the FSMC and GPIOs to interface with the PSRAM memory. - * This function must be called before any write/read operation - * on the PSRAM. - * @param None - * @retval None - */ -void PSRAM_Init(void) -{ - FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure; - FSMC_NORSRAMTimingInitTypeDef p; - GPIO_InitTypeDef GPIO_InitStructure; - - /* Enable GPIOs clock */ - RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOE | RCC_AHB1Periph_GPIOF | - RCC_AHB1Periph_GPIOG, ENABLE); - - /* Enable FSMC clock */ - RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE); - -/*-- GPIOs Configuration ------------------------------------------------------*/ -/* - +-------------------+--------------------+------------------+------------------+ - + PSRAM pins assignment + - +-------------------+--------------------+------------------+------------------+ - | PD0 <-> FSMC_D2 | PE0 <-> FSMC_NBL0 | PF0 <-> FSMC_A0 | PG0 <-> FSMC_A10 | - | PD1 <-> FSMC_D3 | PE1 <-> FSMC_NBL1 | PF1 <-> FSMC_A1 | PG1 <-> FSMC_A11 | - | PD4 <-> FSMC_NOE | PE7 <-> FSMC_D4 | PF2 <-> FSMC_A2 | PG2 <-> FSMC_A12 | - | PD5 <-> FSMC_NWE | PE8 <-> FSMC_D5 | PF3 <-> FSMC_A3 | PG3 <-> FSMC_A13 | - | PD8 <-> FSMC_D13 | PE9 <-> FSMC_D6 | PF4 <-> FSMC_A4 | PG4 <-> FSMC_A14 | - | PD9 <-> FSMC_D14 | PE10 <-> FSMC_D7 | PF5 <-> FSMC_A5 | PG5 <-> FSMC_A15 | - | PD10 <-> FSMC_D15 | PE11 <-> FSMC_D8 | PF12 <-> FSMC_A6 | PG9 <-> FSMC_NE2 | - | PD11 <-> FSMC_A16 | PE12 <-> FSMC_D9 | PF13 <-> FSMC_A7 |------------------+ - | PD12 <-> FSMC_A17 | PE13 <-> FSMC_D10 | PF14 <-> FSMC_A8 | - | PD14 <-> FSMC_D0 | PE14 <-> FSMC_D11 | PF15 <-> FSMC_A9 | - | PD15 <-> FSMC_D1 | PE15 <-> FSMC_D12 |------------------+ - +-------------------+--------------------+ -*/ - /* GPIOD configuration */ - GPIO_PinAFConfig(GPIOD, GPIO_PinSource0, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource1, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource4, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource5, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource8, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource9, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource10, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource11, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource12, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource14, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource15, GPIO_AF_FSMC); - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5 | - GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | - GPIO_Pin_12 | GPIO_Pin_14 | GPIO_Pin_15; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; - GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - - GPIO_Init(GPIOD, &GPIO_InitStructure); - - - /* GPIOE configuration */ - GPIO_PinAFConfig(GPIOE, GPIO_PinSource0 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource1 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource7 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource8 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource9 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource10 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource11 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource12 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource13 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource14 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource15 , GPIO_AF_FSMC); - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_7 | - GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11| - GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; - - GPIO_Init(GPIOE, &GPIO_InitStructure); - - - /* GPIOF configuration */ - GPIO_PinAFConfig(GPIOF, GPIO_PinSource0 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF, GPIO_PinSource1 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF, GPIO_PinSource2 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF, GPIO_PinSource3 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF, GPIO_PinSource4 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF, GPIO_PinSource5 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF, GPIO_PinSource12 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF, GPIO_PinSource13 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF, GPIO_PinSource14 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF, GPIO_PinSource15 , GPIO_AF_FSMC); - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | - GPIO_Pin_4 | GPIO_Pin_5 | - GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; - - GPIO_Init(GPIOF, &GPIO_InitStructure); - - - /* GPIOG configuration */ - GPIO_PinAFConfig(GPIOG, GPIO_PinSource0 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOG, GPIO_PinSource1 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOG, GPIO_PinSource2 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOG, GPIO_PinSource3 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOG, GPIO_PinSource4 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOG, GPIO_PinSource5 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOG, GPIO_PinSource9 , GPIO_AF_FSMC); - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | - GPIO_Pin_4 | GPIO_Pin_5 |GPIO_Pin_9; - - GPIO_Init(GPIOG, &GPIO_InitStructure); - -/*-- FSMC Configuration ------------------------------------------------------*/ - p.FSMC_AddressSetupTime = 0x2; - p.FSMC_AddressHoldTime = 0; - p.FSMC_DataSetupTime = 0xB; - p.FSMC_BusTurnAroundDuration = 1; - p.FSMC_CLKDivision = 0; - p.FSMC_DataLatency = 0; - p.FSMC_AccessMode = FSMC_AccessMode_A; - - FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM2; - FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable; - FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_PSRAM; - FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b; - FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable; - FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable; - FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low; - FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable; - FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState; - FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable; - FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable; - FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable; - FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable; - FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p; - FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p; - - FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure); - - /*!< Enable FSMC Bank1_SRAM2 Bank */ - FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM2, ENABLE); -} - -/** - * @brief Writes a Half-word buffer to the FSMC PSRAM memory. - * @param pBuffer : pointer to buffer. - * @param WriteAddr : PSRAM memory internal address from which the data will be - * written. - * @param NumHalfwordToWrite : number of half-words to write. - * @retval None - */ -void PSRAM_WriteBuffer(uint16_t* pBuffer, uint32_t WriteAddr, uint32_t NumHalfwordToWrite) -{ - for(; NumHalfwordToWrite != 0; NumHalfwordToWrite--) /* while there is data to write */ - { - /* Transfer data to the memory */ - *(uint16_t *) (Bank1_SRAM2_ADDR + WriteAddr) = *pBuffer++; - - /* Increment the address*/ - WriteAddr += 2; - } -} - -/** - * @brief Reads a block of data from the FSMC PSRAM memory. - * @param pBuffer : pointer to the buffer that receives the data read from the - * PSRAM memory. - * @param ReadAddr : PSRAM memory internal address to read from. - * @param NumHalfwordToRead : number of half-words to read. - * @retval None - */ -void PSRAM_ReadBuffer(uint16_t* pBuffer, uint32_t ReadAddr, uint32_t NumHalfwordToRead) -{ - for(; NumHalfwordToRead != 0; NumHalfwordToRead--) /* while there is data to read */ - { - /* Read a half-word from the memory */ - *pBuffer++ = *(__IO uint16_t*) (Bank1_SRAM2_ADDR + ReadAddr); - - /* Increment the address*/ - ReadAddr += 2; - } -} - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_fsmc_psram.h b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_fsmc_psram.h deleted file mode 100644 index 629db1b60..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_fsmc_psram.h +++ /dev/null @@ -1,110 +0,0 @@ -/** - ****************************************************************************** - * @file stm322xg_eval_fsmc_psram.h - * @author MCD Application Team - * @version V5.0.3 - * @date 09-March-2012 - * @brief This file contains all the functions prototypes for the - * stm322xg_eval_fsmc_psram.c driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __STM322xG_EVAL_FSMC_PSRAM_H -#define __STM322xG_EVAL_FSMC_PSRAM_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include "stm322xg_eval.h" - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL_FSMC_PSRAM - * @{ - */ - -/** @defgroup STM322xG_EVAL_FSMC_PSRAM_Exported_Types - * @{ - */ -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_FSMC_PSRAM_Exported_Constants - * @{ - */ -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_FSMC_PSRAM_Exported_Macros - * @{ - */ -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_FSMC_PSRAM_Exported_Functions - * @{ - */ - -void PSRAM_Init(void); -void PSRAM_WriteBuffer(uint16_t* pBuffer, uint32_t WriteAddr, uint32_t NumHalfwordToWrite); -void PSRAM_ReadBuffer(uint16_t* pBuffer, uint32_t ReadAddr, uint32_t NumHalfwordToRead); - -#ifdef __cplusplus -} -#endif - -#endif /* __STM322xG_EVAL_FSMC_PSRAM_H */ -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_fsmc_sram.c b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_fsmc_sram.c deleted file mode 100644 index 558db9f6a..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_fsmc_sram.c +++ /dev/null @@ -1,321 +0,0 @@ -/** - ****************************************************************************** - * @file stm322xg_eval_fsmc_sram.c - * @author MCD Application Team - * @version V5.0.3 - * @date 09-March-2012 - * @brief This file provides a set of functions needed to drive the - * IS61WV102416BLL SRAM memory mounted on STM322xG-EVAL evaluation - * board(MB786) RevB. - * - * Note: This memory is not available on the RevA of the board. - * - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "stm322xg_eval_fsmc_sram.h" - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL_FSMC_SRAM - * @brief This file provides a set of functions needed to drive the - * IS61WV102416BLL SRAM memory mounted on STM322xG-EVAL board. - * @{ - */ - -/** @defgroup STM322xG_EVAL_FSMC_SRAM_Private_Types - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_FSMC_SRAM_Private_Defines - * @{ - */ -/** - * @brief FSMC Bank 1 NOR/SRAM2 - */ -#define Bank1_SRAM2_ADDR ((uint32_t)0x64000000) - -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_FSMC_SRAM_Private_Macros - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_FSMC_SRAM_Private_Variables - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_FSMC_SRAM_Private_Function_Prototypes - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_FSMC_SRAM_Private_Functions - * @{ - */ - -/** - * @brief Configures the FSMC and GPIOs to interface with the SRAM memory. - * This function must be called before any write/read operation - * on the SRAM. - * @param None - * @retval None - */ -void SRAM_Init(void) -{ - FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure; - FSMC_NORSRAMTimingInitTypeDef p; - GPIO_InitTypeDef GPIO_InitStructure; - - /* Enable GPIOs clock */ - RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOE | RCC_AHB1Periph_GPIOF | - RCC_AHB1Periph_GPIOG, ENABLE); - - /* Enable FSMC clock */ - RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE); - -/*-- GPIOs Configuration -----------------------------------------------------*/ -/* - +-------------------+--------------------+------------------+------------------+ - | PD0 <-> FSMC_D2 | PE0 <-> FSMC_NBL0 | PF0 <-> FSMC_A0 | PG0 <-> FSMC_A10 | - | PD1 <-> FSMC_D3 | PE1 <-> FSMC_NBL1 | PF1 <-> FSMC_A1 | PG1 <-> FSMC_A11 | - | PD4 <-> FSMC_NOE | PE2 <-> FSMC_A23 | PF2 <-> FSMC_A2 | PG2 <-> FSMC_A12 | - | PD5 <-> FSMC_NWE | PE3 <-> FSMC_A19 | PF3 <-> FSMC_A3 | PG3 <-> FSMC_A13 | - | PD8 <-> FSMC_D13 | PE4 <-> FSMC_A20 | PF4 <-> FSMC_A4 | PG4 <-> FSMC_A14 | - | PD9 <-> FSMC_D14 | PE5 <-> FSMC_A21 | PF5 <-> FSMC_A5 | PG5 <-> FSMC_A15 | - | PD10 <-> FSMC_D15 | PE6 <-> FSMC_A22 | PF12 <-> FSMC_A6 | PG9 <-> FSMC_NE2 | - | PD11 <-> FSMC_A16 | PE7 <-> FSMC_D4 | PF13 <-> FSMC_A7 |------------------+ - | PD12 <-> FSMC_A17 | PE8 <-> FSMC_D5 | PF14 <-> FSMC_A8 | - | PD13 <-> FSMC_A18 | PE9 <-> FSMC_D6 | PF15 <-> FSMC_A9 | - | PD14 <-> FSMC_D0 | PE10 <-> FSMC_D7 |------------------+ - | PD15 <-> FSMC_D1 | PE11 <-> FSMC_D8 | - +-------------------| PE12 <-> FSMC_D9 | - | PE13 <-> FSMC_D10 | - | PE14 <-> FSMC_D11 | - | PE15 <-> FSMC_D12 | - +--------------------+ -*/ - - /* GPIOD configuration */ - GPIO_PinAFConfig(GPIOD, GPIO_PinSource0, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource1, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource4, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource5, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource8, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource9, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource10, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource11, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource12, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource13, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource14, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource15, GPIO_AF_FSMC); - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5 | - GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | - GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; - GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - - GPIO_Init(GPIOD, &GPIO_InitStructure); - - - /* GPIOE configuration */ - GPIO_PinAFConfig(GPIOE, GPIO_PinSource0 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource1 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource2 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource3 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource4 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource5 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource6 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource7 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource8 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource9 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource10 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource11 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource12 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource13 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource14 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource15 , GPIO_AF_FSMC); - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | - GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7 | - GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11| - GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; - - GPIO_Init(GPIOE, &GPIO_InitStructure); - - - /* GPIOF configuration */ - GPIO_PinAFConfig(GPIOF, GPIO_PinSource0 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF, GPIO_PinSource1 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF, GPIO_PinSource2 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF, GPIO_PinSource3 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF, GPIO_PinSource4 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF, GPIO_PinSource5 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF, GPIO_PinSource12 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF, GPIO_PinSource13 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF, GPIO_PinSource14 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOF, GPIO_PinSource15 , GPIO_AF_FSMC); - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | - GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_12 | GPIO_Pin_13 | - GPIO_Pin_14 | GPIO_Pin_15; - - GPIO_Init(GPIOF, &GPIO_InitStructure); - - - /* GPIOG configuration */ - GPIO_PinAFConfig(GPIOG, GPIO_PinSource0 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOG, GPIO_PinSource1 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOG, GPIO_PinSource2 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOG, GPIO_PinSource3 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOG, GPIO_PinSource4 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOG, GPIO_PinSource5 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOG, GPIO_PinSource9 , GPIO_AF_FSMC); - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | - GPIO_Pin_4 | GPIO_Pin_5 |GPIO_Pin_9; - - GPIO_Init(GPIOG, &GPIO_InitStructure); - -/*-- FSMC Configuration ------------------------------------------------------*/ - p.FSMC_AddressSetupTime = 0; - p.FSMC_AddressHoldTime = 0; - p.FSMC_DataSetupTime = 4; - p.FSMC_BusTurnAroundDuration = 1; - p.FSMC_CLKDivision = 0; - p.FSMC_DataLatency = 0; - p.FSMC_AccessMode = FSMC_AccessMode_A; - - FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM2; - FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable; - FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_PSRAM; - FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b; - FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable; - FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable; - FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low; - FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable; - FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState; - FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable; - FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable; - FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable; - FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable; - FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p; - FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p; - - FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure); - - /*!< Enable FSMC Bank1_SRAM2 Bank */ - FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM2, ENABLE); - -} - -/** - * @brief Writes a Half-word buffer to the FSMC SRAM memory. - * @param pBuffer : pointer to buffer. - * @param WriteAddr : SRAM memory internal address from which the data will be - * written. - * @param NumHalfwordToWrite : number of half-words to write. - * @retval None - */ -void SRAM_WriteBuffer(uint16_t* pBuffer, uint32_t WriteAddr, uint32_t NumHalfwordToWrite) -{ - for (; NumHalfwordToWrite != 0; NumHalfwordToWrite--) /* while there is data to write */ - { - /* Transfer data to the memory */ - *(uint16_t *) (Bank1_SRAM2_ADDR + WriteAddr) = *pBuffer++; - - /* Increment the address*/ - WriteAddr += 2; - } -} - -/** - * @brief Reads a block of data from the FSMC SRAM memory. - * @param pBuffer : pointer to the buffer that receives the data read from the - * SRAM memory. - * @param ReadAddr : SRAM memory internal address to read from. - * @param NumHalfwordToRead : number of half-words to read. - * @retval None - */ -void SRAM_ReadBuffer(uint16_t* pBuffer, uint32_t ReadAddr, uint32_t NumHalfwordToRead) -{ - for (; NumHalfwordToRead != 0; NumHalfwordToRead--) /* while there is data to read */ - { - /* Read a half-word from the memory */ - *pBuffer++ = *(__IO uint16_t*) (Bank1_SRAM2_ADDR + ReadAddr); - - /* Increment the address*/ - ReadAddr += 2; - } -} - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_fsmc_sram.h b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_fsmc_sram.h deleted file mode 100644 index b0dff7ccd..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_fsmc_sram.h +++ /dev/null @@ -1,110 +0,0 @@ -/** - ****************************************************************************** - * @file stm322xg_eval_fsmc_sram.h - * @author MCD Application Team - * @version V5.0.3 - * @date 09-March-2012 - * @brief This file contains all the functions prototypes for the - * stm322xg_eval_fsmc_sram.c driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __STM322xG_EVAL_FSMC_SRAM_H -#define __STM322xG_EVAL_FSMC_SRAM_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include "stm322xg_eval.h" - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL_FSMC_SRAM - * @{ - */ - -/** @defgroup STM322xG_EVAL_FSMC_SRAM_Exported_Types - * @{ - */ -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_FSMC_SRAM_Exported_Constants - * @{ - */ -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_FSMC_SRAM_Exported_Macros - * @{ - */ -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_FSMC_SRAM_Exported_Functions - * @{ - */ - -void SRAM_Init(void); -void SRAM_WriteBuffer(uint16_t* pBuffer, uint32_t WriteAddr, uint32_t NumHalfwordToWrite); -void SRAM_ReadBuffer(uint16_t* pBuffer, uint32_t ReadAddr, uint32_t NumHalfwordToRead); - -#ifdef __cplusplus -} -#endif - -#endif /* __STM322xG_EVAL_FSMC_SRAM_H */ -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_i2c_ee.c b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_i2c_ee.c deleted file mode 100644 index 13336a18e..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_i2c_ee.c +++ /dev/null @@ -1,814 +0,0 @@ -/** - ****************************************************************************** - * @file stm322xg_eval_i2c_ee.c - * @author MCD Application Team - * @version V5.0.3 - * @date 09-March-2012 - * @brief This file provides a set of functions needed to manage the I2C M24CXX - * EEPROM memory mounted on STM322xG-EVAL evaluation board(MB786) RevA - * and RevB. - * - * =================================================================== - * Note: This driver is intended for STM32F2xx families devices only. - * =================================================================== - * - * It implements a high level communication layer for read and write - * from/to this memory. The needed STM32 hardware resources (I2C and - * GPIO) are defined in stm322xg_eval.h file, and the initialization is - * performed in sEE_LowLevel_Init() function declared in stm322xg_eval.c - * file. - * You can easily tailor this driver to any other development board, - * by just adapting the defines for hardware resources and - * sEE_LowLevel_Init() function. - * - * @note In this driver, basic read and write functions (sEE_ReadBuffer() - * and sEE_WritePage()) use the DMA to perform the data transfer - * to/from EEPROM memory (except when number of requested data is - * equal to 1). Thus, after calling these two functions, user - * application may perform other tasks while DMA is transferring - * data. The application should then monitor the variable holding - * the number of data in order to determine when the transfer is - * completed (variable decremented to 0). Stopping transfer tasks - * are performed into DMA interrupt handlers (which are integrated - * into this driver). - * - * +-----------------------------------------------------------------+ - * | Pin assignment | - * +---------------------------------------+-----------+-------------+ - * | STM32 I2C Pins | sEE | Pin | - * +---------------------------------------+-----------+-------------+ - * | . | E0(GND) | 1 (0V) | - * | . | E1(GND) | 2 (0V) | - * | . | E2(GND) | 3 (0V) | - * | . | E0(VSS) | 4 (0V) | - * | sEE_I2C_SDA_PIN/ SDA | SDA | 5 | - * | sEE_I2C_SCL_PIN/ SCL | SCL | 6 | - * | . | /WC(VDD)| 7 (3.3V) | - * | . | VDD | 8 (3.3V) | - * +---------------------------------------+-----------+-------------+ - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "stm322xg_eval_i2c_ee.h" - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL_I2C_EE - * @brief This file includes the I2C EEPROM driver of STM32-EVAL boards. - * @{ - */ - -/** @defgroup STM322xG_EVAL_I2C_EE_Private_Types - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_I2C_EE_Private_Defines - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_I2C_EE_Private_Macros - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_I2C_EE_Private_Variables - * @{ - */ -__IO uint16_t sEEAddress = 0; -__IO uint32_t sEETimeout = sEE_LONG_TIMEOUT; -__IO uint16_t* sEEDataReadPointer; -__IO uint8_t* sEEDataWritePointer; -__IO uint8_t sEEDataNum; -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_I2C_EE_Private_Function_Prototypes - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_I2C_EE_Private_Functions - * @{ - */ - -/** - * @brief DeInitializes peripherals used by the I2C EEPROM driver. - * @param None - * @retval None - */ -void sEE_DeInit(void) -{ - sEE_LowLevel_DeInit(); -} - -/** - * @brief Initializes peripherals used by the I2C EEPROM driver. - * @param None - * @retval None - */ -void sEE_Init(void) -{ - I2C_InitTypeDef I2C_InitStructure; - - sEE_LowLevel_Init(); - - /*!< I2C configuration */ - /* sEE_I2C configuration */ - I2C_InitStructure.I2C_Mode = I2C_Mode_I2C; - I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2; - I2C_InitStructure.I2C_OwnAddress1 = I2C_SLAVE_ADDRESS7; - I2C_InitStructure.I2C_Ack = I2C_Ack_Enable; - I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit; - I2C_InitStructure.I2C_ClockSpeed = I2C_SPEED; - - /* sEE_I2C Peripheral Enable */ - I2C_Cmd(sEE_I2C, ENABLE); - /* Apply sEE_I2C configuration after enabling it */ - I2C_Init(sEE_I2C, &I2C_InitStructure); - - /* Enable the sEE_I2C peripheral DMA requests */ - I2C_DMACmd(sEE_I2C, ENABLE); - -#if defined (sEE_M24C64_32) - /*!< Select the EEPROM address according to the state of E0, E1, E2 pins */ - sEEAddress = sEE_HW_ADDRESS; -#elif defined (sEE_M24C08) - /*!< depending on the sEE Address selected in the stm322xg_eval_i2c_ee.h file */ - #ifdef sEE_Block0_ADDRESS - /*!< Select the sEE Block0 to write on */ - sEEAddress = sEE_Block0_ADDRESS; - #endif - - #ifdef sEE_Block1_ADDRESS - /*!< Select the sEE Block1 to write on */ - sEEAddress = sEE_Block1_ADDRESS; - #endif - - #ifdef sEE_Block2_ADDRESS - /*!< Select the sEE Block2 to write on */ - sEEAddress = sEE_Block2_ADDRESS; - #endif - - #ifdef sEE_Block3_ADDRESS - /*!< Select the sEE Block3 to write on */ - sEEAddress = sEE_Block3_ADDRESS; - #endif -#endif /*!< sEE_M24C64_32 */ -} - -/** - * @brief Reads a block of data from the EEPROM. - * @param pBuffer : pointer to the buffer that receives the data read from - * the EEPROM. - * @param ReadAddr : EEPROM's internal address to start reading from. - * @param NumByteToRead : pointer to the variable holding number of bytes to - * be read from the EEPROM. - * - * @note The variable pointed by NumByteToRead is reset to 0 when all the - * data are read from the EEPROM. Application should monitor this - * variable in order know when the transfer is complete. - * - * @note When number of data to be read is higher than 1, this function just - * configures the communication and enable the DMA channel to transfer data. - * Meanwhile, the user application may perform other tasks. - * When number of data to be read is 1, then the DMA is not used. The byte - * is read in polling mode. - * - * @retval sEE_OK (0) if operation is correctly performed, else return value - * different from sEE_OK (0) or the timeout user callback. - */ -uint32_t sEE_ReadBuffer(uint8_t* pBuffer, uint16_t ReadAddr, uint16_t* NumByteToRead) -{ - /* Set the pointer to the Number of data to be read. This pointer will be used - by the DMA Transfer Completer interrupt Handler in order to reset the - variable to 0. User should check on this variable in order to know if the - DMA transfer has been complete or not. */ - sEEDataReadPointer = NumByteToRead; - - /*!< While the bus is busy */ - sEETimeout = sEE_LONG_TIMEOUT; - while(I2C_GetFlagStatus(sEE_I2C, I2C_FLAG_BUSY)) - { - if((sEETimeout--) == 0) return sEE_TIMEOUT_UserCallback(); - } - - /*!< Send START condition */ - I2C_GenerateSTART(sEE_I2C, ENABLE); - - /*!< Test on EV5 and clear it (cleared by reading SR1 then writing to DR) */ - sEETimeout = sEE_FLAG_TIMEOUT; - while(!I2C_CheckEvent(sEE_I2C, I2C_EVENT_MASTER_MODE_SELECT)) - { - if((sEETimeout--) == 0) return sEE_TIMEOUT_UserCallback(); - } - - /*!< Send EEPROM address for write */ - I2C_Send7bitAddress(sEE_I2C, sEEAddress, I2C_Direction_Transmitter); - - /*!< Test on EV6 and clear it */ - sEETimeout = sEE_FLAG_TIMEOUT; - while(!I2C_CheckEvent(sEE_I2C, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)) - { - if((sEETimeout--) == 0) return sEE_TIMEOUT_UserCallback(); - } - -#ifdef sEE_M24C08 - - /*!< Send the EEPROM's internal address to read from: Only one byte address */ - I2C_SendData(sEE_I2C, ReadAddr); - -#elif defined (sEE_M24C64_32) - - /*!< Send the EEPROM's internal address to read from: MSB of the address first */ - I2C_SendData(sEE_I2C, (uint8_t)((ReadAddr & 0xFF00) >> 8)); - - /*!< Test on EV8 and clear it */ - sEETimeout = sEE_FLAG_TIMEOUT; - while(!I2C_CheckEvent(sEE_I2C, I2C_EVENT_MASTER_BYTE_TRANSMITTING)) - { - if((sEETimeout--) == 0) return sEE_TIMEOUT_UserCallback(); - } - - /*!< Send the EEPROM's internal address to read from: LSB of the address */ - I2C_SendData(sEE_I2C, (uint8_t)(ReadAddr & 0x00FF)); - -#endif /*!< sEE_M24C08 */ - - /*!< Test on EV8 and clear it */ - sEETimeout = sEE_FLAG_TIMEOUT; - while(I2C_GetFlagStatus(sEE_I2C, I2C_FLAG_BTF) == RESET) - { - if((sEETimeout--) == 0) return sEE_TIMEOUT_UserCallback(); - } - - /*!< Send STRAT condition a second time */ - I2C_GenerateSTART(sEE_I2C, ENABLE); - - /*!< Test on EV5 and clear it (cleared by reading SR1 then writing to DR) */ - sEETimeout = sEE_FLAG_TIMEOUT; - while(!I2C_CheckEvent(sEE_I2C, I2C_EVENT_MASTER_MODE_SELECT)) - { - if((sEETimeout--) == 0) return sEE_TIMEOUT_UserCallback(); - } - - /*!< Send EEPROM address for read */ - I2C_Send7bitAddress(sEE_I2C, sEEAddress, I2C_Direction_Receiver); - - /* If number of data to be read is 1, then DMA couldn't be used */ - /* One Byte Master Reception procedure (POLLING) ---------------------------*/ - if ((uint16_t)(*NumByteToRead) < 2) - { - /* Wait on ADDR flag to be set (ADDR is still not cleared at this level */ - sEETimeout = sEE_FLAG_TIMEOUT; - while(I2C_GetFlagStatus(sEE_I2C, I2C_FLAG_ADDR) == RESET) - { - if((sEETimeout--) == 0) return sEE_TIMEOUT_UserCallback(); - } - - /*!< Disable Acknowledgment */ - I2C_AcknowledgeConfig(sEE_I2C, DISABLE); - - /* Clear ADDR register by reading SR1 then SR2 register (SR1 has already been read) */ - (void)sEE_I2C->SR2; - - /*!< Send STOP Condition */ - I2C_GenerateSTOP(sEE_I2C, ENABLE); - - /* Wait for the byte to be received */ - sEETimeout = sEE_FLAG_TIMEOUT; - while(I2C_GetFlagStatus(sEE_I2C, I2C_FLAG_RXNE) == RESET) - { - if((sEETimeout--) == 0) return sEE_TIMEOUT_UserCallback(); - } - - /*!< Read the byte received from the EEPROM */ - *pBuffer = I2C_ReceiveData(sEE_I2C); - - /*!< Decrement the read bytes counter */ - (uint16_t)(*NumByteToRead)--; - - /* Wait to make sure that STOP control bit has been cleared */ - sEETimeout = sEE_FLAG_TIMEOUT; - while(sEE_I2C->CR1 & I2C_CR1_STOP) - { - if((sEETimeout--) == 0) return sEE_TIMEOUT_UserCallback(); - } - - /*!< Re-Enable Acknowledgment to be ready for another reception */ - I2C_AcknowledgeConfig(sEE_I2C, ENABLE); - } - else/* More than one Byte Master Reception procedure (DMA) -----------------*/ - { - /*!< Test on EV6 and clear it */ - sEETimeout = sEE_FLAG_TIMEOUT; - while(!I2C_CheckEvent(sEE_I2C, I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED)) - { - if((sEETimeout--) == 0) return sEE_TIMEOUT_UserCallback(); - } - - /* Configure the DMA Rx Channel with the buffer address and the buffer size */ - sEE_LowLevel_DMAConfig((uint32_t)pBuffer, (uint16_t)(*NumByteToRead), sEE_DIRECTION_RX); - - /* Inform the DMA that the next End Of Transfer Signal will be the last one */ - I2C_DMALastTransferCmd(sEE_I2C, ENABLE); - - /* Enable the DMA Rx Stream */ - DMA_Cmd(sEE_I2C_DMA_STREAM_RX, ENABLE); - } - - /* If all operations OK, return sEE_OK (0) */ - return sEE_OK; -} - -/** - * @brief Writes more than one byte to the EEPROM with a single WRITE cycle. - * - * @note The number of bytes (combined to write start address) must not - * cross the EEPROM page boundary. This function can only write into - * the boundaries of an EEPROM page. - * This function doesn't check on boundaries condition (in this driver - * the function sEE_WriteBuffer() which calls sEE_WritePage() is - * responsible of checking on Page boundaries). - * - * @param pBuffer : pointer to the buffer containing the data to be written to - * the EEPROM. - * @param WriteAddr : EEPROM's internal address to write to. - * @param NumByteToWrite : pointer to the variable holding number of bytes to - * be written into the EEPROM. - * - * @note The variable pointed by NumByteToWrite is reset to 0 when all the - * data are written to the EEPROM. Application should monitor this - * variable in order know when the transfer is complete. - * - * @note This function just configure the communication and enable the DMA - * channel to transfer data. Meanwhile, the user application may perform - * other tasks in parallel. - * - * @retval sEE_OK (0) if operation is correctly performed, else return value - * different from sEE_OK (0) or the timeout user callback. - */ -uint32_t sEE_WritePage(uint8_t* pBuffer, uint16_t WriteAddr, uint8_t* NumByteToWrite) -{ - /* Set the pointer to the Number of data to be written. This pointer will be used - by the DMA Transfer Completer interrupt Handler in order to reset the - variable to 0. User should check on this variable in order to know if the - DMA transfer has been complete or not. */ - sEEDataWritePointer = NumByteToWrite; - - /*!< While the bus is busy */ - sEETimeout = sEE_LONG_TIMEOUT; - while(I2C_GetFlagStatus(sEE_I2C, I2C_FLAG_BUSY)) - { - if((sEETimeout--) == 0) return sEE_TIMEOUT_UserCallback(); - } - - /*!< Send START condition */ - I2C_GenerateSTART(sEE_I2C, ENABLE); - - /*!< Test on EV5 and clear it */ - sEETimeout = sEE_FLAG_TIMEOUT; - while(!I2C_CheckEvent(sEE_I2C, I2C_EVENT_MASTER_MODE_SELECT)) - { - if((sEETimeout--) == 0) return sEE_TIMEOUT_UserCallback(); - } - - /*!< Send EEPROM address for write */ - sEETimeout = sEE_FLAG_TIMEOUT; - I2C_Send7bitAddress(sEE_I2C, sEEAddress, I2C_Direction_Transmitter); - - /*!< Test on EV6 and clear it */ - sEETimeout = sEE_FLAG_TIMEOUT; - while(!I2C_CheckEvent(sEE_I2C, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)) - { - if((sEETimeout--) == 0) return sEE_TIMEOUT_UserCallback(); - } - -#ifdef sEE_M24C08 - - /*!< Send the EEPROM's internal address to write to : only one byte Address */ - I2C_SendData(sEE_I2C, WriteAddr); - -#elif defined(sEE_M24C64_32) - - /*!< Send the EEPROM's internal address to write to : MSB of the address first */ - I2C_SendData(sEE_I2C, (uint8_t)((WriteAddr & 0xFF00) >> 8)); - - /*!< Test on EV8 and clear it */ - sEETimeout = sEE_FLAG_TIMEOUT; - while(!I2C_CheckEvent(sEE_I2C, I2C_EVENT_MASTER_BYTE_TRANSMITTING)) - { - if((sEETimeout--) == 0) return sEE_TIMEOUT_UserCallback(); - } - - /*!< Send the EEPROM's internal address to write to : LSB of the address */ - I2C_SendData(sEE_I2C, (uint8_t)(WriteAddr & 0x00FF)); - -#endif /*!< sEE_M24C08 */ - - /*!< Test on EV8 and clear it */ - sEETimeout = sEE_FLAG_TIMEOUT; - while(!I2C_CheckEvent(sEE_I2C, I2C_EVENT_MASTER_BYTE_TRANSMITTING)) - { - if((sEETimeout--) == 0) return sEE_TIMEOUT_UserCallback(); - } - - /* Configure the DMA Tx Channel with the buffer address and the buffer size */ - sEE_LowLevel_DMAConfig((uint32_t)pBuffer, (uint8_t)(*NumByteToWrite), sEE_DIRECTION_TX); - - /* Enable the DMA Tx Stream */ - DMA_Cmd(sEE_I2C_DMA_STREAM_TX, ENABLE); - - /* If all operations OK, return sEE_OK (0) */ - return sEE_OK; -} - -/** - * @brief Writes buffer of data to the I2C EEPROM. - * @param pBuffer : pointer to the buffer containing the data to be written - * to the EEPROM. - * @param WriteAddr : EEPROM's internal address to write to. - * @param NumByteToWrite : number of bytes to write to the EEPROM. - * @retval None - */ -void sEE_WriteBuffer(uint8_t* pBuffer, uint16_t WriteAddr, uint16_t NumByteToWrite) -{ - uint8_t NumOfPage = 0, NumOfSingle = 0, count = 0; - uint16_t Addr = 0; - - Addr = WriteAddr % sEE_PAGESIZE; - count = sEE_PAGESIZE - Addr; - NumOfPage = NumByteToWrite / sEE_PAGESIZE; - NumOfSingle = NumByteToWrite % sEE_PAGESIZE; - - /*!< If WriteAddr is sEE_PAGESIZE aligned */ - if(Addr == 0) - { - /*!< If NumByteToWrite < sEE_PAGESIZE */ - if(NumOfPage == 0) - { - /* Store the number of data to be written */ - sEEDataNum = NumOfSingle; - /* Start writing data */ - sEE_WritePage(pBuffer, WriteAddr, (uint8_t*)(&sEEDataNum)); - /* Wait transfer through DMA to be complete */ - sEETimeout = sEE_LONG_TIMEOUT; - while (sEEDataNum > 0) - { - if((sEETimeout--) == 0) {sEE_TIMEOUT_UserCallback(); return;}; - } - sEE_WaitEepromStandbyState(); - } - /*!< If NumByteToWrite > sEE_PAGESIZE */ - else - { - while(NumOfPage--) - { - /* Store the number of data to be written */ - sEEDataNum = sEE_PAGESIZE; - sEE_WritePage(pBuffer, WriteAddr, (uint8_t*)(&sEEDataNum)); - /* Wait transfer through DMA to be complete */ - sEETimeout = sEE_LONG_TIMEOUT; - while (sEEDataNum > 0) - { - if((sEETimeout--) == 0) {sEE_TIMEOUT_UserCallback(); return;}; - } - sEE_WaitEepromStandbyState(); - WriteAddr += sEE_PAGESIZE; - pBuffer += sEE_PAGESIZE; - } - - if(NumOfSingle!=0) - { - /* Store the number of data to be written */ - sEEDataNum = NumOfSingle; - sEE_WritePage(pBuffer, WriteAddr, (uint8_t*)(&sEEDataNum)); - /* Wait transfer through DMA to be complete */ - sEETimeout = sEE_LONG_TIMEOUT; - while (sEEDataNum > 0) - { - if((sEETimeout--) == 0) {sEE_TIMEOUT_UserCallback(); return;}; - } - sEE_WaitEepromStandbyState(); - } - } - } - /*!< If WriteAddr is not sEE_PAGESIZE aligned */ - else - { - /*!< If NumByteToWrite < sEE_PAGESIZE */ - if(NumOfPage== 0) - { - /*!< If the number of data to be written is more than the remaining space - in the current page: */ - if (NumByteToWrite > count) - { - /* Store the number of data to be written */ - sEEDataNum = count; - /*!< Write the data contained in same page */ - sEE_WritePage(pBuffer, WriteAddr, (uint8_t*)(&sEEDataNum)); - /* Wait transfer through DMA to be complete */ - sEETimeout = sEE_LONG_TIMEOUT; - while (sEEDataNum > 0) - { - if((sEETimeout--) == 0) {sEE_TIMEOUT_UserCallback(); return;}; - } - sEE_WaitEepromStandbyState(); - - /* Store the number of data to be written */ - sEEDataNum = (NumByteToWrite - count); - /*!< Write the remaining data in the following page */ - sEE_WritePage((uint8_t*)(pBuffer + count), (WriteAddr + count), (uint8_t*)(&sEEDataNum)); - /* Wait transfer through DMA to be complete */ - sEETimeout = sEE_LONG_TIMEOUT; - while (sEEDataNum > 0) - { - if((sEETimeout--) == 0) {sEE_TIMEOUT_UserCallback(); return;}; - } - sEE_WaitEepromStandbyState(); - } - else - { - /* Store the number of data to be written */ - sEEDataNum = NumOfSingle; - sEE_WritePage(pBuffer, WriteAddr, (uint8_t*)(&sEEDataNum)); - /* Wait transfer through DMA to be complete */ - sEETimeout = sEE_LONG_TIMEOUT; - while (sEEDataNum > 0) - { - if((sEETimeout--) == 0) {sEE_TIMEOUT_UserCallback(); return;}; - } - sEE_WaitEepromStandbyState(); - } - } - /*!< If NumByteToWrite > sEE_PAGESIZE */ - else - { - NumByteToWrite -= count; - NumOfPage = NumByteToWrite / sEE_PAGESIZE; - NumOfSingle = NumByteToWrite % sEE_PAGESIZE; - - if(count != 0) - { - /* Store the number of data to be written */ - sEEDataNum = count; - sEE_WritePage(pBuffer, WriteAddr, (uint8_t*)(&sEEDataNum)); - /* Wait transfer through DMA to be complete */ - sEETimeout = sEE_LONG_TIMEOUT; - while (sEEDataNum > 0) - { - if((sEETimeout--) == 0) {sEE_TIMEOUT_UserCallback(); return;}; - } - sEE_WaitEepromStandbyState(); - WriteAddr += count; - pBuffer += count; - } - - while(NumOfPage--) - { - /* Store the number of data to be written */ - sEEDataNum = sEE_PAGESIZE; - sEE_WritePage(pBuffer, WriteAddr, (uint8_t*)(&sEEDataNum)); - /* Wait transfer through DMA to be complete */ - sEETimeout = sEE_LONG_TIMEOUT; - while (sEEDataNum > 0) - { - if((sEETimeout--) == 0) {sEE_TIMEOUT_UserCallback(); return;}; - } - sEE_WaitEepromStandbyState(); - WriteAddr += sEE_PAGESIZE; - pBuffer += sEE_PAGESIZE; - } - if(NumOfSingle != 0) - { - /* Store the number of data to be written */ - sEEDataNum = NumOfSingle; - sEE_WritePage(pBuffer, WriteAddr, (uint8_t*)(&sEEDataNum)); - /* Wait transfer through DMA to be complete */ - sEETimeout = sEE_LONG_TIMEOUT; - while (sEEDataNum > 0) - { - if((sEETimeout--) == 0) {sEE_TIMEOUT_UserCallback(); return;}; - } - sEE_WaitEepromStandbyState(); - } - } - } -} - -/** - * @brief Wait for EEPROM Standby state. - * - * @note This function allows to wait and check that EEPROM has finished the - * last operation. It is mostly used after Write operation: after receiving - * the buffer to be written, the EEPROM may need additional time to actually - * perform the write operation. During this time, it doesn't answer to - * I2C packets addressed to it. Once the write operation is complete - * the EEPROM responds to its address. - * - * @param None - * @retval sEE_OK (0) if operation is correctly performed, else return value - * different from sEE_OK (0) or the timeout user callback. - */ -uint32_t sEE_WaitEepromStandbyState(void) -{ - __IO uint16_t tmpSR1 = 0; - __IO uint32_t sEETrials = 0; - - /*!< While the bus is busy */ - sEETimeout = sEE_LONG_TIMEOUT; - while(I2C_GetFlagStatus(sEE_I2C, I2C_FLAG_BUSY)) - { - if((sEETimeout--) == 0) return sEE_TIMEOUT_UserCallback(); - } - - /* Keep looping till the slave acknowledge his address or maximum number - of trials is reached (this number is defined by sEE_MAX_TRIALS_NUMBER define - in stm322xg_eval_i2c_ee.h file) */ - while (1) - { - /*!< Send START condition */ - I2C_GenerateSTART(sEE_I2C, ENABLE); - - /*!< Test on EV5 and clear it */ - sEETimeout = sEE_FLAG_TIMEOUT; - while(!I2C_CheckEvent(sEE_I2C, I2C_EVENT_MASTER_MODE_SELECT)) - { - if((sEETimeout--) == 0) return sEE_TIMEOUT_UserCallback(); - } - - /*!< Send EEPROM address for write */ - I2C_Send7bitAddress(sEE_I2C, sEEAddress, I2C_Direction_Transmitter); - - /* Wait for ADDR flag to be set (Slave acknowledged his address) */ - sEETimeout = sEE_LONG_TIMEOUT; - do - { - /* Get the current value of the SR1 register */ - tmpSR1 = sEE_I2C->SR1; - - /* Update the timeout value and exit if it reach 0 */ - if((sEETimeout--) == 0) return sEE_TIMEOUT_UserCallback(); - } - /* Keep looping till the Address is acknowledged or the AF flag is - set (address not acknowledged at time) */ - while((tmpSR1 & (I2C_SR1_ADDR | I2C_SR1_AF)) == 0); - - /* Check if the ADDR flag has been set */ - if (tmpSR1 & I2C_SR1_ADDR) - { - /* Clear ADDR Flag by reading SR1 then SR2 registers (SR1 have already - been read) */ - (void)sEE_I2C->SR2; - - /*!< STOP condition */ - I2C_GenerateSTOP(sEE_I2C, ENABLE); - - /* Exit the function */ - return sEE_OK; - } - else - { - /*!< Clear AF flag */ - I2C_ClearFlag(sEE_I2C, I2C_FLAG_AF); - } - - /* Check if the maximum allowed number of trials has bee reached */ - if (sEETrials++ == sEE_MAX_TRIALS_NUMBER) - { - /* If the maximum number of trials has been reached, exit the function */ - return sEE_TIMEOUT_UserCallback(); - } - } -} - -/** - * @brief This function handles the DMA Tx Channel interrupt Handler. - * @param None - * @retval None - */ -void sEE_I2C_DMA_TX_IRQHandler(void) -{ - /* Check if the DMA transfer is complete */ - if(DMA_GetFlagStatus(sEE_I2C_DMA_STREAM_TX, sEE_TX_DMA_FLAG_TCIF) != RESET) - { - /* Disable the DMA Tx Stream and Clear TC flag */ - DMA_Cmd(sEE_I2C_DMA_STREAM_TX, DISABLE); - DMA_ClearFlag(sEE_I2C_DMA_STREAM_TX, sEE_TX_DMA_FLAG_TCIF); - - /*!< Wait till all data have been physically transferred on the bus */ - sEETimeout = sEE_LONG_TIMEOUT; - while(!I2C_GetFlagStatus(sEE_I2C, I2C_FLAG_BTF)) - { - if((sEETimeout--) == 0) sEE_TIMEOUT_UserCallback(); - } - - /*!< Send STOP condition */ - I2C_GenerateSTOP(sEE_I2C, ENABLE); - - /* Reset the variable holding the number of data to be written */ - *sEEDataWritePointer = 0; - } -} - -/** - * @brief This function handles the DMA Rx Channel interrupt Handler. - * @param None - * @retval None - */ -void sEE_I2C_DMA_RX_IRQHandler(void) -{ - /* Check if the DMA transfer is complete */ - if(DMA_GetFlagStatus(sEE_I2C_DMA_STREAM_RX, sEE_RX_DMA_FLAG_TCIF) != RESET) - { - /*!< Send STOP Condition */ - I2C_GenerateSTOP(sEE_I2C, ENABLE); - - /* Disable the DMA Rx Stream and Clear TC Flag */ - DMA_Cmd(sEE_I2C_DMA_STREAM_RX, DISABLE); - DMA_ClearFlag(sEE_I2C_DMA_STREAM_RX, sEE_RX_DMA_FLAG_TCIF); - - /* Reset the variable holding the number of data to be read */ - *sEEDataReadPointer = 0; - } -} - -#ifdef USE_DEFAULT_TIMEOUT_CALLBACK -/** - * @brief Basic management of the timeout situation. - * @param None. - * @retval None. - */ -uint32_t sEE_TIMEOUT_UserCallback(void) -{ - /* Block communication and all processes */ - while (1) - { - } -} -#endif /* USE_DEFAULT_TIMEOUT_CALLBACK */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_i2c_ee.h b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_i2c_ee.h deleted file mode 100644 index 8ceed5fe7..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_i2c_ee.h +++ /dev/null @@ -1,194 +0,0 @@ -/** - ****************************************************************************** - * @file stm322xg_eval_i2c_ee.h - * @author MCD Application Team - * @version V5.0.3 - * @date 09-March-2012 - * @brief This file contains all the functions prototypes for the - * stm322xg_eval_i2c_ee.c driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __STM322xG_EVAL_I2C_EE_H -#define __STM322xG_EVAL_I2C_EE_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include "stm322xg_eval.h" - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL_I2C_EE - * @{ - */ - -/** @defgroup STM322xG_EVAL_I2C_EE_Exported_Types - * @{ - */ - -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_I2C_EE_Exported_Constants - * @{ - */ - -/* Uncomment the following line to use the default sEE_TIMEOUT_UserCallback() - function implemented in stm32_evel_i2c_ee.c file. - sEE_TIMEOUT_UserCallback() function is called whenever a timeout condition - occure during communication (waiting on an event that doesn't occur, bus - errors, busy devices ...). */ -/* #define USE_DEFAULT_TIMEOUT_CALLBACK */ - -#if !defined (sEE_M24C08) && !defined (sEE_M24C64_32) -/* Use the defines below the choose the EEPROM type */ -/* #define sEE_M24C08*/ /* Support the device: M24C08. */ -/* note: Could support: M24C01, M24C02, M24C04 and M24C16 if the blocks and - HW address are correctly defined*/ -#define sEE_M24C64_32 /* Support the devices: M24C32 and M24C64 */ -#endif - -#ifdef sEE_M24C64_32 -/* For M24C32 and M24C64 devices, E0,E1 and E2 pins are all used for device - address selection (ne need for additional address lines). According to the - Harware connection on the board (on STM322xG-EVAL board E0 = E1 = E2 = 0) */ - - #define sEE_HW_ADDRESS 0xA0 /* E0 = E1 = E2 = 0 */ - -#elif defined (sEE_M24C08) -/* The M24C08W contains 4 blocks (128byte each) with the adresses below: E2 = 0 - EEPROM Addresses defines */ - #define sEE_Block0_ADDRESS 0xA0 /* E2 = 0 */ - /*#define sEE_Block1_ADDRESS 0xA2*/ /* E2 = 0 */ - /*#define sEE_Block2_ADDRESS 0xA4*/ /* E2 = 0 */ - /*#define sEE_Block3_ADDRESS 0xA6*/ /* E2 = 0 */ - -#endif /* sEE_M24C64_32 */ - -/* I2C clock speed configuration (in Hz) - WARNING: - Make sure that this define is not already declared in other files (ie. - stm322xg_eval.h file). It can be used in parallel by other modules. */ -#ifndef I2C_SPEED - #define I2C_SPEED 100000 -#endif /* I2C_SPEED */ - -#define I2C_SLAVE_ADDRESS7 0xA0 - -#if defined (sEE_M24C08) - #define sEE_PAGESIZE 16 -#elif defined (sEE_M24C64_32) - #define sEE_PAGESIZE 32 -#endif - -/* Maximum Timeout values for flags and events waiting loops. These timeouts are - not based on accurate values, they just guarantee that the application will - not remain stuck if the I2C communication is corrupted. - You may modify these timeout values depending on CPU frequency and application - conditions (interrupts routines ...). */ -#define sEE_FLAG_TIMEOUT ((uint32_t)0x1000) -#define sEE_LONG_TIMEOUT ((uint32_t)(10 * sEE_FLAG_TIMEOUT)) - -/* Maximum number of trials for sEE_WaitEepromStandbyState() function */ -#define sEE_MAX_TRIALS_NUMBER 300 - -/* Defintions for the state of the DMA transfer */ -#define sEE_STATE_READY 0 -#define sEE_STATE_BUSY 1 -#define sEE_STATE_ERROR 2 - -#define sEE_OK 0 -#define sEE_FAIL 1 - -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_I2C_EE_Exported_Macros - * @{ - */ -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_I2C_EE_Exported_Functions - * @{ - */ -void sEE_DeInit(void); -void sEE_Init(void); -uint32_t sEE_ReadBuffer(uint8_t* pBuffer, uint16_t ReadAddr, uint16_t* NumByteToRead); -uint32_t sEE_WritePage(uint8_t* pBuffer, uint16_t WriteAddr, uint8_t* NumByteToWrite); -void sEE_WriteBuffer(uint8_t* pBuffer, uint16_t WriteAddr, uint16_t NumByteToWrite); -uint32_t sEE_WaitEepromStandbyState(void); - -/* USER Callbacks: These are functions for which prototypes only are declared in - EEPROM driver and that should be implemented into user applicaiton. */ -/* sEE_TIMEOUT_UserCallback() function is called whenever a timeout condition - occure during communication (waiting on an event that doesn't occur, bus - errors, busy devices ...). - You can use the default timeout callback implementation by uncommenting the - define USE_DEFAULT_TIMEOUT_CALLBACK in stm322xg_eval_i2c_ee.h file. - Typically the user implementation of this callback should reset I2C peripheral - and re-initialize communication or in worst case reset all the application. */ -uint32_t sEE_TIMEOUT_UserCallback(void); - -#ifdef __cplusplus -} -#endif - -#endif /* __STM322xG_EVAL_I2C_EE_H */ -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ - - diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_ioe.c b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_ioe.c deleted file mode 100644 index e90310050..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_ioe.c +++ /dev/null @@ -1,1619 +0,0 @@ -/** - ****************************************************************************** - * @file stm322xg_eval_ioe.c - * @author MCD Application Team - * @version V5.0.3 - * @date 09-March-2012 - * @brief This file provides a set of functions needed to manage the STMPE811 - * IO Expander devices mounted on STM322xG-EVAL evaluation board(MB786) - * RevA and RevB. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - - /* File Info : --------------------------------------------------------------- - - Note: - ----- - - This driver uses the DMA method for sending and receiving data on I2C bus - which allow higher efficiency and reliability of the communication. - - SUPPORTED FEATURES: - - IO Read/write : Set/Reset and Read (Polling/Interrupt) - - Joystick: config and Read (Polling/Interrupt) - - Touch Screen Features: Single point mode (Polling/Interrupt) - - TempSensor Feature: accuracy not determined (Polling). - - UNSUPPORTED FEATURES: - - Row ADC Feature is not supported (not implemented on STM322xG_EVAL board) - ----------------------------------------------------------------------------*/ - -/* Includes ------------------------------------------------------------------*/ -#include "stm322xg_eval_ioe.h" - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL - * @{ - */ - -/** @defgroup STM322xG_EVAL_IOE - * @brief This file includes the IO Expander driver for STMPE811 IO Expander - * devices. - * @{ - */ - - -/** @defgroup STM322xG_EVAL_IOE_Private_TypesDefinitions - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_IOE_Private_Defines - * @{ - */ -#define TIMEOUT_MAX 0x3000 /* _x? (x - _x): (_x - x); - yDiff = y > _y? (y - _y): (_y - y); - if (xDiff + yDiff > 5) - { - _x = x; - _y = y; - } - } - /* Update the X position */ - TS_State.X = _x; - - /* Update the Y position */ - TS_State.Y = _y; - /* Update the Z position index */ - TS_State.Z = IOE_TS_Read_Z(); - - /* Clear the interrupt pending bit and enable the FIFO again */ - I2C_WriteDeviceRegister(IOE_1_ADDR, IOE_REG_FIFO_STA, 0x01); - I2C_WriteDeviceRegister(IOE_1_ADDR, IOE_REG_FIFO_STA, 0x00); - - /* Return pointer to the updated structure */ - return &TS_State; -} - -/** - * @brief Returns the temperature row value (in 16 bit format). - * @param None - * @retval The temperature row value. - */ -uint32_t IOE_TempSens_GetData(void) -{ - static __IO uint32_t tmp = 0; - - /* Acquire data enable */ - I2C_WriteDeviceRegister(IOE_2_ADDR, IOE_REG_TEMP_CTRL, 0x03); - - /* Enable the TEMPSENS module */ - tmp = (uint32_t)((I2C_ReadDeviceRegister(IOE_2_ADDR, IOE_REG_TEMP_DATA) & 0x03) << 8); - tmp |= (uint32_t)I2C_ReadDeviceRegister(IOE_2_ADDR, IOE_REG_TEMP_DATA + 1); - - tmp = (uint32_t)((33 * tmp * 100) / 751); - tmp = (uint32_t)((tmp + 5) / 10); - - /* return the temperature row value */ - return tmp; -} - -/** - * @brief Checks the selected Global interrupt source pending bit - * @param DeviceAddr: The address of the IOExpander, could be : IOE_1_ADDR - * or IOE_2_ADDR. - * @param Global_IT: the Global interrupt source to be checked, could be: - * @arg Global_IT_GPIO : All IOs interrupt - * @arg Global_IT_ADC : ADC interrupt - * @arg Global_IT_TEMP : Temperature Sensor interrupts - * @arg Global_IT_FE : Touch Screen Controller FIFO Error interrupt - * @arg Global_IT_FF : Touch Screen Controller FIFO Full interrupt - * @arg Global_IT_FOV : Touch Screen Controller FIFO Overrun interrupt - * @arg Global_IT_FTH : Touch Screen Controller FIFO Threshold interrupt - * @arg Global_IT_TOUCH : Touch Screen Controller Touch Detected interrupt - * @retval Status of the checked flag. Could be SET or RESET. - */ -FlagStatus IOE_GetGITStatus(uint8_t DeviceAddr, uint8_t Global_IT) -{ - __IO uint8_t tmp = 0; - - /* get the Interrupt status */ - tmp = I2C_ReadDeviceRegister(DeviceAddr, IOE_REG_INT_STA); - - if ((tmp & (uint8_t)Global_IT) != 0) - { - return SET; - } - else - { - return RESET; - } -} - -/** - * @brief Clears the selected Global interrupt pending bit(s) - * @param DeviceAddr: The address of the IOExpander, could be : IOE_1_ADDR - * or IOE_2_ADDR. - * @param Global_IT: the Global interrupt to be cleared, could be any combination - * of the following values: - * @arg Global_IT_GPIO : All IOs interrupt - * @arg Global_IT_ADC : ADC interrupt - * @arg Global_IT_TEMP : Temperature Sensor interrupts - * @arg Global_IT_FE : Touch Screen Controller FIFO Error interrupt - * @arg Global_IT_FF : Touch Screen Controller FIFO Full interrupt - * @arg Global_IT_FOV : Touch Screen Controller FIFO Overrun interrupt - * @arg Global_IT_FTH : Touch Screen Controller FIFO Threshold interrupt - * @arg Global_IT_TOUCH : Touch Screen Controller Touch Detected interrupt - * @retval IOE_OK: if all initializations are OK. Other value if error. - */ -uint8_t IOE_ClearGITPending(uint8_t DeviceAddr, uint8_t Global_IT) -{ - /* Write 1 to the bits that have to be cleared */ - I2C_WriteDeviceRegister(DeviceAddr, IOE_REG_INT_STA, Global_IT); - - /* If all OK return IOE_OK */ - return IOE_OK; -} - -/** - * @brief Checks the status of the selected IO interrupt pending bit - * @param DeviceAddr: The address of the IOExpander, could be : IOE_1_ADDR - * or IOE_2_ADDR. - * @param IO_IT: the IO interrupt to be checked could be IO_ITx Where x can be - * from 0 to 7. - * @retval Status of the checked flag. Could be SET or RESET. - */ -FlagStatus IOE_GetIOITStatus(uint8_t DeviceAddr, uint8_t IO_IT) -{ - uint8_t tmp = 0; - - /* get the Interrupt status */ - tmp = I2C_ReadDeviceRegister(DeviceAddr, IOE_REG_GPIO_INT_STA); - - if ((tmp & (uint8_t)IO_IT) != 0) - { - return SET; - } - else - { - return RESET; - } -} - -/** - * @brief Clears the selected IO interrupt pending bit(s). - * @param DeviceAddr: The address of the IOExpander, could be : IOE_1_ADDR - * or IOE_2_ADDR. - * @param IO_IT: the IO interrupt to be checked could be IO_ITx Where x can be - * from 0 to 7. - * @retval IOE_OK: if all initializations are OK. Other value if error. - */ -uint8_t IOE_ClearIOITPending(uint8_t DeviceAddr, uint8_t IO_IT) -{ - /* Write 1 to the bits that have to be cleared */ - I2C_WriteDeviceRegister(DeviceAddr, IOE_REG_GPIO_INT_STA, IO_IT); - - /* Clear the Edge detection pending bit*/ - I2C_WriteDeviceRegister(IOE_2_ADDR, IOE_REG_GPIO_ED, IO_IT); - - /* Clear the Rising edge pending bit */ - I2C_WriteDeviceRegister(IOE_2_ADDR, IOE_REG_GPIO_RE, IO_IT); - - /* Clear the Falling edge pending bit */ - I2C_WriteDeviceRegister(IOE_2_ADDR, IOE_REG_GPIO_FE, IO_IT); - - /* If all OK return IOE_OK */ - return IOE_OK; -} - -/** - * @brief Checks if the selected device is correctly configured and - * communicates correctly on the I2C bus. - * @param DeviceAddr: The address of the IOExpander, could be : IOE_1_ADDR - * or IOE_2_ADDR. - * @retval IOE_OK if IOE is operational. Other value if failure. - */ -uint8_t IOE_IsOperational(uint8_t DeviceAddr) -{ - /* Return Error if the ID is not correct */ - if( IOE_ReadID(DeviceAddr) != (uint16_t)STMPE811_ID ) - { - /* Check if a Timeout occurred */ - if (IOE_TimeOut == 0) - { - return(IOE_TimeoutUserCallback()); - } - else - { - return IOE_FAILURE; /* ID is not Correct */ - } - } - else - { - return IOE_OK; /* ID is correct */ - } -} - -/** - * @brief Resets the IO Expander by Software (SYS_CTRL1, RESET bit). - * @param DeviceAddr: The address of the IOExpander, could be : IOE_1_ADDR - * or IOE_2_ADDR. - * @retval IOE_OK: if all initializations are OK. Other value if error. - */ -uint8_t IOE_Reset(uint8_t DeviceAddr) -{ - /* Power Down the IO_Expander */ - I2C_WriteDeviceRegister(DeviceAddr, IOE_REG_SYS_CTRL1, 0x02); - - /* wait for a delay to insure registers erasing */ - _delay_(2); - - /* Power On the Codec after the power off => all registers are reinitialized*/ - I2C_WriteDeviceRegister(DeviceAddr, IOE_REG_SYS_CTRL1, 0x00); - - /* If all OK return IOE_OK */ - return IOE_OK; -} - -/** - * @brief Reads the selected device's ID. - * @param DeviceAddr: The address of the IOExpander, could be : IOE_1_ADDR - * or IOE_2_ADDR. - * @retval The Device ID (two bytes). - */ -uint16_t IOE_ReadID(uint8_t DeviceAddr) -{ - uint16_t tmp = 0; - - /* Read device ID */ - tmp = I2C_ReadDeviceRegister(DeviceAddr, 0); - tmp = (uint32_t)(tmp << 8); - tmp |= (uint32_t)I2C_ReadDeviceRegister(DeviceAddr, 1); - - /* Return the ID */ - return (uint16_t)tmp; -} - -/** - * @brief Configures the selected IO Expander functionalities. - * @param DeviceAddr: The address of the IOExpander, could be : IOE_1_ADDR - * or IOE_2_ADDR. - * @param IOE_TEMPSENS_FCT: the functions to be configured. could be any - * combination of the following values: - * @arg IOE_IO_FCT : IO function - * @arg IOE_TS_FCT : Touch Screen function - * @arg IOE_ADC_FCT : ADC function - * @arg IOE_TEMPSENS_FCT : Temperature Sensor function - * @retval IOE_OK: if all initializations are OK. Other value if error. - */ -uint8_t IOE_FnctCmd(uint8_t DeviceAddr, uint8_t Fct, FunctionalState NewState) -{ - uint8_t tmp = 0; - - /* Get the register value */ - tmp = I2C_ReadDeviceRegister(DeviceAddr, IOE_REG_SYS_CTRL2); - - if (NewState != DISABLE) - { - /* Set the Functionalities to be Enabled */ - tmp &= ~(uint8_t)Fct; - } - else - { - /* Set the Functionalities to be Disabled */ - tmp |= (uint8_t)Fct; - } - - /* Set the register value */ - I2C_WriteDeviceRegister(DeviceAddr, IOE_REG_SYS_CTRL2, tmp); - - /* If all OK return IOE_OK */ - return IOE_OK; -} - -/** - * @brief Configures the selected pin direction (to be an input or an output) - * @param DeviceAddr: The address of the IOExpander, could be : IOE_1_ADDR - * or IOE_2_ADDR. - * @param IO_Pin: IO_Pin_x: Where x can be from 0 to 7. - * @param Direction: could be Direction_IN or Direction_OUT. - * @retval IOE_OK: if all initializations are OK. Other value if error. - */ -uint8_t IOE_IOPinConfig(uint8_t DeviceAddr, uint8_t IO_Pin, uint8_t Direction) -{ - uint8_t tmp = 0; - - /* Get all the Pins direction */ - tmp = I2C_ReadDeviceRegister(DeviceAddr, IOE_REG_GPIO_DIR); - - if (Direction != Direction_IN) - { - tmp |= (uint8_t)IO_Pin; - } - else - { - tmp &= ~(uint8_t)IO_Pin; - } - - /* Write the register new value */ - I2C_WriteDeviceRegister(DeviceAddr, IOE_REG_GPIO_DIR, tmp); - - /* If all OK return IOE_OK */ - return IOE_OK; -} - -/** - * @brief Enables or disables the Global interrupt. - * @param DeviceAddr: The address of the IOExpander, could be :I OE_1_ADDR - * or IOE_2_ADDR. - * @param NewState: could be ENABLE or DISABLE. - * @retval IOE_OK: if all initializations are OK. Other value if error. - */ -uint8_t IOE_GITCmd(uint8_t DeviceAddr, FunctionalState NewState) -{ - uint8_t tmp = 0; - - /* Read the Interrupt Control register */ - I2C_ReadDeviceRegister(DeviceAddr, IOE_REG_INT_CTRL); - - if (NewState != DISABLE) - { - /* Set the global interrupts to be Enabled */ - tmp |= (uint8_t)IOE_GIT_EN; - } - else - { - /* Set the global interrupts to be Disabled */ - tmp &= ~(uint8_t)IOE_GIT_EN; - } - - /* Write Back the Interrupt Control register */ - I2C_WriteDeviceRegister(DeviceAddr, IOE_REG_INT_CTRL, tmp); - - /* If all OK return IOE_OK */ - return IOE_OK; -} - -/** - * @brief Configures the selected source to generate or not a global interrupt - * @param DeviceAddr: The address of the IOExpander, could be : IOE_1_ADDR - * or IOE_2_ADDR. - * @param Global_IT: the interrupt source to be configured, could be: - * @arg Global_IT_GPIO : All IOs interrupt - * @arg Global_IT_ADC : ADC interrupt - * @arg Global_IT_TEMP : Temperature Sensor interrupts - * @arg Global_IT_FE : Touch Screen Controller FIFO Error interrupt - * @arg Global_IT_FF : Touch Screen Controller FIFO Full interrupt - * @arg Global_IT_FOV : Touch Screen Controller FIFO Overrun interrupt - * @arg Global_IT_FTH : Touch Screen Controller FIFO Threshold interrupt - * @arg Global_IT_TOUCH : Touch Screen Controller Touch Detected interrupt - * @retval IOE_OK: if all initializations are OK. Other value if error. - */ -uint8_t IOE_GITConfig(uint8_t DeviceAddr, uint8_t Global_IT, FunctionalState NewState) -{ - uint8_t tmp = 0; - - /* Get the current value of the INT_EN register */ - tmp = I2C_ReadDeviceRegister(DeviceAddr, IOE_REG_INT_EN); - - if (NewState != DISABLE) - { - /* Set the interrupts to be Enabled */ - tmp |= (uint8_t)Global_IT; - } - else - { - /* Set the interrupts to be Disabled */ - tmp &= ~(uint8_t)Global_IT; - } - /* Set the register */ - I2C_WriteDeviceRegister(DeviceAddr, IOE_REG_INT_EN, tmp); - - /* If all OK return IOE_OK */ - return IOE_OK; -} - -/** - * @brief Configures the selected pins to generate an interrupt or not. - * @param DeviceAddr: The address of the IOExpander, could be : IOE_1_ADDR - * or IOE_2_ADDR. - * @param IO_IT: The IO interrupt to be configured. This parameter could be any - * combination of the following values: - * @arg IO_IT_x: where x can be from 0 to 7. - * @param NewState: could be ENABLE or DISABLE. - * @retval IOE_OK: if all initializations are OK. Other value if error. - */ -uint8_t IOE_IOITConfig(uint8_t DeviceAddr, uint8_t IO_IT, FunctionalState NewState) -{ - uint8_t tmp = 0; - - tmp = I2C_ReadDeviceRegister(DeviceAddr, IOE_REG_GPIO_INT_EN); - - if (NewState != DISABLE) - { - /* Set the interrupts to be Enabled */ - tmp |= (uint8_t)IO_IT; - } - else - { - /* Set the interrupts to be Disabled */ - tmp &= ~(uint8_t)IO_IT; - } - - /* Set the register */ - I2C_WriteDeviceRegister(DeviceAddr, IOE_REG_GPIO_INT_EN, tmp); - - /* If all OK return IOE_OK */ - return IOE_OK; -} - -/** - * @brief Configures the touch Screen Controller (Single point detection) - * @param None - * @retval IOE_OK if all initializations are OK. Other value if error. - */ -uint8_t IOE_TS_Config(void) -{ - uint8_t tmp = 0; - - /* Enable TSC Fct: already done in IOE_Config */ - tmp = I2C_ReadDeviceRegister(IOE_1_ADDR, IOE_REG_SYS_CTRL2); - tmp &= ~(uint32_t)(IOE_TS_FCT | IOE_ADC_FCT); - I2C_WriteDeviceRegister(IOE_1_ADDR, IOE_REG_SYS_CTRL2, tmp); - - /* Enable the TSC global interrupts */ - tmp = I2C_ReadDeviceRegister(IOE_1_ADDR, IOE_REG_INT_EN); - tmp |= (uint32_t)(IOE_GIT_TOUCH | IOE_GIT_FTH | IOE_GIT_FOV); - I2C_WriteDeviceRegister(IOE_1_ADDR, IOE_REG_INT_EN, tmp); - - /* Select Sample Time, bit number and ADC Reference */ - I2C_WriteDeviceRegister(IOE_1_ADDR, IOE_REG_ADC_CTRL1, 0x49); - - /* Wait for ~20 ms */ - _delay_(2); - - /* Select the ADC clock speed: 3.25 MHz */ - I2C_WriteDeviceRegister(IOE_1_ADDR, IOE_REG_ADC_CTRL2, 0x01); - - /* Select TSC pins in non default mode */ - tmp = I2C_ReadDeviceRegister(IOE_1_ADDR, IOE_REG_GPIO_AF); - tmp &= ~(uint8_t)TOUCH_IO_ALL; - I2C_WriteDeviceRegister(IOE_1_ADDR, IOE_REG_GPIO_AF, tmp); - - /* Select 2 nF filter capacitor */ - I2C_WriteDeviceRegister(IOE_1_ADDR, IOE_REG_TSC_CFG, 0x9A); - - /* Select single point reading */ - I2C_WriteDeviceRegister(IOE_1_ADDR, IOE_REG_FIFO_TH, 0x01); - - /* Write 0x01 to clear the FIFO memory content. */ - I2C_WriteDeviceRegister(IOE_1_ADDR, IOE_REG_FIFO_STA, 0x01); - - /* Write 0x00 to put the FIFO back into operation mode */ - I2C_WriteDeviceRegister(IOE_1_ADDR, IOE_REG_FIFO_STA, 0x00); - - /* set the data format for Z value: 7 fractional part and 1 whole part */ - I2C_WriteDeviceRegister(IOE_1_ADDR, IOE_REG_TSC_FRACT_XYZ, 0x01); - - /* set the driving capability of the device for TSC pins: 50mA */ - I2C_WriteDeviceRegister(IOE_1_ADDR, IOE_REG_TSC_I_DRIVE, 0x01); - - /* Use no tracking index, touchscreen controller operation mode (XYZ) and - enable the TSC */ - I2C_WriteDeviceRegister(IOE_1_ADDR, IOE_REG_TSC_CTRL, 0x01); - - /* Clear all the status pending bits */ - I2C_WriteDeviceRegister(IOE_1_ADDR, IOE_REG_INT_STA, 0xFF); - - /* Initialize the TS structure to their default values */ - TS_State.TouchDetected = TS_State.X = TS_State.Y = TS_State.Z = 0; - - /* All configuration done */ - return IOE_OK; -} - -/** - * @brief Configures and enables the Temperature sensor module. - * @param None - * @retval IOE_OK if all initializations are OK. Other value if error. - */ -uint8_t IOE_TempSens_Config(void) -{ - __IO uint8_t tmp = 0; - - /* Enable Temperature Sensor Fct: already done in IOE_Config */ - tmp = I2C_ReadDeviceRegister(IOE_2_ADDR, IOE_REG_SYS_CTRL2); - tmp &= ~(uint32_t)(IOE_TEMPSENS_FCT | IOE_ADC_FCT); - I2C_WriteDeviceRegister(IOE_2_ADDR, IOE_REG_SYS_CTRL2, tmp); - - /* Enable the TEMPSENS module */ - I2C_WriteDeviceRegister(IOE_2_ADDR, IOE_REG_TEMP_CTRL, 0x01); - - /* Aquire data enable */ - I2C_WriteDeviceRegister(IOE_2_ADDR, IOE_REG_TEMP_CTRL, 0x3); - - /* All configuration done */ - return IOE_OK; -} - -/** - * @brief Configures the selected pin to be in Alternate function or not - * @param DeviceAddr: The address of the IOExpander, could be : IOE_1_ADDR - * or IOE_2_ADDR. - * @param IO_Pin: IO_Pin_x, Where x can be from 0 to 7. - * @param NewState: State of the AF for the selected pin, could be - * ENABLE or DISABLE. - * @retval IOE_OK: if all initializations are OK. Other value if error. - */ -uint8_t IOE_IOAFConfig(uint8_t DeviceAddr, uint8_t IO_Pin, FunctionalState NewState) -{ - uint8_t tmp = 0; - - /* Get the current state of the GPIO_AF register */ - tmp = I2C_ReadDeviceRegister(DeviceAddr, IOE_REG_GPIO_AF); - - if (NewState != DISABLE) - { - /* Enable the selected pins alternate function */ - tmp |= (uint8_t)IO_Pin; - } - else - { - /* Disable the selected pins alternate function */ - tmp &= ~(uint8_t)IO_Pin; - } - - /* Write back the new value in GPIO_AF register */ - I2C_WriteDeviceRegister(DeviceAddr, IOE_REG_GPIO_AF, tmp); - - /* If all OK return IOE_OK */ - return IOE_OK; -} - -/** - * @brief Configures the Edge for which a transition is detectable for the - * the selected pin. - * @param DeviceAddr: The address of the IOExpander, could be : IOE_1_ADDR - * or IOE_2_ADDR. - * @param IO_Pin: IO_Pin_x, Where x can be from 0 to 7. - * @param Edge: The edge which will be detected. This parameter can be one or a - * a combination of following values: EDGE_FALLING and EDGE_RISING . - * @retval IOE_OK: if all initializations are OK. Other value if error. - */ -uint8_t IOE_IOEdgeConfig(uint8_t DeviceAddr, uint8_t IO_Pin, uint8_t Edge) -{ - uint8_t tmp1 = 0, tmp2 = 0; - - /* Get the registers values */ - tmp1 = I2C_ReadDeviceRegister(DeviceAddr, IOE_REG_GPIO_FE); - tmp2 = I2C_ReadDeviceRegister(DeviceAddr, IOE_REG_GPIO_RE); - - /* Disable the Falling Edge */ - tmp1 &= ~(uint8_t)IO_Pin; - /* Disable the Falling Edge */ - tmp2 &= ~(uint8_t)IO_Pin; - - /* Enable the Falling edge if selected */ - if (Edge & EDGE_FALLING) - { - tmp1 |= (uint8_t)IO_Pin; - } - - /* Enable the Rising edge if selected */ - if (Edge & EDGE_RISING) - { - tmp2 |= (uint8_t)IO_Pin; - } - - /* Write back the registers values */ - I2C_WriteDeviceRegister(DeviceAddr, IOE_REG_GPIO_FE, tmp1); - I2C_WriteDeviceRegister(DeviceAddr, IOE_REG_GPIO_RE, tmp2); - - /* if OK return 0 */ - return IOE_OK; -} - -/** - * @brief Configures the Interrupt line active state and format (level/edge) - * @param Polarity: could be - * @arg Polarity_Low: Interrupt line is active Low/Falling edge - * @arg Polarity_High: Interrupt line is active High/Rising edge - * @param Type: Interrupt line activity type, could be one of the following values - * @arg Type_Level: Interrupt line is active in level model - * @arg Type_Edge: Interrupt line is active in edge model - * @retval IOE_OK: if all initializations are OK. Other value if error. - */ -uint8_t IOE_ITOutConfig(uint8_t Polarity, uint8_t Type) -{ - uint8_t tmp = 0; - - /* Get the register IOE_REG_INT_CTRL value */ - tmp = I2C_ReadDeviceRegister(IOE_1_ADDR, IOE_REG_INT_CTRL); - - /* Mask the polarity and type bits */ - tmp &= ~(uint8_t)0x06; - - /* Modify the Interrupt Output line configuration */ - tmp |= (uint8_t)(Polarity | Type); - - /* Set the register */ - I2C_WriteDeviceRegister(IOE_1_ADDR, IOE_REG_INT_CTRL, tmp); - - - /* Get the register IOE_REG_INT_CTRL value */ - tmp = I2C_ReadDeviceRegister(IOE_2_ADDR, IOE_REG_INT_CTRL); - /* Mask the polarity and type bits */ - tmp &= ~(uint8_t)0x06; - - /* Modify the Interrupt Output line configuration */ - tmp |= (uint8_t)(Polarity | Type); - - /* Set the register */ - I2C_WriteDeviceRegister(IOE_2_ADDR, IOE_REG_INT_CTRL, tmp); - - /* If all OK return IOE_OK */ - return IOE_OK; -} - -/** - * @brief Writes a value in a register of the device through I2C. - * @param DeviceAddr: The address of the IOExpander, could be : IOE_1_ADDR - * or IOE_2_ADDR. - * @param RegisterAddr: The target register address - * @param RegisterValue: The target register value to be written - * @retval IOE_OK: if all operations are OK. Other value if error. - */ -uint8_t I2C_WriteDeviceRegister(uint8_t DeviceAddr, uint8_t RegisterAddr, uint8_t RegisterValue) -{ - uint8_t read_verif = 0; - uint8_t IOE_BufferTX = 0; - - /* Get Value to be written */ - IOE_BufferTX = RegisterValue; - - /* Configure DMA Peripheral */ - IOE_DMA_Config(IOE_DMA_TX, (uint8_t*)(&IOE_BufferTX)); - - /* Enable the I2C peripheral */ - I2C_GenerateSTART(IOE_I2C, ENABLE); - - /* Test on SB Flag */ - IOE_TimeOut = TIMEOUT_MAX; - while (I2C_GetFlagStatus(IOE_I2C,I2C_FLAG_SB) == RESET) - { - if (IOE_TimeOut-- == 0) return(IOE_TimeoutUserCallback()); - } - - /* Transmit the slave address and enable writing operation */ - I2C_Send7bitAddress(IOE_I2C, DeviceAddr, I2C_Direction_Transmitter); - - /* Test on ADDR Flag */ - IOE_TimeOut = TIMEOUT_MAX; - while (!I2C_CheckEvent(IOE_I2C, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)) - { - if (IOE_TimeOut-- == 0) return(IOE_TimeoutUserCallback()); - } - - /* Transmit the first address for r/w operations */ - I2C_SendData(IOE_I2C, RegisterAddr); - - /* Test on TXE FLag (data dent) */ - IOE_TimeOut = TIMEOUT_MAX; - while ((!I2C_GetFlagStatus(IOE_I2C,I2C_FLAG_TXE)) && (!I2C_GetFlagStatus(IOE_I2C,I2C_FLAG_BTF))) - { - if (IOE_TimeOut-- == 0) return(IOE_TimeoutUserCallback()); - } - - /* Enable I2C DMA request */ - I2C_DMACmd(IOE_I2C,ENABLE); - - /* Enable DMA TX Channel */ - DMA_Cmd(IOE_DMA_TX_STREAM, ENABLE); - - /* Wait until DMA Transfer Complete */ - IOE_TimeOut = TIMEOUT_MAX; - while (!DMA_GetFlagStatus(IOE_DMA_TX_STREAM,IOE_DMA_TX_TCFLAG)) - { - if (IOE_TimeOut-- == 0) return(IOE_TimeoutUserCallback()); - } - - /* Wait until BTF Flag is set before generating STOP */ - IOE_TimeOut = 2 * TIMEOUT_MAX; - while ((!I2C_GetFlagStatus(IOE_I2C,I2C_FLAG_BTF))) - { - } - - /* Send STOP Condition */ - I2C_GenerateSTOP(IOE_I2C, ENABLE); - - /* Disable DMA TX Channel */ - DMA_Cmd(IOE_DMA_TX_STREAM, DISABLE); - - /* Disable I2C DMA request */ - I2C_DMACmd(IOE_I2C,DISABLE); - - /* Clear DMA TX Transfer Complete Flag */ - DMA_ClearFlag(IOE_DMA_TX_STREAM,IOE_DMA_TX_TCFLAG); - -#ifdef VERIFY_WRITTENDATA - /* Verify (if needed) that the loaded data is correct */ - - /* Read the just written register*/ - read_verif = I2C_ReadDeviceRegister(DeviceAddr, RegisterAddr); - /* Load the register and verify its value */ - if (read_verif != RegisterValue) - { - /* Control data wrongly transfered */ - read_verif = IOE_FAILURE; - } - else - { - /* Control data correctly transfered */ - read_verif = 0; - } -#endif - - /* Return the verifying value: 0 (Passed) or 1 (Failed) */ - return (read_verif); -} - -/** - * @brief Reads a register of the device through I2C. - * @param DeviceAddr: The address of the device, could be : IOE_1_ADDR - * or IOE_2_ADDR. - * @param RegisterAddr: The target register address (between 00x and 0x24) - * @retval The value of the read register (0xAA if Timeout occurred) - */ -uint8_t I2C_ReadDeviceRegister(uint8_t DeviceAddr, uint8_t RegisterAddr) -{ - uint8_t IOE_BufferRX[2] = {0x00, 0x00}; - - /* Configure DMA Peripheral */ - IOE_DMA_Config(IOE_DMA_RX, (uint8_t*)IOE_BufferRX); - - /* Enable DMA NACK automatic generation */ - I2C_DMALastTransferCmd(IOE_I2C, ENABLE); - - /* Enable the I2C peripheral */ - I2C_GenerateSTART(IOE_I2C, ENABLE); - - /* Test on SB Flag */ - IOE_TimeOut = TIMEOUT_MAX; - while (!I2C_GetFlagStatus(IOE_I2C,I2C_FLAG_SB)) - { - if (IOE_TimeOut-- == 0) return(IOE_TimeoutUserCallback()); - } - - /* Send device address for write */ - I2C_Send7bitAddress(IOE_I2C, DeviceAddr, I2C_Direction_Transmitter); - - /* Test on ADDR Flag */ - IOE_TimeOut = TIMEOUT_MAX; - while (!I2C_CheckEvent(IOE_I2C, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)) - { - if (IOE_TimeOut-- == 0) return(IOE_TimeoutUserCallback()); - } - - /* Send the device's internal address to write to */ - I2C_SendData(IOE_I2C, RegisterAddr); - - /* Test on TXE FLag (data dent) */ - IOE_TimeOut = TIMEOUT_MAX; - while ((!I2C_GetFlagStatus(IOE_I2C,I2C_FLAG_TXE)) && (!I2C_GetFlagStatus(IOE_I2C,I2C_FLAG_BTF))) - { - if (IOE_TimeOut-- == 0) return(IOE_TimeoutUserCallback()); - } - - /* Send START condition a second time */ - I2C_GenerateSTART(IOE_I2C, ENABLE); - - /* Test on SB Flag */ - IOE_TimeOut = TIMEOUT_MAX; - while (!I2C_GetFlagStatus(IOE_I2C,I2C_FLAG_SB)) - { - if (IOE_TimeOut-- == 0) return(IOE_TimeoutUserCallback()); - } - - /* Send IOExpander address for read */ - I2C_Send7bitAddress(IOE_I2C, DeviceAddr, I2C_Direction_Receiver); - - /* Test on ADDR Flag */ - IOE_TimeOut = TIMEOUT_MAX; - while (!I2C_CheckEvent(IOE_I2C, I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED)) - { - if (IOE_TimeOut-- == 0) return(IOE_TimeoutUserCallback()); - } - - /* Enable I2C DMA request */ - I2C_DMACmd(IOE_I2C,ENABLE); - - /* Enable DMA RX Channel */ - DMA_Cmd(IOE_DMA_RX_STREAM, ENABLE); - - /* Wait until DMA Transfer Complete */ - IOE_TimeOut = 2 * TIMEOUT_MAX; - while (!DMA_GetFlagStatus(IOE_DMA_RX_STREAM,IOE_DMA_RX_TCFLAG)) - { - if (IOE_TimeOut-- == 0) return(IOE_TimeoutUserCallback()); - } - - /* Send STOP Condition */ - I2C_GenerateSTOP(IOE_I2C, ENABLE); - - /* Disable DMA RX Channel */ - DMA_Cmd(IOE_DMA_RX_STREAM, DISABLE); - - /* Disable I2C DMA request */ - I2C_DMACmd(IOE_I2C,DISABLE); - - /* Clear DMA RX Transfer Complete Flag */ - DMA_ClearFlag(IOE_DMA_RX_STREAM,IOE_DMA_RX_TCFLAG); - - /* return a pointer to the IOE_Buffer */ - return (uint8_t)IOE_BufferRX[0]; -} - - -/** - * @brief Reads a buffer of 2 bytes from the device registers. - * @param DeviceAddr: The address of the device, could be : IOE_1_ADDR - * or IOE_2_ADDR. - * @param RegisterAddr: The target register address (between 00x and 0x24) - * @retval A pointer to the buffer containing the two returned bytes (in halfword). - */ -uint16_t I2C_ReadDataBuffer(uint8_t DeviceAddr, uint8_t RegisterAddr) -{ - uint8_t tmp= 0; - uint8_t IOE_BufferRX[2] = {0x00, 0x00}; - - /* Configure DMA Peripheral */ - IOE_DMA_Config(IOE_DMA_RX, (uint8_t*)IOE_BufferRX); - - /* Enable DMA NACK automatic generation */ - I2C_DMALastTransferCmd(IOE_I2C, ENABLE); - - /* Enable the I2C peripheral */ - I2C_GenerateSTART(IOE_I2C, ENABLE); - - /* Test on SB Flag */ - IOE_TimeOut = TIMEOUT_MAX; - while (!I2C_GetFlagStatus(IOE_I2C,I2C_FLAG_SB)) - { - if (IOE_TimeOut-- == 0) return(IOE_TimeoutUserCallback()); - } - - /* Send device address for write */ - I2C_Send7bitAddress(IOE_I2C, DeviceAddr, I2C_Direction_Transmitter); - - /* Test on ADDR Flag */ - IOE_TimeOut = TIMEOUT_MAX; - while (!I2C_CheckEvent(IOE_I2C, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)) - { - if (IOE_TimeOut-- == 0) return(IOE_TimeoutUserCallback()); - } - - /* Send the device's internal address to write to */ - I2C_SendData(IOE_I2C, RegisterAddr); - - /* Test on TXE FLag (data dent) */ - IOE_TimeOut = TIMEOUT_MAX; - while ((!I2C_GetFlagStatus(IOE_I2C,I2C_FLAG_TXE)) && (!I2C_GetFlagStatus(IOE_I2C,I2C_FLAG_BTF))) - { - if (IOE_TimeOut-- == 0) return(IOE_TimeoutUserCallback()); - } - - /* Send START condition a second time */ - I2C_GenerateSTART(IOE_I2C, ENABLE); - - /* Test on SB Flag */ - IOE_TimeOut = TIMEOUT_MAX; - while (!I2C_GetFlagStatus(IOE_I2C,I2C_FLAG_SB)) - { - if (IOE_TimeOut-- == 0) return(IOE_TimeoutUserCallback()); - } - - /* Send IOExpander address for read */ - I2C_Send7bitAddress(IOE_I2C, DeviceAddr, I2C_Direction_Receiver); - - /* Test on ADDR Flag */ - IOE_TimeOut = TIMEOUT_MAX; - while (!I2C_CheckEvent(IOE_I2C, I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED)) - { - if (IOE_TimeOut-- == 0) return(IOE_TimeoutUserCallback()); - } - - /* Enable I2C DMA request */ - I2C_DMACmd(IOE_I2C,ENABLE); - - /* Enable DMA RX Channel */ - DMA_Cmd(IOE_DMA_RX_STREAM, ENABLE); - - /* Wait until DMA Transfer Complete */ - IOE_TimeOut = 2 * TIMEOUT_MAX; - while (!DMA_GetFlagStatus(IOE_DMA_RX_STREAM, IOE_DMA_RX_TCFLAG)) - { - if (IOE_TimeOut-- == 0) return(IOE_TimeoutUserCallback()); - } - - /* Send STOP Condition */ - I2C_GenerateSTOP(IOE_I2C, ENABLE); - - /* Disable DMA RX Channel */ - DMA_Cmd(IOE_DMA_RX_STREAM, DISABLE); - - /* Disable I2C DMA request */ - I2C_DMACmd(IOE_I2C,DISABLE); - - /* Clear DMA RX Transfer Complete Flag */ - DMA_ClearFlag(IOE_DMA_RX_STREAM,IOE_DMA_RX_TCFLAG); - - /* Reorganize received data */ - tmp = IOE_BufferRX[0]; - IOE_BufferRX[0] = IOE_BufferRX[1]; - IOE_BufferRX[1] = tmp; - - /* return a pointer to the IOE_Buffer */ - return (*(__IO uint16_t *) IOE_BufferRX); -} - -/** - * @brief Return Touch Screen X position value - * @param None - * @retval X position. - */ -static uint16_t IOE_TS_Read_X(void) -{ - int32_t x, xr; - - x = I2C_ReadDataBuffer(IOE_1_ADDR, IOE_REG_TSC_DATA_Y); - - /* first correction */ - xr = (x * 320) >> 12; - /* second correction */ - xr = ((xr * 32)/29) - 17; - - if(xr <= 0) - xr = 0; - - return (uint16_t)(xr); -} - -/** - * @brief Return Touch Screen Y position value - * @param None - * @retval Y position. - */ -static uint16_t IOE_TS_Read_Y(void) -{ - int32_t y, yr; - y= I2C_ReadDataBuffer(IOE_1_ADDR, IOE_REG_TSC_DATA_X); - - yr= (y * 240) >> 12; - yr = ((yr * 240) / 217) - 12; - - if(yr <= 0) - yr = 0; - - return (uint16_t)(yr); -} - -/** - * @brief Return Touch Screen Z position value - * @param None - * @retval Z position. - */ -static uint16_t IOE_TS_Read_Z(void) -{ - uint32_t z; - z = I2C_ReadDataBuffer(IOE_1_ADDR, IOE_REG_TSC_DATA_Z); - - - if(z <= 0) - z = 0; - - return (uint16_t)(z); -} - -/** - * @brief Initializes the GPIO pins used by the IO expander. - * @param None - * @retval None - */ -static void IOE_GPIO_Config(void) -{ - GPIO_InitTypeDef GPIO_InitStructure; - - /* Enable IOE_I2C and IOE_I2C_GPIO_PORT & Alternate Function clocks */ - RCC_APB1PeriphClockCmd(IOE_I2C_CLK, ENABLE); - RCC_AHB1PeriphClockCmd(IOE_I2C_SCL_GPIO_CLK | IOE_I2C_SDA_GPIO_CLK | - IOE_IT_GPIO_CLK, ENABLE); - RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); - - /* Reset IOE_I2C IP */ - RCC_APB1PeriphResetCmd(IOE_I2C_CLK, ENABLE); - - /* Release reset signal of IOE_I2C IP */ - RCC_APB1PeriphResetCmd(IOE_I2C_CLK, DISABLE); - - /* Connect PXx to I2C_SCL*/ - GPIO_PinAFConfig(IOE_I2C_SCL_GPIO_PORT, IOE_I2C_SCL_SOURCE, IOE_I2C_SCL_AF); - /* Connect PXx to I2C_SDA*/ - GPIO_PinAFConfig(IOE_I2C_SDA_GPIO_PORT, IOE_I2C_SDA_SOURCE, IOE_I2C_SDA_AF); - - /* IOE_I2C SCL and SDA pins configuration */ - GPIO_InitStructure.GPIO_Pin = IOE_I2C_SCL_PIN; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_InitStructure.GPIO_OType = GPIO_OType_OD; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - GPIO_Init(IOE_I2C_SCL_GPIO_PORT, &GPIO_InitStructure); - - GPIO_InitStructure.GPIO_Pin = IOE_I2C_SDA_PIN; - GPIO_Init(IOE_I2C_SDA_GPIO_PORT, &GPIO_InitStructure); - - /* Set EXTI pin as Input PullUp - IO_Expander_INT */ - GPIO_InitStructure.GPIO_Pin = IOE_IT_PIN; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - GPIO_Init(IOE_IT_GPIO_PORT, &GPIO_InitStructure); - - /* Connect Button EXTI Line to Button GPIO Pin */ - SYSCFG_EXTILineConfig(IOE_IT_EXTI_PORT_SOURCE, IOE_IT_EXTI_PIN_SOURCE); -} - -/** - * @brief Configure the I2C Peripheral used to communicate with IO_Expanders. - * @param None - * @retval None - */ -static void IOE_I2C_Config(void) -{ - I2C_InitTypeDef I2C_InitStructure; - - /* IOE_I2C configuration */ - I2C_InitStructure.I2C_Mode = I2C_Mode_I2C; - I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2; - I2C_InitStructure.I2C_OwnAddress1 = 0x00; - I2C_InitStructure.I2C_Ack = I2C_Ack_Enable; - I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit; - I2C_InitStructure.I2C_ClockSpeed = I2C_SPEED; - - I2C_Init(IOE_I2C, &I2C_InitStructure); -} - -/** - * @brief Configure the DMA Peripheral used to handle communication via I2C. - * @param None - * @retval None - */ - -static void IOE_DMA_Config(IOE_DMADirection_TypeDef Direction, uint8_t* buffer) -{ - DMA_InitTypeDef DMA_InitStructure; - - RCC_AHB1PeriphClockCmd(IOE_DMA_CLK, ENABLE); - - /* Initialize the DMA_Channel member */ - DMA_InitStructure.DMA_Channel = IOE_DMA_CHANNEL; - - /* Initialize the DMA_PeripheralBaseAddr member */ - DMA_InitStructure.DMA_PeripheralBaseAddr = IOE_I2C_DR; - - /* Initialize the DMA_Memory0BaseAddr member */ - DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)buffer; - - /* Initialize the DMA_PeripheralInc member */ - DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; - - /* Initialize the DMA_MemoryInc member */ - DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; - - /* Initialize the DMA_PeripheralDataSize member */ - DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte; - - /* Initialize the DMA_MemoryDataSize member */ - DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte; - - /* Initialize the DMA_Mode member */ - DMA_InitStructure.DMA_Mode = DMA_Mode_Normal; - - /* Initialize the DMA_Priority member */ - DMA_InitStructure.DMA_Priority = DMA_Priority_Low; - - /* Initialize the DMA_FIFOMode member */ - DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Enable; - - /* Initialize the DMA_FIFOThreshold member */ - DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_1QuarterFull; - - /* Initialize the DMA_MemoryBurst member */ - DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single; - - /* Initialize the DMA_PeripheralBurst member */ - DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single; - - /* If using DMA for Reception */ - if (Direction == IOE_DMA_RX) - { - /* Initialize the DMA_DIR member */ - DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory; - - /* Initialize the DMA_BufferSize member */ - DMA_InitStructure.DMA_BufferSize = 2; - - DMA_DeInit(IOE_DMA_RX_STREAM); - - DMA_Init(IOE_DMA_RX_STREAM, &DMA_InitStructure); - } - /* If using DMA for Transmission */ - else if (Direction == IOE_DMA_TX) - { - /* Initialize the DMA_DIR member */ - DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral; - - /* Initialize the DMA_BufferSize member */ - DMA_InitStructure.DMA_BufferSize = 1; - - DMA_DeInit(IOE_DMA_TX_STREAM); - - DMA_Init(IOE_DMA_TX_STREAM, &DMA_InitStructure); - } -} - - -/** - * @brief Configures the IO expander Interrupt line and GPIO in EXTI mode. - * @param None - * @retval None - */ -static void IOE_EXTI_Config(void) -{ - GPIO_InitTypeDef GPIO_InitStructure; - NVIC_InitTypeDef NVIC_InitStructure; - EXTI_InitTypeDef EXTI_InitStructure; - - /* Enable GPIO clock */ - RCC_AHB1PeriphClockCmd(IOE_IT_GPIO_CLK, ENABLE); - RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); - - /* Configure Button pin as input floating */ - GPIO_InitStructure.GPIO_Pin = IOE_IT_PIN; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - GPIO_Init(IOE_IT_GPIO_PORT, &GPIO_InitStructure); - - /* Connect Button EXTI Line to Button GPIO Pin */ - SYSCFG_EXTILineConfig(IOE_IT_EXTI_PORT_SOURCE, IOE_IT_EXTI_PIN_SOURCE); - - /* Configure Button EXTI line */ - EXTI_InitStructure.EXTI_Line = IOE_IT_EXTI_LINE; - EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; - EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling; - EXTI_InitStructure.EXTI_LineCmd = ENABLE; - EXTI_Init(&EXTI_InitStructure); - - /* Enable and set Button EXTI Interrupt to the lowest priority */ - NVIC_InitStructure.NVIC_IRQChannel = IOE_IT_EXTI_IRQn; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F; - NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - NVIC_Init(&NVIC_InitStructure); -} - -#ifndef USE_Delay -/** - * @brief Inserts a delay time. - * @param nCount: specifies the delay time length. - * @retval None - */ -static void delay(__IO uint32_t nCount) -{ - __IO uint32_t index = 0; - for(index = (100000 * nCount); index != 0; index--) - { - } -} -#endif /* USE_Delay*/ -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_ioe.h b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_ioe.h deleted file mode 100644 index 6f07800d1..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_ioe.h +++ /dev/null @@ -1,565 +0,0 @@ -/** - ****************************************************************************** - * @file stm322xg_eval_ioe.h - * @author MCD Application Team - * @version V5.0.3 - * @date 09-March-2012 - * @brief This file contains all the functions prototypes for the - * stm322xg_eval_ioe.c driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - - /* File Info : --------------------------------------------------------------- - SUPPORTED FEATURES: - - IO Read/write : Set/Reset and Read (Polling/Interrupt) - - Joystick: config and Read (Polling/Interrupt) - - Touch Screen Features: Single point mode (Polling/Interrupt) - - TempSensor Feature: accuracy not determined (Polling). - - UNSUPPORTED FEATURES: - - Row ADC Feature is not supported (not implemented on STM322xG_EVAL board) - ----------------------------------------------------------------------------*/ - - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __STM322xG_EVAL_IOE_H -#define __STM322xG_EVAL_IOE_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include "stm322xg_eval.h" - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL - * @{ - */ - -/** @defgroup STM322xG_EVAL_IOE - * @{ - */ - - -/** @defgroup STM322xG_EVAL_IOE_Exported_Types - * @{ - */ - -/** - * @brief Touch Screen Information structure - */ -typedef struct -{ - uint16_t TouchDetected; - uint16_t X; - uint16_t Y; - uint16_t Z; -}TS_STATE; - -/** - * @brief Joystick State definitions - */ -#ifndef __STM322xG_EVAL_H -typedef enum -{ - JOY_NONE = 0, - JOY_SEL = 1, - JOY_DOWN = 2, - JOY_LEFT = 3, - JOY_RIGHT = 4, - JOY_UP = 5 -} JOYState_TypeDef -; -#endif /* __STM322xG_EVAL_H */ - -/** - * @brief IO_Expander Error codes - */ -typedef enum -{ - IOE_OK = 0, - IOE_FAILURE, - IOE_TIMEOUT, - PARAM_ERROR, - IOE1_NOT_OPERATIONAL, - IOE2_NOT_OPERATIONAL -}IOE_Status_TypDef; - -/** - * @brief IO bit values - */ -typedef enum -{ - BitReset = 0, - BitSet = 1 -}IOE_BitValue_TypeDef; - -/** - * @brief IOE DMA Direction - */ -typedef enum -{ - IOE_DMA_TX = 0, - IOE_DMA_RX = 1 -}IOE_DMADirection_TypeDef; - - -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_IOE_Exported_Constants - * @{ - */ - -/** - * @brief Uncomment the line below to enable verfying each written byte in write - * operation. The I2C_WriteDeviceRegister() function will then compare the - * written and read data and return error status if a mismatch occurs. - */ -/* #define VERIFY_WRITTENDATA */ - -/** - * @brief Uncomment the line below if you want to use user timeout callback. - * Function prototypes is declared in this file but function body may be - * implemented into user application. - */ -/* #define USE_TIMEOUT_USER_CALLBACK */ - -/** - * @brief Uncomment the line below if you want to use user defined Delay function - * (for precise timing), otherwise default _delay_ function defined within - * this driver is used (less precise timing). - */ -/* #define USE_Delay */ - -#ifdef USE_Delay -#include "main.h" - - #define _delay_ Delay /* !< User can provide more timing precise _delay_ function - (with 10ms time base), using SysTick for example */ -#else - #define _delay_ delay /* !< Default _delay_ function with less precise timing */ -#endif - -/*------------------------------------------------------------------------------ - Hardware Configuration -------------------------------------------------------------------------------*/ -/** - * @brief I2C port definitions - */ -#define IOE_I2C I2C1 -#define IOE_I2C_CLK RCC_APB1Periph_I2C1 -#define IOE_I2C_SCL_PIN GPIO_Pin_6 -#define IOE_I2C_SCL_GPIO_PORT GPIOB -#define IOE_I2C_SCL_GPIO_CLK RCC_AHB1Periph_GPIOB -#define IOE_I2C_SCL_SOURCE GPIO_PinSource6 -#define IOE_I2C_SCL_AF GPIO_AF_I2C1 -#define IOE_I2C_SDA_PIN GPIO_Pin_9 -#define IOE_I2C_SDA_GPIO_PORT GPIOB -#define IOE_I2C_SDA_GPIO_CLK RCC_AHB1Periph_GPIOB -#define IOE_I2C_SDA_SOURCE GPIO_PinSource9 -#define IOE_I2C_SDA_AF GPIO_AF_I2C1 -#define IOE_I2C_DR ((uint32_t)0x40005410) - -/* I2C clock speed configuration (in Hz) - WARNING: - Make sure that this define is not already declared in other files (ie. - stm322xg_eval.h file). It can be used in parallel by other modules. */ -#ifndef I2C_SPEED - #define I2C_SPEED 100000 -#endif /* I2C_SPEED */ - -/** - * @brief IOE DMA definitions - */ -#define IOE_DMA_CLK RCC_AHB1Periph_DMA1 -#define IOE_DMA_CHANNEL DMA_Channel_1 - -#ifndef IOE_DMA_TX_STREAM - #define IOE_DMA_TX_STREAM DMA1_Stream6 -#endif /* IOE_DMA_TX_STREAM */ - -#ifndef IOE_DMA_TX_TCFLAG - #define IOE_DMA_TX_TCFLAG DMA_FLAG_TCIF6 -#endif /* IOE_DMA_TX_TCFLAG */ - -#ifndef IOE_DMA_RX_STREAM - #define IOE_DMA_RX_STREAM DMA1_Stream0 -#endif /* IOE_DMA_RX_STREAM */ - -#ifndef IOE_DMA_RX_TCFLAG - #define IOE_DMA_RX_TCFLAG DMA_FLAG_TCIF0 -#endif /* IOE_DMA_RX_TCFLAG */ - -/** - * @brief IO Expander Interrupt line on EXTI - */ -#define IOE_IT_PIN GPIO_Pin_2 -#define IOE_IT_GPIO_PORT GPIOI -#define IOE_IT_GPIO_CLK RCC_AHB1Periph_GPIOI -#define IOE_IT_EXTI_PORT_SOURCE EXTI_PortSourceGPIOI -#define IOE_IT_EXTI_PIN_SOURCE EXTI_PinSource2 -#define IOE_IT_EXTI_LINE EXTI_Line2 -#define IOE_IT_EXTI_IRQn EXTI2_IRQn - -/** - * @brief Eval Board IO Pins definition - */ -#define AUDIO_RESET_PIN IO_Pin_2 /* IO_Exapnader_2 */ /* Output */ -#define MII_INT_PIN IO_Pin_0 /* IO_Exapnader_2 */ /* Output */ -#define VBAT_DIV_PIN IO_Pin_0 /* IO_Exapnader_1 */ /* Output */ -#define MEMS_INT1_PIN IO_Pin_3 /* IO_Exapnader_1 */ /* Input */ -#define MEMS_INT2_PIN IO_Pin_2 /* IO_Exapnader_1 */ /* Input */ - -/** - * @brief Eval Board both IO Exapanders Pins definition - */ -#define IO1_IN_ALL_PINS (uint32_t)(MEMS_INT1_PIN | MEMS_INT2_PIN) -#define IO2_IN_ALL_PINS (uint32_t)(JOY_IO_PINS) -#define IO1_OUT_ALL_PINS (uint32_t)(VBAT_DIV_PIN) -#define IO2_OUT_ALL_PINS (uint32_t)(AUDIO_RESET_PIN | MII_INT_PIN) - -/** - * @brief The 7 bits IO Expanders adresses and chip IDs - */ -#define IOE_1_ADDR 0x82 -#define IOE_2_ADDR 0x88 -#define STMPE811_ID 0x0811 - - -/*------------------------------------------------------------------------------ - Functional and Interrupt Management -------------------------------------------------------------------------------*/ -/** - * @brief IO Expander Functionalities definitions - */ -#define IOE_ADC_FCT 0x01 -#define IOE_TS_FCT 0x02 -#define IOE_IO_FCT 0x04 -#define IOE_TEMPSENS_FCT 0x08 - -/** - * @brief Interrupt source configuration definitons - */ -#define IOE_ITSRC_TSC 0x01 /* IO_Exapnder 1 */ -#define IOE_ITSRC_INMEMS 0x02 /* IO_Exapnder 1 */ -#define IOE_ITSRC_JOYSTICK 0x04 /* IO_Exapnder 2 */ -#define IOE_ITSRC_TEMPSENS 0x08 /* IO_Exapnder 2 */ - -/** - * @brief Glaobal Interrupts definitions - */ -#define IOE_GIT_GPIO 0x80 -#define IOE_GIT_ADC 0x40 -#define IOE_GIT_TEMP 0x20 -#define IOE_GIT_FE 0x10 -#define IOE_GIT_FF 0x08 -#define IOE_GIT_FOV 0x04 -#define IOE_GIT_FTH 0x02 -#define IOE_GIT_TOUCH 0x01 - - -/*------------------------------------------------------------------------------ - STMPE811 device register definition -------------------------------------------------------------------------------*/ -/** - * @brief Identification registers - */ -#define IOE_REG_CHP_ID 0x00 -#define IOE_REG_ID_VER 0x02 - -/** - * @brief General Control Registers - */ -#define IOE_REG_SYS_CTRL1 0x03 -#define IOE_REG_SYS_CTRL2 0x04 -#define IOE_REG_SPI_CFG 0x08 - -/** - * @brief Interrupt Control register - */ -#define IOE_REG_INT_CTRL 0x09 -#define IOE_REG_INT_EN 0x0A -#define IOE_REG_INT_STA 0x0B -#define IOE_REG_GPIO_INT_EN 0x0C -#define IOE_REG_GPIO_INT_STA 0x0D - -/** - * @brief GPIO Registers - */ -#define IOE_REG_GPIO_SET_PIN 0x10 -#define IOE_REG_GPIO_CLR_PIN 0x11 -#define IOE_REG_GPIO_MP_STA 0x12 -#define IOE_REG_GPIO_DIR 0x13 -#define IOE_REG_GPIO_ED 0x14 -#define IOE_REG_GPIO_RE 0x15 -#define IOE_REG_GPIO_FE 0x16 -#define IOE_REG_GPIO_AF 0x17 - -/** - * @brief ADC Registers - */ -#define IOE_REG_ADC_INT_EN 0x0E -#define IOE_REG_ADC_INT_STA 0x0F -#define IOE_REG_ADC_CTRL1 0x20 -#define IOE_REG_ADC_CTRL2 0x21 -#define IOE_REG_ADC_CAPT 0x22 -#define IOE_REG_ADC_DATA_CH0 0x30 /* 16-Bit register */ -#define IOE_REG_ADC_DATA_CH1 0x32 /* 16-Bit register */ -#define IOE_REG_ADC_DATA_CH2 0x34 /* 16-Bit register */ -#define IOE_REG_ADC_DATA_CH3 0x36 /* 16-Bit register */ -#define IOE_REG_ADC_DATA_CH4 0x38 /* 16-Bit register */ -#define IOE_REG_ADC_DATA_CH5 0x3A /* 16-Bit register */ -#define IOE_REG_ADC_DATA_CH6 0x3B /* 16-Bit register */ -#define IOE_REG_ADC_DATA_CH7 0x3C /* 16-Bit register */ - -/** - * @brief TouchScreen Registers - */ -#define IOE_REG_TSC_CTRL 0x40 -#define IOE_REG_TSC_CFG 0x41 -#define IOE_REG_WDM_TR_X 0x42 -#define IOE_REG_WDM_TR_Y 0x44 -#define IOE_REG_WDM_BL_X 0x46 -#define IOE_REG_WDM_BL_Y 0x48 -#define IOE_REG_FIFO_TH 0x4A -#define IOE_REG_FIFO_STA 0x4B -#define IOE_REG_FIFO_SIZE 0x4C -#define IOE_REG_TSC_DATA_X 0x4D -#define IOE_REG_TSC_DATA_Y 0x4F -#define IOE_REG_TSC_DATA_Z 0x51 -#define IOE_REG_TSC_DATA_XYZ 0x52 -#define IOE_REG_TSC_FRACT_XYZ 0x56 -#define IOE_REG_TSC_DATA 0x57 -#define IOE_REG_TSC_I_DRIVE 0x58 -#define IOE_REG_TSC_SHIELD 0x59 - -/** - * @brief Temperature Sensor registers - */ -#define IOE_REG_TEMP_CTRL 0x60 -#define IOE_REG_TEMP_DATA 0x61 -#define IOE_REG_TEMP_TH 0x62 - - -/*------------------------------------------------------------------------------ - Functions parameters defines -------------------------------------------------------------------------------*/ -/** - * @brief Touch Screen Pins definition - */ -#define TOUCH_YD IO_Pin_1 /* IO_Exapnader_1 */ /* Input */ -#define TOUCH_XD IO_Pin_2 /* IO_Exapnader_1 */ /* Input */ -#define TOUCH_YU IO_Pin_3 /* IO_Exapnader_1 */ /* Input */ -#define TOUCH_XU IO_Pin_4 /* IO_Exapnader_1 */ /* Input */ -#define TOUCH_IO_ALL (uint32_t)(IO_Pin_1 | IO_Pin_2 | IO_Pin_3 | IO_Pin_4) - -/** - * @brief JOYSTICK Pins definition - */ -#define JOY_IO_SEL IO_Pin_7 -#define JOY_IO_DOWN IO_Pin_6 -#define JOY_IO_LEFT IO_Pin_5 -#define JOY_IO_RIGHT IO_Pin_4 -#define JOY_IO_UP IO_Pin_3 -#define JOY_IO_NONE JOY_IO_PINS -#define JOY_IO_PINS (uint32_t)(IO_Pin_3 | IO_Pin_4 | IO_Pin_5 | IO_Pin_6 | IO_Pin_7) - -/** - * @brief IO Pins - */ -#define IO_Pin_0 0x01 -#define IO_Pin_1 0x02 -#define IO_Pin_2 0x04 -#define IO_Pin_3 0x08 -#define IO_Pin_4 0x10 -#define IO_Pin_5 0x20 -#define IO_Pin_6 0x40 -#define IO_Pin_7 0x80 -#define IO_Pin_ALL 0xFF - -/** - * @brief IO Pin directions - */ -#define Direction_IN 0x00 -#define Direction_OUT 0x01 - -/** - * @brief Interrupt Line output parameters - */ -#define Polarity_Low 0x00 -#define Polarity_High 0x04 -#define Type_Level 0x00 -#define Type_Edge 0x02 - -/** - * @brief IO Interrupts - */ -#define IO_IT_0 0x01 -#define IO_IT_1 0x02 -#define IO_IT_2 0x04 -#define IO_IT_3 0x08 -#define IO_IT_4 0x10 -#define IO_IT_5 0x20 -#define IO_IT_6 0x40 -#define IO_IT_7 0x80 -#define ALL_IT 0xFF -#define IOE_JOY_IT (uint8_t)(IO_IT_3 | IO_IT_4 | IO_IT_5 | IO_IT_6 | IO_IT_7) -#define IOE_TS_IT (uint8_t)(IO_IT_0 | IO_IT_1 | IO_IT_2) -#define IOE_INMEMS_IT (uint8_t)(IO_IT_2 | IO_IT_3) - -/** - * @brief Edge detection value - */ -#define EDGE_FALLING 0x01 -#define EDGE_RISING 0x02 - -/** - * @brief Global interrupt Enable bit - */ -#define IOE_GIT_EN 0x01 - -/** - * @} - */ - - - -/** @defgroup STM322xG_EVAL_IOE_Exported_Macros - * @{ - */ -/** - * @} - */ - - - -/** @defgroup STM322xG_EVAL_IOE_Exported_Functions - * @{ - */ - -/** - * @brief Configuration and initialization functions - */ -uint8_t IOE_Config(void); -uint8_t IOE_ITConfig(uint32_t IOE_ITSRC_Source); - -/** - * @brief Timeout user callback function. This function is called when a timeout - * condition occurs during communication with IO Expander. Only protoype - * of this function is decalred in IO Expander driver. Its implementation - * may be done into user application. This function may typically stop - * current operations and reset the I2C peripheral and IO Expander. - * To enable this function use uncomment the define USE_TIMEOUT_USER_CALLBACK - * at the top of this file. - */ -#ifdef USE_TIMEOUT_USER_CALLBACK - uint8_t IOE_TimeoutUserCallback(void); -#else - #define IOE_TimeoutUserCallback() IOE_TIMEOUT -#endif /* USE_TIMEOUT_USER_CALLBACK */ - -/** - * @brief IO pins control functions - */ -uint8_t IOE_WriteIOPin(uint8_t IO_Pin, IOE_BitValue_TypeDef BitVal); -uint8_t IOE_ReadIOPin(uint32_t IO_Pin); -JOYState_TypeDef - IOE_JoyStickGetState(void); - -/** - * @brief Touch Screen controller functions - */ -TS_STATE* IOE_TS_GetState(void); - -/** - * @brief Interrupts Mangement functions - */ -FlagStatus IOE_GetGITStatus(uint8_t DeviceAddr, uint8_t Global_IT); -uint8_t IOE_ClearGITPending(uint8_t DeviceAddr, uint8_t IO_IT); -FlagStatus IOE_GetIOITStatus(uint8_t DeviceAddr, uint8_t IO_IT); -uint8_t IOE_ClearIOITPending(uint8_t DeviceAddr, uint8_t IO_IT); - -/** - * @brief Temperature Sensor functions - */ -uint32_t IOE_TempSens_GetData(void); - -/** - * @brief IO-Expander Control functions - */ -uint8_t IOE_IsOperational(uint8_t DeviceAddr); -uint8_t IOE_Reset(uint8_t DeviceAddr); -uint16_t IOE_ReadID(uint8_t DeviceAddr); - -uint8_t IOE_FnctCmd(uint8_t DeviceAddr, uint8_t Fct, FunctionalState NewState); -uint8_t IOE_IOPinConfig(uint8_t DeviceAddr, uint8_t IO_Pin, uint8_t Direction); -uint8_t IOE_GITCmd(uint8_t DeviceAddr, FunctionalState NewState); -uint8_t IOE_GITConfig(uint8_t DeviceAddr, uint8_t Global_IT, FunctionalState NewState); -uint8_t IOE_IOITConfig(uint8_t DeviceAddr, uint8_t IO_IT, FunctionalState NewState); - -/** - * @brief Low Layer functions - */ -uint8_t IOE_TS_Config(void); -uint8_t IOE_TempSens_Config(void); -uint8_t IOE_IOAFConfig(uint8_t DeviceAddr, uint8_t IO_Pin, FunctionalState NewState); -uint8_t IOE_IOEdgeConfig(uint8_t DeviceAddr, uint8_t IO_Pin, uint8_t Edge); -uint8_t IOE_ITOutConfig(uint8_t Polarity, uint8_t Type); - -uint8_t I2C_WriteDeviceRegister(uint8_t DeviceAddr, uint8_t RegisterAddr, uint8_t RegisterValue); -uint8_t I2C_ReadDeviceRegister(uint8_t DeviceAddr, uint8_t RegisterAddr); -uint16_t I2C_ReadDataBuffer(uint8_t DeviceAddr, uint8_t RegisterAddr); - -#ifdef __cplusplus -} -#endif -#endif /* __STM322xG_EVAL_IOE_H */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_lcd.c b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_lcd.c deleted file mode 100644 index 5bc078b6f..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_lcd.c +++ /dev/null @@ -1,1438 +0,0 @@ -/** - ****************************************************************************** - * @file stm322xg_eval_lcd.c - * @author MCD Application Team - * @version V5.0.3 - * @date 09-March-2012 - * @brief This file includes the LCD driver for AM-240320L8TNQW00H (LCD_ILI9320) - * and AM240320D5TOQW01H (LCD_ILI9325) Liquid Crystal Display Modules - * of STM322xG-EVAL evaluation board(MB786) RevA and RevB. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "stm322xg_eval_lcd.h" -#include "../Common/fonts.c" - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL - * @{ - */ - -/** @defgroup STM322xG_EVAL_LCD - * @brief This file includes the LCD driver for AM-240320L8TNQW00H (LCD_ILI9320) - * and AM240320D5TOQW01H (LCD_ILI9325) Liquid Crystal Display Modules - * of STM322xG_EVAL board. - * @{ - */ - -/** @defgroup STM322xG_EVAL_LCD_Private_TypesDefinitions - * @{ - */ -typedef struct -{ - __IO uint16_t LCD_REG; - __IO uint16_t LCD_RAM; -} LCD_TypeDef; -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_LCD_Private_Defines - * @{ - */ -/* Note: LCD /CS is NE3 - Bank 3 of NOR/SRAM Bank 1~4 */ -#define LCD_BASE ((uint32_t)(0x60000000 | 0x08000000)) -#define LCD ((LCD_TypeDef *) LCD_BASE) -#define MAX_POLY_CORNERS 200 -#define POLY_Y(Z) ((int32_t)((Points + Z)->X)) -#define POLY_X(Z) ((int32_t)((Points + Z)->Y)) -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_LCD_Private_Macros - * @{ - */ -#define ABS(X) ((X) > 0 ? (X) : -(X)) -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_LCD_Private_Variables - * @{ - */ -static sFONT *LCD_Currentfonts; - - /* Global variables to set the written text color */ -__IO uint16_t TextColor = 0x0000, BackColor = 0xFFFF; - -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_LCD_Private_FunctionPrototypes - * @{ - */ -#ifndef USE_Delay -static void delay(__IO uint32_t nCount); -#endif /* USE_Delay*/ -static void PutPixel(int16_t x, int16_t y); -static void LCD_PolyLineRelativeClosed(pPoint Points, uint16_t PointCount, uint16_t Closed); - - -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_LCD_Private_Functions - * @{ - */ - -/** - * @brief DeInitializes the LCD. - * @param None - * @retval None - */ -void LCD_DeInit(void) -{ - GPIO_InitTypeDef GPIO_InitStructure; - - /*!< LCD Display Off */ - LCD_DisplayOff(); - - /* BANK 3 (of NOR/SRAM Bank 1~4) is disabled */ - FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM3, ENABLE); - - /*!< LCD_SPI DeInit */ - FSMC_NORSRAMDeInit(FSMC_Bank1_NORSRAM3); - -/*-- GPIO Configuration ------------------------------------------------------*/ - /* SRAM Data lines configuration */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_8 | GPIO_Pin_9 | - GPIO_Pin_10 | GPIO_Pin_14 | GPIO_Pin_15; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - GPIO_Init(GPIOD, &GPIO_InitStructure); - - GPIO_PinAFConfig(GPIOD, GPIO_PinSource0, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource1, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource8, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource9, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource10, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource14, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource15, GPIO_AF_MCO); - - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | - GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | - GPIO_Pin_15; - - GPIO_Init(GPIOE, &GPIO_InitStructure); - - GPIO_PinAFConfig(GPIOE, GPIO_PinSource7 , GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource8 , GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource9 , GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource10 , GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource11 , GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource12 , GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource13 , GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource14 , GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource15 , GPIO_AF_MCO); - - /* SRAM Address lines configuration */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | - GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_12 | GPIO_Pin_13 | - GPIO_Pin_14 | GPIO_Pin_15; - GPIO_Init(GPIOF, &GPIO_InitStructure); - GPIO_PinAFConfig(GPIOF,GPIO_PinSource0, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOF,GPIO_PinSource1, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOF,GPIO_PinSource2, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOF,GPIO_PinSource3, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOF,GPIO_PinSource4, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOF,GPIO_PinSource5, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOF,GPIO_PinSource12, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOF,GPIO_PinSource13, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOF,GPIO_PinSource14, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOF,GPIO_PinSource15, GPIO_AF_MCO); - - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | - GPIO_Pin_4 | GPIO_Pin_5; - - GPIO_Init(GPIOG, &GPIO_InitStructure); - - GPIO_PinAFConfig(GPIOG,GPIO_PinSource0, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOG,GPIO_PinSource1, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOG,GPIO_PinSource2, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOG,GPIO_PinSource3, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOG,GPIO_PinSource4, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOG,GPIO_PinSource5, GPIO_AF_MCO); - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13; - - GPIO_Init(GPIOD, &GPIO_InitStructure); - - GPIO_PinAFConfig(GPIOD,GPIO_PinSource11, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOD,GPIO_PinSource12, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOD,GPIO_PinSource13, GPIO_AF_MCO); - - /* NOE and NWE configuration */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 |GPIO_Pin_5; - - GPIO_Init(GPIOD, &GPIO_InitStructure); - GPIO_PinAFConfig(GPIOD,GPIO_PinSource4, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOD,GPIO_PinSource5, GPIO_AF_MCO); - - /* NE3 configuration */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; - - GPIO_Init(GPIOG, &GPIO_InitStructure); - GPIO_PinAFConfig(GPIOG, GPIO_PinSource12, GPIO_AF_MCO); - - /* NBL0, NBL1 configuration */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1; - GPIO_Init(GPIOE, &GPIO_InitStructure); - - GPIO_PinAFConfig(GPIOE,GPIO_PinSource0, GPIO_AF_MCO); - GPIO_PinAFConfig(GPIOE,GPIO_PinSource1, GPIO_AF_MCO); -} - -/** - * @brief Initializes the LCD. - * @param None - * @retval None - */ -void STM322xG_LCD_Init(void) -{ - __IO uint32_t lcdid = 0; - -/* Configure the LCD Control pins --------------------------------------------*/ - LCD_CtrlLinesConfig(); - -/* Configure the FSMC Parallel interface -------------------------------------*/ - LCD_FSMCConfig(); - - _delay_(5); /* delay 50 ms */ - - /* Read the LCD ID */ - lcdid = LCD_ReadReg(0x00); - - /* Check if the LCD is ILI9320 Controller */ - if(lcdid == 0x9320) - { - /* Start Initial Sequence ------------------------------------------------*/ - LCD_WriteReg(LCD_REG_229,0x8000); /* Set the internal vcore voltage */ - LCD_WriteReg(LCD_REG_0, 0x0001); /* Start internal OSC. */ - LCD_WriteReg(LCD_REG_1, 0x0100); /* set SS and SM bit */ - LCD_WriteReg(LCD_REG_2, 0x0700); /* set 1 line inversion */ - LCD_WriteReg(LCD_REG_3, 0x1030); /* set GRAM write direction and BGR=1. */ - LCD_WriteReg(LCD_REG_4, 0x0000); /* Resize register */ - LCD_WriteReg(LCD_REG_8, 0x0202); /* set the back porch and front porch */ - LCD_WriteReg(LCD_REG_9, 0x0000); /* set non-display area refresh cycle ISC[3:0] */ - LCD_WriteReg(LCD_REG_10, 0x0000); /* FMARK function */ - LCD_WriteReg(LCD_REG_12, 0x0000); /* RGB interface setting */ - LCD_WriteReg(LCD_REG_13, 0x0000); /* Frame marker Position */ - LCD_WriteReg(LCD_REG_15, 0x0000); /* RGB interface polarity */ - - /* Power On sequence -----------------------------------------------------*/ - LCD_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ - LCD_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */ - LCD_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */ - LCD_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude */ - _delay_(20); /* Dis-charge capacitor power voltage (200ms) */ - LCD_WriteReg(LCD_REG_16, 0x17B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ - LCD_WriteReg(LCD_REG_17, 0x0137); /* DC1[2:0], DC0[2:0], VC[2:0] */ - _delay_(5); /* Delay 50 ms */ - LCD_WriteReg(LCD_REG_18, 0x0139); /* VREG1OUT voltage */ - _delay_(5); /* Delay 50 ms */ - LCD_WriteReg(LCD_REG_19, 0x1d00); /* VDV[4:0] for VCOM amplitude */ - LCD_WriteReg(LCD_REG_41, 0x0013); /* VCM[4:0] for VCOMH */ - _delay_(5); /* Delay 50 ms */ - LCD_WriteReg(LCD_REG_32, 0x0000); /* GRAM horizontal Address */ - LCD_WriteReg(LCD_REG_33, 0x0000); /* GRAM Vertical Address */ - - /* Adjust the Gamma Curve ------------------------------------------------*/ - LCD_WriteReg(LCD_REG_48, 0x0007); - LCD_WriteReg(LCD_REG_49, 0x0007); - LCD_WriteReg(LCD_REG_50, 0x0007); - LCD_WriteReg(LCD_REG_53, 0x0007); - LCD_WriteReg(LCD_REG_54, 0x0007); - LCD_WriteReg(LCD_REG_55, 0x0700); - LCD_WriteReg(LCD_REG_56, 0x0700); - LCD_WriteReg(LCD_REG_57, 0x0700); - LCD_WriteReg(LCD_REG_60, 0x0700); - LCD_WriteReg(LCD_REG_61, 0x1F00); - - /* Set GRAM area ---------------------------------------------------------*/ - LCD_WriteReg(LCD_REG_80, 0x0000); /* Horizontal GRAM Start Address */ - LCD_WriteReg(LCD_REG_81, 0x00EF); /* Horizontal GRAM End Address */ - LCD_WriteReg(LCD_REG_82, 0x0000); /* Vertical GRAM Start Address */ - LCD_WriteReg(LCD_REG_83, 0x013F); /* Vertical GRAM End Address */ - LCD_WriteReg(LCD_REG_96, 0x2700); /* Gate Scan Line */ - LCD_WriteReg(LCD_REG_97, 0x0001); /* NDL,VLE, REV */ - LCD_WriteReg(LCD_REG_106, 0x0000); /* set scrolling line */ - - /* Partial Display Control -----------------------------------------------*/ - LCD_WriteReg(LCD_REG_128, 0x0000); - LCD_WriteReg(LCD_REG_129, 0x0000); - LCD_WriteReg(LCD_REG_130, 0x0000); - LCD_WriteReg(LCD_REG_131, 0x0000); - LCD_WriteReg(LCD_REG_132, 0x0000); - LCD_WriteReg(LCD_REG_133, 0x0000); - - /* Panel Control ---------------------------------------------------------*/ - LCD_WriteReg(LCD_REG_144, 0x0010); - LCD_WriteReg(LCD_REG_146, 0x0000); - LCD_WriteReg(LCD_REG_147, 0x0003); - LCD_WriteReg(LCD_REG_149, 0x0110); - LCD_WriteReg(LCD_REG_151, 0x0000); - LCD_WriteReg(LCD_REG_152, 0x0000); - - /* Set GRAM write direction and BGR = 1 */ - /* I/D=01 (Horizontal : increment, Vertical : decrement) */ - /* AM=1 (address is updated in vertical writing direction) */ - LCD_WriteReg(LCD_REG_3, 0x1018); - - LCD_WriteReg(LCD_REG_7, 0x0173); /* 262K color and display ON */ - } - else if(lcdid == 0x9325) /* Check if the LCD is ILI9325 Controller */ - { - /* Start Initial Sequence ------------------------------------------------*/ - LCD_WriteReg(LCD_REG_0, 0x0001); /* Start internal OSC. */ - LCD_WriteReg(LCD_REG_1, 0x0100); /* Set SS and SM bit */ - LCD_WriteReg(LCD_REG_2, 0x0700); /* Set 1 line inversion */ - LCD_WriteReg(LCD_REG_3, 0x1018); /* Set GRAM write direction and BGR=1. */ - LCD_WriteReg(LCD_REG_4, 0x0000); /* Resize register */ - LCD_WriteReg(LCD_REG_8, 0x0202); /* Set the back porch and front porch */ - LCD_WriteReg(LCD_REG_9, 0x0000); /* Set non-display area refresh cycle ISC[3:0] */ - LCD_WriteReg(LCD_REG_10, 0x0000); /* FMARK function */ - LCD_WriteReg(LCD_REG_12, 0x0000); /* RGB interface setting */ - LCD_WriteReg(LCD_REG_13, 0x0000); /* Frame marker Position */ - LCD_WriteReg(LCD_REG_15, 0x0000); /* RGB interface polarity */ - - /* Power On sequence -----------------------------------------------------*/ - LCD_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ - LCD_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */ - LCD_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */ - LCD_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude */ - _delay_(20); /* Dis-charge capacitor power voltage (200ms) */ - LCD_WriteReg(LCD_REG_16, 0x17B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ - LCD_WriteReg(LCD_REG_17, 0x0137); /* DC1[2:0], DC0[2:0], VC[2:0] */ - _delay_(5); /* Delay 50 ms */ - LCD_WriteReg(LCD_REG_18, 0x0139); /* VREG1OUT voltage */ - _delay_(5); /* Delay 50 ms */ - LCD_WriteReg(LCD_REG_19, 0x1d00); /* VDV[4:0] for VCOM amplitude */ - LCD_WriteReg(LCD_REG_41, 0x0013); /* VCM[4:0] for VCOMH */ - _delay_(5); /* Delay 50 ms */ - LCD_WriteReg(LCD_REG_32, 0x0000); /* GRAM horizontal Address */ - LCD_WriteReg(LCD_REG_33, 0x0000); /* GRAM Vertical Address */ - - /* Adjust the Gamma Curve (ILI9325)---------------------------------------*/ - LCD_WriteReg(LCD_REG_48, 0x0007); - LCD_WriteReg(LCD_REG_49, 0x0302); - LCD_WriteReg(LCD_REG_50, 0x0105); - LCD_WriteReg(LCD_REG_53, 0x0206); - LCD_WriteReg(LCD_REG_54, 0x0808); - LCD_WriteReg(LCD_REG_55, 0x0206); - LCD_WriteReg(LCD_REG_56, 0x0504); - LCD_WriteReg(LCD_REG_57, 0x0007); - LCD_WriteReg(LCD_REG_60, 0x0105); - LCD_WriteReg(LCD_REG_61, 0x0808); - - /* Set GRAM area ---------------------------------------------------------*/ - LCD_WriteReg(LCD_REG_80, 0x0000); /* Horizontal GRAM Start Address */ - LCD_WriteReg(LCD_REG_81, 0x00EF); /* Horizontal GRAM End Address */ - LCD_WriteReg(LCD_REG_82, 0x0000); /* Vertical GRAM Start Address */ - LCD_WriteReg(LCD_REG_83, 0x013F); /* Vertical GRAM End Address */ - - LCD_WriteReg(LCD_REG_96, 0xA700); /* Gate Scan Line(GS=1, scan direction is G320~G1) */ - LCD_WriteReg(LCD_REG_97, 0x0001); /* NDL,VLE, REV */ - LCD_WriteReg(LCD_REG_106, 0x0000); /* set scrolling line */ - - /* Partial Display Control -----------------------------------------------*/ - LCD_WriteReg(LCD_REG_128, 0x0000); - LCD_WriteReg(LCD_REG_129, 0x0000); - LCD_WriteReg(LCD_REG_130, 0x0000); - LCD_WriteReg(LCD_REG_131, 0x0000); - LCD_WriteReg(LCD_REG_132, 0x0000); - LCD_WriteReg(LCD_REG_133, 0x0000); - - /* Panel Control ---------------------------------------------------------*/ - LCD_WriteReg(LCD_REG_144, 0x0010); - LCD_WriteReg(LCD_REG_146, 0x0000); - LCD_WriteReg(LCD_REG_147, 0x0003); - LCD_WriteReg(LCD_REG_149, 0x0110); - LCD_WriteReg(LCD_REG_151, 0x0000); - LCD_WriteReg(LCD_REG_152, 0x0000); - - /* set GRAM write direction and BGR = 1 */ - /* I/D=00 (Horizontal : increment, Vertical : decrement) */ - /* AM=1 (address is updated in vertical writing direction) */ - LCD_WriteReg(LCD_REG_3, 0x1018); - - LCD_WriteReg(LCD_REG_7, 0x0133); /* 262K color and display ON */ - } - LCD_SetFont(&LCD_DEFAULT_FONT); -} - -/** - * @brief Sets the LCD Text and Background colors. - * @param _TextColor: specifies the Text Color. - * @param _BackColor: specifies the Background Color. - * @retval None - */ -void LCD_SetColors(__IO uint16_t _TextColor, __IO uint16_t _BackColor) -{ - TextColor = _TextColor; - BackColor = _BackColor; -} - -/** - * @brief Gets the LCD Text and Background colors. - * @param _TextColor: pointer to the variable that will contain the Text - Color. - * @param _BackColor: pointer to the variable that will contain the Background - Color. - * @retval None - */ -void LCD_GetColors(__IO uint16_t *_TextColor, __IO uint16_t *_BackColor) -{ - *_TextColor = TextColor; *_BackColor = BackColor; -} - -/** - * @brief Sets the Text color. - * @param Color: specifies the Text color code RGB(5-6-5). - * @retval None - */ -void LCD_SetTextColor(__IO uint16_t Color) -{ - TextColor = Color; -} - - -/** - * @brief Sets the Background color. - * @param Color: specifies the Background color code RGB(5-6-5). - * @retval None - */ -void LCD_SetBackColor(__IO uint16_t Color) -{ - BackColor = Color; -} - -/** - * @brief Sets the Text Font. - * @param fonts: specifies the font to be used. - * @retval None - */ -void LCD_SetFont(sFONT *fonts) -{ - LCD_Currentfonts = fonts; -} - -/** - * @brief Gets the Text Font. - * @param None. - * @retval the used font. - */ -sFONT *LCD_GetFont(void) -{ - return LCD_Currentfonts; -} - -/** - * @brief Clears the selected line. - * @param Line: the Line to be cleared. - * This parameter can be one of the following values: - * @arg Linex: where x can be 0..n - * @retval None - */ -void LCD_ClearLine(uint16_t Line) -{ - uint16_t refcolumn = LCD_PIXEL_WIDTH - 1; - /* Send the string character by character on lCD */ - while (((refcolumn + 1)& 0xFFFF) >= LCD_Currentfonts->Width) - { - /* Display one character on LCD */ - LCD_DisplayChar(Line, refcolumn, ' '); - /* Decrement the column position by 16 */ - refcolumn -= LCD_Currentfonts->Width; - } -} - -/** - * @brief Clears the hole LCD. - * @param Color: the color of the background. - * @retval None - */ -void LCD_Clear(uint16_t Color) -{ - uint32_t index = 0; - - LCD_SetCursor(0x00, 0x013F); - LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ - for(index = 0; index < 76800; index++) - { - LCD->LCD_RAM = Color; - } -} - -/** - * @brief Sets the cursor position. - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @retval None - */ -void LCD_SetCursor(uint16_t Xpos, uint16_t Ypos) -{ - LCD_WriteReg(LCD_REG_32, Xpos); - LCD_WriteReg(LCD_REG_33, Ypos); -} - -/** - * @brief Draws a character on LCD. - * @param Xpos: the Line where to display the character shape. - * @param Ypos: start column address. - * @param c: pointer to the character data. - * @retval None - */ -void LCD_DrawChar(uint16_t Xpos, uint16_t Ypos, const uint16_t *c) -{ - uint32_t index = 0, i = 0; - uint16_t Xaddress = 0; - Xaddress = Xpos; - - LCD_SetCursor(Xaddress, Ypos); - - for(index = 0; index < LCD_Currentfonts->Height; index++) - { - LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ - for(i = 0; i < LCD_Currentfonts->Width; i++) - { - - if((((c[index] & ((0x80 << ((LCD_Currentfonts->Width / 12 ) * 8 ) ) >> i)) == 0x00) &&(LCD_Currentfonts->Width <= 12))|| - (((c[index] & (0x1 << i)) == 0x00)&&(LCD_Currentfonts->Width > 12 ))) - - { - LCD_WriteRAM(BackColor); - } - else - { - LCD_WriteRAM(TextColor); - } - } - Xaddress++; - LCD_SetCursor(Xaddress, Ypos); - } -} - -/** - * @brief Displays one character (16dots width, 24dots height). - * @param Line: the Line where to display the character shape . - * This parameter can be one of the following values: - * @arg Linex: where x can be 0..9 - * @param Column: start column address. - * @param Ascii: character ascii code, must be between 0x20 and 0x7E. - * @retval None - */ -void LCD_DisplayChar(uint16_t Line, uint16_t Column, uint8_t Ascii) -{ - Ascii -= 32; - LCD_DrawChar(Line, Column, &LCD_Currentfonts->table[Ascii * LCD_Currentfonts->Height]); -} - -/** - * @brief Displays a maximum of 20 char on the LCD. - * @param Line: the Line where to display the character shape . - * This parameter can be one of the following values: - * @arg Linex: where x can be 0..9 - * @param *ptr: pointer to string to display on LCD. - * @retval None - */ -void LCD_DisplayStringLine(uint16_t Line, uint8_t *ptr) -{ - uint16_t refcolumn = LCD_PIXEL_WIDTH - 1; - - /* Send the string character by character on lCD */ - while ((*ptr != 0) & (((refcolumn + 1) & 0xFFFF) >= LCD_Currentfonts->Width)) - { - /* Display one character on LCD */ - LCD_DisplayChar(Line, refcolumn, *ptr); - /* Decrement the column position by 16 */ - refcolumn -= LCD_Currentfonts->Width; - /* Point on the next character */ - ptr++; - } -} - -/** - * @brief Sets a display window - * @param Xpos: specifies the X bottom left position. - * @param Ypos: specifies the Y bottom left position. - * @param Height: display window height. - * @param Width: display window width. - * @retval None - */ -void LCD_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint8_t Height, uint16_t Width) -{ - /* Horizontal GRAM Start Address */ - if(Xpos >= Height) - { - LCD_WriteReg(LCD_REG_80, (Xpos - Height + 1)); - } - else - { - LCD_WriteReg(LCD_REG_80, 0); - } - /* Horizontal GRAM End Address */ - LCD_WriteReg(LCD_REG_81, Xpos); - /* Vertical GRAM Start Address */ - if(Ypos >= Width) - { - LCD_WriteReg(LCD_REG_82, (Ypos - Width + 1)); - } - else - { - LCD_WriteReg(LCD_REG_82, 0); - } - /* Vertical GRAM End Address */ - LCD_WriteReg(LCD_REG_83, Ypos); - LCD_SetCursor(Xpos, Ypos); -} - -/** - * @brief Disables LCD Window mode. - * @param None - * @retval None - */ -void LCD_WindowModeDisable(void) -{ - LCD_SetDisplayWindow(239, 0x13F, 240, 320); - LCD_WriteReg(LCD_REG_3, 0x1018); -} - -/** - * @brief Displays a line. - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @param Length: line length. - * @param Direction: line direction. - * This parameter can be one of the following values: Vertical or Horizontal. - * @retval None - */ -void LCD_DrawLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length, uint8_t Direction) -{ - uint32_t i = 0; - - LCD_SetCursor(Xpos, Ypos); - if(Direction == LCD_DIR_HORIZONTAL) - { - LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ - for(i = 0; i < Length; i++) - { - LCD_WriteRAM(TextColor); - } - } - else - { - for(i = 0; i < Length; i++) - { - LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ - LCD_WriteRAM(TextColor); - Xpos++; - LCD_SetCursor(Xpos, Ypos); - } - } -} - -/** - * @brief Displays a rectangle. - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @param Height: display rectangle height. - * @param Width: display rectangle width. - * @retval None - */ -void LCD_DrawRect(uint16_t Xpos, uint16_t Ypos, uint8_t Height, uint16_t Width) -{ - LCD_DrawLine(Xpos, Ypos, Width, LCD_DIR_HORIZONTAL); - LCD_DrawLine((Xpos + Height), Ypos, Width, LCD_DIR_HORIZONTAL); - - LCD_DrawLine(Xpos, Ypos, Height, LCD_DIR_VERTICAL); - LCD_DrawLine(Xpos, (Ypos - Width + 1), Height, LCD_DIR_VERTICAL); -} - -/** - * @brief Displays a circle. - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @param Radius - * @retval None - */ -void LCD_DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius) -{ - int32_t D;/* Decision Variable */ - uint32_t CurX;/* Current X Value */ - uint32_t CurY;/* Current Y Value */ - - D = 3 - (Radius << 1); - CurX = 0; - CurY = Radius; - - while (CurX <= CurY) - { - LCD_SetCursor(Xpos + CurX, Ypos + CurY); - LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ - LCD_WriteRAM(TextColor); - LCD_SetCursor(Xpos + CurX, Ypos - CurY); - LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ - LCD_WriteRAM(TextColor); - LCD_SetCursor(Xpos - CurX, Ypos + CurY); - LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ - LCD_WriteRAM(TextColor); - LCD_SetCursor(Xpos - CurX, Ypos - CurY); - LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ - LCD_WriteRAM(TextColor); - LCD_SetCursor(Xpos + CurY, Ypos + CurX); - LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ - LCD_WriteRAM(TextColor); - LCD_SetCursor(Xpos + CurY, Ypos - CurX); - LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ - LCD_WriteRAM(TextColor); - LCD_SetCursor(Xpos - CurY, Ypos + CurX); - LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ - LCD_WriteRAM(TextColor); - LCD_SetCursor(Xpos - CurY, Ypos - CurX); - LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ - LCD_WriteRAM(TextColor); - if (D < 0) - { - D += (CurX << 2) + 6; - } - else - { - D += ((CurX - CurY) << 2) + 10; - CurY--; - } - CurX++; - } -} - -/** - * @brief Displays a mono-color picture. - * @param Pict: pointer to the picture array. - * @retval None - */ -void LCD_DrawMonoPict(const uint32_t *Pict) -{ - uint32_t index = 0, i = 0; - LCD_SetCursor(0, (LCD_PIXEL_WIDTH - 1)); - LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ - for(index = 0; index < 2400; index++) - { - for(i = 0; i < 32; i++) - { - if((Pict[index] & (1 << i)) == 0x00) - { - LCD_WriteRAM(BackColor); - } - else - { - LCD_WriteRAM(TextColor); - } - } - } -} - -/** - * @brief Displays a bitmap picture loaded in the internal Flash. - * @param BmpAddress: Bmp picture address in the internal Flash. - * @retval None - */ -void LCD_WriteBMP(uint32_t BmpAddress) -{ - uint32_t index = 0, size = 0; - /* Read bitmap size */ - size = *(__IO uint16_t *) (BmpAddress + 2); - size |= (*(__IO uint16_t *) (BmpAddress + 4)) << 16; - /* Get bitmap data address offset */ - index = *(__IO uint16_t *) (BmpAddress + 10); - index |= (*(__IO uint16_t *) (BmpAddress + 12)) << 16; - size = (size - index)/2; - BmpAddress += index; - /* Set GRAM write direction and BGR = 1 */ - /* I/D=00 (Horizontal : decrement, Vertical : decrement) */ - /* AM=1 (address is updated in vertical writing direction) */ - LCD_WriteReg(LCD_REG_3, 0x1008); - - LCD_WriteRAM_Prepare(); - - for(index = 0; index < size; index++) - { - LCD_WriteRAM(*(__IO uint16_t *)BmpAddress); - BmpAddress += 2; - } - - /* Set GRAM write direction and BGR = 1 */ - /* I/D = 01 (Horizontal : increment, Vertical : decrement) */ - /* AM = 1 (address is updated in vertical writing direction) */ - LCD_WriteReg(LCD_REG_3, 0x1018); -} - -/** - * @brief Displays a full rectangle. - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @param Height: rectangle height. - * @param Width: rectangle width. - * @retval None - */ -void LCD_DrawFullRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height) -{ - LCD_SetTextColor(TextColor); - - LCD_DrawLine(Xpos, Ypos, Width, LCD_DIR_HORIZONTAL); - LCD_DrawLine((Xpos + Height), Ypos, Width, LCD_DIR_HORIZONTAL); - - LCD_DrawLine(Xpos, Ypos, Height, LCD_DIR_VERTICAL); - LCD_DrawLine(Xpos, (Ypos - Width + 1), Height, LCD_DIR_VERTICAL); - - Width -= 2; - Height--; - Ypos--; - - LCD_SetTextColor(BackColor); - - while(Height--) - { - LCD_DrawLine(++Xpos, Ypos, Width, LCD_DIR_HORIZONTAL); - } - - LCD_SetTextColor(TextColor); -} - -/** - * @brief Displays a full circle. - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @param Radius - * @retval None - */ -void LCD_DrawFullCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius) -{ - int32_t D; /* Decision Variable */ - uint32_t CurX;/* Current X Value */ - uint32_t CurY;/* Current Y Value */ - - D = 3 - (Radius << 1); - - CurX = 0; - CurY = Radius; - - LCD_SetTextColor(BackColor); - - while (CurX <= CurY) - { - if(CurY > 0) - { - LCD_DrawLine(Xpos - CurX, Ypos + CurY, 2*CurY, LCD_DIR_HORIZONTAL); - LCD_DrawLine(Xpos + CurX, Ypos + CurY, 2*CurY, LCD_DIR_HORIZONTAL); - } - - if(CurX > 0) - { - LCD_DrawLine(Xpos - CurY, Ypos + CurX, 2*CurX, LCD_DIR_HORIZONTAL); - LCD_DrawLine(Xpos + CurY, Ypos + CurX, 2*CurX, LCD_DIR_HORIZONTAL); - } - if (D < 0) - { - D += (CurX << 2) + 6; - } - else - { - D += ((CurX - CurY) << 2) + 10; - CurY--; - } - CurX++; - } - - LCD_SetTextColor(TextColor); - LCD_DrawCircle(Xpos, Ypos, Radius); -} - -/** - * @brief Displays an uni-line (between two points). - * @param x1: specifies the point 1 x position. - * @param y1: specifies the point 1 y position. - * @param x2: specifies the point 2 x position. - * @param y2: specifies the point 2 y position. - * @retval None - */ -void LCD_DrawUniLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) -{ - int16_t deltax = 0, deltay = 0, x = 0, y = 0, xinc1 = 0, xinc2 = 0, - yinc1 = 0, yinc2 = 0, den = 0, num = 0, numadd = 0, numpixels = 0, - curpixel = 0; - - deltax = ABS(x2 - x1); /* The difference between the x's */ - deltay = ABS(y2 - y1); /* The difference between the y's */ - x = x1; /* Start x off at the first pixel */ - y = y1; /* Start y off at the first pixel */ - - if (x2 >= x1) /* The x-values are increasing */ - { - xinc1 = 1; - xinc2 = 1; - } - else /* The x-values are decreasing */ - { - xinc1 = -1; - xinc2 = -1; - } - - if (y2 >= y1) /* The y-values are increasing */ - { - yinc1 = 1; - yinc2 = 1; - } - else /* The y-values are decreasing */ - { - yinc1 = -1; - yinc2 = -1; - } - - if (deltax >= deltay) /* There is at least one x-value for every y-value */ - { - xinc1 = 0; /* Don't change the x when numerator >= denominator */ - yinc2 = 0; /* Don't change the y for every iteration */ - den = deltax; - num = deltax / 2; - numadd = deltay; - numpixels = deltax; /* There are more x-values than y-values */ - } - else /* There is at least one y-value for every x-value */ - { - xinc2 = 0; /* Don't change the x for every iteration */ - yinc1 = 0; /* Don't change the y when numerator >= denominator */ - den = deltay; - num = deltay / 2; - numadd = deltax; - numpixels = deltay; /* There are more y-values than x-values */ - } - - for (curpixel = 0; curpixel <= numpixels; curpixel++) - { - PutPixel(x, y); /* Draw the current pixel */ - num += numadd; /* Increase the numerator by the top of the fraction */ - if (num >= den) /* Check if numerator >= denominator */ - { - num -= den; /* Calculate the new numerator value */ - x += xinc1; /* Change the x as appropriate */ - y += yinc1; /* Change the y as appropriate */ - } - x += xinc2; /* Change the x as appropriate */ - y += yinc2; /* Change the y as appropriate */ - } -} - -/** - * @brief Displays an poly-line (between many points). - * @param Points: pointer to the points array. - * @param PointCount: Number of points. - * @retval None - */ -void LCD_PolyLine(pPoint Points, uint16_t PointCount) -{ - int16_t X = 0, Y = 0; - - if(PointCount < 2) - { - return; - } - - while(--PointCount) - { - X = Points->X; - Y = Points->Y; - Points++; - LCD_DrawUniLine(X, Y, Points->X, Points->Y); - } -} - -/** - * @brief Displays an relative poly-line (between many points). - * @param Points: pointer to the points array. - * @param PointCount: Number of points. - * @param Closed: specifies if the draw is closed or not. - * 1: closed, 0 : not closed. - * @retval None - */ -static void LCD_PolyLineRelativeClosed(pPoint Points, uint16_t PointCount, uint16_t Closed) -{ - int16_t X = 0, Y = 0; - pPoint First = Points; - - if(PointCount < 2) - { - return; - } - X = Points->X; - Y = Points->Y; - while(--PointCount) - { - Points++; - LCD_DrawUniLine(X, Y, X + Points->X, Y + Points->Y); - X = X + Points->X; - Y = Y + Points->Y; - } - if(Closed) - { - LCD_DrawUniLine(First->X, First->Y, X, Y); - } -} - -/** - * @brief Displays a closed poly-line (between many points). - * @param Points: pointer to the points array. - * @param PointCount: Number of points. - * @retval None - */ -void LCD_ClosedPolyLine(pPoint Points, uint16_t PointCount) -{ - LCD_PolyLine(Points, PointCount); - LCD_DrawUniLine(Points->X, Points->Y, (Points+PointCount-1)->X, (Points+PointCount-1)->Y); -} - -/** - * @brief Displays a relative poly-line (between many points). - * @param Points: pointer to the points array. - * @param PointCount: Number of points. - * @retval None - */ -void LCD_PolyLineRelative(pPoint Points, uint16_t PointCount) -{ - LCD_PolyLineRelativeClosed(Points, PointCount, 0); -} - -/** - * @brief Displays a closed relative poly-line (between many points). - * @param Points: pointer to the points array. - * @param PointCount: Number of points. - * @retval None - */ -void LCD_ClosedPolyLineRelative(pPoint Points, uint16_t PointCount) -{ - LCD_PolyLineRelativeClosed(Points, PointCount, 1); -} - - -/** - * @brief Displays a full poly-line (between many points). - * @param Points: pointer to the points array. - * @param PointCount: Number of points. - * @retval None - */ -void LCD_FillPolyLine(pPoint Points, uint16_t PointCount) -{ - /* public-domain code by Darel Rex Finley, 2007 */ - uint16_t nodes = 0, nodeX[MAX_POLY_CORNERS], pixelX = 0, pixelY = 0, i = 0, - j = 0, swap = 0; - uint16_t IMAGE_LEFT = 0, IMAGE_RIGHT = 0, IMAGE_TOP = 0, IMAGE_BOTTOM = 0; - - IMAGE_LEFT = IMAGE_RIGHT = Points->X; - IMAGE_TOP= IMAGE_BOTTOM = Points->Y; - - for(i = 1; i < PointCount; i++) - { - pixelX = POLY_X(i); - if(pixelX < IMAGE_LEFT) - { - IMAGE_LEFT = pixelX; - } - if(pixelX > IMAGE_RIGHT) - { - IMAGE_RIGHT = pixelX; - } - - pixelY = POLY_Y(i); - if(pixelY < IMAGE_TOP) - { - IMAGE_TOP = pixelY; - } - if(pixelY > IMAGE_BOTTOM) - { - IMAGE_BOTTOM = pixelY; - } - } - - LCD_SetTextColor(BackColor); - - /* Loop through the rows of the image. */ - for (pixelY = IMAGE_TOP; pixelY < IMAGE_BOTTOM; pixelY++) - { - /* Build a list of nodes. */ - nodes = 0; j = PointCount-1; - - for (i = 0; i < PointCount; i++) - { - if (((POLY_Y(i)<(double) pixelY) && (POLY_Y(j)>=(double) pixelY)) || \ - ((POLY_Y(j)<(double) pixelY) && (POLY_Y(i)>=(double) pixelY))) - { - nodeX[nodes++]=(int) (POLY_X(i)+((pixelY-POLY_Y(i))*(POLY_X(j)-POLY_X(i)))/(POLY_Y(j)-POLY_Y(i))); - } - j = i; - } - - /* Sort the nodes, via a simple "Bubble" sort. */ - i = 0; - while (i < nodes-1) - { - if (nodeX[i]>nodeX[i+1]) - { - swap = nodeX[i]; - nodeX[i] = nodeX[i+1]; - nodeX[i+1] = swap; - if(i) - { - i--; - } - } - else - { - i++; - } - } - - /* Fill the pixels between node pairs. */ - for (i = 0; i < nodes; i+=2) - { - if(nodeX[i] >= IMAGE_RIGHT) - { - break; - } - if(nodeX[i+1] > IMAGE_LEFT) - { - if (nodeX[i] < IMAGE_LEFT) - { - nodeX[i]=IMAGE_LEFT; - } - if(nodeX[i+1] > IMAGE_RIGHT) - { - nodeX[i+1] = IMAGE_RIGHT; - } - LCD_SetTextColor(BackColor); - LCD_DrawLine(pixelY, nodeX[i+1], nodeX[i+1] - nodeX[i], LCD_DIR_HORIZONTAL); - LCD_SetTextColor(TextColor); - PutPixel(pixelY, nodeX[i+1]); - PutPixel(pixelY, nodeX[i]); - /* for (j=nodeX[i]; jLCD_REG = LCD_Reg; - /* Write 16-bit Reg */ - LCD->LCD_RAM = LCD_RegValue; -} - -/** - * @brief Reads the selected LCD Register. - * @param LCD_Reg: address of the selected register. - * @retval LCD Register Value. - */ -uint16_t LCD_ReadReg(uint8_t LCD_Reg) -{ - /* Write 16-bit Index (then Read Reg) */ - LCD->LCD_REG = LCD_Reg; - /* Read 16-bit Reg */ - return (LCD->LCD_RAM); -} - -/** - * @brief Prepare to write to the LCD RAM. - * @param None - * @retval None - */ -void LCD_WriteRAM_Prepare(void) -{ - LCD->LCD_REG = LCD_REG_34; -} - -/** - * @brief Writes to the LCD RAM. - * @param RGB_Code: the pixel color in RGB mode (5-6-5). - * @retval None - */ -void LCD_WriteRAM(uint16_t RGB_Code) -{ - /* Write 16-bit GRAM Reg */ - LCD->LCD_RAM = RGB_Code; -} - -/** - * @brief Reads the LCD RAM. - * @param None - * @retval LCD RAM Value. - */ -uint16_t LCD_ReadRAM(void) -{ - /* Write 16-bit Index (then Read Reg) */ - LCD->LCD_REG = LCD_REG_34; /* Select GRAM Reg */ - /* Read 16-bit Reg */ - return LCD->LCD_RAM; -} - -/** - * @brief Power on the LCD. - * @param None - * @retval None - */ -void LCD_PowerOn(void) -{ -/* Power On sequence ---------------------------------------------------------*/ - LCD_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ - LCD_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */ - LCD_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */ - LCD_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude*/ - _delay_(20); /* Dis-charge capacitor power voltage (200ms) */ - LCD_WriteReg(LCD_REG_16, 0x17B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ - LCD_WriteReg(LCD_REG_17, 0x0137); /* DC1[2:0], DC0[2:0], VC[2:0] */ - _delay_(5); /* Delay 50 ms */ - LCD_WriteReg(LCD_REG_18, 0x0139); /* VREG1OUT voltage */ - _delay_(5); /* Delay 50 ms */ - LCD_WriteReg(LCD_REG_19, 0x1d00); /* VDV[4:0] for VCOM amplitude */ - LCD_WriteReg(LCD_REG_41, 0x0013); /* VCM[4:0] for VCOMH */ - _delay_(5); /* Delay 50 ms */ - LCD_WriteReg(LCD_REG_7, 0x0173); /* 262K color and display ON */ -} - -/** - * @brief Enables the Display. - * @param None - * @retval None - */ -void LCD_DisplayOn(void) -{ - /* Display On */ - LCD_WriteReg(LCD_REG_7, 0x0173); /* 262K color and display ON */ -} - -/** - * @brief Disables the Display. - * @param None - * @retval None - */ -void LCD_DisplayOff(void) -{ - /* Display Off */ - LCD_WriteReg(LCD_REG_7, 0x0); -} - -/** - * @brief Configures LCD Control lines (FSMC Pins) in alternate function mode. - * @param None - * @retval None - */ -void LCD_CtrlLinesConfig(void) -{ - GPIO_InitTypeDef GPIO_InitStructure; - - /* Enable GPIOD, GPIOE, GPIOF, GPIOG and AFIO clocks */ - RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOG | RCC_AHB1Periph_GPIOE | - RCC_AHB1Periph_GPIOF, ENABLE); - -/*-- GPIO Configuration ------------------------------------------------------*/ - /* SRAM Data lines, NOE and NWE configuration */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_8 | GPIO_Pin_9 | - GPIO_Pin_10 | GPIO_Pin_14 | GPIO_Pin_15 | - GPIO_Pin_4 |GPIO_Pin_5;; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - - GPIO_Init(GPIOD, &GPIO_InitStructure); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource0, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource1, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource4, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource5, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource8, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource9, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource10, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource14, GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOD, GPIO_PinSource15, GPIO_AF_FSMC); - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | - GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | - GPIO_Pin_15; - GPIO_Init(GPIOE, &GPIO_InitStructure); - - GPIO_PinAFConfig(GPIOE, GPIO_PinSource7 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource8 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource9 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource10 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource11 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource12 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource13 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource14 , GPIO_AF_FSMC); - GPIO_PinAFConfig(GPIOE, GPIO_PinSource15 , GPIO_AF_FSMC); - - /* SRAM Address lines configuration */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; - GPIO_Init(GPIOF, &GPIO_InitStructure); - GPIO_PinAFConfig(GPIOF, GPIO_PinSource0, GPIO_AF_FSMC); - - /* NE3 configuration */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; - - GPIO_Init(GPIOG, &GPIO_InitStructure); - GPIO_PinAFConfig(GPIOG, GPIO_PinSource10, GPIO_AF_FSMC); -} - -/** - * @brief Configures the Parallel interface (FSMC) for LCD(Parallel mode) - * @param None - * @retval None - */ -void LCD_FSMCConfig(void) -{ - FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure; - FSMC_NORSRAMTimingInitTypeDef p; - - /* Enable FSMC clock */ - RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE); - -/*-- FSMC Configuration ------------------------------------------------------*/ -/*----------------------- SRAM Bank 3 ----------------------------------------*/ - /* FSMC_Bank1_NORSRAM4 configuration */ - p.FSMC_AddressSetupTime = 3; - p.FSMC_AddressHoldTime = 0; - p.FSMC_DataSetupTime = 9; - p.FSMC_BusTurnAroundDuration = 0; - p.FSMC_CLKDivision = 0; - p.FSMC_DataLatency = 0; - p.FSMC_AccessMode = FSMC_AccessMode_A; - /* Color LCD configuration ------------------------------------ - LCD configured as follow: - - Data/Address MUX = Disable - - Memory Type = SRAM - - Data Width = 16bit - - Write Operation = Enable - - Extended Mode = Enable - - Asynchronous Wait = Disable */ - - FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM3; - FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable; - FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM; - FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b; - FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable; - FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable; - FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low; - FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable; - FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState; - FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable; - FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable; - FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable; - FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable; - FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p; - FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p; - - FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure); - - /* Enable FSMC NOR/SRAM Bank3 */ - FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM3, ENABLE); -} - -/** - * @brief Displays a pixel. - * @param x: pixel x. - * @param y: pixel y. - * @retval None - */ -static void PutPixel(int16_t x, int16_t y) -{ - if(x < 0 || x > 239 || y < 0 || y > 319) - { - return; - } - LCD_DrawLine(x, y, 1, LCD_DIR_HORIZONTAL); -} - - -#ifndef USE_Delay -/** - * @brief Inserts a delay time. - * @param nCount: specifies the delay time length. - * @retval None - */ -static void delay(__IO uint32_t nCount) -{ - __IO uint32_t index = 0; - for(index = (100000 * nCount); index != 0; index--) - { - } -} -#endif /* USE_Delay*/ -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_lcd.h b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_lcd.h deleted file mode 100644 index 32479af57..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_lcd.h +++ /dev/null @@ -1,365 +0,0 @@ -/** - ****************************************************************************** - * @file stm322xg_eval_lcd.h - * @author MCD Application Team - * @version V5.0.3 - * @date 09-March-2012 - * @brief This file contains all the functions prototypes for the stm322xg_eval_lcd.c - * driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __STM322xG_EVAL_LCD_H -#define __STM322xG_EVAL_LCD_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include "stm322xg_eval.h" -#include "../Common/fonts.h" - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL_LCD - * @{ - */ - - -/** @defgroup STM322xG_EVAL_LCD_Exported_Types - * @{ - */ -typedef struct -{ - int16_t X; - int16_t Y; -} Point, * pPoint; -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_LCD_Exported_Constants - * @{ - */ - -/** - * @brief Uncomment the line below if you want to use user defined Delay function - * (for precise timing), otherwise default _delay_ function defined within - * this driver is used (less precise timing). - */ -/* #define USE_Delay */ - -#ifdef USE_Delay -#include "main.h" - #define _delay_ Delay /* !< User can provide more timing precise _delay_ function - (with 10ms time base), using SysTick for example */ -#else - #define _delay_ delay /* !< Default _delay_ function with less precise timing */ -#endif - -/** - * @brief LCD Registers - */ -#define LCD_REG_0 0x00 -#define LCD_REG_1 0x01 -#define LCD_REG_2 0x02 -#define LCD_REG_3 0x03 -#define LCD_REG_4 0x04 -#define LCD_REG_5 0x05 -#define LCD_REG_6 0x06 -#define LCD_REG_7 0x07 -#define LCD_REG_8 0x08 -#define LCD_REG_9 0x09 -#define LCD_REG_10 0x0A -#define LCD_REG_12 0x0C -#define LCD_REG_13 0x0D -#define LCD_REG_14 0x0E -#define LCD_REG_15 0x0F -#define LCD_REG_16 0x10 -#define LCD_REG_17 0x11 -#define LCD_REG_18 0x12 -#define LCD_REG_19 0x13 -#define LCD_REG_20 0x14 -#define LCD_REG_21 0x15 -#define LCD_REG_22 0x16 -#define LCD_REG_23 0x17 -#define LCD_REG_24 0x18 -#define LCD_REG_25 0x19 -#define LCD_REG_26 0x1A -#define LCD_REG_27 0x1B -#define LCD_REG_28 0x1C -#define LCD_REG_29 0x1D -#define LCD_REG_30 0x1E -#define LCD_REG_31 0x1F -#define LCD_REG_32 0x20 -#define LCD_REG_33 0x21 -#define LCD_REG_34 0x22 -#define LCD_REG_36 0x24 -#define LCD_REG_37 0x25 -#define LCD_REG_40 0x28 -#define LCD_REG_41 0x29 -#define LCD_REG_43 0x2B -#define LCD_REG_45 0x2D -#define LCD_REG_48 0x30 -#define LCD_REG_49 0x31 -#define LCD_REG_50 0x32 -#define LCD_REG_51 0x33 -#define LCD_REG_52 0x34 -#define LCD_REG_53 0x35 -#define LCD_REG_54 0x36 -#define LCD_REG_55 0x37 -#define LCD_REG_56 0x38 -#define LCD_REG_57 0x39 -#define LCD_REG_58 0x3A -#define LCD_REG_59 0x3B -#define LCD_REG_60 0x3C -#define LCD_REG_61 0x3D -#define LCD_REG_62 0x3E -#define LCD_REG_63 0x3F -#define LCD_REG_64 0x40 -#define LCD_REG_65 0x41 -#define LCD_REG_66 0x42 -#define LCD_REG_67 0x43 -#define LCD_REG_68 0x44 -#define LCD_REG_69 0x45 -#define LCD_REG_70 0x46 -#define LCD_REG_71 0x47 -#define LCD_REG_72 0x48 -#define LCD_REG_73 0x49 -#define LCD_REG_74 0x4A -#define LCD_REG_75 0x4B -#define LCD_REG_76 0x4C -#define LCD_REG_77 0x4D -#define LCD_REG_78 0x4E -#define LCD_REG_79 0x4F -#define LCD_REG_80 0x50 -#define LCD_REG_81 0x51 -#define LCD_REG_82 0x52 -#define LCD_REG_83 0x53 -#define LCD_REG_96 0x60 -#define LCD_REG_97 0x61 -#define LCD_REG_106 0x6A -#define LCD_REG_118 0x76 -#define LCD_REG_128 0x80 -#define LCD_REG_129 0x81 -#define LCD_REG_130 0x82 -#define LCD_REG_131 0x83 -#define LCD_REG_132 0x84 -#define LCD_REG_133 0x85 -#define LCD_REG_134 0x86 -#define LCD_REG_135 0x87 -#define LCD_REG_136 0x88 -#define LCD_REG_137 0x89 -#define LCD_REG_139 0x8B -#define LCD_REG_140 0x8C -#define LCD_REG_141 0x8D -#define LCD_REG_143 0x8F -#define LCD_REG_144 0x90 -#define LCD_REG_145 0x91 -#define LCD_REG_146 0x92 -#define LCD_REG_147 0x93 -#define LCD_REG_148 0x94 -#define LCD_REG_149 0x95 -#define LCD_REG_150 0x96 -#define LCD_REG_151 0x97 -#define LCD_REG_152 0x98 -#define LCD_REG_153 0x99 -#define LCD_REG_154 0x9A -#define LCD_REG_157 0x9D -#define LCD_REG_192 0xC0 -#define LCD_REG_193 0xC1 -#define LCD_REG_229 0xE5 - -/** - * @brief LCD color - */ -#define LCD_COLOR_WHITE 0xFFFF -#define LCD_COLOR_BLACK 0x0000 -#define LCD_COLOR_GREY 0xF7DE -#define LCD_COLOR_BLUE 0x001F -#define LCD_COLOR_BLUE2 0x051F -#define LCD_COLOR_RED 0xF800 -#define LCD_COLOR_MAGENTA 0xF81F -#define LCD_COLOR_GREEN 0x07E0 -#define LCD_COLOR_CYAN 0x7FFF -#define LCD_COLOR_YELLOW 0xFFE0 - -/** - * @brief LCD Lines depending on the chosen fonts. - */ -#define LCD_LINE_0 LINE(0) -#define LCD_LINE_1 LINE(1) -#define LCD_LINE_2 LINE(2) -#define LCD_LINE_3 LINE(3) -#define LCD_LINE_4 LINE(4) -#define LCD_LINE_5 LINE(5) -#define LCD_LINE_6 LINE(6) -#define LCD_LINE_7 LINE(7) -#define LCD_LINE_8 LINE(8) -#define LCD_LINE_9 LINE(9) -#define LCD_LINE_10 LINE(10) -#define LCD_LINE_11 LINE(11) -#define LCD_LINE_12 LINE(12) -#define LCD_LINE_13 LINE(13) -#define LCD_LINE_14 LINE(14) -#define LCD_LINE_15 LINE(15) -#define LCD_LINE_16 LINE(16) -#define LCD_LINE_17 LINE(17) -#define LCD_LINE_18 LINE(18) -#define LCD_LINE_19 LINE(19) -#define LCD_LINE_20 LINE(20) -#define LCD_LINE_21 LINE(21) -#define LCD_LINE_22 LINE(22) -#define LCD_LINE_23 LINE(23) -#define LCD_LINE_24 LINE(24) -#define LCD_LINE_25 LINE(25) -#define LCD_LINE_26 LINE(26) -#define LCD_LINE_27 LINE(27) -#define LCD_LINE_28 LINE(28) -#define LCD_LINE_29 LINE(29) - -/** - * @brief LCD default font - */ -#define LCD_DEFAULT_FONT Font16x24 - -/** - * @brief LCD Direction - */ -#define LCD_DIR_HORIZONTAL 0x0000 -#define LCD_DIR_VERTICAL 0x0001 - -/** - * @brief LCD Size (Width and Height) - */ -#define LCD_PIXEL_WIDTH 0x0140 -#define LCD_PIXEL_HEIGHT 0x00F0 - -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_LCD_Exported_Macros - * @{ - */ -#define ASSEMBLE_RGB(R ,G, B) ((((R)& 0xF8) << 8) | (((G) & 0xFC) << 3) | (((B) & 0xF8) >> 3)) -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_LCD_Exported_Functions - * @{ - */ -/** @defgroup - * @{ - */ -void LCD_DeInit(void); -void STM322xG_LCD_Init(void); -void LCD_SetColors(__IO uint16_t _TextColor, __IO uint16_t _BackColor); -void LCD_GetColors(__IO uint16_t *_TextColor, __IO uint16_t *_BackColor); -void LCD_SetTextColor(__IO uint16_t Color); -void LCD_SetBackColor(__IO uint16_t Color); -void LCD_ClearLine(uint16_t Line); -void LCD_Clear(uint16_t Color); -void LCD_SetCursor(uint16_t Xpos, uint16_t Ypos); -void LCD_DrawChar(uint16_t Xpos, uint16_t Ypos, const uint16_t *c); -void LCD_DisplayChar(uint16_t Line, uint16_t Column, uint8_t Ascii); -void LCD_SetFont(sFONT *fonts); -sFONT *LCD_GetFont(void); -void LCD_DisplayStringLine(uint16_t Line, uint8_t *ptr); -void LCD_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint8_t Height, uint16_t Width); -void LCD_WindowModeDisable(void); -void LCD_DrawLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length, uint8_t Direction); -void LCD_DrawRect(uint16_t Xpos, uint16_t Ypos, uint8_t Height, uint16_t Width); -void LCD_DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius); -void LCD_DrawMonoPict(const uint32_t *Pict); -void LCD_WriteBMP(uint32_t BmpAddress); -void LCD_DrawUniLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); -void LCD_DrawFullRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height); -void LCD_DrawFullCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius); -void LCD_PolyLine(pPoint Points, uint16_t PointCount); -void LCD_PolyLineRelative(pPoint Points, uint16_t PointCount); -void LCD_ClosedPolyLine(pPoint Points, uint16_t PointCount); -void LCD_ClosedPolyLineRelative(pPoint Points, uint16_t PointCount); -void LCD_FillPolyLine(pPoint Points, uint16_t PointCount); -/** - * @} - */ - -/** @defgroup - * @{ - */ -void LCD_WriteReg(uint8_t LCD_Reg, uint16_t LCD_RegValue); -uint16_t LCD_ReadReg(uint8_t LCD_Reg); -void LCD_WriteRAM_Prepare(void); -void LCD_WriteRAM(uint16_t RGB_Code); -uint16_t LCD_ReadRAM(void); -void LCD_PowerOn(void); -void LCD_DisplayOn(void); -void LCD_DisplayOff(void); -/** - * @} - */ - -/** @defgroup - * @{ - */ -void LCD_CtrlLinesConfig(void); -void LCD_FSMCConfig(void); -/** - * @} - */ -/** - * @} - */ -#ifdef __cplusplus -} -#endif - -#endif /* __STM322xG_EVAL_LCD_H */ -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_sdio_sd.c b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_sdio_sd.c deleted file mode 100644 index f0b9478c5..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_sdio_sd.c +++ /dev/null @@ -1,2820 +0,0 @@ -/** - ****************************************************************************** - * @file stm322xg_eval_sdio_sd.c - * @author MCD Application Team - * @version V5.0.3 - * @date 09-March-2012 - * @brief This file provides a set of functions needed to manage the SDIO SD - * Card memory mounted on STM322xG-EVAL evaluation board. - * - * - * @verbatim - * - * =================================================================== - * How to use this driver - * =================================================================== - * It implements a high level communication layer for read and write - * from/to this memory. The needed STM32 hardware resources (SDIO and - * GPIO) are defined in stm322xg_eval.h file, and the initialization is - * performed in SD_LowLevel_Init() function declared in stm322xg_eval.c - * file. - * You can easily tailor this driver to any other development board, - * by just adapting the defines for hardware resources and - * SD_LowLevel_Init() function. - * - * A - SD Card Initialization and configuration - * ============================================ - * - To initialize the SD Card, use the SD_Init() function. It - * Initializes the SD Card and put it into StandBy State (Ready - * for data transfer). This function provide the following operations: - * - * 1 - Apply the SD Card initialization process at 400KHz and check - * the SD Card type (Standard Capacity or High Capacity). You - * can change or adapt this frequency by adjusting the - * "SDIO_INIT_CLK_DIV" define inside the stm322xg_eval.h file. - * The SD Card frequency (SDIO_CK) is computed as follows: - * - * +---------------------------------------------+ - * | SDIO_CK = SDIOCLK / (SDIO_INIT_CLK_DIV + 2) | - * +---------------------------------------------+ - * - * In initialization mode and according to the SD Card standard, - * make sure that the SDIO_CK frequency don't exceed 400KHz. - * - * 2 - Get the SD CID and CSD data. All these information are - * managed by the SDCardInfo structure. This structure provide - * also ready computed SD Card capacity and Block size. - * - * 3 - Configure the SD Card Data transfer frequency. By Default, - * the card transfer frequency is set to 24MHz. You can change - * or adapt this frequency by adjusting the "SDIO_TRANSFER_CLK_DIV" - * define inside the stm322xg_eval.h file. - * The SD Card frequency (SDIO_CK) is computed as follows: - * - * +---------------------------------------------+ - * | SDIO_CK = SDIOCLK / (SDIO_INIT_CLK_DIV + 2) | - * +---------------------------------------------+ - * - * In transfer mode and according to the SD Card standard, - * make sure that the SDIO_CK frequency don't exceed 25MHz - * and 50MHz in High-speed mode switch. - * To be able to use a frequency higher than 24MHz, you should - * use the SDIO peripheral in bypass mode. Refer to the - * corresponding reference manual for more details. - * - * 4 - Select the corresponding SD Card according to the address - * read with the step 2. - * - * 5 - Configure the SD Card in wide bus mode: 4-bits data. - * - * B - SD Card Read operation - * ========================== - * - You can read SD card by using two function: SD_ReadBlock() and - * SD_ReadMultiBlocks() functions. These functions support only - * 512-byte block length. - * - The SD_ReadBlock() function read only one block (512-byte). This - * function can transfer the data using DMA controller or using - * polling mode. To select between DMA or polling mode refer to - * "SD_DMA_MODE" or "SD_POLLING_MODE" inside the stm322xg_eval_sdio_sd.h - * file and uncomment the corresponding line. By default the SD DMA - * mode is selected - * - The SD_ReadMultiBlocks() function read only mutli blocks (multiple - * of 512-byte). - * - Any read operation should be followed by two functions to check - * if the DMA Controller and SD Card status. - * - SD_ReadWaitOperation(): this function insure that the DMA - * controller has finished all data transfer. - * - SD_GetStatus(): to check that the SD Card has finished the - * data transfer and it is ready for data. - * - * - The DMA transfer is finished by the SDIO Data End interrupt. - * User has to call the SD_ProcessIRQ() function inside the SDIO_IRQHandler() - * and SD_ProcessDMAIRQ() function inside the DMA2_Streamx_IRQHandler(). - * Don't forget to enable the SDIO_IRQn and DMA2_Stream3_IRQn or - * DMA2_Stream6_IRQn interrupts using the NVIC controller. - * - * C - SD Card Write operation - * =========================== - * - You can write SD card by using two function: SD_WriteBlock() and - * SD_WriteMultiBlocks() functions. These functions support only - * 512-byte block length. - * - The SD_WriteBlock() function write only one block (512-byte). This - * function can transfer the data using DMA controller or using - * polling mode. To select between DMA or polling mode refer to - * "SD_DMA_MODE" or "SD_POLLING_MODE" inside the stm322xg_eval_sdio_sd.h - * file and uncomment the corresponding line. By default the SD DMA - * mode is selected - * - The SD_WriteMultiBlocks() function write only mutli blocks (multiple - * of 512-byte). - * - Any write operation should be followed by two functions to check - * if the DMA Controller and SD Card status. - * - SD_ReadWaitOperation(): this function insure that the DMA - * controller has finished all data transfer. - * - SD_GetStatus(): to check that the SD Card has finished the - * data transfer and it is ready for data. - * - * - The DMA transfer is finished by the SDIO Data End interrupt. - * User has to call the SD_ProcessIRQ() function inside the SDIO_IRQHandler() - * and SD_ProcessDMAIRQ() function inside the DMA2_Streamx_IRQHandler(). - * Don't forget to enable the SDIO_IRQn and DMA2_Stream3_IRQn or - * DMA2_Stream6_IRQn interrupts using the NVIC controller. - * - * - * D - SD card status - * ================== - * - At any time, you can check the SD Card status and get the SD card - * state by using the SD_GetStatus() function. This function checks - * first if the SD card is still connected and then get the internal - * SD Card transfer state. - * - You can also get the SD card SD Status register by using the - * SD_SendSDStatus() function. - * - * E - Programming Model (Selecting DMA for SDIO data Transfer) - * ============================================================ - * Status = SD_Init(); // Initialization Step as described in section A - * - * // SDIO Interrupt ENABLE - * NVIC_InitStructure.NVIC_IRQChannel = SDIO_IRQn; - * NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; - * NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; - * NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - * NVIC_Init(&NVIC_InitStructure); - * // DMA2 STREAMx Interrupt ENABLE - * NVIC_InitStructure.NVIC_IRQChannel = SD_SDIO_DMA_IRQn; - * NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; - * NVIC_Init(&NVIC_InitStructure); - * - * // Write operation as described in Section C - * Status = SD_WriteBlock(buffer, address, 512); - * Status = SD_WaitWriteOperation(); - * while(SD_GetStatus() != SD_TRANSFER_OK); - * - * Status = SD_WriteMultiBlocks(buffer, address, 512, NUMBEROFBLOCKS); - * Status = SD_WaitWriteOperation(); - * while(SD_GetStatus() != SD_TRANSFER_OK); - * - * // Read operation as described in Section B - * Status = SD_ReadBlock(buffer, address, 512); - * Status = SD_WaitReadOperation(); - * while(SD_GetStatus() != SD_TRANSFER_OK); - * - * Status = SD_ReadMultiBlocks(buffer, address, 512, NUMBEROFBLOCKS); - * Status = SD_WaitReadOperation(); - * while(SD_GetStatus() != SD_TRANSFER_OK); - * - * - Add the SDIO and DMA2 StreamX (3 or 6) IRQ Handlers: - * void SDIO_IRQHandler(void) - * { - * SD_ProcessIRQ(); - * } - * void SD_SDIO_DMA_IRQHANDLER(void) - * { - * SD_ProcessDMAIRQ(); - * } - * - * F - Programming Model (Selecting Polling for SDIO data Transfer) - * ================================================================ - * //Only SD Card Single Block operation are managed. - * Status = SD_Init(); // Initialization Step as described in section - * - * // Write operation as described in Section C - * Status = SD_WriteBlock(buffer, address, 512); - * - * // Read operation as described in Section B - * Status = SD_ReadBlock(buffer, address, 512); - * - * STM32 SDIO Pin assignment - * ========================= - * +-----------------------------------------------------------+ - * | Pin assignment | - * +-----------------------------+---------------+-------------+ - * | STM32 SDIO Pins | SD | Pin | - * +-----------------------------+---------------+-------------+ - * | SDIO D2 | D2 | 1 | - * | SDIO D3 | D3 | 2 | - * | SDIO CMD | CMD | 3 | - * | | VCC | 4 (3.3 V)| - * | SDIO CLK | CLK | 5 | - * | | GND | 6 (0 V) | - * | SDIO D0 | D0 | 7 | - * | SDIO D1 | D1 | 8 | - * +-----------------------------+---------------+-------------+ - * - * @endverbatim - * - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "stm322xg_eval_sdio_sd.h" - - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL_SDIO_SD - * @brief This file provides all the SD Card driver firmware functions. - * @{ - */ - -/** @defgroup STM322xG_EVAL_SDIO_SD_Private_Types - * @{ - */ -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_SDIO_SD_Private_Defines - * @{ - */ - -/** - * @brief SDIO Static flags, TimeOut, FIFO Address - */ -#define NULL 0 -#define SDIO_STATIC_FLAGS ((uint32_t)0x000005FF) -#define SDIO_CMD0TIMEOUT ((uint32_t)0x00010000) - -/** - * @brief Mask for errors Card Status R1 (OCR Register) - */ -#define SD_OCR_ADDR_OUT_OF_RANGE ((uint32_t)0x80000000) -#define SD_OCR_ADDR_MISALIGNED ((uint32_t)0x40000000) -#define SD_OCR_BLOCK_LEN_ERR ((uint32_t)0x20000000) -#define SD_OCR_ERASE_SEQ_ERR ((uint32_t)0x10000000) -#define SD_OCR_BAD_ERASE_PARAM ((uint32_t)0x08000000) -#define SD_OCR_WRITE_PROT_VIOLATION ((uint32_t)0x04000000) -#define SD_OCR_LOCK_UNLOCK_FAILED ((uint32_t)0x01000000) -#define SD_OCR_COM_CRC_FAILED ((uint32_t)0x00800000) -#define SD_OCR_ILLEGAL_CMD ((uint32_t)0x00400000) -#define SD_OCR_CARD_ECC_FAILED ((uint32_t)0x00200000) -#define SD_OCR_CC_ERROR ((uint32_t)0x00100000) -#define SD_OCR_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00080000) -#define SD_OCR_STREAM_READ_UNDERRUN ((uint32_t)0x00040000) -#define SD_OCR_STREAM_WRITE_OVERRUN ((uint32_t)0x00020000) -#define SD_OCR_CID_CSD_OVERWRIETE ((uint32_t)0x00010000) -#define SD_OCR_WP_ERASE_SKIP ((uint32_t)0x00008000) -#define SD_OCR_CARD_ECC_DISABLED ((uint32_t)0x00004000) -#define SD_OCR_ERASE_RESET ((uint32_t)0x00002000) -#define SD_OCR_AKE_SEQ_ERROR ((uint32_t)0x00000008) -#define SD_OCR_ERRORBITS ((uint32_t)0xFDFFE008) - -/** - * @brief Masks for R6 Response - */ -#define SD_R6_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00002000) -#define SD_R6_ILLEGAL_CMD ((uint32_t)0x00004000) -#define SD_R6_COM_CRC_FAILED ((uint32_t)0x00008000) - -#define SD_VOLTAGE_WINDOW_SD ((uint32_t)0x80100000) -#define SD_HIGH_CAPACITY ((uint32_t)0x40000000) -#define SD_STD_CAPACITY ((uint32_t)0x00000000) -#define SD_CHECK_PATTERN ((uint32_t)0x000001AA) - -#define SD_MAX_VOLT_TRIAL ((uint32_t)0x0000FFFF) -#define SD_ALLZERO ((uint32_t)0x00000000) - -#define SD_WIDE_BUS_SUPPORT ((uint32_t)0x00040000) -#define SD_SINGLE_BUS_SUPPORT ((uint32_t)0x00010000) -#define SD_CARD_LOCKED ((uint32_t)0x02000000) - -#define SD_DATATIMEOUT ((uint32_t)0xFFFFFFFF) -#define SD_0TO7BITS ((uint32_t)0x000000FF) -#define SD_8TO15BITS ((uint32_t)0x0000FF00) -#define SD_16TO23BITS ((uint32_t)0x00FF0000) -#define SD_24TO31BITS ((uint32_t)0xFF000000) -#define SD_MAX_DATA_LENGTH ((uint32_t)0x01FFFFFF) - -#define SD_HALFFIFO ((uint32_t)0x00000008) -#define SD_HALFFIFOBYTES ((uint32_t)0x00000020) - -/** - * @brief Command Class Supported - */ -#define SD_CCCC_LOCK_UNLOCK ((uint32_t)0x00000080) -#define SD_CCCC_WRITE_PROT ((uint32_t)0x00000040) -#define SD_CCCC_ERASE ((uint32_t)0x00000020) - -/** - * @brief Following commands are SD Card Specific commands. - * SDIO_APP_CMD should be sent before sending these commands. - */ -#define SDIO_SEND_IF_COND ((uint32_t)0x00000008) - -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_SDIO_SD_Private_Macros - * @{ - */ -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_SDIO_SD_Private_Variables - * @{ - */ - -static uint32_t CardType = SDIO_STD_CAPACITY_SD_CARD_V1_1; -static uint32_t CSD_Tab[4], CID_Tab[4], RCA = 0; -static uint8_t SDSTATUS_Tab[16]; -__IO uint32_t StopCondition = 0; -__IO SD_Error TransferError = SD_OK; -__IO uint32_t TransferEnd = 0, DMAEndOfTransfer = 0; -SD_CardInfo SDCardInfo; - -SDIO_InitTypeDef SDIO_InitStructure; -SDIO_CmdInitTypeDef SDIO_CmdInitStructure; -SDIO_DataInitTypeDef SDIO_DataInitStructure; -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_SDIO_SD_Private_Function_Prototypes - * @{ - */ -static SD_Error CmdError(void); -static SD_Error CmdResp1Error(uint8_t cmd); -static SD_Error CmdResp7Error(void); -static SD_Error CmdResp3Error(void); -static SD_Error CmdResp2Error(void); -static SD_Error CmdResp6Error(uint8_t cmd, uint16_t *prca); -static SD_Error SDEnWideBus(FunctionalState NewState); -static SD_Error IsCardProgramming(uint8_t *pstatus); -static SD_Error FindSCR(uint16_t rca, uint32_t *pscr); -uint8_t convert_from_bytes_to_power_of_two(uint16_t NumberOfBytes); - -/** - * @} - */ - - -/** @defgroup STM322xG_EVAL_SDIO_SD_Private_Functions - * @{ - */ - -/** - * @brief DeInitializes the SDIO interface. - * @param None - * @retval None - */ -void SD_DeInit(void) -{ - SD_LowLevel_DeInit(); -} - -/** - * @brief Initializes the SD Card and put it into StandBy State (Ready for data - * transfer). - * @param None - * @retval SD_Error: SD Card Error code. - */ -SD_Error SD_Init(void) -{ - __IO SD_Error errorstatus = SD_OK; - - /* SDIO Peripheral Low Level Init */ - SD_LowLevel_Init(); - - SDIO_DeInit(); - - errorstatus = SD_PowerON(); - - if (errorstatus != SD_OK) - { - /*!< CMD Response TimeOut (wait for CMDSENT flag) */ - return(errorstatus); - } - - errorstatus = SD_InitializeCards(); - - if (errorstatus != SD_OK) - { - /*!< CMD Response TimeOut (wait for CMDSENT flag) */ - return(errorstatus); - } - - /*!< Configure the SDIO peripheral */ - /*!< SDIO_CK = SDIOCLK / (SDIO_TRANSFER_CLK_DIV + 2) */ - /*!< on STM32F2xx devices, SDIOCLK is fixed to 48MHz */ - SDIO_InitStructure.SDIO_ClockDiv = SDIO_TRANSFER_CLK_DIV; - SDIO_InitStructure.SDIO_ClockEdge = SDIO_ClockEdge_Rising; - SDIO_InitStructure.SDIO_ClockBypass = SDIO_ClockBypass_Disable; - SDIO_InitStructure.SDIO_ClockPowerSave = SDIO_ClockPowerSave_Disable; - SDIO_InitStructure.SDIO_BusWide = SDIO_BusWide_1b; - SDIO_InitStructure.SDIO_HardwareFlowControl = SDIO_HardwareFlowControl_Disable; - SDIO_Init(&SDIO_InitStructure); - - /*----------------- Read CSD/CID MSD registers ------------------*/ - errorstatus = SD_GetCardInfo(&SDCardInfo); - - if (errorstatus == SD_OK) - { - /*----------------- Select Card --------------------------------*/ - errorstatus = SD_SelectDeselect((uint32_t) (SDCardInfo.RCA << 16)); - } - - if (errorstatus == SD_OK) - { - errorstatus = SD_EnableWideBusOperation(SDIO_BusWide_4b); - } - - return(errorstatus); -} - -/** - * @brief Gets the cuurent sd card data transfer status. - * @param None - * @retval SDTransferState: Data Transfer state. - * This value can be: - * - SD_TRANSFER_OK: No data transfer is acting - * - SD_TRANSFER_BUSY: Data transfer is acting - */ -SDTransferState SD_GetStatus(void) -{ - SDCardState cardstate = SD_CARD_TRANSFER; - - cardstate = SD_GetState(); - - if (cardstate == SD_CARD_TRANSFER) - { - return(SD_TRANSFER_OK); - } - else if(cardstate == SD_CARD_ERROR) - { - return (SD_TRANSFER_ERROR); - } - else - { - return(SD_TRANSFER_BUSY); - } -} - -/** - * @brief Returns the current card's state. - * @param None - * @retval SDCardState: SD Card Error or SD Card Current State. - */ -SDCardState SD_GetState(void) -{ - uint32_t resp1 = 0; - - if(SD_Detect()== SD_PRESENT) - { - if (SD_SendStatus(&resp1) != SD_OK) - { - return SD_CARD_ERROR; - } - else - { - return (SDCardState)((resp1 >> 9) & 0x0F); - } - } - else - { - return SD_CARD_ERROR; - } -} - -/** - * @brief Detect if SD card is correctly plugged in the memory slot. - * @param None - * @retval Return if SD is detected or not - */ -uint8_t SD_Detect(void) -{ - __IO uint8_t status = SD_PRESENT; - - /*!< Check GPIO to detect SD */ - if (GPIO_ReadInputDataBit(SD_DETECT_GPIO_PORT, SD_DETECT_PIN) != Bit_RESET) - { - status = SD_NOT_PRESENT; - } - return status; -} - -/** - * @brief Enquires cards about their operating voltage and configures - * clock controls. - * @param None - * @retval SD_Error: SD Card Error code. - */ -SD_Error SD_PowerON(void) -{ - __IO SD_Error errorstatus = SD_OK; - uint32_t response = 0, count = 0, validvoltage = 0; - uint32_t SDType = SD_STD_CAPACITY; - - /*!< Power ON Sequence -----------------------------------------------------*/ - /*!< Configure the SDIO peripheral */ - /*!< SDIO_CK = SDIOCLK / (SDIO_INIT_CLK_DIV + 2) */ - /*!< on STM32F2xx devices, SDIOCLK is fixed to 48MHz */ - /*!< SDIO_CK for initialization should not exceed 400 KHz */ - SDIO_InitStructure.SDIO_ClockDiv = SDIO_INIT_CLK_DIV; - SDIO_InitStructure.SDIO_ClockEdge = SDIO_ClockEdge_Rising; - SDIO_InitStructure.SDIO_ClockBypass = SDIO_ClockBypass_Disable; - SDIO_InitStructure.SDIO_ClockPowerSave = SDIO_ClockPowerSave_Disable; - SDIO_InitStructure.SDIO_BusWide = SDIO_BusWide_1b; - SDIO_InitStructure.SDIO_HardwareFlowControl = SDIO_HardwareFlowControl_Disable; - SDIO_Init(&SDIO_InitStructure); - - /*!< Set Power State to ON */ - SDIO_SetPowerState(SDIO_PowerState_ON); - - /*!< Enable SDIO Clock */ - SDIO_ClockCmd(ENABLE); - - /*!< CMD0: GO_IDLE_STATE ---------------------------------------------------*/ - /*!< No CMD response required */ - SDIO_CmdInitStructure.SDIO_Argument = 0x0; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_GO_IDLE_STATE; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_No; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdError(); - - if (errorstatus != SD_OK) - { - /*!< CMD Response TimeOut (wait for CMDSENT flag) */ - return(errorstatus); - } - - /*!< CMD8: SEND_IF_COND ----------------------------------------------------*/ - /*!< Send CMD8 to verify SD card interface operating condition */ - /*!< Argument: - [31:12]: Reserved (shall be set to '0') - - [11:8]: Supply Voltage (VHS) 0x1 (Range: 2.7-3.6 V) - - [7:0]: Check Pattern (recommended 0xAA) */ - /*!< CMD Response: R7 */ - SDIO_CmdInitStructure.SDIO_Argument = SD_CHECK_PATTERN; - SDIO_CmdInitStructure.SDIO_CmdIndex = SDIO_SEND_IF_COND; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp7Error(); - - if (errorstatus == SD_OK) - { - CardType = SDIO_STD_CAPACITY_SD_CARD_V2_0; /*!< SD Card 2.0 */ - SDType = SD_HIGH_CAPACITY; - } - else - { - /*!< CMD55 */ - SDIO_CmdInitStructure.SDIO_Argument = 0x00; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_APP_CMD; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - errorstatus = CmdResp1Error(SD_CMD_APP_CMD); - } - /*!< CMD55 */ - SDIO_CmdInitStructure.SDIO_Argument = 0x00; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_APP_CMD; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - errorstatus = CmdResp1Error(SD_CMD_APP_CMD); - - /*!< If errorstatus is Command TimeOut, it is a MMC card */ - /*!< If errorstatus is SD_OK it is a SD card: SD card 2.0 (voltage range mismatch) - or SD card 1.x */ - if (errorstatus == SD_OK) - { - /*!< SD CARD */ - /*!< Send ACMD41 SD_APP_OP_COND with Argument 0x80100000 */ - while ((!validvoltage) && (count < SD_MAX_VOLT_TRIAL)) - { - - /*!< SEND CMD55 APP_CMD with RCA as 0 */ - SDIO_CmdInitStructure.SDIO_Argument = 0x00; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_APP_CMD; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_APP_CMD); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - SDIO_CmdInitStructure.SDIO_Argument = SD_VOLTAGE_WINDOW_SD | SDType; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_SD_APP_OP_COND; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp3Error(); - if (errorstatus != SD_OK) - { - return(errorstatus); - } - - response = SDIO_GetResponse(SDIO_RESP1); - validvoltage = (((response >> 31) == 1) ? 1 : 0); - count++; - } - if (count >= SD_MAX_VOLT_TRIAL) - { - errorstatus = SD_INVALID_VOLTRANGE; - return(errorstatus); - } - - if (response &= SD_HIGH_CAPACITY) - { - CardType = SDIO_HIGH_CAPACITY_SD_CARD; - } - - }/*!< else MMC Card */ - - return(errorstatus); -} - -/** - * @brief Turns the SDIO output signals off. - * @param None - * @retval SD_Error: SD Card Error code. - */ -SD_Error SD_PowerOFF(void) -{ - SD_Error errorstatus = SD_OK; - - /*!< Set Power State to OFF */ - SDIO_SetPowerState(SDIO_PowerState_OFF); - - return(errorstatus); -} - -/** - * @brief Intialises all cards or single card as the case may be Card(s) come - * into standby state. - * @param None - * @retval SD_Error: SD Card Error code. - */ -SD_Error SD_InitializeCards(void) -{ - SD_Error errorstatus = SD_OK; - uint16_t rca = 0x01; - - if (SDIO_GetPowerState() == SDIO_PowerState_OFF) - { - errorstatus = SD_REQUEST_NOT_APPLICABLE; - return(errorstatus); - } - - if (SDIO_SECURE_DIGITAL_IO_CARD != CardType) - { - /*!< Send CMD2 ALL_SEND_CID */ - SDIO_CmdInitStructure.SDIO_Argument = 0x0; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_ALL_SEND_CID; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Long; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp2Error(); - - if (SD_OK != errorstatus) - { - return(errorstatus); - } - - CID_Tab[0] = SDIO_GetResponse(SDIO_RESP1); - CID_Tab[1] = SDIO_GetResponse(SDIO_RESP2); - CID_Tab[2] = SDIO_GetResponse(SDIO_RESP3); - CID_Tab[3] = SDIO_GetResponse(SDIO_RESP4); - } - if ((SDIO_STD_CAPACITY_SD_CARD_V1_1 == CardType) || (SDIO_STD_CAPACITY_SD_CARD_V2_0 == CardType) || (SDIO_SECURE_DIGITAL_IO_COMBO_CARD == CardType) - || (SDIO_HIGH_CAPACITY_SD_CARD == CardType)) - { - /*!< Send CMD3 SET_REL_ADDR with argument 0 */ - /*!< SD Card publishes its RCA. */ - SDIO_CmdInitStructure.SDIO_Argument = 0x00; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_SET_REL_ADDR; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp6Error(SD_CMD_SET_REL_ADDR, &rca); - - if (SD_OK != errorstatus) - { - return(errorstatus); - } - } - - if (SDIO_SECURE_DIGITAL_IO_CARD != CardType) - { - RCA = rca; - - /*!< Send CMD9 SEND_CSD with argument as card's RCA */ - SDIO_CmdInitStructure.SDIO_Argument = (uint32_t)(rca << 16); - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_SEND_CSD; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Long; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp2Error(); - - if (SD_OK != errorstatus) - { - return(errorstatus); - } - - CSD_Tab[0] = SDIO_GetResponse(SDIO_RESP1); - CSD_Tab[1] = SDIO_GetResponse(SDIO_RESP2); - CSD_Tab[2] = SDIO_GetResponse(SDIO_RESP3); - CSD_Tab[3] = SDIO_GetResponse(SDIO_RESP4); - } - - errorstatus = SD_OK; /*!< All cards get intialized */ - - return(errorstatus); -} - -/** - * @brief Returns information about specific card. - * @param cardinfo: pointer to a SD_CardInfo structure that contains all SD card - * information. - * @retval SD_Error: SD Card Error code. - */ -SD_Error SD_GetCardInfo(SD_CardInfo *cardinfo) -{ - SD_Error errorstatus = SD_OK; - uint8_t tmp = 0; - - cardinfo->CardType = (uint8_t)CardType; - cardinfo->RCA = (uint16_t)RCA; - - /*!< Byte 0 */ - tmp = (uint8_t)((CSD_Tab[0] & 0xFF000000) >> 24); - cardinfo->SD_csd.CSDStruct = (tmp & 0xC0) >> 6; - cardinfo->SD_csd.SysSpecVersion = (tmp & 0x3C) >> 2; - cardinfo->SD_csd.Reserved1 = tmp & 0x03; - - /*!< Byte 1 */ - tmp = (uint8_t)((CSD_Tab[0] & 0x00FF0000) >> 16); - cardinfo->SD_csd.TAAC = tmp; - - /*!< Byte 2 */ - tmp = (uint8_t)((CSD_Tab[0] & 0x0000FF00) >> 8); - cardinfo->SD_csd.NSAC = tmp; - - /*!< Byte 3 */ - tmp = (uint8_t)(CSD_Tab[0] & 0x000000FF); - cardinfo->SD_csd.MaxBusClkFrec = tmp; - - /*!< Byte 4 */ - tmp = (uint8_t)((CSD_Tab[1] & 0xFF000000) >> 24); - cardinfo->SD_csd.CardComdClasses = tmp << 4; - - /*!< Byte 5 */ - tmp = (uint8_t)((CSD_Tab[1] & 0x00FF0000) >> 16); - cardinfo->SD_csd.CardComdClasses |= (tmp & 0xF0) >> 4; - cardinfo->SD_csd.RdBlockLen = tmp & 0x0F; - - /*!< Byte 6 */ - tmp = (uint8_t)((CSD_Tab[1] & 0x0000FF00) >> 8); - cardinfo->SD_csd.PartBlockRead = (tmp & 0x80) >> 7; - cardinfo->SD_csd.WrBlockMisalign = (tmp & 0x40) >> 6; - cardinfo->SD_csd.RdBlockMisalign = (tmp & 0x20) >> 5; - cardinfo->SD_csd.DSRImpl = (tmp & 0x10) >> 4; - cardinfo->SD_csd.Reserved2 = 0; /*!< Reserved */ - - if ((CardType == SDIO_STD_CAPACITY_SD_CARD_V1_1) || (CardType == SDIO_STD_CAPACITY_SD_CARD_V2_0)) - { - cardinfo->SD_csd.DeviceSize = (tmp & 0x03) << 10; - - /*!< Byte 7 */ - tmp = (uint8_t)(CSD_Tab[1] & 0x000000FF); - cardinfo->SD_csd.DeviceSize |= (tmp) << 2; - - /*!< Byte 8 */ - tmp = (uint8_t)((CSD_Tab[2] & 0xFF000000) >> 24); - cardinfo->SD_csd.DeviceSize |= (tmp & 0xC0) >> 6; - - cardinfo->SD_csd.MaxRdCurrentVDDMin = (tmp & 0x38) >> 3; - cardinfo->SD_csd.MaxRdCurrentVDDMax = (tmp & 0x07); - - /*!< Byte 9 */ - tmp = (uint8_t)((CSD_Tab[2] & 0x00FF0000) >> 16); - cardinfo->SD_csd.MaxWrCurrentVDDMin = (tmp & 0xE0) >> 5; - cardinfo->SD_csd.MaxWrCurrentVDDMax = (tmp & 0x1C) >> 2; - cardinfo->SD_csd.DeviceSizeMul = (tmp & 0x03) << 1; - /*!< Byte 10 */ - tmp = (uint8_t)((CSD_Tab[2] & 0x0000FF00) >> 8); - cardinfo->SD_csd.DeviceSizeMul |= (tmp & 0x80) >> 7; - - cardinfo->CardCapacity = (cardinfo->SD_csd.DeviceSize + 1) ; - cardinfo->CardCapacity *= (1 << (cardinfo->SD_csd.DeviceSizeMul + 2)); - cardinfo->CardBlockSize = 1 << (cardinfo->SD_csd.RdBlockLen); - cardinfo->CardCapacity *= cardinfo->CardBlockSize; - } - else if (CardType == SDIO_HIGH_CAPACITY_SD_CARD) - { - /*!< Byte 7 */ - tmp = (uint8_t)(CSD_Tab[1] & 0x000000FF); - cardinfo->SD_csd.DeviceSize = (tmp & 0x3F) << 16; - - /*!< Byte 8 */ - tmp = (uint8_t)((CSD_Tab[2] & 0xFF000000) >> 24); - - cardinfo->SD_csd.DeviceSize |= (tmp << 8); - - /*!< Byte 9 */ - tmp = (uint8_t)((CSD_Tab[2] & 0x00FF0000) >> 16); - - cardinfo->SD_csd.DeviceSize |= (tmp); - - /*!< Byte 10 */ - tmp = (uint8_t)((CSD_Tab[2] & 0x0000FF00) >> 8); - - cardinfo->CardCapacity = (cardinfo->SD_csd.DeviceSize + 1) * 512 * 1024; - cardinfo->CardBlockSize = 512; - } - - - cardinfo->SD_csd.EraseGrSize = (tmp & 0x40) >> 6; - cardinfo->SD_csd.EraseGrMul = (tmp & 0x3F) << 1; - - /*!< Byte 11 */ - tmp = (uint8_t)(CSD_Tab[2] & 0x000000FF); - cardinfo->SD_csd.EraseGrMul |= (tmp & 0x80) >> 7; - cardinfo->SD_csd.WrProtectGrSize = (tmp & 0x7F); - - /*!< Byte 12 */ - tmp = (uint8_t)((CSD_Tab[3] & 0xFF000000) >> 24); - cardinfo->SD_csd.WrProtectGrEnable = (tmp & 0x80) >> 7; - cardinfo->SD_csd.ManDeflECC = (tmp & 0x60) >> 5; - cardinfo->SD_csd.WrSpeedFact = (tmp & 0x1C) >> 2; - cardinfo->SD_csd.MaxWrBlockLen = (tmp & 0x03) << 2; - - /*!< Byte 13 */ - tmp = (uint8_t)((CSD_Tab[3] & 0x00FF0000) >> 16); - cardinfo->SD_csd.MaxWrBlockLen |= (tmp & 0xC0) >> 6; - cardinfo->SD_csd.WriteBlockPaPartial = (tmp & 0x20) >> 5; - cardinfo->SD_csd.Reserved3 = 0; - cardinfo->SD_csd.ContentProtectAppli = (tmp & 0x01); - - /*!< Byte 14 */ - tmp = (uint8_t)((CSD_Tab[3] & 0x0000FF00) >> 8); - cardinfo->SD_csd.FileFormatGrouop = (tmp & 0x80) >> 7; - cardinfo->SD_csd.CopyFlag = (tmp & 0x40) >> 6; - cardinfo->SD_csd.PermWrProtect = (tmp & 0x20) >> 5; - cardinfo->SD_csd.TempWrProtect = (tmp & 0x10) >> 4; - cardinfo->SD_csd.FileFormat = (tmp & 0x0C) >> 2; - cardinfo->SD_csd.ECC = (tmp & 0x03); - - /*!< Byte 15 */ - tmp = (uint8_t)(CSD_Tab[3] & 0x000000FF); - cardinfo->SD_csd.CSD_CRC = (tmp & 0xFE) >> 1; - cardinfo->SD_csd.Reserved4 = 1; - - - /*!< Byte 0 */ - tmp = (uint8_t)((CID_Tab[0] & 0xFF000000) >> 24); - cardinfo->SD_cid.ManufacturerID = tmp; - - /*!< Byte 1 */ - tmp = (uint8_t)((CID_Tab[0] & 0x00FF0000) >> 16); - cardinfo->SD_cid.OEM_AppliID = tmp << 8; - - /*!< Byte 2 */ - tmp = (uint8_t)((CID_Tab[0] & 0x000000FF00) >> 8); - cardinfo->SD_cid.OEM_AppliID |= tmp; - - /*!< Byte 3 */ - tmp = (uint8_t)(CID_Tab[0] & 0x000000FF); - cardinfo->SD_cid.ProdName1 = tmp << 24; - - /*!< Byte 4 */ - tmp = (uint8_t)((CID_Tab[1] & 0xFF000000) >> 24); - cardinfo->SD_cid.ProdName1 |= tmp << 16; - - /*!< Byte 5 */ - tmp = (uint8_t)((CID_Tab[1] & 0x00FF0000) >> 16); - cardinfo->SD_cid.ProdName1 |= tmp << 8; - - /*!< Byte 6 */ - tmp = (uint8_t)((CID_Tab[1] & 0x0000FF00) >> 8); - cardinfo->SD_cid.ProdName1 |= tmp; - - /*!< Byte 7 */ - tmp = (uint8_t)(CID_Tab[1] & 0x000000FF); - cardinfo->SD_cid.ProdName2 = tmp; - - /*!< Byte 8 */ - tmp = (uint8_t)((CID_Tab[2] & 0xFF000000) >> 24); - cardinfo->SD_cid.ProdRev = tmp; - - /*!< Byte 9 */ - tmp = (uint8_t)((CID_Tab[2] & 0x00FF0000) >> 16); - cardinfo->SD_cid.ProdSN = tmp << 24; - - /*!< Byte 10 */ - tmp = (uint8_t)((CID_Tab[2] & 0x0000FF00) >> 8); - cardinfo->SD_cid.ProdSN |= tmp << 16; - - /*!< Byte 11 */ - tmp = (uint8_t)(CID_Tab[2] & 0x000000FF); - cardinfo->SD_cid.ProdSN |= tmp << 8; - - /*!< Byte 12 */ - tmp = (uint8_t)((CID_Tab[3] & 0xFF000000) >> 24); - cardinfo->SD_cid.ProdSN |= tmp; - - /*!< Byte 13 */ - tmp = (uint8_t)((CID_Tab[3] & 0x00FF0000) >> 16); - cardinfo->SD_cid.Reserved1 |= (tmp & 0xF0) >> 4; - cardinfo->SD_cid.ManufactDate = (tmp & 0x0F) << 8; - - /*!< Byte 14 */ - tmp = (uint8_t)((CID_Tab[3] & 0x0000FF00) >> 8); - cardinfo->SD_cid.ManufactDate |= tmp; - - /*!< Byte 15 */ - tmp = (uint8_t)(CID_Tab[3] & 0x000000FF); - cardinfo->SD_cid.CID_CRC = (tmp & 0xFE) >> 1; - cardinfo->SD_cid.Reserved2 = 1; - - return(errorstatus); -} - -/** - * @brief Enables wide bus opeartion for the requeseted card if supported by - * card. - * @param WideMode: Specifies the SD card wide bus mode. - * This parameter can be one of the following values: - * @arg SDIO_BusWide_8b: 8-bit data transfer (Only for MMC) - * @arg SDIO_BusWide_4b: 4-bit data transfer - * @arg SDIO_BusWide_1b: 1-bit data transfer - * @retval SD_Error: SD Card Error code. - */ -SD_Error SD_GetCardStatus(SD_CardStatus *cardstatus) -{ - SD_Error errorstatus = SD_OK; - uint8_t tmp = 0; - - errorstatus = SD_SendSDStatus((uint32_t *)SDSTATUS_Tab); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - - /*!< Byte 0 */ - tmp = (uint8_t)((SDSTATUS_Tab[0] & 0xC0) >> 6); - cardstatus->DAT_BUS_WIDTH = tmp; - - /*!< Byte 0 */ - tmp = (uint8_t)((SDSTATUS_Tab[0] & 0x20) >> 5); - cardstatus->SECURED_MODE = tmp; - - /*!< Byte 2 */ - tmp = (uint8_t)((SDSTATUS_Tab[2] & 0xFF)); - cardstatus->SD_CARD_TYPE = tmp << 8; - - /*!< Byte 3 */ - tmp = (uint8_t)((SDSTATUS_Tab[3] & 0xFF)); - cardstatus->SD_CARD_TYPE |= tmp; - - /*!< Byte 4 */ - tmp = (uint8_t)(SDSTATUS_Tab[4] & 0xFF); - cardstatus->SIZE_OF_PROTECTED_AREA = tmp << 24; - - /*!< Byte 5 */ - tmp = (uint8_t)(SDSTATUS_Tab[5] & 0xFF); - cardstatus->SIZE_OF_PROTECTED_AREA |= tmp << 16; - - /*!< Byte 6 */ - tmp = (uint8_t)(SDSTATUS_Tab[6] & 0xFF); - cardstatus->SIZE_OF_PROTECTED_AREA |= tmp << 8; - - /*!< Byte 7 */ - tmp = (uint8_t)(SDSTATUS_Tab[7] & 0xFF); - cardstatus->SIZE_OF_PROTECTED_AREA |= tmp; - - /*!< Byte 8 */ - tmp = (uint8_t)((SDSTATUS_Tab[8] & 0xFF)); - cardstatus->SPEED_CLASS = tmp; - - /*!< Byte 9 */ - tmp = (uint8_t)((SDSTATUS_Tab[9] & 0xFF)); - cardstatus->PERFORMANCE_MOVE = tmp; - - /*!< Byte 10 */ - tmp = (uint8_t)((SDSTATUS_Tab[10] & 0xF0) >> 4); - cardstatus->AU_SIZE = tmp; - - /*!< Byte 11 */ - tmp = (uint8_t)(SDSTATUS_Tab[11] & 0xFF); - cardstatus->ERASE_SIZE = tmp << 8; - - /*!< Byte 12 */ - tmp = (uint8_t)(SDSTATUS_Tab[12] & 0xFF); - cardstatus->ERASE_SIZE |= tmp; - - /*!< Byte 13 */ - tmp = (uint8_t)((SDSTATUS_Tab[13] & 0xFC) >> 2); - cardstatus->ERASE_TIMEOUT = tmp; - - /*!< Byte 13 */ - tmp = (uint8_t)((SDSTATUS_Tab[13] & 0x3)); - cardstatus->ERASE_OFFSET = tmp; - - return(errorstatus); -} - -/** - * @brief Enables wide bus opeartion for the requeseted card if supported by - * card. - * @param WideMode: Specifies the SD card wide bus mode. - * This parameter can be one of the following values: - * @arg SDIO_BusWide_8b: 8-bit data transfer (Only for MMC) - * @arg SDIO_BusWide_4b: 4-bit data transfer - * @arg SDIO_BusWide_1b: 1-bit data transfer - * @retval SD_Error: SD Card Error code. - */ -SD_Error SD_EnableWideBusOperation(uint32_t WideMode) -{ - SD_Error errorstatus = SD_OK; - - /*!< MMC Card doesn't support this feature */ - if (SDIO_MULTIMEDIA_CARD == CardType) - { - errorstatus = SD_UNSUPPORTED_FEATURE; - return(errorstatus); - } - else if ((SDIO_STD_CAPACITY_SD_CARD_V1_1 == CardType) || (SDIO_STD_CAPACITY_SD_CARD_V2_0 == CardType) || (SDIO_HIGH_CAPACITY_SD_CARD == CardType)) - { - if (SDIO_BusWide_8b == WideMode) - { - errorstatus = SD_UNSUPPORTED_FEATURE; - return(errorstatus); - } - else if (SDIO_BusWide_4b == WideMode) - { - errorstatus = SDEnWideBus(ENABLE); - - if (SD_OK == errorstatus) - { - /*!< Configure the SDIO peripheral */ - SDIO_InitStructure.SDIO_ClockDiv = SDIO_TRANSFER_CLK_DIV; - SDIO_InitStructure.SDIO_ClockEdge = SDIO_ClockEdge_Rising; - SDIO_InitStructure.SDIO_ClockBypass = SDIO_ClockBypass_Disable; - SDIO_InitStructure.SDIO_ClockPowerSave = SDIO_ClockPowerSave_Disable; - SDIO_InitStructure.SDIO_BusWide = SDIO_BusWide_4b; - SDIO_InitStructure.SDIO_HardwareFlowControl = SDIO_HardwareFlowControl_Disable; - SDIO_Init(&SDIO_InitStructure); - } - } - else - { - errorstatus = SDEnWideBus(DISABLE); - - if (SD_OK == errorstatus) - { - /*!< Configure the SDIO peripheral */ - SDIO_InitStructure.SDIO_ClockDiv = SDIO_TRANSFER_CLK_DIV; - SDIO_InitStructure.SDIO_ClockEdge = SDIO_ClockEdge_Rising; - SDIO_InitStructure.SDIO_ClockBypass = SDIO_ClockBypass_Disable; - SDIO_InitStructure.SDIO_ClockPowerSave = SDIO_ClockPowerSave_Disable; - SDIO_InitStructure.SDIO_BusWide = SDIO_BusWide_1b; - SDIO_InitStructure.SDIO_HardwareFlowControl = SDIO_HardwareFlowControl_Disable; - SDIO_Init(&SDIO_InitStructure); - } - } - } - - return(errorstatus); -} - -/** - * @brief Selects od Deselects the corresponding card. - * @param addr: Address of the Card to be selected. - * @retval SD_Error: SD Card Error code. - */ -SD_Error SD_SelectDeselect(uint32_t addr) -{ - SD_Error errorstatus = SD_OK; - - /*!< Send CMD7 SDIO_SEL_DESEL_CARD */ - SDIO_CmdInitStructure.SDIO_Argument = addr; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_SEL_DESEL_CARD; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_SEL_DESEL_CARD); - - return(errorstatus); -} - -/** - * @brief Allows to read one block from a specified address in a card. The Data - * transfer can be managed by DMA mode or Polling mode. - * @note This operation should be followed by two functions to check if the - * DMA Controller and SD Card status. - * - SD_ReadWaitOperation(): this function insure that the DMA - * controller has finished all data transfer. - * - SD_GetStatus(): to check that the SD Card has finished the - * data transfer and it is ready for data. - * @param readbuff: pointer to the buffer that will contain the received data - * @param ReadAddr: Address from where data are to be read. - * @param BlockSize: the SD card Data block size. The Block size should be 512. - * @retval SD_Error: SD Card Error code. - */ -SD_Error SD_ReadBlock(uint8_t *readbuff, uint32_t ReadAddr, uint16_t BlockSize) -{ - SD_Error errorstatus = SD_OK; -#if defined (SD_POLLING_MODE) - uint32_t count = 0, *tempbuff = (uint32_t *)readbuff; -#endif - - TransferError = SD_OK; - TransferEnd = 0; - StopCondition = 0; - - SDIO->DCTRL = 0x0; - - - if (CardType == SDIO_HIGH_CAPACITY_SD_CARD) - { - BlockSize = 512; - ReadAddr /= 512; - } - - /* Set Block Size for Card */ - SDIO_CmdInitStructure.SDIO_Argument = (uint32_t) BlockSize; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_SET_BLOCKLEN; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_SET_BLOCKLEN); - - if (SD_OK != errorstatus) - { - return(errorstatus); - } - - SDIO_DataInitStructure.SDIO_DataTimeOut = SD_DATATIMEOUT; - SDIO_DataInitStructure.SDIO_DataLength = BlockSize; - SDIO_DataInitStructure.SDIO_DataBlockSize = (uint32_t) 9 << 4; - SDIO_DataInitStructure.SDIO_TransferDir = SDIO_TransferDir_ToSDIO; - SDIO_DataInitStructure.SDIO_TransferMode = SDIO_TransferMode_Block; - SDIO_DataInitStructure.SDIO_DPSM = SDIO_DPSM_Enable; - SDIO_DataConfig(&SDIO_DataInitStructure); - - /*!< Send CMD17 READ_SINGLE_BLOCK */ - SDIO_CmdInitStructure.SDIO_Argument = (uint32_t)ReadAddr; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_READ_SINGLE_BLOCK; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_READ_SINGLE_BLOCK); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - -#if defined (SD_POLLING_MODE) - /*!< In case of single block transfer, no need of stop transfer at all.*/ - /*!< Polling mode */ - while (!(SDIO->STA &(SDIO_FLAG_RXOVERR | SDIO_FLAG_DCRCFAIL | SDIO_FLAG_DTIMEOUT | SDIO_FLAG_DBCKEND | SDIO_FLAG_STBITERR))) - { - if (SDIO_GetFlagStatus(SDIO_FLAG_RXFIFOHF) != RESET) - { - for (count = 0; count < 8; count++) - { - *(tempbuff + count) = SDIO_ReadData(); - } - tempbuff += 8; - } - } - - if (SDIO_GetFlagStatus(SDIO_FLAG_DTIMEOUT) != RESET) - { - SDIO_ClearFlag(SDIO_FLAG_DTIMEOUT); - errorstatus = SD_DATA_TIMEOUT; - return(errorstatus); - } - else if (SDIO_GetFlagStatus(SDIO_FLAG_DCRCFAIL) != RESET) - { - SDIO_ClearFlag(SDIO_FLAG_DCRCFAIL); - errorstatus = SD_DATA_CRC_FAIL; - return(errorstatus); - } - else if (SDIO_GetFlagStatus(SDIO_FLAG_RXOVERR) != RESET) - { - SDIO_ClearFlag(SDIO_FLAG_RXOVERR); - errorstatus = SD_RX_OVERRUN; - return(errorstatus); - } - else if (SDIO_GetFlagStatus(SDIO_FLAG_STBITERR) != RESET) - { - SDIO_ClearFlag(SDIO_FLAG_STBITERR); - errorstatus = SD_START_BIT_ERR; - return(errorstatus); - } - count = SD_DATATIMEOUT; - while ((SDIO_GetFlagStatus(SDIO_FLAG_RXDAVL) != RESET) && (count > 0)) - { - *tempbuff = SDIO_ReadData(); - tempbuff++; - count--; - } - - /*!< Clear all the static flags */ - SDIO_ClearFlag(SDIO_STATIC_FLAGS); - -#elif defined (SD_DMA_MODE) - SDIO_ITConfig(SDIO_IT_DCRCFAIL | SDIO_IT_DTIMEOUT | SDIO_IT_DATAEND | SDIO_IT_RXOVERR | SDIO_IT_STBITERR, ENABLE); - SDIO_DMACmd(ENABLE); - SD_LowLevel_DMA_RxConfig((uint32_t *)readbuff, BlockSize); -#endif - - return(errorstatus); -} - -/** - * @brief Allows to read blocks from a specified address in a card. The Data - * transfer can be managed by DMA mode or Polling mode. - * @note This operation should be followed by two functions to check if the - * DMA Controller and SD Card status. - * - SD_ReadWaitOperation(): this function insure that the DMA - * controller has finished all data transfer. - * - SD_GetStatus(): to check that the SD Card has finished the - * data transfer and it is ready for data. - * @param readbuff: pointer to the buffer that will contain the received data. - * @param ReadAddr: Address from where data are to be read. - * @param BlockSize: the SD card Data block size. The Block size should be 512. - * @param NumberOfBlocks: number of blocks to be read. - * @retval SD_Error: SD Card Error code. - */ -SD_Error SD_ReadMultiBlocks(uint8_t *readbuff, uint32_t ReadAddr, uint16_t BlockSize, uint32_t NumberOfBlocks) -{ - SD_Error errorstatus = SD_OK; - TransferError = SD_OK; - TransferEnd = 0; - StopCondition = 1; - - SDIO->DCTRL = 0x0; - - if (CardType == SDIO_HIGH_CAPACITY_SD_CARD) - { - BlockSize = 512; - ReadAddr /= 512; - } - - /*!< Set Block Size for Card */ - SDIO_CmdInitStructure.SDIO_Argument = (uint32_t) BlockSize; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_SET_BLOCKLEN; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_SET_BLOCKLEN); - - if (SD_OK != errorstatus) - { - return(errorstatus); - } - - SDIO_DataInitStructure.SDIO_DataTimeOut = SD_DATATIMEOUT; - SDIO_DataInitStructure.SDIO_DataLength = NumberOfBlocks * BlockSize; - SDIO_DataInitStructure.SDIO_DataBlockSize = (uint32_t) 9 << 4; - SDIO_DataInitStructure.SDIO_TransferDir = SDIO_TransferDir_ToSDIO; - SDIO_DataInitStructure.SDIO_TransferMode = SDIO_TransferMode_Block; - SDIO_DataInitStructure.SDIO_DPSM = SDIO_DPSM_Enable; - SDIO_DataConfig(&SDIO_DataInitStructure); - - /*!< Send CMD18 READ_MULT_BLOCK with argument data address */ - SDIO_CmdInitStructure.SDIO_Argument = (uint32_t)ReadAddr; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_READ_MULT_BLOCK; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_READ_MULT_BLOCK); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - - SDIO_ITConfig(SDIO_IT_DCRCFAIL | SDIO_IT_DTIMEOUT | SDIO_IT_DATAEND | SDIO_IT_RXOVERR | SDIO_IT_STBITERR, ENABLE); - SDIO_DMACmd(ENABLE); - SD_LowLevel_DMA_RxConfig((uint32_t *)readbuff, (NumberOfBlocks * BlockSize)); - - return(errorstatus); -} - -/** - * @brief This function waits until the SDIO DMA data transfer is finished. - * This function should be called after SDIO_ReadMultiBlocks() function - * to insure that all data sent by the card are already transferred by - * the DMA controller. - * @param None. - * @retval SD_Error: SD Card Error code. - */ -SD_Error SD_WaitReadOperation(void) -{ - SD_Error errorstatus = SD_OK; - uint32_t timeout; - - timeout = SD_DATATIMEOUT; - - while ((DMAEndOfTransfer == 0x00) && (TransferEnd == 0) && (TransferError == SD_OK) && (timeout > 0)) - { - timeout--; - } - - DMAEndOfTransfer = 0x00; - - timeout = SD_DATATIMEOUT; - - while(((SDIO->STA & SDIO_FLAG_RXACT)) && (timeout > 0)) - { - timeout--; - } - - if (StopCondition == 1) - { - errorstatus = SD_StopTransfer(); - StopCondition = 0; - } - - if ((timeout == 0) && (errorstatus == SD_OK)) - { - errorstatus = SD_DATA_TIMEOUT; - } - - /*!< Clear all the static flags */ - SDIO_ClearFlag(SDIO_STATIC_FLAGS); - - if (TransferError != SD_OK) - { - return(TransferError); - } - else - { - return(errorstatus); - } -} - -/** - * @brief Allows to write one block starting from a specified address in a card. - * The Data transfer can be managed by DMA mode or Polling mode. - * @note This operation should be followed by two functions to check if the - * DMA Controller and SD Card status. - * - SD_ReadWaitOperation(): this function insure that the DMA - * controller has finished all data transfer. - * - SD_GetStatus(): to check that the SD Card has finished the - * data transfer and it is ready for data. - * @param writebuff: pointer to the buffer that contain the data to be transferred. - * @param WriteAddr: Address from where data are to be read. - * @param BlockSize: the SD card Data block size. The Block size should be 512. - * @retval SD_Error: SD Card Error code. - */ -SD_Error SD_WriteBlock(uint8_t *writebuff, uint32_t WriteAddr, uint16_t BlockSize) -{ - SD_Error errorstatus = SD_OK; - -#if defined (SD_POLLING_MODE) - uint32_t bytestransferred = 0, count = 0, restwords = 0; - uint32_t *tempbuff = (uint32_t *)writebuff; -#endif - - TransferError = SD_OK; - TransferEnd = 0; - StopCondition = 0; - - SDIO->DCTRL = 0x0; - - - if (CardType == SDIO_HIGH_CAPACITY_SD_CARD) - { - BlockSize = 512; - WriteAddr /= 512; - } - - /* Set Block Size for Card */ - SDIO_CmdInitStructure.SDIO_Argument = (uint32_t) BlockSize; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_SET_BLOCKLEN; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_SET_BLOCKLEN); - - if (SD_OK != errorstatus) - { - return(errorstatus); - } - - /*!< Send CMD24 WRITE_SINGLE_BLOCK */ - SDIO_CmdInitStructure.SDIO_Argument = WriteAddr; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_WRITE_SINGLE_BLOCK; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_WRITE_SINGLE_BLOCK); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - - SDIO_DataInitStructure.SDIO_DataTimeOut = SD_DATATIMEOUT; - SDIO_DataInitStructure.SDIO_DataLength = BlockSize; - SDIO_DataInitStructure.SDIO_DataBlockSize = (uint32_t) 9 << 4; - SDIO_DataInitStructure.SDIO_TransferDir = SDIO_TransferDir_ToCard; - SDIO_DataInitStructure.SDIO_TransferMode = SDIO_TransferMode_Block; - SDIO_DataInitStructure.SDIO_DPSM = SDIO_DPSM_Enable; - SDIO_DataConfig(&SDIO_DataInitStructure); - - /*!< In case of single data block transfer no need of stop command at all */ -#if defined (SD_POLLING_MODE) - while (!(SDIO->STA & (SDIO_FLAG_DBCKEND | SDIO_FLAG_TXUNDERR | SDIO_FLAG_DCRCFAIL | SDIO_FLAG_DTIMEOUT | SDIO_FLAG_STBITERR))) - { - if (SDIO_GetFlagStatus(SDIO_FLAG_TXFIFOHE) != RESET) - { - if ((512 - bytestransferred) < 32) - { - restwords = ((512 - bytestransferred) % 4 == 0) ? ((512 - bytestransferred) / 4) : (( 512 - bytestransferred) / 4 + 1); - for (count = 0; count < restwords; count++, tempbuff++, bytestransferred += 4) - { - SDIO_WriteData(*tempbuff); - } - } - else - { - for (count = 0; count < 8; count++) - { - SDIO_WriteData(*(tempbuff + count)); - } - tempbuff += 8; - bytestransferred += 32; - } - } - } - if (SDIO_GetFlagStatus(SDIO_FLAG_DTIMEOUT) != RESET) - { - SDIO_ClearFlag(SDIO_FLAG_DTIMEOUT); - errorstatus = SD_DATA_TIMEOUT; - return(errorstatus); - } - else if (SDIO_GetFlagStatus(SDIO_FLAG_DCRCFAIL) != RESET) - { - SDIO_ClearFlag(SDIO_FLAG_DCRCFAIL); - errorstatus = SD_DATA_CRC_FAIL; - return(errorstatus); - } - else if (SDIO_GetFlagStatus(SDIO_FLAG_TXUNDERR) != RESET) - { - SDIO_ClearFlag(SDIO_FLAG_TXUNDERR); - errorstatus = SD_TX_UNDERRUN; - return(errorstatus); - } - else if (SDIO_GetFlagStatus(SDIO_FLAG_STBITERR) != RESET) - { - SDIO_ClearFlag(SDIO_FLAG_STBITERR); - errorstatus = SD_START_BIT_ERR; - return(errorstatus); - } -#elif defined (SD_DMA_MODE) - SDIO_ITConfig(SDIO_IT_DCRCFAIL | SDIO_IT_DTIMEOUT | SDIO_IT_DATAEND | SDIO_IT_RXOVERR | SDIO_IT_STBITERR, ENABLE); - SD_LowLevel_DMA_TxConfig((uint32_t *)writebuff, BlockSize); - SDIO_DMACmd(ENABLE); -#endif - - return(errorstatus); -} - -/** - * @brief Allows to write blocks starting from a specified address in a card. - * The Data transfer can be managed by DMA mode only. - * @note This operation should be followed by two functions to check if the - * DMA Controller and SD Card status. - * - SD_ReadWaitOperation(): this function insure that the DMA - * controller has finished all data transfer. - * - SD_GetStatus(): to check that the SD Card has finished the - * data transfer and it is ready for data. - * @param WriteAddr: Address from where data are to be read. - * @param writebuff: pointer to the buffer that contain the data to be transferred. - * @param BlockSize: the SD card Data block size. The Block size should be 512. - * @param NumberOfBlocks: number of blocks to be written. - * @retval SD_Error: SD Card Error code. - */ -SD_Error SD_WriteMultiBlocks(uint8_t *writebuff, uint32_t WriteAddr, uint16_t BlockSize, uint32_t NumberOfBlocks) -{ - SD_Error errorstatus = SD_OK; - - TransferError = SD_OK; - TransferEnd = 0; - StopCondition = 1; - - SDIO->DCTRL = 0x0; - - if (CardType == SDIO_HIGH_CAPACITY_SD_CARD) - { - BlockSize = 512; - WriteAddr /= 512; - } - - /* Set Block Size for Card */ - SDIO_CmdInitStructure.SDIO_Argument = (uint32_t) BlockSize; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_SET_BLOCKLEN; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_SET_BLOCKLEN); - - if (SD_OK != errorstatus) - { - return(errorstatus); - } - - /*!< To improve performance */ - SDIO_CmdInitStructure.SDIO_Argument = (uint32_t) (RCA << 16); - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_APP_CMD; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - - errorstatus = CmdResp1Error(SD_CMD_APP_CMD); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - /*!< To improve performance */ - SDIO_CmdInitStructure.SDIO_Argument = (uint32_t)NumberOfBlocks; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_SET_BLOCK_COUNT; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_SET_BLOCK_COUNT); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - - - /*!< Send CMD25 WRITE_MULT_BLOCK with argument data address */ - SDIO_CmdInitStructure.SDIO_Argument = (uint32_t)WriteAddr; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_WRITE_MULT_BLOCK; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_WRITE_MULT_BLOCK); - - if (SD_OK != errorstatus) - { - return(errorstatus); - } - - SDIO_DataInitStructure.SDIO_DataTimeOut = SD_DATATIMEOUT; - SDIO_DataInitStructure.SDIO_DataLength = NumberOfBlocks * BlockSize; - SDIO_DataInitStructure.SDIO_DataBlockSize = (uint32_t) 9 << 4; - SDIO_DataInitStructure.SDIO_TransferDir = SDIO_TransferDir_ToCard; - SDIO_DataInitStructure.SDIO_TransferMode = SDIO_TransferMode_Block; - SDIO_DataInitStructure.SDIO_DPSM = SDIO_DPSM_Enable; - SDIO_DataConfig(&SDIO_DataInitStructure); - - SDIO_ITConfig(SDIO_IT_DCRCFAIL | SDIO_IT_DTIMEOUT | SDIO_IT_DATAEND | SDIO_IT_RXOVERR | SDIO_IT_STBITERR, ENABLE); - SDIO_DMACmd(ENABLE); - SD_LowLevel_DMA_TxConfig((uint32_t *)writebuff, (NumberOfBlocks * BlockSize)); - - return(errorstatus); -} - -/** - * @brief This function waits until the SDIO DMA data transfer is finished. - * This function should be called after SDIO_WriteBlock() and - * SDIO_WriteMultiBlocks() function to insure that all data sent by the - * card are already transferred by the DMA controller. - * @param None. - * @retval SD_Error: SD Card Error code. - */ -SD_Error SD_WaitWriteOperation(void) -{ - SD_Error errorstatus = SD_OK; - uint32_t timeout; - - timeout = SD_DATATIMEOUT; - - while ((DMAEndOfTransfer == 0x00) && (TransferEnd == 0) && (TransferError == SD_OK) && (timeout > 0)) - { - timeout--; - } - - DMAEndOfTransfer = 0x00; - - timeout = SD_DATATIMEOUT; - - while(((SDIO->STA & SDIO_FLAG_TXACT)) && (timeout > 0)) - { - timeout--; - } - - if (StopCondition == 1) - { - errorstatus = SD_StopTransfer(); - StopCondition = 0; - } - - if ((timeout == 0) && (errorstatus == SD_OK)) - { - errorstatus = SD_DATA_TIMEOUT; - } - - /*!< Clear all the static flags */ - SDIO_ClearFlag(SDIO_STATIC_FLAGS); - - if (TransferError != SD_OK) - { - return(TransferError); - } - else - { - return(errorstatus); - } -} - -/** - * @brief Gets the cuurent data transfer state. - * @param None - * @retval SDTransferState: Data Transfer state. - * This value can be: - * - SD_TRANSFER_OK: No data transfer is acting - * - SD_TRANSFER_BUSY: Data transfer is acting - */ -SDTransferState SD_GetTransferState(void) -{ - if (SDIO->STA & (SDIO_FLAG_TXACT | SDIO_FLAG_RXACT)) - { - return(SD_TRANSFER_BUSY); - } - else - { - return(SD_TRANSFER_OK); - } -} - -/** - * @brief Aborts an ongoing data transfer. - * @param None - * @retval SD_Error: SD Card Error code. - */ -SD_Error SD_StopTransfer(void) -{ - SD_Error errorstatus = SD_OK; - - /*!< Send CMD12 STOP_TRANSMISSION */ - SDIO_CmdInitStructure.SDIO_Argument = 0x0; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_STOP_TRANSMISSION; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_STOP_TRANSMISSION); - - return(errorstatus); -} - -/** - * @brief Allows to erase memory area specified for the given card. - * @param startaddr: the start address. - * @param endaddr: the end address. - * @retval SD_Error: SD Card Error code. - */ -SD_Error SD_Erase(uint32_t startaddr, uint32_t endaddr) -{ - SD_Error errorstatus = SD_OK; - uint32_t delay = 0; - __IO uint32_t maxdelay = 0; - uint8_t cardstate = 0; - - /*!< Check if the card coomnd class supports erase command */ - if (((CSD_Tab[1] >> 20) & SD_CCCC_ERASE) == 0) - { - errorstatus = SD_REQUEST_NOT_APPLICABLE; - return(errorstatus); - } - - maxdelay = 120000 / ((SDIO->CLKCR & 0xFF) + 2); - - if (SDIO_GetResponse(SDIO_RESP1) & SD_CARD_LOCKED) - { - errorstatus = SD_LOCK_UNLOCK_FAILED; - return(errorstatus); - } - - if (CardType == SDIO_HIGH_CAPACITY_SD_CARD) - { - startaddr /= 512; - endaddr /= 512; - } - - /*!< According to sd-card spec 1.0 ERASE_GROUP_START (CMD32) and erase_group_end(CMD33) */ - if ((SDIO_STD_CAPACITY_SD_CARD_V1_1 == CardType) || (SDIO_STD_CAPACITY_SD_CARD_V2_0 == CardType) || (SDIO_HIGH_CAPACITY_SD_CARD == CardType)) - { - /*!< Send CMD32 SD_ERASE_GRP_START with argument as addr */ - SDIO_CmdInitStructure.SDIO_Argument = startaddr; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_SD_ERASE_GRP_START; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_SD_ERASE_GRP_START); - if (errorstatus != SD_OK) - { - return(errorstatus); - } - - /*!< Send CMD33 SD_ERASE_GRP_END with argument as addr */ - SDIO_CmdInitStructure.SDIO_Argument = endaddr; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_SD_ERASE_GRP_END; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_SD_ERASE_GRP_END); - if (errorstatus != SD_OK) - { - return(errorstatus); - } - } - - /*!< Send CMD38 ERASE */ - SDIO_CmdInitStructure.SDIO_Argument = 0; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_ERASE; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_ERASE); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - - for (delay = 0; delay < maxdelay; delay++) - {} - - /*!< Wait till the card is in programming state */ - errorstatus = IsCardProgramming(&cardstate); - delay = SD_DATATIMEOUT; - while ((delay > 0) && (errorstatus == SD_OK) && ((SD_CARD_PROGRAMMING == cardstate) || (SD_CARD_RECEIVING == cardstate))) - { - errorstatus = IsCardProgramming(&cardstate); - delay--; - } - - return(errorstatus); -} - -/** - * @brief Returns the current card's status. - * @param pcardstatus: pointer to the buffer that will contain the SD card - * status (Card Status register). - * @retval SD_Error: SD Card Error code. - */ -SD_Error SD_SendStatus(uint32_t *pcardstatus) -{ - SD_Error errorstatus = SD_OK; - - if (pcardstatus == NULL) - { - errorstatus = SD_INVALID_PARAMETER; - return(errorstatus); - } - - SDIO_CmdInitStructure.SDIO_Argument = (uint32_t) RCA << 16; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_SEND_STATUS; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_SEND_STATUS); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - - *pcardstatus = SDIO_GetResponse(SDIO_RESP1); - - return(errorstatus); -} - -/** - * @brief Returns the current SD card's status. - * @param psdstatus: pointer to the buffer that will contain the SD card status - * (SD Status register). - * @retval SD_Error: SD Card Error code. - */ -SD_Error SD_SendSDStatus(uint32_t *psdstatus) -{ - SD_Error errorstatus = SD_OK; - uint32_t count = 0; - - if (SDIO_GetResponse(SDIO_RESP1) & SD_CARD_LOCKED) - { - errorstatus = SD_LOCK_UNLOCK_FAILED; - return(errorstatus); - } - - /*!< Set block size for card if it is not equal to current block size for card. */ - SDIO_CmdInitStructure.SDIO_Argument = 64; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_SET_BLOCKLEN; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_SET_BLOCKLEN); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - - /*!< CMD55 */ - SDIO_CmdInitStructure.SDIO_Argument = (uint32_t) RCA << 16; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_APP_CMD; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - errorstatus = CmdResp1Error(SD_CMD_APP_CMD); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - - SDIO_DataInitStructure.SDIO_DataTimeOut = SD_DATATIMEOUT; - SDIO_DataInitStructure.SDIO_DataLength = 64; - SDIO_DataInitStructure.SDIO_DataBlockSize = SDIO_DataBlockSize_64b; - SDIO_DataInitStructure.SDIO_TransferDir = SDIO_TransferDir_ToSDIO; - SDIO_DataInitStructure.SDIO_TransferMode = SDIO_TransferMode_Block; - SDIO_DataInitStructure.SDIO_DPSM = SDIO_DPSM_Enable; - SDIO_DataConfig(&SDIO_DataInitStructure); - - /*!< Send ACMD13 SD_APP_STAUS with argument as card's RCA.*/ - SDIO_CmdInitStructure.SDIO_Argument = 0; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_SD_APP_STAUS; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - errorstatus = CmdResp1Error(SD_CMD_SD_APP_STAUS); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - - while (!(SDIO->STA &(SDIO_FLAG_RXOVERR | SDIO_FLAG_DCRCFAIL | SDIO_FLAG_DTIMEOUT | SDIO_FLAG_DBCKEND | SDIO_FLAG_STBITERR))) - { - if (SDIO_GetFlagStatus(SDIO_FLAG_RXFIFOHF) != RESET) - { - for (count = 0; count < 8; count++) - { - *(psdstatus + count) = SDIO_ReadData(); - } - psdstatus += 8; - } - } - - if (SDIO_GetFlagStatus(SDIO_FLAG_DTIMEOUT) != RESET) - { - SDIO_ClearFlag(SDIO_FLAG_DTIMEOUT); - errorstatus = SD_DATA_TIMEOUT; - return(errorstatus); - } - else if (SDIO_GetFlagStatus(SDIO_FLAG_DCRCFAIL) != RESET) - { - SDIO_ClearFlag(SDIO_FLAG_DCRCFAIL); - errorstatus = SD_DATA_CRC_FAIL; - return(errorstatus); - } - else if (SDIO_GetFlagStatus(SDIO_FLAG_RXOVERR) != RESET) - { - SDIO_ClearFlag(SDIO_FLAG_RXOVERR); - errorstatus = SD_RX_OVERRUN; - return(errorstatus); - } - else if (SDIO_GetFlagStatus(SDIO_FLAG_STBITERR) != RESET) - { - SDIO_ClearFlag(SDIO_FLAG_STBITERR); - errorstatus = SD_START_BIT_ERR; - return(errorstatus); - } - - count = SD_DATATIMEOUT; - while ((SDIO_GetFlagStatus(SDIO_FLAG_RXDAVL) != RESET) && (count > 0)) - { - *psdstatus = SDIO_ReadData(); - psdstatus++; - count--; - } - /*!< Clear all the static status flags*/ - SDIO_ClearFlag(SDIO_STATIC_FLAGS); - - return(errorstatus); -} - -/** - * @brief Allows to process all the interrupts that are high. - * @param None - * @retval SD_Error: SD Card Error code. - */ -SD_Error SD_ProcessIRQSrc(void) -{ - if (SDIO_GetITStatus(SDIO_IT_DATAEND) != RESET) - { - TransferError = SD_OK; - SDIO_ClearITPendingBit(SDIO_IT_DATAEND); - TransferEnd = 1; - } - else if (SDIO_GetITStatus(SDIO_IT_DCRCFAIL) != RESET) - { - SDIO_ClearITPendingBit(SDIO_IT_DCRCFAIL); - TransferError = SD_DATA_CRC_FAIL; - } - else if (SDIO_GetITStatus(SDIO_IT_DTIMEOUT) != RESET) - { - SDIO_ClearITPendingBit(SDIO_IT_DTIMEOUT); - TransferError = SD_DATA_TIMEOUT; - } - else if (SDIO_GetITStatus(SDIO_IT_RXOVERR) != RESET) - { - SDIO_ClearITPendingBit(SDIO_IT_RXOVERR); - TransferError = SD_RX_OVERRUN; - } - else if (SDIO_GetITStatus(SDIO_IT_TXUNDERR) != RESET) - { - SDIO_ClearITPendingBit(SDIO_IT_TXUNDERR); - TransferError = SD_TX_UNDERRUN; - } - else if (SDIO_GetITStatus(SDIO_IT_STBITERR) != RESET) - { - SDIO_ClearITPendingBit(SDIO_IT_STBITERR); - TransferError = SD_START_BIT_ERR; - } - - SDIO_ITConfig(SDIO_IT_DCRCFAIL | SDIO_IT_DTIMEOUT | SDIO_IT_DATAEND | - SDIO_IT_TXFIFOHE | SDIO_IT_RXFIFOHF | SDIO_IT_TXUNDERR | - SDIO_IT_RXOVERR | SDIO_IT_STBITERR, DISABLE); - return(TransferError); -} - -/** - * @brief This function waits until the SDIO DMA data transfer is finished. - * @param None. - * @retval None. - */ -void SD_ProcessDMAIRQ(void) -{ - if(DMA2->LISR & SD_SDIO_DMA_FLAG_TCIF) - { - DMAEndOfTransfer = 0x01; - DMA_ClearFlag(SD_SDIO_DMA_STREAM, SD_SDIO_DMA_FLAG_TCIF|SD_SDIO_DMA_FLAG_FEIF); - } -} - -/** - * @brief Checks for error conditions for CMD0. - * @param None - * @retval SD_Error: SD Card Error code. - */ -static SD_Error CmdError(void) -{ - SD_Error errorstatus = SD_OK; - uint32_t timeout; - - timeout = SDIO_CMD0TIMEOUT; /*!< 10000 */ - - while ((timeout > 0) && (SDIO_GetFlagStatus(SDIO_FLAG_CMDSENT) == RESET)) - { - timeout--; - } - - if (timeout == 0) - { - errorstatus = SD_CMD_RSP_TIMEOUT; - return(errorstatus); - } - - /*!< Clear all the static flags */ - SDIO_ClearFlag(SDIO_STATIC_FLAGS); - - return(errorstatus); -} - -/** - * @brief Checks for error conditions for R7 response. - * @param None - * @retval SD_Error: SD Card Error code. - */ -static SD_Error CmdResp7Error(void) -{ - SD_Error errorstatus = SD_OK; - uint32_t status; - uint32_t timeout = SDIO_CMD0TIMEOUT; - - status = SDIO->STA; - - while (!(status & (SDIO_FLAG_CCRCFAIL | SDIO_FLAG_CMDREND | SDIO_FLAG_CTIMEOUT)) && (timeout > 0)) - { - timeout--; - status = SDIO->STA; - } - - if ((timeout == 0) || (status & SDIO_FLAG_CTIMEOUT)) - { - /*!< Card is not V2.0 complient or card does not support the set voltage range */ - errorstatus = SD_CMD_RSP_TIMEOUT; - SDIO_ClearFlag(SDIO_FLAG_CTIMEOUT); - return(errorstatus); - } - - if (status & SDIO_FLAG_CMDREND) - { - /*!< Card is SD V2.0 compliant */ - errorstatus = SD_OK; - SDIO_ClearFlag(SDIO_FLAG_CMDREND); - return(errorstatus); - } - return(errorstatus); -} - -/** - * @brief Checks for error conditions for R1 response. - * @param cmd: The sent command index. - * @retval SD_Error: SD Card Error code. - */ -static SD_Error CmdResp1Error(uint8_t cmd) -{ - SD_Error errorstatus = SD_OK; - uint32_t status; - uint32_t response_r1; - - status = SDIO->STA; - - while (!(status & (SDIO_FLAG_CCRCFAIL | SDIO_FLAG_CMDREND | SDIO_FLAG_CTIMEOUT))) - { - status = SDIO->STA; - } - - if (status & SDIO_FLAG_CTIMEOUT) - { - errorstatus = SD_CMD_RSP_TIMEOUT; - SDIO_ClearFlag(SDIO_FLAG_CTIMEOUT); - return(errorstatus); - } - else if (status & SDIO_FLAG_CCRCFAIL) - { - errorstatus = SD_CMD_CRC_FAIL; - SDIO_ClearFlag(SDIO_FLAG_CCRCFAIL); - return(errorstatus); - } - - /*!< Check response received is of desired command */ - if (SDIO_GetCommandResponse() != cmd) - { - errorstatus = SD_ILLEGAL_CMD; - return(errorstatus); - } - - /*!< Clear all the static flags */ - SDIO_ClearFlag(SDIO_STATIC_FLAGS); - - /*!< We have received response, retrieve it for analysis */ - response_r1 = SDIO_GetResponse(SDIO_RESP1); - - if ((response_r1 & SD_OCR_ERRORBITS) == SD_ALLZERO) - { - return(errorstatus); - } - - if (response_r1 & SD_OCR_ADDR_OUT_OF_RANGE) - { - return(SD_ADDR_OUT_OF_RANGE); - } - - if (response_r1 & SD_OCR_ADDR_MISALIGNED) - { - return(SD_ADDR_MISALIGNED); - } - - if (response_r1 & SD_OCR_BLOCK_LEN_ERR) - { - return(SD_BLOCK_LEN_ERR); - } - - if (response_r1 & SD_OCR_ERASE_SEQ_ERR) - { - return(SD_ERASE_SEQ_ERR); - } - - if (response_r1 & SD_OCR_BAD_ERASE_PARAM) - { - return(SD_BAD_ERASE_PARAM); - } - - if (response_r1 & SD_OCR_WRITE_PROT_VIOLATION) - { - return(SD_WRITE_PROT_VIOLATION); - } - - if (response_r1 & SD_OCR_LOCK_UNLOCK_FAILED) - { - return(SD_LOCK_UNLOCK_FAILED); - } - - if (response_r1 & SD_OCR_COM_CRC_FAILED) - { - return(SD_COM_CRC_FAILED); - } - - if (response_r1 & SD_OCR_ILLEGAL_CMD) - { - return(SD_ILLEGAL_CMD); - } - - if (response_r1 & SD_OCR_CARD_ECC_FAILED) - { - return(SD_CARD_ECC_FAILED); - } - - if (response_r1 & SD_OCR_CC_ERROR) - { - return(SD_CC_ERROR); - } - - if (response_r1 & SD_OCR_GENERAL_UNKNOWN_ERROR) - { - return(SD_GENERAL_UNKNOWN_ERROR); - } - - if (response_r1 & SD_OCR_STREAM_READ_UNDERRUN) - { - return(SD_STREAM_READ_UNDERRUN); - } - - if (response_r1 & SD_OCR_STREAM_WRITE_OVERRUN) - { - return(SD_STREAM_WRITE_OVERRUN); - } - - if (response_r1 & SD_OCR_CID_CSD_OVERWRIETE) - { - return(SD_CID_CSD_OVERWRITE); - } - - if (response_r1 & SD_OCR_WP_ERASE_SKIP) - { - return(SD_WP_ERASE_SKIP); - } - - if (response_r1 & SD_OCR_CARD_ECC_DISABLED) - { - return(SD_CARD_ECC_DISABLED); - } - - if (response_r1 & SD_OCR_ERASE_RESET) - { - return(SD_ERASE_RESET); - } - - if (response_r1 & SD_OCR_AKE_SEQ_ERROR) - { - return(SD_AKE_SEQ_ERROR); - } - return(errorstatus); -} - -/** - * @brief Checks for error conditions for R3 (OCR) response. - * @param None - * @retval SD_Error: SD Card Error code. - */ -static SD_Error CmdResp3Error(void) -{ - SD_Error errorstatus = SD_OK; - uint32_t status; - - status = SDIO->STA; - - while (!(status & (SDIO_FLAG_CCRCFAIL | SDIO_FLAG_CMDREND | SDIO_FLAG_CTIMEOUT))) - { - status = SDIO->STA; - } - - if (status & SDIO_FLAG_CTIMEOUT) - { - errorstatus = SD_CMD_RSP_TIMEOUT; - SDIO_ClearFlag(SDIO_FLAG_CTIMEOUT); - return(errorstatus); - } - /*!< Clear all the static flags */ - SDIO_ClearFlag(SDIO_STATIC_FLAGS); - return(errorstatus); -} - -/** - * @brief Checks for error conditions for R2 (CID or CSD) response. - * @param None - * @retval SD_Error: SD Card Error code. - */ -static SD_Error CmdResp2Error(void) -{ - SD_Error errorstatus = SD_OK; - uint32_t status; - - status = SDIO->STA; - - while (!(status & (SDIO_FLAG_CCRCFAIL | SDIO_FLAG_CTIMEOUT | SDIO_FLAG_CMDREND))) - { - status = SDIO->STA; - } - - if (status & SDIO_FLAG_CTIMEOUT) - { - errorstatus = SD_CMD_RSP_TIMEOUT; - SDIO_ClearFlag(SDIO_FLAG_CTIMEOUT); - return(errorstatus); - } - else if (status & SDIO_FLAG_CCRCFAIL) - { - errorstatus = SD_CMD_CRC_FAIL; - SDIO_ClearFlag(SDIO_FLAG_CCRCFAIL); - return(errorstatus); - } - - /*!< Clear all the static flags */ - SDIO_ClearFlag(SDIO_STATIC_FLAGS); - - return(errorstatus); -} - -/** - * @brief Checks for error conditions for R6 (RCA) response. - * @param cmd: The sent command index. - * @param prca: pointer to the variable that will contain the SD card relative - * address RCA. - * @retval SD_Error: SD Card Error code. - */ -static SD_Error CmdResp6Error(uint8_t cmd, uint16_t *prca) -{ - SD_Error errorstatus = SD_OK; - uint32_t status; - uint32_t response_r1; - - status = SDIO->STA; - - while (!(status & (SDIO_FLAG_CCRCFAIL | SDIO_FLAG_CTIMEOUT | SDIO_FLAG_CMDREND))) - { - status = SDIO->STA; - } - - if (status & SDIO_FLAG_CTIMEOUT) - { - errorstatus = SD_CMD_RSP_TIMEOUT; - SDIO_ClearFlag(SDIO_FLAG_CTIMEOUT); - return(errorstatus); - } - else if (status & SDIO_FLAG_CCRCFAIL) - { - errorstatus = SD_CMD_CRC_FAIL; - SDIO_ClearFlag(SDIO_FLAG_CCRCFAIL); - return(errorstatus); - } - - /*!< Check response received is of desired command */ - if (SDIO_GetCommandResponse() != cmd) - { - errorstatus = SD_ILLEGAL_CMD; - return(errorstatus); - } - - /*!< Clear all the static flags */ - SDIO_ClearFlag(SDIO_STATIC_FLAGS); - - /*!< We have received response, retrieve it. */ - response_r1 = SDIO_GetResponse(SDIO_RESP1); - - if (SD_ALLZERO == (response_r1 & (SD_R6_GENERAL_UNKNOWN_ERROR | SD_R6_ILLEGAL_CMD | SD_R6_COM_CRC_FAILED))) - { - *prca = (uint16_t) (response_r1 >> 16); - return(errorstatus); - } - - if (response_r1 & SD_R6_GENERAL_UNKNOWN_ERROR) - { - return(SD_GENERAL_UNKNOWN_ERROR); - } - - if (response_r1 & SD_R6_ILLEGAL_CMD) - { - return(SD_ILLEGAL_CMD); - } - - if (response_r1 & SD_R6_COM_CRC_FAILED) - { - return(SD_COM_CRC_FAILED); - } - - return(errorstatus); -} - -/** - * @brief Enables or disables the SDIO wide bus mode. - * @param NewState: new state of the SDIO wide bus mode. - * This parameter can be: ENABLE or DISABLE. - * @retval SD_Error: SD Card Error code. - */ -static SD_Error SDEnWideBus(FunctionalState NewState) -{ - SD_Error errorstatus = SD_OK; - - uint32_t scr[2] = {0, 0}; - - if (SDIO_GetResponse(SDIO_RESP1) & SD_CARD_LOCKED) - { - errorstatus = SD_LOCK_UNLOCK_FAILED; - return(errorstatus); - } - - /*!< Get SCR Register */ - errorstatus = FindSCR(RCA, scr); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - - /*!< If wide bus operation to be enabled */ - if (NewState == ENABLE) - { - /*!< If requested card supports wide bus operation */ - if ((scr[1] & SD_WIDE_BUS_SUPPORT) != SD_ALLZERO) - { - /*!< Send CMD55 APP_CMD with argument as card's RCA.*/ - SDIO_CmdInitStructure.SDIO_Argument = (uint32_t) RCA << 16; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_APP_CMD; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_APP_CMD); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - - /*!< Send ACMD6 APP_CMD with argument as 2 for wide bus mode */ - SDIO_CmdInitStructure.SDIO_Argument = 0x2; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_APP_SD_SET_BUSWIDTH; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_APP_SD_SET_BUSWIDTH); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - return(errorstatus); - } - else - { - errorstatus = SD_REQUEST_NOT_APPLICABLE; - return(errorstatus); - } - } /*!< If wide bus operation to be disabled */ - else - { - /*!< If requested card supports 1 bit mode operation */ - if ((scr[1] & SD_SINGLE_BUS_SUPPORT) != SD_ALLZERO) - { - /*!< Send CMD55 APP_CMD with argument as card's RCA.*/ - SDIO_CmdInitStructure.SDIO_Argument = (uint32_t) RCA << 16; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_APP_CMD; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - - errorstatus = CmdResp1Error(SD_CMD_APP_CMD); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - - /*!< Send ACMD6 APP_CMD with argument as 2 for wide bus mode */ - SDIO_CmdInitStructure.SDIO_Argument = 0x00; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_APP_SD_SET_BUSWIDTH; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_APP_SD_SET_BUSWIDTH); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - - return(errorstatus); - } - else - { - errorstatus = SD_REQUEST_NOT_APPLICABLE; - return(errorstatus); - } - } -} - -/** - * @brief Checks if the SD card is in programming state. - * @param pstatus: pointer to the variable that will contain the SD card state. - * @retval SD_Error: SD Card Error code. - */ -static SD_Error IsCardProgramming(uint8_t *pstatus) -{ - SD_Error errorstatus = SD_OK; - __IO uint32_t respR1 = 0, status = 0; - - SDIO_CmdInitStructure.SDIO_Argument = (uint32_t) RCA << 16; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_SEND_STATUS; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - status = SDIO->STA; - while (!(status & (SDIO_FLAG_CCRCFAIL | SDIO_FLAG_CMDREND | SDIO_FLAG_CTIMEOUT))) - { - status = SDIO->STA; - } - - if (status & SDIO_FLAG_CTIMEOUT) - { - errorstatus = SD_CMD_RSP_TIMEOUT; - SDIO_ClearFlag(SDIO_FLAG_CTIMEOUT); - return(errorstatus); - } - else if (status & SDIO_FLAG_CCRCFAIL) - { - errorstatus = SD_CMD_CRC_FAIL; - SDIO_ClearFlag(SDIO_FLAG_CCRCFAIL); - return(errorstatus); - } - - status = (uint32_t)SDIO_GetCommandResponse(); - - /*!< Check response received is of desired command */ - if (status != SD_CMD_SEND_STATUS) - { - errorstatus = SD_ILLEGAL_CMD; - return(errorstatus); - } - - /*!< Clear all the static flags */ - SDIO_ClearFlag(SDIO_STATIC_FLAGS); - - - /*!< We have received response, retrieve it for analysis */ - respR1 = SDIO_GetResponse(SDIO_RESP1); - - /*!< Find out card status */ - *pstatus = (uint8_t) ((respR1 >> 9) & 0x0000000F); - - if ((respR1 & SD_OCR_ERRORBITS) == SD_ALLZERO) - { - return(errorstatus); - } - - if (respR1 & SD_OCR_ADDR_OUT_OF_RANGE) - { - return(SD_ADDR_OUT_OF_RANGE); - } - - if (respR1 & SD_OCR_ADDR_MISALIGNED) - { - return(SD_ADDR_MISALIGNED); - } - - if (respR1 & SD_OCR_BLOCK_LEN_ERR) - { - return(SD_BLOCK_LEN_ERR); - } - - if (respR1 & SD_OCR_ERASE_SEQ_ERR) - { - return(SD_ERASE_SEQ_ERR); - } - - if (respR1 & SD_OCR_BAD_ERASE_PARAM) - { - return(SD_BAD_ERASE_PARAM); - } - - if (respR1 & SD_OCR_WRITE_PROT_VIOLATION) - { - return(SD_WRITE_PROT_VIOLATION); - } - - if (respR1 & SD_OCR_LOCK_UNLOCK_FAILED) - { - return(SD_LOCK_UNLOCK_FAILED); - } - - if (respR1 & SD_OCR_COM_CRC_FAILED) - { - return(SD_COM_CRC_FAILED); - } - - if (respR1 & SD_OCR_ILLEGAL_CMD) - { - return(SD_ILLEGAL_CMD); - } - - if (respR1 & SD_OCR_CARD_ECC_FAILED) - { - return(SD_CARD_ECC_FAILED); - } - - if (respR1 & SD_OCR_CC_ERROR) - { - return(SD_CC_ERROR); - } - - if (respR1 & SD_OCR_GENERAL_UNKNOWN_ERROR) - { - return(SD_GENERAL_UNKNOWN_ERROR); - } - - if (respR1 & SD_OCR_STREAM_READ_UNDERRUN) - { - return(SD_STREAM_READ_UNDERRUN); - } - - if (respR1 & SD_OCR_STREAM_WRITE_OVERRUN) - { - return(SD_STREAM_WRITE_OVERRUN); - } - - if (respR1 & SD_OCR_CID_CSD_OVERWRIETE) - { - return(SD_CID_CSD_OVERWRITE); - } - - if (respR1 & SD_OCR_WP_ERASE_SKIP) - { - return(SD_WP_ERASE_SKIP); - } - - if (respR1 & SD_OCR_CARD_ECC_DISABLED) - { - return(SD_CARD_ECC_DISABLED); - } - - if (respR1 & SD_OCR_ERASE_RESET) - { - return(SD_ERASE_RESET); - } - - if (respR1 & SD_OCR_AKE_SEQ_ERROR) - { - return(SD_AKE_SEQ_ERROR); - } - - return(errorstatus); -} - -/** - * @brief Find the SD card SCR register value. - * @param rca: selected card address. - * @param pscr: pointer to the buffer that will contain the SCR value. - * @retval SD_Error: SD Card Error code. - */ -static SD_Error FindSCR(uint16_t rca, uint32_t *pscr) -{ - uint32_t index = 0; - SD_Error errorstatus = SD_OK; - uint32_t tempscr[2] = {0, 0}; - - /*!< Set Block Size To 8 Bytes */ - /*!< Send CMD55 APP_CMD with argument as card's RCA */ - SDIO_CmdInitStructure.SDIO_Argument = (uint32_t)8; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_SET_BLOCKLEN; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_SET_BLOCKLEN); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - - /*!< Send CMD55 APP_CMD with argument as card's RCA */ - SDIO_CmdInitStructure.SDIO_Argument = (uint32_t) RCA << 16; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_APP_CMD; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_APP_CMD); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - SDIO_DataInitStructure.SDIO_DataTimeOut = SD_DATATIMEOUT; - SDIO_DataInitStructure.SDIO_DataLength = 8; - SDIO_DataInitStructure.SDIO_DataBlockSize = SDIO_DataBlockSize_8b; - SDIO_DataInitStructure.SDIO_TransferDir = SDIO_TransferDir_ToSDIO; - SDIO_DataInitStructure.SDIO_TransferMode = SDIO_TransferMode_Block; - SDIO_DataInitStructure.SDIO_DPSM = SDIO_DPSM_Enable; - SDIO_DataConfig(&SDIO_DataInitStructure); - - - /*!< Send ACMD51 SD_APP_SEND_SCR with argument as 0 */ - SDIO_CmdInitStructure.SDIO_Argument = 0x0; - SDIO_CmdInitStructure.SDIO_CmdIndex = SD_CMD_SD_APP_SEND_SCR; - SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; - SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; - SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable; - SDIO_SendCommand(&SDIO_CmdInitStructure); - - errorstatus = CmdResp1Error(SD_CMD_SD_APP_SEND_SCR); - - if (errorstatus != SD_OK) - { - return(errorstatus); - } - - while (!(SDIO->STA & (SDIO_FLAG_RXOVERR | SDIO_FLAG_DCRCFAIL | SDIO_FLAG_DTIMEOUT | SDIO_FLAG_DBCKEND | SDIO_FLAG_STBITERR))) - { - if (SDIO_GetFlagStatus(SDIO_FLAG_RXDAVL) != RESET) - { - *(tempscr + index) = SDIO_ReadData(); - index++; - } - } - - if (SDIO_GetFlagStatus(SDIO_FLAG_DTIMEOUT) != RESET) - { - SDIO_ClearFlag(SDIO_FLAG_DTIMEOUT); - errorstatus = SD_DATA_TIMEOUT; - return(errorstatus); - } - else if (SDIO_GetFlagStatus(SDIO_FLAG_DCRCFAIL) != RESET) - { - SDIO_ClearFlag(SDIO_FLAG_DCRCFAIL); - errorstatus = SD_DATA_CRC_FAIL; - return(errorstatus); - } - else if (SDIO_GetFlagStatus(SDIO_FLAG_RXOVERR) != RESET) - { - SDIO_ClearFlag(SDIO_FLAG_RXOVERR); - errorstatus = SD_RX_OVERRUN; - return(errorstatus); - } - else if (SDIO_GetFlagStatus(SDIO_FLAG_STBITERR) != RESET) - { - SDIO_ClearFlag(SDIO_FLAG_STBITERR); - errorstatus = SD_START_BIT_ERR; - return(errorstatus); - } - - /*!< Clear all the static flags */ - SDIO_ClearFlag(SDIO_STATIC_FLAGS); - - *(pscr + 1) = ((tempscr[0] & SD_0TO7BITS) << 24) | ((tempscr[0] & SD_8TO15BITS) << 8) | ((tempscr[0] & SD_16TO23BITS) >> 8) | ((tempscr[0] & SD_24TO31BITS) >> 24); - - *(pscr) = ((tempscr[1] & SD_0TO7BITS) << 24) | ((tempscr[1] & SD_8TO15BITS) << 8) | ((tempscr[1] & SD_16TO23BITS) >> 8) | ((tempscr[1] & SD_24TO31BITS) >> 24); - - return(errorstatus); -} - -/** - * @brief Converts the number of bytes in power of two and returns the power. - * @param NumberOfBytes: number of bytes. - * @retval None - */ -uint8_t convert_from_bytes_to_power_of_two(uint16_t NumberOfBytes) -{ - uint8_t count = 0; - - while (NumberOfBytes != 1) - { - NumberOfBytes >>= 1; - count++; - } - return(count); -} - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_sdio_sd.h b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_sdio_sd.h deleted file mode 100644 index d410b37fa..000000000 --- a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/Utilities/STM32_EVAL/STM322xG_EVAL/stm322xg_eval_sdio_sd.h +++ /dev/null @@ -1,406 +0,0 @@ -/** - ****************************************************************************** - * @file stm322xg_eval_sdio_sd.h - * @author MCD Application Team - * @version V5.0.3 - * @date 09-March-2012 - * @brief This file contains all the functions prototypes for the SD Card - * stm322xg_eval_sdio_sd driver firmware library. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __STM322xG_EVAL_SDIO_SD_H -#define __STM322xG_EVAL_SDIO_SD_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include "stm322xg_eval.h" - -/** @addtogroup Utilities - * @{ - */ - -/** @addtogroup STM32_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL - * @{ - */ - -/** @addtogroup STM322xG_EVAL_SDIO_SD - * @{ - */ - -/** @defgroup STM322xG_EVAL_SDIO_SD_Exported_Types - * @{ - */ -typedef enum -{ -/** - * @brief SDIO specific error defines - */ - SD_CMD_CRC_FAIL = (1), /*!< Command response received (but CRC check failed) */ - SD_DATA_CRC_FAIL = (2), /*!< Data bock sent/received (CRC check Failed) */ - SD_CMD_RSP_TIMEOUT = (3), /*!< Command response timeout */ - SD_DATA_TIMEOUT = (4), /*!< Data time out */ - SD_TX_UNDERRUN = (5), /*!< Transmit FIFO under-run */ - SD_RX_OVERRUN = (6), /*!< Receive FIFO over-run */ - SD_START_BIT_ERR = (7), /*!< Start bit not detected on all data signals in widE bus mode */ - SD_CMD_OUT_OF_RANGE = (8), /*!< CMD's argument was out of range.*/ - SD_ADDR_MISALIGNED = (9), /*!< Misaligned address */ - SD_BLOCK_LEN_ERR = (10), /*!< Transferred block length is not allowed for the card or the number of transferred bytes does not match the block length */ - SD_ERASE_SEQ_ERR = (11), /*!< An error in the sequence of erase command occurs.*/ - SD_BAD_ERASE_PARAM = (12), /*!< An Invalid selection for erase groups */ - SD_WRITE_PROT_VIOLATION = (13), /*!< Attempt to program a write protect block */ - SD_LOCK_UNLOCK_FAILED = (14), /*!< Sequence or password error has been detected in unlock command or if there was an attempt to access a locked card */ - SD_COM_CRC_FAILED = (15), /*!< CRC check of the previous command failed */ - SD_ILLEGAL_CMD = (16), /*!< Command is not legal for the card state */ - SD_CARD_ECC_FAILED = (17), /*!< Card internal ECC was applied but failed to correct the data */ - SD_CC_ERROR = (18), /*!< Internal card controller error */ - SD_GENERAL_UNKNOWN_ERROR = (19), /*!< General or Unknown error */ - SD_STREAM_READ_UNDERRUN = (20), /*!< The card could not sustain data transfer in stream read operation. */ - SD_STREAM_WRITE_OVERRUN = (21), /*!< The card could not sustain data programming in stream mode */ - SD_CID_CSD_OVERWRITE = (22), /*!< CID/CSD overwrite error */ - SD_WP_ERASE_SKIP = (23), /*!< only partial address space was erased */ - SD_CARD_ECC_DISABLED = (24), /*!< Command has been executed without using internal ECC */ - SD_ERASE_RESET = (25), /*!< Erase sequence was cleared before executing because an out of erase sequence command was received */ - SD_AKE_SEQ_ERROR = (26), /*!< Error in sequence of authentication. */ - SD_INVALID_VOLTRANGE = (27), - SD_ADDR_OUT_OF_RANGE = (28), - SD_SWITCH_ERROR = (29), - SD_SDIO_DISABLED = (30), - SD_SDIO_FUNCTION_BUSY = (31), - SD_SDIO_FUNCTION_FAILED = (32), - SD_SDIO_UNKNOWN_FUNCTION = (33), - -/** - * @brief Standard error defines - */ - SD_INTERNAL_ERROR, - SD_NOT_CONFIGURED, - SD_REQUEST_PENDING, - SD_REQUEST_NOT_APPLICABLE, - SD_INVALID_PARAMETER, - SD_UNSUPPORTED_FEATURE, - SD_UNSUPPORTED_HW, - SD_ERROR, - SD_OK = 0 -} SD_Error; - -/** - * @brief SDIO Transfer state - */ -typedef enum -{ - SD_TRANSFER_OK = 0, - SD_TRANSFER_BUSY = 1, - SD_TRANSFER_ERROR -} SDTransferState; - -/** - * @brief SD Card States - */ -typedef enum -{ - SD_CARD_READY = ((uint32_t)0x00000001), - SD_CARD_IDENTIFICATION = ((uint32_t)0x00000002), - SD_CARD_STANDBY = ((uint32_t)0x00000003), - SD_CARD_TRANSFER = ((uint32_t)0x00000004), - SD_CARD_SENDING = ((uint32_t)0x00000005), - SD_CARD_RECEIVING = ((uint32_t)0x00000006), - SD_CARD_PROGRAMMING = ((uint32_t)0x00000007), - SD_CARD_DISCONNECTED = ((uint32_t)0x00000008), - SD_CARD_ERROR = ((uint32_t)0x000000FF) -}SDCardState; - - -/** - * @brief Card Specific Data: CSD Register - */ -typedef struct -{ - __IO uint8_t CSDStruct; /*!< CSD structure */ - __IO uint8_t SysSpecVersion; /*!< System specification version */ - __IO uint8_t Reserved1; /*!< Reserved */ - __IO uint8_t TAAC; /*!< Data read access-time 1 */ - __IO uint8_t NSAC; /*!< Data read access-time 2 in CLK cycles */ - __IO uint8_t MaxBusClkFrec; /*!< Max. bus clock frequency */ - __IO uint16_t CardComdClasses; /*!< Card command classes */ - __IO uint8_t RdBlockLen; /*!< Max. read data block length */ - __IO uint8_t PartBlockRead; /*!< Partial blocks for read allowed */ - __IO uint8_t WrBlockMisalign; /*!< Write block misalignment */ - __IO uint8_t RdBlockMisalign; /*!< Read block misalignment */ - __IO uint8_t DSRImpl; /*!< DSR implemented */ - __IO uint8_t Reserved2; /*!< Reserved */ - __IO uint32_t DeviceSize; /*!< Device Size */ - __IO uint8_t MaxRdCurrentVDDMin; /*!< Max. read current @ VDD min */ - __IO uint8_t MaxRdCurrentVDDMax; /*!< Max. read current @ VDD max */ - __IO uint8_t MaxWrCurrentVDDMin; /*!< Max. write current @ VDD min */ - __IO uint8_t MaxWrCurrentVDDMax; /*!< Max. write current @ VDD max */ - __IO uint8_t DeviceSizeMul; /*!< Device size multiplier */ - __IO uint8_t EraseGrSize; /*!< Erase group size */ - __IO uint8_t EraseGrMul; /*!< Erase group size multiplier */ - __IO uint8_t WrProtectGrSize; /*!< Write protect group size */ - __IO uint8_t WrProtectGrEnable; /*!< Write protect group enable */ - __IO uint8_t ManDeflECC; /*!< Manufacturer default ECC */ - __IO uint8_t WrSpeedFact; /*!< Write speed factor */ - __IO uint8_t MaxWrBlockLen; /*!< Max. write data block length */ - __IO uint8_t WriteBlockPaPartial; /*!< Partial blocks for write allowed */ - __IO uint8_t Reserved3; /*!< Reserded */ - __IO uint8_t ContentProtectAppli; /*!< Content protection application */ - __IO uint8_t FileFormatGrouop; /*!< File format group */ - __IO uint8_t CopyFlag; /*!< Copy flag (OTP) */ - __IO uint8_t PermWrProtect; /*!< Permanent write protection */ - __IO uint8_t TempWrProtect; /*!< Temporary write protection */ - __IO uint8_t FileFormat; /*!< File Format */ - __IO uint8_t ECC; /*!< ECC code */ - __IO uint8_t CSD_CRC; /*!< CSD CRC */ - __IO uint8_t Reserved4; /*!< always 1*/ -} SD_CSD; - -/** - * @brief Card Identification Data: CID Register - */ -typedef struct -{ - __IO uint8_t ManufacturerID; /*!< ManufacturerID */ - __IO uint16_t OEM_AppliID; /*!< OEM/Application ID */ - __IO uint32_t ProdName1; /*!< Product Name part1 */ - __IO uint8_t ProdName2; /*!< Product Name part2*/ - __IO uint8_t ProdRev; /*!< Product Revision */ - __IO uint32_t ProdSN; /*!< Product Serial Number */ - __IO uint8_t Reserved1; /*!< Reserved1 */ - __IO uint16_t ManufactDate; /*!< Manufacturing Date */ - __IO uint8_t CID_CRC; /*!< CID CRC */ - __IO uint8_t Reserved2; /*!< always 1 */ -} SD_CID; - -/** - * @brief SD Card Status - */ -typedef struct -{ - __IO uint8_t DAT_BUS_WIDTH; - __IO uint8_t SECURED_MODE; - __IO uint16_t SD_CARD_TYPE; - __IO uint32_t SIZE_OF_PROTECTED_AREA; - __IO uint8_t SPEED_CLASS; - __IO uint8_t PERFORMANCE_MOVE; - __IO uint8_t AU_SIZE; - __IO uint16_t ERASE_SIZE; - __IO uint8_t ERASE_TIMEOUT; - __IO uint8_t ERASE_OFFSET; -} SD_CardStatus; - - -/** - * @brief SD Card information - */ -typedef struct -{ - SD_CSD SD_csd; - SD_CID SD_cid; - uint64_t CardCapacity; /*!< Card Capacity */ - uint32_t CardBlockSize; /*!< Card Block Size */ - uint16_t RCA; - uint8_t CardType; -} SD_CardInfo; - -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_SDIO_SD_Exported_Constants - * @{ - */ - -/** - * @brief SDIO Commands Index - */ -#define SD_CMD_GO_IDLE_STATE ((uint8_t)0) -#define SD_CMD_SEND_OP_COND ((uint8_t)1) -#define SD_CMD_ALL_SEND_CID ((uint8_t)2) -#define SD_CMD_SET_REL_ADDR ((uint8_t)3) /*!< SDIO_SEND_REL_ADDR for SD Card */ -#define SD_CMD_SET_DSR ((uint8_t)4) -#define SD_CMD_SDIO_SEN_OP_COND ((uint8_t)5) -#define SD_CMD_HS_SWITCH ((uint8_t)6) -#define SD_CMD_SEL_DESEL_CARD ((uint8_t)7) -#define SD_CMD_HS_SEND_EXT_CSD ((uint8_t)8) -#define SD_CMD_SEND_CSD ((uint8_t)9) -#define SD_CMD_SEND_CID ((uint8_t)10) -#define SD_CMD_READ_DAT_UNTIL_STOP ((uint8_t)11) /*!< SD Card doesn't support it */ -#define SD_CMD_STOP_TRANSMISSION ((uint8_t)12) -#define SD_CMD_SEND_STATUS ((uint8_t)13) -#define SD_CMD_HS_BUSTEST_READ ((uint8_t)14) -#define SD_CMD_GO_INACTIVE_STATE ((uint8_t)15) -#define SD_CMD_SET_BLOCKLEN ((uint8_t)16) -#define SD_CMD_READ_SINGLE_BLOCK ((uint8_t)17) -#define SD_CMD_READ_MULT_BLOCK ((uint8_t)18) -#define SD_CMD_HS_BUSTEST_WRITE ((uint8_t)19) -#define SD_CMD_WRITE_DAT_UNTIL_STOP ((uint8_t)20) /*!< SD Card doesn't support it */ -#define SD_CMD_SET_BLOCK_COUNT ((uint8_t)23) /*!< SD Card doesn't support it */ -#define SD_CMD_WRITE_SINGLE_BLOCK ((uint8_t)24) -#define SD_CMD_WRITE_MULT_BLOCK ((uint8_t)25) -#define SD_CMD_PROG_CID ((uint8_t)26) /*!< reserved for manufacturers */ -#define SD_CMD_PROG_CSD ((uint8_t)27) -#define SD_CMD_SET_WRITE_PROT ((uint8_t)28) -#define SD_CMD_CLR_WRITE_PROT ((uint8_t)29) -#define SD_CMD_SEND_WRITE_PROT ((uint8_t)30) -#define SD_CMD_SD_ERASE_GRP_START ((uint8_t)32) /*!< To set the address of the first write - block to be erased. (For SD card only) */ -#define SD_CMD_SD_ERASE_GRP_END ((uint8_t)33) /*!< To set the address of the last write block of the - continuous range to be erased. (For SD card only) */ -#define SD_CMD_ERASE_GRP_START ((uint8_t)35) /*!< To set the address of the first write block to be erased. - (For MMC card only spec 3.31) */ - -#define SD_CMD_ERASE_GRP_END ((uint8_t)36) /*!< To set the address of the last write block of the - continuous range to be erased. (For MMC card only spec 3.31) */ - -#define SD_CMD_ERASE ((uint8_t)38) -#define SD_CMD_FAST_IO ((uint8_t)39) /*!< SD Card doesn't support it */ -#define SD_CMD_GO_IRQ_STATE ((uint8_t)40) /*!< SD Card doesn't support it */ -#define SD_CMD_LOCK_UNLOCK ((uint8_t)42) -#define SD_CMD_APP_CMD ((uint8_t)55) -#define SD_CMD_GEN_CMD ((uint8_t)56) -#define SD_CMD_NO_CMD ((uint8_t)64) - -/** - * @brief Following commands are SD Card Specific commands. - * SDIO_APP_CMD should be sent before sending these commands. - */ -#define SD_CMD_APP_SD_SET_BUSWIDTH ((uint8_t)6) /*!< For SD Card only */ -#define SD_CMD_SD_APP_STAUS ((uint8_t)13) /*!< For SD Card only */ -#define SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS ((uint8_t)22) /*!< For SD Card only */ -#define SD_CMD_SD_APP_OP_COND ((uint8_t)41) /*!< For SD Card only */ -#define SD_CMD_SD_APP_SET_CLR_CARD_DETECT ((uint8_t)42) /*!< For SD Card only */ -#define SD_CMD_SD_APP_SEND_SCR ((uint8_t)51) /*!< For SD Card only */ -#define SD_CMD_SDIO_RW_DIRECT ((uint8_t)52) /*!< For SD I/O Card only */ -#define SD_CMD_SDIO_RW_EXTENDED ((uint8_t)53) /*!< For SD I/O Card only */ - -/** - * @brief Following commands are SD Card Specific security commands. - * SDIO_APP_CMD should be sent before sending these commands. - */ -#define SD_CMD_SD_APP_GET_MKB ((uint8_t)43) /*!< For SD Card only */ -#define SD_CMD_SD_APP_GET_MID ((uint8_t)44) /*!< For SD Card only */ -#define SD_CMD_SD_APP_SET_CER_RN1 ((uint8_t)45) /*!< For SD Card only */ -#define SD_CMD_SD_APP_GET_CER_RN2 ((uint8_t)46) /*!< For SD Card only */ -#define SD_CMD_SD_APP_SET_CER_RES2 ((uint8_t)47) /*!< For SD Card only */ -#define SD_CMD_SD_APP_GET_CER_RES1 ((uint8_t)48) /*!< For SD Card only */ -#define SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK ((uint8_t)18) /*!< For SD Card only */ -#define SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK ((uint8_t)25) /*!< For SD Card only */ -#define SD_CMD_SD_APP_SECURE_ERASE ((uint8_t)38) /*!< For SD Card only */ -#define SD_CMD_SD_APP_CHANGE_SECURE_AREA ((uint8_t)49) /*!< For SD Card only */ -#define SD_CMD_SD_APP_SECURE_WRITE_MKB ((uint8_t)48) /*!< For SD Card only */ - -/* Uncomment the following line to select the SDIO Data transfer mode */ -#if !defined (SD_DMA_MODE) && !defined (SD_POLLING_MODE) -#define SD_DMA_MODE ((uint32_t)0x00000000) -/*#define SD_POLLING_MODE ((uint32_t)0x00000002)*/ -#endif - -/** - * @brief SD detection on its memory slot - */ -#define SD_PRESENT ((uint8_t)0x01) -#define SD_NOT_PRESENT ((uint8_t)0x00) - -/** - * @brief Supported SD Memory Cards - */ -#define SDIO_STD_CAPACITY_SD_CARD_V1_1 ((uint32_t)0x00000000) -#define SDIO_STD_CAPACITY_SD_CARD_V2_0 ((uint32_t)0x00000001) -#define SDIO_HIGH_CAPACITY_SD_CARD ((uint32_t)0x00000002) -#define SDIO_MULTIMEDIA_CARD ((uint32_t)0x00000003) -#define SDIO_SECURE_DIGITAL_IO_CARD ((uint32_t)0x00000004) -#define SDIO_HIGH_SPEED_MULTIMEDIA_CARD ((uint32_t)0x00000005) -#define SDIO_SECURE_DIGITAL_IO_COMBO_CARD ((uint32_t)0x00000006) -#define SDIO_HIGH_CAPACITY_MMC_CARD ((uint32_t)0x00000007) - -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_SDIO_SD_Exported_Macros - * @{ - */ -/** - * @} - */ - -/** @defgroup STM322xG_EVAL_SDIO_SD_Exported_Functions - * @{ - */ -void SD_DeInit(void); -SD_Error SD_Init(void); -SDTransferState SD_GetStatus(void); -SDCardState SD_GetState(void); -uint8_t SD_Detect(void); -SD_Error SD_PowerON(void); -SD_Error SD_PowerOFF(void); -SD_Error SD_InitializeCards(void); -SD_Error SD_GetCardInfo(SD_CardInfo *cardinfo); -SD_Error SD_GetCardStatus(SD_CardStatus *cardstatus); -SD_Error SD_EnableWideBusOperation(uint32_t WideMode); -SD_Error SD_SelectDeselect(uint32_t addr); -SD_Error SD_ReadBlock(uint8_t *readbuff, uint32_t ReadAddr, uint16_t BlockSize); -SD_Error SD_ReadMultiBlocks(uint8_t *readbuff, uint32_t ReadAddr, uint16_t BlockSize, uint32_t NumberOfBlocks); -SD_Error SD_WriteBlock(uint8_t *writebuff, uint32_t WriteAddr, uint16_t BlockSize); -SD_Error SD_WriteMultiBlocks(uint8_t *writebuff, uint32_t WriteAddr, uint16_t BlockSize, uint32_t NumberOfBlocks); -SDTransferState SD_GetTransferState(void); -SD_Error SD_StopTransfer(void); -SD_Error SD_Erase(uint32_t startaddr, uint32_t endaddr); -SD_Error SD_SendStatus(uint32_t *pcardstatus); -SD_Error SD_SendSDStatus(uint32_t *psdstatus); -SD_Error SD_ProcessIRQSrc(void); -void SD_ProcessDMAIRQ(void); -SD_Error SD_WaitReadOperation(void); -SD_Error SD_WaitWriteOperation(void); -#ifdef __cplusplus -} -#endif - -#endif /* __STM322xG_EVAL_SDIO_SD_H */ -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/_htmresc/CMSIS_Logo_Final.jpg b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/_htmresc/CMSIS_Logo_Final.jpg deleted file mode 100644 index e04560175..000000000 Binary files a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/_htmresc/CMSIS_Logo_Final.jpg and /dev/null differ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/_htmresc/logo.bmp b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/_htmresc/logo.bmp deleted file mode 100644 index 18a621e81..000000000 Binary files a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/_htmresc/logo.bmp and /dev/null differ diff --git a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/stm32f2xx_stdperiph_lib_um.chm b/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/stm32f2xx_stdperiph_lib_um.chm deleted file mode 100644 index 95f2e4ab6..000000000 Binary files a/src/x9d/STM32F2xx_StdPeriph_Lib_V1.1.0/stm32f2xx_stdperiph_lib_um.chm and /dev/null differ diff --git a/src/x9d/board_x9d.cpp b/src/x9d/board_x9d.cpp index 82bb363a0..ca4ca039e 100644 --- a/src/x9d/board_x9d.cpp +++ b/src/x9d/board_x9d.cpp @@ -40,8 +40,6 @@ volatile uint32_t Tenms ; // TODO to remove everywhere / use a #define // TODO why not here the Peri1_frequency ... (to avoid modifications in system_stm32f2xx.c) uint32_t Master_frequency ; -extern uint32_t Peri1_frequency ; -extern uint32_t Peri2_frequency ; #define PIN_MODE_MASK 0x0003 #define PIN_INPUT 0x0000 diff --git a/src/x9d/board_x9d.h b/src/x9d/board_x9d.h index dce4daaf6..b3e99be99 100644 --- a/src/x9d/board_x9d.h +++ b/src/x9d/board_x9d.h @@ -38,6 +38,7 @@ #include "./STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc/stm32f2xx_rcc.h" #include "./STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc/stm32f2xx_gpio.h" +#include "./STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc/stm32f2xx_spi.h" #include "./STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h" #include "hal.h" @@ -46,17 +47,15 @@ #include "audio_driver.h" #include "delays.h" +extern uint32_t Peri1_frequency ; +extern uint32_t Peri2_frequency ; + // TODO elsewhere #if !defined(SIMU) #define SD_IS_HC() (1) #endif -extern "C" { -extern void init_SDcard(); -extern void sdInit(); -} - -#define sdPoll10ms() +void sdPoll10ms(); void usbMassStorage(); @@ -71,11 +70,6 @@ extern uint8_t temperature ; // Raw temp reading extern uint8_t maxTemperature ; // Raw temp reading uint8_t getTemperature(); -extern int32_t Card_state; -extern volatile uint32_t Card_initialized; -#define SD_ST_DATA 9 -#define SD_ST_MOUNTED 10 - #define SD_GET_SIZE_MB() (0) #define SD_GET_BLOCKNR() (0) #define SD_GET_SPEED() (0) diff --git a/src/x9d/diskio.cpp b/src/x9d/diskio.cpp index bafc0f307..ba29ef977 100644 --- a/src/x9d/diskio.cpp +++ b/src/x9d/diskio.cpp @@ -31,21 +31,52 @@ * */ -/*-----------------------------------------------------------------------*/ -/* MMCv3/SDv1/SDv2 (in SPI mode) control module (C)ChaN, 2010 */ -/*-----------------------------------------------------------------------*/ -/* Only rcvr_spi(), xmit_spi(), sdPoll10ms() and some macros */ -/* are platform dependent. */ -/*-----------------------------------------------------------------------*/ - #include #include "../FatFs/diskio.h" #include "../FatFs/ff.h" #include "../CoOS/kernel/CoOS.h" +/* Definitions for MMC/SDC command */ +#define CMD0 (0x40+0) /* GO_IDLE_STATE */ +#define CMD1 (0x40+1) /* SEND_OP_COND (MMC) */ +#define ACMD41 (0xC0+41) /* SEND_OP_COND (SDC) */ +#define CMD8 (0x40+8) /* SEND_IF_COND */ +#define CMD9 (0x40+9) /* SEND_CSD */ +#define CMD10 (0x40+10) /* SEND_CID */ +#define CMD12 (0x40+12) /* STOP_TRANSMISSION */ +#define ACMD13 (0xC0+13) /* SD_STATUS (SDC) */ +#define CMD16 (0x40+16) /* SET_BLOCKLEN */ +#define CMD17 (0x40+17) /* READ_SINGLE_BLOCK */ +#define CMD18 (0x40+18) /* READ_MULTIPLE_BLOCK */ +#define CMD23 (0x40+23) /* SET_BLOCK_COUNT (MMC) */ +#define ACMD23 (0xC0+23) /* SET_WR_BLK_ERASE_COUNT (SDC) */ +#define CMD24 (0x40+24) /* WRITE_BLOCK */ +#define CMD25 (0x40+25) /* WRITE_MULTIPLE_BLOCK */ +#define CMD55 (0x40+55) /* APP_CMD */ +#define CMD58 (0x40+58) /* READ_OCR */ +/* Card-Select Controls (Platform dependent) */ +#define SELECT() GPIO_ResetBits(GPIO_SPI_SD, GPIO_Pin_SPI_SD_CS) /* MMC CS = L */ +#define DESELECT() GPIO_SetBits(GPIO_SPI_SD, GPIO_Pin_SPI_SD_CS) /* MMC CS = H */ -uint32_t Card_ID[4] ; +#if (_MAX_SS != 512) || (_FS_READONLY == 0) || (STM32_SD_DISK_IOCTRL_FORCE == 1) +#define STM32_SD_DISK_IOCTRL 1 +#else +#define STM32_SD_DISK_IOCTRL 0 +#endif + +#define BOOL bool +#define FALSE false +#define TRUE true + +/* Card type flags (CardType) */ +#define CT_MMC 0x01 +#define CT_SD1 0x02 +#define CT_SD2 0x04 +#define CT_SDC (CT_SD1|CT_SD2) +#define CT_BLOCK 0x08 + +/*uint32_t Card_ID[4] ; uint32_t Card_SCR[2] ; uint32_t Card_CSD[4] ; int32_t Card_state; // = SD_ST_STARTUP ; @@ -53,7 +84,7 @@ volatile uint32_t Card_initialized = 0; uint32_t Sd_rca ; uint32_t Cmd_A41_resp ; uint8_t cardType; -uint32_t transSpeed; +uint32_t transSpeed; */ /*-----------------------------------------------------------------------*/ /* Lock / unlock functions */ @@ -80,59 +111,898 @@ int ff_del_syncobj (_SYNC_t mutex) return 1; } -DSTATUS disk_initialize ( - BYTE drv /* Physical drive nmuber (0) */ - ) +static const DWORD socket_state_mask_cp = (1 << 0); +static const DWORD socket_state_mask_wp = (1 << 1); + +static volatile +DSTATUS Stat = STA_NOINIT; /* Disk status */ + +static volatile +DWORD Timer1, Timer2; /* 100Hz decrement timers */ + +static +BYTE CardType; /* Card type flags */ + +enum speed_setting { INTERFACE_SLOW, INTERFACE_FAST }; + +static void interface_speed( enum speed_setting speed ) { - return RES_NOTRDY; + DWORD tmp; + + tmp = SPI_SD->CR1; + if ( speed == INTERFACE_SLOW ) { + /* Set slow clock (100k-400k) */ + tmp = ( tmp | SPI_BaudRatePrescaler_256 ); + } else { + /* Set fast clock (depends on the CSD) */ + tmp = ( tmp & ~SPI_BaudRatePrescaler_256 ) | SPI_BaudRatePrescaler_SPI_SD; + } + SPI_SD->CR1 = tmp; } +#if SOCKET_WP_CONNECTED +/* Socket's Write-Protection Pin: high = write-protected, low = writable */ + +static void socket_wp_init(void) +{ + GPIO_InitTypeDef GPIO_InitStructure; + + /* Configure I/O for write-protect */ + RCC_AHB1PeriphClockCmd(RCC_AHBxPeriph_GPIO_WP, ENABLE); + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_WP; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_WP; + GPIO_Init(GPIO_CTL_SD, &GPIO_InitStructure); +} + +static DWORD socket_is_write_protected(void) +{ + return ( GPIO_ReadInputData(GPIO_CTL_SD) & GPIO_Pin_WP ) ? socket_state_mask_wp : 0; +} + +#else + +static void socket_wp_init(void) +{ + return; +} + +static inline DWORD socket_is_write_protected(void) +{ + return 0; /* fake not protected */ +} + +#endif /* SOCKET_WP_CONNECTED */ + + +#if SOCKET_CP_CONNECTED +/* Socket's Card-Present Pin: high = socket empty, low = card inserted */ + +static void socket_cp_init(void) +{ + GPIO_InitTypeDef GPIO_InitStructure; + + /* Configure I/O for card-present */ + RCC_AHB1PeriphClockCmd(RCC_AHBxPeriph_GPIO_CP, ENABLE); + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_CP; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_CP; + GPIO_Init(GPIO_CTL_SD, &GPIO_InitStructure); +} + +static inline DWORD socket_is_empty(void) +{ + return ( GPIO_ReadInputData(GPIO_CTL_SD) & GPIO_Pin_CP ) ? socket_state_mask_cp : FALSE; +} + +#else + +static void socket_cp_init(void) +{ + return; +} + +static inline DWORD socket_is_empty(void) +{ + return 0; /* fake inserted */ +} + +#endif /* SOCKET_CP_CONNECTED */ + + +#if CARD_SUPPLY_SWITCHABLE + +static void card_power(BOOL on) /* switch FET for card-socket VCC */ +{ + GPIO_InitTypeDef GPIO_InitStructure; + + /* Turn on GPIO for power-control pin connected to FET's gate */ + RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIO_PWR, ENABLE); + /* Configure I/O for Power FET */ + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_PWR; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_PWR; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_Init(GPIO_PWR, &GPIO_InitStructure); + if (on) { + GPIO_ResetBits(GPIO_PWR, GPIO_Pin_PWR); + } else { + /* Chip select internal pull-down (to avoid parasite powering) */ + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_CS; + GPIO_Init(GPIO_CS, &GPIO_InitStructure); + + GPIO_SetBits(GPIO_PWR, GPIO_Pin_PWR); + } +} + +#if (STM32_SD_DISK_IOCTRL == 1) +static int chk_power(void) /* Socket power state: 0=off, 1=on */ +{ + if ( GPIO_ReadOutputDataBit(GPIO_PWR, GPIO_Pin_PWR) == Bit_SET ) { + return 0; + } else { + return 1; + } +} +#endif + +#else + +static void card_power(BYTE on) +{ + on=on; +} + +#if (STM32_SD_DISK_IOCTRL == 1) +static int chk_power(void) +{ + return 1; /* fake powered */ +} +#endif + +#endif /* CARD_SUPPLY_SWITCHABLE */ + + +/*-----------------------------------------------------------------------*/ +/* Transmit/Receive a byte to MMC via SPI (Platform dependent) */ +/*-----------------------------------------------------------------------*/ +static BYTE stm32_spi_rw( BYTE out ) +{ + /* Loop while DR register in not empty */ + /// not needed: while (SPI_I2S_GetFlagStatus(SPI_SD, SPI_I2S_FLAG_TXE) == RESET) { ; } + + /* Send byte through the SPI peripheral */ + SPI_I2S_SendData(SPI_SD, out); + + /* Wait to receive a byte */ + while (SPI_I2S_GetFlagStatus(SPI_SD, SPI_I2S_FLAG_RXNE) == RESET) { ; } + + /* Return the byte read from the SPI bus */ + return SPI_I2S_ReceiveData(SPI_SD); +} + + + +/*-----------------------------------------------------------------------*/ +/* Transmit a byte to MMC via SPI (Platform dependent) */ +/*-----------------------------------------------------------------------*/ + +#define xmit_spi(dat) stm32_spi_rw(dat) + +/*-----------------------------------------------------------------------*/ +/* Receive a byte from MMC via SPI (Platform dependent) */ +/*-----------------------------------------------------------------------*/ + +static +BYTE rcvr_spi (void) +{ + return stm32_spi_rw(0xff); +} + +/* Alternative macro to receive data fast */ +#define rcvr_spi_m(dst) *(dst)=stm32_spi_rw(0xff) + + + +/*-----------------------------------------------------------------------*/ +/* Wait for card ready */ +/*-----------------------------------------------------------------------*/ + +static +BYTE wait_ready (void) +{ + BYTE res; + + + Timer2 = 50; /* Wait for ready in timeout of 500ms */ + rcvr_spi(); + do + res = rcvr_spi(); + while ((res != 0xFF) && Timer2); + + return res; +} + + + +/*-----------------------------------------------------------------------*/ +/* Deselect the card and release SPI bus */ +/*-----------------------------------------------------------------------*/ + +static +void release_spi (void) +{ + DESELECT(); + rcvr_spi(); +} + +#ifdef STM32_SD_USE_DMA +/*-----------------------------------------------------------------------*/ +/* Transmit/Receive Block using DMA (Platform dependent. STM32 here) */ +/*-----------------------------------------------------------------------*/ +static +void stm32_dma_transfer( + BOOL receive, /* FALSE for buff->SPI, TRUE for SPI->buff */ + const BYTE *buff, /* receive TRUE : 512 byte data block to be transmitted + receive FALSE : Data buffer to store received data */ + UINT btr /* receive TRUE : Byte count (must be multiple of 2) + receive FALSE : Byte count (must be 512) */ +) +{ + DMA_InitTypeDef DMA_InitStructure; + WORD rw_workbyte[] = { 0xffff }; + + /* shared DMA configuration values */ + DMA_InitStructure.DMA_PeripheralBaseAddr = (DWORD)(&(SPI_SD->DR)); + DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte; + DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte; + DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; + DMA_InitStructure.DMA_BufferSize = btr; + DMA_InitStructure.DMA_Mode = DMA_Mode_Normal; + DMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh; + DMA_InitStructure.DMA_M2M = DMA_M2M_Disable; + + DMA_DeInit(DMA_Channel_SPI_SD_RX); + DMA_DeInit(DMA_Channel_SPI_SD_TX); + + if ( receive ) { + + /* DMA1 channel2 configuration SPI1 RX ---------------------------------------------*/ + /* DMA1 channel4 configuration SPI2 RX ---------------------------------------------*/ + DMA_InitStructure.DMA_MemoryBaseAddr = (DWORD)buff; + DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC; + DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; + DMA_Init(DMA_Channel_SPI_SD_RX, &DMA_InitStructure); + + /* DMA1 channel3 configuration SPI1 TX ---------------------------------------------*/ + /* DMA1 channel5 configuration SPI2 TX ---------------------------------------------*/ + DMA_InitStructure.DMA_MemoryBaseAddr = (DWORD)rw_workbyte; + DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST; + DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Disable; + DMA_Init(DMA_Channel_SPI_SD_TX, &DMA_InitStructure); + + } else { + +#if _FS_READONLY == 0 + /* DMA1 channel2 configuration SPI1 RX ---------------------------------------------*/ + /* DMA1 channel4 configuration SPI2 RX ---------------------------------------------*/ + DMA_InitStructure.DMA_MemoryBaseAddr = (DWORD)rw_workbyte; + DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC; + DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Disable; + DMA_Init(DMA_Channel_SPI_SD_RX, &DMA_InitStructure); + + /* DMA1 channel3 configuration SPI1 TX ---------------------------------------------*/ + /* DMA1 channel5 configuration SPI2 TX ---------------------------------------------*/ + DMA_InitStructure.DMA_MemoryBaseAddr = (DWORD)buff; + DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST; + DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; + DMA_Init(DMA_Channel_SPI_SD_TX, &DMA_InitStructure); +#endif + + } + + /* Enable DMA RX Channel */ + DMA_Cmd(DMA_Channel_SPI_SD_RX, ENABLE); + /* Enable DMA TX Channel */ + DMA_Cmd(DMA_Channel_SPI_SD_TX, ENABLE); + + /* Enable SPI TX/RX request */ + SPI_I2S_DMACmd(SPI_SD, SPI_I2S_DMAReq_Rx | SPI_I2S_DMAReq_Tx, ENABLE); + + /* Wait until DMA1_Channel 3 Transfer Complete */ + /// not needed: while (DMA_GetFlagStatus(DMA_FLAG_SPI_SD_TC_TX) == RESET) { ; } + /* Wait until DMA1_Channel 2 Receive Complete */ + while (DMA_GetFlagStatus(DMA_FLAG_SPI_SD_TC_RX) == RESET) { ; } + // same w/o function-call: + // while ( ( ( DMA1->ISR ) & DMA_FLAG_SPI_SD_TC_RX ) == RESET ) { ; } + + /* Disable DMA RX Channel */ + DMA_Cmd(DMA_Channel_SPI_SD_RX, DISABLE); + /* Disable DMA TX Channel */ + DMA_Cmd(DMA_Channel_SPI_SD_TX, DISABLE); + + /* Disable SPI RX/TX request */ + SPI_I2S_DMACmd(SPI_SD, SPI_I2S_DMAReq_Rx | SPI_I2S_DMAReq_Tx, DISABLE); +} +#endif /* STM32_SD_USE_DMA */ + + +/*-----------------------------------------------------------------------*/ +/* Power Control and interface-initialization (Platform dependent) */ +/*-----------------------------------------------------------------------*/ + +static +void power_on (void) +{ + SPI_InitTypeDef SPI_InitStructure; + GPIO_InitTypeDef GPIO_InitStructure; + volatile BYTE dummyread; + + /* Enable GPIO clock for CS */ + RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIO_CS, ENABLE); + /* Enable SPI clock, SPI1: APB2, SPI2: APB1 */ + RCC_APBPeriphClockCmd_SPI_SD(RCC_APBPeriph_SPI_SD, ENABLE); + + GPIO_PinAFConfig(GPIO_SPI_SD,GPIO_PinSource_SCK ,GPIO_AF_SD); + GPIO_PinAFConfig(GPIO_SPI_SD,GPIO_PinSource_MISO,GPIO_AF_SD); + GPIO_PinAFConfig(GPIO_SPI_SD,GPIO_PinSource_MOSI,GPIO_AF_SD); + + card_power(1); + + socket_cp_init();//Empty return + socket_wp_init();//Empty return. + + for (Timer1 = 25; Timer1; ); /* Wait for 250ms */ + + /* Configure I/O for Flash Chip select */ + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_SPI_SD_CS; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; + GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; + GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_Init(GPIO_SPI_SD, &GPIO_InitStructure); + + /* De-select the Card: Chip Select high */ + DESELECT(); + + /* Configure SPI pins: SCK MISO and MOSI with alternate function push-down */ + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_SPI_SD_SCK | GPIO_Pin_SPI_SD_MOSI | GPIO_Pin_SPI_SD_MISO; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; + GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; + GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN; + GPIO_Init(GPIO_SPI_SD, &GPIO_InitStructure); + + /* SPI configuration */ + SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; + SPI_InitStructure.SPI_Mode = SPI_Mode_Master; + SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; + SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low; + SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge; + SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; + SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_SPI_SD; // + SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; + SPI_InitStructure.SPI_CRCPolynomial = 7; + + SPI_Init(SPI_SD, &SPI_InitStructure); + SPI_CalculateCRC(SPI_SD, DISABLE); + SPI_Cmd(SPI_SD, ENABLE); + + /* drain SPI */ + while (SPI_I2S_GetFlagStatus(SPI_SD, SPI_I2S_FLAG_TXE) == RESET) { ; } + dummyread = SPI_I2S_ReceiveData(SPI_SD); + +#ifdef STM32_SD_USE_DMA + /* enable DMA clock */ + RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE); +#endif +} + +static +void power_off (void) +{ + GPIO_InitTypeDef GPIO_InitStructure; + + if (!(Stat & STA_NOINIT)) { + SELECT(); + wait_ready(); + release_spi(); + } + + SPI_I2S_DeInit(SPI_SD); + SPI_Cmd(SPI_SD, DISABLE); + RCC_APBPeriphClockCmd_SPI_SD(RCC_APBPeriph_SPI_SD, DISABLE); + + //All SPI-Pins to input with weak internal pull-downs // + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_SPI_SD_SCK | GPIO_Pin_SPI_SD_MISO | GPIO_Pin_SPI_SD_MOSI; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; + GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; + GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN; + GPIO_Init(GPIO_SPI_SD, &GPIO_InitStructure); + + card_power(0); + + Stat |= STA_NOINIT; /* Set STA_NOINIT */ +} + + +/*-----------------------------------------------------------------------*/ +/* Receive a data packet from MMC */ +/*-----------------------------------------------------------------------*/ + +static +BOOL rcvr_datablock ( + BYTE *buff, /* Data buffer to store received data */ + UINT btr /* Byte count (must be multiple of 4) */ +) +{ + BYTE token; + + + Timer1 = 10; + do { /* Wait for data packet in timeout of 100ms */ + token = rcvr_spi(); + } while ((token == 0xFF) && Timer1); + if(token != 0xFE) return FALSE; /* If not valid data token, return with error */ + +#ifdef STM32_SD_USE_DMA + stm32_dma_transfer( TRUE, buff, btr ); +#else + do { /* Receive the data block into buffer */ + rcvr_spi_m(buff++); + rcvr_spi_m(buff++); + rcvr_spi_m(buff++); + rcvr_spi_m(buff++); + } while (btr -= 4); +#endif /* STM32_SD_USE_DMA */ + + rcvr_spi(); /* Discard CRC */ + rcvr_spi(); + + return TRUE; /* Return with success */ +} + + + +/*-----------------------------------------------------------------------*/ +/* Send a data packet to MMC */ +/*-----------------------------------------------------------------------*/ + +#if _FS_READONLY == 0 +static +BOOL xmit_datablock ( + const BYTE *buff, /* 512 byte data block to be transmitted */ + BYTE token /* Data/Stop token */ +) +{ + BYTE resp; +#ifndef STM32_SD_USE_DMA + BYTE wc; +#endif + + if (wait_ready() != 0xFF) return FALSE; + + xmit_spi(token); /* transmit data token */ + if (token != 0xFD) { /* Is data token */ + +#ifdef STM32_SD_USE_DMA + stm32_dma_transfer( FALSE, buff, 512 ); +#else + wc = 0; + do { /* transmit the 512 byte data block to MMC */ + xmit_spi(*buff++); + xmit_spi(*buff++); + } while (--wc); +#endif /* STM32_SD_USE_DMA */ + + xmit_spi(0xFF); /* CRC (Dummy) */ + xmit_spi(0xFF); + resp = rcvr_spi(); /* Receive data response */ + if ((resp & 0x1F) != 0x05) /* If not accepted, return with error */ + return FALSE; + } + + return TRUE; +} +#endif /* _READONLY */ + + + +/*-----------------------------------------------------------------------*/ +/* Send a command packet to MMC */ +/*-----------------------------------------------------------------------*/ + +static +BYTE send_cmd ( + BYTE cmd, /* Command byte */ + DWORD arg /* Argument */ +) +{ + BYTE n, res; + + + if (cmd & 0x80) { /* ACMD is the command sequence of CMD55-CMD */ + cmd &= 0x7F; + res = send_cmd(CMD55, 0); + if (res > 1) return res; + } + + /* Select the card and wait for ready */ + DESELECT(); + SELECT(); + if (wait_ready() != 0xFF) { + return 0xFF; + } + + /* Send command packet */ + xmit_spi(cmd); /* Start + Command index */ + xmit_spi((BYTE)(arg >> 24)); /* Argument[31..24] */ + xmit_spi((BYTE)(arg >> 16)); /* Argument[23..16] */ + xmit_spi((BYTE)(arg >> 8)); /* Argument[15..8] */ + xmit_spi((BYTE)arg); /* Argument[7..0] */ + n = 0x01; /* Dummy CRC + Stop */ + if (cmd == CMD0) n = 0x95; /* Valid CRC for CMD0(0) */ + if (cmd == CMD8) n = 0x87; /* Valid CRC for CMD8(0x1AA) */ + xmit_spi(n); + + /* Receive command response */ + if (cmd == CMD12) rcvr_spi(); /* Skip a stuff byte when stop reading */ + + n = 10; /* Wait for a valid response in timeout of 10 attempts */ + do + res = rcvr_spi(); + while ((res & 0x80) && --n); + + return res; /* Return with the response value */ +} + + + +/*-------------------------------------------------------------------------- + + Public Functions + +---------------------------------------------------------------------------*/ + + +/*-----------------------------------------------------------------------*/ +/* Initialize Disk Drive */ +/*-----------------------------------------------------------------------*/ + +DSTATUS disk_initialize ( + BYTE drv /* Physical drive number (0) */ +) +{ + BYTE n, cmd, ty, ocr[4]; + + if (drv) return STA_NOINIT; /* Supports only single drive */ + if (Stat & STA_NODISK) return Stat; /* No card in the socket */ + + power_on(); /* Force socket power on and initialize interface */ + interface_speed(INTERFACE_SLOW); + for (n = 10; n; n--) rcvr_spi(); /* 80 dummy clocks */ + + ty = 0; + if (send_cmd(CMD0, 0) == 1) { /* Enter Idle state */ + Timer1 = 100; /* Initialization timeout of 1000 milliseconds */ + if (send_cmd(CMD8, 0x1AA) == 1) { /* SDHC */ + for (n = 0; n < 4; n++) ocr[n] = rcvr_spi(); /* Get trailing return value of R7 response */ + if (ocr[2] == 0x01 && ocr[3] == 0xAA) { /* The card can work at VDD range of 2.7-3.6V */ + while (Timer1 && send_cmd(ACMD41, 1UL << 30)); /* Wait for leaving idle state (ACMD41 with HCS bit) */ + if (Timer1 && send_cmd(CMD58, 0) == 0) { /* Check CCS bit in the OCR */ + for (n = 0; n < 4; n++) ocr[n] = rcvr_spi(); + ty = (ocr[0] & 0x40) ? CT_SD2 | CT_BLOCK : CT_SD2; + } + } + } else { /* SDSC or MMC */ + if (send_cmd(ACMD41, 0) <= 1) { + ty = CT_SD1; cmd = ACMD41; /* SDSC */ + } else { + ty = CT_MMC; cmd = CMD1; /* MMC */ + } + while (Timer1 && send_cmd(cmd, 0)); /* Wait for leaving idle state */ + if (!Timer1 || send_cmd(CMD16, 512) != 0) /* Set R/W block length to 512 */ + ty = 0; + } + } + CardType = ty; + release_spi(); + + if (ty) { /* Initialization succeeded */ + Stat &= ~STA_NOINIT; /* Clear STA_NOINIT */ + interface_speed(INTERFACE_FAST); + } else { /* Initialization failed */ + power_off(); + } + + return Stat; +} + + + +/*-----------------------------------------------------------------------*/ +/* Get Disk Status */ +/*-----------------------------------------------------------------------*/ + DSTATUS disk_status ( - BYTE drv /* Physical drive number (0) */ - ) + BYTE drv /* Physical drive number (0) */ +) { - return RES_NOTRDY; + if (drv) return STA_NOINIT; /* Supports only single drive */ + return Stat; } + +/*-----------------------------------------------------------------------*/ +/* Read Sector(s) */ +/*-----------------------------------------------------------------------*/ + DRESULT disk_read ( - BYTE drv, /* Physical drive nmuber (0) */ - BYTE *buff, /* Pointer to the data buffer to store read data */ - DWORD sector, /* Start sector number (LBA) */ - BYTE count /* Sector count (1..255) */ - ) + BYTE drv, /* Physical drive number (0) */ + BYTE *buff, /* Pointer to the data buffer to store read data */ + DWORD sector, /* Start sector number (LBA) */ + BYTE count /* Sector count (1..255) */ +) { - return RES_NOTRDY; + if (drv || !count) return RES_PARERR; + if (Stat & STA_NOINIT) return RES_NOTRDY; + + if (!(CardType & CT_BLOCK)) sector *= 512; /* Convert to byte address if needed */ + + if (count == 1) { /* Single block read */ + if (send_cmd(CMD17, sector) == 0) { /* READ_SINGLE_BLOCK */ + if (rcvr_datablock(buff, 512)) { + count = 0; + } + } + } + else { /* Multiple block read */ + if (send_cmd(CMD18, sector) == 0) { /* READ_MULTIPLE_BLOCK */ + do { + if (!rcvr_datablock(buff, 512)) { + break; + } + buff += 512; + } while (--count); + send_cmd(CMD12, 0); /* STOP_TRANSMISSION */ + } + } + release_spi(); + + return count ? RES_ERROR : RES_OK; } + + +/*-----------------------------------------------------------------------*/ +/* Write Sector(s) */ +/*-----------------------------------------------------------------------*/ + +#if _FS_READONLY == 0 + DRESULT disk_write ( - BYTE drv, /* Physical drive nmuber (0) */ - const BYTE *buff, /* Pointer to the data to be written */ - DWORD sector, /* Start sector number (LBA) */ - BYTE count /* Sector count (1..255) */ - ) + BYTE drv, /* Physical drive number (0) */ + const BYTE *buff, /* Pointer to the data to be written */ + DWORD sector, /* Start sector number (LBA) */ + BYTE count /* Sector count (1..255) */ +) { - return RES_NOTRDY; -} + if (drv || !count) return RES_PARERR; + if (Stat & STA_NOINIT) return RES_NOTRDY; + if (Stat & STA_PROTECT) return RES_WRPRT; + if (!(CardType & CT_BLOCK)) sector *= 512; /* Convert to byte address if needed */ + + if (count == 1) { /* Single block write */ + if ((send_cmd(CMD24, sector) == 0) /* WRITE_BLOCK */ + && xmit_datablock(buff, 0xFE)) + count = 0; + } + else { /* Multiple block write */ + if (CardType & CT_SDC) send_cmd(ACMD23, count); + if (send_cmd(CMD25, sector) == 0) { /* WRITE_MULTIPLE_BLOCK */ + do { + if (!xmit_datablock(buff, 0xFC)) break; + buff += 512; + } while (--count); + if (!xmit_datablock(0, 0xFD)) /* STOP_TRAN token */ + count = 1; + } + } + release_spi(); + + return count ? RES_ERROR : RES_OK; +} +#endif /* _READONLY == 0 */ + + + +/*-----------------------------------------------------------------------*/ +/* Miscellaneous Functions */ +/*-----------------------------------------------------------------------*/ + +#if (STM32_SD_DISK_IOCTRL == 1) DRESULT disk_ioctl ( - BYTE drv, /* Physical drive nmuber (0) */ - BYTE ctrl, /* Control code */ - void *buff /* Buffer to send/receive control data */ - ) + BYTE drv, /* Physical drive number (0) */ + BYTE ctrl, /* Control code */ + void *buff /* Buffer to send/receive control data */ +) { - return RES_NOTRDY; + DRESULT res; + BYTE n, csd[16], *ptr = (BYTE *)buff; + WORD csize; + + if (drv) return RES_PARERR; + + res = RES_ERROR; + + if (ctrl == CTRL_POWER) { + switch (*ptr) { + case 0: /* Sub control code == 0 (POWER_OFF) */ + if (chk_power()) + power_off(); /* Power off */ + res = RES_OK; + break; + case 1: /* Sub control code == 1 (POWER_ON) */ + power_on(); /* Power on */ + res = RES_OK; + break; + case 2: /* Sub control code == 2 (POWER_GET) */ + *(ptr+1) = (BYTE)chk_power(); + res = RES_OK; + break; + default : + res = RES_PARERR; + } + } + else { + if (Stat & STA_NOINIT) return RES_NOTRDY; + + switch (ctrl) { + case CTRL_SYNC : /* Make sure that no pending write process */ + SELECT(); + if (wait_ready() == 0xFF) + res = RES_OK; + break; + + case GET_SECTOR_COUNT : /* Get number of sectors on the disk (DWORD) */ + if ((send_cmd(CMD9, 0) == 0) && rcvr_datablock(csd, 16)) { + if ((csd[0] >> 6) == 1) { /* SDC version 2.00 */ + csize = csd[9] + ((WORD)csd[8] << 8) + 1; + *(DWORD*)buff = (DWORD)csize << 10; + } else { /* SDC version 1.XX or MMC*/ + n = (csd[5] & 15) + ((csd[10] & 128) >> 7) + ((csd[9] & 3) << 1) + 2; + csize = (csd[8] >> 6) + ((WORD)csd[7] << 2) + ((WORD)(csd[6] & 3) << 10) + 1; + *(DWORD*)buff = (DWORD)csize << (n - 9); + } + res = RES_OK; + } + break; + + case GET_SECTOR_SIZE : /* Get R/W sector size (WORD) */ + *(WORD*)buff = 512; + res = RES_OK; + break; + + case GET_BLOCK_SIZE : /* Get erase block size in unit of sector (DWORD) */ + if (CardType & CT_SD2) { /* SDC version 2.00 */ + if (send_cmd(ACMD13, 0) == 0) { /* Read SD status */ + rcvr_spi(); + if (rcvr_datablock(csd, 16)) { /* Read partial block */ + for (n = 64 - 16; n; n--) rcvr_spi(); /* Purge trailing data */ + *(DWORD*)buff = 16UL << (csd[10] >> 4); + res = RES_OK; + } + } + } else { /* SDC version 1.XX or MMC */ + if ((send_cmd(CMD9, 0) == 0) && rcvr_datablock(csd, 16)) { /* Read CSD */ + if (CardType & CT_SD1) { /* SDC version 1.XX */ + *(DWORD*)buff = (((csd[10] & 63) << 1) + ((WORD)(csd[11] & 128) >> 7) + 1) << ((csd[13] >> 6) - 1); + } else { /* MMC */ + *(DWORD*)buff = ((WORD)((csd[10] & 124) >> 2) + 1) * (((csd[11] & 3) << 3) + ((csd[11] & 224) >> 5) + 1); + } + res = RES_OK; + } + } + break; + + case MMC_GET_TYPE : /* Get card type flags (1 byte) */ + *ptr = CardType; + res = RES_OK; + break; + + case MMC_GET_CSD : /* Receive CSD as a data block (16 bytes) */ + if (send_cmd(CMD9, 0) == 0 /* READ_CSD */ + && rcvr_datablock(ptr, 16)) + res = RES_OK; + break; + + case MMC_GET_CID : /* Receive CID as a data block (16 bytes) */ + if (send_cmd(CMD10, 0) == 0 /* READ_CID */ + && rcvr_datablock(ptr, 16)) + res = RES_OK; + break; + + case MMC_GET_OCR : /* Receive OCR as an R3 resp (4 bytes) */ + if (send_cmd(CMD58, 0) == 0) { /* READ_OCR */ + for (n = 4; n; n--) *ptr++ = rcvr_spi(); + res = RES_OK; + } + break; + + case MMC_GET_SDSTAT : /* Receive SD status as a data block (64 bytes) */ + if (send_cmd(ACMD13, 0) == 0) { /* SD_STATUS */ + rcvr_spi(); + if (rcvr_datablock(ptr, 64)) + res = RES_OK; + } + break; + + default: + res = RES_PARERR; + } + + release_spi(); + } + + return res; +} +#endif /* _USE_IOCTL != 0 */ + + +/*-----------------------------------------------------------------------*/ +/* Device Timer Interrupt Procedure (Platform dependent) */ +/*-----------------------------------------------------------------------*/ +/* This function must be called in period of 10ms */ + +void sdPoll10ms() +{ + static DWORD pv; + DWORD ns; + BYTE n, s; + + + n = Timer1; /* 100Hz decrement timers */ + if (n) Timer1 = --n; + n = Timer2; + if (n) Timer2 = --n; + + ns = pv; + pv = socket_is_empty() | socket_is_write_protected(); /* Sample socket switch */ + + if (ns == pv) { /* Have contacts stabled? */ + s = Stat; + + if (pv & socket_state_mask_wp) /* WP is H (write protected) */ + s |= STA_PROTECT; + else /* WP is L (write enabled) */ + s &= ~STA_PROTECT; + + if (pv & socket_state_mask_cp) /* INS = H (Socket empty) */ + s |= (STA_NODISK | STA_NOINIT); + else /* INS = L (Card inserted) */ + s &= ~STA_NODISK; + + Stat = s; + } } void sdInit() { } +FATFS g_FATFS_Obj; + void sdMountPoll() { + static uint8_t mountTimer; + if (mountTimer-- == 0) { + mountTimer = 100; + if (g_FATFS_Obj.fs_type == 0) { + f_mount(0, &g_FATFS_Obj); + } + } } -uint32_t sd_card_mounted( void ) +uint32_t sd_card_mounted(void) { - return 0; // CardIsConnected() && Card_state == SD_ST_MOUNTED; + return g_FATFS_Obj.fs_type != 0; } diff --git a/src/x9d/pwr_driver.cpp b/src/x9d/pwr_driver.cpp index 5f9e98ec2..f8bbc55be 100644 --- a/src/x9d/pwr_driver.cpp +++ b/src/x9d/pwr_driver.cpp @@ -40,10 +40,14 @@ void soft_power_off() uint32_t check_soft_power() { +#if defined(SIMU) + return e_power_on; +#else if (GPIO_ReadInputDataBit(GPIOPWR, PIN_PWR_STATUS) == Bit_RESET) return e_power_on; else return e_power_off; +#endif } void pwrInit()