]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Remove unused prototypes.
authorMichael Jerris <mike@jerris.com>
Sun, 3 Jun 2007 02:56:56 +0000 (02:56 +0000)
committerMichael Jerris <mike@jerris.com>
Sun, 3 Jun 2007 02:56:56 +0000 (02:56 +0000)
Add function pointer typedef.
Switch to use /* */ comments to survive pickier compile flags.
Add dsp_uart_destroy function (takes ** pointer so it can set the pointer back to NULL)

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@200 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/freetdm/src/dsp/uart.c
libs/freetdm/src/dsp/uart.h

index cbd81b22366c5b4f088b7a4281ffd96eb5702413..c6e2105fccc2290eee28806fe23a2a148fbde9f0 100644 (file)
@@ -46,8 +46,7 @@
  *     attributes structure is used.
 */
 
-void
-dsp_uart_attr_init (dsp_uart_attr_t *attr)
+void dsp_uart_attr_init (dsp_uart_attr_t *attr)
 {
        memset (attr, 0, sizeof (*attr));
 }
@@ -61,22 +60,19 @@ dsp_uart_attr_init (dsp_uart_attr_t *attr)
  *     zero == ok, -1 == fail.
 */
 
-void (*
-dsp_uart_attr_get_bytehandler (dsp_uart_attr_t *attr, void **bytehandler_arg)) (void *, int)
+bytehandler_func_t dsp_uart_attr_get_bytehandler (dsp_uart_attr_t *attr, void **bytehandler_arg)
 {
        *bytehandler_arg = attr -> bytehandler_arg;
        return (attr -> bytehandler);
 }
 
-void
-dsp_uart_attr_set_bytehandler (dsp_uart_attr_t *attr, void (*bytehandler) (void *, int ), void *bytehandler_arg)
+void dsp_uart_attr_set_bytehandler (dsp_uart_attr_t *attr, bytehandler_func_t bytehandler, void *bytehandler_arg)
 {
        attr -> bytehandler = bytehandler;
        attr -> bytehandler_arg = bytehandler_arg;
 }
 
-dsp_uart_handle_t *
-dsp_uart_create (dsp_uart_attr_t *attr)
+dsp_uart_handle_t *dsp_uart_create (dsp_uart_attr_t *attr)
 {
        dsp_uart_handle_t       *handle;
 
@@ -86,21 +82,28 @@ dsp_uart_create (dsp_uart_attr_t *attr)
        }
        memset (handle, 0, sizeof (handle));
 
-       // fill the attributes member
+       /* fill the attributes member */
        memcpy (&handle -> attr, attr, sizeof (*attr));
 
        return (handle);
 }
 
-void
-dsp_uart_bit_handler (void *x, int bit)
+void dsp_uart_destroy (dsp_uart_handle_t **handle)
+{
+       if (*handle) {
+               free(*handle);
+               *handle = NULL;
+       }
+}
+
+
+void dsp_uart_bit_handler (void *x, int bit)
 {
        dsp_uart_handle_t *handle = (dsp_uart_handle_t *) x;
 
-//     printf ("bit %d handle -> have_start %d handle -> data %02X handle -> nbits %d\n", bit, handle -> have_start, handle -> data, handle -> nbits);
        if (!handle -> have_start) {
                if (bit) {
-                       return;         // waiting for start bit (0)
+                       return;         /* waiting for start bit (0) */
                }
                handle -> have_start = 1;
                handle -> data = 0;
@@ -118,11 +121,11 @@ dsp_uart_bit_handler (void *x, int bit)
                handle -> data = 0;
                handle -> have_start = 0;
 
-// might consider handling errors in the future...
+/* might consider handling errors in the future... */
 #if 0
        } else if (handle -> nbits > 8) {
                if (!bit) {
-                       // framing error; expected stop bit (mark, 1)
+                       /* framing error; expected stop bit (mark, 1) */
                        printf ("FRAME"); fflush (stdout);
                } else {
                        handle -> have_start = 0;
index 7c3a9164b06013d32797d74ce32c597feca26d23..9989ab935da28b787d70ef16af605c96b928dd32 100644 (file)
 #ifndef        __UART_H__
 #define        __UART_H__
 
+typedef void (*bytehandler_func_t) (void *, int);
+
 typedef struct dsp_uart_attr_s
 {
-       void                            (*bytehandler) (void *, int);   // byte handler
-       void                            *bytehandler_arg;                               // arbitrary ID passed to bytehandler as first argument
+       bytehandler_func_t      bytehandler;                                    /* byte handler */
+       void                            *bytehandler_arg;                               /* arbitrary ID passed to bytehandler as first argument */
 }      dsp_uart_attr_t;
 
 typedef struct
 {
        dsp_uart_attr_t         attr;
-       int                                     have_start;                                             // wait for start bit to show up
-       int                                     data;                                                   // data buffer
-       int                                     nbits;                                                  // number of bits accumulated so far
+       int                                     have_start;                                             /* wait for start bit to show up */
+       int                                     data;                                                   /* data buffer */
+       int                                     nbits;                                                  /* number of bits accumulated so far */
 }      dsp_uart_handle_t;
 
 /*
@@ -56,24 +58,18 @@ typedef struct
  *             a) create the attributes structure (dsp_uart_attr_init)
  *             b) initialize fields in the attributes structure (dsp_uart_attr_set_*)
  *             c) create a Bell-202 handle (dsp_uart_create)
- *             d) feed samples through the handler (dsp_uart_sample)
+ *             d) feed bits through dsp_uart_bit_handler
 */
 
-extern void                                    dsp_uart_attr_init (dsp_uart_attr_t *attributes);
-
-extern  void                                   (*dsp_uart_attr_get_bithandler (dsp_uart_attr_t *attributes, void **bithandler_arg)) (void *, int);
-extern void                                    dsp_uart_attr_set_bithandler (dsp_uart_attr_t *attributes, void (*bithandler) (void *, int ), void *bithandler_arg);
-extern  void                                   (*dsp_uart_attr_get_bytehandler (dsp_uart_attr_t *attributes, void **bytehandler_arg)) (void *, int);
-extern void                                    dsp_uart_attr_set_bytehandler (dsp_uart_attr_t *attributes, void (*bytehandler) (void *, int ), void *bytehandler_arg);
-extern int                                             dsp_uart_attr_get_samplerate (dsp_uart_attr_t *attributes);
-extern int                                             dsp_uart_attr_set_samplerate (dsp_uart_attr_t *attributes, int samplerate);
+void                                   dsp_uart_attr_init (dsp_uart_attr_t *attributes);
 
-extern dsp_uart_handle_t *             dsp_uart_create (dsp_uart_attr_t *attributes);
-extern void                                    dsp_uart_destroy (dsp_uart_handle_t *handle);
+bytehandler_func_t             dsp_uart_attr_get_bytehandler (dsp_uart_attr_t *attributes, void **bytehandler_arg);
+void                                   dsp_uart_attr_set_bytehandler (dsp_uart_attr_t *attributes, bytehandler_func_t bytehandler, void *bytehandler_arg);
 
-extern void                                    dsp_uart_sample (dsp_uart_handle_t *handle, double normalized_sample);
+dsp_uart_handle_t *            dsp_uart_create (dsp_uart_attr_t *attributes);
+void                                   dsp_uart_destroy (dsp_uart_handle_t **handle);
 
-extern void                                    dsp_uart_bit_handler (void *handle, int bit);
+void                                   dsp_uart_bit_handler (void *handle, int bit);
 
 #endif // __UART_H__