Skip to content

Commit 0658c08

Browse files
committed
renesas: support micros with different number of HW pipes
not all renesas micro have the same number of pipes as expected by the find_pipe function for example see RA4M1 micro which only have 2 bulk pipes and 2 interrupt pipes for this reason some defines were introduced so that the actual number and positions of USB HW pipes can be defined at build time for different kind of processor using the ifndef ---> define mechanism allows to put sensible default values
1 parent 7bf5923 commit 0658c08

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

Diff for: src/portable/renesas/rusb2/dcd_rusb2.c

+21-3
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,24 @@ static dcd_data_t _dcd;
8989
// INTERNAL OBJECT & FUNCTION DECLARATION
9090
//--------------------------------------------------------------------+
9191

92+
#ifndef FIRST_BULK_PIPE
93+
#define FIRST_BULK_PIPE 3
94+
#endif
95+
96+
#ifndef FIRST_INTERRUPT_PIPE
97+
#define FIRST_INTERRUPT_PIPE 6
98+
#endif
99+
100+
#ifndef NUMBER_OF_PIPES
101+
#define NUMBER_OF_PIPES 10
102+
#endif
103+
104+
#ifdef NO_ISOCRONOUS_PIPE
105+
#define FIRST_PIPE FIRST_BULK_PIPE
106+
#else
107+
#define FIRST_PIPE 1
108+
#endif
109+
92110
// Transfer conditions specifiable for each pipe:
93111
// - Pipe 0: Control transfer with 64-byte single buffer
94112
// - Pipes 1 and 2: Bulk isochronous transfer continuous transfer mode with programmable buffer size up
@@ -97,9 +115,9 @@ static dcd_data_t _dcd;
97115
// optional double buffer
98116
// - Pipes 6 to 9: Interrupt transfer with 64-byte single buffer
99117
enum {
100-
PIPE_1ST_BULK = 3,
101-
PIPE_1ST_INTERRUPT = 6,
102-
PIPE_COUNT = 10,
118+
PIPE_1ST_BULK = FIRST_BULK_PIPE,
119+
PIPE_1ST_INTERRUPT = FIRST_INTERRUPT_PIPE,
120+
PIPE_COUNT = NUMBER_OF_PIPES,
103121
};
104122

105123
static unsigned find_pipe(unsigned xfer)

0 commit comments

Comments
 (0)