USB modem device software in cisco routers using C - c

HI all,
I am a final year computer science student; my project for final year is to develop a software using C or Tcl, for a CISCO router. In the latest series of routers, cisco has given a USB port for mass storage.
Now I want that if I plug-in a wireless modem like Idea netsetter (a modem available in India with this name), the router should connect to the internet.
Tell me any basic ideas regarding this project. Also, if there is any other language in which it can be developed more easily, please suggest.

When you say "develop a software using C or Tcl, for a CISCO router", do you mean that you are writing a custom firmware from scratch? Or are you wanting to write some sort of plug-in or application that interfaces with the existing firmware?
In either case, I would recommend that you first consult the documentation you have for the router. See what kind of API and driver support you have for the C and TCL languages. If one language looks like it is better supported than the other, then you will likely have an easier time using that language.
In my experiences, it is typically easier to do systems-level programming in C than in TCL. Most embedded systems assume that you are going to work in C and provide C-language interfaces to system functions. You didn't mention anything about the router model, so I can't say anything too specific.

Related

Is it possible to program a "Java Card" - enabled smart card in any other language than Java?

I have a Java Card enabled smart card and a card reader that was given by my Lab-instructor. I am supposed to do a project using Java Card 2.1.1 API.
I don't like the Java Card API.
Is it possible to program my given smart card using any other language like C?
The general answer :
Unfortunately no, currently there is no other way than using Java Card API to program a Java Card compatible card.
The detailed answer:
Some kind of cards have a mechanism named "Secure Box". As mentioned in the JCOP v2.4.2 r3 card Security target :
The Secure Box is a construct which allows to run non certified third
party native code and ensures that this code cannot harm, influence or
manipulate the JCOP 2.4.2 R3 operating system or any of the applets
executed by the operating system.The separation of the native code in
the Secure Box from other code and/or data residing on the hardware is
ensured by the Hardware MMU which has been certified in the hardware
evaluation.
Here and here you can see some information about Secure Box. As far as I know, you can write applications in C or Assembly language and upload them on the Secure Box. But it is really really tricky and I think finally you will change your opinion about the Java Card API and you will make a decision to try to not only like it, but also love it! ;)
Note that, in comparison with Java Cards, there are some other kind of cards named "Native Cards". The operation system in this cards is not Java Card Runtime Environment/Virtual Machine. These cards have a proprietary/manufacturer-specific way and language (Normally C or Assembly) to develop applications. But it is not as easy as Java Card applet development. And you will make a decision to try to ....love it again :D
Update : (Thanks to dear Vojta)
Sorry, I was forgot that. As Vojta mentioned in his comment, one of most known native card types is MULTOS. You can write programs in C, Java, Assembly and some other language for these cards and after that you must convert them to MELL (MULTOS card's language) using SwiftCard tool (consist of SwiftC and SwiftJ and ...). Some good documents here and here.

Custom Kernel: Implement filesystem

As a out of course project, I am currently developing a kernel in an attempt to better understand all the aspects of an actual OS. So far, I am done setting up a flat physical memory model with support for paging and the basic interrupts (keyboard and perhaps trackpad/mouse next). I thought the step forward would be to implement a filesystem and I am keen about the ext2. I have looked around, even on SO but there isn't anything explicit that answers my questions:
Is it possible to write a driver to access an ext2 filesystem in C or do I need to go lower?
If I plan to access the filesystem off a USB device, I am assuming I will need to get the device driver for USB running first. Any help on this would be greatly appreciated.
I know the code for detecting a filesystem is already available on the MINIX and other kernels but what I really want to know is if I want to build a custom albeit simple filesystem, how do I go about it? I am considering this possibility too.
My apologies if the question and details sound a little ignorant but I am still in the learning process.
Thanks :)
I'll try to give you a few tips/hints - a clear answer isn't that simple:
An ext2 filesystem written in C is just C. C is just a programming language - you can use C++, plain assembly or a few others (A few os'dever use D) - but not a "managed" language etc. But it is important that you have a rock solid understanding of this language. In my opinion assembly is a MUST (Take a look at the scheduler in an operating system -> plain assembly)
Do you really want to write an USB driver ? It isn't "just" a simple USB driver (Layer of abstractions). Why a USB driver and not a floppy disk or CD driver (Believe me - a floppy driver in 32 bit protected mode isn't that hard) ?
Please focus on your project. Of course Linux (Early versions) and Minix have example code, but take care of the design structure (Monolithic/Microkernel or hybrid-kernel) - and don't mix it, write your own code.
Please make on step after the other. You wrote a basic IRQ handling and the plan is to write a keyboard/mouse driver - write the keyboard driver ! Don't dream about loading and executing files (Rom wasn't built in one day).
You have to read documentations, for example the Intel manuals or other "books". A very popular forum is osdev.org - take a look at the wiki. As twalberg said, it's a very huge module - stay focused on the main parts of your operating system.
I know, this is not the answer to your question - but it's important not to go in the wrong direction and dream of a fancy UI or something like this ;)
osdev.org forum
osdev.org wiki
Intel manuals
And a few other books in my book shelf can you find here (Tanenbaum, Silberschatz with Peter Galvin - great books!):
Books

Mac OS X, C Facilities for reading PCI device information

I'm trying to learn how to get information from PCI devices in Mac OS X. So far I haven't been able to find anything about it in sysctl(3) and it seems the old devinfo(3) facilities from BSD are not available.
I need a C facility for this, I know there is an I/O kit framework for Objective C but I cannot use this.
The specific information I'm after is pretty basic, just vendor and device ID's.
I/O Kit is the system framework for device information. It is not an Objective-C API; instead, Apple use a restricted subset of C++. Quoting the I/O Kit Fundamentals document,
Apple considered several programming languages for the I/O Kit and chose a restricted subset of C++.
C++ was chosen for several reasons. The C++ compiler is mature and the language provides support for system programming. In addition, there is already a large community of Macintosh (and BSD) developers with C++ experience.
The restricted subset disallows certain features of C++, including
Exceptions
Multiple inheritance
Templates
Runtime type information (RTTI)—the I/O Kit uses its own implementation of a runtime typing system
These features were dropped because they were deemed unsuitable for use within a multithreaded kernel. If you feel you need these features, you should reconsider your design. You should be able to write any driver you require using I/O Kit with these restrictions in place.
If you cannot use C++ then one alternative is to have your C program call /usr/bin/ioreg and parse its results.
Edit: you might want to take a look at the Accessing Hardware from Applications document. It looks like accessing the I/O registry can be done with C code for the most part (if not all), with a bit of Core Foundation.

What tools (e.g. IDEs, Debuggers) are there for complex Arduino projects?

I'd like to develop a network based application for the Arduino platform. The examples shipped with a Wi-Fi Shield library are all multifile sketches with a network part implemented in C. I'd like to figure out how to implement the network portion in a way regular C/C++ development is conducted (with a decent IDE and step-by-step debugger).
I noticed WiShield is build on top of the uIP library ((an open source full TCP/IP stack implementation for resource-constrained embedded devices)) and greatly influenced by it. Smart folks implemented DHCP and zero configuration implementations on top of it. How do people execute projects of such complexity and what tools are being used?
Are you looking for some Arduino emulator? I think these two should get you started.
Emulino
Simavr
Use the simple programming software that can easily work with arduino chips but don't make your project in complex situation putting some complex programs.

Can you help improve one of my college's class on low level software and peripheral interfaces?

I am a 2nd year student at the Portuguese Engineering Faculty at the University of Oporto. I am currently studying for a Joint Degree (5 yr undergrad + masters) in Informatics and Computer engineering (which is basically software engineering :P).
I think the course is great, and well structured, but I was in for a nasty surprise.
For a class called Computer Labs (link to the syllabus, english), we have to use obsolete software - Windows 98/MS-DOS (because of protected mode limitations in XP+). I think this has no room in 2010 - even if we don't take into account the fact we should be learning multiplatform programming! All of my lecturers have made sure the software/technologies they selected was 1. updated, 2. compatible with AT LEAST the big three OSs (Mac/Win/Lin), and now this.
My knowledge of this sort of programming is insuficcient to effectively think of alternatives, but we want to change this situation for coming students.
Can I get your opinion and some suggestions for alternatives we can discuss with our lecturers? Please take the syllabus into account.
Thank you for your time!
PS: Extra info on the class here (english)
I looked at the syllabus and I think that this setup is appropriate for the goals of the class. The problem with more modern computers for a class on interfacing is that the operating system has become detached from the hardware. The HAL (hardware abstraction layer), Direct-X (graphics abstraction), and the modern toolkits for device driver development mean that interfacing to a modern Windows machine is (in my experience) more a task of understanding the security and framework requirements than it is learning what is involved in making code interact with electronic circuits. This is a course that sets the foundation for what you will learn when you get a job. It shouldn't be a course that teaches you what you will use on the job - in ten years no one will care if you had a school course interfacing to Windows Server 2010. But to add a robot control interface to the latest brain interfaced cell phone will still require an understanding of how code interacts with circuitry.
Low level programming of this sort cannot be compatible with multiple platforms. By definition, this is platform specific.
From a "working at home" point of view, it gets worse: this is hardware specific.
In my undergraduate course, we did this work on an embedded system (specifically, a Freescale HCS12 microcontroller) rather than using a general purpose PC. It still generally means that you can't work from home - we were provided with out-of-hours access to the lab - but emulators for microcontrollers tend to be about emulating the hardware rather than just getting the majority of software to work.
In terms of the syllabus you linked, we covered almost exactly the same material, with the only differences being that we used CPU12/Motorola assembly language rather than IA32 and a different set of tools. You could suggest using a simpler processor (such as the HC11 or HCS12), but the main advantage is that people expect it to be simple and understand that they can't use it at home: your situation doesn't change, but it is easier to accept.
dos is still alive and well, actively used in ATM (bank teller machines) cash registers, gas pumps, and the like. Basically is one of the most widely used embedded operating systems. The tools and (used) books, web information, etc are still available, inexpensive, etc. A balance of just the right amount of system calls with the freedom to get at the hardware without the OS getting in the way. The windows 3.x based kernels (windows 3.x up to windows 98 or maybe me) also easily allow for direct access with minimal operating system interference. Linux, Windows nt based kernels (windows nt, 2000, xp, etc) do not have those features, are too high level in their drivers, too much operating system in the way. The connection from dos/win3x to the present windows is still there and the student can then understand and use the more advanced/complicated modern operating system.
Encouraging DOS, AmigaOS, pdp-11 assembler, 6502 assembler, and the like in the curriculum is a good thing for future generations not a bad thing. Perhaps call it hands on computer history if you like but it is important to get a well rounded education in software engineering. Students will get a better understanding of the C language for example when they see the platform it was developed on/from (pdp-11/lsi-11). pdp11 is probably one of the best first assembly languages to teach (or msp430) and x86 is clearly the last you would ever teach if ever. (well briefly touching on I/O mapped memory vs memory mapped memory is important, also segmented architectures and how they were used instead of mmus is important, perhaps taught along side some harvard and other now less popular architectures).
Behind the curtain knowledge is dropping off at an alarming rate in the software industry. To the point of being a crisis. Fixing that starts at the schools. You cannot learn it with linux or windows 7 or anything like that.
If you want to replace this class with something else then non-operating system (non-rtos) microcontroller work. msp430 or ARM are good platforms for teaching C interrupts, have good tools, are good instruction sets for teaching for the some assembly that is required. ARM being the most widely used processor today means the student would be immediately marketable for the devices using that platform (mp3 players, mobile phones, pretty much everything handheld). avr and arduino is not bad, covers the same c and interrupt thing, but is not a great instruction set for teaching.

Resources