Skip to content

Commit cdc73f8

Browse files
David Huntcalvinatintel
David Hunt
authored andcommitted
Fixed redmine 2150 - inByte variable declaration issue
Signed-off-by: David Hunt <[email protected]>
1 parent 4489870 commit cdc73f8

File tree

2 files changed

+14
-52
lines changed

2 files changed

+14
-52
lines changed

system/libarc32_edu/common/board.h

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -169,54 +169,6 @@ This header file is used to specify and describe board-level aspects for the
169169

170170
#define UART_REG_ADDR_INTERVAL 4 /* for ns16550 driver */
171171

172-
/*
173-
* Device drivers utilize the macros PLB_BYTE_REG_WRITE() and
174-
* PLB_BYTE_REG_READ() to access byte-wide registers on the processor
175-
* local bus (PLB), as opposed to a PCI bus, for example. Boards are
176-
* expected to provide implementations of these macros.
177-
*/
178-
179-
#define PLB_BYTE_REG_WRITE(data, address) outByte(data, (unsigned int)address)
180-
#define PLB_BYTE_REG_READ(address) inByte((unsigned int)address)
181-
182-
/*******************************************************************************
183-
*
184-
* outByte - output byte to memory location
185-
*
186-
* RETURNS: N/A
187-
*
188-
* NOMANUAL
189-
*/
190-
191-
static inline void outByte(uint8_t data, uint32_t addr)
192-
{
193-
*(volatile uint8_t *)addr = data;
194-
}
195-
196-
/*******************************************************************************
197-
*
198-
* inByte - obtain byte value from memory location
199-
*
200-
* This function issues the 'move' instruction to read a byte from the specified
201-
* memory address.
202-
*
203-
* RETURNS: the byte read from the specified memory address
204-
*
205-
* NOMANUAL
206-
*/
207-
208-
static inline uint8_t inByte(uint32_t addr)
209-
{
210-
return *((volatile uint8_t *)addr);
211-
}
212-
213-
/*
214-
* Device drivers utilize the macros PLB_WORD_REG_WRITE() and
215-
* PLB_WORD_REG_READ() to access shortword-wide registers on the processor
216-
* local bus (PLB), as opposed to a PCI bus, for example. Boards are
217-
* expected to provide implementations of these macros.
218-
*/
219-
220172
#endif /* !_ASMLANGUAGE */
221173

222174
#endif /* _BOARD__H_ */

system/libarc32_edu/drivers/ns16550.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ A board support package's board.h header must provide definitions for:
4545
4646
- the following register access routines:
4747
48-
unsigned int inByte(unsigned int address);
49-
void outByte(unsigned char data, unsigned int address);
48+
unsigned int board_inByte(unsigned int address);
49+
void board_outByte(unsigned char data, unsigned int address);
5050
5151
- and the following macro for the number of bytes between register addresses:
5252
@@ -203,8 +203,18 @@ INCLUDE FILES: drivers/uart.h
203203

204204
#define IIRC(n) uart[n].iirCache
205205

206-
#define INBYTE(x) inByte(x)
207-
#define OUTBYTE(x, d) outByte(d, x)
206+
static inline void board_outByte(uint8_t data, uint32_t addr)
207+
{
208+
*(volatile uint8_t *)addr = data;
209+
}
210+
211+
static inline uint8_t board_inByte(uint32_t addr)
212+
{
213+
return *((volatile uint8_t *)addr);
214+
}
215+
216+
#define INBYTE(x) board_inByte(x)
217+
#define OUTBYTE(x, d) board_outByte(d, x)
208218

209219
/* typedefs */
210220

0 commit comments

Comments
 (0)