+++ /dev/null
-/* \r
- * Copyright Droids Corporation, Microb Technology, Eirbot (2005)\r
- * \r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * Revision : $Id: uart_private.h,v 1.1.2.5 2009-01-03 16:24:50 zer0 Exp $\r
- *\r
- */\r
-\r
-/* Olivier MATZ, Droids-corp 2004 - 2009 */\r
-\r
-#ifndef _UART_PRIVATE_H_\r
-#define _UART_PRIVATE_H_\r
-\r
-#include <aversive.h>\r
-#include <aversive/list.h>\r
-\r
-#include <uart.h>\r
-#include <uart_defs.h>\r
-#include <uart_config.h>\r
-\r
-typedef volatile uint8_t *uart_reg_t;\r
-\r
-struct regs {\r
- uart_reg_t udr;\r
- uart_reg_t ucsra;\r
- uart_reg_t ucsrb;\r
- uart_reg_t ucsrc;\r
- uart_reg_t ubrrl;\r
- uart_reg_t ubrrh;\r
-};\r
-\r
-const struct regs uart_regs[UART_HW_NUM];\r
-\r
-typedef void (event)(char);\r
-typedef void (event_9bits)(int);\r
-\r
-extern event *rx_event[UART_HW_NUM];\r
-extern event *tx_event[UART_HW_NUM];\r
-\r
-void uart_send_next_char(uint8_t num);\r
-int8_t uart_setconf(uint8_t num, struct uart_config *u);\r
-\r
-static inline char uart_get_udr(uint8_t num)\r
-{\r
- return *uart_regs[num].udr;\r
-}\r
-\r
-static inline void uart_set_udr(uint8_t num, char c)\r
-{\r
- *uart_regs[num].udr = c;\r
- /* tx event function. We suppose interrupts are already\r
- * locked, so no pb with tx_event pointer */\r
- if (tx_event[num])\r
- tx_event[num](c);\r
-}\r
-\r
-#ifdef CONFIG_MODULE_UART_9BITS\r
-static inline int uart_get_udr_9bits(uint8_t num)\r
-{\r
- int val = *uart_regs[num].udr;\r
- val |= (*uart_regs[num].ucsrb & ((1 << RXB8) ? 0x100 : 0));\r
- return val;\r
-}\r
-\r
-static inline void uart_set_udr_9bits(uint8_t num, int c)\r
-{\r
- if (c & 0x100 )\r
- *uart_regs[num].ucsrb |= (1 << RXB8);\r
- else\r
- *uart_regs[num].ucsrb &= ~(1 << RXB8);\r
- *uart_regs[num].udr = c;\r
-\r
- /* tx event function. We suppose interrupts are already\r
- * locked, so no pb with tx_event pointer */\r
- if (tx_event[num])\r
- ((event_9bits *)tx_event[num])(c);\r
-}\r
-#endif /* CONFIG_MODULE_UART_9BITS */\r
-\r
-#endif /* _UART_PRIVATE_H_ */\r