added more networking routines

This commit is contained in:
Markus Fröschle
2013-12-23 14:14:25 +00:00
parent 53f45bc7cc
commit 53dcc23bd6
9 changed files with 1152 additions and 52 deletions

View File

@@ -97,4 +97,11 @@
extern int register_interrupt_handler(uint8_t source, uint8_t level, uint8_t priority, uint8_t intr, void (*handler)(void));
#define ISR_DBUG_ISR 0x01
#define ISR_USER_ISR 0x02
extern void isr_init(void);
extern int isr_register_handler(int type, int vector, int (*handler)(void *, void *), void *hdev, void *harg);
extern void isr_remove_handler(int type ,int (*handler)(void *, void *));
extern bool isr_execute_handler(int vector);
#endif /* _INTERRUPTS_H_ */

33
include/net_timer.h Normal file
View File

@@ -0,0 +1,33 @@
/*
* File: net_timer.h
* Purpose: Provide a timer use by the dBUG network as a timeout
* indicator
*
* Notes:
*/
#ifndef _TIMER_H_
#define _TIMER_H_
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
typedef struct
{
uint8_t ch; /* which channel is this structure for? */
uint8_t lvl; /* Interrupt level for this channel */
uint8_t pri; /* Interrupt priority for this channel */
uint8_t reference; /* timeout indicator */
uint32_t gms; /* mode select register value */
uint16_t pre; /* prescale value */
uint16_t cnt; /* prescaled clocks for timeout */
} NET_TIMER;
extern bool timer_init(uint8_t, uint8_t, uint8_t);
/* Vector numbers for all the timer channels */
#define TIMER_VECTOR(x) (126-x)
#endif /* _TIMER_H_ */