Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 1 | /* |
| 2 | ************************************************************************* |
| 3 | * Ralink Tech Inc. |
| 4 | * 5F., No.36, Taiyuan St., Jhubei City, |
| 5 | * Hsinchu County 302, |
| 6 | * Taiwan, R.O.C. |
| 7 | * |
| 8 | * (c) Copyright 2002-2007, Ralink Technology, Inc. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify * |
| 11 | * it under the terms of the GNU General Public License as published by * |
| 12 | * the Free Software Foundation; either version 2 of the License, or * |
| 13 | * (at your option) any later version. * |
| 14 | * * |
| 15 | * This program is distributed in the hope that it will be useful, * |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 18 | * GNU General Public License for more details. * |
| 19 | * * |
| 20 | * You should have received a copy of the GNU General Public License * |
| 21 | * along with this program; if not, write to the * |
| 22 | * Free Software Foundation, Inc., * |
| 23 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
| 24 | * * |
| 25 | ************************************************************************* |
| 26 | |
| 27 | Module Name: |
| 28 | rtmp_os.h |
| 29 | |
| 30 | Abstract: |
| 31 | |
| 32 | Revision History: |
| 33 | Who When What |
| 34 | --------- ---------- ---------------------------------------------- |
| 35 | */ |
| 36 | |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 37 | #ifndef __RTMP_OS_H__ |
| 38 | #define __RTMP_OS_H__ |
| 39 | |
| 40 | #ifdef LINUX |
| 41 | #include "rt_linux.h" |
Bartlomiej Zolnierkiewicz | cc27706 | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 42 | #endif /* LINUX // */ |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 43 | |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 44 | /* |
| 45 | This data structure mainly strip some callback function defined in |
| 46 | "struct net_device" in kernel source "include/linux/netdevice.h". |
| 47 | |
| 48 | The definition of this data structure may various depends on different |
| 49 | OS. Use it carefully. |
| 50 | */ |
Bartlomiej Zolnierkiewicz | 62eb734 | 2009-12-11 12:23:16 -0800 | [diff] [blame] | 51 | struct rt_rtmp_os_netdev_op_hook { |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 52 | const struct net_device_ops *netdev_ops; |
Bartlomiej Zolnierkiewicz | 52b81c8 | 2009-12-11 12:23:14 -0800 | [diff] [blame] | 53 | void *priv; |
| 54 | int priv_flags; |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 55 | unsigned char devAddr[6]; |
Bartlomiej Zolnierkiewicz | 52b81c8 | 2009-12-11 12:23:14 -0800 | [diff] [blame] | 56 | unsigned char devName[16]; |
| 57 | unsigned char needProtcted; |
Bartlomiej Zolnierkiewicz | 62eb734 | 2009-12-11 12:23:16 -0800 | [diff] [blame] | 58 | }; |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 59 | |
Bartlomiej Zolnierkiewicz | 52b81c8 | 2009-12-11 12:23:14 -0800 | [diff] [blame] | 60 | typedef enum _RTMP_TASK_STATUS_ { |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 61 | RTMP_TASK_STAT_UNKNOWN = 0, |
| 62 | RTMP_TASK_STAT_INITED = 1, |
| 63 | RTMP_TASK_STAT_RUNNING = 2, |
| 64 | RTMP_TASK_STAT_STOPED = 4, |
Bartlomiej Zolnierkiewicz | 52b81c8 | 2009-12-11 12:23:14 -0800 | [diff] [blame] | 65 | } RTMP_TASK_STATUS; |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 66 | #define RTMP_TASK_CAN_DO_INSERT (RTMP_TASK_STAT_INITED |RTMP_TASK_STAT_RUNNING) |
| 67 | |
| 68 | #define RTMP_OS_TASK_NAME_LEN 16 |
Bartlomiej Zolnierkiewicz | 62eb734 | 2009-12-11 12:23:16 -0800 | [diff] [blame] | 69 | struct rt_rtmp_os_task { |
Bartlomiej Zolnierkiewicz | 52b81c8 | 2009-12-11 12:23:14 -0800 | [diff] [blame] | 70 | char taskName[RTMP_OS_TASK_NAME_LEN]; |
| 71 | void *priv; |
Bartlomiej Zolnierkiewicz | cc27706 | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 72 | /*unsigned long taskFlags; */ |
Bartlomiej Zolnierkiewicz | 52b81c8 | 2009-12-11 12:23:14 -0800 | [diff] [blame] | 73 | RTMP_TASK_STATUS taskStatus; |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 74 | #ifndef KTHREAD_SUPPORT |
Bartlomiej Zolnierkiewicz | 8a10a54 | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 75 | struct semaphore taskSema; |
| 76 | struct pid *taskPID; |
Bartlomiej Zolnierkiewicz | 52b81c8 | 2009-12-11 12:23:14 -0800 | [diff] [blame] | 77 | struct completion taskComplete; |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 78 | #endif |
Bartlomiej Zolnierkiewicz | 52b81c8 | 2009-12-11 12:23:14 -0800 | [diff] [blame] | 79 | unsigned char task_killed; |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 80 | #ifdef KTHREAD_SUPPORT |
Bartlomiej Zolnierkiewicz | 52b81c8 | 2009-12-11 12:23:14 -0800 | [diff] [blame] | 81 | struct task_struct *kthread_task; |
| 82 | wait_queue_head_t kthread_q; |
| 83 | BOOLEAN kthread_running; |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 84 | #endif |
Bartlomiej Zolnierkiewicz | 62eb734 | 2009-12-11 12:23:16 -0800 | [diff] [blame] | 85 | }; |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 86 | |
Bartlomiej Zolnierkiewicz | 8a10a54 | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 87 | int RtmpOSIRQRequest(struct net_device *pNetDev); |
| 88 | int RtmpOSIRQRelease(struct net_device *pNetDev); |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 89 | |
Bartlomiej Zolnierkiewicz | cc27706 | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 90 | #endif /* __RMTP_OS_H__ // */ |