aboutsummaryrefslogtreecommitdiffstats
path: root/tmk_core/common/eeprom.h
blob: 2cc2ccee3f74cdbcb81e3df29e00a2f88795d699 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef TMK_CORE_COMMON_EEPROM_H_
#define TMK_CORE_COMMON_EEPROM_H_

#if defined(__AVR__)
#include <avr/eeprom.h>
#else
uint8_t 	eeprom_read_byte (const uint8_t *__p);
uint16_t 	eeprom_read_word (const uint16_t *__p);
uint32_t 	eeprom_read_dword (const uint32_t *__p);
void 	eeprom_read_block (void *__dst, const void *__src, uint32_t __n);
void 	eeprom_write_byte (uint8_t *__p, uint8_t __value);
void 	eeprom_write_word (uint16_t *__p, uint16_t __value);
void 	eeprom_write_dword (uint32_t *__p, uint32_t __value);
void 	eeprom_write_block (const void *__src, void *__dst, uint32_t __n);
void 	eeprom_update_byte (uint8_t *__p, uint8_t __value);
void 	eeprom_update_word (uint16_t *__p, uint16_t __value);
void 	eeprom_update_dword (uint32_t *__p, uint32_t __value);
void 	eeprom_update_block (const void *__src, void *__dst, uint32_t __n);
#endif


#endif /* TMK_CORE_COMMON_EEPROM_H_ */
" callq *%%rax; " \ "1: movq %%rax,%c4(%0)\n" \ ".section .fixup,\"ax\"\n" \ "2: movq $-"STR(ENOSYS)",%%rax\n" \ " jmp 1b\n" \ ".previous\n" \ : \ : "b" (_call), \ "i" (offsetof(__typeof__(*_call), op)), \ "i" (offsetof(__typeof__(*_call), args)), \ "i" (sizeof(*(_call)->args)), \ "i" (offsetof(__typeof__(*_call), result)) \ /* all the caller-saves registers */ \ : "rax", "rcx", "rdx", "rsi", "rdi", \ "r8", "r9", "r10", "r11" ); \ } while ( 0 ) #define compat_multicall_call(_call) \ __asm__ __volatile__ ( \ " movl %c1(%0),%%eax; " \ " leaq compat_hypercall_table(%%rip),%%rdi; "\ " cmpl $("STR(NR_hypercalls)"),%%eax; " \ " jae 2f; " \ " movq (%%rdi,%%rax,8),%%rax; " \ " movl %c2+0*%c3(%0),%%edi; " \ " movl %c2+1*%c3(%0),%%esi; " \ " movl %c2+2*%c3(%0),%%edx; " \ " movl %c2+3*%c3(%0),%%ecx; " \ " movl %c2+4*%c3(%0),%%r8d; " \ " callq *%%rax; " \ "1: movl %%eax,%c4(%0)\n" \ ".section .fixup,\"ax\"\n" \ "2: movl $-"STR(ENOSYS)",%%eax\n" \ " jmp 1b\n" \ ".previous\n" \ : \ : "b" (_call), \ "i" (offsetof(__typeof__(*_call), op)), \ "i" (offsetof(__typeof__(*_call), args)), \ "i" (sizeof(*(_call)->args)), \ "i" (offsetof(__typeof__(*_call), result)) \ /* all the caller-saves registers */ \ : "rax", "rcx", "rdx", "rsi", "rdi", \ "r8", "r9", "r10", "r11" ) \ #else #define do_multicall_call(_call) \ __asm__ __volatile__ ( \ " movl %c1(%0),%%eax; " \ " pushl %c2+4*%c3(%0); " \ " pushl %c2+3*%c3(%0); " \ " pushl %c2+2*%c3(%0); " \ " pushl %c2+1*%c3(%0); " \ " pushl %c2+0*%c3(%0); " \ " cmpl $("STR(NR_hypercalls)"),%%eax; " \ " jae 2f; " \ " call *hypercall_table(,%%eax,4); " \ "1: movl %%eax,%c4(%0); " \ " addl $20,%%esp\n" \ ".section .fixup,\"ax\"\n" \ "2: movl $-"STR(ENOSYS)",%%eax\n" \ " jmp 1b\n" \ ".previous\n" \ : \ : "bSD" (_call), \ "i" (offsetof(__typeof__(*_call), op)), \ "i" (offsetof(__typeof__(*_call), args)), \ "i" (sizeof(*(_call)->args)), \ "i" (offsetof(__typeof__(*_call), result)) \ /* all the caller-saves registers */ \ : "eax", "ecx", "edx" ) \ #endif #endif /* __ASM_X86_MULTICALL_H__ */