//non-inlined version of rfm12_data
//warning: without the attribute, gcc will inline this even if -Os is set
static void __attribute__ ((noinline)) rfm12_data(uint16_t d) {
	SS_ASSERT();
	#if !(RFM12_SPI_SOFTWARE)
		SPDR = d >> 8;
		while (!(SPSR & (1<<SPIF)));

		SPDR = d & 0xff;
		while (!(SPSR & (1<<SPIF)));
	#else
		spi_data(d >> 8);
		spi_data(d & 0xff);
	#endif
	SS_RELEASE();
}
/* @description reads the upper 8 bits of the status
 * register (the interrupt flags)
 */
static uint8_t rfm12_read_int_flags_inline(void)
{
	#if !(RFM12_SPI_SOFTWARE)
		SS_ASSERT();
		SPDR = 0;
		while(!(SPSR & (1<<SPIF)));
		SS_RELEASE();
		return SPDR;
	#else
		SS_ASSERT();
		unsigned char x, d=d;
		PORT_MOSI &= ~(1<<BIT_MOSI);
		for(x=0;x<8;x++){
			PORT_SCK |= (1<<BIT_SCK);
			d<<=1;
			if(PIN_MISO & (1<<BIT_MISO)){
				d|=1;
			}
			PORT_SCK &= ~(1<<BIT_SCK);
		}
		SS_RELEASE();
		return d;
	#endif
}
Beispiel #3
0
void SS5Player::play(const AnimeRef* animeRef, int startFrameNo)
{
	SS_ASSERT(animeRef);
	if (m_currentAnimeRef != animeRef){
		m_currentAnimeRef = animeRef;
		
		allocParts(animeRef->m_numParts);
		setPartsParentage();
	}

	setCurrentFrame(startFrameNo);
	setFrame(startFrameNo);
	
	//play実行時に最初のフレームのユーザーデータを確認する
	checkUserData(startFrameNo);
	checkEvent(startFrameNo);
}
//non-inlined version of rfm12_read
//warning: without the attribute, gcc will inline this even if -Os is set
static uint16_t __attribute__ ((noinline)) rfm12_read(uint16_t c) {
	uint16_t retval;
	SS_ASSERT();

	#if !(RFM12_SPI_SOFTWARE)
		SPDR = c >> 8;
		while (!(SPSR & (1<<SPIF)));
		retval = SPDR << 8;
		SPDR = c & 0xff;
		while (!(SPSR & (1<<SPIF)));
		retval |= SPDR;
	#else
		retval = spi_data(c >> 8);
		retval <<= 8;
		retval |= spi_data(c & 0xff);
	#endif
	SS_RELEASE();
	return retval;
}
Beispiel #5
0
NET_API_STATUS NET_API_FUNCTION
NetrConnectionEnum (
    IN LPTSTR ServerName,
    IN LPTSTR Qualifier,
    IN LPCONNECT_ENUM_STRUCT InfoStruct,
    IN DWORD PreferredMaximumLength,
    OUT LPDWORD TotalEntries,
    IN OUT LPDWORD ResumeHandle OPTIONAL
    )

/*++

Routine Description:

    This routine communicates with the server FSD to implement the
    NetConnectionEnum function.

Arguments:

    None.

Return Value:

    NET_API_STATUS - NO_ERROR or reason for failure.

--*/

{
    NET_API_STATUS error;
    PSERVER_REQUEST_PACKET srp;

    ServerName;

    //
    // Make sure that the level is valid.  Since it is an unsigned
    // value, it can never be less than 0.
    //

    if ( InfoStruct->Level > 1 ) {
        return ERROR_INVALID_LEVEL;
    }

    //
    // The qualifier cannot be null or can it be a null string
    //

    if ( Qualifier == NULL || *Qualifier == L'\0' ) {
        return ERROR_INVALID_PARAMETER;
    }

    //
    // Make sure that the caller is allowed to get connection
    // information in the server.
    //

    error = SsCheckAccess(
                &SsConnectionSecurityObject,
                SRVSVC_CONNECTION_INFO_GET
                );

    if ( error != NO_ERROR ) {
        return ERROR_ACCESS_DENIED;
    }

    //
    // Set up the input parameters in the request buffer.
    //

    srp = SsAllocateSrp( );
    if ( srp == NULL ) {
        return ERROR_NOT_ENOUGH_MEMORY;
    }
    srp->Level = InfoStruct->Level;

#ifdef UNICODE
    RtlInitUnicodeString( &srp->Name1, Qualifier );
#else
    {
        OEM_STRING ansiString;
        NTSTATUS status;
        NetpInitOemString( &ansiString, Qualifier );
        status = RtlOemStringToUnicodeString( &srp->Name1, &ansiString, TRUE );
        SS_ASSERT( NT_SUCCESS(status) );
    }
#endif

    if ( ARGUMENT_PRESENT( ResumeHandle ) ) {
        srp->Parameters.Get.ResumeHandle = *ResumeHandle;
    } else {
        srp->Parameters.Get.ResumeHandle = 0;
    }

    //
    // Get the data from the server.  This routine will allocate the
    // return buffer and handle the case where PreferredMaximumLength ==
    // -1.
    //

    error = SsServerFsControlGetInfo(
                FSCTL_SRV_NET_CONNECTION_ENUM,
                srp,
                (PVOID *)&InfoStruct->ConnectInfo.Level1->Buffer,
                PreferredMaximumLength
                );

    //
    // Set up return information.
    //

    InfoStruct->ConnectInfo.Level1->EntriesRead =
        srp->Parameters.Get.EntriesRead;
    *TotalEntries = srp->Parameters.Get.TotalEntries;

    if ( srp->Parameters.Get.EntriesRead > 0 &&
             ARGUMENT_PRESENT( ResumeHandle ) ) {
        *ResumeHandle = srp->Parameters.Get.ResumeHandle;
    }

#ifndef UNICODE
    RtlFreeUnicodeString( &srp->Name1 );
#endif

    SsFreeSrp( srp );

    return error;

} // NetrConnectionEnum
Beispiel #6
0
INT
SapScanObjectInternal(
    IN PULONG  ObjectID,
    IN PUCHAR  ObjectName,
    IN PUSHORT ObjectType,
    IN USHORT  ScanType)
{
    PSAP_RECORD Entry;
    PSAP_RECORD HeadEntry;
    ULONG id;

    /** Get the readers lock **/

    ACQUIRE_READERS_LOCK("SapScanObject Entry");

    /**
        Get the ID and validate it.  If the ID is 0xFFFFFFFF, then
        we start with the first entry in the type list.

        If it is not 0xFFFFFFFF - then we get that entry and
        get it's fwd pointer in the type list as the next one to return.
    **/

    id = *ObjectID;
    if (id == 0xFFFFFFFF) {

        /** Get ptr to entry at head of the type list **/

        HeadEntry = GETPTRFROMINDEX(SdmdLists[SAP_TYPELIST_INDEX].Flink);
        if (ScanType != 0xFFFF) {
            while (HeadEntry && (HeadEntry->ServType < ScanType)) {
                HeadEntry = GETPTRFROMINDEX(HeadEntry->Links[SAP_TYPELIST_INDEX].Flink);
            }
        }

        /** If no type found - return error **/

        if ((HeadEntry == NULL) || (HeadEntry->ServType == 0xFFFF)) {
            RELEASE_READERS_LOCK("SapScanObject X1");
            return SAPRETURN_NOTEXIST;
        }

        /** If not wildcard - make sure it matches type we want **/

        if (ScanType != 0xFFFF) {
            if (HeadEntry->ServType != ScanType) {
                RELEASE_READERS_LOCK("SapScanObject X2");
                return SAPRETURN_NOTEXIST;
            }
        }

        /** Get ptr to first entry in this sublist **/

        Entry = GETPTRFROMINDEX(HeadEntry->Links[SAP_SUBLIST_INDEX].Flink);
    }
    else {

        /**
            This is a SCAN NEXT type call.  Take the object ID and
            get the forward pointer to it and verify that it is for
            the same object type as before.
        **/

        if ((id & BINDLIB_BITS) != BINDLIB_BITS) {
            RELEASE_READERS_LOCK("SapScanObject X4");
            return SAPRETURN_NOTEXIST;
        }
        id &= BINDLIB_MASK;           /* Convert to an index */

        /** Make sure the index number is valid **/

        if (id >= (ULONG)SapNumArrayEntries) {
            RELEASE_READERS_LOCK("SapGetObjectName X5");
            return SAPRETURN_NOTEXIST;
        }

        /**
            Get ptr to the entry.  If the ptr is bad or the entry
            is on the free list - then we should return an error.
        **/

        Entry = GETPTRFROMINDEX(id);
        if ((Entry == NULL) || (Entry->ServType == 0xFFFF) || (Entry->HeadIndex == SDMD_ENDOFLIST)) {
            RELEASE_READERS_LOCK("SapGetObjectName X6");
            return SAPRETURN_NOTEXIST;
        }

        /** Get the head entry for this entry **/

        HeadEntry = GETPTRFROMINDEX(Entry->HeadIndex);
        SS_ASSERT(HeadEntry);

        /**
            Now we get the ptr to the next entry in the sub list.
            This is the entry we will return (If there is one).
        **/

        Entry = GETPTRFROMINDEX(Entry->Links[SAP_SUBLIST_INDEX].Flink);
    }

    /**
        Entry is the entry we start with.  This could be NULL.

        Entry and HeadEntry are set here.  HeadEntry must be non-NULL.
    **/

    while (1) {

        /**
            If we hit the end of this sublist - then we can go to the next
            sublist if the scan type is for wildcard.
        **/

        if (Entry == NULL) {

            /** If not wildcard - return error **/

            if (ScanType != 0xFFFF) {
                RELEASE_READERS_LOCK("SapGetObjectName X7");
                return SAPRETURN_NOTEXIST;
            }

            /** This is for wildcard - get next HeadEntry **/

            HeadEntry = GETPTRFROMINDEX(HeadEntry->Links[SAP_TYPELIST_INDEX].Flink);
            if ((HeadEntry == NULL) || (HeadEntry->ServType == 0xFFFF)) {
                RELEASE_READERS_LOCK("SapGetObjectName X8");
                return SAPRETURN_NOTEXIST;
            }

            /** Get ptr to first entry in this list **/

            Entry = GETPTRFROMINDEX(HeadEntry->Links[SAP_SUBLIST_INDEX].Flink);
        }

        /** If we got one - return it **/

        if (Entry) {

            /** If valid entry - return it **/

            if (Entry->HopCount != 16)
                break;

            /** Get ptr to next entry in the list **/

            Entry = GETPTRFROMINDEX(Entry->Links[SAP_SUBLIST_INDEX].Flink);
        }

        /** We go back up to try again **/
    }

    /** Return the entry **/

    *ObjectID = (ULONG)(Entry->Index | BINDLIB_BITS);

    if (ObjectType)
        *ObjectType = Entry->ServType;

    if (ObjectName)
        SAP_COPY_SERVNAME(ObjectName, Entry->ServName);

    /** All Done OK **/

    RELEASE_READERS_LOCK("SapGetObjectName X9");
    return SAPRETURN_SUCCESS;
}
Beispiel #7
0
NET_API_STATUS NET_API_FUNCTION
NetrFileGetInfo (
    IN  LPTSTR ServerName,
    IN  DWORD FileId,
    IN  DWORD Level,
    OUT LPFILE_INFO InfoStruct
    )

/*++

Routine Description:

    This routine communicates with the server FSD to implement the
    NetFileGetInfo function.

Arguments:

    None.

Return Value:

    NET_API_STATUS - NO_ERROR or reason for failure.

--*/

{
    NET_API_STATUS error;
    ULONG entriesRead;
    ULONG totalEntries;
    ULONG resumeHandle = FileId;

    ServerName;

    //
    // Make sure that the caller is allowed to get file information in the
    // server.
    //

    error = SsCheckAccess(
                &SsFileSecurityObject,
                SRVSVC_FILE_INFO_GET
                );

    if ( error != NO_ERROR ) {
        return ERROR_ACCESS_DENIED;
    }

    error = FileEnumCommon(
                NULL,
                NULL,
                Level,
                (LPBYTE *)InfoStruct,
                (DWORD)-1,
                &entriesRead,
                &totalEntries,
                &resumeHandle,
                TRUE
                );

    if ( entriesRead == 0 ) {
        return ERROR_FILE_NOT_FOUND;
    }

    SS_ASSERT( error != NO_ERROR || entriesRead == 1 );

    return error;

} // NetrFileGetInfo
bool NgAppCmdInteractionProgramParameters::SetInputProjPropVal(const AString& val)
{
  bool retVal = m_namedProps.SetPropertyValue(kInputProjStr, val);
  SS_ASSERT(retVal);
  return retVal;
}