static void setupIO(void) { IO_SetMode(HB_PORT, HB_PIN, IO_MODE_OUTPUT); IO_SetMode(eUP_PORT, UP_PIN, IO_MODE_PULLUPINPUT); IO_SetMode(eDIGIT_PORT, DIGIT_PIN, IO_MODE_PULLUPINPUT); IO_SetMode(eTLC_DATA_PORT, TLC_DATA_PIN, IO_MODE_OUTPUT); IO_SetMode(eTLC_CLK_PORT, TLC_CLK_PIN, IO_MODE_OUTPUT); IO_SetMode(eTLC_OE_PORT, TLC_OE_PIN, IO_MODE_OUTPUT); IO_SetMode(eTLC_LATCH_PORT, TLC_LATCH_PIN, IO_MODE_OUTPUT); IO_SetMode(I2C_SCL_PORT, I2C_SCL_PIN, IO_MODE_I2C_PULLUP); IO_SetMode(I2C_SDA_PORT, I2C_SDA_PIN, IO_MODE_I2C_PULLUP); IO_SetMode(SECOND_TICK_PORT, SECOND_TICK_PIN, IO_MODE_PULLUPINPUT); secondTickVector = PCINT_EnableInterrupt(SECOND_TICK_PCINT, true); SR_Init(SFRP(TLC_DATA_PORT), TLC_DATA_PIN, SFRP(TLC_CLK_PORT), TLC_CLK_PIN); }
int main(int argc, char* argv[]) { (void)argc; (void)argv; const int width = 640; const int height = 480; const int depth = 32; Mesh mesh[NUM_MESHES]; ilInit(); iluInit(); //srand(time(NULL)); perspective(clipMatrix, 60.0f, (float)width/(float)height, 1.0f, 40.0f); for(int i = 0; i < NUM_MESHES; ++i) { mesh[i].rotationSpeed = rnd_min_max(0.0f, 0.25f); mesh[i].position.x = rnd_min_max(-1.0f, 1.0f); mesh[i].position.y = rnd_min_max(-1.0f, 1.0f); mesh[i].position.z = rnd_min_max(-2.5f, -30.0f); mesh[i].position.w = 1.0f; } SR_Init(width, height); SR_SetCaption("Tile-Rasterizer Test"); const Texture* tex = ReadPNG("texture0.png"); if(!tex){ printf("Couldn't find texture0.png, aborting..\n"); return -1; } SR_BindTexture0(tex); for(int i=0; i<NUM_MESHES; ++i) makeMeshCube(mesh[i].vertexData, mesh[i].tcoordData, 1.0f); SR_MainLoop(loop, quit, (void*)&mesh[0]); }
int32_t ICC_Async_Device_Init (struct s_reader *reader) { reader->fdmc=-1; cs_debug_mask (D_IFD, "IFD: Opening device %s\n", reader->device); reader->written = 0; if (reader->crdr.active==1 && reader->crdr.reader_init) { return reader->crdr.reader_init(reader); } switch(reader->typ) { case R_SC8in1: cs_writelock(&sc8in1_lock); if (reader->handle != 0) {//this reader is already initialized cs_writeunlock(&sc8in1_lock); return OK; } //this reader is uninitialized, thus the first one, since the first one initializes all others //get physical device name int32_t pos = strlen(reader->device)-2; //this is where : should be located; is also valid length of physical device name if (reader->device[pos] != 0x3a) //0x3a = ":" cs_log("ERROR: '%c' detected instead of slot separator `:` at second to last position of device %s", reader->device[pos], reader->device); reader->slot=(int)reader->device[pos+1] - 0x30; reader->device[pos]= 0; //slot 1 reader now gets correct physicalname //open physical device reader->handle = open (reader->device, O_RDWR | O_NOCTTY| O_NONBLOCK); if (reader->handle < 0) { cs_log("ERROR opening device %s",reader->device); cs_writeunlock(&sc8in1_lock); return ERROR; } //copy physical device name and file handle to other slots struct s_reader *rdr; LL_ITER itr = ll_iter_create(configured_readers); while((rdr = ll_iter_next(&itr))) //copy handle to other slots if (rdr->typ == R_SC8in1 && rdr != reader) { //we have another sc8in1 reader unsigned char save = rdr->device[pos]; rdr->device[pos]=0; //set to 0 so we can compare device names if (!strcmp(reader->device, rdr->device)) {//we have a match to another slot with same device name rdr->handle = reader->handle; rdr->slot=(int)rdr->device[pos+1] - 0x30; } else rdr->device[pos] = save; //restore character } break; case R_MP35: case R_MOUSE: reader->handle = open (reader->device, O_RDWR | O_NOCTTY| O_NONBLOCK); if (reader->handle < 0) { cs_log("ERROR opening device %s",reader->device); return ERROR; } break; #if defined(TUXBOX) && defined(PPC) case R_DB2COM1: case R_DB2COM2: reader->handle = open (reader->device, O_RDWR | O_NOCTTY| O_SYNC); if (reader->handle < 0) { cs_log("ERROR opening device %s",reader->device); return ERROR; } if ((reader->fdmc = open(DEV_MULTICAM, O_RDWR)) < 0) { close(reader->handle); cs_log("ERROR opening device %s",DEV_MULTICAM); return ERROR; } break; #endif case R_SMART: #if defined(LIBUSB) call (SR_Init(reader)); break; #else cs_log("ERROR, you have specified 'protocol = smartreader' in oscam.server,"); cs_log("recompile with SmartReader support."); return ERROR; #endif case R_INTERNAL: #if defined(COOL) return Cool_Init(reader->device); #elif defined(AZBOX) return Azbox_Init(reader); #elif defined(SCI_DEV) #if defined(SH4) || defined(STB04SCI) reader->handle = open (reader->device, O_RDWR|O_NONBLOCK|O_NOCTTY); #else reader->handle = open (reader->device, O_RDWR); #endif if (reader->handle < 0) { cs_log("ERROR opening device %s",reader->device); return ERROR; } #elif defined(WITH_STAPI) return STReader_Open(reader->device, &reader->stsmart_handle); #else//SCI_DEV cs_log("ERROR, you have specified 'protocol = internal' in oscam.server,"); cs_log("recompile with internal reader support."); return ERROR; #endif//SCI_DEV break; #ifdef HAVE_PCSC case R_PCSC: return (pcsc_reader_init(reader, reader->device)); break; #endif default: cs_log("ERROR ICC_Device_Init: unknow reader type %i",reader->typ); return ERROR; } if (reader->typ == R_MP35) { if (MP35_Init(reader)) { cs_log("ERROR: MP35_Init returns error"); MP35_Close (reader); return ERROR; } } else if (reader->typ <= R_MOUSE) if (Phoenix_Init(reader)) { cs_log("ERROR: Phoenix_Init returns error"); Phoenix_Close (reader); return ERROR; } if (reader->typ == R_SC8in1) { call(Sc8in1_Init(reader)); cs_writeunlock(&sc8in1_lock); } cs_debug_mask (D_IFD, "IFD: Device %s succesfully opened\n", reader->device); return OK; }