#define BIT_SET(bit) (1<<bit)
#define BIT_CLR(bit) (0<<bit)
-#define HAL_WORD_REG_WRITE(addr, val) \
- do { \
- (*((volatile uint32_t *)(addr&0xfffffffc))) = (uint32_t)(val); \
- } while (0)
-
-#define HAL_WORD_REG_READ(addr) (*((volatile uint32_t *)(addr&0xfffffffc)))
-
-
-#define HAL_HALF_WORD_REG_WRITE(addr, val) \
- do { \
- (*((volatile uint16_t *)(addr&0xfffffffe))) = (uint16_t)(val); \
- } while (0)
-
-#define HAL_HALF_WORD_REG_READ(addr) (*((volatile uint16_t *)(addr&0xfffffffe)))
-
-
-#define HAL_BYTE_REG_WRITE(addr, val) \
- do { \
- (*((volatile uint8_t *)(addr))) = (uint8_t)(val); \
- } while (0)
-
-#define HAL_BYTE_REG_READ(addr) (*((volatile uint8_t *)(addr)))
-
/***** REGISTER BASE ADDRESS DEFINITION *****/
#define RESET_VECTOR_ADDRESS 0x8e0000
/********************************************/
#include "k2/reg_defs.h"
-/************************* Register Process marco ************************/
-#define UART_REG_WRITE(addr, val) HAL_WORD_REG_WRITE(UART_BASE_ADDRESS|(uint32_t)(addr), (val))
-#define UART_REG_READ(addr) HAL_WORD_REG_READ(UART_BASE_ADDRESS|(uint32_t)(addr))
-
/************************** Register deinition ***************************/
#define RBR_ADDRESS 0x00051000
#define RBR_OFFSET 0x00000000
#define BIT_SET(bit) (1<<bit)\r
#define BIT_CLR(bit) (0<<bit)\r
\r
-#define HAL_WORD_REG_WRITE(addr, val) \\r
- do { \\r
- (*((volatile uint32_t *)(addr&0xfffffffc))) = (uint32_t)(val); \\r
- } while (0)\r
-\r
-#define HAL_WORD_REG_READ(addr) (*((volatile uint32_t *)(addr&0xfffffffc)))\r
-\r
-\r
-#define HAL_HALF_WORD_REG_WRITE(addr, val) \\r
- do { \\r
- (*((volatile uint16_t *)(addr&0xfffffffe))) = (uint16_t)(val); \\r
- } while (0)\r
-\r
-#define HAL_HALF_WORD_REG_READ(addr) (*((volatile uint16_t *)(addr&0xfffffffe))) \r
-\r
-\r
-#define HAL_BYTE_REG_WRITE(addr, val) \\r
- do { \\r
- (*((volatile uint8_t *)(addr))) = (uint8_t)(val); \\r
- } while (0)\r
-\r
-#define HAL_BYTE_REG_READ(addr) (*((volatile uint8_t *)(addr))) \r
-\r
/***** REGISTER BASE ADDRESS DEFINITION *****/\r
#define RESET_VECTOR_ADDRESS 0x8e0000\r
/********************************************/\r
#include "reg_defs.h"
-/************************* Register Process marco ************************/
-#define UART_REG_WRITE(addr, val) HAL_WORD_REG_WRITE(UART_BASE_ADDRESS|(uint32_t)(addr), (val))
-#define UART_REG_READ(addr) HAL_WORD_REG_READ(UART_BASE_ADDRESS|(uint32_t)(addr))
-
/************************** Register deinition ***************************/
#define RBR_ADDRESS 0x00051000
#define RBR_OFFSET 0x00000000
#define mADDR(addr) (*mpADDR(addr))
#define muADDR(addr) ((uint16_t) (&(addr)))
-#define USB_BYTE_REG_WRITE(addr, val) HAL_BYTE_REG_WRITE(USB_CTRL_BASE_ADDRESS|(uint8_t)(addr^3), (val))
-#define USB_BYTE_REG_READ(addr) HAL_BYTE_REG_READ(USB_CTRL_BASE_ADDRESS|(uint8_t)(addr^3))
-//#define USB_BYTE_REG_READ(addr) HAL_BYTE_REG_READ(USB_CTRL_BASE_ADDRESS|(uint8_t)(addr))
+#define USB_BYTE_REG_WRITE(addr, val) iowrite8_usb(addr, val)
+#define USB_BYTE_REG_READ(addr) ioread8_usb(addr)
-#define USB_HALF_WORD_REG_WRITE(addr, val) HAL_HALF_WORD_REG_WRITE(USB_CTRL_BASE_ADDRESS|(uint16_t)(addr), (val))
-#define USB_HALF_WORD_REG_READ(addr) HAL_HALF_WORD_REG_READ(USB_CTRL_BASE_ADDRESS|(uint16_t)(addr))
+#define USB_HALF_WORD_REG_WRITE(addr, val) iowrite16_usb(addr, val)
+#define USB_HALF_WORD_REG_READ(addr) ioread16_usb(addr)
-#define USB_WORD_REG_WRITE(addr, val) HAL_WORD_REG_WRITE(USB_CTRL_BASE_ADDRESS|(uint32_t)(addr), (val))
-#define USB_WORD_REG_READ(addr) HAL_WORD_REG_READ(USB_CTRL_BASE_ADDRESS|(uint32_t)(addr))
+#define USB_WORD_REG_WRITE(addr, val) iowrite32_usb(addr, val)
+#define USB_WORD_REG_READ(addr) ioread32_usb(addr)
/************************** Register Deinition ***************************/