b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | /*
|
| 2 | ** Copyright (c) 2015-2016 by Silicon Laboratories
|
| 3 | **
|
| 4 | ** $Id: demo_common.h 6594 2017-06-30 22:51:35Z mjmourni $
|
| 5 | **
|
| 6 | ** Distributed by:
|
| 7 | ** Silicon Laboratories, Inc
|
| 8 | **
|
| 9 | ** This file contains proprietary information.
|
| 10 | ** No dissemination allowed without prior written permission from
|
| 11 | ** Silicon Laboratories, Inc.
|
| 12 | **
|
| 13 | ** File Description:
|
| 14 | ** Common functions for the various API demo programs.
|
| 15 | **
|
| 16 | **
|
| 17 | */
|
| 18 |
|
| 19 | #ifndef __PROSLIC_DEMO_COMMON_HDR__
|
| 20 | #define __PROSLIC_DEMO_COMMON_HDR__ 1
|
| 21 |
|
| 22 | #include "proslic.h"
|
| 23 |
|
| 24 | #ifdef TSTIN_SUPPORT
|
| 25 | #include "proslic_tstin.h"
|
| 26 | #endif
|
| 27 |
|
| 28 | #define DEMO_NUM_IRQS 4
|
| 29 | /*****************************************************************************************************/
|
| 30 | typedef struct
|
| 31 | {
|
| 32 | uInt8 irq_save[DEMO_NUM_IRQS]; /* Save/restore IRQ settings for various functions */
|
| 33 | BOOLEAN isFRS_enabled; /* Is fast ring start enabled */
|
| 34 | } demo_chan_info_t;
|
| 35 |
|
| 36 | /*****************************************************************************************************/
|
| 37 | /* This data structure is to keep track a string of the same devices in 1 container. If the system
|
| 38 | * has 2 different devices - say 3 Si3226x's and 1 Si3217x, you would need 2 instances of this structure -
|
| 39 | * 1 to contain the 3 Si3226x's and 1 to contain the Si3217x.
|
| 40 | *
|
| 41 | * The initialization code at present assumes everything is on the same daisy chain. Efforts are made
|
| 42 | * to note where a code change would be needed if this is not true.
|
| 43 | */
|
| 44 | typedef struct
|
| 45 | {
|
| 46 | int deviceType;
|
| 47 | int numberOfDevice;
|
| 48 | int numberOfChan;
|
| 49 | int chanPerDevice;
|
| 50 | int channelBaseIndex;
|
| 51 |
|
| 52 | SiVoiceChanType_ptr channels;
|
| 53 | SiVoiceChanType_ptr *channelPtrs;
|
| 54 | SiVoiceDeviceType_ptr devices;
|
| 55 | demo_chan_info_t *demo_info;
|
| 56 | #ifdef TSTIN_SUPPORT
|
| 57 | proslicTestInObjType_ptr pTstin;
|
| 58 | #endif
|
| 59 |
|
| 60 | } demo_port_t;
|
| 61 |
|
| 62 | typedef struct
|
| 63 | {
|
| 64 | demo_port_t *ports;
|
| 65 | demo_port_t *currentPort;
|
| 66 | int currentChannel;
|
| 67 | int totalChannelCount;
|
| 68 | SiVoiceChanType_ptr currentChanPtr;
|
| 69 |
|
| 70 | BOOLEAN is_offhook;
|
| 71 | } demo_state_t;
|
| 72 |
|
| 73 | typedef enum
|
| 74 | {
|
| 75 | DEMO_RING_PRESET,
|
| 76 | DEMO_DCFEED_PRESET,
|
| 77 | DEMO_IMPEDANCE_PRESET,
|
| 78 | DEMO_FSK_PRESET,
|
| 79 | DEMO_PM_PRESET,
|
| 80 | DEMO_TONEGEN_PRESET,
|
| 81 | DEMO_PCM_PRESET,
|
| 82 | DEMO_VDAA_COUNTRY_PRESET,
|
| 83 | DEMO_VDAA_AUDIO_GAIN_PRESET,
|
| 84 | DEMO_VDAA_RING_VALIDATION_PRESET,
|
| 85 | DEMO_VDAA_PCM_PRESET,
|
| 86 | DEMO_VDAA_HYBRID_PRESET,
|
| 87 | } demo_preset_t;
|
| 88 |
|
| 89 | /*****************************************************************************************************/
|
| 90 | void demo_init_port_info(demo_port_t *port, unsigned int port_id);
|
| 91 | int demo_alloc(demo_port_t *port, int *base_channel_index,
|
| 92 | controlInterfaceType *proslic_api_hwIf);
|
| 93 | int demo_init_devices(demo_port_t *port);
|
| 94 | int demo_load_presets(demo_port_t *port);
|
| 95 | void demo_shutdown(demo_port_t *port);
|
| 96 | void demo_free(demo_port_t *port);
|
| 97 | int demo_get_preset(demo_preset_t preset_enum);
|
| 98 | /* Return back the channel pointer, given a channel number */
|
| 99 | SiVoiceChanType_ptr demo_get_cptr(demo_state_t *demo_state, int channel_number);
|
| 100 | void demo_save_slic_irqens(demo_state_t *pState);
|
| 101 | void demo_restore_slic_irqens(demo_state_t *pState);
|
| 102 | int demo_set_chan_state(demo_port_t *port);
|
| 103 |
|
| 104 | #endif /* __PROSLIC_DEMO_COMMON_HDR__ */
|
| 105 |
|