Update the optimized AVR8 example implementation.
[openwrt/svn-archive/archive.git] / utils / ucmb / microcontroller_examples / atmel_avr8_optimized / ucmb.h
1 #ifndef UCMB_AVR8_H_
2 #define UCMB_AVR8_H_
3
4 #include <stdint.h>
5
6
7 /* Max length of the message payload. */
8 #define UCMB_MAX_MSG_LEN (128 * 64 / 8 + 16)
9
10 /* Error logs: If you want UCMB error log messages, define
11 * ucmb_errorlog(message_string_literal)
12 * somewhere. If you don't define it, UCMB will be compiled
13 * without error messages. */
14
15 /* ucmb_rx_message - Message receive callback.
16 * Define this elsewhere. It's called on successful retrieval
17 * of a new message.
18 * If a reply message has to be transferred after this one, put the
19 * message payload into the "payload" buffer and return the number
20 * of bytes to transmit. If no reply message is needed, return 0.
21 * Note that the "payload" buffer always has a size of UCMB_MAX_MSG_LEN.
22 * This function is called with interrupts enabled.
23 */
24 extern uint16_t ucmb_rx_message(uint8_t *payload,
25 uint16_t payload_length);
26
27 /* ucmb_work - Frequently call this from the mainloop.
28 * Must not be called from interrupt context.
29 * Must not be called with interrupts disabled.
30 */
31 void ucmb_work(void);
32
33 /* Initialize the UCMB subsystem. */
34 void ucmb_init(void);
35
36 #endif /* UCMB_AVR8_H_ */