summaryrefslogtreecommitdiff
path: root/usb/f1_usb_def.h
blob: 0e42f6fbcf9bf3b6912b21d1ae0bc46624f3fd48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef F1_USB_DEF_H
#define F1_USB_DEF_H

#include <stdint.h>

class F1_USB_t {
	private:
		struct F1_USB_reg_t {
			volatile uint32_t EPR[16];
			volatile uint32_t CNTR;
			volatile uint32_t ISTR;
			volatile uint32_t FNR;
			volatile uint32_t DADDR;
			volatile uint32_t BTABLE;
		};
		
		struct F1_USB_bufd_t {
			volatile uint32_t ADDR_TX;
			volatile uint32_t COUNT_TX;
			volatile uint32_t ADDR_RX;
			volatile uint32_t COUNT_RX;
		};
		
	public:
		F1_USB_reg_t& reg;
		F1_USB_bufd_t* bufd;
		volatile uint32_t* buf;
		
		F1_USB_t(uint32_t reg_addr, uint32_t buf_addr) :
			reg(*(F1_USB_reg_t*)reg_addr),
			bufd((F1_USB_bufd_t*)buf_addr),
			buf((volatile uint32_t*)buf_addr) {}
};

#endif