source:
rtems/c/src/libchip/shmdr/poll.c
@
dd9cc9f7
Last change on this file since dd9cc9f7 was 5c980d0, checked in by Joel Sherrill <joel.sherrill@…>, on 09/05/08 at 14:48:37 | |
---|---|
|
|
File size: 1.2 KB |
Rev | Line | |
---|---|---|
[5c980d0] | 1 | /* |
[ac7d5ef0] | 2 | * This routine polls to see if a packet has arrived. If one |
[5c980d0] | 3 | * has it informs the executive. It uses a Classic API Timer |
[ac7d5ef0] | 4 | * |
[5c980d0] | 5 | * COPYRIGHT (c) 1989-2008. |
[ac7d5ef0] | 6 | * On-Line Applications Research Corporation (OAR). |
7 | * | |
[98e4ebf5] | 8 | * The license and distribution terms for this file may be |
9 | * found in the file LICENSE in this distribution or at | |
[4e89a12] | 10 | * http://www.rtems.com/license/LICENSE. |
[ac7d5ef0] | 11 | * |
[b06e68ef] | 12 | * $Id$ |
[ac7d5ef0] | 13 | */ |
14 | ||
15 | #include <rtems.h> | |
[5e9b32b] | 16 | #include <rtems/score/sysstate.h> |
[b06e68ef] | 17 | #include <rtems/libio.h> |
18 | ||
[5c980d0] | 19 | #include <assert.h> |
20 | ||
[48bfd992] | 21 | #include "shm_driver.h" |
[ac7d5ef0] | 22 | |
[5c980d0] | 23 | rtems_timer_service_routine Shm_Poll_TSR( |
24 | rtems_id id, | |
25 | void *ignored_address | |
26 | ) | |
[ac7d5ef0] | 27 | { |
[5c980d0] | 28 | uint32_t tmpfront; |
[88d594a] | 29 | |
30 | /* | |
[5c980d0] | 31 | * This should NEVER happen but just in case. |
[88d594a] | 32 | */ |
[5c980d0] | 33 | if (!_System_state_Is_up(_System_state_Get())) |
34 | return; | |
[a3d3d9a] | 35 | |
[5c980d0] | 36 | tmpfront = Shm_Local_receive_queue->front; |
37 | if ( Shm_Convert(tmpfront) != Shm_Locked_queue_End_of_list ) { | |
38 | rtems_multiprocessing_announce(); | |
39 | Shm_Interrupt_count++; | |
[88d594a] | 40 | } |
[5c980d0] | 41 | |
42 | (void) rtems_timer_reset( id ); | |
[ac7d5ef0] | 43 | } |
[5c980d0] | 44 | |
45 | void Shm_install_timer(void) | |
46 | { | |
47 | rtems_id id; | |
48 | rtems_status_code status; | |
49 | ||
50 | status = rtems_timer_create( rtems_build_name( 'S', 'H', 'P', 'L' ), &id ); | |
51 | assert( !status ); | |
52 | ||
53 | status = rtems_timer_fire_after( id, 1, Shm_Poll_TSR, NULL ); | |
54 | assert( !status ); | |
55 | } | |
56 |
Note: See TracBrowser
for help on using the repository browser.