OR1K support
 All Functions Typedefs Groups
or1k-support.h
1 /* Copyright (c) 2014 Authors
2  *
3  * Contributor Julius Baxter <julius.baxter@orsoc.se>
4  * Contributor Stefan Wallentowitz <stefan.wallentowitz@tum.de>
5  *
6  * The authors hereby grant permission to use, copy, modify, distribute,
7  * and license this software and its documentation for any purpose, provided
8  * that existing copyright notices are retained in all copies and that this
9  * notice is included verbatim in any distributions. No written agreement,
10  * license, or royalty fee is required for any of the authorized uses.
11  * Modifications to this software may be copyrighted by their authors
12  * and need not follow the licensing terms described here, provided that
13  * the new terms are clearly indicated on the first page of each file where
14  * they apply.
15  */
16 
17 /* -------------------------------------------------------------------------- */
18 /* This program is commented throughout in a fashion suitable for processing
19 with Doxygen. */
20 /* -------------------------------------------------------------------------- */
21 
22 #include <stdint.h>
23 
24 #ifndef __OR1K_SUPPORT_H__
25 #define __OR1K_SUPPORT_H__
26 
47 #define REG8(add) *((volatile unsigned char *) (add))
48 
59 #define REG16(add) *((volatile unsigned short *) (add))
60 
71 #define REG32(add) *((volatile unsigned long *) (add))
72 
85 typedef void (*or1k_interrupt_handler_fptr)(void* data);
86 
96 void or1k_interrupt_handler_add(uint32_t line,
98  void* data);
99 
108 void or1k_interrupt_enable(int line);
109 
117 void or1k_interrupt_disable(int line);
118 
146 uint32_t or1k_interrupts_disable(void);
147 
159 void or1k_interrupts_enable(void);
160 
175 void or1k_interrupts_restore(uint32_t status);
176 
195 uint32_t or1k_critical_start();
196 
205 void or1k_critical_end(uint32_t restore);
215 typedef void (*or1k_exception_handler_fptr)(void);
216 
245 static inline void or1k_mtspr (uint32_t spr, uint32_t value)
246 {
247  __asm__ __volatile__ ("l.mtspr\t\t%0,%1,0": : "r" (spr), "r" (value));
248 }
249 
258 static inline uint32_t or1k_mfspr (uint32_t spr) {
259  uint32_t value;
260  __asm__ __volatile__ ("l.mfspr\t\t%0,%1,0" : "=r" (value) : "r" (spr));
261  return value;
262 }
280 void or1k_report (unsigned long int value);
281 
289 unsigned long int or1k_rand(void);
290 
312 void or1k_uart_set_read_cb(void (*cb)(char c));
326 void or1k_icache_enable(void);
327 
331 void or1k_icache_disable(void);
332 
340 void or1k_icache_flush(uint32_t entry);
341 
345 void or1k_dcache_enable(void);
346 
350 void or1k_dcache_disable(void);
351 
359 void or1k_dcache_flush(unsigned long entry);
372 void or1k_immu_enable(void);
373 
377 void or1k_immu_disable(void);
378 
382 void or1k_dmmu_enable(void);
383 
387 void or1k_dmmu_disable(void);
478 int or1k_timer_init(unsigned int hz);
479 
486 void or1k_timer_set_period(uint32_t hz);
487 
496 void or1k_timer_set_handler(void (*handler)(void));
497 
508 void or1k_timer_set_mode(uint32_t mode);
509 
520 void or1k_timer_enable(void);
521 
534 uint32_t or1k_timer_disable(void);
535 
545 void or1k_timer_restore(uint32_t sr_tee);
546 
554 void or1k_timer_pause(void);
555 
559 void or1k_timer_reset(void);
560 
569 unsigned long or1k_timer_get_ticks(void);
570 
576 void or1k_timer_reset_ticks(void);
592 uint32_t or1k_coreid(void);
593 
599 uint32_t or1k_numcores(void);
600 
611 uint32_t or1k_sync_ll(void *address);
612 
626 int or1k_sync_sc(void *address, uint32_t value);
627 
641 uint32_t or1k_sync_cas(void *address, uint32_t compare, uint32_t swap);
642 
653 int or1k_sync_tsl(void *address);
658 #endif /* __NEWLIB_OR1K_SUPPORT_H__ */
void or1k_interrupt_enable(int line)
void or1k_report(unsigned long int value)
void or1k_interrupt_disable(int line)
void or1k_timer_set_period(uint32_t hz)
void(* or1k_interrupt_handler_fptr)(void *data)
Definition: or1k-support.h:85
void(* or1k_exception_handler_fptr)(void)
Definition: or1k-support.h:215
void or1k_critical_end(uint32_t restore)
void or1k_timer_set_mode(uint32_t mode)
uint32_t or1k_critical_start()
uint32_t or1k_numcores(void)
uint32_t or1k_sync_ll(void *address)
void or1k_timer_restore(uint32_t sr_tee)
uint32_t or1k_interrupts_disable(void)
void or1k_icache_disable(void)
void or1k_immu_enable(void)
uint32_t or1k_coreid(void)
int or1k_sync_sc(void *address, uint32_t value)
int or1k_sync_tsl(void *address)
void or1k_timer_enable(void)
void or1k_dcache_flush(unsigned long entry)
void or1k_exception_handler_add(int id, or1k_exception_handler_fptr handler)
unsigned long or1k_timer_get_ticks(void)
void or1k_dmmu_enable(void)
void or1k_icache_flush(uint32_t entry)
void or1k_dmmu_disable(void)
unsigned long int or1k_rand(void)
void or1k_immu_disable(void)
void or1k_interrupts_enable(void)
void or1k_icache_enable(void)
void or1k_interrupts_restore(uint32_t status)
uint32_t or1k_sync_cas(void *address, uint32_t compare, uint32_t swap)
void or1k_timer_set_handler(void(*handler)(void))
void or1k_timer_pause(void)
void or1k_timer_reset(void)
int or1k_timer_init(unsigned int hz)
void or1k_uart_set_read_cb(void(*cb)(char c))
uint32_t or1k_timer_disable(void)
void or1k_interrupt_handler_add(uint32_t line, or1k_interrupt_handler_fptr handler, void *data)
void or1k_timer_reset_ticks(void)
void or1k_dcache_disable(void)
void or1k_dcache_enable(void)