@@ -50,35 +50,35 @@ void usbfs_d0fifo_handler(void);
50
50
void usbfs_d1fifo_handler (void );
51
51
52
52
BSP_DONT_REMOVE const
53
- fsp_vector_t g_vector_table [BSP_ICU_VECTOR_MAX_ENTRIES ] BSP_PLACE_IN_SECTION (BSP_SECTION_APPLICATION_VECTORS ) = {
54
- [0 ] = usbfs_interrupt_handler , /* USBFS INT (USBFS interrupt) */
55
- [1 ] = usbfs_resume_handler , /* USBFS RESUME (USBFS resume interrupt) */
56
- [2 ] = usbfs_d0fifo_handler , /* USBFS FIFO 0 (DMA transfer request 0) */
57
- [3 ] = usbfs_d1fifo_handler , /* USBFS FIFO 1 (DMA transfer request 1) */
53
+ fsp_vector_t g_vector_table [BSP_ICU_VECTOR_MAX_ENTRIES ] BSP_PLACE_IN_SECTION (BSP_SECTION_APPLICATION_VECTORS ) = {
54
+ [0 ] = usbfs_interrupt_handler , /* USBFS INT (USBFS interrupt) */
55
+ [1 ] = usbfs_resume_handler , /* USBFS RESUME (USBFS resume interrupt) */
56
+ [2 ] = usbfs_d0fifo_handler , /* USBFS FIFO 0 (DMA transfer request 0) */
57
+ [3 ] = usbfs_d1fifo_handler , /* USBFS FIFO 1 (DMA transfer request 1) */
58
58
};
59
59
const bsp_interrupt_event_t g_interrupt_event_link_select [BSP_ICU_VECTOR_MAX_ENTRIES ] = {
60
- [0 ] = BSP_PRV_IELS_ENUM (EVENT_USBFS_INT ), /* USBFS INT (USBFS interrupt) */
61
- [1 ] = BSP_PRV_IELS_ENUM (EVENT_USBFS_RESUME ), /* USBFS RESUME (USBFS resume interrupt) */
62
- [2 ] = BSP_PRV_IELS_ENUM (EVENT_USBFS_FIFO_0 ), /* USBFS FIFO 0 (DMA transfer request 0) */
63
- [3 ] = BSP_PRV_IELS_ENUM (EVENT_USBFS_FIFO_1 ) /* USBFS FIFO 1 (DMA transfer request 1) */
60
+ [0 ] = BSP_PRV_IELS_ENUM (EVENT_USBFS_INT ), /* USBFS INT (USBFS interrupt) */
61
+ [1 ] = BSP_PRV_IELS_ENUM (EVENT_USBFS_RESUME ), /* USBFS RESUME (USBFS resume interrupt) */
62
+ [2 ] = BSP_PRV_IELS_ENUM (EVENT_USBFS_FIFO_0 ), /* USBFS FIFO 0 (DMA transfer request 0) */
63
+ [3 ] = BSP_PRV_IELS_ENUM (EVENT_USBFS_FIFO_1 ) /* USBFS FIFO 1 (DMA transfer request 1) */
64
64
};
65
65
66
66
const ioport_pin_cfg_t g_bsp_pin_cfg_data [] = {
67
- {.pin = BSP_IO_PORT_04_PIN_07 ,
68
- .pin_cfg = ((uint32_t ) IOPORT_CFG_PERIPHERAL_PIN | (uint32_t ) IOPORT_PERIPHERAL_USB_FS )},
69
- {.pin = BSP_IO_PORT_05_PIN_00 ,
70
- .pin_cfg = ((uint32_t ) IOPORT_CFG_PERIPHERAL_PIN | (uint32_t ) IOPORT_PERIPHERAL_USB_FS )},
71
- {.pin = BSP_IO_PORT_05_PIN_01 ,
72
- .pin_cfg = ((uint32_t ) IOPORT_CFG_PERIPHERAL_PIN | (uint32_t ) IOPORT_PERIPHERAL_USB_FS )},
73
- {.pin = LED1 , .pin_cfg = ((uint32_t ) IOPORT_CFG_PORT_DIRECTION_OUTPUT | (uint32_t ) IOPORT_CFG_PORT_OUTPUT_LOW )},
74
- {.pin = LED2 , .pin_cfg = ((uint32_t ) IOPORT_CFG_PORT_DIRECTION_OUTPUT | (uint32_t ) IOPORT_CFG_PORT_OUTPUT_LOW )},
75
- {.pin = LED3 , .pin_cfg = ((uint32_t ) IOPORT_CFG_PORT_DIRECTION_OUTPUT | (uint32_t ) IOPORT_CFG_PORT_OUTPUT_LOW )},
76
- {.pin = SW1 , .pin_cfg = ((uint32_t ) IOPORT_CFG_PORT_DIRECTION_INPUT )},
77
- {.pin = SW2 , .pin_cfg = ((uint32_t ) IOPORT_CFG_PORT_DIRECTION_INPUT )}};
67
+ {.pin = BSP_IO_PORT_04_PIN_07 ,
68
+ .pin_cfg = ((uint32_t ) IOPORT_CFG_PERIPHERAL_PIN | (uint32_t ) IOPORT_PERIPHERAL_USB_FS )},
69
+ {.pin = BSP_IO_PORT_05_PIN_00 ,
70
+ .pin_cfg = ((uint32_t ) IOPORT_CFG_PERIPHERAL_PIN | (uint32_t ) IOPORT_PERIPHERAL_USB_FS )},
71
+ {.pin = BSP_IO_PORT_05_PIN_01 ,
72
+ .pin_cfg = ((uint32_t ) IOPORT_CFG_PERIPHERAL_PIN | (uint32_t ) IOPORT_PERIPHERAL_USB_FS )},
73
+ {.pin = LED1 , .pin_cfg = ((uint32_t ) IOPORT_CFG_PORT_DIRECTION_OUTPUT | (uint32_t ) IOPORT_CFG_PORT_OUTPUT_LOW )},
74
+ {.pin = LED2 , .pin_cfg = ((uint32_t ) IOPORT_CFG_PORT_DIRECTION_OUTPUT | (uint32_t ) IOPORT_CFG_PORT_OUTPUT_LOW )},
75
+ {.pin = LED3 , .pin_cfg = ((uint32_t ) IOPORT_CFG_PORT_DIRECTION_OUTPUT | (uint32_t ) IOPORT_CFG_PORT_OUTPUT_LOW )},
76
+ {.pin = SW1 , .pin_cfg = ((uint32_t ) IOPORT_CFG_PORT_DIRECTION_INPUT )},
77
+ {.pin = SW2 , .pin_cfg = ((uint32_t ) IOPORT_CFG_PORT_DIRECTION_INPUT )}};
78
78
79
79
const ioport_cfg_t g_bsp_pin_cfg = {
80
- .number_of_pins = sizeof (g_bsp_pin_cfg_data ) / sizeof (ioport_pin_cfg_t ),
81
- .p_pin_cfg_data = & g_bsp_pin_cfg_data [0 ],
80
+ .number_of_pins = sizeof (g_bsp_pin_cfg_data ) / sizeof (ioport_pin_cfg_t ),
81
+ .p_pin_cfg_data = & g_bsp_pin_cfg_data [0 ],
82
82
};
83
83
ioport_instance_ctrl_t g_ioport_ctrl ;
84
84
const ioport_instance_t g_ioport = {.p_api = & g_ioport_on_ioport , .p_ctrl = & g_ioport_ctrl , .p_cfg = & g_bsp_pin_cfg };
@@ -88,78 +88,78 @@ const ioport_instance_t g_ioport = {.p_api = &g_ioport_on_ioport, .p_ctrl = &g_i
88
88
//--------------------------------------------------------------------+
89
89
void usbfs_interrupt_handler (void )
90
90
{
91
- IRQn_Type irq = R_FSP_CurrentIrqGet ();
92
- R_BSP_IrqStatusClear (irq );
91
+ IRQn_Type irq = R_FSP_CurrentIrqGet ();
92
+ R_BSP_IrqStatusClear (irq );
93
93
94
94
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST
95
- tuh_int_handler (0 );
95
+ tuh_int_handler (0 );
96
96
#endif
97
97
98
98
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
99
- tud_int_handler (0 );
99
+ tud_int_handler (0 );
100
100
#endif
101
101
}
102
102
void usbfs_resume_handler (void )
103
103
{
104
- IRQn_Type irq = R_FSP_CurrentIrqGet ();
105
- R_BSP_IrqStatusClear (irq );
104
+ IRQn_Type irq = R_FSP_CurrentIrqGet ();
105
+ R_BSP_IrqStatusClear (irq );
106
106
107
107
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST
108
- tuh_int_handler (0 );
108
+ tuh_int_handler (0 );
109
109
#endif
110
110
111
111
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
112
- tud_int_handler (0 );
112
+ tud_int_handler (0 );
113
113
#endif
114
114
}
115
115
void usbfs_d0fifo_handler (void )
116
116
{
117
- IRQn_Type irq = R_FSP_CurrentIrqGet ();
118
- R_BSP_IrqStatusClear (irq );
117
+ IRQn_Type irq = R_FSP_CurrentIrqGet ();
118
+ R_BSP_IrqStatusClear (irq );
119
119
120
120
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST
121
- tuh_int_handler (0 );
121
+ tuh_int_handler (0 );
122
122
#endif
123
123
124
124
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
125
- tud_int_handler (0 );
125
+ tud_int_handler (0 );
126
126
#endif
127
127
}
128
128
void usbfs_d1fifo_handler (void )
129
129
{
130
- IRQn_Type irq = R_FSP_CurrentIrqGet ();
131
- R_BSP_IrqStatusClear (irq );
130
+ IRQn_Type irq = R_FSP_CurrentIrqGet ();
131
+ R_BSP_IrqStatusClear (irq );
132
132
133
133
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST
134
- tuh_int_handler (0 );
134
+ tuh_int_handler (0 );
135
135
#endif
136
136
137
137
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
138
- tud_int_handler (0 );
138
+ tud_int_handler (0 );
139
139
#endif
140
140
}
141
141
142
142
void board_init (void )
143
143
{
144
- /* Configure pins. */
145
- R_IOPORT_Open (& g_ioport_ctrl , & g_bsp_pin_cfg );
144
+ /* Configure pins. */
145
+ R_IOPORT_Open (& g_ioport_ctrl , & g_bsp_pin_cfg );
146
146
147
- /* Enable USB_BASE */
148
- R_SYSTEM -> PRCR = (uint16_t ) BSP_PRV_PRCR_PRC1_UNLOCK ;
149
- R_MSTP -> MSTPCRB &= ~(1U << 11U );
150
- R_SYSTEM -> PRCR = (uint16_t ) BSP_PRV_PRCR_LOCK ;
147
+ /* Enable USB_BASE */
148
+ R_SYSTEM -> PRCR = (uint16_t ) BSP_PRV_PRCR_PRC1_UNLOCK ;
149
+ R_MSTP -> MSTPCRB &= ~(1U << 11U );
150
+ R_SYSTEM -> PRCR = (uint16_t ) BSP_PRV_PRCR_LOCK ;
151
151
152
152
#if CFG_TUSB_OS == OPT_OS_FREERTOS
153
- // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
154
- NVIC_SetPriority (TU_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
155
- NVIC_SetPriority (USBFS_RESUME_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
156
- NVIC_SetPriority (USBFS_FIFO_0_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
157
- NVIC_SetPriority (USBFS_FIFO_1_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
153
+ // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
154
+ NVIC_SetPriority (TU_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
155
+ NVIC_SetPriority (USBFS_RESUME_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
156
+ NVIC_SetPriority (USBFS_FIFO_0_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
157
+ NVIC_SetPriority (USBFS_FIFO_1_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
158
158
#endif
159
159
160
160
#if CFG_TUSB_OS == OPT_OS_NONE
161
- /* Init systick */
162
- SysTick_Config (SystemCoreClock / 1000 );
161
+ /* Init systick */
162
+ SysTick_Config (SystemCoreClock / 1000 );
163
163
#endif
164
164
}
165
165
@@ -169,66 +169,66 @@ void board_init(void)
169
169
170
170
void board_led_write (bool state )
171
171
{
172
- R_IOPORT_PinWrite (& g_ioport_ctrl , LED1 , state );
173
- R_IOPORT_PinWrite (& g_ioport_ctrl , LED2 , state );
174
- R_IOPORT_PinWrite (& g_ioport_ctrl , LED3 , state );
172
+ R_IOPORT_PinWrite (& g_ioport_ctrl , LED1 , state );
173
+ R_IOPORT_PinWrite (& g_ioport_ctrl , LED2 , state );
174
+ R_IOPORT_PinWrite (& g_ioport_ctrl , LED3 , state );
175
175
}
176
176
177
177
uint32_t board_button_read (void )
178
178
{
179
- bsp_io_level_t lvl ;
180
- R_IOPORT_PinRead (& g_ioport_ctrl , SW1 , & lvl );
181
- return lvl ;
179
+ bsp_io_level_t lvl ;
180
+ R_IOPORT_PinRead (& g_ioport_ctrl , SW1 , & lvl );
181
+ return lvl ;
182
182
}
183
183
184
184
int board_uart_read (uint8_t * buf , int len )
185
185
{
186
- (void ) buf ;
187
- (void ) len ;
188
- return 0 ;
186
+ (void ) buf ;
187
+ (void ) len ;
188
+ return 0 ;
189
189
}
190
190
191
191
int board_uart_write (void const * buf , int len )
192
192
{
193
- (void ) buf ;
194
- (void ) len ;
195
- return 0 ;
193
+ (void ) buf ;
194
+ (void ) len ;
195
+ return 0 ;
196
196
}
197
197
198
198
#if CFG_TUSB_OS == OPT_OS_NONE
199
199
volatile uint32_t system_ticks = 0 ;
200
200
void SysTick_Handler (void )
201
201
{
202
- system_ticks ++ ;
202
+ system_ticks ++ ;
203
203
}
204
204
205
205
uint32_t board_millis (void )
206
206
{
207
- return system_ticks ;
207
+ return system_ticks ;
208
208
}
209
209
#else
210
210
#endif
211
211
212
212
int close (int fd )
213
213
{
214
- (void ) fd ;
215
- return -1 ;
214
+ (void ) fd ;
215
+ return -1 ;
216
216
}
217
217
int fstat (int fd , void * pstat )
218
218
{
219
- (void ) fd ;
220
- (void ) pstat ;
221
- return 0 ;
219
+ (void ) fd ;
220
+ (void ) pstat ;
221
+ return 0 ;
222
222
}
223
223
off_t lseek (int fd , off_t pos , int whence )
224
224
{
225
- (void ) fd ;
226
- (void ) pos ;
227
- (void ) whence ;
228
- return 0 ;
225
+ (void ) fd ;
226
+ (void ) pos ;
227
+ (void ) whence ;
228
+ return 0 ;
229
229
}
230
230
int isatty (int fd )
231
231
{
232
- (void ) fd ;
233
- return 1 ;
232
+ (void ) fd ;
233
+ return 1 ;
234
234
}
0 commit comments