answer
stringlengths
15
1.25M
import os import sys from rope.base import utils def _stdlib_path(): import inspect return os.path.dirname(inspect.getsourcefile(inspect)) @utils.cached(1) def standard_modules(): return python_modules() | dynload_modules() @utils.cached(1) def python_modules(): result = set() lib_path = _stdlib_path() if os.path.exists(lib_path): for name in os.listdir(lib_path): path = os.path.join(lib_path, name) if os.path.isdir(path): if '-' not in name: result.add(name) else: if name.endswith('.py'): result.add(name[:-3]) return result @utils.cached(1) def dynload_modules(): result = set(sys.<API key>) dynload_path = os.path.join(_stdlib_path(), 'lib-dynload') if os.path.exists(dynload_path): for name in os.listdir(dynload_path): path = os.path.join(dynload_path, name) if os.path.isfile(path): if name.endswith('.so') or name.endswith('.dll'): if "cpython" in name: result.add(os.path.splitext(os.path.splitext(name)[0])[0]) else: result.add(os.path.splitext(name)[0]) return result
package use; import foo.Bar; import foo.Foo; import static foo.Bar.foo; import static foo.Foo.*; public class Test { void test() { Foo.foo(1); foo("1"); } }
using System; using System.Windows.Automation; namespace TestUtilities.UI { class OpenProjectDialog : AutomationWrapper { public OpenProjectDialog(IntPtr hwnd) : base(AutomationElement.FromHandle(hwnd)) { } public void Open() { Invoke(FindButton("Open")); } public string ProjectName { get { var patterns = GetProjectNameBox().<API key>(); var filename = (ValuePattern)GetProjectNameBox().GetCurrentPattern(ValuePattern.Pattern); return filename.Current.Value; } set { var patterns = GetProjectNameBox().<API key>(); var filename = (ValuePattern)GetProjectNameBox().GetCurrentPattern(ValuePattern.Pattern); filename.SetValue(value); } } private AutomationElement GetProjectNameBox() { return Element.FindFirst(TreeScope.Descendants, new AndCondition( new PropertyCondition(AutomationElement.NameProperty, "File name:"), new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Edit) ) ); } } }
abstract class A { A(int x){} abstract void foo(); void test(A a){} { tes<caret> } }
#ifndef <API key> #define <API key> #include <list> #include <utility> #include "base/callback.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "media/base/<API key>.h" #include "media/base/media_export.h" #include "media/formats/mp2t/es_parser.h" namespace media { class <API key>; class BitReader; class OffsetByteQueue; class StreamParserBuffer; } namespace media { namespace mp2t { class MEDIA_EXPORT EsParserAdts : public EsParser { public: typedef base::Callback<void(const AudioDecoderConfig&)> NewAudioConfigCB; EsParserAdts(const NewAudioConfigCB& new_audio_config_cb, const EmitBufferCB& emit_buffer_cb, bool sbr_in_mimetype); ~EsParserAdts() override; // EsParser implementation. void Flush() override; private: struct AdtsFrame; // EsParser implementation. bool ParseFromEsQueue() override; void ResetInternal() override; // Synchronize the stream on an ADTS syncword (consuming bytes from // |es_queue_| if needed). // Returns true when a full ADTS frame has been found: in that case // |adts_frame| structure is filled up accordingly. // Returns false otherwise (no ADTS syncword found or partial ADTS frame). bool LookForAdtsFrame(AdtsFrame* adts_frame); // Skip an ADTS frame in the ES queue. void SkipAdtsFrame(const AdtsFrame& adts_frame); // Signal any audio configuration change (if any). // Return false if the current audio config is not // a supported ADTS audio config. bool <API key>(const uint8* adts_header); // Callbacks: // - to signal a new audio configuration, // - to send ES buffers. NewAudioConfigCB <API key>; EmitBufferCB emit_buffer_cb_; // True when AAC SBR extension is signalled in the mimetype // (mp4a.40.5 in the codecs parameter). bool sbr_in_mimetype_; // Interpolated PTS for frames that don't have one. scoped_ptr<<API key>> <API key>; // Last audio config. AudioDecoderConfig <API key>; <API key>(EsParserAdts); }; } // namespace mp2t } // namespace media #endif
// Generated source. // Generator: org.chromium.sdk.internal.wip.tools.protocolgenerator.Generator package org.chromium.sdk.internal.wip.protocol.output.network; /** Clears browser cache. */ public class <API key> extends org.chromium.sdk.internal.wip.protocol.output.WipParams { public <API key>() { } public static final String METHOD_NAME = org.chromium.sdk.internal.wip.protocol.BasicConstants.Domain.NETWORK + ".clearBrowserCache"; @Override protected String getRequestName() { return METHOD_NAME; } }
*> \brief \b CCHKTP * * =========== DOCUMENTATION =========== * * Online html documentation available at * http: * * Definition: * =========== * * SUBROUTINE CCHKTP( DOTYPE, NN, NVAL, NNS, NSVAL, THRESH, TSTERR, * NMAX, AP, AINVP, B, X, XACT, WORK, RWORK, * NOUT ) * * .. Scalar Arguments .. * LOGICAL TSTERR * INTEGER NMAX, NN, NNS, NOUT * REAL THRESH * .. * .. Array Arguments .. * LOGICAL DOTYPE( * ) * INTEGER NSVAL( * ), NVAL( * ) * REAL RWORK( * ) * COMPLEX AINVP( * ), AP( * ), B( * ), WORK( * ), X( * ), * $ XACT( * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> CCHKTP tests CTPTRI, -TRS, -RFS, and -CON, and CLATPS *> \endverbatim * * Arguments: * ========== * *> \param[in] DOTYPE *> \verbatim *> DOTYPE is LOGICAL array, dimension (NTYPES) *> The matrix types to be used for testing. Matrices of type j *> (for 1 <= j <= NTYPES) are used for testing if DOTYPE(j) = *> .TRUE.; if DOTYPE(j) = .FALSE., then type j is not used. *> \endverbatim *> *> \param[in] NN *> \verbatim *> NN is INTEGER *> The number of values of N contained in the vector NVAL. *> \endverbatim *> *> \param[in] NVAL *> \verbatim *> NVAL is INTEGER array, dimension (NN) *> The values of the matrix column dimension N. *> \endverbatim *> *> \param[in] NNS *> \verbatim *> NNS is INTEGER *> The number of values of NRHS contained in the vector NSVAL. *> \endverbatim *> *> \param[in] NSVAL *> \verbatim *> NSVAL is INTEGER array, dimension (NNS) *> The values of the number of right hand sides NRHS. *> \endverbatim *> *> \param[in] THRESH *> \verbatim *> THRESH is REAL *> The threshold value for the test ratios. A result is *> included in the output file if RESULT >= THRESH. To have *> every test ratio printed, use THRESH = 0. *> \endverbatim *> *> \param[in] TSTERR *> \verbatim *> TSTERR is LOGICAL *> Flag that indicates whether error exits are to be tested. *> \endverbatim *> *> \param[in] NMAX *> \verbatim *> NMAX is INTEGER *> The leading dimension of the work arrays. NMAX >= the *> maximumm value of N in NVAL. *> \endverbatim *> *> \param[out] AP *> \verbatim *> AP is COMPLEX array, dimension (NMAX*(NMAX+1)/2) *> \endverbatim *> *> \param[out] AINVP *> \verbatim *> AINVP is COMPLEX array, dimension (NMAX*(NMAX+1)/2) *> \endverbatim *> *> \param[out] B *> \verbatim *> B is COMPLEX array, dimension (NMAX*NSMAX) *> where NSMAX is the largest entry in NSVAL. *> \endverbatim *> *> \param[out] X *> \verbatim *> X is COMPLEX array, dimension (NMAX*NSMAX) *> \endverbatim *> *> \param[out] XACT *> \verbatim *> XACT is COMPLEX array, dimension (NMAX*NSMAX) *> \endverbatim *> *> \param[out] WORK *> \verbatim *> WORK is COMPLEX array, dimension *> (NMAX*max(3,NSMAX)) *> \endverbatim *> *> \param[out] RWORK *> \verbatim *> RWORK is REAL array, dimension *> (max(NMAX,2*NSMAX)) *> \endverbatim *> *> \param[in] NOUT *> \verbatim *> NOUT is INTEGER *> The unit number for output. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup complex_lin * * ===================================================================== SUBROUTINE CCHKTP( DOTYPE, NN, NVAL, NNS, NSVAL, THRESH, TSTERR, $ NMAX, AP, AINVP, B, X, XACT, WORK, RWORK, $ NOUT ) * * -- LAPACK test routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. LOGICAL TSTERR INTEGER NMAX, NN, NNS, NOUT REAL THRESH * .. * .. Array Arguments .. LOGICAL DOTYPE( * ) INTEGER NSVAL( * ), NVAL( * ) REAL RWORK( * ) COMPLEX AINVP( * ), AP( * ), B( * ), WORK( * ), X( * ), $ XACT( * ) * .. * * ===================================================================== * * .. Parameters .. INTEGER NTYPE1, NTYPES PARAMETER ( NTYPE1 = 10, NTYPES = 18 ) INTEGER NTESTS PARAMETER ( NTESTS = 9 ) INTEGER NTRAN PARAMETER ( NTRAN = 3 ) REAL ONE, ZERO PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 ) * .. * .. Local Scalars .. CHARACTER DIAG, NORM, TRANS, UPLO, XTYPE CHARACTER*3 PATH INTEGER I, IDIAG, IMAT, IN, INFO, IRHS, ITRAN, IUPLO, $ K, LAP, LDA, N, NERRS, NFAIL, NRHS, NRUN REAL AINVNM, ANORM, RCOND, RCONDC, RCONDI, RCONDO, $ SCALE * .. * .. Local Arrays .. CHARACTER TRANSS( NTRAN ), UPLOS( 2 ) INTEGER ISEED( 4 ), ISEEDY( 4 ) REAL RESULT( NTESTS ) * .. * .. External Functions .. LOGICAL LSAME REAL CLANTP EXTERNAL LSAME, CLANTP * .. * .. External Subroutines .. EXTERNAL ALAERH, ALAHD, ALASUM, CCOPY, CERRTR, CGET04, $ CLACPY, CLARHS, CLATPS, CLATTP, CTPCON, CTPRFS, $ CTPT01, CTPT02, CTPT03, CTPT05, CTPT06, CTPTRI, $ CTPTRS * .. * .. Scalars in Common .. LOGICAL LERR, OK CHARACTER*32 SRNAMT INTEGER INFOT, IOUNIT * .. * .. Common blocks .. COMMON / INFOC / INFOT, IOUNIT, OK, LERR COMMON / SRNAMC / SRNAMT * .. * .. Intrinsic Functions .. INTRINSIC MAX * .. * .. Data statements .. DATA ISEEDY / 1988, 1989, 1990, 1991 / DATA UPLOS / 'U', 'L' / , TRANSS / 'N', 'T', 'C' / * .. * .. Executable Statements .. * * Initialize constants and the random number seed. * PATH( 1: 1 ) = 'Complex precision' PATH( 2: 3 ) = 'TP' NRUN = 0 NFAIL = 0 NERRS = 0 DO 10 I = 1, 4 ISEED( I ) = ISEEDY( I ) 10 CONTINUE * * Test the error exits * IF( TSTERR ) $ CALL CERRTR( PATH, NOUT ) INFOT = 0 * DO 110 IN = 1, NN * * Do for each value of N in NVAL * N = NVAL( IN ) LDA = MAX( 1, N ) LAP = LDA*( LDA+1 ) / 2 XTYPE = 'N' * DO 70 IMAT = 1, NTYPE1 * * Do the tests only if DOTYPE( IMAT ) is true. * IF( .NOT.DOTYPE( IMAT ) ) $ GO TO 70 * DO 60 IUPLO = 1, 2 * * Do first for UPLO = 'U', then for UPLO = 'L' * UPLO = UPLOS( IUPLO ) * * Call CLATTP to generate a triangular test matrix. * SRNAMT = 'CLATTP' CALL CLATTP( IMAT, UPLO, 'No transpose', DIAG, ISEED, N, $ AP, X, WORK, RWORK, INFO ) * * Set IDIAG = 1 for non-unit matrices, 2 for unit. * IF( LSAME( DIAG, 'N' ) ) THEN IDIAG = 1 ELSE IDIAG = 2 END IF * *+ TEST 1 * Form the inverse of A. * IF( N.GT.0 ) $ CALL CCOPY( LAP, AP, 1, AINVP, 1 ) SRNAMT = 'CTPTRI' CALL CTPTRI( UPLO, DIAG, N, AINVP, INFO ) * * Check error code from CTPTRI. * IF( INFO.NE.0 ) $ CALL ALAERH( PATH, 'CTPTRI', INFO, 0, UPLO // DIAG, N, $ N, -1, -1, -1, IMAT, NFAIL, NERRS, NOUT ) * * Compute the infinity-norm condition number of A. * ANORM = CLANTP( 'I', UPLO, DIAG, N, AP, RWORK ) AINVNM = CLANTP( 'I', UPLO, DIAG, N, AINVP, RWORK ) IF( ANORM.LE.ZERO .OR. AINVNM.LE.ZERO ) THEN RCONDI = ONE ELSE RCONDI = ( ONE / ANORM ) / AINVNM END IF * * Compute the residual for the triangular matrix times its * inverse. Also compute the 1-norm condition number of A. * CALL CTPT01( UPLO, DIAG, N, AP, AINVP, RCONDO, RWORK, $ RESULT( 1 ) ) * * Print the test ratio if it is .GE. THRESH. * IF( RESULT( 1 ).GE.THRESH ) THEN IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 ) $ CALL ALAHD( NOUT, PATH ) WRITE( NOUT, FMT = 9999 )UPLO, DIAG, N, IMAT, 1, $ RESULT( 1 ) NFAIL = NFAIL + 1 END IF NRUN = NRUN + 1 * DO 40 IRHS = 1, NNS NRHS = NSVAL( IRHS ) XTYPE = 'N' * DO 30 ITRAN = 1, NTRAN * * Do for op(A) = A, A**T, or A**H. * TRANS = TRANSS( ITRAN ) IF( ITRAN.EQ.1 ) THEN NORM = 'O' RCONDC = RCONDO ELSE NORM = 'I' RCONDC = RCONDI END IF * *+ TEST 2 * Solve and compute residual for op(A)*x = b. * SRNAMT = 'CLARHS' CALL CLARHS( PATH, XTYPE, UPLO, TRANS, N, N, 0, $ IDIAG, NRHS, AP, LAP, XACT, LDA, B, $ LDA, ISEED, INFO ) XTYPE = 'C' CALL CLACPY( 'Full', N, NRHS, B, LDA, X, LDA ) * SRNAMT = 'CTPTRS' CALL CTPTRS( UPLO, TRANS, DIAG, N, NRHS, AP, X, $ LDA, INFO ) * * Check error code from CTPTRS. * IF( INFO.NE.0 ) $ CALL ALAERH( PATH, 'CTPTRS', INFO, 0, $ UPLO // TRANS // DIAG, N, N, -1, $ -1, -1, IMAT, NFAIL, NERRS, NOUT ) * CALL CTPT02( UPLO, TRANS, DIAG, N, NRHS, AP, X, $ LDA, B, LDA, WORK, RWORK, $ RESULT( 2 ) ) * *+ TEST 3 * Check solution from generated exact solution. * CALL CGET04( N, NRHS, X, LDA, XACT, LDA, RCONDC, $ RESULT( 3 ) ) * *+ TESTS 4, 5, and 6 * Use iterative refinement to improve the solution and * compute error bounds. * SRNAMT = 'CTPRFS' CALL CTPRFS( UPLO, TRANS, DIAG, N, NRHS, AP, B, $ LDA, X, LDA, RWORK, RWORK( NRHS+1 ), $ WORK, RWORK( 2*NRHS+1 ), INFO ) * * Check error code from CTPRFS. * IF( INFO.NE.0 ) $ CALL ALAERH( PATH, 'CTPRFS', INFO, 0, $ UPLO // TRANS // DIAG, N, N, -1, $ -1, NRHS, IMAT, NFAIL, NERRS, $ NOUT ) * CALL CGET04( N, NRHS, X, LDA, XACT, LDA, RCONDC, $ RESULT( 4 ) ) CALL CTPT05( UPLO, TRANS, DIAG, N, NRHS, AP, B, $ LDA, X, LDA, XACT, LDA, RWORK, $ RWORK( NRHS+1 ), RESULT( 5 ) ) * * Print information about the tests that did not pass * the threshold. * DO 20 K = 2, 6 IF( RESULT( K ).GE.THRESH ) THEN IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 ) $ CALL ALAHD( NOUT, PATH ) WRITE( NOUT, FMT = 9998 )UPLO, TRANS, DIAG, $ N, NRHS, IMAT, K, RESULT( K ) NFAIL = NFAIL + 1 END IF 20 CONTINUE NRUN = NRUN + 5 30 CONTINUE 40 CONTINUE * *+ TEST 7 * Get an estimate of RCOND = 1/CNDNUM. * DO 50 ITRAN = 1, 2 IF( ITRAN.EQ.1 ) THEN NORM = 'O' RCONDC = RCONDO ELSE NORM = 'I' RCONDC = RCONDI END IF SRNAMT = 'CTPCON' CALL CTPCON( NORM, UPLO, DIAG, N, AP, RCOND, WORK, $ RWORK, INFO ) * * Check error code from CTPCON. * IF( INFO.NE.0 ) $ CALL ALAERH( PATH, 'CTPCON', INFO, 0, $ NORM // UPLO // DIAG, N, N, -1, -1, $ -1, IMAT, NFAIL, NERRS, NOUT ) * CALL CTPT06( RCOND, RCONDC, UPLO, DIAG, N, AP, RWORK, $ RESULT( 7 ) ) * * Print the test ratio if it is .GE. THRESH. * IF( RESULT( 7 ).GE.THRESH ) THEN IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 ) $ CALL ALAHD( NOUT, PATH ) WRITE( NOUT, FMT = 9997 ) 'CTPCON', NORM, UPLO, $ DIAG, N, IMAT, 7, RESULT( 7 ) NFAIL = NFAIL + 1 END IF NRUN = NRUN + 1 50 CONTINUE 60 CONTINUE 70 CONTINUE * * Use pathological test matrices to test CLATPS. * DO 100 IMAT = NTYPE1 + 1, NTYPES * * Do the tests only if DOTYPE( IMAT ) is true. * IF( .NOT.DOTYPE( IMAT ) ) $ GO TO 100 * DO 90 IUPLO = 1, 2 * * Do first for UPLO = 'U', then for UPLO = 'L' * UPLO = UPLOS( IUPLO ) DO 80 ITRAN = 1, NTRAN * * Do for op(A) = A, A**T, or A**H. * TRANS = TRANSS( ITRAN ) * * Call CLATTP to generate a triangular test matrix. * SRNAMT = 'CLATTP' CALL CLATTP( IMAT, UPLO, TRANS, DIAG, ISEED, N, AP, X, $ WORK, RWORK, INFO ) * *+ TEST 8 * Solve the system op(A)*x = b. * SRNAMT = 'CLATPS' CALL CCOPY( N, X, 1, B, 1 ) CALL CLATPS( UPLO, TRANS, DIAG, 'N', N, AP, B, SCALE, $ RWORK, INFO ) * * Check error code from CLATPS. * IF( INFO.NE.0 ) $ CALL ALAERH( PATH, 'CLATPS', INFO, 0, $ UPLO // TRANS // DIAG // 'N', N, N, $ -1, -1, -1, IMAT, NFAIL, NERRS, NOUT ) * CALL CTPT03( UPLO, TRANS, DIAG, N, 1, AP, SCALE, $ RWORK, ONE, B, LDA, X, LDA, WORK, $ RESULT( 8 ) ) * *+ TEST 9 * Solve op(A)*x = b again with NORMIN = 'Y'. * CALL CCOPY( N, X, 1, B( N+1 ), 1 ) CALL CLATPS( UPLO, TRANS, DIAG, 'Y', N, AP, B( N+1 ), $ SCALE, RWORK, INFO ) * * Check error code from CLATPS. * IF( INFO.NE.0 ) $ CALL ALAERH( PATH, 'CLATPS', INFO, 0, $ UPLO // TRANS // DIAG // 'Y', N, N, $ -1, -1, -1, IMAT, NFAIL, NERRS, NOUT ) * CALL CTPT03( UPLO, TRANS, DIAG, N, 1, AP, SCALE, $ RWORK, ONE, B( N+1 ), LDA, X, LDA, WORK, $ RESULT( 9 ) ) * * Print information about the tests that did not pass * the threshold. * IF( RESULT( 8 ).GE.THRESH ) THEN IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 ) $ CALL ALAHD( NOUT, PATH ) WRITE( NOUT, FMT = 9996 )'CLATPS', UPLO, TRANS, $ DIAG, 'N', N, IMAT, 8, RESULT( 8 ) NFAIL = NFAIL + 1 END IF IF( RESULT( 9 ).GE.THRESH ) THEN IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 ) $ CALL ALAHD( NOUT, PATH ) WRITE( NOUT, FMT = 9996 )'CLATPS', UPLO, TRANS, $ DIAG, 'Y', N, IMAT, 9, RESULT( 9 ) NFAIL = NFAIL + 1 END IF NRUN = NRUN + 2 80 CONTINUE 90 CONTINUE 100 CONTINUE 110 CONTINUE * * Print a summary of the results. * CALL ALASUM( PATH, NOUT, NFAIL, NRUN, NERRS ) * 9999 FORMAT( ' UPLO=, DIAG=, N=', I5, $ ', type ', I2, ', test(', I2, ')= ', G12.5 ) 9998 FORMAT( ' UPLO=, TRANS=, DIAG=''', A1, $ ''', N=', I5, ''', NRHS=', I5, ', type ', I2, ', test(', $ I2, ')= ', G12.5 ) 9997 FORMAT( 1X, A, '( , , ,', $ I5, ', ... ), type ', I2, ', test(', I2, ')=', G12.5 ) 9996 FORMAT( 1X, A, '( , , , ''',
#include "slu_cdefs.h" void cgstrf (superlu_options_t *options, SuperMatrix *A, int relax, int panel_size, int *etree, void *work, int lwork, int *perm_c, int *perm_r, SuperMatrix *L, SuperMatrix *U, GlobalLU_t *Glu, /* persistent to facilitate multiple factorizations */ SuperLUStat_t *stat, int *info) { /* Local working arrays */ NCPformat *Astore; int *iperm_r = NULL; /* inverse of perm_r; used when options->Fact == <API key> */ int *iperm_c; /* inverse of perm_c */ int *iwork; complex *cwork; int *segrep, *repfnz, *parent, *xplore; int *panel_lsub; /* dense[]/panel_lsub[] pair forms a w-wide SPA */ int *xprune; int *marker; complex *dense, *tempv; int *relax_end; complex *a; int *asub; int *xa_begin, *xa_end; int *xsup, *supno; int *xlsub, *xlusup, *xusub; int nzlumax; float fill_ratio = sp_ienv(6); /* estimated fill ratio */ /* Local scalars */ fact_t fact = options->Fact; double diag_pivot_thresh = options->DiagPivotThresh; int pivrow; /* pivotal row number in the original matrix A */ int nseg1; /* no of segments in U-column above panel row jcol */ int nseg; /* no of segments in each U-column */ register int jcol; register int kcol; /* end column of a relaxed snode */ register int icol; register int i, k, jj, new_next, iinfo; int m, n, min_mn, jsupno, fsupc, nextlu, nextu; int w_def; /* upper bound on panel width */ int usepr, iperm_r_allocated = 0; int nnzL, nnzU; int *panel_histo = stat->panel_histo; flops_t *ops = stat->ops; iinfo = 0; m = A->nrow; n = A->ncol; min_mn = SUPERLU_MIN(m, n); Astore = A->Store; a = Astore->nzval; asub = Astore->rowind; xa_begin = Astore->colbeg; xa_end = Astore->colend; /* Allocate storage common to the factor routines */ *info = cLUMemInit(fact, work, lwork, m, n, Astore->nnz, panel_size, fill_ratio, L, U, Glu, &iwork, &cwork); if ( *info ) return; xsup = Glu->xsup; supno = Glu->supno; xlsub = Glu->xlsub; xlusup = Glu->xlusup; xusub = Glu->xusub; SetIWork(m, n, panel_size, iwork, &segrep, &parent, &xplore, &repfnz, &panel_lsub, &xprune, &marker); cSetRWork(m, panel_size, cwork, &dense, &tempv); usepr = (fact == <API key>); if ( usepr ) { /* Compute the inverse of perm_r */ iperm_r = (int *) intMalloc(m); for (k = 0; k < m; ++k) iperm_r[perm_r[k]] = k; iperm_r_allocated = 1; } iperm_c = (int *) intMalloc(n); for (k = 0; k < n; ++k) iperm_c[perm_c[k]] = k; /* Identify relaxed snodes */ relax_end = (int *) intMalloc(n); if ( options->SymmetricMode == YES ) { heap_relax_snode(n, etree, relax, marker, relax_end); } else { relax_snode(n, etree, relax, marker, relax_end); } ifill (perm_r, m, EMPTY); ifill (marker, m * NO_MARKER, EMPTY); supno[0] = -1; xsup[0] = xlsub[0] = xusub[0] = xlusup[0] = 0; w_def = panel_size; /* * Work on one "panel" at a time. A panel is one of the following: * (a) a relaxed supernode at the bottom of the etree, or * (b) panel_size contiguous columns, defined by the user */ for (jcol = 0; jcol < min_mn; ) { if ( relax_end[jcol] != EMPTY ) { /* start of a relaxed snode */ kcol = relax_end[jcol]; /* end of the relaxed snode */ panel_histo[kcol-jcol+1]++; /* Determine the union of the row structure of the snode */ if ( (*info = csnode_dfs(jcol, kcol, asub, xa_begin, xa_end, xprune, marker, Glu)) != 0 ) return; nextu = xusub[jcol]; nextlu = xlusup[jcol]; jsupno = supno[jcol]; fsupc = xsup[jsupno]; new_next = nextlu + (xlsub[fsupc+1]-xlsub[fsupc])*(kcol-jcol+1); nzlumax = Glu->nzlumax; while ( new_next > nzlumax ) { if ( (*info = cLUMemXpand(jcol, nextlu, LUSUP, &nzlumax, Glu)) ) return; } for (icol = jcol; icol<= kcol; icol++) { xusub[icol+1] = nextu; /* Scatter into SPA dense[*] */ for (k = xa_begin[icol]; k < xa_end[icol]; k++) dense[asub[k]] = a[k]; /* Numeric update within the snode */ csnode_bmod(icol, jsupno, fsupc, dense, tempv, Glu, stat); if ( (*info = cpivotL(icol, diag_pivot_thresh, &usepr, perm_r, iperm_r, iperm_c, &pivrow, Glu, stat)) ) if ( iinfo == 0 ) iinfo = *info; #ifdef DEBUG cprint_lu_col("[1]: ", icol, pivrow, xprune, Glu); #endif } jcol = icol; } else { /* Work on one panel of panel_size columns */ /* Adjust panel_size so that a panel won't overlap with the next * relaxed snode. */ panel_size = w_def; for (k = jcol + 1; k < SUPERLU_MIN(jcol+panel_size, min_mn); k++) if ( relax_end[k] != EMPTY ) { panel_size = k - jcol; break; } if ( k == min_mn ) panel_size = min_mn - jcol; panel_histo[panel_size]++; /* symbolic factor on a panel of columns */ cpanel_dfs(m, panel_size, jcol, A, perm_r, &nseg1, dense, panel_lsub, segrep, repfnz, xprune, marker, parent, xplore, Glu); /* numeric sup-panel updates in topological order */ cpanel_bmod(m, panel_size, jcol, nseg1, dense, tempv, segrep, repfnz, Glu, stat); /* Sparse LU within the panel, and below panel diagonal */ for ( jj = jcol; jj < jcol + panel_size; jj++) { k = (jj - jcol) * m; /* column index for w-wide arrays */ nseg = nseg1; /* Begin after all the panel segments */ if ((*info = ccolumn_dfs(m, jj, perm_r, &nseg, &panel_lsub[k], segrep, &repfnz[k], xprune, marker, parent, xplore, Glu)) != 0) return; /* Numeric updates */ if ((*info = ccolumn_bmod(jj, (nseg - nseg1), &dense[k], tempv, &segrep[nseg1], &repfnz[k], jcol, Glu, stat)) != 0) return; /* Copy the U-segments to ucol[*] */ if ((*info = ccopy_to_ucol(jj, nseg, segrep, &repfnz[k], perm_r, &dense[k], Glu)) != 0) return; if ( (*info = cpivotL(jj, diag_pivot_thresh, &usepr, perm_r, iperm_r, iperm_c, &pivrow, Glu, stat)) ) if ( iinfo == 0 ) iinfo = *info; /* Prune columns (0:jj-1) using column jj */ cpruneL(jj, perm_r, pivrow, nseg, segrep, &repfnz[k], xprune, Glu); /* Reset repfnz[] for this column */ resetrep_col (nseg, segrep, &repfnz[k]); #ifdef DEBUG cprint_lu_col("[2]: ", jj, pivrow, xprune, Glu); #endif } jcol += panel_size; /* Move to the next panel */ } /* else */ } /* for */ *info = iinfo; if ( m > n ) { k = 0; for (i = 0; i < m; ++i) if ( perm_r[i] == EMPTY ) { perm_r[i] = n + k; ++k; } } countnz(min_mn, xprune, &nnzL, &nnzU, Glu); fixupL(min_mn, perm_r, Glu); cLUWorkFree(iwork, cwork, Glu); /* Free work space and compress storage */ if ( fact == <API key> ) { /* L and U structures may have changed due to possibly different pivoting, even though the storage is available. There could also be memory expansions, so the array locations may have changed, */ ((SCformat *)L->Store)->nnz = nnzL; ((SCformat *)L->Store)->nsuper = Glu->supno[n]; ((SCformat *)L->Store)->nzval = (complex *) Glu->lusup; ((SCformat *)L->Store)->nzval_colptr = Glu->xlusup; ((SCformat *)L->Store)->rowind = Glu->lsub; ((SCformat *)L->Store)->rowind_colptr = Glu->xlsub; ((NCformat *)U->Store)->nnz = nnzU; ((NCformat *)U->Store)->nzval = (complex *) Glu->ucol; ((NCformat *)U->Store)->rowind = Glu->usub; ((NCformat *)U->Store)->colptr = Glu->xusub; } else { <API key>(L, A->nrow, min_mn, nnzL, (complex *) Glu->lusup, Glu->xlusup, Glu->lsub, Glu->xlsub, Glu->supno, Glu->xsup, SLU_SC, SLU_C, SLU_TRLU); <API key>(U, min_mn, min_mn, nnzU, (complex *) Glu->ucol, Glu->usub, Glu->xusub, SLU_NC, SLU_C, SLU_TRU); } ops[FACT] += ops[TRSV] + ops[GEMV]; stat->expansions = --(Glu->num_expansions); if ( iperm_r_allocated ) SUPERLU_FREE (iperm_r); SUPERLU_FREE (iperm_c); SUPERLU_FREE (relax_end); }
// <API key>: GPL-2.0-only #include <linux/clk.h> #include <linux/delay.h> #include <linux/dma-buf.h> #include <linux/of_graph.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_fourcc.h> #include <drm/<API key>.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_vblank.h> #include "pl111_drm.h" irqreturn_t pl111_irq(int irq, void *data) { struct <API key> *priv = data; u32 irq_stat; irqreturn_t status = IRQ_NONE; irq_stat = readl(priv->regs + CLCD_PL111_MIS); if (!irq_stat) return IRQ_NONE; if (irq_stat & <API key>) { <API key>(&priv->pipe.crtc); status = IRQ_HANDLED; } /* Clear the interrupt once done */ writel(irq_stat, priv->regs + CLCD_PL111_ICR); return status; } static enum drm_mode_status pl111_mode_valid(struct <API key> *pipe, const struct drm_display_mode *mode) { struct drm_device *drm = pipe->crtc.dev; struct <API key> *priv = drm->dev_private; u32 cpp = priv->variant->fb_bpp / 8; u64 bw; /* * We use the pixelclock to also account for interlaced modes, the * resulting bandwidth is in bytes per second. */ bw = mode->clock * 1000ULL; /* In Hz */ bw = bw * mode->hdisplay * mode->vdisplay * cpp; bw = div_u64(bw, mode->htotal * mode->vtotal); /* * If no bandwidth constraints, anything goes, else * check if we are too fast. */ if (priv->memory_bw && (bw > priv->memory_bw)) { DRM_DEBUG_KMS("%d x %d @ %d Hz, %d cpp, bw %llu too fast\n", mode->hdisplay, mode->vdisplay, mode->clock * 1000, cpp, bw); return MODE_BAD; } DRM_DEBUG_KMS("%d x %d @ %d Hz, %d cpp, bw %llu bytes/s OK\n", mode->hdisplay, mode->vdisplay, mode->clock * 1000, cpp, bw); return MODE_OK; } static int pl111_display_check(struct <API key> *pipe, struct drm_plane_state *pstate, struct drm_crtc_state *cstate) { const struct drm_display_mode *mode = &cstate->mode; struct drm_framebuffer *old_fb = pipe->plane.state->fb; struct drm_framebuffer *fb = pstate->fb; if (mode->hdisplay % 16) return -EINVAL; if (fb) { u32 offset = <API key>(fb, pstate, 0); /* FB base address must be dword aligned. */ if (offset & 3) return -EINVAL; /* There's no pitch register -- the mode's hdisplay * controls it. */ if (fb->pitches[0] != mode->hdisplay * fb->format->cpp[0]) return -EINVAL; /* We can't change the FB format in a flicker-free * manner (and only update it during CRTC enable). */ if (old_fb && old_fb->format != fb->format) cstate->mode_changed = true; } return 0; } static void <API key>(struct <API key> *pipe, struct drm_crtc_state *cstate, struct drm_plane_state *plane_state) { struct drm_crtc *crtc = &pipe->crtc; struct drm_plane *plane = &pipe->plane; struct drm_device *drm = crtc->dev; struct <API key> *priv = drm->dev_private; const struct drm_display_mode *mode = &cstate->mode; struct drm_framebuffer *fb = plane->state->fb; struct drm_connector *connector = priv->connector; struct drm_bridge *bridge = priv->bridge; bool grayscale = false; u32 cntl; u32 ppl, hsw, hfp, hbp; u32 lpp, vsw, vfp, vbp; u32 cpl, tim2; int ret; ret = clk_set_rate(priv->clk, mode->clock * 1000); if (ret) { dev_err(drm->dev, "Failed to set pixel clock rate to %d: %d\n", mode->clock * 1000, ret); } clk_prepare_enable(priv->clk); ppl = (mode->hdisplay / 16) - 1; hsw = mode->hsync_end - mode->hsync_start - 1; hfp = mode->hsync_start - mode->hdisplay - 1; hbp = mode->htotal - mode->hsync_end - 1; lpp = mode->vdisplay - 1; vsw = mode->vsync_end - mode->vsync_start - 1; vfp = mode->vsync_start - mode->vdisplay; vbp = mode->vtotal - mode->vsync_end; cpl = mode->hdisplay - 1; writel((ppl << 2) | (hsw << 8) | (hfp << 16) | (hbp << 24), priv->regs + CLCD_TIM0); writel(lpp | (vsw << 10) | (vfp << 16) | (vbp << 24), priv->regs + CLCD_TIM1); spin_lock(&priv->tim2_lock); tim2 = readl(priv->regs + CLCD_TIM2); tim2 &= (TIM2_BCD | TIM2_PCD_LO_MASK | TIM2_PCD_HI_MASK); if (priv->variant->broken_clockdivider) tim2 |= TIM2_BCD; if (mode->flags & <API key>) tim2 |= TIM2_IHS; if (mode->flags & <API key>) tim2 |= TIM2_IVS; if (connector) { if (connector->display_info.bus_flags & DRM_BUS_FLAG_DE_LOW) tim2 |= TIM2_IOE; if (connector->display_info.bus_flags & <API key>) tim2 |= TIM2_IPC; if (connector->display_info.num_bus_formats == 1 && connector->display_info.bus_formats[0] == <API key>) grayscale = true; /* * The AC pin bias frequency is set to max count when using * grayscale so at least once in a while we will reverse * polarity and get rid of any DC built up that could * damage the display. */ if (grayscale) tim2 |= TIM2_ACB_MASK; } if (bridge) { const struct drm_bridge_timings *btimings = bridge->timings; /* * Here is when things get really fun. Sometimes the bridge * timings are such that the signal out from PL11x is not * stable before the receiving bridge (such as a dumb VGA DAC * or similar) samples it. If that happens, we compensate by * the only method we have: output the data on the opposite * edge of the clock so it is for sure stable when it gets * sampled. * * The PL111 manual does not contain proper timining diagrams * or data for these details, but we know from experiments * that the setup time is more than 3000 picoseconds (3 ns). * If we have a bridge that requires the signal to be stable * earlier than 3000 ps before the clock pulse, we have to * output the data on the opposite edge to avoid flicker. */ if (btimings && btimings->setup_time_ps >= 3000) tim2 ^= TIM2_IPC; } tim2 |= cpl << 16; writel(tim2, priv->regs + CLCD_TIM2); spin_unlock(&priv->tim2_lock); writel(0, priv->regs + CLCD_TIM3); /* * Detect grayscale bus format. We do not support a grayscale mode * toward userspace, instead we expose an RGB24 buffer and then the * hardware will activate its grayscaler to convert to the grayscale * format. */ if (grayscale) cntl = CNTL_LCDEN | CNTL_LCDMONO8; else /* Else we assume TFT display */ cntl = CNTL_LCDEN | CNTL_LCDTFT | CNTL_LCDVCOMP(1); /* On the ST Micro variant, assume all 24 bits are connected */ if (priv->variant->st_bitmux_control) cntl |= CNTL_ST_CDWID_24; /* * Note that the the ARM hardware's format reader takes 'r' from * the low bit, while DRM formats list channels from high bit * to low bit as you read left to right. The ST Micro version of * the PL110 (LCDC) however uses the standard DRM format. */ switch (fb->format->format) { case DRM_FORMAT_BGR888: /* Only supported on the ST Micro variant */ if (priv->variant->st_bitmux_control) cntl |= <API key> | CNTL_BGR; break; case DRM_FORMAT_RGB888: /* Only supported on the ST Micro variant */ if (priv->variant->st_bitmux_control) cntl |= <API key>; break; case DRM_FORMAT_ABGR8888: case DRM_FORMAT_XBGR8888: if (priv->variant->st_bitmux_control) cntl |= CNTL_LCDBPP24 | CNTL_BGR; else cntl |= CNTL_LCDBPP24; break; case DRM_FORMAT_ARGB8888: case DRM_FORMAT_XRGB8888: if (priv->variant->st_bitmux_control) cntl |= CNTL_LCDBPP24; else cntl |= CNTL_LCDBPP24 | CNTL_BGR; break; case DRM_FORMAT_BGR565: if (priv->variant->is_pl110) cntl |= CNTL_LCDBPP16; else if (priv->variant->st_bitmux_control) cntl |= CNTL_LCDBPP16 | CNTL_ST_1XBPP_565 | CNTL_BGR; else cntl |= CNTL_LCDBPP16_565; break; case DRM_FORMAT_RGB565: if (priv->variant->is_pl110) cntl |= CNTL_LCDBPP16 | CNTL_BGR; else if (priv->variant->st_bitmux_control) cntl |= CNTL_LCDBPP16 | CNTL_ST_1XBPP_565; else cntl |= CNTL_LCDBPP16_565 | CNTL_BGR; break; case DRM_FORMAT_ABGR1555: case DRM_FORMAT_XBGR1555: cntl |= CNTL_LCDBPP16; if (priv->variant->st_bitmux_control) cntl |= CNTL_ST_1XBPP_5551 | CNTL_BGR; break; case DRM_FORMAT_ARGB1555: case DRM_FORMAT_XRGB1555: cntl |= CNTL_LCDBPP16; if (priv->variant->st_bitmux_control) cntl |= CNTL_ST_1XBPP_5551; else cntl |= CNTL_BGR; break; case DRM_FORMAT_ABGR4444: case DRM_FORMAT_XBGR4444: cntl |= CNTL_LCDBPP16_444; if (priv->variant->st_bitmux_control) cntl |= CNTL_ST_1XBPP_444 | CNTL_BGR; break; case DRM_FORMAT_ARGB4444: case DRM_FORMAT_XRGB4444: cntl |= CNTL_LCDBPP16_444; if (priv->variant->st_bitmux_control) cntl |= CNTL_ST_1XBPP_444; else cntl |= CNTL_BGR; break; default: WARN_ONCE(true, "Unknown FB format 0x%08x\n", fb->format->format); break; } /* The PL110 in Integrator/Versatile does the BGR routing externally */ if (priv->variant->external_bgr) cntl &= ~CNTL_BGR; /* Power sequence: first enable and chill */ writel(cntl, priv->regs + priv->ctrl); /* * We expect this delay to stabilize the contrast * voltage Vee as stipulated by the manual */ msleep(20); if (priv-><API key>) priv-><API key>(drm, fb->format->format); /* Power Up */ cntl |= CNTL_LCDPWR; writel(cntl, priv->regs + priv->ctrl); if (!priv->variant->broken_vblank) drm_crtc_vblank_on(crtc); } static void <API key>(struct <API key> *pipe) { struct drm_crtc *crtc = &pipe->crtc; struct drm_device *drm = crtc->dev; struct <API key> *priv = drm->dev_private; u32 cntl; if (!priv->variant->broken_vblank) drm_crtc_vblank_off(crtc); /* Power Down */ cntl = readl(priv->regs + priv->ctrl); if (cntl & CNTL_LCDPWR) { cntl &= ~CNTL_LCDPWR; writel(cntl, priv->regs + priv->ctrl); } /* * We expect this delay to stabilize the contrast voltage Vee as * stipulated by the manual */ msleep(20); if (priv-><API key>) priv-><API key>(drm); /* Disable */ writel(0, priv->regs + priv->ctrl); <API key>(priv->clk); } static void <API key>(struct <API key> *pipe, struct drm_plane_state *old_pstate) { struct drm_crtc *crtc = &pipe->crtc; struct drm_device *drm = crtc->dev; struct <API key> *priv = drm->dev_private; struct <API key> *event = crtc->state->event; struct drm_plane *plane = &pipe->plane; struct drm_plane_state *pstate = plane->state; struct drm_framebuffer *fb = pstate->fb; if (fb) { u32 addr = <API key>(fb, pstate, 0); writel(addr, priv->regs + CLCD_UBAS); } if (event) { crtc->state->event = NULL; spin_lock_irq(&crtc->dev->event_lock); if (crtc->state->active && drm_crtc_vblank_get(crtc) == 0) <API key>(crtc, event); else <API key>(crtc, event); spin_unlock_irq(&crtc->dev->event_lock); } } static int <API key>(struct <API key> *pipe) { struct drm_crtc *crtc = &pipe->crtc; struct drm_device *drm = crtc->dev; struct <API key> *priv = drm->dev_private; writel(<API key>, priv->regs + priv->ienb); return 0; } static void <API key>(struct <API key> *pipe) { struct drm_crtc *crtc = &pipe->crtc; struct drm_device *drm = crtc->dev; struct <API key> *priv = drm->dev_private; writel(0, priv->regs + priv->ienb); } static struct <API key> pl111_display_funcs = { .mode_valid = pl111_mode_valid, .check = pl111_display_check, .enable = <API key>, .disable = <API key>, .update = <API key>, }; static int <API key>(struct clk_hw *hw, unsigned long rate, unsigned long *prate, bool set_parent) { int best_div = 1, div; struct clk_hw *parent = clk_hw_get_parent(hw); unsigned long best_prate = 0; unsigned long best_diff = ~0ul; int max_div = (1 << (TIM2_PCD_LO_BITS + TIM2_PCD_HI_BITS)) - 1; for (div = 1; div < max_div; div++) { unsigned long this_prate, div_rate, diff; if (set_parent) this_prate = clk_hw_round_rate(parent, rate * div); else this_prate = *prate; div_rate = DIV_ROUND_UP_ULL(this_prate, div); diff = abs(rate - div_rate); if (diff < best_diff) { best_div = div; best_diff = diff; best_prate = this_prate; } } *prate = best_prate; return best_div; } static long <API key>(struct clk_hw *hw, unsigned long rate, unsigned long *prate) { int div = <API key>(hw, rate, prate, true); return DIV_ROUND_UP_ULL(*prate, div); } static unsigned long <API key>(struct clk_hw *hw, unsigned long prate) { struct <API key> *priv = container_of(hw, struct <API key>, clk_div); u32 tim2 = readl(priv->regs + CLCD_TIM2); int div; if (tim2 & TIM2_BCD) return prate; div = tim2 & TIM2_PCD_LO_MASK; div |= (tim2 & TIM2_PCD_HI_MASK) >> (TIM2_PCD_HI_SHIFT - TIM2_PCD_LO_BITS); div += 2; return DIV_ROUND_UP_ULL(prate, div); } static int <API key>(struct clk_hw *hw, unsigned long rate, unsigned long prate) { struct <API key> *priv = container_of(hw, struct <API key>, clk_div); int div = <API key>(hw, rate, &prate, false); u32 tim2; spin_lock(&priv->tim2_lock); tim2 = readl(priv->regs + CLCD_TIM2); tim2 &= ~(TIM2_BCD | TIM2_PCD_LO_MASK | TIM2_PCD_HI_MASK); if (div == 1) { tim2 |= TIM2_BCD; } else { div -= 2; tim2 |= div & TIM2_PCD_LO_MASK; tim2 |= (div >> TIM2_PCD_LO_BITS) << TIM2_PCD_HI_SHIFT; } writel(tim2, priv->regs + CLCD_TIM2); spin_unlock(&priv->tim2_lock); return 0; } static const struct clk_ops pl111_clk_div_ops = { .recalc_rate = <API key>, .round_rate = <API key>, .set_rate = <API key>, }; static int <API key>(struct drm_device *drm) { struct <API key> *priv = drm->dev_private; struct clk *parent = devm_clk_get(drm->dev, "clcdclk"); struct clk_hw *div = &priv->clk_div; const char *parent_name; struct clk_init_data init = { .name = "pl111_div", .ops = &pl111_clk_div_ops, .parent_names = &parent_name, .num_parents = 1, .flags = CLK_SET_RATE_PARENT, }; int ret; if (IS_ERR(parent)) { dev_err(drm->dev, "CLCD: unable to get clcdclk.\n"); return PTR_ERR(parent); } spin_lock_init(&priv->tim2_lock); /* If the clock divider is broken, use the parent directly */ if (priv->variant->broken_clockdivider) { priv->clk = parent; return 0; } parent_name = __clk_get_name(parent); div->init = &init; ret = <API key>(drm->dev, div); priv->clk = div->clk; return ret; } int pl111_display_init(struct drm_device *drm) { struct <API key> *priv = drm->dev_private; int ret; ret = <API key>(drm); if (ret) return ret; if (!priv->variant->broken_vblank) { pl111_display_funcs.enable_vblank = <API key>; pl111_display_funcs.disable_vblank = <API key>; } ret = <API key>(drm, &priv->pipe, &pl111_display_funcs, priv->variant->formats, priv->variant->nformats, NULL, priv->connector); if (ret) return ret; return 0; }
require "abstract_unit" module ActionDispatch module Routing class MapperTest < ActiveSupport::TestCase class FakeSet < ActionDispatch::Routing::RouteSet def <API key> {} end def request_class ActionDispatch::Request end def dispatcher_class RouteSet::Dispatcher end def defaults routes.map(&:defaults) end def conditions routes.map(&:constraints) end def requirements routes.map(&:path).map(&:requirements) end def asts routes.map(&:path).map(&:spec) end end def test_initialize Mapper.new FakeSet.new end def <API key> fakeset = FakeSet.new mapper = Mapper.new fakeset assert_raises(ArgumentError) do mapper.scope(anchor: false) do end end end def <API key> fakeset = FakeSet.new mapper = Mapper.new fakeset assert_raises(ArgumentError) do mapper.match "/", to: "posts#index", as: :main end end def <API key> fakeset = FakeSet.new mapper = Mapper.new fakeset mapper.get "/foo", to: "posts#index", as: :main, format: true assert_equal({ controller: "posts", action: "index" }, fakeset.defaults.first) assert_equal "/foo.:format", fakeset.asts.first.to_s end def <API key> fakeset = FakeSet.new mapper = Mapper.new fakeset mapper.scope(format: true) do mapper.get "/foo", to: "posts#index", as: :main end assert_equal({ controller: "posts", action: "index" }, fakeset.defaults.first) assert_equal "/foo.:format", fakeset.asts.first.to_s end def test_random_keys fakeset = FakeSet.new mapper = Mapper.new fakeset mapper.scope(omg: :awesome) do mapper.get "/", to: "posts#index", as: :main end assert_equal({ omg: :awesome, controller: "posts", action: "index" }, fakeset.defaults.first) assert_equal("GET", fakeset.routes.first.verb) end def <API key> options = {} scope = Mapper::Scope.new({}) ast = Journey::Parser.parse "/store/:name(*rest)" m = Mapper::Mapping.build(scope, FakeSet.new, ast, "foo", "bar", nil, [:get], nil, {}, true, options) assert_equal(/.+?/, m.requirements[:rest]) end def test_via_scope fakeset = FakeSet.new mapper = Mapper.new fakeset mapper.scope(via: :put) do mapper.match "/", to: "posts#index", as: :main end assert_equal("PUT", fakeset.routes.first.verb) end def test_to_scope fakeset = FakeSet.new mapper = Mapper.new fakeset mapper.scope(to: "posts#index") do mapper.get :all mapper.post :most end assert_equal "posts#index", fakeset.routes.to_a[0].defaults[:to] assert_equal "posts#index", fakeset.routes.to_a[1].defaults[:to] end def test_map_slash fakeset = FakeSet.new mapper = Mapper.new fakeset mapper.get "/", to: "posts#index", as: :main assert_equal "/", fakeset.asts.first.to_s end def <API key> fakeset = FakeSet.new mapper = Mapper.new fakeset # FIXME: is this a desired behavior? mapper.get "/one/two/", to: "posts#index", as: :main assert_equal "/one/two(.:format)", fakeset.asts.first.to_s end def test_map_wildcard fakeset = FakeSet.new mapper = Mapper.new fakeset
// ipv4_header.hpp #ifndef IPV4_HEADER_HPP #define IPV4_HEADER_HPP #include <algorithm> #include <asio/ip/address_v4.hpp> // Packet header for IPv4. // The wire format of an IPv4 header is: // 0 8 16 31 // |version|header | type of | total length in bytes | | // | (4) | length| service | | | // | identification |0|D|M| fragment offset | | // | time to live | protocol | header checksum | 20 bytes // | source IPv4 address | | // | destination IPv4 address | | // / options (if any) / 0 - 40 // / / bytes class ipv4_header { public: ipv4_header() { std::fill(rep_, rep_ + sizeof(rep_), 0); } unsigned char version() const { return (rep_[0] >> 4) & 0xF; } unsigned short header_length() const { return (rep_[0] & 0xF) * 4; } unsigned char type_of_service() const { return rep_[1]; } unsigned short total_length() const { return decode(2, 3); } unsigned short identification() const { return decode(4, 5); } bool dont_fragment() const { return (rep_[6] & 0x40) != 0; } bool more_fragments() const { return (rep_[6] & 0x20) != 0; } unsigned short fragment_offset() const { return decode(6, 7) & 0x1FFF; } unsigned int time_to_live() const { return rep_[8]; } unsigned char protocol() const { return rep_[9]; } unsigned short header_checksum() const { return decode(10, 11); } asio::ip::address_v4 source_address() const { asio::ip::address_v4::bytes_type bytes = { { rep_[12], rep_[13], rep_[14], rep_[15] } }; return asio::ip::address_v4(bytes); } asio::ip::address_v4 destination_address() const { asio::ip::address_v4::bytes_type bytes = { { rep_[16], rep_[17], rep_[18], rep_[19] } }; return asio::ip::address_v4(bytes); } friend std::istream& operator>>(std::istream& is, ipv4_header& header) { is.read(reinterpret_cast<char*>(header.rep_), 20); if (header.version() != 4) is.setstate(std::ios::failbit); std::streamsize options_length = header.header_length() - 20; if (options_length < 0 || options_length > 40) is.setstate(std::ios::failbit); else is.read(reinterpret_cast<char*>(header.rep_) + 20, options_length); return is; } private: unsigned short decode(int a, int b) const { return (rep_[a] << 8) + rep_[b]; } unsigned char rep_[60]; }; #endif // IPV4_HEADER_HPP
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: :: Bake is a shell script for running CakePHP bake script :: PHP 5 :: :: CakePHP(tm) : Rapid Development Framework (http://cakephp.org) :: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) :: :: Licensed under The MIT License :: Redistributions of files must retain the above copyright notice. :: :: @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) :: @link http://cakephp.org CakePHP(tm) Project :: @package Cake.Console :: @since CakePHP(tm) v 1.2.0.5012 :: @license http: :: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: In order for this script to work as intended, the cake\console\ folder must be in your PATH @echo. @echo off SET app=%0 SET lib=%~dp0 php -q "%lib%cake.php" -working "%CD% " %* echo. exit /B %ERRORLEVEL%
using System.Runtime.InteropServices; internal static partial class Interop { internal static partial class libc { [DllImport(Libraries.Libc, SetLastError = true)] internal static extern int sysconf(int name); } }
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. namespace Microsoft.Azure.Management.CustomerInsights { using Azure; using Management; using Rest; using Rest.Azure; using Models; using System.Collections; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; <summary> <API key> operations. </summary> public partial interface <API key> { <summary> Gets all the role assignments for the specified hub. </summary> <param name='resourceGroupName'> The name of the resource group. </param> <param name='hubName'> The name of the hub. </param> <param name='customHeaders'> The headers that will be added to request. </param> <param name='cancellationToken'> The cancellation token. </param> <exception cref="Microsoft.Rest.Azure.CloudException"> Thrown when the operation returned an invalid status code </exception> <exception cref="Microsoft.Rest.<API key>"> Thrown when unable to deserialize the response </exception> <exception cref="Microsoft.Rest.ValidationException"> Thrown when a required parameter is null </exception> Task<<API key><IPage<<API key>>>> <API key>(string resourceGroupName, string hubName, Dictionary<string, List<string>> customHeaders = null, Cancellation<API key> = default(CancellationToken)); <summary> Creates or updates a role assignment in the hub. </summary> <param name='resourceGroupName'> The name of the resource group. </param> <param name='hubName'> The name of the hub. </param> <param name='assignmentName'> The assignment name </param> <param name='parameters'> Parameters supplied to the CreateOrUpdate RoleAssignment operation. </param> <param name='customHeaders'> The headers that will be added to request. </param> <param name='cancellationToken'> The cancellation token. </param> <exception cref="Microsoft.Rest.Azure.CloudException"> Thrown when the operation returned an invalid status code </exception> <exception cref="Microsoft.Rest.<API key>"> Thrown when unable to deserialize the response </exception> <exception cref="Microsoft.Rest.ValidationException"> Thrown when a required parameter is null </exception> Task<<API key><<API key>>> <API key>(string resourceGroupName, string hubName, string assignmentName, <API key> parameters, Dictionary<string, List<string>> customHeaders = null, Cancellation<API key> = default(CancellationToken)); <summary> Gets the role assignment in the hub. </summary> <param name='resourceGroupName'> The name of the resource group. </param> <param name='hubName'> The name of the hub. </param> <param name='assignmentName'> The name of the role assignment. </param> <param name='customHeaders'> The headers that will be added to request. </param> <param name='cancellationToken'> The cancellation token. </param> <exception cref="Microsoft.Rest.Azure.CloudException"> Thrown when the operation returned an invalid status code </exception> <exception cref="Microsoft.Rest.<API key>"> Thrown when unable to deserialize the response </exception> <exception cref="Microsoft.Rest.ValidationException"> Thrown when a required parameter is null </exception> Task<<API key><<API key>>> <API key>(string resourceGroupName, string hubName, string assignmentName, Dictionary<string, List<string>> customHeaders = null, Cancellation<API key> = default(CancellationToken)); <summary> Deletes the role assignment in the hub. </summary> <param name='resourceGroupName'> The name of the resource group. </param> <param name='hubName'> The name of the hub. </param> <param name='assignmentName'> The name of the role assignment. </param> <param name='customHeaders'> The headers that will be added to request. </param> <param name='cancellationToken'> The cancellation token. </param> <exception cref="Microsoft.Rest.Azure.CloudException"> Thrown when the operation returned an invalid status code </exception> <exception cref="Microsoft.Rest.ValidationException"> Thrown when a required parameter is null </exception> Task<<API key>> <API key>(string resourceGroupName, string hubName, string assignmentName, Dictionary<string, List<string>> customHeaders = null, Cancellation<API key> = default(CancellationToken)); <summary> Creates or updates a role assignment in the hub. </summary> <param name='resourceGroupName'> The name of the resource group. </param> <param name='hubName'> The name of the hub. </param> <param name='assignmentName'> The assignment name </param> <param name='parameters'> Parameters supplied to the CreateOrUpdate RoleAssignment operation. </param> <param name='customHeaders'> The headers that will be added to request. </param> <param name='cancellationToken'> The cancellation token. </param> <exception cref="Microsoft.Rest.Azure.CloudException"> Thrown when the operation returned an invalid status code </exception> <exception cref="Microsoft.Rest.<API key>"> Thrown when unable to deserialize the response </exception> <exception cref="Microsoft.Rest.ValidationException"> Thrown when a required parameter is null </exception> Task<<API key><<API key>>> <API key>(string resourceGroupName, string hubName, string assignmentName, <API key> parameters, Dictionary<string, List<string>> customHeaders = null, Cancellation<API key> = default(CancellationToken)); <summary> Gets all the role assignments for the specified hub. </summary> <param name='nextPageLink'> The NextLink from the previous successful call to List operation. </param> <param name='customHeaders'> The headers that will be added to request. </param> <param name='cancellationToken'> The cancellation token. </param> <exception cref="Microsoft.Rest.Azure.CloudException"> Thrown when the operation returned an invalid status code </exception> <exception cref="Microsoft.Rest.<API key>"> Thrown when unable to deserialize the response </exception> <exception cref="Microsoft.Rest.ValidationException"> Thrown when a required parameter is null </exception> Task<<API key><IPage<<API key>>>> <API key>(string nextPageLink, Dictionary<string, List<string>> customHeaders = null, Cancellation<API key> = default(CancellationToken)); } }
import path from 'path'; import cp from 'child_process'; import webpackConfig from './webpack.config'; // Should match the text string used in `src/server.js/server.listen(...)` const RUNNING_REGEXP = /The server is running at http:\/\/(.*?)\ let server; const { output } = webpackConfig.find(x => x.target === 'node'); const serverPath = path.join(output.path, output.filename); // Launch or restart the Node.js server function runServer() { return new Promise(resolve => { let pending = true; function onStdOut(data) { const time = new Date().toTimeString(); const match = data.toString('utf8').match(RUNNING_REGEXP); process.stdout.write(time.replace(/.*(\d{2}:\d{2}:\d{2}).*/, '[$1] ')); process.stdout.write(data); if (match) { server.host = match[1]; server.stdout.removeListener('data', onStdOut); server.stdout.on('data', x => process.stdout.write(x)); pending = false; resolve(server); } } if (server) { server.kill('SIGTERM'); } server = cp.spawn('node', [serverPath], { env: Object.assign({ NODE_ENV: 'development' }, process.env), silent: false, }); if (pending) { server.once('exit', (code, signal) => { if (pending) { throw new Error(`Server terminated unexpectedly with code: ${code} signal: ${signal}`); } }); } server.stdout.on('data', onStdOut); server.stderr.on('data', x => process.stderr.write(x)); return server; }); } process.on('exit', () => { if (server) { server.kill('SIGTERM'); } }); export default runServer;
// Type definitions for microrouter 3.1 // Project: https://github.com/pedronauck/micro-router#readme <reference types="node"/> import { IncomingMessage, ServerResponse, Server } from 'http'; import { RequestHandler } from 'micro'; export type ServerResponse = ServerResponse; export type ServerRequest = IncomingMessage & { params: { [key: string]: string }, query: { [key: string]: string } }; export type <API key> = ( req: ServerRequest, res: ServerResponse ) => any; export type RouteHandler = (path: string, handler: <API key>) => RequestHandler; export function router(...routes: RequestHandler[]): RequestHandler; export function withNamespace(namespace: string): (...routes: RequestHandler[]) => RequestHandler; export const get: RouteHandler; export const post: RouteHandler; export const put: RouteHandler; export const patch: RouteHandler; export const del: RouteHandler; export const head: RouteHandler; export const options: RouteHandler;
#include <linux/module.h> #include <linux/types.h> #include <linux/slab.h> #include <linux/ioctl.h> #include <linux/uaccess.h> #include <linux/i2c.h> #include <linux/videodev2.h> #include <media/v4l2-device.h> MODULE_DESCRIPTION("Analog Devices ADV7175 video encoder driver"); MODULE_AUTHOR("Dave Perks"); MODULE_LICENSE("GPL"); #define I2C_ADV7175 0xd4 #define I2C_ADV7176 0x54 static int debug; module_param(debug, int, 0); MODULE_PARM_DESC(debug, "Debug level (0-1)"); struct adv7175 { struct v4l2_subdev sd; v4l2_std_id norm; int input; }; static inline struct adv7175 *to_adv7175(struct v4l2_subdev *sd) { return container_of(sd, struct adv7175, sd); } static char *inputs[] = { "pass_through", "play_back", "color_bar" }; static u32 adv7175_codes[] = { <API key>, <API key>, }; static inline int adv7175_write(struct v4l2_subdev *sd, u8 reg, u8 value) { struct i2c_client *client = v4l2_get_subdevdata(sd); return <API key>(client, reg, value); } static inline int adv7175_read(struct v4l2_subdev *sd, u8 reg) { struct i2c_client *client = v4l2_get_subdevdata(sd); return <API key>(client, reg); } static int adv7175_write_block(struct v4l2_subdev *sd, const u8 *data, unsigned int len) { struct i2c_client *client = v4l2_get_subdevdata(sd); int ret = -1; u8 reg; /* the adv7175 has an autoincrement function, use it if * the adapter understands raw I2C */ if (<API key>(client->adapter, I2C_FUNC_I2C)) { /* do raw I2C, not smbus compatible */ u8 block_data[32]; int block_len; while (len >= 2) { block_len = 0; block_data[block_len++] = reg = data[0]; do { block_data[block_len++] = data[1]; reg++; len -= 2; data += 2; } while (len >= 2 && data[0] == reg && block_len < 32); ret = i2c_master_send(client, block_data, block_len); if (ret < 0) break; } } else { /* do some slow I2C emulation kind of thing */ while (len >= 2) { reg = *data++; ret = adv7175_write(sd, reg, *data++); if (ret < 0) break; len -= 2; } } return ret; } static void set_subcarrier_freq(struct v4l2_subdev *sd, int pass_through) { /* for some reason pass_through NTSC needs * a different sub-carrier freq to remain stable. */ if (pass_through) adv7175_write(sd, 0x02, 0x00); else adv7175_write(sd, 0x02, 0x55); adv7175_write(sd, 0x03, 0x55); adv7175_write(sd, 0x04, 0x55); adv7175_write(sd, 0x05, 0x25); } /* Output filter: S-Video Composite */ #define MR050 0x11 /* 0x09 */ #define MR060 0x14 /* 0x0c */ #define TR0MODE 0x46 #define TR0RST 0x80 #define TR1CAPT 0x80 #define TR1PLAY 0x00 static const unsigned char init_common[] = { 0x00, MR050, /* MR0, PAL enabled */ 0x01, 0x00, /* MR1 */ 0x02, 0x0c, /* subc. freq. */ 0x03, 0x8c, /* subc. freq. */ 0x04, 0x79, /* subc. freq. */ 0x05, 0x26, /* subc. freq. */ 0x06, 0x40, /* subc. phase */ 0x07, TR0MODE, /* TR0, 16bit */ 0x08, 0x21, 0x09, 0x00, 0x0a, 0x00, 0x0b, 0x00, 0x0c, TR1CAPT, /* TR1 */ 0x0d, 0x4f, /* MR2 */ 0x0e, 0x00, 0x0f, 0x00, 0x10, 0x00, 0x11, 0x00, }; static const unsigned char init_pal[] = { 0x00, MR050, /* MR0, PAL enabled */ 0x01, 0x00, /* MR1 */ 0x02, 0x0c, /* subc. freq. */ 0x03, 0x8c, /* subc. freq. */ 0x04, 0x79, /* subc. freq. */ 0x05, 0x26, /* subc. freq. */ 0x06, 0x40, /* subc. phase */ }; static const unsigned char init_ntsc[] = { 0x00, MR060, /* MR0, NTSC enabled */ 0x01, 0x00, /* MR1 */ 0x02, 0x55, /* subc. freq. */ 0x03, 0x55, /* subc. freq. */ 0x04, 0x55, /* subc. freq. */ 0x05, 0x25, /* subc. freq. */ 0x06, 0x1a, /* subc. phase */ }; static int adv7175_init(struct v4l2_subdev *sd, u32 val) { /* This is just for testing!!! */ adv7175_write_block(sd, init_common, sizeof(init_common)); adv7175_write(sd, 0x07, TR0MODE | TR0RST); adv7175_write(sd, 0x07, TR0MODE); return 0; } static int <API key>(struct v4l2_subdev *sd, v4l2_std_id std) { struct adv7175 *encoder = to_adv7175(sd); if (std & V4L2_STD_NTSC) { adv7175_write_block(sd, init_ntsc, sizeof(init_ntsc)); if (encoder->input == 0) adv7175_write(sd, 0x0d, 0x4f); /* Enable genlock */ adv7175_write(sd, 0x07, TR0MODE | TR0RST); adv7175_write(sd, 0x07, TR0MODE); } else if (std & V4L2_STD_PAL) { adv7175_write_block(sd, init_pal, sizeof(init_pal)); if (encoder->input == 0) adv7175_write(sd, 0x0d, 0x4f); /* Enable genlock */ adv7175_write(sd, 0x07, TR0MODE | TR0RST); adv7175_write(sd, 0x07, TR0MODE); } else if (std & V4L2_STD_SECAM) { /* This is an attempt to convert * SECAM->PAL (typically it does not work * due to genlock: when decoder is in SECAM * and encoder in in PAL the subcarrier can * not be syncronized with horizontal * quency) */ adv7175_write_block(sd, init_pal, sizeof(init_pal)); if (encoder->input == 0) adv7175_write(sd, 0x0d, 0x49); /* Disable genlock */ adv7175_write(sd, 0x07, TR0MODE | TR0RST); adv7175_write(sd, 0x07, TR0MODE); } else { v4l2_dbg(1, debug, sd, "illegal norm: %llx\n", (unsigned long long)std); return -EINVAL; } v4l2_dbg(1, debug, sd, "switched to %llx\n", (unsigned long long)std); encoder->norm = std; return 0; } static int adv7175_s_routing(struct v4l2_subdev *sd, u32 input, u32 output, u32 config) { struct adv7175 *encoder = to_adv7175(sd); /* RJ: input = 0: input is from decoder input = 1: input is from ZR36060 input = 2: color bar */ switch (input) { case 0: adv7175_write(sd, 0x01, 0x00); if (encoder->norm & V4L2_STD_NTSC) set_subcarrier_freq(sd, 1); adv7175_write(sd, 0x0c, TR1CAPT); /* TR1 */ if (encoder->norm & V4L2_STD_SECAM) adv7175_write(sd, 0x0d, 0x49); /* Disable genlock */ else adv7175_write(sd, 0x0d, 0x4f); /* Enable genlock */ adv7175_write(sd, 0x07, TR0MODE | TR0RST); adv7175_write(sd, 0x07, TR0MODE); /*udelay(10);*/ break; case 1: adv7175_write(sd, 0x01, 0x00); if (encoder->norm & V4L2_STD_NTSC) set_subcarrier_freq(sd, 0); adv7175_write(sd, 0x0c, TR1PLAY); /* TR1 */ adv7175_write(sd, 0x0d, 0x49); adv7175_write(sd, 0x07, TR0MODE | TR0RST); adv7175_write(sd, 0x07, TR0MODE); /* udelay(10); */ break; case 2: adv7175_write(sd, 0x01, 0x80); if (encoder->norm & V4L2_STD_NTSC) set_subcarrier_freq(sd, 0); adv7175_write(sd, 0x0d, 0x49); adv7175_write(sd, 0x07, TR0MODE | TR0RST); adv7175_write(sd, 0x07, TR0MODE); /* udelay(10); */ break; default: v4l2_dbg(1, debug, sd, "illegal input: %d\n", input); return -EINVAL; } v4l2_dbg(1, debug, sd, "switched to %s\n", inputs[input]); encoder->input = input; return 0; } static int <API key>(struct v4l2_subdev *sd, struct <API key> *cfg, struct <API key> *code) { if (code->pad || code->index >= ARRAY_SIZE(adv7175_codes)) return -EINVAL; code->code = adv7175_codes[code->index]; return 0; } static int adv7175_get_fmt(struct v4l2_subdev *sd, struct <API key> *cfg, struct v4l2_subdev_format *format) { struct v4l2_mbus_framefmt *mf = &format->format; u8 val = adv7175_read(sd, 0x7); if (format->pad) return -EINVAL; if ((val & 0x40) == (1 << 6)) mf->code = <API key>; else mf->code = <API key>; mf->colorspace = <API key>; mf->width = 0; mf->height = 0; mf->field = V4L2_FIELD_ANY; return 0; } static int adv7175_set_fmt(struct v4l2_subdev *sd, struct <API key> *cfg, struct v4l2_subdev_format *format) { struct v4l2_mbus_framefmt *mf = &format->format; u8 val = adv7175_read(sd, 0x7); int ret = 0; if (format->pad) return -EINVAL; switch (mf->code) { case <API key>: val &= ~0x40; break; case <API key>: val |= 0x40; break; default: v4l2_dbg(1, debug, sd, "illegal v4l2_mbus_framefmt code: %d\n", mf->code); return -EINVAL; } if (format->which == <API key>) ret = adv7175_write(sd, 0x7, val); return ret; } static int adv7175_s_power(struct v4l2_subdev *sd, int on) { if (on) adv7175_write(sd, 0x01, 0x00); else adv7175_write(sd, 0x01, 0x78); return 0; } static const struct <API key> adv7175_core_ops = { .init = adv7175_init, .s_power = adv7175_s_power, }; static const struct <API key> adv7175_video_ops = { .s_std_output = <API key>, .s_routing = adv7175_s_routing, }; static const struct v4l2_subdev_pad_ops adv7175_pad_ops = { .enum_mbus_code = <API key>, .get_fmt = adv7175_get_fmt, .set_fmt = adv7175_set_fmt, }; static const struct v4l2_subdev_ops adv7175_ops = { .core = &adv7175_core_ops, .video = &adv7175_video_ops, .pad = &adv7175_pad_ops, }; static int adv7175_probe(struct i2c_client *client, const struct i2c_device_id *id) { int i; struct adv7175 *encoder; struct v4l2_subdev *sd; /* Check if the adapter supports the needed features */ if (!<API key>(client->adapter, <API key>)) return -ENODEV; v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); encoder = devm_kzalloc(&client->dev, sizeof(*encoder), GFP_KERNEL); if (encoder == NULL) return -ENOMEM; sd = &encoder->sd; <API key>(sd, client, &adv7175_ops); encoder->norm = V4L2_STD_NTSC; encoder->input = 0; i = adv7175_write_block(sd, init_common, sizeof(init_common)); if (i >= 0) { i = adv7175_write(sd, 0x07, TR0MODE | TR0RST); i = adv7175_write(sd, 0x07, TR0MODE); i = adv7175_read(sd, 0x12); v4l2_dbg(1, debug, sd, "revision %d\n", i & 1); } if (i < 0) v4l2_dbg(1, debug, sd, "init error 0x%x\n", i); return 0; } static int adv7175_remove(struct i2c_client *client) { struct v4l2_subdev *sd = i2c_get_clientdata(client); <API key>(sd); return 0; } static const struct i2c_device_id adv7175_id[] = { { "adv7175", 0 }, { "adv7176", 0 }, { } }; MODULE_DEVICE_TABLE(i2c, adv7175_id); static struct i2c_driver adv7175_driver = { .driver = { .name = "adv7175", }, .probe = adv7175_probe, .remove = adv7175_remove, .id_table = adv7175_id, }; module_i2c_driver(adv7175_driver);
<h1>Student Administration Options</h1> <p>Certain administration options can be turned 'on' or 'off' for students. When 'on', these options only take affect for wikis that can be edited by the student. When 'off', they will not appear in the administrator menu. </p>
<h1>Id numbers</h1> <p>Setting an ID number provides a way of identifying the activity for grade calculation purposes. If the activity is not included in any grade calculation then the ID number field can be left blank. The ID number for an activity-based grade item may be set on the update activity page.</p>
#include <config.h> #include <gsl/gsl_math.h> #include <gsl/gsl_errno.h> #include <gsl/gsl_sf_log.h> #include <gsl/gsl_sf_trig.h> #include "error.h" #include "chebyshev.h" #include "cheb_eval.c" /* sinh(x) series * double-precision for |x| < 1.0 */ inline static int sinh_series(const double x, double * result) { const double y = x*x; const double c0 = 1.0/6.0; const double c1 = 1.0/120.0; const double c2 = 1.0/5040.0; const double c3 = 1.0/362880.0; const double c4 = 1.0/39916800.0; const double c5 = 1.0/6227020800.0; const double c6 = 1.0/1307674368000.0; const double c7 = 1.0/355687428096000.0; *result = x*(1.0 + y*(c0+y*(c1+y*(c2+y*(c3+y*(c4+y*(c5+y*(c6+y*c7)))))))); return GSL_SUCCESS; } /* cosh(x)-1 series * double-precision for |x| < 1.0 */ inline static int cosh_m1_series(const double x, double * result) { const double y = x*x; const double c0 = 0.5; const double c1 = 1.0/24.0; const double c2 = 1.0/720.0; const double c3 = 1.0/40320.0; const double c4 = 1.0/3628800.0; const double c5 = 1.0/479001600.0; const double c6 = 1.0/87178291200.0; const double c7 = 1.0/20922789888000.0; const double c8 = 1.0/6402373705728000.0; *result = y*(c0+y*(c1+y*(c2+y*(c3+y*(c4+y*(c5+y*(c6+y*(c7+y*c8)))))))); return GSL_SUCCESS; } /* Chebyshev expansion for f(t) = sinc((t+1)/2), -1 < t < 1 */ static double sinc_data[17] = { 1.<API key>, -0.<API key>, -0.<API key>, 0.<API key>, 0.<API key>, -0.<API key>, -0.<API key>, 0.<API key>, 0.<API key>, -0.<API key>, -0.<API key>, 0.<API key>, 0.<API key>, -0.<API key>, -0.<API key>, 0.<API key>, 0.<API key> }; static cheb_series sinc_cs = { sinc_data, 16, -1, 1, 10 }; /* Chebyshev expansion for f(t) = g((t+1)Pi/8), -1<t<1 * g(x) = (sin(x)/x - 1)/(x*x) */ static double sin_data[12] = { -0.<API key>, 0.<API key>, 0.<API key>, -4.<API key>, -5.<API key>, 3.<API key>, 3.<API key>, -1.<API key>, -1.<API key>, 5.<API key>, 2.<API key>, -1.<API key> }; static cheb_series sin_cs = { sin_data, 11, -1, 1, 11 }; /* Chebyshev expansion for f(t) = g((t+1)Pi/8), -1<t<1 * g(x) = (2(cos(x) - 1)/(x^2) + 1) / x^2 */ static double cos_data[11] = { 0.<API key>, -0.<API key>, -0.<API key>, 1.<API key>, 1.<API key>, -7.<API key>, -6.<API key>, 2.<API key>, 1.<API key>, -7.<API key>, -3.<API key> }; static cheb_series cos_cs = { cos_data, 10, -1, 1, 10 }; /*-*-*-*-*-*-*-*-*-*-*-* Functions with Error Codes *-*-*-*-*-*-*-*-*-*-*-*/ /* I would have prefered just using the library sin() function. * But after some experimentation I decided that there was * no good way to understand the error; library sin() is just a black box. * So we have to roll our own. */ int gsl_sf_sin_e(double x, gsl_sf_result * result) { /* CHECK_POINTER(result) */ { const double P1 = 7.<API key>; const double P2 = 3.<API key>; const double P3 = 2.<API key>; const double sgn_x = GSL_SIGN(x); const double abs_x = fabs(x); if(abs_x < <API key>) { const double x2 = x*x; result->val = x * (1.0 - x2/6.0); result->err = fabs(x*x2*x2 / 100.0); return GSL_SUCCESS; } else { double sgn_result = sgn_x; double y = floor(abs_x/(0.25*M_PI)); int octant = y - ldexp(floor(ldexp(y,-3)),3); int stat_cs; double z; if(GSL_IS_ODD(octant)) { octant += 1; octant &= 07; y += 1.0; } if(octant > 3) { octant -= 4; sgn_result = -sgn_result; } z = ((abs_x - y * P1) - y * P2) - y * P3; if(octant == 0) { gsl_sf_result sin_cs_result; const double t = 8.0*fabs(z)/M_PI - 1.0; stat_cs = cheb_eval_e(&sin_cs, t, &sin_cs_result); result->val = z * (1.0 + z*z * sin_cs_result.val); } else { /* octant == 2 */ gsl_sf_result cos_cs_result; const double t = 8.0*fabs(z)/M_PI - 1.0; stat_cs = cheb_eval_e(&cos_cs, t, &cos_cs_result); result->val = 1.0 - 0.5*z*z * (1.0 - z*z * cos_cs_result.val); } result->val *= sgn_result; if(abs_x > 1.0/GSL_DBL_EPSILON) { result->err = fabs(result->val); } else if(abs_x > 100.0/<API key>) { result->err = 2.0 * abs_x * GSL_DBL_EPSILON * fabs(result->val); } else if(abs_x > 0.1/<API key>) { result->err = 2.0 * <API key> * fabs(result->val); } else { result->err = 2.0 * GSL_DBL_EPSILON * fabs(result->val); } return stat_cs; } } } int gsl_sf_cos_e(double x, gsl_sf_result * result) { /* CHECK_POINTER(result) */ { const double P1 = 7.<API key>; const double P2 = 3.<API key>; const double P3 = 2.<API key>; const double abs_x = fabs(x); if(abs_x < <API key>) { const double x2 = x*x; result->val = 1.0 - 0.5*x2; result->err = fabs(x2*x2/12.0); return GSL_SUCCESS; } else { double sgn_result = 1.0; double y = floor(abs_x/(0.25*M_PI)); int octant = y - ldexp(floor(ldexp(y,-3)),3); int stat_cs; double z; if(GSL_IS_ODD(octant)) { octant += 1; octant &= 07; y += 1.0; } if(octant > 3) { octant -= 4; sgn_result = -sgn_result; } if(octant > 1) { sgn_result = -sgn_result; } z = ((abs_x - y * P1) - y * P2) - y * P3; if(octant == 0) { gsl_sf_result cos_cs_result; const double t = 8.0*fabs(z)/M_PI - 1.0; stat_cs = cheb_eval_e(&cos_cs, t, &cos_cs_result); result->val = 1.0 - 0.5*z*z * (1.0 - z*z * cos_cs_result.val); } else { /* octant == 2 */ gsl_sf_result sin_cs_result; const double t = 8.0*fabs(z)/M_PI - 1.0; stat_cs = cheb_eval_e(&sin_cs, t, &sin_cs_result); result->val = z * (1.0 + z*z * sin_cs_result.val); } result->val *= sgn_result; if(abs_x > 1.0/GSL_DBL_EPSILON) { result->err = fabs(result->val); } else if(abs_x > 100.0/<API key>) { result->err = 2.0 * abs_x * GSL_DBL_EPSILON * fabs(result->val); } else if(abs_x > 0.1/<API key>) { result->err = 2.0 * <API key> * fabs(result->val); } else { result->err = 2.0 * GSL_DBL_EPSILON * fabs(result->val); } return stat_cs; } } } int gsl_sf_hypot_e(const double x, const double y, gsl_sf_result * result) { /* CHECK_POINTER(result) */ if(x == 0.0 && y == 0.0) { result->val = 0.0; result->err = 0.0; return GSL_SUCCESS; } else { const double a = fabs(x); const double b = fabs(y); const double min = GSL_MIN_DBL(a,b); const double max = GSL_MAX_DBL(a,b); const double rat = min/max; const double root_term = sqrt(1.0 + rat*rat); if(max < GSL_DBL_MAX/root_term) { result->val = max * root_term; result->err = 2.0 * GSL_DBL_EPSILON * fabs(result->val); return GSL_SUCCESS; } else { OVERFLOW_ERROR(result); } } } int <API key>(const double zr, const double zi, gsl_sf_result * szr, gsl_sf_result * szi) { /* CHECK_POINTER(szr) */ /* CHECK_POINTER(szi) */ if(fabs(zi) < 1.0) { double ch_m1, sh; sinh_series(zi, &sh); cosh_m1_series(zi, &ch_m1); szr->val = sin(zr)*(ch_m1 + 1.0); szi->val = cos(zr)*sh; szr->err = 2.0 * GSL_DBL_EPSILON * fabs(szr->val); szi->err = 2.0 * GSL_DBL_EPSILON * fabs(szi->val); return GSL_SUCCESS; } else if(fabs(zi) < GSL_LOG_DBL_MAX) { double ex = exp(zi); double ch = 0.5*(ex+1.0/ex); double sh = 0.5*(ex-1.0/ex); szr->val = sin(zr)*ch; szi->val = cos(zr)*sh; szr->err = 2.0 * GSL_DBL_EPSILON * fabs(szr->val); szi->err = 2.0 * GSL_DBL_EPSILON * fabs(szi->val); return GSL_SUCCESS; } else { OVERFLOW_ERROR_2(szr, szi); } } int <API key>(const double zr, const double zi, gsl_sf_result * czr, gsl_sf_result * czi) { /* CHECK_POINTER(czr) */ /* CHECK_POINTER(czi) */ if(fabs(zi) < 1.0) { double ch_m1, sh; sinh_series(zi, &sh); cosh_m1_series(zi, &ch_m1); czr->val = cos(zr)*(ch_m1 + 1.0); czi->val = -sin(zr)*sh; czr->err = 2.0 * GSL_DBL_EPSILON * fabs(czr->val); czi->err = 2.0 * GSL_DBL_EPSILON * fabs(czi->val); return GSL_SUCCESS; } else if(fabs(zi) < GSL_LOG_DBL_MAX) { double ex = exp(zi); double ch = 0.5*(ex+1.0/ex); double sh = 0.5*(ex-1.0/ex); czr->val = cos(zr)*ch; czi->val = -sin(zr)*sh; czr->err = 2.0 * GSL_DBL_EPSILON * fabs(czr->val); czi->err = 2.0 * GSL_DBL_EPSILON * fabs(czi->val); return GSL_SUCCESS; } else { OVERFLOW_ERROR_2(czr,czi); } } int <API key>(const double zr, const double zi, gsl_sf_result * lszr, gsl_sf_result * lszi) { /* CHECK_POINTER(lszr) */ /* CHECK_POINTER(lszi) */ if(zi > 60.0) { lszr->val = -M_LN2 + zi; lszi->val = 0.5*M_PI - zr; lszr->err = 2.0 * GSL_DBL_EPSILON * fabs(lszr->val); lszi->err = 2.0 * GSL_DBL_EPSILON * fabs(lszi->val); } else if(zi < -60.0) { lszr->val = -M_LN2 - zi; lszi->val = -0.5*M_PI + zr; lszr->err = 2.0 * GSL_DBL_EPSILON * fabs(lszr->val); lszi->err = 2.0 * GSL_DBL_EPSILON * fabs(lszi->val); } else { gsl_sf_result sin_r, sin_i; int status; <API key>(zr, zi, &sin_r, &sin_i); /* ok by construction */ status = <API key>(sin_r.val, sin_i.val, lszr, lszi); if(status == GSL_EDOM) { DOMAIN_ERROR_2(lszr, lszi); } } return <API key>(&(lszi->val)); } int gsl_sf_lnsinh_e(const double x, gsl_sf_result * result) { /* CHECK_POINTER(result) */ if(x <= 0.0) { DOMAIN_ERROR(result); } else if(fabs(x) < 1.0) { double eps; sinh_series(x, &eps); result->val = log(eps); result->err = 2.0 * GSL_DBL_EPSILON * fabs(result->val); return GSL_SUCCESS; } else if(x < -0.5*GSL_LOG_DBL_EPSILON) { result->val = x + log(0.5*(1.0 - exp(-2.0*x))); result->err = 2.0 * GSL_DBL_EPSILON * fabs(result->val); return GSL_SUCCESS; } else { result->val = -M_LN2 + x; result->err = 2.0 * GSL_DBL_EPSILON * fabs(result->val); return GSL_SUCCESS; } } int gsl_sf_lncosh_e(const double x, gsl_sf_result * result) { /* CHECK_POINTER(result) */ if(fabs(x) < 1.0) { double eps; cosh_m1_series(x, &eps); return gsl_sf_log_1plusx_e(eps, result); } else if(fabs(x) < -0.5*GSL_LOG_DBL_EPSILON) { result->val = fabs(x) + log(0.5*(1.0 + exp(-2.0*fabs(x)))); result->err = 2.0 * GSL_DBL_EPSILON * fabs(result->val); return GSL_SUCCESS; } else { result->val = -M_LN2 + fabs(x); result->err = 2.0 * GSL_DBL_EPSILON * fabs(result->val); return GSL_SUCCESS; } } /* inline int gsl_sf_sincos_e(const double theta, double * s, double * c) { double tan_half = tan(0.5 * theta); double den = 1. + tan_half*tan_half; double cos_theta = (1.0 - tan_half*tan_half) / den; double sin_theta = 2.0 * tan_half / den; } */ int <API key>(const double r, const double theta, gsl_sf_result * x, gsl_sf_result * y) { double t = theta; int status = <API key>(&t); double c = cos(t); double s = sin(t); x->val = r * cos(t); y->val = r * sin(t); x->err = r * fabs(s * GSL_DBL_EPSILON * t); x->err += 2.0 * GSL_DBL_EPSILON * fabs(x->val); y->err = r * fabs(c * GSL_DBL_EPSILON * t); y->err += 2.0 * GSL_DBL_EPSILON * fabs(y->val); return status; } int <API key>(const double x, const double y, gsl_sf_result * r, gsl_sf_result * theta) { int stat_h = gsl_sf_hypot_e(x, y, r); if(r->val > 0.0) { theta->val = atan2(y, x); theta->err = 2.0 * GSL_DBL_EPSILON * fabs(theta->val); return stat_h; } else { DOMAIN_ERROR(theta); } } int <API key>(const double theta, gsl_sf_result * result) { /* synthetic extended precision constants */ const double P1 = 4 * 7.<API key>; const double P2 = 4 * 3.<API key>; const double P3 = 4 * 2.<API key>; const double TwoPi = 2*(P1 + P2 + P3); const double y = GSL_SIGN(theta) * 2 * floor(fabs(theta)/TwoPi); double r = ((theta - y*P1) - y*P2) - y*P3; if(r > M_PI) { r = (((r-2*P1)-2*P2)-2*P3); } /* r-TwoPi */ else if (r < -M_PI) r = (((r+2*P1)+2*P2)+2*P3); /* r+TwoPi */ result->val = r; if(fabs(theta) > 0.0625/GSL_DBL_EPSILON) { result->val = GSL_NAN; result->err = GSL_NAN; GSL_ERROR ("error", GSL_ELOSS); } else if(fabs(theta) > 0.0625/<API key>) { result->err = 2.0 * GSL_DBL_EPSILON * fabs(result->val - theta); return GSL_SUCCESS; } else { double delta = fabs(result->val - theta); result->err = 2.0 * GSL_DBL_EPSILON * ((delta < M_PI) ? delta : M_PI); return GSL_SUCCESS; } } int <API key>(const double theta, gsl_sf_result * result) { /* synthetic extended precision constants */ const double P1 = 4 * 7.<API key>; const double P2 = 4 * 3.<API key>; const double P3 = 4 * 2.<API key>; const double TwoPi = 2*(P1 + P2 + P3); const double y = 2*floor(theta/TwoPi); double r = ((theta - y*P1) - y*P2) - y*P3; if(r > TwoPi) {r = (((r-2*P1)-2*P2)-2*P3); } /* r-TwoPi */ else if (r < 0) { /* may happen due to FP rounding */ r = (((r+2*P1)+2*P2)+2*P3); /* r+TwoPi */ } result->val = r; if(fabs(theta) > 0.0625/GSL_DBL_EPSILON) { result->val = GSL_NAN; result->err = fabs(result->val); GSL_ERROR ("error", GSL_ELOSS); } else if(fabs(theta) > 0.0625/<API key>) { result->err = GSL_DBL_EPSILON * fabs(result->val - theta); return GSL_SUCCESS; } else { double delta = fabs(result->val - theta); result->err = 2.0 * GSL_DBL_EPSILON * ((delta < M_PI) ? delta : M_PI); return GSL_SUCCESS; } } int <API key>(double * theta) { gsl_sf_result r; int stat = <API key>(*theta, &r); *theta = r.val; return stat; } int <API key>(double * theta) { gsl_sf_result r; int stat = <API key>(*theta, &r); *theta = r.val; return stat; } int gsl_sf_sin_err_e(const double x, const double dx, gsl_sf_result * result) { int stat_s = gsl_sf_sin_e(x, result); result->err += fabs(cos(x) * dx); result->err += GSL_DBL_EPSILON * fabs(result->val); return stat_s; } int gsl_sf_cos_err_e(const double x, const double dx, gsl_sf_result * result) { int stat_c = gsl_sf_cos_e(x, result); result->err += fabs(sin(x) * dx); result->err += GSL_DBL_EPSILON * fabs(result->val); return stat_c; } #if 0 int gsl_sf_sin_pi_x_e(const double x, gsl_sf_result * result) { /* CHECK_POINTER(result) */ if(-100.0 < x && x < 100.0) { result->val = sin(M_PI * x) / (M_PI * x); result->err = 2.0 * GSL_DBL_EPSILON * fabs(result->val); return GSL_SUCCESS; } else { const double N = floor(x + 0.5); const double f = x - N; if(N < INT_MAX && N > INT_MIN) { /* Make it an integer if we can. Saves another * call to floor(). */ const int intN = (int)N; const double sign = ( GSL_IS_ODD(intN) ? -1.0 : 1.0 ); result->val = sign * sin(M_PI * f); result->err = GSL_DBL_EPSILON * fabs(result->val); } else if(N > 2.0/GSL_DBL_EPSILON || N < -2.0/GSL_DBL_EPSILON) { /* All integer-valued floating point numbers * bigger than 2/eps=2^53 are actually even. */ result->val = 0.0; result->err = 0.0; } else { const double resN = N - 2.0*floor(0.5*N); /* 0 for even N, 1 for odd N */ const double sign = ( fabs(resN) > 0.5 ? -1.0 : 1.0 ); result->val = sign * sin(M_PI*f); result->err = GSL_DBL_EPSILON * fabs(result->val); } return GSL_SUCCESS; } } #endif int gsl_sf_sinc_e(double x, gsl_sf_result * result) { /* CHECK_POINTER(result) */ { const double ax = fabs(x); if(ax < 0.8) { /* Do not go to the limit of the fit since * there is a zero there and the Chebyshev * accuracy will go to zero. */ return cheb_eval_e(&sinc_cs, 2.0*ax-1.0, result); } else if(ax < 100.0) { /* Small arguments are no problem. * We trust the library sin() to * roughly machine precision. */ result->val = sin(M_PI * ax)/(M_PI * ax); result->err = 2.0 * GSL_DBL_EPSILON * fabs(result->val); return GSL_SUCCESS; } else { /* Large arguments must be handled separately. */ const double r = M_PI*ax; gsl_sf_result s; int stat_s = gsl_sf_sin_e(r, &s); result->val = s.val/r; result->err = s.err/r + 2.0 * GSL_DBL_EPSILON * fabs(result->val); return stat_s; } } } /*-*-*-*-*-*-*-*-*-* Functions w/ Natural Prototypes *-*-*-*-*-*-*-*-*-*-*/ #include "eval.h" double gsl_sf_sin(const double x) { EVAL_RESULT(gsl_sf_sin_e(x, &result)); } double gsl_sf_cos(const double x) { EVAL_RESULT(gsl_sf_cos_e(x, &result)); } double gsl_sf_hypot(const double x, const double y) { EVAL_RESULT(gsl_sf_hypot_e(x, y, &result)); } double gsl_sf_lnsinh(const double x) { EVAL_RESULT(gsl_sf_lnsinh_e(x, &result)); } double gsl_sf_lncosh(const double x) { EVAL_RESULT(gsl_sf_lncosh_e(x, &result)); } double <API key>(const double theta) { double result = theta; EVAL_DOUBLE(<API key>(&result)); } double <API key>(const double theta) { double result = theta; EVAL_DOUBLE(<API key>(&result)); } #if 0 double gsl_sf_sin_pi_x(const double x) { EVAL_RESULT(gsl_sf_sin_pi_x_e(x, &result)); } #endif double gsl_sf_sinc(const double x) { EVAL_RESULT(gsl_sf_sinc_e(x, &result)); }
#ifndef REACHEABLE_H #define REACHEABLE_H extern void <API key>(struct rev_info *revs, int mark_reflog); #endif
#ifndef <API key> #define <API key> #include <string> #include <vector> #include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "media/audio/audio_parameters.h" #include "media/base/audio_bus.h" #include "media/base/media_export.h" namespace media { // AudioCapturerSource is an interface representing the source for // captured audio. An implementation will periodically call Capture() on a // callback object. class AudioCapturerSource : public base::<API key><media::AudioCapturerSource> { public: class CaptureCallback { public: // Callback to deliver the captured data from the OS. virtual void Capture(AudioBus* audio_source, int <API key>, double volume) = 0; // Signals an error has occurred. virtual void OnCaptureError() = 0; protected: virtual ~CaptureCallback() {} }; // Sets information about the audio stream format and the device // to be used. It must be called before any of the other methods. // The |session_id| is used by the browser to identify which input device to // selection, pass |session_id| using // <API key>::kFakeOpenSessionId. virtual void Initialize(const AudioParameters& params, CaptureCallback* callback, int session_id) = 0; // Starts the audio recording. virtual void Start() = 0; // Stops the audio recording. This API is synchronous, and no more data // callback will be passed to the client after it is being called. virtual void Stop() = 0; // Sets the capture volume, with range [0.0, 1.0] inclusive. virtual void SetVolume(double volume) = 0; // Enables or disables the WebRtc AGC control. virtual void <API key>(bool enable) = 0; protected: friend class base::<API key><AudioCapturerSource>; virtual ~AudioCapturerSource() {} }; } // namespace media #endif // <API key>
#ifndef <API key> #define <API key> #include <string> #include "base/basictypes.h" #include "base/callback.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "google_apis/gcm/base/gcm_export.h" #include "google_apis/gcm/protocol/android_checkin.pb.h" #include "google_apis/gcm/protocol/checkin.pb.h" #include "net/base/backoff_entry.h" #include "net/url_request/<API key>.h" #include "url/gurl.h" namespace net { class <API key>; } namespace gcm { class GCMStatsRecorder; // Enables making check-in requests with the GCM infrastructure. When called // with android_id and security_token both set to 0 it is an initial check-in // used to obtain credentials. These should be persisted and used for subsequent // check-ins. class GCM_EXPORT CheckinRequest : public net::URLFetcherDelegate { public: // A callback function for the checkin request, accepting |checkin_response| // protobuf. typedef base::Callback<void(const checkin_proto::<API key>& checkin_response)> <API key>; // Checkin request details. struct GCM_EXPORT RequestInfo { RequestInfo(uint64 android_id, uint64 security_token, const std::map<std::string, std::string>& account_tokens, const std::string& settings_digest, const checkin_proto::ChromeBuildProto& chrome_build_proto); ~RequestInfo(); // Android ID of the device. uint64 android_id; // Security token of the device. uint64 security_token; // Map of account OAuth2 tokens keyed by emails. std::map<std::string, std::string> account_tokens; // Digest of GServices settings on the device. std::string settings_digest; // Information of the Chrome build of this device. checkin_proto::ChromeBuildProto chrome_build_proto; }; CheckinRequest(const GURL& checkin_url, const RequestInfo& request_info, const net::BackoffEntry::Policy& backoff_policy, const <API key>& callback, net::<API key>* <API key>, GCMStatsRecorder* recorder); virtual ~CheckinRequest(); void Start(); // URLFetcherDelegate implementation. virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; private: // Schedules a retry attempt, informs the backoff of a previous request's // failure when |update_backoff| is true. void RetryWithBackoff(bool update_backoff); net::<API key>* <API key>; <API key> callback_; net::BackoffEntry backoff_entry_; GURL checkin_url_; scoped_ptr<net::URLFetcher> url_fetcher_; const RequestInfo request_info_; base::TimeTicks request_start_time_; // Recorder that records GCM activities for debugging purpose. Not owned. GCMStatsRecorder* recorder_; base::WeakPtrFactory<CheckinRequest> weak_ptr_factory_; <API key>(CheckinRequest); }; } // namespace gcm #endif // <API key>
using System; using System.Collections.Generic; namespace Microsoft.Build.Logging.StructuredLogger { internal static class ItemGroupParser { <summary> Parses a log output string to a list of Items (e.g. ItemGroup with metadata or property string). </summary> <param name="message">The message output from the logger.</param> <param name="prefix">The prefix parsed out (e.g. 'Output Item(s): '.).</param> <param name="name">Out: The name of the list.</param> <returns>List of items within the list and all metadata.</returns> public static IList<Item> ParseItemList(string message, string prefix, out string name) { name = null; var items = new List<Item>(); var lines = message.Split('\n'); if (lines.Length == 1) { var line = lines[0]; line = line.Substring(prefix.Length); var nameValue = ParseNameValue(line); name = nameValue.Key; items.Add(new Item(nameValue.Value)); return items; } if (lines[0].Length > prefix.Length) { // we have a weird case of multi-line value var nameValue = ParseNameValue(lines[0].Substring(prefix.Length)); name = nameValue.Key; items.Add(new Item(nameValue.Value.Replace("\r", ""))); for (int i = 1; i < lines.Length; i++) { items.Add(new Item(lines[i].Replace("\r", ""))); } return items; } Item currentItem = null; foreach (var line in lines) { switch (<API key>(line)) { case 4: if (line.EndsWith("=", StringComparison.Ordinal)) { name = line.Substring(4, line.Length - 5); } break; case 8: currentItem = new Item(line.Substring(8)); items.Add(currentItem); break; case 16: if (currentItem != null) { var nameValue = ParseNameValue(line.Substring(16)); currentItem.AddMetadata(nameValue.Key, nameValue.Value); } break; } } return items; } <summary> Parse a string for a name value pair (name=value). </summary> <param name="nameEqualsValue">The (name = value) string to parse.</param> <returns>KeyValuePair name and value</returns> private static KeyValuePair<string, string> ParseNameValue(string nameEqualsValue) { var equals = nameEqualsValue.IndexOf('='); var name = nameEqualsValue.Substring(0, equals); var value = nameEqualsValue.Substring(equals + 1); return new KeyValuePair<string, string>(name, value); } <summary> Gets the number of leading spaces from a string </summary> <param name="line">The string.</param> <returns>Number of spaces in the beginning of the string.</returns> private static int <API key>(string line) { int result = 0; while (result < line.Length && line[result] == ' ') { result++; } return result; } } }
# shell/filter.rb - # $Revision: 11708 $ # by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd) class Shell # Filter # A method to require # each() class Filter include Enumerable def initialize(sh) @shell = sh # parent shell @input = nil # input filter end attr_reader :input def input=(filter) @input = filter end def each(rs = nil) rs = @shell.record_separator unless rs if @input @input.each(rs){|l| yield l} end end def < (src) case src when String cat = Cat.new(@shell, src) cat | self when IO self.input = src self else Shell.Fail Error::CantApplyMethod, "<", to.class end end def > (to) case to when String dst = @shell.open(to, "w") begin each(){|l| dst << l} ensure dst.close end when IO each(){|l| to << l} else Shell.Fail Error::CantApplyMethod, ">", to.class end self end def >> (to) begin Shell.cd(@shell.pwd).append(to, self) rescue CantApplyMethod Shell.Fail Error::CantApplyMethod, ">>", to.class end end def | (filter) filter.input = self if active? @shell.process_controller.start_job filter end filter end def + (filter) Join.new(@shell, self, filter) end def to_a ary = [] each(){|l| ary.push l} ary end def to_s str = "" each(){|l| str.concat l} str end def inspect if @shell.debug.kind_of?(Integer) && @shell.debug > 2 super else to_s end end end end
<?php namespace Symfony\Component\Cache\Adapter; use Symfony\Component\Cache\Exception\CacheException; use Symfony\Component\Cache\Traits\PhpFilesTrait; class PhpFilesAdapter extends AbstractAdapter { use PhpFilesTrait; /** * @param string $namespace * @param int $defaultLifetime * @param string|null $directory * * @throws CacheException if OPcache is not enabled */ public function __construct($namespace = '', $defaultLifetime = 0, $directory = null) { if (!static::isSupported()) { throw new CacheException('OPcache is not enabled'); } parent::__construct('', $defaultLifetime); $this->init($namespace, $directory); $e = new \Exception(); $this->includeHandler = function () use ($e) { throw $e; }; $this->zendDetectUnicode = ini_get('zend.detect_unicode'); } }
// Several strong name tools are in a special scenario because they build in the CoreCLR build process, but // are expected to run against the desktop VM. Because of this, we need to setup the callback structure that // Utilcode asks for to point to callbacks that shim to the desktop. These methods provide that shimming functionality. #include "common.h" #if defined(FEATURE_CORECLR) CoreClrCallbacks *GetCoreClrCallbacks(); // Get a pointer to an API out of the shim // Arguments: // szApiName - name of the API to get a pointer to template<typename FunctionPointer> FunctionPointer ApiShim(LPCSTR szApiName) { static FunctionPointer pfnApi = NULL; if (pfnApi == NULL) { CoreClrCallbacks *pCallbacks = GetCoreClrCallbacks(); pfnApi = reinterpret_cast<FunctionPointer>(GetProcAddress(pCallbacks->m_hmodCoreCLR, szApiName)); _ASSERTE(pfnApi != NULL); } return pfnApi; } // Shim APIs, passing off into the desktop VM IExecutionEngine * __stdcall SnIEE() { typedef IExecutionEngine * ( __stdcall *IEEFn_t)(); return ApiShim<IEEFn_t>("IEE")(); } STDAPI <API key>(SString& pbuffer) { typedef HRESULT (__stdcall *<API key>)(SString&); return ApiShim<<API key>>("<API key>")(pbuffer); } // Initialize a set of CoreCLR callbacks for utilcode to call into the VM with // Return Value: // CoreClrCallbacks for UtilCode // Notes: // Will not return NULL CoreClrCallbacks *GetCoreClrCallbacks() { static CoreClrCallbacks coreClrCallbacks = { 0 }; if (coreClrCallbacks.m_hmodCoreCLR == NULL) { // Run against the desktop CLR coreClrCallbacks.m_hmodCoreCLR = WszLoadLibrary(W("mscoree.dll")); coreClrCallbacks.m_pfnIEE = SnIEE; coreClrCallbacks.<API key> = <API key>; coreClrCallbacks.m_pfnGetCLRFunction = NULL; } return &coreClrCallbacks; } // Initialize Utilcode // Notes: // Should only be called once void InitUtilcode() { #ifdef _DEBUG static bool fAlreadyInitialized = false; _ASSERTE(!fAlreadyInitialized); fAlreadyInitialized = true; #endif InitUtilcode(*GetCoreClrCallbacks()); } #endif // FEATURE_CORECLR && !STRONGNAME_IN_VM
#ifndef <API key> #define <API key> #include "prcm-common.h" #include "prm.h" #define <API key>(module, reg) \ OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE + (module) + (reg)) #define <API key>(module, reg) \ OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE + (module) + (reg)) #define <API key>(module, reg) \ OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg)) #define <API key> 0x0000 #define <API key> <API key>(OCP_MOD, 0x0000) #define <API key> 0x0010 #define <API key> <API key>(OCP_MOD, 0x0010) #define <API key> 0x0018 #define <API key> <API key>(OCP_MOD, 0x0018) #define <API key> 0x001c #define <API key> <API key>(OCP_MOD, 0x001c) #define <API key> 0x0050 #define <API key> <API key>(OCP_MOD, 0x0050) #define <API key> 0x0054 #define <API key> <API key>(OCP_MOD, 0x0054) #define <API key> 0x0060 #define <API key> <API key>(OCP_MOD, 0x0060) #define <API key> 0x0070 #define <API key> <API key>(OCP_MOD, 0x0070) #define <API key> 0x0078 #define <API key> <API key>(OCP_MOD, 0x0078) #define <API key> 0x0080 #define <API key> <API key>(OCP_MOD, 0x0080) #define <API key> 0x0084 #define <API key> <API key>(OCP_MOD, 0x0084) #define <API key> 0x0090 #define <API key> <API key>(OCP_MOD, 0x0090) #define <API key> 0x0094 #define <API key> <API key>(OCP_MOD, 0x0094) #define <API key> 0x0098 #define <API key> <API key>(OCP_MOD, 0x0098) #define <API key> <API key>(OCP_MOD, 0x0000) #define <API key> <API key>(OCP_MOD, 0x0010) #define <API key> <API key>(OCP_MOD, 0x0018) #define <API key> <API key>(OCP_MOD, 0x001c) #define <API key> <API key>(OCP_MOD, 0x0050) #define <API key> <API key>(OCP_MOD, 0x0054) #define <API key> <API key>(OCP_MOD, 0x0060) #define <API key> <API key>(OCP_MOD, 0x0070) #define <API key> <API key>(OCP_MOD, 0x0078) #define <API key> <API key>(OCP_MOD, 0x0080) #define <API key> <API key>(OCP_MOD, 0x0084) #define <API key> <API key>(OCP_MOD, 0x0090) #define <API key> <API key>(OCP_MOD, 0x0094) #define <API key> <API key>(OCP_MOD, 0x0098) #define <API key> 0x0004 #define <API key> <API key>(OCP_MOD, 0x0004) #define <API key> 0x0014 #define <API key> <API key>(OCP_MOD, 0x0014) #define <API key> 0x0018 #define <API key> <API key>(OCP_MOD, 0x0018) #define <API key> 0x001c #define <API key> <API key>(OCP_MOD, 0x001c) #define <API key> 0x0020 #define <API key> <API key>(OMAP3430_GR_MOD, 0x0020) #define <API key> 0x0024 #define <API key> <API key>(OMAP3430_GR_MOD, 0x0024) #define <API key> 0x0028 #define <API key> <API key>(OMAP3430_GR_MOD, 0x0028) #define <API key> 0x002c #define <API key> <API key>(OMAP3430_GR_MOD, 0x002c) #define <API key> 0x0030 #define <API key> <API key>(OMAP3430_GR_MOD, 0x0030) #define <API key> 0x0034 #define <API key> <API key>(OMAP3430_GR_MOD, 0x0034) #define <API key> 0x0038 #define <API key> <API key>(OMAP3430_GR_MOD, 0x0038) #define <API key> 0x003c #define <API key> <API key>(OMAP3430_GR_MOD, 0x003c) #define <API key> 0x0050 #define <API key> <API key>(OMAP3430_GR_MOD, 0x0050) #define <API key> 0x0054 #define <API key> <API key>(OMAP3430_GR_MOD, 0x0054) #define <API key> 0x0058 #define OMAP3430_PRM_RSTST <API key>(OMAP3430_GR_MOD, 0x0058) #define <API key> 0x0060 #define <API key> <API key>(OMAP3430_GR_MOD, 0x0060) #define <API key> 0x0064 #define <API key> <API key>(OMAP3430_GR_MOD, 0x0064) #define <API key> 0x0070 #define <API key> <API key>(OMAP3430_GR_MOD, 0x0070) #define <API key> 0x0090 #define <API key> <API key>(OMAP3430_GR_MOD, 0x0090) #define <API key> 0x0094 #define <API key> <API key>(OMAP3430_GR_MOD, 0x0094) #define <API key> 0x0098 #define <API key> <API key>(OMAP3430_GR_MOD, 0x0098) #define <API key> 0x009c #define <API key> <API key>(OMAP3430_GR_MOD, 0x009c) #define <API key> 0x00a0 #define <API key> <API key>(OMAP3430_GR_MOD, 0x00a0) #define <API key> 0x00b0 #define <API key> <API key>(OMAP3430_GR_MOD, 0x00b0) #define <API key> 0x00b4 #define <API key> <API key>(OMAP3430_GR_MOD, 0x00b4) #define <API key> 0x00b8 #define <API key> <API key>(OMAP3430_GR_MOD, 0x00b8) #define <API key> 0x00bc #define <API key> <API key>(OMAP3430_GR_MOD, 0x00bc) #define <API key> 0x00c0 #define <API key> <API key>(OMAP3430_GR_MOD, 0x00c0) #define <API key> 0x00c4 #define <API key> <API key>(OMAP3430_GR_MOD, 0x00c4) #define <API key> 0x00d0 #define <API key> <API key>(OMAP3430_GR_MOD, 0x00d0) #define <API key> 0x00d4 #define <API key> <API key>(OMAP3430_GR_MOD, 0x00d4) #define <API key> 0x00d8 #define <API key> <API key>(OMAP3430_GR_MOD, 0x00d8) #define <API key> 0x00dc #define <API key> <API key>(OMAP3430_GR_MOD, 0x00dc) #define <API key> 0x00e0 #define <API key> <API key>(OMAP3430_GR_MOD, 0x00e0) #define <API key> 0x00e4 #define <API key> <API key>(OMAP3430_GR_MOD, 0x00e4) #define <API key> 0x0040 #define OMAP3430_PRM_CLKSEL <API key>(OMAP3430_CCR_MOD, 0x0040) #define <API key> 0x0070 #define <API key> <API key>(OMAP3430_CCR_MOD, 0x0070) #define OMAP2_RM_RSTCTRL 0x0050 #define OMAP2_RM_RSTTIME 0x0054 #define OMAP2_RM_RSTST 0x0058 #define OMAP2_PM_PWSTCTRL 0x00e0 #define OMAP2_PM_PWSTST 0x00e4 #define PM_WKEN 0x00a0 #define PM_WKEN1 PM_WKEN #define PM_WKST 0x00b0 #define PM_WKST1 PM_WKST #define PM_WKDEP 0x00c8 #define PM_EVGENCTRL 0x00d4 #define PM_EVGENONTIM 0x00d8 #define PM_EVGENOFFTIM 0x00dc #define OMAP24XX_PM_WKEN2 0x00a4 #define OMAP24XX_PM_WKST2 0x00b4 #define <API key> 0x00f0 #define <API key> 0x00f4 #define <API key> 0x00f8 #define <API key> 0x00fc #define <API key> 0x00f0 #define <API key> 0x00b8 #define <API key> 0x00a4 #define <API key> <API key> #define <API key> 0x00f8 #define <API key> 0x00a8 #define <API key> <API key> #define <API key> 0x00f4 #define <API key> 0x00e8 #define <API key> 0x00f8 #define <API key> 0x00fc #ifndef __ASSEMBLER__ #if defined(CONFIG_ARCH_OMAP4) && !(defined(CONFIG_ARCH_OMAP2) || \ defined(CONFIG_ARCH_OMAP3)) static inline u32 <API key>(s16 module, u16 idx) { WARN(1, "prm: omap2xxx/omap3xxx specific function and " "not suppose to be used on omap4\n"); return 0; } static inline void <API key>(u32 val, s16 module, u16 idx) { WARN(1, "prm: omap2xxx/omap3xxx specific function and " "not suppose to be used on omap4\n"); } static inline u32 <API key>(u32 mask, u32 bits, s16 module, s16 idx) { WARN(1, "prm: omap2xxx/omap3xxx specific function and " "not suppose to be used on omap4\n"); return 0; } static inline u32 <API key>(u32 bits, s16 module, s16 idx) { WARN(1, "prm: omap2xxx/omap3xxx specific function and " "not suppose to be used on omap4\n"); return 0; } static inline u32 <API key>(u32 bits, s16 module, s16 idx) { WARN(1, "prm: omap2xxx/omap3xxx specific function and " "not suppose to be used on omap4\n"); return 0; } static inline u32 <API key>(s16 domain, s16 idx, u32 mask) { WARN(1, "prm: omap2xxx/omap3xxx specific function and " "not suppose to be used on omap4\n"); return 0; } static inline int <API key>(s16 prm_mod, u8 shift) { WARN(1, "prm: omap2xxx/omap3xxx specific function and " "not suppose to be used on omap4\n"); return 0; } static inline int <API key>(s16 prm_mod, u8 shift) { WARN(1, "prm: omap2xxx/omap3xxx specific function and " "not suppose to be used on omap4\n"); return 0; } static inline int <API key>(s16 prm_mod, u8 rst_shift, u8 st_shift) { WARN(1, "prm: omap2xxx/omap3xxx specific function and " "not suppose to be used on omap4\n"); return 0; } #else extern u32 <API key>(s16 module, u16 idx); extern void <API key>(u32 val, s16 module, u16 idx); extern u32 <API key>(u32 mask, u32 bits, s16 module, s16 idx); extern u32 <API key>(u32 bits, s16 module, s16 idx); extern u32 <API key>(u32 bits, s16 module, s16 idx); extern u32 <API key>(s16 domain, s16 idx, u32 mask); extern int <API key>(s16 prm_mod, u8 shift); extern int <API key>(s16 prm_mod, u8 shift); extern int <API key>(s16 prm_mod, u8 rst_shift, u8 st_shift); u32 <API key>(u8 vp_id); void <API key>(u8 vp_id); extern u32 omap3_prm_vcvp_read(u8 offset); extern void <API key>(u32 val, u8 offset); extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset); extern void <API key>(unsigned long *events); extern void <API key>(void); extern void <API key>(u32 *saved_mask); extern void <API key>(u32 *saved_mask); #endif #endif #define <API key> 0 #define OMAP_ONTIMEVAL_MASK (0xffffffff << 0) #define <API key> 0 #define <API key> (0xffffffff << 0) #define <API key> 0 #define <API key> (0xffff << 0) #define <API key> 6 #define OMAP_SYSCLKDIV_MASK (0x3 << 6) #define <API key> 3 #define <API key> (0x3 << 3) #define <API key> 0 #define OMAP_SYSCLKSEL_MASK (0x3 << 0) #define <API key> 3 #define <API key> (0x3 << 3) #define <API key> 1 #define <API key> (0x3 << 1) #define OMAP_ENABLE_MASK (1 << 0) #define OMAP_RSTTIME2_SHIFT 8 #define OMAP_RSTTIME2_MASK (0x1f << 8) #define OMAP_RSTTIME1_SHIFT 0 #define OMAP_RSTTIME1_MASK (0xff << 0) #define OMAP_RST_DPLL3_MASK (1 << 2) #define OMAP_RST_GS_MASK (1 << 1) #define <API key> (1 << 3) #define <API key> (1 << 2) #define <API key> (1 << 1) #define <API key> (1 << 0) #define OMAP_EN_WKUP_SHIFT 4 #define OMAP_EN_WKUP_MASK (1 << 4) #define <API key> (1 << 2) #define <API key> 10000 #endif
#ifndef <API key> #define <API key> #include <linux/io.h> #define RTC_PORT(x) (0x70 + (x)) #define RTC_IRQ 8 static inline unsigned char CMOS_READ(unsigned long addr) { outb_p(addr, RTC_PORT(0)); return inb_p(RTC_PORT(1)); } static inline void CMOS_WRITE(unsigned char data, unsigned long addr) { outb_p(addr, RTC_PORT(0)); outb_p(data, RTC_PORT(1)); } #define RTC_ALWAYS_BCD 0 #ifndef <API key> #define <API key>(year) ((year) < 70 ? (year) + 2000 : (year) + 1970) #endif #endif
#include <linux/etherdevice.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include <linux/sched.h> #include "iwl-dev.h" #include "iwl-core.h" #include "iwl-io.h" #include "iwl-agn-hw.h" #include "iwl-agn.h" #include "iwl-trans.h" #include "iwl-shared.h" int <API key>(u32 addr) { return (addr >= <API key>) && (addr < <API key>); } int <API key>(struct iwl_priv *priv) { struct <API key> tx_power_cmd; u8 tx_ant_cfg_cmd; if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &priv->status), "TX Power requested while scanning!\n")) return -EAGAIN; tx_power_cmd.global_lmt = (s8)(2 * priv->tx_power_user_lmt); if (priv-><API key> && priv-><API key> < tx_power_cmd.global_lmt) { tx_power_cmd.global_lmt = priv-><API key>; } tx_power_cmd.flags = <API key>; tx_power_cmd.srv_chan_lmt = <API key>; if (IWL_UCODE_API(priv->fw->ucode_ver) == 1) tx_ant_cfg_cmd = <API key>; else tx_ant_cfg_cmd = <API key>; return <API key>(priv, tx_ant_cfg_cmd, CMD_SYNC, sizeof(tx_power_cmd), &tx_power_cmd); } void iwlagn_temperature(struct iwl_priv *priv) { lockdep_assert_held(&priv->statistics.lock); priv->temperature = le32_to_cpu(priv->statistics.common.temperature); iwl_tt_handler(priv); } u16 <API key>(struct iwl_shared *shrd) { struct <API key> *hdr; hdr = (struct <API key> *)<API key>(shrd, EEPROM_CALIB_ALL); return hdr->version; } static u32 <API key>(const struct iwl_shared *shrd, u32 address) { u16 offset = 0; if ((address & INDIRECT_ADDRESS) == 0) return address; switch (address & INDIRECT_TYPE_MSK) { case INDIRECT_HOST: offset = iwl_eeprom_query16(shrd, EEPROM_LINK_HOST); break; case INDIRECT_GENERAL: offset = iwl_eeprom_query16(shrd, EEPROM_LINK_GENERAL); break; case INDIRECT_REGULATORY: offset = iwl_eeprom_query16(shrd, <API key>); break; case INDIRECT_TXP_LIMIT: offset = iwl_eeprom_query16(shrd, <API key>); break; case <API key>: offset = iwl_eeprom_query16(shrd, <API key>); break; case <API key>: offset = iwl_eeprom_query16(shrd, <API key>); break; case <API key>: offset = iwl_eeprom_query16(shrd, <API key>); break; case INDIRECT_OTHERS: offset = iwl_eeprom_query16(shrd, EEPROM_LINK_OTHERS); break; default: IWL_ERR(shrd->trans, "illegal indirect type: 0x%X\n", address & INDIRECT_TYPE_MSK); break; } return (address & ADDRESS_MSK) + (offset << 1); } const u8 *<API key>(const struct iwl_shared *shrd, size_t offset) { u32 address = <API key>(shrd, offset); BUG_ON(address >= shrd->cfg->base_params->eeprom_size); return &shrd->eeprom[address]; } struct iwl_mod_params iwlagn_mod_params = { .amsdu_size_8K = 1, .restart_fw = 1, .plcp_check = true, .bt_coex_active = true, .no_sleep_autoadjust = true, .power_level = IWL_POWER_INDEX_1, .bt_ch_announce = true, .<API key> = 1, .auto_agg = true, }; int <API key>(u32 rate_n_flags, enum ieee80211_band band) { int idx = 0; int band_offset = 0; if (rate_n_flags & RATE_MCS_HT_MSK) { idx = (rate_n_flags & 0xff); return idx; } else { if (band == IEEE80211_BAND_5GHZ) band_offset = IWL_FIRST_OFDM_RATE; for (idx = band_offset; idx < <API key>; idx++) if (iwl_rates[idx].plcp == (rate_n_flags & 0xFF)) return idx - band_offset; } return -1; } int <API key>(struct iwl_priv *priv, struct ieee80211_vif *vif, bool add) { struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; if (add) return <API key>(priv, vif_priv->ctx, vif->bss_conf.bssid, &vif_priv->ibss_bssid_sta_id); return iwl_remove_station(priv, vif_priv->ibss_bssid_sta_id, vif->bss_conf.bssid); } int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control) { struct <API key> flush_cmd; struct iwl_host_cmd cmd = { .id = REPLY_TXFIFO_FLUSH, .len = { sizeof(struct <API key>), }, .flags = CMD_SYNC, .data = { &flush_cmd, }, }; might_sleep(); memset(&flush_cmd, 0, sizeof(flush_cmd)); if (flush_control & BIT(IWL_RXON_CTX_BSS)) flush_cmd.fifo_control = IWL_SCD_VO_MSK | IWL_SCD_VI_MSK | IWL_SCD_BE_MSK | IWL_SCD_BK_MSK | IWL_SCD_MGMT_MSK; if ((flush_control & BIT(IWL_RXON_CTX_PAN)) && (priv->shrd->valid_contexts != BIT(IWL_RXON_CTX_BSS))) flush_cmd.fifo_control |= IWL_PAN_SCD_VO_MSK | IWL_PAN_SCD_VI_MSK | IWL_PAN_SCD_BE_MSK | IWL_PAN_SCD_BK_MSK | <API key> | <API key>; if (hw_params(priv).sku & <API key>) flush_cmd.fifo_control |= <API key>; IWL_DEBUG_INFO(priv, "fifo queue control: 0X%x\n", flush_cmd.fifo_control); flush_cmd.flush_control = cpu_to_le16(flush_control); return iwl_dvm_send_cmd(priv, &cmd); } void <API key>(struct iwl_priv *priv, u16 flush_control) { mutex_lock(&priv->mutex); <API key>(priv->hw); if (iwlagn_txfifo_flush(priv, IWL_DROP_ALL)) { IWL_ERR(priv, "flush request fail\n"); goto done; } IWL_DEBUG_INFO(priv, "wait transmit/flush all frames\n"); <API key>(trans(priv)); done: <API key>(priv->hw); mutex_unlock(&priv->mutex); } #define LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, wifi_req, wifi_prio, \ wifi_txrx, wifi_sh_ant_req) \ (bt3_prio | (bt3_txrx << 1) | (bt_rf_act << 2) | (wifi_req << 3) | \ (wifi_prio << 4) | (wifi_txrx << 5) | (wifi_sh_ant_req << 6)) #define <API key>(lut, op, val) \ lut[8 + ((val) >> 5)] op (cpu_to_le32(BIT((val) & 0x1f))) #define <API key>(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \ wifi_prio, wifi_txrx, wifi_sh_ant_req) \ (!!(<API key>(lut, &, LUT_VALUE(bt3_prio, bt3_txrx, \ bt_rf_act, wifi_req, wifi_prio, wifi_txrx, \ wifi_sh_ant_req)))) #define <API key>(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \ wifi_prio, wifi_txrx, wifi_sh_ant_req) \ <API key>(lut, |=, LUT_VALUE(bt3_prio, bt3_txrx, \ bt_rf_act, wifi_req, wifi_prio, wifi_txrx, \ wifi_sh_ant_req)) #define <API key>(lut, bt3_prio, bt3_txrx, bt_rf_act, \ wifi_req, wifi_prio, wifi_txrx, \ wifi_sh_ant_req) \ <API key>(lut, &= ~, LUT_VALUE(bt3_prio, bt3_txrx, \ bt_rf_act, wifi_req, wifi_prio, wifi_txrx, \ wifi_sh_ant_req)) #define LUT_WLAN_KILL_OP(lut, op, val) \ lut[(val) >> 4] op (cpu_to_le32(BIT(((val) << 1) & 0x1e))) #define LUT_TEST_WLAN_KILL(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \ wifi_prio, wifi_txrx, wifi_sh_ant_req) \ (!!(LUT_WLAN_KILL_OP(lut, &, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \ wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req)))) #define LUT_SET_WLAN_KILL(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \ wifi_prio, wifi_txrx, wifi_sh_ant_req) \ LUT_WLAN_KILL_OP(lut, |=, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \ wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req)) #define LUT_CLEAR_WLAN_KILL(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \ wifi_prio, wifi_txrx, wifi_sh_ant_req) \ LUT_WLAN_KILL_OP(lut, &= ~, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \ wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req)) #define LUT_ANT_SWITCH_OP(lut, op, val) \ lut[(val) >> 4] op (cpu_to_le32(BIT((((val) << 1) & 0x1e) + 1))) #define LUT_TEST_ANT_SWITCH(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \ wifi_prio, wifi_txrx, wifi_sh_ant_req) \ (!!(LUT_ANT_SWITCH_OP(lut, &, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \ wifi_req, wifi_prio, wifi_txrx, \ wifi_sh_ant_req)))) #define LUT_SET_ANT_SWITCH(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \ wifi_prio, wifi_txrx, wifi_sh_ant_req) \ LUT_ANT_SWITCH_OP(lut, |=, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \ wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req)) #define <API key>(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \ wifi_prio, wifi_txrx, wifi_sh_ant_req) \ LUT_ANT_SWITCH_OP(lut, &= ~, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \ wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req)) static const __le32 <API key>[12] = { cpu_to_le32(0xaaaaaaaa), cpu_to_le32(0xaaaaaaaa), cpu_to_le32(0xaeaaaaaa), cpu_to_le32(0xaaaaaaaa), cpu_to_le32(0xcc00ff28), cpu_to_le32(0x0000aaaa), cpu_to_le32(0xcc00aaaa), cpu_to_le32(0x0000aaaa), cpu_to_le32(0xc0004000), cpu_to_le32(0x00004000), cpu_to_le32(0xf0005000), cpu_to_le32(0xf0005000), }; static const __le32 <API key>[12] = { cpu_to_le32(0xaaaaaaaa), cpu_to_le32(0xaaaaaaaa), cpu_to_le32(0xaaaaaaaa), cpu_to_le32(0xaaaaaaaa), cpu_to_le32(0xaaaaaaaa), cpu_to_le32(0xaaaaaaaa), cpu_to_le32(0xaaaaaaaa), cpu_to_le32(0xaaaaaaaa), cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), cpu_to_le32(0x00000000), }; void <API key>(struct iwl_priv *priv) { struct iwl_basic_bt_cmd basic = { .max_kill = <API key>, .bt3_timer_t7_value = <API key>, .<API key> = <API key>, .bt3_timer_t2_value = <API key>, }; struct iwl6000_bt_cmd bt_cmd_6000; struct iwl2000_bt_cmd bt_cmd_2000; int ret; BUILD_BUG_ON(sizeof(<API key>) != sizeof(basic.bt3_lookup_table)); if (cfg(priv)->bt_params) { if (cfg(priv)->bt_params->bt_session_2) { bt_cmd_2000.prio_boost = cpu_to_le32( cfg(priv)->bt_params->bt_prio_boost); bt_cmd_2000.tx_prio_boost = 0; bt_cmd_2000.rx_prio_boost = 0; } else { bt_cmd_6000.prio_boost = cfg(priv)->bt_params->bt_prio_boost; bt_cmd_6000.tx_prio_boost = 0; bt_cmd_6000.rx_prio_boost = 0; } } else { IWL_ERR(priv, "failed to construct BT Coex Config\n"); return; } basic.kill_ack_mask = priv->kill_ack_mask; basic.kill_cts_mask = priv->kill_cts_mask; basic.valid = priv->bt_valid; if (!iwlagn_mod_params.bt_coex_active || priv->iw_mode == <API key>) { basic.flags = <API key>; } else { basic.flags = <API key> << <API key>; if (!priv->bt_enable_pspoll) basic.flags |= <API key>; else basic.flags &= ~<API key>; if (priv->bt_ch_announce) basic.flags |= <API key>; IWL_DEBUG_COEX(priv, "BT coex flag: 0X%x\n", basic.flags); } priv->bt_enable_flag = basic.flags; if (priv->bt_full_concurrent) memcpy(basic.bt3_lookup_table, <API key>, sizeof(<API key>)); else memcpy(basic.bt3_lookup_table, <API key>, sizeof(<API key>)); IWL_DEBUG_COEX(priv, "BT coex %s in %s mode\n", basic.flags ? "active" : "disabled", priv->bt_full_concurrent ? "full concurrency" : "3-wire"); if (cfg(priv)->bt_params->bt_session_2) { memcpy(&bt_cmd_2000.basic, &basic, sizeof(basic)); ret = <API key>(priv, REPLY_BT_CONFIG, CMD_SYNC, sizeof(bt_cmd_2000), &bt_cmd_2000); } else { memcpy(&bt_cmd_6000.basic, &basic, sizeof(basic)); ret = <API key>(priv, REPLY_BT_CONFIG, CMD_SYNC, sizeof(bt_cmd_6000), &bt_cmd_6000); } if (ret) IWL_ERR(priv, "failed to send BT Coex Config\n"); } void <API key>(struct iwl_priv *priv, bool rssi_ena) { struct iwl_rxon_context *ctx, *found_ctx = NULL; bool found_ap = false; lockdep_assert_held(&priv->mutex); if (rssi_ena) { for_each_context(priv, ctx) { if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_AP && <API key>(ctx)) { found_ap = true; break; } } } if (!rssi_ena || found_ap) { if (priv->cur_rssi_ctx) { ctx = priv->cur_rssi_ctx; <API key>(ctx->vif); priv->cur_rssi_ctx = NULL; } return; } for_each_context(priv, ctx) { if (ctx->vif && ctx->vif->type == <API key> && <API key>(ctx)) { found_ctx = ctx; break; } } if (found_ctx == priv->cur_rssi_ctx) return; if (priv->cur_rssi_ctx) { ctx = priv->cur_rssi_ctx; if (ctx->vif) <API key>(ctx->vif); } priv->cur_rssi_ctx = found_ctx; if (!found_ctx) return; <API key>(found_ctx->vif, <API key>, <API key>); } static bool <API key>(struct iwl_bt_uart_msg *uart_msg) { return <API key> & uart_msg->frame3 >> <API key>; } static void <API key>(struct work_struct *work) { struct iwl_priv *priv = container_of(work, struct iwl_priv, <API key>); struct iwl_rxon_context *ctx; int smps_request = -1; if (priv->bt_enable_flag == <API key>) { return; } IWL_DEBUG_COEX(priv, "BT traffic load changes: %d\n", priv->bt_traffic_load); switch (priv->bt_traffic_load) { case <API key>: if (priv->bt_status) smps_request = <API key>; else smps_request = <API key>; break; case <API key>: smps_request = <API key>; break; case <API key>: case <API key>: smps_request = <API key>; break; default: IWL_ERR(priv, "Invalid BT traffic load: %d\n", priv->bt_traffic_load); break; } mutex_lock(&priv->mutex); if (test_bit(STATUS_SCAN_HW, &priv->status)) goto out; <API key>(priv); if (smps_request != -1) { priv->current_ht_config.smps = smps_request; for_each_context(priv, ctx) { if (ctx->vif && ctx->vif->type == <API key>) <API key>(ctx->vif, smps_request); } } <API key>(priv); out: mutex_unlock(&priv->mutex); } void <API key>(struct iwl_priv *priv) { if (priv->bt_is_sco && priv->bt_traffic_load == <API key>) <API key>(priv, true); else <API key>(priv, false); } static void <API key>(struct iwl_priv *priv, struct iwl_bt_uart_msg *uart_msg) { IWL_DEBUG_COEX(priv, "Message Type = 0x%X, SSN = 0x%X, " "Update Req = 0x%X", (<API key> & uart_msg->frame1) >> <API key>, (<API key> & uart_msg->frame1) >> <API key>, (<API key> & uart_msg->frame1) >> <API key>); IWL_DEBUG_COEX(priv, "Open connections = 0x%X, Traffic load = 0x%X, " "Chl_SeqN = 0x%X, In band = 0x%X", (<API key> & uart_msg->frame2) >> <API key>, (<API key> & uart_msg->frame2) >> <API key>, (<API key> & uart_msg->frame2) >> <API key>, (<API key> & uart_msg->frame2) >> <API key>); IWL_DEBUG_COEX(priv, "SCO/eSCO = 0x%X, Sniff = 0x%X, A2DP = 0x%X, " "ACL = 0x%X, Master = 0x%X, OBEX = 0x%X", (<API key> & uart_msg->frame3) >> <API key>, (<API key> & uart_msg->frame3) >> <API key>, (<API key> & uart_msg->frame3) >> <API key>, (<API key> & uart_msg->frame3) >> <API key>, (<API key> & uart_msg->frame3) >> <API key>, (<API key> & uart_msg->frame3) >> <API key>); IWL_DEBUG_COEX(priv, "Idle duration = 0x%X", (<API key> & uart_msg->frame4) >> <API key>); IWL_DEBUG_COEX(priv, "Tx Activity = 0x%X, Rx Activity = 0x%X, " "eSCO Retransmissions = 0x%X", (<API key> & uart_msg->frame5) >> <API key>, (<API key> & uart_msg->frame5) >> <API key>, (<API key> & uart_msg->frame5) >> <API key>); IWL_DEBUG_COEX(priv, "Sniff Interval = 0x%X, Discoverable = 0x%X", (<API key> & uart_msg->frame6) >> <API key>, (<API key> & uart_msg->frame6) >> <API key>); IWL_DEBUG_COEX(priv, "Sniff Activity = 0x%X, Page = " "0x%X, Inquiry = 0x%X, Connectable = 0x%X", (<API key> & uart_msg->frame7) >> <API key>, (<API key> & uart_msg->frame7) >> <API key>, (<API key> & uart_msg->frame7) >> <API key>, (<API key> & uart_msg->frame7) >> <API key>); } static void iwlagn_set_kill_msk(struct iwl_priv *priv, struct iwl_bt_uart_msg *uart_msg) { u8 kill_msk; static const __le32 bt_kill_ack_msg[2] = { <API key>, <API key> }; static const __le32 bt_kill_cts_msg[2] = { <API key>, <API key> }; kill_msk = (<API key> & uart_msg->frame3) ? 1 : 0; if (priv->kill_ack_mask != bt_kill_ack_msg[kill_msk] || priv->kill_cts_mask != bt_kill_cts_msg[kill_msk]) { priv->bt_valid |= <API key>; priv->kill_ack_mask = bt_kill_ack_msg[kill_msk]; priv->bt_valid |= <API key>; priv->kill_cts_mask = bt_kill_cts_msg[kill_msk]; queue_work(priv->workqueue, &priv->bt_runtime_config); } } int <API key>(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, struct iwl_device_cmd *cmd) { struct iwl_rx_packet *pkt = rxb_addr(rxb); struct <API key> *coex = (void *)pkt->data; struct iwl_bt_uart_msg *uart_msg = &coex->last_bt_uart_msg; if (priv->bt_enable_flag == <API key>) { return 0; } IWL_DEBUG_COEX(priv, "BT Coex notification:\n"); IWL_DEBUG_COEX(priv, " status: %d\n", coex->bt_status); IWL_DEBUG_COEX(priv, " traffic load: %d\n", coex->bt_traffic_load); IWL_DEBUG_COEX(priv, " CI compliance: %d\n", coex->bt_ci_compliance); <API key>(priv, uart_msg); priv-><API key> = priv->bt_traffic_load; priv->bt_is_sco = <API key>(uart_msg); if (priv->iw_mode != <API key>) { if (priv->bt_status != coex->bt_status || priv-><API key> != coex->bt_traffic_load) { if (coex->bt_status) { if (!priv->bt_ch_announce) priv->bt_traffic_load = <API key>; else priv->bt_traffic_load = coex->bt_traffic_load; } else { priv->bt_traffic_load = <API key>; } priv->bt_status = coex->bt_status; queue_work(priv->workqueue, &priv-><API key>); } } iwlagn_set_kill_msk(priv, uart_msg); priv->bt_ci_compliance = coex->bt_ci_compliance; return 0; } void <API key>(struct iwl_priv *priv) { priv->rx_handlers[<API key>] = <API key>; } void <API key>(struct iwl_priv *priv) { INIT_WORK(&priv-><API key>, <API key>); } void <API key>(struct iwl_priv *priv) { cancel_work_sync(&priv-><API key>); } static bool is_single_rx_stream(struct iwl_priv *priv) { return priv->current_ht_config.smps == <API key> || priv->current_ht_config.<API key>; } #define <API key> 3 #define <API key> 2 #define <API key> 2 #define <API key> 1 static int <API key>(struct iwl_priv *priv) { if (cfg(priv)->bt_params && cfg(priv)->bt_params->advanced_bt_coexist && (priv->bt_full_concurrent || priv->bt_traffic_load >= <API key>)) { return <API key>; } if (is_single_rx_stream(priv)) return <API key>; else return <API key>; } static int <API key>(struct iwl_priv *priv, int active_cnt) { switch (priv->current_ht_config.smps) { case <API key>: case <API key>: return <API key>; case <API key>: case IEEE80211_SMPS_OFF: return active_cnt; default: WARN(1, "invalid SMPS mode %d", priv->current_ht_config.smps); return active_cnt; } } static u8 <API key>(u32 chain_bitmap) { u8 res; res = (chain_bitmap & BIT(0)) >> 0; res += (chain_bitmap & BIT(1)) >> 1; res += (chain_bitmap & BIT(2)) >> 2; res += (chain_bitmap & BIT(3)) >> 3; return res; } void <API key>(struct iwl_priv *priv, struct iwl_rxon_context *ctx) { bool is_single = is_single_rx_stream(priv); bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->shrd->status); u8 idle_rx_cnt, active_rx_cnt, valid_rx_cnt; u32 active_chains; u16 rx_chain; if (priv->chain_noise_data.active_chains) active_chains = priv->chain_noise_data.active_chains; else active_chains = hw_params(priv).valid_rx_ant; if (cfg(priv)->bt_params && cfg(priv)->bt_params->advanced_bt_coexist && (priv->bt_full_concurrent || priv->bt_traffic_load >= <API key>)) { active_chains = first_antenna(active_chains); } rx_chain = active_chains << <API key>; active_rx_cnt = <API key>(priv); idle_rx_cnt = <API key>(priv, active_rx_cnt); valid_rx_cnt = <API key>(active_chains); if (valid_rx_cnt < active_rx_cnt) active_rx_cnt = valid_rx_cnt; if (valid_rx_cnt < idle_rx_cnt) idle_rx_cnt = valid_rx_cnt; rx_chain |= active_rx_cnt << <API key>; rx_chain |= idle_rx_cnt << <API key>; ctx->staging.rx_chain = cpu_to_le16(rx_chain); if (!is_single && (active_rx_cnt >= <API key>) && is_cam) ctx->staging.rx_chain |= <API key>; else ctx->staging.rx_chain &= ~<API key>; IWL_DEBUG_ASSOC(priv, "rx_chain=0x%X active=%d idle=%d\n", ctx->staging.rx_chain, active_rx_cnt, idle_rx_cnt); WARN_ON(active_rx_cnt == 0 || idle_rx_cnt == 0 || active_rx_cnt < idle_rx_cnt); } u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant, u8 valid) { int i; u8 ind = ant; if (priv->band == IEEE80211_BAND_2GHZ && priv->bt_traffic_load >= <API key>) return 0; for (i = 0; i < RATE_ANT_NUM - 1; i++) { ind = (ind + 1) < RATE_ANT_NUM ? ind + 1 : 0; if (valid & BIT(ind)) return ind; } return ant; } #ifdef CONFIG_PM_SLEEP static void iwlagn_convert_p1k(u16 *p1k, __le16 *out) { int i; for (i = 0; i < IWLAGN_P1K_SIZE; i++) out[i] = cpu_to_le16(p1k[i]); } struct wowlan_key_data { struct iwl_rxon_context *ctx; struct <API key> *rsc_tsc; struct <API key> *tkip; const u8 *bssid; bool error, use_rsc_tsc, use_tkip; }; static void <API key>(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_key_conf *key, void *_data) { struct iwl_priv *priv = <API key>(hw); struct wowlan_key_data *data = _data; struct iwl_rxon_context *ctx = data->ctx; struct aes_sc *aes_sc, *aes_tx_sc = NULL; struct tkip_sc *tkip_sc, *tkip_tx_sc = NULL; struct iwlagn_p1k_cache *rx_p1ks; u8 *rx_mic_key; struct ieee80211_key_seq seq; u32 cur_rx_iv32 = 0; u16 p1k[IWLAGN_P1K_SIZE]; int ret, i; mutex_lock(&priv->mutex); if ((key->cipher == <API key> || key->cipher == <API key>) && !sta && !ctx->key_mapping_keys) ret = <API key>(priv, ctx, key); else ret = iwl_set_dynamic_key(priv, ctx, key, sta); if (ret) { IWL_ERR(priv, "Error setting key during suspend!\n"); data->error = true; } switch (key->cipher) { case <API key>: if (sta) { tkip_sc = data->rsc_tsc->all_tsc_rsc.tkip.unicast_rsc; tkip_tx_sc = &data->rsc_tsc->all_tsc_rsc.tkip.tsc; rx_p1ks = data->tkip->rx_uni; <API key>(key, &seq); tkip_tx_sc->iv16 = cpu_to_le16(seq.tkip.iv16); tkip_tx_sc->iv32 = cpu_to_le32(seq.tkip.iv32); <API key>(key, seq.tkip.iv32, p1k); iwlagn_convert_p1k(p1k, data->tkip->tx.p1k); memcpy(data->tkip->mic_keys.tx, &key->key[<API key>], IWLAGN_MIC_KEY_SIZE); rx_mic_key = data->tkip->mic_keys.rx_unicast; } else { tkip_sc = data->rsc_tsc->all_tsc_rsc.tkip.multicast_rsc; rx_p1ks = data->tkip->rx_multi; rx_mic_key = data->tkip->mic_keys.rx_mcast; } for (i = 0; i < IWLAGN_NUM_RSC; i++) { <API key>(key, i, &seq); tkip_sc[i].iv16 = cpu_to_le16(seq.tkip.iv16); tkip_sc[i].iv32 = cpu_to_le32(seq.tkip.iv32); if (seq.tkip.iv32 > cur_rx_iv32) cur_rx_iv32 = seq.tkip.iv32; } <API key>(key, data->bssid, cur_rx_iv32, p1k); iwlagn_convert_p1k(p1k, rx_p1ks[0].p1k); <API key>(key, data->bssid, cur_rx_iv32 + 1, p1k); iwlagn_convert_p1k(p1k, rx_p1ks[1].p1k); memcpy(rx_mic_key, &key->key[<API key>], IWLAGN_MIC_KEY_SIZE); data->use_tkip = true; data->use_rsc_tsc = true; break; case <API key>: if (sta) { u8 *pn = seq.ccmp.pn; aes_sc = data->rsc_tsc->all_tsc_rsc.aes.unicast_rsc; aes_tx_sc = &data->rsc_tsc->all_tsc_rsc.aes.tsc; <API key>(key, &seq); aes_tx_sc->pn = cpu_to_le64( (u64)pn[5] | ((u64)pn[4] << 8) | ((u64)pn[3] << 16) | ((u64)pn[2] << 24) | ((u64)pn[1] << 32) | ((u64)pn[0] << 40)); } else aes_sc = data->rsc_tsc->all_tsc_rsc.aes.multicast_rsc; for (i = 0; i < IWLAGN_NUM_RSC; i++) { u8 *pn = seq.ccmp.pn; <API key>(key, i, &seq); aes_sc->pn = cpu_to_le64( (u64)pn[5] | ((u64)pn[4] << 8) | ((u64)pn[3] << 16) | ((u64)pn[2] << 24) | ((u64)pn[1] << 32) | ((u64)pn[0] << 40)); } data->use_rsc_tsc = true; break; } mutex_unlock(&priv->mutex); } int <API key>(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan) { struct <API key> *pattern_cmd; struct iwl_host_cmd cmd = { .id = <API key>, .dataflags[0] = IWL_HCMD_DFL_NOCOPY, .flags = CMD_SYNC, }; int i, err; if (!wowlan->n_patterns) return 0; cmd.len[0] = sizeof(*pattern_cmd) + wowlan->n_patterns * sizeof(struct <API key>); pattern_cmd = kmalloc(cmd.len[0], GFP_KERNEL); if (!pattern_cmd) return -ENOMEM; pattern_cmd->n_patterns = cpu_to_le32(wowlan->n_patterns); for (i = 0; i < wowlan->n_patterns; i++) { int mask_len = DIV_ROUND_UP(wowlan->patterns[i].pattern_len, 8); memcpy(&pattern_cmd->patterns[i].mask, wowlan->patterns[i].mask, mask_len); memcpy(&pattern_cmd->patterns[i].pattern, wowlan->patterns[i].pattern, wowlan->patterns[i].pattern_len); pattern_cmd->patterns[i].mask_size = mask_len; pattern_cmd->patterns[i].pattern_size = wowlan->patterns[i].pattern_len; } cmd.data[0] = pattern_cmd; err = iwl_dvm_send_cmd(priv, &cmd); kfree(pattern_cmd); return err; } int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan) { struct <API key> wakeup_filter_cmd; struct iwl_rxon_cmd rxon; struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; struct <API key> kek_kck_cmd; struct <API key> tkip_cmd = {}; struct <API key> d3_cfg_cmd = {}; struct wowlan_key_data key_data = { .ctx = ctx, .bssid = ctx->active.bssid_addr, .use_rsc_tsc = false, .tkip = &tkip_cmd, .use_tkip = false, }; int ret, i; u16 seq; key_data.rsc_tsc = kzalloc(sizeof(*key_data.rsc_tsc), GFP_KERNEL); if (!key_data.rsc_tsc) return -ENOMEM; memset(&wakeup_filter_cmd, 0, sizeof(wakeup_filter_cmd)); seq = le16_to_cpu(priv->last_seq_ctl) & IEEE80211_SCTL_SEQ; wakeup_filter_cmd.non_qos_seq = cpu_to_le16(seq); for (i = 0; i < IWL_MAX_TID_COUNT; i++) { seq = priv->tid_data[IWL_AP_ID][i].seq_number; seq -= 0x10; wakeup_filter_cmd.qos_seq[i] = cpu_to_le16(seq); } if (wowlan->disconnect) wakeup_filter_cmd.enabled |= cpu_to_le32(<API key> | <API key>); if (wowlan->magic_pkt) wakeup_filter_cmd.enabled |= cpu_to_le32(<API key>); if (wowlan->gtk_rekey_failure) wakeup_filter_cmd.enabled |= cpu_to_le32(<API key>); if (wowlan->eap_identity_req) wakeup_filter_cmd.enabled |= cpu_to_le32(<API key>); if (wowlan->four_way_handshake) wakeup_filter_cmd.enabled |= cpu_to_le32(<API key>); if (wowlan->n_patterns) wakeup_filter_cmd.enabled |= cpu_to_le32(<API key>); if (wowlan->rfkill_release) d3_cfg_cmd.wakeup_flags |= cpu_to_le32(<API key>); <API key>(priv, 200); memcpy(&rxon, &ctx->active, sizeof(rxon)); priv->ucode_loaded = false; <API key>(trans(priv)); priv->wowlan = true; ret = <API key>(priv, IWL_UCODE_WOWLAN); if (ret) goto out; ret = iwl_alive_start(priv); if (ret) goto out; memcpy(&ctx->staging, &rxon, sizeof(rxon)); ret = iwlagn_commit_rxon(priv, ctx); if (ret) goto out; ret = <API key>(priv, true); if (ret) goto out; if (!iwlagn_mod_params.sw_crypto) { priv->ucode_key_table = 0; ctx->key_mapping_keys = 0; mutex_unlock(&priv->mutex); ieee80211_iter_keys(priv->hw, ctx->vif, <API key>, &key_data); mutex_lock(&priv->mutex); if (key_data.error) { ret = -EIO; goto out; } if (key_data.use_rsc_tsc) { struct iwl_host_cmd rsc_tsc_cmd = { .id = <API key>, .flags = CMD_SYNC, .data[0] = key_data.rsc_tsc, .dataflags[0] = IWL_HCMD_DFL_NOCOPY, .len[0] = sizeof(*key_data.rsc_tsc), }; ret = iwl_dvm_send_cmd(priv, &rsc_tsc_cmd); if (ret) goto out; } if (key_data.use_tkip) { ret = <API key>(priv, <API key>, CMD_SYNC, sizeof(tkip_cmd), &tkip_cmd); if (ret) goto out; } if (priv->have_rekey_data) { memset(&kek_kck_cmd, 0, sizeof(kek_kck_cmd)); memcpy(kek_kck_cmd.kck, priv->kck, NL80211_KCK_LEN); kek_kck_cmd.kck_len = cpu_to_le16(NL80211_KCK_LEN); memcpy(kek_kck_cmd.kek, priv->kek, NL80211_KEK_LEN); kek_kck_cmd.kek_len = cpu_to_le16(NL80211_KEK_LEN); kek_kck_cmd.replay_ctr = priv->replay_ctr; ret = <API key>(priv, <API key>, CMD_SYNC, sizeof(kek_kck_cmd), &kek_kck_cmd); if (ret) goto out; } } ret = <API key>(priv, REPLY_D3_CONFIG, CMD_SYNC, sizeof(d3_cfg_cmd), &d3_cfg_cmd); if (ret) goto out; ret = <API key>(priv, <API key>, CMD_SYNC, sizeof(wakeup_filter_cmd), &wakeup_filter_cmd); if (ret) goto out; ret = <API key>(priv, wowlan); out: kfree(key_data.rsc_tsc); return ret; } #endif int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) { if (iwl_is_rfkill(priv) || iwl_is_ctkill(priv)) { IWL_WARN(priv, "Not sending command - %s KILL\n", iwl_is_rfkill(priv) ? "RF" : "CT"); return -EIO; } if (cmd->flags & CMD_SYNC) lockdep_assert_held(&priv->mutex); if (priv->ucode_owner == IWL_OWNERSHIP_TM && !(cmd->flags & CMD_ON_DEMAND)) { IWL_DEBUG_HC(priv, "tm own the uCode, no regular hcmd send\n"); return -EIO; } return iwl_trans_send_cmd(trans(priv), cmd); } int <API key>(struct iwl_priv *priv, u8 id, u32 flags, u16 len, const void *data) { struct iwl_host_cmd cmd = { .id = id, .len = { len, }, .data = { data, }, .flags = flags, }; return iwl_dvm_send_cmd(priv, &cmd); }
#include <linux/init.h> #include <linux/kernel.h> #include <linux/gpio.h> #include <mach/sh73a0.h> #include <mach/irqs.h> #define CPU_ALL_PORT(fn, pfx, sfx) \ PORT_10(fn, pfx, sfx), PORT_10(fn, pfx##1, sfx), \ PORT_10(fn, pfx##2, sfx), PORT_10(fn, pfx##3, sfx), \ PORT_10(fn, pfx##4, sfx), PORT_10(fn, pfx##5, sfx), \ PORT_10(fn, pfx##6, sfx), PORT_10(fn, pfx##7, sfx), \ PORT_10(fn, pfx##8, sfx), PORT_10(fn, pfx##9, sfx), \ PORT_10(fn, pfx##10, sfx), \ PORT_1(fn, pfx##110, sfx), PORT_1(fn, pfx##111, sfx), \ PORT_1(fn, pfx##112, sfx), PORT_1(fn, pfx##113, sfx), \ PORT_1(fn, pfx##114, sfx), PORT_1(fn, pfx##115, sfx), \ PORT_1(fn, pfx##116, sfx), PORT_1(fn, pfx##117, sfx), \ PORT_1(fn, pfx##118, sfx), \ PORT_1(fn, pfx##128, sfx), PORT_1(fn, pfx##129, sfx), \ PORT_10(fn, pfx##13, sfx), PORT_10(fn, pfx##14, sfx), \ PORT_10(fn, pfx##15, sfx), \ PORT_1(fn, pfx##160, sfx), PORT_1(fn, pfx##161, sfx), \ PORT_1(fn, pfx##162, sfx), PORT_1(fn, pfx##163, sfx), \ PORT_1(fn, pfx##164, sfx), \ PORT_1(fn, pfx##192, sfx), PORT_1(fn, pfx##193, sfx), \ PORT_1(fn, pfx##194, sfx), PORT_1(fn, pfx##195, sfx), \ PORT_1(fn, pfx##196, sfx), PORT_1(fn, pfx##197, sfx), \ PORT_1(fn, pfx##198, sfx), PORT_1(fn, pfx##199, sfx), \ PORT_10(fn, pfx##20, sfx), PORT_10(fn, pfx##21, sfx), \ PORT_10(fn, pfx##22, sfx), PORT_10(fn, pfx##23, sfx), \ PORT_10(fn, pfx##24, sfx), PORT_10(fn, pfx##25, sfx), \ PORT_10(fn, pfx##26, sfx), PORT_10(fn, pfx##27, sfx), \ PORT_1(fn, pfx##280, sfx), PORT_1(fn, pfx##281, sfx), \ PORT_1(fn, pfx##282, sfx), \ PORT_1(fn, pfx##288, sfx), PORT_1(fn, pfx##289, sfx), \ PORT_10(fn, pfx##29, sfx), PORT_10(fn, pfx##30, sfx) enum { PINMUX_RESERVED = 0, PINMUX_DATA_BEGIN, PORT_ALL(DATA), PINMUX_DATA_END, PINMUX_INPUT_BEGIN, PORT_ALL(IN), PINMUX_INPUT_END, <API key>, PORT_ALL(IN_PU), <API key>, <API key>, PORT_ALL(IN_PD), <API key>, PINMUX_OUTPUT_BEGIN, PORT_ALL(OUT), PINMUX_OUTPUT_END, <API key>, PORT_ALL(FN_IN), PORT_ALL(FN_OUT), PORT_ALL(FN0), PORT_ALL(FN1), PORT_ALL(FN2), PORT_ALL(FN3), PORT_ALL(FN4), PORT_ALL(FN5), PORT_ALL(FN6), PORT_ALL(FN7), MSEL2CR_MSEL19_0, MSEL2CR_MSEL19_1, MSEL2CR_MSEL18_0, MSEL2CR_MSEL18_1, MSEL2CR_MSEL17_0, MSEL2CR_MSEL17_1, MSEL2CR_MSEL16_0, MSEL2CR_MSEL16_1, MSEL2CR_MSEL14_0, MSEL2CR_MSEL14_1, MSEL2CR_MSEL13_0, MSEL2CR_MSEL13_1, MSEL2CR_MSEL12_0, MSEL2CR_MSEL12_1, MSEL2CR_MSEL11_0, MSEL2CR_MSEL11_1, MSEL2CR_MSEL10_0, MSEL2CR_MSEL10_1, MSEL2CR_MSEL9_0, MSEL2CR_MSEL9_1, MSEL2CR_MSEL8_0, MSEL2CR_MSEL8_1, MSEL2CR_MSEL7_0, MSEL2CR_MSEL7_1, MSEL2CR_MSEL6_0, MSEL2CR_MSEL6_1, MSEL2CR_MSEL4_0, MSEL2CR_MSEL4_1, MSEL2CR_MSEL5_0, MSEL2CR_MSEL5_1, MSEL2CR_MSEL3_0, MSEL2CR_MSEL3_1, MSEL2CR_MSEL2_0, MSEL2CR_MSEL2_1, MSEL2CR_MSEL1_0, MSEL2CR_MSEL1_1, MSEL2CR_MSEL0_0, MSEL2CR_MSEL0_1, MSEL3CR_MSEL28_0, MSEL3CR_MSEL28_1, MSEL3CR_MSEL15_0, MSEL3CR_MSEL15_1, MSEL3CR_MSEL11_0, MSEL3CR_MSEL11_1, MSEL3CR_MSEL9_0, MSEL3CR_MSEL9_1, MSEL3CR_MSEL6_0, MSEL3CR_MSEL6_1, MSEL3CR_MSEL2_0, MSEL3CR_MSEL2_1, MSEL4CR_MSEL29_0, MSEL4CR_MSEL29_1, MSEL4CR_MSEL27_0, MSEL4CR_MSEL27_1, MSEL4CR_MSEL26_0, MSEL4CR_MSEL26_1, MSEL4CR_MSEL22_0, MSEL4CR_MSEL22_1, MSEL4CR_MSEL21_0, MSEL4CR_MSEL21_1, MSEL4CR_MSEL20_0, MSEL4CR_MSEL20_1, MSEL4CR_MSEL19_0, MSEL4CR_MSEL19_1, MSEL4CR_MSEL15_0, MSEL4CR_MSEL15_1, MSEL4CR_MSEL13_0, MSEL4CR_MSEL13_1, MSEL4CR_MSEL12_0, MSEL4CR_MSEL12_1, MSEL4CR_MSEL11_0, MSEL4CR_MSEL11_1, MSEL4CR_MSEL10_0, MSEL4CR_MSEL10_1, MSEL4CR_MSEL9_0, MSEL4CR_MSEL9_1, MSEL4CR_MSEL8_0, MSEL4CR_MSEL8_1, MSEL4CR_MSEL7_0, MSEL4CR_MSEL7_1, MSEL4CR_MSEL4_0, MSEL4CR_MSEL4_1, MSEL4CR_MSEL1_0, MSEL4CR_MSEL1_1, PINMUX_FUNCTION_END, PINMUX_MARK_BEGIN, VBUS_0_MARK, GPI0_MARK, GPI1_MARK, GPI2_MARK, GPI3_MARK, GPI4_MARK, GPI5_MARK, GPI6_MARK, GPI7_MARK, SCIFA7_RXD_MARK, SCIFA7_CTS__MARK, GPO7_MARK, MFG0_OUT2_MARK, GPO6_MARK, MFG1_OUT2_MARK, GPO5_MARK, SCIFA0_SCK_MARK, FSICOSLDT3_MARK, <API key>, SCIFA0_TXD_MARK, SCIFA7_TXD_MARK, SCIFA7_RTS__MARK, <API key>, GPO0_MARK, GPO1_MARK, GPO2_MARK, STATUS0_MARK, GPO3_MARK, STATUS1_MARK, GPO4_MARK, STATUS2_MARK, VINT_MARK, TCKON_MARK, XDVFS1_MARK, <API key>, <API key>, \ MFG0_OUT1_MARK, PORT27_IROUT_MARK, XDVFS2_MARK, <API key>, <API key>, \ PORT28_TPU1TO1_MARK, SIM_RST_MARK, PORT29_TPU1TO1_MARK, SIM_CLK_MARK, <API key>, SIM_D_MARK, PORT31_IROUT_MARK, SCIFA4_TXD_MARK, SCIFA4_RXD_MARK, XWUP_MARK, SCIFA4_RTS__MARK, SCIFA4_CTS__MARK, FSIBOBT_MARK, FSIBIBT_MARK, FSIBOLR_MARK, FSIBILR_MARK, FSIBOSLD_MARK, FSIBISLD_MARK, VACK_MARK, XTAL1L_MARK, SCIFA0_RTS__MARK, FSICOSLDT2_MARK, SCIFA0_RXD_MARK, SCIFA0_CTS__MARK, FSICOSLDT1_MARK, FSICOBT_MARK, FSICIBT_MARK, FSIDOBT_MARK, FSIDIBT_MARK, FSICOLR_MARK, FSICILR_MARK, FSIDOLR_MARK, FSIDILR_MARK, FSICOSLD_MARK, <API key>, FSICISLD_MARK, FSIDISLD_MARK, FSIACK_MARK, <API key>, PORT49_IROUT_MARK, FSIAOMC_MARK, FSIAOLR_MARK, BBIF2_TSYNC2_MARK, TPU2TO2_MARK, FSIAILR_MARK, FSIAOBT_MARK, BBIF2_TSCK2_MARK, TPU2TO3_MARK, FSIAIBT_MARK, FSIAOSLD_MARK, BBIF2_TXD2_MARK, FSIASPDIF_MARK, PORT53_IRDA_IN_MARK, TPU3TO3_MARK, FSIBSPDIF_MARK, \ <API key>, FSIBCK_MARK, <API key>, TPU3TO2_MARK, FSIBOMC_MARK, \ FSICCK_MARK, FSICOMC_MARK, FSIAISLD_MARK, TPU0TO0_MARK, A0_MARK, BS__MARK, A12_MARK, PORT58_KEYOUT7_MARK, TPU4TO2_MARK, A13_MARK, PORT59_KEYOUT6_MARK, TPU0TO1_MARK, A14_MARK, KEYOUT5_MARK, A15_MARK, KEYOUT4_MARK, A16_MARK, KEYOUT3_MARK, MSIOF0_SS1_MARK, A17_MARK, KEYOUT2_MARK, MSIOF0_TSYNC_MARK, A18_MARK, KEYOUT1_MARK, MSIOF0_TSCK_MARK, A19_MARK, KEYOUT0_MARK, MSIOF0_TXD_MARK, A20_MARK, KEYIN0_MARK, MSIOF0_RSCK_MARK, A21_MARK, KEYIN1_MARK, MSIOF0_RSYNC_MARK, A22_MARK, KEYIN2_MARK, MSIOF0_MCK0_MARK, A23_MARK, KEYIN3_MARK, MSIOF0_MCK1_MARK, A24_MARK, KEYIN4_MARK, MSIOF0_RXD_MARK, A25_MARK, KEYIN5_MARK, MSIOF0_SS2_MARK, A26_MARK, KEYIN6_MARK, KEYIN7_MARK, D0_NAF0_MARK, D1_NAF1_MARK, D2_NAF2_MARK, D3_NAF3_MARK, D4_NAF4_MARK, D5_NAF5_MARK, D6_NAF6_MARK, D7_NAF7_MARK, D8_NAF8_MARK, D9_NAF9_MARK, D10_NAF10_MARK, D11_NAF11_MARK, D12_NAF12_MARK, D13_NAF13_MARK, D14_NAF14_MARK, D15_NAF15_MARK, CS4__MARK, CS5A__MARK, PORT91_RDWR_MARK, CS5B__MARK, FCE1__MARK, CS6B__MARK, DACK0_MARK, FCE0__MARK, CS6A__MARK, WAIT__MARK, DREQ0_MARK, RD__FSC_MARK, WE0__FWE_MARK, RDWR_FWE_MARK, WE1__MARK, FRB_MARK, CKO_MARK, NBRSTOUT__MARK, NBRST__MARK, BBIF2_TXD_MARK, BBIF2_RXD_MARK, BBIF2_SYNC_MARK, BBIF2_SCK_MARK, SCIFA3_CTS__MARK, MFG3_IN2_MARK, SCIFA3_RXD_MARK, MFG3_IN1_MARK, BBIF1_SS2_MARK, SCIFA3_RTS__MARK, MFG3_OUT1_MARK, SCIFA3_TXD_MARK, HSI_RX_DATA_MARK, BBIF1_RXD_MARK, HSI_TX_WAKE_MARK, BBIF1_TSCK_MARK, HSI_TX_DATA_MARK, BBIF1_TSYNC_MARK, HSI_TX_READY_MARK, BBIF1_TXD_MARK, HSI_RX_READY_MARK, BBIF1_RSCK_MARK, <API key>, \ <API key>, HSI_RX_WAKE_MARK, BBIF1_RSYNC_MARK, <API key>, \ <API key>, HSI_RX_FLAG_MARK, BBIF1_SS1_MARK, BBIF1_FLOW_MARK, HSI_TX_FLAG_MARK, VIO_VD_MARK, <API key>, VIO2_VD_MARK, LCD2D0_MARK, VIO_HD_MARK, <API key>, <API key>, \ VIO2_HD_MARK, LCD2D1_MARK, VIO_D0_MARK, <API key>, LCD2D10_MARK, VIO_D1_MARK, <API key>, <API key>, \ <API key>, LCD2D11_MARK, VIO_D2_MARK, <API key>, <API key>, \ <API key>, LCD2D12_MARK, VIO_D3_MARK, MSIOF2_TSYNC_MARK, LCD2D13_MARK, VIO_D4_MARK, MSIOF2_TXD_MARK, LCD2D14_MARK, VIO_D5_MARK, MSIOF2_TSCK_MARK, LCD2D15_MARK, VIO_D6_MARK, <API key>, LCD2D16_MARK, VIO_D7_MARK, <API key>, LCD2D17_MARK, VIO_D8_MARK, <API key>, VIO2_D0_MARK, LCD2D6_MARK, VIO_D9_MARK, <API key>, VIO2_D1_MARK, LCD2D7_MARK, VIO_D10_MARK, TPU0TO2_MARK, VIO2_D2_MARK, LCD2D8_MARK, VIO_D11_MARK, TPU0TO3_MARK, VIO2_D3_MARK, LCD2D9_MARK, VIO_D12_MARK, <API key>, VIO2_D4_MARK, LCD2D2_MARK, VIO_D13_MARK, <API key>, <API key>, \ VIO2_D5_MARK, LCD2D3_MARK, VIO_D14_MARK, <API key>, VIO2_D6_MARK, LCD2D4_MARK, VIO_D15_MARK, TPU1TO3_MARK, <API key>, \ PORT145_LCD2RS_MARK, VIO2_D7_MARK, LCD2D5_MARK, VIO_CLK_MARK, LCD2DCK_MARK, <API key>, VIO2_CLK_MARK, \ LCD2D18_MARK, VIO_FIELD_MARK, LCD2RD__MARK, VIO2_FIELD_MARK, LCD2D19_MARK, VIO_CKO_MARK, A27_MARK, PORT149_RDWR_MARK, MFG0_IN1_MARK, <API key>, MFG0_IN2_MARK, TS_SPSYNC3_MARK, MSIOF2_RSCK_MARK, TS_SDAT3_MARK, MSIOF2_RSYNC_MARK, TPU1TO2_MARK, TS_SDEN3_MARK, <API key>, SCIFA2_TXD1_MARK, MSIOF2_MCK0_MARK, SCIFA2_RXD1_MARK, MSIOF2_MCK1_MARK, SCIFA2_RTS1__MARK, <API key>, SCIFA2_CTS1__MARK, <API key>, DINT__MARK, SCIFA2_SCK1_MARK, TS_SCK3_MARK, <API key>, <API key>, NMI_MARK, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, TPU3TO0_MARK, LCDD0_MARK, LCDD1_MARK, <API key>, BBIF2_TSYNC1_MARK, LCDD2_MARK, <API key>, BBIF2_TSCK1_MARK, LCDD3_MARK, <API key>, BBIF2_TXD1_MARK, LCDD4_MARK, <API key>, LCDD5_MARK, <API key>, MFG2_OUT2_MARK, TPU2TO1_MARK, LCDD6_MARK, LCDD7_MARK, TPU4TO1_MARK, MFG4_OUT2_MARK, LCDD8_MARK, D16_MARK, LCDD9_MARK, D17_MARK, LCDD10_MARK, D18_MARK, LCDD11_MARK, D19_MARK, LCDD12_MARK, D20_MARK, LCDD13_MARK, D21_MARK, LCDD14_MARK, D22_MARK, LCDD15_MARK, <API key>, D23_MARK, LCDD16_MARK, <API key>, D24_MARK, LCDD17_MARK, D25_MARK, LCDD18_MARK, DREQ2_MARK, <API key>, D26_MARK, LCDD19_MARK, <API key>, D27_MARK, LCDD20_MARK, TS_SPSYNC1_MARK, MSIOF0L_MCK0_MARK, D28_MARK, LCDD21_MARK, TS_SDAT1_MARK, MSIOF0L_MCK1_MARK, D29_MARK, LCDD22_MARK, TS_SDEN1_MARK, MSIOF0L_RSCK_MARK, D30_MARK, LCDD23_MARK, TS_SCK1_MARK, MSIOF0L_RSYNC_MARK, D31_MARK, LCDDCK_MARK, LCDWR__MARK, LCDRD__MARK, DACK2_MARK, PORT217_LCD2RS_MARK, MSIOF0L_TSYNC_MARK, \ VIO2_FIELD3_MARK, <API key>, LCDHSYN_MARK, LCDCS__MARK, LCDCS2__MARK, DACK3_MARK, \ <API key>, LCDDISP_MARK, LCDRS_MARK, <API key>, DREQ3_MARK, \ MSIOF0L_TSCK_MARK, VIO2_CLK3_MARK, LCD2DCK_2_MARK, LCDVSYN_MARK, LCDVSYN2_MARK, LCDLCLK_MARK, DREQ1_MARK, <API key>, PWEN_MARK, \ MSIOF0L_RXD_MARK, VIO2_HD3_MARK, <API key>, LCDDON_MARK, LCDDON2_MARK, DACK1_MARK, OVCN_MARK, MSIOF0L_TXD_MARK, \ VIO2_VD3_MARK, <API key>, SCIFA1_TXD_MARK, OVCN2_MARK, EXTLP_MARK, SCIFA1_SCK_MARK, <API key>, SCIFA1_RTS__MARK, IDIN_MARK, SCIFA1_RXD_MARK, SCIFA1_CTS__MARK, MFG1_IN1_MARK, MSIOF1_TXD_MARK, SCIFA2_TXD2_MARK, MSIOF1_TSYNC_MARK, SCIFA2_CTS2__MARK, MSIOF1_TSCK_MARK, SCIFA2_SCK2_MARK, MSIOF1_RXD_MARK, SCIFA2_RXD2_MARK, MSIOF1_RSCK_MARK, SCIFA2_RTS2__MARK, VIO2_CLK2_MARK, LCD2D20_MARK, MSIOF1_RSYNC_MARK, MFG1_IN2_MARK, VIO2_VD2_MARK, LCD2D21_MARK, MSIOF1_MCK0_MARK, <API key>, MSIOF1_MCK1_MARK, <API key>, MSIOF1_SS1_MARK, VIO2_FIELD2_MARK, LCD2D22_MARK, MSIOF1_SS2_MARK, VIO2_HD2_MARK, LCD2D23_MARK, SCIFA6_TXD_MARK, <API key>, PORT241_IROUT_MARK, MFG4_OUT1_MARK, TPU4TO0_MARK, <API key>, MFG4_IN2_MARK, <API key>, <API key>, <API key>, MFG2_IN1_MARK, <API key>, \ MSIOF2R_RXD_MARK, <API key>, MFG2_IN2_MARK, <API key>, \ MSIOF2R_TXD_MARK, <API key>, MFG1_OUT1_MARK, <API key>, \ TPU1TO0_MARK, <API key>, MFG3_OUT2_MARK, <API key>, \ TPU3TO1_MARK, <API key>, MFG2_OUT1_MARK, <API key>, \ TPU2TO0_MARK, <API key>, MSIOF2R_TSCK_MARK, PORT249_IROUT_MARK, MFG4_IN1_MARK, <API key>, \ MSIOF2R_TSYNC_MARK, SDHICLK0_MARK, SDHICD0_MARK, SDHID0_0_MARK, SDHID0_1_MARK, SDHID0_2_MARK, SDHID0_3_MARK, SDHICMD0_MARK, SDHIWP0_MARK, SDHICLK1_MARK, SDHID1_0_MARK, TS_SPSYNC2_MARK, SDHID1_1_MARK, TS_SDAT2_MARK, SDHID1_2_MARK, TS_SDEN2_MARK, SDHID1_3_MARK, TS_SCK2_MARK, SDHICMD1_MARK, SDHICLK2_MARK, SDHID2_0_MARK, TS_SPSYNC4_MARK, SDHID2_1_MARK, TS_SDAT4_MARK, SDHID2_2_MARK, TS_SDEN4_MARK, SDHID2_3_MARK, TS_SCK4_MARK, SDHICMD2_MARK, MMCCLK0_MARK, MMCD0_0_MARK, MMCD0_1_MARK, MMCD0_2_MARK, MMCD0_3_MARK, MMCD0_4_MARK, TS_SPSYNC5_MARK, MMCD0_5_MARK, TS_SDAT5_MARK, MMCD0_6_MARK, TS_SDEN5_MARK, MMCD0_7_MARK, TS_SCK5_MARK, MMCCMD0_MARK, RESETOUTS__MARK, EXTAL2OUT_MARK, <API key>, MCP_CKO_MARK, MMCCLK1_MARK, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, MMCCMD1_MARK, <API key>, MMCD1_7_MARK, <API key>, MMCD1_6_MARK, <API key>, MMCD1_5_MARK, <API key>, MMCD1_4_MARK, <API key>, MMCD1_3_MARK, <API key>, MMCD1_2_MARK, <API key>, MMCD1_1_MARK, <API key>, MMCD1_0_MARK, MCP_NBRSTOUT__MARK, <API key>, <API key>, TSIF2_TS_XX1_MARK, TSIF2_TS_XX2_MARK, TSIF2_TS_XX3_MARK, TSIF2_TS_XX4_MARK, TSIF2_TS_XX5_MARK, TSIF1_TS_XX1_MARK, TSIF1_TS_XX2_MARK, TSIF1_TS_XX3_MARK, TSIF1_TS_XX4_MARK, TSIF1_TS_XX5_MARK, TSIF0_TS_XX1_MARK, TSIF0_TS_XX2_MARK, TSIF0_TS_XX3_MARK, TSIF0_TS_XX4_MARK, TSIF0_TS_XX5_MARK, MST1_TS_XX1_MARK, MST1_TS_XX2_MARK, MST1_TS_XX3_MARK, MST1_TS_XX4_MARK, MST1_TS_XX5_MARK, MST0_TS_XX1_MARK, MST0_TS_XX2_MARK, MST0_TS_XX3_MARK, MST0_TS_XX4_MARK, MST0_TS_XX5_MARK, <API key>, <API key>, DEBUG_MON_VIO_MARK, DEBUG_MON_LCDD_MARK, LCDC_LCDC0_MARK, LCDC_LCDC1_MARK, IRQ9_MEM_INT_MARK, IRQ9_MCP_INT_MARK, A11_MARK, KEYOUT8_MARK, TPU4TO3_MARK, RESETA_N_PU_ON_MARK, <API key>, EDBGREQ_PD_MARK, EDBGREQ_PU_MARK, KEYIN0_PU_MARK, KEYIN1_PU_MARK, KEYIN2_PU_MARK, KEYIN3_PU_MARK, KEYIN4_PU_MARK, KEYIN5_PU_MARK, KEYIN6_PU_MARK, KEYIN7_PU_MARK, SDHICD0_PU_MARK, SDHID0_0_PU_MARK, SDHID0_1_PU_MARK, SDHID0_2_PU_MARK, SDHID0_3_PU_MARK, SDHICMD0_PU_MARK, SDHIWP0_PU_MARK, SDHID1_0_PU_MARK, SDHID1_1_PU_MARK, SDHID1_2_PU_MARK, SDHID1_3_PU_MARK, SDHICMD1_PU_MARK, SDHID2_0_PU_MARK, SDHID2_1_PU_MARK, SDHID2_2_PU_MARK, SDHID2_3_PU_MARK, SDHICMD2_PU_MARK, MMCCMD0_PU_MARK, MMCCMD1_PU_MARK, MMCD0_0_PU_MARK, MMCD0_1_PU_MARK, MMCD0_2_PU_MARK, MMCD0_3_PU_MARK, MMCD0_4_PU_MARK, MMCD0_5_PU_MARK, MMCD0_6_PU_MARK, MMCD0_7_PU_MARK, FSIBISLD_PU_MARK, FSIACK_PU_MARK, FSIAILR_PU_MARK, FSIAIBT_PU_MARK, FSIAISLD_PU_MARK, PINMUX_MARK_END, }; static pinmux_enum_t pinmux_data[] = { PORT_DATA_I_PD(0), PORT_DATA_I_PU(1), PORT_DATA_I_PU(2), PORT_DATA_I_PU(3), PORT_DATA_I_PU(4), PORT_DATA_I_PU(5), PORT_DATA_I_PU(6), PORT_DATA_I_PU(7), PORT_DATA_I_PU(8), PORT_DATA_I_PD(9), PORT_DATA_I_PD(10), PORT_DATA_I_PU_PD(11), PORT_DATA_IO_PU_PD(12), PORT_DATA_IO_PU_PD(13), PORT_DATA_IO_PU_PD(14), PORT_DATA_IO_PU_PD(15), PORT_DATA_IO_PD(16), PORT_DATA_IO_PD(17), PORT_DATA_IO_PU(18), PORT_DATA_IO_PU(19), PORT_DATA_O(20), PORT_DATA_O(21), PORT_DATA_O(22), PORT_DATA_O(23), PORT_DATA_O(24), PORT_DATA_I_PD(25), PORT_DATA_I_PD(26), PORT_DATA_IO_PU(27), PORT_DATA_IO_PU(28), PORT_DATA_IO_PD(29), PORT_DATA_IO_PD(30), PORT_DATA_IO_PU(31), PORT_DATA_IO_PD(32), PORT_DATA_I_PU_PD(33), PORT_DATA_IO_PD(34), PORT_DATA_I_PU_PD(35), PORT_DATA_IO_PD(36), PORT_DATA_IO(37), PORT_DATA_O(38), PORT_DATA_I_PU(39), PORT_DATA_I_PU_PD(40), PORT_DATA_O(41), PORT_DATA_IO_PD(42), PORT_DATA_IO_PU_PD(43), PORT_DATA_IO_PU_PD(44), PORT_DATA_IO_PD(45), PORT_DATA_IO_PD(46), PORT_DATA_IO_PD(47), PORT_DATA_I_PD(48), PORT_DATA_IO_PU_PD(49), PORT_DATA_IO_PD(50), PORT_DATA_IO_PD(51), PORT_DATA_O(52), PORT_DATA_IO_PU_PD(53), PORT_DATA_IO_PU_PD(54), PORT_DATA_IO_PD(55), PORT_DATA_I_PU_PD(56), PORT_DATA_IO(57), PORT_DATA_IO(58), PORT_DATA_IO(59), PORT_DATA_IO(60), PORT_DATA_IO(61), PORT_DATA_IO_PD(62), PORT_DATA_IO_PD(63), PORT_DATA_IO_PU_PD(64), PORT_DATA_IO_PD(65), PORT_DATA_IO_PU_PD(66), PORT_DATA_IO_PU_PD(67), PORT_DATA_IO_PU_PD(68), PORT_DATA_IO_PU_PD(69), PORT_DATA_IO_PU_PD(70), PORT_DATA_IO_PU_PD(71), PORT_DATA_IO_PU_PD(72), PORT_DATA_I_PU_PD(73), PORT_DATA_IO_PU(74), PORT_DATA_IO_PU(75), PORT_DATA_IO_PU(76), PORT_DATA_IO_PU(77), PORT_DATA_IO_PU(78), PORT_DATA_IO_PU(79), PORT_DATA_IO_PU(80), PORT_DATA_IO_PU(81), PORT_DATA_IO_PU(82), PORT_DATA_IO_PU(83), PORT_DATA_IO_PU(84), PORT_DATA_IO_PU(85), PORT_DATA_IO_PU(86), PORT_DATA_IO_PU(87), PORT_DATA_IO_PU(88), PORT_DATA_IO_PU(89), PORT_DATA_O(90), PORT_DATA_IO_PU(91), PORT_DATA_O(92), PORT_DATA_IO_PU(93), PORT_DATA_O(94), PORT_DATA_I_PU_PD(95), PORT_DATA_IO(96), PORT_DATA_IO(97), PORT_DATA_IO(98), PORT_DATA_I_PU(99), PORT_DATA_O(100), PORT_DATA_O(101), PORT_DATA_I_PU(102), PORT_DATA_IO_PD(103), PORT_DATA_I_PU_PD(104), PORT_DATA_I_PD(105), PORT_DATA_I_PD(106), PORT_DATA_I_PU_PD(107), PORT_DATA_I_PU_PD(108), PORT_DATA_IO_PD(109), PORT_DATA_IO_PD(110), PORT_DATA_IO_PU_PD(111), PORT_DATA_IO_PU_PD(112), PORT_DATA_IO_PU_PD(113), PORT_DATA_IO_PD(114), PORT_DATA_IO_PU(115), PORT_DATA_IO_PU(116), PORT_DATA_IO_PU_PD(117), PORT_DATA_IO_PU_PD(118), PORT_DATA_IO_PD(128), PORT_DATA_IO_PD(129), PORT_DATA_IO_PU_PD(130), PORT_DATA_IO_PD(131), PORT_DATA_IO_PD(132), PORT_DATA_IO_PD(133), PORT_DATA_IO_PU_PD(134), PORT_DATA_IO_PU_PD(135), PORT_DATA_IO_PU_PD(136), PORT_DATA_IO_PU_PD(137), PORT_DATA_IO_PD(138), PORT_DATA_IO_PD(139), PORT_DATA_IO_PD(140), PORT_DATA_IO_PD(141), PORT_DATA_IO_PD(142), PORT_DATA_IO_PD(143), PORT_DATA_IO_PU_PD(144), PORT_DATA_IO_PD(145), PORT_DATA_IO_PU_PD(146), PORT_DATA_IO_PU_PD(147), PORT_DATA_IO_PU_PD(148), PORT_DATA_IO_PU_PD(149), PORT_DATA_I_PU_PD(150), PORT_DATA_IO_PU_PD(151), PORT_DATA_IO_PU_PD(152), PORT_DATA_IO_PD(153), PORT_DATA_IO_PD(154), PORT_DATA_I_PU_PD(155), PORT_DATA_IO_PU_PD(156), PORT_DATA_I_PD(157), PORT_DATA_IO_PD(158), PORT_DATA_IO_PU_PD(159), PORT_DATA_IO_PU_PD(160), PORT_DATA_I_PU_PD(161), PORT_DATA_I_PU_PD(162), PORT_DATA_IO_PU_PD(163), PORT_DATA_I_PU_PD(164), PORT_DATA_IO_PD(192), PORT_DATA_IO_PU_PD(193), PORT_DATA_IO_PD(194), PORT_DATA_IO_PU_PD(195), PORT_DATA_IO_PD(196), PORT_DATA_IO_PD(197), PORT_DATA_IO_PD(198), PORT_DATA_IO_PD(199), PORT_DATA_IO_PU_PD(200), PORT_DATA_IO_PU_PD(201), PORT_DATA_IO_PU_PD(202), PORT_DATA_IO_PU_PD(203), PORT_DATA_IO_PU_PD(204), PORT_DATA_IO_PU_PD(205), PORT_DATA_IO_PU_PD(206), PORT_DATA_IO_PD(207), PORT_DATA_IO_PD(208), PORT_DATA_IO_PD(209), PORT_DATA_IO_PD(210), PORT_DATA_IO_PD(211), PORT_DATA_IO_PD(212), PORT_DATA_IO_PD(213), PORT_DATA_IO_PU_PD(214), PORT_DATA_IO_PU_PD(215), PORT_DATA_IO_PD(216), PORT_DATA_IO_PD(217), PORT_DATA_O(218), PORT_DATA_IO_PD(219), PORT_DATA_IO_PD(220), PORT_DATA_IO_PU_PD(221), PORT_DATA_IO_PU_PD(222), PORT_DATA_I_PU_PD(223), PORT_DATA_I_PU_PD(224), PORT_DATA_IO_PU_PD(225), PORT_DATA_O(226), PORT_DATA_IO_PU_PD(227), PORT_DATA_I_PU_PD(228), PORT_DATA_I_PD(229), PORT_DATA_IO(230), PORT_DATA_IO_PU_PD(231), PORT_DATA_IO_PU_PD(232), PORT_DATA_I_PU_PD(233), PORT_DATA_IO_PU_PD(234), PORT_DATA_IO_PU_PD(235), PORT_DATA_IO_PU_PD(236), PORT_DATA_IO_PD(237), PORT_DATA_IO_PU_PD(238), PORT_DATA_IO_PU_PD(239), PORT_DATA_IO_PU_PD(240), PORT_DATA_O(241), PORT_DATA_I_PD(242), PORT_DATA_IO_PU_PD(243), PORT_DATA_IO_PU_PD(244), PORT_DATA_IO_PU_PD(245), PORT_DATA_IO_PU_PD(246), PORT_DATA_IO_PU_PD(247), PORT_DATA_IO_PU_PD(248), PORT_DATA_IO_PU_PD(249), PORT_DATA_IO_PU_PD(250), PORT_DATA_IO_PU_PD(251), PORT_DATA_IO_PU_PD(252), PORT_DATA_IO_PU_PD(253), PORT_DATA_IO_PU_PD(254), PORT_DATA_IO_PU_PD(255), PORT_DATA_IO_PU_PD(256), PORT_DATA_IO_PU_PD(257), PORT_DATA_IO_PU_PD(258), PORT_DATA_IO_PU_PD(259), PORT_DATA_IO_PU_PD(260), PORT_DATA_IO_PU_PD(261), PORT_DATA_IO_PU_PD(262), PORT_DATA_IO_PU_PD(263), PORT_DATA_IO_PU_PD(264), PORT_DATA_IO_PU_PD(265), PORT_DATA_IO_PU_PD(266), PORT_DATA_IO_PU_PD(267), PORT_DATA_IO_PU_PD(268), PORT_DATA_IO_PU_PD(269), PORT_DATA_IO_PU_PD(270), PORT_DATA_IO_PU_PD(271), PORT_DATA_IO_PU_PD(272), PORT_DATA_IO_PU_PD(273), PORT_DATA_IO_PU_PD(274), PORT_DATA_IO_PU_PD(275), PORT_DATA_IO_PU_PD(276), PORT_DATA_IO_PU_PD(277), PORT_DATA_IO_PU_PD(278), PORT_DATA_IO_PU_PD(279), PORT_DATA_IO_PU_PD(280), PORT_DATA_O(281), PORT_DATA_O(282), PORT_DATA_I_PU(288), PORT_DATA_IO_PU_PD(289), PORT_DATA_IO_PU_PD(290), PORT_DATA_IO_PU_PD(291), PORT_DATA_IO_PU_PD(292), PORT_DATA_IO_PU_PD(293), PORT_DATA_IO_PU_PD(294), PORT_DATA_IO_PU_PD(295), PORT_DATA_IO_PU_PD(296), PORT_DATA_IO_PU_PD(297), PORT_DATA_IO_PU_PD(298), PORT_DATA_IO_PU_PD(299), PORT_DATA_IO_PU_PD(300), PORT_DATA_IO_PU_PD(301), PORT_DATA_IO_PU_PD(302), PORT_DATA_IO_PU_PD(303), PORT_DATA_IO_PU_PD(304), PORT_DATA_IO_PU_PD(305), PORT_DATA_O(306), PORT_DATA_O(307), PORT_DATA_I_PU(308), PORT_DATA_O(309), PINMUX_DATA(VBUS_0_MARK, PORT0_FN1), PINMUX_DATA(GPI0_MARK, PORT1_FN1), PINMUX_DATA(GPI1_MARK, PORT2_FN1), PINMUX_DATA(GPI2_MARK, PORT3_FN1), PINMUX_DATA(GPI3_MARK, PORT4_FN1), PINMUX_DATA(GPI4_MARK, PORT5_FN1), PINMUX_DATA(GPI5_MARK, PORT6_FN1), PINMUX_DATA(GPI6_MARK, PORT7_FN1), PINMUX_DATA(GPI7_MARK, PORT8_FN1), PINMUX_DATA(SCIFA7_RXD_MARK, PORT12_FN2), PINMUX_DATA(SCIFA7_CTS__MARK, PORT13_FN2), PINMUX_DATA(GPO7_MARK, PORT14_FN1), \ PINMUX_DATA(MFG0_OUT2_MARK, PORT14_FN4), PINMUX_DATA(GPO6_MARK, PORT15_FN1), \ PINMUX_DATA(MFG1_OUT2_MARK, PORT15_FN4), PINMUX_DATA(GPO5_MARK, PORT16_FN1), \ PINMUX_DATA(SCIFA0_SCK_MARK, PORT16_FN2), \ PINMUX_DATA(FSICOSLDT3_MARK, PORT16_FN3), \ PINMUX_DATA(<API key>, PORT16_FN4), PINMUX_DATA(SCIFA0_TXD_MARK, PORT17_FN2), PINMUX_DATA(SCIFA7_TXD_MARK, PORT18_FN2), PINMUX_DATA(SCIFA7_RTS__MARK, PORT19_FN2), \ PINMUX_DATA(<API key>, PORT19_FN3), PINMUX_DATA(GPO0_MARK, PORT20_FN1), PINMUX_DATA(GPO1_MARK, PORT21_FN1), PINMUX_DATA(GPO2_MARK, PORT22_FN1), \ PINMUX_DATA(STATUS0_MARK, PORT22_FN2), PINMUX_DATA(GPO3_MARK, PORT23_FN1), \ PINMUX_DATA(STATUS1_MARK, PORT23_FN2), PINMUX_DATA(GPO4_MARK, PORT24_FN1), \ PINMUX_DATA(STATUS2_MARK, PORT24_FN2), PINMUX_DATA(VINT_MARK, PORT25_FN1), PINMUX_DATA(TCKON_MARK, PORT26_FN1), PINMUX_DATA(XDVFS1_MARK, PORT27_FN1), \ PINMUX_DATA(<API key>, PORT27_FN2, MSEL2CR_MSEL17_0, MSEL2CR_MSEL16_1), \ PINMUX_DATA(<API key>, PORT27_FN3, MSEL2CR_MSEL19_0, MSEL2CR_MSEL18_0), \ PINMUX_DATA(MFG0_OUT1_MARK, PORT27_FN4), \ PINMUX_DATA(PORT27_IROUT_MARK, PORT27_FN7), PINMUX_DATA(XDVFS2_MARK, PORT28_FN1), \ PINMUX_DATA(<API key>, PORT28_FN2, MSEL2CR_MSEL17_0, MSEL2CR_MSEL16_1), \ PINMUX_DATA(<API key>, PORT28_FN3, MSEL2CR_MSEL19_0, MSEL2CR_MSEL18_0), \ PINMUX_DATA(PORT28_TPU1TO1_MARK, PORT28_FN7), PINMUX_DATA(SIM_RST_MARK, PORT29_FN1), \ PINMUX_DATA(PORT29_TPU1TO1_MARK, PORT29_FN4), PINMUX_DATA(SIM_CLK_MARK, PORT30_FN1), \ PINMUX_DATA(<API key>, PORT30_FN4), PINMUX_DATA(SIM_D_MARK, PORT31_FN1), \ PINMUX_DATA(PORT31_IROUT_MARK, PORT31_FN4), PINMUX_DATA(SCIFA4_TXD_MARK, PORT32_FN2), PINMUX_DATA(SCIFA4_RXD_MARK, PORT33_FN2), \ PINMUX_DATA(XWUP_MARK, PORT33_FN3), PINMUX_DATA(SCIFA4_RTS__MARK, PORT34_FN2), PINMUX_DATA(SCIFA4_CTS__MARK, PORT35_FN2), PINMUX_DATA(FSIBOBT_MARK, PORT36_FN1), \ PINMUX_DATA(FSIBIBT_MARK, PORT36_FN2), PINMUX_DATA(FSIBOLR_MARK, PORT37_FN1), \ PINMUX_DATA(FSIBILR_MARK, PORT37_FN2), PINMUX_DATA(FSIBOSLD_MARK, PORT38_FN1), PINMUX_DATA(FSIBISLD_MARK, PORT39_FN1), PINMUX_DATA(VACK_MARK, PORT40_FN1), PINMUX_DATA(XTAL1L_MARK, PORT41_FN1), PINMUX_DATA(SCIFA0_RTS__MARK, PORT42_FN2), \ PINMUX_DATA(FSICOSLDT2_MARK, PORT42_FN3), PINMUX_DATA(SCIFA0_RXD_MARK, PORT43_FN2), PINMUX_DATA(SCIFA0_CTS__MARK, PORT44_FN2), \ PINMUX_DATA(FSICOSLDT1_MARK, PORT44_FN3), PINMUX_DATA(FSICOBT_MARK, PORT45_FN1), \ PINMUX_DATA(FSICIBT_MARK, PORT45_FN2), \ PINMUX_DATA(FSIDOBT_MARK, PORT45_FN3), \ PINMUX_DATA(FSIDIBT_MARK, PORT45_FN4), PINMUX_DATA(FSICOLR_MARK, PORT46_FN1), \ PINMUX_DATA(FSICILR_MARK, PORT46_FN2), \ PINMUX_DATA(FSIDOLR_MARK, PORT46_FN3), \ PINMUX_DATA(FSIDILR_MARK, PORT46_FN4), PINMUX_DATA(FSICOSLD_MARK, PORT47_FN1), \ PINMUX_DATA(<API key>, PORT47_FN2), PINMUX_DATA(FSICISLD_MARK, PORT48_FN1), \ PINMUX_DATA(FSIDISLD_MARK, PORT48_FN3), PINMUX_DATA(FSIACK_MARK, PORT49_FN1), \ PINMUX_DATA(<API key>, PORT49_FN2, MSEL4CR_MSEL19_1), \ PINMUX_DATA(PORT49_IROUT_MARK, PORT49_FN4), \ PINMUX_DATA(FSIAOMC_MARK, PORT49_FN5), PINMUX_DATA(FSIAOLR_MARK, PORT50_FN1), \ PINMUX_DATA(BBIF2_TSYNC2_MARK, PORT50_FN2), \ PINMUX_DATA(TPU2TO2_MARK, PORT50_FN3), \ PINMUX_DATA(FSIAILR_MARK, PORT50_FN5), PINMUX_DATA(FSIAOBT_MARK, PORT51_FN1), \ PINMUX_DATA(BBIF2_TSCK2_MARK, PORT51_FN2), \ PINMUX_DATA(TPU2TO3_MARK, PORT51_FN3), \ PINMUX_DATA(FSIAIBT_MARK, PORT51_FN5), PINMUX_DATA(FSIAOSLD_MARK, PORT52_FN1), \ PINMUX_DATA(BBIF2_TXD2_MARK, PORT52_FN2), PINMUX_DATA(FSIASPDIF_MARK, PORT53_FN1), \ PINMUX_DATA(PORT53_IRDA_IN_MARK, PORT53_FN2, MSEL4CR_MSEL19_1), \ PINMUX_DATA(TPU3TO3_MARK, PORT53_FN3), \ PINMUX_DATA(FSIBSPDIF_MARK, PORT53_FN5), \ PINMUX_DATA(<API key>, PORT53_FN6), PINMUX_DATA(FSIBCK_MARK, PORT54_FN1), \ PINMUX_DATA(<API key>, PORT54_FN2, MSEL4CR_MSEL19_1), \ PINMUX_DATA(TPU3TO2_MARK, PORT54_FN3), \ PINMUX_DATA(FSIBOMC_MARK, PORT54_FN5), \ PINMUX_DATA(FSICCK_MARK, PORT54_FN6), \ PINMUX_DATA(FSICOMC_MARK, PORT54_FN7), PINMUX_DATA(FSIAISLD_MARK, PORT55_FN1), \ PINMUX_DATA(TPU0TO0_MARK, PORT55_FN3), PINMUX_DATA(A0_MARK, PORT57_FN1), \ PINMUX_DATA(BS__MARK, PORT57_FN2), PINMUX_DATA(A12_MARK, PORT58_FN1), \ PINMUX_DATA(PORT58_KEYOUT7_MARK, PORT58_FN2), \ PINMUX_DATA(TPU4TO2_MARK, PORT58_FN4), PINMUX_DATA(A13_MARK, PORT59_FN1), \ PINMUX_DATA(PORT59_KEYOUT6_MARK, PORT59_FN2), \ PINMUX_DATA(TPU0TO1_MARK, PORT59_FN4), PINMUX_DATA(A14_MARK, PORT60_FN1), \ PINMUX_DATA(KEYOUT5_MARK, PORT60_FN2), PINMUX_DATA(A15_MARK, PORT61_FN1), \ PINMUX_DATA(KEYOUT4_MARK, PORT61_FN2), PINMUX_DATA(A16_MARK, PORT62_FN1), \ PINMUX_DATA(KEYOUT3_MARK, PORT62_FN2), \ PINMUX_DATA(MSIOF0_SS1_MARK, PORT62_FN4, MSEL3CR_MSEL11_0), PINMUX_DATA(A17_MARK, PORT63_FN1), \ PINMUX_DATA(KEYOUT2_MARK, PORT63_FN2), \ PINMUX_DATA(MSIOF0_TSYNC_MARK, PORT63_FN4, MSEL3CR_MSEL11_0), PINMUX_DATA(A18_MARK, PORT64_FN1), \ PINMUX_DATA(KEYOUT1_MARK, PORT64_FN2), \ PINMUX_DATA(MSIOF0_TSCK_MARK, PORT64_FN4, MSEL3CR_MSEL11_0), PINMUX_DATA(A19_MARK, PORT65_FN1), \ PINMUX_DATA(KEYOUT0_MARK, PORT65_FN2), \ PINMUX_DATA(MSIOF0_TXD_MARK, PORT65_FN4, MSEL3CR_MSEL11_0), PINMUX_DATA(A20_MARK, PORT66_FN1), \ PINMUX_DATA(KEYIN0_MARK, PORT66_FN2), \ PINMUX_DATA(MSIOF0_RSCK_MARK, PORT66_FN4, MSEL3CR_MSEL11_0), PINMUX_DATA(A21_MARK, PORT67_FN1), \ PINMUX_DATA(KEYIN1_MARK, PORT67_FN2), \ PINMUX_DATA(MSIOF0_RSYNC_MARK, PORT67_FN4, MSEL3CR_MSEL11_0), PINMUX_DATA(A22_MARK, PORT68_FN1), \ PINMUX_DATA(KEYIN2_MARK, PORT68_FN2), \ PINMUX_DATA(MSIOF0_MCK0_MARK, PORT68_FN4, MSEL3CR_MSEL11_0), PINMUX_DATA(A23_MARK, PORT69_FN1), \ PINMUX_DATA(KEYIN3_MARK, PORT69_FN2), \ PINMUX_DATA(MSIOF0_MCK1_MARK, PORT69_FN4, MSEL3CR_MSEL11_0), PINMUX_DATA(A24_MARK, PORT70_FN1), \ PINMUX_DATA(KEYIN4_MARK, PORT70_FN2), \ PINMUX_DATA(MSIOF0_RXD_MARK, PORT70_FN4, MSEL3CR_MSEL11_0), PINMUX_DATA(A25_MARK, PORT71_FN1), \ PINMUX_DATA(KEYIN5_MARK, PORT71_FN2), \ PINMUX_DATA(MSIOF0_SS2_MARK, PORT71_FN4, MSEL3CR_MSEL11_0), PINMUX_DATA(A26_MARK, PORT72_FN1), \ PINMUX_DATA(KEYIN6_MARK, PORT72_FN2), PINMUX_DATA(KEYIN7_MARK, PORT73_FN2), PINMUX_DATA(D0_NAF0_MARK, PORT74_FN1), PINMUX_DATA(D1_NAF1_MARK, PORT75_FN1), PINMUX_DATA(D2_NAF2_MARK, PORT76_FN1), PINMUX_DATA(D3_NAF3_MARK, PORT77_FN1), PINMUX_DATA(D4_NAF4_MARK, PORT78_FN1), PINMUX_DATA(D5_NAF5_MARK, PORT79_FN1), PINMUX_DATA(D6_NAF6_MARK, PORT80_FN1), PINMUX_DATA(D7_NAF7_MARK, PORT81_FN1), PINMUX_DATA(D8_NAF8_MARK, PORT82_FN1), PINMUX_DATA(D9_NAF9_MARK, PORT83_FN1), PINMUX_DATA(D10_NAF10_MARK, PORT84_FN1), PINMUX_DATA(D11_NAF11_MARK, PORT85_FN1), PINMUX_DATA(D12_NAF12_MARK, PORT86_FN1), PINMUX_DATA(D13_NAF13_MARK, PORT87_FN1), PINMUX_DATA(D14_NAF14_MARK, PORT88_FN1), PINMUX_DATA(D15_NAF15_MARK, PORT89_FN1), PINMUX_DATA(CS4__MARK, PORT90_FN1), PINMUX_DATA(CS5A__MARK, PORT91_FN1), \ PINMUX_DATA(PORT91_RDWR_MARK, PORT91_FN2), PINMUX_DATA(CS5B__MARK, PORT92_FN1), \ PINMUX_DATA(FCE1__MARK, PORT92_FN2), PINMUX_DATA(CS6B__MARK, PORT93_FN1), \ PINMUX_DATA(DACK0_MARK, PORT93_FN4), PINMUX_DATA(FCE0__MARK, PORT94_FN1), \ PINMUX_DATA(CS6A__MARK, PORT94_FN2), PINMUX_DATA(WAIT__MARK, PORT95_FN1), \ PINMUX_DATA(DREQ0_MARK, PORT95_FN2), PINMUX_DATA(RD__FSC_MARK, PORT96_FN1), PINMUX_DATA(WE0__FWE_MARK, PORT97_FN1), \ PINMUX_DATA(RDWR_FWE_MARK, PORT97_FN2), PINMUX_DATA(WE1__MARK, PORT98_FN1), PINMUX_DATA(FRB_MARK, PORT99_FN1), PINMUX_DATA(CKO_MARK, PORT100_FN1), PINMUX_DATA(NBRSTOUT__MARK, PORT101_FN1), PINMUX_DATA(NBRST__MARK, PORT102_FN1), PINMUX_DATA(BBIF2_TXD_MARK, PORT103_FN3), PINMUX_DATA(BBIF2_RXD_MARK, PORT104_FN3), PINMUX_DATA(BBIF2_SYNC_MARK, PORT105_FN3), PINMUX_DATA(BBIF2_SCK_MARK, PORT106_FN3), PINMUX_DATA(SCIFA3_CTS__MARK, PORT107_FN3), \ PINMUX_DATA(MFG3_IN2_MARK, PORT107_FN4), PINMUX_DATA(SCIFA3_RXD_MARK, PORT108_FN3), \ PINMUX_DATA(MFG3_IN1_MARK, PORT108_FN4), PINMUX_DATA(BBIF1_SS2_MARK, PORT109_FN2), \ PINMUX_DATA(SCIFA3_RTS__MARK, PORT109_FN3), \ PINMUX_DATA(MFG3_OUT1_MARK, PORT109_FN4), PINMUX_DATA(SCIFA3_TXD_MARK, PORT110_FN3), PINMUX_DATA(HSI_RX_DATA_MARK, PORT111_FN1), \ PINMUX_DATA(BBIF1_RXD_MARK, PORT111_FN3), PINMUX_DATA(HSI_TX_WAKE_MARK, PORT112_FN1), \ PINMUX_DATA(BBIF1_TSCK_MARK, PORT112_FN3), PINMUX_DATA(HSI_TX_DATA_MARK, PORT113_FN1), \ PINMUX_DATA(BBIF1_TSYNC_MARK, PORT113_FN3), PINMUX_DATA(HSI_TX_READY_MARK, PORT114_FN1), \ PINMUX_DATA(BBIF1_TXD_MARK, PORT114_FN3), PINMUX_DATA(HSI_RX_READY_MARK, PORT115_FN1), \ PINMUX_DATA(BBIF1_RSCK_MARK, PORT115_FN3), \ PINMUX_DATA(<API key>, PORT115_FN5, MSEL2CR_MSEL17_1), \ PINMUX_DATA(<API key>, PORT115_FN6, MSEL2CR_MSEL19_1), PINMUX_DATA(HSI_RX_WAKE_MARK, PORT116_FN1), \ PINMUX_DATA(BBIF1_RSYNC_MARK, PORT116_FN3), \ PINMUX_DATA(<API key>, PORT116_FN5, MSEL2CR_MSEL17_1), \ PINMUX_DATA(<API key>, PORT116_FN6, MSEL2CR_MSEL19_1), PINMUX_DATA(HSI_RX_FLAG_MARK, PORT117_FN1), \ PINMUX_DATA(BBIF1_SS1_MARK, PORT117_FN2), \ PINMUX_DATA(BBIF1_FLOW_MARK, PORT117_FN3), PINMUX_DATA(HSI_TX_FLAG_MARK, PORT118_FN1), PINMUX_DATA(VIO_VD_MARK, PORT128_FN1), \ PINMUX_DATA(<API key>, PORT128_FN4, MSEL3CR_MSEL2_0), \ PINMUX_DATA(VIO2_VD_MARK, PORT128_FN6, MSEL4CR_MSEL27_0), \ PINMUX_DATA(LCD2D0_MARK, PORT128_FN7), PINMUX_DATA(VIO_HD_MARK, PORT129_FN1), \ PINMUX_DATA(<API key>, PORT129_FN4), \ PINMUX_DATA(<API key>, PORT129_FN5), \ PINMUX_DATA(VIO2_HD_MARK, PORT129_FN6, MSEL4CR_MSEL27_0), \ PINMUX_DATA(LCD2D1_MARK, PORT129_FN7), PINMUX_DATA(VIO_D0_MARK, PORT130_FN1), \ PINMUX_DATA(<API key>, PORT130_FN3, MSEL4CR_MSEL11_0, MSEL4CR_MSEL10_1), \ PINMUX_DATA(LCD2D10_MARK, PORT130_FN7), PINMUX_DATA(VIO_D1_MARK, PORT131_FN1), \ PINMUX_DATA(<API key>, PORT131_FN2), \ PINMUX_DATA(<API key>, PORT131_FN3), \ PINMUX_DATA(<API key>, PORT131_FN4), \ PINMUX_DATA(LCD2D11_MARK, PORT131_FN7), PINMUX_DATA(VIO_D2_MARK, PORT132_FN1), \ PINMUX_DATA(<API key>, PORT132_FN2), \ PINMUX_DATA(<API key>, PORT132_FN3), \ PINMUX_DATA(<API key>, PORT132_FN4), \ PINMUX_DATA(LCD2D12_MARK, PORT132_FN7), PINMUX_DATA(VIO_D3_MARK, PORT133_FN1), \ PINMUX_DATA(MSIOF2_TSYNC_MARK, PORT133_FN3, MSEL4CR_MSEL11_0), \ PINMUX_DATA(LCD2D13_MARK, PORT133_FN7), PINMUX_DATA(VIO_D4_MARK, PORT134_FN1), \ PINMUX_DATA(MSIOF2_TXD_MARK, PORT134_FN3, MSEL4CR_MSEL11_0), \ PINMUX_DATA(LCD2D14_MARK, PORT134_FN7), PINMUX_DATA(VIO_D5_MARK, PORT135_FN1), \ PINMUX_DATA(MSIOF2_TSCK_MARK, PORT135_FN3, MSEL4CR_MSEL11_0), \ PINMUX_DATA(LCD2D15_MARK, PORT135_FN7), PINMUX_DATA(VIO_D6_MARK, PORT136_FN1), \ PINMUX_DATA(<API key>, PORT136_FN2), \ PINMUX_DATA(LCD2D16_MARK, PORT136_FN7), PINMUX_DATA(VIO_D7_MARK, PORT137_FN1), \ PINMUX_DATA(<API key>, PORT137_FN2), \ PINMUX_DATA(LCD2D17_MARK, PORT137_FN7), PINMUX_DATA(VIO_D8_MARK, PORT138_FN1), \ PINMUX_DATA(<API key>, PORT138_FN2), \ PINMUX_DATA(VIO2_D0_MARK, PORT138_FN6), \ PINMUX_DATA(LCD2D6_MARK, PORT138_FN7), PINMUX_DATA(VIO_D9_MARK, PORT139_FN1), \ PINMUX_DATA(<API key>, PORT139_FN2), \ PINMUX_DATA(VIO2_D1_MARK, PORT139_FN6), \ PINMUX_DATA(LCD2D7_MARK, PORT139_FN7), PINMUX_DATA(VIO_D10_MARK, PORT140_FN1), \ PINMUX_DATA(TPU0TO2_MARK, PORT140_FN4), \ PINMUX_DATA(VIO2_D2_MARK, PORT140_FN6), \ PINMUX_DATA(LCD2D8_MARK, PORT140_FN7), PINMUX_DATA(VIO_D11_MARK, PORT141_FN1), \ PINMUX_DATA(TPU0TO3_MARK, PORT141_FN4), \ PINMUX_DATA(VIO2_D3_MARK, PORT141_FN6), \ PINMUX_DATA(LCD2D9_MARK, PORT141_FN7), PINMUX_DATA(VIO_D12_MARK, PORT142_FN1), \ PINMUX_DATA(<API key>, PORT142_FN2), \ PINMUX_DATA(VIO2_D4_MARK, PORT142_FN6), \ PINMUX_DATA(LCD2D2_MARK, PORT142_FN7), PINMUX_DATA(VIO_D13_MARK, PORT143_FN1), \ PINMUX_DATA(<API key>, PORT143_FN2), \ PINMUX_DATA(<API key>, PORT143_FN3), \ PINMUX_DATA(VIO2_D5_MARK, PORT143_FN6), \ PINMUX_DATA(LCD2D3_MARK, PORT143_FN7), PINMUX_DATA(VIO_D14_MARK, PORT144_FN1), \ PINMUX_DATA(<API key>, PORT144_FN2), \ PINMUX_DATA(VIO2_D6_MARK, PORT144_FN6), \ PINMUX_DATA(LCD2D4_MARK, PORT144_FN7), PINMUX_DATA(VIO_D15_MARK, PORT145_FN1), \ PINMUX_DATA(TPU1TO3_MARK, PORT145_FN3), \ PINMUX_DATA(<API key>, PORT145_FN4), \ PINMUX_DATA(PORT145_LCD2RS_MARK, PORT145_FN5), \ PINMUX_DATA(VIO2_D7_MARK, PORT145_FN6), \ PINMUX_DATA(LCD2D5_MARK, PORT145_FN7), PINMUX_DATA(VIO_CLK_MARK, PORT146_FN1), \ PINMUX_DATA(LCD2DCK_MARK, PORT146_FN4), \ PINMUX_DATA(<API key>, PORT146_FN5), \ PINMUX_DATA(VIO2_CLK_MARK, PORT146_FN6, MSEL4CR_MSEL27_0), \ PINMUX_DATA(LCD2D18_MARK, PORT146_FN7), PINMUX_DATA(VIO_FIELD_MARK, PORT147_FN1), \ PINMUX_DATA(LCD2RD__MARK, PORT147_FN4), \ PINMUX_DATA(VIO2_FIELD_MARK, PORT147_FN6, MSEL4CR_MSEL27_0), \ PINMUX_DATA(LCD2D19_MARK, PORT147_FN7), PINMUX_DATA(VIO_CKO_MARK, PORT148_FN1), PINMUX_DATA(A27_MARK, PORT149_FN1), \ PINMUX_DATA(PORT149_RDWR_MARK, PORT149_FN2), \ PINMUX_DATA(MFG0_IN1_MARK, PORT149_FN3), \ PINMUX_DATA(<API key>, PORT149_FN4), PINMUX_DATA(MFG0_IN2_MARK, PORT150_FN3), PINMUX_DATA(TS_SPSYNC3_MARK, PORT151_FN4), \ PINMUX_DATA(MSIOF2_RSCK_MARK, PORT151_FN5), PINMUX_DATA(TS_SDAT3_MARK, PORT152_FN4), \ PINMUX_DATA(MSIOF2_RSYNC_MARK, PORT152_FN5), PINMUX_DATA(TPU1TO2_MARK, PORT153_FN3), \ PINMUX_DATA(TS_SDEN3_MARK, PORT153_FN4), \ PINMUX_DATA(<API key>, PORT153_FN5), PINMUX_DATA(SCIFA2_TXD1_MARK, PORT154_FN2, MSEL3CR_MSEL9_0), \ PINMUX_DATA(MSIOF2_MCK0_MARK, PORT154_FN5), PINMUX_DATA(SCIFA2_RXD1_MARK, PORT155_FN2, MSEL3CR_MSEL9_0), \ PINMUX_DATA(MSIOF2_MCK1_MARK, PORT155_FN5), PINMUX_DATA(SCIFA2_RTS1__MARK, PORT156_FN2, MSEL3CR_MSEL9_0), \ PINMUX_DATA(<API key>, PORT156_FN5), PINMUX_DATA(SCIFA2_CTS1__MARK, PORT157_FN2, MSEL3CR_MSEL9_0), \ PINMUX_DATA(<API key>, PORT157_FN5, MSEL4CR_MSEL11_0, MSEL4CR_MSEL10_0), PINMUX_DATA(DINT__MARK, PORT158_FN1), \ PINMUX_DATA(SCIFA2_SCK1_MARK, PORT158_FN2, MSEL3CR_MSEL9_0), \ PINMUX_DATA(TS_SCK3_MARK, PORT158_FN4), PINMUX_DATA(<API key>, PORT159_FN1, MSEL4CR_MSEL22_0), \ PINMUX_DATA(<API key>, PORT159_FN2, MSEL4CR_MSEL21_1), \ PINMUX_DATA(NMI_MARK, PORT159_FN3), PINMUX_DATA(<API key>, PORT160_FN1, MSEL4CR_MSEL22_0), \ PINMUX_DATA(<API key>, PORT160_FN2, MSEL4CR_MSEL21_1), PINMUX_DATA(<API key>, PORT161_FN1, MSEL4CR_MSEL22_0), \ PINMUX_DATA(<API key>, PORT161_FN2, MSEL4CR_MSEL21_1), PINMUX_DATA(<API key>, PORT162_FN1, MSEL4CR_MSEL22_0), \ PINMUX_DATA(<API key>, PORT162_FN2, MSEL4CR_MSEL21_1), PINMUX_DATA(<API key>, PORT163_FN1, MSEL4CR_MSEL22_0), \ PINMUX_DATA(<API key>, PORT163_FN2, MSEL4CR_MSEL21_1), \ PINMUX_DATA(TPU3TO0_MARK, PORT163_FN5), PINMUX_DATA(LCDD0_MARK, PORT192_FN1), PINMUX_DATA(LCDD1_MARK, PORT193_FN1), \ PINMUX_DATA(<API key>, PORT193_FN3, MSEL4CR_MSEL21_0, MSEL4CR_MSEL20_1), \ PINMUX_DATA(BBIF2_TSYNC1_MARK, PORT193_FN5), PINMUX_DATA(LCDD2_MARK, PORT194_FN1), \ PINMUX_DATA(<API key>, PORT194_FN3, MSEL4CR_MSEL21_0, MSEL4CR_MSEL20_1), \ PINMUX_DATA(BBIF2_TSCK1_MARK, PORT194_FN5), PINMUX_DATA(LCDD3_MARK, PORT195_FN1), \ PINMUX_DATA(<API key>, PORT195_FN3, MSEL4CR_MSEL21_0, MSEL4CR_MSEL20_1), \ PINMUX_DATA(BBIF2_TXD1_MARK, PORT195_FN5), PINMUX_DATA(LCDD4_MARK, PORT196_FN1), \ PINMUX_DATA(<API key>, PORT196_FN3, MSEL4CR_MSEL21_0, MSEL4CR_MSEL20_1), PINMUX_DATA(LCDD5_MARK, PORT197_FN1), \ PINMUX_DATA(<API key>, PORT197_FN3, MSEL4CR_MSEL21_0, MSEL4CR_MSEL20_1), \ PINMUX_DATA(MFG2_OUT2_MARK, PORT197_FN5), \ PINMUX_DATA(TPU2TO1_MARK, PORT197_FN7), PINMUX_DATA(LCDD6_MARK, PORT198_FN1), PINMUX_DATA(LCDD7_MARK, PORT199_FN1), \ PINMUX_DATA(TPU4TO1_MARK, PORT199_FN2), \ PINMUX_DATA(MFG4_OUT2_MARK, PORT199_FN5), PINMUX_DATA(LCDD8_MARK, PORT200_FN1), \ PINMUX_DATA(D16_MARK, PORT200_FN6), PINMUX_DATA(LCDD9_MARK, PORT201_FN1), \ PINMUX_DATA(D17_MARK, PORT201_FN6), PINMUX_DATA(LCDD10_MARK, PORT202_FN1), \ PINMUX_DATA(D18_MARK, PORT202_FN6), PINMUX_DATA(LCDD11_MARK, PORT203_FN1), \ PINMUX_DATA(D19_MARK, PORT203_FN6), PINMUX_DATA(LCDD12_MARK, PORT204_FN1), \ PINMUX_DATA(D20_MARK, PORT204_FN6), PINMUX_DATA(LCDD13_MARK, PORT205_FN1), \ PINMUX_DATA(D21_MARK, PORT205_FN6), PINMUX_DATA(LCDD14_MARK, PORT206_FN1), \ PINMUX_DATA(D22_MARK, PORT206_FN6), PINMUX_DATA(LCDD15_MARK, PORT207_FN1), \ PINMUX_DATA(<API key>, PORT207_FN2, MSEL3CR_MSEL11_1), \ PINMUX_DATA(D23_MARK, PORT207_FN6), PINMUX_DATA(LCDD16_MARK, PORT208_FN1), \ PINMUX_DATA(<API key>, PORT208_FN2, MSEL3CR_MSEL11_1), \ PINMUX_DATA(D24_MARK, PORT208_FN6), PINMUX_DATA(LCDD17_MARK, PORT209_FN1), \ PINMUX_DATA(D25_MARK, PORT209_FN6), PINMUX_DATA(LCDD18_MARK, PORT210_FN1), \ PINMUX_DATA(DREQ2_MARK, PORT210_FN2), \ PINMUX_DATA(<API key>, PORT210_FN5, MSEL3CR_MSEL11_1), \ PINMUX_DATA(D26_MARK, PORT210_FN6), PINMUX_DATA(LCDD19_MARK, PORT211_FN1), \ PINMUX_DATA(<API key>, PORT211_FN5, MSEL3CR_MSEL11_1), \ PINMUX_DATA(D27_MARK, PORT211_FN6), PINMUX_DATA(LCDD20_MARK, PORT212_FN1), \ PINMUX_DATA(TS_SPSYNC1_MARK, PORT212_FN2), \ PINMUX_DATA(MSIOF0L_MCK0_MARK, PORT212_FN5, MSEL3CR_MSEL11_1), \ PINMUX_DATA(D28_MARK, PORT212_FN6), PINMUX_DATA(LCDD21_MARK, PORT213_FN1), \ PINMUX_DATA(TS_SDAT1_MARK, PORT213_FN2), \ PINMUX_DATA(MSIOF0L_MCK1_MARK, PORT213_FN5, MSEL3CR_MSEL11_1), \ PINMUX_DATA(D29_MARK, PORT213_FN6), PINMUX_DATA(LCDD22_MARK, PORT214_FN1), \ PINMUX_DATA(TS_SDEN1_MARK, PORT214_FN2), \ PINMUX_DATA(MSIOF0L_RSCK_MARK, PORT214_FN5, MSEL3CR_MSEL11_1), \ PINMUX_DATA(D30_MARK, PORT214_FN6), PINMUX_DATA(LCDD23_MARK, PORT215_FN1), \ PINMUX_DATA(TS_SCK1_MARK, PORT215_FN2), \ PINMUX_DATA(MSIOF0L_RSYNC_MARK, PORT215_FN5, MSEL3CR_MSEL11_1), \ PINMUX_DATA(D31_MARK, PORT215_FN6), PINMUX_DATA(LCDDCK_MARK, PORT216_FN1), \ PINMUX_DATA(LCDWR__MARK, PORT216_FN2), PINMUX_DATA(LCDRD__MARK, PORT217_FN1), \ PINMUX_DATA(DACK2_MARK, PORT217_FN2), \ PINMUX_DATA(PORT217_LCD2RS_MARK, PORT217_FN3), \ PINMUX_DATA(MSIOF0L_TSYNC_MARK, PORT217_FN5, MSEL3CR_MSEL11_1), \ PINMUX_DATA(VIO2_FIELD3_MARK, PORT217_FN6, MSEL4CR_MSEL27_1, MSEL4CR_MSEL26_1), \ PINMUX_DATA(<API key>, PORT217_FN7), PINMUX_DATA(LCDHSYN_MARK, PORT218_FN1), \ PINMUX_DATA(LCDCS__MARK, PORT218_FN2), \ PINMUX_DATA(LCDCS2__MARK, PORT218_FN3), \ PINMUX_DATA(DACK3_MARK, PORT218_FN4), \ PINMUX_DATA(<API key>, PORT218_FN5), PINMUX_DATA(LCDDISP_MARK, PORT219_FN1), \ PINMUX_DATA(LCDRS_MARK, PORT219_FN2), \ PINMUX_DATA(<API key>, PORT219_FN3), \ PINMUX_DATA(DREQ3_MARK, PORT219_FN4), \ PINMUX_DATA(MSIOF0L_TSCK_MARK, PORT219_FN5, MSEL3CR_MSEL11_1), \ PINMUX_DATA(VIO2_CLK3_MARK, PORT219_FN6, MSEL4CR_MSEL27_1, MSEL4CR_MSEL26_1), \ PINMUX_DATA(LCD2DCK_2_MARK, PORT219_FN7), PINMUX_DATA(LCDVSYN_MARK, PORT220_FN1), \ PINMUX_DATA(LCDVSYN2_MARK, PORT220_FN2), PINMUX_DATA(LCDLCLK_MARK, PORT221_FN1), \ PINMUX_DATA(DREQ1_MARK, PORT221_FN2), \ PINMUX_DATA(<API key>, PORT221_FN3), \ PINMUX_DATA(PWEN_MARK, PORT221_FN4), \ PINMUX_DATA(MSIOF0L_RXD_MARK, PORT221_FN5, MSEL3CR_MSEL11_1), \ PINMUX_DATA(VIO2_HD3_MARK, PORT221_FN6, MSEL4CR_MSEL27_1, MSEL4CR_MSEL26_1), \ PINMUX_DATA(<API key>, PORT221_FN7), PINMUX_DATA(LCDDON_MARK, PORT222_FN1), \ PINMUX_DATA(LCDDON2_MARK, PORT222_FN2), \ PINMUX_DATA(DACK1_MARK, PORT222_FN3), \ PINMUX_DATA(OVCN_MARK, PORT222_FN4), \ PINMUX_DATA(MSIOF0L_TXD_MARK, PORT222_FN5, MSEL3CR_MSEL11_1), \ PINMUX_DATA(VIO2_VD3_MARK, PORT222_FN6, MSEL4CR_MSEL27_1, MSEL4CR_MSEL26_1), \ PINMUX_DATA(<API key>, PORT222_FN7, MSEL3CR_MSEL2_1), PINMUX_DATA(SCIFA1_TXD_MARK, PORT225_FN2), \ PINMUX_DATA(OVCN2_MARK, PORT225_FN4), PINMUX_DATA(EXTLP_MARK, PORT226_FN1), \ PINMUX_DATA(SCIFA1_SCK_MARK, PORT226_FN2), \ PINMUX_DATA(<API key>, PORT226_FN5), PINMUX_DATA(SCIFA1_RTS__MARK, PORT227_FN2), \ PINMUX_DATA(IDIN_MARK, PORT227_FN4), PINMUX_DATA(SCIFA1_RXD_MARK, PORT228_FN2), PINMUX_DATA(SCIFA1_CTS__MARK, PORT229_FN2), \ PINMUX_DATA(MFG1_IN1_MARK, PORT229_FN3), PINMUX_DATA(MSIOF1_TXD_MARK, PORT230_FN1), \ PINMUX_DATA(SCIFA2_TXD2_MARK, PORT230_FN2, MSEL3CR_MSEL9_1), PINMUX_DATA(MSIOF1_TSYNC_MARK, PORT231_FN1), \ PINMUX_DATA(SCIFA2_CTS2__MARK, PORT231_FN2, MSEL3CR_MSEL9_1), PINMUX_DATA(MSIOF1_TSCK_MARK, PORT232_FN1), \ PINMUX_DATA(SCIFA2_SCK2_MARK, PORT232_FN2, MSEL3CR_MSEL9_1), PINMUX_DATA(MSIOF1_RXD_MARK, PORT233_FN1), \ PINMUX_DATA(SCIFA2_RXD2_MARK, PORT233_FN2, MSEL3CR_MSEL9_1), PINMUX_DATA(MSIOF1_RSCK_MARK, PORT234_FN1), \ PINMUX_DATA(SCIFA2_RTS2__MARK, PORT234_FN2, MSEL3CR_MSEL9_1), \ PINMUX_DATA(VIO2_CLK2_MARK, PORT234_FN6, MSEL4CR_MSEL27_1, MSEL4CR_MSEL26_0), \ PINMUX_DATA(LCD2D20_MARK, PORT234_FN7), PINMUX_DATA(MSIOF1_RSYNC_MARK, PORT235_FN1), \ PINMUX_DATA(MFG1_IN2_MARK, PORT235_FN3), \ PINMUX_DATA(VIO2_VD2_MARK, PORT235_FN6, MSEL4CR_MSEL27_1, MSEL4CR_MSEL26_0), \ PINMUX_DATA(LCD2D21_MARK, PORT235_FN7), PINMUX_DATA(MSIOF1_MCK0_MARK, PORT236_FN1), \ PINMUX_DATA(<API key>, PORT236_FN2, MSEL2CR_MSEL17_0, MSEL2CR_MSEL16_0), PINMUX_DATA(MSIOF1_MCK1_MARK, PORT237_FN1), \ PINMUX_DATA(<API key>, PORT237_FN2, MSEL2CR_MSEL17_0, MSEL2CR_MSEL16_0), PINMUX_DATA(MSIOF1_SS1_MARK, PORT238_FN1), \ PINMUX_DATA(VIO2_FIELD2_MARK, PORT238_FN6, MSEL4CR_MSEL27_1, MSEL4CR_MSEL26_0), \ PINMUX_DATA(LCD2D22_MARK, PORT238_FN7), PINMUX_DATA(MSIOF1_SS2_MARK, PORT239_FN1), \ PINMUX_DATA(VIO2_HD2_MARK, PORT239_FN6, MSEL4CR_MSEL27_1, MSEL4CR_MSEL26_0), \ PINMUX_DATA(LCD2D23_MARK, PORT239_FN7), PINMUX_DATA(SCIFA6_TXD_MARK, PORT240_FN1), PINMUX_DATA(<API key>, PORT241_FN1, MSEL4CR_MSEL19_0), \ PINMUX_DATA(PORT241_IROUT_MARK, PORT241_FN2), \ PINMUX_DATA(MFG4_OUT1_MARK, PORT241_FN3), \ PINMUX_DATA(TPU4TO0_MARK, PORT241_FN4), PINMUX_DATA(<API key>, PORT242_FN1, MSEL4CR_MSEL19_0), \ PINMUX_DATA(MFG4_IN2_MARK, PORT242_FN3), PINMUX_DATA(<API key>, PORT243_FN1, MSEL4CR_MSEL19_0), \ PINMUX_DATA(<API key>, PORT243_FN2), PINMUX_DATA(<API key>, PORT244_FN1, MSEL4CR_MSEL21_0, MSEL4CR_MSEL20_0), \ PINMUX_DATA(MFG2_IN1_MARK, PORT244_FN2), \ PINMUX_DATA(<API key>, PORT244_FN3, MSEL4CR_MSEL22_1), \ PINMUX_DATA(MSIOF2R_RXD_MARK, PORT244_FN7, MSEL4CR_MSEL11_1), PINMUX_DATA(<API key>, PORT245_FN1, MSEL4CR_MSEL21_0, MSEL4CR_MSEL20_0), \ PINMUX_DATA(MFG2_IN2_MARK, PORT245_FN2), \ PINMUX_DATA(<API key>, PORT245_FN3, MSEL4CR_MSEL22_1), \ PINMUX_DATA(MSIOF2R_TXD_MARK, PORT245_FN7, MSEL4CR_MSEL11_1), PINMUX_DATA(<API key>, PORT246_FN1, MSEL4CR_MSEL21_0, MSEL4CR_MSEL20_0), \ PINMUX_DATA(MFG1_OUT1_MARK, PORT246_FN2), \ PINMUX_DATA(<API key>, PORT246_FN3, MSEL4CR_MSEL22_1), \ PINMUX_DATA(TPU1TO0_MARK, PORT246_FN4), PINMUX_DATA(<API key>, PORT247_FN1, MSEL4CR_MSEL21_0, MSEL4CR_MSEL20_0), \ PINMUX_DATA(MFG3_OUT2_MARK, PORT247_FN2), \ PINMUX_DATA(<API key>, PORT247_FN3, MSEL4CR_MSEL22_1), \ PINMUX_DATA(TPU3TO1_MARK, PORT247_FN4), PINMUX_DATA(<API key>, PORT248_FN1, MSEL4CR_MSEL21_0, MSEL4CR_MSEL20_0), \ PINMUX_DATA(MFG2_OUT1_MARK, PORT248_FN2), \ PINMUX_DATA(<API key>, PORT248_FN3, MSEL4CR_MSEL22_1), \ PINMUX_DATA(TPU2TO0_MARK, PORT248_FN4), \ PINMUX_DATA(<API key>, PORT248_FN5, MSEL2CR_MSEL19_0, MSEL2CR_MSEL18_0), \ PINMUX_DATA(MSIOF2R_TSCK_MARK, PORT248_FN7, MSEL4CR_MSEL11_1), PINMUX_DATA(PORT249_IROUT_MARK, PORT249_FN1), \ PINMUX_DATA(MFG4_IN1_MARK, PORT249_FN2), \ PINMUX_DATA(<API key>, PORT249_FN5, MSEL2CR_MSEL19_0, MSEL2CR_MSEL18_0), \ PINMUX_DATA(MSIOF2R_TSYNC_MARK, PORT249_FN7, MSEL4CR_MSEL11_1), PINMUX_DATA(SDHICLK0_MARK, PORT250_FN1), PINMUX_DATA(SDHICD0_MARK, PORT251_FN1), PINMUX_DATA(SDHID0_0_MARK, PORT252_FN1), PINMUX_DATA(SDHID0_1_MARK, PORT253_FN1), PINMUX_DATA(SDHID0_2_MARK, PORT254_FN1), PINMUX_DATA(SDHID0_3_MARK, PORT255_FN1), PINMUX_DATA(SDHICMD0_MARK, PORT256_FN1), PINMUX_DATA(SDHIWP0_MARK, PORT257_FN1), PINMUX_DATA(SDHICLK1_MARK, PORT258_FN1), PINMUX_DATA(SDHID1_0_MARK, PORT259_FN1), \ PINMUX_DATA(TS_SPSYNC2_MARK, PORT259_FN3), PINMUX_DATA(SDHID1_1_MARK, PORT260_FN1), \ PINMUX_DATA(TS_SDAT2_MARK, PORT260_FN3), PINMUX_DATA(SDHID1_2_MARK, PORT261_FN1), \ PINMUX_DATA(TS_SDEN2_MARK, PORT261_FN3), PINMUX_DATA(SDHID1_3_MARK, PORT262_FN1), \ PINMUX_DATA(TS_SCK2_MARK, PORT262_FN3), PINMUX_DATA(SDHICMD1_MARK, PORT263_FN1), PINMUX_DATA(SDHICLK2_MARK, PORT264_FN1), PINMUX_DATA(SDHID2_0_MARK, PORT265_FN1), \ PINMUX_DATA(TS_SPSYNC4_MARK, PORT265_FN3), PINMUX_DATA(SDHID2_1_MARK, PORT266_FN1), \ PINMUX_DATA(TS_SDAT4_MARK, PORT266_FN3), PINMUX_DATA(SDHID2_2_MARK, PORT267_FN1), \ PINMUX_DATA(TS_SDEN4_MARK, PORT267_FN3), PINMUX_DATA(SDHID2_3_MARK, PORT268_FN1), \ PINMUX_DATA(TS_SCK4_MARK, PORT268_FN3), PINMUX_DATA(SDHICMD2_MARK, PORT269_FN1), PINMUX_DATA(MMCCLK0_MARK, PORT270_FN1, MSEL4CR_MSEL15_0), PINMUX_DATA(MMCD0_0_MARK, PORT271_FN1, PORT271_IN_PU, MSEL4CR_MSEL15_0), PINMUX_DATA(MMCD0_1_MARK, PORT272_FN1, PORT272_IN_PU, MSEL4CR_MSEL15_0), PINMUX_DATA(MMCD0_2_MARK, PORT273_FN1, PORT273_IN_PU, MSEL4CR_MSEL15_0), PINMUX_DATA(MMCD0_3_MARK, PORT274_FN1, PORT274_IN_PU, MSEL4CR_MSEL15_0), PINMUX_DATA(MMCD0_4_MARK, PORT275_FN1, PORT275_IN_PU, MSEL4CR_MSEL15_0), \ PINMUX_DATA(TS_SPSYNC5_MARK, PORT275_FN3), PINMUX_DATA(MMCD0_5_MARK, PORT276_FN1, PORT276_IN_PU, MSEL4CR_MSEL15_0), \ PINMUX_DATA(TS_SDAT5_MARK, PORT276_FN3), PINMUX_DATA(MMCD0_6_MARK, PORT277_FN1, PORT277_IN_PU, MSEL4CR_MSEL15_0), \ PINMUX_DATA(TS_SDEN5_MARK, PORT277_FN3), PINMUX_DATA(MMCD0_7_MARK, PORT278_FN1, PORT278_IN_PU, MSEL4CR_MSEL15_0), \ PINMUX_DATA(TS_SCK5_MARK, PORT278_FN3), PINMUX_DATA(MMCCMD0_MARK, PORT279_FN1, PORT279_IN_PU, MSEL4CR_MSEL15_0), PINMUX_DATA(RESETOUTS__MARK, PORT281_FN1), \ PINMUX_DATA(EXTAL2OUT_MARK, PORT281_FN2), PINMUX_DATA(<API key>, PORT288_FN1), PINMUX_DATA(MCP_CKO_MARK, PORT289_FN1), \ PINMUX_DATA(MMCCLK1_MARK, PORT289_FN2, MSEL4CR_MSEL15_1), PINMUX_DATA(<API key>, PORT290_FN1), PINMUX_DATA(<API key>, PORT291_FN1), PINMUX_DATA(<API key>, PORT292_FN1), PINMUX_DATA(<API key>, PORT293_FN1), PINMUX_DATA(<API key>, PORT294_FN1), PINMUX_DATA(<API key>, PORT295_FN1), PINMUX_DATA(<API key>, PORT296_FN1), PINMUX_DATA(<API key>, PORT297_FN1), \ PINMUX_DATA(MMCCMD1_MARK, PORT297_FN2, MSEL4CR_MSEL15_1), PINMUX_DATA(<API key>, PORT298_FN1), \ PINMUX_DATA(MMCD1_7_MARK, PORT298_FN2, MSEL4CR_MSEL15_1), PINMUX_DATA(<API key>, PORT299_FN1), \ PINMUX_DATA(MMCD1_6_MARK, PORT299_FN2, MSEL4CR_MSEL15_1), PINMUX_DATA(<API key>, PORT300_FN1), \ PINMUX_DATA(MMCD1_5_MARK, PORT300_FN2, MSEL4CR_MSEL15_1), PINMUX_DATA(<API key>, PORT301_FN1), \ PINMUX_DATA(MMCD1_4_MARK, PORT301_FN2, MSEL4CR_MSEL15_1), PINMUX_DATA(<API key>, PORT302_FN1), \ PINMUX_DATA(MMCD1_3_MARK, PORT302_FN2, MSEL4CR_MSEL15_1), PINMUX_DATA(<API key>, PORT303_FN1), \ PINMUX_DATA(MMCD1_2_MARK, PORT303_FN2, MSEL4CR_MSEL15_1), PINMUX_DATA(<API key>, PORT304_FN1), \ PINMUX_DATA(MMCD1_1_MARK, PORT304_FN2, MSEL4CR_MSEL15_1), PINMUX_DATA(<API key>, PORT305_FN1), \ PINMUX_DATA(MMCD1_0_MARK, PORT305_FN2, MSEL4CR_MSEL15_1), PINMUX_DATA(MCP_NBRSTOUT__MARK, PORT306_FN1), PINMUX_DATA(<API key>, PORT309_FN1), \ PINMUX_DATA(<API key>, PORT309_FN2), PINMUX_DATA(TSIF2_TS_XX1_MARK, MSEL2CR_MSEL14_0, MSEL2CR_MSEL13_0, MSEL2CR_MSEL12_0), PINMUX_DATA(TSIF2_TS_XX2_MARK, MSEL2CR_MSEL14_0, MSEL2CR_MSEL13_0, MSEL2CR_MSEL12_1), PINMUX_DATA(TSIF2_TS_XX3_MARK, MSEL2CR_MSEL14_0, MSEL2CR_MSEL13_1, MSEL2CR_MSEL12_0), PINMUX_DATA(TSIF2_TS_XX4_MARK, MSEL2CR_MSEL14_0, MSEL2CR_MSEL13_1, MSEL2CR_MSEL12_1), PINMUX_DATA(TSIF2_TS_XX5_MARK, MSEL2CR_MSEL14_1, MSEL2CR_MSEL13_0, MSEL2CR_MSEL12_0), PINMUX_DATA(TSIF1_TS_XX1_MARK, MSEL2CR_MSEL11_0, MSEL2CR_MSEL10_0, MSEL2CR_MSEL9_0), PINMUX_DATA(TSIF1_TS_XX2_MARK, MSEL2CR_MSEL11_0, MSEL2CR_MSEL10_0, MSEL2CR_MSEL9_1), PINMUX_DATA(TSIF1_TS_XX3_MARK, MSEL2CR_MSEL11_0, MSEL2CR_MSEL10_1, MSEL2CR_MSEL9_0), PINMUX_DATA(TSIF1_TS_XX4_MARK, MSEL2CR_MSEL11_0, MSEL2CR_MSEL10_1, MSEL2CR_MSEL9_1), PINMUX_DATA(TSIF1_TS_XX5_MARK, MSEL2CR_MSEL11_1, MSEL2CR_MSEL10_0, MSEL2CR_MSEL9_0), PINMUX_DATA(TSIF0_TS_XX1_MARK, MSEL2CR_MSEL8_0, MSEL2CR_MSEL7_0, MSEL2CR_MSEL6_0), PINMUX_DATA(TSIF0_TS_XX2_MARK, MSEL2CR_MSEL8_0, MSEL2CR_MSEL7_0, MSEL2CR_MSEL6_1), PINMUX_DATA(TSIF0_TS_XX3_MARK, MSEL2CR_MSEL8_0, MSEL2CR_MSEL7_1, MSEL2CR_MSEL6_0), PINMUX_DATA(TSIF0_TS_XX4_MARK, MSEL2CR_MSEL8_0, MSEL2CR_MSEL7_1, MSEL2CR_MSEL6_1), PINMUX_DATA(TSIF0_TS_XX5_MARK, MSEL2CR_MSEL8_1, MSEL2CR_MSEL7_0, MSEL2CR_MSEL6_0), PINMUX_DATA(MST1_TS_XX1_MARK, MSEL2CR_MSEL5_0, MSEL2CR_MSEL4_0, MSEL2CR_MSEL3_0), PINMUX_DATA(MST1_TS_XX2_MARK, MSEL2CR_MSEL5_0, MSEL2CR_MSEL4_0, MSEL2CR_MSEL3_1), PINMUX_DATA(MST1_TS_XX3_MARK, MSEL2CR_MSEL5_0, MSEL2CR_MSEL4_1, MSEL2CR_MSEL3_0), PINMUX_DATA(MST1_TS_XX4_MARK, MSEL2CR_MSEL5_0, MSEL2CR_MSEL4_1, MSEL2CR_MSEL3_1), PINMUX_DATA(MST1_TS_XX5_MARK, MSEL2CR_MSEL5_1, MSEL2CR_MSEL4_0, MSEL2CR_MSEL3_0), PINMUX_DATA(MST0_TS_XX1_MARK, MSEL2CR_MSEL2_0, MSEL2CR_MSEL1_0, MSEL2CR_MSEL0_0), PINMUX_DATA(MST0_TS_XX2_MARK, MSEL2CR_MSEL2_0, MSEL2CR_MSEL1_0, MSEL2CR_MSEL0_1), PINMUX_DATA(MST0_TS_XX3_MARK, MSEL2CR_MSEL2_0, MSEL2CR_MSEL1_1, MSEL2CR_MSEL0_0), PINMUX_DATA(MST0_TS_XX4_MARK, MSEL2CR_MSEL2_0, MSEL2CR_MSEL1_1, MSEL2CR_MSEL0_1), PINMUX_DATA(MST0_TS_XX5_MARK, MSEL2CR_MSEL2_1, MSEL2CR_MSEL1_0, MSEL2CR_MSEL0_0), PINMUX_DATA(<API key>, MSEL3CR_MSEL28_1), PINMUX_DATA(<API key>, MSEL3CR_MSEL28_0), PINMUX_DATA(DEBUG_MON_VIO_MARK, MSEL3CR_MSEL15_0), PINMUX_DATA(DEBUG_MON_LCDD_MARK, MSEL3CR_MSEL15_1), PINMUX_DATA(LCDC_LCDC0_MARK, MSEL3CR_MSEL6_0), PINMUX_DATA(LCDC_LCDC1_MARK, MSEL3CR_MSEL6_1), PINMUX_DATA(IRQ9_MEM_INT_MARK, MSEL4CR_MSEL29_0), PINMUX_DATA(IRQ9_MCP_INT_MARK, MSEL4CR_MSEL29_1), PINMUX_DATA(A11_MARK, MSEL4CR_MSEL13_0, MSEL4CR_MSEL12_0), PINMUX_DATA(KEYOUT8_MARK, MSEL4CR_MSEL13_0, MSEL4CR_MSEL12_1), PINMUX_DATA(TPU4TO3_MARK, MSEL4CR_MSEL13_1, MSEL4CR_MSEL12_0), PINMUX_DATA(RESETA_N_PU_ON_MARK, MSEL4CR_MSEL4_0), PINMUX_DATA(<API key>, MSEL4CR_MSEL4_1), PINMUX_DATA(EDBGREQ_PD_MARK, MSEL4CR_MSEL1_0), PINMUX_DATA(EDBGREQ_PU_MARK, MSEL4CR_MSEL1_1), PINMUX_DATA(KEYIN0_PU_MARK, PORT66_FN2, PORT66_IN_PU), PINMUX_DATA(KEYIN1_PU_MARK, PORT67_FN2, PORT67_IN_PU), PINMUX_DATA(KEYIN2_PU_MARK, PORT68_FN2, PORT68_IN_PU), PINMUX_DATA(KEYIN3_PU_MARK, PORT69_FN2, PORT69_IN_PU), PINMUX_DATA(KEYIN4_PU_MARK, PORT70_FN2, PORT70_IN_PU), PINMUX_DATA(KEYIN5_PU_MARK, PORT71_FN2, PORT71_IN_PU), PINMUX_DATA(KEYIN6_PU_MARK, PORT72_FN2, PORT72_IN_PU), PINMUX_DATA(KEYIN7_PU_MARK, PORT73_FN2, PORT73_IN_PU), PINMUX_DATA(SDHICD0_PU_MARK, PORT251_FN1, PORT251_IN_PU), PINMUX_DATA(SDHID0_0_PU_MARK, PORT252_FN1, PORT252_IN_PU), PINMUX_DATA(SDHID0_1_PU_MARK, PORT253_FN1, PORT253_IN_PU), PINMUX_DATA(SDHID0_2_PU_MARK, PORT254_FN1, PORT254_IN_PU), PINMUX_DATA(SDHID0_3_PU_MARK, PORT255_FN1, PORT255_IN_PU), PINMUX_DATA(SDHICMD0_PU_MARK, PORT256_FN1, PORT256_IN_PU), PINMUX_DATA(SDHIWP0_PU_MARK, PORT257_FN1, PORT256_IN_PU), PINMUX_DATA(SDHID1_0_PU_MARK, PORT259_FN1, PORT259_IN_PU), PINMUX_DATA(SDHID1_1_PU_MARK, PORT260_FN1, PORT260_IN_PU), PINMUX_DATA(SDHID1_2_PU_MARK, PORT261_FN1, PORT261_IN_PU), PINMUX_DATA(SDHID1_3_PU_MARK, PORT262_FN1, PORT262_IN_PU), PINMUX_DATA(SDHICMD1_PU_MARK, PORT263_FN1, PORT263_IN_PU), PINMUX_DATA(SDHID2_0_PU_MARK, PORT265_FN1, PORT265_IN_PU), PINMUX_DATA(SDHID2_1_PU_MARK, PORT266_FN1, PORT266_IN_PU), PINMUX_DATA(SDHID2_2_PU_MARK, PORT267_FN1, PORT267_IN_PU), PINMUX_DATA(SDHID2_3_PU_MARK, PORT268_FN1, PORT268_IN_PU), PINMUX_DATA(SDHICMD2_PU_MARK, PORT269_FN1, PORT269_IN_PU), PINMUX_DATA(MMCCMD0_PU_MARK, PORT279_FN1, PORT279_IN_PU, MSEL4CR_MSEL15_0), PINMUX_DATA(MMCCMD1_PU_MARK, PORT297_FN2, PORT297_IN_PU, MSEL4CR_MSEL15_1), PINMUX_DATA(MMCD0_0_PU_MARK, PORT271_FN1, PORT271_IN_PU, MSEL4CR_MSEL15_0), PINMUX_DATA(MMCD0_1_PU_MARK, PORT272_FN1, PORT272_IN_PU, MSEL4CR_MSEL15_0), PINMUX_DATA(MMCD0_2_PU_MARK, PORT273_FN1, PORT273_IN_PU, MSEL4CR_MSEL15_0), PINMUX_DATA(MMCD0_3_PU_MARK, PORT274_FN1, PORT274_IN_PU, MSEL4CR_MSEL15_0), PINMUX_DATA(MMCD0_4_PU_MARK, PORT275_FN1, PORT275_IN_PU, MSEL4CR_MSEL15_0), PINMUX_DATA(MMCD0_5_PU_MARK, PORT276_FN1, PORT276_IN_PU, MSEL4CR_MSEL15_0), PINMUX_DATA(MMCD0_6_PU_MARK, PORT277_FN1, PORT277_IN_PU, MSEL4CR_MSEL15_0), PINMUX_DATA(MMCD0_7_PU_MARK, PORT278_FN1, PORT278_IN_PU, MSEL4CR_MSEL15_0), PINMUX_DATA(FSIBISLD_PU_MARK, PORT39_FN1, PORT39_IN_PU), PINMUX_DATA(FSIACK_PU_MARK, PORT49_FN1, PORT49_IN_PU), PINMUX_DATA(FSIAILR_PU_MARK, PORT50_FN5, PORT50_IN_PU), PINMUX_DATA(FSIAIBT_PU_MARK, PORT51_FN5, PORT51_IN_PU), PINMUX_DATA(FSIAISLD_PU_MARK, PORT55_FN1, PORT55_IN_PU), }; static struct pinmux_gpio pinmux_gpios[] = { GPIO_PORT_ALL(), GPIO_FN(VBUS_0), GPIO_FN(GPI0), GPIO_FN(GPI1), GPIO_FN(GPI2), GPIO_FN(GPI3), GPIO_FN(GPI4), GPIO_FN(GPI5), GPIO_FN(GPI6), GPIO_FN(GPI7), GPIO_FN(SCIFA7_RXD), GPIO_FN(SCIFA7_CTS_), GPIO_FN(GPO7), \ GPIO_FN(MFG0_OUT2), GPIO_FN(GPO6), \ GPIO_FN(MFG1_OUT2), GPIO_FN(GPO5), \ GPIO_FN(SCIFA0_SCK), \ GPIO_FN(FSICOSLDT3), \ GPIO_FN(PORT16_VIO_CKOR), GPIO_FN(SCIFA0_TXD), GPIO_FN(SCIFA7_TXD), GPIO_FN(SCIFA7_RTS_), \ GPIO_FN(PORT19_VIO_CKO2), GPIO_FN(GPO0), GPIO_FN(GPO1), GPIO_FN(GPO2), \ GPIO_FN(STATUS0), GPIO_FN(GPO3), \ GPIO_FN(STATUS1), GPIO_FN(GPO4), \ GPIO_FN(STATUS2), GPIO_FN(VINT), GPIO_FN(TCKON), GPIO_FN(XDVFS1), \ GPIO_FN(PORT27_I2C_SCL2), \ GPIO_FN(PORT27_I2C_SCL3), \ GPIO_FN(MFG0_OUT1), \ GPIO_FN(PORT27_IROUT), GPIO_FN(XDVFS2), \ GPIO_FN(PORT28_I2C_SDA2), \ GPIO_FN(PORT28_I2C_SDA3), \ GPIO_FN(PORT28_TPU1TO1), GPIO_FN(SIM_RST), \ GPIO_FN(PORT29_TPU1TO1), GPIO_FN(SIM_CLK), \ GPIO_FN(PORT30_VIO_CKOR), GPIO_FN(SIM_D), \ GPIO_FN(PORT31_IROUT), GPIO_FN(SCIFA4_TXD), GPIO_FN(SCIFA4_RXD), \ GPIO_FN(XWUP), GPIO_FN(SCIFA4_RTS_), GPIO_FN(SCIFA4_CTS_), GPIO_FN(FSIBOBT), \ GPIO_FN(FSIBIBT), GPIO_FN(FSIBOLR), \ GPIO_FN(FSIBILR), GPIO_FN(FSIBOSLD), GPIO_FN(FSIBISLD), GPIO_FN(VACK), GPIO_FN(XTAL1L), GPIO_FN(SCIFA0_RTS_), \ GPIO_FN(FSICOSLDT2), GPIO_FN(SCIFA0_RXD), GPIO_FN(SCIFA0_CTS_), \ GPIO_FN(FSICOSLDT1), GPIO_FN(FSICOBT), \ GPIO_FN(FSICIBT), \ GPIO_FN(FSIDOBT), \ GPIO_FN(FSIDIBT), GPIO_FN(FSICOLR), \ GPIO_FN(FSICILR), \ GPIO_FN(FSIDOLR), \ GPIO_FN(FSIDILR), GPIO_FN(FSICOSLD), \ GPIO_FN(PORT47_FSICSPDIF), GPIO_FN(FSICISLD), \ GPIO_FN(FSIDISLD), GPIO_FN(FSIACK), \ GPIO_FN(PORT49_IRDA_OUT), \ GPIO_FN(PORT49_IROUT), \ GPIO_FN(FSIAOMC), GPIO_FN(FSIAOLR), \ GPIO_FN(BBIF2_TSYNC2), \ GPIO_FN(TPU2TO2), \ GPIO_FN(FSIAILR), GPIO_FN(FSIAOBT), \ GPIO_FN(BBIF2_TSCK2), \ GPIO_FN(TPU2TO3), \ GPIO_FN(FSIAIBT), GPIO_FN(FSIAOSLD), \ GPIO_FN(BBIF2_TXD2), GPIO_FN(FSIASPDIF), \ GPIO_FN(PORT53_IRDA_IN), \ GPIO_FN(TPU3TO3), \ GPIO_FN(FSIBSPDIF), \ GPIO_FN(PORT53_FSICSPDIF), GPIO_FN(FSIBCK), \ GPIO_FN(PORT54_IRDA_FIRSEL), \ GPIO_FN(TPU3TO2), \ GPIO_FN(FSIBOMC), \ GPIO_FN(FSICCK), \ GPIO_FN(FSICOMC), GPIO_FN(FSIAISLD), \ GPIO_FN(TPU0TO0), GPIO_FN(A0), \ GPIO_FN(BS_), GPIO_FN(A12), \ GPIO_FN(PORT58_KEYOUT7), \ GPIO_FN(TPU4TO2), GPIO_FN(A13), \ GPIO_FN(PORT59_KEYOUT6), \ GPIO_FN(TPU0TO1), GPIO_FN(A14), \ GPIO_FN(KEYOUT5), GPIO_FN(A15), \ GPIO_FN(KEYOUT4), GPIO_FN(A16), \ GPIO_FN(KEYOUT3), \ GPIO_FN(MSIOF0_SS1), GPIO_FN(A17), \ GPIO_FN(KEYOUT2), \ GPIO_FN(MSIOF0_TSYNC), GPIO_FN(A18), \ GPIO_FN(KEYOUT1), \ GPIO_FN(MSIOF0_TSCK), GPIO_FN(A19), \ GPIO_FN(KEYOUT0), \ GPIO_FN(MSIOF0_TXD), GPIO_FN(A20), \ GPIO_FN(KEYIN0), \ GPIO_FN(MSIOF0_RSCK), GPIO_FN(A21), \ GPIO_FN(KEYIN1), \ GPIO_FN(MSIOF0_RSYNC), GPIO_FN(A22), \ GPIO_FN(KEYIN2), \ GPIO_FN(MSIOF0_MCK0), GPIO_FN(A23), \ GPIO_FN(KEYIN3), \ GPIO_FN(MSIOF0_MCK1), GPIO_FN(A24), \ GPIO_FN(KEYIN4), \ GPIO_FN(MSIOF0_RXD), GPIO_FN(A25), \ GPIO_FN(KEYIN5), \ GPIO_FN(MSIOF0_SS2), GPIO_FN(A26), \ GPIO_FN(KEYIN6), GPIO_FN(KEYIN7), GPIO_FN(D0_NAF0), GPIO_FN(D1_NAF1), GPIO_FN(D2_NAF2), GPIO_FN(D3_NAF3), GPIO_FN(D4_NAF4), GPIO_FN(D5_NAF5), GPIO_FN(D6_NAF6), GPIO_FN(D7_NAF7), GPIO_FN(D8_NAF8), GPIO_FN(D9_NAF9), GPIO_FN(D10_NAF10), GPIO_FN(D11_NAF11), GPIO_FN(D12_NAF12), GPIO_FN(D13_NAF13), GPIO_FN(D14_NAF14), GPIO_FN(D15_NAF15), GPIO_FN(CS4_), GPIO_FN(CS5A_), \ GPIO_FN(PORT91_RDWR), GPIO_FN(CS5B_), \ GPIO_FN(FCE1_), GPIO_FN(CS6B_), \ GPIO_FN(DACK0), GPIO_FN(FCE0_), \ GPIO_FN(CS6A_), GPIO_FN(WAIT_), \ GPIO_FN(DREQ0), GPIO_FN(RD__FSC), GPIO_FN(WE0__FWE), \ GPIO_FN(RDWR_FWE), GPIO_FN(WE1_), GPIO_FN(FRB), GPIO_FN(CKO), GPIO_FN(NBRSTOUT_), GPIO_FN(NBRST_), GPIO_FN(BBIF2_TXD), GPIO_FN(BBIF2_RXD), GPIO_FN(BBIF2_SYNC), GPIO_FN(BBIF2_SCK), GPIO_FN(SCIFA3_CTS_), \ GPIO_FN(MFG3_IN2), GPIO_FN(SCIFA3_RXD), \ GPIO_FN(MFG3_IN1), GPIO_FN(BBIF1_SS2), \ GPIO_FN(SCIFA3_RTS_), \ GPIO_FN(MFG3_OUT1), GPIO_FN(SCIFA3_TXD), GPIO_FN(HSI_RX_DATA), \ GPIO_FN(BBIF1_RXD), GPIO_FN(HSI_TX_WAKE), \ GPIO_FN(BBIF1_TSCK), GPIO_FN(HSI_TX_DATA), \ GPIO_FN(BBIF1_TSYNC), GPIO_FN(HSI_TX_READY), \ GPIO_FN(BBIF1_TXD), GPIO_FN(HSI_RX_READY), \ GPIO_FN(BBIF1_RSCK), \ GPIO_FN(PORT115_I2C_SCL2), \ GPIO_FN(PORT115_I2C_SCL3), GPIO_FN(HSI_RX_WAKE), \ GPIO_FN(BBIF1_RSYNC), \ GPIO_FN(PORT116_I2C_SDA2), \ GPIO_FN(PORT116_I2C_SDA3), GPIO_FN(HSI_RX_FLAG), \ GPIO_FN(BBIF1_SS1), \ GPIO_FN(BBIF1_FLOW), GPIO_FN(HSI_TX_FLAG), GPIO_FN(VIO_VD), \ GPIO_FN(PORT128_LCD2VSYN), \ GPIO_FN(VIO2_VD), \ GPIO_FN(LCD2D0), GPIO_FN(VIO_HD), \ GPIO_FN(PORT129_LCD2HSYN), \ GPIO_FN(PORT129_LCD2CS_), \ GPIO_FN(VIO2_HD), \ GPIO_FN(LCD2D1), GPIO_FN(VIO_D0), \ GPIO_FN(PORT130_MSIOF2_RXD), \ GPIO_FN(LCD2D10), GPIO_FN(VIO_D1), \ GPIO_FN(PORT131_KEYOUT6), \ GPIO_FN(PORT131_MSIOF2_SS1), \ GPIO_FN(PORT131_KEYOUT11), \ GPIO_FN(LCD2D11), GPIO_FN(VIO_D2), \ GPIO_FN(PORT132_KEYOUT7), \ GPIO_FN(PORT132_MSIOF2_SS2), \ GPIO_FN(PORT132_KEYOUT10), \ GPIO_FN(LCD2D12), GPIO_FN(VIO_D3), \ GPIO_FN(MSIOF2_TSYNC), \ GPIO_FN(LCD2D13), GPIO_FN(VIO_D4), \ GPIO_FN(MSIOF2_TXD), \ GPIO_FN(LCD2D14), GPIO_FN(VIO_D5), \ GPIO_FN(MSIOF2_TSCK), \ GPIO_FN(LCD2D15), GPIO_FN(VIO_D6), \ GPIO_FN(PORT136_KEYOUT8), \ GPIO_FN(LCD2D16), GPIO_FN(VIO_D7), \ GPIO_FN(PORT137_KEYOUT9), \ GPIO_FN(LCD2D17), GPIO_FN(VIO_D8), \ GPIO_FN(PORT138_KEYOUT8), \ GPIO_FN(VIO2_D0), \ GPIO_FN(LCD2D6), GPIO_FN(VIO_D9), \ GPIO_FN(PORT139_KEYOUT9), \ GPIO_FN(VIO2_D1), \ GPIO_FN(LCD2D7), GPIO_FN(VIO_D10), \ GPIO_FN(TPU0TO2), \ GPIO_FN(VIO2_D2), \ GPIO_FN(LCD2D8), GPIO_FN(VIO_D11), \ GPIO_FN(TPU0TO3), \ GPIO_FN(VIO2_D3), \ GPIO_FN(LCD2D9), GPIO_FN(VIO_D12), \ GPIO_FN(PORT142_KEYOUT10), \ GPIO_FN(VIO2_D4), \ GPIO_FN(LCD2D2), GPIO_FN(VIO_D13), \ GPIO_FN(PORT143_KEYOUT11), \ GPIO_FN(PORT143_KEYOUT6), \ GPIO_FN(VIO2_D5), \ GPIO_FN(LCD2D3), GPIO_FN(VIO_D14), \ GPIO_FN(PORT144_KEYOUT7), \ GPIO_FN(VIO2_D6), \ GPIO_FN(LCD2D4), GPIO_FN(VIO_D15), \ GPIO_FN(TPU1TO3), \ GPIO_FN(PORT145_LCD2DISP), \ GPIO_FN(PORT145_LCD2RS), \ GPIO_FN(VIO2_D7), \ GPIO_FN(LCD2D5), GPIO_FN(VIO_CLK), \ GPIO_FN(LCD2DCK), \ GPIO_FN(PORT146_LCD2WR_), \ GPIO_FN(VIO2_CLK), \ GPIO_FN(LCD2D18), GPIO_FN(VIO_FIELD), \ GPIO_FN(LCD2RD_), \ GPIO_FN(VIO2_FIELD), \ GPIO_FN(LCD2D19), GPIO_FN(VIO_CKO), GPIO_FN(A27), \ GPIO_FN(PORT149_RDWR), \ GPIO_FN(MFG0_IN1), \ GPIO_FN(PORT149_KEYOUT9), GPIO_FN(MFG0_IN2), GPIO_FN(TS_SPSYNC3), \ GPIO_FN(MSIOF2_RSCK), GPIO_FN(TS_SDAT3), \ GPIO_FN(MSIOF2_RSYNC), GPIO_FN(TPU1TO2), \ GPIO_FN(TS_SDEN3), \ GPIO_FN(PORT153_MSIOF2_SS1), GPIO_FN(SCIFA2_TXD1), \ GPIO_FN(MSIOF2_MCK0), GPIO_FN(SCIFA2_RXD1), \ GPIO_FN(MSIOF2_MCK1), GPIO_FN(SCIFA2_RTS1_), \ GPIO_FN(PORT156_MSIOF2_SS2), GPIO_FN(SCIFA2_CTS1_), \ GPIO_FN(PORT157_MSIOF2_RXD), GPIO_FN(DINT_), \ GPIO_FN(SCIFA2_SCK1), \ GPIO_FN(TS_SCK3), GPIO_FN(PORT159_SCIFB_SCK), \ GPIO_FN(PORT159_SCIFA5_SCK), \ GPIO_FN(NMI), GPIO_FN(PORT160_SCIFB_TXD), \ GPIO_FN(PORT160_SCIFA5_TXD), GPIO_FN(PORT161_SCIFB_CTS_), \ GPIO_FN(PORT161_SCIFA5_CTS_), GPIO_FN(PORT162_SCIFB_RXD), \ GPIO_FN(PORT162_SCIFA5_RXD), GPIO_FN(PORT163_SCIFB_RTS_), \ GPIO_FN(PORT163_SCIFA5_RTS_), \ GPIO_FN(TPU3TO0), GPIO_FN(LCDD0), GPIO_FN(LCDD1), \ GPIO_FN(PORT193_SCIFA5_CTS_), \ GPIO_FN(BBIF2_TSYNC1), GPIO_FN(LCDD2), \ GPIO_FN(PORT194_SCIFA5_RTS_), \ GPIO_FN(BBIF2_TSCK1), GPIO_FN(LCDD3), \ GPIO_FN(PORT195_SCIFA5_RXD), \ GPIO_FN(BBIF2_TXD1), GPIO_FN(LCDD4), \ GPIO_FN(PORT196_SCIFA5_TXD), GPIO_FN(LCDD5), \ GPIO_FN(PORT197_SCIFA5_SCK), \ GPIO_FN(MFG2_OUT2), \ GPIO_FN(TPU2TO1), GPIO_FN(LCDD6), GPIO_FN(LCDD7), \ GPIO_FN(TPU4TO1), \ GPIO_FN(MFG4_OUT2), GPIO_FN(LCDD8), \ GPIO_FN(D16), GPIO_FN(LCDD9), \ GPIO_FN(D17), GPIO_FN(LCDD10), \ GPIO_FN(D18), GPIO_FN(LCDD11), \ GPIO_FN(D19), GPIO_FN(LCDD12), \ GPIO_FN(D20), GPIO_FN(LCDD13), \ GPIO_FN(D21), GPIO_FN(LCDD14), \ GPIO_FN(D22), GPIO_FN(LCDD15), \ GPIO_FN(PORT207_MSIOF0L_SS1), \ GPIO_FN(D23), GPIO_FN(LCDD16), \ GPIO_FN(PORT208_MSIOF0L_SS2), \ GPIO_FN(D24), GPIO_FN(LCDD17), \ GPIO_FN(D25), GPIO_FN(LCDD18), \ GPIO_FN(DREQ2), \ GPIO_FN(PORT210_MSIOF0L_SS1), \ GPIO_FN(D26), GPIO_FN(LCDD19), \ GPIO_FN(PORT211_MSIOF0L_SS2), \ GPIO_FN(D27), GPIO_FN(LCDD20), \ GPIO_FN(TS_SPSYNC1), \ GPIO_FN(MSIOF0L_MCK0), \ GPIO_FN(D28), GPIO_FN(LCDD21), \ GPIO_FN(TS_SDAT1), \ GPIO_FN(MSIOF0L_MCK1), \ GPIO_FN(D29), GPIO_FN(LCDD22), \ GPIO_FN(TS_SDEN1), \ GPIO_FN(MSIOF0L_RSCK), \ GPIO_FN(D30), GPIO_FN(LCDD23), \ GPIO_FN(TS_SCK1), \ GPIO_FN(MSIOF0L_RSYNC), \ GPIO_FN(D31), GPIO_FN(LCDDCK), \ GPIO_FN(LCDWR_), GPIO_FN(LCDRD_), \ GPIO_FN(DACK2), \ GPIO_FN(PORT217_LCD2RS), \ GPIO_FN(MSIOF0L_TSYNC), \ GPIO_FN(VIO2_FIELD3), \ GPIO_FN(PORT217_LCD2DISP), GPIO_FN(LCDHSYN), \ GPIO_FN(LCDCS_), \ GPIO_FN(LCDCS2_), \ GPIO_FN(DACK3), \ GPIO_FN(PORT218_VIO_CKOR), GPIO_FN(LCDDISP), \ GPIO_FN(LCDRS), \ GPIO_FN(PORT219_LCD2WR_), \ GPIO_FN(DREQ3), \ GPIO_FN(MSIOF0L_TSCK), \ GPIO_FN(VIO2_CLK3), \ GPIO_FN(LCD2DCK_2), GPIO_FN(LCDVSYN), \ GPIO_FN(LCDVSYN2), GPIO_FN(LCDLCLK), \ GPIO_FN(DREQ1), \ GPIO_FN(PORT221_LCD2CS_), \ GPIO_FN(PWEN), \ GPIO_FN(MSIOF0L_RXD), \ GPIO_FN(VIO2_HD3), \ GPIO_FN(PORT221_LCD2HSYN), GPIO_FN(LCDDON), \ GPIO_FN(LCDDON2), \ GPIO_FN(DACK1), \ GPIO_FN(OVCN), \ GPIO_FN(MSIOF0L_TXD), \ GPIO_FN(VIO2_VD3), \ GPIO_FN(PORT222_LCD2VSYN), GPIO_FN(SCIFA1_TXD), \ GPIO_FN(OVCN2), GPIO_FN(EXTLP), \ GPIO_FN(SCIFA1_SCK), \ GPIO_FN(PORT226_VIO_CKO2), GPIO_FN(SCIFA1_RTS_), \ GPIO_FN(IDIN), GPIO_FN(SCIFA1_RXD), GPIO_FN(SCIFA1_CTS_), \ GPIO_FN(MFG1_IN1), GPIO_FN(MSIOF1_TXD), \ GPIO_FN(SCIFA2_TXD2), GPIO_FN(MSIOF1_TSYNC), \ GPIO_FN(SCIFA2_CTS2_), GPIO_FN(MSIOF1_TSCK), \ GPIO_FN(SCIFA2_SCK2), GPIO_FN(MSIOF1_RXD), \ GPIO_FN(SCIFA2_RXD2), GPIO_FN(MSIOF1_RSCK), \ GPIO_FN(SCIFA2_RTS2_), \ GPIO_FN(VIO2_CLK2), \ GPIO_FN(LCD2D20), GPIO_FN(MSIOF1_RSYNC), \ GPIO_FN(MFG1_IN2), \ GPIO_FN(VIO2_VD2), \ GPIO_FN(LCD2D21), GPIO_FN(MSIOF1_MCK0), \ GPIO_FN(PORT236_I2C_SDA2), GPIO_FN(MSIOF1_MCK1), \ GPIO_FN(PORT237_I2C_SCL2), GPIO_FN(MSIOF1_SS1), \ GPIO_FN(VIO2_FIELD2), \ GPIO_FN(LCD2D22), GPIO_FN(MSIOF1_SS2), \ GPIO_FN(VIO2_HD2), \ GPIO_FN(LCD2D23), GPIO_FN(SCIFA6_TXD), GPIO_FN(PORT241_IRDA_OUT), \ GPIO_FN(PORT241_IROUT), \ GPIO_FN(MFG4_OUT1), \ GPIO_FN(TPU4TO0), GPIO_FN(PORT242_IRDA_IN), \ GPIO_FN(MFG4_IN2), GPIO_FN(PORT243_IRDA_FIRSEL), \ GPIO_FN(PORT243_VIO_CKO2), GPIO_FN(PORT244_SCIFA5_CTS_), \ GPIO_FN(MFG2_IN1), \ GPIO_FN(PORT244_SCIFB_CTS_), \ GPIO_FN(MSIOF2R_RXD), GPIO_FN(PORT245_SCIFA5_RTS_), \ GPIO_FN(MFG2_IN2), \ GPIO_FN(PORT245_SCIFB_RTS_), \ GPIO_FN(MSIOF2R_TXD), GPIO_FN(PORT246_SCIFA5_RXD), \ GPIO_FN(MFG1_OUT1), \ GPIO_FN(PORT246_SCIFB_RXD), \ GPIO_FN(TPU1TO0), GPIO_FN(PORT247_SCIFA5_TXD), \ GPIO_FN(MFG3_OUT2), \ GPIO_FN(PORT247_SCIFB_TXD), \ GPIO_FN(TPU3TO1), GPIO_FN(PORT248_SCIFA5_SCK), \ GPIO_FN(MFG2_OUT1), \ GPIO_FN(PORT248_SCIFB_SCK), \ GPIO_FN(TPU2TO0), \ GPIO_FN(PORT248_I2C_SCL3), \ GPIO_FN(MSIOF2R_TSCK), GPIO_FN(PORT249_IROUT), \ GPIO_FN(MFG4_IN1), \ GPIO_FN(PORT249_I2C_SDA3), \ GPIO_FN(MSIOF2R_TSYNC), GPIO_FN(SDHICLK0), GPIO_FN(SDHICD0), GPIO_FN(SDHID0_0), GPIO_FN(SDHID0_1), GPIO_FN(SDHID0_2), GPIO_FN(SDHID0_3), GPIO_FN(SDHICMD0), GPIO_FN(SDHIWP0), GPIO_FN(SDHICLK1), GPIO_FN(SDHID1_0), \ GPIO_FN(TS_SPSYNC2), GPIO_FN(SDHID1_1), \ GPIO_FN(TS_SDAT2), GPIO_FN(SDHID1_2), \ GPIO_FN(TS_SDEN2), GPIO_FN(SDHID1_3), \ GPIO_FN(TS_SCK2), GPIO_FN(SDHICMD1), GPIO_FN(SDHICLK2), GPIO_FN(SDHID2_0), \ GPIO_FN(TS_SPSYNC4), GPIO_FN(SDHID2_1), \ GPIO_FN(TS_SDAT4), GPIO_FN(SDHID2_2), \ GPIO_FN(TS_SDEN4), GPIO_FN(SDHID2_3), \ GPIO_FN(TS_SCK4), GPIO_FN(SDHICMD2), GPIO_FN(MMCCLK0), GPIO_FN(MMCD0_0), GPIO_FN(MMCD0_1), GPIO_FN(MMCD0_2), GPIO_FN(MMCD0_3), GPIO_FN(MMCD0_4), \ GPIO_FN(TS_SPSYNC5), GPIO_FN(MMCD0_5), \ GPIO_FN(TS_SDAT5), GPIO_FN(MMCD0_6), \ GPIO_FN(TS_SDEN5), GPIO_FN(MMCD0_7), \ GPIO_FN(TS_SCK5), GPIO_FN(MMCCMD0), GPIO_FN(RESETOUTS_), \ GPIO_FN(EXTAL2OUT), GPIO_FN(MCP_WAIT__MCP_FRB), GPIO_FN(MCP_CKO), \ GPIO_FN(MMCCLK1), GPIO_FN(MCP_D15_MCP_NAF15), GPIO_FN(MCP_D14_MCP_NAF14), GPIO_FN(MCP_D13_MCP_NAF13), GPIO_FN(MCP_D12_MCP_NAF12), GPIO_FN(MCP_D11_MCP_NAF11), GPIO_FN(MCP_D10_MCP_NAF10), GPIO_FN(MCP_D9_MCP_NAF9), GPIO_FN(MCP_D8_MCP_NAF8), \ GPIO_FN(MMCCMD1), GPIO_FN(MCP_D7_MCP_NAF7), \ GPIO_FN(MMCD1_7), GPIO_FN(MCP_D6_MCP_NAF6), \ GPIO_FN(MMCD1_6), GPIO_FN(MCP_D5_MCP_NAF5), \ GPIO_FN(MMCD1_5), GPIO_FN(MCP_D4_MCP_NAF4), \ GPIO_FN(MMCD1_4), GPIO_FN(MCP_D3_MCP_NAF3), \ GPIO_FN(MMCD1_3), GPIO_FN(MCP_D2_MCP_NAF2), \ GPIO_FN(MMCD1_2), GPIO_FN(MCP_D1_MCP_NAF1), \ GPIO_FN(MMCD1_1), GPIO_FN(MCP_D0_MCP_NAF0), \ GPIO_FN(MMCD1_0), GPIO_FN(MCP_NBRSTOUT_), GPIO_FN(MCP_WE0__MCP_FWE), \ GPIO_FN(MCP_RDWR_MCP_FWE), GPIO_FN(TSIF2_TS_XX1), GPIO_FN(TSIF2_TS_XX2), GPIO_FN(TSIF2_TS_XX3), GPIO_FN(TSIF2_TS_XX4), GPIO_FN(TSIF2_TS_XX5), GPIO_FN(TSIF1_TS_XX1), GPIO_FN(TSIF1_TS_XX2), GPIO_FN(TSIF1_TS_XX3), GPIO_FN(TSIF1_TS_XX4), GPIO_FN(TSIF1_TS_XX5), GPIO_FN(TSIF0_TS_XX1), GPIO_FN(TSIF0_TS_XX2), GPIO_FN(TSIF0_TS_XX3), GPIO_FN(TSIF0_TS_XX4), GPIO_FN(TSIF0_TS_XX5), GPIO_FN(MST1_TS_XX1), GPIO_FN(MST1_TS_XX2), GPIO_FN(MST1_TS_XX3), GPIO_FN(MST1_TS_XX4), GPIO_FN(MST1_TS_XX5), GPIO_FN(MST0_TS_XX1), GPIO_FN(MST0_TS_XX2), GPIO_FN(MST0_TS_XX3), GPIO_FN(MST0_TS_XX4), GPIO_FN(MST0_TS_XX5), GPIO_FN(SDHI0_VCCQ_MC0_ON), GPIO_FN(SDHI0_VCCQ_MC0_OFF), GPIO_FN(DEBUG_MON_VIO), GPIO_FN(DEBUG_MON_LCDD), GPIO_FN(LCDC_LCDC0), GPIO_FN(LCDC_LCDC1), GPIO_FN(IRQ9_MEM_INT), GPIO_FN(IRQ9_MCP_INT), GPIO_FN(A11), GPIO_FN(KEYOUT8), GPIO_FN(TPU4TO3), GPIO_FN(RESETA_N_PU_ON), GPIO_FN(RESETA_N_PU_OFF), GPIO_FN(EDBGREQ_PD), GPIO_FN(EDBGREQ_PU), GPIO_FN(KEYIN0_PU), GPIO_FN(KEYIN1_PU), GPIO_FN(KEYIN2_PU), GPIO_FN(KEYIN3_PU), GPIO_FN(KEYIN4_PU), GPIO_FN(KEYIN5_PU), GPIO_FN(KEYIN6_PU), GPIO_FN(KEYIN7_PU), GPIO_FN(SDHICD0_PU), GPIO_FN(SDHID0_0_PU), GPIO_FN(SDHID0_1_PU), GPIO_FN(SDHID0_2_PU), GPIO_FN(SDHID0_3_PU), GPIO_FN(SDHICMD0_PU), GPIO_FN(SDHIWP0_PU), GPIO_FN(SDHID1_0_PU), GPIO_FN(SDHID1_1_PU), GPIO_FN(SDHID1_2_PU), GPIO_FN(SDHID1_3_PU), GPIO_FN(SDHICMD1_PU), GPIO_FN(SDHID2_0_PU), GPIO_FN(SDHID2_1_PU), GPIO_FN(SDHID2_2_PU), GPIO_FN(SDHID2_3_PU), GPIO_FN(SDHICMD2_PU), GPIO_FN(MMCCMD0_PU), GPIO_FN(MMCCMD1_PU), GPIO_FN(MMCD0_0_PU), GPIO_FN(MMCD0_1_PU), GPIO_FN(MMCD0_2_PU), GPIO_FN(MMCD0_3_PU), GPIO_FN(MMCD0_4_PU), GPIO_FN(MMCD0_5_PU), GPIO_FN(MMCD0_6_PU), GPIO_FN(MMCD0_7_PU), GPIO_FN(FSIACK_PU), GPIO_FN(FSIAILR_PU), GPIO_FN(FSIAIBT_PU), GPIO_FN(FSIAISLD_PU), }; static struct pinmux_cfg_reg pinmux_config_regs[] = { PORTCR(0, 0xe6050000), PORTCR(1, 0xe6050001), PORTCR(2, 0xe6050002), PORTCR(3, 0xe6050003), PORTCR(4, 0xe6050004), PORTCR(5, 0xe6050005), PORTCR(6, 0xe6050006), PORTCR(7, 0xe6050007), PORTCR(8, 0xe6050008), PORTCR(9, 0xe6050009), PORTCR(10, 0xe605000a), PORTCR(11, 0xe605000b), PORTCR(12, 0xe605000c), PORTCR(13, 0xe605000d), PORTCR(14, 0xe605000e), PORTCR(15, 0xe605000f), PORTCR(16, 0xe6050010), PORTCR(17, 0xe6050011), PORTCR(18, 0xe6050012), PORTCR(19, 0xe6050013), PORTCR(20, 0xe6050014), PORTCR(21, 0xe6050015), PORTCR(22, 0xe6050016), PORTCR(23, 0xe6050017), PORTCR(24, 0xe6050018), PORTCR(25, 0xe6050019), PORTCR(26, 0xe605001a), PORTCR(27, 0xe605001b), PORTCR(28, 0xe605001c), PORTCR(29, 0xe605001d), PORTCR(30, 0xe605001e), PORTCR(31, 0xe605001f), PORTCR(32, 0xe6051020), PORTCR(33, 0xe6051021), PORTCR(34, 0xe6051022), PORTCR(35, 0xe6051023), PORTCR(36, 0xe6051024), PORTCR(37, 0xe6051025), PORTCR(38, 0xe6051026), PORTCR(39, 0xe6051027), PORTCR(40, 0xe6051028), PORTCR(41, 0xe6051029), PORTCR(42, 0xe605102a), PORTCR(43, 0xe605102b), PORTCR(44, 0xe605102c), PORTCR(45, 0xe605102d), PORTCR(46, 0xe605102e), PORTCR(47, 0xe605102f), PORTCR(48, 0xe6051030), PORTCR(49, 0xe6051031), PORTCR(50, 0xe6051032), PORTCR(51, 0xe6051033), PORTCR(52, 0xe6051034), PORTCR(53, 0xe6051035), PORTCR(54, 0xe6051036), PORTCR(55, 0xe6051037), PORTCR(56, 0xe6051038), PORTCR(57, 0xe6051039), PORTCR(58, 0xe605103a), PORTCR(59, 0xe605103b), PORTCR(60, 0xe605103c), PORTCR(61, 0xe605103d), PORTCR(62, 0xe605103e), PORTCR(63, 0xe605103f), PORTCR(64, 0xe6051040), PORTCR(65, 0xe6051041), PORTCR(66, 0xe6051042), PORTCR(67, 0xe6051043), PORTCR(68, 0xe6051044), PORTCR(69, 0xe6051045), PORTCR(70, 0xe6051046), PORTCR(71, 0xe6051047), PORTCR(72, 0xe6051048), PORTCR(73, 0xe6051049), PORTCR(74, 0xe605104a), PORTCR(75, 0xe605104b), PORTCR(76, 0xe605104c), PORTCR(77, 0xe605104d), PORTCR(78, 0xe605104e), PORTCR(79, 0xe605104f), PORTCR(80, 0xe6051050), PORTCR(81, 0xe6051051), PORTCR(82, 0xe6051052), PORTCR(83, 0xe6051053), PORTCR(84, 0xe6051054), PORTCR(85, 0xe6051055), PORTCR(86, 0xe6051056), PORTCR(87, 0xe6051057), PORTCR(88, 0xe6051058), PORTCR(89, 0xe6051059), PORTCR(90, 0xe605105a), PORTCR(91, 0xe605105b), PORTCR(92, 0xe605105c), PORTCR(93, 0xe605105d), PORTCR(94, 0xe605105e), PORTCR(95, 0xe605105f), PORTCR(96, 0xe6052060), PORTCR(97, 0xe6052061), PORTCR(98, 0xe6052062), PORTCR(99, 0xe6052063), PORTCR(100, 0xe6052064), PORTCR(101, 0xe6052065), PORTCR(102, 0xe6052066), PORTCR(103, 0xe6052067), PORTCR(104, 0xe6052068), PORTCR(105, 0xe6052069), PORTCR(106, 0xe605206a), PORTCR(107, 0xe605206b), PORTCR(108, 0xe605206c), PORTCR(109, 0xe605206d), PORTCR(110, 0xe605206e), PORTCR(111, 0xe605206f), PORTCR(112, 0xe6052070), PORTCR(113, 0xe6052071), PORTCR(114, 0xe6052072), PORTCR(115, 0xe6052073), PORTCR(116, 0xe6052074), PORTCR(117, 0xe6052075), PORTCR(118, 0xe6052076), PORTCR(128, 0xe6052080), PORTCR(129, 0xe6052081), PORTCR(130, 0xe6052082), PORTCR(131, 0xe6052083), PORTCR(132, 0xe6052084), PORTCR(133, 0xe6052085), PORTCR(134, 0xe6052086), PORTCR(135, 0xe6052087), PORTCR(136, 0xe6052088), PORTCR(137, 0xe6052089), PORTCR(138, 0xe605208a), PORTCR(139, 0xe605208b), PORTCR(140, 0xe605208c), PORTCR(141, 0xe605208d), PORTCR(142, 0xe605208e), PORTCR(143, 0xe605208f), PORTCR(144, 0xe6052090), PORTCR(145, 0xe6052091), PORTCR(146, 0xe6052092), PORTCR(147, 0xe6052093), PORTCR(148, 0xe6052094), PORTCR(149, 0xe6052095), PORTCR(150, 0xe6052096), PORTCR(151, 0xe6052097), PORTCR(152, 0xe6052098), PORTCR(153, 0xe6052099), PORTCR(154, 0xe605209a), PORTCR(155, 0xe605209b), PORTCR(156, 0xe605209c), PORTCR(157, 0xe605209d), PORTCR(158, 0xe605209e), PORTCR(159, 0xe605209f), PORTCR(160, 0xe60520a0), PORTCR(161, 0xe60520a1), PORTCR(162, 0xe60520a2), PORTCR(163, 0xe60520a3), PORTCR(164, 0xe60520a4), PORTCR(192, 0xe60520c0), PORTCR(193, 0xe60520c1), PORTCR(194, 0xe60520c2), PORTCR(195, 0xe60520c3), PORTCR(196, 0xe60520c4), PORTCR(197, 0xe60520c5), PORTCR(198, 0xe60520c6), PORTCR(199, 0xe60520c7), PORTCR(200, 0xe60520c8), PORTCR(201, 0xe60520c9), PORTCR(202, 0xe60520ca), PORTCR(203, 0xe60520cb), PORTCR(204, 0xe60520cc), PORTCR(205, 0xe60520cd), PORTCR(206, 0xe60520ce), PORTCR(207, 0xe60520cf), PORTCR(208, 0xe60520d0), PORTCR(209, 0xe60520d1), PORTCR(210, 0xe60520d2), PORTCR(211, 0xe60520d3), PORTCR(212, 0xe60520d4), PORTCR(213, 0xe60520d5), PORTCR(214, 0xe60520d6), PORTCR(215, 0xe60520d7), PORTCR(216, 0xe60520d8), PORTCR(217, 0xe60520d9), PORTCR(218, 0xe60520da), PORTCR(219, 0xe60520db), PORTCR(220, 0xe60520dc), PORTCR(221, 0xe60520dd), PORTCR(222, 0xe60520de), PORTCR(223, 0xe60520df), PORTCR(224, 0xe60530e0), PORTCR(225, 0xe60530e1), PORTCR(226, 0xe60530e2), PORTCR(227, 0xe60530e3), PORTCR(228, 0xe60530e4), PORTCR(229, 0xe60530e5), PORTCR(230, 0xe60530e6), PORTCR(231, 0xe60530e7), PORTCR(232, 0xe60530e8), PORTCR(233, 0xe60530e9), PORTCR(234, 0xe60530ea), PORTCR(235, 0xe60530eb), PORTCR(236, 0xe60530ec), PORTCR(237, 0xe60530ed), PORTCR(238, 0xe60530ee), PORTCR(239, 0xe60530ef), PORTCR(240, 0xe60530f0), PORTCR(241, 0xe60530f1), PORTCR(242, 0xe60530f2), PORTCR(243, 0xe60530f3), PORTCR(244, 0xe60530f4), PORTCR(245, 0xe60530f5), PORTCR(246, 0xe60530f6), PORTCR(247, 0xe60530f7), PORTCR(248, 0xe60530f8), PORTCR(249, 0xe60530f9), PORTCR(250, 0xe60530fa), PORTCR(251, 0xe60530fb), PORTCR(252, 0xe60530fc), PORTCR(253, 0xe60530fd), PORTCR(254, 0xe60530fe), PORTCR(255, 0xe60530ff), PORTCR(256, 0xe6053100), PORTCR(257, 0xe6053101), PORTCR(258, 0xe6053102), PORTCR(259, 0xe6053103), PORTCR(260, 0xe6053104), PORTCR(261, 0xe6053105), PORTCR(262, 0xe6053106), PORTCR(263, 0xe6053107), PORTCR(264, 0xe6053108), PORTCR(265, 0xe6053109), PORTCR(266, 0xe605310a), PORTCR(267, 0xe605310b), PORTCR(268, 0xe605310c), PORTCR(269, 0xe605310d), PORTCR(270, 0xe605310e), PORTCR(271, 0xe605310f), PORTCR(272, 0xe6053110), PORTCR(273, 0xe6053111), PORTCR(274, 0xe6053112), PORTCR(275, 0xe6053113), PORTCR(276, 0xe6053114), PORTCR(277, 0xe6053115), PORTCR(278, 0xe6053116), PORTCR(279, 0xe6053117), PORTCR(280, 0xe6053118), PORTCR(281, 0xe6053119), PORTCR(282, 0xe605311a), PORTCR(288, 0xe6052120), PORTCR(289, 0xe6052121), PORTCR(290, 0xe6052122), PORTCR(291, 0xe6052123), PORTCR(292, 0xe6052124), PORTCR(293, 0xe6052125), PORTCR(294, 0xe6052126), PORTCR(295, 0xe6052127), PORTCR(296, 0xe6052128), PORTCR(297, 0xe6052129), PORTCR(298, 0xe605212a), PORTCR(299, 0xe605212b), PORTCR(300, 0xe605212c), PORTCR(301, 0xe605212d), PORTCR(302, 0xe605212e), PORTCR(303, 0xe605212f), PORTCR(304, 0xe6052130), PORTCR(305, 0xe6052131), PORTCR(306, 0xe6052132), PORTCR(307, 0xe6052133), PORTCR(308, 0xe6052134), PORTCR(309, 0xe6052135), { PINMUX_CFG_REG("MSEL2CR", 0xe605801c, 32, 1) { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, MSEL2CR_MSEL19_0, MSEL2CR_MSEL19_1, MSEL2CR_MSEL18_0, MSEL2CR_MSEL18_1, MSEL2CR_MSEL17_0, MSEL2CR_MSEL17_1, MSEL2CR_MSEL16_0, MSEL2CR_MSEL16_1, 0, 0, MSEL2CR_MSEL14_0, MSEL2CR_MSEL14_1, MSEL2CR_MSEL13_0, MSEL2CR_MSEL13_1, MSEL2CR_MSEL12_0, MSEL2CR_MSEL12_1, MSEL2CR_MSEL11_0, MSEL2CR_MSEL11_1, MSEL2CR_MSEL10_0, MSEL2CR_MSEL10_1, MSEL2CR_MSEL9_0, MSEL2CR_MSEL9_1, MSEL2CR_MSEL8_0, MSEL2CR_MSEL8_1, MSEL2CR_MSEL7_0, MSEL2CR_MSEL7_1, MSEL2CR_MSEL6_0, MSEL2CR_MSEL6_1, MSEL2CR_MSEL5_0, MSEL2CR_MSEL5_1, MSEL2CR_MSEL4_0, MSEL2CR_MSEL4_1, MSEL2CR_MSEL3_0, MSEL2CR_MSEL3_1, MSEL2CR_MSEL2_0, MSEL2CR_MSEL2_1, MSEL2CR_MSEL1_0, MSEL2CR_MSEL1_1, MSEL2CR_MSEL0_0, MSEL2CR_MSEL0_1, } }, { PINMUX_CFG_REG("MSEL3CR", 0xe6058020, 32, 1) { 0, 0, 0, 0, 0, 0, MSEL3CR_MSEL28_0, MSEL3CR_MSEL28_1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, MSEL3CR_MSEL15_0, MSEL3CR_MSEL15_1, 0, 0, 0, 0, 0, 0, MSEL3CR_MSEL11_0, MSEL3CR_MSEL11_1, 0, 0, MSEL3CR_MSEL9_0, MSEL3CR_MSEL9_1, 0, 0, 0, 0, MSEL3CR_MSEL6_0, MSEL3CR_MSEL6_1, 0, 0, 0, 0, 0, 0, MSEL3CR_MSEL2_0, MSEL3CR_MSEL2_1, 0, 0, 0, 0, } }, { PINMUX_CFG_REG("MSEL4CR", 0xe6058024, 32, 1) { 0, 0, 0, 0, MSEL4CR_MSEL29_0, MSEL4CR_MSEL29_1, 0, 0, MSEL4CR_MSEL27_0, MSEL4CR_MSEL27_1, MSEL4CR_MSEL26_0, MSEL4CR_MSEL26_1, 0, 0, 0, 0, 0, 0, MSEL4CR_MSEL22_0, MSEL4CR_MSEL22_1, MSEL4CR_MSEL21_0, MSEL4CR_MSEL21_1, MSEL4CR_MSEL20_0, MSEL4CR_MSEL20_1, MSEL4CR_MSEL19_0, MSEL4CR_MSEL19_1, 0, 0, 0, 0, 0, 0, MSEL4CR_MSEL15_0, MSEL4CR_MSEL15_1, 0, 0, MSEL4CR_MSEL13_0, MSEL4CR_MSEL13_1, MSEL4CR_MSEL12_0, MSEL4CR_MSEL12_1, MSEL4CR_MSEL11_0, MSEL4CR_MSEL11_1, MSEL4CR_MSEL10_0, MSEL4CR_MSEL10_1, MSEL4CR_MSEL9_0, MSEL4CR_MSEL9_1, MSEL4CR_MSEL8_0, MSEL4CR_MSEL8_1, MSEL4CR_MSEL7_0, MSEL4CR_MSEL7_1, 0, 0, 0, 0, MSEL4CR_MSEL4_0, MSEL4CR_MSEL4_1, 0, 0, 0, 0, MSEL4CR_MSEL1_0, MSEL4CR_MSEL1_1, 0, 0, } }, { }, }; static struct pinmux_data_reg pinmux_data_regs[] = { { PINMUX_DATA_REG("PORTL031_000DR", 0xe6054000, 32) { PORT31_DATA, PORT30_DATA, PORT29_DATA, PORT28_DATA, PORT27_DATA, PORT26_DATA, PORT25_DATA, PORT24_DATA, PORT23_DATA, PORT22_DATA, PORT21_DATA, PORT20_DATA, PORT19_DATA, PORT18_DATA, PORT17_DATA, PORT16_DATA, PORT15_DATA, PORT14_DATA, PORT13_DATA, PORT12_DATA, PORT11_DATA, PORT10_DATA, PORT9_DATA, PORT8_DATA, PORT7_DATA, PORT6_DATA, PORT5_DATA, PORT4_DATA, PORT3_DATA, PORT2_DATA, PORT1_DATA, PORT0_DATA } }, { PINMUX_DATA_REG("PORTD063_032DR", 0xe6055000, 32) { PORT63_DATA, PORT62_DATA, PORT61_DATA, PORT60_DATA, PORT59_DATA, PORT58_DATA, PORT57_DATA, PORT56_DATA, PORT55_DATA, PORT54_DATA, PORT53_DATA, PORT52_DATA, PORT51_DATA, PORT50_DATA, PORT49_DATA, PORT48_DATA, PORT47_DATA, PORT46_DATA, PORT45_DATA, PORT44_DATA, PORT43_DATA, PORT42_DATA, PORT41_DATA, PORT40_DATA, PORT39_DATA, PORT38_DATA, PORT37_DATA, PORT36_DATA, PORT35_DATA, PORT34_DATA, PORT33_DATA, PORT32_DATA } }, { PINMUX_DATA_REG("PORTD095_064DR", 0xe6055004, 32) { PORT95_DATA, PORT94_DATA, PORT93_DATA, PORT92_DATA, PORT91_DATA, PORT90_DATA, PORT89_DATA, PORT88_DATA, PORT87_DATA, PORT86_DATA, PORT85_DATA, PORT84_DATA, PORT83_DATA, PORT82_DATA, PORT81_DATA, PORT80_DATA, PORT79_DATA, PORT78_DATA, PORT77_DATA, PORT76_DATA, PORT75_DATA, PORT74_DATA, PORT73_DATA, PORT72_DATA, PORT71_DATA, PORT70_DATA, PORT69_DATA, PORT68_DATA, PORT67_DATA, PORT66_DATA, PORT65_DATA, PORT64_DATA } }, { PINMUX_DATA_REG("PORTR127_096DR", 0xe6056000, 32) { 0, 0, 0, 0, 0, 0, 0, 0, 0, PORT118_DATA, PORT117_DATA, PORT116_DATA, PORT115_DATA, PORT114_DATA, PORT113_DATA, PORT112_DATA, PORT111_DATA, PORT110_DATA, PORT109_DATA, PORT108_DATA, PORT107_DATA, PORT106_DATA, PORT105_DATA, PORT104_DATA, PORT103_DATA, PORT102_DATA, PORT101_DATA, PORT100_DATA, PORT99_DATA, PORT98_DATA, PORT97_DATA, PORT96_DATA } }, { PINMUX_DATA_REG("PORTR159_128DR", 0xe6056004, 32) { PORT159_DATA, PORT158_DATA, PORT157_DATA, PORT156_DATA, PORT155_DATA, PORT154_DATA, PORT153_DATA, PORT152_DATA, PORT151_DATA, PORT150_DATA, PORT149_DATA, PORT148_DATA, PORT147_DATA, PORT146_DATA, PORT145_DATA, PORT144_DATA, PORT143_DATA, PORT142_DATA, PORT141_DATA, PORT140_DATA, PORT139_DATA, PORT138_DATA, PORT137_DATA, PORT136_DATA, PORT135_DATA, PORT134_DATA, PORT133_DATA, PORT132_DATA, PORT131_DATA, PORT130_DATA, PORT129_DATA, PORT128_DATA } }, { PINMUX_DATA_REG("PORTR191_160DR", 0xe6056008, 32) { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, PORT164_DATA, PORT163_DATA, PORT162_DATA, PORT161_DATA, PORT160_DATA } }, { PINMUX_DATA_REG("PORTR223_192DR", 0xe605600C, 32) { PORT223_DATA, PORT222_DATA, PORT221_DATA, PORT220_DATA, PORT219_DATA, PORT218_DATA, PORT217_DATA, PORT216_DATA, PORT215_DATA, PORT214_DATA, PORT213_DATA, PORT212_DATA, PORT211_DATA, PORT210_DATA, PORT209_DATA, PORT208_DATA, PORT207_DATA, PORT206_DATA, PORT205_DATA, PORT204_DATA, PORT203_DATA, PORT202_DATA, PORT201_DATA, PORT200_DATA, PORT199_DATA, PORT198_DATA, PORT197_DATA, PORT196_DATA, PORT195_DATA, PORT194_DATA, PORT193_DATA, PORT192_DATA } }, { PINMUX_DATA_REG("PORTU255_224DR", 0xe6057000, 32) { PORT255_DATA, PORT254_DATA, PORT253_DATA, PORT252_DATA, PORT251_DATA, PORT250_DATA, PORT249_DATA, PORT248_DATA, PORT247_DATA, PORT246_DATA, PORT245_DATA, PORT244_DATA, PORT243_DATA, PORT242_DATA, PORT241_DATA, PORT240_DATA, PORT239_DATA, PORT238_DATA, PORT237_DATA, PORT236_DATA, PORT235_DATA, PORT234_DATA, PORT233_DATA, PORT232_DATA, PORT231_DATA, PORT230_DATA, PORT229_DATA, PORT228_DATA, PORT227_DATA, PORT226_DATA, PORT225_DATA, PORT224_DATA } }, { PINMUX_DATA_REG("PORTU287_256DR", 0xe6057004, 32) { 0, 0, 0, 0, 0, PORT282_DATA, PORT281_DATA, PORT280_DATA, PORT279_DATA, PORT278_DATA, PORT277_DATA, PORT276_DATA, PORT275_DATA, PORT274_DATA, PORT273_DATA, PORT272_DATA, PORT271_DATA, PORT270_DATA, PORT269_DATA, PORT268_DATA, PORT267_DATA, PORT266_DATA, PORT265_DATA, PORT264_DATA, PORT263_DATA, PORT262_DATA, PORT261_DATA, PORT260_DATA, PORT259_DATA, PORT258_DATA, PORT257_DATA, PORT256_DATA } }, { PINMUX_DATA_REG("PORTR319_288DR", 0xe6056010, 32) { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, PORT309_DATA, PORT308_DATA, PORT307_DATA, PORT306_DATA, PORT305_DATA, PORT304_DATA, PORT303_DATA, PORT302_DATA, PORT301_DATA, PORT300_DATA, PORT299_DATA, PORT298_DATA, PORT297_DATA, PORT296_DATA, PORT295_DATA, PORT294_DATA, PORT293_DATA, PORT292_DATA, PORT291_DATA, PORT290_DATA, PORT289_DATA, PORT288_DATA } }, { }, }; #define EXT_IRQ16L(n) intcs_evt2irq(0x200 + ((n) << 5)) #define EXT_IRQ16H(n) intcs_evt2irq(0x3200 + ((n - 16) << 5)) static struct pinmux_irq pinmux_irqs[] = { PINMUX_IRQ(EXT_IRQ16H(19), PORT9_FN0), PINMUX_IRQ(EXT_IRQ16L(1), PORT10_FN0), PINMUX_IRQ(EXT_IRQ16L(0), PORT11_FN0), PINMUX_IRQ(EXT_IRQ16H(18), PORT13_FN0), PINMUX_IRQ(EXT_IRQ16H(20), PORT14_FN0), PINMUX_IRQ(EXT_IRQ16H(21), PORT15_FN0), PINMUX_IRQ(EXT_IRQ16H(31), PORT26_FN0), PINMUX_IRQ(EXT_IRQ16H(30), PORT27_FN0), PINMUX_IRQ(EXT_IRQ16H(29), PORT28_FN0), PINMUX_IRQ(EXT_IRQ16H(22), PORT40_FN0), PINMUX_IRQ(EXT_IRQ16H(23), PORT53_FN0), PINMUX_IRQ(EXT_IRQ16L(10), PORT54_FN0), PINMUX_IRQ(EXT_IRQ16L(9), PORT56_FN0), PINMUX_IRQ(EXT_IRQ16H(26), PORT115_FN0), PINMUX_IRQ(EXT_IRQ16H(27), PORT116_FN0), PINMUX_IRQ(EXT_IRQ16H(28), PORT117_FN0), PINMUX_IRQ(EXT_IRQ16H(24), PORT118_FN0), PINMUX_IRQ(EXT_IRQ16L(6), PORT147_FN0), PINMUX_IRQ(EXT_IRQ16L(2), PORT149_FN0), PINMUX_IRQ(EXT_IRQ16L(7), PORT150_FN0), PINMUX_IRQ(EXT_IRQ16L(12), PORT156_FN0), PINMUX_IRQ(EXT_IRQ16L(4), PORT159_FN0), PINMUX_IRQ(EXT_IRQ16H(25), PORT164_FN0), PINMUX_IRQ(EXT_IRQ16L(8), PORT223_FN0), PINMUX_IRQ(EXT_IRQ16L(3), PORT224_FN0), PINMUX_IRQ(EXT_IRQ16L(5), PORT227_FN0), PINMUX_IRQ(EXT_IRQ16H(17), PORT234_FN0), PINMUX_IRQ(EXT_IRQ16L(11), PORT238_FN0), PINMUX_IRQ(EXT_IRQ16L(13), PORT239_FN0), PINMUX_IRQ(EXT_IRQ16H(16), PORT249_FN0), PINMUX_IRQ(EXT_IRQ16L(14), PORT251_FN0), PINMUX_IRQ(EXT_IRQ16L(9), PORT308_FN0), }; static struct pinmux_info sh73a0_pinmux_info = { .name = "sh73a0_pfc", .reserved_id = PINMUX_RESERVED, .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END }, .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END }, .input_pu = { <API key>, <API key> }, .input_pd = { <API key>, <API key> }, .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END }, .function = { <API key>, PINMUX_FUNCTION_END }, .first_gpio = GPIO_PORT0, .last_gpio = GPIO_FN_FSIAISLD_PU, .gpios = pinmux_gpios, .cfg_regs = pinmux_config_regs, .data_regs = pinmux_data_regs, .gpio_data = pinmux_data, .gpio_data_size = ARRAY_SIZE(pinmux_data), .gpio_irq = pinmux_irqs, .gpio_irq_size = ARRAY_SIZE(pinmux_irqs), }; void sh73a0_pinmux_init(void) { register_pinmux(&sh73a0_pinmux_info); }
#include "common.h" #include <linux/kthread.h> #include <xen/xen.h> #include <xen/events.h> static bool <API key>(struct xenvif_queue *queue) { RING_IDX prod, cons; struct sk_buff *skb; int needed; skb = skb_peek(&queue->rx_queue); if (!skb) return false; needed = DIV_ROUND_UP(skb->len, XEN_PAGE_SIZE); if (skb_is_gso(skb)) needed++; if (skb->sw_hash) needed++; do { prod = queue->rx.sring->req_prod; cons = queue->rx.req_cons; if (prod - cons >= needed) return true; queue->rx.sring->req_event = prod + 1; /* Make sure event is visible before we check prod * again. */ mb(); } while (queue->rx.sring->req_prod != prod); return false; } void <API key>(struct xenvif_queue *queue, struct sk_buff *skb) { unsigned long flags; spin_lock_irqsave(&queue->rx_queue.lock, flags); __skb_queue_tail(&queue->rx_queue, skb); queue->rx_queue_len += skb->len; if (queue->rx_queue_len > queue->rx_queue_max) { struct net_device *dev = queue->vif->dev; netif_tx_stop_queue(netdev_get_tx_queue(dev, queue->id)); } <API key>(&queue->rx_queue.lock, flags); } static struct sk_buff *xenvif_rx_dequeue(struct xenvif_queue *queue) { struct sk_buff *skb; spin_lock_irq(&queue->rx_queue.lock); skb = __skb_dequeue(&queue->rx_queue); if (skb) { queue->rx_queue_len -= skb->len; if (queue->rx_queue_len < queue->rx_queue_max) { struct netdev_queue *txq; txq = netdev_get_tx_queue(queue->vif->dev, queue->id); netif_tx_wake_queue(txq); } } spin_unlock_irq(&queue->rx_queue.lock); return skb; } static void <API key>(struct xenvif_queue *queue) { struct sk_buff *skb; while ((skb = xenvif_rx_dequeue(queue)) != NULL) kfree_skb(skb); } static void <API key>(struct xenvif_queue *queue) { struct sk_buff *skb; for (;;) { skb = skb_peek(&queue->rx_queue); if (!skb) break; if (time_before(jiffies, XENVIF_RX_CB(skb)->expires)) break; xenvif_rx_dequeue(queue); kfree_skb(skb); } } static void <API key>(struct xenvif_queue *queue) { unsigned int i; int notify; gnttab_batch_copy(queue->rx_copy.op, queue->rx_copy.num); for (i = 0; i < queue->rx_copy.num; i++) { struct gnttab_copy *op; op = &queue->rx_copy.op[i]; /* If the copy failed, overwrite the status field in * the corresponding response. */ if (unlikely(op->status != GNTST_okay)) { struct <API key> *rsp; rsp = RING_GET_RESPONSE(&queue->rx, queue->rx_copy.idx[i]); rsp->status = op->status; } } queue->rx_copy.num = 0; /* Push responses for all completed packets. */ <API key>(&queue->rx, notify); if (notify) <API key>(queue->rx_irq); __skb_queue_purge(queue->rx_copy.completed); } static void xenvif_rx_copy_add(struct xenvif_queue *queue, struct <API key> *req, unsigned int offset, void *data, size_t len) { struct gnttab_copy *op; struct page *page; struct xen_page_foreign *foreign; if (queue->rx_copy.num == COPY_BATCH_SIZE) <API key>(queue); op = &queue->rx_copy.op[queue->rx_copy.num]; page = virt_to_page(data); op->flags = GNTCOPY_dest_gref; foreign = xen_page_foreign(page); if (foreign) { op->source.domid = foreign->domid; op->source.u.ref = foreign->gref; op->flags |= GNTCOPY_source_gref; } else { op->source.u.gmfn = virt_to_gfn(data); op->source.domid = DOMID_SELF; } op->source.offset = xen_offset_in_page(data); op->dest.u.ref = req->gref; op->dest.domid = queue->vif->domid; op->dest.offset = offset; op->len = len; queue->rx_copy.idx[queue->rx_copy.num] = queue->rx.req_cons; queue->rx_copy.num++; } static unsigned int xenvif_gso_type(struct sk_buff *skb) { if (skb_is_gso(skb)) { if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) return <API key>; else return <API key>; } return <API key>; } struct xenvif_pkt_state { struct sk_buff *skb; size_t remaining_len; struct sk_buff *frag_iter; int frag; /* frag == -1 => frag_iter->head */ unsigned int frag_offset; struct <API key> extras[<API key> - 1]; unsigned int extra_count; unsigned int slot; }; static void xenvif_rx_next_skb(struct xenvif_queue *queue, struct xenvif_pkt_state *pkt) { struct sk_buff *skb; unsigned int gso_type; skb = xenvif_rx_dequeue(queue); queue->stats.tx_bytes += skb->len; queue->stats.tx_packets++; /* Reset packet state. */ memset(pkt, 0, sizeof(struct xenvif_pkt_state)); pkt->skb = skb; pkt->frag_iter = skb; pkt->remaining_len = skb->len; pkt->frag = -1; gso_type = xenvif_gso_type(skb); if ((1 << gso_type) & queue->vif->gso_mask) { struct <API key> *extra; extra = &pkt->extras[<API key> - 1]; extra->u.gso.type = gso_type; extra->u.gso.size = skb_shinfo(skb)->gso_size; extra->u.gso.pad = 0; extra->u.gso.features = 0; extra->type = <API key>; extra->flags = 0; pkt->extra_count++; } if (queue->vif->xdp_headroom) { struct <API key> *extra; extra = &pkt->extras[<API key> - 1]; memset(extra, 0, sizeof(struct <API key>)); extra->u.xdp.headroom = queue->vif->xdp_headroom; extra->type = <API key>; extra->flags = 0; pkt->extra_count++; } if (skb->sw_hash) { struct <API key> *extra; extra = &pkt->extras[<API key> - 1]; extra->u.hash.algorithm = <API key>; if (skb->l4_hash) extra->u.hash.type = skb->protocol == htons(ETH_P_IP) ? <API key> : <API key>; else extra->u.hash.type = skb->protocol == htons(ETH_P_IP) ? <API key> : <API key>; *(uint32_t *)extra->u.hash.value = skb_get_hash_raw(skb); extra->type = <API key>; extra->flags = 0; pkt->extra_count++; } } static void xenvif_rx_complete(struct xenvif_queue *queue, struct xenvif_pkt_state *pkt) { /* All responses are ready to be pushed. */ queue->rx.rsp_prod_pvt = queue->rx.req_cons; __skb_queue_tail(queue->rx_copy.completed, pkt->skb); } static void xenvif_rx_next_frag(struct xenvif_pkt_state *pkt) { struct sk_buff *frag_iter = pkt->frag_iter; unsigned int nr_frags = skb_shinfo(frag_iter)->nr_frags; pkt->frag++; pkt->frag_offset = 0; if (pkt->frag >= nr_frags) { if (frag_iter == pkt->skb) pkt->frag_iter = skb_shinfo(frag_iter)->frag_list; else pkt->frag_iter = frag_iter->next; pkt->frag = -1; } } static void <API key>(struct xenvif_queue *queue, struct xenvif_pkt_state *pkt, unsigned int offset, void **data, size_t *len) { struct sk_buff *frag_iter = pkt->frag_iter; void *frag_data; size_t frag_len, chunk_len; BUG_ON(!frag_iter); if (pkt->frag == -1) { frag_data = frag_iter->data; frag_len = skb_headlen(frag_iter); } else { skb_frag_t *frag = &skb_shinfo(frag_iter)->frags[pkt->frag]; frag_data = skb_frag_address(frag); frag_len = skb_frag_size(frag); } frag_data += pkt->frag_offset; frag_len -= pkt->frag_offset; chunk_len = min_t(size_t, frag_len, XEN_PAGE_SIZE - offset); chunk_len = min_t(size_t, chunk_len, XEN_PAGE_SIZE - xen_offset_in_page(frag_data)); pkt->frag_offset += chunk_len; /* Advance to next frag? */ if (frag_len == chunk_len) xenvif_rx_next_frag(pkt); *data = frag_data; *len = chunk_len; } static void xenvif_rx_data_slot(struct xenvif_queue *queue, struct xenvif_pkt_state *pkt, struct <API key> *req, struct <API key> *rsp) { unsigned int offset = queue->vif->xdp_headroom; unsigned int flags; do { size_t len; void *data; <API key>(queue, pkt, offset, &data, &len); xenvif_rx_copy_add(queue, req, offset, data, len); offset += len; pkt->remaining_len -= len; } while (offset < XEN_PAGE_SIZE && pkt->remaining_len > 0); if (pkt->remaining_len > 0) flags = <API key>; else flags = 0; if (pkt->slot == 0) { struct sk_buff *skb = pkt->skb; if (skb->ip_summed == CHECKSUM_PARTIAL) flags |= <API key> | <API key>; else if (skb->ip_summed == <API key>) flags |= <API key>; if (pkt->extra_count != 0) flags |= <API key>; } rsp->offset = 0; rsp->flags = flags; rsp->id = req->id; rsp->status = (s16)offset; } static void <API key>(struct xenvif_queue *queue, struct xenvif_pkt_state *pkt, struct <API key> *req, struct <API key> *rsp) { struct <API key> *extra = (void *)rsp; unsigned int i; pkt->extra_count for (i = 0; i < ARRAY_SIZE(pkt->extras); i++) { if (pkt->extras[i].type) { *extra = pkt->extras[i]; if (pkt->extra_count != 0) extra->flags |= <API key>; pkt->extras[i].type = 0; return; } } BUG(); } static void xenvif_rx_skb(struct xenvif_queue *queue) { struct xenvif_pkt_state pkt; xenvif_rx_next_skb(queue, &pkt); queue->last_rx_time = jiffies; do { struct <API key> *req; struct <API key> *rsp; req = RING_GET_REQUEST(&queue->rx, queue->rx.req_cons); rsp = RING_GET_RESPONSE(&queue->rx, queue->rx.req_cons); /* Extras must go after the first data slot */ if (pkt.slot != 0 && pkt.extra_count != 0) <API key>(queue, &pkt, req, rsp); else xenvif_rx_data_slot(queue, &pkt, req, rsp); queue->rx.req_cons++; pkt.slot++; } while (pkt.remaining_len > 0 || pkt.extra_count != 0); xenvif_rx_complete(queue, &pkt); } #define RX_BATCH_SIZE 64 void xenvif_rx_action(struct xenvif_queue *queue) { struct sk_buff_head completed_skbs; unsigned int work_done = 0; <API key>(&completed_skbs); queue->rx_copy.completed = &completed_skbs; while (<API key>(queue) && work_done < RX_BATCH_SIZE) { xenvif_rx_skb(queue); work_done++; } /* Flush any pending copies and complete all skbs. */ <API key>(queue); } static bool <API key>(struct xenvif_queue *queue) { RING_IDX prod, cons; prod = queue->rx.sring->req_prod; cons = queue->rx.req_cons; return !queue->stalled && prod - cons < 1 && time_after(jiffies, queue->last_rx_time + queue->vif->stall_timeout); } static bool <API key>(struct xenvif_queue *queue) { RING_IDX prod, cons; prod = queue->rx.sring->req_prod; cons = queue->rx.req_cons; return queue->stalled && prod - cons >= 1; } bool xenvif_have_rx_work(struct xenvif_queue *queue, bool test_kthread) { return <API key>(queue) || (queue->vif->stall_timeout && (<API key>(queue) || <API key>(queue))) || (test_kthread && kthread_should_stop()) || queue->vif->disabled; } static long <API key>(struct xenvif_queue *queue) { struct sk_buff *skb; long timeout; skb = skb_peek(&queue->rx_queue); if (!skb) return <API key>; timeout = XENVIF_RX_CB(skb)->expires - jiffies; return timeout < 0 ? 0 : timeout; } /* Wait until the guest Rx thread has work. * * The timeout needs to be adjusted based on the current head of the * queue (and not just the head at the beginning). In particular, if * the queue is initially empty an infinite timeout is used and this * needs to be reduced when a skb is queued. * * This cannot be done with wait_event_timeout() because it only * calculates the timeout once. */ static void <API key>(struct xenvif_queue *queue) { DEFINE_WAIT(wait); if (xenvif_have_rx_work(queue, true)) return; for (;;) { long ret; prepare_to_wait(&queue->wq, &wait, TASK_INTERRUPTIBLE); if (xenvif_have_rx_work(queue, true)) break; if (atomic_fetch_andnot(NETBK_RX_EOI | NETBK_COMMON_EOI, &queue->eoi_pending) & (NETBK_RX_EOI | NETBK_COMMON_EOI)) xen_irq_lateeoi(queue->rx_irq, 0); ret = schedule_timeout(<API key>(queue)); if (!ret) break; } finish_wait(&queue->wq, &wait); } static void <API key>(struct xenvif_queue *queue) { struct xenvif *vif = queue->vif; queue->stalled = true; /* At least one queue has stalled? Disable the carrier. */ spin_lock(&vif->lock); if (vif->stalled_queues++ == 0) { netdev_info(vif->dev, "Guest Rx stalled"); netif_carrier_off(vif->dev); } spin_unlock(&vif->lock); } static void <API key>(struct xenvif_queue *queue) { struct xenvif *vif = queue->vif; queue->last_rx_time = jiffies; /* Reset Rx stall detection. */ queue->stalled = false; /* All queues are ready? Enable the carrier. */ spin_lock(&vif->lock); if (--vif->stalled_queues == 0) { netdev_info(vif->dev, "Guest Rx ready"); netif_carrier_on(vif->dev); } spin_unlock(&vif->lock); } int <API key>(void *data) { struct xenvif_queue *queue = data; struct xenvif *vif = queue->vif; if (!vif->stall_timeout) <API key>(queue); for (;;) { <API key>(queue); if (kthread_should_stop()) break; /* This frontend is found to be rogue, disable it in * kthread context. Currently this is only set when * netback finds out frontend sends malformed packet, * but we cannot disable the interface in softirq * context so we defer it here, if this thread is * associated with queue 0. */ if (unlikely(vif->disabled && queue->id == 0)) { xenvif_carrier_off(vif); break; } if (!skb_queue_empty(&queue->rx_queue)) xenvif_rx_action(queue); /* If the guest hasn't provided any Rx slots for a * while it's probably not responsive, drop the * carrier so packets are dropped earlier. */ if (vif->stall_timeout) { if (<API key>(queue)) <API key>(queue); else if (<API key>(queue)) <API key>(queue); } /* Queued packets may have foreign pages from other * domains. These cannot be queued indefinitely as * this would starve guests of grant refs and transmit * slots. */ <API key>(queue); cond_resched(); } /* Bin any remaining skbs */ <API key>(queue); return 0; }
#ifndef __ASM_ARCH_GPIO_H #define __ASM_ARCH_GPIO_H __FILE__ #define S5PC100_GPIO_A0_NR (8) #define S5PC100_GPIO_A1_NR (5) #define S5PC100_GPIO_B_NR (8) #define S5PC100_GPIO_C_NR (5) #define S5PC100_GPIO_D_NR (7) #define S5PC100_GPIO_E0_NR (8) #define S5PC100_GPIO_E1_NR (6) #define S5PC100_GPIO_F0_NR (8) #define S5PC100_GPIO_F1_NR (8) #define S5PC100_GPIO_F2_NR (8) #define S5PC100_GPIO_F3_NR (4) #define S5PC100_GPIO_G0_NR (8) #define S5PC100_GPIO_G1_NR (3) #define S5PC100_GPIO_G2_NR (7) #define S5PC100_GPIO_G3_NR (7) #define S5PC100_GPIO_H0_NR (8) #define S5PC100_GPIO_H1_NR (8) #define S5PC100_GPIO_H2_NR (8) #define S5PC100_GPIO_H3_NR (8) #define S5PC100_GPIO_I_NR (8) #define S5PC100_GPIO_J0_NR (8) #define S5PC100_GPIO_J1_NR (5) #define S5PC100_GPIO_J2_NR (8) #define S5PC100_GPIO_J3_NR (8) #define S5PC100_GPIO_J4_NR (4) #define S5PC100_GPIO_K0_NR (8) #define S5PC100_GPIO_K1_NR (6) #define S5PC100_GPIO_K2_NR (8) #define S5PC100_GPIO_K3_NR (8) #define S5PC100_GPIO_L0_NR (8) #define S5PC100_GPIO_L1_NR (8) #define S5PC100_GPIO_L2_NR (8) #define S5PC100_GPIO_L3_NR (8) #define S5PC100_GPIO_L4_NR (8) #define S5PC100_GPIO_NEXT(__gpio) \ ((__gpio##_START) + (__gpio##_NR) + <API key> + 1) enum s5p_gpio_number { <API key> = 0, <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_A0), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_A1), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_B), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_C), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_D), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_E0), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_E1), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_F0), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_F1), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_F2), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_F3), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_G0), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_G1), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_G2), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_G3), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_H0), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_H1), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_H2), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_H3), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_I), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_J0), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_J1), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_J2), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_J3), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_J4), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_K0), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_K1), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_K2), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_K3), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_L0), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_L1), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_L2), <API key> = S5PC100_GPIO_NEXT(S5PC100_GPIO_L3), S5PC100_GPIO_END = S5PC100_GPIO_NEXT(S5PC100_GPIO_L4), }; #define S5PC100_GPA0(_nr) (<API key> + (_nr)) #define S5PC100_GPA1(_nr) (<API key> + (_nr)) #define S5PC100_GPB(_nr) (<API key> + (_nr)) #define S5PC100_GPC(_nr) (<API key> + (_nr)) #define S5PC100_GPD(_nr) (<API key> + (_nr)) #define S5PC100_GPE0(_nr) (<API key> + (_nr)) #define S5PC100_GPE1(_nr) (<API key> + (_nr)) #define S5PC100_GPF0(_nr) (<API key> + (_nr)) #define S5PC100_GPF1(_nr) (<API key> + (_nr)) #define S5PC100_GPF2(_nr) (<API key> + (_nr)) #define S5PC100_GPF3(_nr) (<API key> + (_nr)) #define S5PC100_GPG0(_nr) (<API key> + (_nr)) #define S5PC100_GPG1(_nr) (<API key> + (_nr)) #define S5PC100_GPG2(_nr) (<API key> + (_nr)) #define S5PC100_GPG3(_nr) (<API key> + (_nr)) #define S5PC100_GPH0(_nr) (<API key> + (_nr)) #define S5PC100_GPH1(_nr) (<API key> + (_nr)) #define S5PC100_GPH2(_nr) (<API key> + (_nr)) #define S5PC100_GPH3(_nr) (<API key> + (_nr)) #define S5PC100_GPI(_nr) (<API key> + (_nr)) #define S5PC100_GPJ0(_nr) (<API key> + (_nr)) #define S5PC100_GPJ1(_nr) (<API key> + (_nr)) #define S5PC100_GPJ2(_nr) (<API key> + (_nr)) #define S5PC100_GPJ3(_nr) (<API key> + (_nr)) #define S5PC100_GPJ4(_nr) (<API key> + (_nr)) #define S5PC100_GPK0(_nr) (<API key> + (_nr)) #define S5PC100_GPK1(_nr) (<API key> + (_nr)) #define S5PC100_GPK2(_nr) (<API key> + (_nr)) #define S5PC100_GPK3(_nr) (<API key> + (_nr)) #define S5PC100_GPL0(_nr) (<API key> + (_nr)) #define S5PC100_GPL1(_nr) (<API key> + (_nr)) #define S5PC100_GPL2(_nr) (<API key> + (_nr)) #define S5PC100_GPL3(_nr) (<API key> + (_nr)) #define S5PC100_GPL4(_nr) (<API key> + (_nr)) #define S3C_GPIO_END S5PC100_GPIO_END #define ARCH_NR_GPIOS (S5PC100_GPIO_END + 1) #endif
#include "linux/mm.h" #include "linux/sched.h" #include "linux/slab.h" #include "asm/pgalloc.h" #include "asm/pgtable.h" #include "as-layout.h" #include "os.h" #include "skas.h" extern int <API key>; static int init_stub_pte(struct mm_struct *mm, unsigned long proc, unsigned long kernel) { pgd_t *pgd; pud_t *pud; pmd_t *pmd; pte_t *pte; pgd = pgd_offset(mm, proc); pud = pud_alloc(mm, pgd, proc); if (!pud) goto out; pmd = pmd_alloc(mm, pud, proc); if (!pmd) goto out_pmd; pte = pte_alloc_map(mm, NULL, pmd, proc); if (!pte) goto out_pte; *pte = mk_pte(virt_to_page(kernel), __pgprot(_PAGE_PRESENT)); *pte = pte_mkread(*pte); return 0; out_pte: pmd_free(mm, pmd); out_pmd: pud_free(mm, pud); out: return -ENOMEM; } int init_new_context(struct task_struct *task, struct mm_struct *mm) { struct mm_context *from_mm = NULL; struct mm_context *to_mm = &mm->context; unsigned long stack = 0; int ret = -ENOMEM; if (skas_needs_stub) { stack = get_zeroed_page(GFP_KERNEL); if (stack == 0) goto out; } to_mm->id.stack = stack; if (current->mm != NULL && current->mm != &init_mm) from_mm = &current->mm->context; if (proc_mm) { ret = new_mm(stack); if (ret < 0) { printk(KERN_ERR "<API key> - " "new_mm failed, errno = %d\n", ret); goto out_free; } to_mm->id.u.mm_fd = ret; } else { if (from_mm) to_mm->id.u.pid = copy_context_skas0(stack, from_mm->id.u.pid); else to_mm->id.u.pid = start_userspace(stack); if (to_mm->id.u.pid < 0) { ret = to_mm->id.u.pid; goto out_free; } } ret = init_new_ldt(to_mm, from_mm); if (ret < 0) { printk(KERN_ERR "<API key> - init_ldt" " failed, errno = %d\n", ret); goto out_free; } return 0; out_free: if (to_mm->id.stack != 0) free_page(to_mm->id.stack); out: return ret; } void uml_setup_stubs(struct mm_struct *mm) { int err, ret; if (!skas_needs_stub) return; ret = init_stub_pte(mm, STUB_CODE, (unsigned long) &<API key>); if (ret) goto out; ret = init_stub_pte(mm, STUB_DATA, mm->context.id.stack); if (ret) goto out; mm->context.stub_pages[0] = virt_to_page(&<API key>); mm->context.stub_pages[1] = virt_to_page(mm->context.id.stack); err = <API key>(mm, STUB_START, STUB_END - STUB_START, VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC | VM_DONTCOPY, mm->context.stub_pages); if (err) { printk(KERN_ERR "<API key> returned %d\n", err); goto out; } return; out: force_sigsegv(SIGSEGV, current); } void arch_exit_mmap(struct mm_struct *mm) { pte_t *pte; pte = virt_to_pte(mm, STUB_CODE); if (pte != NULL) pte_clear(mm, STUB_CODE, pte); pte = virt_to_pte(mm, STUB_DATA); if (pte == NULL) return; pte_clear(mm, STUB_DATA, pte); } void destroy_context(struct mm_struct *mm) { struct mm_context *mmu = &mm->context; if (proc_mm) os_close_file(mmu->id.u.mm_fd); else { if (mmu->id.u.pid < 2) { printk(KERN_ERR "corrupt mm_context - pid = %d\n", mmu->id.u.pid); return; } <API key>(mmu->id.u.pid, 1); } if (skas_needs_stub) free_page(mmu->id.stack); free_ldt(mmu); }
#ifndef _REGS_MIPIDSIM_H #define _REGS_MIPIDSIM_H #define S5P_DSIM_STATUS (0x0) /* Status register */ #define S5P_DSIM_SWRST (0x4) /* Software reset register */ #define S5P_DSIM_CLKCTRL (0x8) /* Clock control register */ #define S5P_DSIM_TIMEOUT (0xc) /* Time out register */ #define S5P_DSIM_CONFIG (0x10) /* Configuration register */ #define S5P_DSIM_ESCMODE (0x14) /* Escape mode register */ /* Main display image resolution register */ #define S5P_DSIM_MDRESOL (0x18) #define S5P_DSIM_MVPORCH (0x1c) /* Main display Vporch register */ #define S5P_DSIM_MHPORCH (0x20) /* Main display Hporch register */ #define S5P_DSIM_MSYNC (0x24) /* Main display sync area register */ /* Sub display image resolution register */ #define S5P_DSIM_SDRESOL (0x28) #define S5P_DSIM_INTSRC (0x2c) /* Interrupt source register */ #define S5P_DSIM_INTMSK (0x30) /* Interrupt mask register */ #define S5P_DSIM_PKTHDR (0x34) /* Packet Header FIFO register */ #define S5P_DSIM_PAYLOAD (0x38) /* Payload FIFO register */ #define S5P_DSIM_RXFIFO (0x3c) /* Read FIFO register */ #define S5P_DSIM_FIFOTHLD (0x40) /* FIFO threshold level register */ #define S5P_DSIM_FIFOCTRL (0x44) /* FIFO status and control register */ #define DSIM_INIT_SFR (1 << 3) /* SFR FIFO write point initialize */ /* PLL ctrl register */ #define S5P_DSIM_PLLCTRL (0x4c) /* PLL control register */ /* PLL timer register */ #define S5P_DSIM_PLLTMR (soc_is_exynos5250() ? (0x50) : (0x58)) #define S5P_DSIM_PLLCTRL1 (0x50) /* PLL timer register 1 */ #define S5P_DSIM_PLLCTRL2 (0x54) /* PLL timer register 2 */ /* PHY ctrl register */ /* Only used in EXYNOS5250 */ #define S5P_DSIM_PHYACCHR (0x54) /* D-PHY AC characteristic register */ #define S5P_DSIM_PHYACCHR1 (0x58) /* D-PHY AC characteristic register1 */ #define S5P_DSIM_PHYCTRL (0x5C) /* D-PHY Master & Slave Analog block characteristics control register (B_DPHYCTL) */ #define S5P_DSIM_PHYCTRL1 (0x60) /* D-PHY Master & Slave Analog block characteristics control register (M_DPHYCTL) */ #define S5P_DSIM_PHYTIMING (0x64) /* D-PHY Master global operating timing register */ #define S5P_DSIM_PHYTIMING1 (0x68) /* D-PHY Master global operating timing register */ #define S5P_DSIM_PHYTIMING2 (0x6C) /* D-PHY Master global operating timing register */ /* Version register */ #define S5P_DSIM_VERSION (0x70) /* Specifies the DSIM version information */ /* MIC register */ #define S5P_DSIM_MIC_CTRL (0x88) #define DSIM_MIC_CTRL_EN (1 << 1) #define <API key> (1 << 0) #define S5P_DSIM_MIC_ON_H (0x90) #define S5P_DSIM_MIC_ON_HFP (0x9C) /* DSIM_STATUS */ #define DSIM_STOP_STATE_DAT(x) (((x) & 0xf) << 0) #define DSIM_ULPS_DAT(x) (((x) & 0xf) << 4) #define DSIM_STOP_STATE_CLK (1 << 8) #define DSIM_ULPS_CLK (1 << 9) #define <API key> (1 << 10) /* DSIM_SWRST */ #define DSIM_FUNCRST (1 << 16) #define DSIM_SWRST (1 << 0) /* S5P_DSIM_TIMEOUT */ #define <API key> (0) #define DSIM_BTA_TOUT_SHIFT (16) /* S5P_DSIM_CLKCTRL */ #define <API key> (19) #define <API key> (24) #define <API key> (25) #define <API key> (27) #define <API key> (28) #define <API key> (31) #define DSIM_LANE_ESC_CLKEN(x) (((x) & 0x1f) << \ <API key>) #define <API key> (1 << <API key>) #define <API key> (0 << <API key>) #define <API key> (1 << <API key>) #define <API key> (1 << <API key>) #define <API key> (0 << <API key>) /* S5P_DSIM_CONFIG */ #define <API key> (5) #define DSIM_HSA_MODE_SHIFT (20) #define DSIM_HBP_MODE_SHIFT (21) #define DSIM_HFP_MODE_SHIFT (22) #define DSIM_HSE_MODE_SHIFT (23) #define <API key> (24) #define DSIM_LANE_ENx(x) (((x) & 0x1f) << 0) #define <API key>(x) ((x) << <API key>) /* S5P_DSIM_ESCMODE */ #define <API key> (1 << 0) #define DSIM_TX_ULPS_CLK (1 << 1) #define <API key> (1 << 2) #define DSIM_TX_ULPS_DATA (1 << 3) #define DSIM_TX_LPDT_SHIFT (6) #define DSIM_CMD_LPDT_SHIFT (7) #define DSIM_TX_LPDT_LP (1 << DSIM_TX_LPDT_SHIFT) #define DSIM_CMD_LPDT_LP (1 << DSIM_CMD_LPDT_SHIFT) #define <API key> (21) #define <API key> (20) /* S5P_DSIM_MDRESOL */ #define DSIM_MAIN_STAND_BY (1 << 31) #if defined(<API key>) #define DSIM_MAIN_VRESOL(x) (((x) & 0xfff) << 16) #else #define DSIM_MAIN_VRESOL(x) (((x) & 0x7ff) << 16) #endif #define DSIM_MAIN_HRESOL(x) (((x) & 0X7ff) << 0) /* S5P_DSIM_MVPORCH */ #define <API key> (28) #define <API key> (16) #define DSIM_MAIN_VBP_SHIFT (0) #define DSIM_CMD_ALLOW_MASK (0xf << <API key>) #define <API key> (0x7ff << <API key>) #define DSIM_MAIN_VBP_MASK (0x7ff << DSIM_MAIN_VBP_SHIFT) /* S5P_DSIM_MHPORCH */ #define DSIM_MAIN_HFP_SHIFT (16) #define DSIM_MAIN_HBP_SHIFT (0) #define DSIM_MAIN_HFP_MASK ((0xffff) << DSIM_MAIN_HFP_SHIFT) #define DSIM_MAIN_HBP_MASK ((0xffff) << DSIM_MAIN_HBP_SHIFT) /* S5P_DSIM_MSYNC */ #define DSIM_MAIN_VSA_SHIFT (22) #define DSIM_MAIN_HSA_SHIFT (0) #define DSIM_MAIN_VSA_MASK ((0x3ff) << DSIM_MAIN_VSA_SHIFT) #define DSIM_MAIN_HSA_MASK ((0xffff) << DSIM_MAIN_HSA_SHIFT) /* S5P_DSIM_SDRESOL */ #define <API key> (31) #define <API key> (16) #define <API key> (0) #define <API key> ((0x1) << <API key>) #define <API key> ((0x7ff) << <API key>) #define <API key> ((0x7ff) << <API key>) /* S5P_DSIM_INTSRC */ #define INTSRC_FRAME_DONE (1 << 24) #define INTSRC_PLL_STABLE (1 << 31) #define <API key> (1 << 29) #define <API key> (1 << 28) /* S5P_DSIM_INTMSK */ #define INTMSK_FRAME_DONE (1 << 24) /* S5P_DSIM_FIFOCTRL */ #define SFR_HEADER_EMPTY (1 << 22) /* S5P_DSIM_PHYACCHR */ #define DSIM_AFC_CTL(x) (((x) & 0x7) << 5) /* S5P_DSIM_PLLCTRL */ #define DSIM_PLL_EN_SHIFT (23) #define <API key> (24) #if defined(<API key>) #define <API key> 20000 #elif defined(<API key>) #define <API key> 32000 #elif defined(<API key>) #define <API key> 20000 #elif defined(<API key>) #define <API key> 20000 #elif defined(<API key>) #define <API key> 22200 #elif defined(<API key>) #define <API key> 20000 #elif defined(<API key>) #define <API key> 20000 #elif defined(<API key>) #define <API key> 20000 #elif defined(<API key>) #define <API key> 22200 #elif defined(<API key>) #define <API key> 22200 #else #define <API key> 32000 #endif #endif /* _REGS_MIPIDSIM_H */
#include "tomcrypt.h" /** @file ofb_decrypt.c OFB implementation, decrypt data, Tom St Denis */ #ifdef LTC_OFB_MODE /** OFB decrypt @param ct Ciphertext @param pt [out] Plaintext @param len Length of ciphertext (octets) @param ofb OFB state @return CRYPT_OK if successful */ int ofb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_OFB *ofb) { LTC_ARGCHK(pt != NULL); LTC_ARGCHK(ct != NULL); LTC_ARGCHK(ofb != NULL); return ofb_encrypt(ct, pt, len, ofb); } #endif /* $Source: /cvs/libtom/libtomcrypt/src/modes/ofb/ofb_decrypt.c,v $ */ /* $Revision: 1.5 $ */
#include "brw_context.h" #include "brw_state.h" struct dirty_bit_map { uint32_t bit; char *name; uint32_t count; }; #define DEFINE_BIT(name) {name, #name, 0} static struct dirty_bit_map mesa_bits[] = { DEFINE_BIT(<API key>), DEFINE_BIT(PIPE_NEW_RAST), DEFINE_BIT(PIPE_NEW_BLEND), DEFINE_BIT(PIPE_NEW_VIEWPORT), DEFINE_BIT(PIPE_NEW_SAMPLERS), DEFINE_BIT(<API key>), DEFINE_BIT(<API key>), DEFINE_BIT(<API key>), DEFINE_BIT(<API key>), DEFINE_BIT(<API key>), DEFINE_BIT(<API key>), DEFINE_BIT(PIPE_NEW_CLIP), DEFINE_BIT(<API key>), DEFINE_BIT(<API key>), DEFINE_BIT(<API key>), DEFINE_BIT(<API key>), DEFINE_BIT(<API key>), DEFINE_BIT(<API key>), DEFINE_BIT(<API key>), DEFINE_BIT(PIPE_NEW_QUERY), DEFINE_BIT(PIPE_NEW_SCISSOR), DEFINE_BIT(<API key>), DEFINE_BIT(PIPE_NEW_NR_CBUFS), {0, 0, 0} }; static struct dirty_bit_map brw_bits[] = { DEFINE_BIT(BRW_NEW_URB_FENCE), DEFINE_BIT(<API key>), DEFINE_BIT(<API key>), DEFINE_BIT(<API key>), DEFINE_BIT(<API key>), DEFINE_BIT(<API key>), DEFINE_BIT(BRW_NEW_PRIMITIVE), DEFINE_BIT(BRW_NEW_CONTEXT), DEFINE_BIT(<API key>), DEFINE_BIT(BRW_NEW_PSP), DEFINE_BIT(BRW_NEW_WM_SURFACES), DEFINE_BIT(BRW_NEW_xxx), DEFINE_BIT(BRW_NEW_INDICES), {0, 0, 0} }; static struct dirty_bit_map cache_bits[] = { DEFINE_BIT(CACHE_NEW_CC_VP), DEFINE_BIT(CACHE_NEW_CC_UNIT), DEFINE_BIT(CACHE_NEW_WM_PROG), DEFINE_BIT(<API key>), DEFINE_BIT(CACHE_NEW_SAMPLER), DEFINE_BIT(CACHE_NEW_WM_UNIT), DEFINE_BIT(CACHE_NEW_SF_PROG), DEFINE_BIT(CACHE_NEW_SF_VP), DEFINE_BIT(CACHE_NEW_SF_UNIT), DEFINE_BIT(CACHE_NEW_VS_UNIT), DEFINE_BIT(CACHE_NEW_VS_PROG), DEFINE_BIT(CACHE_NEW_GS_UNIT), DEFINE_BIT(CACHE_NEW_GS_PROG), DEFINE_BIT(CACHE_NEW_CLIP_VP), DEFINE_BIT(CACHE_NEW_CLIP_UNIT), DEFINE_BIT(CACHE_NEW_CLIP_PROG), DEFINE_BIT(CACHE_NEW_SURFACE), DEFINE_BIT(CACHE_NEW_SURF_BIND), {0, 0, 0} }; static void <API key>(struct dirty_bit_map *bit_map, int32_t bits) { int i; for (i = 0; i < 32; i++) { if (bit_map[i].bit == 0) return; if (bit_map[i].bit & bits) bit_map[i].count++; } } static void <API key>(struct dirty_bit_map *bit_map, int32_t bits) { int i; for (i = 0; i < 32; i++) { if (bit_map[i].bit == 0) return; debug_printf("0x%08x: %12d (%s)\n", bit_map[i].bit, bit_map[i].count, bit_map[i].name); } } void <API key>( unsigned mesa, unsigned brw, unsigned cache ) { static int dirty_count = 0; <API key>(mesa_bits, mesa); <API key>(brw_bits, brw); <API key>(cache_bits, cache); if (dirty_count++ % 1000 == 0) { <API key>(mesa_bits, mesa); <API key>(brw_bits, brw); <API key>(cache_bits, cache); debug_printf("\n"); } }
(function(addon) { var component; if (window.UIkit2) { component = addon(UIkit2); } if (typeof define == 'function' && define.amd) { define('uikit-upload', ['uikit'], function(){ return component || addon(UIkit2); }); } })(function(UI){ "use strict"; UI.component('uploadSelect', { init: function() { var $this = this; this.on('change', function() { xhrupload($this.element[0].files, $this.options); var twin = $this.element.clone(true).data('uploadSelect', $this); $this.element.replaceWith(twin); $this.element = twin; }); } }); UI.component('uploadDrop', { defaults: { 'dragoverClass': 'uk-dragover' }, init: function() { var $this = this, hasdragCls = false; this.on('drop', function(e){ if (e.originalEvent.dataTransfer && e.originalEvent.dataTransfer.files) { e.stopPropagation(); e.preventDefault(); $this.element.removeClass($this.options.dragoverClass); $this.element.trigger('dropped.uk.upload', [e.originalEvent.dataTransfer.files]); xhrupload(e.originalEvent.dataTransfer.files, $this.options); } }).on('dragenter', function(e){ e.stopPropagation(); e.preventDefault(); }).on('dragover', function(e){ e.stopPropagation(); e.preventDefault(); if (!hasdragCls) { $this.element.addClass($this.options.dragoverClass); hasdragCls = true; } }).on('dragleave', function(e){ e.stopPropagation(); e.preventDefault(); $this.element.removeClass($this.options.dragoverClass); hasdragCls = false; }); } }); UI.support.ajaxupload = (function() { function supportFileAPI() { var fi = document.createElement('INPUT'); fi.type = 'file'; return 'files' in fi; } function <API key>() { var xhr = new XMLHttpRequest(); return !! (xhr && ('upload' in xhr) && ('onprogress' in xhr.upload)); } function supportFormData() { return !! window.FormData; } return supportFileAPI() && <API key>() && supportFormData(); })(); function xhrupload(files, settings) { if (!UI.support.ajaxupload){ return this; } settings = UI.$.extend({}, xhrupload.defaults, settings); if (!files.length){ return; } if (settings.allow !== '*.*') { for(var i=0,file;file=files[i];i++) { if(!matchName(settings.allow, file.name)) { if(typeof(settings.notallowed) == 'string') { alert(settings.notallowed); } else { settings.notallowed(file, settings); } return; } } } var complete = settings.complete; if (settings.single){ var count = files.length, uploaded = 0, allow = true; settings.beforeAll(files); settings.complete = function(response, xhr){ uploaded = uploaded + 1; complete(response, xhr); if (settings.filelimit && uploaded >= settings.filelimit){ allow = false; } if (allow && uploaded<count){ upload([files[uploaded]], settings); } else { settings.allcomplete(response, xhr); } }; upload([files[0]], settings); } else { settings.complete = function(response, xhr){ complete(response, xhr); settings.allcomplete(response, xhr); }; upload(files, settings); } function upload(files, settings){ // upload all at once var formData = new FormData(), xhr = new XMLHttpRequest(); if (settings.before(settings, files)===false) return; for (var i = 0, f; f = files[i]; i++) { formData.append(settings.param, f); } for (var p in settings.params) { formData.append(p, settings.params[p]); } // Add any event handlers here... xhr.upload.addEventListener('progress', function(e){ var percent = (e.loaded / e.total)*100; settings.progress(percent, e); }, false); xhr.addEventListener('loadstart', function(e){ settings.loadstart(e); }, false); xhr.addEventListener('load', function(e){ settings.load(e); }, false); xhr.addEventListener('loadend', function(e){ settings.loadend(e); }, false); xhr.addEventListener('error', function(e){ settings.error(e); }, false); xhr.addEventListener('abort', function(e){ settings.abort(e); }, false); xhr.open(settings.method, settings.action, true); if (settings.type=='json') { xhr.setRequestHeader('Accept', 'application/json'); } for (var h in settings.headers) { xhr.setRequestHeader(h, settings.headers[h]); } xhr.onreadystatechange = function() { settings.readystatechange(xhr); if (xhr.readyState==4){ var response = xhr.responseText; if (settings.type=='json') { try { response = UI.$.parseJSON(response); } catch(e) { response = false; } } settings.complete(response, xhr); } }; settings.beforeSend(xhr); xhr.send(formData); } } xhrupload.defaults = { action: '', single: true, method: 'POST', param : 'files[]', params: {}, allow : '*.*', type : 'text', filelimit: false, headers: {}, // events before : function(o){}, beforeSend : function(xhr){}, beforeAll : function(){}, loadstart : function(){}, load : function(){}, loadend : function(){}, error : function(){}, abort : function(){}, progress : function(){}, complete : function(){}, allcomplete : function(){}, readystatechange: function(){}, notallowed : function(file, settings){ alert('Only the following file types are allowed: '+settings.allow); } }; function matchName(pattern, path) { var parsedPattern = '^' + pattern.replace(/\ replace(/\*\*/g, '(\\/[^\\/]+)*'). replace(/\*/g, '[^\\/]+'). replace(/((?!\\))\?/g, '$1.') + '$'; parsedPattern = '^' + parsedPattern + '$'; return (path.match(new RegExp(parsedPattern, 'i')) !== null); } UI.Utils.xhrupload = xhrupload; return xhrupload; });
#ifdef HAVE_CONFIG_H #include "config.h" #endif #include "<API key>.h" #include <gnuradio/io_signature.h> #include <stdexcept> #include <volk/volk.h> #include <cstdio> #include <iostream> namespace gr { namespace digital { #define VERBOSE 0 <API key>::sptr <API key>::make(const std::string &access_code, int threshold, const std::string &tag_name) { return gnuradio::get_initial_sptr (new <API key>(access_code, threshold, tag_name)); } <API key>::<API key>( const std::string &access_code, int threshold, const std::string &tag_name) : sync_block("<API key>", io_signature::make(1, 1, sizeof(char)), io_signature::make(1, 1, sizeof(char))), d_data_reg(0), d_mask(0), d_threshold(threshold), d_len(0) { if(!set_access_code(access_code)) { throw std::out_of_range ("access_code is > 64 bits"); } std::stringstream str; str << name() << unique_id(); d_me = pmt::string_to_symbol(str.str()); d_key = pmt::string_to_symbol(tag_name); } <API key>::~<API key>() { } bool <API key>::set_access_code( const std::string &access_code) { d_len = access_code.length(); // # of bytes in string if(d_len > 64) return false; // set len bottom bits to 1. d_mask = ((~0ULL) >> (64 - d_len)); d_access_code = 0; for(unsigned i=0; i < d_len; i++){ d_access_code = (d_access_code << 1) | (access_code[i] & 1); } if(VERBOSE) { std::cerr << "Access code: " << std::hex << d_access_code << std::dec << std::endl; std::cerr << "Mask: " << std::hex << d_mask << std::dec << std::endl; } return true; } int <API key>::work(int noutput_items, <API key> &input_items, gr_vector_void_star &output_items) { const unsigned char *in = (const unsigned char*)input_items[0]; unsigned char *out = (unsigned char*)output_items[0]; uint64_t abs_out_sample_cnt = nitems_written(0); for(int i = 0; i < noutput_items; i++) { out[i] = in[i]; // compute hamming distance between desired access code and current data uint64_t wrong_bits = 0; uint64_t nwrong = d_threshold+1; wrong_bits = (d_data_reg ^ d_access_code) & d_mask; volk_64u_popcnt(&nwrong, wrong_bits); // shift in new data d_data_reg = (d_data_reg << 1) | (in[i] & 0x1); if(nwrong <= d_threshold) { if(VERBOSE) std::cerr << "writing tag at sample " << abs_out_sample_cnt + i << std::endl; add_item_tag(0, //stream ID abs_out_sample_cnt + i, //sample d_key, //frame info pmt::from_long(nwrong), //data (number wrong) d_me //block src id ); } } return noutput_items; } } /* namespace digital */ } /* namespace gr */
#pragma once #include <string> #include <sstream> using namespace std; namespace calibre_reflow { class ReflowException : public exception { const char *msg; public: ReflowException(const char *m) : msg(m) {} virtual const char* what() const throw() { return msg; } }; inline string encode_for_xml(const string &sSrc ) { ostringstream sRet; for( string::const_iterator iter = sSrc.begin(); iter!=sSrc.end(); iter++ ) { unsigned char c = (unsigned char)*iter; switch( c ) { case '&': sRet << "&amp;"; break; case '<': sRet << "&lt;"; break; case '>': sRet << "&gt;"; break; case '"': sRet << "&quot;"; break; default: sRet << c; } } return sRet.str(); } }
#include "ble_gatts_conn.h" #include "ble_serialization.h" #include "<API key>.h" #include "<API key>.h" #include "app_util.h" uint32_t <API key>(uint8_t const * const p_buf, uint32_t packet_len, uint16_t * const p_char_handle, ble_gatts_attr_t * * const pp_attr, uint16_t * * const pp_handle) { SER_ASSERT_NOT_NULL(p_buf); SER_ASSERT_NOT_NULL(p_char_handle); SER_ASSERT_NOT_NULL(pp_attr); SER_ASSERT_NOT_NULL(*pp_attr); SER_ASSERT_NOT_NULL(pp_handle); SER_ASSERT_NOT_NULL(*pp_handle); uint32_t index = 0; <API key>(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); SER_ASSERT(p_buf[index] == <API key>, <API key>); index++; uint16_dec(p_buf, packet_len, &index, p_char_handle); uint32_t err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_attr, ble_gatts_attr_dec); SER_ASSERT(err_code == NRF_SUCCESS, err_code); err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_handle, NULL); SER_ASSERT(err_code == NRF_SUCCESS, err_code); <API key>(index, packet_len); return NRF_SUCCESS; } uint32_t <API key>(uint32_t return_code, uint8_t * const p_buf, uint32_t * const p_buf_len, uint16_t handle) { SER_ASSERT_NOT_NULL(p_buf); SER_ASSERT_NOT_NULL(p_buf_len); uint32_t total_len = *p_buf_len; <API key>(SER_CMD_HEADER_SIZE + 4, total_len); uint32_t err_code = <API key>(<API key>, return_code, p_buf, p_buf_len); if (err_code != NRF_SUCCESS) { return err_code; } if (return_code != NRF_SUCCESS) { return NRF_SUCCESS; } uint32_t index = *p_buf_len; <API key>(index + 2, total_len); err_code = uint16_t_enc(&handle, p_buf, total_len, &index); SER_ASSERT(err_code == NRF_SUCCESS, err_code); *p_buf_len = index; return err_code; }
#ifndef AVCODEC_CELP_MATH_H #define AVCODEC_CELP_MATH_H #include <stdint.h> /** * fixed-point implementation of cosine in [0; PI) domain. * @param arg fixed-point cosine argument, 0 <= arg < 0x4000 * * @return value of (1<<15) * cos(arg * PI / (1<<14)), -0x8000 <= result <= 0x7fff */ int16_t ff_cos(uint16_t arg); /** * fixed-point implementation of exp2(x) in [0; 1] domain. * @param power argument to exp2, 0 <= power <= 0x7fff * * @return value of (1<<20) * exp2(power / (1<<15)) * 0x8000c <= result <= 0xfffea */ int ff_exp2(uint16_t power); /** * Calculates log2(x). * @param value function argument, 0 < value <= 7fff ffff * * @return value of (1<<15) * log2(value) */ int ff_log2(uint32_t value); /** * Shift value left or right depending on sign of offset parameter. * @param value value to shift * @param offset shift offset * * @return value << offset, if offset>=0; value >> -offset - otherwise */ static inline int bidir_sal(int value, int offset) { if(offset < 0) return value >> -offset; else return value << offset; } /** * returns the dot product. * @param a input data array * @param b input data array * @param length number of elements * * @return dot product = sum of elementwise products */ float ff_dot_productf(const float* a, const float* b, int length); #endif /* AVCODEC_CELP_MATH_H */
#ifndef <API key> #if defined(__GNUC__) #warning "Inclusion of header files from include/Qt is deprecated." #elif defined(_MSC_VER) #pragma message("WARNING: Inclusion of header files from include/Qt is deprecated.") #endif #endif #include "../QtCore/qconfig-nacl.h"
require File.expand_path('../helper', __FILE__) class DefaultSchemaTest < Service::TestCase class SchemaService < Service end def setup @svc = SchemaService end def test_title assert_equal 'SchemaService', @svc.title end def test_hook_name assert_equal 'schemaservice', @svc.hook_name end def test_default_events assert_equal [:push], @svc.default_events end def <API key> assert_equal [], @svc.supported_events end def test_schema assert_equal [], @svc.schema end def <API key> assert_equal [], @svc.white_listed end def test_url assert_nil @svc.url end def test_logo_url assert_nil @svc.logo_url end def test_maintainers assert_equal [], @svc.maintainers end def test_supporters assert_equal [], @svc.supporters end end class <API key> < DefaultSchemaTest class SchemaService < Service def receive_push end def receive_issues end end def setup @svc = SchemaService end def <API key> assert_equal %w(issues push), @svc.supported_events.sort end end class <API key> < DefaultSchemaTest class SchemaService < Service def receive_event end def receive_push end def receive_issues end end def setup @svc = SchemaService end def <API key> assert_equal Service::ALL_EVENTS, @svc.supported_events.sort end end class CustomSchemaTest < DefaultSchemaTest class SchemaService < Service title "Custom!" hook_name "custom" string :abc password :def boolean :ghi white_list :abc, :ghi url 'url' logo_url 'logo' maintained_by :email => 'abc@def.com', :web => 'http://def.com/support', :github => 'abc', :twitter => 'def' supported_by :email => 'abc@def.com', :web => 'http://def.com/support', :github => %w(abc def), :twitter => 'def' end def setup @svc = SchemaService end def test_title assert_equal 'Custom!', @svc.title end def test_hook_name assert_equal 'custom', @svc.hook_name end def test_schema assert_equal [ [:string, :abc], [:password, :def], [:boolean, :ghi]], @svc.schema end def <API key> assert_equal %w(abc ghi), @svc.white_listed end def test_maintainers maintainers = @svc.maintainers assert_contributor :email, 'abc@def.com', maintainers assert_contributor :web, 'http://def.com/support', maintainers assert_contributor :github, 'abc', maintainers assert_contributor :twitter, 'def', maintainers assert_equal 4, maintainers.size end def test_supporters supporters = @svc.supporters assert_contributor :email, 'abc@def.com', supporters assert_contributor :web, 'http://def.com/support', supporters assert_contributor :github, 'abc', supporters assert_contributor :github, 'def', supporters assert_contributor :twitter, 'def', supporters assert_equal 5, supporters.size end def test_url assert_equal 'url', @svc.url end def test_logo_url assert_equal 'logo', @svc.logo_url end def assert_contributor(contributor_type, value, contributors) assert contributors.detect { |c| c.class.contributor_type == contributor_type && c.value == value } end end
// 2005-12-23 Paolo Carlini <pcarlini@suse.de> // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // Free Software Foundation; either version 3, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // with this library; see the file COPYING3. If not see // 23.2.5 vector<bool> modifiers #include <vector> #include <testsuite_hooks.h> const bool A[] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; const bool A1[] = {0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; const bool A2[] = {0, 0, 1, 0, 0, 1, 0, 1, 0, 1}; const bool A3[] = {0, 0, 1, 0, 0, 1}; const bool A4[] = {0, 0, 1}; const bool A5[] = {0, 0}; const unsigned N = sizeof(A) / sizeof(bool); const unsigned N1 = sizeof(A1) / sizeof(bool); const unsigned N2 = sizeof(A2) / sizeof(bool); const unsigned N3 = sizeof(A3) / sizeof(bool); const unsigned N4 = sizeof(A4) / sizeof(bool); const unsigned N5 = sizeof(A5) / sizeof(bool); void test01() { bool test __attribute__((unused)) = true; typedef std::vector<bool> vec_type; typedef vec_type::iterator iterator_type; vec_type v(A, A + N); iterator_type it1 = v.erase(v.begin() + 1); VERIFY( it1 == v.begin() + 1 ); VERIFY( v.size() == N1 ); VERIFY( std::equal(v.begin(), v.end(), A1) ); iterator_type it2 = v.erase(v.begin() + 4, v.begin() + 9); VERIFY( it2 == v.begin() + 4 ); VERIFY( v.size() == N2 ); VERIFY( std::equal(v.begin(), v.end(), A2) ); iterator_type it3 = v.erase(v.begin() + 6, v.end()); VERIFY( it3 == v.begin() + 6 ); VERIFY( v.size() == N3 ); VERIFY( std::equal(v.begin(), v.end(), A3) ); iterator_type it4 = v.erase(v.begin(), v.begin() + 3); VERIFY( it4 == v.begin() ); VERIFY( v.size() == N4 ); VERIFY( std::equal(v.begin(), v.end(), A4) ); iterator_type it5 = v.erase(v.begin() + 2); VERIFY( it5 == v.begin() + 2 ); VERIFY( v.size() == N5 ); VERIFY( std::equal(v.begin(), v.end(), A5) ); iterator_type it6 = v.erase(v.begin(), v.end()); VERIFY( it6 == v.begin() ); VERIFY( v.empty() ); } void test02() { bool test __attribute__((unused)) = true; typedef std::vector<std::vector<bool> > vec_type; typedef vec_type::iterator iterator_type; vec_type v, v1, v2, v3, v4, v5; for (unsigned i = 0; i < N; ++i) v.push_back(std::vector<bool>(1, A[i])); for (unsigned i = 0; i < N1; ++i) v1.push_back(std::vector<bool>(1, A1[i])); for (unsigned i = 0; i < N2; ++i) v2.push_back(std::vector<bool>(1, A2[i])); for (unsigned i = 0; i < N3; ++i) v3.push_back(std::vector<bool>(1, A3[i])); for (unsigned i = 0; i < N4; ++i) v4.push_back(std::vector<bool>(1, A4[i])); for (unsigned i = 0; i < N5; ++i) v5.push_back(std::vector<bool>(1, A5[i])); iterator_type it1 = v.erase(v.begin() + 1); VERIFY( it1 == v.begin() + 1 ); VERIFY( v.size() == N1 ); VERIFY( std::equal(v.begin(), v.end(), v1.begin()) ); iterator_type it2 = v.erase(v.begin() + 4, v.begin() + 9); VERIFY( it2 == v.begin() + 4 ); VERIFY( v.size() == N2 ); VERIFY( std::equal(v.begin(), v.end(), v2.begin()) ); iterator_type it3 = v.erase(v.begin() + 6, v.end()); VERIFY( it3 == v.begin() + 6 ); VERIFY( v.size() == N3 ); VERIFY( std::equal(v.begin(), v.end(), v3.begin()) ); iterator_type it4 = v.erase(v.begin(), v.begin() + 3); VERIFY( it4 == v.begin() ); VERIFY( v.size() == N4 ); VERIFY( std::equal(v.begin(), v.end(), v4.begin()) ); iterator_type it5 = v.erase(v.begin() + 2); VERIFY( it5 == v.begin() + 2 ); VERIFY( v.size() == N5 ); VERIFY( std::equal(v.begin(), v.end(), v5.begin()) ); iterator_type it6 = v.erase(v.begin(), v.end()); VERIFY( it6 == v.begin() ); VERIFY( v.empty() ); } int main() { test01(); test02(); return 0; }
#include <linux/device.h> #include <linux/i2c.h> #include <linux/i2c-mux.h> #include <linux/io.h> #include <linux/init.h> #include <linux/module.h> #include <linux/platform_device.h> #include <linux/slab.h> #include <linux/version.h> #include <linux/i2c/mlxcpld.h> #define CPLD_MUX_MAX_NCHANS 8 /* mlxcpld_mux - mux control structure: * @last_chan - last register value * @client - I2C device client */ struct mlxcpld_mux { u8 last_chan; struct i2c_client *client; }; static const struct i2c_device_id mlxcpld_mux_id[] = { { "mlxcpld_mux_module", 0 }, { } }; MODULE_DEVICE_TABLE(i2c, mlxcpld_mux_id); /* Write to mux register. Don't use i2c_transfer() and i2c_smbus_xfer() * for this as they will try to lock adapter a second time. */ static int <API key>(struct i2c_adapter *adap, struct i2c_client *client, u8 val) { struct <API key> *pdata = dev_get_platdata(&client->dev); int ret = -ENODEV; if (adap->algo->master_xfer) { struct i2c_msg msg; u8 msgbuf[] = {pdata->sel_reg_addr, val}; msg.addr = client->addr; msg.flags = 0; msg.len = 2; msg.buf = msgbuf; ret = __i2c_transfer(adap, &msg, 1); if (ret >= 0 && ret != 1) ret = -EREMOTEIO; } else if (adap->algo->smbus_xfer) { union i2c_smbus_data data; data.byte = val; ret = adap->algo->smbus_xfer(adap, client->addr, client->flags, I2C_SMBUS_WRITE, pdata->sel_reg_addr, I2C_SMBUS_BYTE_DATA, &data); } return ret; } static int <API key>(struct i2c_mux_core *muxc, u32 chan) { struct mlxcpld_mux *data = i2c_mux_priv(muxc); struct i2c_client *client = data->client; u8 regval = chan + 1; int err = 0; /* Only select the channel if its different from the last channel */ if (data->last_chan != regval) { err = <API key>(muxc->parent, client, regval); data->last_chan = err < 0 ? 0 : regval; } return err; } static int <API key>(struct i2c_mux_core *muxc, u32 chan) { struct mlxcpld_mux *data = i2c_mux_priv(muxc); struct i2c_client *client = data->client; /* Deselect active channel */ data->last_chan = 0; return <API key>(muxc->parent, client, data->last_chan); } /* Probe/reomove functions */ static int mlxcpld_mux_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); struct <API key> *pdata = dev_get_platdata(&client->dev); struct i2c_mux_core *muxc; int num, force; struct mlxcpld_mux *data; int err; if (!pdata) return -EINVAL; if (!<API key>(adap, <API key>)) return -ENODEV; muxc = i2c_mux_alloc(adap, &client->dev, CPLD_MUX_MAX_NCHANS, sizeof(*data), 0, <API key>, <API key>); if (!muxc) return -ENOMEM; data = i2c_mux_priv(muxc); i2c_set_clientdata(client, muxc); data->client = client; data->last_chan = 0; /* force the first selection */ /* Create an adapter for each channel. */ for (num = 0; num < CPLD_MUX_MAX_NCHANS; num++) { if (num >= pdata->num_adaps) /* discard unconfigured channels */ break; force = pdata->adap_ids[num]; err = i2c_mux_add_adapter(muxc, force, num, 0); if (err) goto virt_reg_failed; } return 0; virt_reg_failed: <API key>(muxc); return err; } static int mlxcpld_mux_remove(struct i2c_client *client) { struct i2c_mux_core *muxc = i2c_get_clientdata(client); <API key>(muxc); return 0; } static struct i2c_driver mlxcpld_mux_driver = { .driver = { .name = "mlxcpld-mux", }, .probe = mlxcpld_mux_probe, .remove = mlxcpld_mux_remove, .id_table = mlxcpld_mux_id, }; module_i2c_driver(mlxcpld_mux_driver); MODULE_AUTHOR("Michael Shych (michaels@mellanox.com)"); MODULE_DESCRIPTION("Mellanox I2C-CPLD-MUX driver"); MODULE_LICENSE("Dual BSD/GPL"); MODULE_ALIAS("platform:i2c-mux-mlxcpld");
#ifndef XDCFG_H /* prevent circular inclusions */ #define XDCFG_H /* by using protection macros */ #include "xdevcfg_hw.h" #include "xstatus.h" #include "xil_assert.h" #ifdef __cplusplus extern "C" { #endif /* Types of PCAP transfers */ #define <API key> 1 #define <API key> 2 #define XDCFG_PCAP_READBACK 3 #define <API key> 4 #define <API key> 5 /** * The handler data type allows the user to define a callback function to * respond to interrupt events in the system. This function is executed * in interrupt context, so amount of processing should be minimized. * * @param CallBackRef is the callback reference passed in by the upper * layer when setting the callback functions, and passed back to * the upper layer when the callback is invoked. Its type is * unimportant to the driver component, so it is a void pointer. * @param Status is the Interrupt status of the XDcfg device. */ typedef void (*XDcfg_IntrHandler) (void *CallBackRef, u32 Status); /** * This typedef contains configuration information for the device. */ typedef struct { u16 DeviceId; /**< Unique ID of device */ u32 BaseAddr; /**< Base address of the device */ } XDcfg_Config; /** * The XDcfg driver instance data. */ typedef struct { XDcfg_Config Config; /**< Hardware Configuration */ u32 IsReady; /**< Device is initialized and ready */ u32 IsStarted; /**< Device Configuration Interface * is running */ XDcfg_IntrHandler StatusHandler; /* Event handler function */ void *CallBackRef; /* Callback reference for event handler */ } XDcfg; #define XDcfg_Unlock(InstancePtr) \ XDcfg_WriteReg((InstancePtr)->Config.BaseAddr, \ XDCFG_UNLOCK_OFFSET, XDCFG_UNLOCK_DATA) #define XDcfg_GetPsVersion(InstancePtr) \ ((XDcfg_ReadReg((InstancePtr)->Config.BaseAddr, \ XDCFG_MCTRL_OFFSET)) & \ <API key>) >> \ <API key> #define <API key>(InstancePtr) \ XDcfg_ReadReg((InstancePtr)->Config.BaseAddr + \ <API key>) #define <API key>(InstancePtr) \ XDcfg_WriteReg((InstancePtr)->Config.BaseAddr, XDCFG_CTRL_OFFSET, \ ((XDcfg_ReadReg((InstancePtr)->Config.BaseAddr, XDCFG_CTRL_OFFSET)) \ & ( ~<API key>))) #define <API key>(InstancePtr) \ XDcfg_WriteReg((InstancePtr)->Config.BaseAddr, XDCFG_CTRL_OFFSET, \ ((XDcfg_ReadReg((InstancePtr)->Config.BaseAddr, XDCFG_CTRL_OFFSET)) \ | <API key>)) /* * Lookup configuration in xdevcfg_sinit.c. */ XDcfg_Config *XDcfg_LookupConfig(u16 DeviceId); /* * Selftest function in xdevcfg_selftest.c */ int XDcfg_SelfTest(XDcfg *InstancePtr); /* * Interface functions in xdevcfg.c */ int XDcfg_CfgInitialize(XDcfg *InstancePtr, XDcfg_Config *ConfigPtr, u32 EffectiveAddress); void XDcfg_EnablePCAP(XDcfg *InstancePtr); void XDcfg_DisablePCAP(XDcfg *InstancePtr); void <API key>(XDcfg *InstancePtr, u32 Mask); void <API key>(XDcfg *InstancePtr, u32 Mask); u32 <API key>(XDcfg *InstancePtr); void <API key>(XDcfg *InstancePtr, u32 Data); u32 <API key>(XDcfg *InstancePtr); void <API key>(XDcfg *InstancePtr, u32 Data); u32 <API key>(XDcfg *InstancePtr); void <API key>(XDcfg *InstancePtr, u32 Data); u32 <API key>(XDcfg *InstancePtr); void <API key>(XDcfg *InstancePtr, u32 Data); u32 <API key>(XDcfg *InstancePtr); void <API key>(XDcfg *InstancePtr, u32 Mask); u32 <API key>(XDcfg *InstancePtr); u32 XDcfg_IsDmaBusy(XDcfg *InstancePtr); void XDcfg_InitiateDma(XDcfg *InstancePtr, u32 SourcePtr, u32 DestPtr, u32 SrcWordLength, u32 DestWordLength); u32 XDcfg_Transfer(XDcfg *InstancePtr, void *SourcePtr, u32 SrcWordLength, void *DestPtr, u32 DestWordLength, u32 TransferType); /* * Interrupt related function prototypes implemented in xdevcfg_intr.c */ void XDcfg_IntrEnable(XDcfg *InstancePtr, u32 Mask); void XDcfg_IntrDisable(XDcfg *InstancePtr, u32 Mask); u32 <API key>(XDcfg *InstancePtr); u32 XDcfg_IntrGetStatus(XDcfg *InstancePtr); void XDcfg_IntrClear(XDcfg *InstancePtr, u32 Mask); void <API key>(XDcfg *InstancePtr); void XDcfg_SetHandler(XDcfg *InstancePtr, void *CallBackFunc, void *CallBackRef); #ifdef __cplusplus } #endif #endif /* end of protection macro */
package org.jetbrains.plugins.ipnb.format.cells.output; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class IpnbJpegOutputCell extends IpnbImageOutputCell { public IpnbJpegOutputCell(@NotNull final String jpeg, @Nullable final String[] text, @Nullable final Integer prompt) { super(jpeg, text, prompt); } }
package null import ( "fmt" "github.com/mitchellh/packer/common" "github.com/mitchellh/packer/helper/communicator" "github.com/mitchellh/packer/helper/config" "github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/template/interpolate" ) type Config struct { common.PackerConfig `mapstructure:",squash"` CommConfig communicator.Config `mapstructure:",squash"` } func NewConfig(raws ...interface{}) (*Config, []string, error) { var c Config err := config.Decode(&c, &config.DecodeOpts{ Interpolate: true, InterpolateFilter: &interpolate.RenderFilter{}, }, raws...) if err != nil { return nil, nil, err } var errs *packer.MultiError if es := c.CommConfig.Prepare(nil); len(es) > 0 { errs = packer.MultiErrorAppend(errs, es...) } if c.CommConfig.Host() == "" { errs = packer.MultiErrorAppend(errs, fmt.Errorf("a Host must be specified, please reference your communicator documentation")) } if c.CommConfig.User() == "" { errs = packer.MultiErrorAppend(errs, fmt.Errorf("a Username must be specified, please reference your communicator documentation")) } if c.CommConfig.Password() == "" && c.CommConfig.SSHPrivateKey == "" { errs = packer.MultiErrorAppend(errs, fmt.Errorf("one authentication method must be specified, please reference your communicator documentation")) } if c.CommConfig.SSHPassword != "" && c.CommConfig.SSHPrivateKey != "" { errs = packer.MultiErrorAppend(errs, fmt.Errorf("only one of ssh_password and <API key> must be specified")) } if errs != nil && len(errs.Errors) > 0 { return nil, nil, errs } return &c, nil, nil }
package mf.org.w3c.dom.html; import mf.org.w3c.dom.*; import mf.org.w3c.dom.Node; /** * An <code>HTMLCollection</code> is a list of nodes. An individual nodemay be * accessed by either ordinal index or the node's<code>name</code> or * <code>id</code> attributes. Note:Collections in the HTML DOM are assumed * to be live meaningthat they are automatically updated when the underlying * document ischanged. */ public interface HTMLCollection { /** * This attribute specifies the length or size of the list. */ public int getLength(); /** * This method retrieves a node specified by ordinal index. Nodes are * numbered in tree order (depth-first traversal order). * @param index The index of the node to be fetched. The index origin is 0. * @return The <code>Node</code> at the corresponding position upon success. * A value of <code>null</code> is returned if the index is out of range. */ public Node item(int index); /** * This method retrieves a <code>Node</code> using a name. It first searches * for a <code>Node</code> with a matching <code>id</code> attribute. If it * doesn't find one, it then searches for a <code>Node</code> with a * matching <code>name</code> attribute, but only on those elements that * are allowed a name attribute. * @param name The name of the <code>Node</code> to be fetched. * @return The <code>Node</code> with a <code>name</code> or <code>id</code> * attribute whose value corresponds to the specified string. Upon * failure (e.g., no node with this name exists), returns * <code>null</code>. */ public Node namedItem(String name); }
// this will show what ends up in the fstream-npm package var P = require('../') var DW = require('fstream').DirWriter var target = new DW({ Directory: true, type: 'Directory', path: __dirname + '/output'}) function f (entry) { return entry.basename !== '.git' } P({ path: './', type: 'Directory', isDirectory: true, filter: f }) .on('package', function (p) { console.error('package', p) }) .on('ignoreFile', function (e) { console.error('ignoreFile', e) }) .on('entry', function (e) { console.error(e.constructor.name, e.path) }) .pipe(target) .on('end', function () { console.error('ended') })
// detail/assert.hpp #ifndef <API key> #define <API key> #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #if defined(<API key>) # include <boost/assert.hpp> #else // defined(<API key>) # include <cassert> #endif // defined(<API key>) #if defined(<API key>) # define BOOST_ASIO_ASSERT(expr) BOOST_ASSERT(expr) #else // defined(<API key>) # define BOOST_ASIO_ASSERT(expr) assert(expr) #endif // defined(<API key>) #endif // <API key>
(function (root, factory) { 'use strict'; var Intl = root.Intl || root.IntlPolyfill, MessageFormat = factory(Intl); // register in -all- the module systems (at once) if (typeof define === 'function' && define.amd) { define(MessageFormat); } if (typeof module === 'object' && typeof module.exports === 'object') { module.exports = MessageFormat; } if (root) { root.IntlMessageFormat = MessageFormat; } })(typeof global !== 'undefined' ? global : this, function (Intl) { 'use strict'; if (!Intl) { throw new ReferenceError ('Intl must be available'); } // Purposely using the same implementation as the Intl.js `Intl` polyfill. // Used for proto-less objects which won't have this method. var hop = Object.prototype.hasOwnProperty; var realDefineProp = (function () { try { return !!Object.defineProperty({}, 'a', {}); } catch (e) { return false; } })(); var es3 = !realDefineProp && !Object.prototype.__defineGetter__; var defineProperty = realDefineProp ? Object.defineProperty : function (obj, name, desc) { if ('get' in desc && obj.__defineGetter__) { obj.__defineGetter__(name, desc.get); } else if (!hop.call(obj, name) || 'value' in desc) { obj[name] = desc.value; } }; var objCreate = Object.create || function (proto, props) { var obj, k; function F() {} F.prototype = proto; obj = new F(); for (k in props) { if (hop.call(props, k)) { defineProperty(obj, k, props[k]); } } return obj; }; var fnBind = Function.prototype.bind || function (thisObj) { var fn = this, args = [].slice.call(arguments, 1); return function () { fn.apply(thisObj, args.concat([].slice.call(arguments))); }; }; function MessageFormat(pattern, locales, formats) { // Parse string messages into a tokenized JSON structure for traversal. if (typeof pattern === 'string') { pattern = MessageFormat.__parse(pattern); } if (!(pattern && typeof pattern.length === 'number')) { throw new TypeError('A pattern must be provided as a String or Array.'); } // Creates a new object with the specified `formats` merged with the // default formats. formats = this._mergeFormats(MessageFormat.FORMATS, formats); // Defined first because it's used to build the format pattern. defineProperty(this, '_locale', {value: this._resolveLocale(locales)}); // Define the `pattern` property, a compiled pattern that is highly // optimized for repeated `format()` invocations. **Note:** This passes // the `locales` set provided to the constructor instead of just the // resolved locale. pattern = this._compilePattern(pattern, locales, formats); defineProperty(this, '_pattern', {value: pattern}); // Bind `format()` method to `this` so it can be passed by reference // like the other `Intl` APIs. this.format = fnBind.call(this.format, this); } // Default format options used as the prototype of the `formats` provided to // the constructor. These are used when constructing the internal // Intl.NumberFormat and Intl.DateTimeFormat instances. defineProperty(MessageFormat, 'FORMATS', { enumerable: true, value: { number: { 'currency': { style: 'currency' }, 'percent': { style: 'percent' } }, date: { 'short': { month: 'numeric', day : 'numeric', year : '2-digit' }, 'medium': { month: 'short', day : 'numeric', year : 'numeric' }, 'long': { month: 'long', day : 'numeric', year : 'numeric' }, 'full': { weekday: 'long', month : 'long', day : 'numeric', year : 'numeric' } }, time: { 'short': { hour : 'numeric', minute: 'numeric' }, 'medium': { hour : 'numeric', minute: 'numeric', second: 'numeric' }, 'long': { hour : 'numeric', minute : 'numeric', second : 'numeric', timeZoneName: 'short' }, 'full': { hour : 'numeric', minute : 'numeric', second : 'numeric', timeZoneName: 'short' } } } }); // Define internal private properties for dealing with locale data. defineProperty(MessageFormat, '<API key>', {value: []}); defineProperty(MessageFormat, '__localeData__', {value: objCreate(null)}); defineProperty(MessageFormat, '__addLocaleData', {value: function (data) { if (!(data && data.locale)) { throw new Error('Object passed does not identify itself with a valid language tag'); } if (!data.messageformat) { throw new Error('Object passed does not contain locale data for IntlMessageFormat'); } var availableLocales = MessageFormat.<API key>, localeData = MessageFormat.__localeData__; // Message format locale data only requires the first part of the tag. var locale = data.locale.toLowerCase().split('-')[0]; availableLocales.push(locale); localeData[locale] = data.messageformat; if (MessageFormat.defaultLocale === undefined) { MessageFormat.defaultLocale = locale; } }}); // Defines `__parse()` static method as an exposed private. defineProperty(MessageFormat, '__parse', {value: parse}); // Define public `defaultLocale` property which is set when the first bundle // of locale data is added. defineProperty(MessageFormat, 'defaultLocale', { enumerable: true, writable : true }); MessageFormat.prototype.format = function (values) { return this._format(this._pattern, values); }; MessageFormat.prototype.resolvedOptions = function () { // TODO: Provide anything else? return { locale: this._locale }; }; MessageFormat.prototype._compilePattern = function (pattern, locales, formats) { // Wrap string patterns with an array for iteration control flow. if (typeof pattern === 'string') { pattern = [pattern]; } var locale = this._locale, localeData = MessageFormat.__localeData__, formatPattern = [], i, len, part, type, valueName, format, pluralFunction, options, key, optionsParts, option; for (i = 0, len = pattern.length; i < len; i += 1) { part = pattern[i]; // Checks if string part is a simple string, or if it has a // tokenized place-holder that needs to be substituted. if (typeof part === 'string') { formatPattern.push(createStringPart(part)); continue; } type = part.type; valueName = part.valueName; options = part.options; // Handles plural and select parts' options by building format // patterns for each option. if (options) { optionsParts = {}; for (key in options) { if (!hop.call(options, key)) { continue; } option = options[key]; // Early exit and special handling for plural options with a // "${#}" token. These options will have this token replaced // with NumberFormat wrap with optional prefix and suffix. if (type === 'plural' && typeof option === 'string' && option.indexOf('${ option = option.match(/(.*)\${ optionsParts[key] = [ option[1], // prefix { valueName: valueName, format : new Intl.NumberFormat(locales).format }, option[2] // suffix ]; continue; } // Recursively compiles a format pattern for the option. optionsParts[key] = this._compilePattern(option, locales, formats); } } // Create a specialized format part for each type. This creates a // common interface for the `format()` method and encapsulates the // relevant data need for each type of formatting. switch (type) { case 'date': format = formats.date[part.format]; formatPattern.push({ valueName: valueName, format : new Intl.DateTimeFormat(locales, format).format }); break; case 'time': format = formats.time[part.format]; formatPattern.push({ valueName: valueName, format : new Intl.DateTimeFormat(locales, format).format }); break; case 'number': format = formats.number[part.format]; formatPattern.push({ valueName: valueName, format : new Intl.NumberFormat(locales, format).format }); break; case 'plural': pluralFunction = localeData[locale].pluralFunction; formatPattern.push(new PluralPart(valueName, optionsParts, pluralFunction)); break; case 'select': formatPattern.push(new SelectPart(valueName, optionsParts)); break; default: throw new Error('Message pattern part at index ' + i + ' does not have a valid type'); } } return formatPattern; }; MessageFormat.prototype._format = function (pattern, values) { var result = '', i, len, part, valueName, value, options; for (i = 0, len = pattern.length; i < len; i += 1) { part = pattern[i]; // Exist early for string parts. if (typeof part === 'string') { result += part; continue; } valueName = part.valueName; // Enforce that all required values are provided by the caller. if (!(values && hop.call(values, valueName))) { throw new Error('A value must be provided for: ' + valueName); } value = values[valueName]; options = part.options; // a nested pattern structure. The choosing of the option to use is // abstracted-by and delegated-to the part helper object. if (options) { result += this._format(part.getOption(value), values); } else { result += part.format(value); } } return result; }; MessageFormat.prototype._mergeFormats = function (defaults, formats) { var mergedFormats = {}, type, mergedType; for (type in defaults) { if (!hop.call(defaults, type)) { continue; } mergedFormats[type] = mergedType = objCreate(defaults[type]); if (formats && hop.call(formats, type)) { extend(mergedType, formats[type]); } } return mergedFormats; }; MessageFormat.prototype._resolveLocale = function (locales) { var availableLocales = MessageFormat.<API key>, locale, parts, i, len; if (availableLocales.length === 0) { throw new Error('No locale data has been provided for IntlMessageFormat yet'); } if (typeof locales === 'string') { locales = [locales]; } if (locales && locales.length) { for (i = 0, len = locales.length; i < len; i += 1) { locale = locales[i].toLowerCase().split('-')[0]; // Make sure the first part of the locale that we care about is // structurally valid. if (!/[a-z]{2,3}/i.test(locale)) { throw new RangeError('"' + locales[i] + '" is not a structurally valid language tag'); } if (availableLocales.indexOf(locale) >= 0) { break; } } } return locale || MessageFormat.defaultLocale; }; var RE_PARSED_TOKEN = /^\${([-\w]+)}$/; function createStringPart(str) { var token = str.match(RE_PARSED_TOKEN); return token ? new StringPart(token[1]) : str; } function StringPart(valueName) { this.valueName = valueName; } StringPart.prototype.format = function (value) { if (!value) { return ''; } return typeof value === 'string' ? value : String(value); }; function SelectPart(valueName, options) { this.valueName = valueName; this.options = options; } SelectPart.prototype.getOption = function (value) { var options = this.options; return options[value] || options.other; }; function PluralPart(valueName, options, pluralFunction) { this.valueName = valueName; this.options = options; this.pluralFunction = pluralFunction; } PluralPart.prototype.getOption = function (value) { var options = this.options, option = this.pluralFunction(value); return options[option] || options.other; }; // `type` (required): The name of the message format type. // `regex` (required): The regex used to check if this formatter can parse the message. // `parse` (required): The main parse method which is given the full message. // `tokenParser` (optional): Used to parse the remaining tokens of a message (what remains after the variable and the format type). // `postParser` (optional): Used to format the output before returning from the main `parse` method. // `outputFormatter` (optional): Used to format the fully parsed string returned from the base case of the recursive parser. var FORMATTERS = [ { type: 'string', regex: /^{\s*([-\w]+)\s*}$/, parse: formatElementParser, postParser: function (parsed) { return '${' + parsed.valueName + '}'; } }, { type: 'select', regex: /^{\s*([-\w]+)\s*,\s*select\s*,\s*(.*)\s*}$/, parse: formatElementParser, tokenParser: pairedOptionsParser }, { type: 'plural', regex: /^{\s*([-\w]+)\s*,\s*plural\s*,\s*(.*)\s*}$/, parse: formatElementParser, tokenParser: pairedOptionsParser, outputFormatter: function (str) { return str.replace(/ } }, { type: 'time', regex: /^{\s*([-\w]+)\s*,\s*time(?:,(.*))?\s*}$/, parse: formatElementParser, tokenParser: formatOptionParser, postParser: function (parsed) { parsed.format = parsed.format || 'medium'; return parsed; } }, { type: 'date', regex: /^{\s*([-\w]+)\s*,\s*date(?:,(.*))?\s*}$/, parse: formatElementParser, tokenParser: formatOptionParser, postParser: function (parsed) { parsed.format = parsed.format || 'medium'; return parsed; } }, { type: 'number', regex: /^{\s*([-\w]+)\s*,\s*number(?:,(.*))?\s*}$/, parse: formatElementParser, tokenParser: formatOptionParser }, { type: 'custom', regex: /^{\s*([-\w]+)\s*,\s*([a-zA-Z]*)(?:,(.*))?\s*}$/, parse: formatElementParser, tokenParser:formatOptionParser } ]; /** Tokenizes a MessageFormat pattern. @method tokenize @param {String} pattern A pattern @param {Boolean} trim Whether or not the tokens should be trimmed of whitespace @return {Array} Tokens **/ function tokenize (pattern, trim) { var bracketRE = /[{}]/g, tokens = [], balance = 0, startIndex = 0, endIndex, substr, match, i, len; match = bracketRE.exec(pattern); while (match) { // Keep track of balanced brackets balance += match[0] === '{' ? 1 : -1; // Imbalanced brackets detected (e.g. "}hello{", "{hello}}") if (balance < 0) { throw new Error('Imbalanced bracket detected at index ' + match.index + ' for message "' + pattern + '"'); } // Tokenize a pair of balanced brackets if (balance === 0) { endIndex = match.index + 1; tokens.push( pattern.slice(startIndex, endIndex) ); startIndex = endIndex; } // Tokenize any text that comes before the first opening bracket if (balance === 1 && startIndex !== match.index) { substr = pattern.slice(startIndex, match.index); if (substr.indexOf('{') === -1) { tokens.push(substr); startIndex = match.index; } } match = bracketRE.exec(pattern); } // Imbalanced brackets detected (e.g. "{{hello}") if (balance !== 0) { throw new Error('Brackets were not properly closed: ' + pattern); } // Tokenize any remaining non-empty string if (startIndex !== pattern.length) { tokens.push( pattern.slice(startIndex) ); } if (trim) { for (i = 0, len = tokens.length; i < len; i++) { tokens[i] = tokens[i].replace(/^\s+|\s+$/gm, ''); } } return tokens; } /** Gets the content of the format element by peeling off the outermost pair of brackets. @method <API key> @param {String} formatElement Format element @return {String} Contents of format element **/ function <API key> (formatElement) { return formatElement.replace(/^\{\s*/,'').replace(/\s*\}$/, ''); } /** Checks if the pattern contains a format element. @method <API key> @param {String} pattern Pattern @return {Boolean} Whether or not the pattern contains a format element **/ function <API key> (pattern) { return pattern.indexOf('{') >= 0; } /** Parses a list of tokens into paired options where the key is the option name and the value is the pattern. @method pairedOptionsParser @param {Object} parsed Parsed object @param {Array} tokens Remaining tokens that come after the value name and the format id @return {Object} Parsed object with added options **/ function pairedOptionsParser (parsed, tokens) { var hasDefault, value, name, l, i; parsed.options = {}; if (tokens.length % 2) { throw new Error('Options must come in pairs: ' + tokens.join(', ')); } for (i = 0, l = tokens.length; i < l; i += 2) { name = tokens[i]; value = tokens[i + 1]; parsed.options[name] = value; hasDefault = hasDefault || name === 'other'; } if (!hasDefault) { throw new Error('Options must include default "other" option: ' + tokens.join(', ')); } return parsed; } function formatOptionParser (parsed, tokens) { parsed.format = tokens[0]; return parsed; } /** Parses a format element. Format elements are surrounded by curly braces, and contain at least a value name. @method formatElementParser @param {String} formatElement A format element @param {Object} match The result of a String.match() that has at least the value name at index 1 and a subformat at index 2 @return {Object} Parsed object **/ function formatElementParser (formatElement, match, formatter) { var parsed = { type: formatter.type, valueName: match[1] }, tokens = match[2] && tokenize(match[2], true); // If there are any additional tokens to parse, it should be done here if (formatter.tokenParser && tokens) { parsed = formatter.tokenParser(parsed, tokens); } // Any final modifications to the parsed output should be done here if (formatter.postParser) { parsed = formatter.postParser(parsed); } return parsed; } /** For each formatter, test it on the token in order. Exit early on first token matched. @method parseToken @param {Array} tokens @param {Number} index @return {String|Object} Parsed token or original token */ function parseToken (tokens, index) { var i, len; for (i = 0, len = FORMATTERS.length; i < len; i++) { if (parseFormatTokens(FORMATTERS[i], tokens, index)) { return tokens[index]; } } return tokens[index]; } /** Attempts to parse a token at the given index with the provided formatter. If the token fails the `formatter.regex`, `false` is returned. Otherwise, the token is parsed with `formatter.parse`. Then if the token contains options due to the parsing process, it has each option processed. Then it returns `true` alerting the caller the token was parsed. @method parseFormatTokens @param {Object} formatter @param {Array} tokens @param {Number} tokenIndex @return {Boolean} */ function parseFormatTokens (formatter, tokens, tokenIndex) { var token = tokens[tokenIndex], match = token.match(formatter.regex), parsedToken, parsedKeys = [], key, i, len; if (match) { parsedToken = formatter.parse(token, match, formatter); tokens[tokenIndex] = parsedToken; // if we have options, each option must be parsed if (parsedToken && parsedToken.options && typeof parsedToken.options === 'object') { for (key in parsedToken.options) { if (parsedToken.options.hasOwnProperty(key)) { parsedKeys.push(key); } } } for (i = 0, len = parsedKeys.length; i < len; i++) { parseFormatOptions(parsedToken, parsedKeys[i], formatter); } return true; } return !!match; } /** @method parseFormatOptions @param {Object} */ function parseFormatOptions (parsedToken, key, formatter) { var value = parsedToken.options && parsedToken.options[key]; value = <API key>(value); parsedToken.options[key] = parse(value, formatter.outputFormatter); } /** Parses a pattern that may contain nested format elements. @method parse @param {String} pattern A pattern @return {Object|Array} Parsed output **/ function parse (pattern, outputFormatter) { var tokens, i, len; // base case (plain string) if (!<API key>(pattern)) { // Final chance to format the string before the parser spits it out return outputFormatter ? outputFormatter(pattern) : [pattern]; } tokens = tokenize(pattern); for (i = 0, len = tokens.length; i < len; i++) { if (tokens[i].charAt(0) === '{') { // tokens must start with a { tokens[i] = parseToken(tokens, i); } } return tokens; } function extend(obj) { var sources = Array.prototype.slice.call(arguments, 1), i, len, source, key; for (i = 0, len = sources.length; i < len; i += 1) { source = sources[i]; if (!source) { continue; } for (key in source) { if (source.hasOwnProperty(key)) { obj[key] = source[key]; } } } return obj; } return MessageFormat; }); IntlMessageFormat.__addLocaleData({locale:"sbp", messageformat:{pluralFunction:function (n) { }}});
"use strict";const{kFourOhFourContext,<API key>}=require("./symbols.js");function Context(t,e,r,l,i,s,n,o,h,a,u,m,c){this.schema=t,this.handler=e,this.Reply=r,this.Request=l,this.contentTypeParser=i,this.onRequest=null,this.onSend=null,this.onError=null,this.onTimeout=null,this.preHandler=null,this.onResponse=null,this.config=s,this.errorHandler=n,this._middie=null,this._parserOptions={limit:o||null},this.logLevel=h,this.logSerializers=a,this[kFourOhFourContext]=null,this.attachValidation=u,this[<API key>]=m,this.<API key>=c||<API key>}function <API key>(t,e){let r="";for(var l=0;l!==t.length;++l){var i=t[l];r+=e+(i.dataPath||"")+" "+i.message+", "}return new Error(r.slice(0,-", ".length))}module.exports=Context;
#include <linux/time.h> #include <linux/fs.h> #include <linux/jbd2.h> #include <linux/stat.h> #include <linux/string.h> #include <linux/quotaops.h> #include <linux/buffer_head.h> #include <linux/random.h> #include <linux/bitops.h> #include <linux/blkdev.h> #include <asm/byteorder.h> #include "ext4.h" #include "ext4_jbd2.h" #include "xattr.h" #include "acl.h" #include <trace/events/ext4.h> /* * ialloc.c contains the inodes allocation and deallocation routines */ /* * The free inodes are managed by bitmaps. A file system contains several * blocks groups. Each group contains 1 bitmap block for blocks, 1 bitmap * block for inodes, N blocks for the inode table and data blocks. * * The file system contains group descriptors which are located after the * super block. Each descriptor contains the number of the bitmap block and * the free blocks count in the block. */ /* * To avoid calling the atomic setbit hundreds or thousands of times, we only * need to use it within a single byte (to ensure we get endianness right). * We can use memset for the rest of the bitmap as there are no other users. */ void mark_bitmap_end(int start_bit, int end_bit, char *bitmap) { int i; if (start_bit >= end_bit) return; ext4_debug("mark end bits +%d through +%d used\n", start_bit, end_bit); for (i = start_bit; i < ((start_bit + 7) & ~7UL); i++) ext4_set_bit(i, bitmap); if (i < end_bit) memset(bitmap + (i >> 3), 0xff, (end_bit - i) >> 3); } /* Initializes an uninitialized inode bitmap */ unsigned <API key>(struct super_block *sb, struct buffer_head *bh, ext4_group_t block_group, struct ext4_group_desc *gdp) { struct ext4_sb_info *sbi = EXT4_SB(sb); J_ASSERT_BH(bh, buffer_locked(bh)); /* If checksum is bad mark all blocks and inodes use to prevent * allocation, essentially implementing a per-group read-only flag. */ if (!<API key>(sbi, block_group, gdp)) { ext4_error(sb, "Checksum bad for group %u", block_group); ext4_free_blks_set(sb, gdp, 0); <API key>(sb, gdp, 0); <API key>(sb, gdp, 0); memset(bh->b_data, 0xff, sb->s_blocksize); return 0; } memset(bh->b_data, 0, (<API key>(sb) + 7) / 8); mark_bitmap_end(<API key>(sb), sb->s_blocksize * 8, bh->b_data); return <API key>(sb); } /* * Read the inode allocation bitmap for a given block_group, reading * into the specified slot in the superblock's bitmap cache. * * Return buffer_head of bitmap on success or NULL. */ static struct buffer_head * <API key>(struct super_block *sb, ext4_group_t block_group) { struct ext4_group_desc *desc; struct buffer_head *bh = NULL; ext4_fsblk_t bitmap_blk; desc = ext4_get_group_desc(sb, block_group, NULL); if (!desc) return NULL; bitmap_blk = ext4_inode_bitmap(sb, desc); bh = sb_getblk(sb, bitmap_blk); if (unlikely(!bh)) { ext4_error(sb, "Cannot read inode bitmap - " "block_group = %u, inode_bitmap = %llu", block_group, bitmap_blk); return NULL; } if (bitmap_uptodate(bh)) return bh; lock_buffer(bh); if (bitmap_uptodate(bh)) { unlock_buffer(bh); return bh; } ext4_lock_group(sb, block_group); if (desc->bg_flags & cpu_to_le16(<API key>)) { <API key>(sb, bh, block_group, desc); set_bitmap_uptodate(bh); set_buffer_uptodate(bh); ext4_unlock_group(sb, block_group); unlock_buffer(bh); return bh; } ext4_unlock_group(sb, block_group); if (buffer_uptodate(bh)) { /* * if not uninit if bh is uptodate, * bitmap is also uptodate */ set_bitmap_uptodate(bh); unlock_buffer(bh); return bh; } /* * submit the buffer_head for read. We can * safely mark the bitmap as uptodate now. * We do it here so the bitmap uptodate bit * get set with buffer lock held. */ set_bitmap_uptodate(bh); if (bh_submit_read(bh) < 0) { put_bh(bh); ext4_error(sb, "Cannot read inode bitmap - " "block_group = %u, inode_bitmap = %llu", block_group, bitmap_blk); return NULL; } return bh; } /* * NOTE! When we get the inode, we're the only people * that have access to it, and as such there are no * race conditions we have to worry about. The inode * is not on the hash-lists, and it cannot be reached * through the filesystem because the directory entry * has been deleted earlier. * * HOWEVER: we must make sure that we get no aliases, * which means that we have to call "clear_inode()" * _before_ we mark the inode not in use in the inode * bitmaps. Otherwise a newly created file might use * the same inode number (not actually the same pointer * though), and then we'd have two inodes sharing the * same inode number and space on the harddisk. */ void ext4_free_inode(handle_t *handle, struct inode *inode) { struct super_block *sb = inode->i_sb; int is_directory; unsigned long ino; struct buffer_head *bitmap_bh = NULL; struct buffer_head *bh2; ext4_group_t block_group; unsigned long bit; struct ext4_group_desc *gdp; struct ext4_super_block *es; struct ext4_sb_info *sbi; int fatal = 0, err, count, cleared; if (atomic_read(&inode->i_count) > 1) { printk(KERN_ERR "ext4_free_inode: inode has count=%d\n", atomic_read(&inode->i_count)); return; } if (inode->i_nlink) { printk(KERN_ERR "ext4_free_inode: inode has nlink=%d\n", inode->i_nlink); return; } if (!sb) { printk(KERN_ERR "ext4_free_inode: inode on " "nonexistent device\n"); return; } sbi = EXT4_SB(sb); ino = inode->i_ino; ext4_debug("freeing inode %lu\n", ino); <API key>(inode); /* * Note: we must free any quota before locking the superblock, * as writing the quota to disk may need the lock as well. */ dquot_initialize(inode); <API key>(handle, inode); dquot_free_inode(inode); dquot_drop(inode); is_directory = S_ISDIR(inode->i_mode); /* Do this BEFORE marking the inode not in use or returning an error */ clear_inode(inode); es = EXT4_SB(sb)->s_es; if (ino < EXT4_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) { ext4_error(sb, "reserved or nonexistent inode %lu", ino); goto error_return; } block_group = (ino - 1) / <API key>(sb); bit = (ino - 1) % <API key>(sb); bitmap_bh = <API key>(sb, block_group); if (!bitmap_bh) goto error_return; BUFFER_TRACE(bitmap_bh, "get_write_access"); fatal = <API key>(handle, bitmap_bh); if (fatal) goto error_return; fatal = -ESRCH; gdp = ext4_get_group_desc(sb, block_group, &bh2); if (gdp) { BUFFER_TRACE(bh2, "get_write_access"); fatal = <API key>(handle, bh2); } ext4_lock_group(sb, block_group); cleared = ext4_clear_bit(bit, bitmap_bh->b_data); if (fatal || !cleared) { ext4_unlock_group(sb, block_group); goto out; } count = <API key>(sb, gdp) + 1; <API key>(sb, gdp, count); if (is_directory) { count = <API key>(sb, gdp) - 1; ext4_used_dirs_set(sb, gdp, count); percpu_counter_dec(&sbi->s_dirs_counter); } gdp->bg_checksum = <API key>(sbi, block_group, gdp); ext4_unlock_group(sb, block_group); percpu_counter_inc(&sbi-><API key>); if (sbi-><API key>) { ext4_group_t f = ext4_flex_group(sbi, block_group); atomic_inc(&sbi->s_flex_groups[f].free_inodes); if (is_directory) atomic_dec(&sbi->s_flex_groups[f].used_dirs); } BUFFER_TRACE(bh2, "call <API key>"); fatal = <API key>(handle, NULL, bh2); out: if (cleared) { BUFFER_TRACE(bitmap_bh, "call <API key>"); err = <API key>(handle, NULL, bitmap_bh); if (!fatal) fatal = err; <API key>(sb); } else ext4_error(sb, "bit already cleared for inode %lu", ino); error_return: brelse(bitmap_bh); ext4_std_error(sb, fatal); } /* * There are two policies for allocating an inode. If the new inode is * a directory, then a forward search is made for a block group with both * free space and a low directory-to-inode ratio; if that fails, then of * the groups with above-average free space, that group with the fewest * directories already is chosen. * * For other inodes, search forward from the parent directory\'s block * group to find a free inode. */ static int find_group_dir(struct super_block *sb, struct inode *parent, ext4_group_t *best_group) { ext4_group_t ngroups = <API key>(sb); unsigned int freei, avefreei; struct ext4_group_desc *desc, *best_desc = NULL; ext4_group_t group; int ret = -1; freei = <API key>(&EXT4_SB(sb)-><API key>); avefreei = freei / ngroups; for (group = 0; group < ngroups; group++) { desc = ext4_get_group_desc(sb, group, NULL); if (!desc || !<API key>(sb, desc)) continue; if (<API key>(sb, desc) < avefreei) continue; if (!best_desc || (<API key>(sb, desc) > <API key>(sb, best_desc))) { *best_group = group; best_desc = desc; ret = 0; } } return ret; } #define free_block_ratio 10 static int find_group_flex(struct super_block *sb, struct inode *parent, ext4_group_t *best_group) { struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_group_desc *desc; struct flex_groups *flex_group = sbi->s_flex_groups; ext4_group_t parent_group = EXT4_I(parent)->i_block_group; ext4_group_t parent_fbg_group = ext4_flex_group(sbi, parent_group); ext4_group_t ngroups = <API key>(sb); int flex_size = ext4_flex_bg_size(sbi); ext4_group_t best_flex = parent_fbg_group; int blocks_per_flex = sbi->s_blocks_per_group * flex_size; int flexbg_free_blocks; int flex_freeb_ratio; ext4_group_t n_fbg_groups; ext4_group_t i; n_fbg_groups = (ngroups + flex_size - 1) >> sbi-><API key>; <API key>: flexbg_free_blocks = atomic_read(&flex_group[best_flex].free_blocks); flex_freeb_ratio = flexbg_free_blocks * 100 / blocks_per_flex; if (atomic_read(&flex_group[best_flex].free_inodes) && flex_freeb_ratio > free_block_ratio) goto found_flexbg; if (best_flex && best_flex == parent_fbg_group) { best_flex goto <API key>; } for (i = 0; i < n_fbg_groups; i++) { if (i == parent_fbg_group || i == parent_fbg_group - 1) continue; flexbg_free_blocks = atomic_read(&flex_group[i].free_blocks); flex_freeb_ratio = flexbg_free_blocks * 100 / blocks_per_flex; if (flex_freeb_ratio > free_block_ratio && (atomic_read(&flex_group[i].free_inodes))) { best_flex = i; goto found_flexbg; } if ((atomic_read(&flex_group[best_flex].free_inodes) == 0) || ((atomic_read(&flex_group[i].free_blocks) > atomic_read(&flex_group[best_flex].free_blocks)) && atomic_read(&flex_group[i].free_inodes))) best_flex = i; } if (!atomic_read(&flex_group[best_flex].free_inodes) || !atomic_read(&flex_group[best_flex].free_blocks)) return -1; found_flexbg: for (i = best_flex * flex_size; i < ngroups && i < (best_flex + 1) * flex_size; i++) { desc = ext4_get_group_desc(sb, i, NULL); if (<API key>(sb, desc)) { *best_group = i; goto out; } } return -1; out: return 0; } struct orlov_stats { __u32 free_inodes; __u32 free_blocks; __u32 used_dirs; }; /* * Helper function for Orlov's allocator; returns critical information * for a particular block group or flex_bg. If flex_size is 1, then g * is a block group number; otherwise it is flex_bg number. */ void get_orlov_stats(struct super_block *sb, ext4_group_t g, int flex_size, struct orlov_stats *stats) { struct ext4_group_desc *desc; struct flex_groups *flex_group = EXT4_SB(sb)->s_flex_groups; if (flex_size > 1) { stats->free_inodes = atomic_read(&flex_group[g].free_inodes); stats->free_blocks = atomic_read(&flex_group[g].free_blocks); stats->used_dirs = atomic_read(&flex_group[g].used_dirs); return; } desc = ext4_get_group_desc(sb, g, NULL); if (desc) { stats->free_inodes = <API key>(sb, desc); stats->free_blocks = <API key>(sb, desc); stats->used_dirs = <API key>(sb, desc); } else { stats->free_inodes = 0; stats->free_blocks = 0; stats->used_dirs = 0; } } /* * Orlov's allocator for directories. * * We always try to spread first-level directories. * * If there are blockgroups with both free inodes and free blocks counts * not worse than average we return one with smallest directory count. * Otherwise we simply return a random group. * * For the rest rules look so: * * It's OK to put directory into a group unless * it has too many directories already (max_dirs) or * it has too few free inodes left (min_inodes) or * it has too few free blocks left (min_blocks) or * Parent's group is preferred, if it doesn't satisfy these * conditions we search cyclically through the rest. If none * of the groups look good we just look for a group with more * free inodes than average (starting at parent's group). */ static int find_group_orlov(struct super_block *sb, struct inode *parent, ext4_group_t *group, int mode, const struct qstr *qstr) { ext4_group_t parent_group = EXT4_I(parent)->i_block_group; struct ext4_sb_info *sbi = EXT4_SB(sb); ext4_group_t real_ngroups = <API key>(sb); int inodes_per_group = <API key>(sb); unsigned int freei, avefreei; ext4_fsblk_t freeb, avefreeb; unsigned int ndirs; int max_dirs, min_inodes; ext4_grpblk_t min_blocks; ext4_group_t i, grp, g, ngroups; struct ext4_group_desc *desc; struct orlov_stats stats; int flex_size = ext4_flex_bg_size(sbi); struct dx_hash_info hinfo; ngroups = real_ngroups; if (flex_size > 1) { ngroups = (real_ngroups + flex_size - 1) >> sbi-><API key>; parent_group >>= sbi-><API key>; } freei = <API key>(&sbi-><API key>); avefreei = freei / ngroups; freeb = <API key>(&sbi-><API key>); avefreeb = freeb; do_div(avefreeb, ngroups); ndirs = <API key>(&sbi->s_dirs_counter); if (S_ISDIR(mode) && ((parent == sb->s_root->d_inode) || (<API key>(parent, EXT4_INODE_TOPDIR)))) { int best_ndir = inodes_per_group; int ret = -1; if (qstr) { hinfo.hash_version = DX_HASH_HALF_MD4; hinfo.seed = sbi->s_hash_seed; ext4fs_dirhash(qstr->name, qstr->len, &hinfo); grp = hinfo.hash; } else get_random_bytes(&grp, sizeof(grp)); parent_group = (unsigned)grp % ngroups; for (i = 0; i < ngroups; i++) { g = (parent_group + i) % ngroups; get_orlov_stats(sb, g, flex_size, &stats); if (!stats.free_inodes) continue; if (stats.used_dirs >= best_ndir) continue; if (stats.free_inodes < avefreei) continue; if (stats.free_blocks < avefreeb) continue; grp = g; ret = 0; best_ndir = stats.used_dirs; } if (ret) goto fallback; found_flex_bg: if (flex_size == 1) { *group = grp; return 0; } /* * We pack inodes at the beginning of the flexgroup's * inode tables. Block allocation decisions will do * something similar, although regular files will * start at 2nd block group of the flexgroup. See * ext4_ext_find_goal() and ext4_find_near(). */ grp *= flex_size; for (i = 0; i < flex_size; i++) { if (grp+i >= real_ngroups) break; desc = ext4_get_group_desc(sb, grp+i, NULL); if (desc && <API key>(sb, desc)) { *group = grp+i; return 0; } } goto fallback; } max_dirs = ndirs / ngroups + inodes_per_group / 16; min_inodes = avefreei - inodes_per_group*flex_size / 4; if (min_inodes < 1) min_inodes = 1; min_blocks = avefreeb - <API key>(sb)*flex_size / 4; /* * Start looking in the flex group where we last allocated an * inode for this parent directory */ if (EXT4_I(parent)->i_last_alloc_group != ~0) { parent_group = EXT4_I(parent)->i_last_alloc_group; if (flex_size > 1) parent_group >>= sbi-><API key>; } for (i = 0; i < ngroups; i++) { grp = (parent_group + i) % ngroups; get_orlov_stats(sb, grp, flex_size, &stats); if (stats.used_dirs >= max_dirs) continue; if (stats.free_inodes < min_inodes) continue; if (stats.free_blocks < min_blocks) continue; goto found_flex_bg; } fallback: ngroups = real_ngroups; avefreei = freei / ngroups; fallback_retry: parent_group = EXT4_I(parent)->i_block_group; for (i = 0; i < ngroups; i++) { grp = (parent_group + i) % ngroups; desc = ext4_get_group_desc(sb, grp, NULL); if (desc && <API key>(sb, desc) && <API key>(sb, desc) >= avefreei) { *group = grp; return 0; } } if (avefreei) { /* * The free-inodes counter is approximate, and for really small * filesystems the above test can fail to find any blockgroups */ avefreei = 0; goto fallback_retry; } return -1; } static int find_group_other(struct super_block *sb, struct inode *parent, ext4_group_t *group, int mode) { ext4_group_t parent_group = EXT4_I(parent)->i_block_group; ext4_group_t i, last, ngroups = <API key>(sb); struct ext4_group_desc *desc; int flex_size = ext4_flex_bg_size(EXT4_SB(sb)); /* * Try to place the inode is the same flex group as its * parent. If we can't find space, use the Orlov algorithm to * find another flex group, and store that information in the * parent directory's inode information so that use that flex * group for future allocations. */ if (flex_size > 1) { int retry = 0; try_again: parent_group &= ~(flex_size-1); last = parent_group + flex_size; if (last > ngroups) last = ngroups; for (i = parent_group; i < last; i++) { desc = ext4_get_group_desc(sb, i, NULL); if (desc && <API key>(sb, desc)) { *group = i; return 0; } } if (!retry && EXT4_I(parent)->i_last_alloc_group != ~0) { retry = 1; parent_group = EXT4_I(parent)->i_last_alloc_group; goto try_again; } /* * If this didn't work, use the Orlov search algorithm * to find a new flex group; we pass in the mode to * avoid the topdir algorithms. */ *group = parent_group + flex_size; if (*group > ngroups) *group = 0; return find_group_orlov(sb, parent, group, mode, 0); } /* * Try to place the inode in its parent directory */ *group = parent_group; desc = ext4_get_group_desc(sb, *group, NULL); if (desc && <API key>(sb, desc) && <API key>(sb, desc)) return 0; /* * We're going to place this inode in a different blockgroup from its * parent. We want to cause files in a common directory to all land in * the same blockgroup. But we want files which are in a different * directory which shares a blockgroup with our parent to land in a * different blockgroup. * * So add our directory's i_ino into the starting point for the hash. */ *group = (*group + parent->i_ino) % ngroups; /* * Use a quadratic hash to find a group with a free inode and some free * blocks. */ for (i = 1; i < ngroups; i <<= 1) { *group += i; if (*group >= ngroups) *group -= ngroups; desc = ext4_get_group_desc(sb, *group, NULL); if (desc && <API key>(sb, desc) && <API key>(sb, desc)) return 0; } /* * That failed: try linear search for a free inode, even if that group * has no free blocks. */ *group = parent_group; for (i = 0; i < ngroups; i++) { if (++*group >= ngroups) *group = 0; desc = ext4_get_group_desc(sb, *group, NULL); if (desc && <API key>(sb, desc)) return 0; } return -1; } /* * claim the inode from the inode bitmap. If the group * is uninit we need to take the groups's ext4_group_lock * and clear the uninit flag. The inode bitmap update * and group desc uninit flag clear should be done * after holding ext4_group_lock so that <API key> * doesn't race with the ext4_claim_inode */ static int ext4_claim_inode(struct super_block *sb, struct buffer_head *inode_bitmap_bh, unsigned long ino, ext4_group_t group, int mode) { int free = 0, retval = 0, count; struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_group_desc *gdp = ext4_get_group_desc(sb, group, NULL); ext4_lock_group(sb, group); if (ext4_set_bit(ino, inode_bitmap_bh->b_data)) { /* not a free inode */ retval = 1; goto err_ret; } ino++; if ((group == 0 && ino < EXT4_FIRST_INO(sb)) || ino > <API key>(sb)) { ext4_unlock_group(sb, group); ext4_error(sb, "reserved inode or inode > inodes count - " "block_group = %u, inode=%lu", group, ino + group * <API key>(sb)); return 1; } /* If we didn't allocate from within the initialized part of the inode * table then we need to initialize up to this inode. */ if (<API key>(sb, <API key>)) { if (gdp->bg_flags & cpu_to_le16(<API key>)) { gdp->bg_flags &= cpu_to_le16(~<API key>); /* When marking the block group with * ~<API key> we don't want to depend * on the value of bg_itable_unused even though * mke2fs could have initialized the same for us. * Instead we calculated the value below */ free = 0; } else { free = <API key>(sb) - <API key>(sb, gdp); } /* * Check the relative inode number against the last used * relative inode number in this group. if it is greater * we need to update the bg_itable_unused count * */ if (ino > free) <API key>(sb, gdp, (<API key>(sb) - ino)); } count = <API key>(sb, gdp) - 1; <API key>(sb, gdp, count); if (S_ISDIR(mode)) { count = <API key>(sb, gdp) + 1; ext4_used_dirs_set(sb, gdp, count); if (sbi-><API key>) { ext4_group_t f = ext4_flex_group(sbi, group); atomic_inc(&sbi->s_flex_groups[f].used_dirs); } } gdp->bg_checksum = <API key>(sbi, group, gdp); err_ret: ext4_unlock_group(sb, group); return retval; } /* * There are two policies for allocating an inode. If the new inode is * a directory, then a forward search is made for a block group with both * free space and a low directory-to-inode ratio; if that fails, then of * the groups with above-average free space, that group with the fewest * directories already is chosen. * * For other inodes, search forward from the parent directory's block * group to find a free inode. */ struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode, const struct qstr *qstr, __u32 goal) { struct super_block *sb; struct buffer_head *inode_bitmap_bh = NULL; struct buffer_head *group_desc_bh; ext4_group_t ngroups, group = 0; unsigned long ino = 0; struct inode *inode; struct ext4_group_desc *gdp = NULL; struct ext4_inode_info *ei; struct ext4_sb_info *sbi; int ret2, err = 0; struct inode *ret; ext4_group_t i; int free = 0; static int once = 1; ext4_group_t flex_group; /* Cannot create files in a deleted directory */ if (!dir || !dir->i_nlink) return ERR_PTR(-EPERM); sb = dir->i_sb; ngroups = <API key>(sb); <API key>(dir, mode); inode = new_inode(sb); if (!inode) return ERR_PTR(-ENOMEM); ei = EXT4_I(inode); sbi = EXT4_SB(sb); if (!goal) goal = sbi->s_inode_goal; if (goal && goal <= le32_to_cpu(sbi->s_es->s_inodes_count)) { group = (goal - 1) / <API key>(sb); ino = (goal - 1) % <API key>(sb); ret2 = 0; goto got_group; } if (sbi-><API key> && test_opt(sb, OLDALLOC)) { ret2 = find_group_flex(sb, dir, &group); if (ret2 == -1) { ret2 = find_group_other(sb, dir, &group, mode); if (ret2 == 0 && once) { once = 0; printk(KERN_NOTICE "ext4: find_group_flex " "failed, fallback succeeded dir %lu\n", dir->i_ino); } } goto got_group; } if (S_ISDIR(mode)) { if (test_opt(sb, OLDALLOC)) ret2 = find_group_dir(sb, dir, &group); else ret2 = find_group_orlov(sb, dir, &group, mode, qstr); } else ret2 = find_group_other(sb, dir, &group, mode); got_group: EXT4_I(dir)->i_last_alloc_group = group; err = -ENOSPC; if (ret2 == -1) goto out; for (i = 0; i < ngroups; i++, ino = 0) { err = -EIO; gdp = ext4_get_group_desc(sb, group, &group_desc_bh); if (!gdp) goto fail; brelse(inode_bitmap_bh); inode_bitmap_bh = <API key>(sb, group); if (!inode_bitmap_bh) goto fail; <API key>: ino = <API key>((unsigned long *) inode_bitmap_bh->b_data, <API key>(sb), ino); if (ino < <API key>(sb)) { BUFFER_TRACE(inode_bitmap_bh, "get_write_access"); err = <API key>(handle, inode_bitmap_bh); if (err) goto fail; BUFFER_TRACE(group_desc_bh, "get_write_access"); err = <API key>(handle, group_desc_bh); if (err) goto fail; if (!ext4_claim_inode(sb, inode_bitmap_bh, ino, group, mode)) { /* we won it */ BUFFER_TRACE(inode_bitmap_bh, "call <API key>"); err = <API key>(handle, NULL, inode_bitmap_bh); if (err) goto fail; /* zero bit is inode number 1*/ ino++; goto got; } /* we lost it */ <API key>(handle, inode_bitmap_bh); <API key>(handle, group_desc_bh); if (++ino < <API key>(sb)) goto <API key>; } /* * This case is possible in concurrent environment. It is very * rare. We cannot repeat the find_group_xxx() call because * that will simply return the same blockgroup, because the * group descriptor metadata has not yet been updated. * So we just go onto the next blockgroup. */ if (++group == ngroups) group = 0; } err = -ENOSPC; goto out; got: /* We may have to initialize the block bitmap if it isn't already */ if (<API key>(sb, <API key>) && gdp->bg_flags & cpu_to_le16(<API key>)) { struct buffer_head *block_bitmap_bh; block_bitmap_bh = <API key>(sb, group); BUFFER_TRACE(block_bitmap_bh, "get block bitmap access"); err = <API key>(handle, block_bitmap_bh); if (err) { brelse(block_bitmap_bh); goto fail; } free = 0; ext4_lock_group(sb, group); /* recheck and clear flag under lock if we still need to */ if (gdp->bg_flags & cpu_to_le16(<API key>)) { free = <API key>(sb, group, gdp); gdp->bg_flags &= cpu_to_le16(~<API key>); ext4_free_blks_set(sb, gdp, free); gdp->bg_checksum = <API key>(sbi, group, gdp); } ext4_unlock_group(sb, group); /* Don't need to dirty bitmap block if we didn't change it */ if (free) { BUFFER_TRACE(block_bitmap_bh, "dirty block bitmap"); err = <API key>(handle, NULL, block_bitmap_bh); } brelse(block_bitmap_bh); if (err) goto fail; } BUFFER_TRACE(group_desc_bh, "call <API key>"); err = <API key>(handle, NULL, group_desc_bh); if (err) goto fail; percpu_counter_dec(&sbi-><API key>); if (S_ISDIR(mode)) percpu_counter_inc(&sbi->s_dirs_counter); <API key>(sb); if (sbi-><API key>) { flex_group = ext4_flex_group(sbi, group); atomic_dec(&sbi->s_flex_groups[flex_group].free_inodes); } if (test_opt(sb, GRPID)) { inode->i_mode = mode; inode->i_uid = current_fsuid(); inode->i_gid = dir->i_gid; } else inode_init_owner(inode, dir, mode); inode->i_ino = ino + group * <API key>(sb); /* This is the optimal IO size (for stat), not the fs block size */ inode->i_blocks = 0; inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime = ext4_current_time(inode); memset(ei->i_data, 0, sizeof(ei->i_data)); ei->i_dir_start_lookup = 0; ei->i_disksize = 0; /* * Don't inherit extent flag from directory, amongst others. We set * extent flag on newly created directory and file only if -o extent * mount option is specified */ ei->i_flags = ext4_mask_flags(mode, EXT4_I(dir)->i_flags & EXT4_FL_INHERITED); ei->i_file_acl = 0; ei->i_dtime = 0; ei->i_block_group = group; ei->i_last_alloc_group = ~0; <API key>(inode); if (IS_DIRSYNC(inode)) ext4_handle_sync(handle); if (insert_inode_locked(inode) < 0) { err = -EINVAL; goto fail_drop; } spin_lock(&sbi->s_next_gen_lock); inode->i_generation = sbi->s_next_generation++; spin_unlock(&sbi->s_next_gen_lock); <API key>(ei); /* Only relevant on 32-bit archs */ <API key>(inode, EXT4_STATE_NEW); ei->i_extra_isize = EXT4_SB(sb)->s_want_extra_isize; ret = inode; dquot_initialize(inode); err = dquot_alloc_inode(inode); if (err) goto fail_drop; err = ext4_init_acl(handle, inode, dir); if (err) goto fail_free_drop; err = ext4_init_security(handle, inode, dir); if (err) goto fail_free_drop; if (<API key>(sb, <API key>)) { /* set extent flag only for directory, file and normal symlink*/ if (S_ISDIR(mode) || S_ISREG(mode) || S_ISLNK(mode)) { ext4_set_inode_flag(inode, EXT4_INODE_EXTENTS); ext4_ext_tree_init(handle, inode); } } err = <API key>(handle, inode); if (err) { ext4_std_error(sb, err); goto fail_free_drop; } ext4_debug("allocating inode %lu\n", inode->i_ino); <API key>(inode, dir, mode); goto really_out; fail: ext4_std_error(sb, err); out: iput(inode); ret = ERR_PTR(err); really_out: brelse(inode_bitmap_bh); return ret; fail_free_drop: dquot_free_inode(inode); fail_drop: dquot_drop(inode); inode->i_flags |= S_NOQUOTA; inode->i_nlink = 0; unlock_new_inode(inode); iput(inode); brelse(inode_bitmap_bh); return ERR_PTR(err); } /* Verify that we are loading a valid orphan from disk */ struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino) { unsigned long max_ino = le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count); ext4_group_t block_group; int bit; struct buffer_head *bitmap_bh; struct inode *inode = NULL; long err = -EIO; /* Error cases - e2fsck has already cleaned up for us */ if (ino > max_ino) { ext4_warning(sb, "bad orphan ino %lu! e2fsck was run?", ino); goto error; } block_group = (ino - 1) / <API key>(sb); bit = (ino - 1) % <API key>(sb); bitmap_bh = <API key>(sb, block_group); if (!bitmap_bh) { ext4_warning(sb, "inode bitmap error for orphan %lu", ino); goto error; } /* Having the inode bit set should be a 100% indicator that this * is a valid orphan (no e2fsck run on fs). Orphans also include * inodes that were being truncated, so we can't check i_nlink==0. */ if (!ext4_test_bit(bit, bitmap_bh->b_data)) goto bad_orphan; inode = ext4_iget(sb, ino); if (IS_ERR(inode)) goto iget_failed; /* * If the orphans has i_nlinks > 0 then it should be able to be * truncated, otherwise it won't be removed from the orphan list * during processing and an infinite loop will result. */ if (inode->i_nlink && !ext4_can_truncate(inode)) goto bad_orphan; if (NEXT_ORPHAN(inode) > max_ino) goto bad_orphan; brelse(bitmap_bh); return inode; iget_failed: err = PTR_ERR(inode); inode = NULL; bad_orphan: ext4_warning(sb, "bad orphan inode %lu! e2fsck was run?", ino); printk(KERN_NOTICE "ext4_test_bit(bit=%d, block=%llu) = %d\n", bit, (unsigned long long)bitmap_bh->b_blocknr, ext4_test_bit(bit, bitmap_bh->b_data)); printk(KERN_NOTICE "inode=%p\n", inode); if (inode) { printk(KERN_NOTICE "is_bad_inode(inode)=%d\n", is_bad_inode(inode)); printk(KERN_NOTICE "NEXT_ORPHAN(inode)=%u\n", NEXT_ORPHAN(inode)); printk(KERN_NOTICE "max_ino=%lu\n", max_ino); printk(KERN_NOTICE "i_nlink=%u\n", inode->i_nlink); /* Avoid freeing blocks if we got a bad deleted inode */ if (inode->i_nlink == 0) inode->i_blocks = 0; iput(inode); } brelse(bitmap_bh); error: return ERR_PTR(err); } unsigned long <API key>(struct super_block *sb) { unsigned long desc_count; struct ext4_group_desc *gdp; ext4_group_t i, ngroups = <API key>(sb); #ifdef EXT4FS_DEBUG struct ext4_super_block *es; unsigned long bitmap_count, x; struct buffer_head *bitmap_bh = NULL; es = EXT4_SB(sb)->s_es; desc_count = 0; bitmap_count = 0; gdp = NULL; for (i = 0; i < ngroups; i++) { gdp = ext4_get_group_desc(sb, i, NULL); if (!gdp) continue; desc_count += <API key>(sb, gdp); brelse(bitmap_bh); bitmap_bh = <API key>(sb, i); if (!bitmap_bh) continue; x = ext4_count_free(bitmap_bh, <API key>(sb) / 8); printk(KERN_DEBUG "group %lu: stored = %d, counted = %lu\n", (unsigned long) i, <API key>(sb, gdp), x); bitmap_count += x; } brelse(bitmap_bh); printk(KERN_DEBUG "<API key>: " "stored = %u, computed = %lu, %lu\n", le32_to_cpu(es->s_free_inodes_count), desc_count, bitmap_count); return desc_count; #else desc_count = 0; for (i = 0; i < ngroups; i++) { gdp = ext4_get_group_desc(sb, i, NULL); if (!gdp) continue; desc_count += <API key>(sb, gdp); cond_resched(); } return desc_count; #endif } /* Called at mount-time, super-block is locked */ unsigned long ext4_count_dirs(struct super_block * sb) { unsigned long count = 0; ext4_group_t i, ngroups = <API key>(sb); for (i = 0; i < ngroups; i++) { struct ext4_group_desc *gdp = ext4_get_group_desc(sb, i, NULL); if (!gdp) continue; count += <API key>(sb, gdp); } return count; }
/**@file w4all.h * @brief Main header file * * @author Batman@GothamCity */ #pragma once #include <mfapi.h> #include <mftransform.h> #include <mfidl.h> #include <mferror.h> #include <shlwapi.h> #include <strsafe.h> void DllAddRef(); void DllRelease();
#include "base/bind.h" #include "base/message_loop/message_loop.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/<API key>.h" #include "chromeos/disks/disk_mount_manager.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" using chromeos::disks::DiskMountManager; using chromeos::CrosDisksClient; using chromeos::DBusThreadManager; using chromeos::FakeCrosDisksClient; using testing::_; using testing::Field; using testing::InSequence; namespace { // Holds information needed to create a DiskMountManager::Disk instance. struct TestDiskInfo { const char* source_path; const char* mount_path; const char* system_path; const char* file_path; const char* device_label; const char* drive_label; const char* vendor_id; const char* vendor_name; const char* product_id; const char* product_name; const char* fs_uuid; const char* system_path_prefix; chromeos::DeviceType device_type; uint64 size_in_bytes; bool is_parent; bool is_read_only; bool has_media; bool on_boot_device; bool on_removable_device; bool is_hidden; }; // Holds information to create a DiskMOuntManager::MountPointInfo instance. struct TestMountPointInfo { const char* source_path; const char* mount_path; chromeos::MountType mount_type; chromeos::disks::MountCondition mount_condition; }; // List of disks held in DiskMountManager at the begining of the test. const TestDiskInfo kTestDisks[] = { { "/device/source_path", "/device/mount_path", "/device/prefix/system_path", "/device/file_path", "/device/device_label", "/device/drive_label", "/device/vendor_id", "/device/vendor_name", "/device/product_id", "/device/product_name", "/device/fs_uuid", "/device/prefix", chromeos::DEVICE_TYPE_USB, 1073741824, // size in bytes false, // is parent false, // is read only true, // has media false, // is on boot device true, // is on removable device false // is hidden }, }; // List of mount points held in DiskMountManager at the begining of the test. const TestMountPointInfo kTestMountPoints[] = { { "/archive/source_path", "/archive/mount_path", chromeos::MOUNT_TYPE_ARCHIVE, chromeos::disks::<API key> }, { "/device/source_path", "/device/mount_path", chromeos::MOUNT_TYPE_DEVICE, chromeos::disks::<API key> }, }; // Mocks DiskMountManager observer. class <API key> : public DiskMountManager::Observer { public: virtual ~<API key>() {} MOCK_METHOD2(OnDiskEvent, void(DiskMountManager::DiskEvent event, const DiskMountManager::Disk* disk)); MOCK_METHOD2(OnDeviceEvent, void(DiskMountManager::DeviceEvent event, const std::string& device_path)); MOCK_METHOD3(OnMountEvent, void(DiskMountManager::MountEvent event, chromeos::MountError error_code, const DiskMountManager::MountPointInfo& mount_point)); MOCK_METHOD3(OnFormatEvent, void(DiskMountManager::FormatEvent event, chromeos::FormatError error_code, const std::string& device_path)); }; class <API key> : public testing::Test { public: <API key>() {} virtual ~<API key>() {} // Sets up test dbus tread manager and disks mount manager. // Initializes disk mount manager disks and mount points. // Adds a test observer to the disk mount manager. virtual void SetUp() { <API key> = new FakeCrosDisksClient; DBusThreadManager::GetSetterForTesting()->SetCrosDisksClient( scoped_ptr<CrosDisksClient>(<API key>)); DiskMountManager::Initialize(); <API key>(); DiskMountManager::GetInstance()->AddObserver(&observer_); } // Shuts down dbus thread manager and disk moutn manager used in the test. virtual void TearDown() { DiskMountManager::GetInstance()->RemoveObserver(&observer_); DiskMountManager::Shutdown(); DBusThreadManager::Shutdown(); } protected: // Checks if disk mount manager contains a mount point with specified moutn // path. bool HasMountPoint(const std::string& mount_path) { const DiskMountManager::MountPointMap& mount_points = DiskMountManager::GetInstance()->mount_points(); return mount_points.find(mount_path) != mount_points.end(); } private: // Adds a new disk to the disk mount manager. void AddTestDisk(const TestDiskInfo& disk) { EXPECT_TRUE(DiskMountManager::GetInstance()->AddDiskForTest( new DiskMountManager::Disk(disk.source_path, disk.mount_path, disk.system_path, disk.file_path, disk.device_label, disk.drive_label, disk.vendor_id, disk.vendor_name, disk.product_id, disk.product_name, disk.fs_uuid, disk.system_path_prefix, disk.device_type, disk.size_in_bytes, disk.is_parent, disk.is_read_only, disk.has_media, disk.on_boot_device, disk.on_removable_device, disk.is_hidden))); } // Adds a new mount point to the disk mount manager. // If the moutn point is a device mount point, disk with its source path // should already be added to the disk mount manager. void AddTestMountPoint(const TestMountPointInfo& mount_point) { EXPECT_TRUE(DiskMountManager::GetInstance()-><API key>( DiskMountManager::MountPointInfo(mount_point.source_path, mount_point.mount_path, mount_point.mount_type, mount_point.mount_condition))); } // Adds disks and mount points to disk mount manager. void <API key>() { // Disks should be added first (when adding device mount points it is // expected that the corresponding disk is already added). for (size_t i = 0; i < arraysize(kTestDisks); i++) AddTestDisk(kTestDisks[i]); for (size_t i = 0; i < arraysize(kTestMountPoints); i++) AddTestMountPoint(kTestMountPoints[i]); } protected: chromeos::FakeCrosDisksClient* <API key>; <API key> observer_; base::MessageLoopForUI message_loop_; }; // Tests that the observer gets notified on attempt to format non existent mount // point. TEST_F(<API key>, Format_NotMounted) { EXPECT_CALL(observer_, OnFormatEvent(DiskMountManager::FORMAT_COMPLETED, chromeos::<API key>, "/mount/non_existent")) .Times(1); DiskMountManager::GetInstance()->FormatMountedDevice("/mount/non_existent"); } // Tests that it is not possible to format archive mount point. TEST_F(<API key>, Format_Archive) { EXPECT_CALL(observer_, OnFormatEvent(DiskMountManager::FORMAT_COMPLETED, chromeos::<API key>, "/archive/source_path")) .Times(1); DiskMountManager::GetInstance()->FormatMountedDevice("/archive/mount_path"); } // Tests that format fails if the device cannot be unmounted. TEST_F(<API key>, <API key>) { // Before formatting mounted device, the device should be unmounted. // In this test unmount will fail, and there should be no attempt to // format the device. // Set up expectations for observer mock. // Observer should be notified that unmount attempt fails and format task // failed to start. { InSequence s; EXPECT_CALL(observer_, OnMountEvent(DiskMountManager::UNMOUNTING, chromeos::<API key>, Field(&DiskMountManager::MountPointInfo::mount_path, "/device/mount_path"))) .Times(1); EXPECT_CALL(observer_, OnFormatEvent(DiskMountManager::FORMAT_COMPLETED, chromeos::<API key>, "/device/source_path")) .Times(1); } <API key>->MakeUnmountFail(); // Start test. DiskMountManager::GetInstance()->FormatMountedDevice("/device/mount_path"); // Cros disks will respond asynchronoulsy, so let's drain the message loop. message_loop_.RunUntilIdle(); EXPECT_EQ(1, <API key>->unmount_call_count()); EXPECT_EQ("/device/mount_path", <API key>-><API key>()); EXPECT_EQ(chromeos::<API key>, <API key>-><API key>()); EXPECT_EQ(0, <API key>->format_call_count()); // The device mount should still be here. EXPECT_TRUE(HasMountPoint("/device/mount_path")); } // Tests that observer is notified when cros disks fails to start format // process. TEST_F(<API key>, <API key>) { // Before formatting mounted device, the device should be unmounted. // In this test, unmount will succeed, but call to Format method will // fail. // Set up expectations for observer mock. // Observer should be notified that the device was unmounted and format task // failed to start. { InSequence s; EXPECT_CALL(observer_, OnMountEvent(DiskMountManager::UNMOUNTING, chromeos::MOUNT_ERROR_NONE, Field(&DiskMountManager::MountPointInfo::mount_path, "/device/mount_path"))) .Times(1); EXPECT_CALL(observer_, OnFormatEvent(DiskMountManager::FORMAT_COMPLETED, chromeos::<API key>, "/device/source_path")) .Times(1); } <API key>->MakeFormatFail(); // Start the test. DiskMountManager::GetInstance()->FormatMountedDevice("/device/mount_path"); // Cros disks will respond asynchronoulsy, so let's drain the message loop. message_loop_.RunUntilIdle(); EXPECT_EQ(1, <API key>->unmount_call_count()); EXPECT_EQ("/device/mount_path", <API key>-><API key>()); EXPECT_EQ(chromeos::<API key>, <API key>-><API key>()); EXPECT_EQ(1, <API key>->format_call_count()); EXPECT_EQ("/device/source_path", <API key>-><API key>()); EXPECT_EQ("vfat", <API key>-><API key>()); // The device mount should be gone. EXPECT_FALSE(HasMountPoint("/device/mount_path")); } // Tests the case where there are two format requests for the same device. TEST_F(<API key>, <API key>) { // Only the first format request should be processed (the second unmount // request fails because the device is already unmounted at that point). // CrosDisksClient will report that the format process for the first request // is successfully started. // Set up expectations for observer mock. // The observer should get a FORMAT_STARTED event for one format request and a // FORMAT_COMPLETED with an error code for the other format request. The // formatting will be started only for the first request. // There should be only one UNMOUNTING event. The result of the second one // should not be reported as the mount point will go away after the first // request. // Note that in this test the format completion signal will not be simulated, // so the observer should not get FORMAT_COMPLETED signal. { InSequence s; EXPECT_CALL(observer_, OnMountEvent(DiskMountManager::UNMOUNTING, chromeos::MOUNT_ERROR_NONE, Field(&DiskMountManager::MountPointInfo::mount_path, "/device/mount_path"))) .Times(1); EXPECT_CALL(observer_, OnFormatEvent(DiskMountManager::FORMAT_COMPLETED, chromeos::<API key>, "/device/source_path")) .Times(1); EXPECT_CALL(observer_, OnFormatEvent(DiskMountManager::FORMAT_STARTED, chromeos::FORMAT_ERROR_NONE, "/device/source_path")) .Times(1); } <API key>-><API key>( base::Bind(&FakeCrosDisksClient::MakeUnmountFail, base::Unretained(<API key>))); // Start the test. DiskMountManager::GetInstance()->FormatMountedDevice("/device/mount_path"); DiskMountManager::GetInstance()->FormatMountedDevice("/device/mount_path"); // Cros disks will respond asynchronoulsy, so let's drain the message loop. message_loop_.RunUntilIdle(); EXPECT_EQ(2, <API key>->unmount_call_count()); EXPECT_EQ("/device/mount_path", <API key>-><API key>()); EXPECT_EQ(chromeos::<API key>, <API key>-><API key>()); EXPECT_EQ(1, <API key>->format_call_count()); EXPECT_EQ("/device/source_path", <API key>-><API key>()); EXPECT_EQ("vfat", <API key>-><API key>()); // The device mount should be gone. EXPECT_FALSE(HasMountPoint("/device/mount_path")); } // Tests the case when the format process actually starts and fails. TEST_F(<API key>, Format_FormatFails) { // Both unmount and format device cals are successful in this test. // Set up expectations for observer mock. // The observer should get notified that the device was unmounted and that // formatting has started. // After the formatting starts, the test will simulate failing // FORMAT_COMPLETED signal, so the observer should also be notified the // formatting has failed (FORMAT_COMPLETED event). { InSequence s; EXPECT_CALL(observer_, OnMountEvent(DiskMountManager::UNMOUNTING, chromeos::MOUNT_ERROR_NONE, Field(&DiskMountManager::MountPointInfo::mount_path, "/device/mount_path"))) .Times(1); EXPECT_CALL(observer_, OnFormatEvent(DiskMountManager::FORMAT_STARTED, chromeos::FORMAT_ERROR_NONE, "/device/source_path")) .Times(1); EXPECT_CALL(observer_, OnFormatEvent(DiskMountManager::FORMAT_COMPLETED, chromeos::<API key>, "/device/source_path")) .Times(1); } // Start the test. DiskMountManager::GetInstance()->FormatMountedDevice("/device/mount_path"); // Wait for Unmount and Format calls to end. message_loop_.RunUntilIdle(); EXPECT_EQ(1, <API key>->unmount_call_count()); EXPECT_EQ("/device/mount_path", <API key>-><API key>()); EXPECT_EQ(chromeos::<API key>, <API key>-><API key>()); EXPECT_EQ(1, <API key>->format_call_count()); EXPECT_EQ("/device/source_path", <API key>-><API key>()); EXPECT_EQ("vfat", <API key>-><API key>()); // The device should be unmounted by now. EXPECT_FALSE(HasMountPoint("/device/mount_path")); // Send failing FORMAT_COMPLETED signal. // The failure is marked by ! in fromt of the path (but this should change // soon). <API key>-><API key>( chromeos::<API key>, "/device/source_path"); } // Tests the case when formatting completes successfully. TEST_F(<API key>, <API key>) { // Set up cros disks client mocks. // Both unmount and format device cals are successful in this test. // Set up expectations for observer mock. // The observer should receive UNMOUNTING, FORMAT_STARTED and FORMAT_COMPLETED // events (all of them without an error set). { InSequence s; EXPECT_CALL(observer_, OnMountEvent(DiskMountManager::UNMOUNTING, chromeos::MOUNT_ERROR_NONE, Field(&DiskMountManager::MountPointInfo::mount_path, "/device/mount_path"))) .Times(1); EXPECT_CALL(observer_, OnFormatEvent(DiskMountManager::FORMAT_STARTED, chromeos::FORMAT_ERROR_NONE, "/device/source_path")) .Times(1); EXPECT_CALL(observer_, OnFormatEvent(DiskMountManager::FORMAT_COMPLETED, chromeos::FORMAT_ERROR_NONE, "/device/source_path")) .Times(1); } // Start the test. DiskMountManager::GetInstance()->FormatMountedDevice("/device/mount_path"); // Wait for Unmount and Format calls to end. message_loop_.RunUntilIdle(); EXPECT_EQ(1, <API key>->unmount_call_count()); EXPECT_EQ("/device/mount_path", <API key>-><API key>()); EXPECT_EQ(chromeos::<API key>, <API key>-><API key>()); EXPECT_EQ(1, <API key>->format_call_count()); EXPECT_EQ("/device/source_path", <API key>-><API key>()); EXPECT_EQ("vfat", <API key>-><API key>()); // The device should be unmounted by now. EXPECT_FALSE(HasMountPoint("/device/mount_path")); // Simulate cros_disks reporting success. <API key>-><API key>( chromeos::FORMAT_ERROR_NONE, "/device/source_path"); } // Tests that it's possible to format the device twice in a row (this may not be // true if the list of pending formats is not properly cleared). TEST_F(<API key>, <API key>) { // All unmount and format device cals are successful in this test. // Each of the should be made twice (once for each formatting task). // Set up expectations for observer mock. // The observer should receive UNMOUNTING, FORMAT_STARTED and FORMAT_COMPLETED // events (all of them without an error set) twice (once for each formatting // task). // Also, there should be a MOUNTING event when the device remounting is // simulated. EXPECT_CALL(observer_, OnFormatEvent(DiskMountManager::FORMAT_COMPLETED, chromeos::FORMAT_ERROR_NONE, "/device/source_path")) .Times(2); EXPECT_CALL(observer_, OnFormatEvent(DiskMountManager::FORMAT_STARTED, chromeos::FORMAT_ERROR_NONE, "/device/source_path")) .Times(2); EXPECT_CALL(observer_, OnMountEvent(DiskMountManager::UNMOUNTING, chromeos::MOUNT_ERROR_NONE, Field(&DiskMountManager::MountPointInfo::mount_path, "/device/mount_path"))) .Times(2); EXPECT_CALL(observer_, OnMountEvent(DiskMountManager::MOUNTING, chromeos::MOUNT_ERROR_NONE, Field(&DiskMountManager::MountPointInfo::mount_path, "/device/mount_path"))) .Times(1); // Start the test. DiskMountManager::GetInstance()->FormatMountedDevice("/device/mount_path"); // Wait for Unmount and Format calls to end. message_loop_.RunUntilIdle(); EXPECT_EQ(1, <API key>->unmount_call_count()); EXPECT_EQ("/device/mount_path", <API key>-><API key>()); EXPECT_EQ(chromeos::<API key>, <API key>-><API key>()); EXPECT_EQ(1, <API key>->format_call_count()); EXPECT_EQ("/device/source_path", <API key>-><API key>()); EXPECT_EQ("vfat", <API key>-><API key>()); // The device should be unmounted by now. EXPECT_FALSE(HasMountPoint("/device/mount_path")); // Simulate cros_disks reporting success. <API key>-><API key>( chromeos::FORMAT_ERROR_NONE, "/device/source_path"); // Simulate the device remounting. <API key>-><API key>( chromeos::MOUNT_ERROR_NONE, "/device/source_path", chromeos::MOUNT_TYPE_DEVICE, "/device/mount_path"); EXPECT_TRUE(HasMountPoint("/device/mount_path")); // Try formatting again. DiskMountManager::GetInstance()->FormatMountedDevice("/device/mount_path"); // Wait for Unmount and Format calls to end. message_loop_.RunUntilIdle(); EXPECT_EQ(2, <API key>->unmount_call_count()); EXPECT_EQ("/device/mount_path", <API key>-><API key>()); EXPECT_EQ(chromeos::<API key>, <API key>-><API key>()); EXPECT_EQ(2, <API key>->format_call_count()); EXPECT_EQ("/device/source_path", <API key>-><API key>()); EXPECT_EQ("vfat", <API key>-><API key>()); // Simulate cros_disks reporting success. <API key>-><API key>( chromeos::FORMAT_ERROR_NONE, "/device/source_path"); } } // namespace
/*** * A singleton for controlling access to the editing functionality for multiple components capable of editing the same data. */ define(function() { window.GlobalEditorLock = new function() { var currentEditor = null; this.isEditing = function() { return (currentEditor != null); } this.hasLock = function(editor) { return (currentEditor == editor); } this.enterEditMode = function(editor) { if (currentEditor != null) throw "GlobalEditorLock : enterEditMode : currentEditor == null"; if (!editor.commitCurrentEdit) throw "GlobalEditorLock : enterEditMode : editor must implement .commitCurrentEdit()"; if (!editor.cancelCurrentEdit) throw "GlobalEditorLock : enterEditMode : editor must implement .cancelCurrentEdit()"; currentEditor = editor; } this.leaveEditMode = function(editor) { if (currentEditor != editor) throw "GlobalEditorLock : leaveEditMode() : currentEditor != editor"; currentEditor = null; } this.commitCurrentEdit = function() { if (currentEditor) return currentEditor.commitCurrentEdit(); return true; } this.cancelCurrentEdit = function() { if (currentEditor) currentEditor.cancelCurrentEdit(); } }; return window.GlobalEditorLock; });
require 'sanitize' module DataFixup module SanitizeEportfolios def self.run config = CanvasSanitize::SANITIZE EportfolioEntry. where("content LIKE '%rich\_text%' OR content LIKE '%html%'"). find_each do |entry| next unless entry.content.is_a?(Array) entry.content.each do |obj| next unless obj.is_a?(Hash) next unless ['rich_text', 'html'].include?(obj[:section_type]) obj[:content] = Sanitize.clean(obj[:content] || '', config).strip end entry.save! end end end end
var win = Titanium.UI.currentWindow; win.backgroundColor = 'black'; var minDate = new Date(); minDate.setFullYear(2009); minDate.setMonth(0); minDate.setDate(1); var maxDate = new Date(); maxDate.setFullYear(2009); maxDate.setMonth(11); maxDate.setDate(31); var value = new Date(); value.setFullYear(2009); value.setMonth(0); value.setDate(1); var picker = Ti.UI.createPicker({ useSpinner: true, type:Ti.UI.PICKER_TYPE_DATE, minDate:minDate, maxDate:maxDate, value:value }); // turn on the selection indicator (off by default) picker.selectionIndicator = true; win.add(picker); var label = Ti.UI.createLabel({ text:'Choose a date', top:6, width:'auto', height:'auto', textAlign:'center', color:'white' }); win.add(label); picker.addEventListener('change',function(e) { label.text = e.value; }); var locale = false; var localebutton = Ti.UI.createButton({ title:'Change locale', bottom:20, width:200, height:40 }); localebutton.addEventListener('click', function() { if (!locale) { picker.setLocale('ru'); locale = true; } else { locale = false; picker.setLocale(Titanium.Platform.locale); } }); win.add(localebutton);
#include "src/v8.h" #include "src/assembler.h" #include "src/base/once.h" #include "src/base/platform/platform.h" #include "src/bootstrapper.h" #include "src/compiler/pipeline.h" #include "src/debug.h" #include "src/deoptimizer.h" #include "src/elements.h" #include "src/frames.h" #include "src/heap/store-buffer.h" #include "src/heap-profiler.h" #include "src/hydrogen.h" #include "src/isolate.h" #include "src/lithium-allocator.h" #include "src/objects.h" #include "src/runtime-profiler.h" #include "src/sampler.h" #include "src/serialize.h" namespace v8 { namespace internal { V8_DECLARE_ONCE(init_once); v8::ArrayBuffer::Allocator* V8::<API key> = NULL; v8::Platform* V8::platform_ = NULL; bool V8::Initialize() { <API key>(); return true; } void V8::TearDown() { Bootstrapper::TearDownExtensions(); ElementsAccessor::TearDown(); LOperand::TearDownCaches(); compiler::Pipeline::TearDown(); ExternalReference::TearDownMathExpData(); RegisteredExtension::UnregisterAll(); Isolate::GlobalTearDown(); Sampler::TearDown(); FlagList::ResetAllFlags(); // Frees memory held by string arguments. } void V8::<API key>( <API key> resolver) { StackFrame::<API key>(resolver); } void V8::<API key>() { FlagList::<API key>(); if (FLAG_predictable && FLAG_random_seed == 0) { // Avoid random seeds in predictable mode. FLAG_random_seed = 12347; } if (<API key>) { <API key> = true; FLAG_gc_global = true; <API key> = 1; } base::OS::Initialize(FLAG_random_seed, FLAG_hard_abort, FLAG_gc_fake_mmap); Isolate::<API key>(); Sampler::SetUp(); CpuFeatures::Probe(false); <API key>(); // The custom exp implementation needs 16KB of lookup data; initialize it // on demand. <API key>(); #ifdef _WIN64 <API key>(); #endif ElementsAccessor::<API key>(); LOperand::SetUpCaches(); compiler::Pipeline::SetUp(); <API key>(); ExternalReference::SetUp(); Bootstrapper::<API key>(); } void V8::<API key>() { base::CallOnce(&init_once, &<API key>); } void V8::InitializePlatform(v8::Platform* platform) { CHECK(!platform_); CHECK(platform); platform_ = platform; } void V8::ShutdownPlatform() { CHECK(platform_); platform_ = NULL; } v8::Platform* V8::GetCurrentPlatform() { DCHECK(platform_); return platform_; } } } // namespace v8::internal
// obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without // restriction, including without limitation the rights to use, // copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following // conditions: // included in all copies or substantial portions of the Software. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. #endregion using System; using System.Collections.Generic; #if NET20 using Newtonsoft.Json.Utilities.LinqBridge; #else using System.Linq; #endif using System.Text; using Newtonsoft.Json.Linq; #if NETFX_CORE using Microsoft.VisualStudio.TestPlatform.UnitTestFramework; using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute; using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute; #elif DNXCORE50 using Xunit; using Test = Xunit.FactAttribute; using Assert = Newtonsoft.Json.Tests.XUnitAssert; #else using NUnit.Framework; #endif namespace Newtonsoft.Json.Tests.Linq { [TestFixture] public class MergeTests : TestFixtureBase { [Test] public void MergeObjectProperty() { var left = (JObject)JToken.FromObject(new { Property1 = 1 }); var right = (JObject)JToken.FromObject(new { Property2 = 2 }); left.Merge(right); string json = left.ToString(); StringAssert.AreEqual(@"{ ""Property1"": 1, ""Property2"": 2 }", json); } [Test] public void MergeChildObject() { var left = (JObject)JToken.FromObject(new { Property1 = new { SubProperty1 = 1 } }); var right = (JObject)JToken.FromObject(new { Property1 = new { SubProperty2 = 2 } }); left.Merge(right); string json = left.ToString(); StringAssert.AreEqual(@"{ ""Property1"": { ""SubProperty1"": 1, ""SubProperty2"": 2 } }", json); } [Test] public void <API key>() { var left = (JObject)JToken.FromObject(new { Property1 = new { SubProperty1 = 1 } }); var right = (JArray)JToken.FromObject(new object[] { new { Property1 = 1 }, new { Property1 = 1 } }); left.Merge(right); string json = left.ToString(); StringAssert.AreEqual(@"{ ""Property1"": { ""SubProperty1"": 1 } }", json); } [Test] public void <API key>() { var left = (JObject)JToken.FromObject(new { Property1 = new { SubProperty1 = 1 } }); var right = (JObject)JToken.FromObject(new { Property1 = new { SubProperty2 = 2 }, Property2 = 2 }); left.Merge(right); string json = left.ToString(); StringAssert.AreEqual(@"{ ""Property1"": { ""SubProperty1"": 1, ""SubProperty2"": 2 }, ""Property2"": 2 }", json); } [Test] public void MergeArray() { var left = (JObject)JToken.FromObject(new { Array1 = new object[] { new { Property1 = new { Property1 = 1, Property2 = 2, Property3 = 3, Property4 = 4, Property5 = (object)null } }, new { }, 3, null, 5, null } }); var right = (JObject)JToken.FromObject(new { Array1 = new object[] { new { Property1 = new { Property1 = (object)null, Property2 = 3, Property3 = new { }, Property5 = (object)null } }, null, null, 4, 5.1, null, new { Property1 = 1 } } }); left.Merge(right, new JsonMergeSettings { MergeArrayHandling = MergeArrayHandling.Merge }); string json = left.ToString(); StringAssert.AreEqual(@"{ ""Array1"": [ { ""Property1"": { ""Property1"": 1, ""Property2"": 3, ""Property3"": {}, ""Property4"": 4, ""Property5"": null } }, {}, 3, 4, 5.1, null, { ""Property1"": 1 } ] }", json); } [Test] public void ConcatArray() { var left = (JObject)JToken.FromObject(new { Array1 = new object[] { new { Property1 = 1 }, new { Property1 = 1 } } }); var right = (JObject)JToken.FromObject(new { Array1 = new object[] { new { Property1 = 1 }, new { Property2 = 2 }, new { Property3 = 3 } } }); left.Merge(right, new JsonMergeSettings { MergeArrayHandling = MergeArrayHandling.Concat }); string json = left.ToString(); StringAssert.AreEqual(@"{ ""Array1"": [ { ""Property1"": 1 }, { ""Property1"": 1 }, { ""Property1"": 1 }, { ""Property2"": 2 }, { ""Property3"": 3 } ] }", json); } [Test] public void <API key>() { var left = (JArray)JToken.FromObject(new object[] { true, null, new { Property1 = 1 }, new object[] { 1 }, new { Property1 = 1 }, 1, new object[] { 1 } }); var right = (JArray)JToken.FromObject(new object[] { 1, 5, new object[] { 1 }, new { Property1 = 1 }, true, new { Property1 = 1 }, null }); left.Merge(right, new JsonMergeSettings { MergeArrayHandling = MergeArrayHandling.Merge }); string json = left.ToString(); StringAssert.AreEqual(@"[ 1, 5, { ""Property1"": 1 }, [ 1 ], { ""Property1"": 1 }, { ""Property1"": 1 }, [ 1 ] ]", json); } [Test] public void <API key>() { var left = (JObject)JToken.FromObject(new { Property1 = new object[] { 1 }, Property2 = new object[] { 1 }, Property3 = true, Property4 = true }); var right = (JObject)JToken.FromObject(new { Property1 = new { Nested = true }, Property2 = true, Property3 = new object[] { 1 }, Property4 = (object)null }); left.Merge(right); string json = left.ToString(); StringAssert.AreEqual(@"{ ""Property1"": { ""Nested"": true }, ""Property2"": true, ""Property3"": [ 1 ], ""Property4"": true }", json); } [Test] public void <API key>() { var left = (JObject)JToken.FromObject(new { Array1 = new object[] { 1, 2, 3 } }); var right = (JObject)JToken.FromObject(new { Array1 = new object[] { 4, 5 } }); left.Merge(right, new JsonMergeSettings { MergeArrayHandling = MergeArrayHandling.Replace }); string json = left.ToString(); StringAssert.AreEqual(@"{ ""Array1"": [ 4, 5 ] }", json); } [Test] public void <API key>() { var left = (JArray)JToken.FromObject(new object[] { 1, 2, 3 }); var right = (JArray)JToken.FromObject(new object[] { 4, 5 }); left.Merge(right, new JsonMergeSettings { MergeArrayHandling = MergeArrayHandling.Replace }); string json = left.ToString(); StringAssert.AreEqual(@"[ 4, 5 ]", json); } [Test] public void UnionArrays() { var left = (JObject)JToken.FromObject(new { Array1 = new object[] { new { Property1 = 1 }, new { Property1 = 1 } } }); var right = (JObject)JToken.FromObject(new { Array1 = new object[] { new { Property1 = 1 }, new { Property2 = 2 }, new { Property3 = 3 } } }); left.Merge(right, new JsonMergeSettings { MergeArrayHandling = MergeArrayHandling.Union }); string json = left.ToString(); StringAssert.AreEqual(@"{ ""Array1"": [ { ""Property1"": 1 }, { ""Property1"": 1 }, { ""Property2"": 2 }, { ""Property3"": 3 } ] }", json); } [Test] public void MergeJProperty() { JProperty p1 = new JProperty("p1", 1); JProperty p2 = new JProperty("p2", 2); p1.Merge(p2); Assert.AreEqual(2, (int)p1.Value); JProperty p3 = new JProperty("p3"); p1.Merge(p3); Assert.AreEqual(2, (int)p1.Value); JProperty p4 = new JProperty("p4", null); p1.Merge(p4); Assert.AreEqual(2, (int)p1.Value); } [Test] public void MergeJConstructor() { JConstructor c1 = new JConstructor("c1", new[] { 1, 2 }); JConstructor c2 = new JConstructor("c2", new[] { 3, 4 }); c1.Merge(c2); Assert.AreEqual("c2", c1.Name); CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4 }, c1.Select(i => (int)i)); JConstructor c3 = new JConstructor(); c1.Merge(c3); Assert.AreEqual("c2", c1.Name); JConstructor c4 = new JConstructor("c4", new[] { 5, 6 }); c1.Merge(c4, new JsonMergeSettings { MergeArrayHandling = MergeArrayHandling.Replace }); Assert.AreEqual("c4", c1.Name); CollectionAssert.AreEquivalent(new[] { 5, 6 }, c1.Select(i => (int)i)); } [Test] public void <API key>() { JConstructor c = new JConstructor(); c.Merge(new JConstructor()); Assert.AreEqual(null, c.Name); Assert.AreEqual(0, c.Count); JObject o = new JObject(); o.Merge(new JObject()); Assert.AreEqual(0, o.Count); JArray a = new JArray(); a.Merge(new JArray()); Assert.AreEqual(0, a.Count); JProperty p = new JProperty("name1"); p.Merge(new JProperty("name2")); Assert.AreEqual("name1", p.Name); Assert.AreEqual(0, p.Count); } [Test] public void MergeNull() { JConstructor c = new JConstructor(); c.Merge(null); Assert.AreEqual(null, c.Name); Assert.AreEqual(0, c.Count); JObject o = new JObject(); o.Merge(null); Assert.AreEqual(0, o.Count); JArray a = new JArray(); a.Merge(null); Assert.AreEqual(0, a.Count); JProperty p = new JProperty("name1"); p.Merge(null); Assert.AreEqual("name1", p.Name); Assert.AreEqual(0, p.Count); } } }
# transfer.sh Easy file sharing from the command line # transfer Plugin # Usage Example : # > transfer file.txt # > transfer directory/ # Remco Verhoef <remco@dutchcoders.io> # Modified to use tar command instead of zip curl --version 2>&1 > /dev/null if [ $? -ne 0 ]; then echo "Could not find curl." return 1 fi transfer() { # check arguments if [ $# -eq 0 ]; then echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md" return 1 fi # get temporarily filename, output is written to this file show progress can be showed tmpfile=$( mktemp -t transferXXX ) # upload stdin or file file=$1 if tty -s; then basefile=$(basename "$file" | sed -e 's/[^a-zA-Z0-9._-]/-/g') if [ ! -e $file ]; then echo "File $file doesn't exists." return 1 fi if [ -d $file ]; then echo $file # tar directory and transfer tarfile=$( mktemp -t transferXXX.tar.gz ) cd $(dirname $file) && tar -czf $tarfile $(basename $file) curl --progress-bar --upload-file "$tarfile" "https://transfer.sh/$basefile.tar.gz" >> $tmpfile rm -f $tarfile else # transfer file curl --progress-bar --upload-file "$file" "https://transfer.sh/$basefile" >> $tmpfile fi else # transfer pipe curl --progress-bar --upload-file "-" "https://transfer.sh/$file" >> $tmpfile fi # cat output link cat $tmpfile # cleanup rm -f $tmpfile }
layout: docs title: Progress group: components Stylize the HTML5 `<progress>` element with a few extra classes and some crafty browser-specific CSS. Be sure to read up on the browser support. ## Contents * Will be replaced with the ToC, excluding the "Contents" header {:toc} Example {% example html %} <progress class="progress" value="0" max="100">0%</progress> <progress class="progress" value="25" max="100">25%</progress> <progress class="progress" value="50" max="100">50%</progress> <progress class="progress" value="75" max="100">75%</progress> <progress class="progress" value="100" max="100">100%</progress> {% endexample %} IE9 support Internet Explorer 9 doesn't support the HTML5 `<progress>` element, but we can work around that. {% example html %} <progress class="progress" value="25" max="100"> <div class="progress"> <span class="progress-bar" style="width: 25%;">25%</span> </div> </progress> {% endexample %} Contextual alternatives Progress bars use some of the same button and alert classes for consistent styles. {% example html %} <progress class="progress progress-success" value="25" max="100">25%</progress> <progress class="progress progress-info" value="50" max="100">50%</progress> <progress class="progress progress-warning" value="75" max="100">75%</progress> <progress class="progress progress-danger" value="100" max="100">100%</progress> {% endexample %} Striped Uses a gradient to create a striped effect. {% example html %} <progress class="progress progress-striped" value="10" max="100">10%</progress> <progress class="progress progress-striped progress-success" value="25" max="100">25%</progress> <progress class="progress progress-striped progress-info" value="50" max="100">50%</progress> <progress class="progress progress-striped progress-warning" value="75" max="100">75%</progress> <progress class="progress progress-striped progress-danger" value="100" max="100">100%</progress> {% endexample %} Animated stripes The striped gradient can also be animated. Add `.progress-animated` to `.progress` to animate the stripes right to left via CSS3 animations. **Animated progress bars do not work in IE9 and Opera 12** as they don't support CSS3 animations. <div class="bd-example"> <progress class="progress progress-striped" value="25" max="100">25%</progress> <button type="button" class="btn btn-secondary <API key>" data-toggle="button" aria-pressed="false" autocomplete="off"> Toggle animation </button> </div> {% highlight html %} <progress class="progress progress-striped progress-animated" value="25" max="100">25%</progress> {% endhighlight %}
/* <API key>: GPL-2.0-or-later */ #ifndef S5P_MFC_COMMON_H_ #define S5P_MFC_COMMON_H_ #include <linux/platform_device.h> #include <linux/videodev2.h> #include <media/v4l2-ctrls.h> #include <media/v4l2-device.h> #include <media/v4l2-ioctl.h> #include <media/videobuf2-v4l2.h> #include "regs-mfc.h" #include "regs-mfc-v10.h" #define S5P_MFC_NAME "s5p-mfc" /* Definitions related to MFC memory */ /* Offset base used to differentiate between CAPTURE and OUTPUT * while mmaping */ #define DST_QUEUE_OFF_BASE (1 << 30) #define BANK_L_CTX 0 #define BANK_R_CTX 1 #define BANK_CTX_NUM 2 #define <API key> 13 #define <API key> 13 #define <API key> 17 #define MFC_FW_MAX_VERSIONS 2 #include <media/<API key>.h> /* MFC definitions */ #define MFC_MAX_EXTRA_DPB 5 #define MFC_MAX_BUFFERS 32 #define MFC_NUM_CONTEXTS 4 /* Interrupt timeout */ #define MFC_INT_TIMEOUT 2000 /* Busy wait timeout */ #define MFC_BW_TIMEOUT 500 /* Watchdog interval */ #define <API key> 1000 /* After how many executions watchdog should assume lock up */ #define MFC_WATCHDOG_CNT 10 #define MFC_NO_INSTANCE_SET -1 #define <API key> 1 #define <API key> 2 #define STUFF_BYTE 4 #define MFC_MAX_CTRLS 128 #define S5P_MFC_CODEC_NONE -1 #define <API key> 0 #define <API key> 1 #define <API key> 2 #define <API key> 3 #define <API key> 4 #define <API key> 5 #define <API key> 6 #define <API key> 7 #define <API key> 17 #define <API key> 18 #define <API key> 20 #define <API key> 21 #define <API key> 22 #define <API key> 23 #define <API key> 24 #define <API key> 26 #define <API key> 0 #define <API key> 1 #define <API key> 2 #define <API key> 3 #define <API key> 4 #define <API key> 6 #define <API key> 7 #define <API key> 8 #define <API key> 9 #define <API key> 10 #define <API key> 11 #define <API key> 12 #define <API key> 13 #define <API key> 14 #define <API key> 15 #define <API key> 16 #define <API key> 32 #define MFC_MAX_CLOCKS 4 #define mfc_read(dev, offset) readl(dev->regs_base + (offset)) #define mfc_write(dev, data, offset) writel((data), dev->regs_base + \ (offset)) /** * enum s5p_mfc_fmt_type - type of the pixelformat */ enum s5p_mfc_fmt_type { MFC_FMT_DEC, MFC_FMT_ENC, MFC_FMT_RAW, }; /** * enum s5p_mfc_inst_type - The type of an MFC instance. */ enum s5p_mfc_inst_type { MFCINST_INVALID, MFCINST_DECODER, MFCINST_ENCODER, }; /** * enum s5p_mfc_inst_state - The state of an MFC instance. */ enum s5p_mfc_inst_state { MFCINST_FREE = 0, MFCINST_INIT = 100, MFCINST_GOT_INST, MFCINST_HEAD_PARSED, <API key>, MFCINST_BUFS_SET, MFCINST_RUNNING, MFCINST_FINISHING, MFCINST_FINISHED, MFCINST_RETURN_INST, MFCINST_ERROR, MFCINST_ABORT, MFCINST_FLUSH, <API key>, <API key>, <API key>, }; /** * enum s5p_mfc_queue_state - The state of buffer queue. */ enum s5p_mfc_queue_state { QUEUE_FREE, <API key>, QUEUE_BUFS_QUERIED, QUEUE_BUFS_MMAPED, }; /** * enum s5p_mfc_decode_arg - type of frame decoding */ enum s5p_mfc_decode_arg { MFC_DEC_FRAME, MFC_DEC_LAST_FRAME, MFC_DEC_RES_CHANGE, }; enum s5p_mfc_fw_ver { MFC_FW_V1, MFC_FW_V2, }; #define MFC_BUF_FLAG_USED (1 << 0) #define MFC_BUF_FLAG_EOS (1 << 1) struct s5p_mfc_ctx; /** * struct s5p_mfc_buf - MFC buffer */ struct s5p_mfc_buf { struct vb2_v4l2_buffer *b; struct list_head list; union { struct { size_t luma; size_t chroma; } raw; size_t stream; } cookie; int flags; }; /** * struct s5p_mfc_pm - power management data structure */ struct s5p_mfc_pm { struct clk *clock_gate; const char * const *clk_names; struct clk *clocks[MFC_MAX_CLOCKS]; int num_clocks; bool use_clock_gating; struct device *device; }; struct s5p_mfc_buf_size_v5 { unsigned int h264_ctx; unsigned int non_h264_ctx; unsigned int dsc; unsigned int shm; }; struct s5p_mfc_buf_size_v6 { unsigned int dev_ctx; unsigned int h264_dec_ctx; unsigned int other_dec_ctx; unsigned int h264_enc_ctx; unsigned int hevc_enc_ctx; unsigned int other_enc_ctx; }; struct s5p_mfc_buf_size { unsigned int fw; unsigned int cpb; void *priv; }; struct s5p_mfc_variant { unsigned int version; unsigned int port_num; u32 version_bit; struct s5p_mfc_buf_size *buf_size; char *fw_name[MFC_FW_MAX_VERSIONS]; const char *clk_names[MFC_MAX_CLOCKS]; int num_clocks; bool use_clock_gating; }; /** * struct s5p_mfc_priv_buf - represents internal used buffer * @ofs: offset of each buffer, will be used for MFC * @virt: kernel virtual address, only valid when the * buffer accessed by driver * @dma: DMA address, only valid when kernel DMA API used * @size: size of the buffer * @ctx: memory context (bank) used for this allocation */ struct s5p_mfc_priv_buf { unsigned long ofs; void *virt; dma_addr_t dma; size_t size; unsigned int ctx; }; /** * struct s5p_mfc_dev - The struct containing driver internal parameters. * * @v4l2_dev: v4l2_device * @vfd_dec: video device for decoding * @vfd_enc: video device for encoding * @plat_dev: platform device * @mem_dev[]: child devices of the memory banks * @regs_base: base address of the MFC hw registers * @irq: irq resource * @dec_ctrl_handler: control framework handler for decoding * @enc_ctrl_handler: control framework handler for encoding * @pm: power management control * @variant: MFC hardware variant information * @num_inst: counter of active MFC instances * @irqlock: lock for operations on videobuf2 queues * @condlock: lock for changing/checking if a context is ready to be * processed * @mfc_mutex: lock for video_device * @int_cond: variable used by the waitqueue * @int_type: type of last interrupt * @int_err: error number for last interrupt * @queue: waitqueue for waiting for completion of device commands * @fw_size: size of firmware * @fw_virt_addr: virtual firmware address * @dma_base[]: address of the beginning of memory banks * @hw_lock: used for hardware locking * @ctx: array of driver contexts * @curr_ctx: number of the currently running context * @ctx_work_bits: used to mark which contexts are waiting for hardware * @watchdog_cnt: counter for the watchdog * @watchdog_workqueue: workqueue for the watchdog * @watchdog_work: worker for the watchdog * @enter_suspend: flag set when entering suspend * @ctx_buf: common context memory (MFCv6) * @warn_start: hardware error code from which warnings start * @mfc_ops: ops structure holding HW operation function pointers * @mfc_cmds: cmd structure holding HW commands function pointers * @mfc_regs: structure holding MFC registers * @fw_ver: loaded firmware sub-version * @fw_get_done flag set when request_firmware() is complete and * copied into fw_buf * risc_on: flag indicates RISC is on or off * */ struct s5p_mfc_dev { struct v4l2_device v4l2_dev; struct video_device *vfd_dec; struct video_device *vfd_enc; struct platform_device *plat_dev; struct device *mem_dev[BANK_CTX_NUM]; void __iomem *regs_base; int irq; struct v4l2_ctrl_handler dec_ctrl_handler; struct v4l2_ctrl_handler enc_ctrl_handler; struct s5p_mfc_pm pm; const struct s5p_mfc_variant *variant; int num_inst; spinlock_t irqlock; /* lock when operating on context */ spinlock_t condlock; /* lock when changing/checking if a context is ready to be processed */ struct mutex mfc_mutex; /* video_device lock */ int int_cond; int int_type; unsigned int int_err; wait_queue_head_t queue; struct s5p_mfc_priv_buf fw_buf; size_t mem_size; dma_addr_t mem_base; unsigned long *mem_bitmap; void *mem_virt; dma_addr_t dma_base[BANK_CTX_NUM]; unsigned long hw_lock; struct s5p_mfc_ctx *ctx[MFC_NUM_CONTEXTS]; int curr_ctx; unsigned long ctx_work_bits; atomic_t watchdog_cnt; struct timer_list watchdog_timer; struct workqueue_struct *watchdog_workqueue; struct work_struct watchdog_work; unsigned long enter_suspend; struct s5p_mfc_priv_buf ctx_buf; int warn_start; struct s5p_mfc_hw_ops *mfc_ops; struct s5p_mfc_hw_cmds *mfc_cmds; const struct s5p_mfc_regs *mfc_regs; enum s5p_mfc_fw_ver fw_ver; bool fw_get_done; bool risc_on; /* indicates if RISC is on or off */ }; /** * struct <API key> - encoding parameters for h264 */ struct <API key> { enum <API key> profile; enum <API key> loop_filter_mode; s8 loop_filter_alpha; s8 loop_filter_beta; enum <API key> entropy_mode; u8 max_ref_pic; u8 num_ref_pic_4p; int _8x8_transform; int rc_mb_dark; int rc_mb_smooth; int rc_mb_static; int rc_mb_activity; int vui_sar; u8 vui_sar_idc; u16 vui_ext_sar_width; u16 vui_ext_sar_height; int open_gop; u16 open_gop_size; u8 rc_frame_qp; u8 rc_min_qp; u8 rc_max_qp; u8 rc_p_frame_qp; u8 rc_b_frame_qp; enum <API key> level_v4l2; int level; u16 cpb_size; int interlace; u8 hier_qp; u8 hier_qp_type; u8 hier_qp_layer; u8 hier_qp_layer_qp[7]; u8 sei_frame_packing; u8 sei_fp_curr_frame_0; u8 <API key>; u8 fmo; u8 fmo_map_type; u8 fmo_slice_grp; u8 fmo_chg_dir; u32 fmo_chg_rate; u32 fmo_run_len[4]; u8 aso; u32 aso_slice_order[8]; }; /** * struct <API key> - encoding parameters for h263 and mpeg4 */ struct <API key> { /* MPEG4 Only */ enum <API key> profile; int quarter_pixel; /* Common for MPEG4, H263 */ u16 vop_time_res; u16 vop_frm_delta; u8 rc_frame_qp; u8 rc_min_qp; u8 rc_max_qp; u8 rc_p_frame_qp; u8 rc_b_frame_qp; enum <API key> level_v4l2; int level; }; /** * struct <API key> - encoding parameters for vp8 */ struct <API key> { u8 imd_4x4; enum <API key> num_partitions; enum <API key> num_ref; u8 filter_level; u8 filter_sharpness; u32 <API key>; enum <API key> golden_frame_sel; u8 hier_layer; u8 hier_layer_qp[3]; u8 rc_min_qp; u8 rc_max_qp; u8 rc_frame_qp; u8 rc_p_frame_qp; u8 profile; }; struct <API key> { enum <API key> profile; int level; enum <API key> level_v4l2; u8 tier; u32 rc_framerate; u8 rc_min_qp; u8 rc_max_qp; u8 rc_lcu_dark; u8 rc_lcu_smooth; u8 rc_lcu_static; u8 rc_lcu_activity; u8 rc_frame_qp; u8 rc_p_frame_qp; u8 rc_b_frame_qp; u8 max_partition_depth; u8 num_refs_for_p; u8 refreshtype; u16 refreshperiod; s32 lf_beta_offset_div2; s32 lf_tc_offset_div2; u8 loopfilter; u8 loopfilter_disable; u8 loopfilter_across; u8 <API key>; u8 <API key>; u8 <API key>; u8 <API key>; u8 lossless_cu_enable; u8 wavefront_enable; u8 enable_ltr; u8 hier_qp_enable; enum <API key> hier_qp_type; u8 num_hier_layer; u8 hier_qp_layer[7]; u32 hier_bit_layer[7]; u8 sign_data_hiding; u8 general_pb_enable; u8 temporal_id_enable; u8 strong_intra_smooth; u8 <API key>; u8 <API key>; u8 max_num_merge_mv; u8 eco_mode_enable; u8 <API key>; u8 <API key>; u8 <API key>; }; /** * struct s5p_mfc_enc_params - general encoding parameters */ struct s5p_mfc_enc_params { u16 width; u16 height; u32 mv_h_range; u32 mv_v_range; u16 gop_size; enum <API key> slice_mode; u16 slice_mb; u32 slice_bit; u16 intra_refresh_mb; int pad; u8 pad_luma; u8 pad_cb; u8 pad_cr; int rc_frame; int rc_mb; u32 rc_bitrate; u16 rc_reaction_coeff; u16 vbv_size; u32 vbv_delay; enum <API key> seq_hdr_mode; enum <API key> frame_skip_mode; int fixed_target_bit; u8 num_b_frame; u32 rc_framerate_num; u32 rc_framerate_denom; struct { struct <API key> h264; struct <API key> mpeg4; struct <API key> vp8; struct <API key> hevc; } codec; }; /** * struct s5p_mfc_codec_ops - codec ops, used by encoding */ struct s5p_mfc_codec_ops { /* initialization routines */ int (*pre_seq_start) (struct s5p_mfc_ctx *ctx); int (*post_seq_start) (struct s5p_mfc_ctx *ctx); /* execution routines */ int (*pre_frame_start) (struct s5p_mfc_ctx *ctx); int (*post_frame_start) (struct s5p_mfc_ctx *ctx); }; #define call_cop(c, op, args...) \ (((c)->c_ops->op) ? \ ((c)->c_ops->op(args)) : 0) /** * struct s5p_mfc_ctx - This struct contains the instance context * * @dev: pointer to the s5p_mfc_dev of the device * @fh: struct v4l2_fh * @num: number of the context that this structure describes * @int_cond: variable used by the waitqueue * @int_type: type of the last interrupt * @int_err: error number received from MFC hw in the interrupt * @queue: waitqueue that can be used to wait for this context to * finish * @src_fmt: source pixelformat information * @dst_fmt: destination pixelformat information * @vq_src: vb2 queue for source buffers * @vq_dst: vb2 queue for destination buffers * @src_queue: driver internal queue for source buffers * @dst_queue: driver internal queue for destination buffers * @src_queue_cnt: number of buffers queued on the source internal queue * @dst_queue_cnt: number of buffers queued on the dest internal queue * @type: type of the instance - decoder or encoder * @state: state of the context * @inst_no: number of hw instance associated with the context * @img_width: width of the image that is decoded or encoded * @img_height: height of the image that is decoded or encoded * @buf_width: width of the buffer for processed image * @buf_height: height of the buffer for processed image * @luma_size: size of a luma plane * @chroma_size: size of a chroma plane * @mv_size: size of a motion vectors buffer * @consumed_stream: number of bytes that have been used so far from the * decoding buffer * @dpb_flush_flag: flag used to indicate that a DPB buffers are being * flushed * @head_processed: flag mentioning whether the header data is processed * completely or not * @bank1: handle to memory allocated for temporary buffers from * memory bank 1 * @bank2: handle to memory allocated for temporary buffers from * memory bank 2 * @capture_state: state of the capture buffers queue * @output_state: state of the output buffers queue * @src_bufs: information on allocated source buffers * @dst_bufs: information on allocated destination buffers * @sequence: counter for the sequence number for v4l2 * @dec_dst_flag: flags for buffers queued in the hardware * @dec_src_buf_size: size of the buffer for source buffers in decoding * @codec_mode: number of codec mode used by MFC hw * @slice_interface: slice interface flag * @loop_filter_mpeg4: loop filter for MPEG4 flag * @display_delay: value of the display delay for H264 * @<API key>: display delay for H264 enable flag * @after_packed_pb: flag used to track buffer when stream is in * Packed PB format * @sei_fp_parse: enable/disable parsing of frame packing SEI information * @dpb_count: count of the DPB buffers required by MFC hw * @total_dpb_count: count of DPB buffers with additional buffers * requested by the application * @ctx: context buffer information * @dsc: descriptor buffer information * @shm: shared memory buffer information * @mv_count: number of MV buffers allocated for decoding * @enc_params: encoding parameters for MFC * @enc_dst_buf_size: size of the buffers for encoder output * @luma_dpb_size: dpb buffer size for luma * @chroma_dpb_size: dpb buffer size for chroma * @me_buffer_size: size of the motion estimation buffer * @tmv_buffer_size: size of temporal predictor motion vector buffer * @frame_type: used to force the type of the next encoded frame * @ref_queue: list of the reference buffers for encoding * @ref_queue_cnt: number of the buffers in the reference list * @c_ops: ops for encoding * @ctrls: array of controls, used when adding controls to the * v4l2 control framework * @ctrl_handler: handler for v4l2 framework */ struct s5p_mfc_ctx { struct s5p_mfc_dev *dev; struct v4l2_fh fh; int num; int int_cond; int int_type; unsigned int int_err; wait_queue_head_t queue; struct s5p_mfc_fmt *src_fmt; struct s5p_mfc_fmt *dst_fmt; struct vb2_queue vq_src; struct vb2_queue vq_dst; struct list_head src_queue; struct list_head dst_queue; unsigned int src_queue_cnt; unsigned int dst_queue_cnt; enum s5p_mfc_inst_type type; enum s5p_mfc_inst_state state; int inst_no; /* Image parameters */ int img_width; int img_height; int buf_width; int buf_height; int luma_size; int chroma_size; int mv_size; unsigned long consumed_stream; unsigned int dpb_flush_flag; unsigned int head_processed; struct s5p_mfc_priv_buf bank1; struct s5p_mfc_priv_buf bank2; enum s5p_mfc_queue_state capture_state; enum s5p_mfc_queue_state output_state; struct s5p_mfc_buf src_bufs[MFC_MAX_BUFFERS]; int src_bufs_cnt; struct s5p_mfc_buf dst_bufs[MFC_MAX_BUFFERS]; int dst_bufs_cnt; unsigned int sequence; unsigned long dec_dst_flag; size_t dec_src_buf_size; /* Control values */ int codec_mode; int slice_interface; int loop_filter_mpeg4; int display_delay; int <API key>; int after_packed_pb; int sei_fp_parse; int pb_count; int total_dpb_count; int mv_count; /* Buffers */ struct s5p_mfc_priv_buf ctx; struct s5p_mfc_priv_buf dsc; struct s5p_mfc_priv_buf shm; struct s5p_mfc_enc_params enc_params; size_t enc_dst_buf_size; size_t luma_dpb_size; size_t chroma_dpb_size; size_t me_buffer_size; size_t tmv_buffer_size; enum <API key> force_frame_type; struct list_head ref_queue; unsigned int ref_queue_cnt; enum <API key> slice_mode; union { unsigned int mb; unsigned int bits; } slice_size; const struct s5p_mfc_codec_ops *c_ops; struct v4l2_ctrl *ctrls[MFC_MAX_CTRLS]; struct v4l2_ctrl_handler ctrl_handler; unsigned int frame_tag; size_t scratch_buf_size; }; /* * struct s5p_mfc_fmt - structure used to store information about pixelformats * used by the MFC */ struct s5p_mfc_fmt { char *name; u32 fourcc; u32 codec_mode; enum s5p_mfc_fmt_type type; u32 num_planes; u32 versions; }; /** * struct mfc_control - structure used to store information about MFC controls * it is used to initialize the control framework. */ struct mfc_control { __u32 id; enum v4l2_ctrl_type type; __u8 name[32]; /* Whatever */ __s32 minimum; /* Note signedness */ __s32 maximum; __s32 step; __u32 menu_skip_mask; __s32 default_value; __u32 flags; __u32 reserved[2]; __u8 is_volatile; }; /* Macro for making hardware specific calls */ #define s5p_mfc_hw_call(f, op, args...) \ ((f && f->op) ? f->op(args) : (typeof(f->op(args)))(-ENODEV)) #define fh_to_ctx(__fh) container_of(__fh, struct s5p_mfc_ctx, fh) #define ctrl_to_ctx(__ctrl) \ container_of((__ctrl)->handler, struct s5p_mfc_ctx, ctrl_handler) void clear_work_bit(struct s5p_mfc_ctx *ctx); void set_work_bit(struct s5p_mfc_ctx *ctx); void <API key>(struct s5p_mfc_ctx *ctx); void <API key>(struct s5p_mfc_ctx *ctx); int s5p_mfc_get_new_ctx(struct s5p_mfc_dev *dev); void <API key>(struct list_head *lh, struct vb2_queue *vq); #define HAS_PORTNUM(dev) (dev ? (dev->variant ? \ (dev->variant->port_num ? 1 : 0) : 0) : 0) #define IS_TWOPORT(dev) (dev->variant->port_num == 2 ? 1 : 0) #define IS_MFCV6_PLUS(dev) (dev->variant->version >= 0x60 ? 1 : 0) #define IS_MFCV7_PLUS(dev) (dev->variant->version >= 0x70 ? 1 : 0) #define IS_MFCV8_PLUS(dev) (dev->variant->version >= 0x80 ? 1 : 0) #define IS_MFCV10(dev) (dev->variant->version >= 0xA0 ? 1 : 0) #define <API key>(dev) (IS_MFCV10(dev)) #define MFC_V5_BIT BIT(0) #define MFC_V6_BIT BIT(1) #define MFC_V7_BIT BIT(2) #define MFC_V8_BIT BIT(3) #define MFC_V10_BIT BIT(5) #define MFC_V5PLUS_BITS (MFC_V5_BIT | MFC_V6_BIT | MFC_V7_BIT | \ MFC_V8_BIT | MFC_V10_BIT) #define MFC_V6PLUS_BITS (MFC_V6_BIT | MFC_V7_BIT | MFC_V8_BIT | \ MFC_V10_BIT) #define MFC_V7PLUS_BITS (MFC_V7_BIT | MFC_V8_BIT | MFC_V10_BIT) #endif /* S5P_MFC_COMMON_H_ */
#include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include <linux/input.h> #include <linux/platform_device.h> #include <linux/input/sparse-keymap.h> #include <linux/acpi.h> #include <acpi/acpi_bus.h> MODULE_LICENSE("GPL"); MODULE_AUTHOR("Alex Hung"); static const struct acpi_device_id intel_hid_ids[] = { {"INT33D5", 0}, {"", 0}, }; /* In theory, these are HID usages. */ static const struct key_entry intel_hid_keymap[] = { /* 1: LSuper (Page 0x07, usage 0xE3) -- unclear what to do */ /* 2: Toggle SW_ROTATE_LOCK -- easy to implement if seen in wild */ { KE_KEY, 3, { KEY_NUMLOCK } }, { KE_KEY, 4, { KEY_HOME } }, { KE_KEY, 5, { KEY_END } }, { KE_KEY, 6, { KEY_PAGEUP } }, { KE_KEY, 7, { KEY_PAGEDOWN } }, { KE_KEY, 8, { KEY_RFKILL } }, { KE_KEY, 9, { KEY_POWER } }, { KE_KEY, 11, { KEY_SLEEP } }, /* 13 has two different meanings in the spec -- ignore it. */ { KE_KEY, 14, { KEY_STOPCD } }, { KE_KEY, 15, { KEY_PLAYPAUSE } }, { KE_KEY, 16, { KEY_MUTE } }, { KE_KEY, 17, { KEY_VOLUMEUP } }, { KE_KEY, 18, { KEY_VOLUMEDOWN } }, { KE_KEY, 19, { KEY_BRIGHTNESSUP } }, { KE_KEY, 20, { KEY_BRIGHTNESSDOWN } }, /* 27: wake -- needs special handling */ { KE_END }, }; struct intel_hid_priv { struct input_dev *input_dev; }; static int <API key>(struct device *device, int enable) { union acpi_object arg0 = { ACPI_TYPE_INTEGER }; struct acpi_object_list args = { 1, &arg0 }; acpi_status status; arg0.integer.value = enable; status = <API key>(ACPI_HANDLE(device), "HDSM", &args, NULL); if (ACPI_FAILURE(status)) { dev_warn(device, "failed to %sable hotkeys\n", enable ? "en" : "dis"); return -EIO; } return 0; } static int <API key>(struct device *device) { <API key>(device, 0); return 0; } static int <API key>(struct device *device) { <API key>(device, 1); return 0; } static const struct dev_pm_ops intel_hid_pl_pm_ops = { .freeze = <API key>, .restore = <API key>, .suspend = <API key>, .resume = <API key>, }; static int <API key>(struct platform_device *device) { struct intel_hid_priv *priv = dev_get_drvdata(&device->dev); int ret; priv->input_dev = <API key>(); if (!priv->input_dev) return -ENOMEM; ret = sparse_keymap_setup(priv->input_dev, intel_hid_keymap, NULL); if (ret) goto err_free_device; priv->input_dev->dev.parent = &device->dev; priv->input_dev->name = "Intel HID events"; priv->input_dev->id.bustype = BUS_HOST; set_bit(KEY_RFKILL, priv->input_dev->keybit); ret = <API key>(priv->input_dev); if (ret) goto err_free_device; return 0; err_free_device: input_free_device(priv->input_dev); return ret; } static void <API key>(struct platform_device *device) { struct intel_hid_priv *priv = dev_get_drvdata(&device->dev); <API key>(priv->input_dev); } static void notify_handler(acpi_handle handle, u32 event, void *context) { struct platform_device *device = context; struct intel_hid_priv *priv = dev_get_drvdata(&device->dev); unsigned long long ev_index; acpi_status status; /* The platform spec only defines one event code: 0xC0. */ if (event != 0xc0) { dev_warn(&device->dev, "received unknown event (0x%x)\n", event); return; } status = <API key>(handle, "HDEM", NULL, &ev_index); if (ACPI_FAILURE(status)) { dev_warn(&device->dev, "failed to get event index\n"); return; } if (!<API key>(priv->input_dev, ev_index, 1, true)) dev_info(&device->dev, "unknown event index 0x%llx\n", ev_index); } static int intel_hid_probe(struct platform_device *device) { acpi_handle handle = ACPI_HANDLE(&device->dev); struct intel_hid_priv *priv; unsigned long long mode; acpi_status status; int err; status = <API key>(handle, "HDMM", NULL, &mode); if (ACPI_FAILURE(status)) { dev_warn(&device->dev, "failed to read mode\n"); return -ENODEV; } if (mode != 0) { /* * This driver only implements "simple" mode. There appear * to be no other modes, but we should be paranoid and check * for compatibility. */ dev_info(&device->dev, "platform is not in simple mode\n"); return -ENODEV; } priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; dev_set_drvdata(&device->dev, priv); err = <API key>(device); if (err) { pr_err("Failed to setup Intel HID hotkeys\n"); return err; } status = <API key>(handle, ACPI_DEVICE_NOTIFY, notify_handler, device); if (ACPI_FAILURE(status)) { err = -EBUSY; goto err_remove_input; } err = <API key>(&device->dev, 1); if (err) goto err_remove_notify; return 0; err_remove_notify: <API key>(handle, ACPI_DEVICE_NOTIFY, notify_handler); err_remove_input: <API key>(device); return err; } static int intel_hid_remove(struct platform_device *device) { acpi_handle handle = ACPI_HANDLE(&device->dev); <API key>(handle, ACPI_DEVICE_NOTIFY, notify_handler); <API key>(device); <API key>(&device->dev, 0); /* * Even if we failed to shut off the event stream, we can still * safely detach from the device. */ return 0; } static struct platform_driver intel_hid_pl_driver = { .driver = { .name = "intel-hid", .acpi_match_table = intel_hid_ids, .pm = &intel_hid_pl_pm_ops, }, .probe = intel_hid_probe, .remove = intel_hid_remove, }; MODULE_DEVICE_TABLE(acpi, intel_hid_ids); /* * Unfortunately, some laptops provide a _HID="INT33D5" device with * _CID="PNP0C02". This causes the pnpacpi scan driver to claim the * ACPI node, so no platform device will be created. The pnpacpi * driver rejects this device in subsequent processing, so no physical * node is created at all. * * As a workaround until the ACPI core figures out how to handle * this corner case, manually ask the ACPI platform device code to * claim the ACPI node. */ static acpi_status __init check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv) { const struct acpi_device_id *ids = context; struct acpi_device *dev; if (acpi_bus_get_device(handle, &dev) != 0) return AE_OK; if (<API key>(dev, ids) == 0) if (<API key>(dev, NULL)) dev_info(&dev->dev, "intel-hid: created platform device\n"); return AE_OK; } static int __init intel_hid_init(void) { acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, check_acpi_dev, NULL, (void *)intel_hid_ids, NULL); return <API key>(&intel_hid_pl_driver); } module_init(intel_hid_init); static void __exit intel_hid_exit(void) { <API key>(&intel_hid_pl_driver); } module_exit(intel_hid_exit);
#include <QDBusConnection> #include <QDBusMessage> #include <QDBusPendingCall> #include <QDBusPendingReply> #include "powermanagement_x11.h" <API key>::<API key>(QObject *parent) : QObject(parent) { if (!QDBusConnection::sessionBus().isConnected()) { qDebug("D-Bus: Could not connect to session bus"); m_state = error; } else { m_state = idle; } m_intended_state = idle; m_cookie = 0; m_use_gsm = false; } <API key>::~<API key>() { } void <API key>::RequestIdle() { m_intended_state = idle; if (m_state == error || m_state == idle || m_state == request_idle || m_state == request_busy) return; qDebug("D-Bus: <API key>: Requesting idle"); QDBusMessage call; if (!m_use_gsm) call = QDBusMessage::createMethodCall( "org.freedesktop.PowerManagement", "/org/freedesktop/PowerManagement/Inhibit", "org.freedesktop.PowerManagement.Inhibit", "UnInhibit"); else call = QDBusMessage::createMethodCall( "org.gnome.SessionManager", "/org/gnome/SessionManager", "org.gnome.SessionManager", "Uninhibit"); m_state = request_idle; QList<QVariant> args; args << m_cookie; call.setArguments(args); QDBusPendingCall pcall = QDBusConnection::sessionBus().asyncCall(call, 1000); <API key> *watcher = new <API key>(pcall, this); connect(watcher, SIGNAL(finished(<API key>*)), this, SLOT(OnAsyncReply(<API key>*))); } void <API key>::RequestBusy() { m_intended_state = busy; if (m_state == error || m_state == busy || m_state == request_busy || m_state == request_idle) return; qDebug("D-Bus: <API key>: Requesting busy"); QDBusMessage call; if (!m_use_gsm) call = QDBusMessage::createMethodCall( "org.freedesktop.PowerManagement", "/org/freedesktop/PowerManagement/Inhibit", "org.freedesktop.PowerManagement.Inhibit", "Inhibit"); else call = QDBusMessage::createMethodCall( "org.gnome.SessionManager", "/org/gnome/SessionManager", "org.gnome.SessionManager", "Inhibit"); m_state = request_busy; QList<QVariant> args; args << "qBittorrent"; if (m_use_gsm) args << (uint)0; args << "Active torrents are presented"; if (m_use_gsm) args << (uint)8; call.setArguments(args); QDBusPendingCall pcall = QDBusConnection::sessionBus().asyncCall(call, 1000); <API key> *watcher = new <API key>(pcall, this); connect(watcher, SIGNAL(finished(<API key>*)), this, SLOT(OnAsyncReply(<API key>*))); } void <API key>::OnAsyncReply(<API key> *call) { if (m_state == request_idle) { QDBusPendingReply<> reply = *call; if (reply.isError()) { qDebug("D-Bus: Reply: Error: %s", qPrintable(reply.error().message())); m_state = error; } else { m_state = idle; qDebug("D-Bus: <API key>: Request successful"); if (m_intended_state == busy) RequestBusy(); } } else if (m_state == request_busy) { QDBusPendingReply<uint> reply = *call; if (reply.isError()) { qDebug("D-Bus: Reply: Error: %s", qPrintable(reply.error().message())); if (!m_use_gsm) { qDebug("D-Bus: Falling back to org.gnome.SessionManager"); m_use_gsm = true; m_state = idle; if (m_intended_state == busy) RequestBusy(); } else { m_state = error; } } else { m_state = busy; m_cookie = reply.value(); qDebug("D-Bus: <API key>: Request successful, cookie is %d", m_cookie); if (m_intended_state == idle) RequestIdle(); } } else { qDebug("D-Bus: Unexpected reply in state %d", m_state); m_state = error; } call->deleteLater(); }
// -*- C++;indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*- /* * driver_name.cpp * * Test suite program for C++ bindings */ #include <iostream> #include <iomanip> #include <usbpp.h> using namespace std; int main(void) { USB::Busses buslist; cout << "bus/device idVendor/idProduct" << endl; // buslist.init(); USB::Bus *bus; list<USB::Bus *>::const_iterator biter; USB::Device *device; list<USB::Device *>::const_iterator diter; int i, j; int retval; string driver; for (biter = buslist.begin(); biter != buslist.end(); biter++) { bus = *biter; for (diter = bus->begin(); diter != bus->end(); diter++) { device = *diter; USB::Configuration *this_Configuration; this_Configuration = device->firstConfiguration(); for (i=0; i < device->numConfigurations(); i++) { USB::Interface *this_Interface; this_Interface = this_Configuration->firstInterface(); for (j=0; j < this_Configuration->numInterfaces(); j++) { retval = this_Interface->driverName(driver); if (0 == retval) { cout << bus->directoryName() << "/" << device->fileName() << " " << uppercase << hex << setw(4) << setfill('0') << device->idVendor() << "/" << uppercase << hex << setw(4) << setfill('0') << device->idProduct() << " " << "driver: " << driver << endl; } else { cout << "fetching driver string failed (" << retval << "): " << usb_strerror() << endl; return EXIT_FAILURE; } this_Interface = this_Configuration->nextInterface(); } this_Configuration = device->nextConfiguration(); } } } return 0; }
/* <API key>: GPL-2.0 OR BSD-3-Clause */ #ifndef __USB_OPS_LINUX_H__ #define __USB_OPS_LINUX_H__ #define <API key> 254 #define <API key> 10 #define <API key> 500 #define <API key> 10 #define <API key> 5000 #define <API key>(urb, regs) \ <API key>(urb) #define <API key>(purb, regs) \ <API key>(purb) #define <API key>(purb, regs) \ <API key>(purb) #define <API key>(purb, regs) \ <API key>(purb) #define <API key>(purb, regs) \ <API key>(purb) #define <API key>(purb, regs) \ <API key>(purb) unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 addr); void usb_read_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem); void usb_write_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem); void <API key>(struct intf_hdl *pintfhdl); u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem); void <API key>(struct intf_hdl *pintfhdl); #endif
var assert = require('assert'); var ASN1 = require('./types'); var errors = require('./errors'); --- Globals var newInvalidAsn1Error = errors.newInvalidAsn1Error; --- API function Reader(data) { if (!data || !Buffer.isBuffer(data)) throw new TypeError('data must be a node Buffer'); this._buf = data; this._size = data.length; // These hold the "current" state this._len = 0; this._offset = 0; var self = this; this.__defineGetter__('length', function() { return self._len; }); this.__defineGetter__('offset', function() { return self._offset; }); this.__defineGetter__('remain', function() { return self._size - self._offset; }); this.__defineGetter__('buffer', function() { return self._buf.slice(self._offset); }); } /** * Reads a single byte and advances offset; you can pass in `true` to make this * a "peek" operation (i.e., get the byte, but don't advance the offset). * * @param {Boolean} peek true means don't move offset. * @return {Number} the next byte, null if not enough data. */ Reader.prototype.readByte = function(peek) { if (this._size - this._offset < 1) return null; var b = this._buf[this._offset] & 0xff; if (!peek) this._offset += 1; return b; }; Reader.prototype.peek = function() { return this.readByte(true); }; /** * Reads a (potentially) variable length off the BER buffer. This call is * not really meant to be called directly, as callers have to manipulate * the internal buffer afterwards. * * As a result of this call, you can call `Reader.length`, until the * next thing called that does a readLength. * * @return {Number} the amount of offset to advance the buffer. * @throws {InvalidAsn1Error} on bad ASN.1 */ Reader.prototype.readLength = function(offset) { if (offset === undefined) offset = this._offset; if (offset >= this._size) return null; var lenB = this._buf[offset++] & 0xff; if (lenB === null) return null; if ((lenB & 0x80) == 0x80) { lenB &= 0x7f; if (lenB == 0) throw newInvalidAsn1Error('Indefinite length not supported'); if (lenB > 4) throw newInvalidAsn1Error('encoding too long'); if (this._size - offset < lenB) return null; this._len = 0; for (var i = 0; i < lenB; i++) this._len = (this._len << 8) + (this._buf[offset++] & 0xff); } else { // Wasn't a variable length this._len = lenB; } return offset; }; /** * Parses the next sequence in this BER buffer. * * To get the length of the sequence, call `Reader.length`. * * @return {Number} the sequence's tag. */ Reader.prototype.readSequence = function(tag) { var seq = this.peek(); if (seq === null) return null; if (tag !== undefined && tag !== seq) throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) + ': got 0x' + seq.toString(16)); var o = this.readLength(this._offset + 1); // stored in `length` if (o === null) return null; this._offset = o; return seq; }; Reader.prototype.readInt = function() { return this._readTag(ASN1.Integer); }; Reader.prototype.readBoolean = function() { return (this._readTag(ASN1.Boolean) === 0 ? false : true); }; Reader.prototype.readEnumeration = function() { return this._readTag(ASN1.Enumeration); }; Reader.prototype.readString = function(tag, retbuf) { if (!tag) tag = ASN1.OctetString; var b = this.peek(); if (b === null) return null; if (b !== tag) throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) + ': got 0x' + b.toString(16)); var o = this.readLength(this._offset + 1); // stored in `length` if (o === null) return null; if (this.length > this._size - o) return null; this._offset = o; if (this.length === 0) return ''; var str = this._buf.slice(this._offset, this._offset + this.length); this._offset += this.length; return retbuf ? str : str.toString('utf8'); }; Reader.prototype.readOID = function(tag) { if (!tag) tag = ASN1.OID; var b = this.peek(); if (b === null) return null; if (b !== tag) throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) + ': got 0x' + b.toString(16)); var o = this.readLength(this._offset + 1); // stored in `length` if (o === null) return null; if (this.length > this._size - o) return null; this._offset = o; var values = []; var value = 0; for (var i = 0; i < this.length; i++) { var byte = this._buf[this._offset++] & 0xff; value <<= 7; value += byte & 0x7f; if ((byte & 0x80) == 0) { values.push(value); value = 0; } } value = values.shift(); values.unshift(value % 40); values.unshift((value / 40) >> 0); return values.join('.'); }; Reader.prototype._readTag = function(tag) { assert.ok(tag !== undefined); var b = this.peek(); if (b === null) return null; if (b !== tag) throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) + ': got 0x' + b.toString(16)); var o = this.readLength(this._offset + 1); // stored in `length` if (o === null) return null; if (this.length > 4) throw newInvalidAsn1Error('Integer too long: ' + this.length); if (this.length > this._size - o) return null; this._offset = o; var fb = this._buf[this._offset++]; var value = 0; value = fb & 0x7F; for (var i = 1; i < this.length; i++) { value <<= 8; value |= (this._buf[this._offset++] & 0xff); } if ((fb & 0x80) == 0x80) value = -value; return value; }; --- Exported API module.exports = Reader;
# Makefile for the kernel USB device drivers. # Object files in subdirectories obj-$(CONFIG_USB) += core/ obj-$(<API key>) += otg/ obj-$(CONFIG_USB_DWC3) += dwc3/ obj-$(CONFIG_USB_MON) += mon/ obj-$(CONFIG_PCI) += host/ obj-$(CONFIG_USB_EHCI_HCD) += host/ obj-$(<API key>) += host/ obj-$(CONFIG_USB_OHCI_HCD) += host/ obj-$(CONFIG_USB_UHCI_HCD) += host/ obj-$(CONFIG_USB_FHCI_HCD) += host/ obj-$(CONFIG_USB_XHCI_HCD) += host/ obj-$(<API key>) += host/ obj-$(<API key>) += host/ obj-$(CONFIG_USB_U132_HCD) += host/ obj-$(<API key>) += host/ obj-$(CONFIG_USB_HWA_HCD) += host/ obj-$(<API key>) += host/ obj-$(<API key>) += host/ obj-$(<API key>) += host/ obj-$(<API key>) += host/ obj-$(<API key>) += c67x00/ obj-$(CONFIG_USB_WUSB) += wusbcore/ obj-$(CONFIG_USB_ACM) += class/ obj-$(CONFIG_USB_PRINTER) += class/ obj-$(CONFIG_USB_WDM) += class/ obj-$(CONFIG_USB_TMC) += class/ obj-$(CONFIG_USB_STORAGE) += storage/ obj-$(CONFIG_USB) += storage/ obj-$(CONFIG_USB_MDC800) += image/ obj-$(CONFIG_USB_MICROTEK) += image/ obj-$(CONFIG_USB_SERIAL) += serial/ obj-$(CONFIG_USB) += misc/ obj-$(<API key>) += early/ obj-$(CONFIG_USB_ATM) += atm/ obj-$(<API key>) += atm/ obj-$(<API key>) += notify/ obj-$(<API key>) += musb/ obj-$(<API key>) += renesas_usbhs/ obj-$(CONFIG_USB_GADGET) += gadget/ obj-$(CONFIG_USB_COMMON) += usb-common.o
// filename: ISSP_Extern.h #include "issp_revision.h" #ifdef PROJECT_REV_304 //CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, //INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF //MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE //BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR //CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT //OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR //BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF //LIABILITY, WHETHER IN CONRTACT, STRICT LIABILITY, OR TORT (INCLUDING //NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // Cypress reserves the right to make changes without further notice to the // materials described herein. Cypress does not assume any liability arising // out of the application or use of any product or circuit described herein. // Cypress does not authorize its products for use as critical components in // life-support systems where a malfunction or failure may reasonably be // expected to result in significant injury to the user. The inclusion of // Cypress?product in a life-support systems application implies that the // manufacturer assumes all risk of such use and in doing so indemnifies // Cypress against all charges. // Use may be limited by and subject to the applicable Cypress software #ifndef INC_ISSP_EXTERN #define INC_ISSP_EXTERN #include "issp_directives.h" extern signed char <API key>(void); extern signed char <API key>(void); extern signed char fEraseTarget(void); extern unsigned int iLoadTarget(unsigned blknum); extern void ReStartTarget(void); extern signed char fVerifySiliconID(void); extern signed char <API key>(unsigned int*); extern signed char fProgramTargetBlock(unsigned char, unsigned char); extern signed char fVerifyTargetBlock(unsigned char, unsigned char); extern signed char fVerifySetup(unsigned char, unsigned char); //PTJ: VERIFY-SETUP extern signed char fReadByteLoop(unsigned int blknum); //PTJ: read bytes after VERIFY-SETUP extern signed char fSecureTargetFlash(void); extern signed char fReadStatus(void); //PTJ: READ-STATUS extern signed char fReadWriteSetup(void); //PTJ: READ-WRITE-SETUP extern void InitTargetTestData(void); extern void <API key>(unsigned char, unsigned char, unsigned char); extern void LoadProgramData(unsigned char, unsigned char); extern signed char fLoadSecurityData(unsigned char); extern void Delay(unsigned int); extern unsigned char fSDATACheck(void); extern void SCLKHigh(void); extern void SCLKLow(void); #ifndef RESET_MODE //only needed when power cycle mode extern void SetSCLKHiZ(void); #endif extern void SetSCLKStrong(void); extern void SetSDATAHigh(void); extern void SetSDATALow(void); extern void SetSDATAHiZ(void); extern void SetSDATAStrong(void); extern void AssertXRES(void); extern void DeassertXRES(void); extern void SetXRESStrong(void); extern void ApplyTargetVDD(void); extern void RemoveTargetVDD(void); extern void SetTargetVDDStrong(void); #ifdef TX_ON extern void UART_PutHexHalf(char ch); extern void UART_PutHexByte(unsigned char ch); extern void UART_PutHexWord(unsigned int ch); #endif //extern char *pSocData; extern unsigned char fIsError; #endif //(INC_ISSP_EXTERN) #endif //(PROJECT_REV_) //end of file ISSP_Extern.h
#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/list.h> #include <linux/spinlock.h> #include <linux/device.h> #include <linux/timer.h> #include <linux/err.h> #include <linux/ctype.h> #include <linux/leds.h> #include "leds.h" static struct class *leds_class; static void <API key>(struct led_classdev *led_cdev) { if (led_cdev->brightness_get) led_cdev->brightness = led_cdev->brightness_get(led_cdev); } static ssize_t brightness_show(struct device *dev, struct device_attribute *attr, char *buf) { struct led_classdev *led_cdev = dev_get_drvdata(dev); /* no lock needed for this */ <API key>(led_cdev); return sprintf(buf, "%u\n", led_cdev->brightness); } static ssize_t brightness_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { struct led_classdev *led_cdev = dev_get_drvdata(dev); unsigned long state; ssize_t ret = -EINVAL; ret = kstrtoul(buf, 10, &state); if (ret) return ret; if (state == LED_OFF) led_trigger_remove(led_cdev); <API key>(led_cdev, state); return size; } static DEVICE_ATTR_RW(brightness); static ssize_t <API key>(struct device *dev, struct device_attribute *attr, char *buf) { struct led_classdev *led_cdev = dev_get_drvdata(dev); return sprintf(buf, "%u\n", led_cdev->max_brightness); } static DEVICE_ATTR(max_brightness, 0444, <API key>, NULL); #ifdef <API key> static DEVICE_ATTR(trigger, 0644, led_trigger_show, led_trigger_store); static struct attribute *led_trigger_attrs[] = { &dev_attr_trigger.attr, NULL, }; static const struct attribute_group led_trigger_group = { .attrs = led_trigger_attrs, }; #endif static struct attribute *led_class_attrs[] = { &dev_attr_brightness.attr, &<API key>.attr, NULL, }; static const struct attribute_group led_group = { .attrs = led_class_attrs, }; static const struct attribute_group *led_groups[] = { &led_group, #ifdef <API key> &led_trigger_group, #endif NULL, }; static void led_timer_function(unsigned long data) { struct led_classdev *led_cdev = (void *)data; unsigned long brightness; unsigned long delay; if (!led_cdev->blink_delay_on || !led_cdev->blink_delay_off) { <API key>(led_cdev, LED_OFF); return; } if (led_cdev->flags & <API key>) { led_cdev->flags &= ~<API key>; return; } brightness = led_get_brightness(led_cdev); if (!brightness) { /* Time to switch the LED on. */ brightness = led_cdev->blink_brightness; delay = led_cdev->blink_delay_on; } else { /* Store the current brightness value to be able * to restore it when the delay_off period is over. */ led_cdev->blink_brightness = brightness; brightness = LED_OFF; delay = led_cdev->blink_delay_off; } <API key>(led_cdev, brightness); /* Return in next iteration if led is in one-shot mode and we are in * the final blink state so that the led is toggled each delay_on + * delay_off milliseconds in worst case. */ if (led_cdev->flags & LED_BLINK_ONESHOT) { if (led_cdev->flags & LED_BLINK_INVERT) { if (brightness) led_cdev->flags |= <API key>; } else { if (!brightness) led_cdev->flags |= <API key>; } } mod_timer(&led_cdev->blink_timer, jiffies + msecs_to_jiffies(delay)); } static void <API key>(struct work_struct *ws) { struct led_classdev *led_cdev = container_of(ws, struct led_classdev, set_brightness_work); <API key>(led_cdev); <API key>(led_cdev, led_cdev->delayed_set_value); } /** * <API key> - suspend an led_classdev. * @led_cdev: the led_classdev to suspend. */ void <API key>(struct led_classdev *led_cdev) { led_cdev->flags |= LED_SUSPENDED; led_cdev->brightness_set(led_cdev, 0); } EXPORT_SYMBOL_GPL(<API key>); /** * led_classdev_resume - resume an led_classdev. * @led_cdev: the led_classdev to resume. */ void led_classdev_resume(struct led_classdev *led_cdev) { led_cdev->brightness_set(led_cdev, led_cdev->brightness); led_cdev->flags &= ~LED_SUSPENDED; } EXPORT_SYMBOL_GPL(led_classdev_resume); #ifdef CONFIG_PM_SLEEP static int led_suspend(struct device *dev) { struct led_classdev *led_cdev = dev_get_drvdata(dev); if (led_cdev->flags & <API key>) <API key>(led_cdev); return 0; } static int led_resume(struct device *dev) { struct led_classdev *led_cdev = dev_get_drvdata(dev); if (led_cdev->flags & <API key>) led_classdev_resume(led_cdev); return 0; } #endif static SIMPLE_DEV_PM_OPS(<API key>, led_suspend, led_resume); /** * <API key> - register a new object of led_classdev class. * @parent: The device to register. * @led_cdev: the led_classdev structure for this device. */ int <API key>(struct device *parent, struct led_classdev *led_cdev) { led_cdev->dev = device_create(leds_class, parent, 0, led_cdev, "%s", led_cdev->name); if (IS_ERR(led_cdev->dev)) return PTR_ERR(led_cdev->dev); #ifdef <API key> init_rwsem(&led_cdev->trigger_lock); #endif /* add to the list of leds */ down_write(&leds_list_lock); list_add_tail(&led_cdev->node, &leds_list); up_write(&leds_list_lock); if (!led_cdev->max_brightness) led_cdev->max_brightness = LED_FULL; <API key>(led_cdev); INIT_WORK(&led_cdev->set_brightness_work, <API key>); init_timer(&led_cdev->blink_timer); led_cdev->blink_timer.function = led_timer_function; led_cdev->blink_timer.data = (unsigned long)led_cdev; #ifdef <API key> <API key>(led_cdev); #endif dev_dbg(parent, "Registered led device: %s\n", led_cdev->name); return 0; } EXPORT_SYMBOL_GPL(<API key>); /** * <API key> - unregisters a object of led_properties class. * @led_cdev: the led device to unregister * * Unregisters a previously registered via <API key> object. */ void <API key>(struct led_classdev *led_cdev) { #ifdef <API key> down_write(&led_cdev->trigger_lock); if (led_cdev->trigger) led_trigger_set(led_cdev, NULL); up_write(&led_cdev->trigger_lock); #endif cancel_work_sync(&led_cdev->set_brightness_work); /* Stop blinking */ <API key>(led_cdev); led_set_brightness(led_cdev, LED_OFF); device_unregister(led_cdev->dev); down_write(&leds_list_lock); list_del(&led_cdev->node); up_write(&leds_list_lock); } EXPORT_SYMBOL_GPL(<API key>); static int __init leds_init(void) { leds_class = class_create(THIS_MODULE, "leds"); if (IS_ERR(leds_class)) return PTR_ERR(leds_class); leds_class->pm = &<API key>; leds_class->dev_groups = led_groups; return 0; } static void __exit leds_exit(void) { class_destroy(leds_class); } subsys_initcall(leds_init); module_exit(leds_exit); MODULE_AUTHOR("John Lenz, Richard Purdie"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("LED Class Interface");
using System; using Server.Network; namespace Server.Engines.PartySystem { public sealed class PartyEmptyList : Packet { public PartyEmptyList(Mobile m) : base(0xBF) { this.EnsureCapacity(7); this.m_Stream.Write((short)0x0006); this.m_Stream.Write((byte)0x02); this.m_Stream.Write((byte)0); this.m_Stream.Write((int)m.Serial); } } public sealed class PartyMemberList : Packet { public PartyMemberList(Party p) : base(0xBF) { this.EnsureCapacity(7 + p.Count * 4); this.m_Stream.Write((short)0x0006); this.m_Stream.Write((byte)0x01); this.m_Stream.Write((byte)p.Count); for (int i = 0; i < p.Count; ++i) this.m_Stream.Write((int)p[i].Mobile.Serial); } } public sealed class PartyRemoveMember : Packet { public PartyRemoveMember(Mobile removed, Party p) : base(0xBF) { this.EnsureCapacity(11 + p.Count * 4); this.m_Stream.Write((short)0x0006); this.m_Stream.Write((byte)0x02); this.m_Stream.Write((byte)p.Count); this.m_Stream.Write((int)removed.Serial); for (int i = 0; i < p.Count; ++i) this.m_Stream.Write((int)p[i].Mobile.Serial); } } public sealed class PartyTextMessage : Packet { public PartyTextMessage(bool toAll, Mobile from, string text) : base(0xBF) { if (text == null) text = ""; this.EnsureCapacity(12 + text.Length * 2); this.m_Stream.Write((short)0x0006); this.m_Stream.Write((byte)(toAll ? 0x04 : 0x03)); this.m_Stream.Write((int)from.Serial); this.m_Stream.WriteBigUniNull(text); } } public sealed class PartyInvitation : Packet { public PartyInvitation(Mobile leader) : base(0xBF) { this.EnsureCapacity(10); this.m_Stream.Write((short)0x0006); this.m_Stream.Write((byte)0x07); this.m_Stream.Write((int)leader.Serial); } } }
using System.Collections.Generic; using System.Collections.Immutable; using System.Composition; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editing; namespace System.Runtime.Analyzers { public abstract class <API key> : CodeFixProvider { public override ImmutableArray<string> <API key> => ImmutableArray.Create(<API key>.RuleId); public override async Task <API key>(CodeFixContext context) { var generator = SyntaxGenerator.GetGenerator(context.Document); var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); var declaration = root.FindNode(context.Span); declaration = generator.GetDeclaration(declaration); if (declaration == null) { return; } var model = await context.Document.<API key>(context.CancellationToken).ConfigureAwait(false); var typeSymbol = model.GetDeclaredSymbol(declaration) as INamedTypeSymbol; if (typeSymbol?.TypeKind != TypeKind.Class && typeSymbol?.TypeKind != TypeKind.Struct) { return; } // We cannot have multiple overlapping diagnostics of this id. var diagnostic = context.Diagnostics.Single(); context.RegisterCodeFix(new MyCodeAction(<API key>.ImplementComparable, async ct => await ImplementComparable(context.Document, declaration, typeSymbol, ct).ConfigureAwait(false)), diagnostic); } protected abstract SyntaxNode <API key>(SyntaxNode returnType, string operatorName, IEnumerable<SyntaxNode> parameters, SyntaxNode <API key>); private async Task<Document> ImplementComparable(Document document, SyntaxNode declaration, INamedTypeSymbol typeSymbol, Cancellation<API key>) { DocumentEditor editor = await DocumentEditor.CreateAsync(document, cancellationToken).ConfigureAwait(false); var generator = editor.Generator; if (!typeSymbol.DoesOverrideEquals()) { var equalsMethod = generator.MethodDeclaration(<API key>.ObjectEquals, new[] { generator.<API key>("obj", generator.TypeExpression(SpecialType.System_Object)) }, returnType: generator.TypeExpression(SpecialType.System_Boolean), accessibility: Accessibility.Public, modifiers: <API key>.Override, statements: new[] { generator.ThrowStatement(generator.<API key>(generator.DottedName("System.<API key>"))) }); editor.AddMember(declaration, equalsMethod); } if (!typeSymbol.<API key>()) { var getHashCodeMethod = generator.MethodDeclaration(<API key>.ObjectGetHashCode, returnType: generator.TypeExpression(SpecialType.System_Int32), accessibility: Accessibility.Public, modifiers: <API key>.Override, statements: new[] { generator.ThrowStatement(generator.<API key>(generator.DottedName("System.<API key>"))) }); editor.AddMember(declaration, getHashCodeMethod); } if (!typeSymbol.<API key>(<API key>.<API key>)) { var equalityOperator = <API key>(generator.TypeExpression(SpecialType.System_Boolean), <API key>.<API key>, new[] { generator.<API key>("left", generator.TypeExpression(typeSymbol)), generator.<API key>("right", generator.TypeExpression(typeSymbol)), }, generator.ThrowStatement(generator.<API key>(generator.DottedName("System.<API key>")))); editor.AddMember(declaration, equalityOperator); } if (!typeSymbol.<API key>(<API key>.<API key>)) { var inequalityOperator = <API key>(generator.TypeExpression(SpecialType.System_Boolean), <API key>.<API key>, new[] { generator.<API key>("left", generator.TypeExpression(typeSymbol)), generator.<API key>("right", generator.TypeExpression(typeSymbol)), }, generator.ThrowStatement(generator.<API key>(generator.DottedName("System.<API key>")))); editor.AddMember(declaration, inequalityOperator); } if (!typeSymbol.<API key>(<API key>.<API key>)) { var lessThanOperator = <API key>(generator.TypeExpression(SpecialType.System_Boolean), <API key>.<API key>, new[] { generator.<API key>("left", generator.TypeExpression(typeSymbol)), generator.<API key>("right", generator.TypeExpression(typeSymbol)), }, generator.ThrowStatement(generator.<API key>(generator.DottedName("System.<API key>")))); editor.AddMember(declaration, lessThanOperator); } if (!typeSymbol.<API key>(<API key>.<API key>)) { var greaterThanOperator = <API key>(generator.TypeExpression(SpecialType.System_Boolean), <API key>.<API key>, new[] { generator.<API key>("left", generator.TypeExpression(typeSymbol)), generator.<API key>("right", generator.TypeExpression(typeSymbol)), }, generator.ThrowStatement(generator.<API key>(generator.DottedName("System.<API key>")))); editor.AddMember(declaration, greaterThanOperator); } return editor.GetChangedDocument(); } private class MyCodeAction : <API key> { public MyCodeAction(string title, Func<CancellationToken, Task<Document>> <API key>) : base(title, <API key>) { } } } }
var x; for (; false;) { let x; () => x; } var y; for (; false;) { let y; y = 1; }
<!-- Good morning, Mr. Phelps. --> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>or-tools/examples/cpp/: operations_research::DobbleFilter Class Reference - Doxy</title> <link rel="shortcut icon" href="../../../favicon.ico"> <!-- Both stylesheets are supplied by Doxygen, with maybe minor tweaks from Google. --> <link href="../../../doxygen.css" rel="stylesheet" type="text/css"> <link href="../../../tabs.css" rel="stylesheet" type="text/css"> </head> <body topmargin=0 leftmargin=20 bottommargin=0 rightmargin=20 marginwidth=20 marginheight=0> <!-- Second part of the secret behind Doxy logo always having the word "Doxy" with the color of the day. --> <style> a.doxy_logo:hover { background-color: #287003 } </style> <table width=100% cellpadding=0 cellspacing=0 border=0> <!-- Top horizontal line with the color of the day. --> <tr valign=top> <td colspan=3 bgcolor=#287003 height=3></td> </tr> <!-- Header row with the links at the right. --> <tr valign=top> <td colspan=3 align=right> <font size=-1> Generated on: <font color=#287003><b>Thu Mar 29 07:46:58 PDT 2012</b></font> for <b>custom file set</b> </font> </td> </tr> <!-- Header row with the logo and the search form. --> <tr valign=top> <!-- Logo. --> <td align=left width=150> <table width=150 height=54 cellpadding=0 cellspacing=0 border=0> <tr valign=top> <!-- First part of the secret behind Doxy logo always having the word "Doxy" with the color of the day. --> <td bgcolor=#287003> <a class="doxy_logo" href="../../../index.html"><img src="../../../doxy_logo.png" alt="Doxy" border=0></a> </td> </tr> </table> </td> </tr> <!-- Tiny vertical space below the form. --> <tr valign=top> <td colspan=3 height=3></td> </tr> </table> <!-- Header navigation row. --> <div class="memproto"> <table width=100% cellpadding=0 cellspacing=0 border=0> <tr> <td align=left style="padding-left: 20px"><font size=+1><b><tt><font color=#333333>// <a href="../../../index.html"><font color=#287003>doxy</font></a>/</font> <a href="../../../or-tools/index.html">or-tools</a>/ <a href="../../../or-tools/examples/index.html">examples</a>/ <a href="../../../or-tools/examples/cpp/index.html">cpp</a>/ </tt></b></font> </td> </tr> </table> </div> <br /> <!-- No subdirs found. --> <!-- End of header. --> <!-- Generated by Doxygen 1.5.6 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main&nbsp;Page</span></a></li> <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li> <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li> <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="<API key>.html">operations_research</a>::<a class="el" href="<API key>.html">DobbleFilter</a> </div> </div> <div class="contents"> <h1>operations_research::DobbleFilter Class Reference</h1><!-- doxytag: class="operations_research::DobbleFilter" --><!-- doxytag: inherits="<API key>" -->Local Search Filter. <a href="#_details">More...</a> <p> <div class="dynheader"> Inheritance diagram for operations_research::DobbleFilter:</div> <div class="dynsection"> <p><center><img src="<API key>.png" usemap="#operations_research::DobbleFilter_map" border="0" alt=""></center> <map name="operations_research::DobbleFilter_map"> <area href="<API key>.html" alt="<API key>" shape="rect" coords="0,0,204,24"> </map> </div> <p> <a href="<API key>.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> <tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">DobbleFilter</a> (const IntVar *const *card_symbol_vars, int num_vars, int num_cards, int num_symbols, int <API key>)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">OnSynchronize</a> ()</td></tr> <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">We build the current bitmap and the matrix of violation cost between any two cards. <a href="#<API key>"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">Accept</a> (const Assignment *delta, const Assignment *unused_deltadelta)</td></tr> <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The LocalSearchFilter::Accept() API also takes a deltadelta, which is the difference between the current delta and the last delta that was given to <a class="el" href="<API key>.html#<API key>" title="The LocalSearchFilter::Accept() API also takes a deltadelta, which is the difference...">Accept()</a> -- but we don't use it here. <a href="#<API key>"></a><br></td></tr> <tr><td colspan="2"><br><h2>Classes</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><b>UndoChange</b></td></tr> <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Undo information after an evaluation. <br></td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> Local Search Filter. <p> A filter is responsible for rejecting a local search move faster than what the propagation of the constraint solver would do. Its API consists in:<ul> <li>The constructor, which takes as input a reference to all the variables relevant to the filter.</li><li><a class="el" href="<API key>.html#<API key>" title="We build the current bitmap and the matrix of violation cost between any two cards...">OnSynchronize()</a>, called at the beginning of the search and after each move to a new solution (when the local search restarts from it).</li><li><a class="el" href="<API key>.html#<API key>" title="The LocalSearchFilter::Accept() API also takes a deltadelta, which is the difference...">Accept()</a>, which takes as input an attempted move (in the form of a Delta to tentatively apply to the variables), and returns true iff this move is found valid.</li></ul> <p> To decide if a move is valid, first this <a class="el" href="<API key>.html" title="Local Search Filter.">DobbleFilter</a> builds a bitmap of symbols per card. Then for each move, it updates the bitmap according to the move and checks the following constraints:<ul> <li>First, each card still has <API key> symbols. - The cost of the assignment described by the move is better than the current one. After the check is done, the original bitmap is restored if the move was rejected, so as to be ready for the next evaluation.</li></ul> <p> Please note that this filter uses a fixed size bitset and effectively limits the number of cards to 63, and thus the number of symbols per card to 8. <p>Definition at line <a class="el" href="<API key>.html#l00455">455</a> of file <a class="el" href="<API key>.html">dobble_ls.cc</a>.</p> <hr><h2>Constructor &amp; Destructor Documentation</h2> <a class="anchor" name="<API key>"></a><!-- doxytag: member="operations_research::DobbleFilter::DobbleFilter" ref="<API key>" args="(const IntVar *const *card_symbol_vars, int num_vars, int num_cards, int num_symbols, int <API key>)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">operations_research::DobbleFilter::DobbleFilter </td> <td>(</td> <td class="paramtype">const IntVar *const *&nbsp;</td> <td class="paramname"> <em>card_symbol_vars</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&nbsp;</td> <td class="paramname"> <em>num_vars</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&nbsp;</td> <td class="paramname"> <em>num_cards</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&nbsp;</td> <td class="paramname"> <em>num_symbols</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&nbsp;</td> <td class="paramname"> <em><API key></em></td><td>&nbsp;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p> <p>Definition at line <a class="el" href="<API key>.html#l00457">457</a> of file <a class="el" href="<API key>.html">dobble_ls.cc</a>.</p> </div> </div><p> <hr><h2>Member Function Documentation</h2> <a class="anchor" name="<API key>"></a><!-- doxytag: member="operations_research::DobbleFilter::OnSynchronize" ref="<API key>" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual void operations_research::DobbleFilter::OnSynchronize </td> <td>(</td> <td class="paramname"> </td> <td>&nbsp;)&nbsp;</td> <td><code> [inline, virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> We build the current bitmap and the matrix of violation cost between any two cards. <p> <p>Definition at line <a class="el" href="<API key>.html#l00472">472</a> of file <a class="el" href="<API key>.html">dobble_ls.cc</a>.</p> </div> </div><p> <a class="anchor" name="<API key>"></a><!-- doxytag: member="operations_research::DobbleFilter::Accept" ref="<API key>" args="(const Assignment *delta, const Assignment *unused_deltadelta)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual bool operations_research::DobbleFilter::Accept </td> <td>(</td> <td class="paramtype">const Assignment *&nbsp;</td> <td class="paramname"> <em>delta</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Assignment *&nbsp;</td> <td class="paramname"> <em>unused_deltadelta</em></td><td>&nbsp;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [inline, virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> The LocalSearchFilter::Accept() API also takes a deltadelta, which is the difference between the current delta and the last delta that was given to <a class="el" href="<API key>.html#<API key>" title="The LocalSearchFilter::Accept() API also takes a deltadelta, which is the difference...">Accept()</a> -- but we don't use it here. <p> <p>Definition at line <a class="el" href="<API key>.html#l00494">494</a> of file <a class="el" href="<API key>.html">dobble_ls.cc</a>.</p> </div> </div><p> <hr>The documentation for this class was generated from the following file:<ul> <li>or-tools/examples/cpp/<a class="el" href="<API key>.html">dobble_ls.cc</a></ul> </div> <!-- Start of footer. --> <table width=100% cellpadding=0 cellspacing=0 border=0> <tr valign=top> <td colspan=2 height=10></td> </tr> <tr valign=top> <td colspan=2 bgcolor=#287003 height=3></td> </tr> </table> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /> </body> </html>
require "formula" class Sshrc < Formula homepage "https://github.com/Russell91/sshrc" url "https://github.com/Russell91/sshrc/archive/0.4.tar.gz" sha1 "<SHA1-like>" def install bin.install "sshrc" end test do ENV["HOME"] = testpath touch testpath/".sshrc" (testpath/"ssh").write <<-EOS.undent #!/bin/sh true EOS chmod 0755, testpath/"ssh" ENV.prepend_path "PATH", testpath system "sshrc" end end
<!doctype html> <html> <head> <meta charset="utf-8"> <title>Mocha Tests</title> <link rel="stylesheet" href="node_modules/mocha/mocha.css" /> </head> <body> <! To run tests cd .../noVNC/tests npm install chai mocha open keyboard-tests.html in a browser <div id="mocha"></div> <script src="node_modules/chai/chai.js"></script> <script src="node_modules/mocha/mocha.js"></script> <script>mocha.setup('bdd')</script> <script src="../include/keysymdef.js"></script> <script src="../include/keyboard.js"></script> <script src="test.keyboard.js"></script> <script src="test.helper.js"></script> <script> mocha.checkLeaks(); mocha.globals(['navigator']); mocha.run(); </script> </body> </html>
#begin zh-cn // :support@sharesdk.cn // :ShareSDK 24 // QQ:4006852216 #end #begin en // Support E-mail:support@sharesdk.cn // WeChat ID:ShareSDK If publish a new version, we will be push the updates content of version to you. If you have any questions about the ShareSDK, you can get in touch through the WeChat with us, we will respond within 24 hours // Business QQ:4006852216 #end #import <Foundation/Foundation.h> #import <ShareSDKCoreService/ShareSDKCoreService.h> #import "SSQZoneUser.h" #import "SSQZoneErrorInfo.h" #import "SSQZoneShareInfo.h" #import <ShareSDK/ShareSDKPlugin.h> #begin zh-cn /** * @brief */ #end #begin en /** * @brief Request method */ #end typedef enum { <API key> = 0, /**< GET */ <API key> = 1, /**< POST */ <API key> = 2 /**< Multipart POSTapi */ } <API key>; #begin zh-cn /** * @brief QQ */ #end #begin en /** * @brief QZone App. */ #end @protocol ISSQZoneApp <ISSPlatformApp> #begin zh-cn /** * @brief Key * * @return Key */ #end #begin en /** * @brief Get app key. * * @return App key. */ #end - (NSString *)appKey; #begin zh-cn /** * @brief ID * * @return ID */ #end #begin en /** * @brief Get app id. * * @return App id. */ #end - (NSString *)appId; #begin zh-cn /** * @brief SSO * * @return SSO */ #end #begin en /** * @brief Get SSO callback URL address. * * @return SSO callback url address. */ #end - (NSString *)ssoCallbackUrl; #begin zh-cn /** * @brief API * * @param path * @param method * @param params * @param user ,nil * @param result * @param fault */ #end #begin en /** * @brief Call API * * @param path API path string. * @param method Request method. * @param params Request parameters. * @param user Authorized users, it means that if the incoming nil default authorized users * @param result Result handler. * @param fault Fault handler. */ #end - (void)api:(NSString *)path method:(<API key>)method params:(id<ISSCParameters>)params user:(id<ISSPlatformUser>)user result:(void(^)(id responder))result fault:(void(^)(CMErrorInfo *error))fault; #begin zh-cn /** * @brief * * @param pic * @param desc * @param title * @param albumid IDnil */ #end #begin en /** * @brief Upload picture. * * @param pic Picture attachment object. * @param desc Description. * @param title Title string. * @param albumid Album IDThe default is nil indicates album */ #end - (void)uploadPic:(id<ISSCAttachment>)pic desc:(NSString *)desc title:(NSString *)title albumid:(NSString *)albumid result:(void(^)(BOOL result, id image, CMErrorInfo *error))result; #begin zh-cn /** * @brief * * @param title 36 * @param url * @param site * @param fromUrl url * @param comment 40 * @param summary 80 * @param images * @param type 45type=5playurl * @param playUrl 256type=5swf * @param nswb 1 * @param result */ #end #begin en #end - (void)addShareWithTitle:(NSString *)title url:(NSString *)url site:(NSString *)site fromUrl:(NSString *)fromUrl comment:(NSString *)comment summary:(NSString *)summary images:(NSArray *)images type:(NSNumber *)type playUrl:(NSString *)playUrl nswb:(NSNumber *)nswb result:(SSShareResultEvent)result; #begin zh-cn #end #begin en #end - (void)sendStoryWithTitle:(NSString *)title description:(NSString *)description shareUrl:(NSString *)shareUrl pics:(NSArray *)pics summary:(NSString *)summary url:(NSString *)url act:(NSString *)act result:(SSShareResultEvent)result; @end
<?php class Title_Checks implements themecheck { protected $error = array(); function check( $php_files, $css_files, $other_files ) { $ret = true; $php = implode( ' ', $php_files ); // Look for add_theme_support( 'title-tag' ) first $titletag = true; if ( ! preg_match( '#add_theme_support\s?\(\s?[\'|"]title-tag#', $php ) ) { $this->error[] = '<span class="tc-lead tc-recommended">'.__('RECOMMENDED','theme-check').'</span>: '.__('No reference to <strong>add_theme_support( "title-tag" )</strong> was found in the theme. It is recommended that the theme implement this functionality for WordPress 4.1 and above.', 'theme-check' ); $titletag = false; } /** * Look for <title> and </title> tags. */ checkcount(); if ( ( false === strpos( $php, '<title>' ) || false === strpos( $php, '</title>' ) ) && !$titletag ) { $this->error[] = '<span class="tc-lead tc-required">' . __( 'REQUIRED', 'theme-check').'</span>: ' . __( 'The theme needs to have <strong>&lt;title&gt;</strong> tags, ideally in the <strong>header.php</strong> file.', 'theme-check' ); $ret = false; } /** * Check whether there is a call to wp_title(). */ checkcount(); if ( false === strpos( $php, 'wp_title(' ) && !$titletag ) { $this->error[] = '<span class="tc-lead tc-required">' . __( 'REQUIRED', 'theme-check').'</span>: ' . __( 'The theme needs to have a call to <strong>wp_title()</strong>, ideally in the <strong>header.php</strong> file.', 'theme-check' ); $ret = false; } /** * Check whether the the <title> tag contains something besides a call to wp_title(). */ checkcount(); foreach ( $php_files as $file_path => $file_content ) { /** * First looks ahead to see of there's <title>...</title> * Then performs a negative look ahead for <title><?php wp_title(...); ?></title> */ if ( preg_match( '/(?=<title>(.*)<\/title>)(?!<title>\s*<\?php\s*wp_title\([^\)]*\);\s*\?>\s*<\/title>)/s', $file_content ) ) { $this->error[] = '<span class="tc-lead tc-required">' . __( 'REQUIRED', 'theme-check').'</span>: ' . __( 'The <strong>&lt;title&gt;</strong> tags can only contain a call to <strong>wp_title()</strong>. Use the <strong>wp_title filter</strong> to modify the output', 'theme-check' ); $ret = false; } } return $ret; } function getError() { return $this->error; } } $themechecks[] = new Title_Checks;
package test.rowset; import com.sun.rowset.RowSetFactoryImpl; import java.io.File; import java.net.URL; import java.net.URLClassLoader; import java.sql.SQLException; import javax.sql.rowset.RowSetFactory; import javax.sql.rowset.RowSetProvider; import static org.testng.Assert.*; import org.testng.annotations.AfterClass; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import util.BaseTest; import util.StubRowSetFactory; public class RowSetProviderTests extends BaseTest { // Default RowSetFactory Implementation private final String <API key> = "com.sun.rowset.RowSetFactoryImpl"; // Stub RowSetFactory Implementation private final String <API key> = "util.StubRowSetFactory"; // Indicator that the factory implementation does not need to be checked private final String NO_VALADATE_IMPL = ""; // Original System property value for javax.sql.rowset.RowSetFactory private static String origFactoryProperty; // Original ClassLoader private static ClassLoader cl; // Path to the location of the jar files used by the ServiceLoader API private static String jarPath; /* * Save off the original property value for javax.sql.rowset.RowSetFactory, * original classloader and define the path to the jars directory */ @BeforeClass public static void setUpClass() throws Exception { origFactoryProperty = System.getProperty("javax.sql.rowset.RowSetFactory"); cl = Thread.currentThread().<API key>(); jarPath = System.getProperty("test.src", ".") + File.separatorChar + "jars" + File.separatorChar; } /* * Install the original javax.sql.rowset.RowSetFactory property value */ @AfterClass public static void tearDownClass() throws Exception { if (origFactoryProperty != null) { System.setProperty("javax.sql.rowset.RowSetFactory", origFactoryProperty); } } /* * Clear the javax.sql.rowset.RowSetFactory property value and * reset the classloader to its original value */ @AfterMethod public void tearDownMethod() throws Exception { System.clearProperty("javax.sql.rowset.RowSetFactory"); Thread.currentThread().<API key>(cl); } /* * Validate that the correct RowSetFactory is returned by newFactory(). */ @Test(dataProvider = "RowSetFactoryValues") public void test(RowSetFactory rsf, String impl) throws SQLException { validateProvider(rsf, impl); } /* * Validate that the default RowSetFactory is returned by newFactory() * when specified by the javax.sql.rowset.RowSetFactory property. */ @Test public void test01() throws SQLException { System.setProperty("javax.sql.rowset.RowSetFactory", <API key>); validateProvider(RowSetProvider.newFactory(), <API key>); } /* * Validate that the correct RowSetFactory is returned by newFactory() * when specified by the javax.sql.rowset.RowSetFactory property. */ @Test(enabled = true) public void test02() throws SQLException { System.setProperty("javax.sql.rowset.RowSetFactory", <API key>); validateProvider(RowSetProvider.newFactory(), <API key>); } /* * Validate that a SQLException is thrown by newFactory() * when specified RowSetFactory specified by the * javax.sql.rowset.RowSetFactory property is not valid. */ @Test(expectedExceptions = SQLException.class) public void test03() throws SQLException { System.setProperty("javax.sql.rowset.RowSetFactory", "invalid.RowSetFactoryImpl"); RowSetFactory rsf = RowSetProvider.newFactory(); } /* * Validate that the correct RowSetFactory is returned by newFactory() * when specified by the ServiceLoader API. */ @Test public void test04() throws Exception { File f = new File(jarPath + "goodFactory"); URLClassLoader loader = new URLClassLoader(new URL[]{ new URL(f.toURI().toString())}, getClass().getClassLoader()); Thread.currentThread().<API key>(loader); validateProvider(RowSetProvider.newFactory(), <API key>); } /* * Validate that a SQLException is thrown by newFactory() if the default * RowSetFactory specified by the ServiceLoader API is not valid */ @Test(expectedExceptions = SQLException.class) public void test05() throws Exception { File f = new File(jarPath + "badFactory"); URLClassLoader loader = new URLClassLoader(new URL[]{ new URL(f.toURI().toString())}, getClass().getClassLoader()); Thread.currentThread().<API key>(loader); RowSetProvider.newFactory(); } /* * Utility Method to validate that the RowsetFactory returned from * RowSetProvider.newFactory() is correct */ private void validateProvider(RowSetFactory rsf, String implName) { assertNotNull(rsf, "RowSetFactory should not be null"); switch (implName) { case <API key>: assertTrue(rsf instanceof RowSetFactoryImpl); break; case <API key>: assertTrue(rsf instanceof StubRowSetFactory); break; default: } } /* * DataProvider used to provide a RowSetFactory and the expected * RowSetFactory implementation that should be returned */ @DataProvider(name = "RowSetFactoryValues") private Object[][] RowSetFactoryValues() throws SQLException { RowSetFactory rsf = RowSetProvider.newFactory(); RowSetFactory rsf1 = RowSetProvider.newFactory(<API key>, null); RowSetFactory rsf2 = RowSetProvider.newFactory(<API key>, null); return new Object[][]{ {rsf, NO_VALADATE_IMPL}, {rsf, <API key>}, {rsf1, <API key>}, {rsf2, <API key>} }; } }
package command import ( "bytes" "fmt" ) // VersionCommand is a Command implementation prints the version. type VersionCommand struct { Meta Revision string Version string VersionPrerelease string CheckFunc VersionCheckFunc } // VersionCheckFunc is the callback called by the Version command to // check if there is a new version of Otto. type VersionCheckFunc func() (VersionCheckInfo, error) // VersionCheckInfo is the return value for the VersionCheckFunc callback // and tells the Version command information about the latest version // of Otto. type VersionCheckInfo struct { Outdated bool Latest string Alerts []string } func (c *VersionCommand) Help() string { return "" } func (c *VersionCommand) Run(args []string) int { var versionString bytes.Buffer fmt.Fprintf(&versionString, "Otto v%s", c.Version) if c.VersionPrerelease != "" { fmt.Fprintf(&versionString, "-%s", c.VersionPrerelease) if c.Revision != "" { fmt.Fprintf(&versionString, " (%s)", c.Revision) } } c.Ui.Output(versionString.String()) // If we have a version check function, then let's check for // the latest version as well. if c.CheckFunc != nil { // Separate the prior output with a newline c.Ui.Output("") // Check the latest version info, err := c.CheckFunc() if err != nil { c.Ui.Error(fmt.Sprintf( "Error checking latest version: %s", err)) } if info.Outdated { c.Ui.Output(fmt.Sprintf( "Your version of Otto is out of date! The latest version\n"+ "is %s. You can update by downloading from www.ottoproject.io", info.Latest)) } } return 0 } func (c *VersionCommand) Synopsis() string { return "Prints the Otto version" }
package org.andengine.entity.modifier; import org.andengine.entity.IEntity; import org.andengine.util.modifier.<API key>; import org.andengine.util.modifier.ease.IEaseFunction; public abstract class <API key> extends <API key><IEntity> implements IEntityModifier { // Constants // Fields // Constructors public <API key>(final float pDuration, final float pFromValue, final float pToValue) { super(pDuration, pFromValue, pToValue); } public <API key>(final float pDuration, final float pFromValue, final float pToValue, final IEaseFunction pEaseFunction) { super(pDuration, pFromValue, pToValue, pEaseFunction); } public <API key>(final float pDuration, final float pFromValue, final float pToValue, final <API key> <API key>) { super(pDuration, pFromValue, pToValue, <API key>); } public <API key>(final float pDuration, final float pFromValue, final float pToValue, final <API key> <API key>, final IEaseFunction pEaseFunction) { super(pDuration, pFromValue, pToValue, <API key>, pEaseFunction); } protected <API key>(final <API key> <API key>) { super(<API key>); } // Getter & Setter // Methods for/from SuperClass/Interfaces // Methods // Inner and Anonymous Classes }
package org.andengine.util.level; import java.util.HashMap; import org.andengine.entity.IEntity; import org.andengine.util.adt.list.SmartList; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class LevelParser extends DefaultHandler { // Constants // Fields private final IEntityLoader <API key>; private final HashMap<String, IEntityLoader> mEntityLoaders; private SmartList<IEntity> mParentEntityStack = new SmartList<IEntity>(); // Constructors public LevelParser(final IEntityLoader <API key>, final HashMap<String, IEntityLoader> pEntityLoaders) { this.<API key> = <API key>; this.mEntityLoaders = pEntityLoaders; } // Getter & Setter // Methods for/from SuperClass/Interfaces @Override public void startElement(final String pUri, final String pLocalName, final String pQualifiedName, final Attributes pAttributes) throws SAXException { final String entityName = pLocalName; final IEntity parent = (this.mParentEntityStack.isEmpty()) ? null : this.mParentEntityStack.getLast(); final IEntityLoader entityLoader = this.mEntityLoaders.get(entityName); final IEntity entity; if(entityLoader != null) { entity = entityLoader.onLoadEntity(entityName, pAttributes); } else if(this.<API key> != null) { entity = this.<API key>.onLoadEntity(entityName, pAttributes); } else { throw new <API key>("Unexpected tag: '" + entityName + "'."); } if(parent != null && entity != null) { parent.attachChild(entity); } this.mParentEntityStack.addLast(entity); } @Override public void endElement(final String pUri, final String pLocalName, final String pQualifiedName) throws SAXException { this.mParentEntityStack.removeLast(); } // Methods // Inner and Anonymous Classes }
tinyMCE.addI18n({ko:{ common:{ edit_confirm:"WYSIWYG\uBAA8\uB4DC\uB85C \uC804\uD658\uD569\uB2C8\uAE4C?", apply:"\uC801\uC6A9", insert:"\uC0BD\uC785", update:"\uAC31\uC2E0", cancel:"\uCDE8\uC18C", close:"\uB2EB\uAE30", browse:"\uBE0C\uB77C\uC6B0\uC988", class_name:"\uD074\uB798\uC2A4", not_set:"-- \uC5C6\uC74C --", clipboard_msg:"\uBCF5\uC0AC/\uC798\uB77C\uB0B4\uAE30/\uBD99\uC774\uAE30\uB294 Mozilla \uBC0FFirefox \uC5D0\uC11C \uC0AC\uC6A9\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n\uC0C1\uC138\uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uAE4C?", <API key>:"\uC774 \uAE30\uB2A5\uC740 \uBE0C\uB77C\uC6B0\uC800\uC5D0 \uC758\uD574 \uC81C\uD55C\uB418\uACE0 \uC788\uC2B5\uB2C8\uB2E4. \uB2E8\uCD95\uD0A4\uC744 \uC774\uC6A9\uD558\uC2ED\uC2DC\uC624.", popup_blocked:"\uD31D\uC5C5\uC774 \uCC28\uB2E8\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uBAA8\uB4E0 \uAE30\uB2A5\uC744 \uC774\uC6A9\uD558\uC2DC\uAE30 \uC704\uD574\uC11C\uB294 \uD31D\uC5C5\uCC28\uB2E8\uC744 \uD574\uC81C\uD574 \uC8FC\uC138\uC694.", invalid_data:"\uC5D0\uB7EC: \uC720\uD6A8\uD558\uC9C0 \uC54A\uB294 \uAE00\uC790\uAC00 \uC788\uC2B5\uB2C8\uB2E4. \uBE68\uAC04\uC0C9\uC73C\uB85C \uD45C\uC2DC\uB429\uB2C8\uB2E4.", more_colors:"\uADF8 \uC678\uC758 \uC0C9" }, contextmenu:{ align:"\uC815\uB82C", left:"\uC67C\uCABD \uC815\uB82C", center:"\uAC00\uC6B4\uB370 \uC815\uB82C", right:"\uC624\uB978\uCABD \uC815\uB82C", full:"\uBC30\uBD84 \uC815\uB82C" }, insertdatetime:{ date_fmt:"%Y-%m-%d", time_fmt:"%H:%M:%S", insertdate_desc:"\uB0A0\uC9DC \uC0BD\uC785", inserttime_desc:"\uC2DC\uAC04 \uC0BD\uC785", months_long:"1\uC6D4,2\uC6D4,3\uC6D4,4\uC6D4,5\uC6D4,6\uC6D4,7\uC6D4,8\uC6D4,9\uC6D4,10\uC6D4,11\uC6D4,12\uC6D4", months_short:"1,2,3,4,5,6,7,8,9,10,11,12", day_long:"\uC77C\uC694\uC77C,\uC6D4\uC694\uC77C,\uD654\uC694\uC77C,\uC218\uC694\uC77C,\uBAA9\uC694\uC77C,\uAE08\uC694\uC77C,\uD1A0\uC694\uC77C,\uC77C\uC694\uC77C", day_short:"\uC77C,\uC6D4,\uD654,\uC218,\uBAA9,\uAE08,\uD1A0,\uC77C" }, print:{ print_desc:"\uC778\uC1C4" }, preview:{ preview_desc:"\uBBF8\uB9AC\uBCF4\uAE30" }, directionality:{ ltr_desc:"\uBB38\uC790\uBC29\uD5A5\uC744 \uC67C\uCABD\uC5D0\uC11C \uC624\uB978\uCABD\uC73C\uB85C", rtl_desc:"\uBB38\uC790\uBC29\uD5A5\uC744 \uC624\uB978\uCABD\uC5D0\uC11C \uC67C\uCABD\uC73C\uB85C" }, layer:{ insertlayer_desc:"\uC0C8 \uB808\uC774\uC5B4", forward_desc:"\uC55E\uC73C\uB85C \uC774\uB3D9", backward_desc:"\uB4A4\uB85C \uC774\uB3D9", absolute_desc:"\uC808\uB300\uC704\uCE58\uB85C \uC804\uD658", content:"\uC0C8 \uB808\uC774\uC5B4..." }, save:{ save_desc:"\uC800\uC7A5", cancel_desc:"\uBAA8\uB450 \uCDE8\uC18C" }, nonbreaking:{ nonbreaking_desc:"\uBE48\uCE78 \uC0BD\uC785" }, iespell:{ iespell_desc:"\uCCA0\uC790 \uAC80\uC0AC", download:"ieSpell\uC774 \uBC1C\uACAC\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.\n\uC778\uC2A4\uD1A8 \uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?" }, advhr:{ advhr_desc:"\uAD6C\uBD84\uC120" }, emotions:{ emotions_desc:"\uC774\uBAA8\uD2F0\uCF58" }, searchreplace:{ search_desc:"\uAC80\uC0C9", replace_desc:"\uAC80\uC0C9/\uCE58\uD658" }, advimage:{ image_desc:"\uC774\uBBF8\uC9C0\uC758 \uC0BD\uC785/\uD3B8\uC9D1" }, advlink:{ link_desc:"\uB9C1\uD06C\uC758 \uC0BD\uC785/\uD3B8\uC9D1" }, xhtmlxtras:{ cite_desc:"\uC778\uC6A9\uCC98", abbr_desc:"\uC57D\uAE30", acronym_desc:"\uBA38\uB9AC \uAE00\uC790\uC5B4", del_desc:"\uC0AD\uC81C", ins_desc:"\uC0BD\uC785", attribs_desc:"\uC18D\uC131 \uC0BD\uC785/\uD3B8\uC9D1" }, style:{ desc:"CSS\uD3B8\uC9D1" }, paste:{ paste_text_desc:"\uD14D\uC2A4\uD2B8\uCC98\uB7FC \uBD99\uC5EC\uB123\uAE30", paste_word_desc:"Word\uB85C\uBD80\uD130 \uBD99\uC5EC\uB123\uAE30", selectall_desc:"\uBAA8\uB450 \uC120\uD0DD" }, paste_dlg:{ text_title:"\uC708\uB3C4\uC6B0\uC5D0 \uD14D\uC2A4\uD2B8\uB97C \uBD99\uC774\uB824\uBA74 \uD0A4\uBCF4\uB4DC\uB85C Ctrl+V\uB97C \uC785\uB825\uD574 \uC8FC\uC138\uC694.", text_linebreaks:"\uAC1C\uD589\uC744 \uBCF4\uAD00 \uC720\uC9C0", word_title:"\uC708\uB3C4\uC6B0\uC5D0 \uD14D\uC2A4\uD2B8\uB97C \uBD99\uC774\uB824\uBA74 \uD0A4\uBCF4\uB4DC\uB85CCtrl+V\uB97C \uC785\uB825\uD574 \uC8FC\uC138\uC694." }, table:{ desc:"\uC0C8 \uD14C\uC774\uBE14 \uC0BD\uC785", row_before_desc:"\uC55E\uC5D0 \uD589 \uC0BD\uC785", row_after_desc:"\uB4A4\uC5D0 \uD589 \uC0BD\uC785", delete_row_desc:"\uD589 \uC0AD\uC81C", col_before_desc:"\uC55E\uC5D0 \uC5F4\uC0BD\uC785", col_after_desc:"\uB4A4\uC5D0 \uC5F4\uC0BD\uC785", delete_col_desc:"\uC5F4\uC0AD\uC81C", split_cells_desc:"\uACB0\uD569\uB41C \uC140\uC744 \uBD84\uD560", merge_cells_desc:"\uC140\uC744 \uACB0\uD569", row_desc:"\uD589\uC758 \uC18D\uC131", cell_desc:"\uC140\uC758 \uC18D\uC131", props_desc:"\uD14C\uC774\uBE14 \uC18D\uC131", <API key>:"\uC55E\uC5D0 \uD589\uC744 \uBD99\uC5EC\uB123\uAE30", <API key>:"\uB4A4\uB85C \uD589\uC744 \uBD99\uC5EC\uB123\uAE30", cut_row_desc:"\uD589\uC744 \uC798\uB77C\uB0B4\uAE30", copy_row_desc:"\uD589\uC744 \uBCF5\uC0AC", del:"\uD14C\uC774\uBE14 \uC0AD\uC81C", row:"\uD589", col:"\uC5F4", cell:"\uC140" }, autosave:{ unload_msg:"\uB2E4\uB978 \uD398\uC774\uC9C0\uB85C \uC774\uB3D9\uD558\uBA74 \uD3B8\uC9D1\uD55C \uB0B4\uC6A9\uC774 \uCDE8\uC18C\uB429\uB2C8\uB2E4." }, fullscreen:{ desc:"\uC804\uCCB4\uD654\uBA74" }, media:{ desc:"\uBBF8\uB514\uC5B4\uC758 \uC0BD\uC785/\uD3B8\uC9D1", edit:"\uBBF8\uB514\uC5B4\uC758 \uD3B8\uC9D1" }, fullpage:{ desc:"\uD398\uC774\uC9C0\uC758 \uC18D\uC131" }, template:{ desc:"\uC815\uC758\uAC00 \uB05D\uB09C \uD15C\uD50C\uB9BF\uC758 \uC0BD\uC785" }, visualchars:{ desc:"\uC81C\uC5B4 \uBB38\uC790\uC758 \uD45C\uC2DC \uC804\uD658" }, spellchecker:{ desc:"\uC2A4\uD3A0\uB9C1 \uC804\uD658", menu:"\uC2A4\uD3A0\uB9C1 \uC124\uC815", ignore_word:"\uC774 \uC5B4\uAD6C\uB97C \uBB34\uC2DC", ignore_words:"\uBAA8\uB450 \uBB34\uC2DC", langs:"\uC5B8\uC5B4", wait:"\uAE30\uB2E4\uB824 \uC8FC\uC138\uC694...", sug:"\uD6C4\uBCF4", no_sug:"\uD6C4\uBCF4 \uC5C6\uC74C", no_mpell:"\uC624\uD0C8\uC790\uAC00 \uBC1C\uACAC\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4." }, pagebreak:{ desc:"\uC0C8\uD398\uC774\uC9C0 \uC0BD\uC785" }}});
<?php namespace Zend\Cache\Storage\Plugin; use Zend\Cache\Storage\<API key>; use Zend\Cache\Storage\PostEvent; use Zend\EventManager\<API key>; class OptimizeByFactor extends AbstractPlugin { /** * {@inheritDoc} */ public function attach(<API key> $events, $priority = 1) { $callback = [$this, 'optimizeByFactor']; $this->listeners[] = $events->attach('removeItem.post', $callback, $priority); $this->listeners[] = $events->attach('removeItems.post', $callback, $priority); } /** * Optimize by factor on a success _RESULT_ * * @param PostEvent $event * @return void */ public function optimizeByFactor(PostEvent $event) { $storage = $event->getStorage(); if (!($storage instanceof <API key>)) { return; } $factor = $this->getOptions()->getOptimizingFactor(); if ($factor && mt_rand(1, $factor) == 1) { $storage->optimize(); } } }
# modification, are permitted provided that the following conditions # are met: # documentation and/or other materials provided with the distribution. # * Neither the names of Kitware, Inc., the Insight Software Consortium, # nor the names of their contributors may be used to endorse or promote # products derived from this software without specific prior written # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Runs compiler with "-dumpversion" and parses major/minor # version with a regex. FUNCTION(<API key> _OUTPUT_VERSION) EXEC_PROGRAM(${CMAKE_C_COMPILER} ARGS ${<API key>} -dumpversion OUTPUT_VARIABLE _COMPILER_VERSION ) STRING(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" _COMPILER_VERSION ${_COMPILER_VERSION}) SET(${_OUTPUT_VERSION} ${_COMPILER_VERSION} PARENT_SCOPE) ENDFUNCTION() # End functions/macros
#ifndef <API key> #define <API key> // PURPOSE: This simple module just deals with attaching a debugger to the // running program. #include "pub_core_basics.h" // ThreadId extern void VG_(start_debugger) ( ThreadId tid ); #endif // <API key>
#include <stdio.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <assert.h> #include <stdlib.h> #include <sys/wait.h> #include <sys/resource.h> #include <linux/bpf.h> #include "bpf_sys.h" #include "bpf_util.h" static int map_flags; static void test_hashmap(int task, void *data) { long long key, next_key, value; int fd; fd = bpf_map_create(BPF_MAP_TYPE_HASH, sizeof(key), sizeof(value), 2, map_flags); if (fd < 0) { printf("Failed to create hashmap '%s'!\n", strerror(errno)); exit(1); } key = 1; value = 1234; /* Insert key=1 element. */ assert(bpf_map_update(fd, &key, &value, BPF_ANY) == 0); value = 0; /* BPF_NOEXIST means add new element if it doesn't exist. */ assert(bpf_map_update(fd, &key, &value, BPF_NOEXIST) == -1 && /* key=1 already exists. */ errno == EEXIST); /* -1 is an invalid flag. */ assert(bpf_map_update(fd, &key, &value, -1) == -1 && errno == EINVAL); /* Check that key=1 can be found. */ assert(bpf_map_lookup(fd, &key, &value) == 0 && value == 1234); key = 2; /* Check that key=2 is not found. */ assert(bpf_map_lookup(fd, &key, &value) == -1 && errno == ENOENT); /* BPF_EXIST means update existing element. */ assert(bpf_map_update(fd, &key, &value, BPF_EXIST) == -1 && /* key=2 is not there. */ errno == ENOENT); /* Insert key=2 element. */ assert(bpf_map_update(fd, &key, &value, BPF_NOEXIST) == 0); /* key=1 and key=2 were inserted, check that key=0 cannot be * inserted due to max_entries limit. */ key = 0; assert(bpf_map_update(fd, &key, &value, BPF_NOEXIST) == -1 && errno == E2BIG); /* Update existing element, though the map is full. */ key = 1; assert(bpf_map_update(fd, &key, &value, BPF_EXIST) == 0); key = 2; assert(bpf_map_update(fd, &key, &value, BPF_ANY) == 0); key = 1; assert(bpf_map_update(fd, &key, &value, BPF_ANY) == 0); /* Check that key = 0 doesn't exist. */ key = 0; assert(bpf_map_delete(fd, &key) == -1 && errno == ENOENT); /* Iterate over two elements. */ assert(bpf_map_next_key(fd, &key, &next_key) == 0 && (next_key == 1 || next_key == 2)); assert(bpf_map_next_key(fd, &next_key, &next_key) == 0 && (next_key == 1 || next_key == 2)); assert(bpf_map_next_key(fd, &next_key, &next_key) == -1 && errno == ENOENT); /* Delete both elements. */ key = 1; assert(bpf_map_delete(fd, &key) == 0); key = 2; assert(bpf_map_delete(fd, &key) == 0); assert(bpf_map_delete(fd, &key) == -1 && errno == ENOENT); key = 0; /* Check that map is empty. */ assert(bpf_map_next_key(fd, &key, &next_key) == -1 && errno == ENOENT); close(fd); } static void test_hashmap_percpu(int task, void *data) { unsigned int nr_cpus = <API key>(); long long value[nr_cpus]; long long key, next_key; int expected_key_mask = 0; int fd, i; fd = bpf_map_create(<API key>, sizeof(key), sizeof(value[0]), 2, map_flags); if (fd < 0) { printf("Failed to create hashmap '%s'!\n", strerror(errno)); exit(1); } for (i = 0; i < nr_cpus; i++) value[i] = i + 100; key = 1; /* Insert key=1 element. */ assert(!(expected_key_mask & key)); assert(bpf_map_update(fd, &key, value, BPF_ANY) == 0); expected_key_mask |= key; /* BPF_NOEXIST means add new element if it doesn't exist. */ assert(bpf_map_update(fd, &key, value, BPF_NOEXIST) == -1 && /* key=1 already exists. */ errno == EEXIST); /* -1 is an invalid flag. */ assert(bpf_map_update(fd, &key, value, -1) == -1 && errno == EINVAL); /* Check that key=1 can be found. Value could be 0 if the lookup * was run from a different CPU. */ value[0] = 1; assert(bpf_map_lookup(fd, &key, value) == 0 && value[0] == 100); key = 2; /* Check that key=2 is not found. */ assert(bpf_map_lookup(fd, &key, value) == -1 && errno == ENOENT); /* BPF_EXIST means update existing element. */ assert(bpf_map_update(fd, &key, value, BPF_EXIST) == -1 && /* key=2 is not there. */ errno == ENOENT); /* Insert key=2 element. */ assert(!(expected_key_mask & key)); assert(bpf_map_update(fd, &key, value, BPF_NOEXIST) == 0); expected_key_mask |= key; /* key=1 and key=2 were inserted, check that key=0 cannot be * inserted due to max_entries limit. */ key = 0; assert(bpf_map_update(fd, &key, value, BPF_NOEXIST) == -1 && errno == E2BIG); /* Check that key = 0 doesn't exist. */ assert(bpf_map_delete(fd, &key) == -1 && errno == ENOENT); /* Iterate over two elements. */ while (!bpf_map_next_key(fd, &key, &next_key)) { assert((expected_key_mask & next_key) == next_key); expected_key_mask &= ~next_key; assert(bpf_map_lookup(fd, &next_key, value) == 0); for (i = 0; i < nr_cpus; i++) assert(value[i] == i + 100); key = next_key; } assert(errno == ENOENT); /* Update with BPF_EXIST. */ key = 1; assert(bpf_map_update(fd, &key, value, BPF_EXIST) == 0); /* Delete both elements. */ key = 1; assert(bpf_map_delete(fd, &key) == 0); key = 2; assert(bpf_map_delete(fd, &key) == 0); assert(bpf_map_delete(fd, &key) == -1 && errno == ENOENT); key = 0; /* Check that map is empty. */ assert(bpf_map_next_key(fd, &key, &next_key) == -1 && errno == ENOENT); close(fd); } static void test_arraymap(int task, void *data) { int key, next_key, fd; long long value; fd = bpf_map_create(BPF_MAP_TYPE_ARRAY, sizeof(key), sizeof(value), 2, 0); if (fd < 0) { printf("Failed to create arraymap '%s'!\n", strerror(errno)); exit(1); } key = 1; value = 1234; /* Insert key=1 element. */ assert(bpf_map_update(fd, &key, &value, BPF_ANY) == 0); value = 0; assert(bpf_map_update(fd, &key, &value, BPF_NOEXIST) == -1 && errno == EEXIST); /* Check that key=1 can be found. */ assert(bpf_map_lookup(fd, &key, &value) == 0 && value == 1234); key = 0; /* Check that key=0 is also found and zero initialized. */ assert(bpf_map_lookup(fd, &key, &value) == 0 && value == 0); /* key=0 and key=1 were inserted, check that key=2 cannot be inserted * due to max_entries limit. */ key = 2; assert(bpf_map_update(fd, &key, &value, BPF_EXIST) == -1 && errno == E2BIG); /* Check that key = 2 doesn't exist. */ assert(bpf_map_lookup(fd, &key, &value) == -1 && errno == ENOENT); /* Iterate over two elements. */ assert(bpf_map_next_key(fd, &key, &next_key) == 0 && next_key == 0); assert(bpf_map_next_key(fd, &next_key, &next_key) == 0 && next_key == 1); assert(bpf_map_next_key(fd, &next_key, &next_key) == -1 && errno == ENOENT); /* Delete shouldn't succeed. */ key = 1; assert(bpf_map_delete(fd, &key) == -1 && errno == EINVAL); close(fd); } static void <API key>(int task, void *data) { unsigned int nr_cpus = <API key>(); int key, next_key, fd, i; long values[nr_cpus]; fd = bpf_map_create(<API key>, sizeof(key), sizeof(values[0]), 2, 0); if (fd < 0) { printf("Failed to create arraymap '%s'!\n", strerror(errno)); exit(1); } for (i = 0; i < nr_cpus; i++) values[i] = i + 100; key = 1; /* Insert key=1 element. */ assert(bpf_map_update(fd, &key, values, BPF_ANY) == 0); values[0] = 0; assert(bpf_map_update(fd, &key, values, BPF_NOEXIST) == -1 && errno == EEXIST); /* Check that key=1 can be found. */ assert(bpf_map_lookup(fd, &key, values) == 0 && values[0] == 100); key = 0; /* Check that key=0 is also found and zero initialized. */ assert(bpf_map_lookup(fd, &key, values) == 0 && values[0] == 0 && values[nr_cpus - 1] == 0); /* Check that key=2 cannot be inserted due to max_entries limit. */ key = 2; assert(bpf_map_update(fd, &key, values, BPF_EXIST) == -1 && errno == E2BIG); /* Check that key = 2 doesn't exist. */ assert(bpf_map_lookup(fd, &key, values) == -1 && errno == ENOENT); /* Iterate over two elements. */ assert(bpf_map_next_key(fd, &key, &next_key) == 0 && next_key == 0); assert(bpf_map_next_key(fd, &next_key, &next_key) == 0 && next_key == 1); assert(bpf_map_next_key(fd, &next_key, &next_key) == -1 && errno == ENOENT); /* Delete shouldn't succeed. */ key = 1; assert(bpf_map_delete(fd, &key) == -1 && errno == EINVAL); close(fd); } static void <API key>(void) { unsigned int nr_cpus = <API key>(); unsigned int nr_keys = 20000; long values[nr_cpus]; int key, fd, i; fd = bpf_map_create(<API key>, sizeof(key), sizeof(values[0]), nr_keys, 0); if (fd < 0) { printf("Failed to create per-cpu arraymap '%s'!\n", strerror(errno)); exit(1); } for (i = 0; i < nr_cpus; i++) values[i] = i + 10; for (key = 0; key < nr_keys; key++) assert(bpf_map_update(fd, &key, values, BPF_ANY) == 0); for (key = 0; key < nr_keys; key++) { for (i = 0; i < nr_cpus; i++) values[i] = 0; assert(bpf_map_lookup(fd, &key, values) == 0); for (i = 0; i < nr_cpus; i++) assert(values[i] == i + 10); } close(fd); } #define MAP_SIZE (32 * 1024) static void test_map_large(void) { struct bigkey { int a; char b[116]; long long c; } key; int fd, i, value; fd = bpf_map_create(BPF_MAP_TYPE_HASH, sizeof(key), sizeof(value), MAP_SIZE, map_flags); if (fd < 0) { printf("Failed to create large map '%s'!\n", strerror(errno)); exit(1); } for (i = 0; i < MAP_SIZE; i++) { key = (struct bigkey) { .c = i }; value = i; assert(bpf_map_update(fd, &key, &value, BPF_NOEXIST) == 0); } key.c = -1; assert(bpf_map_update(fd, &key, &value, BPF_NOEXIST) == -1 && errno == E2BIG); /* Iterate through all elements. */ for (i = 0; i < MAP_SIZE; i++) assert(bpf_map_next_key(fd, &key, &key) == 0); assert(bpf_map_next_key(fd, &key, &key) == -1 && errno == ENOENT); key.c = 0; assert(bpf_map_lookup(fd, &key, &value) == 0 && value == 0); key.a = 1; assert(bpf_map_lookup(fd, &key, &value) == -1 && errno == ENOENT); close(fd); } static void run_parallel(int tasks, void (*fn)(int task, void *data), void *data) { pid_t pid[tasks]; int i; for (i = 0; i < tasks; i++) { pid[i] = fork(); if (pid[i] == 0) { fn(i, data); exit(0); } else if (pid[i] == -1) { printf("Couldn't spawn #%d process!\n", i); exit(1); } } for (i = 0; i < tasks; i++) { int status; assert(waitpid(pid[i], &status, 0) == pid[i]); assert(status == 0); } } static void test_map_stress(void) { run_parallel(100, test_hashmap, NULL); run_parallel(100, test_hashmap_percpu, NULL); run_parallel(100, test_arraymap, NULL); run_parallel(100, <API key>, NULL); } #define TASKS 1024 #define DO_UPDATE 1 #define DO_DELETE 0 static void do_work(int fn, void *data) { int do_update = ((int *)data)[1]; int fd = ((int *)data)[0]; int i, key, value; for (i = fn; i < MAP_SIZE; i += TASKS) { key = value = i; if (do_update) { assert(bpf_map_update(fd, &key, &value, BPF_NOEXIST) == 0); assert(bpf_map_update(fd, &key, &value, BPF_EXIST) == 0); } else { assert(bpf_map_delete(fd, &key) == 0); } } } static void test_map_parallel(void) { int i, fd, key = 0, value = 0; int data[2]; fd = bpf_map_create(BPF_MAP_TYPE_HASH, sizeof(key), sizeof(value), MAP_SIZE, map_flags); if (fd < 0) { printf("Failed to create map for parallel test '%s'!\n", strerror(errno)); exit(1); } /* Use the same fd in children to add elements to this map: * child_0 adds key=0, key=1024, key=2048, ... * child_1 adds key=1, key=1025, key=2049, ... * child_1023 adds key=1023, ... */ data[0] = fd; data[1] = DO_UPDATE; run_parallel(TASKS, do_work, data); /* Check that key=0 is already there. */ assert(bpf_map_update(fd, &key, &value, BPF_NOEXIST) == -1 && errno == EEXIST); /* Check that all elements were inserted. */ key = -1; for (i = 0; i < MAP_SIZE; i++) assert(bpf_map_next_key(fd, &key, &key) == 0); assert(bpf_map_next_key(fd, &key, &key) == -1 && errno == ENOENT); /* Another check for all elements */ for (i = 0; i < MAP_SIZE; i++) { key = MAP_SIZE - i - 1; assert(bpf_map_lookup(fd, &key, &value) == 0 && value == key); } /* Now let's delete all elemenets in parallel. */ data[1] = DO_DELETE; run_parallel(TASKS, do_work, data); /* Nothing should be left. */ key = -1; assert(bpf_map_next_key(fd, &key, &key) == -1 && errno == ENOENT); } static void run_all_tests(void) { test_hashmap(0, NULL); test_hashmap_percpu(0, NULL); test_arraymap(0, NULL); <API key>(0, NULL); <API key>(); test_map_large(); test_map_parallel(); test_map_stress(); } int main(void) { struct rlimit rinf = { RLIM_INFINITY, RLIM_INFINITY }; setrlimit(RLIMIT_MEMLOCK, &rinf); map_flags = 0; run_all_tests(); map_flags = BPF_F_NO_PREALLOC; run_all_tests(); printf("test_maps: OK\n"); return 0; }
#ifndef __NET_CFG80211_H #define __NET_CFG80211_H #include <linux/netdevice.h> #include <linux/debugfs.h> #include <linux/list.h> #include <linux/netlink.h> #include <linux/skbuff.h> #include <linux/nl80211.h> #include <linux/if_ether.h> #include <linux/ieee80211.h> #include <net/regulatory.h> /** * DOC: Introduction * * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges * userspace and drivers, and offers some utility functionality associated * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used * by all modern wireless drivers in Linux, so that they offer a consistent * API through nl80211. For backward compatibility, cfg80211 also offers * wireless extensions to userspace, but hides them from drivers completely. * * Additionally, cfg80211 contains code to help enforce regulatory spectrum * use restrictions. */ /** * DOC: Device registration * * In order for a driver to use cfg80211, it must register the hardware device * with cfg80211. This happens through a number of hardware capability structs * described below. * * The fundamental structure for each device is the 'wiphy', of which each * instance describes a physical wireless device connected to the system. Each * such wiphy can have zero, one, or many virtual interfaces associated with * it, which need to be identified as such by pointing the network interface's * @ieee80211_ptr pointer to a &struct wireless_dev which further describes * the wireless part of the interface, normally this struct is embedded in the * network interface's private data area. Drivers can optionally allow creating * or destroying virtual interfaces on the fly, but without at least one or the * ability to create some the wireless device isn't useful. * * Each wiphy structure contains device capability information, and also has * a pointer to the various operations the driver offers. The definitions and * structures here describe these capabilities in detail. */ /* * wireless hardware capability structures */ /** * enum ieee80211_band - supported frequency bands * * The bands are assigned this way because the supported * bitrates differ in these bands. * * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) * @IEEE80211_NUM_BANDS: number of defined bands */ enum ieee80211_band { IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ, IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ, /* keep last */ IEEE80211_NUM_BANDS }; /** * enum <API key> - channel flags * * Channel flags set by the regulatory control code. * * @<API key>: This channel is disabled. * @<API key>: Only passive scanning is permitted * on this channel. * @<API key>: IBSS is not allowed on this channel. * @<API key>: Radar detection is required on this channel. * @<API key>: extension channel above this channel * is not permitted. * @<API key>: extension channel below this channel * is not permitted. */ enum <API key> { <API key> = 1<<0, <API key> = 1<<1, <API key> = 1<<2, <API key> = 1<<3, <API key> = 1<<4, <API key> = 1<<5, }; #define <API key> \ (<API key> | <API key>) /** * struct ieee80211_channel - channel definition * * This structure describes a single channel for use * with cfg80211. * * @center_freq: center frequency in MHz * @hw_value: hardware-specific value for the channel * @flags: channel flags from &enum <API key>. * @orig_flags: channel flags at registration time, used by regulatory * code to support devices with additional restrictions * @band: band this channel belongs to. * @max_antenna_gain: maximum antenna gain in dBi * @max_power: maximum transmission power (in dBm) * @beacon_found: helper to regulatory code to indicate when a beacon * has been found on this channel. Use <API key>() * to enable this, this is useful only on 5 GHz band. * @orig_mag: internal use * @orig_mpwr: internal use */ struct ieee80211_channel { enum ieee80211_band band; u16 center_freq; u16 hw_value; u32 flags; int max_antenna_gain; int max_power; bool beacon_found; u32 orig_flags; int orig_mag, orig_mpwr; }; /** * enum <API key> - rate flags * * Hardware/specification flags for rates. These are structured * in a way that allows using the same bitrate structure for * different bands/PHY modes. * * @<API key>: Hardware can send with short * preamble on this bitrate; only relevant in 2.4GHz band and * with CCK rates. * @<API key>: This bitrate is a mandatory rate * when used with 802.11a (on the 5 GHz band); filled by the * core code when registering the wiphy. * @<API key>: This bitrate is a mandatory rate * when used with 802.11b (on the 2.4 GHz band); filled by the * core code when registering the wiphy. * @<API key>: This bitrate is a mandatory rate * when used with 802.11g (on the 2.4 GHz band); filled by the * core code when registering the wiphy. * @<API key>: This is an ERP rate in 802.11g mode. */ enum <API key> { <API key> = 1<<0, <API key> = 1<<1, <API key> = 1<<2, <API key> = 1<<3, <API key> = 1<<4, }; /** * struct ieee80211_rate - bitrate definition * * This structure describes a bitrate that an 802.11 PHY can * operate with. The two values @hw_value and @hw_value_short * are only for driver use when pointers to this structure are * passed around. * * @flags: rate-specific flags * @bitrate: bitrate in units of 100 Kbps * @hw_value: driver/hardware value for this rate * @hw_value_short: driver/hardware value for this rate when * short preamble is used */ struct ieee80211_rate { u32 flags; u16 bitrate; u16 hw_value, hw_value_short; }; /** * struct <API key> - STA's HT capabilities * * This structure describes most essential parameters needed * to describe 802.11n HT capabilities for an STA. * * @ht_supported: is HT supported by the STA * @cap: HT capabilities map as described in 802.11n spec * @ampdu_factor: Maximum A-MPDU length factor * @ampdu_density: Minimum A-MPDU spacing * @mcs: Supported MCS rates */ struct <API key> { u16 cap; /* use IEEE80211_HT_CAP_ */ bool ht_supported; u8 ampdu_factor; u8 ampdu_density; struct ieee80211_mcs_info mcs; }; /** * struct <API key> - frequency band definition * * This structure describes a frequency band a wiphy * is able to operate in. * * @channels: Array of channels the hardware can operate in * in this band. * @band: the band this structure represents * @n_channels: Number of channels in @channels * @bitrates: Array of bitrates the hardware can operate with * in this band. Must be sorted to give a valid "supported * rates" IE, i.e. CCK rates first, then OFDM. * @n_bitrates: Number of bitrates in @bitrates * @ht_cap: HT capabilities in this band */ struct <API key> { struct ieee80211_channel *channels; struct ieee80211_rate *bitrates; enum ieee80211_band band; int n_channels; int n_bitrates; struct <API key> ht_cap; }; /* * Wireless hardware/device configuration structures and methods */ /** * DOC: Actions and configuration * * Each wireless device and each virtual interface offer a set of configuration * operations and other actions that are invoked by userspace. Each of these * actions is described in the operations structure, and the parameters these * operations use are described separately. * * Additionally, some operations are asynchronous and expect to get status * information via some functions that drivers need to call. * * Scanning and BSS list handling with its associated functionality is described * in a separate chapter. */ /** * struct vif_params - describes virtual interface parameters * @use_4addr: use 4-address frames */ struct vif_params { int use_4addr; }; /** * struct key_params - key information * * Information about a key * * @key: key material * @key_len: length of key material * @cipher: cipher suite selector * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used * with the get_key() callback, must be in little endian, * length given by @seq_len. * @seq_len: length of @seq. */ struct key_params { u8 *key; u8 *seq; int key_len; int seq_len; u32 cipher; }; /** * enum survey_info_flags - survey information flags * * @<API key>: noise (in dBm) was filled in * @SURVEY_INFO_IN_USE: channel is currently being used * @<API key>: channel active time (in ms) was filled in * @<API key>: channel busy time was filled in * @<API key>: extension channel busy time was filled in * @<API key>: channel receive time was filled in * @<API key>: channel transmit time was filled in * * Used by the driver to indicate which info in &struct survey_info * it has filled in during the get_survey(). */ enum survey_info_flags { <API key> = 1<<0, SURVEY_INFO_IN_USE = 1<<1, <API key> = 1<<2, <API key> = 1<<3, <API key> = 1<<4, <API key> = 1<<5, <API key> = 1<<6, }; /** * struct survey_info - channel survey response * * @channel: the channel this survey record reports, mandatory * @filled: bitflag of flags from &enum survey_info_flags * @noise: channel noise in dBm. This and all following fields are * optional * @channel_time: amount of time in ms the radio spent on the channel * @channel_time_busy: amount of time the primary channel was sensed busy * @<API key>: amount of time the extension channel was sensed busy * @channel_time_rx: amount of time the radio spent receiving data * @channel_time_tx: amount of time the radio spent transmitting data * * Used by dump_survey() to report back per-channel survey information. * * This structure can later be expanded with things like * channel duty cycle etc. */ struct survey_info { struct ieee80211_channel *channel; u64 channel_time; u64 channel_time_busy; u64 <API key>; u64 channel_time_rx; u64 channel_time_tx; u32 filled; s8 noise; }; /** * struct <API key> - Crypto settings * @wpa_versions: indicates which, if any, WPA versions are enabled * (from enum <API key>) * @cipher_group: group key cipher suite (or 0 if unset) * @n_ciphers_pairwise: number of AP supported unicast ciphers * @ciphers_pairwise: unicast key cipher suites * @n_akm_suites: number of AKM suites * @akm_suites: AKM suites * @control_port: Whether user space controls IEEE 802.1X port, i.e., * sets/clears %<API key>. If true, the driver is * required to assume that the port is unauthorized until authorized by * user space. Otherwise, port is marked authorized by default. * @<API key>: the control port protocol that should be * allowed through even on unauthorized ports * @<API key>: TRUE to prevent encryption of control port * protocol frames. */ struct <API key> { u32 wpa_versions; u32 cipher_group; int n_ciphers_pairwise; u32 ciphers_pairwise[<API key>]; int n_akm_suites; u32 akm_suites[<API key>]; bool control_port; __be16 <API key>; bool <API key>; }; /** * struct beacon_parameters - beacon parameters * * Used to configure the beacon for an interface. * * @head: head portion of beacon (before TIM IE) * or %NULL if not changed * @tail: tail portion of beacon (after TIM IE) * or %NULL if not changed * @interval: beacon interval or zero if not changed * @dtim_period: DTIM period or zero if not changed * @head_len: length of @head * @tail_len: length of @tail * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from * user space) * @ssid_len: length of @ssid * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames * @crypto: crypto settings * @privacy: the BSS uses privacy * @auth_type: Authentication type (algorithm) * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL * @beacon_ies_len: length of beacon_ies in octets * @proberesp_ies: extra information element(s) to add into Probe Response * frames or %NULL * @proberesp_ies_len: length of proberesp_ies in octets * @assocresp_ies: extra information element(s) to add into (Re)Association * Response frames or %NULL * @assocresp_ies_len: length of assocresp_ies in octets * @probe_resp_len: length of probe response template (@probe_resp) * @probe_resp: probe response template (AP mode only) */ struct beacon_parameters { u8 *head, *tail; int interval, dtim_period; int head_len, tail_len; const u8 *ssid; size_t ssid_len; enum nl80211_hidden_ssid hidden_ssid; struct <API key> crypto; bool privacy; enum nl80211_auth_type auth_type; const u8 *beacon_ies; size_t beacon_ies_len; const u8 *proberesp_ies; size_t proberesp_ies_len; const u8 *assocresp_ies; size_t assocresp_ies_len; int probe_resp_len; u8 *probe_resp; }; /** * enum plink_action - actions to perform in mesh peers * * @<API key>: action 0 is reserved * @PLINK_ACTION_OPEN: start mesh peer link establishment * @PLINK_ACTION_BLOCK: block traffic from this mesh peer */ enum plink_actions { <API key>, PLINK_ACTION_OPEN, PLINK_ACTION_BLOCK, }; /** * enum <API key> - station parameter values to apply * @<API key>: apply new uAPSD parameters (uapsd_queues, max_sp) * * Not all station parameters have in-band "no change" signalling, * for those that don't these flags will are used. */ enum <API key> { <API key> = BIT(0), }; /** * struct station_parameters - station parameters * * Used to change and create a new station. * * @vlan: vlan interface station should belong to * @supported_rates: supported rates in IEEE 802.11 format * (or NULL for no change) * @supported_rates_len: number of supported rates * @sta_flags_mask: station flags that changed * (bitmask of BIT(NL80211_STA_FLAG_...)) * @sta_flags_set: station flags values * (bitmask of BIT(NL80211_STA_FLAG_...)) * @listen_interval: listen interval or -1 for no change * @aid: AID or zero for no change * @plink_action: plink action to take * @plink_state: set the peer link state for a station * @ht_capa: HT capabilities of station * @uapsd_queues: bitmap of queues configured for uapsd. same format * as the AC bitmap in the QoS info field * @max_sp: max Service Period. same format as the MAX_SP in the * QoS info field (but already shifted down) * @sta_modify_mask: bitmap indicating which parameters changed * (for those that don't have a natural "no change" value), * see &enum <API key> */ struct station_parameters { u8 *supported_rates; struct net_device *vlan; u32 sta_flags_mask, sta_flags_set; u32 sta_modify_mask; int listen_interval; u16 aid; u8 supported_rates_len; u8 plink_action; u8 plink_state; struct ieee80211_ht_cap *ht_capa; u8 uapsd_queues; u8 max_sp; }; /** * enum station_info_flags - station information flags * * Used by the driver to indicate which info in &struct station_info * it has filled in during get_station() or dump_station(). * * @<API key>: @inactive_time filled * @<API key>: @rx_bytes filled * @<API key>: @tx_bytes filled * @STATION_INFO_LLID: @llid filled * @STATION_INFO_PLID: @plid filled * @<API key>: @plink_state filled * @STATION_INFO_SIGNAL: @signal filled * @<API key>: @txrate fields are filled * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) * @<API key>: @rx_packets filled * @<API key>: @tx_packets filled * @<API key>: @tx_retries filled * @<API key>: @tx_failed filled * @<API key>: @rx_dropped_misc filled * @<API key>: @signal_avg filled * @<API key>: @rxrate fields are filled * @<API key>: @bss_param filled * @<API key>: @connected_time filled * @<API key>: @assoc_req_ies filled * @<API key>: @sta_flags filled */ enum station_info_flags { <API key> = 1<<0, <API key> = 1<<1, <API key> = 1<<2, STATION_INFO_LLID = 1<<3, STATION_INFO_PLID = 1<<4, <API key> = 1<<5, STATION_INFO_SIGNAL = 1<<6, <API key> = 1<<7, <API key> = 1<<8, <API key> = 1<<9, <API key> = 1<<10, <API key> = 1<<11, <API key> = 1<<12, <API key> = 1<<13, <API key> = 1<<14, <API key> = 1<<15, <API key> = 1<<16, <API key> = 1<<17, <API key> = 1<<18 }; /** * enum <API key> - bitrate info flags * * Used by the driver to indicate the specific rate transmission * type for 802.11n transmissions. * * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled * @<API key>: 40 Mhz width transmission * @<API key>: 400ns guard interval */ enum rate_info_flags { RATE_INFO_FLAGS_MCS = 1<<0, <API key> = 1<<1, <API key> = 1<<2, }; /** * struct rate_info - bitrate information * * Information about a receiving or transmitting bitrate * * @flags: bitflag of flags from &enum rate_info_flags * @mcs: mcs index if struct describes a 802.11n bitrate * @legacy: bitrate in 100kbit/s for 802.11abg */ struct rate_info { u8 flags; u8 mcs; u16 legacy; }; /** * enum <API key> - bitrate info flags * * Used by the driver to indicate the specific rate transmission * type for 802.11n transmissions. * * @<API key>: whether CTS protection is enabled * @<API key>: whether short preamble is enabled * @<API key>: whether short slot time is enabled */ enum bss_param_flags { <API key> = 1<<0, <API key> = 1<<1, <API key> = 1<<2, }; /** * struct sta_bss_parameters - BSS parameters for the attached station * * Information about the currently associated BSS * * @flags: bitflag of flags from &enum bss_param_flags * @dtim_period: DTIM period for the BSS * @beacon_interval: beacon interval */ struct sta_bss_parameters { u8 flags; u8 dtim_period; u16 beacon_interval; }; /** * struct station_info - station information * * Station information filled by driver for get_station() and dump_station. * * @filled: bitflag of flags from &enum station_info_flags * @connected_time: time(in secs) since a station is last connected * @inactive_time: time since last station activity (tx/rx) in milliseconds * @rx_bytes: bytes received from this station * @tx_bytes: bytes transmitted to this station * @llid: mesh local link id * @plid: mesh peer link id * @plink_state: mesh peer link state * @signal: signal strength of last received packet in dBm * @signal_avg: signal strength average in dBm * @txrate: current unicast bitrate from this station * @rxrate: current unicast bitrate to this station * @rx_packets: packets received from this station * @tx_packets: packets transmitted to this station * @tx_retries: cumulative retry counts * @tx_failed: number of failed transmissions (retries exceeded, no ACK) * @rx_dropped_misc: Dropped for un-specified reason. * @bss_param: current BSS parameters * @generation: generation number for nl80211 dumps. * This number should increase every time the list of stations * changes, i.e. when a station is added or removed, so that * userspace can tell whether it got a consistent snapshot. * @assoc_req_ies: IEs from (Re)Association Request. * This is used only when in AP mode with drivers that do not use * user space MLME/SME implementation. The information is provided for * the cfg80211_new_sta() calls to notify user space of the IEs. * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. * @sta_flags: station flags mask & values */ struct station_info { u32 filled; u32 connected_time; u32 inactive_time; u32 rx_bytes; u32 tx_bytes; u16 llid; u16 plid; u8 plink_state; s8 signal; s8 signal_avg; struct rate_info txrate; struct rate_info rxrate; u32 rx_packets; u32 tx_packets; u32 tx_retries; u32 tx_failed; u32 rx_dropped_misc; struct sta_bss_parameters bss_param; struct <API key> sta_flags; int generation; const u8 *assoc_req_ies; size_t assoc_req_ies_len; /* * Note: Add a new enum station_info_flags value for each new field and * use it to check which fields are initialized. */ }; /** * enum monitor_flags - monitor flags * * Monitor interface configuration flags. Note that these must be the bits * according to the nl80211 flags. * * @<API key>: pass frames with bad FCS * @<API key>: pass frames with bad PLCP * @<API key>: pass control frames * @<API key>: disable BSSID filtering * @<API key>: report frames after processing */ enum monitor_flags { <API key> = 1<<<API key>, <API key> = 1<<<API key>, <API key> = 1<<<API key>, <API key> = 1<<<API key>, <API key> = 1<<<API key>, }; /** * enum mpath_info_flags - mesh path information flags * * Used by the driver to indicate which info in &struct mpath_info it has filled * in during get_station() or dump_station(). * * @<API key>: @frame_qlen filled * @MPATH_INFO_SN: @sn filled * @MPATH_INFO_METRIC: @metric filled * @MPATH_INFO_EXPTIME: @exptime filled * @<API key>: @discovery_timeout filled * @<API key>: @discovery_retries filled * @MPATH_INFO_FLAGS: @flags filled */ enum mpath_info_flags { <API key> = BIT(0), MPATH_INFO_SN = BIT(1), MPATH_INFO_METRIC = BIT(2), MPATH_INFO_EXPTIME = BIT(3), <API key> = BIT(4), <API key> = BIT(5), MPATH_INFO_FLAGS = BIT(6), }; /** * struct mpath_info - mesh path information * * Mesh path information filled by driver for get_mpath() and dump_mpath(). * * @filled: bitfield of flags from &enum mpath_info_flags * @frame_qlen: number of queued frames for this destination * @sn: target sequence number * @metric: metric (cost) of this mesh path * @exptime: expiration time for the mesh path from now, in msecs * @flags: mesh path flags * @discovery_timeout: total mesh path discovery timeout, in msecs * @discovery_retries: mesh path discovery retries * @generation: generation number for nl80211 dumps. * This number should increase every time the list of mesh paths * changes, i.e. when a station is added or removed, so that * userspace can tell whether it got a consistent snapshot. */ struct mpath_info { u32 filled; u32 frame_qlen; u32 sn; u32 metric; u32 exptime; u32 discovery_timeout; u8 discovery_retries; u8 flags; int generation; }; /** * struct bss_parameters - BSS parameters * * Used to change BSS parameters (mainly for AP mode). * * @use_cts_prot: Whether to use CTS protection * (0 = no, 1 = yes, -1 = do not change) * @use_short_preamble: Whether the use of short preambles is allowed * (0 = no, 1 = yes, -1 = do not change) * @use_short_slot_time: Whether the use of short slot time is allowed * (0 = no, 1 = yes, -1 = do not change) * @basic_rates: basic rates in IEEE 802.11 format * (or NULL for no change) * @basic_rates_len: number of basic rates * @ap_isolate: do not forward packets between connected stations * @ht_opmode: HT Operation mode * (u16 = opmode, -1 = do not change) */ struct bss_parameters { int use_cts_prot; int use_short_preamble; int use_short_slot_time; u8 *basic_rates; u8 basic_rates_len; int ap_isolate; int ht_opmode; }; /* * struct mesh_config - 802.11s mesh configuration * * These parameters can be changed while the mesh is active. */ struct mesh_config { /* Timeouts in ms */ /* Mesh plink management parameters */ u16 <API key>; u16 <API key>; u16 <API key>; u16 <API key>; u8 dot11MeshMaxRetries; u8 dot11MeshTTL; /* ttl used in path selection information elements */ u8 element_ttl; bool auto_open_plinks; /* HWMP parameters */ u8 <API key>; u32 path_refresh_time; u16 <API key>; u32 <API key>; u16 <API key>; u16 <API key>; u8 <API key>; u16 <API key>; /* This is missnamed in draft 12.0: <API key> * set to true only means that the station will announce others it's a * mesh gate, but not necessarily using the gate announcement protocol. * Still keeping the same nomenclature to be in sync with the spec. */ bool <API key>; }; /** * struct mesh_setup - 802.11s mesh setup configuration * @mesh_id: the mesh ID * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes * @path_sel_proto: which path selection protocol to use * @path_metric: which metric to use * @ie: vendor information elements (optional) * @ie_len: length of vendor information elements * @is_authenticated: this mesh requires authentication * @is_secure: this mesh uses security * * These parameters are fixed when the mesh is created. */ struct mesh_setup { const u8 *mesh_id; u8 mesh_id_len; u8 path_sel_proto; u8 path_metric; const u8 *ie; u8 ie_len; bool is_authenticated; bool is_secure; }; /** * struct <API key> - TX queue parameters * @queue: TX queue identifier (NL80211_TXQ_Q_*) * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range * 1..32767] * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range * 1..32767] * @aifs: Arbitration interframe space [0..255] */ struct <API key> { enum nl80211_txq_q queue; u16 txop; u16 cwmin; u16 cwmax; u8 aifs; }; /* from net/wireless.h */ struct wiphy; /** * DOC: Scanning and BSS list handling * * The scanning process itself is fairly simple, but cfg80211 offers quite * a bit of helper functionality. To start a scan, the scan operation will * be invoked with a scan definition. This scan definition contains the * channels to scan, and the SSIDs to send probe requests for (including the * wildcard, if desired). A passive scan is indicated by having no SSIDs to * probe. Additionally, a scan request may contain extra information elements * that should be added to the probe request. The IEs are guaranteed to be * well-formed, and will not exceed the maximum length the driver advertised * in the wiphy structure. * * When scanning finds a BSS, cfg80211 needs to be notified of that, because * it is responsible for maintaining the BSS list; the driver should not * maintain a list itself. For this notification, various functions exist. * * Since drivers do not maintain a BSS list, there are also a number of * functions to search for a BSS and obtain information about it from the * BSS structure cfg80211 maintains. The BSS list is also made available * to userspace. */ /** * struct cfg80211_ssid - SSID description * @ssid: the SSID * @ssid_len: length of the ssid */ struct cfg80211_ssid { u8 ssid[<API key>]; u8 ssid_len; }; /** * struct <API key> - scan request description * * @ssids: SSIDs to scan for (active scan only) * @n_ssids: number of SSIDs * @channels: channels to scan on. * @n_channels: total number of channels to scan * @ie: optional information element(s) to add into Probe Request or %NULL * @ie_len: length of ie in octets * @rates: bitmap of rates to advertise for each band * @wiphy: the wiphy this was for * @dev: the interface * @aborted: (internal) scan request was notified as aborted * @no_cck: used to send probe requests at non CCK rate in 2GHz band */ struct <API key> { struct cfg80211_ssid *ssids; int n_ssids; u32 n_channels; const u8 *ie; size_t ie_len; u32 rates[IEEE80211_NUM_BANDS]; /* internal */ struct wiphy *wiphy; struct net_device *dev; bool aborted; bool no_cck; /* keep last */ struct ieee80211_channel *channels[0]; }; /** * struct cfg80211_match_set - sets of attributes to match * * @ssid: SSID to be matched */ struct cfg80211_match_set { struct cfg80211_ssid ssid; }; /** * struct <API key> - scheduled scan request description * * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) * @n_ssids: number of SSIDs * @n_channels: total number of channels to scan * @interval: interval between each scheduled scan cycle * @ie: optional information element(s) to add into Probe Request or %NULL * @ie_len: length of ie in octets * @match_sets: sets of parameters to be matched for a scan result * entry to be considered valid and to be passed to the host * (others are filtered out). * If ommited, all results are passed. * @n_match_sets: number of match sets * @wiphy: the wiphy this was for * @dev: the interface * @channels: channels to scan */ struct <API key> { struct cfg80211_ssid *ssids; int n_ssids; u32 n_channels; u32 interval; const u8 *ie; size_t ie_len; struct cfg80211_match_set *match_sets; int n_match_sets; /* internal */ struct wiphy *wiphy; struct net_device *dev; /* keep last */ struct ieee80211_channel *channels[0]; }; /** * enum <API key> - signal type * * @<API key>: no signal strength information available * @<API key>: signal strength in mBm (100*dBm) * @<API key>: signal strength, increasing from 0 through 100 */ enum <API key> { <API key>, <API key>, <API key>, }; /** * struct cfg80211_bss - BSS description * * This structure describes a BSS (which may also be a mesh network) * for use in scan results and similar. * * @channel: channel this BSS is on * @bssid: BSSID of the BSS * @tsf: timestamp of last received update * @beacon_interval: the beacon interval as from the frame * @capability: the capability field in host byte order * @<API key>: the information elements (Note that there * is no guarantee that these are well-formed!); this is a pointer to * either the beacon_ies or proberesp_ies depending on whether Probe * Response frame has been received * @<API key>: total length of the information elements * @beacon_ies: the information elements from the last Beacon frame * @len_beacon_ies: total length of the beacon_ies * @proberesp_ies: the information elements from the last Probe Response frame * @len_proberesp_ies: total length of the proberesp_ies * @signal: signal strength value (type depends on the wiphy's signal_type) * @free_priv: function pointer to free private data * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes */ struct cfg80211_bss { struct ieee80211_channel *channel; u8 bssid[ETH_ALEN]; u64 tsf; u16 beacon_interval; u16 capability; u8 *<API key>; size_t <API key>; u8 *beacon_ies; size_t len_beacon_ies; u8 *proberesp_ies; size_t len_proberesp_ies; s32 signal; void (*free_priv)(struct cfg80211_bss *bss); u8 priv[0] __attribute__((__aligned__(sizeof(void *)))); }; /** * <API key> - find IE with given ID * @bss: the bss to search * @ie: the IE ID * Returns %NULL if not found. */ const u8 *<API key>(struct cfg80211_bss *bss, u8 ie); /** * struct <API key> - Authentication request data * * This structure provides information needed to complete IEEE 802.11 * authentication. * * @bss: The BSS to authenticate with. * @auth_type: Authentication type (algorithm) * @ie: Extra IEs to add to Authentication frame or %NULL * @ie_len: Length of ie buffer in octets * @key_len: length of WEP key for shared key authentication * @key_idx: index of WEP key for shared key authentication * @key: WEP key for shared key authentication * @local_state_change: This is a request for a local state only, i.e., no * Authentication frame is to be transmitted and authentication state is * to be changed without having to wait for a response from the peer STA * (AP). */ struct <API key> { struct cfg80211_bss *bss; const u8 *ie; size_t ie_len; enum nl80211_auth_type auth_type; const u8 *key; u8 key_len, key_idx; bool local_state_change; }; /** * struct <API key> - (Re)Association request data * * This structure provides information needed to complete IEEE 802.11 * (re)association. * @bss: The BSS to associate with. * @ie: Extra IEs to add to (Re)Association Request frame or %NULL * @ie_len: Length of ie buffer in octets * @use_mfp: Use management frame protection (IEEE 802.11w) in this association * @crypto: crypto settings * @prev_bssid: previous BSSID, if not %NULL use reassociate frame */ struct <API key> { struct cfg80211_bss *bss; const u8 *ie, *prev_bssid; size_t ie_len; struct <API key> crypto; bool use_mfp; }; /** * struct <API key> - Deauthentication request data * * This structure provides information needed to complete IEEE 802.11 * deauthentication. * * @bss: the BSS to deauthenticate from * @ie: Extra IEs to add to Deauthentication frame or %NULL * @ie_len: Length of ie buffer in octets * @reason_code: The reason code for the deauthentication * @local_state_change: This is a request for a local state only, i.e., no * Deauthentication frame is to be transmitted. */ struct <API key> { struct cfg80211_bss *bss; const u8 *ie; size_t ie_len; u16 reason_code; bool local_state_change; }; /** * struct <API key> - Disassociation request data * * This structure provides information needed to complete IEEE 802.11 * disassocation. * * @bss: the BSS to disassociate from * @ie: Extra IEs to add to Disassociation frame or %NULL * @ie_len: Length of ie buffer in octets * @reason_code: The reason code for the disassociation * @local_state_change: This is a request for a local state only, i.e., no * Disassociation frame is to be transmitted. */ struct <API key> { struct cfg80211_bss *bss; const u8 *ie; size_t ie_len; u16 reason_code; bool local_state_change; }; /** * struct <API key> - IBSS parameters * * This structure defines the IBSS parameters for the join_ibss() * method. * * @ssid: The SSID, will always be non-null. * @ssid_len: The length of the SSID, will always be non-zero. * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not * search for IBSSs with a different BSSID. * @channel: The channel to use if no IBSS can be found to join. * @channel_fixed: The channel should be fixed -- do not search for * IBSSs to join on other channels. * @ie: information element(s) to include in the beacon * @ie_len: length of that * @beacon_interval: beacon interval to use * @privacy: this is a protected network, keys will be configured * after joining * @basic_rates: bitmap of basic rates to use when creating the IBSS * @mcast_rate: per-band multicast rate index + 1 (0: disabled) */ struct <API key> { u8 *ssid; u8 *bssid; struct ieee80211_channel *channel; u8 *ie; u8 ssid_len, ie_len; u16 beacon_interval; u32 basic_rates; bool channel_fixed; bool privacy; int mcast_rate[IEEE80211_NUM_BANDS]; }; /** * struct <API key> - Connection parameters * * This structure provides information needed to complete IEEE 802.11 * authentication and association. * * @channel: The channel to use or %NULL if not specified (auto-select based * on scan results) * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan * results) * @ssid: SSID * @ssid_len: Length of ssid in octets * @auth_type: Authentication type (algorithm) * @ie: IEs for association request * @ie_len: Length of assoc_ie in octets * @privacy: indicates whether privacy-enabled APs should be used * @crypto: crypto settings * @key_len: length of WEP key for shared key authentication * @key_idx: index of WEP key for shared key authentication * @key: WEP key for shared key authentication */ struct <API key> { struct ieee80211_channel *channel; u8 *bssid; u8 *ssid; size_t ssid_len; enum nl80211_auth_type auth_type; u8 *ie; size_t ie_len; bool privacy; struct <API key> crypto; const u8 *key; u8 key_len, key_idx; }; /** * enum wiphy_params_flags - set_wiphy_params bitfield values * @<API key>: wiphy->retry_short has changed * @<API key>: wiphy->retry_long has changed * @<API key>: wiphy->frag_threshold has changed * @<API key>: wiphy->rts_threshold has changed * @<API key>: coverage class changed */ enum wiphy_params_flags { <API key> = 1 << 0, <API key> = 1 << 1, <API key> = 1 << 2, <API key> = 1 << 3, <API key> = 1 << 4, }; /* * <API key> - masks for bitrate control */ struct <API key> { struct { u32 legacy; /* TODO: add support for masking MCS rates; e.g.: */ /* u8 mcs[<API key>]; */ } control[IEEE80211_NUM_BANDS]; }; /** * struct cfg80211_pmksa - PMK Security Association * * This structure is passed to the set/del_pmksa() method for PMKSA * caching. * * @bssid: The AP's BSSID. * @pmkid: The PMK material itself. */ struct cfg80211_pmksa { u8 *bssid; u8 *pmkid; }; /** * struct <API key> - packet pattern * @mask: bitmask where to match pattern and where to ignore bytes, * one bit per byte, in same format as nl80211 * @pattern: bytes to match where bitmask is 1 * @pattern_len: length of pattern (in bytes) * * Internal note: @mask and @pattern are allocated in one chunk of * memory, free @mask only! */ struct <API key> { u8 *mask, *pattern; int pattern_len; }; /** * struct cfg80211_wowlan - Wake on Wireless-LAN support info * * This structure defines the enabled WoWLAN triggers for the device. * @any: wake up on any activity -- special trigger if device continues * operating as normal during suspend * @disconnect: wake up if getting disconnected * @magic_pkt: wake up on receiving magic packet * @patterns: wake up on receiving packet matching a pattern * @n_patterns: number of patterns * @gtk_rekey_failure: wake up on GTK rekey failure * @eap_identity_req: wake up on EAP identity request packet * @four_way_handshake: wake up on 4-way handshake * @rfkill_release: wake up when rfkill is released */ struct cfg80211_wowlan { bool any, disconnect, magic_pkt, gtk_rekey_failure, eap_identity_req, four_way_handshake, rfkill_release; struct <API key> *patterns; int n_patterns; }; /** * struct <API key> - rekey data * @kek: key encryption key * @kck: key confirmation key * @replay_ctr: replay counter */ struct <API key> { u8 kek[NL80211_KEK_LEN]; u8 kck[NL80211_KCK_LEN]; u8 replay_ctr[<API key>]; }; /** * struct cfg80211_ops - backend description for wireless configuration * * This struct is registered by fullmac card drivers and/or wireless stacks * in order to handle configuration requests on their interfaces. * * All callbacks except where otherwise noted should return 0 * on success or a negative error code. * * All operations are currently invoked under rtnl for consistency with the * wireless extensions but this is subject to reevaluation as soon as this * code is used more widely and we have a first user without wext. * * @suspend: wiphy device needs to be suspended. The variable @wow will * be %NULL or contain the enabled Wake-on-Wireless triggers that are * configured for the device. * @resume: wiphy device needs to be resumed * * @add_virtual_intf: create a new virtual interface with the given name, * must set the struct wireless_dev's iftype. Beware: You must create * the new netdev in the wiphy's network namespace! Returns the netdev, * or an ERR_PTR. * * @del_virtual_intf: remove the virtual interface determined by ifindex. * * @change_virtual_intf: change type/configuration of virtual interface, * keep the struct wireless_dev's iftype updated. * * @add_key: add a key with the given parameters. @mac_addr will be %NULL * when adding a group key. * * @get_key: get information about the key with the given parameters. * @mac_addr will be %NULL when requesting information for a group * key. All pointers given to the @callback function need not be valid * after it returns. This function should return an error if it is * not possible to retrieve the key, -ENOENT if it doesn't exist. * * @del_key: remove a key given the @mac_addr (%NULL for a group key) * and @key_index, return -ENOENT if the key doesn't exist. * * @set_default_key: set the default key on an interface * * @<API key>: set the default management frame key on an interface * * @set_rekey_data: give the data necessary for GTK rekeying to the driver * * @add_beacon: Add a beacon with given parameters, @head, @interval * and @dtim_period will be valid, @tail is optional. * @set_beacon: Change the beacon parameters for an access point mode * interface. This should reject the call when no beacon has been * configured. * @del_beacon: Remove beacon configuration and stop sending the beacon. * * @add_station: Add a new station. * @del_station: Remove a station; @mac may be NULL to remove all stations. * @change_station: Modify a given station. * @get_station: get station information for the station identified by @mac * @dump_station: dump station callback -- resume dump at index @idx * * @add_mpath: add a fixed mesh path * @del_mpath: delete a given mesh path * @change_mpath: change a given mesh path * @get_mpath: get a mesh path for the given parameters * @dump_mpath: dump mesh path callback -- resume dump at index @idx * @join_mesh: join the mesh network with the specified parameters * @leave_mesh: leave the current mesh network * * @get_mesh_config: Get the current mesh configuration * * @update_mesh_config: Update mesh parameters on a running mesh. * The mask is a bitfield which tells us which parameters to * set, and which to leave alone. * * @change_bss: Modify parameters for a given BSS. * * @set_txq_params: Set TX queue parameters * * @set_channel: Set channel for a given wireless interface. Some devices * may support multi-channel operation (by channel hopping) so cfg80211 * doesn't verify much. Note, however, that the passed netdev may be * %NULL as well if the user requested changing the channel for the * device itself, or for a monitor interface. * @get_channel: Get the current operating channel, should return %NULL if * there's no single defined operating channel if for example the * device implements channel hopping for multi-channel virtual interfaces. * * @scan: Request to do a scan. If returning zero, the scan request is given * the driver, and will be valid until passed to cfg80211_scan_done(). * For scan results, call cfg80211_inform_bss(); you can call this outside * the scan/scan_done bracket too. * * @auth: Request to authenticate with the specified peer * @assoc: Request to (re)associate with the specified peer * @deauth: Request to deauthenticate from the specified peer * @disassoc: Request to disassociate from the specified peer * * @connect: Connect to the ESS with the specified parameters. When connected, * call <API key>() with status code %WLAN_STATUS_SUCCESS. * If the connection fails for some reason, call <API key>() * with the status from the AP. * @disconnect: Disconnect from the BSS/ESS. * * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call * <API key>(), also call that function when changing BSSID due * to a merge. * @leave_ibss: Leave the IBSS. * * @set_wiphy_params: Notify that wiphy parameters have changed; * @changed bitfield (see &enum wiphy_params_flags) describes which values * have changed. The actual parameter values are available in * struct wiphy. If returning an error, no value should be changed. * * @set_tx_power: set the transmit power according to the parameters * @get_tx_power: store the current TX power into the dbm variable; * return 0 if successful * * @set_wds_peer: set the WDS peer for a WDS interface * * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting * functions to adjust rfkill hw state * * @dump_survey: get site survey information. * * @remain_on_channel: Request the driver to remain awake on the specified * channel for the specified duration to complete an off-channel * operation (e.g., public action frame exchange). When the driver is * ready on the requested channel, it must indicate this with an event * notification by calling <API key>(). * @<API key>: Cancel an on-going remain-on-channel operation. * This allows the operation to be terminated prior to timeout based on * the duration value. * @mgmt_tx: Transmit a management frame. * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management * frame on another channel * * @testmode_cmd: run a test mode command * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be * used by the function, but 0 and 1 must not be touched. Additionally, * return error codes other than -ENOBUFS and -ENOENT will terminate the * dump and return to userspace with an error, so be careful. If any data * was passed in from userspace then the data/len arguments will be present * and point to the data contained in %<API key>. * * @set_bitrate_mask: set the bitrate mask configuration * * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac * devices running firmwares capable of generating the (re) association * RSN IE. It allows for faster roaming between WPA2 BSSIDs. * @del_pmksa: Delete a cached PMKID. * @flush_pmksa: Flush all cached PMKIDs. * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 * allows the driver to adjust the dynamic ps timeout value. * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. * @sched_scan_start: Tell the driver to start a scheduled scan. * @sched_scan_stop: Tell the driver to stop an ongoing scheduled * scan. The driver_initiated flag specifies whether the driver * itself has informed that the scan has stopped. * * @mgmt_frame_register: Notify driver that a management frame type was * registered. Note that this callback may not sleep, and cannot run * concurrently with itself. * * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may * reject TX/RX mask combinations they cannot support by returning -EINVAL * (also see nl80211.h @<API key>). * * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). * * @set_ringparam: Set tx and rx ring sizes. * * @get_ringparam: Get tx and rx ring current and maximum sizes. * * @tdls_mgmt: Transmit a TDLS management frame. * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). * * @probe_client: probe an associated client, must return a cookie that it * later passes to <API key>(). * * @<API key>: Notify the Bluetooth inquiry status in * case of a Bleutooth co-ex device. * * @<API key>: Notify the Bluetooth SCO connection status in * case of a Bluetooth co-ex device. * * @<API key>: Notify the Bluetooth A2DP connection status in * case of a Bluetooth co-ex device. * * @<API key>: Notify the Bluetooth chip's ACL connction * information * * @<API key>: Notify the Bluetooth WiFi chip antenna * configuration * * @<API key>: Notify the Bluetooth chip vendor in case of using * different Bluetooth chip vendor */ struct cfg80211_ops { int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); int (*resume)(struct wiphy *wiphy); struct net_device * (*add_virtual_intf)(struct wiphy *wiphy, char *name, enum nl80211_iftype type, u32 *flags, struct vif_params *params); int (*del_virtual_intf)(struct wiphy *wiphy, struct net_device *dev); int (*change_virtual_intf)(struct wiphy *wiphy, struct net_device *dev, enum nl80211_iftype type, u32 *flags, struct vif_params *params); int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, bool pairwise, const u8 *mac_addr, struct key_params *params); int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, bool pairwise, const u8 *mac_addr, void *cookie, void (*callback)(void *cookie, struct key_params*)); int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, bool pairwise, const u8 *mac_addr); int (*set_default_key)(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, bool unicast, bool multicast); int (*<API key>)(struct wiphy *wiphy, struct net_device *netdev, u8 key_index); int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, struct beacon_parameters *info); int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev, struct beacon_parameters *info); int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev); int (*add_station)(struct wiphy *wiphy, struct net_device *dev, u8 *mac, struct station_parameters *params); int (*del_station)(struct wiphy *wiphy, struct net_device *dev, u8 *mac); int (*change_station)(struct wiphy *wiphy, struct net_device *dev, u8 *mac, struct station_parameters *params); int (*get_station)(struct wiphy *wiphy, struct net_device *dev, u8 *mac, struct station_info *sinfo); int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, int idx, u8 *mac, struct station_info *sinfo); int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, u8 *dst, u8 *next_hop); int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, u8 *dst); int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, u8 *dst, u8 *next_hop); int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, u8 *dst, u8 *next_hop, struct mpath_info *pinfo); int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, int idx, u8 *dst, u8 *next_hop, struct mpath_info *pinfo); int (*get_mesh_config)(struct wiphy *wiphy, struct net_device *dev, struct mesh_config *conf); int (*update_mesh_config)(struct wiphy *wiphy, struct net_device *dev, u32 mask, const struct mesh_config *nconf); int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, const struct mesh_config *conf, const struct mesh_setup *setup); int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, struct bss_parameters *params); int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev, struct <API key> *params); int (*set_channel)(struct wiphy *wiphy, struct net_device *dev, struct ieee80211_channel *chan, enum <API key> channel_type); int (*scan)(struct wiphy *wiphy, struct net_device *dev, struct <API key> *request); int (*auth)(struct wiphy *wiphy, struct net_device *dev, struct <API key> *req); int (*assoc)(struct wiphy *wiphy, struct net_device *dev, struct <API key> *req); int (*deauth)(struct wiphy *wiphy, struct net_device *dev, struct <API key> *req, void *cookie); int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, struct <API key> *req, void *cookie); int (*connect)(struct wiphy *wiphy, struct net_device *dev, struct <API key> *sme); int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, u16 reason_code); int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, struct <API key> *params); int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); int (*set_tx_power)(struct wiphy *wiphy, enum <API key> type, int mbm); int (*get_tx_power)(struct wiphy *wiphy, int *dbm); int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, const u8 *addr); void (*rfkill_poll)(struct wiphy *wiphy); #ifdef <API key> int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len); int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, struct netlink_callback *cb, void *data, int len); #endif int (*set_bitrate_mask)(struct wiphy *wiphy, struct net_device *dev, const u8 *peer, const struct <API key> *mask); int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, int idx, struct survey_info *info); int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, struct cfg80211_pmksa *pmksa); int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, struct cfg80211_pmksa *pmksa); int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); int (*remain_on_channel)(struct wiphy *wiphy, struct net_device *dev, struct ieee80211_channel *chan, enum <API key> channel_type, unsigned int duration, u64 *cookie); int (*<API key>)(struct wiphy *wiphy, struct net_device *dev, u64 cookie); int (*mgmt_tx)(struct wiphy *wiphy, struct net_device *dev, struct ieee80211_channel *chan, bool offchan, enum <API key> channel_type, bool channel_type_valid, unsigned int wait, const u8 *buf, size_t len, bool no_cck, bool dont_wait_for_ack, u64 *cookie); int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, struct net_device *dev, u64 cookie); int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, bool enabled, int timeout); int (*set_cqm_rssi_config)(struct wiphy *wiphy, struct net_device *dev, s32 rssi_thold, u32 rssi_hyst); void (*mgmt_frame_register)(struct wiphy *wiphy, struct net_device *dev, u16 frame_type, bool reg); int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); int (*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx); void (*get_ringparam)(struct wiphy *wiphy, u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); int (*sched_scan_start)(struct wiphy *wiphy, struct net_device *dev, struct <API key> *request); int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev); int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev, struct <API key> *data); int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, u8 *peer, u8 action_code, u8 dialog_token, u16 status_code, const u8 *buf, size_t len); int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, u8 *peer, enum <API key> oper); int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, const u8 *peer, u64 *cookie); struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy); int (*<API key>)(struct wiphy *wiphy, bool status); int (*<API key>)(struct wiphy *wiphy, bool status, bool esco, u32 tx_interval, u32 tx_pkt_len); int (*<API key>)(struct wiphy *wiphy, bool status); int (*<API key>)(struct wiphy *wiphy, enum <API key> role, u32 remote_lmp_ver); int (*<API key>)(struct wiphy *wiphy, enum <API key>); int (*<API key>)(struct wiphy *wiphy, enum <API key>); int (*notify_btcoex)(struct wiphy *wiphy, u8 *buf, int len); }; /* * wireless hardware and networking interfaces structures * and registration/helper functions */ /** * enum wiphy_flags - wiphy capability flags * * @<API key>: tells us the driver for this device * has its own custom regulatory domain and cannot identify the * ISO / IEC 3166 alpha2 it belongs to. When this is enabled * we will disregard the first regulatory hint (when the * initiator is %REGDOM_SET_BY_CORE). * @<API key>: tells us the driver for this device will * ignore regulatory domain settings until it gets its own regulatory * domain via its regulatory_hint() unless the regulatory hint is * from a country IE. After its gets its own regulatory domain it will * only allow further regulatory domain settings to further enhance * compliance. For example if channel 13 and 14 are disabled by this * regulatory domain no user regulatory domain can enable these channels * at a later time. This can be used for devices which do not have * calibration information guaranteed for frequencies or settings * outside of its regulatory domain. * @<API key>: enable this if your driver needs to ensure * that passive scan flags and beaconing flags may not be lifted by * cfg80211 due to regulatory beacon hints. For more information on beacon * hints read the documenation for <API key>() * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this * wiphy at all * @<API key>: Set this flag to enforce interface * combinations for this device. This flag is used for backward * compatibility only until all drivers advertise combinations and * they will always be enforced. * @<API key>: if set to true, powersave will be enabled * by default -- this flag will be set depending on the kernel's default * on wiphy_new(), but can be changed by the driver if it has a good * reason to override the default * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station * on a VLAN interface) * @<API key>: supports 4addr mode even as a station * @<API key>: This device supports setting the * control port protocol ethertype. The device also honours the * <API key> flag. * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. * @<API key>: The device supports mesh authentication by routing * auth frames to userspace. See @<API key>. * @<API key>: The device supports scheduled scans. * @<API key>: The device supports roaming feature in the * firmware. * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP. * @<API key>: The device supports TDLS (802.11z) operation. * @<API key>: The device does not handle TDLS (802.11z) * link setup/discovery operations internally. Setup, discovery and * teardown packets should be sent through the @<API key> * command. When this flag is not set, @<API key> should be * used for asking the driver/firmware to perform a TDLS operation. * @<API key>: device integrates AP SME * @<API key>: the device will report beacons from other BSSes * when there are virtual interfaces in AP mode by calling * <API key>(). * @<API key>: When operating as an AP, the device * responds to probe-requests in hardware. */ enum wiphy_flags { <API key> = BIT(0), <API key> = BIT(1), <API key> = BIT(2), WIPHY_FLAG_NETNS_OK = BIT(3), <API key> = BIT(4), WIPHY_FLAG_4ADDR_AP = BIT(5), <API key> = BIT(6), <API key> = BIT(7), WIPHY_FLAG_IBSS_RSN = BIT(8), <API key> = BIT(10), <API key> = BIT(11), <API key> = BIT(12), <API key> = BIT(13), WIPHY_FLAG_AP_UAPSD = BIT(14), <API key> = BIT(15), <API key> = BIT(16), <API key> = BIT(17), <API key> = BIT(18), <API key> = BIT(19), }; /** * struct <API key> - limit on certain interface types * @max: maximum number of interfaces of these types * @types: interface types (bits) */ struct <API key> { u16 max; u16 types; }; /** * struct <API key> - possible interface combination * @limits: limits for the given interface types * @n_limits: number of limitations * @<API key>: can use up to this many different channels * @max_interfaces: maximum number of interfaces in total allowed in this * group * @<API key>: In this combination, the beacon intervals * between infrastructure and AP types must match. This is required * only in special cases. * * These examples can be expressed as follows: * * Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: * * struct <API key> limits1[] = { * { .max = 1, .types = BIT(<API key>), }, * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, }, * }; * struct <API key> combination1 = { * .limits = limits1, * .n_limits = ARRAY_SIZE(limits1), * .max_interfaces = 2, * .<API key> = true, * }; * * * Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: * * struct <API key> limits2[] = { * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | * BIT(<API key>), }, * }; * struct <API key> combination2 = { * .limits = limits2, * .n_limits = ARRAY_SIZE(limits2), * .max_interfaces = 8, * .<API key> = 1, * }; * * * Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. * This allows for an infrastructure connection and three P2P connections. * * struct <API key> limits3[] = { * { .max = 1, .types = BIT(<API key>), }, * { .max = 3, .types = BIT(<API key>) | * BIT(<API key>), }, * }; * struct <API key> combination3 = { * .limits = limits3, * .n_limits = ARRAY_SIZE(limits3), * .max_interfaces = 4, * .<API key> = 2, * }; */ struct <API key> { const struct <API key> *limits; u32 <API key>; u16 max_interfaces; u8 n_limits; bool <API key>; }; struct mac_address { u8 addr[ETH_ALEN]; }; struct <API key> { u16 tx, rx; }; /** * enum <API key> - WoWLAN support flags * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" * trigger that keeps the device operating as-is and * wakes up the host on any activity, for example a * received packet that passed filtering; note that the * packet should be preserved in that case * @<API key>: supports wakeup on magic packet * (see nl80211.h) * @<API key>: supports wakeup on disconnect * @<API key>: supports GTK rekeying while asleep * @<API key>: supports wakeup on GTK rekey failure * @<API key>: supports wakeup on EAP identity request * @<API key>: supports wakeup on 4-way handshake failure * @<API key>: supports wakeup on RF-kill release */ enum <API key> { WIPHY_WOWLAN_ANY = BIT(0), <API key> = BIT(1), <API key> = BIT(2), <API key> = BIT(3), <API key> = BIT(4), <API key> = BIT(5), <API key> = BIT(6), <API key> = BIT(7), }; /** * struct <API key> - WoWLAN support data * @flags: see &enum <API key> * @n_patterns: number of supported wakeup patterns * (see nl80211.h for the pattern definition) * @pattern_max_len: maximum length of each pattern * @pattern_min_len: minimum length of each pattern */ struct <API key> { u32 flags; int n_patterns; int pattern_max_len; int pattern_min_len; }; struct wiphy { /* assign these fields before you register the wiphy */ #define <API key> 2048 u8 padding[<API key>]; /* permanent MAC address(es) */ u8 perm_addr[ETH_ALEN]; u8 addr_mask[ETH_ALEN]; struct mac_address *addresses; const struct <API key> *mgmt_stypes; const struct <API key> *iface_combinations; int <API key>; u16 software_iftypes; u16 n_addresses; /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ u16 interface_modes; u32 flags, features; u32 ap_sme_capa; enum <API key> signal_type; int bss_priv_size; u8 max_scan_ssids; u8 <API key>; u8 max_match_sets; u16 max_scan_ie_len; u16 <API key>; int n_cipher_suites; const u32 *cipher_suites; u8 retry_short; u8 retry_long; u32 frag_threshold; u32 rts_threshold; u8 coverage_class; char fw_version[ETHTOOL_BUSINFO_LEN]; u32 hw_version; struct <API key> wowlan; u16 <API key>; u8 max_num_pmkids; u32 <API key>; u32 <API key>; /* * Bitmap of supported protocols for probe response offloading * see &enum <API key>. Only valid * when the wiphy flag @<API key> is set. */ u32 probe_resp_offload; /* If multiple wiphys are registered and you're handed e.g. * a regular netdev with assigned ieee80211_ptr, you won't * know whether it points to a wiphy your driver has registered * or not. Assign this to something global to your driver to * help determine whether you own this wiphy or not. */ const void *privid; struct <API key> *bands[IEEE80211_NUM_BANDS]; /* Lets us get back the wiphy on the callback */ int (*reg_notifier)(struct wiphy *wiphy, struct regulatory_request *request); /* fields below are read-only, assigned by cfg80211 */ const struct ieee80211_regdomain *regd; /* the item in /sys/class/ieee80211/ points to this, * you need use set_wiphy_dev() (see below) */ struct device dev; /* protects ->resume, ->suspend sysfs callbacks against unregister hw */ bool registered; /* dir in debugfs: ieee80211/<wiphyname> */ struct dentry *debugfsdir; #ifdef CONFIG_NET_NS /* the network namespace this phy lives in currently */ struct net *_net; #endif #ifdef <API key> const struct iw_handler_def *wext; #endif char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); }; static inline struct net *wiphy_net(struct wiphy *wiphy) { return read_pnet(&wiphy->_net); } static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) { write_pnet(&wiphy->_net, net); } /** * wiphy_priv - return priv from wiphy * * @wiphy: the wiphy whose priv pointer to return */ static inline void *wiphy_priv(struct wiphy *wiphy) { BUG_ON(!wiphy); return &wiphy->priv; } /** * priv_to_wiphy - return the wiphy containing the priv * * @priv: a pointer previously returned by wiphy_priv */ static inline struct wiphy *priv_to_wiphy(void *priv) { BUG_ON(!priv); return container_of(priv, struct wiphy, priv); } /** * set_wiphy_dev - set device pointer for wiphy * * @wiphy: The wiphy whose device to bind * @dev: The device to parent it to */ static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) { wiphy->dev.parent = dev; } /** * wiphy_dev - get wiphy dev pointer * * @wiphy: The wiphy whose device struct to look up */ static inline struct device *wiphy_dev(struct wiphy *wiphy) { return wiphy->dev.parent; } /** * wiphy_name - get wiphy name * * @wiphy: The wiphy whose name to return */ static inline const char *wiphy_name(const struct wiphy *wiphy) { return dev_name(&wiphy->dev); } /** * wiphy_new - create a new wiphy for use with cfg80211 * * @ops: The configuration operations for this device * @sizeof_priv: The size of the private area to allocate * * Create a new wiphy and associate the given operations with it. * @sizeof_priv bytes are allocated for private use. * * The returned pointer must be assigned to each netdev's * ieee80211_ptr for proper operation. */ struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv); /** * wiphy_register - register a wiphy with cfg80211 * * @wiphy: The wiphy to register. * * Returns a non-negative wiphy index or a negative error code. */ extern int wiphy_register(struct wiphy *wiphy); /** * wiphy_unregister - deregister a wiphy from cfg80211 * * @wiphy: The wiphy to unregister. * * After this call, no more requests can be made with this priv * pointer, but the call may sleep to wait for an outstanding * request that is being handled. */ extern void wiphy_unregister(struct wiphy *wiphy); /** * wiphy_free - free wiphy * * @wiphy: The wiphy to free */ extern void wiphy_free(struct wiphy *wiphy); /* internal structs */ struct cfg80211_conn; struct <API key>; struct <API key>; #define MAX_AUTH_BSSES 4 /** * struct wireless_dev - wireless per-netdev state * * This structure must be allocated by the driver/stack * that uses the ieee80211_ptr field in struct net_device * (this is intentional so it can be allocated along with * the netdev.) * * @wiphy: pointer to hardware description * @iftype: interface type * @list: (private) Used to collect the interfaces * @netdev: (private) Used to reference back to the netdev * @current_bss: (private) Used by the internal configuration code * @channel: (private) Used by the internal configuration code to track * user-set AP, monitor and WDS channels for wireless extensions * @bssid: (private) Used by the internal configuration code * @ssid: (private) Used by the internal configuration code * @ssid_len: (private) Used by the internal configuration code * @mesh_id_len: (private) Used by the internal configuration code * @mesh_id_up_len: (private) Used by the internal configuration code * @wext: (private) Used by the internal wireless extensions compat code * @use_4addr: indicates 4addr mode is used on this interface, must be * set by driver (if supported) on add_interface BEFORE registering the * netdev and may otherwise be used by driver read-only, will be update * by cfg80211 on change_interface * @mgmt_registrations: list of registrations for management frames * @<API key>: lock for the list * @mtx: mutex used to lock data in this struct * @cleanup_work: work struct used for cleanup that can't be done directly * @beacon_interval: beacon interval used on this device for transmitting * beacons, 0 when not valid */ struct wireless_dev { struct wiphy *wiphy; enum nl80211_iftype iftype; /* the remainder of this struct should be private to cfg80211 */ struct list_head list; struct net_device *netdev; struct list_head mgmt_registrations; spinlock_t <API key>; struct mutex mtx; struct work_struct cleanup_work; bool use_4addr; /* currently used for IBSS and SME - might be rearranged later */ u8 ssid[<API key>]; u8 ssid_len, mesh_id_len, mesh_id_up_len; enum { CFG80211_SME_IDLE, <API key>, <API key>, } sme_state; struct cfg80211_conn *conn; struct <API key> *connect_keys; struct list_head event_list; spinlock_t event_lock; struct <API key> *authtry_bsses[MAX_AUTH_BSSES]; struct <API key> *auth_bsses[MAX_AUTH_BSSES]; struct <API key> *current_bss; /* associated / joined */ struct ieee80211_channel *channel; bool ps; int ps_timeout; int beacon_interval; u32 ap_unexpected_nlpid; #ifdef <API key> /* wext data */ struct { struct <API key> ibss; struct <API key> connect; struct <API key> *keys; u8 *ie; size_t ie_len; u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; u8 ssid[<API key>]; s8 default_key, default_mgmt_key; bool prev_bssid_valid; } wext; #endif }; /** * wdev_priv - return wiphy priv from wireless_dev * * @wdev: The wireless device whose wiphy's priv pointer to return */ static inline void *wdev_priv(struct wireless_dev *wdev) { BUG_ON(!wdev); return wiphy_priv(wdev->wiphy); } /** * DOC: Utility functions * * cfg80211 offers a number of utility functions that can be useful. */ /** * <API key> - convert channel number to frequency * @chan: channel number * @band: band, necessary due to channel number overlap */ extern int <API key>(int chan, enum ieee80211_band band); /** * <API key> - convert frequency to channel number * @freq: center frequency */ extern int <API key>(int freq); /* * Name indirection necessary because the ieee80211 code also has * a function named "<API key>", so if you include * cfg80211's header file you get cfg80211's version, if you try * to include both header files you'll (rightfully!) get a symbol * clash. */ extern struct ieee80211_channel *<API key>(struct wiphy *wiphy, int freq); /** * <API key> - get channel struct from wiphy for specified frequency * @wiphy: the struct wiphy to get the channel for * @freq: the center frequency of the channel */ static inline struct ieee80211_channel * <API key>(struct wiphy *wiphy, int freq) { return <API key>(wiphy, freq); } /** * <API key> - get basic rate for a given rate * * @sband: the band to look for rates in * @basic_rates: bitmap of basic rates * @bitrate: the bitrate for which to find the basic rate * * This function returns the basic rate corresponding to a given * bitrate, that is the next lower bitrate contained in the basic * rate map, which is, for this function, given as a bitmap of * indices of rates in the band's bitrate table. */ struct ieee80211_rate * <API key>(struct <API key> *sband, u32 basic_rates, int bitrate); /* * Radiotap parsing functions -- for controlled injection support * * Implemented in net/wireless/radiotap.c * Documentation in Documentation/networking/radiotap-headers.txt */ struct radiotap_align_size { uint8_t align:4, size:4; }; struct <API key> { const struct radiotap_align_size *align_size; int n_bits; uint32_t oui; uint8_t subns; }; struct <API key> { const struct <API key> *ns; int n_ns; }; /** * struct <API key> - tracks walk thru present radiotap args * @this_arg_index: index of current arg, valid after each successful call * to <API key>() * @this_arg: pointer to current radiotap arg; it is valid after each * call to <API key>() but also after * <API key>() where it will point to * the beginning of the actual data portion * @this_arg_size: length of the current arg, for convenience * @current_namespace: pointer to the current namespace definition * (or internally %NULL if the current namespace is unknown) * @is_radiotap_ns: indicates whether the current namespace is the default * radiotap namespace or not * * @_rtheader: pointer to the radiotap header we are walking through * @_max_length: length of radiotap header in cpu byte ordering * @_arg_index: next argument index * @_arg: next argument pointer * @_next_bitmap: internal pointer to next present u32 * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present * @_vns: vendor namespace definitions * @_next_ns_data: beginning of the next namespace's data * @_reset_on_ext: internal; reset the arg index to 0 when going to the * next bitmap word * * Describes the radiotap parser state. Fields prefixed with an underscore * must not be used by users of the parser, only by the parser internally. */ struct <API key> { struct <API key> *_rtheader; const struct <API key> *_vns; const struct <API key> *current_namespace; unsigned char *_arg, *_next_ns_data; __le32 *_next_bitmap; unsigned char *this_arg; int this_arg_index; int this_arg_size; int is_radiotap_ns; int _max_length; int _arg_index; uint32_t _bitmap_shifter; int _reset_on_ext; }; extern int <API key>( struct <API key> *iterator, struct <API key> *radiotap_header, int max_length, const struct <API key> *vns); extern int <API key>( struct <API key> *iterator); extern const unsigned char rfc1042_header[6]; extern const unsigned char <API key>[6]; /* Parsed Information Elements */ struct ieee802_11_elems { u8 *ie_start; size_t total_len; /* pointers to IEs */ u8 *ssid; u8 *supp_rates; u8 *fh_params; u8 *ds_params; u8 *cf_params; struct ieee80211_tim_ie *tim; u8 *ibss_params; u8 *challenge; u8 *wpa; u8 *rsn; u8 *erp_info; u8 *ext_supp_rates; u8 *wmm_info; u8 *wmm_param; struct ieee80211_ht_cap *ht_cap_elem; struct ieee80211_ht_info *ht_info_elem; struct <API key> *mesh_config; u8 *mesh_id; u8 *peering; u8 *preq; u8 *prep; u8 *perr; struct ieee80211_rann_ie *rann; u8 *ch_switch_elem; u8 *country_elem; u8 *pwr_constr_elem; u8 *quiet_elem; /* first quite element */ u8 *timeout_int; /* length of them, respectively */ u8 ssid_len; u8 supp_rates_len; u8 fh_params_len; u8 ds_params_len; u8 cf_params_len; u8 tim_len; u8 ibss_params_len; u8 challenge_len; u8 wpa_len; u8 rsn_len; u8 erp_info_len; u8 ext_supp_rates_len; u8 wmm_info_len; u8 wmm_param_len; u8 mesh_id_len; u8 peering_len; u8 preq_len; u8 prep_len; u8 perr_len; u8 ch_switch_elem_len; u8 country_elem_len; u8 pwr_constr_elem_len; u8 quiet_elem_len; u8 num_of_quiet_elem; /* can be more the one */ u8 timeout_int_len; }; /** * <API key> - get header length from data * * Given an skb with a raw 802.11 header at the data pointer this function * returns the 802.11 header length in bytes (not including encryption * headers). If the data in the sk_buff is too short to contain a valid 802.11 * header the function returns 0. * * @skb: the frame */ unsigned int <API key>(const struct sk_buff *skb); /** * ieee80211_hdrlen - get header length in bytes from frame control * @fc: frame control field in little-endian format */ unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); /** * DOC: Data path helpers * * In addition to generic utilities, cfg80211 also offers * functions that help implement the data path for devices * that do not do the 802.11/802.3 conversion on the device. */ /** * <API key> - convert an 802.11 data frame to 802.3 * @skb: the 802.11 data frame * @addr: the device MAC address * @iftype: the virtual interface type */ int <API key>(struct sk_buff *skb, const u8 *addr, enum nl80211_iftype iftype); /** * <API key> - convert an 802.3 frame to 802.11 * @skb: the 802.3 frame * @addr: the device MAC address * @iftype: the virtual interface type * @bssid: the network bssid (used only for iftype STATION and ADHOC) * @qos: build 802.11 QoS data frame */ int <API key>(struct sk_buff *skb, const u8 *addr, enum nl80211_iftype iftype, u8 *bssid, bool qos); /** * <API key> - decode an IEEE 802.11n A-MSDU frame * * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of * 802.3 frames. The @list will be empty if the decode fails. The * @skb is consumed after the function returns. * * @skb: The input IEEE 802.11n A-MSDU frame. * @list: The output list of 802.3 frames. It must be allocated and * initialized by by the caller. * @addr: The device MAC address. * @iftype: The device interface type. * @extra_headroom: The hardware extra headroom for SKBs in the @list. * @has_80211_header: Set it true if SKB is with IEEE 802.11 header. */ void <API key>(struct sk_buff *skb, struct sk_buff_head *list, const u8 *addr, enum nl80211_iftype iftype, const unsigned int extra_headroom, bool has_80211_header); /** * <API key> - determine the 802.1p/1d tag for a data frame * @skb: the data frame */ unsigned int <API key>(struct sk_buff *skb); /** * cfg80211_find_ie - find information element in data * * @eid: element ID * @ies: data consisting of IEs * @len: length of data * * This function will return %NULL if the element ID could * not be found or if the element is invalid (claims to be * longer than the given data), or a pointer to the first byte * of the requested element, that is the byte containing the * element ID. There are no checks on the element length * other than having to fit into the given data. */ const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); /** * <API key> - find vendor specific information element in data * * @oui: vendor OUI * @oui_type: vendor-specific OUI type * @ies: data consisting of IEs * @len: length of data * * This function will return %NULL if the vendor specific element ID * could not be found or if the element is invalid (claims to be * longer than the given data), or a pointer to the first byte * of the requested element, that is the byte containing the * element ID. There are no checks on the element length * other than having to fit into the given data. */ const u8 *<API key>(unsigned int oui, u8 oui_type, const u8 *ies, int len); /** * DOC: Regulatory enforcement infrastructure * * TODO */ /** * regulatory_hint - driver hint to the wireless core a regulatory domain * @wiphy: the wireless device giving the hint (used only for reporting * conflicts) * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain * should be in. If @rd is set this should be NULL. Note that if you * set this to NULL you should still set rd->alpha2 to some accepted * alpha2. * * Wireless drivers can use this function to hint to the wireless core * what it believes should be the current regulatory domain by * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory * domain should be in or by providing a completely build regulatory domain. * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried * for a regulatory domain structure for the respective country. * * The wiphy must have been registered to cfg80211 prior to this call. * For cfg80211 drivers this means you must first use wiphy_register(), * for mac80211 drivers you must first use <API key>(). * * Drivers should check the return value, its possible you can get * an -ENOMEM. */ extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); /** * <API key> - apply a custom driver regulatory domain * @wiphy: the wireless device we want to process the regulatory domain on * @regd: the custom regulatory domain to use for this wiphy * * Drivers can sometimes have custom regulatory domains which do not apply * to a specific country. Drivers can use this to apply such custom regulatory * domains. This routine must be called prior to wiphy registration. The * custom regulatory domain will be trusted completely and as such previous * default channel settings will be disregarded. If no rule is found for a * channel on the regulatory domain the channel will be disabled. */ extern void <API key>( struct wiphy *wiphy, const struct ieee80211_regdomain *regd); /** * freq_reg_info - get regulatory information for the given frequency * @wiphy: the wiphy for which we want to process this rule for * @center_freq: Frequency in KHz for which we want regulatory information for * @desired_bw_khz: the desired max bandwidth you want to use per * channel. Note that this is still 20 MHz if you want to use HT40 * as HT40 makes use of two channels for its 40 MHz width bandwidth. * If set to 0 we'll assume you want the standard 20 MHz. * @reg_rule: the regulatory rule which we have for this frequency * * Use this function to get the regulatory rule for a specific frequency on * a given wireless device. If the device has a specific regulatory domain * it wants to follow we respect that unless a country IE has been received * and processed already. * * Returns 0 if it was able to find a valid regulatory rule which does * apply to the given center_freq otherwise it returns non-zero. It will * also return -ERANGE if we determine the given center_freq does not even have * a regulatory rule for a frequency range in the center_freq's band. See * freq_in_rule_band() for our current definition of a band -- this is purely * subjective and right now its 802.11 specific. */ extern int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 desired_bw_khz, const struct ieee80211_reg_rule **reg_rule); /* * callbacks for asynchronous cfg80211 methods, notification * functions and BSS handling helpers */ /** * cfg80211_scan_done - notify that scan finished * * @request: the corresponding scan request * @aborted: set to true if the scan was aborted for any reason, * userspace will be notified of that */ void cfg80211_scan_done(struct <API key> *request, bool aborted); /** * <API key> - notify that new scan results are available * * @wiphy: the wiphy which got scheduled scan results */ void <API key>(struct wiphy *wiphy); /** * <API key> - notify that the scheduled scan has stopped * * @wiphy: the wiphy on which the scheduled scan stopped * * The driver can call this function to inform cfg80211 that the * scheduled scan had to be stopped, for whatever reason. The driver * is then called back via the sched_scan_stop operation when done. */ void <API key>(struct wiphy *wiphy); /** * <API key> - inform cfg80211 of a received BSS frame * * @wiphy: the wiphy reporting the BSS * @channel: The channel the frame was received on * @mgmt: the management frame (probe response or beacon) * @len: length of the management frame * @signal: the signal strength, type depends on the wiphy's signal_type * @gfp: context flags * * This informs cfg80211 that BSS information was found and * the BSS should be updated/added. * * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()! */ struct cfg80211_bss * __must_check <API key>(struct wiphy *wiphy, struct ieee80211_channel *channel, struct ieee80211_mgmt *mgmt, size_t len, s32 signal, gfp_t gfp); /** * cfg80211_inform_bss - inform cfg80211 of a new BSS * * @wiphy: the wiphy reporting the BSS * @channel: The channel the frame was received on * @bssid: the BSSID of the BSS * @timestamp: the TSF timestamp sent by the peer * @capability: the capability field sent by the peer * @beacon_interval: the beacon interval announced by the peer * @ie: additional IEs sent by the peer * @ielen: length of the additional IEs * @signal: the signal strength, type depends on the wiphy's signal_type * @gfp: context flags * * This informs cfg80211 that BSS information was found and * the BSS should be updated/added. * * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()! */ struct cfg80211_bss * __must_check cfg80211_inform_bss(struct wiphy *wiphy, struct ieee80211_channel *channel, const u8 *bssid, u64 timestamp, u16 capability, u16 beacon_interval, const u8 *ie, size_t ielen, s32 signal, gfp_t gfp); struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, struct ieee80211_channel *channel, const u8 *bssid, const u8 *ssid, size_t ssid_len, u16 capa_mask, u16 capa_val); static inline struct cfg80211_bss * cfg80211_get_ibss(struct wiphy *wiphy, struct ieee80211_channel *channel, const u8 *ssid, size_t ssid_len) { return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, <API key>, <API key>); } struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy, struct ieee80211_channel *channel, const u8 *meshid, size_t meshidlen, const u8 *meshcfg); void cfg80211_put_bss(struct cfg80211_bss *bss); /** * cfg80211_unlink_bss - unlink BSS from internal data structures * @wiphy: the wiphy * @bss: the bss to remove * * This function removes the given BSS from the internal data structures * thereby making it no longer show up in scan results etc. Use this * function when you detect a BSS is gone. Normally BSSes will also time * out, so it is not necessary to use this function at all. */ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); /** * <API key> - notification of processed authentication * @dev: network device * @buf: authentication frame (header + body) * @len: length of the frame data * * This function is called whenever an authentication has been processed in * station mode. The driver is required to call either this function or * <API key>() to indicate the result of cfg80211_ops::auth() * call. This function may sleep. */ void <API key>(struct net_device *dev, const u8 *buf, size_t len); /** * <API key> - notification of timed out authentication * @dev: network device * @addr: The MAC address of the device with which the authentication timed out * * This function may sleep. */ void <API key>(struct net_device *dev, const u8 *addr); /** * <API key> - notify cfg80211 that authentication was canceled * @dev: network device * @addr: The MAC address of the device with which the authentication timed out * * When a pending authentication had no action yet, the driver may decide * to not send a deauth frame, but in that case must calls this function * to tell cfg80211 about this decision. It is only valid to call this * function within the deauth() callback. */ void <API key>(struct net_device *dev, const u8 *addr); /** * <API key> - notification of processed association * @dev: network device * @buf: (re)association response frame (header + body) * @len: length of the frame data * * This function is called whenever a (re)association response has been * processed in station mode. The driver is required to call either this * function or <API key>() to indicate the result of * cfg80211_ops::assoc() call. This function may sleep. */ void <API key>(struct net_device *dev, const u8 *buf, size_t len); /** * <API key> - notification of timed out association * @dev: network device * @addr: The MAC address of the device with which the association timed out * * This function may sleep. */ void <API key>(struct net_device *dev, const u8 *addr); /** * <API key> - notification of processed deauthentication * @dev: network device * @buf: deauthentication frame (header + body) * @len: length of the frame data * * This function is called whenever deauthentication has been processed in * station mode. This includes both received deauthentication frames and * locally generated ones. This function may sleep. */ void <API key>(struct net_device *dev, const u8 *buf, size_t len); /** * <API key> - notification of processed deauthentication * @dev: network device * @buf: deauthentication frame (header + body) * @len: length of the frame data * * Like <API key>(), but doesn't take the wdev lock. */ void <API key>(struct net_device *dev, const u8 *buf, size_t len); /** * <API key> - notification of processed disassociation * @dev: network device * @buf: disassociation response frame (header + body) * @len: length of the frame data * * This function is called whenever disassociation has been processed in * station mode. This includes both received disassociation frames and locally * generated ones. This function may sleep. */ void <API key>(struct net_device *dev, const u8 *buf, size_t len); /** * <API key> - notification of processed disassociation * @dev: network device * @buf: disassociation response frame (header + body) * @len: length of the frame data * * Like <API key>(), but doesn't take the wdev lock. */ void <API key>(struct net_device *dev, const u8 *buf, size_t len); /** * <API key> - notification of unprotected deauthentication * @dev: network device * @buf: deauthentication frame (header + body) * @len: length of the frame data * * This function is called whenever a received Deauthentication frame has been * dropped in station mode because of MFP being used but the Deauthentication * frame was not protected. This function may sleep. */ void <API key>(struct net_device *dev, const u8 *buf, size_t len); /** * <API key> - notification of unprotected disassociation * @dev: network device * @buf: disassociation frame (header + body) * @len: length of the frame data * * This function is called whenever a received Disassociation frame has been * dropped in station mode because of MFP being used but the Disassociation * frame was not protected. This function may sleep. */ void <API key>(struct net_device *dev, const u8 *buf, size_t len); /** * <API key> - notification of Michael MIC failure (TKIP) * @dev: network device * @addr: The source MAC address of the frame * @key_type: The key type that the received frame used * @key_id: Key identifier (0..3). Can be -1 if missing. * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) * @gfp: allocation flags * * This function is called whenever the local MAC detects a MIC failure in a * received frame. This matches with <API key>.indication() * primitive. */ void <API key>(struct net_device *dev, const u8 *addr, enum nl80211_key_type key_type, int key_id, const u8 *tsc, gfp_t gfp); /** * <API key> - notify cfg80211 that device joined an IBSS * * @dev: network device * @bssid: the BSSID of the IBSS joined * @gfp: allocation flags * * This function notifies cfg80211 that the device joined an IBSS or * switched to a different BSSID. Before this function can be called, * either a beacon has to have been received from the IBSS, or one of * the cfg80211_inform_bss{,_frame} functions must have been called * with the locally generated beacon -- this guarantees that there is * always a scan result for this IBSS. cfg80211 will handle the rest. */ void <API key>(struct net_device *dev, const u8 *bssid, gfp_t gfp); /** * <API key> - notify cfg80211 of a new mesh peer candidate * * @dev: network device * @macaddr: the MAC address of the new candidate * @ie: information elements advertised by the peer candidate * @ie_len: lenght of the information elements buffer * @gfp: allocation flags * * This function notifies cfg80211 that the mesh peer candidate has been * detected, most likely via a beacon or, less likely, via a probe response. * cfg80211 then sends a notification to userspace. */ void <API key>(struct net_device *dev, const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp); /** * DOC: RFkill integration * * RFkill integration in cfg80211 is almost invisible to drivers, * as cfg80211 automatically registers an rfkill instance for each * wireless device it knows about. Soft kill is also translated * into disconnecting and turning all interfaces off, drivers are * expected to turn off the device when all interfaces are down. * * However, devices may have a hard RFkill line, in which case they * also need to interact with the rfkill subsystem, via cfg80211. * They can do this with a few helper functions documented here. */ /** * <API key> - notify cfg80211 about hw block state * @wiphy: the wiphy * @blocked: block status */ void <API key>(struct wiphy *wiphy, bool blocked); /** * <API key> - start polling rfkill * @wiphy: the wiphy */ void <API key>(struct wiphy *wiphy); /** * <API key> - stop polling rfkill * @wiphy: the wiphy */ void <API key>(struct wiphy *wiphy); #ifdef <API key> /** * DOC: Test mode * * Test mode is a set of utility functions to allow drivers to * interact with driver-specific tools to aid, for instance, * factory programming. * * This chapter describes how drivers interact with it, for more * information see the nl80211 book's chapter on it. */ /** * <API key> - allocate testmode reply * @wiphy: the wiphy * @approxlen: an upper bound of the length of the data that will * be put into the skb * * This function allocates and pre-fills an skb for a reply to * the testmode command. Since it is intended for a reply, calling * it outside of the @testmode_cmd operation is invalid. * * The returned skb (or %NULL if any errors happen) is pre-filled * with the wiphy index and set up in a way that any data that is * put into the skb (with skb_put(), nla_put() or similar) will end * up being within the %<API key> attribute, so all that * needs to be done with the skb is adding data for the corresponding * userspace tool which can then read that data out of the testdata * attribute. You must not modify the skb in any other way. * * When done, call <API key>() with the skb and return * its error code as the result of the @testmode_cmd operation. */ struct sk_buff *<API key>(struct wiphy *wiphy, int approxlen); /** * <API key> - send the reply skb * @skb: The skb, must have been allocated with * <API key>() * * Returns an error code or 0 on success, since calling this * function will usually be the last thing before returning * from the @testmode_cmd you should return the error code. * Note that this function consumes the skb regardless of the * return value. */ int <API key>(struct sk_buff *skb); /** * <API key> - allocate testmode event * @wiphy: the wiphy * @approxlen: an upper bound of the length of the data that will * be put into the skb * @gfp: allocation flags * * This function allocates and pre-fills an skb for an event on the * testmode multicast group. * * The returned skb (or %NULL if any errors happen) is set up in the * same way as with <API key>() but prepared * for an event. As there, you should simply add data to it that will * then end up in the %<API key> attribute. Again, you must * not modify the skb in any other way. * * When done filling the skb, call <API key>() with the * skb to send the event. */ struct sk_buff *<API key>(struct wiphy *wiphy, int approxlen, gfp_t gfp); /** * <API key> - send the event * @skb: The skb, must have been allocated with * <API key>() * @gfp: allocation flags * * This function sends the given @skb, which must have been allocated * by <API key>(), as an event. It always * consumes it. */ void <API key>(struct sk_buff *skb, gfp_t gfp); #define <API key>(cmd) .testmode_cmd = (cmd), #define <API key>(cmd) .testmode_dump = (cmd), #else #define <API key>(cmd) #define <API key>(cmd) #endif /** * <API key> - notify cfg80211 of connection result * * @dev: network device * @bssid: the BSSID of the AP * @req_ie: association request IEs (maybe be %NULL) * @req_ie_len: association request IEs length * @resp_ie: association response IEs (may be %NULL) * @resp_ie_len: assoc response IEs length * @status: status code, 0 for successful connection, use * %<API key> if your device cannot give you * the real status code for failures. * @gfp: allocation flags * * It should be called by the underlying driver whenever connect() has * succeeded. */ void <API key>(struct net_device *dev, const u8 *bssid, const u8 *req_ie, size_t req_ie_len, const u8 *resp_ie, size_t resp_ie_len, u16 status, gfp_t gfp); /** * cfg80211_roamed - notify cfg80211 of roaming * * @dev: network device * @channel: the channel of the new AP * @bssid: the BSSID of the new AP * @req_ie: association request IEs (maybe be %NULL) * @req_ie_len: association request IEs length * @resp_ie: association response IEs (may be %NULL) * @resp_ie_len: assoc response IEs length * @gfp: allocation flags * * It should be called by the underlying driver whenever it roamed * from one AP to another while connected. */ void cfg80211_roamed(struct net_device *dev, struct ieee80211_channel *channel, const u8 *bssid, const u8 *req_ie, size_t req_ie_len, const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); /** * cfg80211_roamed_bss - notify cfg80211 of roaming * * @dev: network device * @bss: entry of bss to which STA got roamed * @req_ie: association request IEs (maybe be %NULL) * @req_ie_len: association request IEs length * @resp_ie: association response IEs (may be %NULL) * @resp_ie_len: assoc response IEs length * @gfp: allocation flags * * This is just a wrapper to notify cfg80211 of roaming event with driver * passing bss to avoid a race in timeout of the bss entry. It should be * called by the underlying driver whenever it roamed from one AP to another * while connected. Drivers which have roaming implemented in firmware * may use this function to avoid a race in bss entry timeout where the bss * entry of the new AP is seen in the driver, but gets timed out by the time * it is accessed in __cfg80211_roamed() due to delay in scheduling * rdev->event_work. In case of any failures, the reference is released * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise, * it will be released while diconneting from the current bss. */ void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss, const u8 *req_ie, size_t req_ie_len, const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); /** * <API key> - notify cfg80211 that connection was dropped * * @dev: network device * @ie: information elements of the deauth/disassoc frame (may be %NULL) * @ie_len: length of IEs * @reason: reason code for the disconnection, set it to 0 if unknown * @gfp: allocation flags * * After it calls this function, the driver should enter an idle state * and not try to connect to any AP any more. */ void <API key>(struct net_device *dev, u16 reason, u8 *ie, size_t ie_len, gfp_t gfp); /** * <API key> - notification of remain_on_channel start * @dev: network device * @cookie: the request cookie * @chan: The current channel (from remain_on_channel request) * @channel_type: Channel type * @duration: Duration in milliseconds that the driver intents to remain on the * channel * @gfp: allocation flags */ void <API key>(struct net_device *dev, u64 cookie, struct ieee80211_channel *chan, enum <API key> channel_type, unsigned int duration, gfp_t gfp); /** * <API key> - remain_on_channel duration expired * @dev: network device * @cookie: the request cookie * @chan: The current channel (from remain_on_channel request) * @channel_type: Channel type * @gfp: allocation flags */ void <API key>(struct net_device *dev, u64 cookie, struct ieee80211_channel *chan, enum <API key> channel_type, gfp_t gfp); /** * cfg80211_new_sta - notify userspace about station * * @dev: the netdev * @mac_addr: the station's address * @sinfo: the station information * @gfp: allocation flags */ void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, struct station_info *sinfo, gfp_t gfp); /** * cfg80211_del_sta - notify userspace about deletion of a station * * @dev: the netdev * @mac_addr: the station's address * @gfp: allocation flags */ void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); /** * cfg80211_rx_mgmt - notification of received, unprocessed management frame * @dev: network device * @freq: Frequency on which the frame was received in MHz * @buf: Management frame (header + body) * @len: length of the frame data * @gfp: context flags * * Returns %true if a user space application has registered for this frame. * For action frames, that makes it responsible for rejecting unrecognized * action frames; %false otherwise, in which case for action frames the * driver is responsible for rejecting the frame. * * This function is called whenever an Action frame is received for a station * mode interface, but is not processed in kernel. */ bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf, size_t len, gfp_t gfp); /** * <API key> - notification of TX status for management frame * @dev: network device * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() * @buf: Management frame (header + body) * @len: length of the frame data * @ack: Whether frame was acknowledged * @gfp: context flags * * This function is called whenever a management frame was requested to be * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the * transmission attempt. */ void <API key>(struct net_device *dev, u64 cookie, const u8 *buf, size_t len, bool ack, gfp_t gfp); /** * <API key> - connection quality monitoring rssi event * @dev: network device * @rssi_event: the triggered RSSI event * @gfp: context flags * * This function is called when a configured connection quality monitoring * rssi threshold reached event occurs. */ void <API key>(struct net_device *dev, enum <API key> rssi_event, gfp_t gfp); /** * <API key> - notify userspace about packetloss to peer * @dev: network device * @peer: peer's MAC address * @num_packets: how many packets were lost -- should be a fixed threshold * but probably no less than maybe 50, or maybe a throughput dependent * threshold (to account for temporary interference) * @gfp: context flags */ void <API key>(struct net_device *dev, const u8 *peer, u32 num_packets, gfp_t gfp); /** * <API key> - notify userspace about driver rekeying * @dev: network device * @bssid: BSSID of AP (to avoid races) * @replay_ctr: new replay counter * @gfp: allocation flags */ void <API key>(struct net_device *dev, const u8 *bssid, const u8 *replay_ctr, gfp_t gfp); /** * <API key> - notify about PMKSA caching candidate * @dev: network device * @index: candidate index (the smaller the index, the higher the priority) * @bssid: BSSID of AP * @preauth: Whether AP advertises support for RSN pre-authentication * @gfp: allocation flags */ void <API key>(struct net_device *dev, int index, const u8 *bssid, bool preauth, gfp_t gfp); /** * <API key> - inform userspace about a spurious frame * @dev: The device the frame matched to * @addr: the transmitter address * @gfp: context flags * * This function is used in AP mode (only!) to inform userspace that * a spurious class 3 frame was received, to be able to deauth the * sender. * Returns %true if the frame was passed to userspace (or this failed * for a reason other than not having a subscription.) */ bool <API key>(struct net_device *dev, const u8 *addr, gfp_t gfp); /** * <API key> - inform about unexpected WDS frame * @dev: The device the frame matched to * @addr: the transmitter address * @gfp: context flags * * This function is used in AP mode (only!) to inform userspace that * an associated station sent a 4addr frame but that wasn't expected. * It is allowed and desirable to send this event only once for each * station to avoid event flooding. * Returns %true if the frame was passed to userspace (or this failed * for a reason other than not having a subscription.) */ bool <API key>(struct net_device *dev, const u8 *addr, gfp_t gfp); /** * <API key> - notify userspace about probe status * @dev: the device the probe was sent on * @addr: the address of the peer * @cookie: the cookie filled in @probe_client previously * @acked: indicates whether probe was acked or not * @gfp: allocation flags */ void <API key>(struct net_device *dev, const u8 *addr, u64 cookie, bool acked, gfp_t gfp); /** * <API key> - report beacon from other APs * @wiphy: The wiphy that received the beacon * @frame: the frame * @len: length of the frame * @freq: frequency the frame was received on * @gfp: allocation flags * * Use this function to report to userspace when a beacon was * received. It is not useful to call this when there is no * netdev that is in AP/GO mode. */ void <API key>(struct wiphy *wiphy, const u8 *frame, size_t len, int freq, gfp_t gfp); /* Logging, debugging and troubleshooting/diagnostic helpers. */ /* wiphy_printk helpers, similar to dev_printk */ #define wiphy_printk(level, wiphy, format, args...) \ dev_printk(level, &(wiphy)->dev, format, ##args) #define wiphy_emerg(wiphy, format, args...) \ dev_emerg(&(wiphy)->dev, format, ##args) #define wiphy_alert(wiphy, format, args...) \ dev_alert(&(wiphy)->dev, format, ##args) #define wiphy_crit(wiphy, format, args...) \ dev_crit(&(wiphy)->dev, format, ##args) #define wiphy_err(wiphy, format, args...) \ dev_err(&(wiphy)->dev, format, ##args) #define wiphy_warn(wiphy, format, args...) \ dev_warn(&(wiphy)->dev, format, ##args) #define wiphy_notice(wiphy, format, args...) \ dev_notice(&(wiphy)->dev, format, ##args) #define wiphy_info(wiphy, format, args...) \ dev_info(&(wiphy)->dev, format, ##args) #define wiphy_debug(wiphy, format, args...) \ wiphy_printk(KERN_DEBUG, wiphy, format, ##args) #define wiphy_dbg(wiphy, format, args...) \ dev_dbg(&(wiphy)->dev, format, ##args) #if defined(VERBOSE_DEBUG) #define wiphy_vdbg wiphy_dbg #else #define wiphy_vdbg(wiphy, format, args...) \ ({ \ if (0) \ wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 0; \ }) #endif /* * wiphy_WARN() acts like wiphy_printk(), but with the key difference * of using a WARN/WARN_ON to get the message out, including the * file/line information and a backtrace. */ #define wiphy_WARN(wiphy, format, args...) \ WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); #endif /* __NET_CFG80211_H */
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */ #if !_LIBC # include <config.h> #endif #include "error.h" #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #if !_LIBC && ENABLE_NLS # include "gettext.h" # define _(msgid) gettext (msgid) #endif #ifdef _LIBC # include <libintl.h> # include <stdbool.h> # include <stdint.h> # include <wchar.h> # define mbsrtowcs __mbsrtowcs #endif #if USE_UNLOCKED_IO # include "unlocked-io.h" #endif #ifndef _ # define _(String) String #endif /* If NULL, error will flush stdout, then print on stderr the program name, a colon and a space. Otherwise, error will call this function without parameters instead. */ void (*<API key>) (void); /* This variable is incremented each time `error' is called. */ unsigned int error_message_count; #ifdef _LIBC /* In the GNU C library, there is a predefined variable for this. */ # define program_name <API key> # include <errno.h> # include <limits.h> # include <libio/libioP.h> /* In GNU libc we want do not want to use the common name `error' directly. Instead make it a weak alias. */ extern void __error (int status, int errnum, const char *message, ...) __attribute__ ((__format__ (__printf__, 3, 4))); extern void __error_at_line (int status, int errnum, const char *file_name, unsigned int line_number, const char *message, ) __attribute__ ((__format__ (__printf__, 5, 6)));; # define error __error # define error_at_line __error_at_line # include <libio/iolibio.h> # define fflush(s) INTUSE(_IO_fflush) (s) # undef putc # define putc(c, fp) INTUSE(_IO_putc) (c, fp) # include <bits/libc-lock.h> #else /* not _LIBC */ # include <fcntl.h> # include <unistd.h> # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* Get declarations of the Win32 API functions. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> # endif /* The gnulib override of fcntl is not needed in this file. */ # undef fcntl # if !<API key> && STRERROR_R_CHAR_P # ifndef <API key> "this configure-time declaration test was not run" # endif char *strerror_r (); # endif /* The calling program should define program_name and set it to the name of the executing program. */ extern char *program_name; # if HAVE_STRERROR_R || defined strerror_r # define __strerror_r strerror_r # endif /* HAVE_STRERROR_R || defined strerror_r */ #endif /* not _LIBC */ #if !_LIBC /* Return non-zero if FD is open. */ static inline int is_open (int fd) { # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* On Win32: The initial state of unassigned standard file descriptors is that they are open but point to an <API key>. There is no fcntl, and the gnulib replacement fcntl does not support F_GETFL. */ return (HANDLE) _get_osfhandle (fd) != <API key>; # else # ifndef F_GETFL # error Please port fcntl to your platform # endif return 0 <= fcntl (fd, F_GETFL); # endif } #endif static inline void flush_stdout (void) { #if !_LIBC int stdout_fd; # if <API key> /* Use of gnulib's freopen-safer module normally ensures that fileno (stdout) == 1 whenever stdout is open. */ stdout_fd = STDOUT_FILENO; # else /* POSIX states that fileno (stdout) after fclose is unspecified. But in practice it is not a problem, because stdout is statically allocated and the fd of a FILE stream is stored as a field in its allocated memory. */ stdout_fd = fileno (stdout); # endif /* POSIX states that fflush (stdout) after fclose is unspecified; it is safe in glibc, but not on all other platforms. fflush (NULL) is always defined, but too draconian. */ if (0 <= stdout_fd && is_open (stdout_fd)) #endif fflush (stdout); } static void print_errno_message (int errnum) { char const *s; #if defined HAVE_STRERROR_R || _LIBC char errbuf[1024]; # if STRERROR_R_CHAR_P || _LIBC s = __strerror_r (errnum, errbuf, sizeof errbuf); # else if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) s = errbuf; else s = 0; # endif #else s = strerror (errnum); #endif #if !_LIBC if (! s) s = _("Unknown system error"); #endif #if _LIBC __fxprintf (NULL, ": %s", s); #else fprintf (stderr, ": %s", s); #endif } static void error_tail (int status, int errnum, const char *message, va_list args) { #if _LIBC if (_IO_fwide (stderr, 0) > 0) { # define ALLOCA_LIMIT 2000 size_t len = strlen (message) + 1; wchar_t *wmessage = NULL; mbstate_t st; size_t res; const char *tmp; bool use_malloc = false; while (1) { if (__libc_use_alloca (len * sizeof (wchar_t))) wmessage = (wchar_t *) alloca (len * sizeof (wchar_t)); else { if (!use_malloc) wmessage = NULL; wchar_t *p = (wchar_t *) realloc (wmessage, len * sizeof (wchar_t)); if (p == NULL) { free (wmessage); fputws_unlocked (L"out of memory\n", stderr); return; } wmessage = p; use_malloc = true; } memset (&st, '\0', sizeof (st)); tmp = message; res = mbsrtowcs (wmessage, &tmp, len, &st); if (res != len) break; if (__builtin_expect (len >= SIZE_MAX / 2, 0)) { /* This really should not happen if everything is fine. */ res = (size_t) -1; break; } len *= 2; } if (res == (size_t) -1) { /* The string cannot be converted. */ if (use_malloc) { free (wmessage); use_malloc = false; } wmessage = (wchar_t *) L"???"; } __vfwprintf (stderr, wmessage, args); if (use_malloc) free (wmessage); } else #endif vfprintf (stderr, message, args); va_end (args); ++error_message_count; if (errnum) print_errno_message (errnum); #if _LIBC __fxprintf (NULL, "\n"); #else putc ('\n', stderr); #endif fflush (stderr); if (status) exit (status); } /* Print the program name and error message MESSAGE, which is a printf-style format string with optional args. If ERRNUM is nonzero, print its corresponding system error message. Exit with status STATUS if it is nonzero. */ void error (int status, int errnum, const char *message, ...) { va_list args; #if defined _LIBC && defined __libc_ptf_call /* We do not want this call to be cut short by a thread cancellation. Therefore disable cancellation for now. */ int state = <API key>; __libc_ptf_call (<API key>, (<API key>, &state), 0); #endif flush_stdout (); #ifdef _LIBC _IO_flockfile (stderr); #endif if (<API key>) (*<API key>) (); else { #if _LIBC __fxprintf (NULL, "%s: ", program_name); #else fprintf (stderr, "%s: ", program_name); #endif } va_start (args, message); error_tail (status, errnum, message, args); #ifdef _LIBC _IO_funlockfile (stderr); # ifdef __libc_ptf_call __libc_ptf_call (<API key>, (state, NULL), 0); # endif #endif } /* Sometimes we want to have at most one error per line. This variable controls whether this mode is selected or not. */ int error_one_per_line; void error_at_line (int status, int errnum, const char *file_name, unsigned int line_number, const char *message, ...) { va_list args; if (error_one_per_line) { static const char *old_file_name; static unsigned int old_line_number; if (old_line_number == line_number && (file_name == old_file_name || strcmp (old_file_name, file_name) == 0)) /* Simply return and print nothing. */ return; old_file_name = file_name; old_line_number = line_number; } #if defined _LIBC && defined __libc_ptf_call /* We do not want this call to be cut short by a thread cancellation. Therefore disable cancellation for now. */ int state = <API key>; __libc_ptf_call (<API key>, (<API key>, &state), 0); #endif flush_stdout (); #ifdef _LIBC _IO_flockfile (stderr); #endif if (<API key>) (*<API key>) (); else { #if _LIBC __fxprintf (NULL, "%s:", program_name); #else fprintf (stderr, "%s:", program_name); #endif } #if _LIBC __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ", file_name, line_number); #else fprintf (stderr, file_name != NULL ? "%s:%d: " : " ", file_name, line_number); #endif va_start (args, message); error_tail (status, errnum, message, args); #ifdef _LIBC _IO_funlockfile (stderr); # ifdef __libc_ptf_call __libc_ptf_call (<API key>, (state, NULL), 0); # endif #endif } #ifdef _LIBC /* Make the weak alias. */ # undef error # undef error_at_line weak_alias (__error, error) weak_alias (__error_at_line, error_at_line) #endif
id: runningondevice title: Running On Device layout: docs category: Guides permalink: docs/runningondevice.html next: embedded-app Note that running on device requires [Apple Developer account](https://developer.apple.com/register/index.action) and provisioning your iPhone. This guide covers only React Native specific topic. ## Accessing development server from device You can iterate quickly on device using development server. To do that, your laptop and your phone have to be on the same wifi network. 1. Open `iOS/AppDelegate.m` 2. Change the IP in the URL from `localhost` to your laptop's IP 3. In Xcode select your phone as build target and press "Build and run" > Hint > > Shake the device to open development menu (reload, debug, etc.) ## Using offline bundle You can also pack all the JavaScript code within the app itself. This way you can test it without development server running and submit the app to the AppStore. 1. Open `iOS/AppDelegate.m` 2. Follow the instructions for "OPTION 2": * Uncomment `jsCodeLocation = [[NSBundle mainBundle] ...` * Run the `react-native bundle` command in terminal from the root directory of your app The bundle script supports a couple of flags: * `--dev` - sets the value of `__DEV__` variable to true. When `true` it turns on a bunch of useful development warnings. For production it is recommended to set `__DEV__=false`. * `--minify` - pipe the JS code through UglifyJS. ## Disabling in-app developer menu When building your app for production, your app's scheme should be set to `Release` as detailed in [the debugging documentation](/react-native/docs/debugging.html#<API key>) in order to disable the in-app developer menu. ## Troubleshooting If `curl` command fails make sure the packager is running. Also try adding `--ipv4` flag to the end of it. If you started your project a while ago, `main.jsbundle` might not be included into Xcode project. To add it, right click on your project directory and click "Add Files to ..." - choose the `main.jsbundle` file that you generated.
import {Component, provide} from 'angular2/core'; import {bootstrap} from 'angular2/platform/browser'; // #docregion JsonPipe @Component({ selector: 'json-example', template: `<div> <p>Without JSON pipe:</p> <pre>{{object}}</pre> <p>With JSON pipe:</p> <pre>{{object | json}}</pre> </div>` }) export class JsonPipeExample { object: Object = {foo: 'bar', baz: 'qux', nested: {xyz: 3, numbers: [1, 2, 3, 4, 5]}} } // #enddocregion @Component({ selector: 'example-app', directives: [JsonPipeExample], template: ` <h1>JsonPipe Example</h1> <json-example></json-example> ` }) export class AppCmp { } export function main() { bootstrap(AppCmp); }
// $Id: helper.js 100 2011-02-20 19:14:25Z ph0enix $ Drupal.elfinder = { editor: { } }
#include "rtl28xxu.h" static int rtl28xxu_disable_rc; module_param_named(disable_rc, rtl28xxu_disable_rc, int, 0644); MODULE_PARM_DESC(disable_rc, "disable RTL2832U remote controller"); <API key>(adapter_nr); static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct rtl28xxu_req *req) { struct rtl28xxu_dev *dev = d->priv; int ret; unsigned int pipe; u8 requesttype; mutex_lock(&d->usb_mutex); if (req->size > sizeof(dev->buf)) { dev_err(&d->intf->dev, "too large message %u\n", req->size); ret = -EINVAL; goto err_mutex_unlock; } if (req->index & CMD_WR_FLAG) { /* write */ memcpy(dev->buf, req->data, req->size); requesttype = (USB_TYPE_VENDOR | USB_DIR_OUT); pipe = usb_sndctrlpipe(d->udev, 0); } else { /* read */ requesttype = (USB_TYPE_VENDOR | USB_DIR_IN); pipe = usb_rcvctrlpipe(d->udev, 0); } ret = usb_control_msg(d->udev, pipe, 0, requesttype, req->value, req->index, dev->buf, req->size, 1000); <API key>(d->udev, 0, requesttype, req->value, req->index, dev->buf, req->size); if (ret < 0) goto err_mutex_unlock; /* read request, copy returned data to return buf */ if (requesttype == (USB_TYPE_VENDOR | USB_DIR_IN)) memcpy(req->data, dev->buf, req->size); mutex_unlock(&d->usb_mutex); return 0; err_mutex_unlock: mutex_unlock(&d->usb_mutex); dev_dbg(&d->intf->dev, "failed=%d\n", ret); return ret; } static int rtl28xxu_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) { struct rtl28xxu_req req; if (reg < 0x3000) req.index = CMD_USB_WR; else if (reg < 0x4000) req.index = CMD_SYS_WR; else req.index = CMD_IR_WR; req.value = reg; req.size = len; req.data = val; return rtl28xxu_ctrl_msg(d, &req); } static int rtl28xxu_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) { struct rtl28xxu_req req; if (reg < 0x3000) req.index = CMD_USB_RD; else if (reg < 0x4000) req.index = CMD_SYS_RD; else req.index = CMD_IR_RD; req.value = reg; req.size = len; req.data = val; return rtl28xxu_ctrl_msg(d, &req); } static int rtl28xxu_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val) { return rtl28xxu_wr_regs(d, reg, &val, 1); } static int rtl28xxu_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val) { return rtl28xxu_rd_regs(d, reg, val, 1); } static int <API key>(struct dvb_usb_device *d, u16 reg, u8 val, u8 mask) { int ret; u8 tmp; /* no need for read if whole reg is written */ if (mask != 0xff) { ret = rtl28xxu_rd_reg(d, reg, &tmp); if (ret) return ret; val &= mask; tmp &= ~mask; val |= tmp; } return rtl28xxu_wr_reg(d, reg, val); } /* I2C */ static int rtl28xxu_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num) { int ret; struct dvb_usb_device *d = i2c_get_adapdata(adap); struct rtl28xxu_dev *dev = d->priv; struct rtl28xxu_req req; /* * It is not known which are real I2C bus xfer limits, but testing * with RTL2831U + MT2060 gives max RD 24 and max WR 22 bytes. * TODO: find out RTL2832U lens */ /* * I2C adapter logic looks rather complicated due to fact it handles * three different access methods. Those methods are; * 1) integrated demod access * 2) old I2C access * 3) new I2C access * * Used method is selected in order 1, 2, 3. Method 3 can handle all * requests but there is two reasons why not use it always; * 1) It is most expensive, usually two USB messages are needed * 2) At least RTL2831U does not support it * * Method 3 is needed in case of I2C write+read (typical register read) * where write is more than one byte. */ if (<API key>(&d->i2c_mutex) < 0) return -EAGAIN; if (num == 2 && !(msg[0].flags & I2C_M_RD) && (msg[1].flags & I2C_M_RD)) { if (msg[0].len > 24 || msg[1].len > 24) { /* TODO: check msg[0].len max */ ret = -EOPNOTSUPP; goto err_mutex_unlock; } else if (msg[0].addr == 0x10) { /* method 1 - integrated demod */ if (msg[0].buf[0] == 0x00) { /* return demod page from driver cache */ msg[1].buf[0] = dev->page; ret = 0; } else { req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1); req.index = CMD_DEMOD_RD | dev->page; req.size = msg[1].len; req.data = &msg[1].buf[0]; ret = rtl28xxu_ctrl_msg(d, &req); } } else if (msg[0].len < 2) { /* method 2 - old I2C */ req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1); req.index = CMD_I2C_RD; req.size = msg[1].len; req.data = &msg[1].buf[0]; ret = rtl28xxu_ctrl_msg(d, &req); } else { /* method 3 - new I2C */ req.value = (msg[0].addr << 1); req.index = CMD_I2C_DA_WR; req.size = msg[0].len; req.data = msg[0].buf; ret = rtl28xxu_ctrl_msg(d, &req); if (ret) goto err_mutex_unlock; req.value = (msg[0].addr << 1); req.index = CMD_I2C_DA_RD; req.size = msg[1].len; req.data = msg[1].buf; ret = rtl28xxu_ctrl_msg(d, &req); } } else if (num == 1 && !(msg[0].flags & I2C_M_RD)) { if (msg[0].len > 22) { /* TODO: check msg[0].len max */ ret = -EOPNOTSUPP; goto err_mutex_unlock; } else if (msg[0].addr == 0x10) { /* method 1 - integrated demod */ if (msg[0].buf[0] == 0x00) { /* save demod page for later demod access */ dev->page = msg[0].buf[1]; ret = 0; } else { req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1); req.index = CMD_DEMOD_WR | dev->page; req.size = msg[0].len-1; req.data = &msg[0].buf[1]; ret = rtl28xxu_ctrl_msg(d, &req); } } else if ((msg[0].len < 23) && (!dev->new_i2c_write)) { /* method 2 - old I2C */ req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1); req.index = CMD_I2C_WR; req.size = msg[0].len-1; req.data = &msg[0].buf[1]; ret = rtl28xxu_ctrl_msg(d, &req); } else { /* method 3 - new I2C */ req.value = (msg[0].addr << 1); req.index = CMD_I2C_DA_WR; req.size = msg[0].len; req.data = msg[0].buf; ret = rtl28xxu_ctrl_msg(d, &req); } } else if (num == 1 && (msg[0].flags & I2C_M_RD)) { req.value = (msg[0].addr << 1); req.index = CMD_I2C_DA_RD; req.size = msg[0].len; req.data = msg[0].buf; ret = rtl28xxu_ctrl_msg(d, &req); } else { ret = -EOPNOTSUPP; } /* Retry failed I2C messages */ if (ret == -EPIPE) ret = -EAGAIN; err_mutex_unlock: mutex_unlock(&d->i2c_mutex); return ret ? ret : num; } static u32 rtl28xxu_i2c_func(struct i2c_adapter *adapter) { return I2C_FUNC_I2C; } static struct i2c_algorithm rtl28xxu_i2c_algo = { .master_xfer = rtl28xxu_i2c_xfer, .functionality = rtl28xxu_i2c_func, }; static int <API key>(struct dvb_usb_device *d) { struct rtl28xxu_dev *dev = d_to_priv(d); int ret; u8 buf[1]; /* open RTL2831U/RTL2830 I2C gate */ struct rtl28xxu_req req_gate_open = {0x0120, 0x0011, 0x0001, "\x08"}; /* tuner probes */ struct rtl28xxu_req req_mt2060 = {0x00c0, CMD_I2C_RD, 1, buf}; struct rtl28xxu_req req_qt1010 = {0x0fc4, CMD_I2C_RD, 1, buf}; dev_dbg(&d->intf->dev, "\n"); /* GPIO direction */ ret = rtl28xxu_wr_reg(d, SYS_GPIO_DIR, 0x0a); if (ret) goto err; /* enable as output GPIO0, GPIO2, GPIO4 */ ret = rtl28xxu_wr_reg(d, SYS_GPIO_OUT_EN, 0x15); if (ret) goto err; /* * Probe used tuner. We need to know used tuner before demod attach * since there is some demod params needed to set according to tuner. */ /* demod needs some time to wake up */ msleep(20); dev->tuner_name = "NONE"; /* open demod I2C gate */ ret = rtl28xxu_ctrl_msg(d, &req_gate_open); if (ret) goto err; /* check QT1010 ID(?) register; reg=0f val=2c */ ret = rtl28xxu_ctrl_msg(d, &req_qt1010); if (ret == 0 && buf[0] == 0x2c) { dev->tuner = <API key>; dev->tuner_name = "QT1010"; goto found; } /* open demod I2C gate */ ret = rtl28xxu_ctrl_msg(d, &req_gate_open); if (ret) goto err; /* check MT2060 ID register; reg=00 val=63 */ ret = rtl28xxu_ctrl_msg(d, &req_mt2060); if (ret == 0 && buf[0] == 0x63) { dev->tuner = <API key>; dev->tuner_name = "MT2060"; goto found; } /* assume MXL5005S */ dev->tuner = <API key>; dev->tuner_name = "MXL5005S"; goto found; found: dev_dbg(&d->intf->dev, "tuner=%s\n", dev->tuner_name); return 0; err: dev_dbg(&d->intf->dev, "failed=%d\n", ret); return ret; } static int <API key>(struct dvb_usb_device *d) { struct rtl28xxu_dev *dev = d_to_priv(d); int ret; u8 buf[2]; /* open RTL2832U/RTL2832 I2C gate */ struct rtl28xxu_req req_gate_open = {0x0120, 0x0011, 0x0001, "\x18"}; /* close RTL2832U/RTL2832 I2C gate */ struct rtl28xxu_req req_gate_close = {0x0120, 0x0011, 0x0001, "\x10"}; /* tuner probes */ struct rtl28xxu_req req_fc0012 = {0x00c6, CMD_I2C_RD, 1, buf}; struct rtl28xxu_req req_fc0013 = {0x00c6, CMD_I2C_RD, 1, buf}; struct rtl28xxu_req req_mt2266 = {0x00c0, CMD_I2C_RD, 1, buf}; struct rtl28xxu_req req_fc2580 = {0x01ac, CMD_I2C_RD, 1, buf}; struct rtl28xxu_req req_mt2063 = {0x00c0, CMD_I2C_RD, 1, buf}; struct rtl28xxu_req req_max3543 = {0x00c0, CMD_I2C_RD, 1, buf}; struct rtl28xxu_req req_tua9001 = {0x7ec0, CMD_I2C_RD, 2, buf}; struct rtl28xxu_req req_mxl5007t = {0xd9c0, CMD_I2C_RD, 1, buf}; struct rtl28xxu_req req_e4000 = {0x02c8, CMD_I2C_RD, 1, buf}; struct rtl28xxu_req req_tda18272 = {0x00c0, CMD_I2C_RD, 2, buf}; struct rtl28xxu_req req_r820t = {0x0034, CMD_I2C_RD, 1, buf}; struct rtl28xxu_req req_r828d = {0x0074, CMD_I2C_RD, 1, buf}; struct rtl28xxu_req req_mn88472 = {0xff38, CMD_I2C_RD, 1, buf}; struct rtl28xxu_req req_mn88473 = {0xff38, CMD_I2C_RD, 1, buf}; struct rtl28xxu_req req_cxd2837er = {0xfdd8, CMD_I2C_RD, 1, buf}; struct rtl28xxu_req req_si2157 = {0x00c0, CMD_I2C_RD, 1, buf}; struct rtl28xxu_req req_si2168 = {0x00c8, CMD_I2C_RD, 1, buf}; dev_dbg(&d->intf->dev, "\n"); /* enable GPIO3 and GPIO6 as output */ ret = <API key>(d, SYS_GPIO_DIR, 0x00, 0x40); if (ret) goto err; ret = <API key>(d, SYS_GPIO_OUT_EN, 0x48, 0x48); if (ret) goto err; /* * Probe used tuner. We need to know used tuner before demod attach * since there is some demod params needed to set according to tuner. */ /* open demod I2C gate */ ret = rtl28xxu_ctrl_msg(d, &req_gate_open); if (ret) goto err; dev->tuner_name = "NONE"; /* check FC0012 ID register; reg=00 val=a1 */ ret = rtl28xxu_ctrl_msg(d, &req_fc0012); if (ret == 0 && buf[0] == 0xa1) { dev->tuner = <API key>; dev->tuner_name = "FC0012"; goto tuner_found; } /* check FC0013 ID register; reg=00 val=a3 */ ret = rtl28xxu_ctrl_msg(d, &req_fc0013); if (ret == 0 && buf[0] == 0xa3) { dev->tuner = <API key>; dev->tuner_name = "FC0013"; goto tuner_found; } /* check MT2266 ID register; reg=00 val=85 */ ret = rtl28xxu_ctrl_msg(d, &req_mt2266); if (ret == 0 && buf[0] == 0x85) { dev->tuner = <API key>; dev->tuner_name = "MT2266"; goto tuner_found; } /* check FC2580 ID register; reg=01 val=56 */ ret = rtl28xxu_ctrl_msg(d, &req_fc2580); if (ret == 0 && buf[0] == 0x56) { dev->tuner = <API key>; dev->tuner_name = "FC2580"; goto tuner_found; } /* check MT2063 ID register; reg=00 val=9e || 9c */ ret = rtl28xxu_ctrl_msg(d, &req_mt2063); if (ret == 0 && (buf[0] == 0x9e || buf[0] == 0x9c)) { dev->tuner = <API key>; dev->tuner_name = "MT2063"; goto tuner_found; } /* check MAX3543 ID register; reg=00 val=38 */ ret = rtl28xxu_ctrl_msg(d, &req_max3543); if (ret == 0 && buf[0] == 0x38) { dev->tuner = <API key>; dev->tuner_name = "MAX3543"; goto tuner_found; } /* check TUA9001 ID register; reg=7e val=2328 */ ret = rtl28xxu_ctrl_msg(d, &req_tua9001); if (ret == 0 && buf[0] == 0x23 && buf[1] == 0x28) { dev->tuner = <API key>; dev->tuner_name = "TUA9001"; goto tuner_found; } /* check MXL5007R ID register; reg=d9 val=14 */ ret = rtl28xxu_ctrl_msg(d, &req_mxl5007t); if (ret == 0 && buf[0] == 0x14) { dev->tuner = <API key>; dev->tuner_name = "MXL5007T"; goto tuner_found; } /* check E4000 ID register; reg=02 val=40 */ ret = rtl28xxu_ctrl_msg(d, &req_e4000); if (ret == 0 && buf[0] == 0x40) { dev->tuner = TUNER_RTL2832_E4000; dev->tuner_name = "E4000"; goto tuner_found; } /* check TDA18272 ID register; reg=00 val=c760 */ ret = rtl28xxu_ctrl_msg(d, &req_tda18272); if (ret == 0 && (buf[0] == 0xc7 || buf[1] == 0x60)) { dev->tuner = <API key>; dev->tuner_name = "TDA18272"; goto tuner_found; } /* check R820T ID register; reg=00 val=69 */ ret = rtl28xxu_ctrl_msg(d, &req_r820t); if (ret == 0 && buf[0] == 0x69) { dev->tuner = TUNER_RTL2832_R820T; dev->tuner_name = "R820T"; goto tuner_found; } /* check R828D ID register; reg=00 val=69 */ ret = rtl28xxu_ctrl_msg(d, &req_r828d); if (ret == 0 && buf[0] == 0x69) { dev->tuner = TUNER_RTL2832_R828D; dev->tuner_name = "R828D"; goto tuner_found; } /* GPIO0 and GPIO5 to reset Si2157/Si2168 tuner and demod */ ret = <API key>(d, SYS_GPIO_OUT_VAL, 0x00, 0x21); if (ret) goto err; ret = <API key>(d, SYS_GPIO_OUT_EN, 0x00, 0x21); if (ret) goto err; msleep(50); ret = <API key>(d, SYS_GPIO_OUT_VAL, 0x21, 0x21); if (ret) goto err; ret = <API key>(d, SYS_GPIO_OUT_EN, 0x21, 0x21); if (ret) goto err; msleep(50); /* check Si2157 ID register; reg=c0 val=80 */ ret = rtl28xxu_ctrl_msg(d, &req_si2157); if (ret == 0 && ((buf[0] & 0x80) == 0x80)) { dev->tuner = <API key>; dev->tuner_name = "SI2157"; goto tuner_found; } tuner_found: dev_dbg(&d->intf->dev, "tuner=%s\n", dev->tuner_name); /* probe slave demod */ if (dev->tuner == TUNER_RTL2832_R828D) { /* power off slave demod on GPIO0 to reset CXD2837ER */ ret = <API key>(d, SYS_GPIO_OUT_VAL, 0x00, 0x01); if (ret) goto err; ret = <API key>(d, SYS_GPIO_OUT_EN, 0x00, 0x01); if (ret) goto err; msleep(50); /* power on slave demod on GPIO0 */ ret = <API key>(d, SYS_GPIO_OUT_VAL, 0x01, 0x01); if (ret) goto err; ret = <API key>(d, SYS_GPIO_DIR, 0x00, 0x01); if (ret) goto err; ret = <API key>(d, SYS_GPIO_OUT_EN, 0x01, 0x01); if (ret) goto err; /* check slave answers */ ret = rtl28xxu_ctrl_msg(d, &req_mn88472); if (ret == 0 && buf[0] == 0x02) { dev_dbg(&d->intf->dev, "MN88472 found\n"); dev->slave_demod = SLAVE_DEMOD_MN88472; goto demod_found; } ret = rtl28xxu_ctrl_msg(d, &req_mn88473); if (ret == 0 && buf[0] == 0x03) { dev_dbg(&d->intf->dev, "MN88473 found\n"); dev->slave_demod = SLAVE_DEMOD_MN88473; goto demod_found; } ret = rtl28xxu_ctrl_msg(d, &req_cxd2837er); if (ret == 0 && buf[0] == 0xb1) { dev_dbg(&d->intf->dev, "CXD2837ER found\n"); dev->slave_demod = <API key>; goto demod_found; } } if (dev->tuner == <API key>) { /* check Si2168 ID register; reg=c8 val=80 */ ret = rtl28xxu_ctrl_msg(d, &req_si2168); if (ret == 0 && ((buf[0] & 0x80) == 0x80)) { dev_dbg(&d->intf->dev, "Si2168 found\n"); dev->slave_demod = SLAVE_DEMOD_SI2168; goto demod_found; } } demod_found: /* close demod I2C gate */ ret = rtl28xxu_ctrl_msg(d, &req_gate_close); if (ret < 0) goto err; return 0; err: dev_dbg(&d->intf->dev, "failed=%d\n", ret); return ret; } static int <API key>(struct dvb_usb_device *d) { struct rtl28xxu_dev *dev = d_to_priv(d); if (dev->chip_id == CHIP_ID_RTL2831U) return <API key>(d); else return <API key>(d); } static int <API key>(struct dvb_usb_device *d, const char **name) { struct rtl28xxu_dev *dev = d_to_priv(d); int ret; struct rtl28xxu_req req_demod_i2c = {0x0020, CMD_I2C_DA_RD, 0, NULL}; dev_dbg(&d->intf->dev, "\n"); /* * Detect chip type using I2C command that is not supported * by old RTL2831U. */ ret = rtl28xxu_ctrl_msg(d, &req_demod_i2c); if (ret == -EPIPE) { dev->chip_id = CHIP_ID_RTL2831U; } else if (ret == 0) { dev->chip_id = CHIP_ID_RTL2832U; } else { dev_err(&d->intf->dev, "chip type detection failed %d\n", ret); goto err; } dev_dbg(&d->intf->dev, "chip_id=%u\n", dev->chip_id); /* Retry failed I2C messages */ d->i2c_adap.retries = 3; d->i2c_adap.timeout = msecs_to_jiffies(10); return WARM; err: dev_dbg(&d->intf->dev, "failed=%d\n", ret); return ret; } static const struct <API key> <API key> = { .clk = 28800000, .spec_inv = 1, .vtop = 0x20, .krf = 0x04, .agc_targ_val = 0x2d, }; static const struct <API key> <API key> = { .clk = 28800000, .spec_inv = 1, .vtop = 0x20, .krf = 0x04, .agc_targ_val = 0x2d, }; static const struct <API key> <API key> = { .clk = 28800000, .spec_inv = 0, .vtop = 0x3f, .krf = 0x04, .agc_targ_val = 0x3e, }; static int <API key>(struct dvb_usb_adapter *adap) { struct dvb_usb_device *d = adap_to_d(adap); struct rtl28xxu_dev *dev = d_to_priv(d); struct <API key> *pdata = &dev-><API key>; struct i2c_board_info board_info; struct i2c_client *client; int ret; dev_dbg(&d->intf->dev, "\n"); switch (dev->tuner) { case <API key>: *pdata = <API key>; break; case <API key>: *pdata = <API key>; break; case <API key>: *pdata = <API key>; break; default: dev_err(&d->intf->dev, "unknown tuner %s\n", dev->tuner_name); ret = -ENODEV; goto err; } /* attach demodulator */ memset(&board_info, 0, sizeof(board_info)); strscpy(board_info.type, "rtl2830", I2C_NAME_SIZE); board_info.addr = 0x10; board_info.platform_data = pdata; request_module("%s", board_info.type); client = i2c_new_device(&d->i2c_adap, &board_info); if (client == NULL || client->dev.driver == NULL) { ret = -ENODEV; goto err; } if (!try_module_get(client->dev.driver->owner)) { <API key>(client); ret = -ENODEV; goto err; } adap->fe[0] = pdata->get_dvb_frontend(client); dev->demod_i2c_adapter = pdata->get_i2c_adapter(client); dev->i2c_client_demod = client; return 0; err: dev_dbg(&d->intf->dev, "failed=%d\n", ret); return ret; } static const struct <API key> <API key> = { .clk = 28800000, .tuner = <API key>, }; static const struct <API key> <API key> = { .clk = 28800000, .tuner = <API key> }; static const struct <API key> <API key> = { .clk = 28800000, .tuner = <API key> }; static const struct <API key> <API key> = { .clk = 28800000, .tuner = <API key>, }; static const struct <API key> <API key> = { .clk = 28800000, .tuner = TUNER_RTL2832_E4000, }; static const struct <API key> <API key> = { .clk = 28800000, .tuner = TUNER_RTL2832_R820T, }; static const struct <API key> <API key> = { .clk = 28800000, .tuner = <API key>, }; static int <API key>(struct dvb_usb_device *d, int cmd, int arg) { int ret; u8 val; dev_dbg(&d->intf->dev, "cmd=%d arg=%d\n", cmd, arg); switch (cmd) { case <API key>: /* set output values */ ret = rtl28xxu_rd_reg(d, SYS_GPIO_OUT_VAL, &val); if (ret) goto err; if (arg) val &= 0xbf; /* set GPIO6 low */ else val |= 0x40; /* set GPIO6 high */ ret = rtl28xxu_wr_reg(d, SYS_GPIO_OUT_VAL, val); if (ret) goto err; break; default: ret = -EINVAL; goto err; } return 0; err: dev_dbg(&d->intf->dev, "failed=%d\n", ret); return ret; } static int <API key>(struct dvb_usb_device *d, int cmd, int arg) { int ret; u8 val; dev_dbg(&d->intf->dev, "cmd=%d arg=%d\n", cmd, arg); /* * CEN always enabled by hardware wiring * RESETN GPIO4 * RXEN GPIO1 */ switch (cmd) { case TUA9001_CMD_RESETN: if (arg) val = (1 << 4); else val = (0 << 4); ret = <API key>(d, SYS_GPIO_OUT_VAL, val, 0x10); if (ret) goto err; break; case TUA9001_CMD_RXEN: if (arg) val = (1 << 1); else val = (0 << 1); ret = <API key>(d, SYS_GPIO_OUT_VAL, val, 0x02); if (ret) goto err; break; } return 0; err: dev_dbg(&d->intf->dev, "failed=%d\n", ret); return ret; } static int <API key>(void *adapter_priv, int component, int cmd, int arg) { struct i2c_adapter *adapter = adapter_priv; struct device *parent = adapter->dev.parent; struct i2c_adapter *parent_adapter; struct dvb_usb_device *d; struct rtl28xxu_dev *dev; /* * All tuners are connected to demod muxed I2C adapter. We have to * resolve its parent adapter in order to get handle for this driver * private data. That is a bit hackish solution, GPIO or direct driver * callback would be better... */ if (parent != NULL && parent->type == &i2c_adapter_type) parent_adapter = to_i2c_adapter(parent); else return -EINVAL; d = i2c_get_adapdata(parent_adapter); dev = d->priv; dev_dbg(&d->intf->dev, "component=%d cmd=%d arg=%d\n", component, cmd, arg); switch (component) { case <API key>: switch (dev->tuner) { case <API key>: return <API key>(d, cmd, arg); case <API key>: return <API key>(d, cmd, arg); } } return 0; } static int <API key>(struct dvb_usb_adapter *adap) { struct dvb_usb_device *d = adap_to_d(adap); struct rtl28xxu_dev *dev = d_to_priv(d); struct <API key> *pdata = &dev-><API key>; struct i2c_board_info board_info; struct i2c_client *client; int ret; dev_dbg(&d->intf->dev, "\n"); switch (dev->tuner) { case <API key>: *pdata = <API key>; break; case <API key>: *pdata = <API key>; break; case <API key>: *pdata = <API key>; break; case <API key>: *pdata = <API key>; break; case TUNER_RTL2832_E4000: *pdata = <API key>; break; case TUNER_RTL2832_R820T: case TUNER_RTL2832_R828D: *pdata = <API key>; break; case <API key>: *pdata = <API key>; break; default: dev_err(&d->intf->dev, "unknown tuner %s\n", dev->tuner_name); ret = -ENODEV; goto err; } /* attach demodulator */ memset(&board_info, 0, sizeof(board_info)); strscpy(board_info.type, "rtl2832", I2C_NAME_SIZE); board_info.addr = 0x10; board_info.platform_data = pdata; request_module("%s", board_info.type); client = i2c_new_device(&d->i2c_adap, &board_info); if (client == NULL || client->dev.driver == NULL) { ret = -ENODEV; goto err; } if (!try_module_get(client->dev.driver->owner)) { <API key>(client); ret = -ENODEV; goto err; } adap->fe[0] = pdata->get_dvb_frontend(client); dev->demod_i2c_adapter = pdata->get_i2c_adapter(client); dev->i2c_client_demod = client; /* set fe callback */ adap->fe[0]->callback = <API key>; if (dev->slave_demod) { struct i2c_board_info info = {}; /* * We continue on reduced mode, without DVB-T2/C, using master * demod, when slave demod fails. */ ret = 0; /* attach slave demodulator */ if (dev->slave_demod == SLAVE_DEMOD_MN88472) { struct mn88472_config mn88472_config = {}; mn88472_config.fe = &adap->fe[1]; mn88472_config.i2c_wr_max = 22, strscpy(info.type, "mn88472", I2C_NAME_SIZE); mn88472_config.xtal = 20500000; mn88472_config.ts_mode = SERIAL_TS_MODE; mn88472_config.ts_clock = VARIABLE_TS_CLOCK; info.addr = 0x18; info.platform_data = &mn88472_config; request_module(info.type); client = i2c_new_device(&d->i2c_adap, &info); if (client == NULL || client->dev.driver == NULL) { dev->slave_demod = SLAVE_DEMOD_NONE; goto <API key>; } if (!try_module_get(client->dev.driver->owner)) { <API key>(client); dev->slave_demod = SLAVE_DEMOD_NONE; goto <API key>; } dev-><API key> = client; } else if (dev->slave_demod == SLAVE_DEMOD_MN88473) { struct mn88473_config mn88473_config = {}; mn88473_config.fe = &adap->fe[1]; mn88473_config.i2c_wr_max = 22, strscpy(info.type, "mn88473", I2C_NAME_SIZE); info.addr = 0x18; info.platform_data = &mn88473_config; request_module(info.type); client = i2c_new_device(&d->i2c_adap, &info); if (client == NULL || client->dev.driver == NULL) { dev->slave_demod = SLAVE_DEMOD_NONE; goto <API key>; } if (!try_module_get(client->dev.driver->owner)) { <API key>(client); dev->slave_demod = SLAVE_DEMOD_NONE; goto <API key>; } dev-><API key> = client; } else if (dev->slave_demod == <API key>) { struct cxd2841er_config cxd2837er_config = {}; cxd2837er_config.i2c_addr = 0xd8; cxd2837er_config.xtal = SONY_XTAL_20500; cxd2837er_config.flags = (CXD2841ER_AUTO_IFHZ | CXD2841ER_NO_AGCNEG | CXD2841ER_TSBITS | <API key> | CXD2841ER_TS_SERIAL); adap->fe[1] = dvb_attach(<API key>, &cxd2837er_config, &d->i2c_adap); if (!adap->fe[1]) { dev->slave_demod = SLAVE_DEMOD_NONE; goto <API key>; } adap->fe[1]->id = 1; dev-><API key> = NULL; } else { struct si2168_config si2168_config = {}; struct i2c_adapter *adapter; si2168_config.i2c_adapter = &adapter; si2168_config.fe = &adap->fe[1]; si2168_config.ts_mode = SI2168_TS_SERIAL; si2168_config.ts_clock_inv = false; si2168_config.ts_clock_gapped = true; strscpy(info.type, "si2168", I2C_NAME_SIZE); info.addr = 0x64; info.platform_data = &si2168_config; request_module(info.type); client = i2c_new_device(&d->i2c_adap, &info); if (client == NULL || client->dev.driver == NULL) { dev->slave_demod = SLAVE_DEMOD_NONE; goto <API key>; } if (!try_module_get(client->dev.driver->owner)) { <API key>(client); dev->slave_demod = SLAVE_DEMOD_NONE; goto <API key>; } dev-><API key> = client; /* for Si2168 devices use only new I2C write method */ dev->new_i2c_write = true; } } return 0; <API key>: err: dev_dbg(&d->intf->dev, "failed=%d\n", ret); return ret; } static int <API key>(struct dvb_usb_adapter *adap) { struct rtl28xxu_dev *dev = adap_to_priv(adap); if (dev->chip_id == CHIP_ID_RTL2831U) return <API key>(adap); else return <API key>(adap); } static int <API key>(struct dvb_usb_adapter *adap) { struct dvb_usb_device *d = adap_to_d(adap); struct rtl28xxu_dev *dev = d_to_priv(d); struct i2c_client *client; dev_dbg(&d->intf->dev, "\n"); /* remove I2C slave demod */ client = dev-><API key>; if (client) { module_put(client->dev.driver->owner); <API key>(client); } /* remove I2C demod */ client = dev->i2c_client_demod; if (client) { module_put(client->dev.driver->owner); <API key>(client); } return 0; } static struct qt1010_config <API key> = { .i2c_address = 0x62, /* 0xc4 */ }; static struct mt2060_config <API key> = { .i2c_address = 0x60, /* 0xc0 */ .clock_out = 0, }; static struct mxl5005s_config <API key> = { .i2c_address = 0x63, /* 0xc6 */ .if_freq = IF_FREQ_4570000HZ, .xtal_freq = <API key>, .agc_mode = MXL_SINGLE_AGC, .tracking_filter = MXL_TF_C_H, .rssi_enable = MXL_RSSI_ENABLE, .cap_select = MXL_CAP_SEL_ENABLE, .div_out = MXL_DIV_OUT_4, .clock_out = <API key>, .output_load = <API key>, .top = MXL5005S_TOP_25P2, .mod_mode = MXL_DIGITAL_MODE, .if_mode = MXL_ZERO_IF, .AgcMasterByte = 0x00, }; static int <API key>(struct dvb_usb_adapter *adap) { int ret; struct dvb_usb_device *d = adap_to_d(adap); struct rtl28xxu_dev *dev = d_to_priv(d); struct dvb_frontend *fe; dev_dbg(&d->intf->dev, "\n"); switch (dev->tuner) { case <API key>: fe = dvb_attach(qt1010_attach, adap->fe[0], dev->demod_i2c_adapter, &<API key>); break; case <API key>: fe = dvb_attach(mt2060_attach, adap->fe[0], dev->demod_i2c_adapter, &<API key>, 1220); break; case <API key>: fe = dvb_attach(mxl5005s_attach, adap->fe[0], dev->demod_i2c_adapter, &<API key>); break; default: fe = NULL; dev_err(&d->intf->dev, "unknown tuner %d\n", dev->tuner); } if (fe == NULL) { ret = -ENODEV; goto err; } return 0; err: dev_dbg(&d->intf->dev, "failed=%d\n", ret); return ret; } static const struct fc0012_config <API key> = { .i2c_address = 0x63, /* 0xc6 >> 1 */ .xtal_freq = FC_XTAL_28_8_MHZ, }; static const struct r820t_config <API key> = { .i2c_addr = 0x1a, .xtal = 28800000, .max_i2c_msg_len = 2, .rafael_chip = CHIP_R820T, }; static const struct r820t_config <API key> = { .i2c_addr = 0x3a, .xtal = 16000000, .max_i2c_msg_len = 2, .rafael_chip = CHIP_R828D, }; static int <API key>(struct dvb_usb_adapter *adap) { int ret; struct dvb_usb_device *d = adap_to_d(adap); struct rtl28xxu_dev *dev = d_to_priv(d); struct dvb_frontend *fe = NULL; struct i2c_board_info info; struct i2c_client *client; struct v4l2_subdev *subdev = NULL; struct platform_device *pdev; struct <API key> pdata; dev_dbg(&d->intf->dev, "\n"); memset(&info, 0, sizeof(struct i2c_board_info)); memset(&pdata, 0, sizeof(pdata)); switch (dev->tuner) { case <API key>: fe = dvb_attach(fc0012_attach, adap->fe[0], dev->demod_i2c_adapter, &<API key>); /* since fc0012 includs reading the signal strength delegate * that to the tuner driver */ adap->fe[0]->ops.<API key> = adap->fe[0]->ops.tuner_ops.get_rf_strength; break; case <API key>: fe = dvb_attach(fc0013_attach, adap->fe[0], dev->demod_i2c_adapter, 0xc6>>1, 0, FC_XTAL_28_8_MHZ); /* fc0013 also supports signal strength reading */ adap->fe[0]->ops.<API key> = adap->fe[0]->ops.tuner_ops.get_rf_strength; break; case TUNER_RTL2832_E4000: { struct e4000_config e4000_config = { .fe = adap->fe[0], .clock = 28800000, }; strscpy(info.type, "e4000", I2C_NAME_SIZE); info.addr = 0x64; info.platform_data = &e4000_config; request_module(info.type); client = i2c_new_device(dev->demod_i2c_adapter, &info); if (client == NULL || client->dev.driver == NULL) break; if (!try_module_get(client->dev.driver->owner)) { <API key>(client); break; } dev->i2c_client_tuner = client; subdev = i2c_get_clientdata(client); } break; case <API key>: { struct <API key> fc2580_pdata = { .dvb_frontend = adap->fe[0], }; struct i2c_board_info board_info = {}; strscpy(board_info.type, "fc2580", I2C_NAME_SIZE); board_info.addr = 0x56; board_info.platform_data = &fc2580_pdata; request_module("fc2580"); client = i2c_new_device(dev->demod_i2c_adapter, &board_info); if (client == NULL || client->dev.driver == NULL) break; if (!try_module_get(client->dev.driver->owner)) { <API key>(client); break; } dev->i2c_client_tuner = client; subdev = fc2580_pdata.get_v4l2_subdev(client); } break; case <API key>: { struct <API key> tua9001_pdata = { .dvb_frontend = adap->fe[0], }; struct i2c_board_info board_info = {}; /* enable GPIO1 and GPIO4 as output */ ret = <API key>(d, SYS_GPIO_DIR, 0x00, 0x12); if (ret) goto err; ret = <API key>(d, SYS_GPIO_OUT_EN, 0x12, 0x12); if (ret) goto err; strscpy(board_info.type, "tua9001", I2C_NAME_SIZE); board_info.addr = 0x60; board_info.platform_data = &tua9001_pdata; request_module("tua9001"); client = i2c_new_device(dev->demod_i2c_adapter, &board_info); if (client == NULL || client->dev.driver == NULL) break; if (!try_module_get(client->dev.driver->owner)) { <API key>(client); break; } dev->i2c_client_tuner = client; break; } case TUNER_RTL2832_R820T: fe = dvb_attach(r820t_attach, adap->fe[0], dev->demod_i2c_adapter, &<API key>); /* Use tuner to get the signal strength */ adap->fe[0]->ops.<API key> = adap->fe[0]->ops.tuner_ops.get_rf_strength; break; case TUNER_RTL2832_R828D: fe = dvb_attach(r820t_attach, adap->fe[0], dev->demod_i2c_adapter, &<API key>); adap->fe[0]->ops.<API key> = adap->fe[0]->ops.tuner_ops.get_rf_strength; if (adap->fe[1]) { fe = dvb_attach(r820t_attach, adap->fe[1], dev->demod_i2c_adapter, &<API key>); adap->fe[1]->ops.<API key> = adap->fe[1]->ops.tuner_ops.get_rf_strength; } break; case <API key>: { struct si2157_config si2157_config = { .fe = adap->fe[0], .if_port = 0, .inversion = false, }; strscpy(info.type, "si2157", I2C_NAME_SIZE); info.addr = 0x60; info.platform_data = &si2157_config; request_module(info.type); client = i2c_new_device(&d->i2c_adap, &info); if (client == NULL || client->dev.driver == NULL) break; if (!try_module_get(client->dev.driver->owner)) { <API key>(client); break; } dev->i2c_client_tuner = client; subdev = i2c_get_clientdata(client); /* copy tuner ops for 2nd FE as tuner is shared */ if (adap->fe[1]) { adap->fe[1]->tuner_priv = adap->fe[0]->tuner_priv; memcpy(&adap->fe[1]->ops.tuner_ops, &adap->fe[0]->ops.tuner_ops, sizeof(struct dvb_tuner_ops)); } } break; default: dev_err(&d->intf->dev, "unknown tuner %d\n", dev->tuner); } if (fe == NULL && dev->i2c_client_tuner == NULL) { ret = -ENODEV; goto err; } /* register SDR */ switch (dev->tuner) { case <API key>: case <API key>: case <API key>: case TUNER_RTL2832_E4000: case TUNER_RTL2832_R820T: case TUNER_RTL2832_R828D: pdata.clk = dev-><API key>.clk; pdata.tuner = dev->tuner; pdata.regmap = dev-><API key>.regmap; pdata.dvb_frontend = adap->fe[0]; pdata.dvb_usb_device = d; pdata.v4l2_subdev = subdev; request_module("%s", "rtl2832_sdr"); pdev = <API key>(&d->intf->dev, "rtl2832_sdr", PLATFORM_DEVID_AUTO, &pdata, sizeof(pdata)); if (IS_ERR(pdev) || pdev->dev.driver == NULL) break; dev->platform_device_sdr = pdev; break; default: dev_dbg(&d->intf->dev, "no SDR for tuner=%d\n", dev->tuner); } return 0; err: dev_dbg(&d->intf->dev, "failed=%d\n", ret); return ret; } static int <API key>(struct dvb_usb_adapter *adap) { struct rtl28xxu_dev *dev = adap_to_priv(adap); if (dev->chip_id == CHIP_ID_RTL2831U) return <API key>(adap); else return <API key>(adap); } static int <API key>(struct dvb_usb_adapter *adap) { struct dvb_usb_device *d = adap_to_d(adap); struct rtl28xxu_dev *dev = d_to_priv(d); struct i2c_client *client; struct platform_device *pdev; dev_dbg(&d->intf->dev, "\n"); /* remove platform SDR */ pdev = dev->platform_device_sdr; if (pdev) <API key>(pdev); /* remove I2C tuner */ client = dev->i2c_client_tuner; if (client) { module_put(client->dev.driver->owner); <API key>(client); } return 0; } static int rtl28xxu_init(struct dvb_usb_device *d) { int ret; u8 val; dev_dbg(&d->intf->dev, "\n"); /* init USB endpoints */ ret = rtl28xxu_rd_reg(d, USB_SYSCTL_0, &val); if (ret) goto err; /* enable DMA and Full Packet Mode*/ val |= 0x09; ret = rtl28xxu_wr_reg(d, USB_SYSCTL_0, val); if (ret) goto err; /* set EPA maximum packet size to 0x0200 */ ret = rtl28xxu_wr_regs(d, USB_EPA_MAXPKT, "\x00\x02\x00\x00", 4); if (ret) goto err; /* change EPA FIFO length */ ret = rtl28xxu_wr_regs(d, USB_EPA_FIFO_CFG, "\x14\x00\x00\x00", 4); if (ret) goto err; return ret; err: dev_dbg(&d->intf->dev, "failed=%d\n", ret); return ret; } static int rtl2831u_power_ctrl(struct dvb_usb_device *d, int onoff) { int ret; u8 gpio, sys0, epa_ctl[2]; dev_dbg(&d->intf->dev, "onoff=%d\n", onoff); /* demod adc */ ret = rtl28xxu_rd_reg(d, SYS_SYS0, &sys0); if (ret) goto err; /* tuner power, read GPIOs */ ret = rtl28xxu_rd_reg(d, SYS_GPIO_OUT_VAL, &gpio); if (ret) goto err; dev_dbg(&d->intf->dev, "RD SYS0=%02x GPIO_OUT_VAL=%02x\n", sys0, gpio); if (onoff) { gpio |= 0x01; /* GPIO0 = 1 */ gpio &= (~0x10); /* GPIO4 = 0 */ gpio |= 0x04; /* GPIO2 = 1, LED on */ sys0 = sys0 & 0x0f; sys0 |= 0xe0; epa_ctl[0] = 0x00; /* clear stall */ epa_ctl[1] = 0x00; /* clear reset */ } else { gpio &= (~0x01); /* GPIO0 = 0 */ gpio |= 0x10; /* GPIO4 = 1 */ gpio &= (~0x04); /* GPIO2 = 1, LED off */ sys0 = sys0 & (~0xc0); epa_ctl[0] = 0x10; /* set stall */ epa_ctl[1] = 0x02; /* set reset */ } dev_dbg(&d->intf->dev, "WR SYS0=%02x GPIO_OUT_VAL=%02x\n", sys0, gpio); /* demod adc */ ret = rtl28xxu_wr_reg(d, SYS_SYS0, sys0); if (ret) goto err; /* tuner power, write GPIOs */ ret = rtl28xxu_wr_reg(d, SYS_GPIO_OUT_VAL, gpio); if (ret) goto err; /* streaming EP: stall & reset */ ret = rtl28xxu_wr_regs(d, USB_EPA_CTL, epa_ctl, 2); if (ret) goto err; if (onoff) usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, 0x81)); return ret; err: dev_dbg(&d->intf->dev, "failed=%d\n", ret); return ret; } static int rtl2832u_power_ctrl(struct dvb_usb_device *d, int onoff) { int ret; dev_dbg(&d->intf->dev, "onoff=%d\n", onoff); if (onoff) { /* GPIO3=1, GPIO4=0 */ ret = <API key>(d, SYS_GPIO_OUT_VAL, 0x08, 0x18); if (ret) goto err; /* suspend? */ ret = <API key>(d, SYS_DEMOD_CTL1, 0x00, 0x10); if (ret) goto err; /* enable PLL */ ret = <API key>(d, SYS_DEMOD_CTL, 0x80, 0x80); if (ret) goto err; /* disable reset */ ret = <API key>(d, SYS_DEMOD_CTL, 0x20, 0x20); if (ret) goto err; /* streaming EP: clear stall & reset */ ret = rtl28xxu_wr_regs(d, USB_EPA_CTL, "\x00\x00", 2); if (ret) goto err; ret = usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, 0x81)); if (ret) goto err; } else { /* GPIO4=1 */ ret = <API key>(d, SYS_GPIO_OUT_VAL, 0x10, 0x10); if (ret) goto err; /* disable PLL */ ret = <API key>(d, SYS_DEMOD_CTL, 0x00, 0x80); if (ret) goto err; /* streaming EP: set stall & reset */ ret = rtl28xxu_wr_regs(d, USB_EPA_CTL, "\x10\x02", 2); if (ret) goto err; } return ret; err: dev_dbg(&d->intf->dev, "failed=%d\n", ret); return ret; } static int rtl28xxu_power_ctrl(struct dvb_usb_device *d, int onoff) { struct rtl28xxu_dev *dev = d_to_priv(d); if (dev->chip_id == CHIP_ID_RTL2831U) return rtl2831u_power_ctrl(d, onoff); else return rtl2832u_power_ctrl(d, onoff); } static int <API key>(struct dvb_frontend *fe, int onoff) { struct dvb_usb_device *d = fe_to_d(fe); struct rtl28xxu_dev *dev = fe_to_priv(fe); struct <API key> *pdata = &dev-><API key>; int ret; u8 val; dev_dbg(&d->intf->dev, "fe=%d onoff=%d\n", fe->id, onoff); if (dev->chip_id == CHIP_ID_RTL2831U) return 0; if (fe->id == 0) { /* control internal demod ADC */ if (onoff) val = 0x48; /* enable ADC */ else val = 0x00; /* disable ADC */ ret = <API key>(d, SYS_DEMOD_CTL, val, 0x48); if (ret) goto err; } else if (fe->id == 1) { /* bypass slave demod TS through master demod */ ret = pdata->slave_ts_ctrl(dev->i2c_client_demod, onoff); if (ret) goto err; } return 0; err: dev_dbg(&d->intf->dev, "failed=%d\n", ret); return ret; } #if IS_ENABLED(CONFIG_RC_CORE) static int rtl2831u_rc_query(struct dvb_usb_device *d) { int ret, i; struct rtl28xxu_dev *dev = d->priv; u8 buf[5]; u32 rc_code; static const struct rtl28xxu_reg_val rc_nec_tab[] = { { 0x3033, 0x80 }, { 0x3020, 0x43 }, { 0x3021, 0x16 }, { 0x3022, 0x16 }, { 0x3023, 0x5a }, { 0x3024, 0x2d }, { 0x3025, 0x16 }, { 0x3026, 0x01 }, { 0x3028, 0xb0 }, { 0x3029, 0x04 }, { 0x302c, 0x88 }, { 0x302e, 0x13 }, { 0x3030, 0xdf }, { 0x3031, 0x05 }, }; /* init remote controller */ if (!dev->rc_active) { for (i = 0; i < ARRAY_SIZE(rc_nec_tab); i++) { ret = rtl28xxu_wr_reg(d, rc_nec_tab[i].reg, rc_nec_tab[i].val); if (ret) goto err; } dev->rc_active = true; } ret = rtl28xxu_rd_regs(d, SYS_IRRC_RP, buf, 5); if (ret) goto err; if (buf[4] & 0x01) { enum rc_proto proto; if (buf[2] == (u8) ~buf[3]) { if (buf[0] == (u8) ~buf[1]) { /* NEC standard (16 bit) */ rc_code = RC_SCANCODE_NEC(buf[0], buf[2]); proto = RC_PROTO_NEC; } else { /* NEC extended (24 bit) */ rc_code = RC_SCANCODE_NECX(buf[0] << 8 | buf[1], buf[2]); proto = RC_PROTO_NECX; } } else { /* NEC full (32 bit) */ rc_code = RC_SCANCODE_NEC32(buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3]); proto = RC_PROTO_NEC32; } rc_keydown(d->rc_dev, proto, rc_code, 0); ret = rtl28xxu_wr_reg(d, SYS_IRRC_SR, 1); if (ret) goto err; /* repeated intentionally to avoid extra keypress */ ret = rtl28xxu_wr_reg(d, SYS_IRRC_SR, 1); if (ret) goto err; } return ret; err: dev_dbg(&d->intf->dev, "failed=%d\n", ret); return ret; } static int <API key>(struct dvb_usb_device *d, struct dvb_usb_rc *rc) { rc->map_name = RC_MAP_EMPTY; rc->allowed_protos = RC_PROTO_BIT_NEC | RC_PROTO_BIT_NECX | RC_PROTO_BIT_NEC32; rc->query = rtl2831u_rc_query; rc->interval = 400; return 0; } static int rtl2832u_rc_query(struct dvb_usb_device *d) { int ret, i, len; struct rtl28xxu_dev *dev = d->priv; struct ir_raw_event ev = {}; u8 buf[128]; static const struct <API key> refresh_tab[] = { {IR_RX_IF, 0x03, 0xff}, {IR_RX_BUF_CTRL, 0x80, 0xff}, {IR_RX_CTRL, 0x80, 0xff}, }; /* init remote controller */ if (!dev->rc_active) { static const struct <API key> init_tab[] = { {SYS_DEMOD_CTL1, 0x00, 0x04}, {SYS_DEMOD_CTL1, 0x00, 0x08}, {USB_CTRL, 0x20, 0x20}, {SYS_GPIO_DIR, 0x00, 0x08}, {SYS_GPIO_OUT_EN, 0x08, 0x08}, {SYS_GPIO_OUT_VAL, 0x08, 0x08}, {IR_MAX_DURATION0, 0xd0, 0xff}, {IR_MAX_DURATION1, 0x07, 0xff}, {IR_IDLE_LEN0, 0xc0, 0xff}, {IR_IDLE_LEN1, 0x00, 0xff}, {IR_GLITCH_LEN, 0x03, 0xff}, {IR_RX_CLK, 0x09, 0xff}, {IR_RX_CFG, 0x1c, 0xff}, {IR_MAX_H_TOL_LEN, 0x1e, 0xff}, {IR_MAX_L_TOL_LEN, 0x1e, 0xff}, {IR_RX_CTRL, 0x80, 0xff}, }; for (i = 0; i < ARRAY_SIZE(init_tab); i++) { ret = <API key>(d, init_tab[i].reg, init_tab[i].val, init_tab[i].mask); if (ret) goto err; } dev->rc_active = true; } ret = rtl28xxu_rd_reg(d, IR_RX_IF, &buf[0]); if (ret) goto err; if (buf[0] != 0x83) goto exit; ret = rtl28xxu_rd_reg(d, IR_RX_BC, &buf[0]); if (ret || buf[0] > sizeof(buf)) goto err; len = buf[0]; /* read raw code from hw */ ret = rtl28xxu_rd_regs(d, IR_RX_BUF, buf, len); if (ret) goto err; /* let hw receive new code */ for (i = 0; i < ARRAY_SIZE(refresh_tab); i++) { ret = <API key>(d, refresh_tab[i].reg, refresh_tab[i].val, refresh_tab[i].mask); if (ret) goto err; } /* pass data to Kernel IR decoder */ for (i = 0; i < len; i++) { ev.pulse = buf[i] >> 7; ev.duration = 50800 * (buf[i] & 0x7f); <API key>(d->rc_dev, &ev); } /* 'flush' <API key>() */ <API key>(d->rc_dev, true); ir_raw_event_handle(d->rc_dev); exit: return ret; err: dev_dbg(&d->intf->dev, "failed=%d\n", ret); return ret; } static int <API key>(struct dvb_usb_device *d, struct dvb_usb_rc *rc) { /* disable IR interrupts in order to avoid SDR sample loss */ if (rtl28xxu_disable_rc) return rtl28xxu_wr_reg(d, IR_RX_IE, 0x00); /* load empty to enable rc */ if (!rc->map_name) rc->map_name = RC_MAP_EMPTY; rc->allowed_protos = <API key>; rc->driver_type = RC_DRIVER_IR_RAW; rc->query = rtl2832u_rc_query; rc->interval = 200; return 0; } static int <API key>(struct dvb_usb_device *d, struct dvb_usb_rc *rc) { struct rtl28xxu_dev *dev = d_to_priv(d); if (dev->chip_id == CHIP_ID_RTL2831U) return <API key>(d, rc); else return <API key>(d, rc); } #else #define <API key> NULL #endif static int <API key>(struct dvb_usb_adapter *adap, int onoff) { struct rtl28xxu_dev *dev = adap_to_priv(adap); if (dev->chip_id == CHIP_ID_RTL2831U) { struct <API key> *pdata = &dev-><API key>; return pdata->pid_filter_ctrl(adap->fe[0], onoff); } else { struct <API key> *pdata = &dev-><API key>; return pdata->pid_filter_ctrl(adap->fe[0], onoff); } } static int rtl28xxu_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff) { struct rtl28xxu_dev *dev = adap_to_priv(adap); if (dev->chip_id == CHIP_ID_RTL2831U) { struct <API key> *pdata = &dev-><API key>; return pdata->pid_filter(adap->fe[0], index, pid, onoff); } else { struct <API key> *pdata = &dev-><API key>; return pdata->pid_filter(adap->fe[0], index, pid, onoff); } } static const struct <API key> rtl28xxu_props = { .driver_name = KBUILD_MODNAME, .owner = THIS_MODULE, .adapter_nr = adapter_nr, .size_of_priv = sizeof(struct rtl28xxu_dev), .identify_state = <API key>, .power_ctrl = rtl28xxu_power_ctrl, .frontend_ctrl = <API key>, .i2c_algo = &rtl28xxu_i2c_algo, .read_config = <API key>, .frontend_attach = <API key>, .frontend_detach = <API key>, .tuner_attach = <API key>, .tuner_detach = <API key>, .init = rtl28xxu_init, .get_rc_config = <API key>, .num_adapters = 1, .adapter = { { .caps = <API key> | <API key>, .pid_filter_count = 32, .pid_filter_ctrl = <API key>, .pid_filter = rtl28xxu_pid_filter, .stream = DVB_USB_STREAM_BULK(0x81, 6, 8 * 512), }, }, }; static const struct usb_device_id rtl28xxu_id_table[] = { /* RTL2831U devices: */ { DVB_USB_DEVICE(USB_VID_REALTEK, <API key>, &rtl28xxu_props, "Realtek RTL2831U reference design", NULL) }, { DVB_USB_DEVICE(USB_VID_WIDEVIEW, <API key>, &rtl28xxu_props, "Freecom USB2.0 DVB-T", NULL) }, { DVB_USB_DEVICE(USB_VID_WIDEVIEW, <API key>, &rtl28xxu_props, "Freecom USB2.0 DVB-T", NULL) }, /* RTL2832U devices: */ { DVB_USB_DEVICE(USB_VID_REALTEK, 0x2832, &rtl28xxu_props, "Realtek RTL2832U reference design", NULL) }, { DVB_USB_DEVICE(USB_VID_REALTEK, 0x2838, &rtl28xxu_props, "Realtek RTL2832U reference design", NULL) }, { DVB_USB_DEVICE(USB_VID_TERRATEC, <API key>, &rtl28xxu_props, "TerraTec Cinergy T Stick Black", <API key>) }, { DVB_USB_DEVICE(USB_VID_GTEK, <API key>, &rtl28xxu_props, "G-Tek Electronics Group Lifeview LV5TDLX DVB-T", NULL) }, { DVB_USB_DEVICE(USB_VID_TERRATEC, <API key>, &rtl28xxu_props, "TerraTec NOXON DAB Stick", NULL) }, { DVB_USB_DEVICE(USB_VID_TERRATEC, <API key>, &rtl28xxu_props, "TerraTec NOXON DAB Stick (rev 2)", NULL) }, { DVB_USB_DEVICE(USB_VID_TERRATEC, <API key>, &rtl28xxu_props, "TerraTec NOXON DAB Stick (rev 3)", NULL) }, { DVB_USB_DEVICE(USB_VID_GTEK, <API key>, &rtl28xxu_props, "Trekstor DVB-T Stick Terres 2.0", NULL) }, { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1101, &rtl28xxu_props, "Dexatek DK DVB-T Dongle", NULL) }, { DVB_USB_DEVICE(USB_VID_LEADTEK, 0x6680, &rtl28xxu_props, "DigitalNow Quad DVB-T Receiver", NULL) }, { DVB_USB_DEVICE(USB_VID_LEADTEK, <API key>, &rtl28xxu_props, "Leadtek Winfast DTV Dongle Mini D", NULL) }, { DVB_USB_DEVICE(USB_VID_LEADTEK, <API key>, &rtl28xxu_props, "Leadtek WinFast DTV2000DS Plus", <API key>) }, { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d3, &rtl28xxu_props, "TerraTec Cinergy T Stick RC (Rev. 3)", NULL) }, { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1102, &rtl28xxu_props, "Dexatek DK mini DVB-T Dongle", NULL) }, { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d7, &rtl28xxu_props, "TerraTec Cinergy T Stick+", NULL) }, { DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd3a8, &rtl28xxu_props, "ASUS My Cinema-U3100Mini Plus V2", NULL) }, { DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd393, &rtl28xxu_props, "GIGABYTE U7300", NULL) }, { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1104, &rtl28xxu_props, "MSI DIGIVOX Micro HD", NULL) }, { DVB_USB_DEVICE(USB_VID_COMPRO, 0x0620, &rtl28xxu_props, "Compro VideoMate U620F", NULL) }, { DVB_USB_DEVICE(USB_VID_COMPRO, 0x0650, &rtl28xxu_props, "Compro VideoMate U650F", NULL) }, { DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd394, &rtl28xxu_props, "MaxMedia HU394-T", NULL) }, { DVB_USB_DEVICE(USB_VID_LEADTEK, 0x6a03, &rtl28xxu_props, "Leadtek WinFast DTV Dongle mini", NULL) }, { DVB_USB_DEVICE(USB_VID_GTEK, <API key>, &rtl28xxu_props, "Crypto ReDi PC 50 A", NULL) }, { DVB_USB_DEVICE(USB_VID_KYE, 0x707f, &rtl28xxu_props, "Genius TVGo DVB-T03", NULL) }, { DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd395, &rtl28xxu_props, "Peak DVB-T USB", NULL) }, { DVB_USB_DEVICE(USB_VID_KWORLD_2, <API key>, &rtl28xxu_props, "Sveon STV20", NULL) }, { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV21, &rtl28xxu_props, "Sveon STV21", NULL) }, { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV27, &rtl28xxu_props, "Sveon STV27", NULL) }, { DVB_USB_DEVICE(USB_VID_KWORLD_2, <API key>, &rtl28xxu_props, "TURBO-X Pure TV Tuner DTT-2000", NULL) }, /* RTL2832P devices: */ { DVB_USB_DEVICE(USB_VID_HANFTEK, 0x0131, &rtl28xxu_props, "Astrometa DVB-T2", NULL) }, { DVB_USB_DEVICE(0x5654, 0xca42, &rtl28xxu_props, "GoTView MasterHD 3", NULL) }, { } }; MODULE_DEVICE_TABLE(usb, rtl28xxu_id_table); static struct usb_driver rtl28xxu_usb_driver = { .name = KBUILD_MODNAME, .id_table = rtl28xxu_id_table, .probe = dvb_usbv2_probe, .disconnect = <API key>, .suspend = dvb_usbv2_suspend, .resume = dvb_usbv2_resume, .reset_resume = <API key>, .no_dynamic_id = 1, .soft_unbind = 1, }; module_usb_driver(rtl28xxu_usb_driver); MODULE_DESCRIPTION("Realtek RTL28xxU DVB USB driver"); MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); MODULE_AUTHOR("Thomas Mair <thomas.mair86@googlemail.com>"); MODULE_LICENSE("GPL");
<!DOCTYPE html> <meta charset="utf-8"> <title>Legacy platform objects</title> <link rel="help" href="https://heycam.github.io/webidl/#<API key>"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script> function <API key>(object, property_key, expected) { let actual = Object.<API key>(object, property_key); if (expected === undefined) { assert_equals( actual, undefined, "(<API key>: no property descriptor expected)"); return; } for (p in actual) { assert_true( expected.hasOwnProperty(p), "(<API key>: property '" + p + "' is not expected)"); assert_equals( actual[p], expected[p], "(<API key>: property '" + p + "')"); } for (p in expected) { assert_true( actual.hasOwnProperty(p), "(<API key>: expected property '" + p + "' missing)"); } } // https://heycam.github.io/webidl/#<API key> // https://heycam.github.io/webidl/#<API key> test(function() { // DOMTokenList has an indexed property getter, no indexed property setter // and no named property handlers. let div = document.createElement("div"); div.classList.add("baz", "quux"); const domTokenList = div.classList; <API key>( domTokenList, "1", {value: "quux", writable: false, enumerable: true, configurable: true}, "[[GetOwnProperty]] for indexed properties returns the right descriptor"); <API key>( domTokenList, "42", undefined, "[[GetOwnProperty]] with invalid index returns undefined"); assert_array_equals(Object.keys(domTokenList), ["0", "1"]); assert_array_equals(Object.values(domTokenList), ["baz", "quux"]); // <API key>() returns an HTMLCollection. // HTMLCollection has indexed and named property getters, no setters. Its IDL // interface declaration has [<API key>] so its named // properties are not enumerable. let span1 = document.createElement("span"); span1.id = "foo"; let span2 = document.createElement("span"); span2.id = "bar"; document.head.appendChild(span1); document.head.appendChild(span2); const elementList = document.<API key>("span"); <API key>( elementList, "foo", {value: span1, writable: false, enumerable: false, configurable: true}, "[[GetOwnProperty]] for named properties returns the right descriptor"); <API key>( elementList, "1", {value: span2, writable: false, enumerable: true, configurable: true}, "[[GetOwnProperty]] for indexed properties returns the right descriptor"); <API key>( elementList, "unknown", undefined, "[[GetOwnProperty]] with invalid property name returns undefined"); assert_array_equals(Object.keys(elementList), ["0", "1"]); assert_array_equals(Object.values(elementList), [span1, span2]); }, "[[GetOwnProperty]] with getters and no setters"); test(function() { // DOMStringMap supports named property getters and setters, but not indexed // properties. let span = document.createElement("span"); span.dataset.foo = "bar"; <API key>( span.dataset, "foo", {value: "bar", writable: true, enumerable: true, configurable: true}, "[[GetOwnProperty]] for named properties returns the right descriptor"); <API key>( span.dataset, "unknown", undefined, "[[GetOwnProperty]] with invalid property name returns undefined"); assert_array_equals(Object.keys(span.dataset), ["foo"]); assert_array_equals(Object.values(span.dataset), ["bar"]); }, "[[GetOwnProperty]] with named property getters and setters"); test(function() { // HTMLSelectElement has indexed property getters and setters, but no support // for named properties. let selectElement = document.createElement("select"); <API key>( selectElement, "0", undefined, "[[GetOwnProperty]] with invalid property index returns undefined"); let optionElement = document.createElement("option"); selectElement.appendChild(optionElement); <API key>( selectElement, "0", {value: optionElement, writable: true, enumerable: true, configurable: true}, "[[GetOwnProperty]] for indexed properties returns the right descriptor"); assert_array_equals(Object.keys(selectElement), ["0"]); assert_array_equals(Object.values(selectElement), [optionElement]); }, "[[GetOwnProperty]] with indexed property getters and setters"); // https://heycam.github.io/webidl/#<API key> // 3.9.3. [[DefineOwnProperty]] test(function() { let span = document.createElement("span"); span.className = "foo"; // DOMTokenList supports an indexed property getter but not a setter. let domTokenList = span.classList; // Confirm the test settings. assert_equals(domTokenList.length, 1); <API key>(domTokenList, "0", {value: "foo", writable: false, enumerable: true, configurable: true}); <API key>(domTokenList, "1", undefined); // Actual test assert_throws(new TypeError(), () => Object.defineProperty(domTokenList, "0", {value: true, writable: true})); assert_throws(new TypeError(), () => Object.defineProperty(domTokenList, "1", {value: true, writable: true})); assert_throws(new TypeError(), () => Object.defineProperty(domTokenList, "0", {get: () => {}})); assert_throws(new TypeError(), () => Object.defineProperty(domTokenList, "0", {set: () => {}})); assert_throws(new TypeError(), () => Object.defineProperty(domTokenList, "1", {get: () => {}})); assert_throws(new TypeError(), () => Object.defineProperty(domTokenList, "1", {set: () => {}})); assert_equals(domTokenList[0], "foo"); assert_equals(domTokenList[1], undefined); domTokenList[0] = "bar"; domTokenList[1] = "bar"; assert_equals(domTokenList[0], "foo"); assert_equals(domTokenList[1], undefined); assert_throws(new TypeError(), () => { "use strict"; domTokenList[0] = "bar"; }); assert_throws(new TypeError(), () => { "use strict"; domTokenList[1] = "bar"; }); // Nothing must change after all. assert_equals(domTokenList.length, 1); <API key>(domTokenList, "0", {value: "foo", writable: false, enumerable: true, configurable: true}); <API key>(domTokenList, "1", undefined); }, "Test [[DefineOwnProperty]] with no indexed property setter support."); test(function() { // HTMLSelectElement supports an indexed property setter. let select = document.createElement("select"); let option0 = document.createElement("option"); let option1 = document.createElement("option"); // Confirm the test settings. assert_equals(select.length, 0); <API key>(select, "0", undefined); // Try to define an accessor property with non supported property index. assert_throws(new TypeError(), () => Object.defineProperty(select, "0", {get: () => {}})); assert_throws(new TypeError(), () => Object.defineProperty(select, "0", {set: () => {}})); <API key>(select, "0", undefined); // writable, enumerable, configurable will be ignored. Object.defineProperty(select, "0", {value: option0, writable: false, enumerable: false, configurable: false}); <API key>(select, "0", {value: option0, writable: true, enumerable: true, configurable: true}); select[1] = option1; <API key>(select, "1", {value: option1, writable: true, enumerable: true, configurable: true}); // Try to define an accessor property with a supported property index. assert_throws(new TypeError(), () => Object.defineProperty(select, "0", {get: () => {}})); assert_throws(new TypeError(), () => Object.defineProperty(select, "0", {set: () => {}})); <API key>(select, "0", {value: option0, writable: true, enumerable: true, configurable: true}); }, "Test [[DefineOwnProperty]] with indexed property setter support."); </script>
# The Python Imaging Library. # IM Tools support for PIL # history: # 1996-05-27 fl Created (read 8-bit images only) # 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.2) __version__ = "0.2" import re import Image, ImageFile field = re.compile(r"([a-z]*) ([^ \r\n]*)") # Image plugin for IM Tools images. class ImtImageFile(ImageFile.ImageFile): format = "IMT" format_description = "IM Tools" def _open(self): # Quick rejection: if there's not a LF among the first # 100 bytes, this is (probably) not a text header. if not "\n" in self.fp.read(100): raise SyntaxError, "not an IM file" self.fp.seek(0) xsize = ysize = 0 while 1: s = self.fp.read(1) if not s: break if s == chr(12): # image data begins self.tile = [("raw", (0,0)+self.size, self.fp.tell(), (self.mode, 0, 1))] break else: # read key/value pair # FIXME: dangerous, may read whole file s = s + self.fp.readline() if len(s) == 1 or len(s) > 100: break if s[0] == "*": continue # comment m = field.match(s) if not m: break k, v = m.group(1,2) if k == "width": xsize = int(v) self.size = xsize, ysize elif k == "height": ysize = int(v) self.size = xsize, ysize elif k == "pixel" and v == "n8": self.mode = "L" Image.register_open("IMT", ImtImageFile) # no extension registered (".im" is simply too common)
#include "Test.h" #include "SkMetaData.h" static void test_ptrs(skiatest::Reporter* reporter) { SkRefCnt ref; REPORTER_ASSERT(reporter, 1 == ref.getRefCnt()); { SkMetaData md0, md1; const char name[] = "refcnt"; md0.setRefCnt(name, &ref); REPORTER_ASSERT(reporter, md0.findRefCnt(name)); REPORTER_ASSERT(reporter, md0.hasRefCnt(name, &ref)); REPORTER_ASSERT(reporter, 2 == ref.getRefCnt()); md1 = md0; REPORTER_ASSERT(reporter, md1.findRefCnt(name)); REPORTER_ASSERT(reporter, md1.hasRefCnt(name, &ref)); REPORTER_ASSERT(reporter, 3 == ref.getRefCnt()); REPORTER_ASSERT(reporter, md0.removeRefCnt(name)); REPORTER_ASSERT(reporter, !md0.findRefCnt(name)); REPORTER_ASSERT(reporter, !md0.hasRefCnt(name, &ref)); REPORTER_ASSERT(reporter, 2 == ref.getRefCnt()); } REPORTER_ASSERT(reporter, 1 == ref.getRefCnt()); } static void TestMetaData(skiatest::Reporter* reporter) { SkMetaData m1; REPORTER_ASSERT(reporter, !m1.findS32("int")); REPORTER_ASSERT(reporter, !m1.findScalar("scalar")); REPORTER_ASSERT(reporter, !m1.findString("hello")); REPORTER_ASSERT(reporter, !m1.removeS32("int")); REPORTER_ASSERT(reporter, !m1.removeScalar("scalar")); REPORTER_ASSERT(reporter, !m1.removeString("hello")); REPORTER_ASSERT(reporter, !m1.removeString("true")); REPORTER_ASSERT(reporter, !m1.removeString("false")); m1.setS32("int", 12345); m1.setScalar("scalar", SK_Scalar1 * 42); m1.setString("hello", "world"); m1.setPtr("ptr", &m1); m1.setBool("true", true); m1.setBool("false", false); int32_t n; SkScalar s; m1.setScalar("scalar", SK_Scalar1/2); REPORTER_ASSERT(reporter, m1.findS32("int", &n) && n == 12345); REPORTER_ASSERT(reporter, m1.findScalar("scalar", &s) && s == SK_Scalar1/2); REPORTER_ASSERT(reporter, !strcmp(m1.findString("hello"), "world")); REPORTER_ASSERT(reporter, m1.hasBool("true", true)); REPORTER_ASSERT(reporter, m1.hasBool("false", false)); SkMetaData::Iter iter(m1); const char* name; static const struct { const char* fName; SkMetaData::Type fType; int fCount; } gElems[] = { { "int", SkMetaData::kS32_Type, 1 }, { "scalar", SkMetaData::kScalar_Type, 1 }, { "ptr", SkMetaData::kPtr_Type, 1 }, { "hello", SkMetaData::kString_Type, sizeof("world") }, { "true", SkMetaData::kBool_Type, 1 }, { "false", SkMetaData::kBool_Type, 1 } }; int loop = 0; int count; SkMetaData::Type t; while ((name = iter.next(&t, &count)) != NULL) { int match = 0; for (unsigned i = 0; i < SK_ARRAY_COUNT(gElems); i++) { if (!strcmp(name, gElems[i].fName)) { match += 1; REPORTER_ASSERT(reporter, gElems[i].fType == t); REPORTER_ASSERT(reporter, gElems[i].fCount == count); } } REPORTER_ASSERT(reporter, match == 1); loop += 1; } REPORTER_ASSERT(reporter, loop == SK_ARRAY_COUNT(gElems)); REPORTER_ASSERT(reporter, m1.removeS32("int")); REPORTER_ASSERT(reporter, m1.removeScalar("scalar")); REPORTER_ASSERT(reporter, m1.removeString("hello")); REPORTER_ASSERT(reporter, m1.removeBool("true")); REPORTER_ASSERT(reporter, m1.removeBool("false")); REPORTER_ASSERT(reporter, !m1.findS32("int")); REPORTER_ASSERT(reporter, !m1.findScalar("scalar")); REPORTER_ASSERT(reporter, !m1.findString("hello")); REPORTER_ASSERT(reporter, !m1.findBool("true")); REPORTER_ASSERT(reporter, !m1.findBool("false")); test_ptrs(reporter); } #include "TestClassDef.h" DEFINE_TESTCLASS("MetaData", TestMetaDataClass, TestMetaData)
<?php namespace Symfony\Component\DependencyInjection\Tests\Dumper; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Dumper\PhpDumper; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Definition; class PhpDumperTest extends \<API key> { protected static $fixturesPath; public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); } public function testDump() { $dumper = new PhpDumper($container = new ContainerBuilder()); $this-><API key>(self::$fixturesPath.'/php/services1.php', $dumper->dump(), '->dump() dumps an empty container as an empty PHP class'); $this-><API key>(self::$fixturesPath.'/php/services1-1.php', $dumper->dump(array('class' => 'Container', 'base_class' => 'AbstractContainer', 'namespace' => 'Symfony\Component\DependencyInjection\Dump')), '->dump() takes a class and a base_class options'); $container = new ContainerBuilder(); new PhpDumper($container); } public function <API key>() { $container = new ContainerBuilder(); $container->setResourceTracking(false); $container->register('foo', 'stdClass'); $container->compile(); $dumper = new PhpDumper($container); $dumpedString = $dumper->dump(); $this-><API key>(self::$fixturesPath.'/php/services11.php', $dumpedString, '->dump() does not add <API key>() method call if container have no parameters.'); $this->assertNotRegexp("/function <API key>\(/", $dumpedString, '->dump() does not add <API key>() method definition.'); } public function <API key>() { $definition = new Definition(); $definition->setClass('stdClass'); $definition->addArgument(array( 'only dot' => '.', 'concatenation as value' => '.\'\'.', 'concatenation from the start value' => '\'\'.', '.' => 'dot as a key', '.\'\'.' => 'concatenation as a key', '\'\'.' => 'concatenation from the start key', 'optimize concatenation' => "string1%some_string%string2", 'optimize concatenation with empty string' => "string1%empty_value%string2", 'optimize concatenation from the start' => '%empty_value%start', 'optimize concatenation at the end' => 'end%empty_value%', )); $container = new ContainerBuilder(); $container->setResourceTracking(false); $container->setDefinition('test', $definition); $container->setParameter('empty_value', ''); $container->setParameter('some_string', '-'); $container->compile(); $dumper = new PhpDumper($container); $this-><API key>(self::$fixturesPath.'/php/services10.php', $dumper->dump(), '->dump() dumps an empty container as an empty PHP class'); } public function testDumpRelativeDir() { $definition = new Definition(); $definition->setClass('stdClass'); $definition->addArgument('%foo%'); $definition->addArgument(array('%foo%' => '%buz%/')); $container = new ContainerBuilder(); $container->setDefinition('test', $definition); $container->setParameter('foo', 'wiz'.dirname(dirname(__FILE__))); $container->setParameter('bar', dirname(__FILE__)); $container->setParameter('baz', '%bar%/PhpDumperTest.php'); $container->setParameter('buz', dirname(dirname(__DIR__))); $container->compile(); $dumper = new PhpDumper($container); $this-><API key>(self::$fixturesPath.'/php/services12.php', $dumper->dump(array('file' => __FILE__)), '->dump() dumps __DIR__ relative strings'); } /** * @expectedException \<API key> */ public function <API key>() { $dumper = new PhpDumper(new ContainerBuilder(new ParameterBag(array('foo' => new Reference('foo'))))); $dumper->dump(); } public function testAddParameters() { $container = include self::$fixturesPath.'/containers/container8.php'; $dumper = new PhpDumper($container); $this-><API key>(self::$fixturesPath.'/php/services8.php', $dumper->dump(), '->dump() dumps parameters'); } public function testAddService() { // without compilation $container = include self::$fixturesPath.'/containers/container9.php'; $dumper = new PhpDumper($container); $this->assertEquals(str_replace('%path%', str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), file_get_contents(self::$fixturesPath.'/php/services9.php')), $dumper->dump(), '->dump() dumps services'); // with compilation $container = include self::$fixturesPath.'/containers/container9.php'; $container->compile(); $dumper = new PhpDumper($container); $this->assertEquals(str_replace('%path%', str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), file_get_contents(self::$fixturesPath.'/php/services9_compiled.php')), $dumper->dump(), '->dump() dumps services'); $dumper = new PhpDumper($container = new ContainerBuilder()); $container->register('foo', 'FooClass')->addArgument(new \stdClass()); try { $dumper->dump(); $this->fail('->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); } catch (\Exception $e) { $this->assertInstanceOf('\Symfony\Component\DependencyInjection\Exception\RuntimeException', $e, '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); $this->assertEquals('Unable to dump a service container if a parameter is an object or a resource.', $e->getMessage(), '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); } } /** * @expectedException \<API key> * @<API key> Service id "bar$" cannot be converted to a valid PHP method name. */ public function <API key>() { $container = new ContainerBuilder(); $container->register('bar$', 'FooClass'); $dumper = new PhpDumper($container); $dumper->dump(); } public function testAliases() { $container = include self::$fixturesPath.'/containers/container9.php'; $container->compile(); $dumper = new PhpDumper($container); eval('?>'.$dumper->dump(array('class' => '<API key>'))); $container = new \<API key>(); $container->set('foo', $foo = new \stdClass()); $this->assertSame($foo, $container->get('foo')); $this->assertSame($foo, $container->get('alias_for_foo')); $this->assertSame($foo, $container->get('alias_for_alias')); } public function <API key>() { $container = new ContainerBuilder(); $container->compile(); $dumper = new PhpDumper($container); eval('?>'.$dumper->dump(array('class' => '<API key>'))); $container = new \<API key>(); $this->assertFalse($container->has('foo')); } public function <API key>() { require_once self::$fixturesPath.'/php/services9.php'; require_once self::$fixturesPath.'/includes/foo.php'; $container = new \<API key>(); $container->set('bar', $bar = new \stdClass()); $container->setParameter('foo_bar', 'foo_bar'); $this->assertEquals($bar, $container->get('bar'), '->set() overrides an already defined service'); } public function <API key>() { require_once self::$fixturesPath.'/php/services9.php'; require_once self::$fixturesPath.'/includes/foo.php'; require_once self::$fixturesPath.'/includes/classes.php'; $container = new \<API key>(); $container->set('bar', $bar = new \stdClass()); $this->assertSame($bar, $container->get('foo')->bar, '->set() overrides an already defined service'); } /** * @expectedException \Symfony\Component\DependencyInjection\Exception\<API key> */ public function <API key>() { $container = new ContainerBuilder(); $container->register('foo', 'stdClass')->addArgument(new Reference('bar')); $container->register('bar', 'stdClass')->setPublic(false)->addMethodCall('setA', array(new Reference('baz'))); $container->register('baz', 'stdClass')->addMethodCall('setA', array(new Reference('foo'))); $container->compile(); $dumper = new PhpDumper($container); $dumper->dump(); } }