diff options
author | Damien <damien.p.george@gmail.com> | 2013-10-19 18:13:48 +0100 |
---|---|---|
committer | Damien <damien.p.george@gmail.com> | 2013-10-19 18:13:48 +0100 |
commit | afe12bca23b106a18796bf6ed793ff1389bdddb2 (patch) | |
tree | c34020314b3b1ed7a6106a3582882460471ef1dc /stm/lib | |
parent | fb42ec17bcf7508f66b8d8d0770b60c33be0d6ab (diff) | |
download | micropython-afe12bca23b106a18796bf6ed793ff1389bdddb2.tar.gz micropython-afe12bca23b106a18796bf6ed793ff1389bdddb2.zip |
Fix IRQ priority issue to give working USB; and some cleanup.
Diffstat (limited to 'stm/lib')
-rw-r--r-- | stm/lib/usb_bsp.c | 12 | ||||
-rw-r--r-- | stm/lib/usbd_storage_msd.c | 9 | ||||
-rw-r--r-- | stm/lib/usbd_usr.c | 16 |
3 files changed, 20 insertions, 17 deletions
diff --git a/stm/lib/usb_bsp.c b/stm/lib/usb_bsp.c index 293ee95e20..c4839bdf96 100644 --- a/stm/lib/usb_bsp.c +++ b/stm/lib/usb_bsp.c @@ -106,8 +106,8 @@ void USB_OTG_BSP_Init(USB_OTG_CORE_HANDLE *pdev) { GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;
GPIO_Init(GPIOA, &GPIO_InitStructure);
- GPIO_PinAFConfig(GPIOA, GPIO_PinSource11, GPIO_AF_OTG1_FS);
- GPIO_PinAFConfig(GPIOA, GPIO_PinSource12, GPIO_AF_OTG1_FS);
+ GPIO_PinAFConfig(GPIOA, GPIO_PinSource11, GPIO_AF_OTG_FS);
+ GPIO_PinAFConfig(GPIOA, GPIO_PinSource12, GPIO_AF_OTG_FS);
/* Configure VBUS Pin (or disable VBUS_SENSING_ENABLED) */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
@@ -123,16 +123,16 @@ void USB_OTG_BSP_Init(USB_OTG_CORE_HANDLE *pdev) { /**
* @brief USB_OTG_BSP_EnableInterrupt
-* Enabele USB Global interrupt
+* Enable USB Global interrupt
* @param None
* @retval None
*/
void USB_OTG_BSP_EnableInterrupt(USB_OTG_CORE_HANDLE *pdev) {
+ // this assumes we use NVIC_PriorityGroup_4
NVIC_InitTypeDef NVIC_InitStructure;
- NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
NVIC_InitStructure.NVIC_IRQChannel = OTG_FS_IRQn;
- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;
+ NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 8;
+ NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
diff --git a/stm/lib/usbd_storage_msd.c b/stm/lib/usbd_storage_msd.c index 47790bb110..afdd47865d 100644 --- a/stm/lib/usbd_storage_msd.c +++ b/stm/lib/usbd_storage_msd.c @@ -28,6 +28,9 @@ /* Includes ------------------------------------------------------------------*/
#include "usbd_msc_mem.h"
#include "usb_conf.h"
+
+#include "misc.h"
+#include "storage.h"
#include "diskio.h"
/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
@@ -198,9 +201,9 @@ int8_t STORAGE_GetCapacity (uint8_t lun, uint32_t *block_num, uint32_t *block_si */
- *block_size = 512;
+ *block_size = storage_get_block_size();
//*block_num = SDCardInfo.CardCapacity / 512;
- *block_num = 256 + 128;
+ *block_num = storage_get_block_count();
return (0);
@@ -305,7 +308,7 @@ int8_t STORAGE_Write (uint8_t lun, while (SD_GetStatus() != SD_TRANSFER_OK);
#endif
*/
- disk_write(0, buf, blk_addr, blk_len);
+ //disk_write(0, buf, blk_addr, blk_len);
return (0);
}
diff --git a/stm/lib/usbd_usr.c b/stm/lib/usbd_usr.c index 844a3ed7f5..a5a7fb7ffb 100644 --- a/stm/lib/usbd_usr.c +++ b/stm/lib/usbd_usr.c @@ -46,8 +46,8 @@ USBD_Usr_cb_TypeDef USR_cb = { * @retval None */ void USBD_USR_Init() { - printf("USB OTG FS\n"); - printf("USB device start\n"); + //printf("USB OTG FS\n"); + //printf("USB device start\n"); } /** @@ -57,7 +57,7 @@ void USBD_USR_Init() { * @retval None */ void USBD_USR_DeviceReset(uint8_t speed) { - printf("USB reset %d\n", speed); + //printf("USB reset %d\n", speed); } /** @@ -67,7 +67,7 @@ void USBD_USR_DeviceReset(uint8_t speed) { * @retval Staus */ void USBD_USR_DeviceConfigured() { - printf("USB dev config\n"); + //printf("USB dev config\n"); } /** @@ -77,7 +77,7 @@ void USBD_USR_DeviceConfigured() { * @retval None */ void USBD_USR_DeviceSuspended() { - printf("USB dev suspend\n"); + //printf("USB dev suspend\n"); } /** @@ -87,7 +87,7 @@ void USBD_USR_DeviceSuspended() { * @retval None */ void USBD_USR_DeviceResumed() { - printf("USB dev resume\n"); + //printf("USB dev resume\n"); } @@ -98,7 +98,7 @@ void USBD_USR_DeviceResumed() { * @retval Staus */ void USBD_USR_DeviceConnected() { - printf("USB dev connect\n"); + //printf("USB dev connect\n"); } @@ -109,7 +109,7 @@ void USBD_USR_DeviceConnected() { * @retval Staus */ void USBD_USR_DeviceDisconnected() { - printf("USB dev disconn\n"); + //printf("USB dev disconn\n"); } /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |