- refactored libsys
- added critical section - added interrupt global enable/disable - added console::getInstanveByName git-svn-id: http://moon:8086/svn/mips@76 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
@@ -20,6 +20,18 @@ uart_if_t uart_if[2] =
|
||||
// ------------------------------------
|
||||
// Low-level I/O
|
||||
// ------------------------------------
|
||||
#define CALC_BAUD(b) \
|
||||
((uint32_t)((float)CPU_FREQ_HZ/(16*b) + 0.5f) - 1);
|
||||
|
||||
void UART_setbaud(void const *pInst, uint32_t baudrate)
|
||||
{
|
||||
assert(pInst);
|
||||
|
||||
uart_if_t *pReg = (uart_if_t*)pInst;
|
||||
|
||||
*pReg->pBAUD = CALC_BAUD(baudrate);
|
||||
}
|
||||
|
||||
int UART_readchar(void const *pInst)
|
||||
{
|
||||
assert(pInst);
|
||||
|
||||
Reference in New Issue
Block a user