root/drivers/staging/vc04_services/interface/vchi/vchi_cfg.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
   2 /* Copyright (c) 2010-2012 Broadcom. All rights reserved. */
   3 
   4 #ifndef VCHI_CFG_H_
   5 #define VCHI_CFG_H_
   6 
   7 /****************************************************************************************
   8  * Defines in this first section are part of the VCHI API and may be examined by VCHI
   9  * services.
  10  ***************************************************************************************/
  11 
  12 /* Required alignment of base addresses for bulk transfer, if unaligned transfers are not enabled */
  13 /* Really determined by the message driver, and should be available from a run-time call. */
  14 #ifndef VCHI_BULK_ALIGN
  15 #   if __VCCOREVER__ >= 0x04000000
  16 #       define VCHI_BULK_ALIGN 32 // Allows for the need to do cache cleans
  17 #   else
  18 #       define VCHI_BULK_ALIGN 16
  19 #   endif
  20 #endif
  21 
  22 /* Required length multiple for bulk transfers, if unaligned transfers are not enabled */
  23 /* May be less than or greater than VCHI_BULK_ALIGN */
  24 /* Really determined by the message driver, and should be available from a run-time call. */
  25 #ifndef VCHI_BULK_GRANULARITY
  26 #   if __VCCOREVER__ >= 0x04000000
  27 #       define VCHI_BULK_GRANULARITY 32 // Allows for the need to do cache cleans
  28 #   else
  29 #       define VCHI_BULK_GRANULARITY 16
  30 #   endif
  31 #endif
  32 
  33 /* The largest possible message to be queued with vchi_msg_queue. */
  34 #ifndef VCHI_MAX_MSG_SIZE
  35 #   if defined VCHI_LOCAL_HOST_PORT
  36 #       define VCHI_MAX_MSG_SIZE     16384         // makes file transfers fast, but should they be using bulk?
  37 #   else
  38 #       define VCHI_MAX_MSG_SIZE      4096 // NOTE: THIS MUST BE LARGER THAN OR EQUAL TO THE SIZE OF THE KHRONOS MERGE BUFFER!!
  39 #   endif
  40 #endif
  41 
  42 /******************************************************************************************
  43  * Defines below are system configuration options, and should not be used by VCHI services.
  44  *****************************************************************************************/
  45 
  46 /* How many connections can we support? A localhost implementation uses 2 connections,
  47  * 1 for host-app, 1 for VMCS, and these are hooked together by a loopback MPHI VCFW
  48  * driver. */
  49 #ifndef VCHI_MAX_NUM_CONNECTIONS
  50 #   define VCHI_MAX_NUM_CONNECTIONS 3
  51 #endif
  52 
  53 /* How many services can we open per connection? Extending this doesn't cost processing time, just a small
  54  * amount of static memory. */
  55 #ifndef VCHI_MAX_SERVICES_PER_CONNECTION
  56 #  define VCHI_MAX_SERVICES_PER_CONNECTION 36
  57 #endif
  58 
  59 /* Adjust if using a message driver that supports more logical TX channels */
  60 #ifndef VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION
  61 #   define VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION 9 // 1 MPHI + 8 CCP2 logical channels
  62 #endif
  63 
  64 /* Adjust if using a message driver that supports more logical RX channels */
  65 #ifndef VCHI_MAX_BULK_RX_CHANNELS_PER_CONNECTION
  66 #   define VCHI_MAX_BULK_RX_CHANNELS_PER_CONNECTION 1 // 1 MPHI
  67 #endif
  68 
  69 /* How many receive slots do we use. This times VCHI_MAX_MSG_SIZE gives the effective
  70  * receive queue space, less message headers. */
  71 #ifndef VCHI_NUM_READ_SLOTS
  72 #  if defined(VCHI_LOCAL_HOST_PORT)
  73 #     define VCHI_NUM_READ_SLOTS 4
  74 #  else
  75 #     define VCHI_NUM_READ_SLOTS 48
  76 #  endif
  77 #endif
  78 
  79 /* Do we utilise overrun facility for receive message slots? Can aid peer transmit
  80  * performance. Only define on VideoCore end, talking to host.
  81  */
  82 //#define VCHI_MSG_RX_OVERRUN
  83 
  84 /* How many transmit slots do we use. Generally don't need many, as the hardware driver
  85  * underneath VCHI will usually have its own buffering. */
  86 #ifndef VCHI_NUM_WRITE_SLOTS
  87 #  define VCHI_NUM_WRITE_SLOTS 4
  88 #endif
  89 
  90 /* If a service has held or queued received messages in VCHI_XOFF_THRESHOLD or more slots,
  91  * then it's taking up too much buffer space, and the peer service will be told to stop
  92  * transmitting with an XOFF message. For this to be effective, the VCHI_NUM_READ_SLOTS
  93  * needs to be considerably bigger than VCHI_NUM_WRITE_SLOTS, or the transmit latency
  94  * is too high. */
  95 #ifndef VCHI_XOFF_THRESHOLD
  96 #  define VCHI_XOFF_THRESHOLD (VCHI_NUM_READ_SLOTS / 2)
  97 #endif
  98 
  99 /* After we've sent an XOFF, the peer will be told to resume transmission once the local
 100  * service has dequeued/released enough messages that it's now occupying
 101  * VCHI_XON_THRESHOLD slots or fewer. */
 102 #ifndef VCHI_XON_THRESHOLD
 103 #  define VCHI_XON_THRESHOLD (VCHI_NUM_READ_SLOTS / 4)
 104 #endif
 105 
 106 /* A size below which a bulk transfer omits the handshake completely and always goes
 107  * via the message channel, if bulk auxiliary is being sent on that service. (The user
 108  * can guarantee this by enabling unaligned transmits).
 109  * Not API. */
 110 #ifndef VCHI_MIN_BULK_SIZE
 111 #  define VCHI_MIN_BULK_SIZE    (VCHI_MAX_MSG_SIZE / 2 < 4096 ? VCHI_MAX_MSG_SIZE / 2 : 4096)
 112 #endif
 113 
 114 /* Maximum size of bulk transmission chunks, for each interface type. A trade-off between
 115  * speed and latency; the smaller the chunk size the better change of messages and other
 116  * bulk transmissions getting in when big bulk transfers are happening. Set to 0 to not
 117  * break transmissions into chunks.
 118  */
 119 #ifndef VCHI_MAX_BULK_CHUNK_SIZE_MPHI
 120 #  define VCHI_MAX_BULK_CHUNK_SIZE_MPHI (16 * 1024)
 121 #endif
 122 
 123 /* NB Chunked CCP2 transmissions violate the letter of the CCP2 spec by using "JPEG8" mode
 124  * with multiple-line frames. Only use if the receiver can cope. */
 125 #ifndef VCHI_MAX_BULK_CHUNK_SIZE_CCP2
 126 #  define VCHI_MAX_BULK_CHUNK_SIZE_CCP2 0
 127 #endif
 128 
 129 /* How many TX messages can we have pending in our transmit slots. Once exhausted,
 130  * vchi_msg_queue will be blocked. */
 131 #ifndef VCHI_TX_MSG_QUEUE_SIZE
 132 #  define VCHI_TX_MSG_QUEUE_SIZE           256
 133 #endif
 134 
 135 /* How many RX messages can we have parsed in the receive slots. Once exhausted, parsing
 136  * will be suspended until older messages are dequeued/released. */
 137 #ifndef VCHI_RX_MSG_QUEUE_SIZE
 138 #  define VCHI_RX_MSG_QUEUE_SIZE           256
 139 #endif
 140 
 141 /* Really should be able to cope if we run out of received message descriptors, by
 142  * suspending parsing as the comment above says, but we don't. This sweeps the issue
 143  * under the carpet. */
 144 #if VCHI_RX_MSG_QUEUE_SIZE < (VCHI_MAX_MSG_SIZE/16 + 1) * VCHI_NUM_READ_SLOTS
 145 #  undef VCHI_RX_MSG_QUEUE_SIZE
 146 #  define VCHI_RX_MSG_QUEUE_SIZE ((VCHI_MAX_MSG_SIZE/16 + 1) * VCHI_NUM_READ_SLOTS)
 147 #endif
 148 
 149 /* How many bulk transmits can we have pending. Once exhausted, vchi_bulk_queue_transmit
 150  * will be blocked. */
 151 #ifndef VCHI_TX_BULK_QUEUE_SIZE
 152 #  define VCHI_TX_BULK_QUEUE_SIZE           64
 153 #endif
 154 
 155 /* How many bulk receives can we have pending. Once exhausted, vchi_bulk_queue_receive
 156  * will be blocked. */
 157 #ifndef VCHI_RX_BULK_QUEUE_SIZE
 158 #  define VCHI_RX_BULK_QUEUE_SIZE           64
 159 #endif
 160 
 161 /* A limit on how many outstanding bulk requests we expect the peer to give us. If
 162  * the peer asks for more than this, VCHI will fail and assert. The number is determined
 163  * by the peer's hardware - it's the number of outstanding requests that can be queued
 164  * on all bulk channels. VC3's MPHI peripheral allows 16. */
 165 #ifndef VCHI_MAX_PEER_BULK_REQUESTS
 166 #  define VCHI_MAX_PEER_BULK_REQUESTS       32
 167 #endif
 168 
 169 /* Define VCHI_CCP2TX_MANUAL_POWER if the host tells us when to turn the CCP2
 170  * transmitter on and off.
 171  */
 172 /*#define VCHI_CCP2TX_MANUAL_POWER*/
 173 
 174 #ifndef VCHI_CCP2TX_MANUAL_POWER
 175 
 176 /* Timeout (in milliseconds) for putting the CCP2TX interface into IDLE state. Set
 177  * negative for no IDLE.
 178  */
 179 #  ifndef VCHI_CCP2TX_IDLE_TIMEOUT
 180 #    define VCHI_CCP2TX_IDLE_TIMEOUT        5
 181 #  endif
 182 
 183 /* Timeout (in milliseconds) for putting the CCP2TX interface into OFF state. Set
 184  * negative for no OFF.
 185  */
 186 #  ifndef VCHI_CCP2TX_OFF_TIMEOUT
 187 #    define VCHI_CCP2TX_OFF_TIMEOUT         1000
 188 #  endif
 189 
 190 #endif /* VCHI_CCP2TX_MANUAL_POWER */
 191 
 192 #endif /* VCHI_CFG_H_ */
 193 
 194 /****************************** End of file **********************************/

/* [<][>][^][v][top][bottom][index][help] */