| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2012, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bxpt_packetsub.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/5 $ |
|---|
| 12 | * $brcm_Date: 1/12/12 2:40p $ |
|---|
| 13 | * |
|---|
| 14 | * Porting interface code for the packet substitution section of the |
|---|
| 15 | * data transport core. |
|---|
| 16 | * |
|---|
| 17 | * Revision History: |
|---|
| 18 | * |
|---|
| 19 | * $brcm_Log: /magnum/portinginterface/xpt/base2/bxpt_packetsub.h $ |
|---|
| 20 | * |
|---|
| 21 | * Hydra_Software_Devel/5 1/12/12 2:40p gmullen |
|---|
| 22 | * SW7425-2138: Fixed incorrect parser band index |
|---|
| 23 | * |
|---|
| 24 | * Hydra_Software_Devel/4 1/11/12 10:32a gmullen |
|---|
| 25 | * SW7425-2138: Added BXPT_HAS_PB_PACKETSUB |
|---|
| 26 | * |
|---|
| 27 | * Hydra_Software_Devel/3 12/15/11 9:50a gmullen |
|---|
| 28 | * SW7425-1589: Merged to Hydra_Software_Devel |
|---|
| 29 | * |
|---|
| 30 | * Hydra_Software_Devel/SW7425-1589/1 12/12/11 4:35p gmullen |
|---|
| 31 | * SW7425-1589: Added BXPT_PacketSub_GetEobIntId() |
|---|
| 32 | * |
|---|
| 33 | * Hydra_Software_Devel/2 1/25/11 3:11p rjlewis |
|---|
| 34 | * SW7420-879: supply a means to provide an output rate default on open. |
|---|
| 35 | * Get defaults provides the default value. |
|---|
| 36 | * |
|---|
| 37 | * Hydra_Software_Devel/1 10/25/10 2:09p gmullen |
|---|
| 38 | * SW7425-15: Moved srcs to base2 folder |
|---|
| 39 | * |
|---|
| 40 | * Hydra_Software_Devel/2 10/25/10 9:11a gmullen |
|---|
| 41 | * SW7425-15: Updated headers and added stub versions of C files |
|---|
| 42 | * |
|---|
| 43 | * Hydra_Software_Devel/1 10/8/10 2:57p gmullen |
|---|
| 44 | * SW7425-15: Added header files |
|---|
| 45 | * |
|---|
| 46 | * Hydra_Software_Devel/9 8/18/10 7:55a gmullen |
|---|
| 47 | * SW7403-924: Merged to mainline |
|---|
| 48 | * |
|---|
| 49 | * Hydra_Software_Devel/SW7403-924/2 8/11/10 10:53a gmullen |
|---|
| 50 | * SW7403-924: New method: change band_num in PSUB |
|---|
| 51 | * |
|---|
| 52 | * Hydra_Software_Devel/SW7403-924/1 8/9/10 9:07a gmullen |
|---|
| 53 | * SW7403-924: See the JIRA for the workaround notes |
|---|
| 54 | * |
|---|
| 55 | * Hydra_Software_Devel/8 6/17/09 6:46p gmullen |
|---|
| 56 | * PR56110: Added support.xpt/7550/uif_image/a0 |
|---|
| 57 | * |
|---|
| 58 | * Hydra_Software_Devel/7 4/7/09 5:25p piyushg |
|---|
| 59 | * PR52986: Add support for 7635 |
|---|
| 60 | * Added directory element "7635". |
|---|
| 61 | * |
|---|
| 62 | * Hydra_Software_Devel/6 1/27/09 1:09p gmullen |
|---|
| 63 | * PR51625: Added 7336 support |
|---|
| 64 | * |
|---|
| 65 | * Hydra_Software_Devel/5 11/26/08 4:14p gmullen |
|---|
| 66 | * PR47755: Added support for 7420. |
|---|
| 67 | * |
|---|
| 68 | * Hydra_Software_Devel/4 3/26/08 11:24a gmullen |
|---|
| 69 | * PR38954: Added 3548 support to XPT PI. |
|---|
| 70 | * |
|---|
| 71 | * Hydra_Software_Devel/3 11/28/07 11:24a gmullen |
|---|
| 72 | * PR36900: Added 7335 support |
|---|
| 73 | * |
|---|
| 74 | * Hydra_Software_Devel/2 10/30/07 3:11p gmullen |
|---|
| 75 | * PR35018: Added support for 7325 |
|---|
| 76 | * |
|---|
| 77 | * Hydra_Software_Devel/1 5/13/05 1:27p gmullen |
|---|
| 78 | * PR15309: First draft of XPT PI. |
|---|
| 79 | * |
|---|
| 80 | * Hydra_Software_Devel/14 10/4/04 3:26p gmullen |
|---|
| 81 | * PR12902: Added requested function |
|---|
| 82 | * |
|---|
| 83 | * Hydra_Software_Devel/13 3/25/04 11:15a gmullen |
|---|
| 84 | * PR8852: Checked for duplicate PID usage in record, remux, and hsx. |
|---|
| 85 | * |
|---|
| 86 | * Hydra_Software_Devel/12 2/8/04 5:21p gmullen |
|---|
| 87 | * PR9210: Changed includes to comply. |
|---|
| 88 | * |
|---|
| 89 | * Hydra_Software_Devel/11 1/19/04 2:54p gmullen |
|---|
| 90 | * PR8852: Changed definition of _SetOutputRate(). RDB description is |
|---|
| 91 | * confusing. |
|---|
| 92 | * |
|---|
| 93 | * Hydra_Software_Devel/10 1/5/04 2:49p gmullen |
|---|
| 94 | * PR9142: Fixed compiler warnings. |
|---|
| 95 | * |
|---|
| 96 | * Hydra_Software_Devel/9 1/5/04 12:21p gmullen |
|---|
| 97 | * PR8852: Moved BandNum from ChannelSettings to SetPidChanNum() |
|---|
| 98 | * |
|---|
| 99 | * Hydra_Software_Devel/8 12/4/03 5:32p gmullen |
|---|
| 100 | * PR8729: Added prototype for |
|---|
| 101 | * BXPT_PacketSub_GetChannelDefaultSettings(). |
|---|
| 102 | * |
|---|
| 103 | * Hydra_Software_Devel/7 10/3/03 5:06p gmullen |
|---|
| 104 | * Updated function prototypes. |
|---|
| 105 | * |
|---|
| 106 | * Hydra_Software_Devel/6 9/26/03 4:50p gmullen |
|---|
| 107 | * Replaced stubs with real code. |
|---|
| 108 | * |
|---|
| 109 | * Hydra_Software_Devel/5 9/8/03 9:21a gmullen |
|---|
| 110 | * Updated for channel-based API. |
|---|
| 111 | * |
|---|
| 112 | * Hydra_Software_Devel/4 8/14/03 4:06p gmullen |
|---|
| 113 | * Replaced Get/Set calls. |
|---|
| 114 | * |
|---|
| 115 | * Hydra_Software_Devel/3 7/31/03 10:55a gmullen |
|---|
| 116 | * Changed 'Description' fields in enum and structure comments to |
|---|
| 117 | * 'Summary' so they'll show up in auto-generated docs. |
|---|
| 118 | * |
|---|
| 119 | * Hydra_Software_Devel/2 7/30/03 6:35p gmullen |
|---|
| 120 | * Added comments to enums |
|---|
| 121 | * |
|---|
| 122 | * Hydra_Software_Devel/1 7/25/03 3:39p gmullen |
|---|
| 123 | * Initial release for 7038 |
|---|
| 124 | * |
|---|
| 125 | ***************************************************************************/ |
|---|
| 126 | |
|---|
| 127 | /*= Module Overview ********************************************************* |
|---|
| 128 | The packet substitution module provides a method to adjust the contents of |
|---|
| 129 | PIDs carrying PSI or SI information, after packets have been removed by the |
|---|
| 130 | PID parsers. Every time packet is removed, a 'gap' is created in the stream |
|---|
| 131 | where the packet used to be. The packet substitution logic can insert new |
|---|
| 132 | data into those gaps. The modified stream that is created is available to |
|---|
| 133 | all other blocks in the transport core, and can be treated like any data |
|---|
| 134 | packet stream. |
|---|
| 135 | ***************************************************************************/ |
|---|
| 136 | |
|---|
| 137 | #ifndef BXPT_PACKETSUB_H__ |
|---|
| 138 | #define BXPT_PACKETSUB_H__ |
|---|
| 139 | |
|---|
| 140 | #include "bxpt.h" |
|---|
| 141 | |
|---|
| 142 | /*************************************************************************** |
|---|
| 143 | Summary: |
|---|
| 144 | Defines the DMA priority levels a packet sub channel can use. A channel with |
|---|
| 145 | HIGH priority will output all its packets before a channel with LOW priority |
|---|
| 146 | will be allowed to output any. |
|---|
| 147 | ****************************************************************************/ |
|---|
| 148 | typedef enum BXPT_PacketSubDmaPriority |
|---|
| 149 | { |
|---|
| 150 | BXPT_PacketSubDmaPriority_eHigh = 1, |
|---|
| 151 | BXPT_PacketSubDmaPriority_eLow = 0 |
|---|
| 152 | } |
|---|
| 153 | BXPT_PacketSubDmaPriority; |
|---|
| 154 | |
|---|
| 155 | /*************************************************************************** |
|---|
| 156 | Summary: |
|---|
| 157 | Handle for accessing the packet substitution API via a channel. Users should |
|---|
| 158 | not directly access the contents of the structure. |
|---|
| 159 | ****************************************************************************/ |
|---|
| 160 | typedef struct BXPT_P_PacketSubHandle *BXPT_PacketSub_Handle; |
|---|
| 161 | |
|---|
| 162 | /*************************************************************************** |
|---|
| 163 | Summary: |
|---|
| 164 | Settings for the Playback channels. These values can be passed in when the |
|---|
| 165 | channel is opened, and will be used as the new default settings. |
|---|
| 166 | ****************************************************************************/ |
|---|
| 167 | typedef struct BXPT_PacketSub_ChannelSettings |
|---|
| 168 | { |
|---|
| 169 | unsigned int PacketLen; /* Packet length. */ |
|---|
| 170 | |
|---|
| 171 | /* |
|---|
| 172 | ** Insert packet in gap between upstream data. When enabled, forced packet |
|---|
| 173 | ** insertion mode for this pasrser band is enabled and normal substitution |
|---|
| 174 | ** of null packet for this band is disabled. Output rate control is the |
|---|
| 175 | ** same for forced packet insertion mode and normal substitution mode. |
|---|
| 176 | */ |
|---|
| 177 | bool ForcedInsertionEn; |
|---|
| 178 | |
|---|
| 179 | /* Provides a default rate for packet insertion. */ |
|---|
| 180 | uint32_t OutputRate; |
|---|
| 181 | } |
|---|
| 182 | BXPT_PacketSub_ChannelSettings; |
|---|
| 183 | |
|---|
| 184 | /*************************************************************************** |
|---|
| 185 | Summary: |
|---|
| 186 | Layout of a packet sub descriptor. The order of the members matches the order |
|---|
| 187 | the hardware will expect them in when the descriptor is read from memory. |
|---|
| 188 | Thus, the descriptor's contents can be accessed by creating a pointer to this |
|---|
| 189 | type of struct and setting that pointer to the address of the real descriptor |
|---|
| 190 | in memory (after being memory mapped, of course). |
|---|
| 191 | ****************************************************************************/ |
|---|
| 192 | typedef struct BXPT_PacketSub_Descriptor |
|---|
| 193 | { |
|---|
| 194 | uint32_t BufferStartAddr; /* (Pointer to) the buffer associated with this descriptor. */ |
|---|
| 195 | uint32_t BufferLength; /* Length (in bytes) of the buffer. */ |
|---|
| 196 | uint32_t Flags; /* Channel-specific flags. */ |
|---|
| 197 | uint32_t NextDescAddr; /* (Pointer to) the next descriptor in the chain. */ |
|---|
| 198 | } |
|---|
| 199 | BXPT_PacketSub_Descriptor; |
|---|
| 200 | |
|---|
| 201 | /*************************************************************************** |
|---|
| 202 | Summary: |
|---|
| 203 | Status bits for the packet substitution channel. |
|---|
| 204 | ****************************************************************************/ |
|---|
| 205 | typedef struct BXPT_PacketSub_ChannelStatus |
|---|
| 206 | { |
|---|
| 207 | bool Finished; /* true if channel has processed last descriptor in the chain. */ |
|---|
| 208 | bool Busy; /* true if channel is active. */ |
|---|
| 209 | bool Run; /* true if a playback session has been started. */ |
|---|
| 210 | } |
|---|
| 211 | BXPT_PacketSub_ChannelStatus; |
|---|
| 212 | |
|---|
| 213 | #ifdef __cplusplus |
|---|
| 214 | extern "C" { |
|---|
| 215 | #endif |
|---|
| 216 | |
|---|
| 217 | /*************************************************************************** |
|---|
| 218 | Summary: |
|---|
| 219 | Return the number of packet substitution channels. |
|---|
| 220 | |
|---|
| 221 | Description: |
|---|
| 222 | For the given transport core, return the number of packet substitution channels |
|---|
| 223 | that is supported. |
|---|
| 224 | |
|---|
| 225 | Returns: |
|---|
| 226 | BERR_SUCCESS - Retrieved channel count. |
|---|
| 227 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 228 | ****************************************************************************/ |
|---|
| 229 | BERR_Code BXPT_PacketSub_GetTotalChannels( |
|---|
| 230 | BXPT_Handle hXpt, /* [in] Handle for this transport */ |
|---|
| 231 | unsigned int *TotalChannels /* [out] The number of PacketSub channels. */ |
|---|
| 232 | ); |
|---|
| 233 | |
|---|
| 234 | /*************************************************************************** |
|---|
| 235 | Summary: |
|---|
| 236 | Open a given packet substitution channel. |
|---|
| 237 | |
|---|
| 238 | Description: |
|---|
| 239 | Reset the given playback channel, configure it using the given defaults, then |
|---|
| 240 | return a handle to access that channel. |
|---|
| 241 | |
|---|
| 242 | Returns: |
|---|
| 243 | BERR_SUCCESS - Packet substitution channel opened. |
|---|
| 244 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 245 | ****************************************************************************/ |
|---|
| 246 | BERR_Code BXPT_PacketSub_OpenChannel( |
|---|
| 247 | BXPT_Handle hXpt, /* [in] Handle for this transport */ |
|---|
| 248 | BXPT_PacketSub_Handle *hPSub, /* [out] Handle for opened packet sub channel */ |
|---|
| 249 | unsigned int ChannelNo, /* [in] Which channel to open. */ |
|---|
| 250 | BXPT_PacketSub_ChannelSettings *ChannelSettings /* [in] The defaults to use */ |
|---|
| 251 | ); |
|---|
| 252 | |
|---|
| 253 | /*************************************************************************** |
|---|
| 254 | Summary: |
|---|
| 255 | Close a given packet sub channel. |
|---|
| 256 | |
|---|
| 257 | Description: |
|---|
| 258 | Shutdown a given playback channel, disable any interrupts from it. |
|---|
| 259 | |
|---|
| 260 | Returns: |
|---|
| 261 | void |
|---|
| 262 | ****************************************************************************/ |
|---|
| 263 | void BXPT_PacketSub_CloseChannel( |
|---|
| 264 | BXPT_PacketSub_Handle hPSub /* [in] Handle for the channel to close*/ |
|---|
| 265 | ); |
|---|
| 266 | |
|---|
| 267 | /*************************************************************************** |
|---|
| 268 | Summary: |
|---|
| 269 | Get the default settings for a given packet sub channel. |
|---|
| 270 | |
|---|
| 271 | Description: |
|---|
| 272 | Retrieves the default values used when opening a packet sub channel. The user |
|---|
| 273 | can change the defaults, then pass the new settings in when |
|---|
| 274 | BXPT_PacketSub_OpenChannel() is called. |
|---|
| 275 | |
|---|
| 276 | Returns: |
|---|
| 277 | BERR_SUCCESS - Call completed successfully. |
|---|
| 278 | BERR_INVALID_PARAMETER - Bad channel number |
|---|
| 279 | ****************************************************************************/ |
|---|
| 280 | BERR_Code BXPT_PacketSub_GetChannelDefaultSettings( |
|---|
| 281 | BXPT_Handle hXpt, /* [in] Handle for this transport */ |
|---|
| 282 | unsigned int ChannelNo, /* [in] Which channel to get defaults from. */ |
|---|
| 283 | BXPT_PacketSub_ChannelSettings *ChannelSettings /* [out] The defaults */ |
|---|
| 284 | ); |
|---|
| 285 | |
|---|
| 286 | /*************************************************************************** |
|---|
| 287 | Summary: |
|---|
| 288 | Set the ouput PID channel number. |
|---|
| 289 | |
|---|
| 290 | Description: |
|---|
| 291 | Set the PID channel number that the substituted packets will be given. |
|---|
| 292 | |
|---|
| 293 | All chips support substitution into PID channels from live feeds (via the |
|---|
| 294 | front end parsers). On some chips, substitution from playback feeds is also |
|---|
| 295 | supported. Such chips have BXPT_HAS_PB_PACKETSUB defined for them in bxpt.h . |
|---|
| 296 | To use playback feeds, add the BXPT_PB_PARSER macro like so: |
|---|
| 297 | |
|---|
| 298 | BXPT_PacketSub_SetPidChanNum( hPSub, PidChanNum, BXPT_PB_PARSER( BandNum ) ); |
|---|
| 299 | |
|---|
| 300 | BandNum should be set to the index of the playback channel that the PID channel |
|---|
| 301 | is mapped to, i.e. BandNum should be 1 if playback 1 is used. |
|---|
| 302 | |
|---|
| 303 | Returns: |
|---|
| 304 | BERR_SUCCESS - Call completed successfully. |
|---|
| 305 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 306 | ****************************************************************************/ |
|---|
| 307 | BERR_Code BXPT_PacketSub_SetPidChanNum( |
|---|
| 308 | BXPT_PacketSub_Handle hPSub, /* [in] Handle for the channel. */ |
|---|
| 309 | unsigned int PidChanNum, /* [in] Which PID channel to assign the output to. */ |
|---|
| 310 | unsigned int BandNum /* [in] Which band number to assign the output to */ |
|---|
| 311 | ); |
|---|
| 312 | |
|---|
| 313 | /*************************************************************************** |
|---|
| 314 | Summary: |
|---|
| 315 | Get the ouput PID channel number. |
|---|
| 316 | |
|---|
| 317 | Description: |
|---|
| 318 | On certain chips (the 7403 right now), only certain PID channels can |
|---|
| 319 | be used with the PSUB hardware. This API will return the correct PID channel |
|---|
| 320 | number for the given PSUB. |
|---|
| 321 | |
|---|
| 322 | Returns: |
|---|
| 323 | unsigned int - PID channel number to be used with this PacketSub block. |
|---|
| 324 | ****************************************************************************/ |
|---|
| 325 | unsigned int BXPT_PacketSub_GetPidChanNum( |
|---|
| 326 | BXPT_PacketSub_Handle hPSub /* [in] Handle for the channel. */ |
|---|
| 327 | ); |
|---|
| 328 | |
|---|
| 329 | /*************************************************************************** |
|---|
| 330 | Summary: |
|---|
| 331 | Force immediate output. |
|---|
| 332 | |
|---|
| 333 | Description: |
|---|
| 334 | Substitution data is normally inserted on a space-available basis, meaning |
|---|
| 335 | the PID parsers must drop a packet from the selected output band to make room |
|---|
| 336 | for a substitution packet. This function forces immediate insertion for the |
|---|
| 337 | given channel. For a live stream, forced insertion means that input packets |
|---|
| 338 | are dropped immediatly to make room. For a playback stream with pacing, the |
|---|
| 339 | playback channel will be paused to allow the insertion. Playback without |
|---|
| 340 | pacing is handled like a live stream. |
|---|
| 341 | |
|---|
| 342 | Returns: |
|---|
| 343 | BERR_SUCCESS - Immediate output enabled. |
|---|
| 344 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 345 | |
|---|
| 346 | See Also: |
|---|
| 347 | BXPT_PacketSub_SetFullRateOutput, BXPT_PacketSub_SetOutputRate |
|---|
| 348 | ****************************************************************************/ |
|---|
| 349 | BERR_Code BXPT_PacketSub_SetForcedOutput( |
|---|
| 350 | BXPT_PacketSub_Handle hPSub, /* [in] Handle for the channel. */ |
|---|
| 351 | bool Enable /* [in] Force output immediately if TRUE */ |
|---|
| 352 | ); |
|---|
| 353 | |
|---|
| 354 | /*************************************************************************** |
|---|
| 355 | Summary: |
|---|
| 356 | Set output rate equal to input rate. |
|---|
| 357 | |
|---|
| 358 | Description: |
|---|
| 359 | Ignore the programmable output rate that was set through |
|---|
| 360 | BXPT_PacketSub_SetOutputRate(), and make the output rate equal to the input |
|---|
| 361 | rate. Disabling this feature will return to the programmable rate. |
|---|
| 362 | |
|---|
| 363 | Returns: |
|---|
| 364 | BERR_SUCCESS - Output rate now matches input. |
|---|
| 365 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 366 | |
|---|
| 367 | See Also: |
|---|
| 368 | BXPT_PacketSub_SetForcedOutput, BXPT_PacketSub_SetOutputRate |
|---|
| 369 | ****************************************************************************/ |
|---|
| 370 | BERR_Code BXPT_PacketSub_SetFullRateOutput( |
|---|
| 371 | BXPT_PacketSub_Handle hPSub, /* [in] Handle for the channel. */ |
|---|
| 372 | bool Enable /* [in] Use full rate if TRUE */ |
|---|
| 373 | ); |
|---|
| 374 | |
|---|
| 375 | /*************************************************************************** |
|---|
| 376 | Summary: |
|---|
| 377 | Set output rate to the user-supplied value. |
|---|
| 378 | |
|---|
| 379 | Description: |
|---|
| 380 | Set packet output rate, expressed in bits/second. Unless overridden by |
|---|
| 381 | BXPT_PacketSub_SetFullRateOutput(), the output rate for substituted packets |
|---|
| 382 | will the given bitrate, rounded to the nearest 1600 bits/second. |
|---|
| 383 | |
|---|
| 384 | Returns: |
|---|
| 385 | BERR_SUCCESS - Output rate now set. |
|---|
| 386 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 387 | |
|---|
| 388 | See Also: |
|---|
| 389 | BXPT_PacketSub_SetFullRateOutput, BXPT_PacketSub_SetForcedOutput |
|---|
| 390 | ****************************************************************************/ |
|---|
| 391 | BERR_Code BXPT_PacketSub_SetOutputRate( |
|---|
| 392 | BXPT_PacketSub_Handle hPSub, /* [in] Handle for the channel. */ |
|---|
| 393 | uint32_t OutputRate /* [in] The output rate, in bits/second */ |
|---|
| 394 | ); |
|---|
| 395 | |
|---|
| 396 | /*************************************************************************** |
|---|
| 397 | Summary: |
|---|
| 398 | Pause packet substitution. |
|---|
| 399 | |
|---|
| 400 | Description: |
|---|
| 401 | Pause the packet substitution channel. Packet subbing stops until this |
|---|
| 402 | function is called again to disable the pause. |
|---|
| 403 | |
|---|
| 404 | Returns: |
|---|
| 405 | BERR_SUCCESS - Paused enabled or disabled. |
|---|
| 406 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 407 | ****************************************************************************/ |
|---|
| 408 | BERR_Code BXPT_PacketSub_PauseChannel( |
|---|
| 409 | BXPT_PacketSub_Handle hPSub, /* [in] Handle for the channel. */ |
|---|
| 410 | bool Pause /* [in] Pause channel if TRUE, continue if FALSE */ |
|---|
| 411 | ); |
|---|
| 412 | |
|---|
| 413 | /*************************************************************************** |
|---|
| 414 | Summary: |
|---|
| 415 | Initialize a descriptor for the packet substitution linked list. |
|---|
| 416 | |
|---|
| 417 | Description: |
|---|
| 418 | Initialize the contents of a packet sub descriptor. The caller passes in the |
|---|
| 419 | starting address of the buffer that the descriptor will point to. |
|---|
| 420 | The buffer can start at any byte address, and may be of any length. |
|---|
| 421 | |
|---|
| 422 | The caller specifies if an interrupt should be generated when the |
|---|
| 423 | hardware has finished processing the contents of the descriptor's |
|---|
| 424 | buffer. |
|---|
| 425 | |
|---|
| 426 | The memory for the descriptor must be allocated by the caller, and must |
|---|
| 427 | start on a 16-byte boundary. |
|---|
| 428 | |
|---|
| 429 | Since descriptors are usually used in chains, the function allows the |
|---|
| 430 | descriptor's NextDescAddr to be initialized along with the rest of the |
|---|
| 431 | fields. This next descriptor does not have to be initialized itself. The |
|---|
| 432 | address must meet the 16-byte boundary requirement. |
|---|
| 433 | |
|---|
| 434 | Returns: |
|---|
| 435 | BERR_SUCCESS - Descriptor initialized. |
|---|
| 436 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 437 | |
|---|
| 438 | See Also: |
|---|
| 439 | BXPT_PacketSub_AddDescriptors, BXPT_PacketSub_CheckHeadDescriptor |
|---|
| 440 | ****************************************************************************/ |
|---|
| 441 | BERR_Code BXPT_PacketSub_CreateDesc( |
|---|
| 442 | BXPT_Handle hXpt, /* [in] Handle for this transport */ |
|---|
| 443 | BXPT_PacketSub_Descriptor * const Desc, /* [in] Descriptor to initialize */ |
|---|
| 444 | uint8_t *Buffer, /* [in] Data buffer. */ |
|---|
| 445 | uint32_t BufferLength, /* [in] Size of buffer (in bytes). */ |
|---|
| 446 | bool IntEnable, /* [in] Interrupt when done? */ |
|---|
| 447 | BXPT_PacketSub_Descriptor * const NextDesc /* [in] Next descriptor, or NULL */ |
|---|
| 448 | ); |
|---|
| 449 | |
|---|
| 450 | /*************************************************************************** |
|---|
| 451 | Summary: |
|---|
| 452 | Add a descriptor to a packet substitution linked list. |
|---|
| 453 | |
|---|
| 454 | Description: |
|---|
| 455 | Add a descriptor chain to an existing (but possibly empty) chain used by a |
|---|
| 456 | packet sub channel. If the existing chain is empty, the chain being added |
|---|
| 457 | simply becomes the current chain. |
|---|
| 458 | |
|---|
| 459 | The FirstDesc argument is a pointer to the descriptor at the start of the |
|---|
| 460 | chain being added. The LastDesc argument passed in is a pointer to the end |
|---|
| 461 | of that chain. |
|---|
| 462 | |
|---|
| 463 | Returns: |
|---|
| 464 | BERR_SUCCESS - Descriptor added to the list. |
|---|
| 465 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 466 | |
|---|
| 467 | See Also: |
|---|
| 468 | BXPT_PacketSub_CreateDesc, BXPT_PacketSub_CheckHeadDescriptor |
|---|
| 469 | ****************************************************************************/ |
|---|
| 470 | BERR_Code BXPT_PacketSub_AddDescriptors( |
|---|
| 471 | BXPT_PacketSub_Handle hPSub, /* [in] Handle for the channel. */ |
|---|
| 472 | BXPT_PacketSub_Descriptor *LastDesc, /* [in] Last descriptor in new chain */ |
|---|
| 473 | BXPT_PacketSub_Descriptor *FirstDesc /* [in] First descriptor in new chain */ |
|---|
| 474 | ); |
|---|
| 475 | |
|---|
| 476 | /*************************************************************************** |
|---|
| 477 | Summary: |
|---|
| 478 | Return the address of the current packet sub descriptor. |
|---|
| 479 | |
|---|
| 480 | Description: |
|---|
| 481 | For a given packet substitution channel, get the address of the descriptor |
|---|
| 482 | that is currently being used by the hardware. |
|---|
| 483 | |
|---|
| 484 | Returns: |
|---|
| 485 | BERR_SUCCESS - Retrieved address from hardware. |
|---|
| 486 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 487 | ****************************************************************************/ |
|---|
| 488 | BERR_Code BXPT_PacketSub_GetCurrentDescriptorAddress( |
|---|
| 489 | BXPT_PacketSub_Handle hPSub, /* [in] Handle for the channel. */ |
|---|
| 490 | BXPT_PacketSub_Descriptor **LastDesc /* [in] Address of the current descriptor. */ |
|---|
| 491 | ); |
|---|
| 492 | |
|---|
| 493 | /*************************************************************************** |
|---|
| 494 | Summary: |
|---|
| 495 | Determine if a descriptor is the head of a linked list. |
|---|
| 496 | |
|---|
| 497 | Description: |
|---|
| 498 | Determine if the current descriptor being processed by the packet sub channel |
|---|
| 499 | is the first on the channel's chain (which means this descriptor is still |
|---|
| 500 | being used). For packet sub channels that are still 'busy', the size of the |
|---|
| 501 | descriptor's buffer is also returned. This value should be ignore for all |
|---|
| 502 | other types of channels. |
|---|
| 503 | |
|---|
| 504 | Returns: |
|---|
| 505 | BERR_SUCCESS - No errors occurred during the check. |
|---|
| 506 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 507 | |
|---|
| 508 | See Also: |
|---|
| 509 | BXPT_PacketSub_CreateDesc, BXPT_PacketSub_CheckHeadDescriptor |
|---|
| 510 | ****************************************************************************/ |
|---|
| 511 | BERR_Code BXPT_PacketSub_CheckHeadDescriptor( |
|---|
| 512 | BXPT_PacketSub_Handle hPSub, /* [in] Handle for the channel. */ |
|---|
| 513 | BXPT_PacketSub_Descriptor *Desc, /* [in] Descriptor to check. */ |
|---|
| 514 | bool *InUse, /* [out] Is descriptor in use? */ |
|---|
| 515 | uint32_t *BufferSize /* [out] Size of the buffer (in bytes). */ |
|---|
| 516 | ); |
|---|
| 517 | |
|---|
| 518 | /*************************************************************************** |
|---|
| 519 | Summary: |
|---|
| 520 | Begin packet substitution on the specified channel. |
|---|
| 521 | |
|---|
| 522 | Description: |
|---|
| 523 | Start a packet sub channel. If no buffers have been added to the packet sub |
|---|
| 524 | channel, the hardware is not actually started until the first buffer is added. |
|---|
| 525 | |
|---|
| 526 | Note: the caller should install an interrupt handler prior to calling this |
|---|
| 527 | function. That handler will be called when a descriptor's data has been |
|---|
| 528 | processed if the IntEnable bit in the descriptor was set. |
|---|
| 529 | |
|---|
| 530 | Returns: |
|---|
| 531 | BERR_SUCCESS - Channel started. |
|---|
| 532 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 533 | |
|---|
| 534 | See Also: |
|---|
| 535 | BXPT_PacketSub_StopChannel, BXPT_PacketSub_PauseChannel |
|---|
| 536 | ****************************************************************************/ |
|---|
| 537 | BERR_Code BXPT_PacketSub_StartChannel( |
|---|
| 538 | BXPT_PacketSub_Handle hPSub /* [in] Handle for the channel. */ |
|---|
| 539 | ); |
|---|
| 540 | |
|---|
| 541 | /*************************************************************************** |
|---|
| 542 | Summary: |
|---|
| 543 | Stop a packet sub channel. |
|---|
| 544 | |
|---|
| 545 | Description: |
|---|
| 546 | Stop packet substitution on the specified channel.The interrupts for the |
|---|
| 547 | given channel are disabled. |
|---|
| 548 | |
|---|
| 549 | Returns: |
|---|
| 550 | BERR_SUCCESS - Channel stopped. |
|---|
| 551 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 552 | |
|---|
| 553 | See Also: |
|---|
| 554 | BXPT_PacketSub_StartChannel, BXPT_PacketSub_PauseChannel |
|---|
| 555 | ****************************************************************************/ |
|---|
| 556 | BERR_Code BXPT_PacketSub_StopChannel( |
|---|
| 557 | BXPT_PacketSub_Handle hPSub /* [in] Handle for the channel. */ |
|---|
| 558 | ); |
|---|
| 559 | |
|---|
| 560 | /*************************************************************************** |
|---|
| 561 | Summary: |
|---|
| 562 | Get the packet sub channels status bits. |
|---|
| 563 | |
|---|
| 564 | Description: |
|---|
| 565 | Return the packet sub channels FINISHED, RUN, and BUSY status bits. The bits |
|---|
| 566 | are read directly from the hardware. |
|---|
| 567 | |
|---|
| 568 | Returns: |
|---|
| 569 | BERR_SUCCESS - Settings read from hardware successfully. |
|---|
| 570 | ****************************************************************************/ |
|---|
| 571 | BERR_Code BXPT_PacketSub_GetChannelStatus( |
|---|
| 572 | BXPT_PacketSub_Handle hPSub, /* [in] Handle for the channel. */ |
|---|
| 573 | BXPT_PacketSub_ChannelStatus *Status /* [out] Channel status. */ |
|---|
| 574 | ); |
|---|
| 575 | |
|---|
| 576 | /*************************************************************************** |
|---|
| 577 | Summary: |
|---|
| 578 | Return BINT_Id for the packetsub end-of-buffer interrupt. |
|---|
| 579 | |
|---|
| 580 | Description: |
|---|
| 581 | The result is a BINT_Id value suitable for use in BINT_CreateCallback(). |
|---|
| 582 | |
|---|
| 583 | Returns: |
|---|
| 584 | BERR_SUCCESS - Id generated successfully. |
|---|
| 585 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 586 | ****************************************************************************/ |
|---|
| 587 | BERR_Code BXPT_PacketSub_GetEobIntId( |
|---|
| 588 | BXPT_PacketSub_Handle hPSub, /* [in] Handle for the channel. */ |
|---|
| 589 | BINT_Id *IntId |
|---|
| 590 | ); |
|---|
| 591 | |
|---|
| 592 | /*************************************************************************** |
|---|
| 593 | Summary: |
|---|
| 594 | Insert a packet in any gap between upstream packet. |
|---|
| 595 | |
|---|
| 596 | Description: |
|---|
| 597 | This API provides the same functionality as ForcedInsertionEn in the |
|---|
| 598 | BXPT_PacketSub_ChannelSettings struct. It is provided for cases where setting |
|---|
| 599 | ForcedInsertionEn at open is inconvenient. |
|---|
| 600 | |
|---|
| 601 | Returns: |
|---|
| 602 | BERR_SUCCESS - Id generated successfully. |
|---|
| 603 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 604 | ****************************************************************************/ |
|---|
| 605 | BERR_Code BXPT_PacketSub_SetForcedInsertion( |
|---|
| 606 | BXPT_PacketSub_Handle hPSub, /* [in] Handle for the channel. */ |
|---|
| 607 | bool Enable /* [in] */ |
|---|
| 608 | ); |
|---|
| 609 | |
|---|
| 610 | #ifdef __cplusplus |
|---|
| 611 | } |
|---|
| 612 | #endif |
|---|
| 613 | |
|---|
| 614 | #endif /* #ifndef BXPT_PACKETSUB_H__ */ |
|---|
| 615 | |
|---|
| 616 | /* end of file */ |
|---|