agileRTOS (zrtos)  Version 0.8.0 (ghostbuster)
uart2.h File Reference
Include dependency graph for uart2.h:

Go to the source code of this file.

Functions

 ISR (UART2_RECEIVE_INTERRUPT)
 
 ISR (UART2_TRANSMIT_INTERRUPT, ISR_NOBLOCK)
 
zrtos_error_t zrtos_vfs_module_avr_uart2__on_mount (zrtos_vfs_dentry_t *thiz)
 
zrtos_error_t zrtos_vfs_module_avr_uart2__on_umount (zrtos_vfs_dentry_t *thiz)
 
zrtos_error_t zrtos_vfs_module_avr_uart2__on_write (zrtos_vfs_file_t *thiz, char *path, void *buf, size_t len, zrtos_vfs_offset_t offset, size_t *out)
 
 ZRTOS_VFS_PLUGIN__INIT (avr_uart2, ZRTOS_VFS_PLUGIN__0_ON_OPEN_DEFAULT() ZRTOS_VFS_PLUGIN__1_ON_CLOSE_DEFAULT() ZRTOS_VFS_PLUGIN__2_ON_MOUNT(zrtos_vfs_module_avr_uart2__on_mount) ZRTOS_VFS_PLUGIN__3_ON_UMOUNT(zrtos_vfs_module_avr_uart2__on_umount) ZRTOS_VFS_PLUGIN__4_ON_READ(zrtos_vfs_module_uart__on_read) ZRTOS_VFS_PLUGIN__5_ON_WRITE(zrtos_vfs_module_avr_uart2__on_write) ZRTOS_VFS_PLUGIN__6_ON_CAN_READ(zrtos_vfs_module_uart__on_can_read) ZRTOS_VFS_PLUGIN__7_ON_CAN_WRITE(zrtos_vfs_module_uart__on_can_write) ZRTOS_VFS_PLUGIN__8_ON_SEEK_DEFAULT() ZRTOS_VFS_PLUGIN__9_ON_IOCTL(zrtos_vfs_module_uart__on_ioctl))
 

Variables

zrtos_vfs_module_uart_inode_tzrtos_vfs_module_avr_uart2
 

Function Documentation

◆ ISR() [1/2]

ISR ( UART2_RECEIVE_INTERRUPT  )

Definition at line 18 of file uart2.h.

18  {
21  ,UART2_DATA
22  ,(
23  (UART2_STATUS & (_BV(FE2)|_BV(DOR2)|_BV(UPE2))) == 0
26  )
27  );
28 }
zrtos_vfs_module_uart_inode_t * zrtos_vfs_module_avr_uart2
Definition: uart2.h:16
void zrtos_vfs_module_avr_uart__on_receive_interrupt(zrtos_vfs_module_uart_inode_t *thiz, uint8_t data, zrtos_error_t err)
Successful program execution status.
Definition: error.h:22
I/O error.
Definition: error.h:29
Here is the call graph for this function:

◆ ISR() [2/2]

ISR ( UART2_TRANSMIT_INTERRUPT  ,
ISR_NOBLOCK   
)

Definition at line 30 of file uart2.h.

30  {
31  uint8_t tmp;
34  ,&tmp
35  )){
36  UART2_DATA = tmp;
37  }else{
38  UART2_CONTROL &= ~_BV(UART2_UDRIE);
39  }
40 }
zrtos_vfs_module_uart_inode_t * zrtos_vfs_module_avr_uart2
Definition: uart2.h:16
bool zrtos_vfs_module_avr_uart__on_transmit_interrupt(zrtos_vfs_module_uart_inode_t *thiz, uint8_t *data)
static uint8_t
Definition: mcp2515.h:159
Here is the call graph for this function:

◆ zrtos_vfs_module_avr_uart2__on_mount()

zrtos_error_t zrtos_vfs_module_avr_uart2__on_mount ( zrtos_vfs_dentry_t thiz)

Definition at line 42 of file uart2.h.

42  {
43  uint16_t baudrate;
47  thiz
48  )
49  );
50 
53  );
54 
55  //Set baud rate
57  UART2_STATUS = _BV(U2X2); //Enable 2x speed
58  baudrate &= ~0x8000;
59  }else{
60  UART2_STATUS = 0;
61  //UART2_STATUS &= ~_BV(U2X2);
62  }
63  UBRR2H = (uint8_t) (baudrate>>8);
64  UBRR2L = (uint8_t) baudrate;
65 
66  /* Enable USART receiver and transmitter and receive complete interrupt */
67  UART2_CONTROL = _BV(RXCIE2)|_BV(RXEN2)|_BV(TXEN2);
68  //UART2_CONTROL = _BV(RXCIE2)|_BV(TXEN2);
69 
70  /* Set frame format: asynchronous, 8data, no parity, 1stop bit */
71 #ifdef URSEL2
72  UCSR2C = _BV(URSEL2)|_BV(UCSZ21)|_BV(UCSZ20);
73 #else
74  UCSR2C = _BV(UCSZ21)|_BV(UCSZ20);
75 #endif
76 
77  return ZRTOS_ERROR__SUCCESS;
78 }
#define ZRTOS_CAST(type, value)
Definition: cast.h:18
zrtos_vfs_module_uart_baudrate_t baudrate
Definition: uart/uart.h:207
zrtos_vfs_module_uart_inode_t * zrtos_vfs_module_avr_uart2
Definition: uart2.h:16
#define ZRTOS_VFS_MODULE_AVR_UART__IS_DOUBLE_SPEED(baudrate)
Successful program execution status.
Definition: error.h:22
void * zrtos_vfs_dentry__get_inode_data(zrtos_vfs_dentry_t *thiz)
Definition: vfs_dentry.h:196
uint16_t zrtos_vfs_module_avr_uart__baud_select(zrtos_vfs_module_uart_baudrate_t baudrate)
static uint8_t
Definition: mcp2515.h:159
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zrtos_vfs_module_avr_uart2__on_umount()

zrtos_error_t zrtos_vfs_module_avr_uart2__on_umount ( zrtos_vfs_dentry_t thiz)

Definition at line 80 of file uart2.h.

80  {
81  UART2_CONTROL &= ~_BV(UART2_UDRIE);
82  return ZRTOS_ERROR__SUCCESS;
83 }
Successful program execution status.
Definition: error.h:22
Here is the caller graph for this function:

◆ zrtos_vfs_module_avr_uart2__on_write()

zrtos_error_t zrtos_vfs_module_avr_uart2__on_write ( zrtos_vfs_file_t thiz,
char *  path,
void *  buf,
size_t  len,
zrtos_vfs_offset_t  offset,
size_t out 
)

Definition at line 85 of file uart2.h.

92  {
94  thiz
95  ,path
96  ,buf
97  ,len
98  ,offset
99  ,out
100  );
101  if(zrtos_error__is_success(ret)){
102  UART2_CONTROL |= _BV(UART2_UDRIE);
103  }
104  return ret;
105 }
bool zrtos_error__is_success(zrtos_error_t thiz)
Definition: error.h:152
zrtos_error_t zrtos_vfs_module_uart__on_write(zrtos_vfs_file_t *thiz, char *path, void *buf, size_t len, zrtos_vfs_offset_t offset, size_t *out)
Definition: uart/uart.h:317
zrtos_error_t
Definition: error.h:20
Here is the call graph for this function:

◆ ZRTOS_VFS_PLUGIN__INIT()

Variable Documentation

◆ zrtos_vfs_module_avr_uart2

zrtos_vfs_module_uart_inode_t* zrtos_vfs_module_avr_uart2

Definition at line 16 of file uart2.h.