Changeset 1010

Show
Ignore:
Timestamp:
11/18/08 22:07:49 (7 weeks ago)
Author:
liamMT
Message:

- update crossworks project for heavy
- wrap USB ISR in wrapper as per FreeRTOS spec

Location:
firmware/branches/cpp
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • firmware/branches/cpp/core/usb/device/core/USBDCallbacks_Initialized.c

    r1006 r1010  
    3737// #include <aic/aic.h> 
    3838 
     39extern void ( UsbIsr_Wrapper )( void ); 
     40 
    3941//------------------------------------------------------------------------------ 
    4042//         Exported function 
     
    4951#if defined(BOARD_USB_UDP) 
    5052    // Configure and enable the UDP interrupt 
    51     AIC_ConfigureIT(AT91C_ID_UDP, 0, USBD_InterruptHandler); 
    52     AIC_EnableIT(AT91C_ID_UDP); 
     53//    AIC_ConfigureIT(AT91C_ID_UDP, 0, UsbIsr_Wrapper); 
     54    AT91C_BASE_AIC->AIC_IDCR = 1 << AT91C_ID_UDP; 
     55    // Configure mode and handler 
     56    AT91C_BASE_AIC->AIC_SMR[AT91C_ID_UDP] = AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL | 3; 
     57    AT91C_BASE_AIC->AIC_SVR[AT91C_ID_UDP] = (unsigned int) UsbIsr_Wrapper; 
     58   
     59    // Clear interrupt 
     60    AT91C_BASE_AIC->AIC_ICCR = 1 << AT91C_ID_UDP; 
     61//    AIC_EnableIT(AT91C_ID_UDP); 
     62    AT91C_BASE_AIC->AIC_IECR = 1 << AT91C_ID_UDP; 
    5363 
    5464#elif defined(BOARD_USB_UDPHS) 
    5565    // Configure and enable the UDPHS interrupt 
    56     AIC_ConfigureIT(AT91C_ID_UDPHS, 0, USBD_InterruptHandler); 
     66    AIC_ConfigureIT(AT91C_ID_UDPHS, 0, UsbIsr_Wrapper); 
    5767    AIC_EnableIT(AT91C_ID_UDPHS); 
    5868#else 
  • firmware/branches/cpp/core/usb/device/core/USBDCallbacks_RequestReceived.c

    r1004 r1010  
    4646{ 
    4747    // Does nothing 
     48    (void)pRequest; 
    4849} 
    4950 
  • firmware/branches/cpp/core/usb/device/core/USBD_UDP.c

    r1008 r1010  
    5151#include "USBGenericRequest.h" 
    5252 
     53#include "FreeRTOS.h" 
     54 
    5355#if defined(BOARD_USB_UDP) 
    5456 
     
    659661 
    660662    // Configure endpoint 
    661     SET_CSR(eptnum, (unsigned char)AT91C_UDP_EPEDS | (type << 8) | (direction << 10)); 
     663    SET_CSR(eptnum, AT91C_UDP_EPEDS | (type << 8) | (direction << 10)); 
    662664    if (type == USBEndpointDescriptor_CONTROL) { 
    663665 
     
    666668 
    667669    // trace_LOG(trace_INFO, "CfgEpt%d ", eptnum); 
     670} 
     671 
     672void UsbIsr_Wrapper( void ) __attribute__ ((naked)); 
     673 
     674void UsbIsr_Wrapper( void ) 
     675{ 
     676  /* Save the context of the interrupted task. */ 
     677  portSAVE_CONTEXT(); 
     678 
     679  /* Call the handler to do the work.  This must be a separate 
     680  function to ensure the stack frame is set up correctly. */ 
     681  USBD_InterruptHandler(); 
     682 
     683  /* Restore the context of whichever task will execute next. */ 
     684  portRESTORE_CONTEXT(); 
    668685} 
    669686 
     
    11631180    #error Unsupported pull-up type. 
    11641181#endif 
    1165   AT91C_BASE_PIOA->PIO_PER = AT91C_PIO_PA10; 
    1166   AT91C_BASE_PIOA->PIO_ODR = AT91C_PIO_PA10; 
    1167    
    1168   AT91C_BASE_PIOA->PIO_PER = AT91C_PIO_PA11; 
    1169   AT91C_BASE_PIOA->PIO_OER = AT91C_PIO_PA11; 
    1170   AT91C_BASE_PIOA->PIO_CODR = AT91C_PIO_PA11; 
    11711182} 
    11721183 
     
    12341245    AT91C_BASE_UDP->UDP_IER = AT91C_UDP_WAKEUP; 
    12351246 
     1247    AT91C_BASE_PIOA->PIO_PER = AT91C_PIO_PA10; 
     1248    AT91C_BASE_PIOA->PIO_ODR = AT91C_PIO_PA10; 
     1249    AT91C_BASE_PIOA->PIO_PER = AT91C_PIO_PA11; 
     1250    AT91C_BASE_PIOA->PIO_OER = AT91C_PIO_PA11; 
     1251    AT91C_BASE_PIOA->PIO_CODR = AT91C_PIO_PA11; 
     1252 
    12361253    // Configure interrupts 
    12371254    USBDCallbacks_Initialized(); 
     1255 
     1256    AT91C_BASE_PIOA->PIO_SODR = AT91C_PIO_PA11; 
    12381257} 
    12391258 
  • firmware/branches/cpp/projects/heavy/config.h

    r819 r1010  
    2121//  Comment out the systems that you don't want to include in your build. 
    2222//---------------------------------------------------------------- 
    23 #define MAKE_CTRL_USB     // enable the USB system 
     23//#define MAKE_CTRL_USB     // enable the USB system 
    2424#define MAKE_CTRL_NETWORK // enable the Ethernet system 
    2525#define OSC               // enable the OSC system 
  • firmware/branches/cpp/projects/heavy/heavy.hzp

    r703 r1010  
    88      <configuration filter="c;cpp;cxx;cc;h;s;asm;inc" Name="Common" /> 
    99      <folder Name="Heavy" > 
    10         <file file_name="make.c" Name="make.c" /> 
    1110        <file file_name="config.h" Name="config.h" /> 
     11        <file file_name="make_.cpp" Name="make_.cpp" /> 
    1212      </folder> 
    1313      <folder Name="Core" > 
     
    5151            <configuration arm_instruction_set="ARM" Name="THUMB Flash Debug" /> 
    5252          </file> 
    53           <file file_name="../../core/makingthings/serial2.c" Name="serial2.c" /> 
    54           <file file_name="../../core/makingthings/serial2.h" Name="serial2.h" /> 
    55           <file file_name="../../core/makingthings/serial2_internal.h" Name="serial2_internal.h" /> 
    56           <file file_name="../../core/makingthings/serial2_isr.c" Name="serial2_isr.c" > 
    57             <configuration arm_instruction_set="ARM" Name="THUMB Flash Debug" /> 
    58           </file> 
    5953          <file file_name="../../core/makingthings/serial.c" Name="serial.c" /> 
    6054          <file file_name="../../core/makingthings/serial.h" Name="serial.h" /> 
     
    7872          <file file_name="../../core/makingthings/USB-CDC.c" Name="USB-CDC.c" /> 
    7973          <file file_name="../../core/makingthings/USB-CDC.h" Name="USB-CDC.h" /> 
     74          <file file_name="../../core/makingthings/udpsocket.h" Name="udpsocket.h" /> 
     75          <file file_name="../../core/makingthings/io_cpp.cpp" Name="io_cpp.cpp" /> 
     76          <file file_name="../../core/makingthings/io_cpp.h" Name="io_cpp.h" /> 
     77          <file file_name="../../core/makingthings/led_.cpp" Name="led_.cpp" /> 
     78          <file file_name="../../core/makingthings/led_cpp.h" Name="led_cpp.h" /> 
     79          <file file_name="../../core/makingthings/osc_cpp.cpp" Name="osc_cpp.cpp" /> 
     80          <file file_name="../../core/makingthings/osc_cpp.h" Name="osc_cpp.h" /> 
     81          <file file_name="../../core/makingthings/rtos_.cpp" Name="rtos_.cpp" /> 
     82          <file file_name="../../core/makingthings/rtos_.h" Name="rtos_.h" /> 
     83          <file file_name="../../core/makingthings/tcpserver.cpp" Name="tcpserver.cpp" /> 
     84          <file file_name="../../core/makingthings/tcpserver.h" Name="tcpserver.h" /> 
     85          <file file_name="../../core/makingthings/tcpsocket.cpp" Name="tcpsocket.cpp" /> 
     86          <file file_name="../../core/makingthings/tcpsocket.h" Name="tcpsocket.h" /> 
     87          <file file_name="../../core/makingthings/udpsocket.cpp" Name="udpsocket.cpp" /> 
     88          <file file_name="../../core/makingthings/usb_.cpp" Name="usb_.cpp" /> 
     89          <file file_name="../../core/makingthings/usb_.h" Name="usb_.h" /> 
    8090        </folder> 
    8191        <folder Name="FreeRTOS" > 
     
    94104          <file file_name="../../core/freertos/include/semphr.h" Name="semphr.h" /> 
    95105          <file file_name="../../core/freertos/include/task.h" Name="task.h" /> 
     106          <file file_name="../../core/freertos/portable/GCC/ARM7_AT91SAM7S/AT91SAM7X256.h" Name="AT91SAM7X256.h" /> 
    96107        </folder> 
    97108        <folder Name="lwIP" > 
     
    134145          <file file_name="../../core/startup/AT91SAM7_Startup.s" Name="AT91SAM7_Startup.s" /> 
    135146          <file file_name="../../core/startup/AT91SAM7_Target.js" Name="AT91SAM7_Target.js" > 
    136             <configuration Name="Common" file_type="Reset Script" /> 
    137           </file> 
     147            <configuration Name="Common" file_type="Reset Script" /> 
     148          </file> 
    138149          <file file_name="../../core/startup/AT91SAM7S256_MemoryMap.xml" Name="AT91SAM7S256_MemoryMap.xml" /> 
    139150          <file file_name="../../core/startup/crt0.s" Name="crt0.s" /> 
    140151          <file file_name="../../core/startup/flash_placement.xml" Name="flash_placement.xml" /> 
    141152          <file file_name="../../core/freertos/portable/GCC/ARM7_AT91SAM7S/AT91SAM7X256.h" Name="AT91SAM7X256.h" /> 
     153        </folder> 
     154        <folder Name="USB" > 
     155          <file file_name="../../core/usb/common/cdc/CDCSetControlLineStateRequest.c" Name="CDCSetControlLineStateRequest.c" /> 
     156          <file file_name="../../core/usb/common/cdc/CDCLineCoding.c" Name="CDCLineCoding.c" /> 
     157          <file file_name="../../core/usb/common/core/USBSetConfigurationRequest.c" Name="USBSetConfigurationRequest.c" /> 
     158          <file file_name="../../core/usb/common/core/USBConfigurationDescriptor.c" Name="USBConfigurationDescriptor.c" /> 
     159          <file file_name="../../core/usb/common/core/USBEndpointDescriptor.c" Name="USBEndpointDescriptor.c" /> 
     160          <file file_name="../../core/usb/common/core/USBFeatureRequest.c" Name="USBFeatureRequest.c" /> 
     161          <file file_name="../../core/usb/common/core/USBGenericDescriptor.c" Name="USBGenericDescriptor.c" /> 
     162          <file file_name="../../core/usb/common/core/USBGenericRequest.c" Name="USBGenericRequest.c" /> 
     163          <file file_name="../../core/usb/common/core/USBGetDescriptorRequest.c" Name="USBGetDescriptorRequest.c" /> 
     164          <file file_name="../../core/usb/common/core/USBInterfaceRequest.c" Name="USBInterfaceRequest.c" /> 
     165          <file file_name="../../core/usb/common/core/USBSetAddressRequest.c" Name="USBSetAddressRequest.c" /> 
     166          <file file_name="../../core/usb/device/cdc-serial/CDCDSerialDriverDescriptors.c" Name="CDCDSerialDriverDescriptors.c" /> 
     167          <file file_name="../../core/usb/device/cdc-serial/CDCDSerialDriver.c" Name="CDCDSerialDriver.c" /> 
     168          <file file_name="../../core/usb/device/core/USBDDriverCallbacks_InterfaceSettingChanged.c" Name="USBDDriverCallbacks_InterfaceSettingChanged.c" /> 
     169          <file file_name="../../core/usb/device/core/USBD_UDP.c" Name="USBD_UDP.c" > 
     170            <configuration arm_instruction_set="ARM" Name="THUMB Flash Debug" /> 
     171          </file> 
     172          <file file_name="../../core/usb/device/core/USBDCallbacks_Initialized.c" Name="USBDCallbacks_Initialized.c" /> 
     173          <file file_name="../../core/usb/device/core/USBDCallbacks_Reset.c" Name="USBDCallbacks_Reset.c" /> 
     174          <file file_name="../../core/usb/device/core/USBDCallbacks_Resumed.c" Name="USBDCallbacks_Resumed.c" /> 
     175          <file file_name="../../core/usb/device/core/USBDCallbacks_Suspended.c" Name="USBDCallbacks_Suspended.c" /> 
     176          <file file_name="../../core/usb/device/core/USBDDriver.c" Name="USBDDriver.c" /> 
     177          <file file_name="../../core/usb/device/core/USBDDriverCallbacks_ConfigurationChanged.c" Name="USBDDriverCallbacks_ConfigurationChanged.c" /> 
    142178        </folder> 
    143179      </folder> 
     
    164200        <file file_name="../../libraries/webserver/webserver.h" Name="webserver.h" /> 
    165201        <file file_name="../../libraries/webserver/webserver.c" Name="webserver.c" /> 
     202        <file file_name="../../libraries/appled/appled_cpp.h" Name="appled_cpp.h" /> 
     203        <file file_name="../../libraries/appled/appled_.cpp" Name="appled_.cpp" /> 
    166204      </folder> 
    167205    </folder> 
    168206    <configuration arm_target_loader_reset_after_download="Yes" Target="AT91SAM7X256" build_intermediate_directory="intermediate" arm_simulator_memory_simulation_parameter="0x20000;0x4000" linker_memory_map_file="$(StudioDir)/targets/Atmel_AT91SAM7/AT91SAM7X256_MemoryMap.xml" target_reset_script="FLASHReset()" build_output_directory="output" arm_target_flash_loader_type="Comms Channel Loader" Name="THUMB Flash Debug" /> 
    169207    <configuration Target="AT91SAM7X256" arm_simulator_memory_simulation_parameter="0x40000;0x10000" linker_memory_map_file="$(StudioDir)/targets/Atmel_AT91SAM7/AT91SAM7X256_MemoryMap.xml" c_user_include_directories=".;../controller/makingthings;../controller/makingthings/testing;../appboard/makingthings;../controller/freertos/include;../controller/lwip/src/include;../controller/lwip/contrib/port/FreeRTOS/AT91SAM7X;../controller/freertos/portable/GCC/ARM7_AT91SAM7S;../controller/lwip/src/include/ipv4" gcc_optimization_level="Optimize For Size" c_additional_options="-D CROSSWORKS_BUILD" build_debug_information="No" linker_printf_width_precision_supported="Yes" Name="THUMB Flash Release" /> 
    170     <configuration Target="AT91SAM7X256" arm_simulator_memory_simulation_parameter="0x40000;0x10000" linker_memory_map_file="$(StudioDir)/targets/Atmel_AT91SAM7/AT91SAM7X256_MemoryMap.xml" c_user_include_directories=".;../../core/makingthings;../../core/freertos/include;../../core/lwip/src/include;../../core/lwip/contrib/port/FreeRTOS/AT91SAM7X;../../core/freertos/portable/GCC/ARM7_AT91SAM7S;../../core/lwip/src/include/ipv4;../../libraries/appled;../../libraries/digitalin;../../libraries/digitalout;../../libraries/dipswitch;../../libraries/motor;../../libraries/pwmout;../../libraries/servo;../../libraries/stepper;../../libraries/webclient;../../libraries/webserver;../../libraries/xbee" gcc_optimization_level="None" c_additional_options="-D CROSSWORKS_BUILD" linker_printf_width_precision_supported="Yes" Name="THUMB Flash Debug" /> 
     208    <configuration Target="AT91SAM7X256" arm_simulator_memory_simulation_parameter="0x40000;0x10000" linker_memory_map_file="$(StudioDir)/targets/Atmel_AT91SAM7/AT91SAM7X256_MemoryMap.xml" c_user_include_directories=".;../../core/makingthings;../../core/freertos/include;../../core/lwip/src/include;../../core/lwip/contrib/port/FreeRTOS/AT91SAM7X;../../core/freertos/portable/GCC/ARM7_AT91SAM7S;../../core/lwip/src/include/ipv4;../../libraries/appled;../../libraries/digitalin;../../libraries/digitalout;../../libraries/dipswitch;../../libraries/motor;../../libraries/pwmout;../../libraries/servo;../../libraries/stepper;../../libraries/webclient;../../libraries/webserver;../../libraries/xbee;../../core/usb/device/cdc-serial;../../core/usb/device/core;../../core/usb/common/cdc;../../core/usb/common/core" gcc_optimization_level="None" c_additional_options="-D CROSSWORKS_BUILD" linker_printf_width_precision_supported="Yes" Name="THUMB Flash Debug" /> 
    171209  </project> 
    172   <configuration build_intermediate_directory="intermediate" build_quietly="Yes" link_use_multi_threaded_libraries="No" inherited_configurations="THUMB;Flash;Debug" arm_linker_fiq_stack_size="256" build_output_directory="output" gcc_optimization_level="None" c_additional_options="-fomit-frame-pointer" arm_linker_stack_size="256" Name="THUMB Flash Debug" arm_linker_svc_stack_size="256" arm_linker_heap_size="512" /> 
     210  <configuration build_intermediate_directory="intermediate" build_remove_unused_symbols="No" build_quietly="Yes" link_use_multi_threaded_libraries="No" inherited_configurations="THUMB;Flash;Debug" arm_linker_fiq_stack_size="256" build_output_directory="output" gcc_optimization_level="None" c_additional_options="-fomit-frame-pointer" arm_linker_stack_size="256" Name="THUMB Flash Debug" arm_linker_svc_stack_size="256" arm_linker_heap_size="512" /> 
    173211  <configuration arm_library_instruction_set="THUMB" c_preprocessor_definitions="__THUMB" arm_instruction_set="THUMB" hidden="Yes" Name="THUMB" /> 
    174212  <configuration c_preprocessor_definitions="__FLASH_BUILD" hidden="Yes" Name="Flash" /> 
  • firmware/branches/cpp/projects/heavy/make_.cpp

    r1008 r1010  
    4040 
    4141  // Fire up the OSC system and register the subsystems you want to use 
    42   Osc_SetActive( true, true, true, true ); 
    43   // make sure OSC_SUBSYSTEM_COUNT (osc.h) is large enough to accomodate them all 
    44   //Osc_RegisterSubsystem( AppLedOsc_GetName(), AppLedOsc_ReceiveMessage, NULL ); 
    45   Osc_RegisterSubsystem( DipSwitchOsc_GetName(), DipSwitchOsc_ReceiveMessage, DipSwitchOsc_Async ); 
    46   Osc_RegisterSubsystem( ServoOsc_GetName(), ServoOsc_ReceiveMessage, NULL ); 
    47   Osc_RegisterSubsystem( AnalogInOsc_GetName(), AnalogInOsc_ReceiveMessage, AnalogInOsc_Async ); 
    48   Osc_RegisterSubsystem( DigitalOutOsc_GetName(), DigitalOutOsc_ReceiveMessage, NULL ); 
    49   Osc_RegisterSubsystem( DigitalInOsc_GetName(), DigitalInOsc_ReceiveMessage, NULL ); 
    50   Osc_RegisterSubsystem( MotorOsc_GetName(), MotorOsc_ReceiveMessage, NULL ); 
    51   Osc_RegisterSubsystem( PwmOutOsc_GetName(), PwmOutOsc_ReceiveMessage, NULL ); 
    52   //Osc_RegisterSubsystem( LedOsc_GetName(), LedOsc_ReceiveMessage, NULL ); 
    53   Osc_RegisterSubsystem( DebugOsc_GetName(), DebugOsc_ReceiveMessage, NULL ); 
    54   Osc_RegisterSubsystem( SystemOsc_GetName(), SystemOsc_ReceiveMessage, NULL ); 
    55   Osc_RegisterSubsystem( NetworkOsc_GetName(), NetworkOsc_ReceiveMessage, NULL ); 
    56   Osc_RegisterSubsystem( SerialOsc_GetName(), SerialOsc_ReceiveMessage, NULL ); 
    57   Osc_RegisterSubsystem( IoOsc_GetName(), IoOsc_ReceiveMessage, NULL ); 
    58   Osc_RegisterSubsystem( StepperOsc_GetName(), StepperOsc_ReceiveMessage, NULL ); 
    59   Osc_RegisterSubsystem( XBeeOsc_GetName(), XBeeOsc_ReceiveMessage, XBeeOsc_Async ); 
    60   Osc_RegisterSubsystem( XBeeConfigOsc_GetName(), XBeeConfigOsc_ReceiveMessage, NULL ); 
    61   Osc_RegisterSubsystem( WebServerOsc_GetName(), WebServerOsc_ReceiveMessage, NULL ); 
     42//  Osc_SetActive( true, true, true, true ); 
     43//  // make sure OSC_SUBSYSTEM_COUNT (osc.h) is large enough to accomodate them all 
     44//  //Osc_RegisterSubsystem( AppLedOsc_GetName(), AppLedOsc_ReceiveMessage, NULL ); 
     45//  Osc_RegisterSubsystem( DipSwitchOsc_GetName(), DipSwitchOsc_ReceiveMessage, DipSwitchOsc_Async ); 
     46//  Osc_RegisterSubsystem( ServoOsc_GetName(), ServoOsc_ReceiveMessage, NULL ); 
     47//  Osc_RegisterSubsystem( AnalogInOsc_GetName(), AnalogInOsc_ReceiveMessage, AnalogInOsc_Async ); 
     48//  Osc_RegisterSubsystem( DigitalOutOsc_GetName(), DigitalOutOsc_ReceiveMessage, NULL ); 
     49//  Osc_RegisterSubsystem( DigitalInOsc_GetName(), DigitalInOsc_ReceiveMessage, NULL ); 
     50//  Osc_RegisterSubsystem( MotorOsc_GetName(), MotorOsc_ReceiveMessage, NULL ); 
     51//  Osc_RegisterSubsystem( PwmOutOsc_GetName(), PwmOutOsc_ReceiveMessage, NULL ); 
     52//  //Osc_RegisterSubsystem( LedOsc_GetName(), LedOsc_ReceiveMessage, NULL ); 
     53//  Osc_RegisterSubsystem( DebugOsc_GetName(), DebugOsc_ReceiveMessage, NULL ); 
     54//  Osc_RegisterSubsystem( SystemOsc_GetName(), SystemOsc_ReceiveMessage, NULL ); 
     55//  Osc_RegisterSubsystem( NetworkOsc_GetName(), NetworkOsc_ReceiveMessage, NULL ); 
     56//  Osc_RegisterSubsystem( SerialOsc_GetName(), SerialOsc_ReceiveMessage, NULL ); 
     57//  Osc_RegisterSubsystem( IoOsc_GetName(), IoOsc_ReceiveMessage, NULL ); 
     58//  Osc_RegisterSubsystem( StepperOsc_GetName(), StepperOsc_ReceiveMessage, NULL ); 
     59//  Osc_RegisterSubsystem( XBeeOsc_GetName(), XBeeOsc_ReceiveMessage, XBeeOsc_Async ); 
     60//  Osc_RegisterSubsystem( XBeeConfigOsc_GetName(), XBeeConfigOsc_ReceiveMessage, NULL ); 
     61//  Osc_RegisterSubsystem( WebServerOsc_GetName(), WebServerOsc_ReceiveMessage, NULL ); 
    6262 
    6363  // Starts the network up.  Will not return until a network is found...