|
From: <jmk...@us...> - 2003-08-14 04:43:12
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv13345/src/rtapi
Modified Files:
rtai_rtapi.c rtapi.h
Log Message:
Converted shared memory and semaphores from handles to IDs. Added more /proc entries. Examples work under RTAI. Still need to convert fifos.
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** rtai_rtapi.c 13 Aug 2003 05:55:07 -0000 1.22
--- rtai_rtapi.c 14 Aug 2003 04:08:26 -0000 1.23
***************
*** 77,81 ****
/* These structs hold data associated with objects like tasks, etc. */
- /* Task handles are pointers to these structs. */
typedef enum { EMPTY, PAUSED, PERIODIC, FREERUN, ENDED } state_t;
--- 77,80 ----
***************
*** 87,101 ****
} task_data;
[...1147 lines suppressed...]
+
+ return RTAPI_SUCCESS;
+ }
+
+ /***********************************************************************
+ * I/O RELATED FUNCTIONS *
+ ************************************************************************/
+
+ void rtapi_outb(unsigned char byte, unsigned int port)
+ {
+ outb(byte, port);
+ }
+
+
+ unsigned char rtapi_inb(unsigned int port)
+ {
+ return inb(port);
+ }
+
+
Index: rtapi.h
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtapi.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** rtapi.h 13 Aug 2003 05:55:07 -0000 1.19
--- rtapi.h 14 Aug 2003 04:08:26 -0000 1.20
***************
*** 65,71 ****
/* SEE, it's happening... tasks are now referred to by int task id's */
! /* the others will change soon */
! typedef struct rtapi_shmem *rtapi_shmem_handle;
! typedef struct rtapi_sem *rtapi_sem_handle;
typedef struct rtapi_fifo *rtapi_fifo_handle;
--- 65,69 ----
/* SEE, it's happening... tasks are now referred to by int task id's */
! /* the others will change soon. update - only fifos are left */
typedef struct rtapi_fifo *rtapi_fifo_handle;
***************
*** 182,186 ****
* either rtapi_task_start() for periodic tasks, or rtapi_task_resume() *
* for free-running tasks. *
! * On success, returns a non-negative integer task ID. This ID is used *
* for all subsequent calls that need to act on the task. On failure, *
* returns a negative error code as listed above. *
--- 180,184 ----
* either rtapi_task_start() for periodic tasks, or rtapi_task_resume() *
* for free-running tasks. *
! * On success, returns a positive integer task ID. This ID is used *
* for all subsequent calls that need to act on the task. On failure, *
* returns a negative error code as listed above. *
***************
*** 282,309 ****
/** 'rtapi_shmem_new()' allocates a block of shared memory. 'key' *
! * identifies the memory block, all modules wishing to access the same *
! * memory must use the same key. The block will be at least 'size' *
! * bytes, and may be rounded up. Allocating many small blocks may be *
! * very wasteful. On success, '*shmemptr' becomes a handle pointing *
! * to internal data for the shared memory and is used for subsequent *
! * calls dealing with the block. Remember that '*shmemptr' points to *
! * internal data, not the actual shared memory. To get a pointer to *
! * the shared memory, pass the handle to 'rtapi_shmem_getptr()'. *
! * Returns a status code. */
!
! extern int rtapi_shmem_new(int key, unsigned long int size,
! rtapi_shmem_handle * shmemptr);
- /** 'rtapi_shmem_getptr()' sets '*ptr' to point to the start of the *
- * shared memory block 'mbuf'. Returns a status code. */
! extern int rtapi_shmem_getptr(rtapi_shmem_handle shmem, void **ptr);
! /** 'rtapi_shmem_delete()' frees the shared memory block 'mbuf'. *
! * Returns a status code. */
! extern int rtapi_shmem_delete(rtapi_shmem_handle shmem);
--- 280,304 ----
/** 'rtapi_shmem_new()' allocates a block of shared memory. 'key' *
! * identifies the memory block, and must be non-zero. All modules *
! * wishing to access the same memory must use the same key. *
! * The block will be at least 'size' bytes, and may be rounded up. *
! * Allocating many small blocks may be very wasteful. On success, it *
! * returns a positive integer ID, which is used for all subsequent *
! * calls dealing with the block. On failure it returns a negative *
! * error code. To get a pointer to the shared memory, pass the ID to *
! * 'rtapi_shmem_getptr()'. */
+ extern int rtapi_shmem_new(int key, unsigned long int size );
! /** 'rtapi_shmem_delete()' frees the shared memory block associated *
! * with 'shmem_id'. Returns a status code. */
+ extern int rtapi_shmem_delete(int shmem_id);
! /** 'rtapi_shmem_getptr()' sets '*ptr' to point to shared memory block *
! * associated with 'shmem_id'. Returns a status code. */
! extern int rtapi_shmem_getptr(int shmem_id, void **ptr);
***************
*** 312,328 ****
************************************************************************/
! /** 'rtapi_sem_new()' creates a realtime semaphore. On success, *
! * '*semptr' becomes a semaphore handle, which points to internal data *
! * for the semaphore is used for subsequent calls dealing with it. *
! * Returns a status code. */
! extern int rtapi_sem_new(rtapi_sem_handle * semptr);
/** 'rtapi_sem_delete()' is the counterpart to 'rtapi_sem_new()'. It *
! * destroys the semaphore 'sem'. Any tasks blocked on 'sem' will *
! * resume execution. Returns a status code. */
! extern int rtapi_sem_delete(rtapi_sem_handle sem);
--- 307,325 ----
************************************************************************/
! /** 'rtapi_sem_new()' creates a realtime semaphore. 'key' identifies *
! * identifies the semaphore, and must be non-zero. All modules wishing *
! * to use the same semaphore must specify the same key. On success, it *
! * returns a positive integer ID, which is used for all subsequent *
! * calls dealing with the semaphore. On failure it returns a negative *
! * error code. */
! extern int rtapi_sem_new(int key);
/** 'rtapi_sem_delete()' is the counterpart to 'rtapi_sem_new()'. It *
! * discards the semaphore associated with 'sem_id'. Any tasks blocked *
! * on 'sem' will resume execution. Returns a status code. */
! extern int rtapi_sem_delete(int sem_id);
***************
*** 331,335 ****
* higher priority task will begin to run. Returns a status code. */
! extern int rtapi_sem_give(rtapi_sem_handle sem);
--- 328,332 ----
* higher priority task will begin to run. Returns a status code. */
! extern int rtapi_sem_give(int sem_id);
***************
*** 339,343 ****
* until the semaphore is unlocked, then it returns RTAPI_SUCCESS. */
! extern int rtapi_sem_take(rtapi_sem_handle sem);
--- 336,340 ----
* until the semaphore is unlocked, then it returns RTAPI_SUCCESS. */
! extern int rtapi_sem_take(int sem_id);
***************
*** 348,352 ****
* decide how to deal with the situation. */
! extern int rtapi_sem_try(rtapi_sem_handle sem);
--- 345,349 ----
* decide how to deal with the situation. */
! extern int rtapi_sem_try(int sem_id);
|