Skip to content

Commit

Permalink
Added support for linux kernel.
Browse files Browse the repository at this point in the history
- Also, removed standard includes from several files
  • Loading branch information
Daniele Lacamera committed Jan 7, 2015
1 parent 8717787 commit 4805e06
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 14 deletions.
34 changes: 34 additions & 0 deletions include/arch/pico_linux.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#ifndef PICO_SUPPORT_LINUX
#define PICO_SUPPORT_LINUX
#include "linux/types.h"
#include "linux/mm.h"
#include "linux/slab.h"
#include "linux/jiffies.h"
typedef u64 uint64_t;

#define dbg printk

#define pico_zalloc(x) kcalloc(x, 1, GFP_ATOMIC) /* All allocations are GFP_ATOMIC for now */
#define pico_free(x) kfree(x)



static inline unsigned long PICO_TIME(void)
{
return (unsigned long)(jiffies_to_msecs(jiffies) / 1000);
}

static inline unsigned long PICO_TIME_MS(void)
{
return (unsigned long)jiffies_to_msecs(jiffies);
}

static inline void PICO_IDLE(void)
{
unsigned long now = jiffies;
while (now == jiffies) {
;
}
}

#endif
1 change: 0 additions & 1 deletion include/pico_addressing.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#ifndef INCLUDE_PICO_ADDRESSING
#define INCLUDE_PICO_ADDRESSING

#include <stdint.h>
#include "pico_config.h"

PACKED_STRUCT_DEF pico_ip4
Expand Down
4 changes: 4 additions & 0 deletions include/pico_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#else
#include <linux/types.h>
#endif

#if defined __IAR_SYSTEMS_ICC__ || defined ATOP
Expand Down Expand Up @@ -210,6 +212,8 @@ static inline uint64_t long_long_be(uint64_t le)
# include "../test/pico_faulty.h"
#elif defined ARCHNONE
# include "arch/pico_none.h"
#elif defined __KERNEL__
# include "arch/pico_linux.h"


/* #elif defined ... */
Expand Down
2 changes: 1 addition & 1 deletion include/pico_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*********************************************************************/
#ifndef INCLUDE_PICO_PROTOCOL
#define INCLUDE_PICO_PROTOCOL
#include <stdint.h>
#include "pico_config.h"
#include "pico_queue.h"

#define PICO_LOOP_DIR_IN 1
Expand Down
1 change: 0 additions & 1 deletion include/pico_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*********************************************************************/
#ifndef INCLUDE_PICO_QUEUE
#define INCLUDE_PICO_QUEUE
#include <stdint.h>
#include "pico_config.h"
#include "pico_frame.h"

Expand Down
2 changes: 1 addition & 1 deletion include/pico_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "pico_tree.h"

#ifdef __linux__
#define PICO_DEFAULT_SOCKETQ (16 * 1024) /* Linux host, so we want full throttle */
#define PICO_DEFAULT_SOCKETQ (256 * 1024) /* Linux host, so we want full throttle */
#else
#define PICO_DEFAULT_SOCKETQ (6 * 1024) /* seems like an acceptable default for small embedded systems */
#endif
Expand Down
1 change: 0 additions & 1 deletion include/pico_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#ifndef PICO_RBTREE_H
#define PICO_RBTREE_H

#include <stdint.h>
#include "pico_config.h"

/* This is used to declare a new tree, leaf root by default */
Expand Down
1 change: 0 additions & 1 deletion modules/pico_dns_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#define PICO_DNS_NS_DEL 0
#define PICO_DNS_NS_ADD 1
#include <stdint.h>
#include "pico_config.h"

/* Compression values */
Expand Down
5 changes: 1 addition & 4 deletions modules/pico_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
Authors: Gustav Janssens, Jonas Van Nieuwenberg, Sam Van Den Berge
*********************************************************************/


#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include "pico_config.h"
#include "pico_mm.h"
#include "pico_tree.h"
#include "pico_config.h"
Expand Down
2 changes: 1 addition & 1 deletion modules/pico_mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef _INCLUDE_PICO_MM
#define _INCLUDE_PICO_MM

#include <stdint.h>
#include "pico_config.h"

/*
* Memory init function, this will create a memory manager instance
Expand Down
2 changes: 1 addition & 1 deletion modules/pico_socket_tcp.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <stdint.h>
#include "pico_config.h"
#include "pico_socket.h"
#include "pico_ipv4.h"
#include "pico_ipv6.h"
Expand Down
2 changes: 1 addition & 1 deletion modules/pico_socket_udp.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <stdint.h>
#include "pico_config.h"
#include "pico_socket.h"
#include "pico_udp.h"
#include "pico_socket_multicast.h"
Expand Down
2 changes: 1 addition & 1 deletion stack/pico_socket_multicast.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <stdint.h>
#include "pico_config.h"
#include "pico_stack.h"
#include "pico_socket.h"
#include "pico_socket_multicast.h"
Expand Down

0 comments on commit 4805e06

Please sign in to comment.