The document describes how to port and modify drivers for UART, Ethernet, LCD, and keypad on a Mango100 board running Android. It provides instructions on configuring the kernel, modifying driver source code files, and checking that the drivers are functioning properly. Key steps include enabling drivers in the kernel .config file, adding device registration code, and modifying functions to set GPIO pins and timing parameters for devices like the LCD. It also explains how to view input events in logcat and trace the flow of key events through the Android framework.
This code is controlling an access control system using an Arduino. It includes libraries for fingerprint scanning, camera, SD card, and NFC. It can unlock the door by matching a fingerprint, NFC tag, or both. When the door is opened, it takes a picture with the camera and saves it to an SD card. It puts the Arduino to sleep when the door is closed to save power.
This document discusses the crash reporting mechanism in Tizen. It describes the crash client, which handles crash signals and generates crash reports. It covers Samsung's crash-work-sdk and Intel's corewatcher crash clients. It also discusses the crash server that receives reports and the CrashDB web interface. Finally, it mentions crash reason location algorithms.
This document discusses using JavaScript for embedded programming on microcontrollers. It introduces Espruino, which allows programming microcontrollers using JavaScript. Espruino provides inexpensive hardware with peripherals and libraries, making it suitable for hobbyists and prototyping. In contrast to Arduino, Espruino includes a debugger. The document demonstrates examples of using Espruino to read temperature and humidity sensors and expose sensor data over Bluetooth Low Energy. It encourages exploring Espruino and related projects like Tessel and Neonious for embedded JavaScript development.
The document discusses using Phaser.io, Socket.io, and Arduino together to create an HTML5 game that can be controlled from an Arduino board. It provides code examples for setting up a Phaser game state and loading assets, connecting the game to a Socket.io server, reading input from an Arduino button to trigger actions over the socket, and blinking LEDs on the Arduino in response to game events. The document serves as a tutorial for building an HTML5-Arduino web game using these technologies.
This code is controlling an access control system using an Arduino. It includes libraries for fingerprint scanning, camera, SD card, and NFC. It can unlock the door by matching a fingerprint, NFC tag, or both. When the door is opened, it takes a picture with the camera and saves it to an SD card. It puts the Arduino to sleep when the door is closed to save power.
This document discusses the crash reporting mechanism in Tizen. It describes the crash client, which handles crash signals and generates crash reports. It covers Samsung's crash-work-sdk and Intel's corewatcher crash clients. It also discusses the crash server that receives reports and the CrashDB web interface. Finally, it mentions crash reason location algorithms.
This document discusses using JavaScript for embedded programming on microcontrollers. It introduces Espruino, which allows programming microcontrollers using JavaScript. Espruino provides inexpensive hardware with peripherals and libraries, making it suitable for hobbyists and prototyping. In contrast to Arduino, Espruino includes a debugger. The document demonstrates examples of using Espruino to read temperature and humidity sensors and expose sensor data over Bluetooth Low Energy. It encourages exploring Espruino and related projects like Tessel and Neonious for embedded JavaScript development.
The document discusses using Phaser.io, Socket.io, and Arduino together to create an HTML5 game that can be controlled from an Arduino board. It provides code examples for setting up a Phaser game state and loading assets, connecting the game to a Socket.io server, reading input from an Arduino button to trigger actions over the socket, and blinking LEDs on the Arduino in response to game events. The document serves as a tutorial for building an HTML5-Arduino web game using these technologies.
The document discusses using Phaser.io, Socket.io, and Arduino together to create an HTML5 game that can be controlled from an Arduino board. It provides code examples for setting up a Phaser game state and loading assets, connecting the game to a Socket.io server, reading input from an Arduino button to trigger actions over the socket, and blinking LEDs on the Arduino in response to game events. The document serves as a tutorial for building an HTML5-Arduino web game using these technologies.
The document provides an overview of various user-space system programming concepts in Linux including processes, signals, scheduling, and inter-process communication. It discusses APIs for process creation and management, signal handling techniques, and scheduling priorities. Examples of using processes, signals and waitpid are provided from SSH and BusyBox code.
The document appears to contain code snippets and documentation related to boundary scan testing and initialization of integrated circuits. Specifically, it includes:
1. Code examples for boundary scan register definitions using attributes like REGISTER_FIELDS, REGISTER_MNEMONICS, and REGISTER_ASSEMBLY.
2. Descriptions and examples of initialization data registers and related instructions/procedures for setting up I/O protocols, voltages, and clocks on chips.
3. Package definitions and examples that define and assemble segments for boundary scan registers and initialization data fields across multiple ICs.
The document contains information about various digital circuits that can be used for a VHDL practical exam, including code and simulations for:
1. A 4-bit by 4-bit multiplier circuit with VHDL code and a simulation forcing inputs and displaying outputs.
2. An 8-bit by 8-bit multiplier circuit with similar VHDL code and simulation.
3. A 128-bit by 8-bit RAM circuit with 1024 bits of memory, VHDL code, and a simulation storing values and reading them back out.
The document discusses Unix domain sockets and provides examples of client-server communication using Unix domain streams and datagrams, including passing file descriptors between processes and receiving sender credentials; it also describes the socket address structure for Unix domain sockets and functions like socketpair() and socket() for Unix domain communication on a single host.
The document discusses the "Hello World" program in C and assembly languages. It provides the C code, compiles and runs it using GCC and LLVM, and examines the output assembly code, object file and executable using various Linux tools like objdump, readelf, nm, and strace. It explains concepts like sections, segments, symbol tables, relocation records, and the role of linker and loader.
This document contains code for implementing a jamming attack in a mobile ad hoc network (MANET). It includes code for functions related to sending and processing Hello messages used for neighbor discovery and route maintenance. It also includes code for functions related to creating, sending, forwarding, and processing route reply (RREP) messages used for route discovery and maintenance in the ad hoc on-demand distance vector (AODV) routing protocol. The code implements optimizations for dealing with unidirectional links and extensions for including additional information in messages.
DEF CON 24 - Patrick Wardle - 99 problems little snitchFelipe Prado
Little Snitch is a host-based firewall for macOS that intercepts connection attempts and allows the user to approve or deny them. The document discusses understanding, bypassing, and reversing Little Snitch. It provides an overview of Little Snitch's components and architecture, describes several methods for bypassing its network filtering, and examines techniques for interacting with and disabling Little Snitch's kernel extension through the I/O Kit framework.
La société Farjump propose une solution simple, innovante et bon marché pour la mise au point des systèmes embarqués utilisés dans l'IoT. La solution est basé sur la mise en place d'agents GDB sur la cible.
- VHDL is a hardware description language used to model digital circuits.
- In VHDL, components are used to model lower-level blocks that can be connected together to form more complex systems. Components are declared using ENTITY and ARCHITECTURE.
- Structural description models the internal connections between lower-level components. Components are instantiated using the PORT MAP statement to connect their ports to signals.
This document discusses binary vulnerabilities and methods for identifying and exploiting them. It covers topics like stack overflows, heap overflows, integer overflows, and pointer vulnerabilities. It also discusses vulnerability metrics, identifiers, and tools that can be used for analysis like fuzzers, symbolic execution, and decompilers. Exploitation techniques like bypassing protections and transferring control are also mentioned.
Kernel Recipes 2016 - Why you need a test strategy for your kernel developmentAnne Nicolas
Testing is important. That’s a well known fact that very few developers will dispute. Why is then so little kernel code covered by a clear testing strategy ? Through real stories about test plans (or the lack thereof), this talk will convince you that none of your excuses for not having a test strategy are valid. You will learn how various parts of the Linux kernel have approached testing and how you can benefit from their experience. The talk will use the V4L2 subsystem to demonstrate the use of test tools, but will be applicable to kernel development in general.
Laurent Pinchart
[ZigBee 嵌入式系統] ZigBee 應用實作 - 使用 TI Z-Stack FirmwareSimen Li
The document outlines an application called BasicApp that is used to understand the basic operations of the OSAL (Operating System Abstraction Layer) embedded in the ZigBee firmware. It describes initializing tasks using OSAL, processing events, and handling key presses to control an LED using the HAL (Hardware Abstraction Layer) APIs. The code files for the BasicApp include OSAL_BasicApp.c for task initialization, BasicApp.h for constants and function declarations, and BasicApp.c which implements the task event processing and key handling functions.
The document discusses kernel debugging techniques. It covers analyzing kernel error logs, debugging memory errors, detecting kernel deadlocks, and troubleshooting login issues. The key debugging steps involve prerequisites like having the kernel source code, reading the error logs and call traces to understand the bug, and tracing from assembly to C code to transactions. Memory debugging tools like AddressSanitizer are also covered.
Architecture for Massively Parallel HDL Simulations DVClub
This document describes Art of Silicon's architecture for massively parallel HDL simulations using Verilator. It allows running many simulations concurrently by generating a single testbench that can run on both Verilator and event-driven simulators. Identical C++ stimulus and checking code interfaces with the design through "gaskets". Logs are captured in a unified format across platforms for easy triage. This approach maximizes engineer productivity by minimizing idle simulation time.
The document discusses exploiting vulnerabilities in the ProSSHD remote administration software. It begins by explaining how to set up a vulnerable virtual machine installation of ProSSHD. It then covers the steps of exploit development, including crashing the ProSSHD server process to gain control of EIP, determining the offset to overwrite EIP, finding opcodes to redirect execution, selecting and testing shellcode, and building the final exploit payload. Debugging tips are provided to analyze crashes, determine space constraints, and identify bad characters.
This program controls a robot using a microcontroller. It defines pins for sensors and motors, includes libraries, and declares interrupt routines to control pulse-width modulation for motor speed. The main routine initializes ports, timers and interrupts, then calls functions for the robot to scan its environment, turn right, and repeat in a loop.
There's Waldo by Patrick Wardle & Colby MooreShakacon
Mobile apps are truly ubiquitous and enhance our lives in many ways. However, many either leak or insecurely handle geolocation data, affording an attacker the ability to locate, track, or even determine a user’s identity. This talk describes classes of geolocation vulnerabilities, how apps may be audited to find such bugs, and best practices to ensure users remain protected. To provide a more 'hands-on' feel, real world case studies are presented to demonstrate attacks uncovered by Synack researchers.
The talk will begin with a technical overview of geolocation capabilities in mobile OSs and how apps may access a user's location. Next the talk will identify common classes of geolocation bugs and illustrate how developers often utilize a user's location in an insecure manner. One example, since geolocation APIs may default to the highest level of accuracy, a user's precise location may be revealed if not properly secured (on the device, in transit, or in the cloud).
Unfortunately, as our case studies show, such bugs are alarmingly common (numerous popular applications will be mentioned). A specific case study on Grindr (a common dating app), will be presented to illustrate a myriad of geolocation bugs that placed its users in harm’s way (see: 'Grindr vulnerability places men in harm's way' http://goo.gl/dg4cs6). First, due to the lack of SSL pinning, we present a MitM attack that reveals the user's exact location. Following this, we demonstrate a scalable remote attack. This attack combined several bugs, including the fact that the app reported (to anybody), the precise relative distance of all 'near-by' users. With these distances and the ability to spoof one's location and perform unlimited requests, trilateration could precisely locate and track users world-wide. Unfortunately though we reported the bugs, patches only appeared after it was reported that the Egyptian government was tracking and arresting Grindr users.
Step by step demonstrations will be given, showing how we were able to harvest data and run calculations to determine tens of thousands of user's locations in real time. But it would be silly if we stopped there... Leveraging our capability we demonstrate a custom framework developed to map patterns of life and subsequently correlate these patters to true identity. By setting "hot spots" in our framework (think celebrity homes or US capitols) we can monitor target locations for user activity - potentially exposing identities of parties that may traditionally wish to remain private such as celebrities, athletes, and politicians. And yes, it works ;).
The document discusses using Phaser.io, Socket.io, and Arduino together to create an HTML5 game that can be controlled from an Arduino board. It provides code examples for setting up a Phaser game state and loading assets, connecting the game to a Socket.io server, reading input from an Arduino button to trigger actions over the socket, and blinking LEDs on the Arduino in response to game events. The document serves as a tutorial for building an HTML5-Arduino web game using these technologies.
The document provides an overview of various user-space system programming concepts in Linux including processes, signals, scheduling, and inter-process communication. It discusses APIs for process creation and management, signal handling techniques, and scheduling priorities. Examples of using processes, signals and waitpid are provided from SSH and BusyBox code.
The document appears to contain code snippets and documentation related to boundary scan testing and initialization of integrated circuits. Specifically, it includes:
1. Code examples for boundary scan register definitions using attributes like REGISTER_FIELDS, REGISTER_MNEMONICS, and REGISTER_ASSEMBLY.
2. Descriptions and examples of initialization data registers and related instructions/procedures for setting up I/O protocols, voltages, and clocks on chips.
3. Package definitions and examples that define and assemble segments for boundary scan registers and initialization data fields across multiple ICs.
The document contains information about various digital circuits that can be used for a VHDL practical exam, including code and simulations for:
1. A 4-bit by 4-bit multiplier circuit with VHDL code and a simulation forcing inputs and displaying outputs.
2. An 8-bit by 8-bit multiplier circuit with similar VHDL code and simulation.
3. A 128-bit by 8-bit RAM circuit with 1024 bits of memory, VHDL code, and a simulation storing values and reading them back out.
The document discusses Unix domain sockets and provides examples of client-server communication using Unix domain streams and datagrams, including passing file descriptors between processes and receiving sender credentials; it also describes the socket address structure for Unix domain sockets and functions like socketpair() and socket() for Unix domain communication on a single host.
The document discusses the "Hello World" program in C and assembly languages. It provides the C code, compiles and runs it using GCC and LLVM, and examines the output assembly code, object file and executable using various Linux tools like objdump, readelf, nm, and strace. It explains concepts like sections, segments, symbol tables, relocation records, and the role of linker and loader.
This document contains code for implementing a jamming attack in a mobile ad hoc network (MANET). It includes code for functions related to sending and processing Hello messages used for neighbor discovery and route maintenance. It also includes code for functions related to creating, sending, forwarding, and processing route reply (RREP) messages used for route discovery and maintenance in the ad hoc on-demand distance vector (AODV) routing protocol. The code implements optimizations for dealing with unidirectional links and extensions for including additional information in messages.
DEF CON 24 - Patrick Wardle - 99 problems little snitchFelipe Prado
Little Snitch is a host-based firewall for macOS that intercepts connection attempts and allows the user to approve or deny them. The document discusses understanding, bypassing, and reversing Little Snitch. It provides an overview of Little Snitch's components and architecture, describes several methods for bypassing its network filtering, and examines techniques for interacting with and disabling Little Snitch's kernel extension through the I/O Kit framework.
La société Farjump propose une solution simple, innovante et bon marché pour la mise au point des systèmes embarqués utilisés dans l'IoT. La solution est basé sur la mise en place d'agents GDB sur la cible.
- VHDL is a hardware description language used to model digital circuits.
- In VHDL, components are used to model lower-level blocks that can be connected together to form more complex systems. Components are declared using ENTITY and ARCHITECTURE.
- Structural description models the internal connections between lower-level components. Components are instantiated using the PORT MAP statement to connect their ports to signals.
This document discusses binary vulnerabilities and methods for identifying and exploiting them. It covers topics like stack overflows, heap overflows, integer overflows, and pointer vulnerabilities. It also discusses vulnerability metrics, identifiers, and tools that can be used for analysis like fuzzers, symbolic execution, and decompilers. Exploitation techniques like bypassing protections and transferring control are also mentioned.
Kernel Recipes 2016 - Why you need a test strategy for your kernel developmentAnne Nicolas
Testing is important. That’s a well known fact that very few developers will dispute. Why is then so little kernel code covered by a clear testing strategy ? Through real stories about test plans (or the lack thereof), this talk will convince you that none of your excuses for not having a test strategy are valid. You will learn how various parts of the Linux kernel have approached testing and how you can benefit from their experience. The talk will use the V4L2 subsystem to demonstrate the use of test tools, but will be applicable to kernel development in general.
Laurent Pinchart
[ZigBee 嵌入式系統] ZigBee 應用實作 - 使用 TI Z-Stack FirmwareSimen Li
The document outlines an application called BasicApp that is used to understand the basic operations of the OSAL (Operating System Abstraction Layer) embedded in the ZigBee firmware. It describes initializing tasks using OSAL, processing events, and handling key presses to control an LED using the HAL (Hardware Abstraction Layer) APIs. The code files for the BasicApp include OSAL_BasicApp.c for task initialization, BasicApp.h for constants and function declarations, and BasicApp.c which implements the task event processing and key handling functions.
The document discusses kernel debugging techniques. It covers analyzing kernel error logs, debugging memory errors, detecting kernel deadlocks, and troubleshooting login issues. The key debugging steps involve prerequisites like having the kernel source code, reading the error logs and call traces to understand the bug, and tracing from assembly to C code to transactions. Memory debugging tools like AddressSanitizer are also covered.
Architecture for Massively Parallel HDL Simulations DVClub
This document describes Art of Silicon's architecture for massively parallel HDL simulations using Verilator. It allows running many simulations concurrently by generating a single testbench that can run on both Verilator and event-driven simulators. Identical C++ stimulus and checking code interfaces with the design through "gaskets". Logs are captured in a unified format across platforms for easy triage. This approach maximizes engineer productivity by minimizing idle simulation time.
The document discusses exploiting vulnerabilities in the ProSSHD remote administration software. It begins by explaining how to set up a vulnerable virtual machine installation of ProSSHD. It then covers the steps of exploit development, including crashing the ProSSHD server process to gain control of EIP, determining the offset to overwrite EIP, finding opcodes to redirect execution, selecting and testing shellcode, and building the final exploit payload. Debugging tips are provided to analyze crashes, determine space constraints, and identify bad characters.
This program controls a robot using a microcontroller. It defines pins for sensors and motors, includes libraries, and declares interrupt routines to control pulse-width modulation for motor speed. The main routine initializes ports, timers and interrupts, then calls functions for the robot to scan its environment, turn right, and repeat in a loop.
There's Waldo by Patrick Wardle & Colby MooreShakacon
Mobile apps are truly ubiquitous and enhance our lives in many ways. However, many either leak or insecurely handle geolocation data, affording an attacker the ability to locate, track, or even determine a user’s identity. This talk describes classes of geolocation vulnerabilities, how apps may be audited to find such bugs, and best practices to ensure users remain protected. To provide a more 'hands-on' feel, real world case studies are presented to demonstrate attacks uncovered by Synack researchers.
The talk will begin with a technical overview of geolocation capabilities in mobile OSs and how apps may access a user's location. Next the talk will identify common classes of geolocation bugs and illustrate how developers often utilize a user's location in an insecure manner. One example, since geolocation APIs may default to the highest level of accuracy, a user's precise location may be revealed if not properly secured (on the device, in transit, or in the cloud).
Unfortunately, as our case studies show, such bugs are alarmingly common (numerous popular applications will be mentioned). A specific case study on Grindr (a common dating app), will be presented to illustrate a myriad of geolocation bugs that placed its users in harm’s way (see: 'Grindr vulnerability places men in harm's way' http://goo.gl/dg4cs6). First, due to the lack of SSL pinning, we present a MitM attack that reveals the user's exact location. Following this, we demonstrate a scalable remote attack. This attack combined several bugs, including the fact that the app reported (to anybody), the precise relative distance of all 'near-by' users. With these distances and the ability to spoof one's location and perform unlimited requests, trilateration could precisely locate and track users world-wide. Unfortunately though we reported the bugs, patches only appeared after it was reported that the Egyptian government was tracking and arresting Grindr users.
Step by step demonstrations will be given, showing how we were able to harvest data and run calculations to determine tens of thousands of user's locations in real time. But it would be silly if we stopped there... Leveraging our capability we demonstrate a custom framework developed to map patterns of life and subsequently correlate these patters to true identity. By setting "hot spots" in our framework (think celebrity homes or US capitols) we can monitor target locations for user activity - potentially exposing identities of parties that may traditionally wish to remain private such as celebrities, athletes, and politicians. And yes, it works ;).
The document discusses modifying u-boot source code to port it to the Mango64 board based on the S3C6410 processor. It describes adding board configuration files, modifying hardware initialization code, and updating macros and definitions to support the board's hardware. Key files modified include the Makefile, device tree, board initialization code, and board-specific configuration header. The goal is to enable features like SD card detection and eventually add other functionality supported by the port.
The document discusses adding menu options and icons for sound driver selection on Android. It involves:
1. Modifying the kernel configuration to include WM8960 and SPDIF drivers.
2. Creating menu strings and arrays in the Settings app for the sound change options.
3. Implementing a SoundChangeManager in the framework to set the sound mode from apps and broadcast state changes.
4. Adding JNI functions and HAL code to actually change the sound driver on selection.
The end result is a new sound change setting and icons in the Android system settings to allow selecting between the WM8960 and SPDIF sound drivers.
This sample program demonstrates how to access Meinberg GPS receivers via the binary data protocol. It can work via a serial port or network socket connection depending on the target operating system. It requires several other modules and supports Windows, Linux, QNX, and DOS targets. The program checks return codes from API functions, gets receiver information, status information, position, time zone, and synthesizer settings. It also has the ability to set the synthesizer frequency and phase.
HSA enables more efficient compilation of high-level programming interfaces like OpenACC and C++AMP. For OpenACC, HSA provides flexibility in implementing data transfers and optimizing nested parallel loops. For C++AMP, HSA allows efficient compilation from an even higher level interface where GPU data and kernels are modeled as C++ containers and lambdas, without needing to specify data transfers. Overall, HSA aims to reduce boilerplate code for heterogeneous programming and provide better portability across devices.
This document discusses RISC-V boot processes using the Berkeley Boot Loader (BBL) and RISC-V Proxy Kernel (PK). It explains how upon reset, code in Machine mode initializes the system and switches to Supervisor mode. The boot loader then loads an application ELF into memory. For BBL, it loads a Linux kernel, and for PK it loads a user application. Control is then transferred to the loaded program in User mode. Trap handling mechanisms involving different privilege modes are also covered.
How do I draw the Labview code for pneumatic cylinder(air pistion). .pdffootstatus
How do I draw the Labview code for pneumatic cylinder(air pistion). (Start with banana-plug>>
Pneumatic cylinder(air pistion) moves back and forward certain times or certain seconds>> end)
Solution
#include
#include
#include
#include
#include \"RTClib.h\"
#define LOG_INTERVAL 1 // milsec betweens entries
#define SYNC_INTERVAL 100
uint32_t syncTime =0;
RTC_DS1307 RTC; // Real Time Clock
// On the Ethernet Shield, CS is pin 4. Note that even if it\'s not
// used as the CS pin, the hardware CS pin (10 on most Arduino boards,
// 53 on the Mega) must be left as an output or the SD library
// functions will not work.
const int chipSelect = 10;
//switch inputs and variables
const int kPinReedSwitch1 = 22;
const int kPinReedSwitch2 = 24;
const int relayPin = 26;
int strokedown = 0;
int inc = 0;
int precountA =0;
int precountB = 0;
int count = 0;
int runcycles = 20;
int reset = 0;
int initial = 1;
int start =1;
int LinearPot1Pin = A0; // select the input pin for the potentiometer
float sensorValue = 0.0; // variable to store the value coming from the sensor
int MC_travel = 0;
int on =0;
//logging file
File logfile;
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
void error(char *str)
{
Serial.print(\"error: \");
Serial.println(str);
while(1);
}
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// Input pins for Arduino
pinMode(kPinReedSwitch1, INPUT_PULLUP);
pinMode(kPinReedSwitch2, INPUT_PULLUP);
pinMode(relayPin, OUTPUT);
Serial.print(\"Initializing SD card...\");
// make sure that the default chip select pin is set to
// output, even if you don\'t use it:
pinMode(53, OUTPUT);
// see if the card is present and can be initialized:
if (!SD.begin(10,11,12,13)) {
Serial.println(\"Card failed, or not present\");
// don\'t do anything more:
return;
}
Serial.println(\"card initialized.\");
// creating a new file for data logger
char filename[] = \"LOGGER00.CSV\";
for (uint8_t i = 0; i < 100; i++){
filename[6] = i/10 + \'0\';
filename[7] = i%10 + \'0\';
if(! SD.exists(filename)){
logfile = SD.open(filename, FILE_WRITE);
break;
}
}
if (!logfile) {
error(\"couldnt create file\");
}
Serial.print(\"Logging to:\");
Serial.println(filename);
logfile.println(\"MC Travel\");
// LCD initialization
lcd.begin(20,4);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(\"Count: \");
lcd.setCursor(0,1);
lcd.print(\"MC Travel: in\");
}
void loop()
{
for(int i = 1; i < 2; i++ )
//an initialization routine just to get cylinder to \"home\"
//although should never really be away from home
{
digitalWrite(relayPin, HIGH);
delay(200);
digitalWrite(relayPin, LOW);
delay (2000);
}
while( count <= runcycles){
if( start ==1 && digitalRead(kPinReedSwitch1)==HIGH){
digitalWrite(relayPin, HIGH);
}
else if (digitalRead(kPinReedSwitch1) == LOW)
// turns on relay when reed switch A is triggered
// Logic reversed because of pullup resistors
{
strokedown = 1;
precountA =1;
start=0;// .
The document provides instructions for setting up a TI-RTOS project for the CC1352R wireless microcontroller. It describes creating a CCS project targeting the CC1352R, configuring compiler and linker settings, generating a system configuration file, and adding TI-RTOS and driver library files. The goal is to build a basic "hello world" project to demonstrate real-time operating system functionality on the CC1352R wireless microcontroller.
PLEASE HELP!Modify the source code to implement the followingCh.pdfforecastfashions
The code is modified to change the LED color based on button presses. Pushing the left button changes the LED to red. Pushing the right button changes the LED to green. Pushing both buttons together changes the LED to blue. Additional functionality is added to sample an analog signal and display the value and digital input on the UART.
This document contains code for configuring a UART communication between a microcontroller and MATLAB using a serial port. It includes code for initializing the UART, transmitting and receiving characters, and an interrupt service routine to blink LEDs in response to received characters. It also describes including header files and shows an example GUI in MATLAB for sending characters over the serial port to control LEDs on the microcontroller.
CUDA lab's slides of "parallel programming" courseShuai Yuan
This document provides an overview of the CUDA lab including the programming environment, GPU server specifications, CUDA tools, lab assignments, and programming tips. The GPU server has two Intel Xeon CPUs and two NVIDIA K20X GPUs with 5760MB of memory each. The lab assignments involve rewriting CPU programs to CUDA kernels and optimizing parallel reduction algorithms. CUDA tools demonstrated include cuda-memcheck for error checking and nvidia-smi for querying the GPU state. Programming tips cover kernel launch configuration, thread indexing, memory transfers, synchronization, and profiling kernel execution time.
seccomp is a computer security facility in the Linux kernel, pledge is a similar security facility in the OpenBSD kernel. In this presentation Giovanni Bechis will review the development story and progress of both kernel interfaces and will analyze the main differences. There will be some examples of implementations of security patches made for some important open source projects.
Runtime Code Generation and Data Management for Heterogeneous Computing in JavaJuan Fumero
This document discusses runtime and data management techniques for heterogeneous computing in Java. It presents an approach that uses three levels of abstraction: parallel skeletons API based on functional programming, a high-level optimizing library that rewrites operations to target specific hardware, and OpenCL code generation and runtime with data management for heterogeneous architectures. It describes how the runtime performs type inference, IR generation, optimizations, and kernel generation to compile Java code into OpenCL kernels. It also discusses how custom array types are used to reduce data marshaling overhead between the Java and OpenCL runtimes.
The following code is an implementation of the producer consumer pro.pdfmarketing413921
The following code is an implementation of the producer consumer problem using a software
locking mechanism. Your tasks here require you to debug the code with the intent of achieving
the following tasks:
Task 1: Identifying the critical section
Task 2: Identify the software locks and replace them with a simplified mutex lock and unlock.
HINT: The code provided relies heavily on the in and out pointers of the buffer. You should
make the code run on a single count variable.
#include
#include
#include
#include
#define MAXSIZE 100
#define ITERATIONS 1000
int buffer[MAXSIZE]; // buffer
int nextp, nextc; // temporary storage
int count=0;
void printfunction(void * ptr)
{
int count = *(int *) ptr;
if (count==0)
{
printf(\"All items produced are consumed by the consumer \ \");
}
else
{
for (int i=0; i<=count; i=i+1)
{
printf(\"%d, \\t\",buffer[i]);
}
printf(\"\ \");
}
}
void *producer(void *ptr)
{
int item, flag=0;
int in = *(int *) ptr;
do
{
item = (rand()%7)%10;
flag=flag+1;
nextp=item;
buffer[in]=nextp;
in=((in+1)%MAXSIZE);
while(count <= MAXSIZE)
{
count=count+1;
printf(\"Count = %d - incremented at producer\ \", count);
}
} while (flag<=ITERATIONS);
pthread_exit(NULL);
}
void *consumer(void *ptr)
{
int item, flag=ITERATIONS;
int out = *(int *) ptr;
do
{
while (count >0)
{
nextc = buffer[out];
out=(out+1)%MAXSIZE;
printf(\"\\tCount = %d - decremented at consumer\ \", count, flag);
count = count-1;
flag=flag-1;
}
if (count <= 0)
{
printf(\"consumer made to wait...faster than producer.\ \");
}
}while (flag>=0);
pthread_exit(NULL);
}
int main(void)
{
int in=0, out=0; //pointers
pthread_t pro, con;
// Spawn threads
pthread_create(&pro, NULL, producer, &count);
pthread_create(&con, NULL, consumer, &count);
if (rc1)
{
printf(\"ERROR; return code from pthread_create() is %d\ \", rc1);
exit(-1);
}
if (rc2)
{
printf(\"ERROR; return code from pthread_create() is %d\ \", rc2);
exit(-1);
}
// Wait for the threads to finish
// Otherwise main might run to the end
// and kill the entire process when it exits.
pthread_join(pro, NULL);
pthread_join(con, NULL);
printfunction(&count);
}
Solution
#include
#include
#include
#include
#define MAXSIZE 100
#define ITERATIONS 1000
int buffer[MAXSIZE]; // buffer
int nextp, nextc; // temporary storage
int count=0;
void printfunction(void * ptr)
{
int count = *(int *) ptr;
if (count==0)
{
printf(\"All items produced are consumed by the consumer \ \");
}
else
{
for (int i=0; i<=count; i=i+1)
{
printf(\"%d, \\t\",buffer[i]);
}
printf(\"\ \");
}
}
void *producer(void *ptr)
{
int item, flag=0;
int in = *(int *) ptr;
do
{
item = (rand()%7)%10;
flag=flag+1;
nextp=item;
buffer[in]=nextp;
in=((in+1)%MAXSIZE);
while(count <= MAXSIZE)
{
count=count+1;
printf(\"Count = %d - incremented at producer\ \", count);
}
} while (flag<=ITERATIONS);
pthread_exit(NULL);
}
void *consumer(void *ptr)
{
int item, flag=ITERATIONS;
int out = *(int *) ptr;
do
{
while (count >0)
{
nextc = buffer[out];
out=(out+1)%MAXSIZE;
printf(\"\\tCount = %d - decreme.
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Vincenzo Iozzo
Charlie Miller and Vincenzo Iozzo presented techniques for post-exploitation on the iPhone 2 including:
1. Running arbitrary shellcode by overwriting memory protections and calling vm_protect to mark pages as read/write/executable.
2. Loading an unsigned dynamic library called Meterpreter by mapping it over an existing signed library, patching dyld to ignore code signing, and forcing unloaded of linked libraries.
3. Adding new functionality to Meterpreter, such as a module to vibrate and play a sound on the iPhone, demonstrating how payloads can be extended once loaded into memory.
The document discusses analyzing crashes using WinDbg. It provides tips on reconstructing crashed call stacks and investigating what thread or lock is causing a hang. The debugging commands discussed include !analyze, !locks, .cxr, kb to find the crashing function and stuck thread.
The document contains Verilog code for a single cycle processor including modules for a program counter, accumulator, ALU, adder, multiplexers, controller, data memory, instruction memory, and a test bench. It describes the design and implementation of the datapath and controller for a simple CPU using Verilog that performs arithmetic and logical operations on data stored in memory locations.
Samrt attendance system using fingerprintpraful borad
This document contains code for a fingerprint attendance system using an Arduino. It includes code to initialize various hardware components like an LCD display, fingerprint sensor, thermal printer and keypad. The code allows users to enroll fingerprints by capturing images of a finger, converting it to a template and storing it. It also displays messages to guide the user through the enrollment process and handles any errors.
The document provides instructions for setting up an ESP8266 microcontroller to control appliances remotely via MQTT and radio frequency signals. It explains how to connect the ESP8266 to WiFi, set up an MQTT client, and subscribe to commands topics to control plugs by sending RF codes when messages are received. Code examples are given to demonstrate publishing sensor data to MQTT and handling incoming messages to trigger the RF transmitter as needed.
This document discusses PostgreSQL and Solaris as a low-cost platform for medium to large scale critical scenarios. It provides an overview of PostgreSQL, highlighting features like MVCC, PITR, and ACID compliance. It describes how Solaris and PostgreSQL integrate well, with benefits like DTrace support, scalability on multicore/multiprocessor systems, and Solaris Cluster support. Examples are given for installing PostgreSQL on Solaris using different methods, configuring zones for isolation, using ZFS for storage, and monitoring performance with DTrace scripts.
1) The document discusses the process of adding Ethernet functionality to an Android device using the MangoBoard. It describes initializing the Ethernet service during boot up and registering it with the ConnectivityService.
2) When an Ethernet connection is detected, the EthernetMonitor thread notifies the EthernetStateTracker which triggers DHCP configuration of the interface.
3) The DHCPHandler is then sent a message to start the DHCP process and obtain an IP address for the connected Ethernet interface.
The document discusses the partition layouts of the Mango100 board's NAND flash and SD/MMC storage. For NAND, there are three partitions for the bootloader, kernel, and filesystem. For SD/MMC, fdisk is used to create partitions including FAT32, GNOME, and Android filesystems which are then formatted and mounted.
This document discusses two booting modes for the Mango64 (S3C6410) - NOR mode and NAND mode. NOR mode boots from the internal NOR flash memory, while NAND mode boots from an external NAND flash memory. The document provides information on turning each mode on.
This document provides diagrams and component lists for the bottom and top sides of a Mango64 board. The bottom diagram labels 29 components including the S3C6410 processor, RAM chips, and various connectors. The top diagram focuses on the LCD components, labeling 14 parts including the LCD screen, LEDs, and buttons. Both diagrams include references to an online cafe for more information on embedded systems and the Mango64 board.
This document analyzes the $BOARDNAME.h file in U-boot. It describes the contents and purpose of this important file that defines board-specific configurations for U-boot. It provides examples of definitions for the Mango100 board related to memory layout, boot settings, Ethernet/USB configurations, and NAND support.
1. 망고100 보드로 놀아보자-15
UART,Keypad,이더넷 드라이버
안드로이드에서 키 처리
http://cafe.naver.com/embeddedcrazyboys
2. DEBUG PORT 포팅
$(topdir)./config 파일에서
CONFIG_S3C_LOWLEVEL_UART_PORT=1
# CONFIG_SPLIT_ROOT_FILESYSTEM is not set
Kernel configuration에서
“kernel hacking-> S3C UART to use for low-level debug “
에서 1 선택
./arch/arm/plat-s3c/include/plat/uncompress.h 소스에 포함
#define uart_base S3C_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT)
.dev_name = "s3c2410_serial",
./drivers/serial/samsung.c 에서 디바이스 이름을 수정 할 수 있습니다.
3. LCD 드라이버 수정-1
#make menuconfig
“Device Drivers->Graphic Support
->Support for frame buffer devices
->S3C Framebuffer support 선택
4. LCD 드라이버 수정-2
void lcd_power_ctrl(s32 value)
{
int err;
./drivers/video/samsung/s3cfb_lte480wv.c
if (value) {
if (gpio_is_valid(S5PC1XX_GPH0(2))) {
에서 lcd_power_ctrl함수를 수정
err = gpio_request(S5PC1XX_GPH0(2), "GPH0"); LCD 에 전원을 인가한다.
if (err) {
printk(KERN_ERR "failed to request GPH0 for "
"lcd reset controln");
}
gpio_direction_output(S5PC1XX_GPH0(2), 1);
}
}
else {
if (gpio_is_valid(S5PC1XX_GPH0(2))) {
err = gpio_request(S5PC1XX_GPH0(2), "GPH0");
if (err) {
printk(KERN_ERR "failed to request GPH0 for "
"lcd reset controln");
}
gpio_direction_output(S5PC1XX_GPH0(2), 0);
}
}
gpio_free(S5PC1XX_GPH0(2));
lcd_power = value;
}
18. Keypad driver
“Kernel hacking “ 설정
CONFIG_TIMER_STATS=y 로 설정
To activate the collection of stats
# echo 1 > /proc/timer_stats
# cat /proc/timer_stats
Timer Stats Version: v0.2
Sample period: 2.911 s
291, 1 swapper mango100_keypad_config (mango100_rd_timer_handler)
2, 1 swapper schedule_delayed_work_on (delayed_work_timer_fn)
8, 1867 er.ServerThread futex_wait (hrtimer_wakeup)
3, 1 swapper phy_start_machine (phy_timer)
3, 1832 zygote queue_delayed_work (delayed_work_timer_fn)
1, 0 swapper page_writeback_init (wb_timer_fn)
308 total events, 105.805 events/sec
# echo 0 > /proc/timer_stats To stop collecting stats
19. Keypad driver flow
Button (Hardware)
10ms 마다 스캔
mango100_keypad.rd_timer GET_KEYPAD_DATA
mango100_rd_timer_handler
generate_keycode
mango100_keypad_control input_report_key
에서 이벤트 발생
20. 안드로이드 Key event 처리
Key button Map 정의는 vendorsecmango100mango100-keypad.kl
frameworks/base/libs/EventHub.cpp에 scan_dir,open_device 정의
KeyInputQueue( 1853): InputDeviceReader.run()
static const char *device_path = "/dev/input"; int EventHub::scan_dir(const char *dirname)
bool EventHub::openPlatformInput(void)
{
{
.. while((de = readdir(dir))) {
res = scan_dir(device_path);
..
strcpy(filename, de->d_name);
} open_device(devname);
}
}
int EventHub::open_device(const char *deviceName)
21. 안드로이드 Key event 처리
export ANDROID_ROOT /system
/init.rc에 정의
int EventHub::open_device(const char *deviceName)
{
…
const char* root = getenv("ANDROID_ROOT");
property_get("persist.sys.keylayout", keylayout, "qwerty"); I/EventHub( 1853): 2:devname = qwerty,
snprintf(keylayoutFilename, sizeof(keylayoutFilename),
"%s/usrkeylayout/%s.kl", root, keylayout); keylayout =qwerty,
strcpy(devname, keylayout); keylayoutFilename = /system/usr/keylayout/qwerty
bool defaultKeymap = access(keylayoutFilename, R_OK);
if (defaultKeymap) { -#logcat 명령으로 디버깅 메시지 출력
snprintf(keylayoutFilename, sizeof(keylayoutFilename),
"%s/usr/keylayout/%s.kl", root, "qwerty");
strcpy(devname, "qwerty"); frameworks/base/libs/ui/EventHub.cpp파일에
} EventHub::open_device함수에 정의
LOGI("2:devname = %s, keylayout =%s, keylayoutFilename = %s",
devname, keylayout, keylayoutFilename);
device->layoutMap->load(keylayoutFilename);
….
}
22. 안드로이드 Key event 처리
int EventHub::open_device(const char *deviceName)
{
…
LOGI("New keyboard: publicID=%d device->id=0x%x devname='%s' propName='%s' keylayout='%s'n",
publicID, device->id, name, propName, keylayoutFilename);
}
LOGI("New device: path=%s name=%s id=0x%x (of 0x%x) index=%d fd=%d classes=0x%xn",
deviceName, name, device->id, mNumDevicesById, mFDCount, fd, device->classes);
LOGV("Adding device %s %p at %d, id = %d, classes = 0x%xn",
deviceName, device, mFDCount, devid, device->classes);
}
frameworks/base/libs/ui/EventHub.cpp 에 open_device 정의
#logcat 명령으로 출력 결과
I/EventHub( 1853): New keyboard: publicID=65537 device->id=0x10001
devname='mango100-keypad' propName='hw.keyboards.65537.devname' keylayout='/system/usr/keylayout/qwerty.kl'
I/EventHub( 1853): New device: path=/dev/input/event0 name=mango100-keypad id=0x10001 (of 0x2) index=2 fd=58 classes=0x1
23. 안드로이드 Key event 처리
Key Event 처리
Thread mThread = new Thread("InputDeviceReader") {
Thread
public void run() {
if (DEBUG) Log.v(TAG, "InputDeviceReader.run()");
android.os.Process.setThreadPriority(
android.os.Process.THREAD_PRIORITY_URGENT_DISPLAY);
RawInputEvent ev = new RawInputEvent();
while (true) {
#logcat 메시지
try {
InputDevice di;
I/KeyInputQueue( 1853): Input event:
// block, doesn't release the monitor
readEvent(ev); dev=0x10001 type=0x1 scancode=158
keycode=4 value=1
boolean send = false;
boolean configChanged = false;
if (true) {
Log.i(TAG, "Input event: dev=0x" Mango100-keypad.kl과 scancode값 일치
+ Integer.toHexString(ev.deviceId)
+ " type=0x" + Integer.toHexString(ev.type) BACK 키 수행이 됨
+ " scancode=" + ev.scancode ./frameworks/base/services/java/
+ " keycode=" + ev.keycode
+ " value=" + ev.value);
com/android/server/KeyInputQueue.java
} 파일에 정의
24. 안드로이드 Key event 처리
frameworks/base/services/java/com/android/server/KeyI
frameworks/base/services/jni/
nputQueue.java com_android_server_KeyInputQueue.cpp
Thread mThread = new Thread("InputDeviceReader") {
…..
while (true) {
try {
InputDevice di;
// block, doesn't release the monitor
readEvent(ev);
……
25. 안드로이드 Key event 처리
public final boolean dispatch(Callback receiver, DispatcherState state,
Object target) {
switch (mAction) { public void handleUpEvent(KeyEvent event) {
…. final int keyCode = event.getKeyCode();
case ACTION_UP: if (DEBUG) Log.v(TAG, "Handle key up " + event + ": " + this);
if (DEBUG) Log.v(TAG, "Key up to " + target + " in " + state
+ ": " + this);
if (state != null) {
state.handleUpEvent(this);
}
return receiver.onKeyUp(mKeyCode, this);
./frameworks/base/core/java/android/view/KeyEvent.java
에서 dispatch를 한다.
#logcat 수행 결과
KeyEvent( 1910): Key up to android.inputmethodservice.InputMethodService$InputMethodSessionImpl@43da0b40 in
android.view.KeyEvent$DispatcherState@43d92cf8: KeyEvent{action=1 code=4 repeat=0 meta=0 scancode=158 mFlags=8}
V/KeyEvent( 1910): Handle key up KeyEvent{action=1 code=4 repeat=0 meta=0 scancode=158 mFlags=8}: a
ndroid.view.KeyEvent$DispatcherState@43d92cf8
D/MountListener( 1853): handleEvent ums_connected