hexsha
stringlengths
40
40
repo
stringlengths
5
105
path
stringlengths
3
173
license
sequence
language
stringclasses
1 value
identifier
stringlengths
1
438
return_type
stringlengths
1
106
original_string
stringlengths
21
40.7k
original_docstring
stringlengths
18
13.4k
docstring
stringlengths
11
3.24k
docstring_tokens
sequence
code
stringlengths
14
20.4k
code_tokens
sequence
short_docstring
stringlengths
0
4.36k
short_docstring_tokens
sequence
comment
sequence
parameters
list
docstring_params
dict
1c4b7edca53198f766055889797215288a5b8506
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/qs-scope/usb_device.c
[ "BSD-3-Clause" ]
C
SendHelloResponse
void
static void SendHelloResponse(void) { tScopePacket sPacket; tScopeSettings sSettings; tTriggerType eType; unsigned long ulTrigPos; unsigned short usLevel; tBoolean bTriggerCh1; tBoolean bRetcode; // // Are we free to send the data just now? // if((g_eDataInState == USBDEV_STATE_IDLE) && !g_bBlockSend) { sPacket.ucVersion = SCOPE_PROTOCOL_VERSION_1; sPacket.ucHdrLength = sizeof(tScopePacket); sPacket.ucPacketType = SCOPE_PKT_HELLO_RESPONSE; sPacket.ucParam = 0; sPacket.ulParam = 0; sPacket.ulDataLength = sizeof(tScopeSettings); // // The payload of the HELLO_RESPONSE packet contains the current // application settings that are relevant to allow the host to // correctly configure its user interface. // sSettings.ulTriggerLevelmV = g_sRender.lTriggerLevelmV; sSettings.ulTimebaseuS = g_sRender.uluSPerDivision; sSettings.lTriggerPos = g_sRender.lHorizontalOffset; sSettings.sChannel1OffsetmV = g_sRender.lVerticalOffsetmV[CHANNEL_1]; sSettings.sChannel2OffsetmV = g_sRender.lVerticalOffsetmV[CHANNEL_2]; sSettings.usChannel1ScalemVdiv = g_sRender.ulmVPerDivision[CHANNEL_1]; sSettings.usChannel2ScalemVdiv = g_sRender.ulmVPerDivision[CHANNEL_2]; sSettings.ucChannel2Enabled = g_pbActiveChannels[CHANNEL_2]; sSettings.ucStarted = g_bContinuousCapture; // // Get the trigger type. We make the (currently valid) assumption that // the members of tTriggerType align with the SCOPE_TRIGGER_TYPE_XXX // definitions from usb_protocol.h. // DataAcquisitionGetTrigger(&eType, &ulTrigPos, &usLevel); bTriggerCh1 = DataAcquisitionGetTriggerChannel(); sSettings.ucTriggerType = (unsigned char)eType; sSettings.ucTriggerChannel = bTriggerCh1 ? SCOPE_CHANNEL_1 : SCOPE_CHANNEL_2; // // Write the packet data to the USB endpoint FIFO. // bRetcode = SendUSBPacket(&sPacket, (unsigned char *)&sSettings, sizeof(tScopeSettings)); if(bRetcode) { // // We sent the response so turn off the flag telling us to do this. // g_bSendHelloResponse = false; // // Update our device state to indicate that normal communication // is now possible. // g_eDeviceState = DEVICE_COMMUNICATING; // // Inform the main loop that the host is disconnecting. // COMMAND_FLAG_WRITE(SCOPE_USB_HOST_CONNECT, 0); } } else { // // We're waiting for a previous packet to be sent so can't send the // response right now. Set a flag to ourselves telling us to send // this response next time the transmitter is available. // g_bSendHelloResponse = true; } }
//***************************************************************************** // // Send the SCOPE_PKT_HELLO_RESPONSE packet and current settings back to the // USB host. // //*****************************************************************************
Send the SCOPE_PKT_HELLO_RESPONSE packet and current settings back to the USB host.
[ "Send", "the", "SCOPE_PKT_HELLO_RESPONSE", "packet", "and", "current", "settings", "back", "to", "the", "USB", "host", "." ]
static void SendHelloResponse(void) { tScopePacket sPacket; tScopeSettings sSettings; tTriggerType eType; unsigned long ulTrigPos; unsigned short usLevel; tBoolean bTriggerCh1; tBoolean bRetcode; if((g_eDataInState == USBDEV_STATE_IDLE) && !g_bBlockSend) { sPacket.ucVersion = SCOPE_PROTOCOL_VERSION_1; sPacket.ucHdrLength = sizeof(tScopePacket); sPacket.ucPacketType = SCOPE_PKT_HELLO_RESPONSE; sPacket.ucParam = 0; sPacket.ulParam = 0; sPacket.ulDataLength = sizeof(tScopeSettings); sSettings.ulTriggerLevelmV = g_sRender.lTriggerLevelmV; sSettings.ulTimebaseuS = g_sRender.uluSPerDivision; sSettings.lTriggerPos = g_sRender.lHorizontalOffset; sSettings.sChannel1OffsetmV = g_sRender.lVerticalOffsetmV[CHANNEL_1]; sSettings.sChannel2OffsetmV = g_sRender.lVerticalOffsetmV[CHANNEL_2]; sSettings.usChannel1ScalemVdiv = g_sRender.ulmVPerDivision[CHANNEL_1]; sSettings.usChannel2ScalemVdiv = g_sRender.ulmVPerDivision[CHANNEL_2]; sSettings.ucChannel2Enabled = g_pbActiveChannels[CHANNEL_2]; sSettings.ucStarted = g_bContinuousCapture; DataAcquisitionGetTrigger(&eType, &ulTrigPos, &usLevel); bTriggerCh1 = DataAcquisitionGetTriggerChannel(); sSettings.ucTriggerType = (unsigned char)eType; sSettings.ucTriggerChannel = bTriggerCh1 ? SCOPE_CHANNEL_1 : SCOPE_CHANNEL_2; bRetcode = SendUSBPacket(&sPacket, (unsigned char *)&sSettings, sizeof(tScopeSettings)); if(bRetcode) { g_bSendHelloResponse = false; g_eDeviceState = DEVICE_COMMUNICATING; COMMAND_FLAG_WRITE(SCOPE_USB_HOST_CONNECT, 0); } } else { g_bSendHelloResponse = true; } }
[ "static", "void", "SendHelloResponse", "(", "void", ")", "{", "tScopePacket", "sPacket", ";", "tScopeSettings", "sSettings", ";", "tTriggerType", "eType", ";", "unsigned", "long", "ulTrigPos", ";", "unsigned", "short", "usLevel", ";", "tBoolean", "bTriggerCh1", ";", "tBoolean", "bRetcode", ";", "if", "(", "(", "g_eDataInState", "==", "USBDEV_STATE_IDLE", ")", "&&", "!", "g_bBlockSend", ")", "{", "sPacket", ".", "ucVersion", "=", "SCOPE_PROTOCOL_VERSION_1", ";", "sPacket", ".", "ucHdrLength", "=", "sizeof", "(", "tScopePacket", ")", ";", "sPacket", ".", "ucPacketType", "=", "SCOPE_PKT_HELLO_RESPONSE", ";", "sPacket", ".", "ucParam", "=", "0", ";", "sPacket", ".", "ulParam", "=", "0", ";", "sPacket", ".", "ulDataLength", "=", "sizeof", "(", "tScopeSettings", ")", ";", "sSettings", ".", "ulTriggerLevelmV", "=", "g_sRender", ".", "lTriggerLevelmV", ";", "sSettings", ".", "ulTimebaseuS", "=", "g_sRender", ".", "uluSPerDivision", ";", "sSettings", ".", "lTriggerPos", "=", "g_sRender", ".", "lHorizontalOffset", ";", "sSettings", ".", "sChannel1OffsetmV", "=", "g_sRender", ".", "lVerticalOffsetmV", "[", "CHANNEL_1", "]", ";", "sSettings", ".", "sChannel2OffsetmV", "=", "g_sRender", ".", "lVerticalOffsetmV", "[", "CHANNEL_2", "]", ";", "sSettings", ".", "usChannel1ScalemVdiv", "=", "g_sRender", ".", "ulmVPerDivision", "[", "CHANNEL_1", "]", ";", "sSettings", ".", "usChannel2ScalemVdiv", "=", "g_sRender", ".", "ulmVPerDivision", "[", "CHANNEL_2", "]", ";", "sSettings", ".", "ucChannel2Enabled", "=", "g_pbActiveChannels", "[", "CHANNEL_2", "]", ";", "sSettings", ".", "ucStarted", "=", "g_bContinuousCapture", ";", "DataAcquisitionGetTrigger", "(", "&", "eType", ",", "&", "ulTrigPos", ",", "&", "usLevel", ")", ";", "bTriggerCh1", "=", "DataAcquisitionGetTriggerChannel", "(", ")", ";", "sSettings", ".", "ucTriggerType", "=", "(", "unsigned", "char", ")", "eType", ";", "sSettings", ".", "ucTriggerChannel", "=", "bTriggerCh1", "?", "SCOPE_CHANNEL_1", ":", "SCOPE_CHANNEL_2", ";", "bRetcode", "=", "SendUSBPacket", "(", "&", "sPacket", ",", "(", "unsigned", "char", "*", ")", "&", "sSettings", ",", "sizeof", "(", "tScopeSettings", ")", ")", ";", "if", "(", "bRetcode", ")", "{", "g_bSendHelloResponse", "=", "false", ";", "g_eDeviceState", "=", "DEVICE_COMMUNICATING", ";", "COMMAND_FLAG_WRITE", "(", "SCOPE_USB_HOST_CONNECT", ",", "0", ")", ";", "}", "}", "else", "{", "g_bSendHelloResponse", "=", "true", ";", "}", "}" ]
Send the SCOPE_PKT_HELLO_RESPONSE packet and current settings back to the USB host.
[ "Send", "the", "SCOPE_PKT_HELLO_RESPONSE", "packet", "and", "current", "settings", "back", "to", "the", "USB", "host", "." ]
[ "//\r", "// Are we free to send the data just now?\r", "//\r", "//\r", "// The payload of the HELLO_RESPONSE packet contains the current\r", "// application settings that are relevant to allow the host to\r", "// correctly configure its user interface.\r", "//\r", "//\r", "// Get the trigger type. We make the (currently valid) assumption that\r", "// the members of tTriggerType align with the SCOPE_TRIGGER_TYPE_XXX\r", "// definitions from usb_protocol.h.\r", "//\r", "//\r", "// Write the packet data to the USB endpoint FIFO.\r", "//\r", "//\r", "// We sent the response so turn off the flag telling us to do this.\r", "//\r", "//\r", "// Update our device state to indicate that normal communication\r", "// is now possible.\r", "//\r", "//\r", "// Inform the main loop that the host is disconnecting.\r", "//\r", "//\r", "// We're waiting for a previous packet to be sent so can't send the\r", "// response right now. Set a flag to ourselves telling us to send\r", "// this response next time the transmitter is available.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
1c4b7edca53198f766055889797215288a5b8506
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/qs-scope/usb_device.c
[ "BSD-3-Clause" ]
C
SendPingResponse
void
static void SendPingResponse(unsigned char ucEcho1, unsigned long ulEcho2) { tScopePacket sPacket; // // If no outstanding transmission is pending, go ahead and send the // response immediately. // if((g_eDataInState == USBDEV_STATE_IDLE) && !g_bBlockSend) { sPacket.ucVersion = SCOPE_PROTOCOL_VERSION_1; sPacket.ucHdrLength = sizeof(tScopePacket); sPacket.ucPacketType = SCOPE_PKT_PING_RESPONSE; sPacket.ucParam = ucEcho1; sPacket.ulParam = ulEcho2; sPacket.ulDataLength = 0; // // Mark the fact that we don't have a ping response pending any // more. // g_bSendPingResponse = false; // // Write the packet data to the USB endpoint FIFO. // SendUSBPacket(&sPacket, (unsigned char *)0, 0); } else { // // We're waiting for a previous packet to be sent so can't send the // response right now. Flag this so that we send the response later. // g_bSendPingResponse = true; g_ucPingEcho1 = ucEcho1; g_ulPingEcho2 = ulEcho2; } }
//***************************************************************************** // // Send the SCOPE_PKT_PING_RESPONSE packet back to the USB host. // //*****************************************************************************
Send the SCOPE_PKT_PING_RESPONSE packet back to the USB host.
[ "Send", "the", "SCOPE_PKT_PING_RESPONSE", "packet", "back", "to", "the", "USB", "host", "." ]
static void SendPingResponse(unsigned char ucEcho1, unsigned long ulEcho2) { tScopePacket sPacket; if((g_eDataInState == USBDEV_STATE_IDLE) && !g_bBlockSend) { sPacket.ucVersion = SCOPE_PROTOCOL_VERSION_1; sPacket.ucHdrLength = sizeof(tScopePacket); sPacket.ucPacketType = SCOPE_PKT_PING_RESPONSE; sPacket.ucParam = ucEcho1; sPacket.ulParam = ulEcho2; sPacket.ulDataLength = 0; g_bSendPingResponse = false; SendUSBPacket(&sPacket, (unsigned char *)0, 0); } else { g_bSendPingResponse = true; g_ucPingEcho1 = ucEcho1; g_ulPingEcho2 = ulEcho2; } }
[ "static", "void", "SendPingResponse", "(", "unsigned", "char", "ucEcho1", ",", "unsigned", "long", "ulEcho2", ")", "{", "tScopePacket", "sPacket", ";", "if", "(", "(", "g_eDataInState", "==", "USBDEV_STATE_IDLE", ")", "&&", "!", "g_bBlockSend", ")", "{", "sPacket", ".", "ucVersion", "=", "SCOPE_PROTOCOL_VERSION_1", ";", "sPacket", ".", "ucHdrLength", "=", "sizeof", "(", "tScopePacket", ")", ";", "sPacket", ".", "ucPacketType", "=", "SCOPE_PKT_PING_RESPONSE", ";", "sPacket", ".", "ucParam", "=", "ucEcho1", ";", "sPacket", ".", "ulParam", "=", "ulEcho2", ";", "sPacket", ".", "ulDataLength", "=", "0", ";", "g_bSendPingResponse", "=", "false", ";", "SendUSBPacket", "(", "&", "sPacket", ",", "(", "unsigned", "char", "*", ")", "0", ",", "0", ")", ";", "}", "else", "{", "g_bSendPingResponse", "=", "true", ";", "g_ucPingEcho1", "=", "ucEcho1", ";", "g_ulPingEcho2", "=", "ulEcho2", ";", "}", "}" ]
Send the SCOPE_PKT_PING_RESPONSE packet back to the USB host.
[ "Send", "the", "SCOPE_PKT_PING_RESPONSE", "packet", "back", "to", "the", "USB", "host", "." ]
[ "//\r", "// If no outstanding transmission is pending, go ahead and send the\r", "// response immediately.\r", "//\r", "//\r", "// Mark the fact that we don't have a ping response pending any\r", "// more.\r", "//\r", "//\r", "// Write the packet data to the USB endpoint FIFO.\r", "//\r", "//\r", "// We're waiting for a previous packet to be sent so can't send the\r", "// response right now. Flag this so that we send the response later.\r", "//\r" ]
[ { "param": "ucEcho1", "type": "unsigned char" }, { "param": "ulEcho2", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ucEcho1", "type": "unsigned char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulEcho2", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1c4b7edca53198f766055889797215288a5b8506
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/qs-scope/usb_device.c
[ "BSD-3-Clause" ]
C
ProcessUSBPacket
void
void ProcessUSBPacket(unsigned char *pcPacket, unsigned long ulSize) { tScopePacket *psPacket; // // Get a pointer to our packet header structure. // psPacket = (tScopePacket *)pcPacket; // // Check the validity of the packet we just received. // if(psPacket->ucVersion != SCOPE_PROTOCOL_VERSION_1) { // // Someone is asking for a protocol later than we support or // is sending us bogus packets. Check to see if this is a // a HOST_HELLO packet to determine which of these is the case. // if(!((psPacket->ucPacketType == SCOPE_PKT_HOST_HELLO) && (ulSize == psPacket->ucHdrLength))) { // // This is not a HOST_HELLO packet with the expected length // so we assume it's either invalid or something we can't handle // and merely ignore it. // UARTprintf("Unexpected USB packet\n"); return; } else { // // This is something other than a HOST_HELLO packet. We don't // support this level of the protocol and the host hasn't // sent us the HELLO packet so we ignore this completely. UARTprintf("USB packet ignored\n"); return; } } else { // // Seems to be a packet using the protocol version we support so // all seems well so far. Check that the header length is correct // for this protocol version. // if(psPacket->ucHdrLength != sizeof(tScopePacket)) { // // Header length is wrong so ignore the packet. // UARTprintf("USB header error - wrong length\n"); return; } } // // Parse the packet and send the appropriate command to the main loop. // switch(psPacket->ucPacketType) { case SCOPE_PKT_HOST_HELLO: { // // We respond with a HELLO_RESPONSE packet. Don't update the state // until this is actually sent, though. // SendHelloResponse(); break; } case SCOPE_PKT_HOST_GOODBYE: { // // The host application is closing down so go back to the state // where we are waiting for a HOST_HELLO packet. // g_eDeviceState = DEVICE_WAITING_FOR_HELLO; // // Inform the main loop that the host is disconnecting. // COMMAND_FLAG_WRITE(SCOPE_USB_HOST_REMOVE, 0); break; } case SCOPE_PKT_PING: { // // We respond with a PING_RESPONSE packet. // SendPingResponse(psPacket->ucParam, psPacket->ulParam); break; } case SCOPE_PKT_CAPTURE: { // // Send a command to the main loop asking to capture a frame. // COMMAND_FLAG_WRITE(SCOPE_CAPTURE, 0); break; } case SCOPE_PKT_START: { // // Send a command to the main loop to start automatic capture. // COMMAND_FLAG_WRITE(SCOPE_START, 0); break; } case SCOPE_PKT_STOP: { // // Send a command to the main loop to start automatic capture. // COMMAND_FLAG_WRITE(SCOPE_STOP, 0); break; } case SCOPE_PKT_SET_TIMEBASE: { // // Send a command to the main loop to set the capture timebase. // COMMAND_FLAG_WRITE(SCOPE_CHANGE_TIMEBASE, psPacket->ulParam); break; } case SCOPE_PKT_SET_TRIGGER_TYPE: { // // Send commands to the main loop to set the trigger type and // channel. // COMMAND_FLAG_WRITE(SCOPE_CHANGE_TRIGGER, psPacket->ulParam); COMMAND_FLAG_WRITE(SCOPE_SET_TRIGGER_CH, ((psPacket->ucParam == SCOPE_CHANNEL_1) ? CHANNEL_1 : CHANNEL_2)); break; } case SCOPE_PKT_SET_TRIGGER_LEVEL: { // // Send a command to the main loop to set the trigger level. // COMMAND_FLAG_WRITE(SCOPE_TRIGGER_LEVEL, psPacket->ulParam); break; } case SCOPE_PKT_SET_TRIGGER_POS: { // // Send a command to the main loop to set the trigger position. // COMMAND_FLAG_WRITE(SCOPE_TRIGGER_POS, psPacket->ulParam); break; } case SCOPE_PKT_SET_CHANNEL2: { // // Send a command to the main loop to enable or disable channel // 2 as required. // COMMAND_FLAG_WRITE(SCOPE_CH2_DISPLAY, (unsigned long)psPacket->ucParam); break; } case SCOPE_PKT_RETRANSMIT: { // // Send a command to the main loop to have it retransmit the latest // captured waveform data. // COMMAND_FLAG_WRITE(SCOPE_RETRANSMIT, 0); break; } case SCOPE_PKT_DATA_CONTROL: { // // Set or clear the flag we use to gate data transmission to ' // the host. // g_bDataEnabled = (tBoolean)psPacket->ucParam; break; } case SCOPE_PKT_FIND: { // // Send a command to the main loop to have it rescale and // reposition the appropriate waveform. // COMMAND_FLAG_WRITE(SCOPE_FIND, ((psPacket->ucParam == SCOPE_CHANNEL_1) ? CHANNEL_1 : CHANNEL_2)); break; } case SCOPE_PKT_SET_POSITION: { // // Send a command to the main loop to have it reposition the // appropriate waveform. // COMMAND_FLAG_WRITE(((psPacket->ucParam == SCOPE_CHANNEL_1) ? SCOPE_CH1_POS : SCOPE_CH2_POS), psPacket->ulParam); break; } case SCOPE_PKT_SET_SCALE: { // // Send a command to the main loop to have it rescale the // appropriate waveform. // COMMAND_FLAG_WRITE(((psPacket->ucParam == SCOPE_CHANNEL_1) ? SCOPE_CH1_SCALE : SCOPE_CH2_SCALE), psPacket->ulParam); break; } // // Handle all unrecognized packets. // default: { // // We received an unrecognized packet. Ignore it. // break; } } }
//***************************************************************************** // // Handles USB packets received from the host. // // \param pcPacket points to the first byte of a received packet. // \param ulSize is the size in bytes of the packet pointed to by \e pcPacket. // // This function is called in interrupt context whenever a new packet has // been read from the USB host. Here we parse the packet and pass on any // orders it contains to the main loop for later action. // // In the current version of the protocol, all transactions from the host // are contained in a single USB packet with no additional data so we // don't need to worry about variable sized data here or transactions that // span more than one packet. // // \return None. // //*****************************************************************************
Handles USB packets received from the host. \param pcPacket points to the first byte of a received packet. \param ulSize is the size in bytes of the packet pointed to by \e pcPacket. This function is called in interrupt context whenever a new packet has been read from the USB host. Here we parse the packet and pass on any orders it contains to the main loop for later action. In the current version of the protocol, all transactions from the host are contained in a single USB packet with no additional data so we don't need to worry about variable sized data here or transactions that span more than one packet. \return None.
[ "Handles", "USB", "packets", "received", "from", "the", "host", ".", "\\", "param", "pcPacket", "points", "to", "the", "first", "byte", "of", "a", "received", "packet", ".", "\\", "param", "ulSize", "is", "the", "size", "in", "bytes", "of", "the", "packet", "pointed", "to", "by", "\\", "e", "pcPacket", ".", "This", "function", "is", "called", "in", "interrupt", "context", "whenever", "a", "new", "packet", "has", "been", "read", "from", "the", "USB", "host", ".", "Here", "we", "parse", "the", "packet", "and", "pass", "on", "any", "orders", "it", "contains", "to", "the", "main", "loop", "for", "later", "action", ".", "In", "the", "current", "version", "of", "the", "protocol", "all", "transactions", "from", "the", "host", "are", "contained", "in", "a", "single", "USB", "packet", "with", "no", "additional", "data", "so", "we", "don", "'", "t", "need", "to", "worry", "about", "variable", "sized", "data", "here", "or", "transactions", "that", "span", "more", "than", "one", "packet", ".", "\\", "return", "None", "." ]
void ProcessUSBPacket(unsigned char *pcPacket, unsigned long ulSize) { tScopePacket *psPacket; psPacket = (tScopePacket *)pcPacket; if(psPacket->ucVersion != SCOPE_PROTOCOL_VERSION_1) { if(!((psPacket->ucPacketType == SCOPE_PKT_HOST_HELLO) && (ulSize == psPacket->ucHdrLength))) { UARTprintf("Unexpected USB packet\n"); return; } else { UARTprintf("USB packet ignored\n"); return; } } else { if(psPacket->ucHdrLength != sizeof(tScopePacket)) { UARTprintf("USB header error - wrong length\n"); return; } } switch(psPacket->ucPacketType) { case SCOPE_PKT_HOST_HELLO: { SendHelloResponse(); break; } case SCOPE_PKT_HOST_GOODBYE: { g_eDeviceState = DEVICE_WAITING_FOR_HELLO; COMMAND_FLAG_WRITE(SCOPE_USB_HOST_REMOVE, 0); break; } case SCOPE_PKT_PING: { SendPingResponse(psPacket->ucParam, psPacket->ulParam); break; } case SCOPE_PKT_CAPTURE: { COMMAND_FLAG_WRITE(SCOPE_CAPTURE, 0); break; } case SCOPE_PKT_START: { COMMAND_FLAG_WRITE(SCOPE_START, 0); break; } case SCOPE_PKT_STOP: { COMMAND_FLAG_WRITE(SCOPE_STOP, 0); break; } case SCOPE_PKT_SET_TIMEBASE: { COMMAND_FLAG_WRITE(SCOPE_CHANGE_TIMEBASE, psPacket->ulParam); break; } case SCOPE_PKT_SET_TRIGGER_TYPE: { COMMAND_FLAG_WRITE(SCOPE_CHANGE_TRIGGER, psPacket->ulParam); COMMAND_FLAG_WRITE(SCOPE_SET_TRIGGER_CH, ((psPacket->ucParam == SCOPE_CHANNEL_1) ? CHANNEL_1 : CHANNEL_2)); break; } case SCOPE_PKT_SET_TRIGGER_LEVEL: { COMMAND_FLAG_WRITE(SCOPE_TRIGGER_LEVEL, psPacket->ulParam); break; } case SCOPE_PKT_SET_TRIGGER_POS: { COMMAND_FLAG_WRITE(SCOPE_TRIGGER_POS, psPacket->ulParam); break; } case SCOPE_PKT_SET_CHANNEL2: { COMMAND_FLAG_WRITE(SCOPE_CH2_DISPLAY, (unsigned long)psPacket->ucParam); break; } case SCOPE_PKT_RETRANSMIT: { COMMAND_FLAG_WRITE(SCOPE_RETRANSMIT, 0); break; } case SCOPE_PKT_DATA_CONTROL: { g_bDataEnabled = (tBoolean)psPacket->ucParam; break; } case SCOPE_PKT_FIND: { COMMAND_FLAG_WRITE(SCOPE_FIND, ((psPacket->ucParam == SCOPE_CHANNEL_1) ? CHANNEL_1 : CHANNEL_2)); break; } case SCOPE_PKT_SET_POSITION: { COMMAND_FLAG_WRITE(((psPacket->ucParam == SCOPE_CHANNEL_1) ? SCOPE_CH1_POS : SCOPE_CH2_POS), psPacket->ulParam); break; } case SCOPE_PKT_SET_SCALE: { COMMAND_FLAG_WRITE(((psPacket->ucParam == SCOPE_CHANNEL_1) ? SCOPE_CH1_SCALE : SCOPE_CH2_SCALE), psPacket->ulParam); break; } default: { break; } } }
[ "void", "ProcessUSBPacket", "(", "unsigned", "char", "*", "pcPacket", ",", "unsigned", "long", "ulSize", ")", "{", "tScopePacket", "*", "psPacket", ";", "psPacket", "=", "(", "tScopePacket", "*", ")", "pcPacket", ";", "if", "(", "psPacket", "->", "ucVersion", "!=", "SCOPE_PROTOCOL_VERSION_1", ")", "{", "if", "(", "!", "(", "(", "psPacket", "->", "ucPacketType", "==", "SCOPE_PKT_HOST_HELLO", ")", "&&", "(", "ulSize", "==", "psPacket", "->", "ucHdrLength", ")", ")", ")", "{", "UARTprintf", "(", "\"", "\\n", "\"", ")", ";", "return", ";", "}", "else", "{", "UARTprintf", "(", "\"", "\\n", "\"", ")", ";", "return", ";", "}", "}", "else", "{", "if", "(", "psPacket", "->", "ucHdrLength", "!=", "sizeof", "(", "tScopePacket", ")", ")", "{", "UARTprintf", "(", "\"", "\\n", "\"", ")", ";", "return", ";", "}", "}", "switch", "(", "psPacket", "->", "ucPacketType", ")", "{", "case", "SCOPE_PKT_HOST_HELLO", ":", "{", "SendHelloResponse", "(", ")", ";", "break", ";", "}", "case", "SCOPE_PKT_HOST_GOODBYE", ":", "{", "g_eDeviceState", "=", "DEVICE_WAITING_FOR_HELLO", ";", "COMMAND_FLAG_WRITE", "(", "SCOPE_USB_HOST_REMOVE", ",", "0", ")", ";", "break", ";", "}", "case", "SCOPE_PKT_PING", ":", "{", "SendPingResponse", "(", "psPacket", "->", "ucParam", ",", "psPacket", "->", "ulParam", ")", ";", "break", ";", "}", "case", "SCOPE_PKT_CAPTURE", ":", "{", "COMMAND_FLAG_WRITE", "(", "SCOPE_CAPTURE", ",", "0", ")", ";", "break", ";", "}", "case", "SCOPE_PKT_START", ":", "{", "COMMAND_FLAG_WRITE", "(", "SCOPE_START", ",", "0", ")", ";", "break", ";", "}", "case", "SCOPE_PKT_STOP", ":", "{", "COMMAND_FLAG_WRITE", "(", "SCOPE_STOP", ",", "0", ")", ";", "break", ";", "}", "case", "SCOPE_PKT_SET_TIMEBASE", ":", "{", "COMMAND_FLAG_WRITE", "(", "SCOPE_CHANGE_TIMEBASE", ",", "psPacket", "->", "ulParam", ")", ";", "break", ";", "}", "case", "SCOPE_PKT_SET_TRIGGER_TYPE", ":", "{", "COMMAND_FLAG_WRITE", "(", "SCOPE_CHANGE_TRIGGER", ",", "psPacket", "->", "ulParam", ")", ";", "COMMAND_FLAG_WRITE", "(", "SCOPE_SET_TRIGGER_CH", ",", "(", "(", "psPacket", "->", "ucParam", "==", "SCOPE_CHANNEL_1", ")", "?", "CHANNEL_1", ":", "CHANNEL_2", ")", ")", ";", "break", ";", "}", "case", "SCOPE_PKT_SET_TRIGGER_LEVEL", ":", "{", "COMMAND_FLAG_WRITE", "(", "SCOPE_TRIGGER_LEVEL", ",", "psPacket", "->", "ulParam", ")", ";", "break", ";", "}", "case", "SCOPE_PKT_SET_TRIGGER_POS", ":", "{", "COMMAND_FLAG_WRITE", "(", "SCOPE_TRIGGER_POS", ",", "psPacket", "->", "ulParam", ")", ";", "break", ";", "}", "case", "SCOPE_PKT_SET_CHANNEL2", ":", "{", "COMMAND_FLAG_WRITE", "(", "SCOPE_CH2_DISPLAY", ",", "(", "unsigned", "long", ")", "psPacket", "->", "ucParam", ")", ";", "break", ";", "}", "case", "SCOPE_PKT_RETRANSMIT", ":", "{", "COMMAND_FLAG_WRITE", "(", "SCOPE_RETRANSMIT", ",", "0", ")", ";", "break", ";", "}", "case", "SCOPE_PKT_DATA_CONTROL", ":", "{", "g_bDataEnabled", "=", "(", "tBoolean", ")", "psPacket", "->", "ucParam", ";", "break", ";", "}", "case", "SCOPE_PKT_FIND", ":", "{", "COMMAND_FLAG_WRITE", "(", "SCOPE_FIND", ",", "(", "(", "psPacket", "->", "ucParam", "==", "SCOPE_CHANNEL_1", ")", "?", "CHANNEL_1", ":", "CHANNEL_2", ")", ")", ";", "break", ";", "}", "case", "SCOPE_PKT_SET_POSITION", ":", "{", "COMMAND_FLAG_WRITE", "(", "(", "(", "psPacket", "->", "ucParam", "==", "SCOPE_CHANNEL_1", ")", "?", "SCOPE_CH1_POS", ":", "SCOPE_CH2_POS", ")", ",", "psPacket", "->", "ulParam", ")", ";", "break", ";", "}", "case", "SCOPE_PKT_SET_SCALE", ":", "{", "COMMAND_FLAG_WRITE", "(", "(", "(", "psPacket", "->", "ucParam", "==", "SCOPE_CHANNEL_1", ")", "?", "SCOPE_CH1_SCALE", ":", "SCOPE_CH2_SCALE", ")", ",", "psPacket", "->", "ulParam", ")", ";", "break", ";", "}", "default", ":", "{", "break", ";", "}", "}", "}" ]
Handles USB packets received from the host.
[ "Handles", "USB", "packets", "received", "from", "the", "host", "." ]
[ "//\r", "// Get a pointer to our packet header structure.\r", "//\r", "//\r", "// Check the validity of the packet we just received.\r", "//\r", "//\r", "// Someone is asking for a protocol later than we support or\r", "// is sending us bogus packets. Check to see if this is a\r", "// a HOST_HELLO packet to determine which of these is the case.\r", "//\r", "//\r", "// This is not a HOST_HELLO packet with the expected length\r", "// so we assume it's either invalid or something we can't handle\r", "// and merely ignore it.\r", "//\r", "//\r", "// This is something other than a HOST_HELLO packet. We don't\r", "// support this level of the protocol and the host hasn't\r", "// sent us the HELLO packet so we ignore this completely.\r", "//\r", "// Seems to be a packet using the protocol version we support so\r", "// all seems well so far. Check that the header length is correct\r", "// for this protocol version.\r", "//\r", "//\r", "// Header length is wrong so ignore the packet.\r", "//\r", "//\r", "// Parse the packet and send the appropriate command to the main loop.\r", "//\r", "//\r", "// We respond with a HELLO_RESPONSE packet. Don't update the state\r", "// until this is actually sent, though.\r", "//\r", "//\r", "// The host application is closing down so go back to the state\r", "// where we are waiting for a HOST_HELLO packet.\r", "//\r", "//\r", "// Inform the main loop that the host is disconnecting.\r", "//\r", "//\r", "// We respond with a PING_RESPONSE packet.\r", "//\r", "//\r", "// Send a command to the main loop asking to capture a frame.\r", "//\r", "//\r", "// Send a command to the main loop to start automatic capture.\r", "//\r", "//\r", "// Send a command to the main loop to start automatic capture.\r", "//\r", "//\r", "// Send a command to the main loop to set the capture timebase.\r", "//\r", "//\r", "// Send commands to the main loop to set the trigger type and\r", "// channel.\r", "//\r", "//\r", "// Send a command to the main loop to set the trigger level.\r", "//\r", "//\r", "// Send a command to the main loop to set the trigger position.\r", "//\r", "//\r", "// Send a command to the main loop to enable or disable channel\r", "// 2 as required.\r", "//\r", "//\r", "// Send a command to the main loop to have it retransmit the latest\r", "// captured waveform data.\r", "//\r", "//\r", "// Set or clear the flag we use to gate data transmission to '\r", "// the host.\r", "//\r", "//\r", "// Send a command to the main loop to have it rescale and\r", "// reposition the appropriate waveform.\r", "//\r", "//\r", "// Send a command to the main loop to have it reposition the\r", "// appropriate waveform.\r", "//\r", "//\r", "// Send a command to the main loop to have it rescale the\r", "// appropriate waveform.\r", "//\r", "//\r", "// Handle all unrecognized packets.\r", "//\r", "//\r", "// We received an unrecognized packet. Ignore it.\r", "//\r" ]
[ { "param": "pcPacket", "type": "unsigned char" }, { "param": "ulSize", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pcPacket", "type": "unsigned char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulSize", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1c4b7edca53198f766055889797215288a5b8506
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/qs-scope/usb_device.c
[ "BSD-3-Clause" ]
C
ProcessDataFromHost
void
static void ProcessDataFromHost(unsigned long ulStatus) { unsigned long ulCount; int iRetcode; switch(g_eDataOutState) { case USBDEV_STATE_UNCONFIGURED: // // Weird - we got a packet before the configuration was set. // Just handle it as normal anyway. // case USBDEV_STATE_IDLE: { // // Read the packet we got into the local buffer and keep track of // its size. // ulCount = DATA_OUT_EP_MAX_SIZE; iRetcode = USBEndpointDataGet(USB0_BASE, DATA_OUT_ENDPOINT, g_pucDataOutBuffer, &ulCount); // // Was there a packet to read? // if(iRetcode != -1) { g_ulDataOutSize = ulCount; // // // ACK the packet. This tells the host that it is free to send // the next one. // USBDevEndpointDataAck(USB0_BASE, DATA_OUT_ENDPOINT, true); // // Parse the packet contents and send appropriate commands to // the main loop. // ProcessUSBPacket(g_pucDataOutBuffer, g_ulDataOutSize); } // // We have handled the packet so jump back to idle state and wait // for the next one. // g_eDataOutState = USBDEV_STATE_IDLE; break; } case USBDEV_STATE_WAIT_DATA: { // // We shouldn't get here. This implies that we received a second // packet while we still had one in the FIFO which is not ACKed. // break; } } }
//***************************************************************************** // // This function is called from HandleEndpoints for all interrupts signaling // the arrival of data on the bulk OUT endpoint (in other words, whenever // the host has sent us data). We read the data into our local buffer assuming // it has already been emptied and ACK the data. If the buffer is not yet // available, we merely return without doing anything. The USB hardware will // continue to NACK the data until we later read the new packet from the // FIFO and ACK it. // // NOTE: This function must not block since it is called from interrupt // context. // //*****************************************************************************
This function is called from HandleEndpoints for all interrupts signaling the arrival of data on the bulk OUT endpoint (in other words, whenever the host has sent us data). We read the data into our local buffer assuming it has already been emptied and ACK the data. If the buffer is not yet available, we merely return without doing anything. The USB hardware will continue to NACK the data until we later read the new packet from the FIFO and ACK it. This function must not block since it is called from interrupt context.
[ "This", "function", "is", "called", "from", "HandleEndpoints", "for", "all", "interrupts", "signaling", "the", "arrival", "of", "data", "on", "the", "bulk", "OUT", "endpoint", "(", "in", "other", "words", "whenever", "the", "host", "has", "sent", "us", "data", ")", ".", "We", "read", "the", "data", "into", "our", "local", "buffer", "assuming", "it", "has", "already", "been", "emptied", "and", "ACK", "the", "data", ".", "If", "the", "buffer", "is", "not", "yet", "available", "we", "merely", "return", "without", "doing", "anything", ".", "The", "USB", "hardware", "will", "continue", "to", "NACK", "the", "data", "until", "we", "later", "read", "the", "new", "packet", "from", "the", "FIFO", "and", "ACK", "it", ".", "This", "function", "must", "not", "block", "since", "it", "is", "called", "from", "interrupt", "context", "." ]
static void ProcessDataFromHost(unsigned long ulStatus) { unsigned long ulCount; int iRetcode; switch(g_eDataOutState) { case USBDEV_STATE_UNCONFIGURED: case USBDEV_STATE_IDLE: { ulCount = DATA_OUT_EP_MAX_SIZE; iRetcode = USBEndpointDataGet(USB0_BASE, DATA_OUT_ENDPOINT, g_pucDataOutBuffer, &ulCount); if(iRetcode != -1) { g_ulDataOutSize = ulCount; USBDevEndpointDataAck(USB0_BASE, DATA_OUT_ENDPOINT, true); ProcessUSBPacket(g_pucDataOutBuffer, g_ulDataOutSize); } g_eDataOutState = USBDEV_STATE_IDLE; break; } case USBDEV_STATE_WAIT_DATA: { break; } } }
[ "static", "void", "ProcessDataFromHost", "(", "unsigned", "long", "ulStatus", ")", "{", "unsigned", "long", "ulCount", ";", "int", "iRetcode", ";", "switch", "(", "g_eDataOutState", ")", "{", "case", "USBDEV_STATE_UNCONFIGURED", ":", "case", "USBDEV_STATE_IDLE", ":", "{", "ulCount", "=", "DATA_OUT_EP_MAX_SIZE", ";", "iRetcode", "=", "USBEndpointDataGet", "(", "USB0_BASE", ",", "DATA_OUT_ENDPOINT", ",", "g_pucDataOutBuffer", ",", "&", "ulCount", ")", ";", "if", "(", "iRetcode", "!=", "-1", ")", "{", "g_ulDataOutSize", "=", "ulCount", ";", "USBDevEndpointDataAck", "(", "USB0_BASE", ",", "DATA_OUT_ENDPOINT", ",", "true", ")", ";", "ProcessUSBPacket", "(", "g_pucDataOutBuffer", ",", "g_ulDataOutSize", ")", ";", "}", "g_eDataOutState", "=", "USBDEV_STATE_IDLE", ";", "break", ";", "}", "case", "USBDEV_STATE_WAIT_DATA", ":", "{", "break", ";", "}", "}", "}" ]
This function is called from HandleEndpoints for all interrupts signaling the arrival of data on the bulk OUT endpoint (in other words, whenever the host has sent us data).
[ "This", "function", "is", "called", "from", "HandleEndpoints", "for", "all", "interrupts", "signaling", "the", "arrival", "of", "data", "on", "the", "bulk", "OUT", "endpoint", "(", "in", "other", "words", "whenever", "the", "host", "has", "sent", "us", "data", ")", "." ]
[ "//\r", "// Weird - we got a packet before the configuration was set.\r", "// Just handle it as normal anyway.\r", "//\r", "//\r", "// Read the packet we got into the local buffer and keep track of\r", "// its size.\r", "//\r", "//\r", "// Was there a packet to read?\r", "//\r", "//\r", "//\r", "// ACK the packet. This tells the host that it is free to send\r", "// the next one.\r", "//\r", "//\r", "// Parse the packet contents and send appropriate commands to\r", "// the main loop.\r", "//\r", "//\r", "// We have handled the packet so jump back to idle state and wait\r", "// for the next one.\r", "//\r", "//\r", "// We shouldn't get here. This implies that we received a second\r", "// packet while we still had one in the FIFO which is not ACKed.\r", "//\r" ]
[ { "param": "ulStatus", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulStatus", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1c4b7edca53198f766055889797215288a5b8506
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/qs-scope/usb_device.c
[ "BSD-3-Clause" ]
C
ProcessDataToHost
void
static void ProcessDataToHost(unsigned long ulStatus) { if(ulStatus) { // // Clear the status bits. // USBDevEndpointStatusClear(USB0_BASE, DATA_IN_ENDPOINT, ulStatus); } // // Our IN endpoint is now idle. // g_eDataInState = USBDEV_STATE_IDLE; // // Our last transmission completed. Do we need to send any further data // or are we finished? // if(g_bSendHelloResponse) { // // We need to send a HELLO response packet so do this now. // SendHelloResponse(); } else { // // Do we have a pending PING_RESPONSE to send? // if(g_bSendPingResponse) { SendPingResponse(g_ucPingEcho1, g_ulPingEcho2); } } }
//***************************************************************************** // // This function is called from HandleEndpoints for all interrupts originating // from the bulk IN endpoint (in other words, whenever data has been // transmitted to the USB host). // //*****************************************************************************
This function is called from HandleEndpoints for all interrupts originating from the bulk IN endpoint (in other words, whenever data has been transmitted to the USB host).
[ "This", "function", "is", "called", "from", "HandleEndpoints", "for", "all", "interrupts", "originating", "from", "the", "bulk", "IN", "endpoint", "(", "in", "other", "words", "whenever", "data", "has", "been", "transmitted", "to", "the", "USB", "host", ")", "." ]
static void ProcessDataToHost(unsigned long ulStatus) { if(ulStatus) { USBDevEndpointStatusClear(USB0_BASE, DATA_IN_ENDPOINT, ulStatus); } g_eDataInState = USBDEV_STATE_IDLE; if(g_bSendHelloResponse) { SendHelloResponse(); } else { if(g_bSendPingResponse) { SendPingResponse(g_ucPingEcho1, g_ulPingEcho2); } } }
[ "static", "void", "ProcessDataToHost", "(", "unsigned", "long", "ulStatus", ")", "{", "if", "(", "ulStatus", ")", "{", "USBDevEndpointStatusClear", "(", "USB0_BASE", ",", "DATA_IN_ENDPOINT", ",", "ulStatus", ")", ";", "}", "g_eDataInState", "=", "USBDEV_STATE_IDLE", ";", "if", "(", "g_bSendHelloResponse", ")", "{", "SendHelloResponse", "(", ")", ";", "}", "else", "{", "if", "(", "g_bSendPingResponse", ")", "{", "SendPingResponse", "(", "g_ucPingEcho1", ",", "g_ulPingEcho2", ")", ";", "}", "}", "}" ]
This function is called from HandleEndpoints for all interrupts originating from the bulk IN endpoint (in other words, whenever data has been transmitted to the USB host).
[ "This", "function", "is", "called", "from", "HandleEndpoints", "for", "all", "interrupts", "originating", "from", "the", "bulk", "IN", "endpoint", "(", "in", "other", "words", "whenever", "data", "has", "been", "transmitted", "to", "the", "USB", "host", ")", "." ]
[ "//\r", "// Clear the status bits.\r", "//\r", "//\r", "// Our IN endpoint is now idle.\r", "//\r", "//\r", "// Our last transmission completed. Do we need to send any further data\r", "// or are we finished?\r", "//\r", "//\r", "// We need to send a HELLO response packet so do this now.\r", "//\r", "//\r", "// Do we have a pending PING_RESPONSE to send?\r", "//\r" ]
[ { "param": "ulStatus", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulStatus", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1c4b7edca53198f766055889797215288a5b8506
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/qs-scope/usb_device.c
[ "BSD-3-Clause" ]
C
SendUSBPacket
tBoolean
static tBoolean SendUSBPacket(tScopePacket *psHeader, unsigned char *pucData, unsigned long ulLength) { int iRetcode; // // Put the packet header into the transmit FIFO. // iRetcode = USBEndpointDataPut(USB0_BASE, DATA_IN_ENDPOINT, (unsigned char *)psHeader, sizeof(tScopePacket)); if(iRetcode == 0) { // // If the packet has optional data, send this too. // if(ulLength != 0) { iRetcode = USBEndpointDataPut(USB0_BASE, DATA_IN_ENDPOINT, pucData, ulLength); } // // Did we manage to put all the data into the USB FIFO? // if(iRetcode == 0) { // // We successfully put the data in the FIFO so now initiate the // transmission. // g_eDataInState = USBDEV_STATE_WAIT_DATA; iRetcode = USBEndpointDataSend(USB0_BASE, DATA_IN_ENDPOINT, USB_TRANS_IN); if(iRetcode != 0) { // // USBEndpointDataSend failed! // return(false); } } else { // // USBEndpointDataPut for the payload failed! // return(false); } } else { // // USBEndpointDataPut for the header failed! // return(false); } // // If we get here, things must have gone well // return(true); }
//***************************************************************************** // // This function sends a single packet with optional data block to the USB // host. // // \note This rather simplified function will not allow more data to be sent // than there is space in the USB FIFO for the data IN endpoint. // // \return Returns \b true if the packet was scheduled to be sent or \b false // if an error occurred. // //*****************************************************************************
This function sends a single packet with optional data block to the USB host. \note This rather simplified function will not allow more data to be sent than there is space in the USB FIFO for the data IN endpoint. \return Returns \b true if the packet was scheduled to be sent or \b false if an error occurred.
[ "This", "function", "sends", "a", "single", "packet", "with", "optional", "data", "block", "to", "the", "USB", "host", ".", "\\", "note", "This", "rather", "simplified", "function", "will", "not", "allow", "more", "data", "to", "be", "sent", "than", "there", "is", "space", "in", "the", "USB", "FIFO", "for", "the", "data", "IN", "endpoint", ".", "\\", "return", "Returns", "\\", "b", "true", "if", "the", "packet", "was", "scheduled", "to", "be", "sent", "or", "\\", "b", "false", "if", "an", "error", "occurred", "." ]
static tBoolean SendUSBPacket(tScopePacket *psHeader, unsigned char *pucData, unsigned long ulLength) { int iRetcode; iRetcode = USBEndpointDataPut(USB0_BASE, DATA_IN_ENDPOINT, (unsigned char *)psHeader, sizeof(tScopePacket)); if(iRetcode == 0) { if(ulLength != 0) { iRetcode = USBEndpointDataPut(USB0_BASE, DATA_IN_ENDPOINT, pucData, ulLength); } if(iRetcode == 0) { g_eDataInState = USBDEV_STATE_WAIT_DATA; iRetcode = USBEndpointDataSend(USB0_BASE, DATA_IN_ENDPOINT, USB_TRANS_IN); if(iRetcode != 0) { return(false); } } else { return(false); } } else { return(false); } return(true); }
[ "static", "tBoolean", "SendUSBPacket", "(", "tScopePacket", "*", "psHeader", ",", "unsigned", "char", "*", "pucData", ",", "unsigned", "long", "ulLength", ")", "{", "int", "iRetcode", ";", "iRetcode", "=", "USBEndpointDataPut", "(", "USB0_BASE", ",", "DATA_IN_ENDPOINT", ",", "(", "unsigned", "char", "*", ")", "psHeader", ",", "sizeof", "(", "tScopePacket", ")", ")", ";", "if", "(", "iRetcode", "==", "0", ")", "{", "if", "(", "ulLength", "!=", "0", ")", "{", "iRetcode", "=", "USBEndpointDataPut", "(", "USB0_BASE", ",", "DATA_IN_ENDPOINT", ",", "pucData", ",", "ulLength", ")", ";", "}", "if", "(", "iRetcode", "==", "0", ")", "{", "g_eDataInState", "=", "USBDEV_STATE_WAIT_DATA", ";", "iRetcode", "=", "USBEndpointDataSend", "(", "USB0_BASE", ",", "DATA_IN_ENDPOINT", ",", "USB_TRANS_IN", ")", ";", "if", "(", "iRetcode", "!=", "0", ")", "{", "return", "(", "false", ")", ";", "}", "}", "else", "{", "return", "(", "false", ")", ";", "}", "}", "else", "{", "return", "(", "false", ")", ";", "}", "return", "(", "true", ")", ";", "}" ]
This function sends a single packet with optional data block to the USB host.
[ "This", "function", "sends", "a", "single", "packet", "with", "optional", "data", "block", "to", "the", "USB", "host", "." ]
[ "//\r", "// Put the packet header into the transmit FIFO.\r", "//\r", "//\r", "// If the packet has optional data, send this too.\r", "//\r", "//\r", "// Did we manage to put all the data into the USB FIFO?\r", "//\r", "//\r", "// We successfully put the data in the FIFO so now initiate the\r", "// transmission.\r", "//\r", "//\r", "// USBEndpointDataSend failed!\r", "//\r", "//\r", "// USBEndpointDataPut for the payload failed!\r", "//\r", "//\r", "// USBEndpointDataPut for the header failed!\r", "//\r", "//\r", "// If we get here, things must have gone well\r", "//\r" ]
[ { "param": "psHeader", "type": "tScopePacket" }, { "param": "pucData", "type": "unsigned char" }, { "param": "ulLength", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "psHeader", "type": "tScopePacket", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pucData", "type": "unsigned char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulLength", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1c4b7edca53198f766055889797215288a5b8506
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/qs-scope/usb_device.c
[ "BSD-3-Clause" ]
C
ScopeUSBDeviceInit
tBoolean
tBoolean ScopeUSBDeviceInit(void) { // // Not configured initially. // g_ulUSBConfigured = 0; // // Configure the USB mux on the board to put us in device mode. We pull // the relevant pin high to do this. // SysCtlPeripheralEnable(USB_MUX_GPIO_PERIPH); GPIOPinTypeGPIOOutput(USB_MUX_GPIO_BASE, USB_MUX_GPIO_PIN); GPIOPinWrite(USB_MUX_GPIO_BASE, USB_MUX_GPIO_PIN, USB_MUX_SEL_DEVICE); // // Tell the stack that we will be operating as a device rather than a // host. This calls back to ScopeUSBModeCallback where we perform final // initialization. // USBStackModeSet(0, USB_MODE_DEVICE, ScopeUSBModeCallback); // // Enter the idle state. // CleanUpOnDisconnect(false); // // Pass our device information to the USB library. // USBDCDInit(0, &g_sScopeDeviceInfo); return(true); }
//***************************************************************************** // // Initializes the USB stack for the oscilloscope device. // //*****************************************************************************
Initializes the USB stack for the oscilloscope device.
[ "Initializes", "the", "USB", "stack", "for", "the", "oscilloscope", "device", "." ]
tBoolean ScopeUSBDeviceInit(void) { g_ulUSBConfigured = 0; SysCtlPeripheralEnable(USB_MUX_GPIO_PERIPH); GPIOPinTypeGPIOOutput(USB_MUX_GPIO_BASE, USB_MUX_GPIO_PIN); GPIOPinWrite(USB_MUX_GPIO_BASE, USB_MUX_GPIO_PIN, USB_MUX_SEL_DEVICE); USBStackModeSet(0, USB_MODE_DEVICE, ScopeUSBModeCallback); CleanUpOnDisconnect(false); USBDCDInit(0, &g_sScopeDeviceInfo); return(true); }
[ "tBoolean", "ScopeUSBDeviceInit", "(", "void", ")", "{", "g_ulUSBConfigured", "=", "0", ";", "SysCtlPeripheralEnable", "(", "USB_MUX_GPIO_PERIPH", ")", ";", "GPIOPinTypeGPIOOutput", "(", "USB_MUX_GPIO_BASE", ",", "USB_MUX_GPIO_PIN", ")", ";", "GPIOPinWrite", "(", "USB_MUX_GPIO_BASE", ",", "USB_MUX_GPIO_PIN", ",", "USB_MUX_SEL_DEVICE", ")", ";", "USBStackModeSet", "(", "0", ",", "USB_MODE_DEVICE", ",", "ScopeUSBModeCallback", ")", ";", "CleanUpOnDisconnect", "(", "false", ")", ";", "USBDCDInit", "(", "0", ",", "&", "g_sScopeDeviceInfo", ")", ";", "return", "(", "true", ")", ";", "}" ]
Initializes the USB stack for the oscilloscope device.
[ "Initializes", "the", "USB", "stack", "for", "the", "oscilloscope", "device", "." ]
[ "//\r", "// Not configured initially.\r", "//\r", "//\r", "// Configure the USB mux on the board to put us in device mode. We pull\r", "// the relevant pin high to do this.\r", "//\r", "//\r", "// Tell the stack that we will be operating as a device rather than a\r", "// host. This calls back to ScopeUSBModeCallback where we perform final\r", "// initialization.\r", "//\r", "//\r", "// Enter the idle state.\r", "//\r", "//\r", "// Pass our device information to the USB library.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
1c4b7edca53198f766055889797215288a5b8506
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/qs-scope/usb_device.c
[ "BSD-3-Clause" ]
C
ScopeUSBDeviceTerm
void
void ScopeUSBDeviceTerm(void) { // // Remember that we are no longer configured. // g_ulUSBConfigured = 0; // // Tell the USB library that we are no longer using the controller. // USBDCDTerm(0); }
//***************************************************************************** // // Removes the oscilloscope USB device from the bus. // //*****************************************************************************
Removes the oscilloscope USB device from the bus.
[ "Removes", "the", "oscilloscope", "USB", "device", "from", "the", "bus", "." ]
void ScopeUSBDeviceTerm(void) { g_ulUSBConfigured = 0; USBDCDTerm(0); }
[ "void", "ScopeUSBDeviceTerm", "(", "void", ")", "{", "g_ulUSBConfigured", "=", "0", ";", "USBDCDTerm", "(", "0", ")", ";", "}" ]
Removes the oscilloscope USB device from the bus.
[ "Removes", "the", "oscilloscope", "USB", "device", "from", "the", "bus", "." ]
[ "//\r", "// Remember that we are no longer configured.\r", "//\r", "//\r", "// Tell the USB library that we are no longer using the controller.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
1c4b7edca53198f766055889797215288a5b8506
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/qs-scope/usb_device.c
[ "BSD-3-Clause" ]
C
ScopeUSBDeviceSendPacket
tBoolean
tBoolean ScopeUSBDeviceSendPacket(unsigned char ucPacketType, unsigned char ucParam, unsigned long ulParam) { tBoolean bRetcode; tScopePacket sPacket; if(g_eDeviceState == DEVICE_COMMUNICATING) { // // Set the flag which prevents any automatic packet transmission // from interrupt context while we are trying to send a packet // from this context. // g_bBlockSend = true; // // Wait until it is safe to send the packet. // bRetcode = WaitForUSBSendIdle(USB_DATA_TIMEOUT_TICKS); // // If we didn't time out, go ahead and send the packet. // if(bRetcode) { // // Fill in the packet header structure. // sPacket.ucVersion = SCOPE_PROTOCOL_VERSION_1; sPacket.ucHdrLength = sizeof(tScopePacket); sPacket.ucPacketType = ucPacketType; sPacket.ucParam = ucParam; sPacket.ulParam = ulParam; sPacket.ulDataLength = 0; // // ...and send it back to the host. // bRetcode = SendUSBPacket(&sPacket, 0, 0); // // If we scheduled the packet for transmission successfully, // wait until it has been sent. // if(bRetcode) { bRetcode = WaitForUSBSendIdle(USB_DATA_TIMEOUT_TICKS); } } } else { // // We are not connected to the host so discard the packet. // bRetcode = false; } // // Release the transmission block flag. // g_bBlockSend = false; return(bRetcode); }
//***************************************************************************** // // This public function sends a single packet to the host and returns once // the packet has been acknowledged. // // \param ucPacketType is the type of packet to send. // \param ucParam is the first packet parameter value. // \param ulParam is the second packet parameter value. // // \note This rather simplified function will not allow more data to be sent // than there is space in the USB FIFO for the data IN endpoint. // // \return Returns \b true if the packet was sent successfully or \b false // if an error occurred or we are not connected to the host. // //*****************************************************************************
This public function sends a single packet to the host and returns once the packet has been acknowledged. \param ucPacketType is the type of packet to send. \param ucParam is the first packet parameter value. \param ulParam is the second packet parameter value. \note This rather simplified function will not allow more data to be sent than there is space in the USB FIFO for the data IN endpoint. \return Returns \b true if the packet was sent successfully or \b false if an error occurred or we are not connected to the host.
[ "This", "public", "function", "sends", "a", "single", "packet", "to", "the", "host", "and", "returns", "once", "the", "packet", "has", "been", "acknowledged", ".", "\\", "param", "ucPacketType", "is", "the", "type", "of", "packet", "to", "send", ".", "\\", "param", "ucParam", "is", "the", "first", "packet", "parameter", "value", ".", "\\", "param", "ulParam", "is", "the", "second", "packet", "parameter", "value", ".", "\\", "note", "This", "rather", "simplified", "function", "will", "not", "allow", "more", "data", "to", "be", "sent", "than", "there", "is", "space", "in", "the", "USB", "FIFO", "for", "the", "data", "IN", "endpoint", ".", "\\", "return", "Returns", "\\", "b", "true", "if", "the", "packet", "was", "sent", "successfully", "or", "\\", "b", "false", "if", "an", "error", "occurred", "or", "we", "are", "not", "connected", "to", "the", "host", "." ]
tBoolean ScopeUSBDeviceSendPacket(unsigned char ucPacketType, unsigned char ucParam, unsigned long ulParam) { tBoolean bRetcode; tScopePacket sPacket; if(g_eDeviceState == DEVICE_COMMUNICATING) { g_bBlockSend = true; bRetcode = WaitForUSBSendIdle(USB_DATA_TIMEOUT_TICKS); if(bRetcode) { sPacket.ucVersion = SCOPE_PROTOCOL_VERSION_1; sPacket.ucHdrLength = sizeof(tScopePacket); sPacket.ucPacketType = ucPacketType; sPacket.ucParam = ucParam; sPacket.ulParam = ulParam; sPacket.ulDataLength = 0; bRetcode = SendUSBPacket(&sPacket, 0, 0); if(bRetcode) { bRetcode = WaitForUSBSendIdle(USB_DATA_TIMEOUT_TICKS); } } } else { bRetcode = false; } g_bBlockSend = false; return(bRetcode); }
[ "tBoolean", "ScopeUSBDeviceSendPacket", "(", "unsigned", "char", "ucPacketType", ",", "unsigned", "char", "ucParam", ",", "unsigned", "long", "ulParam", ")", "{", "tBoolean", "bRetcode", ";", "tScopePacket", "sPacket", ";", "if", "(", "g_eDeviceState", "==", "DEVICE_COMMUNICATING", ")", "{", "g_bBlockSend", "=", "true", ";", "bRetcode", "=", "WaitForUSBSendIdle", "(", "USB_DATA_TIMEOUT_TICKS", ")", ";", "if", "(", "bRetcode", ")", "{", "sPacket", ".", "ucVersion", "=", "SCOPE_PROTOCOL_VERSION_1", ";", "sPacket", ".", "ucHdrLength", "=", "sizeof", "(", "tScopePacket", ")", ";", "sPacket", ".", "ucPacketType", "=", "ucPacketType", ";", "sPacket", ".", "ucParam", "=", "ucParam", ";", "sPacket", ".", "ulParam", "=", "ulParam", ";", "sPacket", ".", "ulDataLength", "=", "0", ";", "bRetcode", "=", "SendUSBPacket", "(", "&", "sPacket", ",", "0", ",", "0", ")", ";", "if", "(", "bRetcode", ")", "{", "bRetcode", "=", "WaitForUSBSendIdle", "(", "USB_DATA_TIMEOUT_TICKS", ")", ";", "}", "}", "}", "else", "{", "bRetcode", "=", "false", ";", "}", "g_bBlockSend", "=", "false", ";", "return", "(", "bRetcode", ")", ";", "}" ]
This public function sends a single packet to the host and returns once the packet has been acknowledged.
[ "This", "public", "function", "sends", "a", "single", "packet", "to", "the", "host", "and", "returns", "once", "the", "packet", "has", "been", "acknowledged", "." ]
[ "//\r", "// Set the flag which prevents any automatic packet transmission\r", "// from interrupt context while we are trying to send a packet\r", "// from this context.\r", "//\r", "//\r", "// Wait until it is safe to send the packet.\r", "//\r", "//\r", "// If we didn't time out, go ahead and send the packet.\r", "//\r", "//\r", "// Fill in the packet header structure.\r", "//\r", "//\r", "// ...and send it back to the host.\r", "//\r", "//\r", "// If we scheduled the packet for transmission successfully,\r", "// wait until it has been sent.\r", "//\r", "//\r", "// We are not connected to the host so discard the packet.\r", "//\r", "//\r", "// Release the transmission block flag.\r", "//\r" ]
[ { "param": "ucPacketType", "type": "unsigned char" }, { "param": "ucParam", "type": "unsigned char" }, { "param": "ulParam", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ucPacketType", "type": "unsigned char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ucParam", "type": "unsigned char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulParam", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1c4b7edca53198f766055889797215288a5b8506
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/qs-scope/usb_device.c
[ "BSD-3-Clause" ]
C
CleanUpOnDisconnect
void
static void CleanUpOnDisconnect(tBoolean bInformUser) { // // Get back to the default state. We are not in communication, both // endpoints are idle and we are not automatically sending data back to // the host. // UARTprintf("USB host disconnected\n"); g_eDataInState = USBDEV_STATE_IDLE; g_eDataOutState = USBDEV_STATE_IDLE; g_eDeviceState = DEVICE_DISCONNECTED; g_bDataEnabled = false; g_bBlockSend = false; // // Inform the main loop that the host is disconnecting. // if(bInformUser) { COMMAND_FLAG_WRITE(SCOPE_USB_HOST_REMOVE, 0); } }
//***************************************************************************** // // This function should be called in all error conditions which cause us to // believe that the host disconnected or which cause us to need to // synchronize with the host. We clean up all state and revert to // the original disconnected state where we wait for a SCOPE_PKT_HOST_HELLO // and ignore all other incoming packets. The host should recognize that it is // no longer being communicated with and initiate communications after this. // //*****************************************************************************
This function should be called in all error conditions which cause us to believe that the host disconnected or which cause us to need to synchronize with the host. We clean up all state and revert to the original disconnected state where we wait for a SCOPE_PKT_HOST_HELLO and ignore all other incoming packets. The host should recognize that it is no longer being communicated with and initiate communications after this.
[ "This", "function", "should", "be", "called", "in", "all", "error", "conditions", "which", "cause", "us", "to", "believe", "that", "the", "host", "disconnected", "or", "which", "cause", "us", "to", "need", "to", "synchronize", "with", "the", "host", ".", "We", "clean", "up", "all", "state", "and", "revert", "to", "the", "original", "disconnected", "state", "where", "we", "wait", "for", "a", "SCOPE_PKT_HOST_HELLO", "and", "ignore", "all", "other", "incoming", "packets", ".", "The", "host", "should", "recognize", "that", "it", "is", "no", "longer", "being", "communicated", "with", "and", "initiate", "communications", "after", "this", "." ]
static void CleanUpOnDisconnect(tBoolean bInformUser) { UARTprintf("USB host disconnected\n"); g_eDataInState = USBDEV_STATE_IDLE; g_eDataOutState = USBDEV_STATE_IDLE; g_eDeviceState = DEVICE_DISCONNECTED; g_bDataEnabled = false; g_bBlockSend = false; if(bInformUser) { COMMAND_FLAG_WRITE(SCOPE_USB_HOST_REMOVE, 0); } }
[ "static", "void", "CleanUpOnDisconnect", "(", "tBoolean", "bInformUser", ")", "{", "UARTprintf", "(", "\"", "\\n", "\"", ")", ";", "g_eDataInState", "=", "USBDEV_STATE_IDLE", ";", "g_eDataOutState", "=", "USBDEV_STATE_IDLE", ";", "g_eDeviceState", "=", "DEVICE_DISCONNECTED", ";", "g_bDataEnabled", "=", "false", ";", "g_bBlockSend", "=", "false", ";", "if", "(", "bInformUser", ")", "{", "COMMAND_FLAG_WRITE", "(", "SCOPE_USB_HOST_REMOVE", ",", "0", ")", ";", "}", "}" ]
This function should be called in all error conditions which cause us to believe that the host disconnected or which cause us to need to synchronize with the host.
[ "This", "function", "should", "be", "called", "in", "all", "error", "conditions", "which", "cause", "us", "to", "believe", "that", "the", "host", "disconnected", "or", "which", "cause", "us", "to", "need", "to", "synchronize", "with", "the", "host", "." ]
[ "//\r", "// Get back to the default state. We are not in communication, both\r", "// endpoints are idle and we are not automatically sending data back to\r", "// the host.\r", "//\r", "//\r", "// Inform the main loop that the host is disconnecting.\r", "//\r" ]
[ { "param": "bInformUser", "type": "tBoolean" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bInformUser", "type": "tBoolean", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1c4b7edca53198f766055889797215288a5b8506
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/qs-scope/usb_device.c
[ "BSD-3-Clause" ]
C
WaitForUSBSendIdle
tBoolean
static tBoolean WaitForUSBSendIdle(unsigned long ulTimeout) { unsigned long ulTimeEnd; // // What will the time be when we time out? // ulTimeEnd = g_ulSysTickCounter + ulTimeout; // // Wait for the USB endpoint to become free. // while((g_eDataInState != USBDEV_STATE_IDLE) && (g_ulSysTickCounter != ulTimeEnd)) { // // Wait around... // } // // Did we drop out of the loop because the endpoint is idle or // due to a timeout? Return true if the endpoint is now idle // or false if not (since this implies we timed out). // return(g_eDataInState == USBDEV_STATE_IDLE); }
//***************************************************************************** // // This function will poll until either the USB data IN endpoint is idle or a // timeout occurs. The ulTimeout parameter provides the required timeout // expressed in a number of system ticks. // //*****************************************************************************
This function will poll until either the USB data IN endpoint is idle or a timeout occurs. The ulTimeout parameter provides the required timeout expressed in a number of system ticks.
[ "This", "function", "will", "poll", "until", "either", "the", "USB", "data", "IN", "endpoint", "is", "idle", "or", "a", "timeout", "occurs", ".", "The", "ulTimeout", "parameter", "provides", "the", "required", "timeout", "expressed", "in", "a", "number", "of", "system", "ticks", "." ]
static tBoolean WaitForUSBSendIdle(unsigned long ulTimeout) { unsigned long ulTimeEnd; ulTimeEnd = g_ulSysTickCounter + ulTimeout; while((g_eDataInState != USBDEV_STATE_IDLE) && (g_ulSysTickCounter != ulTimeEnd)) { } return(g_eDataInState == USBDEV_STATE_IDLE); }
[ "static", "tBoolean", "WaitForUSBSendIdle", "(", "unsigned", "long", "ulTimeout", ")", "{", "unsigned", "long", "ulTimeEnd", ";", "ulTimeEnd", "=", "g_ulSysTickCounter", "+", "ulTimeout", ";", "while", "(", "(", "g_eDataInState", "!=", "USBDEV_STATE_IDLE", ")", "&&", "(", "g_ulSysTickCounter", "!=", "ulTimeEnd", ")", ")", "{", "}", "return", "(", "g_eDataInState", "==", "USBDEV_STATE_IDLE", ")", ";", "}" ]
This function will poll until either the USB data IN endpoint is idle or a timeout occurs.
[ "This", "function", "will", "poll", "until", "either", "the", "USB", "data", "IN", "endpoint", "is", "idle", "or", "a", "timeout", "occurs", "." ]
[ "//\r", "// What will the time be when we time out?\r", "//\r", "//\r", "// Wait for the USB endpoint to become free.\r", "//\r", "//\r", "// Wait around...\r", "//\r", "//\r", "// Did we drop out of the loop because the endpoint is idle or\r", "// due to a timeout? Return true if the endpoint is now idle\r", "// or false if not (since this implies we timed out).\r", "//\r" ]
[ { "param": "ulTimeout", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulTimeout", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1c4b7edca53198f766055889797215288a5b8506
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/qs-scope/usb_device.c
[ "BSD-3-Clause" ]
C
ScopeUSBDeviceSendData
tBoolean
tBoolean ScopeUSBDeviceSendData(tDataAcqCaptureStatus *pCapInfo, tBoolean bAuto) { tScopeDataStart sStartInfo; tScopePacket sPacket; tBoolean bRetcode; unsigned char ucPacketCount; unsigned long ulSampleCount; unsigned long ulSampleIndex; unsigned long ulMaxSample; unsigned long ulLoop; int iRetcode; // // We only send data if the device is connected to a USB host // and the host has either requested the data or enabled automatic // data transmission. // if((g_eDeviceState == DEVICE_COMMUNICATING) && (!bAuto || (bAuto && g_bDataEnabled))) { // // Set the flag that signals the interrupt context code not to // try to send anything immediately. // g_bBlockSend = true; // // Wait for the data IN endpoint to complete sending // the packet. // bRetcode = WaitForUSBSendIdle(USB_DATA_TIMEOUT_TICKS); // // If we didn't time out, go ahead and send the data // if(bRetcode) { // // The endpoint is idle so send our data. We first send a // SCOPE_PKT_DATA_START packet. // sStartInfo.ulSampleOffsetuS = pCapInfo->ulSampleOffsetuS; sStartInfo.ulSamplePerioduS = pCapInfo->ulSamplePerioduS; sStartInfo.bDualChannel = pCapInfo->bDualMode; sStartInfo.bCh2SampleFirst = pCapInfo->bBSampleFirst; sStartInfo.ulTotalElements = pCapInfo->bDualMode ? (pCapInfo->ulMaxSamples / 2) : pCapInfo->ulMaxSamples; // // Map the trigger index in the ring buffer to an element // index in the data we will be sending back to the USB host. // sStartInfo.ulTriggerIndex = DISTANCE_FROM_START( pCapInfo->ulStartIndex, pCapInfo->ulTriggerIndex, pCapInfo->ulMaxSamples); if(pCapInfo->bDualMode) { sStartInfo.ulTriggerIndex /= 2; } sPacket.ucVersion = SCOPE_PROTOCOL_VERSION_1; sPacket.ucHdrLength = sizeof(tScopePacket); sPacket.ucPacketType = SCOPE_PKT_DATA_START; sPacket.ucParam = 0; sPacket.ulParam = sStartInfo.ulTotalElements; sPacket.ulDataLength = sizeof(tScopeDataStart); bRetcode = SendUSBPacket(&sPacket, (unsigned char *)&sStartInfo, sizeof(tScopeDataStart)); // // If we can't send the packet for some reason, // return an error. // if(!bRetcode) { CleanUpOnDisconnect(true); return(false); } // // Now we send the actual data samples in multiple // SCOPE_PKT_DATA packets. // ulSampleCount = 0; ulSampleIndex = pCapInfo->ulStartIndex; ucPacketCount = 1; ulMaxSample = sPacket.ulParam; sPacket.ucPacketType = SCOPE_PKT_DATA; while(ulSampleCount < ulMaxSample) { // // Wait for the data IN endpoint to complete sending // the previous packet. // bRetcode = WaitForUSBSendIdle(USB_DATA_TIMEOUT_TICKS); // // Immediately mark the endpoint as waiting for data. This is // intended to reduce the likelihood of an incoming PING or // HELLO packet from causing our interrupt service routine to // write to the USB endpoint FIFO while this function is // running. There is, admittedly, still a tiny timing hole // here (if a USB interrupt for a PING packet is serviced // between WaitForUSBSendIdle and the next line, we have a // problem). // g_eDataInState = USBDEV_STATE_WAIT_DATA; if(!bRetcode) { CleanUpOnDisconnect(true); return(false); } // // Update the header for the new packet. // sPacket.ucParam = ucPacketCount++; // // How many samples will we send in this packet? // if(pCapInfo->bDualMode) { sPacket.ulParam = min(DUAL_ELEMENTS_PER_PACKET, (ulMaxSample - ulSampleCount)); sPacket.ulDataLength = (sPacket.ulParam * sizeof(tScopeDualDataElement)); } else { sPacket.ulParam = min(SINGLE_ELEMENTS_PER_PACKET, (ulMaxSample - ulSampleCount)); sPacket.ulDataLength = (sPacket.ulParam * sizeof(tScopeDataElement)); } // // Put the packet header into the transmit FIFO. // USBEndpointDataPut(USB0_BASE, DATA_IN_ENDPOINT, (unsigned char *)&sPacket, sizeof(tScopePacket)); // // Now write the sample data for this packet. // for(ulLoop = 0; ulLoop < sPacket.ulParam; ulLoop++) { // // Are we dealing with single or dual channel data? // if(pCapInfo->bDualMode) { // // Dual channel - send two samples per element. // tScopeDualDataElement sData; sData.ulTimeuS = ((ulSampleCount + ulLoop) * pCapInfo->ulSamplePerioduS); sData.sSample1mVolts = ADC_SAMPLE_TO_MV( pCapInfo->pusBuffer[ulSampleIndex++]); sData.sSample2mVolts = ADC_SAMPLE_TO_MV( pCapInfo->pusBuffer[ulSampleIndex++]); // // Adjust for the wrap at the end of the ring buffer. // It's fine to do this after writing both samples // since the sample buffer must be a multiple of two // samples long - we can't have a wrap between samples. // if(ulSampleIndex >= pCapInfo->ulMaxSamples) { ulSampleIndex -= pCapInfo->ulMaxSamples; } // // Write the sample to the USB FIFO. // USBEndpointDataPut(USB0_BASE, DATA_IN_ENDPOINT, (unsigned char *)&sData, sizeof(tScopeDualDataElement)); } else { // // Single channel - send one sample per element. // tScopeDataElement sData; sData.ulTimeuS = ((ulSampleCount + ulLoop) * pCapInfo->ulSamplePerioduS); sData.sSamplemVolts = ADC_SAMPLE_TO_MV( pCapInfo->pusBuffer[ulSampleIndex++]); // // Adjust for the wrap at the end of the ring buffer. // if(ulSampleIndex >= pCapInfo->ulMaxSamples) { ulSampleIndex -= pCapInfo->ulMaxSamples; } // // Write the sample to the USB FIFO. // USBEndpointDataPut(USB0_BASE, DATA_IN_ENDPOINT, (unsigned char *)&sData, sizeof(tScopeDataElement)); } } // // At this point, we've written all the data for a single data // packet so go ahead and send it. // iRetcode = USBEndpointDataSend(USB0_BASE, DATA_IN_ENDPOINT, USB_TRANS_IN); // // Was the transmission scheduled successfully? // if(iRetcode != 0) { // // No - something went wrong. Handle this as if the host // disconnected. // CleanUpOnDisconnect(true); return(false); } // // Update our element counter for the next loop. // ulSampleCount += sPacket.ulParam; } // // At this point, all the data packets have been sent. All we need // to do now is send a terminating SCOPE_PKT_DATA_END. // sPacket.ucPacketType = SCOPE_PKT_DATA_END; sPacket.ucParam = ucPacketCount; sPacket.ulParam = 0; sPacket.ulDataLength = 0; // // Wait for the data IN endpoint to complete sending // the previous packet. // bRetcode = WaitForUSBSendIdle(USB_DATA_TIMEOUT_TICKS); if(bRetcode) { bRetcode = SendUSBPacket(&sPacket, 0, 0); } if(!bRetcode) { // // We couldn't send the packet. Treat this as a host // disconnection. // CleanUpOnDisconnect(true); return(false); } else { // // Clear the flag blocking the ISR from transmitting. // g_bBlockSend = false; return(true); } } else { // // We timed out waiting for the data IN endpoint to become free. // Something horrid happened so disconnect and wait for the host to // initiate communication. // CleanUpOnDisconnect(true); } } // // If we get here data transmission was disabled or we are // not connected to the host. // return(false); }
//***************************************************************************** // // This function is called by the main loop to transmit captured waveform // data to the USB host (if connected). The function blocks until the complete // data set has been transmitted and acknowledged by the host. // // If the host is not currently connected, this function returns immediately // indicating an error. // // If automatic data transmission is currently enabled, the call is ignored // unless the \e bAuto parameter is \b false indicating that the call is the // result of a specific request for data from the host. // // Note: This function must not be called from interrupt context since it // blocks until all data is sent or a timeout occurs. // // \return Returns \b true on success or \b false on error. // //*****************************************************************************
This function is called by the main loop to transmit captured waveform data to the USB host (if connected). The function blocks until the complete data set has been transmitted and acknowledged by the host. If the host is not currently connected, this function returns immediately indicating an error. If automatic data transmission is currently enabled, the call is ignored unless the \e bAuto parameter is \b false indicating that the call is the result of a specific request for data from the host. This function must not be called from interrupt context since it blocks until all data is sent or a timeout occurs. \return Returns \b true on success or \b false on error.
[ "This", "function", "is", "called", "by", "the", "main", "loop", "to", "transmit", "captured", "waveform", "data", "to", "the", "USB", "host", "(", "if", "connected", ")", ".", "The", "function", "blocks", "until", "the", "complete", "data", "set", "has", "been", "transmitted", "and", "acknowledged", "by", "the", "host", ".", "If", "the", "host", "is", "not", "currently", "connected", "this", "function", "returns", "immediately", "indicating", "an", "error", ".", "If", "automatic", "data", "transmission", "is", "currently", "enabled", "the", "call", "is", "ignored", "unless", "the", "\\", "e", "bAuto", "parameter", "is", "\\", "b", "false", "indicating", "that", "the", "call", "is", "the", "result", "of", "a", "specific", "request", "for", "data", "from", "the", "host", ".", "This", "function", "must", "not", "be", "called", "from", "interrupt", "context", "since", "it", "blocks", "until", "all", "data", "is", "sent", "or", "a", "timeout", "occurs", ".", "\\", "return", "Returns", "\\", "b", "true", "on", "success", "or", "\\", "b", "false", "on", "error", "." ]
tBoolean ScopeUSBDeviceSendData(tDataAcqCaptureStatus *pCapInfo, tBoolean bAuto) { tScopeDataStart sStartInfo; tScopePacket sPacket; tBoolean bRetcode; unsigned char ucPacketCount; unsigned long ulSampleCount; unsigned long ulSampleIndex; unsigned long ulMaxSample; unsigned long ulLoop; int iRetcode; if((g_eDeviceState == DEVICE_COMMUNICATING) && (!bAuto || (bAuto && g_bDataEnabled))) { g_bBlockSend = true; bRetcode = WaitForUSBSendIdle(USB_DATA_TIMEOUT_TICKS); if(bRetcode) { sStartInfo.ulSampleOffsetuS = pCapInfo->ulSampleOffsetuS; sStartInfo.ulSamplePerioduS = pCapInfo->ulSamplePerioduS; sStartInfo.bDualChannel = pCapInfo->bDualMode; sStartInfo.bCh2SampleFirst = pCapInfo->bBSampleFirst; sStartInfo.ulTotalElements = pCapInfo->bDualMode ? (pCapInfo->ulMaxSamples / 2) : pCapInfo->ulMaxSamples; sStartInfo.ulTriggerIndex = DISTANCE_FROM_START( pCapInfo->ulStartIndex, pCapInfo->ulTriggerIndex, pCapInfo->ulMaxSamples); if(pCapInfo->bDualMode) { sStartInfo.ulTriggerIndex /= 2; } sPacket.ucVersion = SCOPE_PROTOCOL_VERSION_1; sPacket.ucHdrLength = sizeof(tScopePacket); sPacket.ucPacketType = SCOPE_PKT_DATA_START; sPacket.ucParam = 0; sPacket.ulParam = sStartInfo.ulTotalElements; sPacket.ulDataLength = sizeof(tScopeDataStart); bRetcode = SendUSBPacket(&sPacket, (unsigned char *)&sStartInfo, sizeof(tScopeDataStart)); if(!bRetcode) { CleanUpOnDisconnect(true); return(false); } ulSampleCount = 0; ulSampleIndex = pCapInfo->ulStartIndex; ucPacketCount = 1; ulMaxSample = sPacket.ulParam; sPacket.ucPacketType = SCOPE_PKT_DATA; while(ulSampleCount < ulMaxSample) { bRetcode = WaitForUSBSendIdle(USB_DATA_TIMEOUT_TICKS); g_eDataInState = USBDEV_STATE_WAIT_DATA; if(!bRetcode) { CleanUpOnDisconnect(true); return(false); } sPacket.ucParam = ucPacketCount++; if(pCapInfo->bDualMode) { sPacket.ulParam = min(DUAL_ELEMENTS_PER_PACKET, (ulMaxSample - ulSampleCount)); sPacket.ulDataLength = (sPacket.ulParam * sizeof(tScopeDualDataElement)); } else { sPacket.ulParam = min(SINGLE_ELEMENTS_PER_PACKET, (ulMaxSample - ulSampleCount)); sPacket.ulDataLength = (sPacket.ulParam * sizeof(tScopeDataElement)); } USBEndpointDataPut(USB0_BASE, DATA_IN_ENDPOINT, (unsigned char *)&sPacket, sizeof(tScopePacket)); for(ulLoop = 0; ulLoop < sPacket.ulParam; ulLoop++) { if(pCapInfo->bDualMode) { tScopeDualDataElement sData; sData.ulTimeuS = ((ulSampleCount + ulLoop) * pCapInfo->ulSamplePerioduS); sData.sSample1mVolts = ADC_SAMPLE_TO_MV( pCapInfo->pusBuffer[ulSampleIndex++]); sData.sSample2mVolts = ADC_SAMPLE_TO_MV( pCapInfo->pusBuffer[ulSampleIndex++]); if(ulSampleIndex >= pCapInfo->ulMaxSamples) { ulSampleIndex -= pCapInfo->ulMaxSamples; } USBEndpointDataPut(USB0_BASE, DATA_IN_ENDPOINT, (unsigned char *)&sData, sizeof(tScopeDualDataElement)); } else { tScopeDataElement sData; sData.ulTimeuS = ((ulSampleCount + ulLoop) * pCapInfo->ulSamplePerioduS); sData.sSamplemVolts = ADC_SAMPLE_TO_MV( pCapInfo->pusBuffer[ulSampleIndex++]); if(ulSampleIndex >= pCapInfo->ulMaxSamples) { ulSampleIndex -= pCapInfo->ulMaxSamples; } USBEndpointDataPut(USB0_BASE, DATA_IN_ENDPOINT, (unsigned char *)&sData, sizeof(tScopeDataElement)); } } iRetcode = USBEndpointDataSend(USB0_BASE, DATA_IN_ENDPOINT, USB_TRANS_IN); if(iRetcode != 0) { CleanUpOnDisconnect(true); return(false); } ulSampleCount += sPacket.ulParam; } sPacket.ucPacketType = SCOPE_PKT_DATA_END; sPacket.ucParam = ucPacketCount; sPacket.ulParam = 0; sPacket.ulDataLength = 0; bRetcode = WaitForUSBSendIdle(USB_DATA_TIMEOUT_TICKS); if(bRetcode) { bRetcode = SendUSBPacket(&sPacket, 0, 0); } if(!bRetcode) { CleanUpOnDisconnect(true); return(false); } else { g_bBlockSend = false; return(true); } } else { CleanUpOnDisconnect(true); } } return(false); }
[ "tBoolean", "ScopeUSBDeviceSendData", "(", "tDataAcqCaptureStatus", "*", "pCapInfo", ",", "tBoolean", "bAuto", ")", "{", "tScopeDataStart", "sStartInfo", ";", "tScopePacket", "sPacket", ";", "tBoolean", "bRetcode", ";", "unsigned", "char", "ucPacketCount", ";", "unsigned", "long", "ulSampleCount", ";", "unsigned", "long", "ulSampleIndex", ";", "unsigned", "long", "ulMaxSample", ";", "unsigned", "long", "ulLoop", ";", "int", "iRetcode", ";", "if", "(", "(", "g_eDeviceState", "==", "DEVICE_COMMUNICATING", ")", "&&", "(", "!", "bAuto", "||", "(", "bAuto", "&&", "g_bDataEnabled", ")", ")", ")", "{", "g_bBlockSend", "=", "true", ";", "bRetcode", "=", "WaitForUSBSendIdle", "(", "USB_DATA_TIMEOUT_TICKS", ")", ";", "if", "(", "bRetcode", ")", "{", "sStartInfo", ".", "ulSampleOffsetuS", "=", "pCapInfo", "->", "ulSampleOffsetuS", ";", "sStartInfo", ".", "ulSamplePerioduS", "=", "pCapInfo", "->", "ulSamplePerioduS", ";", "sStartInfo", ".", "bDualChannel", "=", "pCapInfo", "->", "bDualMode", ";", "sStartInfo", ".", "bCh2SampleFirst", "=", "pCapInfo", "->", "bBSampleFirst", ";", "sStartInfo", ".", "ulTotalElements", "=", "pCapInfo", "->", "bDualMode", "?", "(", "pCapInfo", "->", "ulMaxSamples", "/", "2", ")", ":", "pCapInfo", "->", "ulMaxSamples", ";", "sStartInfo", ".", "ulTriggerIndex", "=", "DISTANCE_FROM_START", "(", "pCapInfo", "->", "ulStartIndex", ",", "pCapInfo", "->", "ulTriggerIndex", ",", "pCapInfo", "->", "ulMaxSamples", ")", ";", "if", "(", "pCapInfo", "->", "bDualMode", ")", "{", "sStartInfo", ".", "ulTriggerIndex", "/=", "2", ";", "}", "sPacket", ".", "ucVersion", "=", "SCOPE_PROTOCOL_VERSION_1", ";", "sPacket", ".", "ucHdrLength", "=", "sizeof", "(", "tScopePacket", ")", ";", "sPacket", ".", "ucPacketType", "=", "SCOPE_PKT_DATA_START", ";", "sPacket", ".", "ucParam", "=", "0", ";", "sPacket", ".", "ulParam", "=", "sStartInfo", ".", "ulTotalElements", ";", "sPacket", ".", "ulDataLength", "=", "sizeof", "(", "tScopeDataStart", ")", ";", "bRetcode", "=", "SendUSBPacket", "(", "&", "sPacket", ",", "(", "unsigned", "char", "*", ")", "&", "sStartInfo", ",", "sizeof", "(", "tScopeDataStart", ")", ")", ";", "if", "(", "!", "bRetcode", ")", "{", "CleanUpOnDisconnect", "(", "true", ")", ";", "return", "(", "false", ")", ";", "}", "ulSampleCount", "=", "0", ";", "ulSampleIndex", "=", "pCapInfo", "->", "ulStartIndex", ";", "ucPacketCount", "=", "1", ";", "ulMaxSample", "=", "sPacket", ".", "ulParam", ";", "sPacket", ".", "ucPacketType", "=", "SCOPE_PKT_DATA", ";", "while", "(", "ulSampleCount", "<", "ulMaxSample", ")", "{", "bRetcode", "=", "WaitForUSBSendIdle", "(", "USB_DATA_TIMEOUT_TICKS", ")", ";", "g_eDataInState", "=", "USBDEV_STATE_WAIT_DATA", ";", "if", "(", "!", "bRetcode", ")", "{", "CleanUpOnDisconnect", "(", "true", ")", ";", "return", "(", "false", ")", ";", "}", "sPacket", ".", "ucParam", "=", "ucPacketCount", "++", ";", "if", "(", "pCapInfo", "->", "bDualMode", ")", "{", "sPacket", ".", "ulParam", "=", "min", "(", "DUAL_ELEMENTS_PER_PACKET", ",", "(", "ulMaxSample", "-", "ulSampleCount", ")", ")", ";", "sPacket", ".", "ulDataLength", "=", "(", "sPacket", ".", "ulParam", "*", "sizeof", "(", "tScopeDualDataElement", ")", ")", ";", "}", "else", "{", "sPacket", ".", "ulParam", "=", "min", "(", "SINGLE_ELEMENTS_PER_PACKET", ",", "(", "ulMaxSample", "-", "ulSampleCount", ")", ")", ";", "sPacket", ".", "ulDataLength", "=", "(", "sPacket", ".", "ulParam", "*", "sizeof", "(", "tScopeDataElement", ")", ")", ";", "}", "USBEndpointDataPut", "(", "USB0_BASE", ",", "DATA_IN_ENDPOINT", ",", "(", "unsigned", "char", "*", ")", "&", "sPacket", ",", "sizeof", "(", "tScopePacket", ")", ")", ";", "for", "(", "ulLoop", "=", "0", ";", "ulLoop", "<", "sPacket", ".", "ulParam", ";", "ulLoop", "++", ")", "{", "if", "(", "pCapInfo", "->", "bDualMode", ")", "{", "tScopeDualDataElement", "sData", ";", "sData", ".", "ulTimeuS", "=", "(", "(", "ulSampleCount", "+", "ulLoop", ")", "*", "pCapInfo", "->", "ulSamplePerioduS", ")", ";", "sData", ".", "sSample1mVolts", "=", "ADC_SAMPLE_TO_MV", "(", "pCapInfo", "->", "pusBuffer", "[", "ulSampleIndex", "++", "]", ")", ";", "sData", ".", "sSample2mVolts", "=", "ADC_SAMPLE_TO_MV", "(", "pCapInfo", "->", "pusBuffer", "[", "ulSampleIndex", "++", "]", ")", ";", "if", "(", "ulSampleIndex", ">=", "pCapInfo", "->", "ulMaxSamples", ")", "{", "ulSampleIndex", "-=", "pCapInfo", "->", "ulMaxSamples", ";", "}", "USBEndpointDataPut", "(", "USB0_BASE", ",", "DATA_IN_ENDPOINT", ",", "(", "unsigned", "char", "*", ")", "&", "sData", ",", "sizeof", "(", "tScopeDualDataElement", ")", ")", ";", "}", "else", "{", "tScopeDataElement", "sData", ";", "sData", ".", "ulTimeuS", "=", "(", "(", "ulSampleCount", "+", "ulLoop", ")", "*", "pCapInfo", "->", "ulSamplePerioduS", ")", ";", "sData", ".", "sSamplemVolts", "=", "ADC_SAMPLE_TO_MV", "(", "pCapInfo", "->", "pusBuffer", "[", "ulSampleIndex", "++", "]", ")", ";", "if", "(", "ulSampleIndex", ">=", "pCapInfo", "->", "ulMaxSamples", ")", "{", "ulSampleIndex", "-=", "pCapInfo", "->", "ulMaxSamples", ";", "}", "USBEndpointDataPut", "(", "USB0_BASE", ",", "DATA_IN_ENDPOINT", ",", "(", "unsigned", "char", "*", ")", "&", "sData", ",", "sizeof", "(", "tScopeDataElement", ")", ")", ";", "}", "}", "iRetcode", "=", "USBEndpointDataSend", "(", "USB0_BASE", ",", "DATA_IN_ENDPOINT", ",", "USB_TRANS_IN", ")", ";", "if", "(", "iRetcode", "!=", "0", ")", "{", "CleanUpOnDisconnect", "(", "true", ")", ";", "return", "(", "false", ")", ";", "}", "ulSampleCount", "+=", "sPacket", ".", "ulParam", ";", "}", "sPacket", ".", "ucPacketType", "=", "SCOPE_PKT_DATA_END", ";", "sPacket", ".", "ucParam", "=", "ucPacketCount", ";", "sPacket", ".", "ulParam", "=", "0", ";", "sPacket", ".", "ulDataLength", "=", "0", ";", "bRetcode", "=", "WaitForUSBSendIdle", "(", "USB_DATA_TIMEOUT_TICKS", ")", ";", "if", "(", "bRetcode", ")", "{", "bRetcode", "=", "SendUSBPacket", "(", "&", "sPacket", ",", "0", ",", "0", ")", ";", "}", "if", "(", "!", "bRetcode", ")", "{", "CleanUpOnDisconnect", "(", "true", ")", ";", "return", "(", "false", ")", ";", "}", "else", "{", "g_bBlockSend", "=", "false", ";", "return", "(", "true", ")", ";", "}", "}", "else", "{", "CleanUpOnDisconnect", "(", "true", ")", ";", "}", "}", "return", "(", "false", ")", ";", "}" ]
This function is called by the main loop to transmit captured waveform data to the USB host (if connected).
[ "This", "function", "is", "called", "by", "the", "main", "loop", "to", "transmit", "captured", "waveform", "data", "to", "the", "USB", "host", "(", "if", "connected", ")", "." ]
[ "//\r", "// We only send data if the device is connected to a USB host\r", "// and the host has either requested the data or enabled automatic\r", "// data transmission.\r", "//\r", "//\r", "// Set the flag that signals the interrupt context code not to\r", "// try to send anything immediately.\r", "//\r", "//\r", "// Wait for the data IN endpoint to complete sending\r", "// the packet.\r", "//\r", "//\r", "// If we didn't time out, go ahead and send the data\r", "//\r", "//\r", "// The endpoint is idle so send our data. We first send a\r", "// SCOPE_PKT_DATA_START packet.\r", "//\r", "//\r", "// Map the trigger index in the ring buffer to an element\r", "// index in the data we will be sending back to the USB host.\r", "//\r", "//\r", "// If we can't send the packet for some reason,\r", "// return an error.\r", "//\r", "//\r", "// Now we send the actual data samples in multiple\r", "// SCOPE_PKT_DATA packets.\r", "//\r", "//\r", "// Wait for the data IN endpoint to complete sending\r", "// the previous packet.\r", "//\r", "//\r", "// Immediately mark the endpoint as waiting for data. This is\r", "// intended to reduce the likelihood of an incoming PING or\r", "// HELLO packet from causing our interrupt service routine to\r", "// write to the USB endpoint FIFO while this function is\r", "// running. There is, admittedly, still a tiny timing hole\r", "// here (if a USB interrupt for a PING packet is serviced\r", "// between WaitForUSBSendIdle and the next line, we have a\r", "// problem).\r", "//\r", "//\r", "// Update the header for the new packet.\r", "//\r", "//\r", "// How many samples will we send in this packet?\r", "//\r", "//\r", "// Put the packet header into the transmit FIFO.\r", "//\r", "//\r", "// Now write the sample data for this packet.\r", "//\r", "//\r", "// Are we dealing with single or dual channel data?\r", "//\r", "//\r", "// Dual channel - send two samples per element.\r", "//\r", "//\r", "// Adjust for the wrap at the end of the ring buffer.\r", "// It's fine to do this after writing both samples\r", "// since the sample buffer must be a multiple of two\r", "// samples long - we can't have a wrap between samples.\r", "//\r", "//\r", "// Write the sample to the USB FIFO.\r", "//\r", "//\r", "// Single channel - send one sample per element.\r", "//\r", "//\r", "// Adjust for the wrap at the end of the ring buffer.\r", "//\r", "//\r", "// Write the sample to the USB FIFO.\r", "//\r", "//\r", "// At this point, we've written all the data for a single data\r", "// packet so go ahead and send it.\r", "//\r", "//\r", "// Was the transmission scheduled successfully?\r", "//\r", "//\r", "// No - something went wrong. Handle this as if the host\r", "// disconnected.\r", "//\r", "//\r", "// Update our element counter for the next loop.\r", "//\r", "//\r", "// At this point, all the data packets have been sent. All we need\r", "// to do now is send a terminating SCOPE_PKT_DATA_END.\r", "//\r", "//\r", "// Wait for the data IN endpoint to complete sending\r", "// the previous packet.\r", "//\r", "//\r", "// We couldn't send the packet. Treat this as a host\r", "// disconnection.\r", "//\r", "//\r", "// Clear the flag blocking the ISR from transmitting.\r", "//\r", "//\r", "// We timed out waiting for the data IN endpoint to become free.\r", "// Something horrid happened so disconnect and wait for the host to\r", "// initiate communication.\r", "//\r", "//\r", "// If we get here data transmission was disabled or we are\r", "// not connected to the host.\r", "//\r" ]
[ { "param": "pCapInfo", "type": "tDataAcqCaptureStatus" }, { "param": "bAuto", "type": "tBoolean" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pCapInfo", "type": "tDataAcqCaptureStatus", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bAuto", "type": "tBoolean", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1c4b7edca53198f766055889797215288a5b8506
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/qs-scope/usb_device.c
[ "BSD-3-Clause" ]
C
HandleEndpoints
void
void HandleEndpoints(void *pvInstance, unsigned long ulStatus) { // // Handler for the bulk OUT data endpoint. // if(ulStatus & USB_INTEP_DEV_OUT_2) { // // Data is being sent to us from the host. // ProcessDataFromHost(ulStatus); ulStatus &= ~USB_INTEP_DEV_OUT_2; } // // Handler for the bulk IN data endpoint. // if(ulStatus & USB_INTEP_DEV_IN_1) { ProcessDataToHost(ulStatus); ulStatus &= ~USB_INTEP_DEV_IN_1; } // // Check to see if any other interrupt causes are being signaled. If // there are any we don't support, this is a problem. // if(ulStatus) { UARTprintf("Unhandled EP interrupt 0x%08x!\n", ulStatus); } }
//***************************************************************************** // // Called by the USB stack for any activity involving one of our endpoints // other than EP0. This function is a fan out that merely directs the call to // the correct handler depending upon the endpoint and transaction direction // signaled in ulStatus. // //*****************************************************************************
Called by the USB stack for any activity involving one of our endpoints other than EP0. This function is a fan out that merely directs the call to the correct handler depending upon the endpoint and transaction direction signaled in ulStatus.
[ "Called", "by", "the", "USB", "stack", "for", "any", "activity", "involving", "one", "of", "our", "endpoints", "other", "than", "EP0", ".", "This", "function", "is", "a", "fan", "out", "that", "merely", "directs", "the", "call", "to", "the", "correct", "handler", "depending", "upon", "the", "endpoint", "and", "transaction", "direction", "signaled", "in", "ulStatus", "." ]
void HandleEndpoints(void *pvInstance, unsigned long ulStatus) { if(ulStatus & USB_INTEP_DEV_OUT_2) { ProcessDataFromHost(ulStatus); ulStatus &= ~USB_INTEP_DEV_OUT_2; } if(ulStatus & USB_INTEP_DEV_IN_1) { ProcessDataToHost(ulStatus); ulStatus &= ~USB_INTEP_DEV_IN_1; } if(ulStatus) { UARTprintf("Unhandled EP interrupt 0x%08x!\n", ulStatus); } }
[ "void", "HandleEndpoints", "(", "void", "*", "pvInstance", ",", "unsigned", "long", "ulStatus", ")", "{", "if", "(", "ulStatus", "&", "USB_INTEP_DEV_OUT_2", ")", "{", "ProcessDataFromHost", "(", "ulStatus", ")", ";", "ulStatus", "&=", "~", "USB_INTEP_DEV_OUT_2", ";", "}", "if", "(", "ulStatus", "&", "USB_INTEP_DEV_IN_1", ")", "{", "ProcessDataToHost", "(", "ulStatus", ")", ";", "ulStatus", "&=", "~", "USB_INTEP_DEV_IN_1", ";", "}", "if", "(", "ulStatus", ")", "{", "UARTprintf", "(", "\"", "\\n", "\"", ",", "ulStatus", ")", ";", "}", "}" ]
Called by the USB stack for any activity involving one of our endpoints other than EP0.
[ "Called", "by", "the", "USB", "stack", "for", "any", "activity", "involving", "one", "of", "our", "endpoints", "other", "than", "EP0", "." ]
[ "//\r", "// Handler for the bulk OUT data endpoint.\r", "//\r", "//\r", "// Data is being sent to us from the host.\r", "//\r", "//\r", "// Handler for the bulk IN data endpoint.\r", "//\r", "//\r", "// Check to see if any other interrupt causes are being signaled. If\r", "// there are any we don't support, this is a problem.\r", "//\r" ]
[ { "param": "pvInstance", "type": "void" }, { "param": "ulStatus", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pvInstance", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulStatus", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1c4b7edca53198f766055889797215288a5b8506
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/qs-scope/usb_device.c
[ "BSD-3-Clause" ]
C
HandleConfigChange
void
void HandleConfigChange(void *pvInstance, unsigned long ulInfo) { UARTprintf("USB configuration change 0x%08x\n", ulInfo); // // Save this change in state. // g_ulUSBConfigured = ulInfo; // // // The host setting the configuration indicates to us that we are now // connected so update the device state. // g_eDeviceState = DEVICE_WAITING_FOR_HELLO; }
//***************************************************************************** // // Called by the USB stack whenever a configuration change occurs. // //*****************************************************************************
Called by the USB stack whenever a configuration change occurs.
[ "Called", "by", "the", "USB", "stack", "whenever", "a", "configuration", "change", "occurs", "." ]
void HandleConfigChange(void *pvInstance, unsigned long ulInfo) { UARTprintf("USB configuration change 0x%08x\n", ulInfo); g_ulUSBConfigured = ulInfo; g_eDeviceState = DEVICE_WAITING_FOR_HELLO; }
[ "void", "HandleConfigChange", "(", "void", "*", "pvInstance", ",", "unsigned", "long", "ulInfo", ")", "{", "UARTprintf", "(", "\"", "\\n", "\"", ",", "ulInfo", ")", ";", "g_ulUSBConfigured", "=", "ulInfo", ";", "g_eDeviceState", "=", "DEVICE_WAITING_FOR_HELLO", ";", "}" ]
Called by the USB stack whenever a configuration change occurs.
[ "Called", "by", "the", "USB", "stack", "whenever", "a", "configuration", "change", "occurs", "." ]
[ "//\r", "// Save this change in state.\r", "//\r", "//\r", "//\r", "// The host setting the configuration indicates to us that we are now\r", "// connected so update the device state.\r", "//\r" ]
[ { "param": "pvInstance", "type": "void" }, { "param": "ulInfo", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pvInstance", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulInfo", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1c4b7edca53198f766055889797215288a5b8506
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/qs-scope/usb_device.c
[ "BSD-3-Clause" ]
C
HandleReset
void
void HandleReset(void *pvInstance) { UARTprintf("USB reset - cleaning up.\n"); // // Reset the states of all our endpoints. // CleanUpOnDisconnect(false); }
//***************************************************************************** // // This function is called by the USB device stack whenever a bus reset occurs. // We use this notification to tidy up and get back into an idle state in // preparation for reconnection. // //*****************************************************************************
This function is called by the USB device stack whenever a bus reset occurs. We use this notification to tidy up and get back into an idle state in preparation for reconnection.
[ "This", "function", "is", "called", "by", "the", "USB", "device", "stack", "whenever", "a", "bus", "reset", "occurs", ".", "We", "use", "this", "notification", "to", "tidy", "up", "and", "get", "back", "into", "an", "idle", "state", "in", "preparation", "for", "reconnection", "." ]
void HandleReset(void *pvInstance) { UARTprintf("USB reset - cleaning up.\n"); CleanUpOnDisconnect(false); }
[ "void", "HandleReset", "(", "void", "*", "pvInstance", ")", "{", "UARTprintf", "(", "\"", "\\n", "\"", ")", ";", "CleanUpOnDisconnect", "(", "false", ")", ";", "}" ]
This function is called by the USB device stack whenever a bus reset occurs.
[ "This", "function", "is", "called", "by", "the", "USB", "device", "stack", "whenever", "a", "bus", "reset", "occurs", "." ]
[ "//\r", "// Reset the states of all our endpoints.\r", "//\r" ]
[ { "param": "pvInstance", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pvInstance", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1c4b7edca53198f766055889797215288a5b8506
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/qs-scope/usb_device.c
[ "BSD-3-Clause" ]
C
HandleDisconnect
void
void HandleDisconnect(void *pvInstance) { UARTprintf("USB host disconnected - cleaning up.\n"); // // Reset the states of all our endpoints. // CleanUpOnDisconnect(true); }
//***************************************************************************** // // This function is called by the USB device stack whenever the host // disconnects. We use this notification to tidy up and get back into an // idle state in preparation for reconnection. // //*****************************************************************************
This function is called by the USB device stack whenever the host disconnects. We use this notification to tidy up and get back into an idle state in preparation for reconnection.
[ "This", "function", "is", "called", "by", "the", "USB", "device", "stack", "whenever", "the", "host", "disconnects", ".", "We", "use", "this", "notification", "to", "tidy", "up", "and", "get", "back", "into", "an", "idle", "state", "in", "preparation", "for", "reconnection", "." ]
void HandleDisconnect(void *pvInstance) { UARTprintf("USB host disconnected - cleaning up.\n"); CleanUpOnDisconnect(true); }
[ "void", "HandleDisconnect", "(", "void", "*", "pvInstance", ")", "{", "UARTprintf", "(", "\"", "\\n", "\"", ")", ";", "CleanUpOnDisconnect", "(", "true", ")", ";", "}" ]
This function is called by the USB device stack whenever the host disconnects.
[ "This", "function", "is", "called", "by", "the", "USB", "device", "stack", "whenever", "the", "host", "disconnects", "." ]
[ "//\r", "// Reset the states of all our endpoints.\r", "//\r" ]
[ { "param": "pvInstance", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pvInstance", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5b20e7a0c7be8a23ce8e2961cc1144ec6d94fe9d
junyanl-code/Luminary-Micro-Library
third_party/ptpd-1rc1/src/protocol.c
[ "BSD-3-Clause" ]
C
doState
void
void doState(RunTimeOpts *rtOpts, PtpClock *ptpClock) { UInteger8 state; ptpClock->message_activity = FALSE; switch(ptpClock->port_state) { case PTP_LISTENING: case PTP_PASSIVE: case PTP_SLAVE: case PTP_MASTER: if(ptpClock->record_update) { ptpClock->record_update = FALSE; state = bmc(ptpClock->foreign, rtOpts, ptpClock); if(state != ptpClock->port_state) toState(state, rtOpts, ptpClock); } break; default: break; } switch(ptpClock->port_state) { case PTP_FAULTY: /* imaginary troubleshooting */ DBG("event FAULT_CLEARED\n"); toState(PTP_INITIALIZING, rtOpts, ptpClock); return; case PTP_LISTENING: case PTP_PASSIVE: case PTP_UNCALIBRATED: case PTP_SLAVE: handle(rtOpts, ptpClock); if(timerExpired(SYNC_RECEIPT_TIMER, ptpClock->itimer)) { DBG("event SYNC_RECEIPT_TIMEOUT_EXPIRES\n"); ptpClock->number_foreign_records = 0; ptpClock->foreign_record_i = 0; if(!rtOpts->slaveOnly && ptpClock->clock_stratum != 255) { m1(ptpClock); toState(PTP_MASTER, rtOpts, ptpClock); } else if(ptpClock->port_state != PTP_LISTENING) toState(PTP_LISTENING, rtOpts, ptpClock); } break; case PTP_MASTER: if(timerExpired(SYNC_INTERVAL_TIMER, ptpClock->itimer)) { DBGV("event SYNC_INTERVAL_TIMEOUT_EXPIRES\n"); issueSync(rtOpts, ptpClock); } handle(rtOpts, ptpClock); break; case PTP_DISABLED: handle(rtOpts, ptpClock); break; default: DBG("do unrecognized state\n"); break; } }
/* handle actions and events for 'port_state' */
handle actions and events for 'port_state'
[ "handle", "actions", "and", "events", "for", "'", "port_state", "'" ]
void doState(RunTimeOpts *rtOpts, PtpClock *ptpClock) { UInteger8 state; ptpClock->message_activity = FALSE; switch(ptpClock->port_state) { case PTP_LISTENING: case PTP_PASSIVE: case PTP_SLAVE: case PTP_MASTER: if(ptpClock->record_update) { ptpClock->record_update = FALSE; state = bmc(ptpClock->foreign, rtOpts, ptpClock); if(state != ptpClock->port_state) toState(state, rtOpts, ptpClock); } break; default: break; } switch(ptpClock->port_state) { case PTP_FAULTY: DBG("event FAULT_CLEARED\n"); toState(PTP_INITIALIZING, rtOpts, ptpClock); return; case PTP_LISTENING: case PTP_PASSIVE: case PTP_UNCALIBRATED: case PTP_SLAVE: handle(rtOpts, ptpClock); if(timerExpired(SYNC_RECEIPT_TIMER, ptpClock->itimer)) { DBG("event SYNC_RECEIPT_TIMEOUT_EXPIRES\n"); ptpClock->number_foreign_records = 0; ptpClock->foreign_record_i = 0; if(!rtOpts->slaveOnly && ptpClock->clock_stratum != 255) { m1(ptpClock); toState(PTP_MASTER, rtOpts, ptpClock); } else if(ptpClock->port_state != PTP_LISTENING) toState(PTP_LISTENING, rtOpts, ptpClock); } break; case PTP_MASTER: if(timerExpired(SYNC_INTERVAL_TIMER, ptpClock->itimer)) { DBGV("event SYNC_INTERVAL_TIMEOUT_EXPIRES\n"); issueSync(rtOpts, ptpClock); } handle(rtOpts, ptpClock); break; case PTP_DISABLED: handle(rtOpts, ptpClock); break; default: DBG("do unrecognized state\n"); break; } }
[ "void", "doState", "(", "RunTimeOpts", "*", "rtOpts", ",", "PtpClock", "*", "ptpClock", ")", "{", "UInteger8", "state", ";", "ptpClock", "->", "message_activity", "=", "FALSE", ";", "switch", "(", "ptpClock", "->", "port_state", ")", "{", "case", "PTP_LISTENING", ":", "case", "PTP_PASSIVE", ":", "case", "PTP_SLAVE", ":", "case", "PTP_MASTER", ":", "if", "(", "ptpClock", "->", "record_update", ")", "{", "ptpClock", "->", "record_update", "=", "FALSE", ";", "state", "=", "bmc", "(", "ptpClock", "->", "foreign", ",", "rtOpts", ",", "ptpClock", ")", ";", "if", "(", "state", "!=", "ptpClock", "->", "port_state", ")", "toState", "(", "state", ",", "rtOpts", ",", "ptpClock", ")", ";", "}", "break", ";", "default", ":", "break", ";", "}", "switch", "(", "ptpClock", "->", "port_state", ")", "{", "case", "PTP_FAULTY", ":", "DBG", "(", "\"", "\\n", "\"", ")", ";", "toState", "(", "PTP_INITIALIZING", ",", "rtOpts", ",", "ptpClock", ")", ";", "return", ";", "case", "PTP_LISTENING", ":", "case", "PTP_PASSIVE", ":", "case", "PTP_UNCALIBRATED", ":", "case", "PTP_SLAVE", ":", "handle", "(", "rtOpts", ",", "ptpClock", ")", ";", "if", "(", "timerExpired", "(", "SYNC_RECEIPT_TIMER", ",", "ptpClock", "->", "itimer", ")", ")", "{", "DBG", "(", "\"", "\\n", "\"", ")", ";", "ptpClock", "->", "number_foreign_records", "=", "0", ";", "ptpClock", "->", "foreign_record_i", "=", "0", ";", "if", "(", "!", "rtOpts", "->", "slaveOnly", "&&", "ptpClock", "->", "clock_stratum", "!=", "255", ")", "{", "m1", "(", "ptpClock", ")", ";", "toState", "(", "PTP_MASTER", ",", "rtOpts", ",", "ptpClock", ")", ";", "}", "else", "if", "(", "ptpClock", "->", "port_state", "!=", "PTP_LISTENING", ")", "toState", "(", "PTP_LISTENING", ",", "rtOpts", ",", "ptpClock", ")", ";", "}", "break", ";", "case", "PTP_MASTER", ":", "if", "(", "timerExpired", "(", "SYNC_INTERVAL_TIMER", ",", "ptpClock", "->", "itimer", ")", ")", "{", "DBGV", "(", "\"", "\\n", "\"", ")", ";", "issueSync", "(", "rtOpts", ",", "ptpClock", ")", ";", "}", "handle", "(", "rtOpts", ",", "ptpClock", ")", ";", "break", ";", "case", "PTP_DISABLED", ":", "handle", "(", "rtOpts", ",", "ptpClock", ")", ";", "break", ";", "default", ":", "DBG", "(", "\"", "\\n", "\"", ")", ";", "break", ";", "}", "}" ]
handle actions and events for 'port_state'
[ "handle", "actions", "and", "events", "for", "'", "port_state", "'" ]
[ "/* imaginary troubleshooting */" ]
[ { "param": "rtOpts", "type": "RunTimeOpts" }, { "param": "ptpClock", "type": "PtpClock" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "rtOpts", "type": "RunTimeOpts", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ptpClock", "type": "PtpClock", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5b20e7a0c7be8a23ce8e2961cc1144ec6d94fe9d
junyanl-code/Luminary-Micro-Library
third_party/ptpd-1rc1/src/protocol.c
[ "BSD-3-Clause" ]
C
toState
void
void toState(UInteger8 state, RunTimeOpts *rtOpts, PtpClock *ptpClock) { ptpClock->message_activity = TRUE; /* leaving state tasks */ switch(ptpClock->port_state) { case PTP_MASTER: timerStop(SYNC_INTERVAL_TIMER, ptpClock->itimer); timerStart(SYNC_RECEIPT_TIMER, PTP_SYNC_RECEIPT_TIMEOUT(ptpClock->sync_interval), ptpClock->itimer); break; case PTP_SLAVE: initClock(rtOpts, ptpClock); break; default: break; } /* entering state tasks */ switch(state) { case PTP_INITIALIZING: DBG("state PTP_INITIALIZING\n"); timerStop(SYNC_RECEIPT_TIMER, ptpClock->itimer); ptpClock->port_state = PTP_INITIALIZING; break; case PTP_FAULTY: DBG("state PTP_FAULTY\n"); timerStop(SYNC_RECEIPT_TIMER, ptpClock->itimer); ptpClock->port_state = PTP_FAULTY; break; case PTP_DISABLED: DBG("state change to PTP_DISABLED\n"); timerStop(SYNC_RECEIPT_TIMER, ptpClock->itimer); ptpClock->port_state = PTP_DISABLED; break; case PTP_LISTENING: DBG("state PTP_LISTENING\n"); timerStart(SYNC_RECEIPT_TIMER, PTP_SYNC_RECEIPT_TIMEOUT(ptpClock->sync_interval), ptpClock->itimer); ptpClock->port_state = PTP_LISTENING; break; case PTP_MASTER: DBG("state PTP_MASTER\n"); if(ptpClock->port_state != PTP_PRE_MASTER) timerStart(SYNC_INTERVAL_TIMER, PTP_SYNC_INTERVAL_TIMEOUT(ptpClock->sync_interval), ptpClock->itimer); timerStop(SYNC_RECEIPT_TIMER, ptpClock->itimer); ptpClock->port_state = PTP_MASTER; break; case PTP_PASSIVE: DBG("state PTP_PASSIVE\n"); ptpClock->port_state = PTP_PASSIVE; break; case PTP_UNCALIBRATED: DBG("state PTP_UNCALIBRATED\n"); ptpClock->port_state = PTP_UNCALIBRATED; break; case PTP_SLAVE: DBG("state PTP_PTP_SLAVE\n"); initClock(rtOpts, ptpClock); /* R is chosen to allow a few syncs before we first get a one-way delay estimate */ /* this is to allow the offset filter to fill for an accurate initial clock reset */ ptpClock->Q = 0; ptpClock->R = getRand(&ptpClock->random_seed)%4 + 4; DBG("Q = %d, R = %d\n", ptpClock->Q, ptpClock->R); ptpClock->waitingForFollow = FALSE; ptpClock->delay_req_send_time.seconds = ptpClock->delay_req_receive_time.seconds = 0; ptpClock->delay_req_send_time.nanoseconds = ptpClock->delay_req_receive_time.nanoseconds = 0; timerStart(SYNC_RECEIPT_TIMER, PTP_SYNC_RECEIPT_TIMEOUT(ptpClock->sync_interval), ptpClock->itimer); ptpClock->port_state = PTP_SLAVE; break; default: DBG("to unrecognized state\n"); break; } if(rtOpts->displayStats) displayStats(rtOpts, ptpClock); }
/* perform actions required when leaving 'port_state' and entering 'state' */
perform actions required when leaving 'port_state' and entering 'state'
[ "perform", "actions", "required", "when", "leaving", "'", "port_state", "'", "and", "entering", "'", "state", "'" ]
void toState(UInteger8 state, RunTimeOpts *rtOpts, PtpClock *ptpClock) { ptpClock->message_activity = TRUE; switch(ptpClock->port_state) { case PTP_MASTER: timerStop(SYNC_INTERVAL_TIMER, ptpClock->itimer); timerStart(SYNC_RECEIPT_TIMER, PTP_SYNC_RECEIPT_TIMEOUT(ptpClock->sync_interval), ptpClock->itimer); break; case PTP_SLAVE: initClock(rtOpts, ptpClock); break; default: break; } switch(state) { case PTP_INITIALIZING: DBG("state PTP_INITIALIZING\n"); timerStop(SYNC_RECEIPT_TIMER, ptpClock->itimer); ptpClock->port_state = PTP_INITIALIZING; break; case PTP_FAULTY: DBG("state PTP_FAULTY\n"); timerStop(SYNC_RECEIPT_TIMER, ptpClock->itimer); ptpClock->port_state = PTP_FAULTY; break; case PTP_DISABLED: DBG("state change to PTP_DISABLED\n"); timerStop(SYNC_RECEIPT_TIMER, ptpClock->itimer); ptpClock->port_state = PTP_DISABLED; break; case PTP_LISTENING: DBG("state PTP_LISTENING\n"); timerStart(SYNC_RECEIPT_TIMER, PTP_SYNC_RECEIPT_TIMEOUT(ptpClock->sync_interval), ptpClock->itimer); ptpClock->port_state = PTP_LISTENING; break; case PTP_MASTER: DBG("state PTP_MASTER\n"); if(ptpClock->port_state != PTP_PRE_MASTER) timerStart(SYNC_INTERVAL_TIMER, PTP_SYNC_INTERVAL_TIMEOUT(ptpClock->sync_interval), ptpClock->itimer); timerStop(SYNC_RECEIPT_TIMER, ptpClock->itimer); ptpClock->port_state = PTP_MASTER; break; case PTP_PASSIVE: DBG("state PTP_PASSIVE\n"); ptpClock->port_state = PTP_PASSIVE; break; case PTP_UNCALIBRATED: DBG("state PTP_UNCALIBRATED\n"); ptpClock->port_state = PTP_UNCALIBRATED; break; case PTP_SLAVE: DBG("state PTP_PTP_SLAVE\n"); initClock(rtOpts, ptpClock); ptpClock->Q = 0; ptpClock->R = getRand(&ptpClock->random_seed)%4 + 4; DBG("Q = %d, R = %d\n", ptpClock->Q, ptpClock->R); ptpClock->waitingForFollow = FALSE; ptpClock->delay_req_send_time.seconds = ptpClock->delay_req_receive_time.seconds = 0; ptpClock->delay_req_send_time.nanoseconds = ptpClock->delay_req_receive_time.nanoseconds = 0; timerStart(SYNC_RECEIPT_TIMER, PTP_SYNC_RECEIPT_TIMEOUT(ptpClock->sync_interval), ptpClock->itimer); ptpClock->port_state = PTP_SLAVE; break; default: DBG("to unrecognized state\n"); break; } if(rtOpts->displayStats) displayStats(rtOpts, ptpClock); }
[ "void", "toState", "(", "UInteger8", "state", ",", "RunTimeOpts", "*", "rtOpts", ",", "PtpClock", "*", "ptpClock", ")", "{", "ptpClock", "->", "message_activity", "=", "TRUE", ";", "switch", "(", "ptpClock", "->", "port_state", ")", "{", "case", "PTP_MASTER", ":", "timerStop", "(", "SYNC_INTERVAL_TIMER", ",", "ptpClock", "->", "itimer", ")", ";", "timerStart", "(", "SYNC_RECEIPT_TIMER", ",", "PTP_SYNC_RECEIPT_TIMEOUT", "(", "ptpClock", "->", "sync_interval", ")", ",", "ptpClock", "->", "itimer", ")", ";", "break", ";", "case", "PTP_SLAVE", ":", "initClock", "(", "rtOpts", ",", "ptpClock", ")", ";", "break", ";", "default", ":", "break", ";", "}", "switch", "(", "state", ")", "{", "case", "PTP_INITIALIZING", ":", "DBG", "(", "\"", "\\n", "\"", ")", ";", "timerStop", "(", "SYNC_RECEIPT_TIMER", ",", "ptpClock", "->", "itimer", ")", ";", "ptpClock", "->", "port_state", "=", "PTP_INITIALIZING", ";", "break", ";", "case", "PTP_FAULTY", ":", "DBG", "(", "\"", "\\n", "\"", ")", ";", "timerStop", "(", "SYNC_RECEIPT_TIMER", ",", "ptpClock", "->", "itimer", ")", ";", "ptpClock", "->", "port_state", "=", "PTP_FAULTY", ";", "break", ";", "case", "PTP_DISABLED", ":", "DBG", "(", "\"", "\\n", "\"", ")", ";", "timerStop", "(", "SYNC_RECEIPT_TIMER", ",", "ptpClock", "->", "itimer", ")", ";", "ptpClock", "->", "port_state", "=", "PTP_DISABLED", ";", "break", ";", "case", "PTP_LISTENING", ":", "DBG", "(", "\"", "\\n", "\"", ")", ";", "timerStart", "(", "SYNC_RECEIPT_TIMER", ",", "PTP_SYNC_RECEIPT_TIMEOUT", "(", "ptpClock", "->", "sync_interval", ")", ",", "ptpClock", "->", "itimer", ")", ";", "ptpClock", "->", "port_state", "=", "PTP_LISTENING", ";", "break", ";", "case", "PTP_MASTER", ":", "DBG", "(", "\"", "\\n", "\"", ")", ";", "if", "(", "ptpClock", "->", "port_state", "!=", "PTP_PRE_MASTER", ")", "timerStart", "(", "SYNC_INTERVAL_TIMER", ",", "PTP_SYNC_INTERVAL_TIMEOUT", "(", "ptpClock", "->", "sync_interval", ")", ",", "ptpClock", "->", "itimer", ")", ";", "timerStop", "(", "SYNC_RECEIPT_TIMER", ",", "ptpClock", "->", "itimer", ")", ";", "ptpClock", "->", "port_state", "=", "PTP_MASTER", ";", "break", ";", "case", "PTP_PASSIVE", ":", "DBG", "(", "\"", "\\n", "\"", ")", ";", "ptpClock", "->", "port_state", "=", "PTP_PASSIVE", ";", "break", ";", "case", "PTP_UNCALIBRATED", ":", "DBG", "(", "\"", "\\n", "\"", ")", ";", "ptpClock", "->", "port_state", "=", "PTP_UNCALIBRATED", ";", "break", ";", "case", "PTP_SLAVE", ":", "DBG", "(", "\"", "\\n", "\"", ")", ";", "initClock", "(", "rtOpts", ",", "ptpClock", ")", ";", "ptpClock", "->", "Q", "=", "0", ";", "ptpClock", "->", "R", "=", "getRand", "(", "&", "ptpClock", "->", "random_seed", ")", "%", "4", "+", "4", ";", "DBG", "(", "\"", "\\n", "\"", ",", "ptpClock", "->", "Q", ",", "ptpClock", "->", "R", ")", ";", "ptpClock", "->", "waitingForFollow", "=", "FALSE", ";", "ptpClock", "->", "delay_req_send_time", ".", "seconds", "=", "ptpClock", "->", "delay_req_receive_time", ".", "seconds", "=", "0", ";", "ptpClock", "->", "delay_req_send_time", ".", "nanoseconds", "=", "ptpClock", "->", "delay_req_receive_time", ".", "nanoseconds", "=", "0", ";", "timerStart", "(", "SYNC_RECEIPT_TIMER", ",", "PTP_SYNC_RECEIPT_TIMEOUT", "(", "ptpClock", "->", "sync_interval", ")", ",", "ptpClock", "->", "itimer", ")", ";", "ptpClock", "->", "port_state", "=", "PTP_SLAVE", ";", "break", ";", "default", ":", "DBG", "(", "\"", "\\n", "\"", ")", ";", "break", ";", "}", "if", "(", "rtOpts", "->", "displayStats", ")", "displayStats", "(", "rtOpts", ",", "ptpClock", ")", ";", "}" ]
perform actions required when leaving 'port_state' and entering 'state'
[ "perform", "actions", "required", "when", "leaving", "'", "port_state", "'", "and", "entering", "'", "state", "'" ]
[ "/* leaving state tasks */", "/* entering state tasks */", "/* R is chosen to allow a few syncs before we first get a one-way delay estimate */", "/* this is to allow the offset filter to fill for an accurate initial clock reset */" ]
[ { "param": "state", "type": "UInteger8" }, { "param": "rtOpts", "type": "RunTimeOpts" }, { "param": "ptpClock", "type": "PtpClock" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "state", "type": "UInteger8", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rtOpts", "type": "RunTimeOpts", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ptpClock", "type": "PtpClock", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5b20e7a0c7be8a23ce8e2961cc1144ec6d94fe9d
junyanl-code/Luminary-Micro-Library
third_party/ptpd-1rc1/src/protocol.c
[ "BSD-3-Clause" ]
C
addForeign
MsgSync
MsgSync * addForeign(Octet *buf, MsgHeader *header, PtpClock *ptpClock) { int i, j; Boolean found = FALSE; DBGV("updateForeign\n"); j = ptpClock->foreign_record_best; for(i = 0; i < ptpClock->number_foreign_records; ++i) { if(header->sourceCommunicationTechnology == ptpClock->foreign[j].foreign_master_communication_technology && header->sourcePortId == ptpClock->foreign[j].foreign_master_port_id && !memcmp(header->sourceUuid, ptpClock->foreign[j].foreign_master_uuid, PTP_UUID_LENGTH)) { ++ptpClock->foreign[j].foreign_master_syncs; found = TRUE; DBGV("updateForeign: update record %d\n", j); break; } j = (j + 1)%ptpClock->number_foreign_records; } if(!found) { if(ptpClock->number_foreign_records < ptpClock->max_foreign_records) ++ptpClock->number_foreign_records; j = ptpClock->foreign_record_i; ptpClock->foreign[j].foreign_master_communication_technology = header->sourceCommunicationTechnology; ptpClock->foreign[j].foreign_master_port_id = header->sourcePortId; memcpy(ptpClock->foreign[j].foreign_master_uuid, header->sourceUuid, PTP_UUID_LENGTH); DBG("updateForeign: new record (%d,%d) %d %d %02x:%02x:%02x:%02x:%02x:%02x\n", ptpClock->foreign_record_i, ptpClock->number_foreign_records, ptpClock->foreign[j].foreign_master_communication_technology, ptpClock->foreign[j].foreign_master_port_id, ptpClock->foreign[j].foreign_master_uuid[0], ptpClock->foreign[j].foreign_master_uuid[1], ptpClock->foreign[j].foreign_master_uuid[2], ptpClock->foreign[j].foreign_master_uuid[3], ptpClock->foreign[j].foreign_master_uuid[4], ptpClock->foreign[j].foreign_master_uuid[5]); ptpClock->foreign_record_i = (ptpClock->foreign_record_i + 1)%ptpClock->max_foreign_records; } msgUnpackHeader(buf, &ptpClock->foreign[j].header); msgUnpackSync(buf, &ptpClock->foreign[j].sync); return &ptpClock->foreign[j].sync; }
/* add or update an entry in the foreign master data set */
add or update an entry in the foreign master data set
[ "add", "or", "update", "an", "entry", "in", "the", "foreign", "master", "data", "set" ]
MsgSync * addForeign(Octet *buf, MsgHeader *header, PtpClock *ptpClock) { int i, j; Boolean found = FALSE; DBGV("updateForeign\n"); j = ptpClock->foreign_record_best; for(i = 0; i < ptpClock->number_foreign_records; ++i) { if(header->sourceCommunicationTechnology == ptpClock->foreign[j].foreign_master_communication_technology && header->sourcePortId == ptpClock->foreign[j].foreign_master_port_id && !memcmp(header->sourceUuid, ptpClock->foreign[j].foreign_master_uuid, PTP_UUID_LENGTH)) { ++ptpClock->foreign[j].foreign_master_syncs; found = TRUE; DBGV("updateForeign: update record %d\n", j); break; } j = (j + 1)%ptpClock->number_foreign_records; } if(!found) { if(ptpClock->number_foreign_records < ptpClock->max_foreign_records) ++ptpClock->number_foreign_records; j = ptpClock->foreign_record_i; ptpClock->foreign[j].foreign_master_communication_technology = header->sourceCommunicationTechnology; ptpClock->foreign[j].foreign_master_port_id = header->sourcePortId; memcpy(ptpClock->foreign[j].foreign_master_uuid, header->sourceUuid, PTP_UUID_LENGTH); DBG("updateForeign: new record (%d,%d) %d %d %02x:%02x:%02x:%02x:%02x:%02x\n", ptpClock->foreign_record_i, ptpClock->number_foreign_records, ptpClock->foreign[j].foreign_master_communication_technology, ptpClock->foreign[j].foreign_master_port_id, ptpClock->foreign[j].foreign_master_uuid[0], ptpClock->foreign[j].foreign_master_uuid[1], ptpClock->foreign[j].foreign_master_uuid[2], ptpClock->foreign[j].foreign_master_uuid[3], ptpClock->foreign[j].foreign_master_uuid[4], ptpClock->foreign[j].foreign_master_uuid[5]); ptpClock->foreign_record_i = (ptpClock->foreign_record_i + 1)%ptpClock->max_foreign_records; } msgUnpackHeader(buf, &ptpClock->foreign[j].header); msgUnpackSync(buf, &ptpClock->foreign[j].sync); return &ptpClock->foreign[j].sync; }
[ "MsgSync", "*", "addForeign", "(", "Octet", "*", "buf", ",", "MsgHeader", "*", "header", ",", "PtpClock", "*", "ptpClock", ")", "{", "int", "i", ",", "j", ";", "Boolean", "found", "=", "FALSE", ";", "DBGV", "(", "\"", "\\n", "\"", ")", ";", "j", "=", "ptpClock", "->", "foreign_record_best", ";", "for", "(", "i", "=", "0", ";", "i", "<", "ptpClock", "->", "number_foreign_records", ";", "++", "i", ")", "{", "if", "(", "header", "->", "sourceCommunicationTechnology", "==", "ptpClock", "->", "foreign", "[", "j", "]", ".", "foreign_master_communication_technology", "&&", "header", "->", "sourcePortId", "==", "ptpClock", "->", "foreign", "[", "j", "]", ".", "foreign_master_port_id", "&&", "!", "memcmp", "(", "header", "->", "sourceUuid", ",", "ptpClock", "->", "foreign", "[", "j", "]", ".", "foreign_master_uuid", ",", "PTP_UUID_LENGTH", ")", ")", "{", "++", "ptpClock", "->", "foreign", "[", "j", "]", ".", "foreign_master_syncs", ";", "found", "=", "TRUE", ";", "DBGV", "(", "\"", "\\n", "\"", ",", "j", ")", ";", "break", ";", "}", "j", "=", "(", "j", "+", "1", ")", "%", "ptpClock", "->", "number_foreign_records", ";", "}", "if", "(", "!", "found", ")", "{", "if", "(", "ptpClock", "->", "number_foreign_records", "<", "ptpClock", "->", "max_foreign_records", ")", "++", "ptpClock", "->", "number_foreign_records", ";", "j", "=", "ptpClock", "->", "foreign_record_i", ";", "ptpClock", "->", "foreign", "[", "j", "]", ".", "foreign_master_communication_technology", "=", "header", "->", "sourceCommunicationTechnology", ";", "ptpClock", "->", "foreign", "[", "j", "]", ".", "foreign_master_port_id", "=", "header", "->", "sourcePortId", ";", "memcpy", "(", "ptpClock", "->", "foreign", "[", "j", "]", ".", "foreign_master_uuid", ",", "header", "->", "sourceUuid", ",", "PTP_UUID_LENGTH", ")", ";", "DBG", "(", "\"", "\\n", "\"", ",", "ptpClock", "->", "foreign_record_i", ",", "ptpClock", "->", "number_foreign_records", ",", "ptpClock", "->", "foreign", "[", "j", "]", ".", "foreign_master_communication_technology", ",", "ptpClock", "->", "foreign", "[", "j", "]", ".", "foreign_master_port_id", ",", "ptpClock", "->", "foreign", "[", "j", "]", ".", "foreign_master_uuid", "[", "0", "]", ",", "ptpClock", "->", "foreign", "[", "j", "]", ".", "foreign_master_uuid", "[", "1", "]", ",", "ptpClock", "->", "foreign", "[", "j", "]", ".", "foreign_master_uuid", "[", "2", "]", ",", "ptpClock", "->", "foreign", "[", "j", "]", ".", "foreign_master_uuid", "[", "3", "]", ",", "ptpClock", "->", "foreign", "[", "j", "]", ".", "foreign_master_uuid", "[", "4", "]", ",", "ptpClock", "->", "foreign", "[", "j", "]", ".", "foreign_master_uuid", "[", "5", "]", ")", ";", "ptpClock", "->", "foreign_record_i", "=", "(", "ptpClock", "->", "foreign_record_i", "+", "1", ")", "%", "ptpClock", "->", "max_foreign_records", ";", "}", "msgUnpackHeader", "(", "buf", ",", "&", "ptpClock", "->", "foreign", "[", "j", "]", ".", "header", ")", ";", "msgUnpackSync", "(", "buf", ",", "&", "ptpClock", "->", "foreign", "[", "j", "]", ".", "sync", ")", ";", "return", "&", "ptpClock", "->", "foreign", "[", "j", "]", ".", "sync", ";", "}" ]
add or update an entry in the foreign master data set
[ "add", "or", "update", "an", "entry", "in", "the", "foreign", "master", "data", "set" ]
[]
[ { "param": "buf", "type": "Octet" }, { "param": "header", "type": "MsgHeader" }, { "param": "ptpClock", "type": "PtpClock" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "buf", "type": "Octet", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "header", "type": "MsgHeader", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ptpClock", "type": "PtpClock", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
745a00e900c0fe63338e834a1600097ef4488a9b
junyanl-code/Luminary-Micro-Library
boards/rdk-bdc/bdc-ui/current.c
[ "BSD-3-Clause" ]
C
CurrentConfigRead
void
void CurrentConfigRead(void) { // // Read the PID controller's P coefficient. // if(CANReadParameter(LM_API_ICTRL_PC, 0, (unsigned long *)&(g_sCurrentConfig.lP), 0) == 0) { g_sCurrentConfig.lP = 0; } else if(g_sCurrentConfig.lP < 0) { g_sCurrentConfig.lP = (((g_sCurrentConfig.lP / 65536) * 1000) + ((((g_sCurrentConfig.lP % 65536) * 1000) - 32768) / 65536)); } else { g_sCurrentConfig.lP = (((g_sCurrentConfig.lP / 65536) * 1000) + ((((g_sCurrentConfig.lP % 65536) * 1000) + 32768) / 65536)); } // // Read the PID controller's I coefficient. // if(CANReadParameter(LM_API_ICTRL_IC, 0, (unsigned long *)&(g_sCurrentConfig.lI), 0) == 0) { g_sCurrentConfig.lI = 0; } else if(g_sCurrentConfig.lI < 0) { g_sCurrentConfig.lI = (((g_sCurrentConfig.lI / 65536) * 1000) + ((((g_sCurrentConfig.lI % 65536) * 1000) - 32768) / 65536)); } else { g_sCurrentConfig.lI = (((g_sCurrentConfig.lI / 65536) * 1000) + ((((g_sCurrentConfig.lI % 65536) * 1000) + 32768) / 65536)); } // // Read the PID controller's D coefficient. // if(CANReadParameter(LM_API_ICTRL_DC, 0, (unsigned long *)&(g_sCurrentConfig.lD), 0) == 0) { g_sCurrentConfig.lD = 0; } else if(g_sCurrentConfig.lD < 0) { g_sCurrentConfig.lD = (((g_sCurrentConfig.lD / 65536) * 1000) + ((((g_sCurrentConfig.lD % 65536) * 1000) - 32768) / 65536)); } else { g_sCurrentConfig.lD = (((g_sCurrentConfig.lD / 65536) * 1000) + ((((g_sCurrentConfig.lD % 65536) * 1000) + 32768) / 65536)); } }
//***************************************************************************** // // Reads the configuration of the current control mode of the current motor // controller. // //*****************************************************************************
Reads the configuration of the current control mode of the current motor controller.
[ "Reads", "the", "configuration", "of", "the", "current", "control", "mode", "of", "the", "current", "motor", "controller", "." ]
void CurrentConfigRead(void) { if(CANReadParameter(LM_API_ICTRL_PC, 0, (unsigned long *)&(g_sCurrentConfig.lP), 0) == 0) { g_sCurrentConfig.lP = 0; } else if(g_sCurrentConfig.lP < 0) { g_sCurrentConfig.lP = (((g_sCurrentConfig.lP / 65536) * 1000) + ((((g_sCurrentConfig.lP % 65536) * 1000) - 32768) / 65536)); } else { g_sCurrentConfig.lP = (((g_sCurrentConfig.lP / 65536) * 1000) + ((((g_sCurrentConfig.lP % 65536) * 1000) + 32768) / 65536)); } if(CANReadParameter(LM_API_ICTRL_IC, 0, (unsigned long *)&(g_sCurrentConfig.lI), 0) == 0) { g_sCurrentConfig.lI = 0; } else if(g_sCurrentConfig.lI < 0) { g_sCurrentConfig.lI = (((g_sCurrentConfig.lI / 65536) * 1000) + ((((g_sCurrentConfig.lI % 65536) * 1000) - 32768) / 65536)); } else { g_sCurrentConfig.lI = (((g_sCurrentConfig.lI / 65536) * 1000) + ((((g_sCurrentConfig.lI % 65536) * 1000) + 32768) / 65536)); } if(CANReadParameter(LM_API_ICTRL_DC, 0, (unsigned long *)&(g_sCurrentConfig.lD), 0) == 0) { g_sCurrentConfig.lD = 0; } else if(g_sCurrentConfig.lD < 0) { g_sCurrentConfig.lD = (((g_sCurrentConfig.lD / 65536) * 1000) + ((((g_sCurrentConfig.lD % 65536) * 1000) - 32768) / 65536)); } else { g_sCurrentConfig.lD = (((g_sCurrentConfig.lD / 65536) * 1000) + ((((g_sCurrentConfig.lD % 65536) * 1000) + 32768) / 65536)); } }
[ "void", "CurrentConfigRead", "(", "void", ")", "{", "if", "(", "CANReadParameter", "(", "LM_API_ICTRL_PC", ",", "0", ",", "(", "unsigned", "long", "*", ")", "&", "(", "g_sCurrentConfig", ".", "lP", ")", ",", "0", ")", "==", "0", ")", "{", "g_sCurrentConfig", ".", "lP", "=", "0", ";", "}", "else", "if", "(", "g_sCurrentConfig", ".", "lP", "<", "0", ")", "{", "g_sCurrentConfig", ".", "lP", "=", "(", "(", "(", "g_sCurrentConfig", ".", "lP", "/", "65536", ")", "*", "1000", ")", "+", "(", "(", "(", "(", "g_sCurrentConfig", ".", "lP", "%", "65536", ")", "*", "1000", ")", "-", "32768", ")", "/", "65536", ")", ")", ";", "}", "else", "{", "g_sCurrentConfig", ".", "lP", "=", "(", "(", "(", "g_sCurrentConfig", ".", "lP", "/", "65536", ")", "*", "1000", ")", "+", "(", "(", "(", "(", "g_sCurrentConfig", ".", "lP", "%", "65536", ")", "*", "1000", ")", "+", "32768", ")", "/", "65536", ")", ")", ";", "}", "if", "(", "CANReadParameter", "(", "LM_API_ICTRL_IC", ",", "0", ",", "(", "unsigned", "long", "*", ")", "&", "(", "g_sCurrentConfig", ".", "lI", ")", ",", "0", ")", "==", "0", ")", "{", "g_sCurrentConfig", ".", "lI", "=", "0", ";", "}", "else", "if", "(", "g_sCurrentConfig", ".", "lI", "<", "0", ")", "{", "g_sCurrentConfig", ".", "lI", "=", "(", "(", "(", "g_sCurrentConfig", ".", "lI", "/", "65536", ")", "*", "1000", ")", "+", "(", "(", "(", "(", "g_sCurrentConfig", ".", "lI", "%", "65536", ")", "*", "1000", ")", "-", "32768", ")", "/", "65536", ")", ")", ";", "}", "else", "{", "g_sCurrentConfig", ".", "lI", "=", "(", "(", "(", "g_sCurrentConfig", ".", "lI", "/", "65536", ")", "*", "1000", ")", "+", "(", "(", "(", "(", "g_sCurrentConfig", ".", "lI", "%", "65536", ")", "*", "1000", ")", "+", "32768", ")", "/", "65536", ")", ")", ";", "}", "if", "(", "CANReadParameter", "(", "LM_API_ICTRL_DC", ",", "0", ",", "(", "unsigned", "long", "*", ")", "&", "(", "g_sCurrentConfig", ".", "lD", ")", ",", "0", ")", "==", "0", ")", "{", "g_sCurrentConfig", ".", "lD", "=", "0", ";", "}", "else", "if", "(", "g_sCurrentConfig", ".", "lD", "<", "0", ")", "{", "g_sCurrentConfig", ".", "lD", "=", "(", "(", "(", "g_sCurrentConfig", ".", "lD", "/", "65536", ")", "*", "1000", ")", "+", "(", "(", "(", "(", "g_sCurrentConfig", ".", "lD", "%", "65536", ")", "*", "1000", ")", "-", "32768", ")", "/", "65536", ")", ")", ";", "}", "else", "{", "g_sCurrentConfig", ".", "lD", "=", "(", "(", "(", "g_sCurrentConfig", ".", "lD", "/", "65536", ")", "*", "1000", ")", "+", "(", "(", "(", "(", "g_sCurrentConfig", ".", "lD", "%", "65536", ")", "*", "1000", ")", "+", "32768", ")", "/", "65536", ")", ")", ";", "}", "}" ]
Reads the configuration of the current control mode of the current motor controller.
[ "Reads", "the", "configuration", "of", "the", "current", "control", "mode", "of", "the", "current", "motor", "controller", "." ]
[ "//\r", "// Read the PID controller's P coefficient.\r", "//\r", "//\r", "// Read the PID controller's I coefficient.\r", "//\r", "//\r", "// Read the PID controller's D coefficient.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlPeripheralMapToNew
null
static unsigned long SysCtlPeripheralMapToNew(unsigned long ulPeripheral) { unsigned long ulIndex; // // Loop through the table of old-style identifiers. // for(ulIndex = 0; ulIndex < (sizeof(g_ppulPeripheralMap) / sizeof(g_ppulPeripheralMap[0])); ulIndex++) { // // See if this peripheral matches the old-style identifier. // if(g_ppulPeripheralMap[ulIndex][0] == ulPeripheral) { // // Return the new-style identifier that corresponds to this // peripheral. // return(g_ppulPeripheralMap[ulIndex][1]); } } // // No old-style identifier was found, so return the identifier unchanged // (on the assumption that it is already a new-style identifier). // return(ulPeripheral); }
//***************************************************************************** // // Maps a SYSCTL_PERIPH_foo identifier into its new-style SYSCTL_PERIPH2_foo // identifier. // //*****************************************************************************
Maps a SYSCTL_PERIPH_foo identifier into its new-style SYSCTL_PERIPH2_foo identifier.
[ "Maps", "a", "SYSCTL_PERIPH_foo", "identifier", "into", "its", "new", "-", "style", "SYSCTL_PERIPH2_foo", "identifier", "." ]
static unsigned long SysCtlPeripheralMapToNew(unsigned long ulPeripheral) { unsigned long ulIndex; for(ulIndex = 0; ulIndex < (sizeof(g_ppulPeripheralMap) / sizeof(g_ppulPeripheralMap[0])); ulIndex++) { if(g_ppulPeripheralMap[ulIndex][0] == ulPeripheral) { return(g_ppulPeripheralMap[ulIndex][1]); } } return(ulPeripheral); }
[ "static", "unsigned", "long", "SysCtlPeripheralMapToNew", "(", "unsigned", "long", "ulPeripheral", ")", "{", "unsigned", "long", "ulIndex", ";", "for", "(", "ulIndex", "=", "0", ";", "ulIndex", "<", "(", "sizeof", "(", "g_ppulPeripheralMap", ")", "/", "sizeof", "(", "g_ppulPeripheralMap", "[", "0", "]", ")", ")", ";", "ulIndex", "++", ")", "{", "if", "(", "g_ppulPeripheralMap", "[", "ulIndex", "]", "[", "0", "]", "==", "ulPeripheral", ")", "{", "return", "(", "g_ppulPeripheralMap", "[", "ulIndex", "]", "[", "1", "]", ")", ";", "}", "}", "return", "(", "ulPeripheral", ")", ";", "}" ]
Maps a SYSCTL_PERIPH_foo identifier into its new-style SYSCTL_PERIPH2_foo identifier.
[ "Maps", "a", "SYSCTL_PERIPH_foo", "identifier", "into", "its", "new", "-", "style", "SYSCTL_PERIPH2_foo", "identifier", "." ]
[ "//\r", "// Loop through the table of old-style identifiers.\r", "//\r", "//\r", "// See if this peripheral matches the old-style identifier.\r", "//\r", "//\r", "// Return the new-style identifier that corresponds to this\r", "// peripheral.\r", "//\r", "//\r", "// No old-style identifier was found, so return the identifier unchanged\r", "// (on the assumption that it is already a new-style identifier).\r", "//\r" ]
[ { "param": "ulPeripheral", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulPeripheral", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlSRAMSizeGet
null
unsigned long SysCtlSRAMSizeGet(void) { // // Compute the size of the SRAM. // return(((HWREG(SYSCTL_DC0) & SYSCTL_DC0_SRAMSZ_M) >> 8) + 0x100); }
//***************************************************************************** // //! Gets the size of the SRAM. //! //! This function determines the size of the SRAM on the Stellaris device. //! //! \return The total number of bytes of SRAM. // //*****************************************************************************
Gets the size of the SRAM. This function determines the size of the SRAM on the Stellaris device. \return The total number of bytes of SRAM.
[ "Gets", "the", "size", "of", "the", "SRAM", ".", "This", "function", "determines", "the", "size", "of", "the", "SRAM", "on", "the", "Stellaris", "device", ".", "\\", "return", "The", "total", "number", "of", "bytes", "of", "SRAM", "." ]
unsigned long SysCtlSRAMSizeGet(void) { return(((HWREG(SYSCTL_DC0) & SYSCTL_DC0_SRAMSZ_M) >> 8) + 0x100); }
[ "unsigned", "long", "SysCtlSRAMSizeGet", "(", "void", ")", "{", "return", "(", "(", "(", "HWREG", "(", "SYSCTL_DC0", ")", "&", "SYSCTL_DC0_SRAMSZ_M", ")", ">>", "8", ")", "+", "0x100", ")", ";", "}" ]
Gets the size of the SRAM.
[ "Gets", "the", "size", "of", "the", "SRAM", "." ]
[ "//\r", "// Compute the size of the SRAM.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlFlashSizeGet
null
unsigned long SysCtlFlashSizeGet(void) { // // Compute the size of the flash. // return(((HWREG(SYSCTL_DC0) & SYSCTL_DC0_FLASHSZ_M) << 11) + 0x800); }
//***************************************************************************** // //! Gets the size of the flash. //! //! This function determines the size of the flash on the Stellaris device. //! //! \return The total number of bytes of flash. // //*****************************************************************************
Gets the size of the flash. This function determines the size of the flash on the Stellaris device. \return The total number of bytes of flash.
[ "Gets", "the", "size", "of", "the", "flash", ".", "This", "function", "determines", "the", "size", "of", "the", "flash", "on", "the", "Stellaris", "device", ".", "\\", "return", "The", "total", "number", "of", "bytes", "of", "flash", "." ]
unsigned long SysCtlFlashSizeGet(void) { return(((HWREG(SYSCTL_DC0) & SYSCTL_DC0_FLASHSZ_M) << 11) + 0x800); }
[ "unsigned", "long", "SysCtlFlashSizeGet", "(", "void", ")", "{", "return", "(", "(", "(", "HWREG", "(", "SYSCTL_DC0", ")", "&", "SYSCTL_DC0_FLASHSZ_M", ")", "<<", "11", ")", "+", "0x800", ")", ";", "}" ]
Gets the size of the flash.
[ "Gets", "the", "size", "of", "the", "flash", "." ]
[ "//\r", "// Compute the size of the flash.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlPinPresent
tBoolean
tBoolean SysCtlPinPresent(unsigned long ulPin) { // // Check the arguments. // ASSERT((ulPin == SYSCTL_PIN_PWM0) || (ulPin == SYSCTL_PIN_PWM1) || (ulPin == SYSCTL_PIN_PWM2) || (ulPin == SYSCTL_PIN_PWM3) || (ulPin == SYSCTL_PIN_PWM4) || (ulPin == SYSCTL_PIN_PWM5) || (ulPin == SYSCTL_PIN_C0MINUS) || (ulPin == SYSCTL_PIN_C0PLUS) || (ulPin == SYSCTL_PIN_C0O) || (ulPin == SYSCTL_PIN_C1MINUS) || (ulPin == SYSCTL_PIN_C1PLUS) || (ulPin == SYSCTL_PIN_C1O) || (ulPin == SYSCTL_PIN_C2MINUS) || (ulPin == SYSCTL_PIN_C2PLUS) || (ulPin == SYSCTL_PIN_C2O) || (ulPin == SYSCTL_PIN_MC_FAULT0) || (ulPin == SYSCTL_PIN_ADC0) || (ulPin == SYSCTL_PIN_ADC1) || (ulPin == SYSCTL_PIN_ADC2) || (ulPin == SYSCTL_PIN_ADC3) || (ulPin == SYSCTL_PIN_ADC4) || (ulPin == SYSCTL_PIN_ADC5) || (ulPin == SYSCTL_PIN_ADC6) || (ulPin == SYSCTL_PIN_ADC7) || (ulPin == SYSCTL_PIN_CCP0) || (ulPin == SYSCTL_PIN_CCP1) || (ulPin == SYSCTL_PIN_CCP2) || (ulPin == SYSCTL_PIN_CCP3) || (ulPin == SYSCTL_PIN_CCP4) || (ulPin == SYSCTL_PIN_CCP5) || (ulPin == SYSCTL_PIN_32KHZ)); // // Determine if this pin is present. // if(HWREG(SYSCTL_DC3) & ulPin) { return(true); } else { return(false); } }
//***************************************************************************** // //! Determines if a pin is present. //! //! \param ulPin is the pin in question. //! //! This function determines if a particular pin is present in the device. The //! PWM, analog comparators, ADC, and timers have a varying number of pins //! across members of the Stellaris family; this function determines which pins //! are present on this device. //! //! The \e ulPin argument must be only one of the following values: //! \b SYSCTL_PIN_PWM0, \b SYSCTL_PIN_PWM1, \b SYSCTL_PIN_PWM2, //! \b SYSCTL_PIN_PWM3, \b SYSCTL_PIN_PWM4, \b SYSCTL_PIN_PWM5, //! \b SYSCTL_PIN_C0MINUS, \b SYSCTL_PIN_C0PLUS, \b SYSCTL_PIN_C0O, //! \b SYSCTL_PIN_C1MINUS, \b SYSCTL_PIN_C1PLUS, \b SYSCTL_PIN_C1O, //! \b SYSCTL_PIN_C2MINUS, \b SYSCTL_PIN_C2PLUS, \b SYSCTL_PIN_C2O, //! \b SYSCTL_PIN_ADC0, \b SYSCTL_PIN_ADC1, \b SYSCTL_PIN_ADC2, //! \b SYSCTL_PIN_ADC3, \b SYSCTL_PIN_ADC4, \b SYSCTL_PIN_ADC5, //! \b SYSCTL_PIN_ADC6, \b SYSCTL_PIN_ADC7, \b SYSCTL_PIN_CCP0, //! \b SYSCTL_PIN_CCP1, \b SYSCTL_PIN_CCP2, \b SYSCTL_PIN_CCP3, //! \b SYSCTL_PIN_CCP4, \b SYSCTL_PIN_CCP5, \b SYSCTL_PIN_CCP6, //! \b SYSCTL_PIN_CCP7, \b SYSCTL_PIN_32KHZ, or \b SYSCTL_PIN_MC_FAULT0. //! //! \return Returns \b true if the specified pin is present and \b false if it //! is not. // //*****************************************************************************
Determines if a pin is present. \param ulPin is the pin in question. This function determines if a particular pin is present in the device. The PWM, analog comparators, ADC, and timers have a varying number of pins across members of the Stellaris family; this function determines which pins are present on this device. \return Returns \b true if the specified pin is present and \b false if it is not.
[ "Determines", "if", "a", "pin", "is", "present", ".", "\\", "param", "ulPin", "is", "the", "pin", "in", "question", ".", "This", "function", "determines", "if", "a", "particular", "pin", "is", "present", "in", "the", "device", ".", "The", "PWM", "analog", "comparators", "ADC", "and", "timers", "have", "a", "varying", "number", "of", "pins", "across", "members", "of", "the", "Stellaris", "family", ";", "this", "function", "determines", "which", "pins", "are", "present", "on", "this", "device", ".", "\\", "return", "Returns", "\\", "b", "true", "if", "the", "specified", "pin", "is", "present", "and", "\\", "b", "false", "if", "it", "is", "not", "." ]
tBoolean SysCtlPinPresent(unsigned long ulPin) { ASSERT((ulPin == SYSCTL_PIN_PWM0) || (ulPin == SYSCTL_PIN_PWM1) || (ulPin == SYSCTL_PIN_PWM2) || (ulPin == SYSCTL_PIN_PWM3) || (ulPin == SYSCTL_PIN_PWM4) || (ulPin == SYSCTL_PIN_PWM5) || (ulPin == SYSCTL_PIN_C0MINUS) || (ulPin == SYSCTL_PIN_C0PLUS) || (ulPin == SYSCTL_PIN_C0O) || (ulPin == SYSCTL_PIN_C1MINUS) || (ulPin == SYSCTL_PIN_C1PLUS) || (ulPin == SYSCTL_PIN_C1O) || (ulPin == SYSCTL_PIN_C2MINUS) || (ulPin == SYSCTL_PIN_C2PLUS) || (ulPin == SYSCTL_PIN_C2O) || (ulPin == SYSCTL_PIN_MC_FAULT0) || (ulPin == SYSCTL_PIN_ADC0) || (ulPin == SYSCTL_PIN_ADC1) || (ulPin == SYSCTL_PIN_ADC2) || (ulPin == SYSCTL_PIN_ADC3) || (ulPin == SYSCTL_PIN_ADC4) || (ulPin == SYSCTL_PIN_ADC5) || (ulPin == SYSCTL_PIN_ADC6) || (ulPin == SYSCTL_PIN_ADC7) || (ulPin == SYSCTL_PIN_CCP0) || (ulPin == SYSCTL_PIN_CCP1) || (ulPin == SYSCTL_PIN_CCP2) || (ulPin == SYSCTL_PIN_CCP3) || (ulPin == SYSCTL_PIN_CCP4) || (ulPin == SYSCTL_PIN_CCP5) || (ulPin == SYSCTL_PIN_32KHZ)); if(HWREG(SYSCTL_DC3) & ulPin) { return(true); } else { return(false); } }
[ "tBoolean", "SysCtlPinPresent", "(", "unsigned", "long", "ulPin", ")", "{", "ASSERT", "(", "(", "ulPin", "==", "SYSCTL_PIN_PWM0", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_PWM1", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_PWM2", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_PWM3", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_PWM4", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_PWM5", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_C0MINUS", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_C0PLUS", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_C0O", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_C1MINUS", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_C1PLUS", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_C1O", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_C2MINUS", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_C2PLUS", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_C2O", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_MC_FAULT0", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_ADC0", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_ADC1", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_ADC2", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_ADC3", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_ADC4", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_ADC5", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_ADC6", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_ADC7", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_CCP0", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_CCP1", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_CCP2", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_CCP3", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_CCP4", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_CCP5", ")", "||", "(", "ulPin", "==", "SYSCTL_PIN_32KHZ", ")", ")", ";", "if", "(", "HWREG", "(", "SYSCTL_DC3", ")", "&", "ulPin", ")", "{", "return", "(", "true", ")", ";", "}", "else", "{", "return", "(", "false", ")", ";", "}", "}" ]
Determines if a pin is present.
[ "Determines", "if", "a", "pin", "is", "present", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Determine if this pin is present.\r", "//\r" ]
[ { "param": "ulPin", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulPin", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlPeripheralPresent
tBoolean
tBoolean SysCtlPeripheralPresent(unsigned long ulPeripheral) { // // Check the arguments. // ASSERT(SysCtlPeripheralValid(ulPeripheral)); // // See if the peripheral index is 15, indicating a peripheral that is // accessed via the SYSCTL_PPperiph registers. // if((ulPeripheral & 0xf0000000) == 0xf0000000) { // // See if this peripheral is present. // return(HWREGBITW(SYSCTL_PPBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff)); } else if(ulPeripheral == SYSCTL_PERIPH_USB0) { // // USB is a special case because the DC bit is missing for USB0. // if(HWREG(SYSCTL_DC6) & SYSCTL_DC6_USB0_M) { return(true); } else { return(false); } } else if(HWREG(g_pulDCRegs[SYSCTL_PERIPH_INDEX(ulPeripheral)]) & SYSCTL_PERIPH_MASK(ulPeripheral)) { return(true); } else { return(false); } }
//***************************************************************************** // //! Determines if a peripheral is present. //! //! \param ulPeripheral is the peripheral in question. //! //! This function determines if a particular peripheral is present in the //! device. Each member of the Stellaris family has a different peripheral //! set; this function determines which peripherals are present on this device. //! //! The \e ulPeripheral parameter must be only one of the following values: //! \b SYSCTL_PERIPH_ADC0, \b SYSCTL_PERIPH_ADC1, \b SYSCTL_PERIPH_CAN0, //! \b SYSCTL_PERIPH_CAN1, \b SYSCTL_PERIPH_CAN2, \b SYSCTL_PERIPH_COMP0, //! \b SYSCTL_PERIPH_COMP1, \b SYSCTL_PERIPH_COMP2, \b SYSCTL_PERIPH_EPI0, //! \b SYSCTL_PERIPH_ETH, \b SYSCTL_PERIPH_FAN0, \b SYSCTL_PERIPH_GPIOA, //! \b SYSCTL_PERIPH_GPIOB, \b SYSCTL_PERIPH_GPIOC, \b SYSCTL_PERIPH_GPIOD, //! \b SYSCTL_PERIPH_GPIOE, \b SYSCTL_PERIPH_GPIOF, \b SYSCTL_PERIPH_GPIOG, //! \b SYSCTL_PERIPH_GPIOH, \b SYSCTL_PERIPH_GPIOJ, \b SYSCTL_PERIPH_GPIOK, //! \b SYSCTL_PERIPH_GPIOL, \b SYSCTL_PERIPH_GPIOM, \b SYSCTL_PERIPH_GPION, //! \b SYSCTL_PERIPH_GPIOP, \b SYSCTL_PERIPH_GPIOQ, \b SYSCTL_PERIPH_HIBERNATE, //! \b SYSCTL_PERIPH_I2C0, \b SYSCTL_PERIPH_I2C1, \b SYSCTL_PERIPH_I2C2, //! \b SYSCTL_PERIPH_I2C3, \b SYSCTL_PERIPH_I2C4, \b SYSCTL_PERIPH_I2C5, //! \b SYSCTL_PERIPH_I2S0, \b SYSCTL_PERIPH_IEEE1588, \b SYSCTL_PERIPH_LPC0, //! \b SYSCTL_PERIPH_MPU, \b SYSCTL_PERIPH_PECI0, \b SYSCTL_PERIPH_PLL, //! \b SYSCTL_PERIPH_PWM0, \b SYSCTL_PERIPH_PWM1, \b SYSCTL_PERIPH_QEI0, //! \b SYSCTL_PERIPH_QEI1, \b SYSCTL_PERIPH_SSI0, \b SYSCTL_PERIPH_SSI1, //! \b SYSCTL_PERIPH_SSI2, \b SYSCTL_PERIPH_SSI3, \b SYSCTL_PERIPH_TEMP, //! \b SYSCTL_PERIPH_TIMER0, \b SYSCTL_PERIPH_TIMER1, \b SYSCTL_PERIPH_TIMER2, //! \b SYSCTL_PERIPH_TIMER3, \b SYSCTL_PERIPH_TIMER4, \b SYSCTL_PERIPH_TIMER5, //! \b SYSCTL_PERIPH_UART0, \b SYSCTL_PERIPH_UART1, \b SYSCTL_PERIPH_UART2, //! \b SYSCTL_PERIPH_UART3, \b SYSCTL_PERIPH_UART4, \b SYSCTL_PERIPH_UART5, //! \b SYSCTL_PERIPH_UART6, \b SYSCTL_PERIPH_UART7, \b SYSCTL_PERIPH_UDMA, //! \b SYSCTL_PERIPH_USB0, \b SYSCTL_PERIPH_WDOG0, \b SYSCTL_PERIPH_WDOG1, //! \b SYSCTL_PERIPH_WTIMER0, \b SYSCTL_PERIPH_WTIMER1, //! \b SYSCTL_PERIPH_WTIMER2, \b SYSCTL_PERIPH_WTIMER3, //! \b SYSCTL_PERIPH_WTIMER4, or \b SYSCTL_PERIPH_WTIMER5, //! //! \return Returns \b true if the specified peripheral is present and \b false //! if it is not. // //*****************************************************************************
Determines if a peripheral is present. \param ulPeripheral is the peripheral in question. This function determines if a particular peripheral is present in the device. Each member of the Stellaris family has a different peripheral set; this function determines which peripherals are present on this device. \return Returns \b true if the specified peripheral is present and \b false if it is not.
[ "Determines", "if", "a", "peripheral", "is", "present", ".", "\\", "param", "ulPeripheral", "is", "the", "peripheral", "in", "question", ".", "This", "function", "determines", "if", "a", "particular", "peripheral", "is", "present", "in", "the", "device", ".", "Each", "member", "of", "the", "Stellaris", "family", "has", "a", "different", "peripheral", "set", ";", "this", "function", "determines", "which", "peripherals", "are", "present", "on", "this", "device", ".", "\\", "return", "Returns", "\\", "b", "true", "if", "the", "specified", "peripheral", "is", "present", "and", "\\", "b", "false", "if", "it", "is", "not", "." ]
tBoolean SysCtlPeripheralPresent(unsigned long ulPeripheral) { ASSERT(SysCtlPeripheralValid(ulPeripheral)); if((ulPeripheral & 0xf0000000) == 0xf0000000) { return(HWREGBITW(SYSCTL_PPBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff)); } else if(ulPeripheral == SYSCTL_PERIPH_USB0) { if(HWREG(SYSCTL_DC6) & SYSCTL_DC6_USB0_M) { return(true); } else { return(false); } } else if(HWREG(g_pulDCRegs[SYSCTL_PERIPH_INDEX(ulPeripheral)]) & SYSCTL_PERIPH_MASK(ulPeripheral)) { return(true); } else { return(false); } }
[ "tBoolean", "SysCtlPeripheralPresent", "(", "unsigned", "long", "ulPeripheral", ")", "{", "ASSERT", "(", "SysCtlPeripheralValid", "(", "ulPeripheral", ")", ")", ";", "if", "(", "(", "ulPeripheral", "&", "0xf0000000", ")", "==", "0xf0000000", ")", "{", "return", "(", "HWREGBITW", "(", "SYSCTL_PPBASE", "+", "(", "(", "ulPeripheral", "&", "0xff00", ")", ">>", "8", ")", ",", "ulPeripheral", "&", "0xff", ")", ")", ";", "}", "else", "if", "(", "ulPeripheral", "==", "SYSCTL_PERIPH_USB0", ")", "{", "if", "(", "HWREG", "(", "SYSCTL_DC6", ")", "&", "SYSCTL_DC6_USB0_M", ")", "{", "return", "(", "true", ")", ";", "}", "else", "{", "return", "(", "false", ")", ";", "}", "}", "else", "if", "(", "HWREG", "(", "g_pulDCRegs", "[", "SYSCTL_PERIPH_INDEX", "(", "ulPeripheral", ")", "]", ")", "&", "SYSCTL_PERIPH_MASK", "(", "ulPeripheral", ")", ")", "{", "return", "(", "true", ")", ";", "}", "else", "{", "return", "(", "false", ")", ";", "}", "}" ]
Determines if a peripheral is present.
[ "Determines", "if", "a", "peripheral", "is", "present", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// See if the peripheral index is 15, indicating a peripheral that is\r", "// accessed via the SYSCTL_PPperiph registers.\r", "//\r", "//\r", "// See if this peripheral is present.\r", "//\r", "//\r", "// USB is a special case because the DC bit is missing for USB0.\r", "//\r" ]
[ { "param": "ulPeripheral", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulPeripheral", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlPeripheralReady
tBoolean
tBoolean SysCtlPeripheralReady(unsigned long ulPeripheral) { // // Check the arguments. // ASSERT(SysCtlPeripheralValid(ulPeripheral)); // // Map the peripheral identifier to the new style identifiers. If it is // already a new style identifier, this is a NOP. // ulPeripheral = SysCtlPeripheralMapToNew(ulPeripheral); // // See if this peripheral is ready. // return(HWREGBITW(SYSCTL_PRBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff)); }
//***************************************************************************** // //! Determines if a peripheral is ready. //! //! \param ulPeripheral is the peripheral in question. //! //! This function determines if a particular peripheral is ready to be //! accessed. The peripheral may be in a non-ready state if it is not enabled, //! is being held in reset, or is in the process of becoming ready after being //! enabled or taken out of reset. //! //! The \e ulPeripheral parameter must be only one of the following values: //! \b SYSCTL_PERIPH_ADC0, \b SYSCTL_PERIPH_ADC1, \b SYSCTL_PERIPH_CAN0, //! \b SYSCTL_PERIPH_CAN1, \b SYSCTL_PERIPH_CAN2, \b SYSCTL_PERIPH_COMP0, //! \b SYSCTL_PERIPH_COMP1, \b SYSCTL_PERIPH_COMP2, \b SYSCTL_PERIPH_EEPROM0, //! \b SYSCTL_PERIPH_EPI0, \b SYSCTL_PERIPH_ETH, \b SYSCTL_PERIPH_FAN0, //! \b SYSCTL_PERIPH_GPIOA, \b SYSCTL_PERIPH_GPIOB, \b SYSCTL_PERIPH_GPIOC, //! \b SYSCTL_PERIPH_GPIOD, \b SYSCTL_PERIPH_GPIOE, \b SYSCTL_PERIPH_GPIOF, //! \b SYSCTL_PERIPH_GPIOG, \b SYSCTL_PERIPH_GPIOH, \b SYSCTL_PERIPH_GPIOJ, //! \b SYSCTL_PERIPH_GPIOK, \b SYSCTL_PERIPH_GPIOL, \b SYSCTL_PERIPH_GPIOM, //! \b SYSCTL_PERIPH_GPION, \b SYSCTL_PERIPH_GPIOP, \b SYSCTL_PERIPH_GPIOQ, //! \b SYSCTL_PERIPH_HIBERNATE, \b SYSCTL_PERIPH_I2C0, \b SYSCTL_PERIPH_I2C1, //! \b SYSCTL_PERIPH_I2C2, \b SYSCTL_PERIPH_I2C3, \b SYSCTL_PERIPH_I2C4, //! \b SYSCTL_PERIPH_I2C5, \b SYSCTL_PERIPH_I2S0, \b SYSCTL_PERIPH_LPC0, //! \b SYSCTL_PERIPH_PECI0, \b SYSCTL_PERIPH_PWM0, \b SYSCTL_PERIPH_PWM1, //! \b SYSCTL_PERIPH_QEI0, \b SYSCTL_PERIPH_QEI1, \b SYSCTL_PERIPH_SSI0, //! \b SYSCTL_PERIPH_SSI1, \b SYSCTL_PERIPH_SSI2, \b SYSCTL_PERIPH_SSI3, //! \b SYSCTL_PERIPH_TIMER0, \b SYSCTL_PERIPH_TIMER1, \b SYSCTL_PERIPH_TIMER2, //! \b SYSCTL_PERIPH_TIMER3, \b SYSCTL_PERIPH_TIMER4, \b SYSCTL_PERIPH_TIMER5, //! \b SYSCTL_PERIPH_UART0, \b SYSCTL_PERIPH_UART1, \b SYSCTL_PERIPH_UART2, //! \b SYSCTL_PERIPH_UART3, \b SYSCTL_PERIPH_UART4, \b SYSCTL_PERIPH_UART5, //! \b SYSCTL_PERIPH_UART6, \b SYSCTL_PERIPH_UART7, \b SYSCTL_PERIPH_UDMA, //! \b SYSCTL_PERIPH_USB0, \b SYSCTL_PERIPH_WDOG0, \b SYSCTL_PERIPH_WDOG1, //! \b SYSCTL_PERIPH_WTIMER0, \b SYSCTL_PERIPH_WTIMER1, //! \b SYSCTL_PERIPH_WTIMER2, \b SYSCTL_PERIPH_WTIMER3, //! \b SYSCTL_PERIPH_WTIMER4, or \b SYSCTL_PERIPH_WTIMER5. //! //! \note The ability to check for a peripheral being ready varies based on the //! Stellaris part in use. Please consult the data sheet for the part you are //! using to determine if this feature is available. //! //! \return Returns \b true if the specified peripheral is ready and \b false //! if it is not. // //*****************************************************************************
Determines if a peripheral is ready. \param ulPeripheral is the peripheral in question. This function determines if a particular peripheral is ready to be accessed. The peripheral may be in a non-ready state if it is not enabled, is being held in reset, or is in the process of becoming ready after being enabled or taken out of reset. \note The ability to check for a peripheral being ready varies based on the Stellaris part in use. Please consult the data sheet for the part you are using to determine if this feature is available. \return Returns \b true if the specified peripheral is ready and \b false if it is not.
[ "Determines", "if", "a", "peripheral", "is", "ready", ".", "\\", "param", "ulPeripheral", "is", "the", "peripheral", "in", "question", ".", "This", "function", "determines", "if", "a", "particular", "peripheral", "is", "ready", "to", "be", "accessed", ".", "The", "peripheral", "may", "be", "in", "a", "non", "-", "ready", "state", "if", "it", "is", "not", "enabled", "is", "being", "held", "in", "reset", "or", "is", "in", "the", "process", "of", "becoming", "ready", "after", "being", "enabled", "or", "taken", "out", "of", "reset", ".", "\\", "note", "The", "ability", "to", "check", "for", "a", "peripheral", "being", "ready", "varies", "based", "on", "the", "Stellaris", "part", "in", "use", ".", "Please", "consult", "the", "data", "sheet", "for", "the", "part", "you", "are", "using", "to", "determine", "if", "this", "feature", "is", "available", ".", "\\", "return", "Returns", "\\", "b", "true", "if", "the", "specified", "peripheral", "is", "ready", "and", "\\", "b", "false", "if", "it", "is", "not", "." ]
tBoolean SysCtlPeripheralReady(unsigned long ulPeripheral) { ASSERT(SysCtlPeripheralValid(ulPeripheral)); ulPeripheral = SysCtlPeripheralMapToNew(ulPeripheral); return(HWREGBITW(SYSCTL_PRBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff)); }
[ "tBoolean", "SysCtlPeripheralReady", "(", "unsigned", "long", "ulPeripheral", ")", "{", "ASSERT", "(", "SysCtlPeripheralValid", "(", "ulPeripheral", ")", ")", ";", "ulPeripheral", "=", "SysCtlPeripheralMapToNew", "(", "ulPeripheral", ")", ";", "return", "(", "HWREGBITW", "(", "SYSCTL_PRBASE", "+", "(", "(", "ulPeripheral", "&", "0xff00", ")", ">>", "8", ")", ",", "ulPeripheral", "&", "0xff", ")", ")", ";", "}" ]
Determines if a peripheral is ready.
[ "Determines", "if", "a", "peripheral", "is", "ready", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Map the peripheral identifier to the new style identifiers. If it is\r", "// already a new style identifier, this is a NOP.\r", "//\r", "//\r", "// See if this peripheral is ready.\r", "//\r" ]
[ { "param": "ulPeripheral", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulPeripheral", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlPeripheralPowerOn
void
void SysCtlPeripheralPowerOn(unsigned long ulPeripheral) { // // Check the arguments. // ASSERT(SysCtlPeripheralValid(ulPeripheral)); // // Map the peripheral identifier to the new style identifiers. If it is // already a new style identifier, this is a NOP. // ulPeripheral = SysCtlPeripheralMapToNew(ulPeripheral); // // Power on this peripheral. // HWREGBITW(SYSCTL_PCBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 1; }
//***************************************************************************** // //! Powers on a peripheral. //! //! \param ulPeripheral is the peripheral to be powered on. //! //! This function turns on the power to a peripheral. The peripheral continues //! to receive power even when its clock is not enabled. //! //! The \e ulPeripheral parameter must be only one of the following values: //! \b SYSCTL_PERIPH_ADC0, \b SYSCTL_PERIPH_ADC1, \b SYSCTL_PERIPH_CAN0, //! \b SYSCTL_PERIPH_CAN1, \b SYSCTL_PERIPH_CAN2, \b SYSCTL_PERIPH_COMP0, //! \b SYSCTL_PERIPH_COMP1, \b SYSCTL_PERIPH_COMP2, \b SYSCTL_PERIPH_EEPROM0, //! \b SYSCTL_PERIPH_EPI0, \b SYSCTL_PERIPH_ETH, \b SYSCTL_PERIPH_FAN0, //! \b SYSCTL_PERIPH_GPIOA, \b SYSCTL_PERIPH_GPIOB, \b SYSCTL_PERIPH_GPIOC, //! \b SYSCTL_PERIPH_GPIOD, \b SYSCTL_PERIPH_GPIOE, \b SYSCTL_PERIPH_GPIOF, //! \b SYSCTL_PERIPH_GPIOG, \b SYSCTL_PERIPH_GPIOH, \b SYSCTL_PERIPH_GPIOJ, //! \b SYSCTL_PERIPH_GPIOK, \b SYSCTL_PERIPH_GPIOL, \b SYSCTL_PERIPH_GPIOM, //! \b SYSCTL_PERIPH_GPION, \b SYSCTL_PERIPH_GPIOP, \b SYSCTL_PERIPH_GPIOQ, //! \b SYSCTL_PERIPH_HIBERNATE, \b SYSCTL_PERIPH_I2C0, \b SYSCTL_PERIPH_I2C1, //! \b SYSCTL_PERIPH_I2C2, \b SYSCTL_PERIPH_I2C3, \b SYSCTL_PERIPH_I2C4, //! \b SYSCTL_PERIPH_I2C5, \b SYSCTL_PERIPH_I2S0, \b SYSCTL_PERIPH_LPC0, //! \b SYSCTL_PERIPH_PECI0, \b SYSCTL_PERIPH_PWM0, \b SYSCTL_PERIPH_PWM1, //! \b SYSCTL_PERIPH_QEI0, \b SYSCTL_PERIPH_QEI1, \b SYSCTL_PERIPH_SSI0, //! \b SYSCTL_PERIPH_SSI1, \b SYSCTL_PERIPH_SSI2, \b SYSCTL_PERIPH_SSI3, //! \b SYSCTL_PERIPH_TIMER0, \b SYSCTL_PERIPH_TIMER1, \b SYSCTL_PERIPH_TIMER2, //! \b SYSCTL_PERIPH_TIMER3, \b SYSCTL_PERIPH_TIMER4, \b SYSCTL_PERIPH_TIMER5, //! \b SYSCTL_PERIPH_UART0, \b SYSCTL_PERIPH_UART1, \b SYSCTL_PERIPH_UART2, //! \b SYSCTL_PERIPH_UART3, \b SYSCTL_PERIPH_UART4, \b SYSCTL_PERIPH_UART5, //! \b SYSCTL_PERIPH_UART6, \b SYSCTL_PERIPH_UART7, \b SYSCTL_PERIPH_UDMA, //! \b SYSCTL_PERIPH_USB0, \b SYSCTL_PERIPH_WDOG0, \b SYSCTL_PERIPH_WDOG1, //! \b SYSCTL_PERIPH_WTIMER0, \b SYSCTL_PERIPH_WTIMER1, //! \b SYSCTL_PERIPH_WTIMER2, \b SYSCTL_PERIPH_WTIMER3, //! \b SYSCTL_PERIPH_WTIMER4, or \b SYSCTL_PERIPH_WTIMER5. //! //! \note The ability to power off a peripheral varies based on the Stellaris //! part in use. Please consult the data sheet for the part you are using to //! determine if this feature is available. //! //! \return None. // //*****************************************************************************
Powers on a peripheral. \param ulPeripheral is the peripheral to be powered on. This function turns on the power to a peripheral. The peripheral continues to receive power even when its clock is not enabled. \note The ability to power off a peripheral varies based on the Stellaris part in use. Please consult the data sheet for the part you are using to determine if this feature is available. \return None.
[ "Powers", "on", "a", "peripheral", ".", "\\", "param", "ulPeripheral", "is", "the", "peripheral", "to", "be", "powered", "on", ".", "This", "function", "turns", "on", "the", "power", "to", "a", "peripheral", ".", "The", "peripheral", "continues", "to", "receive", "power", "even", "when", "its", "clock", "is", "not", "enabled", ".", "\\", "note", "The", "ability", "to", "power", "off", "a", "peripheral", "varies", "based", "on", "the", "Stellaris", "part", "in", "use", ".", "Please", "consult", "the", "data", "sheet", "for", "the", "part", "you", "are", "using", "to", "determine", "if", "this", "feature", "is", "available", ".", "\\", "return", "None", "." ]
void SysCtlPeripheralPowerOn(unsigned long ulPeripheral) { ASSERT(SysCtlPeripheralValid(ulPeripheral)); ulPeripheral = SysCtlPeripheralMapToNew(ulPeripheral); HWREGBITW(SYSCTL_PCBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 1; }
[ "void", "SysCtlPeripheralPowerOn", "(", "unsigned", "long", "ulPeripheral", ")", "{", "ASSERT", "(", "SysCtlPeripheralValid", "(", "ulPeripheral", ")", ")", ";", "ulPeripheral", "=", "SysCtlPeripheralMapToNew", "(", "ulPeripheral", ")", ";", "HWREGBITW", "(", "SYSCTL_PCBASE", "+", "(", "(", "ulPeripheral", "&", "0xff00", ")", ">>", "8", ")", ",", "ulPeripheral", "&", "0xff", ")", "=", "1", ";", "}" ]
Powers on a peripheral.
[ "Powers", "on", "a", "peripheral", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Map the peripheral identifier to the new style identifiers. If it is\r", "// already a new style identifier, this is a NOP.\r", "//\r", "//\r", "// Power on this peripheral.\r", "//\r" ]
[ { "param": "ulPeripheral", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulPeripheral", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlPeripheralPowerOff
void
void SysCtlPeripheralPowerOff(unsigned long ulPeripheral) { // // Check the arguments. // ASSERT(SysCtlPeripheralValid(ulPeripheral)); // // Map the peripheral identifier to the new style identifiers. If it is // already a new style identifier, this is a NOP. // ulPeripheral = SysCtlPeripheralMapToNew(ulPeripheral); // // Power off this peripheral. // HWREGBITW(SYSCTL_PCBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 0; }
//***************************************************************************** // //! Powers off a peripheral. //! //! \param ulPeripheral is the peripheral to be powered off. //! //! This function allows the power to a peripheral to be turned off. The //! peripheral continues to receive power when its clock is enabled, but //! the power is removed when its clock is disabled. //! //! The \e ulPeripheral parameter must be only one of the following values: //! \b SYSCTL_PERIPH_ADC0, \b SYSCTL_PERIPH_ADC1, \b SYSCTL_PERIPH_CAN0, //! \b SYSCTL_PERIPH_CAN1, \b SYSCTL_PERIPH_CAN2, \b SYSCTL_PERIPH_COMP0, //! \b SYSCTL_PERIPH_COMP1, \b SYSCTL_PERIPH_COMP2, \b SYSCTL_PERIPH_EEPROM0, //! \b SYSCTL_PERIPH_EPI0, \b SYSCTL_PERIPH_ETH, \b SYSCTL_PERIPH_FAN0, //! \b SYSCTL_PERIPH_GPIOA, \b SYSCTL_PERIPH_GPIOB, \b SYSCTL_PERIPH_GPIOC, //! \b SYSCTL_PERIPH_GPIOD, \b SYSCTL_PERIPH_GPIOE, \b SYSCTL_PERIPH_GPIOF, //! \b SYSCTL_PERIPH_GPIOG, \b SYSCTL_PERIPH_GPIOH, \b SYSCTL_PERIPH_GPIOJ, //! \b SYSCTL_PERIPH_GPIOK, \b SYSCTL_PERIPH_GPIOL, \b SYSCTL_PERIPH_GPIOM, //! \b SYSCTL_PERIPH_GPION, \b SYSCTL_PERIPH_GPIOP, \b SYSCTL_PERIPH_GPIOQ, //! \b SYSCTL_PERIPH_HIBERNATE, \b SYSCTL_PERIPH_I2C0, \b SYSCTL_PERIPH_I2C1, //! \b SYSCTL_PERIPH_I2C2, \b SYSCTL_PERIPH_I2C3, \b SYSCTL_PERIPH_I2C4, //! \b SYSCTL_PERIPH_I2C5, \b SYSCTL_PERIPH_I2S0, \b SYSCTL_PERIPH_LPC0, //! \b SYSCTL_PERIPH_PECI0, \b SYSCTL_PERIPH_PWM0, \b SYSCTL_PERIPH_PWM1, //! \b SYSCTL_PERIPH_QEI0, \b SYSCTL_PERIPH_QEI1, \b SYSCTL_PERIPH_SSI0, //! \b SYSCTL_PERIPH_SSI1, \b SYSCTL_PERIPH_SSI2, \b SYSCTL_PERIPH_SSI3, //! \b SYSCTL_PERIPH_TIMER0, \b SYSCTL_PERIPH_TIMER1, \b SYSCTL_PERIPH_TIMER2, //! \b SYSCTL_PERIPH_TIMER3, \b SYSCTL_PERIPH_TIMER4, \b SYSCTL_PERIPH_TIMER5, //! \b SYSCTL_PERIPH_UART0, \b SYSCTL_PERIPH_UART1, \b SYSCTL_PERIPH_UART2, //! \b SYSCTL_PERIPH_UART3, \b SYSCTL_PERIPH_UART4, \b SYSCTL_PERIPH_UART5, //! \b SYSCTL_PERIPH_UART6, \b SYSCTL_PERIPH_UART7, \b SYSCTL_PERIPH_UDMA, //! \b SYSCTL_PERIPH_USB0, \b SYSCTL_PERIPH_WDOG0, \b SYSCTL_PERIPH_WDOG1, //! \b SYSCTL_PERIPH_WTIMER0, \b SYSCTL_PERIPH_WTIMER1, //! \b SYSCTL_PERIPH_WTIMER2, \b SYSCTL_PERIPH_WTIMER3, //! \b SYSCTL_PERIPH_WTIMER4, or \b SYSCTL_PERIPH_WTIMER5. //! //! \note The ability to power off a peripheral varies based on the Stellaris //! part in use. Please consult the data sheet for the part you are using to //! determine if this feature is available. //! //! \return None. // //*****************************************************************************
Powers off a peripheral. \param ulPeripheral is the peripheral to be powered off. This function allows the power to a peripheral to be turned off. The peripheral continues to receive power when its clock is enabled, but the power is removed when its clock is disabled. \note The ability to power off a peripheral varies based on the Stellaris part in use. Please consult the data sheet for the part you are using to determine if this feature is available. \return None.
[ "Powers", "off", "a", "peripheral", ".", "\\", "param", "ulPeripheral", "is", "the", "peripheral", "to", "be", "powered", "off", ".", "This", "function", "allows", "the", "power", "to", "a", "peripheral", "to", "be", "turned", "off", ".", "The", "peripheral", "continues", "to", "receive", "power", "when", "its", "clock", "is", "enabled", "but", "the", "power", "is", "removed", "when", "its", "clock", "is", "disabled", ".", "\\", "note", "The", "ability", "to", "power", "off", "a", "peripheral", "varies", "based", "on", "the", "Stellaris", "part", "in", "use", ".", "Please", "consult", "the", "data", "sheet", "for", "the", "part", "you", "are", "using", "to", "determine", "if", "this", "feature", "is", "available", ".", "\\", "return", "None", "." ]
void SysCtlPeripheralPowerOff(unsigned long ulPeripheral) { ASSERT(SysCtlPeripheralValid(ulPeripheral)); ulPeripheral = SysCtlPeripheralMapToNew(ulPeripheral); HWREGBITW(SYSCTL_PCBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 0; }
[ "void", "SysCtlPeripheralPowerOff", "(", "unsigned", "long", "ulPeripheral", ")", "{", "ASSERT", "(", "SysCtlPeripheralValid", "(", "ulPeripheral", ")", ")", ";", "ulPeripheral", "=", "SysCtlPeripheralMapToNew", "(", "ulPeripheral", ")", ";", "HWREGBITW", "(", "SYSCTL_PCBASE", "+", "(", "(", "ulPeripheral", "&", "0xff00", ")", ">>", "8", ")", ",", "ulPeripheral", "&", "0xff", ")", "=", "0", ";", "}" ]
Powers off a peripheral.
[ "Powers", "off", "a", "peripheral", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Map the peripheral identifier to the new style identifiers. If it is\r", "// already a new style identifier, this is a NOP.\r", "//\r", "//\r", "// Power off this peripheral.\r", "//\r" ]
[ { "param": "ulPeripheral", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulPeripheral", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlPeripheralReset
void
void SysCtlPeripheralReset(unsigned long ulPeripheral) { volatile unsigned long ulDelay; // // Check the arguments. // ASSERT(SysCtlPeripheralValid(ulPeripheral)); // // See if the peripheral index is 15, indicating a peripheral that is // accessed via the SYSCTL_SRperiph registers. // if((ulPeripheral & 0xf0000000) == 0xf0000000) { // // Put the peripheral into the reset state. // HWREGBITW(SYSCTL_SRBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 1; // // Delay for a little bit. // for(ulDelay = 0; ulDelay < 16; ulDelay++) { } // // Take the peripheral out of the reset state. // HWREGBITW(SYSCTL_SRBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 0; } else { // // Put the peripheral into the reset state. // HWREG(g_pulSRCRRegs[SYSCTL_PERIPH_INDEX(ulPeripheral)]) |= SYSCTL_PERIPH_MASK(ulPeripheral); // // Delay for a little bit. // for(ulDelay = 0; ulDelay < 16; ulDelay++) { } // // Take the peripheral out of the reset state. // HWREG(g_pulSRCRRegs[SYSCTL_PERIPH_INDEX(ulPeripheral)]) &= ~SYSCTL_PERIPH_MASK(ulPeripheral); } }
//***************************************************************************** // //! Performs a software reset of a peripheral. //! //! \param ulPeripheral is the peripheral to reset. //! //! This function performs a software reset of the specified peripheral. An //! individual peripheral reset signal is asserted for a brief period and then //! de-asserted, returning the internal state of the peripheral to its reset //! condition. //! //! The \e ulPeripheral parameter must be only one of the following values: //! \b SYSCTL_PERIPH_ADC0, \b SYSCTL_PERIPH_ADC1, \b SYSCTL_PERIPH_CAN0, //! \b SYSCTL_PERIPH_CAN1, \b SYSCTL_PERIPH_CAN2, \b SYSCTL_PERIPH_COMP0, //! \b SYSCTL_PERIPH_COMP1, \b SYSCTL_PERIPH_COMP2, \b SYSCTL_PERIPH_EEPROM0, //! \b SYSCTL_PERIPH_EPI0, \b SYSCTL_PERIPH_ETH, \b SYSCTL_PERIPH_FAN0, //! \b SYSCTL_PERIPH_GPIOA, \b SYSCTL_PERIPH_GPIOB, \b SYSCTL_PERIPH_GPIOC, //! \b SYSCTL_PERIPH_GPIOD, \b SYSCTL_PERIPH_GPIOE, \b SYSCTL_PERIPH_GPIOF, //! \b SYSCTL_PERIPH_GPIOG, \b SYSCTL_PERIPH_GPIOH, \b SYSCTL_PERIPH_GPIOJ, //! \b SYSCTL_PERIPH_GPIOK, \b SYSCTL_PERIPH_GPIOL, \b SYSCTL_PERIPH_GPIOM, //! \b SYSCTL_PERIPH_GPION, \b SYSCTL_PERIPH_GPIOP, \b SYSCTL_PERIPH_GPIOQ, //! \b SYSCTL_PERIPH_HIBERNATE, \b SYSCTL_PERIPH_I2C0, \b SYSCTL_PERIPH_I2C1, //! \b SYSCTL_PERIPH_I2C2, \b SYSCTL_PERIPH_I2C3, \b SYSCTL_PERIPH_I2C4, //! \b SYSCTL_PERIPH_I2C5, \b SYSCTL_PERIPH_I2S0, \b SYSCTL_PERIPH_LPC0, //! \b SYSCTL_PERIPH_PECI0, \b SYSCTL_PERIPH_PWM0, \b SYSCTL_PERIPH_PWM1, //! \b SYSCTL_PERIPH_QEI0, \b SYSCTL_PERIPH_QEI1, \b SYSCTL_PERIPH_SSI0, //! \b SYSCTL_PERIPH_SSI1, \b SYSCTL_PERIPH_SSI2, \b SYSCTL_PERIPH_SSI3, //! \b SYSCTL_PERIPH_TIMER0, \b SYSCTL_PERIPH_TIMER1, \b SYSCTL_PERIPH_TIMER2, //! \b SYSCTL_PERIPH_TIMER3, \b SYSCTL_PERIPH_TIMER4, \b SYSCTL_PERIPH_TIMER5, //! \b SYSCTL_PERIPH_UART0, \b SYSCTL_PERIPH_UART1, \b SYSCTL_PERIPH_UART2, //! \b SYSCTL_PERIPH_UART3, \b SYSCTL_PERIPH_UART4, \b SYSCTL_PERIPH_UART5, //! \b SYSCTL_PERIPH_UART6, \b SYSCTL_PERIPH_UART7, \b SYSCTL_PERIPH_UDMA, //! \b SYSCTL_PERIPH_USB0, \b SYSCTL_PERIPH_WDOG0, \b SYSCTL_PERIPH_WDOG1, //! \b SYSCTL_PERIPH_WTIMER0, \b SYSCTL_PERIPH_WTIMER1, //! \b SYSCTL_PERIPH_WTIMER2, \b SYSCTL_PERIPH_WTIMER3, //! \b SYSCTL_PERIPH_WTIMER4, or \b SYSCTL_PERIPH_WTIMER5. //! //! \return None. // //*****************************************************************************
Performs a software reset of a peripheral. \param ulPeripheral is the peripheral to reset. This function performs a software reset of the specified peripheral. An individual peripheral reset signal is asserted for a brief period and then de-asserted, returning the internal state of the peripheral to its reset condition. \return None.
[ "Performs", "a", "software", "reset", "of", "a", "peripheral", ".", "\\", "param", "ulPeripheral", "is", "the", "peripheral", "to", "reset", ".", "This", "function", "performs", "a", "software", "reset", "of", "the", "specified", "peripheral", ".", "An", "individual", "peripheral", "reset", "signal", "is", "asserted", "for", "a", "brief", "period", "and", "then", "de", "-", "asserted", "returning", "the", "internal", "state", "of", "the", "peripheral", "to", "its", "reset", "condition", ".", "\\", "return", "None", "." ]
void SysCtlPeripheralReset(unsigned long ulPeripheral) { volatile unsigned long ulDelay; ASSERT(SysCtlPeripheralValid(ulPeripheral)); if((ulPeripheral & 0xf0000000) == 0xf0000000) { HWREGBITW(SYSCTL_SRBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 1; for(ulDelay = 0; ulDelay < 16; ulDelay++) { } HWREGBITW(SYSCTL_SRBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 0; } else { HWREG(g_pulSRCRRegs[SYSCTL_PERIPH_INDEX(ulPeripheral)]) |= SYSCTL_PERIPH_MASK(ulPeripheral); for(ulDelay = 0; ulDelay < 16; ulDelay++) { } HWREG(g_pulSRCRRegs[SYSCTL_PERIPH_INDEX(ulPeripheral)]) &= ~SYSCTL_PERIPH_MASK(ulPeripheral); } }
[ "void", "SysCtlPeripheralReset", "(", "unsigned", "long", "ulPeripheral", ")", "{", "volatile", "unsigned", "long", "ulDelay", ";", "ASSERT", "(", "SysCtlPeripheralValid", "(", "ulPeripheral", ")", ")", ";", "if", "(", "(", "ulPeripheral", "&", "0xf0000000", ")", "==", "0xf0000000", ")", "{", "HWREGBITW", "(", "SYSCTL_SRBASE", "+", "(", "(", "ulPeripheral", "&", "0xff00", ")", ">>", "8", ")", ",", "ulPeripheral", "&", "0xff", ")", "=", "1", ";", "for", "(", "ulDelay", "=", "0", ";", "ulDelay", "<", "16", ";", "ulDelay", "++", ")", "{", "}", "HWREGBITW", "(", "SYSCTL_SRBASE", "+", "(", "(", "ulPeripheral", "&", "0xff00", ")", ">>", "8", ")", ",", "ulPeripheral", "&", "0xff", ")", "=", "0", ";", "}", "else", "{", "HWREG", "(", "g_pulSRCRRegs", "[", "SYSCTL_PERIPH_INDEX", "(", "ulPeripheral", ")", "]", ")", "|=", "SYSCTL_PERIPH_MASK", "(", "ulPeripheral", ")", ";", "for", "(", "ulDelay", "=", "0", ";", "ulDelay", "<", "16", ";", "ulDelay", "++", ")", "{", "}", "HWREG", "(", "g_pulSRCRRegs", "[", "SYSCTL_PERIPH_INDEX", "(", "ulPeripheral", ")", "]", ")", "&=", "~", "SYSCTL_PERIPH_MASK", "(", "ulPeripheral", ")", ";", "}", "}" ]
Performs a software reset of a peripheral.
[ "Performs", "a", "software", "reset", "of", "a", "peripheral", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// See if the peripheral index is 15, indicating a peripheral that is\r", "// accessed via the SYSCTL_SRperiph registers.\r", "//\r", "//\r", "// Put the peripheral into the reset state.\r", "//\r", "//\r", "// Delay for a little bit.\r", "//\r", "//\r", "// Take the peripheral out of the reset state.\r", "//\r", "//\r", "// Put the peripheral into the reset state.\r", "//\r", "//\r", "// Delay for a little bit.\r", "//\r", "//\r", "// Take the peripheral out of the reset state.\r", "//\r" ]
[ { "param": "ulPeripheral", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulPeripheral", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlPeripheralEnable
void
void SysCtlPeripheralEnable(unsigned long ulPeripheral) { // // Check the arguments. // ASSERT(SysCtlPeripheralValid(ulPeripheral)); // // See if the peripheral index is 15, indicating a peripheral that is // accessed via the SYSCTL_RCGCperiph registers. // if((ulPeripheral & 0xf0000000) == 0xf0000000) { // // Enable this peripheral. // HWREGBITW(SYSCTL_RCGCBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 1; } else { // // Enable this peripheral. // HWREG(g_pulRCGCRegs[SYSCTL_PERIPH_INDEX(ulPeripheral)]) |= SYSCTL_PERIPH_MASK(ulPeripheral); } }
//***************************************************************************** // //! Enables a peripheral. //! //! \param ulPeripheral is the peripheral to enable. //! //! This function enables peripherals. At power-up, all peripherals //! are disabled; they must be enabled in order to operate or respond to //! register reads/writes. //! //! The \e ulPeripheral parameter must be only one of the following values: //! \b SYSCTL_PERIPH_ADC0, \b SYSCTL_PERIPH_ADC1, \b SYSCTL_PERIPH_CAN0, //! \b SYSCTL_PERIPH_CAN1, \b SYSCTL_PERIPH_CAN2, \b SYSCTL_PERIPH_COMP0, //! \b SYSCTL_PERIPH_COMP1, \b SYSCTL_PERIPH_COMP2, \b SYSCTL_PERIPH_EEPROM0, //! \b SYSCTL_PERIPH_EPI0, \b SYSCTL_PERIPH_ETH, \b SYSCTL_PERIPH_FAN0, //! \b SYSCTL_PERIPH_GPIOA, \b SYSCTL_PERIPH_GPIOB, \b SYSCTL_PERIPH_GPIOC, //! \b SYSCTL_PERIPH_GPIOD, \b SYSCTL_PERIPH_GPIOE, \b SYSCTL_PERIPH_GPIOF, //! \b SYSCTL_PERIPH_GPIOG, \b SYSCTL_PERIPH_GPIOH, \b SYSCTL_PERIPH_GPIOJ, //! \b SYSCTL_PERIPH_GPIOK, \b SYSCTL_PERIPH_GPIOL, \b SYSCTL_PERIPH_GPIOM, //! \b SYSCTL_PERIPH_GPION, \b SYSCTL_PERIPH_GPIOP, \b SYSCTL_PERIPH_GPIOQ, //! \b SYSCTL_PERIPH_HIBERNATE, \b SYSCTL_PERIPH_I2C0, \b SYSCTL_PERIPH_I2C1, //! \b SYSCTL_PERIPH_I2C2, \b SYSCTL_PERIPH_I2C3, \b SYSCTL_PERIPH_I2C4, //! \b SYSCTL_PERIPH_I2C5, \b SYSCTL_PERIPH_I2S0, \b SYSCTL_PERIPH_LPC0, //! \b SYSCTL_PERIPH_PECI0, \b SYSCTL_PERIPH_PWM0, \b SYSCTL_PERIPH_PWM1, //! \b SYSCTL_PERIPH_QEI0, \b SYSCTL_PERIPH_QEI1, \b SYSCTL_PERIPH_SSI0, //! \b SYSCTL_PERIPH_SSI1, \b SYSCTL_PERIPH_SSI2, \b SYSCTL_PERIPH_SSI3, //! \b SYSCTL_PERIPH_TIMER0, \b SYSCTL_PERIPH_TIMER1, \b SYSCTL_PERIPH_TIMER2, //! \b SYSCTL_PERIPH_TIMER3, \b SYSCTL_PERIPH_TIMER4, \b SYSCTL_PERIPH_TIMER5, //! \b SYSCTL_PERIPH_UART0, \b SYSCTL_PERIPH_UART1, \b SYSCTL_PERIPH_UART2, //! \b SYSCTL_PERIPH_UART3, \b SYSCTL_PERIPH_UART4, \b SYSCTL_PERIPH_UART5, //! \b SYSCTL_PERIPH_UART6, \b SYSCTL_PERIPH_UART7, \b SYSCTL_PERIPH_UDMA, //! \b SYSCTL_PERIPH_USB0, \b SYSCTL_PERIPH_WDOG0, \b SYSCTL_PERIPH_WDOG1, //! \b SYSCTL_PERIPH_WTIMER0, \b SYSCTL_PERIPH_WTIMER1, //! \b SYSCTL_PERIPH_WTIMER2, \b SYSCTL_PERIPH_WTIMER3, //! \b SYSCTL_PERIPH_WTIMER4, or \b SYSCTL_PERIPH_WTIMER5. //! //! \note It takes five clock cycles after the write to enable a peripheral //! before the the peripheral is actually enabled. During this time, attempts //! to access the peripheral result in a bus fault. Care should be taken //! to ensure that the peripheral is not accessed during this brief time //! period. //! //! \return None. // //*****************************************************************************
Enables a peripheral. \param ulPeripheral is the peripheral to enable. This function enables peripherals. At power-up, all peripherals are disabled; they must be enabled in order to operate or respond to register reads/writes. \note It takes five clock cycles after the write to enable a peripheral before the the peripheral is actually enabled. During this time, attempts to access the peripheral result in a bus fault. Care should be taken to ensure that the peripheral is not accessed during this brief time period. \return None.
[ "Enables", "a", "peripheral", ".", "\\", "param", "ulPeripheral", "is", "the", "peripheral", "to", "enable", ".", "This", "function", "enables", "peripherals", ".", "At", "power", "-", "up", "all", "peripherals", "are", "disabled", ";", "they", "must", "be", "enabled", "in", "order", "to", "operate", "or", "respond", "to", "register", "reads", "/", "writes", ".", "\\", "note", "It", "takes", "five", "clock", "cycles", "after", "the", "write", "to", "enable", "a", "peripheral", "before", "the", "the", "peripheral", "is", "actually", "enabled", ".", "During", "this", "time", "attempts", "to", "access", "the", "peripheral", "result", "in", "a", "bus", "fault", ".", "Care", "should", "be", "taken", "to", "ensure", "that", "the", "peripheral", "is", "not", "accessed", "during", "this", "brief", "time", "period", ".", "\\", "return", "None", "." ]
void SysCtlPeripheralEnable(unsigned long ulPeripheral) { ASSERT(SysCtlPeripheralValid(ulPeripheral)); if((ulPeripheral & 0xf0000000) == 0xf0000000) { HWREGBITW(SYSCTL_RCGCBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 1; } else { HWREG(g_pulRCGCRegs[SYSCTL_PERIPH_INDEX(ulPeripheral)]) |= SYSCTL_PERIPH_MASK(ulPeripheral); } }
[ "void", "SysCtlPeripheralEnable", "(", "unsigned", "long", "ulPeripheral", ")", "{", "ASSERT", "(", "SysCtlPeripheralValid", "(", "ulPeripheral", ")", ")", ";", "if", "(", "(", "ulPeripheral", "&", "0xf0000000", ")", "==", "0xf0000000", ")", "{", "HWREGBITW", "(", "SYSCTL_RCGCBASE", "+", "(", "(", "ulPeripheral", "&", "0xff00", ")", ">>", "8", ")", ",", "ulPeripheral", "&", "0xff", ")", "=", "1", ";", "}", "else", "{", "HWREG", "(", "g_pulRCGCRegs", "[", "SYSCTL_PERIPH_INDEX", "(", "ulPeripheral", ")", "]", ")", "|=", "SYSCTL_PERIPH_MASK", "(", "ulPeripheral", ")", ";", "}", "}" ]
Enables a peripheral.
[ "Enables", "a", "peripheral", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// See if the peripheral index is 15, indicating a peripheral that is\r", "// accessed via the SYSCTL_RCGCperiph registers.\r", "//\r", "//\r", "// Enable this peripheral.\r", "//\r", "//\r", "// Enable this peripheral.\r", "//\r" ]
[ { "param": "ulPeripheral", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulPeripheral", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlPeripheralDisable
void
void SysCtlPeripheralDisable(unsigned long ulPeripheral) { // // Check the arguments. // ASSERT(SysCtlPeripheralValid(ulPeripheral)); // // See if the peripheral index is 15, indicating a peripheral that is // accessed via the SYSCTL_RCGCperiph registers. // if((ulPeripheral & 0xf0000000) == 0xf0000000) { // // Disable this peripheral. // HWREGBITW(SYSCTL_RCGCBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 0; } else { // // Disable this peripheral. // HWREG(g_pulRCGCRegs[SYSCTL_PERIPH_INDEX(ulPeripheral)]) &= ~SYSCTL_PERIPH_MASK(ulPeripheral); } }
//***************************************************************************** // //! Disables a peripheral. //! //! \param ulPeripheral is the peripheral to disable. //! //! This function disables peripherals are disabled with this function. Once //! disabled, they do not operate or respond to register reads/writes. //! //! The \e ulPeripheral parameter must be only one of the following values: //! \b SYSCTL_PERIPH_ADC0, \b SYSCTL_PERIPH_ADC1, \b SYSCTL_PERIPH_CAN0, //! \b SYSCTL_PERIPH_CAN1, \b SYSCTL_PERIPH_CAN2, \b SYSCTL_PERIPH_COMP0, //! \b SYSCTL_PERIPH_COMP1, \b SYSCTL_PERIPH_COMP2, \b SYSCTL_PERIPH_EEPROM0, //! \b SYSCTL_PERIPH_EPI0, \b SYSCTL_PERIPH_ETH, \b SYSCTL_PERIPH_FAN0, //! \b SYSCTL_PERIPH_GPIOA, \b SYSCTL_PERIPH_GPIOB, \b SYSCTL_PERIPH_GPIOC, //! \b SYSCTL_PERIPH_GPIOD, \b SYSCTL_PERIPH_GPIOE, \b SYSCTL_PERIPH_GPIOF, //! \b SYSCTL_PERIPH_GPIOG, \b SYSCTL_PERIPH_GPIOH, \b SYSCTL_PERIPH_GPIOJ, //! \b SYSCTL_PERIPH_GPIOK, \b SYSCTL_PERIPH_GPIOL, \b SYSCTL_PERIPH_GPIOM, //! \b SYSCTL_PERIPH_GPION, \b SYSCTL_PERIPH_GPIOP, \b SYSCTL_PERIPH_GPIOQ, //! \b SYSCTL_PERIPH_HIBERNATE, \b SYSCTL_PERIPH_I2C0, \b SYSCTL_PERIPH_I2C1, //! \b SYSCTL_PERIPH_I2C2, \b SYSCTL_PERIPH_I2C3, \b SYSCTL_PERIPH_I2C4, //! \b SYSCTL_PERIPH_I2C5, \b SYSCTL_PERIPH_I2S0, \b SYSCTL_PERIPH_LPC0, //! \b SYSCTL_PERIPH_PECI0, \b SYSCTL_PERIPH_PWM0, \b SYSCTL_PERIPH_PWM1, //! \b SYSCTL_PERIPH_QEI0, \b SYSCTL_PERIPH_QEI1, \b SYSCTL_PERIPH_SSI0, //! \b SYSCTL_PERIPH_SSI1, \b SYSCTL_PERIPH_SSI2, \b SYSCTL_PERIPH_SSI3, //! \b SYSCTL_PERIPH_TIMER0, \b SYSCTL_PERIPH_TIMER1, \b SYSCTL_PERIPH_TIMER2, //! \b SYSCTL_PERIPH_TIMER3, \b SYSCTL_PERIPH_TIMER4, \b SYSCTL_PERIPH_TIMER5, //! \b SYSCTL_PERIPH_UART0, \b SYSCTL_PERIPH_UART1, \b SYSCTL_PERIPH_UART2, //! \b SYSCTL_PERIPH_UART3, \b SYSCTL_PERIPH_UART4, \b SYSCTL_PERIPH_UART5, //! \b SYSCTL_PERIPH_UART6, \b SYSCTL_PERIPH_UART7, \b SYSCTL_PERIPH_UDMA, //! \b SYSCTL_PERIPH_USB0, \b SYSCTL_PERIPH_WDOG0, \b SYSCTL_PERIPH_WDOG1, //! \b SYSCTL_PERIPH_WTIMER0, \b SYSCTL_PERIPH_WTIMER1, //! \b SYSCTL_PERIPH_WTIMER2, \b SYSCTL_PERIPH_WTIMER3, //! \b SYSCTL_PERIPH_WTIMER4, or \b SYSCTL_PERIPH_WTIMER5. //! //! \return None. // //*****************************************************************************
Disables a peripheral. \param ulPeripheral is the peripheral to disable. This function disables peripherals are disabled with this function. Once disabled, they do not operate or respond to register reads/writes. \return None.
[ "Disables", "a", "peripheral", ".", "\\", "param", "ulPeripheral", "is", "the", "peripheral", "to", "disable", ".", "This", "function", "disables", "peripherals", "are", "disabled", "with", "this", "function", ".", "Once", "disabled", "they", "do", "not", "operate", "or", "respond", "to", "register", "reads", "/", "writes", ".", "\\", "return", "None", "." ]
void SysCtlPeripheralDisable(unsigned long ulPeripheral) { ASSERT(SysCtlPeripheralValid(ulPeripheral)); if((ulPeripheral & 0xf0000000) == 0xf0000000) { HWREGBITW(SYSCTL_RCGCBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 0; } else { HWREG(g_pulRCGCRegs[SYSCTL_PERIPH_INDEX(ulPeripheral)]) &= ~SYSCTL_PERIPH_MASK(ulPeripheral); } }
[ "void", "SysCtlPeripheralDisable", "(", "unsigned", "long", "ulPeripheral", ")", "{", "ASSERT", "(", "SysCtlPeripheralValid", "(", "ulPeripheral", ")", ")", ";", "if", "(", "(", "ulPeripheral", "&", "0xf0000000", ")", "==", "0xf0000000", ")", "{", "HWREGBITW", "(", "SYSCTL_RCGCBASE", "+", "(", "(", "ulPeripheral", "&", "0xff00", ")", ">>", "8", ")", ",", "ulPeripheral", "&", "0xff", ")", "=", "0", ";", "}", "else", "{", "HWREG", "(", "g_pulRCGCRegs", "[", "SYSCTL_PERIPH_INDEX", "(", "ulPeripheral", ")", "]", ")", "&=", "~", "SYSCTL_PERIPH_MASK", "(", "ulPeripheral", ")", ";", "}", "}" ]
Disables a peripheral.
[ "Disables", "a", "peripheral", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// See if the peripheral index is 15, indicating a peripheral that is\r", "// accessed via the SYSCTL_RCGCperiph registers.\r", "//\r", "//\r", "// Disable this peripheral.\r", "//\r", "//\r", "// Disable this peripheral.\r", "//\r" ]
[ { "param": "ulPeripheral", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulPeripheral", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlPeripheralSleepEnable
void
void SysCtlPeripheralSleepEnable(unsigned long ulPeripheral) { // // Check the arguments. // ASSERT(SysCtlPeripheralValid(ulPeripheral)); // // See if the peripheral index is 15, indicating a peripheral that is // accessed via the SYSCTL_SCGCperiph registers. // if((ulPeripheral & 0xf0000000) == 0xf0000000) { // // Enable this peripheral in sleep mode. // HWREGBITW(SYSCTL_SCGCBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 1; } else { // // Enable this peripheral in sleep mode. // HWREG(g_pulSCGCRegs[SYSCTL_PERIPH_INDEX(ulPeripheral)]) |= SYSCTL_PERIPH_MASK(ulPeripheral); } }
//***************************************************************************** // //! Enables a peripheral in sleep mode. //! //! \param ulPeripheral is the peripheral to enable in sleep mode. //! //! This function allows a peripheral to continue operating when the processor //! goes into sleep mode. Because the clocking configuration of the device //! does not change, any peripheral can safely continue operating while the //! processor is in sleep mode and can therefore wake the processor from sleep //! mode. //! //! Sleep mode clocking of peripherals must be enabled via //! SysCtlPeripheralClockGating(); if disabled, the peripheral sleep mode //! configuration is maintained but has no effect when sleep mode is entered. //! //! The \e ulPeripheral parameter must be only one of the following values: //! \b SYSCTL_PERIPH_ADC0, \b SYSCTL_PERIPH_ADC1, \b SYSCTL_PERIPH_CAN0, //! \b SYSCTL_PERIPH_CAN1, \b SYSCTL_PERIPH_CAN2, \b SYSCTL_PERIPH_COMP0, //! \b SYSCTL_PERIPH_COMP1, \b SYSCTL_PERIPH_COMP2, \b SYSCTL_PERIPH_EEPROM0, //! \b SYSCTL_PERIPH_EPI0, \b SYSCTL_PERIPH_ETH, \b SYSCTL_PERIPH_FAN0, //! \b SYSCTL_PERIPH_GPIOA, \b SYSCTL_PERIPH_GPIOB, \b SYSCTL_PERIPH_GPIOC, //! \b SYSCTL_PERIPH_GPIOD, \b SYSCTL_PERIPH_GPIOE, \b SYSCTL_PERIPH_GPIOF, //! \b SYSCTL_PERIPH_GPIOG, \b SYSCTL_PERIPH_GPIOH, \b SYSCTL_PERIPH_GPIOJ, //! \b SYSCTL_PERIPH_GPIOK, \b SYSCTL_PERIPH_GPIOL, \b SYSCTL_PERIPH_GPIOM, //! \b SYSCTL_PERIPH_GPION, \b SYSCTL_PERIPH_GPIOP, \b SYSCTL_PERIPH_GPIOQ, //! \b SYSCTL_PERIPH_HIBERNATE, \b SYSCTL_PERIPH_I2C0, \b SYSCTL_PERIPH_I2C1, //! \b SYSCTL_PERIPH_I2C2, \b SYSCTL_PERIPH_I2C3, \b SYSCTL_PERIPH_I2C4, //! \b SYSCTL_PERIPH_I2C5, \b SYSCTL_PERIPH_I2S0, \b SYSCTL_PERIPH_LPC0, //! \b SYSCTL_PERIPH_PECI0, \b SYSCTL_PERIPH_PWM0, \b SYSCTL_PERIPH_PWM1, //! \b SYSCTL_PERIPH_QEI0, \b SYSCTL_PERIPH_QEI1, \b SYSCTL_PERIPH_SSI0, //! \b SYSCTL_PERIPH_SSI1, \b SYSCTL_PERIPH_SSI2, \b SYSCTL_PERIPH_SSI3, //! \b SYSCTL_PERIPH_TIMER0, \b SYSCTL_PERIPH_TIMER1, \b SYSCTL_PERIPH_TIMER2, //! \b SYSCTL_PERIPH_TIMER3, \b SYSCTL_PERIPH_TIMER4, \b SYSCTL_PERIPH_TIMER5, //! \b SYSCTL_PERIPH_UART0, \b SYSCTL_PERIPH_UART1, \b SYSCTL_PERIPH_UART2, //! \b SYSCTL_PERIPH_UART3, \b SYSCTL_PERIPH_UART4, \b SYSCTL_PERIPH_UART5, //! \b SYSCTL_PERIPH_UART6, \b SYSCTL_PERIPH_UART7, \b SYSCTL_PERIPH_UDMA, //! \b SYSCTL_PERIPH_USB0, \b SYSCTL_PERIPH_WDOG0, \b SYSCTL_PERIPH_WDOG1, //! \b SYSCTL_PERIPH_WTIMER0, \b SYSCTL_PERIPH_WTIMER1, //! \b SYSCTL_PERIPH_WTIMER2, \b SYSCTL_PERIPH_WTIMER3, //! \b SYSCTL_PERIPH_WTIMER4, or \b SYSCTL_PERIPH_WTIMER5. //! //! \return None. // //*****************************************************************************
Enables a peripheral in sleep mode. \param ulPeripheral is the peripheral to enable in sleep mode. This function allows a peripheral to continue operating when the processor goes into sleep mode. Because the clocking configuration of the device does not change, any peripheral can safely continue operating while the processor is in sleep mode and can therefore wake the processor from sleep mode. Sleep mode clocking of peripherals must be enabled via SysCtlPeripheralClockGating(); if disabled, the peripheral sleep mode configuration is maintained but has no effect when sleep mode is entered. \return None.
[ "Enables", "a", "peripheral", "in", "sleep", "mode", ".", "\\", "param", "ulPeripheral", "is", "the", "peripheral", "to", "enable", "in", "sleep", "mode", ".", "This", "function", "allows", "a", "peripheral", "to", "continue", "operating", "when", "the", "processor", "goes", "into", "sleep", "mode", ".", "Because", "the", "clocking", "configuration", "of", "the", "device", "does", "not", "change", "any", "peripheral", "can", "safely", "continue", "operating", "while", "the", "processor", "is", "in", "sleep", "mode", "and", "can", "therefore", "wake", "the", "processor", "from", "sleep", "mode", ".", "Sleep", "mode", "clocking", "of", "peripherals", "must", "be", "enabled", "via", "SysCtlPeripheralClockGating", "()", ";", "if", "disabled", "the", "peripheral", "sleep", "mode", "configuration", "is", "maintained", "but", "has", "no", "effect", "when", "sleep", "mode", "is", "entered", ".", "\\", "return", "None", "." ]
void SysCtlPeripheralSleepEnable(unsigned long ulPeripheral) { ASSERT(SysCtlPeripheralValid(ulPeripheral)); if((ulPeripheral & 0xf0000000) == 0xf0000000) { HWREGBITW(SYSCTL_SCGCBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 1; } else { HWREG(g_pulSCGCRegs[SYSCTL_PERIPH_INDEX(ulPeripheral)]) |= SYSCTL_PERIPH_MASK(ulPeripheral); } }
[ "void", "SysCtlPeripheralSleepEnable", "(", "unsigned", "long", "ulPeripheral", ")", "{", "ASSERT", "(", "SysCtlPeripheralValid", "(", "ulPeripheral", ")", ")", ";", "if", "(", "(", "ulPeripheral", "&", "0xf0000000", ")", "==", "0xf0000000", ")", "{", "HWREGBITW", "(", "SYSCTL_SCGCBASE", "+", "(", "(", "ulPeripheral", "&", "0xff00", ")", ">>", "8", ")", ",", "ulPeripheral", "&", "0xff", ")", "=", "1", ";", "}", "else", "{", "HWREG", "(", "g_pulSCGCRegs", "[", "SYSCTL_PERIPH_INDEX", "(", "ulPeripheral", ")", "]", ")", "|=", "SYSCTL_PERIPH_MASK", "(", "ulPeripheral", ")", ";", "}", "}" ]
Enables a peripheral in sleep mode.
[ "Enables", "a", "peripheral", "in", "sleep", "mode", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// See if the peripheral index is 15, indicating a peripheral that is\r", "// accessed via the SYSCTL_SCGCperiph registers.\r", "//\r", "//\r", "// Enable this peripheral in sleep mode.\r", "//\r", "//\r", "// Enable this peripheral in sleep mode.\r", "//\r" ]
[ { "param": "ulPeripheral", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulPeripheral", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlPeripheralSleepDisable
void
void SysCtlPeripheralSleepDisable(unsigned long ulPeripheral) { // // Check the arguments. // ASSERT(SysCtlPeripheralValid(ulPeripheral)); // // See if the peripheral index is 15, indicating a peripheral that is // accessed via the SYSCTL_SCGCperiph registers. // if((ulPeripheral & 0xf0000000) == 0xf0000000) { // // Disable this peripheral in sleep mode. // HWREGBITW(SYSCTL_SCGCBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 0; } else { // // Disable this peripheral in sleep mode. // HWREG(g_pulSCGCRegs[SYSCTL_PERIPH_INDEX(ulPeripheral)]) &= ~SYSCTL_PERIPH_MASK(ulPeripheral); } }
//***************************************************************************** // //! Disables a peripheral in sleep mode. //! //! \param ulPeripheral is the peripheral to disable in sleep mode. //! //! This function causes a peripheral to stop operating when the processor goes //! into sleep mode. Disabling peripherals while in sleep mode helps to lower //! the current draw of the device. If enabled (via SysCtlPeripheralEnable()), //! the peripheral automatically resumes operation when the processor //! leaves sleep mode, maintaining its entire state from before sleep mode was //! entered. //! //! Sleep mode clocking of peripherals must be enabled via //! SysCtlPeripheralClockGating(); if disabled, the peripheral sleep mode //! configuration is maintained but has no effect when sleep mode is entered. //! //! The \e ulPeripheral parameter must be only one of the following values: //! \b SYSCTL_PERIPH_ADC0, \b SYSCTL_PERIPH_ADC1, \b SYSCTL_PERIPH_CAN0, //! \b SYSCTL_PERIPH_CAN1, \b SYSCTL_PERIPH_CAN2, \b SYSCTL_PERIPH_COMP0, //! \b SYSCTL_PERIPH_COMP1, \b SYSCTL_PERIPH_COMP2, \b SYSCTL_PERIPH_EEPROM0, //! \b SYSCTL_PERIPH_EPI0, \b SYSCTL_PERIPH_ETH, \b SYSCTL_PERIPH_FAN0, //! \b SYSCTL_PERIPH_GPIOA, \b SYSCTL_PERIPH_GPIOB, \b SYSCTL_PERIPH_GPIOC, //! \b SYSCTL_PERIPH_GPIOD, \b SYSCTL_PERIPH_GPIOE, \b SYSCTL_PERIPH_GPIOF, //! \b SYSCTL_PERIPH_GPIOG, \b SYSCTL_PERIPH_GPIOH, \b SYSCTL_PERIPH_GPIOJ, //! \b SYSCTL_PERIPH_GPIOK, \b SYSCTL_PERIPH_GPIOL, \b SYSCTL_PERIPH_GPIOM, //! \b SYSCTL_PERIPH_GPION, \b SYSCTL_PERIPH_GPIOP, \b SYSCTL_PERIPH_GPIOQ, //! \b SYSCTL_PERIPH_HIBERNATE, \b SYSCTL_PERIPH_I2C0, \b SYSCTL_PERIPH_I2C1, //! \b SYSCTL_PERIPH_I2C2, \b SYSCTL_PERIPH_I2C3, \b SYSCTL_PERIPH_I2C4, //! \b SYSCTL_PERIPH_I2C5, \b SYSCTL_PERIPH_I2S0, \b SYSCTL_PERIPH_LPC0, //! \b SYSCTL_PERIPH_PECI0, \b SYSCTL_PERIPH_PWM0, \b SYSCTL_PERIPH_PWM1, //! \b SYSCTL_PERIPH_QEI0, \b SYSCTL_PERIPH_QEI1, \b SYSCTL_PERIPH_SSI0, //! \b SYSCTL_PERIPH_SSI1, \b SYSCTL_PERIPH_SSI2, \b SYSCTL_PERIPH_SSI3, //! \b SYSCTL_PERIPH_TIMER0, \b SYSCTL_PERIPH_TIMER1, \b SYSCTL_PERIPH_TIMER2, //! \b SYSCTL_PERIPH_TIMER3, \b SYSCTL_PERIPH_TIMER4, \b SYSCTL_PERIPH_TIMER5, //! \b SYSCTL_PERIPH_UART0, \b SYSCTL_PERIPH_UART1, \b SYSCTL_PERIPH_UART2, //! \b SYSCTL_PERIPH_UART3, \b SYSCTL_PERIPH_UART4, \b SYSCTL_PERIPH_UART5, //! \b SYSCTL_PERIPH_UART6, \b SYSCTL_PERIPH_UART7, \b SYSCTL_PERIPH_UDMA, //! \b SYSCTL_PERIPH_USB0, \b SYSCTL_PERIPH_WDOG0, \b SYSCTL_PERIPH_WDOG1, //! \b SYSCTL_PERIPH_WTIMER0, \b SYSCTL_PERIPH_WTIMER1, //! \b SYSCTL_PERIPH_WTIMER2, \b SYSCTL_PERIPH_WTIMER3, //! \b SYSCTL_PERIPH_WTIMER4, or \b SYSCTL_PERIPH_WTIMER5. //! //! \return None. // //*****************************************************************************
Disables a peripheral in sleep mode. \param ulPeripheral is the peripheral to disable in sleep mode. This function causes a peripheral to stop operating when the processor goes into sleep mode. Disabling peripherals while in sleep mode helps to lower the current draw of the device. If enabled (via SysCtlPeripheralEnable()), the peripheral automatically resumes operation when the processor leaves sleep mode, maintaining its entire state from before sleep mode was entered. Sleep mode clocking of peripherals must be enabled via SysCtlPeripheralClockGating(); if disabled, the peripheral sleep mode configuration is maintained but has no effect when sleep mode is entered. \return None.
[ "Disables", "a", "peripheral", "in", "sleep", "mode", ".", "\\", "param", "ulPeripheral", "is", "the", "peripheral", "to", "disable", "in", "sleep", "mode", ".", "This", "function", "causes", "a", "peripheral", "to", "stop", "operating", "when", "the", "processor", "goes", "into", "sleep", "mode", ".", "Disabling", "peripherals", "while", "in", "sleep", "mode", "helps", "to", "lower", "the", "current", "draw", "of", "the", "device", ".", "If", "enabled", "(", "via", "SysCtlPeripheralEnable", "()", ")", "the", "peripheral", "automatically", "resumes", "operation", "when", "the", "processor", "leaves", "sleep", "mode", "maintaining", "its", "entire", "state", "from", "before", "sleep", "mode", "was", "entered", ".", "Sleep", "mode", "clocking", "of", "peripherals", "must", "be", "enabled", "via", "SysCtlPeripheralClockGating", "()", ";", "if", "disabled", "the", "peripheral", "sleep", "mode", "configuration", "is", "maintained", "but", "has", "no", "effect", "when", "sleep", "mode", "is", "entered", ".", "\\", "return", "None", "." ]
void SysCtlPeripheralSleepDisable(unsigned long ulPeripheral) { ASSERT(SysCtlPeripheralValid(ulPeripheral)); if((ulPeripheral & 0xf0000000) == 0xf0000000) { HWREGBITW(SYSCTL_SCGCBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 0; } else { HWREG(g_pulSCGCRegs[SYSCTL_PERIPH_INDEX(ulPeripheral)]) &= ~SYSCTL_PERIPH_MASK(ulPeripheral); } }
[ "void", "SysCtlPeripheralSleepDisable", "(", "unsigned", "long", "ulPeripheral", ")", "{", "ASSERT", "(", "SysCtlPeripheralValid", "(", "ulPeripheral", ")", ")", ";", "if", "(", "(", "ulPeripheral", "&", "0xf0000000", ")", "==", "0xf0000000", ")", "{", "HWREGBITW", "(", "SYSCTL_SCGCBASE", "+", "(", "(", "ulPeripheral", "&", "0xff00", ")", ">>", "8", ")", ",", "ulPeripheral", "&", "0xff", ")", "=", "0", ";", "}", "else", "{", "HWREG", "(", "g_pulSCGCRegs", "[", "SYSCTL_PERIPH_INDEX", "(", "ulPeripheral", ")", "]", ")", "&=", "~", "SYSCTL_PERIPH_MASK", "(", "ulPeripheral", ")", ";", "}", "}" ]
Disables a peripheral in sleep mode.
[ "Disables", "a", "peripheral", "in", "sleep", "mode", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// See if the peripheral index is 15, indicating a peripheral that is\r", "// accessed via the SYSCTL_SCGCperiph registers.\r", "//\r", "//\r", "// Disable this peripheral in sleep mode.\r", "//\r", "//\r", "// Disable this peripheral in sleep mode.\r", "//\r" ]
[ { "param": "ulPeripheral", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulPeripheral", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlPeripheralDeepSleepEnable
void
void SysCtlPeripheralDeepSleepEnable(unsigned long ulPeripheral) { // // Check the arguments. // ASSERT(SysCtlPeripheralValid(ulPeripheral)); // // See if the peripheral index is 15, indicating a peripheral that is // accessed via the SYSCTL_DCGCperiph registers. // if((ulPeripheral & 0xf0000000) == 0xf0000000) { // // Enable this peripheral in deep-sleep mode. // HWREGBITW(SYSCTL_DCGCBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 1; } else { // // Enable this peripheral in deep-sleep mode. // HWREG(g_pulDCGCRegs[SYSCTL_PERIPH_INDEX(ulPeripheral)]) |= SYSCTL_PERIPH_MASK(ulPeripheral); } }
//***************************************************************************** // //! Enables a peripheral in deep-sleep mode. //! //! \param ulPeripheral is the peripheral to enable in deep-sleep mode. //! //! This function allows a peripheral to continue operating when the processor //! goes into deep-sleep mode. Because the clocking configuration of the //! device may change, not all peripherals can safely continue operating while //! the processor is in sleep mode. Those that must run at a particular //! frequency (such as a UART) do not work as expected if the clock changes. //! It is the responsibility of the caller to make sensible choices. //! //! Deep-sleep mode clocking of peripherals must be enabled via //! SysCtlPeripheralClockGating(); if disabled, the peripheral deep-sleep mode //! configuration is maintained but has no effect when deep-sleep mode is //! entered. //! //! The \e ulPeripheral parameter must be only one of the following values: //! \b SYSCTL_PERIPH_ADC0, \b SYSCTL_PERIPH_ADC1, \b SYSCTL_PERIPH_CAN0, //! \b SYSCTL_PERIPH_CAN1, \b SYSCTL_PERIPH_CAN2, \b SYSCTL_PERIPH_COMP0, //! \b SYSCTL_PERIPH_COMP1, \b SYSCTL_PERIPH_COMP2, \b SYSCTL_PERIPH_EEPROM0, //! \b SYSCTL_PERIPH_EPI0, \b SYSCTL_PERIPH_ETH, \b SYSCTL_PERIPH_FAN0, //! \b SYSCTL_PERIPH_GPIOA, \b SYSCTL_PERIPH_GPIOB, \b SYSCTL_PERIPH_GPIOC, //! \b SYSCTL_PERIPH_GPIOD, \b SYSCTL_PERIPH_GPIOE, \b SYSCTL_PERIPH_GPIOF, //! \b SYSCTL_PERIPH_GPIOG, \b SYSCTL_PERIPH_GPIOH, \b SYSCTL_PERIPH_GPIOJ, //! \b SYSCTL_PERIPH_GPIOK, \b SYSCTL_PERIPH_GPIOL, \b SYSCTL_PERIPH_GPIOM, //! \b SYSCTL_PERIPH_GPION, \b SYSCTL_PERIPH_GPIOP, \b SYSCTL_PERIPH_GPIOQ, //! \b SYSCTL_PERIPH_HIBERNATE, \b SYSCTL_PERIPH_I2C0, \b SYSCTL_PERIPH_I2C1, //! \b SYSCTL_PERIPH_I2C2, \b SYSCTL_PERIPH_I2C3, \b SYSCTL_PERIPH_I2C4, //! \b SYSCTL_PERIPH_I2C5, \b SYSCTL_PERIPH_I2S0, \b SYSCTL_PERIPH_LPC0, //! \b SYSCTL_PERIPH_PECI0, \b SYSCTL_PERIPH_PWM0, \b SYSCTL_PERIPH_PWM1, //! \b SYSCTL_PERIPH_QEI0, \b SYSCTL_PERIPH_QEI1, \b SYSCTL_PERIPH_SSI0, //! \b SYSCTL_PERIPH_SSI1, \b SYSCTL_PERIPH_SSI2, \b SYSCTL_PERIPH_SSI3, //! \b SYSCTL_PERIPH_TIMER0, \b SYSCTL_PERIPH_TIMER1, \b SYSCTL_PERIPH_TIMER2, //! \b SYSCTL_PERIPH_TIMER3, \b SYSCTL_PERIPH_TIMER4, \b SYSCTL_PERIPH_TIMER5, //! \b SYSCTL_PERIPH_UART0, \b SYSCTL_PERIPH_UART1, \b SYSCTL_PERIPH_UART2, //! \b SYSCTL_PERIPH_UART3, \b SYSCTL_PERIPH_UART4, \b SYSCTL_PERIPH_UART5, //! \b SYSCTL_PERIPH_UART6, \b SYSCTL_PERIPH_UART7, \b SYSCTL_PERIPH_UDMA, //! \b SYSCTL_PERIPH_USB0, \b SYSCTL_PERIPH_WDOG0, \b SYSCTL_PERIPH_WDOG1, //! \b SYSCTL_PERIPH_WTIMER0, \b SYSCTL_PERIPH_WTIMER1, //! \b SYSCTL_PERIPH_WTIMER2, \b SYSCTL_PERIPH_WTIMER3, //! \b SYSCTL_PERIPH_WTIMER4, or \b SYSCTL_PERIPH_WTIMER5. //! //! \return None. // //*****************************************************************************
Enables a peripheral in deep-sleep mode. \param ulPeripheral is the peripheral to enable in deep-sleep mode. This function allows a peripheral to continue operating when the processor goes into deep-sleep mode. Because the clocking configuration of the device may change, not all peripherals can safely continue operating while the processor is in sleep mode. Those that must run at a particular frequency (such as a UART) do not work as expected if the clock changes. It is the responsibility of the caller to make sensible choices. Deep-sleep mode clocking of peripherals must be enabled via SysCtlPeripheralClockGating(); if disabled, the peripheral deep-sleep mode configuration is maintained but has no effect when deep-sleep mode is entered. \return None.
[ "Enables", "a", "peripheral", "in", "deep", "-", "sleep", "mode", ".", "\\", "param", "ulPeripheral", "is", "the", "peripheral", "to", "enable", "in", "deep", "-", "sleep", "mode", ".", "This", "function", "allows", "a", "peripheral", "to", "continue", "operating", "when", "the", "processor", "goes", "into", "deep", "-", "sleep", "mode", ".", "Because", "the", "clocking", "configuration", "of", "the", "device", "may", "change", "not", "all", "peripherals", "can", "safely", "continue", "operating", "while", "the", "processor", "is", "in", "sleep", "mode", ".", "Those", "that", "must", "run", "at", "a", "particular", "frequency", "(", "such", "as", "a", "UART", ")", "do", "not", "work", "as", "expected", "if", "the", "clock", "changes", ".", "It", "is", "the", "responsibility", "of", "the", "caller", "to", "make", "sensible", "choices", ".", "Deep", "-", "sleep", "mode", "clocking", "of", "peripherals", "must", "be", "enabled", "via", "SysCtlPeripheralClockGating", "()", ";", "if", "disabled", "the", "peripheral", "deep", "-", "sleep", "mode", "configuration", "is", "maintained", "but", "has", "no", "effect", "when", "deep", "-", "sleep", "mode", "is", "entered", ".", "\\", "return", "None", "." ]
void SysCtlPeripheralDeepSleepEnable(unsigned long ulPeripheral) { ASSERT(SysCtlPeripheralValid(ulPeripheral)); if((ulPeripheral & 0xf0000000) == 0xf0000000) { HWREGBITW(SYSCTL_DCGCBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 1; } else { HWREG(g_pulDCGCRegs[SYSCTL_PERIPH_INDEX(ulPeripheral)]) |= SYSCTL_PERIPH_MASK(ulPeripheral); } }
[ "void", "SysCtlPeripheralDeepSleepEnable", "(", "unsigned", "long", "ulPeripheral", ")", "{", "ASSERT", "(", "SysCtlPeripheralValid", "(", "ulPeripheral", ")", ")", ";", "if", "(", "(", "ulPeripheral", "&", "0xf0000000", ")", "==", "0xf0000000", ")", "{", "HWREGBITW", "(", "SYSCTL_DCGCBASE", "+", "(", "(", "ulPeripheral", "&", "0xff00", ")", ">>", "8", ")", ",", "ulPeripheral", "&", "0xff", ")", "=", "1", ";", "}", "else", "{", "HWREG", "(", "g_pulDCGCRegs", "[", "SYSCTL_PERIPH_INDEX", "(", "ulPeripheral", ")", "]", ")", "|=", "SYSCTL_PERIPH_MASK", "(", "ulPeripheral", ")", ";", "}", "}" ]
Enables a peripheral in deep-sleep mode.
[ "Enables", "a", "peripheral", "in", "deep", "-", "sleep", "mode", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// See if the peripheral index is 15, indicating a peripheral that is\r", "// accessed via the SYSCTL_DCGCperiph registers.\r", "//\r", "//\r", "// Enable this peripheral in deep-sleep mode.\r", "//\r", "//\r", "// Enable this peripheral in deep-sleep mode.\r", "//\r" ]
[ { "param": "ulPeripheral", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulPeripheral", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlPeripheralDeepSleepDisable
void
void SysCtlPeripheralDeepSleepDisable(unsigned long ulPeripheral) { // // Check the arguments. // ASSERT(SysCtlPeripheralValid(ulPeripheral)); // // See if the peripheral index is 15, indicating a peripheral that is // accessed via the SYSCTL_DCGCperiph registers. // if((ulPeripheral & 0xf0000000) == 0xf0000000) { // // Disable this peripheral in deep-sleep mode. // HWREGBITW(SYSCTL_DCGCBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 0; } else { // // Disable this peripheral in deep-sleep mode. // HWREG(g_pulDCGCRegs[SYSCTL_PERIPH_INDEX(ulPeripheral)]) &= ~SYSCTL_PERIPH_MASK(ulPeripheral); } }
//***************************************************************************** // //! Disables a peripheral in deep-sleep mode. //! //! \param ulPeripheral is the peripheral to disable in deep-sleep mode. //! //! This function causes a peripheral to stop operating when the processor goes //! into deep-sleep mode. Disabling peripherals while in deep-sleep mode helps //! to lower the current draw of the device, and can keep peripherals that //! require a particular clock frequency from operating when the clock changes //! as a result of entering deep-sleep mode. If enabled (via //! SysCtlPeripheralEnable()), the peripheral automatically resumes //! operation when the processor leaves deep-sleep mode, maintaining its entire //! state from before deep-sleep mode was entered. //! //! Deep-sleep mode clocking of peripherals must be enabled via //! SysCtlPeripheralClockGating(); if disabled, the peripheral deep-sleep mode //! configuration is maintained but has no effect when deep-sleep mode is //! entered. //! //! The \e ulPeripheral parameter must be only one of the following values: //! \b SYSCTL_PERIPH_ADC0, \b SYSCTL_PERIPH_ADC1, \b SYSCTL_PERIPH_CAN0, //! \b SYSCTL_PERIPH_CAN1, \b SYSCTL_PERIPH_CAN2, \b SYSCTL_PERIPH_COMP0, //! \b SYSCTL_PERIPH_COMP1, \b SYSCTL_PERIPH_COMP2, \b SYSCTL_PERIPH_EEPROM0, //! \b SYSCTL_PERIPH_EPI0, \b SYSCTL_PERIPH_ETH, \b SYSCTL_PERIPH_FAN0, //! \b SYSCTL_PERIPH_GPIOA, \b SYSCTL_PERIPH_GPIOB, \b SYSCTL_PERIPH_GPIOC, //! \b SYSCTL_PERIPH_GPIOD, \b SYSCTL_PERIPH_GPIOE, \b SYSCTL_PERIPH_GPIOF, //! \b SYSCTL_PERIPH_GPIOG, \b SYSCTL_PERIPH_GPIOH, \b SYSCTL_PERIPH_GPIOJ, //! \b SYSCTL_PERIPH_GPIOK, \b SYSCTL_PERIPH_GPIOL, \b SYSCTL_PERIPH_GPIOM, //! \b SYSCTL_PERIPH_GPION, \b SYSCTL_PERIPH_GPIOP, \b SYSCTL_PERIPH_GPIOQ, //! \b SYSCTL_PERIPH_HIBERNATE, \b SYSCTL_PERIPH_I2C0, \b SYSCTL_PERIPH_I2C1, //! \b SYSCTL_PERIPH_I2C2, \b SYSCTL_PERIPH_I2C3, \b SYSCTL_PERIPH_I2C4, //! \b SYSCTL_PERIPH_I2C5, \b SYSCTL_PERIPH_I2S0, \b SYSCTL_PERIPH_LPC0, //! \b SYSCTL_PERIPH_PECI0, \b SYSCTL_PERIPH_PWM0, \b SYSCTL_PERIPH_PWM1, //! \b SYSCTL_PERIPH_QEI0, \b SYSCTL_PERIPH_QEI1, \b SYSCTL_PERIPH_SSI0, //! \b SYSCTL_PERIPH_SSI1, \b SYSCTL_PERIPH_SSI2, \b SYSCTL_PERIPH_SSI3, //! \b SYSCTL_PERIPH_TIMER0, \b SYSCTL_PERIPH_TIMER1, \b SYSCTL_PERIPH_TIMER2, //! \b SYSCTL_PERIPH_TIMER3, \b SYSCTL_PERIPH_TIMER4, \b SYSCTL_PERIPH_TIMER5, //! \b SYSCTL_PERIPH_UART0, \b SYSCTL_PERIPH_UART1, \b SYSCTL_PERIPH_UART2, //! \b SYSCTL_PERIPH_UART3, \b SYSCTL_PERIPH_UART4, \b SYSCTL_PERIPH_UART5, //! \b SYSCTL_PERIPH_UART6, \b SYSCTL_PERIPH_UART7, \b SYSCTL_PERIPH_UDMA, //! \b SYSCTL_PERIPH_USB0, \b SYSCTL_PERIPH_WDOG0, \b SYSCTL_PERIPH_WDOG1, //! \b SYSCTL_PERIPH_WTIMER0, \b SYSCTL_PERIPH_WTIMER1, //! \b SYSCTL_PERIPH_WTIMER2, \b SYSCTL_PERIPH_WTIMER3, //! \b SYSCTL_PERIPH_WTIMER4, or \b SYSCTL_PERIPH_WTIMER5. //! //! \return None. // //*****************************************************************************
Disables a peripheral in deep-sleep mode. \param ulPeripheral is the peripheral to disable in deep-sleep mode. This function causes a peripheral to stop operating when the processor goes into deep-sleep mode. Disabling peripherals while in deep-sleep mode helps to lower the current draw of the device, and can keep peripherals that require a particular clock frequency from operating when the clock changes as a result of entering deep-sleep mode. If enabled (via SysCtlPeripheralEnable()), the peripheral automatically resumes operation when the processor leaves deep-sleep mode, maintaining its entire state from before deep-sleep mode was entered. Deep-sleep mode clocking of peripherals must be enabled via SysCtlPeripheralClockGating(); if disabled, the peripheral deep-sleep mode configuration is maintained but has no effect when deep-sleep mode is entered. \return None.
[ "Disables", "a", "peripheral", "in", "deep", "-", "sleep", "mode", ".", "\\", "param", "ulPeripheral", "is", "the", "peripheral", "to", "disable", "in", "deep", "-", "sleep", "mode", ".", "This", "function", "causes", "a", "peripheral", "to", "stop", "operating", "when", "the", "processor", "goes", "into", "deep", "-", "sleep", "mode", ".", "Disabling", "peripherals", "while", "in", "deep", "-", "sleep", "mode", "helps", "to", "lower", "the", "current", "draw", "of", "the", "device", "and", "can", "keep", "peripherals", "that", "require", "a", "particular", "clock", "frequency", "from", "operating", "when", "the", "clock", "changes", "as", "a", "result", "of", "entering", "deep", "-", "sleep", "mode", ".", "If", "enabled", "(", "via", "SysCtlPeripheralEnable", "()", ")", "the", "peripheral", "automatically", "resumes", "operation", "when", "the", "processor", "leaves", "deep", "-", "sleep", "mode", "maintaining", "its", "entire", "state", "from", "before", "deep", "-", "sleep", "mode", "was", "entered", ".", "Deep", "-", "sleep", "mode", "clocking", "of", "peripherals", "must", "be", "enabled", "via", "SysCtlPeripheralClockGating", "()", ";", "if", "disabled", "the", "peripheral", "deep", "-", "sleep", "mode", "configuration", "is", "maintained", "but", "has", "no", "effect", "when", "deep", "-", "sleep", "mode", "is", "entered", ".", "\\", "return", "None", "." ]
void SysCtlPeripheralDeepSleepDisable(unsigned long ulPeripheral) { ASSERT(SysCtlPeripheralValid(ulPeripheral)); if((ulPeripheral & 0xf0000000) == 0xf0000000) { HWREGBITW(SYSCTL_DCGCBASE + ((ulPeripheral & 0xff00) >> 8), ulPeripheral & 0xff) = 0; } else { HWREG(g_pulDCGCRegs[SYSCTL_PERIPH_INDEX(ulPeripheral)]) &= ~SYSCTL_PERIPH_MASK(ulPeripheral); } }
[ "void", "SysCtlPeripheralDeepSleepDisable", "(", "unsigned", "long", "ulPeripheral", ")", "{", "ASSERT", "(", "SysCtlPeripheralValid", "(", "ulPeripheral", ")", ")", ";", "if", "(", "(", "ulPeripheral", "&", "0xf0000000", ")", "==", "0xf0000000", ")", "{", "HWREGBITW", "(", "SYSCTL_DCGCBASE", "+", "(", "(", "ulPeripheral", "&", "0xff00", ")", ">>", "8", ")", ",", "ulPeripheral", "&", "0xff", ")", "=", "0", ";", "}", "else", "{", "HWREG", "(", "g_pulDCGCRegs", "[", "SYSCTL_PERIPH_INDEX", "(", "ulPeripheral", ")", "]", ")", "&=", "~", "SYSCTL_PERIPH_MASK", "(", "ulPeripheral", ")", ";", "}", "}" ]
Disables a peripheral in deep-sleep mode.
[ "Disables", "a", "peripheral", "in", "deep", "-", "sleep", "mode", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// See if the peripheral index is 15, indicating a peripheral that is\r", "// accessed via the SYSCTL_DCGCperiph registers.\r", "//\r", "//\r", "// Disable this peripheral in deep-sleep mode.\r", "//\r", "//\r", "// Disable this peripheral in deep-sleep mode.\r", "//\r" ]
[ { "param": "ulPeripheral", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulPeripheral", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlPeripheralClockGating
void
void SysCtlPeripheralClockGating(tBoolean bEnable) { // // Enable peripheral clock gating as requested. // if(bEnable) { HWREG(SYSCTL_RCC) |= SYSCTL_RCC_ACG; } else { HWREG(SYSCTL_RCC) &= ~(SYSCTL_RCC_ACG); } }
//***************************************************************************** // //! Controls peripheral clock gating in sleep and deep-sleep mode. //! //! \param bEnable is a boolean that is \b true if the sleep and deep-sleep //! peripheral configuration should be used and \b false if not. //! //! This function controls how peripherals are clocked when the processor goes //! into sleep or deep-sleep mode. By default, the peripherals are clocked the //! same as in run mode; if peripheral clock gating is enabled, they are //! clocked according to the configuration set by //! SysCtlPeripheralSleepEnable(), SysCtlPeripheralSleepDisable(), //! SysCtlPeripheralDeepSleepEnable(), and SysCtlPeripheralDeepSleepDisable(). //! //! \return None. // //*****************************************************************************
Controls peripheral clock gating in sleep and deep-sleep mode. \param bEnable is a boolean that is \b true if the sleep and deep-sleep peripheral configuration should be used and \b false if not. This function controls how peripherals are clocked when the processor goes into sleep or deep-sleep mode. By default, the peripherals are clocked the same as in run mode; if peripheral clock gating is enabled, they are clocked according to the configuration set by SysCtlPeripheralSleepEnable(), SysCtlPeripheralSleepDisable(), SysCtlPeripheralDeepSleepEnable(), and SysCtlPeripheralDeepSleepDisable(). \return None.
[ "Controls", "peripheral", "clock", "gating", "in", "sleep", "and", "deep", "-", "sleep", "mode", ".", "\\", "param", "bEnable", "is", "a", "boolean", "that", "is", "\\", "b", "true", "if", "the", "sleep", "and", "deep", "-", "sleep", "peripheral", "configuration", "should", "be", "used", "and", "\\", "b", "false", "if", "not", ".", "This", "function", "controls", "how", "peripherals", "are", "clocked", "when", "the", "processor", "goes", "into", "sleep", "or", "deep", "-", "sleep", "mode", ".", "By", "default", "the", "peripherals", "are", "clocked", "the", "same", "as", "in", "run", "mode", ";", "if", "peripheral", "clock", "gating", "is", "enabled", "they", "are", "clocked", "according", "to", "the", "configuration", "set", "by", "SysCtlPeripheralSleepEnable", "()", "SysCtlPeripheralSleepDisable", "()", "SysCtlPeripheralDeepSleepEnable", "()", "and", "SysCtlPeripheralDeepSleepDisable", "()", ".", "\\", "return", "None", "." ]
void SysCtlPeripheralClockGating(tBoolean bEnable) { if(bEnable) { HWREG(SYSCTL_RCC) |= SYSCTL_RCC_ACG; } else { HWREG(SYSCTL_RCC) &= ~(SYSCTL_RCC_ACG); } }
[ "void", "SysCtlPeripheralClockGating", "(", "tBoolean", "bEnable", ")", "{", "if", "(", "bEnable", ")", "{", "HWREG", "(", "SYSCTL_RCC", ")", "|=", "SYSCTL_RCC_ACG", ";", "}", "else", "{", "HWREG", "(", "SYSCTL_RCC", ")", "&=", "~", "(", "SYSCTL_RCC_ACG", ")", ";", "}", "}" ]
Controls peripheral clock gating in sleep and deep-sleep mode.
[ "Controls", "peripheral", "clock", "gating", "in", "sleep", "and", "deep", "-", "sleep", "mode", "." ]
[ "//\r", "// Enable peripheral clock gating as requested.\r", "//\r" ]
[ { "param": "bEnable", "type": "tBoolean" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bEnable", "type": "tBoolean", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlIntRegister
void
void SysCtlIntRegister(void (*pfnHandler)(void)) { // // Register the interrupt handler, returning an error if an error occurs. // IntRegister(INT_SYSCTL, pfnHandler); // // Enable the system control interrupt. // IntEnable(INT_SYSCTL); }
//***************************************************************************** // //! Registers an interrupt handler for the system control interrupt. //! //! \param pfnHandler is a pointer to the function to be called when the system //! control interrupt occurs. //! //! This function registers the handler to be called when a system control //! interrupt occurs. This function enables the global interrupt in the //! interrupt controller; specific system control interrupts must be enabled //! via SysCtlIntEnable(). It is the interrupt handler's responsibility to //! clear the interrupt source via SysCtlIntClear(). //! //! System control can generate interrupts when the PLL achieves lock, if the //! internal LDO current limit is exceeded, if the internal oscillator fails, //! if the main oscillator fails, if the internal LDO output voltage droops too //! much, if the external voltage droops too much, or if the PLL fails. //! //! \sa IntRegister() for important information about registering interrupt //! handlers. //! //! \note The events that cause system control interrupts vary based on the //! Stellaris part in use. Please consult the data sheet for the part you are //! using to determine which interrupt sources are available. //! //! \return None. // //*****************************************************************************
Registers an interrupt handler for the system control interrupt. \param pfnHandler is a pointer to the function to be called when the system control interrupt occurs. This function registers the handler to be called when a system control interrupt occurs. This function enables the global interrupt in the interrupt controller; specific system control interrupts must be enabled via SysCtlIntEnable(). It is the interrupt handler's responsibility to clear the interrupt source via SysCtlIntClear(). System control can generate interrupts when the PLL achieves lock, if the internal LDO current limit is exceeded, if the internal oscillator fails, if the main oscillator fails, if the internal LDO output voltage droops too much, if the external voltage droops too much, or if the PLL fails. \sa IntRegister() for important information about registering interrupt handlers. \note The events that cause system control interrupts vary based on the Stellaris part in use. Please consult the data sheet for the part you are using to determine which interrupt sources are available. \return None.
[ "Registers", "an", "interrupt", "handler", "for", "the", "system", "control", "interrupt", ".", "\\", "param", "pfnHandler", "is", "a", "pointer", "to", "the", "function", "to", "be", "called", "when", "the", "system", "control", "interrupt", "occurs", ".", "This", "function", "registers", "the", "handler", "to", "be", "called", "when", "a", "system", "control", "interrupt", "occurs", ".", "This", "function", "enables", "the", "global", "interrupt", "in", "the", "interrupt", "controller", ";", "specific", "system", "control", "interrupts", "must", "be", "enabled", "via", "SysCtlIntEnable", "()", ".", "It", "is", "the", "interrupt", "handler", "'", "s", "responsibility", "to", "clear", "the", "interrupt", "source", "via", "SysCtlIntClear", "()", ".", "System", "control", "can", "generate", "interrupts", "when", "the", "PLL", "achieves", "lock", "if", "the", "internal", "LDO", "current", "limit", "is", "exceeded", "if", "the", "internal", "oscillator", "fails", "if", "the", "main", "oscillator", "fails", "if", "the", "internal", "LDO", "output", "voltage", "droops", "too", "much", "if", "the", "external", "voltage", "droops", "too", "much", "or", "if", "the", "PLL", "fails", ".", "\\", "sa", "IntRegister", "()", "for", "important", "information", "about", "registering", "interrupt", "handlers", ".", "\\", "note", "The", "events", "that", "cause", "system", "control", "interrupts", "vary", "based", "on", "the", "Stellaris", "part", "in", "use", ".", "Please", "consult", "the", "data", "sheet", "for", "the", "part", "you", "are", "using", "to", "determine", "which", "interrupt", "sources", "are", "available", ".", "\\", "return", "None", "." ]
void SysCtlIntRegister(void (*pfnHandler)(void)) { IntRegister(INT_SYSCTL, pfnHandler); IntEnable(INT_SYSCTL); }
[ "void", "SysCtlIntRegister", "(", "void", "(", "*", "pfnHandler", ")", "(", "void", ")", ")", "{", "IntRegister", "(", "INT_SYSCTL", ",", "pfnHandler", ")", ";", "IntEnable", "(", "INT_SYSCTL", ")", ";", "}" ]
Registers an interrupt handler for the system control interrupt.
[ "Registers", "an", "interrupt", "handler", "for", "the", "system", "control", "interrupt", "." ]
[ "//\r", "// Register the interrupt handler, returning an error if an error occurs.\r", "//\r", "//\r", "// Enable the system control interrupt.\r", "//\r" ]
[ { "param": "pfnHandler", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pfnHandler", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlIntUnregister
void
void SysCtlIntUnregister(void) { // // Disable the interrupt. // IntDisable(INT_SYSCTL); // // Unregister the interrupt handler. // IntUnregister(INT_SYSCTL); }
//***************************************************************************** // //! Unregisters the interrupt handler for the system control interrupt. //! //! This function unregisters the handler to be called when a system control //! interrupt occurs. This function also masks off the interrupt in the //! interrupt controller so that the interrupt handler no longer is called. //! //! \sa IntRegister() for important information about registering interrupt //! handlers. //! //! \return None. // //*****************************************************************************
Unregisters the interrupt handler for the system control interrupt. This function unregisters the handler to be called when a system control interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler no longer is called. \sa IntRegister() for important information about registering interrupt handlers. \return None.
[ "Unregisters", "the", "interrupt", "handler", "for", "the", "system", "control", "interrupt", ".", "This", "function", "unregisters", "the", "handler", "to", "be", "called", "when", "a", "system", "control", "interrupt", "occurs", ".", "This", "function", "also", "masks", "off", "the", "interrupt", "in", "the", "interrupt", "controller", "so", "that", "the", "interrupt", "handler", "no", "longer", "is", "called", ".", "\\", "sa", "IntRegister", "()", "for", "important", "information", "about", "registering", "interrupt", "handlers", ".", "\\", "return", "None", "." ]
void SysCtlIntUnregister(void) { IntDisable(INT_SYSCTL); IntUnregister(INT_SYSCTL); }
[ "void", "SysCtlIntUnregister", "(", "void", ")", "{", "IntDisable", "(", "INT_SYSCTL", ")", ";", "IntUnregister", "(", "INT_SYSCTL", ")", ";", "}" ]
Unregisters the interrupt handler for the system control interrupt.
[ "Unregisters", "the", "interrupt", "handler", "for", "the", "system", "control", "interrupt", "." ]
[ "//\r", "// Disable the interrupt.\r", "//\r", "//\r", "// Unregister the interrupt handler.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlIntEnable
void
void SysCtlIntEnable(unsigned long ulInts) { // // Enable the specified interrupts. // HWREG(SYSCTL_IMC) |= ulInts; }
//***************************************************************************** // //! Enables individual system control interrupt sources. //! //! \param ulInts is a bit mask of the interrupt sources to be enabled. Must //! be a logical OR of \b SYSCTL_INT_PLL_LOCK, \b SYSCTL_INT_CUR_LIMIT, //! \b SYSCTL_INT_IOSC_FAIL, \b SYSCTL_INT_MOSC_FAIL, \b SYSCTL_INT_POR, //! \b SYSCTL_INT_BOR, and/or \b SYSCTL_INT_PLL_FAIL. //! //! This function enables the indicated system control interrupt sources. Only //! the sources that are enabled can be reflected to the processor interrupt; //! disabled sources have no effect on the processor. //! //! \note The interrupt sources vary based on the Stellaris part in use. //! Please consult the data sheet for the part you are using to determine //! which interrupt sources are available. //! //! \return None. // //*****************************************************************************
Enables individual system control interrupt sources. \param ulInts is a bit mask of the interrupt sources to be enabled. This function enables the indicated system control interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor. \note The interrupt sources vary based on the Stellaris part in use. Please consult the data sheet for the part you are using to determine which interrupt sources are available. \return None.
[ "Enables", "individual", "system", "control", "interrupt", "sources", ".", "\\", "param", "ulInts", "is", "a", "bit", "mask", "of", "the", "interrupt", "sources", "to", "be", "enabled", ".", "This", "function", "enables", "the", "indicated", "system", "control", "interrupt", "sources", ".", "Only", "the", "sources", "that", "are", "enabled", "can", "be", "reflected", "to", "the", "processor", "interrupt", ";", "disabled", "sources", "have", "no", "effect", "on", "the", "processor", ".", "\\", "note", "The", "interrupt", "sources", "vary", "based", "on", "the", "Stellaris", "part", "in", "use", ".", "Please", "consult", "the", "data", "sheet", "for", "the", "part", "you", "are", "using", "to", "determine", "which", "interrupt", "sources", "are", "available", ".", "\\", "return", "None", "." ]
void SysCtlIntEnable(unsigned long ulInts) { HWREG(SYSCTL_IMC) |= ulInts; }
[ "void", "SysCtlIntEnable", "(", "unsigned", "long", "ulInts", ")", "{", "HWREG", "(", "SYSCTL_IMC", ")", "|=", "ulInts", ";", "}" ]
Enables individual system control interrupt sources.
[ "Enables", "individual", "system", "control", "interrupt", "sources", "." ]
[ "//\r", "// Enable the specified interrupts.\r", "//\r" ]
[ { "param": "ulInts", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulInts", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlIntDisable
void
void SysCtlIntDisable(unsigned long ulInts) { // // Disable the specified interrupts. // HWREG(SYSCTL_IMC) &= ~(ulInts); }
//***************************************************************************** // //! Disables individual system control interrupt sources. //! //! \param ulInts is a bit mask of the interrupt sources to be disabled. Must //! be a logical OR of \b SYSCTL_INT_PLL_LOCK, \b SYSCTL_INT_CUR_LIMIT, //! \b SYSCTL_INT_IOSC_FAIL, \b SYSCTL_INT_MOSC_FAIL, \b SYSCTL_INT_POR, //! \b SYSCTL_INT_BOR, and/or \b SYSCTL_INT_PLL_FAIL. //! //! This function disables the indicated system control interrupt sources. //! Only the sources that are enabled can be reflected to the processor //! interrupt; disabled sources have no effect on the processor. //! //! \note The interrupt sources vary based on the Stellaris part in use. //! Please consult the data sheet for the part you are using to determine //! which interrupt sources are available. //! //! \return None. // //*****************************************************************************
Disables individual system control interrupt sources. \param ulInts is a bit mask of the interrupt sources to be disabled. This function disables the indicated system control interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor. \note The interrupt sources vary based on the Stellaris part in use. Please consult the data sheet for the part you are using to determine which interrupt sources are available. \return None.
[ "Disables", "individual", "system", "control", "interrupt", "sources", ".", "\\", "param", "ulInts", "is", "a", "bit", "mask", "of", "the", "interrupt", "sources", "to", "be", "disabled", ".", "This", "function", "disables", "the", "indicated", "system", "control", "interrupt", "sources", ".", "Only", "the", "sources", "that", "are", "enabled", "can", "be", "reflected", "to", "the", "processor", "interrupt", ";", "disabled", "sources", "have", "no", "effect", "on", "the", "processor", ".", "\\", "note", "The", "interrupt", "sources", "vary", "based", "on", "the", "Stellaris", "part", "in", "use", ".", "Please", "consult", "the", "data", "sheet", "for", "the", "part", "you", "are", "using", "to", "determine", "which", "interrupt", "sources", "are", "available", ".", "\\", "return", "None", "." ]
void SysCtlIntDisable(unsigned long ulInts) { HWREG(SYSCTL_IMC) &= ~(ulInts); }
[ "void", "SysCtlIntDisable", "(", "unsigned", "long", "ulInts", ")", "{", "HWREG", "(", "SYSCTL_IMC", ")", "&=", "~", "(", "ulInts", ")", ";", "}" ]
Disables individual system control interrupt sources.
[ "Disables", "individual", "system", "control", "interrupt", "sources", "." ]
[ "//\r", "// Disable the specified interrupts.\r", "//\r" ]
[ { "param": "ulInts", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulInts", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlIntClear
void
void SysCtlIntClear(unsigned long ulInts) { // // Clear the requested interrupt sources. // HWREG(SYSCTL_MISC) = ulInts; }
//***************************************************************************** // //! Clears system control interrupt sources. //! //! \param ulInts is a bit mask of the interrupt sources to be cleared. Must //! be a logical OR of \b SYSCTL_INT_PLL_LOCK, \b SYSCTL_INT_CUR_LIMIT, //! \b SYSCTL_INT_IOSC_FAIL, \b SYSCTL_INT_MOSC_FAIL, \b SYSCTL_INT_POR, //! \b SYSCTL_INT_BOR, and/or \b SYSCTL_INT_PLL_FAIL. //! //! The specified system control interrupt sources are cleared, so that they no //! longer assert. This function must be called in the interrupt handler to //! keep it from being called again immediately upon exit. //! //! \note Because there is a write buffer in the Cortex-M processor, it may //! take several clock cycles before the interrupt source is actually cleared. //! Therefore, it is recommended that the interrupt source be cleared early in //! the interrupt handler (as opposed to the very last action) to avoid //! returning from the interrupt handler before the interrupt source is //! actually cleared. Failure to do so may result in the interrupt handler //! being immediately reentered (because the interrupt controller still sees //! the interrupt source asserted). //! //! \note The interrupt sources vary based on the Stellaris part in use. //! Please consult the data sheet for the part you are using to determine //! which interrupt sources are available. //! //! \return None. // //*****************************************************************************
Clears system control interrupt sources. \param ulInts is a bit mask of the interrupt sources to be cleared. The specified system control interrupt sources are cleared, so that they no longer assert. This function must be called in the interrupt handler to keep it from being called again immediately upon exit. \note Because there is a write buffer in the Cortex-M processor, it may take several clock cycles before the interrupt source is actually cleared. Therefore, it is recommended that the interrupt source be cleared early in the interrupt handler (as opposed to the very last action) to avoid returning from the interrupt handler before the interrupt source is actually cleared. Failure to do so may result in the interrupt handler being immediately reentered (because the interrupt controller still sees the interrupt source asserted). \note The interrupt sources vary based on the Stellaris part in use. Please consult the data sheet for the part you are using to determine which interrupt sources are available. \return None.
[ "Clears", "system", "control", "interrupt", "sources", ".", "\\", "param", "ulInts", "is", "a", "bit", "mask", "of", "the", "interrupt", "sources", "to", "be", "cleared", ".", "The", "specified", "system", "control", "interrupt", "sources", "are", "cleared", "so", "that", "they", "no", "longer", "assert", ".", "This", "function", "must", "be", "called", "in", "the", "interrupt", "handler", "to", "keep", "it", "from", "being", "called", "again", "immediately", "upon", "exit", ".", "\\", "note", "Because", "there", "is", "a", "write", "buffer", "in", "the", "Cortex", "-", "M", "processor", "it", "may", "take", "several", "clock", "cycles", "before", "the", "interrupt", "source", "is", "actually", "cleared", ".", "Therefore", "it", "is", "recommended", "that", "the", "interrupt", "source", "be", "cleared", "early", "in", "the", "interrupt", "handler", "(", "as", "opposed", "to", "the", "very", "last", "action", ")", "to", "avoid", "returning", "from", "the", "interrupt", "handler", "before", "the", "interrupt", "source", "is", "actually", "cleared", ".", "Failure", "to", "do", "so", "may", "result", "in", "the", "interrupt", "handler", "being", "immediately", "reentered", "(", "because", "the", "interrupt", "controller", "still", "sees", "the", "interrupt", "source", "asserted", ")", ".", "\\", "note", "The", "interrupt", "sources", "vary", "based", "on", "the", "Stellaris", "part", "in", "use", ".", "Please", "consult", "the", "data", "sheet", "for", "the", "part", "you", "are", "using", "to", "determine", "which", "interrupt", "sources", "are", "available", ".", "\\", "return", "None", "." ]
void SysCtlIntClear(unsigned long ulInts) { HWREG(SYSCTL_MISC) = ulInts; }
[ "void", "SysCtlIntClear", "(", "unsigned", "long", "ulInts", ")", "{", "HWREG", "(", "SYSCTL_MISC", ")", "=", "ulInts", ";", "}" ]
Clears system control interrupt sources.
[ "Clears", "system", "control", "interrupt", "sources", "." ]
[ "//\r", "// Clear the requested interrupt sources.\r", "//\r" ]
[ { "param": "ulInts", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulInts", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlIntStatus
null
unsigned long SysCtlIntStatus(tBoolean bMasked) { // // Return either the interrupt status or the raw interrupt status as // requested. // if(bMasked) { return(HWREG(SYSCTL_MISC)); } else { return(HWREG(SYSCTL_RIS)); } }
//***************************************************************************** // //! Gets the current interrupt status. //! //! \param bMasked is false if the raw interrupt status is required and true if //! the masked interrupt status is required. //! //! This function returns the interrupt status for the system controller. //! Either the raw interrupt status or the status of interrupts that are //! allowed to reflect to the processor can be returned. //! //! \return The current interrupt status, enumerated as a bit field of //! \b SYSCTL_INT_PLL_LOCK, \b SYSCTL_INT_CUR_LIMIT, \b SYSCTL_INT_IOSC_FAIL, //! \b SYSCTL_INT_MOSC_FAIL, \b SYSCTL_INT_POR, \b SYSCTL_INT_BOR, and //! \b SYSCTL_INT_PLL_FAIL. //! //! \note The interrupt sources vary based on the Stellaris part in use. //! Please consult the data sheet for the part you are using to determine //! which interrupt sources are available. // //*****************************************************************************
Gets the current interrupt status. \param bMasked is false if the raw interrupt status is required and true if the masked interrupt status is required. This function returns the interrupt status for the system controller. Either the raw interrupt status or the status of interrupts that are allowed to reflect to the processor can be returned. \note The interrupt sources vary based on the Stellaris part in use. Please consult the data sheet for the part you are using to determine which interrupt sources are available.
[ "Gets", "the", "current", "interrupt", "status", ".", "\\", "param", "bMasked", "is", "false", "if", "the", "raw", "interrupt", "status", "is", "required", "and", "true", "if", "the", "masked", "interrupt", "status", "is", "required", ".", "This", "function", "returns", "the", "interrupt", "status", "for", "the", "system", "controller", ".", "Either", "the", "raw", "interrupt", "status", "or", "the", "status", "of", "interrupts", "that", "are", "allowed", "to", "reflect", "to", "the", "processor", "can", "be", "returned", ".", "\\", "note", "The", "interrupt", "sources", "vary", "based", "on", "the", "Stellaris", "part", "in", "use", ".", "Please", "consult", "the", "data", "sheet", "for", "the", "part", "you", "are", "using", "to", "determine", "which", "interrupt", "sources", "are", "available", "." ]
unsigned long SysCtlIntStatus(tBoolean bMasked) { if(bMasked) { return(HWREG(SYSCTL_MISC)); } else { return(HWREG(SYSCTL_RIS)); } }
[ "unsigned", "long", "SysCtlIntStatus", "(", "tBoolean", "bMasked", ")", "{", "if", "(", "bMasked", ")", "{", "return", "(", "HWREG", "(", "SYSCTL_MISC", ")", ")", ";", "}", "else", "{", "return", "(", "HWREG", "(", "SYSCTL_RIS", ")", ")", ";", "}", "}" ]
Gets the current interrupt status.
[ "Gets", "the", "current", "interrupt", "status", "." ]
[ "//\r", "// Return either the interrupt status or the raw interrupt status as\r", "// requested.\r", "//\r" ]
[ { "param": "bMasked", "type": "tBoolean" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bMasked", "type": "tBoolean", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlLDOSet
void
void SysCtlLDOSet(unsigned long ulVoltage) { // // Check the arguments. // ASSERT((ulVoltage == SYSCTL_LDO_2_25V) || (ulVoltage == SYSCTL_LDO_2_30V) || (ulVoltage == SYSCTL_LDO_2_35V) || (ulVoltage == SYSCTL_LDO_2_40V) || (ulVoltage == SYSCTL_LDO_2_45V) || (ulVoltage == SYSCTL_LDO_2_50V) || (ulVoltage == SYSCTL_LDO_2_55V) || (ulVoltage == SYSCTL_LDO_2_60V) || (ulVoltage == SYSCTL_LDO_2_65V) || (ulVoltage == SYSCTL_LDO_2_70V) || (ulVoltage == SYSCTL_LDO_2_75V)); // // Set the LDO voltage to the requested value. // HWREG(SYSCTL_LDOPCTL) = ulVoltage; }
//***************************************************************************** // //! Sets the output voltage of the LDO. //! //! \param ulVoltage is the required output voltage from the LDO. //! //! This function sets the output voltage of the LDO. The \e ulVoltage //! parameter specifies the LDO voltage and must be one of the following //! values: //! \b SYSCTL_LDO_2_25V, \b SYSCTL_LDO_2_30V, \b SYSCTL_LDO_2_35V, //! \b SYSCTL_LDO_2_40V, \b SYSCTL_LDO_2_45V, \b SYSCTL_LDO_2_50V, //! \b SYSCTL_LDO_2_55V, \b SYSCTL_LDO_2_60V, \b SYSCTL_LDO_2_65V, //! \b SYSCTL_LDO_2_70V, or \b SYSCTL_LDO_2_75V. //! //! \note The default LDO voltage and the adjustment range varies with the //! Stellaris part in use. Please consult the data sheet for the part you are //! using to determine the default voltage and range available. //! //! \return None. // //*****************************************************************************
Sets the output voltage of the LDO. \param ulVoltage is the required output voltage from the LDO. This function sets the output voltage of the LDO. \note The default LDO voltage and the adjustment range varies with the Stellaris part in use. Please consult the data sheet for the part you are using to determine the default voltage and range available. \return None.
[ "Sets", "the", "output", "voltage", "of", "the", "LDO", ".", "\\", "param", "ulVoltage", "is", "the", "required", "output", "voltage", "from", "the", "LDO", ".", "This", "function", "sets", "the", "output", "voltage", "of", "the", "LDO", ".", "\\", "note", "The", "default", "LDO", "voltage", "and", "the", "adjustment", "range", "varies", "with", "the", "Stellaris", "part", "in", "use", ".", "Please", "consult", "the", "data", "sheet", "for", "the", "part", "you", "are", "using", "to", "determine", "the", "default", "voltage", "and", "range", "available", ".", "\\", "return", "None", "." ]
void SysCtlLDOSet(unsigned long ulVoltage) { ASSERT((ulVoltage == SYSCTL_LDO_2_25V) || (ulVoltage == SYSCTL_LDO_2_30V) || (ulVoltage == SYSCTL_LDO_2_35V) || (ulVoltage == SYSCTL_LDO_2_40V) || (ulVoltage == SYSCTL_LDO_2_45V) || (ulVoltage == SYSCTL_LDO_2_50V) || (ulVoltage == SYSCTL_LDO_2_55V) || (ulVoltage == SYSCTL_LDO_2_60V) || (ulVoltage == SYSCTL_LDO_2_65V) || (ulVoltage == SYSCTL_LDO_2_70V) || (ulVoltage == SYSCTL_LDO_2_75V)); HWREG(SYSCTL_LDOPCTL) = ulVoltage; }
[ "void", "SysCtlLDOSet", "(", "unsigned", "long", "ulVoltage", ")", "{", "ASSERT", "(", "(", "ulVoltage", "==", "SYSCTL_LDO_2_25V", ")", "||", "(", "ulVoltage", "==", "SYSCTL_LDO_2_30V", ")", "||", "(", "ulVoltage", "==", "SYSCTL_LDO_2_35V", ")", "||", "(", "ulVoltage", "==", "SYSCTL_LDO_2_40V", ")", "||", "(", "ulVoltage", "==", "SYSCTL_LDO_2_45V", ")", "||", "(", "ulVoltage", "==", "SYSCTL_LDO_2_50V", ")", "||", "(", "ulVoltage", "==", "SYSCTL_LDO_2_55V", ")", "||", "(", "ulVoltage", "==", "SYSCTL_LDO_2_60V", ")", "||", "(", "ulVoltage", "==", "SYSCTL_LDO_2_65V", ")", "||", "(", "ulVoltage", "==", "SYSCTL_LDO_2_70V", ")", "||", "(", "ulVoltage", "==", "SYSCTL_LDO_2_75V", ")", ")", ";", "HWREG", "(", "SYSCTL_LDOPCTL", ")", "=", "ulVoltage", ";", "}" ]
Sets the output voltage of the LDO.
[ "Sets", "the", "output", "voltage", "of", "the", "LDO", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Set the LDO voltage to the requested value.\r", "//\r" ]
[ { "param": "ulVoltage", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulVoltage", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlLDOGet
null
unsigned long SysCtlLDOGet(void) { // // Return the LDO voltage setting. // return(HWREG(SYSCTL_LDOPCTL)); }
//***************************************************************************** // //! Gets the output voltage of the LDO. //! //! This function determines the output voltage of the LDO, as specified by the //! control register. //! //! \return Returns the current voltage of the LDO and is one of: //! \b SYSCTL_LDO_2_25V, \b SYSCTL_LDO_2_30V, \b SYSCTL_LDO_2_35V, //! \b SYSCTL_LDO_2_40V, \b SYSCTL_LDO_2_45V, \b SYSCTL_LDO_2_50V, //! \b SYSCTL_LDO_2_55V, \b SYSCTL_LDO_2_60V, \b SYSCTL_LDO_2_65V, //! \b SYSCTL_LDO_2_70V, or \b SYSCTL_LDO_2_75V. // //*****************************************************************************
Gets the output voltage of the LDO. This function determines the output voltage of the LDO, as specified by the control register.
[ "Gets", "the", "output", "voltage", "of", "the", "LDO", ".", "This", "function", "determines", "the", "output", "voltage", "of", "the", "LDO", "as", "specified", "by", "the", "control", "register", "." ]
unsigned long SysCtlLDOGet(void) { return(HWREG(SYSCTL_LDOPCTL)); }
[ "unsigned", "long", "SysCtlLDOGet", "(", "void", ")", "{", "return", "(", "HWREG", "(", "SYSCTL_LDOPCTL", ")", ")", ";", "}" ]
Gets the output voltage of the LDO.
[ "Gets", "the", "output", "voltage", "of", "the", "LDO", "." ]
[ "//\r", "// Return the LDO voltage setting.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlLDOConfigSet
void
void SysCtlLDOConfigSet(unsigned long ulConfig) { // // Check the arguments. // ASSERT((ulConfig == SYSCTL_LDOCFG_ARST) || (ulConfig == SYSCTL_LDOCFG_NORST)); // // Set the reset control as requested. // HWREG(SYSCTL_LDOARST) = ulConfig; }
//***************************************************************************** // //! Configures the LDO failure control. //! //! \param ulConfig is the required LDO failure control setting; can be either //! \b SYSCTL_LDOCFG_ARST or \b SYSCTL_LDOCFG_NORST. //! //! This function allows the LDO to be configured to cause a processor reset //! when the output voltage becomes unregulated. //! //! The LDO failure control is only available on Sandstorm-class devices. //! //! \return None. // //*****************************************************************************
Configures the LDO failure control. \param ulConfig is the required LDO failure control setting; can be either \b SYSCTL_LDOCFG_ARST or \b SYSCTL_LDOCFG_NORST. This function allows the LDO to be configured to cause a processor reset when the output voltage becomes unregulated. The LDO failure control is only available on Sandstorm-class devices. \return None.
[ "Configures", "the", "LDO", "failure", "control", ".", "\\", "param", "ulConfig", "is", "the", "required", "LDO", "failure", "control", "setting", ";", "can", "be", "either", "\\", "b", "SYSCTL_LDOCFG_ARST", "or", "\\", "b", "SYSCTL_LDOCFG_NORST", ".", "This", "function", "allows", "the", "LDO", "to", "be", "configured", "to", "cause", "a", "processor", "reset", "when", "the", "output", "voltage", "becomes", "unregulated", ".", "The", "LDO", "failure", "control", "is", "only", "available", "on", "Sandstorm", "-", "class", "devices", ".", "\\", "return", "None", "." ]
void SysCtlLDOConfigSet(unsigned long ulConfig) { ASSERT((ulConfig == SYSCTL_LDOCFG_ARST) || (ulConfig == SYSCTL_LDOCFG_NORST)); HWREG(SYSCTL_LDOARST) = ulConfig; }
[ "void", "SysCtlLDOConfigSet", "(", "unsigned", "long", "ulConfig", ")", "{", "ASSERT", "(", "(", "ulConfig", "==", "SYSCTL_LDOCFG_ARST", ")", "||", "(", "ulConfig", "==", "SYSCTL_LDOCFG_NORST", ")", ")", ";", "HWREG", "(", "SYSCTL_LDOARST", ")", "=", "ulConfig", ";", "}" ]
Configures the LDO failure control.
[ "Configures", "the", "LDO", "failure", "control", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Set the reset control as requested.\r", "//\r" ]
[ { "param": "ulConfig", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulConfig", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlReset
void
void SysCtlReset(void) { // // Perform a software reset request. This request causes the device to // reset, no further code is executed. // HWREG(NVIC_APINT) = NVIC_APINT_VECTKEY | NVIC_APINT_SYSRESETREQ; // // The device should have reset, so this should never be reached. Just in // case, loop forever. // while(1) { } }
//***************************************************************************** // //! Resets the device. //! //! This function performs a software reset of the entire device. The //! processor and all peripherals are reset and all device registers are //! returned to their default values (with the exception of the reset cause //! register, which maintains its current value but has the software reset //! bit set as well). //! //! \return This function does not return. // //*****************************************************************************
Resets the device. This function performs a software reset of the entire device. The processor and all peripherals are reset and all device registers are returned to their default values (with the exception of the reset cause register, which maintains its current value but has the software reset bit set as well). \return This function does not return.
[ "Resets", "the", "device", ".", "This", "function", "performs", "a", "software", "reset", "of", "the", "entire", "device", ".", "The", "processor", "and", "all", "peripherals", "are", "reset", "and", "all", "device", "registers", "are", "returned", "to", "their", "default", "values", "(", "with", "the", "exception", "of", "the", "reset", "cause", "register", "which", "maintains", "its", "current", "value", "but", "has", "the", "software", "reset", "bit", "set", "as", "well", ")", ".", "\\", "return", "This", "function", "does", "not", "return", "." ]
void SysCtlReset(void) { HWREG(NVIC_APINT) = NVIC_APINT_VECTKEY | NVIC_APINT_SYSRESETREQ; while(1) { } }
[ "void", "SysCtlReset", "(", "void", ")", "{", "HWREG", "(", "NVIC_APINT", ")", "=", "NVIC_APINT_VECTKEY", "|", "NVIC_APINT_SYSRESETREQ", ";", "while", "(", "1", ")", "{", "}", "}" ]
Resets the device.
[ "Resets", "the", "device", "." ]
[ "//\r", "// Perform a software reset request. This request causes the device to\r", "// reset, no further code is executed.\r", "//\r", "//\r", "// The device should have reset, so this should never be reached. Just in\r", "// case, loop forever.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlSleep
void
void SysCtlSleep(void) { // // Wait for an interrupt. // CPUwfi(); }
//***************************************************************************** // //! Puts the processor into sleep mode. //! //! This function places the processor into sleep mode; it does not return //! until the processor returns to run mode. The peripherals that are enabled //! via SysCtlPeripheralSleepEnable() continue to operate and can wake up the //! processor (if automatic clock gating is enabled with //! SysCtlPeripheralClockGating(), otherwise all peripherals continue to //! operate). //! //! \return None. // //*****************************************************************************
Puts the processor into sleep mode. This function places the processor into sleep mode; it does not return until the processor returns to run mode. The peripherals that are enabled via SysCtlPeripheralSleepEnable() continue to operate and can wake up the processor (if automatic clock gating is enabled with SysCtlPeripheralClockGating(), otherwise all peripherals continue to operate). \return None.
[ "Puts", "the", "processor", "into", "sleep", "mode", ".", "This", "function", "places", "the", "processor", "into", "sleep", "mode", ";", "it", "does", "not", "return", "until", "the", "processor", "returns", "to", "run", "mode", ".", "The", "peripherals", "that", "are", "enabled", "via", "SysCtlPeripheralSleepEnable", "()", "continue", "to", "operate", "and", "can", "wake", "up", "the", "processor", "(", "if", "automatic", "clock", "gating", "is", "enabled", "with", "SysCtlPeripheralClockGating", "()", "otherwise", "all", "peripherals", "continue", "to", "operate", ")", ".", "\\", "return", "None", "." ]
void SysCtlSleep(void) { CPUwfi(); }
[ "void", "SysCtlSleep", "(", "void", ")", "{", "CPUwfi", "(", ")", ";", "}" ]
Puts the processor into sleep mode.
[ "Puts", "the", "processor", "into", "sleep", "mode", "." ]
[ "//\r", "// Wait for an interrupt.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlDeepSleep
void
void SysCtlDeepSleep(void) { // // Enable deep-sleep. // HWREG(NVIC_SYS_CTRL) |= NVIC_SYS_CTRL_SLEEPDEEP; // // Wait for an interrupt. // CPUwfi(); // // Disable deep-sleep so that a future sleep works correctly. // HWREG(NVIC_SYS_CTRL) &= ~(NVIC_SYS_CTRL_SLEEPDEEP); }
//***************************************************************************** // //! Puts the processor into deep-sleep mode. //! //! This function places the processor into deep-sleep mode; it does not return //! until the processor returns to run mode. The peripherals that are enabled //! via SysCtlPeripheralDeepSleepEnable() continue to operate and can wake up //! the processor (if automatic clock gating is enabled with //! SysCtlPeripheralClockGating(), otherwise all peripherals continue to //! operate). //! //! \return None. // //*****************************************************************************
Puts the processor into deep-sleep mode. This function places the processor into deep-sleep mode; it does not return until the processor returns to run mode. The peripherals that are enabled via SysCtlPeripheralDeepSleepEnable() continue to operate and can wake up the processor (if automatic clock gating is enabled with SysCtlPeripheralClockGating(), otherwise all peripherals continue to operate). \return None.
[ "Puts", "the", "processor", "into", "deep", "-", "sleep", "mode", ".", "This", "function", "places", "the", "processor", "into", "deep", "-", "sleep", "mode", ";", "it", "does", "not", "return", "until", "the", "processor", "returns", "to", "run", "mode", ".", "The", "peripherals", "that", "are", "enabled", "via", "SysCtlPeripheralDeepSleepEnable", "()", "continue", "to", "operate", "and", "can", "wake", "up", "the", "processor", "(", "if", "automatic", "clock", "gating", "is", "enabled", "with", "SysCtlPeripheralClockGating", "()", "otherwise", "all", "peripherals", "continue", "to", "operate", ")", ".", "\\", "return", "None", "." ]
void SysCtlDeepSleep(void) { HWREG(NVIC_SYS_CTRL) |= NVIC_SYS_CTRL_SLEEPDEEP; CPUwfi(); HWREG(NVIC_SYS_CTRL) &= ~(NVIC_SYS_CTRL_SLEEPDEEP); }
[ "void", "SysCtlDeepSleep", "(", "void", ")", "{", "HWREG", "(", "NVIC_SYS_CTRL", ")", "|=", "NVIC_SYS_CTRL_SLEEPDEEP", ";", "CPUwfi", "(", ")", ";", "HWREG", "(", "NVIC_SYS_CTRL", ")", "&=", "~", "(", "NVIC_SYS_CTRL_SLEEPDEEP", ")", ";", "}" ]
Puts the processor into deep-sleep mode.
[ "Puts", "the", "processor", "into", "deep", "-", "sleep", "mode", "." ]
[ "//\r", "// Enable deep-sleep.\r", "//\r", "//\r", "// Wait for an interrupt.\r", "//\r", "//\r", "// Disable deep-sleep so that a future sleep works correctly.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlResetCauseGet
null
unsigned long SysCtlResetCauseGet(void) { // // Return the reset reasons. // return(HWREG(SYSCTL_RESC)); }
//***************************************************************************** // //! Gets the reason for a reset. //! //! This function returns the reason(s) for a reset. Because the reset //! reasons are sticky until either cleared by software or an external reset //! (for Sandstorm-class devices) or a power-on reset (for all other classes), //! multiple reset reasons may be returned if multiple resets have occurred. //! The reset reason is a logical OR of \b SYSCTL_CAUSE_LDO, //! \b SYSCTL_CAUSE_SW, \b SYSCTL_CAUSE_WDOG, \b SYSCTL_CAUSE_BOR, //! \b SYSCTL_CAUSE_POR, and/or \b SYSCTL_CAUSE_EXT. //! //! \return Returns the reason(s) for a reset. // //*****************************************************************************
Gets the reason for a reset. This function returns the reason(s) for a reset. Because the reset reasons are sticky until either cleared by software or an external reset (for Sandstorm-class devices) or a power-on reset (for all other classes), multiple reset reasons may be returned if multiple resets have occurred. \return Returns the reason(s) for a reset.
[ "Gets", "the", "reason", "for", "a", "reset", ".", "This", "function", "returns", "the", "reason", "(", "s", ")", "for", "a", "reset", ".", "Because", "the", "reset", "reasons", "are", "sticky", "until", "either", "cleared", "by", "software", "or", "an", "external", "reset", "(", "for", "Sandstorm", "-", "class", "devices", ")", "or", "a", "power", "-", "on", "reset", "(", "for", "all", "other", "classes", ")", "multiple", "reset", "reasons", "may", "be", "returned", "if", "multiple", "resets", "have", "occurred", ".", "\\", "return", "Returns", "the", "reason", "(", "s", ")", "for", "a", "reset", "." ]
unsigned long SysCtlResetCauseGet(void) { return(HWREG(SYSCTL_RESC)); }
[ "unsigned", "long", "SysCtlResetCauseGet", "(", "void", ")", "{", "return", "(", "HWREG", "(", "SYSCTL_RESC", ")", ")", ";", "}" ]
Gets the reason for a reset.
[ "Gets", "the", "reason", "for", "a", "reset", "." ]
[ "//\r", "// Return the reset reasons.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlResetCauseClear
void
void SysCtlResetCauseClear(unsigned long ulCauses) { // // Clear the given reset reasons. // HWREG(SYSCTL_RESC) &= ~(ulCauses); }
//***************************************************************************** // //! Clears reset reasons. //! //! \param ulCauses are the reset causes to be cleared; must be a logical OR of //! \b SYSCTL_CAUSE_LDO, \b SYSCTL_CAUSE_SW, \b SYSCTL_CAUSE_WDOG, //! \b SYSCTL_CAUSE_BOR, \b SYSCTL_CAUSE_POR, and/or \b SYSCTL_CAUSE_EXT. //! //! This function clears the specified sticky reset reasons. Once cleared, //! another reset for the same reason can be detected, and a reset for a //! different reason can be distinguished (instead of having two reset causes //! set). If the reset reason is used by an application, all reset causes //! should be cleared after they are retrieved with SysCtlResetCauseGet(). //! //! \return None. // //*****************************************************************************
Clears reset reasons. This function clears the specified sticky reset reasons. Once cleared, another reset for the same reason can be detected, and a reset for a different reason can be distinguished (instead of having two reset causes set). If the reset reason is used by an application, all reset causes should be cleared after they are retrieved with SysCtlResetCauseGet(). \return None.
[ "Clears", "reset", "reasons", ".", "This", "function", "clears", "the", "specified", "sticky", "reset", "reasons", ".", "Once", "cleared", "another", "reset", "for", "the", "same", "reason", "can", "be", "detected", "and", "a", "reset", "for", "a", "different", "reason", "can", "be", "distinguished", "(", "instead", "of", "having", "two", "reset", "causes", "set", ")", ".", "If", "the", "reset", "reason", "is", "used", "by", "an", "application", "all", "reset", "causes", "should", "be", "cleared", "after", "they", "are", "retrieved", "with", "SysCtlResetCauseGet", "()", ".", "\\", "return", "None", "." ]
void SysCtlResetCauseClear(unsigned long ulCauses) { HWREG(SYSCTL_RESC) &= ~(ulCauses); }
[ "void", "SysCtlResetCauseClear", "(", "unsigned", "long", "ulCauses", ")", "{", "HWREG", "(", "SYSCTL_RESC", ")", "&=", "~", "(", "ulCauses", ")", ";", "}" ]
Clears reset reasons.
[ "Clears", "reset", "reasons", "." ]
[ "//\r", "// Clear the given reset reasons.\r", "//\r" ]
[ { "param": "ulCauses", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulCauses", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlBrownOutConfigSet
void
void SysCtlBrownOutConfigSet(unsigned long ulConfig, unsigned long ulDelay) { // // Check the arguments. // ASSERT(!(ulConfig & ~(SYSCTL_BOR_RESET | SYSCTL_BOR_RESAMPLE))); ASSERT(ulDelay < 8192); // // Configure the brown-out reset control. // HWREG(SYSCTL_PBORCTL) = (ulDelay << SYSCTL_PBORCTL_BORTIM_S) | ulConfig; }
//***************************************************************************** // //! Configures the brown-out control. //! //! \param ulConfig is the desired configuration of the brown-out control. //! Must be the logical OR of \b SYSCTL_BOR_RESET and/or //! \b SYSCTL_BOR_RESAMPLE. //! \param ulDelay is the number of internal oscillator cycles to wait before //! resampling an asserted brown-out signal. This value only has meaning when //! \b SYSCTL_BOR_RESAMPLE is set and must be less than 8192. //! //! This function configures how the brown-out control operates. It can detect //! a brown-out by looking at only the brown-out output, or it can wait for it //! to be active for two consecutive samples separated by a configurable time. //! When it detects a brown-out condition, it can either reset the device or //! generate a processor interrupt. //! //! \note The availability of the resample feature is only available on //! Sandstorm-class devices. Please consult the data sheet for the part you //! are using to determine whether this feature is available. //! //! \return None. // //*****************************************************************************
Configures the brown-out control. \param ulConfig is the desired configuration of the brown-out control. Must be the logical OR of \b SYSCTL_BOR_RESET and/or \b SYSCTL_BOR_RESAMPLE. \param ulDelay is the number of internal oscillator cycles to wait before resampling an asserted brown-out signal. This value only has meaning when \b SYSCTL_BOR_RESAMPLE is set and must be less than 8192. This function configures how the brown-out control operates. It can detect a brown-out by looking at only the brown-out output, or it can wait for it to be active for two consecutive samples separated by a configurable time. When it detects a brown-out condition, it can either reset the device or generate a processor interrupt. \note The availability of the resample feature is only available on Sandstorm-class devices. Please consult the data sheet for the part you are using to determine whether this feature is available. \return None.
[ "Configures", "the", "brown", "-", "out", "control", ".", "\\", "param", "ulConfig", "is", "the", "desired", "configuration", "of", "the", "brown", "-", "out", "control", ".", "Must", "be", "the", "logical", "OR", "of", "\\", "b", "SYSCTL_BOR_RESET", "and", "/", "or", "\\", "b", "SYSCTL_BOR_RESAMPLE", ".", "\\", "param", "ulDelay", "is", "the", "number", "of", "internal", "oscillator", "cycles", "to", "wait", "before", "resampling", "an", "asserted", "brown", "-", "out", "signal", ".", "This", "value", "only", "has", "meaning", "when", "\\", "b", "SYSCTL_BOR_RESAMPLE", "is", "set", "and", "must", "be", "less", "than", "8192", ".", "This", "function", "configures", "how", "the", "brown", "-", "out", "control", "operates", ".", "It", "can", "detect", "a", "brown", "-", "out", "by", "looking", "at", "only", "the", "brown", "-", "out", "output", "or", "it", "can", "wait", "for", "it", "to", "be", "active", "for", "two", "consecutive", "samples", "separated", "by", "a", "configurable", "time", ".", "When", "it", "detects", "a", "brown", "-", "out", "condition", "it", "can", "either", "reset", "the", "device", "or", "generate", "a", "processor", "interrupt", ".", "\\", "note", "The", "availability", "of", "the", "resample", "feature", "is", "only", "available", "on", "Sandstorm", "-", "class", "devices", ".", "Please", "consult", "the", "data", "sheet", "for", "the", "part", "you", "are", "using", "to", "determine", "whether", "this", "feature", "is", "available", ".", "\\", "return", "None", "." ]
void SysCtlBrownOutConfigSet(unsigned long ulConfig, unsigned long ulDelay) { ASSERT(!(ulConfig & ~(SYSCTL_BOR_RESET | SYSCTL_BOR_RESAMPLE))); ASSERT(ulDelay < 8192); HWREG(SYSCTL_PBORCTL) = (ulDelay << SYSCTL_PBORCTL_BORTIM_S) | ulConfig; }
[ "void", "SysCtlBrownOutConfigSet", "(", "unsigned", "long", "ulConfig", ",", "unsigned", "long", "ulDelay", ")", "{", "ASSERT", "(", "!", "(", "ulConfig", "&", "~", "(", "SYSCTL_BOR_RESET", "|", "SYSCTL_BOR_RESAMPLE", ")", ")", ")", ";", "ASSERT", "(", "ulDelay", "<", "8192", ")", ";", "HWREG", "(", "SYSCTL_PBORCTL", ")", "=", "(", "ulDelay", "<<", "SYSCTL_PBORCTL_BORTIM_S", ")", "|", "ulConfig", ";", "}" ]
Configures the brown-out control.
[ "Configures", "the", "brown", "-", "out", "control", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Configure the brown-out reset control.\r", "//\r" ]
[ { "param": "ulConfig", "type": "unsigned long" }, { "param": "ulDelay", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulConfig", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulDelay", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlMOSCConfigSet
void
void SysCtlMOSCConfigSet(unsigned long ulConfig) { // // Configure the MOSC control. // HWREG(SYSCTL_MOSCCTL) = ulConfig; }
//***************************************************************************** // //! Sets the configuration of the main oscillator (MOSC) control. //! //! \param ulConfig is the required configuration of the MOSC control. //! //! This function configures the control of the main oscillator. The //! \e ulConfig is specified as follows: //! //! - \b SYSCTL_MOSC_VALIDATE enables the MOSC verification circuit that //! detects a failure of the main oscillator (such as a loss of the clock). //! - \b SYSCTL_MOSC_INTERRUPT indicates that a MOSC failure should generate an //! interrupt instead of resetting the processor. //! - \b SYSCTL_MOSC_NO_XTAL indicates that there is no crystal connected to //! the OSC0/OSC1 pins, allowing power consumption to be reduced. //! //! \note The availability of MOSC control varies based on the Stellaris part //! in use. Please consult the data sheet for the part you are using to //! determine whether this support is available. In addition, the capability //! of MOSC control varies based on the Stellaris part in use. //! //! \return None. // //*****************************************************************************
Sets the configuration of the main oscillator (MOSC) control. \param ulConfig is the required configuration of the MOSC control. This function configures the control of the main oscillator. The \e ulConfig is specified as follows. \b SYSCTL_MOSC_VALIDATE enables the MOSC verification circuit that detects a failure of the main oscillator (such as a loss of the clock). \b SYSCTL_MOSC_INTERRUPT indicates that a MOSC failure should generate an interrupt instead of resetting the processor. \b SYSCTL_MOSC_NO_XTAL indicates that there is no crystal connected to the OSC0/OSC1 pins, allowing power consumption to be reduced. \note The availability of MOSC control varies based on the Stellaris part in use. Please consult the data sheet for the part you are using to determine whether this support is available. In addition, the capability of MOSC control varies based on the Stellaris part in use. \return None.
[ "Sets", "the", "configuration", "of", "the", "main", "oscillator", "(", "MOSC", ")", "control", ".", "\\", "param", "ulConfig", "is", "the", "required", "configuration", "of", "the", "MOSC", "control", ".", "This", "function", "configures", "the", "control", "of", "the", "main", "oscillator", ".", "The", "\\", "e", "ulConfig", "is", "specified", "as", "follows", ".", "\\", "b", "SYSCTL_MOSC_VALIDATE", "enables", "the", "MOSC", "verification", "circuit", "that", "detects", "a", "failure", "of", "the", "main", "oscillator", "(", "such", "as", "a", "loss", "of", "the", "clock", ")", ".", "\\", "b", "SYSCTL_MOSC_INTERRUPT", "indicates", "that", "a", "MOSC", "failure", "should", "generate", "an", "interrupt", "instead", "of", "resetting", "the", "processor", ".", "\\", "b", "SYSCTL_MOSC_NO_XTAL", "indicates", "that", "there", "is", "no", "crystal", "connected", "to", "the", "OSC0", "/", "OSC1", "pins", "allowing", "power", "consumption", "to", "be", "reduced", ".", "\\", "note", "The", "availability", "of", "MOSC", "control", "varies", "based", "on", "the", "Stellaris", "part", "in", "use", ".", "Please", "consult", "the", "data", "sheet", "for", "the", "part", "you", "are", "using", "to", "determine", "whether", "this", "support", "is", "available", ".", "In", "addition", "the", "capability", "of", "MOSC", "control", "varies", "based", "on", "the", "Stellaris", "part", "in", "use", ".", "\\", "return", "None", "." ]
void SysCtlMOSCConfigSet(unsigned long ulConfig) { HWREG(SYSCTL_MOSCCTL) = ulConfig; }
[ "void", "SysCtlMOSCConfigSet", "(", "unsigned", "long", "ulConfig", ")", "{", "HWREG", "(", "SYSCTL_MOSCCTL", ")", "=", "ulConfig", ";", "}" ]
Sets the configuration of the main oscillator (MOSC) control.
[ "Sets", "the", "configuration", "of", "the", "main", "oscillator", "(", "MOSC", ")", "control", "." ]
[ "//\r", "// Configure the MOSC control.\r", "//\r" ]
[ { "param": "ulConfig", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulConfig", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlPIOSCCalibrate
null
unsigned long SysCtlPIOSCCalibrate(unsigned long ulType) { // // Perform the requested calibration. If performing user calibration, the // UTEN bit must be set with one write, then the UT field in a second // write, and the UPDATE bit in a final write. For other calibration // types, a single write to set UPDATE or CAL is all that is required. // if(ulType & (SYSCTL_PIOSCCAL_UTEN | SYSCTL_PIOSCCAL_UPDATE)) { HWREG(SYSCTL_PIOSCCAL) = ulType & SYSCTL_PIOSCCAL_UTEN; HWREG(SYSCTL_PIOSCCAL) = ulType & (SYSCTL_PIOSCCAL_UTEN | SYSCTL_PIOSCCAL_UT_M); } HWREG(SYSCTL_PIOSCCAL) = ulType; // // See if an automatic calibration was requested. // if(ulType & SYSCTL_PIOSCCAL_CAL) { // // Wait for the automatic calibration to complete. // while((HWREG(SYSCTL_PIOSCSTAT) & SYSCTL_PIOSCSTAT_CR_M) == 0) { } // // If the automatic calibration failed, return an error. // if((HWREG(SYSCTL_PIOSCSTAT) & SYSCTL_PIOSCSTAT_CR_M) != SYSCTL_PIOSCSTAT_CRPASS) { return(0); } } // // The calibration was successful. // return(1); }
//***************************************************************************** // //! Calibrates the precision internal oscillator. //! //! \param ulType is the type of calibration to perform. //! //! This function performs a calibration of the PIOSC. There are three types //! of calibration available; the desired calibration type as specified in //! \e ulType is one of: //! //! - \b SYSCTL_PIOSC_CAL_AUTO to perform automatic calibration using the //! 32-kHz clock from the hibernate module as a reference. This type is //! only possible on parts that have a hibernate module, and then only if //! it is enabled and the hibernate module's RTC is also enabled. //! //! - \b SYSCTL_PIOSC_CAL_FACT to reset the PIOSC calibration to the factory //! provided calibration. //! //! - \b SYSCTL_PIOSC_CAL_USER to set the PIOSC calibration to a user-supplied //! value. The value to be used is ORed into the lower 7-bits of this value, //! with 0x40 being the ``nominal'' value (in other words, if everything were //! perfect, 0x40 provides exactly 16 MHz). Values larger than 0x40 //! slow down PIOSC, and values smaller than 0x40 speed up PIOSC. //! //! \return Returns 1 if the calibration was successful and 0 if it failed. // //*****************************************************************************
Calibrates the precision internal oscillator. \param ulType is the type of calibration to perform. This function performs a calibration of the PIOSC. There are three types of calibration available; the desired calibration type as specified in \e ulType is one of. \b SYSCTL_PIOSC_CAL_AUTO to perform automatic calibration using the 32-kHz clock from the hibernate module as a reference. This type is only possible on parts that have a hibernate module, and then only if it is enabled and the hibernate module's RTC is also enabled. \b SYSCTL_PIOSC_CAL_FACT to reset the PIOSC calibration to the factory provided calibration. \b SYSCTL_PIOSC_CAL_USER to set the PIOSC calibration to a user-supplied value. The value to be used is ORed into the lower 7-bits of this value, with 0x40 being the ``nominal'' value (in other words, if everything were perfect, 0x40 provides exactly 16 MHz). Values larger than 0x40 slow down PIOSC, and values smaller than 0x40 speed up PIOSC. \return Returns 1 if the calibration was successful and 0 if it failed.
[ "Calibrates", "the", "precision", "internal", "oscillator", ".", "\\", "param", "ulType", "is", "the", "type", "of", "calibration", "to", "perform", ".", "This", "function", "performs", "a", "calibration", "of", "the", "PIOSC", ".", "There", "are", "three", "types", "of", "calibration", "available", ";", "the", "desired", "calibration", "type", "as", "specified", "in", "\\", "e", "ulType", "is", "one", "of", ".", "\\", "b", "SYSCTL_PIOSC_CAL_AUTO", "to", "perform", "automatic", "calibration", "using", "the", "32", "-", "kHz", "clock", "from", "the", "hibernate", "module", "as", "a", "reference", ".", "This", "type", "is", "only", "possible", "on", "parts", "that", "have", "a", "hibernate", "module", "and", "then", "only", "if", "it", "is", "enabled", "and", "the", "hibernate", "module", "'", "s", "RTC", "is", "also", "enabled", ".", "\\", "b", "SYSCTL_PIOSC_CAL_FACT", "to", "reset", "the", "PIOSC", "calibration", "to", "the", "factory", "provided", "calibration", ".", "\\", "b", "SYSCTL_PIOSC_CAL_USER", "to", "set", "the", "PIOSC", "calibration", "to", "a", "user", "-", "supplied", "value", ".", "The", "value", "to", "be", "used", "is", "ORed", "into", "the", "lower", "7", "-", "bits", "of", "this", "value", "with", "0x40", "being", "the", "`", "`", "nominal", "'", "'", "value", "(", "in", "other", "words", "if", "everything", "were", "perfect", "0x40", "provides", "exactly", "16", "MHz", ")", ".", "Values", "larger", "than", "0x40", "slow", "down", "PIOSC", "and", "values", "smaller", "than", "0x40", "speed", "up", "PIOSC", ".", "\\", "return", "Returns", "1", "if", "the", "calibration", "was", "successful", "and", "0", "if", "it", "failed", "." ]
unsigned long SysCtlPIOSCCalibrate(unsigned long ulType) { if(ulType & (SYSCTL_PIOSCCAL_UTEN | SYSCTL_PIOSCCAL_UPDATE)) { HWREG(SYSCTL_PIOSCCAL) = ulType & SYSCTL_PIOSCCAL_UTEN; HWREG(SYSCTL_PIOSCCAL) = ulType & (SYSCTL_PIOSCCAL_UTEN | SYSCTL_PIOSCCAL_UT_M); } HWREG(SYSCTL_PIOSCCAL) = ulType; if(ulType & SYSCTL_PIOSCCAL_CAL) { while((HWREG(SYSCTL_PIOSCSTAT) & SYSCTL_PIOSCSTAT_CR_M) == 0) { } if((HWREG(SYSCTL_PIOSCSTAT) & SYSCTL_PIOSCSTAT_CR_M) != SYSCTL_PIOSCSTAT_CRPASS) { return(0); } } return(1); }
[ "unsigned", "long", "SysCtlPIOSCCalibrate", "(", "unsigned", "long", "ulType", ")", "{", "if", "(", "ulType", "&", "(", "SYSCTL_PIOSCCAL_UTEN", "|", "SYSCTL_PIOSCCAL_UPDATE", ")", ")", "{", "HWREG", "(", "SYSCTL_PIOSCCAL", ")", "=", "ulType", "&", "SYSCTL_PIOSCCAL_UTEN", ";", "HWREG", "(", "SYSCTL_PIOSCCAL", ")", "=", "ulType", "&", "(", "SYSCTL_PIOSCCAL_UTEN", "|", "SYSCTL_PIOSCCAL_UT_M", ")", ";", "}", "HWREG", "(", "SYSCTL_PIOSCCAL", ")", "=", "ulType", ";", "if", "(", "ulType", "&", "SYSCTL_PIOSCCAL_CAL", ")", "{", "while", "(", "(", "HWREG", "(", "SYSCTL_PIOSCSTAT", ")", "&", "SYSCTL_PIOSCSTAT_CR_M", ")", "==", "0", ")", "{", "}", "if", "(", "(", "HWREG", "(", "SYSCTL_PIOSCSTAT", ")", "&", "SYSCTL_PIOSCSTAT_CR_M", ")", "!=", "SYSCTL_PIOSCSTAT_CRPASS", ")", "{", "return", "(", "0", ")", ";", "}", "}", "return", "(", "1", ")", ";", "}" ]
Calibrates the precision internal oscillator.
[ "Calibrates", "the", "precision", "internal", "oscillator", "." ]
[ "//\r", "// Perform the requested calibration. If performing user calibration, the\r", "// UTEN bit must be set with one write, then the UT field in a second\r", "// write, and the UPDATE bit in a final write. For other calibration\r", "// types, a single write to set UPDATE or CAL is all that is required.\r", "//\r", "//\r", "// See if an automatic calibration was requested.\r", "//\r", "//\r", "// Wait for the automatic calibration to complete.\r", "//\r", "//\r", "// If the automatic calibration failed, return an error.\r", "//\r", "//\r", "// The calibration was successful.\r", "//\r" ]
[ { "param": "ulType", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulType", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlClockSet
void
void SysCtlClockSet(unsigned long ulConfig) { unsigned long ulDelay, ulRCC, ulRCC2; // // See if this is a Sandstorm-class device and clocking features from newer // devices were requested. // if(CLASS_IS_SANDSTORM && (ulConfig & SYSCTL_RCC2_USERCC2)) { // // Return without changing the clocking because the requested // configuration can not be achieved. // return; } // // Get the current value of the RCC and RCC2 registers. If using a // Sandstorm-class device, the RCC2 register reads back as zero and the // writes to it from within this function are ignored. // ulRCC = HWREG(SYSCTL_RCC); ulRCC2 = HWREG(SYSCTL_RCC2); // // Bypass the PLL and system clock dividers for now. // ulRCC |= SYSCTL_RCC_BYPASS; ulRCC &= ~(SYSCTL_RCC_USESYSDIV); ulRCC2 |= SYSCTL_RCC2_BYPASS2; // // Write the new RCC value. // HWREG(SYSCTL_RCC) = ulRCC; HWREG(SYSCTL_RCC2) = ulRCC2; // // See if either oscillator needs to be enabled. // if(((ulRCC & SYSCTL_RCC_IOSCDIS) && !(ulConfig & SYSCTL_RCC_IOSCDIS)) || ((ulRCC & SYSCTL_RCC_MOSCDIS) && !(ulConfig & SYSCTL_RCC_MOSCDIS))) { // // Make sure that the required oscillators are enabled. For now, the // previously enabled oscillators must be enabled along with the newly // requested oscillators. // ulRCC &= (~(SYSCTL_RCC_IOSCDIS | SYSCTL_RCC_MOSCDIS) | (ulConfig & (SYSCTL_RCC_IOSCDIS | SYSCTL_RCC_MOSCDIS))); // // Write the new RCC value. // HWREG(SYSCTL_RCC) = ulRCC; // // Wait for a bit, giving the oscillator time to stabilize. The number // of iterations is adjusted based on the current clock source; a // smaller number of iterations is required for slower clock rates. // if(((ulRCC2 & SYSCTL_RCC2_USERCC2) && (((ulRCC2 & SYSCTL_RCC2_OSCSRC2_M) == SYSCTL_RCC2_OSCSRC2_30) || ((ulRCC2 & SYSCTL_RCC2_OSCSRC2_M) == SYSCTL_RCC2_OSCSRC2_32))) || (!(ulRCC2 & SYSCTL_RCC2_USERCC2) && ((ulRCC & SYSCTL_RCC_OSCSRC_M) == SYSCTL_RCC_OSCSRC_30))) { // // Delay for 4096 iterations. // SysCtlDelay(4096); } else { // // Delay for 524,288 iterations. // SysCtlDelay(524288); } } // // Set the new crystal value and oscillator source. Because the OSCSRC2 // field in RCC2 overlaps the XTAL field in RCC, the OSCSRC field has a // special encoding within ulConfig to avoid the overlap. // ulRCC &= ~(SYSCTL_RCC_XTAL_M | SYSCTL_RCC_OSCSRC_M); ulRCC |= ulConfig & (SYSCTL_RCC_XTAL_M | SYSCTL_RCC_OSCSRC_M); ulRCC2 &= ~(SYSCTL_RCC2_USERCC2 | SYSCTL_RCC2_OSCSRC2_M); ulRCC2 |= ulConfig & (SYSCTL_RCC2_USERCC2 | SYSCTL_RCC_OSCSRC_M); ulRCC2 |= (ulConfig & 0x00000008) << 3; // // Write the new RCC value. // HWREG(SYSCTL_RCC) = ulRCC; HWREG(SYSCTL_RCC2) = ulRCC2; // // Wait for a bit so that new crystal value and oscillator source can take // effect. // SysCtlDelay(16); // // Set the PLL configuration. // ulRCC &= ~(SYSCTL_RCC_PWRDN | SYSCTL_RCC_OEN); ulRCC |= ulConfig & (SYSCTL_RCC_PWRDN | SYSCTL_RCC_OEN); ulRCC2 &= ~(SYSCTL_RCC2_PWRDN2); ulRCC2 |= ulConfig & SYSCTL_RCC2_PWRDN2; // // Clear the PLL lock interrupt. // HWREG(SYSCTL_MISC) = SYSCTL_INT_PLL_LOCK; // // Write the new RCC value. // if(ulRCC2 & SYSCTL_RCC2_USERCC2) { HWREG(SYSCTL_RCC2) = ulRCC2; HWREG(SYSCTL_RCC) = ulRCC; } else { HWREG(SYSCTL_RCC) = ulRCC; HWREG(SYSCTL_RCC2) = ulRCC2; } // // Set the requested system divider and disable the appropriate // oscillators. This value is not written immediately. // ulRCC &= ~(SYSCTL_RCC_SYSDIV_M | SYSCTL_RCC_USESYSDIV | SYSCTL_RCC_IOSCDIS | SYSCTL_RCC_MOSCDIS); ulRCC |= ulConfig & (SYSCTL_RCC_SYSDIV_M | SYSCTL_RCC_USESYSDIV | SYSCTL_RCC_IOSCDIS | SYSCTL_RCC_MOSCDIS); ulRCC2 &= ~(SYSCTL_RCC2_SYSDIV2_M); ulRCC2 |= ulConfig & SYSCTL_RCC2_SYSDIV2_M; if(ulConfig & SYSCTL_RCC2_DIV400) { ulRCC |= SYSCTL_RCC_USESYSDIV; ulRCC2 &= ~(SYSCTL_RCC_USESYSDIV); ulRCC2 |= ulConfig & (SYSCTL_RCC2_DIV400 | SYSCTL_RCC2_SYSDIV2LSB); } else { ulRCC2 &= ~(SYSCTL_RCC2_DIV400); } // // See if the PLL output is being used to clock the system. // if(!(ulConfig & SYSCTL_RCC_BYPASS)) { // // Wait until the PLL has locked. // for(ulDelay = 32768; ulDelay > 0; ulDelay--) { if(HWREG(SYSCTL_RIS) & SYSCTL_INT_PLL_LOCK) { break; } } // // Enable use of the PLL. // ulRCC &= ~(SYSCTL_RCC_BYPASS); ulRCC2 &= ~(SYSCTL_RCC2_BYPASS2); } // // Write the final RCC value. // HWREG(SYSCTL_RCC) = ulRCC; HWREG(SYSCTL_RCC2) = ulRCC2; // // Delay for a little bit so that the system divider takes effect. // SysCtlDelay(16); }
//***************************************************************************** // //! Sets the clocking of the device. //! //! \param ulConfig is the required configuration of the device clocking. //! //! This function configures the clocking of the device. The input crystal //! frequency, oscillator to be used, use of the PLL, and the system clock //! divider are all configured with this function. //! //! The \e ulConfig parameter is the logical OR of several different values, //! many of which are grouped into sets where only one can be chosen. //! //! The system clock divider is chosen with one of the following values: //! \b SYSCTL_SYSDIV_1, \b SYSCTL_SYSDIV_2, \b SYSCTL_SYSDIV_3, ... //! \b SYSCTL_SYSDIV_64. Only \b SYSCTL_SYSDIV_1 through \b SYSCTL_SYSDIV_16 //! are valid on Sandstorm-class devices. Half-dividers, such as //! \b SYSCTL_SYSDIV_2_5 and \b SYSCTL_SYSDIV_3_5. are available on Tempest-, //! Firestorm-, and Blizzard-class devices. //! //! The use of the PLL is chosen with either \b SYSCTL_USE_PLL or //! \b SYSCTL_USE_OSC. //! //! The external crystal frequency is chosen with one of the following values: //! \b SYSCTL_XTAL_1MHZ, \b SYSCTL_XTAL_1_84MHZ, \b SYSCTL_XTAL_2MHZ, //! \b SYSCTL_XTAL_2_45MHZ, \b SYSCTL_XTAL_3_57MHZ, \b SYSCTL_XTAL_3_68MHZ, //! \b SYSCTL_XTAL_4MHZ, \b SYSCTL_XTAL_4_09MHZ, \b SYSCTL_XTAL_4_91MHZ, //! \b SYSCTL_XTAL_5MHZ, \b SYSCTL_XTAL_5_12MHZ, \b SYSCTL_XTAL_6MHZ, //! \b SYSCTL_XTAL_6_14MHZ, \b SYSCTL_XTAL_7_37MHZ, \b SYSCTL_XTAL_8MHZ, //! \b SYSCTL_XTAL_8_19MHZ, \b SYSCTL_XTAL_10MHZ, \b SYSCTL_XTAL_12MHZ, //! \b SYSCTL_XTAL_12_2MHZ, \b SYSCTL_XTAL_13_5MHZ, \b SYSCTL_XTAL_14_3MHZ, //! \b SYSCTL_XTAL_16MHZ, \b SYSCTL_XTAL_16_3MHZ, \b SYSCTL_XTAL_18MHZ, //! \b SYSCTL_XTAL_20MHZ, \b SYSCTL_XTAL_24MHZ, or \b SYSCTL_XTAL_25MHz. //! Values below \b SYSCTL_XTAL_3_57MHZ are not valid when the PLL is in //! operation on Sandstorm-, Fury-, Dustdevil-, Tempest-, and Firestorm-class. //! devices. Values below \b SYSCTL_XTAL_5MHZ are not valid when the PLL is in //! operation on Blizzard-class devices. Values below \b SYSCTL_XTAL_4MHZ //! are never valid on Blizzard-class devices. On Sandstorm- and Fury-class //! devices, values above \b SYSCTL_XTAL_8_19MHZ are not valid. On Dustdevil-, //! Tempest-, and Firestorm-class devices, values above \b SYSCTL_XTAL_16_3MHZ //! are not valid. //! //! The oscillator source is chosen with one of the following values: //! \b SYSCTL_OSC_MAIN, \b SYSCTL_OSC_INT, \b SYSCTL_OSC_INT4, //! \b SYSCTL_OSC_INT30, or \b SYSCTL_OSC_EXT32. On Sandstorm-class devices, //! \b SYSCTL_OSC_INT30 and \b SYSCTL_OSC_EXT32 are not valid. //! \b SYSCTL_OSC_EXT32 is only available on devices with the hibernate module, //! and then only when the hibernate module has been enabled. //! //! The internal and main oscillators are disabled with the //! \b SYSCTL_INT_OSC_DIS and \b SYSCTL_MAIN_OSC_DIS flags, respectively. //! The external oscillator must be enabled in order to use an external clock //! source. Note that attempts to disable the oscillator used to clock the //! device is prevented by the hardware. //! //! To clock the system from an external source (such as an external crystal //! oscillator), use \b SYSCTL_USE_OSC \b | \b SYSCTL_OSC_MAIN. To clock the //! system from the main oscillator, use \b SYSCTL_USE_OSC \b | //! \b SYSCTL_OSC_MAIN. To clock the system from the PLL, use //! \b SYSCTL_USE_PLL \b | \b SYSCTL_OSC_MAIN, and select the appropriate //! crystal with one of the \b SYSCTL_XTAL_xxx values. //! //! \note If selecting the PLL as the system clock source (that is, via //! \b SYSCTL_USE_PLL), this function polls the PLL lock interrupt to //! determine when the PLL has locked. If an interrupt handler for the //! system control interrupt is in place, and it responds to and clears the //! PLL lock interrupt, this function delays until its timeout has occurred //! instead of completing as soon as PLL lock is achieved. //! //! \return None. // //*****************************************************************************
Sets the clocking of the device. \param ulConfig is the required configuration of the device clocking. This function configures the clocking of the device. The input crystal frequency, oscillator to be used, use of the PLL, and the system clock divider are all configured with this function. The \e ulConfig parameter is the logical OR of several different values, many of which are grouped into sets where only one can be chosen. The system clock divider is chosen with one of the following values: \b SYSCTL_SYSDIV_1, \b SYSCTL_SYSDIV_2, \b SYSCTL_SYSDIV_3, \b SYSCTL_SYSDIV_64. Only \b SYSCTL_SYSDIV_1 through \b SYSCTL_SYSDIV_16 are valid on Sandstorm-class devices. Half-dividers, such as \b SYSCTL_SYSDIV_2_5 and \b SYSCTL_SYSDIV_3_5. are available on Tempest-, Firestorm-, and Blizzard-class devices. The use of the PLL is chosen with either \b SYSCTL_USE_PLL or \b SYSCTL_USE_OSC. The internal and main oscillators are disabled with the \b SYSCTL_INT_OSC_DIS and \b SYSCTL_MAIN_OSC_DIS flags, respectively. The external oscillator must be enabled in order to use an external clock source. Note that attempts to disable the oscillator used to clock the device is prevented by the hardware. To clock the system from an external source (such as an external crystal oscillator), use \b SYSCTL_USE_OSC \b | \b SYSCTL_OSC_MAIN. To clock the system from the main oscillator, use \b SYSCTL_USE_OSC \b | \b SYSCTL_OSC_MAIN. To clock the system from the PLL, use \b SYSCTL_USE_PLL \b | \b SYSCTL_OSC_MAIN, and select the appropriate crystal with one of the \b SYSCTL_XTAL_xxx values. \note If selecting the PLL as the system clock source (that is, via \b SYSCTL_USE_PLL), this function polls the PLL lock interrupt to determine when the PLL has locked. If an interrupt handler for the system control interrupt is in place, and it responds to and clears the PLL lock interrupt, this function delays until its timeout has occurred instead of completing as soon as PLL lock is achieved. \return None.
[ "Sets", "the", "clocking", "of", "the", "device", ".", "\\", "param", "ulConfig", "is", "the", "required", "configuration", "of", "the", "device", "clocking", ".", "This", "function", "configures", "the", "clocking", "of", "the", "device", ".", "The", "input", "crystal", "frequency", "oscillator", "to", "be", "used", "use", "of", "the", "PLL", "and", "the", "system", "clock", "divider", "are", "all", "configured", "with", "this", "function", ".", "The", "\\", "e", "ulConfig", "parameter", "is", "the", "logical", "OR", "of", "several", "different", "values", "many", "of", "which", "are", "grouped", "into", "sets", "where", "only", "one", "can", "be", "chosen", ".", "The", "system", "clock", "divider", "is", "chosen", "with", "one", "of", "the", "following", "values", ":", "\\", "b", "SYSCTL_SYSDIV_1", "\\", "b", "SYSCTL_SYSDIV_2", "\\", "b", "SYSCTL_SYSDIV_3", "\\", "b", "SYSCTL_SYSDIV_64", ".", "Only", "\\", "b", "SYSCTL_SYSDIV_1", "through", "\\", "b", "SYSCTL_SYSDIV_16", "are", "valid", "on", "Sandstorm", "-", "class", "devices", ".", "Half", "-", "dividers", "such", "as", "\\", "b", "SYSCTL_SYSDIV_2_5", "and", "\\", "b", "SYSCTL_SYSDIV_3_5", ".", "are", "available", "on", "Tempest", "-", "Firestorm", "-", "and", "Blizzard", "-", "class", "devices", ".", "The", "use", "of", "the", "PLL", "is", "chosen", "with", "either", "\\", "b", "SYSCTL_USE_PLL", "or", "\\", "b", "SYSCTL_USE_OSC", ".", "The", "internal", "and", "main", "oscillators", "are", "disabled", "with", "the", "\\", "b", "SYSCTL_INT_OSC_DIS", "and", "\\", "b", "SYSCTL_MAIN_OSC_DIS", "flags", "respectively", ".", "The", "external", "oscillator", "must", "be", "enabled", "in", "order", "to", "use", "an", "external", "clock", "source", ".", "Note", "that", "attempts", "to", "disable", "the", "oscillator", "used", "to", "clock", "the", "device", "is", "prevented", "by", "the", "hardware", ".", "To", "clock", "the", "system", "from", "an", "external", "source", "(", "such", "as", "an", "external", "crystal", "oscillator", ")", "use", "\\", "b", "SYSCTL_USE_OSC", "\\", "b", "|", "\\", "b", "SYSCTL_OSC_MAIN", ".", "To", "clock", "the", "system", "from", "the", "main", "oscillator", "use", "\\", "b", "SYSCTL_USE_OSC", "\\", "b", "|", "\\", "b", "SYSCTL_OSC_MAIN", ".", "To", "clock", "the", "system", "from", "the", "PLL", "use", "\\", "b", "SYSCTL_USE_PLL", "\\", "b", "|", "\\", "b", "SYSCTL_OSC_MAIN", "and", "select", "the", "appropriate", "crystal", "with", "one", "of", "the", "\\", "b", "SYSCTL_XTAL_xxx", "values", ".", "\\", "note", "If", "selecting", "the", "PLL", "as", "the", "system", "clock", "source", "(", "that", "is", "via", "\\", "b", "SYSCTL_USE_PLL", ")", "this", "function", "polls", "the", "PLL", "lock", "interrupt", "to", "determine", "when", "the", "PLL", "has", "locked", ".", "If", "an", "interrupt", "handler", "for", "the", "system", "control", "interrupt", "is", "in", "place", "and", "it", "responds", "to", "and", "clears", "the", "PLL", "lock", "interrupt", "this", "function", "delays", "until", "its", "timeout", "has", "occurred", "instead", "of", "completing", "as", "soon", "as", "PLL", "lock", "is", "achieved", ".", "\\", "return", "None", "." ]
void SysCtlClockSet(unsigned long ulConfig) { unsigned long ulDelay, ulRCC, ulRCC2; if(CLASS_IS_SANDSTORM && (ulConfig & SYSCTL_RCC2_USERCC2)) { return; } ulRCC = HWREG(SYSCTL_RCC); ulRCC2 = HWREG(SYSCTL_RCC2); ulRCC |= SYSCTL_RCC_BYPASS; ulRCC &= ~(SYSCTL_RCC_USESYSDIV); ulRCC2 |= SYSCTL_RCC2_BYPASS2; HWREG(SYSCTL_RCC) = ulRCC; HWREG(SYSCTL_RCC2) = ulRCC2; if(((ulRCC & SYSCTL_RCC_IOSCDIS) && !(ulConfig & SYSCTL_RCC_IOSCDIS)) || ((ulRCC & SYSCTL_RCC_MOSCDIS) && !(ulConfig & SYSCTL_RCC_MOSCDIS))) { ulRCC &= (~(SYSCTL_RCC_IOSCDIS | SYSCTL_RCC_MOSCDIS) | (ulConfig & (SYSCTL_RCC_IOSCDIS | SYSCTL_RCC_MOSCDIS))); HWREG(SYSCTL_RCC) = ulRCC; if(((ulRCC2 & SYSCTL_RCC2_USERCC2) && (((ulRCC2 & SYSCTL_RCC2_OSCSRC2_M) == SYSCTL_RCC2_OSCSRC2_30) || ((ulRCC2 & SYSCTL_RCC2_OSCSRC2_M) == SYSCTL_RCC2_OSCSRC2_32))) || (!(ulRCC2 & SYSCTL_RCC2_USERCC2) && ((ulRCC & SYSCTL_RCC_OSCSRC_M) == SYSCTL_RCC_OSCSRC_30))) { SysCtlDelay(4096); } else { SysCtlDelay(524288); } } ulRCC &= ~(SYSCTL_RCC_XTAL_M | SYSCTL_RCC_OSCSRC_M); ulRCC |= ulConfig & (SYSCTL_RCC_XTAL_M | SYSCTL_RCC_OSCSRC_M); ulRCC2 &= ~(SYSCTL_RCC2_USERCC2 | SYSCTL_RCC2_OSCSRC2_M); ulRCC2 |= ulConfig & (SYSCTL_RCC2_USERCC2 | SYSCTL_RCC_OSCSRC_M); ulRCC2 |= (ulConfig & 0x00000008) << 3; HWREG(SYSCTL_RCC) = ulRCC; HWREG(SYSCTL_RCC2) = ulRCC2; SysCtlDelay(16); ulRCC &= ~(SYSCTL_RCC_PWRDN | SYSCTL_RCC_OEN); ulRCC |= ulConfig & (SYSCTL_RCC_PWRDN | SYSCTL_RCC_OEN); ulRCC2 &= ~(SYSCTL_RCC2_PWRDN2); ulRCC2 |= ulConfig & SYSCTL_RCC2_PWRDN2; HWREG(SYSCTL_MISC) = SYSCTL_INT_PLL_LOCK; if(ulRCC2 & SYSCTL_RCC2_USERCC2) { HWREG(SYSCTL_RCC2) = ulRCC2; HWREG(SYSCTL_RCC) = ulRCC; } else { HWREG(SYSCTL_RCC) = ulRCC; HWREG(SYSCTL_RCC2) = ulRCC2; } ulRCC &= ~(SYSCTL_RCC_SYSDIV_M | SYSCTL_RCC_USESYSDIV | SYSCTL_RCC_IOSCDIS | SYSCTL_RCC_MOSCDIS); ulRCC |= ulConfig & (SYSCTL_RCC_SYSDIV_M | SYSCTL_RCC_USESYSDIV | SYSCTL_RCC_IOSCDIS | SYSCTL_RCC_MOSCDIS); ulRCC2 &= ~(SYSCTL_RCC2_SYSDIV2_M); ulRCC2 |= ulConfig & SYSCTL_RCC2_SYSDIV2_M; if(ulConfig & SYSCTL_RCC2_DIV400) { ulRCC |= SYSCTL_RCC_USESYSDIV; ulRCC2 &= ~(SYSCTL_RCC_USESYSDIV); ulRCC2 |= ulConfig & (SYSCTL_RCC2_DIV400 | SYSCTL_RCC2_SYSDIV2LSB); } else { ulRCC2 &= ~(SYSCTL_RCC2_DIV400); } if(!(ulConfig & SYSCTL_RCC_BYPASS)) { for(ulDelay = 32768; ulDelay > 0; ulDelay--) { if(HWREG(SYSCTL_RIS) & SYSCTL_INT_PLL_LOCK) { break; } } ulRCC &= ~(SYSCTL_RCC_BYPASS); ulRCC2 &= ~(SYSCTL_RCC2_BYPASS2); } HWREG(SYSCTL_RCC) = ulRCC; HWREG(SYSCTL_RCC2) = ulRCC2; SysCtlDelay(16); }
[ "void", "SysCtlClockSet", "(", "unsigned", "long", "ulConfig", ")", "{", "unsigned", "long", "ulDelay", ",", "ulRCC", ",", "ulRCC2", ";", "if", "(", "CLASS_IS_SANDSTORM", "&&", "(", "ulConfig", "&", "SYSCTL_RCC2_USERCC2", ")", ")", "{", "return", ";", "}", "ulRCC", "=", "HWREG", "(", "SYSCTL_RCC", ")", ";", "ulRCC2", "=", "HWREG", "(", "SYSCTL_RCC2", ")", ";", "ulRCC", "|=", "SYSCTL_RCC_BYPASS", ";", "ulRCC", "&=", "~", "(", "SYSCTL_RCC_USESYSDIV", ")", ";", "ulRCC2", "|=", "SYSCTL_RCC2_BYPASS2", ";", "HWREG", "(", "SYSCTL_RCC", ")", "=", "ulRCC", ";", "HWREG", "(", "SYSCTL_RCC2", ")", "=", "ulRCC2", ";", "if", "(", "(", "(", "ulRCC", "&", "SYSCTL_RCC_IOSCDIS", ")", "&&", "!", "(", "ulConfig", "&", "SYSCTL_RCC_IOSCDIS", ")", ")", "||", "(", "(", "ulRCC", "&", "SYSCTL_RCC_MOSCDIS", ")", "&&", "!", "(", "ulConfig", "&", "SYSCTL_RCC_MOSCDIS", ")", ")", ")", "{", "ulRCC", "&=", "(", "~", "(", "SYSCTL_RCC_IOSCDIS", "|", "SYSCTL_RCC_MOSCDIS", ")", "|", "(", "ulConfig", "&", "(", "SYSCTL_RCC_IOSCDIS", "|", "SYSCTL_RCC_MOSCDIS", ")", ")", ")", ";", "HWREG", "(", "SYSCTL_RCC", ")", "=", "ulRCC", ";", "if", "(", "(", "(", "ulRCC2", "&", "SYSCTL_RCC2_USERCC2", ")", "&&", "(", "(", "(", "ulRCC2", "&", "SYSCTL_RCC2_OSCSRC2_M", ")", "==", "SYSCTL_RCC2_OSCSRC2_30", ")", "||", "(", "(", "ulRCC2", "&", "SYSCTL_RCC2_OSCSRC2_M", ")", "==", "SYSCTL_RCC2_OSCSRC2_32", ")", ")", ")", "||", "(", "!", "(", "ulRCC2", "&", "SYSCTL_RCC2_USERCC2", ")", "&&", "(", "(", "ulRCC", "&", "SYSCTL_RCC_OSCSRC_M", ")", "==", "SYSCTL_RCC_OSCSRC_30", ")", ")", ")", "{", "SysCtlDelay", "(", "4096", ")", ";", "}", "else", "{", "SysCtlDelay", "(", "524288", ")", ";", "}", "}", "ulRCC", "&=", "~", "(", "SYSCTL_RCC_XTAL_M", "|", "SYSCTL_RCC_OSCSRC_M", ")", ";", "ulRCC", "|=", "ulConfig", "&", "(", "SYSCTL_RCC_XTAL_M", "|", "SYSCTL_RCC_OSCSRC_M", ")", ";", "ulRCC2", "&=", "~", "(", "SYSCTL_RCC2_USERCC2", "|", "SYSCTL_RCC2_OSCSRC2_M", ")", ";", "ulRCC2", "|=", "ulConfig", "&", "(", "SYSCTL_RCC2_USERCC2", "|", "SYSCTL_RCC_OSCSRC_M", ")", ";", "ulRCC2", "|=", "(", "ulConfig", "&", "0x00000008", ")", "<<", "3", ";", "HWREG", "(", "SYSCTL_RCC", ")", "=", "ulRCC", ";", "HWREG", "(", "SYSCTL_RCC2", ")", "=", "ulRCC2", ";", "SysCtlDelay", "(", "16", ")", ";", "ulRCC", "&=", "~", "(", "SYSCTL_RCC_PWRDN", "|", "SYSCTL_RCC_OEN", ")", ";", "ulRCC", "|=", "ulConfig", "&", "(", "SYSCTL_RCC_PWRDN", "|", "SYSCTL_RCC_OEN", ")", ";", "ulRCC2", "&=", "~", "(", "SYSCTL_RCC2_PWRDN2", ")", ";", "ulRCC2", "|=", "ulConfig", "&", "SYSCTL_RCC2_PWRDN2", ";", "HWREG", "(", "SYSCTL_MISC", ")", "=", "SYSCTL_INT_PLL_LOCK", ";", "if", "(", "ulRCC2", "&", "SYSCTL_RCC2_USERCC2", ")", "{", "HWREG", "(", "SYSCTL_RCC2", ")", "=", "ulRCC2", ";", "HWREG", "(", "SYSCTL_RCC", ")", "=", "ulRCC", ";", "}", "else", "{", "HWREG", "(", "SYSCTL_RCC", ")", "=", "ulRCC", ";", "HWREG", "(", "SYSCTL_RCC2", ")", "=", "ulRCC2", ";", "}", "ulRCC", "&=", "~", "(", "SYSCTL_RCC_SYSDIV_M", "|", "SYSCTL_RCC_USESYSDIV", "|", "SYSCTL_RCC_IOSCDIS", "|", "SYSCTL_RCC_MOSCDIS", ")", ";", "ulRCC", "|=", "ulConfig", "&", "(", "SYSCTL_RCC_SYSDIV_M", "|", "SYSCTL_RCC_USESYSDIV", "|", "SYSCTL_RCC_IOSCDIS", "|", "SYSCTL_RCC_MOSCDIS", ")", ";", "ulRCC2", "&=", "~", "(", "SYSCTL_RCC2_SYSDIV2_M", ")", ";", "ulRCC2", "|=", "ulConfig", "&", "SYSCTL_RCC2_SYSDIV2_M", ";", "if", "(", "ulConfig", "&", "SYSCTL_RCC2_DIV400", ")", "{", "ulRCC", "|=", "SYSCTL_RCC_USESYSDIV", ";", "ulRCC2", "&=", "~", "(", "SYSCTL_RCC_USESYSDIV", ")", ";", "ulRCC2", "|=", "ulConfig", "&", "(", "SYSCTL_RCC2_DIV400", "|", "SYSCTL_RCC2_SYSDIV2LSB", ")", ";", "}", "else", "{", "ulRCC2", "&=", "~", "(", "SYSCTL_RCC2_DIV400", ")", ";", "}", "if", "(", "!", "(", "ulConfig", "&", "SYSCTL_RCC_BYPASS", ")", ")", "{", "for", "(", "ulDelay", "=", "32768", ";", "ulDelay", ">", "0", ";", "ulDelay", "--", ")", "{", "if", "(", "HWREG", "(", "SYSCTL_RIS", ")", "&", "SYSCTL_INT_PLL_LOCK", ")", "{", "break", ";", "}", "}", "ulRCC", "&=", "~", "(", "SYSCTL_RCC_BYPASS", ")", ";", "ulRCC2", "&=", "~", "(", "SYSCTL_RCC2_BYPASS2", ")", ";", "}", "HWREG", "(", "SYSCTL_RCC", ")", "=", "ulRCC", ";", "HWREG", "(", "SYSCTL_RCC2", ")", "=", "ulRCC2", ";", "SysCtlDelay", "(", "16", ")", ";", "}" ]
Sets the clocking of the device.
[ "Sets", "the", "clocking", "of", "the", "device", "." ]
[ "//\r", "// See if this is a Sandstorm-class device and clocking features from newer\r", "// devices were requested.\r", "//\r", "//\r", "// Return without changing the clocking because the requested\r", "// configuration can not be achieved.\r", "//\r", "//\r", "// Get the current value of the RCC and RCC2 registers. If using a\r", "// Sandstorm-class device, the RCC2 register reads back as zero and the\r", "// writes to it from within this function are ignored.\r", "//\r", "//\r", "// Bypass the PLL and system clock dividers for now.\r", "//\r", "//\r", "// Write the new RCC value.\r", "//\r", "//\r", "// See if either oscillator needs to be enabled.\r", "//\r", "//\r", "// Make sure that the required oscillators are enabled. For now, the\r", "// previously enabled oscillators must be enabled along with the newly\r", "// requested oscillators.\r", "//\r", "//\r", "// Write the new RCC value.\r", "//\r", "//\r", "// Wait for a bit, giving the oscillator time to stabilize. The number\r", "// of iterations is adjusted based on the current clock source; a\r", "// smaller number of iterations is required for slower clock rates.\r", "//\r", "//\r", "// Delay for 4096 iterations.\r", "//\r", "//\r", "// Delay for 524,288 iterations.\r", "//\r", "//\r", "// Set the new crystal value and oscillator source. Because the OSCSRC2\r", "// field in RCC2 overlaps the XTAL field in RCC, the OSCSRC field has a\r", "// special encoding within ulConfig to avoid the overlap.\r", "//\r", "//\r", "// Write the new RCC value.\r", "//\r", "//\r", "// Wait for a bit so that new crystal value and oscillator source can take\r", "// effect.\r", "//\r", "//\r", "// Set the PLL configuration.\r", "//\r", "//\r", "// Clear the PLL lock interrupt.\r", "//\r", "//\r", "// Write the new RCC value.\r", "//\r", "//\r", "// Set the requested system divider and disable the appropriate\r", "// oscillators. This value is not written immediately.\r", "//\r", "//\r", "// See if the PLL output is being used to clock the system.\r", "//\r", "//\r", "// Wait until the PLL has locked.\r", "//\r", "//\r", "// Enable use of the PLL.\r", "//\r", "//\r", "// Write the final RCC value.\r", "//\r", "//\r", "// Delay for a little bit so that the system divider takes effect.\r", "//\r" ]
[ { "param": "ulConfig", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulConfig", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlClockGet
null
unsigned long SysCtlClockGet(void) { unsigned long ulRCC, ulRCC2, ulPLL, ulClk; // // Read RCC and RCC2. For Sandstorm-class devices (which do not have // RCC2), the RCC2 read returns 0, indicating that RCC2 is // disabled (because the SYSCTL_RCC2_USERCC2 bit is clear). // ulRCC = HWREG(SYSCTL_RCC); ulRCC2 = HWREG(SYSCTL_RCC2); // // Get the base clock rate. // switch((ulRCC2 & SYSCTL_RCC2_USERCC2) ? (ulRCC2 & SYSCTL_RCC2_OSCSRC2_M) : (ulRCC & SYSCTL_RCC_OSCSRC_M)) { // // The main oscillator is the clock source. Determine its rate from // the crystal setting field. // case SYSCTL_RCC_OSCSRC_MAIN: { ulClk = g_pulXtals[(ulRCC & SYSCTL_RCC_XTAL_M) >> SYSCTL_RCC_XTAL_S]; break; } // // The internal oscillator is the source clock. // case SYSCTL_RCC_OSCSRC_INT: { // // See if this is a Sandstorm-class or Fury-class device. // if(CLASS_IS_SANDSTORM) { // // The internal oscillator on a Sandstorm-class device is // 15 MHz +/- 50%. // ulClk = 15000000; } else if((CLASS_IS_FURY && REVISION_IS_A2) || (CLASS_IS_DUSTDEVIL && REVISION_IS_A0)) { // // The internal oscillator on a rev A2 Fury-class device and a // Dustdevil-class device is 12 MHz +/- 30%. // ulClk = 12000000; } else { // // The internal oscillator on all other devices is 16 MHz. // ulClk = 16000000; } break; } // // The internal oscillator divided by four is the source clock. // case SYSCTL_RCC_OSCSRC_INT4: { // // See if this is a Sandstorm-class or Fury-class device. // if(CLASS_IS_SANDSTORM) { // // The internal oscillator on a Sandstorm-class device is // 15 MHz +/- 50%. // ulClk = 15000000 / 4; } else if((CLASS_IS_FURY && REVISION_IS_A2) || (CLASS_IS_DUSTDEVIL && REVISION_IS_A0)) { // // The internal oscillator on a rev A2 Fury-class device and a // Dustdevil-class device is 12 MHz +/- 30%. // ulClk = 12000000 / 4; } else { // // The internal oscillator on a Tempest-class device is 16 MHz. // ulClk = 16000000 / 4; } break; } // // The internal 30-KHz oscillator is the source clock. // case SYSCTL_RCC_OSCSRC_30: { // // The internal 30-KHz oscillator has an accuracy of +/- 30%. // ulClk = 30000; break; } // // The 4.194304-MHz clock from the hibernate module is the clock // source. // case SYSCTL_RCC2_OSCSRC2_419: { ulClk = 4194304; break; } // // The 32.768-KHz clock from the hibernate module is the source clock. // case SYSCTL_RCC2_OSCSRC2_32: { ulClk = 32768; break; } // // An unknown setting, so return a zero clock (that is, an unknown // clock rate). // default: { return(0); } } // // See if the PLL is being used. // if(((ulRCC2 & SYSCTL_RCC2_USERCC2) && !(ulRCC2 & SYSCTL_RCC2_BYPASS2)) || (!(ulRCC2 & SYSCTL_RCC2_USERCC2) && !(ulRCC & SYSCTL_RCC_BYPASS))) { // // Get the PLL configuration. // ulPLL = HWREG(SYSCTL_PLLCFG); // // See if this is a Sandstorm-class or Fury-class device. // if(CLASS_IS_SANDSTORM) { // // Compute the PLL output frequency based on its input frequency. // The formula for a Sandstorm-class devices is // "(xtal * (f + 2)) / (r + 2)". // ulClk = ((ulClk * (((ulPLL & SYSCTL_PLLCFG_F_M) >> SYSCTL_PLLCFG_F_S) + 2)) / (((ulPLL & SYSCTL_PLLCFG_R_M) >> SYSCTL_PLLCFG_R_S) + 2)); } else { // // Compute the PLL output frequency based on its input // frequency. The formula for a Fury-class device is // "(xtal * f) / ((r + 1) * 2)". // ulClk = ((ulClk * ((ulPLL & SYSCTL_PLLCFG_F_M) >> SYSCTL_PLLCFG_F_S)) / ((((ulPLL & SYSCTL_PLLCFG_R_M) >> SYSCTL_PLLCFG_R_S) + 1) * 2)); } // // See if the optional output divide by 2 is being used. // if(ulPLL & SYSCTL_PLLCFG_OD_2) { ulClk /= 2; } // // See if the optional output divide by 4 is being used. // if(ulPLL & SYSCTL_PLLCFG_OD_4) { ulClk /= 4; } // // Force the system divider to be enabled. It is always used when // using the PLL, but in some cases it does not read as being enabled. // ulRCC |= SYSCTL_RCC_USESYSDIV; } // // See if the system divider is being used. // if(ulRCC & SYSCTL_RCC_USESYSDIV) { // // Adjust the clock rate by the system clock divider. // if(ulRCC2 & SYSCTL_RCC2_USERCC2) { if((ulRCC2 & SYSCTL_RCC2_DIV400) && (((ulRCC2 & SYSCTL_RCC2_USERCC2) && !(ulRCC2 & SYSCTL_RCC2_BYPASS2)) || (!(ulRCC2 & SYSCTL_RCC2_USERCC2) && !(ulRCC & SYSCTL_RCC_BYPASS)))) { ulClk = ((ulClk * 2) / (((ulRCC2 & (SYSCTL_RCC2_SYSDIV2_M | SYSCTL_RCC2_SYSDIV2LSB)) >> (SYSCTL_RCC2_SYSDIV2_S - 1)) + 1)); } else { ulClk /= (((ulRCC2 & SYSCTL_RCC2_SYSDIV2_M) >> SYSCTL_RCC2_SYSDIV2_S) + 1); } } else { ulClk /= (((ulRCC & SYSCTL_RCC_SYSDIV_M) >> SYSCTL_RCC_SYSDIV_S) + 1); } } // // Return the computed clock rate. // return(ulClk); }
//***************************************************************************** // //! Gets the processor clock rate. //! //! This function determines the clock rate of the processor clock, which is //! also the clock rate of the peripheral modules (with the exception of //! PWM, which has its own clock divider; other peripherals may have different //! clocking, see the device data sheet for details). //! //! \note This cannot return accurate results if SysCtlClockSet() has not //! been called to configure the clocking of the device, or if the device is //! directly clocked from a crystal (or a clock source) that is not one of the //! supported crystal frequencies. In the latter case, this function should be //! modified to directly return the correct system clock rate. //! //! \return The processor clock rate. // //*****************************************************************************
Gets the processor clock rate. This function determines the clock rate of the processor clock, which is also the clock rate of the peripheral modules (with the exception of PWM, which has its own clock divider; other peripherals may have different clocking, see the device data sheet for details). \note This cannot return accurate results if SysCtlClockSet() has not been called to configure the clocking of the device, or if the device is directly clocked from a crystal (or a clock source) that is not one of the supported crystal frequencies. In the latter case, this function should be modified to directly return the correct system clock rate. \return The processor clock rate.
[ "Gets", "the", "processor", "clock", "rate", ".", "This", "function", "determines", "the", "clock", "rate", "of", "the", "processor", "clock", "which", "is", "also", "the", "clock", "rate", "of", "the", "peripheral", "modules", "(", "with", "the", "exception", "of", "PWM", "which", "has", "its", "own", "clock", "divider", ";", "other", "peripherals", "may", "have", "different", "clocking", "see", "the", "device", "data", "sheet", "for", "details", ")", ".", "\\", "note", "This", "cannot", "return", "accurate", "results", "if", "SysCtlClockSet", "()", "has", "not", "been", "called", "to", "configure", "the", "clocking", "of", "the", "device", "or", "if", "the", "device", "is", "directly", "clocked", "from", "a", "crystal", "(", "or", "a", "clock", "source", ")", "that", "is", "not", "one", "of", "the", "supported", "crystal", "frequencies", ".", "In", "the", "latter", "case", "this", "function", "should", "be", "modified", "to", "directly", "return", "the", "correct", "system", "clock", "rate", ".", "\\", "return", "The", "processor", "clock", "rate", "." ]
unsigned long SysCtlClockGet(void) { unsigned long ulRCC, ulRCC2, ulPLL, ulClk; ulRCC = HWREG(SYSCTL_RCC); ulRCC2 = HWREG(SYSCTL_RCC2); switch((ulRCC2 & SYSCTL_RCC2_USERCC2) ? (ulRCC2 & SYSCTL_RCC2_OSCSRC2_M) : (ulRCC & SYSCTL_RCC_OSCSRC_M)) { case SYSCTL_RCC_OSCSRC_MAIN: { ulClk = g_pulXtals[(ulRCC & SYSCTL_RCC_XTAL_M) >> SYSCTL_RCC_XTAL_S]; break; } case SYSCTL_RCC_OSCSRC_INT: { if(CLASS_IS_SANDSTORM) { ulClk = 15000000; } else if((CLASS_IS_FURY && REVISION_IS_A2) || (CLASS_IS_DUSTDEVIL && REVISION_IS_A0)) { ulClk = 12000000; } else { ulClk = 16000000; } break; } case SYSCTL_RCC_OSCSRC_INT4: { if(CLASS_IS_SANDSTORM) { ulClk = 15000000 / 4; } else if((CLASS_IS_FURY && REVISION_IS_A2) || (CLASS_IS_DUSTDEVIL && REVISION_IS_A0)) { ulClk = 12000000 / 4; } else { ulClk = 16000000 / 4; } break; } case SYSCTL_RCC_OSCSRC_30: { ulClk = 30000; break; } case SYSCTL_RCC2_OSCSRC2_419: { ulClk = 4194304; break; } case SYSCTL_RCC2_OSCSRC2_32: { ulClk = 32768; break; } default: { return(0); } } if(((ulRCC2 & SYSCTL_RCC2_USERCC2) && !(ulRCC2 & SYSCTL_RCC2_BYPASS2)) || (!(ulRCC2 & SYSCTL_RCC2_USERCC2) && !(ulRCC & SYSCTL_RCC_BYPASS))) { ulPLL = HWREG(SYSCTL_PLLCFG); if(CLASS_IS_SANDSTORM) { ulClk = ((ulClk * (((ulPLL & SYSCTL_PLLCFG_F_M) >> SYSCTL_PLLCFG_F_S) + 2)) / (((ulPLL & SYSCTL_PLLCFG_R_M) >> SYSCTL_PLLCFG_R_S) + 2)); } else { ulClk = ((ulClk * ((ulPLL & SYSCTL_PLLCFG_F_M) >> SYSCTL_PLLCFG_F_S)) / ((((ulPLL & SYSCTL_PLLCFG_R_M) >> SYSCTL_PLLCFG_R_S) + 1) * 2)); } if(ulPLL & SYSCTL_PLLCFG_OD_2) { ulClk /= 2; } if(ulPLL & SYSCTL_PLLCFG_OD_4) { ulClk /= 4; } ulRCC |= SYSCTL_RCC_USESYSDIV; } if(ulRCC & SYSCTL_RCC_USESYSDIV) { if(ulRCC2 & SYSCTL_RCC2_USERCC2) { if((ulRCC2 & SYSCTL_RCC2_DIV400) && (((ulRCC2 & SYSCTL_RCC2_USERCC2) && !(ulRCC2 & SYSCTL_RCC2_BYPASS2)) || (!(ulRCC2 & SYSCTL_RCC2_USERCC2) && !(ulRCC & SYSCTL_RCC_BYPASS)))) { ulClk = ((ulClk * 2) / (((ulRCC2 & (SYSCTL_RCC2_SYSDIV2_M | SYSCTL_RCC2_SYSDIV2LSB)) >> (SYSCTL_RCC2_SYSDIV2_S - 1)) + 1)); } else { ulClk /= (((ulRCC2 & SYSCTL_RCC2_SYSDIV2_M) >> SYSCTL_RCC2_SYSDIV2_S) + 1); } } else { ulClk /= (((ulRCC & SYSCTL_RCC_SYSDIV_M) >> SYSCTL_RCC_SYSDIV_S) + 1); } } return(ulClk); }
[ "unsigned", "long", "SysCtlClockGet", "(", "void", ")", "{", "unsigned", "long", "ulRCC", ",", "ulRCC2", ",", "ulPLL", ",", "ulClk", ";", "ulRCC", "=", "HWREG", "(", "SYSCTL_RCC", ")", ";", "ulRCC2", "=", "HWREG", "(", "SYSCTL_RCC2", ")", ";", "switch", "(", "(", "ulRCC2", "&", "SYSCTL_RCC2_USERCC2", ")", "?", "(", "ulRCC2", "&", "SYSCTL_RCC2_OSCSRC2_M", ")", ":", "(", "ulRCC", "&", "SYSCTL_RCC_OSCSRC_M", ")", ")", "{", "case", "SYSCTL_RCC_OSCSRC_MAIN", ":", "{", "ulClk", "=", "g_pulXtals", "[", "(", "ulRCC", "&", "SYSCTL_RCC_XTAL_M", ")", ">>", "SYSCTL_RCC_XTAL_S", "]", ";", "break", ";", "}", "case", "SYSCTL_RCC_OSCSRC_INT", ":", "{", "if", "(", "CLASS_IS_SANDSTORM", ")", "{", "ulClk", "=", "15000000", ";", "}", "else", "if", "(", "(", "CLASS_IS_FURY", "&&", "REVISION_IS_A2", ")", "||", "(", "CLASS_IS_DUSTDEVIL", "&&", "REVISION_IS_A0", ")", ")", "{", "ulClk", "=", "12000000", ";", "}", "else", "{", "ulClk", "=", "16000000", ";", "}", "break", ";", "}", "case", "SYSCTL_RCC_OSCSRC_INT4", ":", "{", "if", "(", "CLASS_IS_SANDSTORM", ")", "{", "ulClk", "=", "15000000", "/", "4", ";", "}", "else", "if", "(", "(", "CLASS_IS_FURY", "&&", "REVISION_IS_A2", ")", "||", "(", "CLASS_IS_DUSTDEVIL", "&&", "REVISION_IS_A0", ")", ")", "{", "ulClk", "=", "12000000", "/", "4", ";", "}", "else", "{", "ulClk", "=", "16000000", "/", "4", ";", "}", "break", ";", "}", "case", "SYSCTL_RCC_OSCSRC_30", ":", "{", "ulClk", "=", "30000", ";", "break", ";", "}", "case", "SYSCTL_RCC2_OSCSRC2_419", ":", "{", "ulClk", "=", "4194304", ";", "break", ";", "}", "case", "SYSCTL_RCC2_OSCSRC2_32", ":", "{", "ulClk", "=", "32768", ";", "break", ";", "}", "default", ":", "{", "return", "(", "0", ")", ";", "}", "}", "if", "(", "(", "(", "ulRCC2", "&", "SYSCTL_RCC2_USERCC2", ")", "&&", "!", "(", "ulRCC2", "&", "SYSCTL_RCC2_BYPASS2", ")", ")", "||", "(", "!", "(", "ulRCC2", "&", "SYSCTL_RCC2_USERCC2", ")", "&&", "!", "(", "ulRCC", "&", "SYSCTL_RCC_BYPASS", ")", ")", ")", "{", "ulPLL", "=", "HWREG", "(", "SYSCTL_PLLCFG", ")", ";", "if", "(", "CLASS_IS_SANDSTORM", ")", "{", "ulClk", "=", "(", "(", "ulClk", "*", "(", "(", "(", "ulPLL", "&", "SYSCTL_PLLCFG_F_M", ")", ">>", "SYSCTL_PLLCFG_F_S", ")", "+", "2", ")", ")", "/", "(", "(", "(", "ulPLL", "&", "SYSCTL_PLLCFG_R_M", ")", ">>", "SYSCTL_PLLCFG_R_S", ")", "+", "2", ")", ")", ";", "}", "else", "{", "ulClk", "=", "(", "(", "ulClk", "*", "(", "(", "ulPLL", "&", "SYSCTL_PLLCFG_F_M", ")", ">>", "SYSCTL_PLLCFG_F_S", ")", ")", "/", "(", "(", "(", "(", "ulPLL", "&", "SYSCTL_PLLCFG_R_M", ")", ">>", "SYSCTL_PLLCFG_R_S", ")", "+", "1", ")", "*", "2", ")", ")", ";", "}", "if", "(", "ulPLL", "&", "SYSCTL_PLLCFG_OD_2", ")", "{", "ulClk", "/=", "2", ";", "}", "if", "(", "ulPLL", "&", "SYSCTL_PLLCFG_OD_4", ")", "{", "ulClk", "/=", "4", ";", "}", "ulRCC", "|=", "SYSCTL_RCC_USESYSDIV", ";", "}", "if", "(", "ulRCC", "&", "SYSCTL_RCC_USESYSDIV", ")", "{", "if", "(", "ulRCC2", "&", "SYSCTL_RCC2_USERCC2", ")", "{", "if", "(", "(", "ulRCC2", "&", "SYSCTL_RCC2_DIV400", ")", "&&", "(", "(", "(", "ulRCC2", "&", "SYSCTL_RCC2_USERCC2", ")", "&&", "!", "(", "ulRCC2", "&", "SYSCTL_RCC2_BYPASS2", ")", ")", "||", "(", "!", "(", "ulRCC2", "&", "SYSCTL_RCC2_USERCC2", ")", "&&", "!", "(", "ulRCC", "&", "SYSCTL_RCC_BYPASS", ")", ")", ")", ")", "{", "ulClk", "=", "(", "(", "ulClk", "*", "2", ")", "/", "(", "(", "(", "ulRCC2", "&", "(", "SYSCTL_RCC2_SYSDIV2_M", "|", "SYSCTL_RCC2_SYSDIV2LSB", ")", ")", ">>", "(", "SYSCTL_RCC2_SYSDIV2_S", "-", "1", ")", ")", "+", "1", ")", ")", ";", "}", "else", "{", "ulClk", "/=", "(", "(", "(", "ulRCC2", "&", "SYSCTL_RCC2_SYSDIV2_M", ")", ">>", "SYSCTL_RCC2_SYSDIV2_S", ")", "+", "1", ")", ";", "}", "}", "else", "{", "ulClk", "/=", "(", "(", "(", "ulRCC", "&", "SYSCTL_RCC_SYSDIV_M", ")", ">>", "SYSCTL_RCC_SYSDIV_S", ")", "+", "1", ")", ";", "}", "}", "return", "(", "ulClk", ")", ";", "}" ]
Gets the processor clock rate.
[ "Gets", "the", "processor", "clock", "rate", "." ]
[ "//\r", "// Read RCC and RCC2. For Sandstorm-class devices (which do not have\r", "// RCC2), the RCC2 read returns 0, indicating that RCC2 is\r", "// disabled (because the SYSCTL_RCC2_USERCC2 bit is clear).\r", "//\r", "//\r", "// Get the base clock rate.\r", "//\r", "//\r", "// The main oscillator is the clock source. Determine its rate from\r", "// the crystal setting field.\r", "//\r", "//\r", "// The internal oscillator is the source clock.\r", "//\r", "//\r", "// See if this is a Sandstorm-class or Fury-class device.\r", "//\r", "//\r", "// The internal oscillator on a Sandstorm-class device is\r", "// 15 MHz +/- 50%.\r", "//\r", "//\r", "// The internal oscillator on a rev A2 Fury-class device and a\r", "// Dustdevil-class device is 12 MHz +/- 30%.\r", "//\r", "//\r", "// The internal oscillator on all other devices is 16 MHz.\r", "//\r", "//\r", "// The internal oscillator divided by four is the source clock.\r", "//\r", "//\r", "// See if this is a Sandstorm-class or Fury-class device.\r", "//\r", "//\r", "// The internal oscillator on a Sandstorm-class device is\r", "// 15 MHz +/- 50%.\r", "//\r", "//\r", "// The internal oscillator on a rev A2 Fury-class device and a\r", "// Dustdevil-class device is 12 MHz +/- 30%.\r", "//\r", "//\r", "// The internal oscillator on a Tempest-class device is 16 MHz.\r", "//\r", "//\r", "// The internal 30-KHz oscillator is the source clock.\r", "//\r", "//\r", "// The internal 30-KHz oscillator has an accuracy of +/- 30%.\r", "//\r", "//\r", "// The 4.194304-MHz clock from the hibernate module is the clock\r", "// source.\r", "//\r", "//\r", "// The 32.768-KHz clock from the hibernate module is the source clock.\r", "//\r", "//\r", "// An unknown setting, so return a zero clock (that is, an unknown\r", "// clock rate).\r", "//\r", "//\r", "// See if the PLL is being used.\r", "//\r", "//\r", "// Get the PLL configuration.\r", "//\r", "//\r", "// See if this is a Sandstorm-class or Fury-class device.\r", "//\r", "//\r", "// Compute the PLL output frequency based on its input frequency.\r", "// The formula for a Sandstorm-class devices is\r", "// \"(xtal * (f + 2)) / (r + 2)\".\r", "//\r", "//\r", "// Compute the PLL output frequency based on its input\r", "// frequency. The formula for a Fury-class device is\r", "// \"(xtal * f) / ((r + 1) * 2)\".\r", "//\r", "//\r", "// See if the optional output divide by 2 is being used.\r", "//\r", "//\r", "// See if the optional output divide by 4 is being used.\r", "//\r", "//\r", "// Force the system divider to be enabled. It is always used when\r", "// using the PLL, but in some cases it does not read as being enabled.\r", "//\r", "//\r", "// See if the system divider is being used.\r", "//\r", "//\r", "// Adjust the clock rate by the system clock divider.\r", "//\r", "//\r", "// Return the computed clock rate.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlDeepSleepClockSet
void
void SysCtlDeepSleepClockSet(unsigned long ulConfig) { // // Set the deep-sleep clock configuration. // HWREG(SYSCTL_DSLPCLKCFG) = ulConfig; }
//***************************************************************************** // //! Sets the clocking of the device while in deep-sleep mode. //! //! \param ulConfig is the required configuration of the device clocking while //! in deep-sleep mode. //! //! This function configures the clocking of the device while in deep-sleep //! mode. The oscillator to be used and the system clock divider are //! configured with this function. //! //! The \e ulConfig parameter is the logical OR of the following values: //! //! The system clock divider is chosen from one of the following values: //! \b SYSCTL_DSLP_DIV_1, \b SYSCTL_DSLP_DIV_2, \b SYSCTL_DSLP_DIV_3, ... //! \b SYSCTL_DSLP_DIV_64. //! //! The oscillator source is chosen from one of the following values: //! \b SYSCTL_DSLP_OSC_MAIN, \b SYSCTL_DSLP_OSC_INT, \b SYSCTL_DSLP_OSC_INT30, //! or \b SYSCTL_DSLP_OSC_EXT32. \b SYSCTL_OSC_EXT32 is only available on //! devices with the hibernation module, and then only when the hibernation //! module has been enabled. //! //! The precision internal oscillator can be powered down in deep-sleep mode by //! specifying \b SYSCTL_DSLP_PIOSC_PD. The precision internal oscillator is //! not powered down if it is required for operation while in deep-sleep //! (based on other configuration settings.) //! //! \note The availability of deep-sleep clocking configuration varies with the //! Stellaris part in use. Please consult the data sheet for the part you are //! using to determine whether this support is available. //! //! \return None. // //*****************************************************************************
Sets the clocking of the device while in deep-sleep mode. \param ulConfig is the required configuration of the device clocking while in deep-sleep mode. This function configures the clocking of the device while in deep-sleep mode. The oscillator to be used and the system clock divider are configured with this function. The \e ulConfig parameter is the logical OR of the following values. The system clock divider is chosen from one of the following values: \b SYSCTL_DSLP_DIV_1, \b SYSCTL_DSLP_DIV_2, \b SYSCTL_DSLP_DIV_3, \b SYSCTL_DSLP_DIV_64. The oscillator source is chosen from one of the following values: \b SYSCTL_DSLP_OSC_MAIN, \b SYSCTL_DSLP_OSC_INT, \b SYSCTL_DSLP_OSC_INT30, or \b SYSCTL_DSLP_OSC_EXT32. \b SYSCTL_OSC_EXT32 is only available on devices with the hibernation module, and then only when the hibernation module has been enabled. The precision internal oscillator can be powered down in deep-sleep mode by specifying \b SYSCTL_DSLP_PIOSC_PD. The precision internal oscillator is not powered down if it is required for operation while in deep-sleep (based on other configuration settings.) \note The availability of deep-sleep clocking configuration varies with the Stellaris part in use. Please consult the data sheet for the part you are using to determine whether this support is available. \return None.
[ "Sets", "the", "clocking", "of", "the", "device", "while", "in", "deep", "-", "sleep", "mode", ".", "\\", "param", "ulConfig", "is", "the", "required", "configuration", "of", "the", "device", "clocking", "while", "in", "deep", "-", "sleep", "mode", ".", "This", "function", "configures", "the", "clocking", "of", "the", "device", "while", "in", "deep", "-", "sleep", "mode", ".", "The", "oscillator", "to", "be", "used", "and", "the", "system", "clock", "divider", "are", "configured", "with", "this", "function", ".", "The", "\\", "e", "ulConfig", "parameter", "is", "the", "logical", "OR", "of", "the", "following", "values", ".", "The", "system", "clock", "divider", "is", "chosen", "from", "one", "of", "the", "following", "values", ":", "\\", "b", "SYSCTL_DSLP_DIV_1", "\\", "b", "SYSCTL_DSLP_DIV_2", "\\", "b", "SYSCTL_DSLP_DIV_3", "\\", "b", "SYSCTL_DSLP_DIV_64", ".", "The", "oscillator", "source", "is", "chosen", "from", "one", "of", "the", "following", "values", ":", "\\", "b", "SYSCTL_DSLP_OSC_MAIN", "\\", "b", "SYSCTL_DSLP_OSC_INT", "\\", "b", "SYSCTL_DSLP_OSC_INT30", "or", "\\", "b", "SYSCTL_DSLP_OSC_EXT32", ".", "\\", "b", "SYSCTL_OSC_EXT32", "is", "only", "available", "on", "devices", "with", "the", "hibernation", "module", "and", "then", "only", "when", "the", "hibernation", "module", "has", "been", "enabled", ".", "The", "precision", "internal", "oscillator", "can", "be", "powered", "down", "in", "deep", "-", "sleep", "mode", "by", "specifying", "\\", "b", "SYSCTL_DSLP_PIOSC_PD", ".", "The", "precision", "internal", "oscillator", "is", "not", "powered", "down", "if", "it", "is", "required", "for", "operation", "while", "in", "deep", "-", "sleep", "(", "based", "on", "other", "configuration", "settings", ".", ")", "\\", "note", "The", "availability", "of", "deep", "-", "sleep", "clocking", "configuration", "varies", "with", "the", "Stellaris", "part", "in", "use", ".", "Please", "consult", "the", "data", "sheet", "for", "the", "part", "you", "are", "using", "to", "determine", "whether", "this", "support", "is", "available", ".", "\\", "return", "None", "." ]
void SysCtlDeepSleepClockSet(unsigned long ulConfig) { HWREG(SYSCTL_DSLPCLKCFG) = ulConfig; }
[ "void", "SysCtlDeepSleepClockSet", "(", "unsigned", "long", "ulConfig", ")", "{", "HWREG", "(", "SYSCTL_DSLPCLKCFG", ")", "=", "ulConfig", ";", "}" ]
Sets the clocking of the device while in deep-sleep mode.
[ "Sets", "the", "clocking", "of", "the", "device", "while", "in", "deep", "-", "sleep", "mode", "." ]
[ "//\r", "// Set the deep-sleep clock configuration.\r", "//\r" ]
[ { "param": "ulConfig", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulConfig", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlPWMClockSet
void
void SysCtlPWMClockSet(unsigned long ulConfig) { // // Check the arguments. // ASSERT((ulConfig == SYSCTL_PWMDIV_1) || (ulConfig == SYSCTL_PWMDIV_2) || (ulConfig == SYSCTL_PWMDIV_4) || (ulConfig == SYSCTL_PWMDIV_8) || (ulConfig == SYSCTL_PWMDIV_16) || (ulConfig == SYSCTL_PWMDIV_32) || (ulConfig == SYSCTL_PWMDIV_64)); // // Check that there is a PWM block on this part. // ASSERT(HWREG(SYSCTL_DC1) & SYSCTL_DC1_PWM0); // // Set the PWM clock configuration into the run-mode clock configuration // register. // HWREG(SYSCTL_RCC) = ((HWREG(SYSCTL_RCC) & ~(SYSCTL_RCC_USEPWMDIV | SYSCTL_RCC_PWMDIV_M)) | ulConfig); }
//***************************************************************************** // //! Sets the PWM clock configuration. //! //! \param ulConfig is the configuration for the PWM clock; it must be one of //! \b SYSCTL_PWMDIV_1, \b SYSCTL_PWMDIV_2, \b SYSCTL_PWMDIV_4, //! \b SYSCTL_PWMDIV_8, \b SYSCTL_PWMDIV_16, \b SYSCTL_PWMDIV_32, or //! \b SYSCTL_PWMDIV_64. //! //! This function configures the rate of the clock provided to the PWM module //! as a ratio of the processor clock. This clock is used by the PWM module to //! generate PWM signals; its rate forms the basis for all PWM signals. //! //! \note The clocking of the PWM is dependent upon the system clock rate as //! configured by SysCtlClockSet(). //! //! \return None. // //*****************************************************************************
Sets the PWM clock configuration. This function configures the rate of the clock provided to the PWM module as a ratio of the processor clock. This clock is used by the PWM module to generate PWM signals; its rate forms the basis for all PWM signals. \note The clocking of the PWM is dependent upon the system clock rate as configured by SysCtlClockSet(). \return None.
[ "Sets", "the", "PWM", "clock", "configuration", ".", "This", "function", "configures", "the", "rate", "of", "the", "clock", "provided", "to", "the", "PWM", "module", "as", "a", "ratio", "of", "the", "processor", "clock", ".", "This", "clock", "is", "used", "by", "the", "PWM", "module", "to", "generate", "PWM", "signals", ";", "its", "rate", "forms", "the", "basis", "for", "all", "PWM", "signals", ".", "\\", "note", "The", "clocking", "of", "the", "PWM", "is", "dependent", "upon", "the", "system", "clock", "rate", "as", "configured", "by", "SysCtlClockSet", "()", ".", "\\", "return", "None", "." ]
void SysCtlPWMClockSet(unsigned long ulConfig) { ASSERT((ulConfig == SYSCTL_PWMDIV_1) || (ulConfig == SYSCTL_PWMDIV_2) || (ulConfig == SYSCTL_PWMDIV_4) || (ulConfig == SYSCTL_PWMDIV_8) || (ulConfig == SYSCTL_PWMDIV_16) || (ulConfig == SYSCTL_PWMDIV_32) || (ulConfig == SYSCTL_PWMDIV_64)); ASSERT(HWREG(SYSCTL_DC1) & SYSCTL_DC1_PWM0); HWREG(SYSCTL_RCC) = ((HWREG(SYSCTL_RCC) & ~(SYSCTL_RCC_USEPWMDIV | SYSCTL_RCC_PWMDIV_M)) | ulConfig); }
[ "void", "SysCtlPWMClockSet", "(", "unsigned", "long", "ulConfig", ")", "{", "ASSERT", "(", "(", "ulConfig", "==", "SYSCTL_PWMDIV_1", ")", "||", "(", "ulConfig", "==", "SYSCTL_PWMDIV_2", ")", "||", "(", "ulConfig", "==", "SYSCTL_PWMDIV_4", ")", "||", "(", "ulConfig", "==", "SYSCTL_PWMDIV_8", ")", "||", "(", "ulConfig", "==", "SYSCTL_PWMDIV_16", ")", "||", "(", "ulConfig", "==", "SYSCTL_PWMDIV_32", ")", "||", "(", "ulConfig", "==", "SYSCTL_PWMDIV_64", ")", ")", ";", "ASSERT", "(", "HWREG", "(", "SYSCTL_DC1", ")", "&", "SYSCTL_DC1_PWM0", ")", ";", "HWREG", "(", "SYSCTL_RCC", ")", "=", "(", "(", "HWREG", "(", "SYSCTL_RCC", ")", "&", "~", "(", "SYSCTL_RCC_USEPWMDIV", "|", "SYSCTL_RCC_PWMDIV_M", ")", ")", "|", "ulConfig", ")", ";", "}" ]
Sets the PWM clock configuration.
[ "Sets", "the", "PWM", "clock", "configuration", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Check that there is a PWM block on this part.\r", "//\r", "//\r", "// Set the PWM clock configuration into the run-mode clock configuration\r", "// register.\r", "//\r" ]
[ { "param": "ulConfig", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulConfig", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlPWMClockGet
null
unsigned long SysCtlPWMClockGet(void) { // // Check that there is a PWM block on this part. // ASSERT(HWREG(SYSCTL_DC1) & SYSCTL_DC1_PWM0); // // Return the current PWM clock configuration. Make sure that // SYSCTL_PWMDIV_1 is returned in all cases where the divider is disabled. // if(!(HWREG(SYSCTL_RCC) & SYSCTL_RCC_USEPWMDIV)) { // // The divider is not active so reflect this in the value we return. // return(SYSCTL_PWMDIV_1); } else { // // The divider is active so directly return the masked register value. // return(HWREG(SYSCTL_RCC) & (SYSCTL_RCC_USEPWMDIV | SYSCTL_RCC_PWMDIV_M)); } }
//***************************************************************************** // //! Gets the current PWM clock configuration. //! //! This function returns the current PWM clock configuration. //! //! \return Returns the current PWM clock configuration; is one of //! \b SYSCTL_PWMDIV_1, \b SYSCTL_PWMDIV_2, \b SYSCTL_PWMDIV_4, //! \b SYSCTL_PWMDIV_8, \b SYSCTL_PWMDIV_16, \b SYSCTL_PWMDIV_32, or //! \b SYSCTL_PWMDIV_64. // //*****************************************************************************
Gets the current PWM clock configuration. This function returns the current PWM clock configuration.
[ "Gets", "the", "current", "PWM", "clock", "configuration", ".", "This", "function", "returns", "the", "current", "PWM", "clock", "configuration", "." ]
unsigned long SysCtlPWMClockGet(void) { ASSERT(HWREG(SYSCTL_DC1) & SYSCTL_DC1_PWM0); if(!(HWREG(SYSCTL_RCC) & SYSCTL_RCC_USEPWMDIV)) { return(SYSCTL_PWMDIV_1); } else { return(HWREG(SYSCTL_RCC) & (SYSCTL_RCC_USEPWMDIV | SYSCTL_RCC_PWMDIV_M)); } }
[ "unsigned", "long", "SysCtlPWMClockGet", "(", "void", ")", "{", "ASSERT", "(", "HWREG", "(", "SYSCTL_DC1", ")", "&", "SYSCTL_DC1_PWM0", ")", ";", "if", "(", "!", "(", "HWREG", "(", "SYSCTL_RCC", ")", "&", "SYSCTL_RCC_USEPWMDIV", ")", ")", "{", "return", "(", "SYSCTL_PWMDIV_1", ")", ";", "}", "else", "{", "return", "(", "HWREG", "(", "SYSCTL_RCC", ")", "&", "(", "SYSCTL_RCC_USEPWMDIV", "|", "SYSCTL_RCC_PWMDIV_M", ")", ")", ";", "}", "}" ]
Gets the current PWM clock configuration.
[ "Gets", "the", "current", "PWM", "clock", "configuration", "." ]
[ "//\r", "// Check that there is a PWM block on this part.\r", "//\r", "//\r", "// Return the current PWM clock configuration. Make sure that\r", "// SYSCTL_PWMDIV_1 is returned in all cases where the divider is disabled.\r", "//\r", "//\r", "// The divider is not active so reflect this in the value we return.\r", "//\r", "//\r", "// The divider is active so directly return the masked register value.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlADCSpeedSet
void
void SysCtlADCSpeedSet(unsigned long ulSpeed) { // // Check the arguments. // ASSERT((ulSpeed == SYSCTL_ADCSPEED_1MSPS) || (ulSpeed == SYSCTL_ADCSPEED_500KSPS) || (ulSpeed == SYSCTL_ADCSPEED_250KSPS) || (ulSpeed == SYSCTL_ADCSPEED_125KSPS)); // // Set the ADC speed in run and sleep mode. // HWREG(SYSCTL_RCGC0) = ((HWREG(SYSCTL_RCGC0) & ~(SYSCTL_RCGC0_ADCSPD_M)) | ulSpeed); HWREG(SYSCTL_SCGC0) = ((HWREG(SYSCTL_SCGC0) & ~(SYSCTL_SCGC0_ADCSPD_M)) | ulSpeed); }
//***************************************************************************** // //! Sets the sample rate of the ADC. //! //! \param ulSpeed is the desired sample rate of the ADC; must be one of //! \b SYSCTL_ADCSPEED_1MSPS, \b SYSCTL_ADCSPEED_500KSPS, //! \b SYSCTL_ADCSPEED_250KSPS, or \b SYSCTL_ADCSPEED_125KSPS. //! //! This function configures the rate at which the ADC samples are captured by //! the ADC block. The sampling speed may be limited by the hardware, so the //! sample rate may end up being slower than requested. SysCtlADCSpeedGet() //! returns the actual speed in use. //! //! \return None. // //*****************************************************************************
Sets the sample rate of the ADC. This function configures the rate at which the ADC samples are captured by the ADC block. The sampling speed may be limited by the hardware, so the sample rate may end up being slower than requested. SysCtlADCSpeedGet() returns the actual speed in use. \return None.
[ "Sets", "the", "sample", "rate", "of", "the", "ADC", ".", "This", "function", "configures", "the", "rate", "at", "which", "the", "ADC", "samples", "are", "captured", "by", "the", "ADC", "block", ".", "The", "sampling", "speed", "may", "be", "limited", "by", "the", "hardware", "so", "the", "sample", "rate", "may", "end", "up", "being", "slower", "than", "requested", ".", "SysCtlADCSpeedGet", "()", "returns", "the", "actual", "speed", "in", "use", ".", "\\", "return", "None", "." ]
void SysCtlADCSpeedSet(unsigned long ulSpeed) { ASSERT((ulSpeed == SYSCTL_ADCSPEED_1MSPS) || (ulSpeed == SYSCTL_ADCSPEED_500KSPS) || (ulSpeed == SYSCTL_ADCSPEED_250KSPS) || (ulSpeed == SYSCTL_ADCSPEED_125KSPS)); HWREG(SYSCTL_RCGC0) = ((HWREG(SYSCTL_RCGC0) & ~(SYSCTL_RCGC0_ADCSPD_M)) | ulSpeed); HWREG(SYSCTL_SCGC0) = ((HWREG(SYSCTL_SCGC0) & ~(SYSCTL_SCGC0_ADCSPD_M)) | ulSpeed); }
[ "void", "SysCtlADCSpeedSet", "(", "unsigned", "long", "ulSpeed", ")", "{", "ASSERT", "(", "(", "ulSpeed", "==", "SYSCTL_ADCSPEED_1MSPS", ")", "||", "(", "ulSpeed", "==", "SYSCTL_ADCSPEED_500KSPS", ")", "||", "(", "ulSpeed", "==", "SYSCTL_ADCSPEED_250KSPS", ")", "||", "(", "ulSpeed", "==", "SYSCTL_ADCSPEED_125KSPS", ")", ")", ";", "HWREG", "(", "SYSCTL_RCGC0", ")", "=", "(", "(", "HWREG", "(", "SYSCTL_RCGC0", ")", "&", "~", "(", "SYSCTL_RCGC0_ADCSPD_M", ")", ")", "|", "ulSpeed", ")", ";", "HWREG", "(", "SYSCTL_SCGC0", ")", "=", "(", "(", "HWREG", "(", "SYSCTL_SCGC0", ")", "&", "~", "(", "SYSCTL_SCGC0_ADCSPD_M", ")", ")", "|", "ulSpeed", ")", ";", "}" ]
Sets the sample rate of the ADC.
[ "Sets", "the", "sample", "rate", "of", "the", "ADC", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Set the ADC speed in run and sleep mode.\r", "//\r" ]
[ { "param": "ulSpeed", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulSpeed", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlADCSpeedGet
null
unsigned long SysCtlADCSpeedGet(void) { // // Return the current ADC speed. // return(HWREG(SYSCTL_RCGC0) & SYSCTL_RCGC0_ADCSPD_M); }
//***************************************************************************** // //! Gets the sample rate of the ADC. //! //! This function gets the current sample rate of the ADC. //! //! \return Returns the current ADC sample rate; is one of //! \b SYSCTL_ADCSPEED_1MSPS, \b SYSCTL_ADCSPEED_500KSPS, //! \b SYSCTL_ADCSPEED_250KSPS, or \b SYSCTL_ADCSPEED_125KSPS. // //*****************************************************************************
Gets the sample rate of the ADC. This function gets the current sample rate of the ADC.
[ "Gets", "the", "sample", "rate", "of", "the", "ADC", ".", "This", "function", "gets", "the", "current", "sample", "rate", "of", "the", "ADC", "." ]
unsigned long SysCtlADCSpeedGet(void) { return(HWREG(SYSCTL_RCGC0) & SYSCTL_RCGC0_ADCSPD_M); }
[ "unsigned", "long", "SysCtlADCSpeedGet", "(", "void", ")", "{", "return", "(", "HWREG", "(", "SYSCTL_RCGC0", ")", "&", "SYSCTL_RCGC0_ADCSPD_M", ")", ";", "}" ]
Gets the sample rate of the ADC.
[ "Gets", "the", "sample", "rate", "of", "the", "ADC", "." ]
[ "//\r", "// Return the current ADC speed.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlIOSCVerificationSet
void
void SysCtlIOSCVerificationSet(tBoolean bEnable) { // // Enable or disable the internal oscillator verification timer as // requested. // if(bEnable) { HWREG(SYSCTL_RCC) |= SYSCTL_RCC_IOSCVER; } else { HWREG(SYSCTL_RCC) &= ~(SYSCTL_RCC_IOSCVER); } }
//***************************************************************************** // //! Configures the internal oscillator verification timer. //! //! \param bEnable is a boolean that is \b true if the internal oscillator //! verification timer should be enabled. //! //! This function allows the internal oscillator verification timer to be //! enabled or disabled. When enabled, an interrupt is generated if the //! internal oscillator ceases to operate. //! //! The internal oscillator verification timer is only available on //! Sandstorm-class devices. //! //! \note Both oscillators (main and internal) must be enabled for this //! verification timer to operate as the main oscillator verifies the //! internal oscillator. //! //! \return None. // //*****************************************************************************
Configures the internal oscillator verification timer. \param bEnable is a boolean that is \b true if the internal oscillator verification timer should be enabled. This function allows the internal oscillator verification timer to be enabled or disabled. When enabled, an interrupt is generated if the internal oscillator ceases to operate. The internal oscillator verification timer is only available on Sandstorm-class devices. \note Both oscillators (main and internal) must be enabled for this verification timer to operate as the main oscillator verifies the internal oscillator. \return None.
[ "Configures", "the", "internal", "oscillator", "verification", "timer", ".", "\\", "param", "bEnable", "is", "a", "boolean", "that", "is", "\\", "b", "true", "if", "the", "internal", "oscillator", "verification", "timer", "should", "be", "enabled", ".", "This", "function", "allows", "the", "internal", "oscillator", "verification", "timer", "to", "be", "enabled", "or", "disabled", ".", "When", "enabled", "an", "interrupt", "is", "generated", "if", "the", "internal", "oscillator", "ceases", "to", "operate", ".", "The", "internal", "oscillator", "verification", "timer", "is", "only", "available", "on", "Sandstorm", "-", "class", "devices", ".", "\\", "note", "Both", "oscillators", "(", "main", "and", "internal", ")", "must", "be", "enabled", "for", "this", "verification", "timer", "to", "operate", "as", "the", "main", "oscillator", "verifies", "the", "internal", "oscillator", ".", "\\", "return", "None", "." ]
void SysCtlIOSCVerificationSet(tBoolean bEnable) { if(bEnable) { HWREG(SYSCTL_RCC) |= SYSCTL_RCC_IOSCVER; } else { HWREG(SYSCTL_RCC) &= ~(SYSCTL_RCC_IOSCVER); } }
[ "void", "SysCtlIOSCVerificationSet", "(", "tBoolean", "bEnable", ")", "{", "if", "(", "bEnable", ")", "{", "HWREG", "(", "SYSCTL_RCC", ")", "|=", "SYSCTL_RCC_IOSCVER", ";", "}", "else", "{", "HWREG", "(", "SYSCTL_RCC", ")", "&=", "~", "(", "SYSCTL_RCC_IOSCVER", ")", ";", "}", "}" ]
Configures the internal oscillator verification timer.
[ "Configures", "the", "internal", "oscillator", "verification", "timer", "." ]
[ "//\r", "// Enable or disable the internal oscillator verification timer as\r", "// requested.\r", "//\r" ]
[ { "param": "bEnable", "type": "tBoolean" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bEnable", "type": "tBoolean", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlMOSCVerificationSet
void
void SysCtlMOSCVerificationSet(tBoolean bEnable) { // // Enable or disable the main oscillator verification timer as requested. // if(bEnable) { HWREG(SYSCTL_RCC) |= SYSCTL_RCC_MOSCVER; } else { HWREG(SYSCTL_RCC) &= ~(SYSCTL_RCC_MOSCVER); } }
//***************************************************************************** // //! Configures the main oscillator verification timer. //! //! \param bEnable is a boolean that is \b true if the main oscillator //! verification timer should be enabled. //! //! This function allows the main oscillator verification timer to be enabled //! or disabled. When enabled, an interrupt is generated if the main //! oscillator ceases to operate. //! //! The main oscillator verification timer is only available on //! Sandstorm-class devices. //! //! \note Both oscillators (main and internal) must be enabled for this //! verification timer to operate as the internal oscillator verifies the //! main oscillator. //! //! \return None. // //*****************************************************************************
Configures the main oscillator verification timer. \param bEnable is a boolean that is \b true if the main oscillator verification timer should be enabled. This function allows the main oscillator verification timer to be enabled or disabled. When enabled, an interrupt is generated if the main oscillator ceases to operate. The main oscillator verification timer is only available on Sandstorm-class devices. \note Both oscillators (main and internal) must be enabled for this verification timer to operate as the internal oscillator verifies the main oscillator. \return None.
[ "Configures", "the", "main", "oscillator", "verification", "timer", ".", "\\", "param", "bEnable", "is", "a", "boolean", "that", "is", "\\", "b", "true", "if", "the", "main", "oscillator", "verification", "timer", "should", "be", "enabled", ".", "This", "function", "allows", "the", "main", "oscillator", "verification", "timer", "to", "be", "enabled", "or", "disabled", ".", "When", "enabled", "an", "interrupt", "is", "generated", "if", "the", "main", "oscillator", "ceases", "to", "operate", ".", "The", "main", "oscillator", "verification", "timer", "is", "only", "available", "on", "Sandstorm", "-", "class", "devices", ".", "\\", "note", "Both", "oscillators", "(", "main", "and", "internal", ")", "must", "be", "enabled", "for", "this", "verification", "timer", "to", "operate", "as", "the", "internal", "oscillator", "verifies", "the", "main", "oscillator", ".", "\\", "return", "None", "." ]
void SysCtlMOSCVerificationSet(tBoolean bEnable) { if(bEnable) { HWREG(SYSCTL_RCC) |= SYSCTL_RCC_MOSCVER; } else { HWREG(SYSCTL_RCC) &= ~(SYSCTL_RCC_MOSCVER); } }
[ "void", "SysCtlMOSCVerificationSet", "(", "tBoolean", "bEnable", ")", "{", "if", "(", "bEnable", ")", "{", "HWREG", "(", "SYSCTL_RCC", ")", "|=", "SYSCTL_RCC_MOSCVER", ";", "}", "else", "{", "HWREG", "(", "SYSCTL_RCC", ")", "&=", "~", "(", "SYSCTL_RCC_MOSCVER", ")", ";", "}", "}" ]
Configures the main oscillator verification timer.
[ "Configures", "the", "main", "oscillator", "verification", "timer", "." ]
[ "//\r", "// Enable or disable the main oscillator verification timer as requested.\r", "//\r" ]
[ { "param": "bEnable", "type": "tBoolean" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bEnable", "type": "tBoolean", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlPLLVerificationSet
void
void SysCtlPLLVerificationSet(tBoolean bEnable) { // // Enable or disable the PLL verification timer as requested. // if(bEnable) { HWREG(SYSCTL_RCC) |= SYSCTL_RCC_PLLVER; } else { HWREG(SYSCTL_RCC) &= ~(SYSCTL_RCC_PLLVER); } }
//***************************************************************************** // //! Configures the PLL verification timer. //! //! \param bEnable is a boolean that is \b true if the PLL verification timer //! should be enabled. //! //! This function allows the PLL verification timer to be enabled or disabled. //! When enabled, an interrupt is generated if the PLL ceases to operate. //! //! The PLL verification timer is only available on Sandstorm-class devices. //! //! \note The main oscillator must be enabled for this verification timer to //! operate as it is used to check the PLL. Also, the verification timer //! should be disabled while the PLL is being reconfigured via //! SysCtlClockSet(). //! //! \return None. // //*****************************************************************************
Configures the PLL verification timer. \param bEnable is a boolean that is \b true if the PLL verification timer should be enabled. This function allows the PLL verification timer to be enabled or disabled. When enabled, an interrupt is generated if the PLL ceases to operate. The PLL verification timer is only available on Sandstorm-class devices. \note The main oscillator must be enabled for this verification timer to operate as it is used to check the PLL. Also, the verification timer should be disabled while the PLL is being reconfigured via SysCtlClockSet(). \return None.
[ "Configures", "the", "PLL", "verification", "timer", ".", "\\", "param", "bEnable", "is", "a", "boolean", "that", "is", "\\", "b", "true", "if", "the", "PLL", "verification", "timer", "should", "be", "enabled", ".", "This", "function", "allows", "the", "PLL", "verification", "timer", "to", "be", "enabled", "or", "disabled", ".", "When", "enabled", "an", "interrupt", "is", "generated", "if", "the", "PLL", "ceases", "to", "operate", ".", "The", "PLL", "verification", "timer", "is", "only", "available", "on", "Sandstorm", "-", "class", "devices", ".", "\\", "note", "The", "main", "oscillator", "must", "be", "enabled", "for", "this", "verification", "timer", "to", "operate", "as", "it", "is", "used", "to", "check", "the", "PLL", ".", "Also", "the", "verification", "timer", "should", "be", "disabled", "while", "the", "PLL", "is", "being", "reconfigured", "via", "SysCtlClockSet", "()", ".", "\\", "return", "None", "." ]
void SysCtlPLLVerificationSet(tBoolean bEnable) { if(bEnable) { HWREG(SYSCTL_RCC) |= SYSCTL_RCC_PLLVER; } else { HWREG(SYSCTL_RCC) &= ~(SYSCTL_RCC_PLLVER); } }
[ "void", "SysCtlPLLVerificationSet", "(", "tBoolean", "bEnable", ")", "{", "if", "(", "bEnable", ")", "{", "HWREG", "(", "SYSCTL_RCC", ")", "|=", "SYSCTL_RCC_PLLVER", ";", "}", "else", "{", "HWREG", "(", "SYSCTL_RCC", ")", "&=", "~", "(", "SYSCTL_RCC_PLLVER", ")", ";", "}", "}" ]
Configures the PLL verification timer.
[ "Configures", "the", "PLL", "verification", "timer", "." ]
[ "//\r", "// Enable or disable the PLL verification timer as requested.\r", "//\r" ]
[ { "param": "bEnable", "type": "tBoolean" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bEnable", "type": "tBoolean", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlClkVerificationClear
void
void SysCtlClkVerificationClear(void) { // // Clear the clock verification. // HWREG(SYSCTL_CLKVCLR) = SYSCTL_CLKVCLR_VERCLR; // // The bit does not self-reset, so clear it. // HWREG(SYSCTL_CLKVCLR) = 0; }
//***************************************************************************** // //! Clears the clock verification status. //! //! This function clears the status of the clock verification timers, allowing //! them to assert another failure if detected. //! //! The clock verification timers are only available on Sandstorm-class //! devices. //! //! \return None. // //*****************************************************************************
Clears the clock verification status. This function clears the status of the clock verification timers, allowing them to assert another failure if detected. The clock verification timers are only available on Sandstorm-class devices. \return None.
[ "Clears", "the", "clock", "verification", "status", ".", "This", "function", "clears", "the", "status", "of", "the", "clock", "verification", "timers", "allowing", "them", "to", "assert", "another", "failure", "if", "detected", ".", "The", "clock", "verification", "timers", "are", "only", "available", "on", "Sandstorm", "-", "class", "devices", ".", "\\", "return", "None", "." ]
void SysCtlClkVerificationClear(void) { HWREG(SYSCTL_CLKVCLR) = SYSCTL_CLKVCLR_VERCLR; HWREG(SYSCTL_CLKVCLR) = 0; }
[ "void", "SysCtlClkVerificationClear", "(", "void", ")", "{", "HWREG", "(", "SYSCTL_CLKVCLR", ")", "=", "SYSCTL_CLKVCLR_VERCLR", ";", "HWREG", "(", "SYSCTL_CLKVCLR", ")", "=", "0", ";", "}" ]
Clears the clock verification status.
[ "Clears", "the", "clock", "verification", "status", "." ]
[ "//\r", "// Clear the clock verification.\r", "//\r", "//\r", "// The bit does not self-reset, so clear it.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlGPIOAHBEnable
void
void SysCtlGPIOAHBEnable(unsigned long ulGPIOPeripheral) { // // Check the arguments. // ASSERT((ulGPIOPeripheral == SYSCTL_PERIPH_GPIOA) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOB) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOC) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOD) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOE) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOF) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOG) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOH) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOJ)); // // Enable this GPIO for AHB access. // HWREG(SYSCTL_GPIOHBCTL) |= ulGPIOPeripheral & 0xFFFF; }
//***************************************************************************** // //! Enables a GPIO peripheral for access from the AHB. //! //! \param ulGPIOPeripheral is the GPIO peripheral to enable. //! //! This function is used to enable the specified GPIO peripheral to be //! accessed from the Advanced Host Bus (AHB) instead of the legacy Advanced //! Peripheral Bus (APB). When a GPIO peripheral is enabled for AHB access, //! the \b _AHB_BASE form of the base address should be used for GPIO //! functions. For example, instead of using \b GPIO_PORTA_BASE as the base //! address for GPIO functions, use \b GPIO_PORTA_AHB_BASE instead. //! //! The \e ulGPIOPeripheral argument must be only one of the following values: //! \b SYSCTL_PERIPH_GPIOA, \b SYSCTL_PERIPH_GPIOB, \b SYSCTL_PERIPH_GPIOC, //! \b SYSCTL_PERIPH_GPIOD, \b SYSCTL_PERIPH_GPIOE, \b SYSCTL_PERIPH_GPIOF, //! \b SYSCTL_PERIPH_GPIOG, \b SYSCTL_PERIPH_GPIOH, or \b SYSCTL_PERIPH_GPIOJ. //! //! \return None. // //*****************************************************************************
Enables a GPIO peripheral for access from the AHB. \param ulGPIOPeripheral is the GPIO peripheral to enable. This function is used to enable the specified GPIO peripheral to be accessed from the Advanced Host Bus (AHB) instead of the legacy Advanced Peripheral Bus (APB). When a GPIO peripheral is enabled for AHB access, the \b _AHB_BASE form of the base address should be used for GPIO functions. For example, instead of using \b GPIO_PORTA_BASE as the base address for GPIO functions, use \b GPIO_PORTA_AHB_BASE instead. \return None.
[ "Enables", "a", "GPIO", "peripheral", "for", "access", "from", "the", "AHB", ".", "\\", "param", "ulGPIOPeripheral", "is", "the", "GPIO", "peripheral", "to", "enable", ".", "This", "function", "is", "used", "to", "enable", "the", "specified", "GPIO", "peripheral", "to", "be", "accessed", "from", "the", "Advanced", "Host", "Bus", "(", "AHB", ")", "instead", "of", "the", "legacy", "Advanced", "Peripheral", "Bus", "(", "APB", ")", ".", "When", "a", "GPIO", "peripheral", "is", "enabled", "for", "AHB", "access", "the", "\\", "b", "_AHB_BASE", "form", "of", "the", "base", "address", "should", "be", "used", "for", "GPIO", "functions", ".", "For", "example", "instead", "of", "using", "\\", "b", "GPIO_PORTA_BASE", "as", "the", "base", "address", "for", "GPIO", "functions", "use", "\\", "b", "GPIO_PORTA_AHB_BASE", "instead", ".", "\\", "return", "None", "." ]
void SysCtlGPIOAHBEnable(unsigned long ulGPIOPeripheral) { ASSERT((ulGPIOPeripheral == SYSCTL_PERIPH_GPIOA) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOB) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOC) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOD) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOE) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOF) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOG) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOH) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOJ)); HWREG(SYSCTL_GPIOHBCTL) |= ulGPIOPeripheral & 0xFFFF; }
[ "void", "SysCtlGPIOAHBEnable", "(", "unsigned", "long", "ulGPIOPeripheral", ")", "{", "ASSERT", "(", "(", "ulGPIOPeripheral", "==", "SYSCTL_PERIPH_GPIOA", ")", "||", "(", "ulGPIOPeripheral", "==", "SYSCTL_PERIPH_GPIOB", ")", "||", "(", "ulGPIOPeripheral", "==", "SYSCTL_PERIPH_GPIOC", ")", "||", "(", "ulGPIOPeripheral", "==", "SYSCTL_PERIPH_GPIOD", ")", "||", "(", "ulGPIOPeripheral", "==", "SYSCTL_PERIPH_GPIOE", ")", "||", "(", "ulGPIOPeripheral", "==", "SYSCTL_PERIPH_GPIOF", ")", "||", "(", "ulGPIOPeripheral", "==", "SYSCTL_PERIPH_GPIOG", ")", "||", "(", "ulGPIOPeripheral", "==", "SYSCTL_PERIPH_GPIOH", ")", "||", "(", "ulGPIOPeripheral", "==", "SYSCTL_PERIPH_GPIOJ", ")", ")", ";", "HWREG", "(", "SYSCTL_GPIOHBCTL", ")", "|=", "ulGPIOPeripheral", "&", "0xFFFF", ";", "}" ]
Enables a GPIO peripheral for access from the AHB.
[ "Enables", "a", "GPIO", "peripheral", "for", "access", "from", "the", "AHB", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Enable this GPIO for AHB access.\r", "//\r" ]
[ { "param": "ulGPIOPeripheral", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulGPIOPeripheral", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlGPIOAHBDisable
void
void SysCtlGPIOAHBDisable(unsigned long ulGPIOPeripheral) { // // Check the arguments. // ASSERT((ulGPIOPeripheral == SYSCTL_PERIPH_GPIOA) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOB) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOC) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOD) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOE) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOF) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOG) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOH) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOJ)); // // Disable this GPIO for AHB access. // HWREG(SYSCTL_GPIOHBCTL) &= ~(ulGPIOPeripheral & 0xFFFF); }
//***************************************************************************** // //! Disables a GPIO peripheral for access from the AHB. //! //! \param ulGPIOPeripheral is the GPIO peripheral to disable. //! //! This function disables the specified GPIO peripheral for access from the //! Advanced Host Bus (AHB). Once disabled, the GPIO peripheral is accessed //! from the legacy Advanced Peripheral Bus (APB). //! //! The \b ulGPIOPeripheral argument must be only one of the following values: //! \b SYSCTL_PERIPH_GPIOA, \b SYSCTL_PERIPH_GPIOB, \b SYSCTL_PERIPH_GPIOC, //! \b SYSCTL_PERIPH_GPIOD, \b SYSCTL_PERIPH_GPIOE, \b SYSCTL_PERIPH_GPIOF, //! \b SYSCTL_PERIPH_GPIOG, \b SYSCTL_PERIPH_GPIOH, or \b SYSCTL_PERIPH_GPIOJ. //! //! \return None. // //*****************************************************************************
Disables a GPIO peripheral for access from the AHB. \param ulGPIOPeripheral is the GPIO peripheral to disable. This function disables the specified GPIO peripheral for access from the Advanced Host Bus (AHB). Once disabled, the GPIO peripheral is accessed from the legacy Advanced Peripheral Bus (APB). \return None.
[ "Disables", "a", "GPIO", "peripheral", "for", "access", "from", "the", "AHB", ".", "\\", "param", "ulGPIOPeripheral", "is", "the", "GPIO", "peripheral", "to", "disable", ".", "This", "function", "disables", "the", "specified", "GPIO", "peripheral", "for", "access", "from", "the", "Advanced", "Host", "Bus", "(", "AHB", ")", ".", "Once", "disabled", "the", "GPIO", "peripheral", "is", "accessed", "from", "the", "legacy", "Advanced", "Peripheral", "Bus", "(", "APB", ")", ".", "\\", "return", "None", "." ]
void SysCtlGPIOAHBDisable(unsigned long ulGPIOPeripheral) { ASSERT((ulGPIOPeripheral == SYSCTL_PERIPH_GPIOA) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOB) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOC) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOD) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOE) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOF) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOG) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOH) || (ulGPIOPeripheral == SYSCTL_PERIPH_GPIOJ)); HWREG(SYSCTL_GPIOHBCTL) &= ~(ulGPIOPeripheral & 0xFFFF); }
[ "void", "SysCtlGPIOAHBDisable", "(", "unsigned", "long", "ulGPIOPeripheral", ")", "{", "ASSERT", "(", "(", "ulGPIOPeripheral", "==", "SYSCTL_PERIPH_GPIOA", ")", "||", "(", "ulGPIOPeripheral", "==", "SYSCTL_PERIPH_GPIOB", ")", "||", "(", "ulGPIOPeripheral", "==", "SYSCTL_PERIPH_GPIOC", ")", "||", "(", "ulGPIOPeripheral", "==", "SYSCTL_PERIPH_GPIOD", ")", "||", "(", "ulGPIOPeripheral", "==", "SYSCTL_PERIPH_GPIOE", ")", "||", "(", "ulGPIOPeripheral", "==", "SYSCTL_PERIPH_GPIOF", ")", "||", "(", "ulGPIOPeripheral", "==", "SYSCTL_PERIPH_GPIOG", ")", "||", "(", "ulGPIOPeripheral", "==", "SYSCTL_PERIPH_GPIOH", ")", "||", "(", "ulGPIOPeripheral", "==", "SYSCTL_PERIPH_GPIOJ", ")", ")", ";", "HWREG", "(", "SYSCTL_GPIOHBCTL", ")", "&=", "~", "(", "ulGPIOPeripheral", "&", "0xFFFF", ")", ";", "}" ]
Disables a GPIO peripheral for access from the AHB.
[ "Disables", "a", "GPIO", "peripheral", "for", "access", "from", "the", "AHB", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Disable this GPIO for AHB access.\r", "//\r" ]
[ { "param": "ulGPIOPeripheral", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulGPIOPeripheral", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlUSBPLLEnable
void
void SysCtlUSBPLLEnable(void) { // // Turn on the USB PLL. // HWREG(SYSCTL_RCC2) &= ~SYSCTL_RCC2_USBPWRDN; }
//***************************************************************************** // //! Powers up the USB PLL. //! //! This function enables the USB controller's PLL, which is used by it's //! physical layer. This call is necessary before connecting to any external //! devices. //! //! \return None. // //*****************************************************************************
Powers up the USB PLL. This function enables the USB controller's PLL, which is used by it's physical layer. This call is necessary before connecting to any external devices. \return None.
[ "Powers", "up", "the", "USB", "PLL", ".", "This", "function", "enables", "the", "USB", "controller", "'", "s", "PLL", "which", "is", "used", "by", "it", "'", "s", "physical", "layer", ".", "This", "call", "is", "necessary", "before", "connecting", "to", "any", "external", "devices", ".", "\\", "return", "None", "." ]
void SysCtlUSBPLLEnable(void) { HWREG(SYSCTL_RCC2) &= ~SYSCTL_RCC2_USBPWRDN; }
[ "void", "SysCtlUSBPLLEnable", "(", "void", ")", "{", "HWREG", "(", "SYSCTL_RCC2", ")", "&=", "~", "SYSCTL_RCC2_USBPWRDN", ";", "}" ]
Powers up the USB PLL.
[ "Powers", "up", "the", "USB", "PLL", "." ]
[ "//\r", "// Turn on the USB PLL.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlUSBPLLDisable
void
void SysCtlUSBPLLDisable(void) { // // Turn off the USB PLL. // HWREG(SYSCTL_RCC2) |= SYSCTL_RCC2_USBPWRDN; }
//***************************************************************************** // //! Powers down the USB PLL. //! //! This function disables the USB controller's PLL, which is used by it's //! physical layer. The USB registers are still accessible, but the physical //! layer no longer functions. //! //! \return None. // //*****************************************************************************
Powers down the USB PLL. This function disables the USB controller's PLL, which is used by it's physical layer. The USB registers are still accessible, but the physical layer no longer functions. \return None.
[ "Powers", "down", "the", "USB", "PLL", ".", "This", "function", "disables", "the", "USB", "controller", "'", "s", "PLL", "which", "is", "used", "by", "it", "'", "s", "physical", "layer", ".", "The", "USB", "registers", "are", "still", "accessible", "but", "the", "physical", "layer", "no", "longer", "functions", ".", "\\", "return", "None", "." ]
void SysCtlUSBPLLDisable(void) { HWREG(SYSCTL_RCC2) |= SYSCTL_RCC2_USBPWRDN; }
[ "void", "SysCtlUSBPLLDisable", "(", "void", ")", "{", "HWREG", "(", "SYSCTL_RCC2", ")", "|=", "SYSCTL_RCC2_USBPWRDN", ";", "}" ]
Powers down the USB PLL.
[ "Powers", "down", "the", "USB", "PLL", "." ]
[ "//\r", "// Turn off the USB PLL.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
71cf76eb466c22b7db5b7d51febd2ee3494379a8
junyanl-code/Luminary-Micro-Library
driverlib/sysctl.c
[ "BSD-3-Clause" ]
C
SysCtlI2SMClkSet
null
unsigned long SysCtlI2SMClkSet(unsigned long ulInputClock, unsigned long ulMClk) { unsigned long ulDivInt, ulDivFrac, ulPLL; // // See if the I2S MCLK should be disabled. // if(ulMClk == 0) { // // Disable the I2S MCLK and return. // HWREG(SYSCTL_I2SMCLKCFG) = 0; return(0); } // // See if the input clock was specified. // if(ulInputClock == 0) { // // The input clock was not specified, so compute the output frequency // of the PLL. Get the current PLL configuration. // ulPLL = HWREG(SYSCTL_PLLCFG); // // Get the frequency of the crystal in use. // ulInputClock = g_pulXtals[(HWREG(SYSCTL_RCC) & SYSCTL_RCC_XTAL_M) >> SYSCTL_RCC_XTAL_S]; // // Calculate the PLL output frequency. // ulInputClock = ((ulInputClock * ((ulPLL & SYSCTL_PLLCFG_F_M) >> SYSCTL_PLLCFG_F_S)) / ((((ulPLL & SYSCTL_PLLCFG_R_M) >> SYSCTL_PLLCFG_R_S) + 1))); // // See if the optional output divide by 2 is being used. // if(ulPLL & SYSCTL_PLLCFG_OD_2) { ulInputClock /= 2; } // // See if the optional output divide by 4 is being used. // if(ulPLL & SYSCTL_PLLCFG_OD_4) { ulInputClock /= 4; } } // // Verify that the requested MCLK frequency is attainable. // ASSERT(ulMClk < ulInputClock); // // Add a rounding factor to the input clock, so that the MCLK frequency // that is closest to the desire value is selected. // ulInputClock += (ulMClk / 32) - 1; // // Compute the integer portion of the MCLK divider. // ulDivInt = ulInputClock / ulMClk; // // If the divisor is too large, then simply use the maximum divisor. // if(CLASS_IS_TEMPEST && REVISION_IS_B1 && (ulDivInt > 255)) { ulDivInt = 255; ulDivFrac = 15; } else if(ulDivInt > 1023) { ulDivInt = 1023; ulDivFrac = 15; } else { // // Compute the fractional portion of the MCLK divider. // ulDivFrac = ((ulInputClock - (ulDivInt * ulMClk)) * 16) / ulMClk; } // // Set the divisor for the TX and RX MCLK generators and enable the clocks. // HWREG(SYSCTL_I2SMCLKCFG) = (SYSCTL_I2SMCLKCFG_RXEN | (ulDivInt << SYSCTL_I2SMCLKCFG_RXI_S) | (ulDivFrac << SYSCTL_I2SMCLKCFG_RXF_S) | SYSCTL_I2SMCLKCFG_TXEN | (ulDivInt << SYSCTL_I2SMCLKCFG_TXI_S) | (ulDivFrac << SYSCTL_I2SMCLKCFG_TXF_S)); // // Return the actual MCLK frequency. // ulInputClock -= (ulMClk / 32) - 1; ulDivInt = (ulDivInt * 16) + ulDivFrac; ulMClk = (ulInputClock / ulDivInt) * 16; ulMClk += ((ulInputClock - ((ulMClk / 16) * ulDivInt)) * 16) / ulDivInt; return(ulMClk); }
//***************************************************************************** // //! Sets the MCLK frequency provided to the I2S module. //! //! \param ulInputClock is the input clock to the MCLK divider. If this value //! is zero, the value is computed from the current PLL configuration. //! \param ulMClk is the desired MCLK frequency. If this value is zero, MCLK //! output is disabled. //! //! This function configures the dividers to provide MCLK to the I2S module. A //! MCLK divider is chosen that produces the MCLK frequency that is the closest //! possible to the requested frequency, which may be above or below the //! requested frequency. //! //! The actual MCLK frequency is returned. It is the responsibility of the //! application to determine if the selected MCLK is acceptable; in general the //! human ear can not discern the frequency difference if it is within 0.3% of //! the desired frequency (although there is a very small percentage of the //! population that can discern lower frequency deviations). //! //! \return Returns the actual MCLK frequency. // //*****************************************************************************
Sets the MCLK frequency provided to the I2S module. \param ulInputClock is the input clock to the MCLK divider. If this value is zero, the value is computed from the current PLL configuration. \param ulMClk is the desired MCLK frequency. If this value is zero, MCLK output is disabled. This function configures the dividers to provide MCLK to the I2S module. A MCLK divider is chosen that produces the MCLK frequency that is the closest possible to the requested frequency, which may be above or below the requested frequency. The actual MCLK frequency is returned. It is the responsibility of the application to determine if the selected MCLK is acceptable; in general the human ear can not discern the frequency difference if it is within 0.3% of the desired frequency (although there is a very small percentage of the population that can discern lower frequency deviations). \return Returns the actual MCLK frequency.
[ "Sets", "the", "MCLK", "frequency", "provided", "to", "the", "I2S", "module", ".", "\\", "param", "ulInputClock", "is", "the", "input", "clock", "to", "the", "MCLK", "divider", ".", "If", "this", "value", "is", "zero", "the", "value", "is", "computed", "from", "the", "current", "PLL", "configuration", ".", "\\", "param", "ulMClk", "is", "the", "desired", "MCLK", "frequency", ".", "If", "this", "value", "is", "zero", "MCLK", "output", "is", "disabled", ".", "This", "function", "configures", "the", "dividers", "to", "provide", "MCLK", "to", "the", "I2S", "module", ".", "A", "MCLK", "divider", "is", "chosen", "that", "produces", "the", "MCLK", "frequency", "that", "is", "the", "closest", "possible", "to", "the", "requested", "frequency", "which", "may", "be", "above", "or", "below", "the", "requested", "frequency", ".", "The", "actual", "MCLK", "frequency", "is", "returned", ".", "It", "is", "the", "responsibility", "of", "the", "application", "to", "determine", "if", "the", "selected", "MCLK", "is", "acceptable", ";", "in", "general", "the", "human", "ear", "can", "not", "discern", "the", "frequency", "difference", "if", "it", "is", "within", "0", ".", "3%", "of", "the", "desired", "frequency", "(", "although", "there", "is", "a", "very", "small", "percentage", "of", "the", "population", "that", "can", "discern", "lower", "frequency", "deviations", ")", ".", "\\", "return", "Returns", "the", "actual", "MCLK", "frequency", "." ]
unsigned long SysCtlI2SMClkSet(unsigned long ulInputClock, unsigned long ulMClk) { unsigned long ulDivInt, ulDivFrac, ulPLL; if(ulMClk == 0) { HWREG(SYSCTL_I2SMCLKCFG) = 0; return(0); } if(ulInputClock == 0) { ulPLL = HWREG(SYSCTL_PLLCFG); ulInputClock = g_pulXtals[(HWREG(SYSCTL_RCC) & SYSCTL_RCC_XTAL_M) >> SYSCTL_RCC_XTAL_S]; ulInputClock = ((ulInputClock * ((ulPLL & SYSCTL_PLLCFG_F_M) >> SYSCTL_PLLCFG_F_S)) / ((((ulPLL & SYSCTL_PLLCFG_R_M) >> SYSCTL_PLLCFG_R_S) + 1))); if(ulPLL & SYSCTL_PLLCFG_OD_2) { ulInputClock /= 2; } if(ulPLL & SYSCTL_PLLCFG_OD_4) { ulInputClock /= 4; } } ASSERT(ulMClk < ulInputClock); ulInputClock += (ulMClk / 32) - 1; ulDivInt = ulInputClock / ulMClk; if(CLASS_IS_TEMPEST && REVISION_IS_B1 && (ulDivInt > 255)) { ulDivInt = 255; ulDivFrac = 15; } else if(ulDivInt > 1023) { ulDivInt = 1023; ulDivFrac = 15; } else { ulDivFrac = ((ulInputClock - (ulDivInt * ulMClk)) * 16) / ulMClk; } HWREG(SYSCTL_I2SMCLKCFG) = (SYSCTL_I2SMCLKCFG_RXEN | (ulDivInt << SYSCTL_I2SMCLKCFG_RXI_S) | (ulDivFrac << SYSCTL_I2SMCLKCFG_RXF_S) | SYSCTL_I2SMCLKCFG_TXEN | (ulDivInt << SYSCTL_I2SMCLKCFG_TXI_S) | (ulDivFrac << SYSCTL_I2SMCLKCFG_TXF_S)); ulInputClock -= (ulMClk / 32) - 1; ulDivInt = (ulDivInt * 16) + ulDivFrac; ulMClk = (ulInputClock / ulDivInt) * 16; ulMClk += ((ulInputClock - ((ulMClk / 16) * ulDivInt)) * 16) / ulDivInt; return(ulMClk); }
[ "unsigned", "long", "SysCtlI2SMClkSet", "(", "unsigned", "long", "ulInputClock", ",", "unsigned", "long", "ulMClk", ")", "{", "unsigned", "long", "ulDivInt", ",", "ulDivFrac", ",", "ulPLL", ";", "if", "(", "ulMClk", "==", "0", ")", "{", "HWREG", "(", "SYSCTL_I2SMCLKCFG", ")", "=", "0", ";", "return", "(", "0", ")", ";", "}", "if", "(", "ulInputClock", "==", "0", ")", "{", "ulPLL", "=", "HWREG", "(", "SYSCTL_PLLCFG", ")", ";", "ulInputClock", "=", "g_pulXtals", "[", "(", "HWREG", "(", "SYSCTL_RCC", ")", "&", "SYSCTL_RCC_XTAL_M", ")", ">>", "SYSCTL_RCC_XTAL_S", "]", ";", "ulInputClock", "=", "(", "(", "ulInputClock", "*", "(", "(", "ulPLL", "&", "SYSCTL_PLLCFG_F_M", ")", ">>", "SYSCTL_PLLCFG_F_S", ")", ")", "/", "(", "(", "(", "(", "ulPLL", "&", "SYSCTL_PLLCFG_R_M", ")", ">>", "SYSCTL_PLLCFG_R_S", ")", "+", "1", ")", ")", ")", ";", "if", "(", "ulPLL", "&", "SYSCTL_PLLCFG_OD_2", ")", "{", "ulInputClock", "/=", "2", ";", "}", "if", "(", "ulPLL", "&", "SYSCTL_PLLCFG_OD_4", ")", "{", "ulInputClock", "/=", "4", ";", "}", "}", "ASSERT", "(", "ulMClk", "<", "ulInputClock", ")", ";", "ulInputClock", "+=", "(", "ulMClk", "/", "32", ")", "-", "1", ";", "ulDivInt", "=", "ulInputClock", "/", "ulMClk", ";", "if", "(", "CLASS_IS_TEMPEST", "&&", "REVISION_IS_B1", "&&", "(", "ulDivInt", ">", "255", ")", ")", "{", "ulDivInt", "=", "255", ";", "ulDivFrac", "=", "15", ";", "}", "else", "if", "(", "ulDivInt", ">", "1023", ")", "{", "ulDivInt", "=", "1023", ";", "ulDivFrac", "=", "15", ";", "}", "else", "{", "ulDivFrac", "=", "(", "(", "ulInputClock", "-", "(", "ulDivInt", "*", "ulMClk", ")", ")", "*", "16", ")", "/", "ulMClk", ";", "}", "HWREG", "(", "SYSCTL_I2SMCLKCFG", ")", "=", "(", "SYSCTL_I2SMCLKCFG_RXEN", "|", "(", "ulDivInt", "<<", "SYSCTL_I2SMCLKCFG_RXI_S", ")", "|", "(", "ulDivFrac", "<<", "SYSCTL_I2SMCLKCFG_RXF_S", ")", "|", "SYSCTL_I2SMCLKCFG_TXEN", "|", "(", "ulDivInt", "<<", "SYSCTL_I2SMCLKCFG_TXI_S", ")", "|", "(", "ulDivFrac", "<<", "SYSCTL_I2SMCLKCFG_TXF_S", ")", ")", ";", "ulInputClock", "-=", "(", "ulMClk", "/", "32", ")", "-", "1", ";", "ulDivInt", "=", "(", "ulDivInt", "*", "16", ")", "+", "ulDivFrac", ";", "ulMClk", "=", "(", "ulInputClock", "/", "ulDivInt", ")", "*", "16", ";", "ulMClk", "+=", "(", "(", "ulInputClock", "-", "(", "(", "ulMClk", "/", "16", ")", "*", "ulDivInt", ")", ")", "*", "16", ")", "/", "ulDivInt", ";", "return", "(", "ulMClk", ")", ";", "}" ]
Sets the MCLK frequency provided to the I2S module.
[ "Sets", "the", "MCLK", "frequency", "provided", "to", "the", "I2S", "module", "." ]
[ "//\r", "// See if the I2S MCLK should be disabled.\r", "//\r", "//\r", "// Disable the I2S MCLK and return.\r", "//\r", "//\r", "// See if the input clock was specified.\r", "//\r", "//\r", "// The input clock was not specified, so compute the output frequency\r", "// of the PLL. Get the current PLL configuration.\r", "//\r", "//\r", "// Get the frequency of the crystal in use.\r", "//\r", "//\r", "// Calculate the PLL output frequency.\r", "//\r", "//\r", "// See if the optional output divide by 2 is being used.\r", "//\r", "//\r", "// See if the optional output divide by 4 is being used.\r", "//\r", "//\r", "// Verify that the requested MCLK frequency is attainable.\r", "//\r", "//\r", "// Add a rounding factor to the input clock, so that the MCLK frequency\r", "// that is closest to the desire value is selected.\r", "//\r", "//\r", "// Compute the integer portion of the MCLK divider.\r", "//\r", "//\r", "// If the divisor is too large, then simply use the maximum divisor.\r", "//\r", "//\r", "// Compute the fractional portion of the MCLK divider.\r", "//\r", "//\r", "// Set the divisor for the TX and RX MCLK generators and enable the clocks.\r", "//\r", "//\r", "// Return the actual MCLK frequency.\r", "//\r" ]
[ { "param": "ulInputClock", "type": "unsigned long" }, { "param": "ulMClk", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulInputClock", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulMClk", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
79d39b9d80bde6592073b13a1f86f2bb257fbffb
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9b96/boot_demo2/boot_demo2.c
[ "BSD-3-Clause" ]
C
JumpToBootLoader
void
void JumpToBootLoader(void) { // // We must make sure we turn off SysTick and its interrupt before entering // the boot loader! // ROM_SysTickIntDisable(); ROM_SysTickDisable(); // // Disable all processor interrupts. Instead of disabling them // one at a time, a direct write to NVIC is done to disable all // peripheral interrupts. // HWREG(NVIC_DIS0) = 0xffffffff; HWREG(NVIC_DIS1) = 0xffffffff; // // Return control to the boot loader. This is a call to the SVC // handler in the boot loader. // (*((void (*)(void))(*(unsigned long *)0x2c)))(); }
//***************************************************************************** // // Passes control to the bootloader and initiates a remote software update. // // This function passes control to the bootloader and initiates an update of // the main application firmware image via UART0, Ethernet or USB depending // upon the specific boot loader binary in use. // // \return Never returns. // //*****************************************************************************
Passes control to the bootloader and initiates a remote software update. This function passes control to the bootloader and initiates an update of the main application firmware image via UART0, Ethernet or USB depending upon the specific boot loader binary in use. \return Never returns.
[ "Passes", "control", "to", "the", "bootloader", "and", "initiates", "a", "remote", "software", "update", ".", "This", "function", "passes", "control", "to", "the", "bootloader", "and", "initiates", "an", "update", "of", "the", "main", "application", "firmware", "image", "via", "UART0", "Ethernet", "or", "USB", "depending", "upon", "the", "specific", "boot", "loader", "binary", "in", "use", ".", "\\", "return", "Never", "returns", "." ]
void JumpToBootLoader(void) { ROM_SysTickIntDisable(); ROM_SysTickDisable(); HWREG(NVIC_DIS0) = 0xffffffff; HWREG(NVIC_DIS1) = 0xffffffff; (*((void (*)(void))(*(unsigned long *)0x2c)))(); }
[ "void", "JumpToBootLoader", "(", "void", ")", "{", "ROM_SysTickIntDisable", "(", ")", ";", "ROM_SysTickDisable", "(", ")", ";", "HWREG", "(", "NVIC_DIS0", ")", "=", "0xffffffff", ";", "HWREG", "(", "NVIC_DIS1", ")", "=", "0xffffffff", ";", "(", "*", "(", "(", "void", "(", "*", ")", "(", "void", ")", ")", "(", "*", "(", "unsigned", "long", "*", ")", "0x2c", ")", ")", ")", "(", ")", ";", "}" ]
Passes control to the bootloader and initiates a remote software update.
[ "Passes", "control", "to", "the", "bootloader", "and", "initiates", "a", "remote", "software", "update", "." ]
[ "//\r", "// We must make sure we turn off SysTick and its interrupt before entering\r", "// the boot loader!\r", "//\r", "//\r", "// Disable all processor interrupts. Instead of disabling them\r", "// one at a time, a direct write to NVIC is done to disable all\r", "// peripheral interrupts.\r", "//\r", "//\r", "// Return control to the boot loader. This is a call to the SVC\r", "// handler in the boot loader.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
79d39b9d80bde6592073b13a1f86f2bb257fbffb
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9b96/boot_demo2/boot_demo2.c
[ "BSD-3-Clause" ]
C
SetupForEthernet
void
void SetupForEthernet(void) { unsigned long ulUser0, ulUser1; unsigned char pucMACAddr[6]; // // Configure SysTick for a 100Hz interrupt. // ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / TICKS_PER_SECOND); ROM_SysTickEnable(); ROM_SysTickIntEnable(); // // Configure the pins used to control the Ethernet LEDs. // LED0 PF3 Output // LED1 PF2 Output // GPIOPinTypeEthernetLED(GPIO_PORTF_BASE, GPIO_PIN_2 | GPIO_PIN_3); // // Get the MAC address from the UART0 and UART1 registers in NV ram. // ROM_FlashUserGet(&ulUser0, &ulUser1); // // Convert the 24/24 split MAC address from NV ram into a MAC address // array. // pucMACAddr[0] = ulUser0 & 0xff; pucMACAddr[1] = (ulUser0 >> 8) & 0xff; pucMACAddr[2] = (ulUser0 >> 16) & 0xff; pucMACAddr[3] = ulUser1 & 0xff; pucMACAddr[4] = (ulUser1 >> 8) & 0xff; pucMACAddr[5] = (ulUser1 >> 16) & 0xff; // // Format this address into the string used by the relevant widget. // usnprintf(g_pcMACAddr, SIZE_MAC_ADDR_BUFFER, "MAC: %02X-%02X-%02X-%02X-%02X-%02X", pucMACAddr[0], pucMACAddr[1], pucMACAddr[2], pucMACAddr[3], pucMACAddr[4], pucMACAddr[5]); // // Remember that we don't have an IP address yet. // usnprintf(g_pcIPAddr, SIZE_IP_ADDR_BUFFER, "IP: Not assigned"); // // Initialize the lwIP TCP/IP stack. // lwIPInit(pucMACAddr, 0, 0, 0, IPADDR_USE_DHCP); }
//***************************************************************************** // // Perform the initialization steps required to start up the Ethernet controller // and lwIP stack. // //*****************************************************************************
Perform the initialization steps required to start up the Ethernet controller and lwIP stack.
[ "Perform", "the", "initialization", "steps", "required", "to", "start", "up", "the", "Ethernet", "controller", "and", "lwIP", "stack", "." ]
void SetupForEthernet(void) { unsigned long ulUser0, ulUser1; unsigned char pucMACAddr[6]; ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / TICKS_PER_SECOND); ROM_SysTickEnable(); ROM_SysTickIntEnable(); GPIOPinTypeEthernetLED(GPIO_PORTF_BASE, GPIO_PIN_2 | GPIO_PIN_3); ROM_FlashUserGet(&ulUser0, &ulUser1); pucMACAddr[0] = ulUser0 & 0xff; pucMACAddr[1] = (ulUser0 >> 8) & 0xff; pucMACAddr[2] = (ulUser0 >> 16) & 0xff; pucMACAddr[3] = ulUser1 & 0xff; pucMACAddr[4] = (ulUser1 >> 8) & 0xff; pucMACAddr[5] = (ulUser1 >> 16) & 0xff; usnprintf(g_pcMACAddr, SIZE_MAC_ADDR_BUFFER, "MAC: %02X-%02X-%02X-%02X-%02X-%02X", pucMACAddr[0], pucMACAddr[1], pucMACAddr[2], pucMACAddr[3], pucMACAddr[4], pucMACAddr[5]); usnprintf(g_pcIPAddr, SIZE_IP_ADDR_BUFFER, "IP: Not assigned"); lwIPInit(pucMACAddr, 0, 0, 0, IPADDR_USE_DHCP); }
[ "void", "SetupForEthernet", "(", "void", ")", "{", "unsigned", "long", "ulUser0", ",", "ulUser1", ";", "unsigned", "char", "pucMACAddr", "[", "6", "]", ";", "ROM_SysTickPeriodSet", "(", "ROM_SysCtlClockGet", "(", ")", "/", "TICKS_PER_SECOND", ")", ";", "ROM_SysTickEnable", "(", ")", ";", "ROM_SysTickIntEnable", "(", ")", ";", "GPIOPinTypeEthernetLED", "(", "GPIO_PORTF_BASE", ",", "GPIO_PIN_2", "|", "GPIO_PIN_3", ")", ";", "ROM_FlashUserGet", "(", "&", "ulUser0", ",", "&", "ulUser1", ")", ";", "pucMACAddr", "[", "0", "]", "=", "ulUser0", "&", "0xff", ";", "pucMACAddr", "[", "1", "]", "=", "(", "ulUser0", ">>", "8", ")", "&", "0xff", ";", "pucMACAddr", "[", "2", "]", "=", "(", "ulUser0", ">>", "16", ")", "&", "0xff", ";", "pucMACAddr", "[", "3", "]", "=", "ulUser1", "&", "0xff", ";", "pucMACAddr", "[", "4", "]", "=", "(", "ulUser1", ">>", "8", ")", "&", "0xff", ";", "pucMACAddr", "[", "5", "]", "=", "(", "ulUser1", ">>", "16", ")", "&", "0xff", ";", "usnprintf", "(", "g_pcMACAddr", ",", "SIZE_MAC_ADDR_BUFFER", ",", "\"", "\"", ",", "pucMACAddr", "[", "0", "]", ",", "pucMACAddr", "[", "1", "]", ",", "pucMACAddr", "[", "2", "]", ",", "pucMACAddr", "[", "3", "]", ",", "pucMACAddr", "[", "4", "]", ",", "pucMACAddr", "[", "5", "]", ")", ";", "usnprintf", "(", "g_pcIPAddr", ",", "SIZE_IP_ADDR_BUFFER", ",", "\"", "\"", ")", ";", "lwIPInit", "(", "pucMACAddr", ",", "0", ",", "0", ",", "0", ",", "IPADDR_USE_DHCP", ")", ";", "}" ]
Perform the initialization steps required to start up the Ethernet controller and lwIP stack.
[ "Perform", "the", "initialization", "steps", "required", "to", "start", "up", "the", "Ethernet", "controller", "and", "lwIP", "stack", "." ]
[ "//\r", "// Configure SysTick for a 100Hz interrupt.\r", "//\r", "//\r", "// Configure the pins used to control the Ethernet LEDs.\r", "// LED0 PF3 Output\r", "// LED1 PF2 Output\r", "//\r", "//\r", "// Get the MAC address from the UART0 and UART1 registers in NV ram.\r", "//\r", "//\r", "// Convert the 24/24 split MAC address from NV ram into a MAC address\r", "// array.\r", "//\r", "//\r", "// Format this address into the string used by the relevant widget.\r", "//\r", "//\r", "// Remember that we don't have an IP address yet.\r", "//\r", "//\r", "// Initialize the lwIP TCP/IP stack.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
79d39b9d80bde6592073b13a1f86f2bb257fbffb
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9b96/boot_demo2/boot_demo2.c
[ "BSD-3-Clause" ]
C
SetupForUART
void
void SetupForUART(void) { // // We need to make sure that UART0 and its associated GPIO port are // enabled before we pass control to the boot loader. The serial boot // loader does not enable or configure these peripherals for us if we // enter it via its SVC vector. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); // // Set GPIO A0 and A1 as UART. // ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); // // Configure the UART for 115200, n, 8, 1 // ROM_UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200, (UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE | UART_CONFIG_WLEN_8)); // // Enable the UART operation. // ROM_UARTEnable(UART0_BASE); }
//***************************************************************************** // // Initialize UART0 and set the appropriate communication parameters. // //*****************************************************************************
Initialize UART0 and set the appropriate communication parameters.
[ "Initialize", "UART0", "and", "set", "the", "appropriate", "communication", "parameters", "." ]
void SetupForUART(void) { ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); ROM_UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200, (UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE | UART_CONFIG_WLEN_8)); ROM_UARTEnable(UART0_BASE); }
[ "void", "SetupForUART", "(", "void", ")", "{", "ROM_SysCtlPeripheralEnable", "(", "SYSCTL_PERIPH_UART0", ")", ";", "ROM_SysCtlPeripheralEnable", "(", "SYSCTL_PERIPH_GPIOA", ")", ";", "ROM_GPIOPinTypeUART", "(", "GPIO_PORTA_BASE", ",", "GPIO_PIN_0", "|", "GPIO_PIN_1", ")", ";", "ROM_UARTConfigSetExpClk", "(", "UART0_BASE", ",", "SysCtlClockGet", "(", ")", ",", "115200", ",", "(", "UART_CONFIG_PAR_NONE", "|", "UART_CONFIG_STOP_ONE", "|", "UART_CONFIG_WLEN_8", ")", ")", ";", "ROM_UARTEnable", "(", "UART0_BASE", ")", ";", "}" ]
Initialize UART0 and set the appropriate communication parameters.
[ "Initialize", "UART0", "and", "set", "the", "appropriate", "communication", "parameters", "." ]
[ "//\r", "// We need to make sure that UART0 and its associated GPIO port are\r", "// enabled before we pass control to the boot loader. The serial boot\r", "// loader does not enable or configure these peripherals for us if we\r", "// enter it via its SVC vector.\r", "//\r", "//\r", "// Set GPIO A0 and A1 as UART.\r", "//\r", "//\r", "// Configure the UART for 115200, n, 8, 1\r", "//\r", "//\r", "// Enable the UART operation.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
79d39b9d80bde6592073b13a1f86f2bb257fbffb
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9b96/boot_demo2/boot_demo2.c
[ "BSD-3-Clause" ]
C
OnButtonPress
void
void OnButtonPress(tWidget *pWidget) { g_bFirmwareUpdate = true; }
//***************************************************************************** // // This function is called by the graphics library widget manager whenever the // "Update Now" button is pressed. It sets a flag that the main loop checks // and, when set, causes control to transfer to the boot loader. // //*****************************************************************************
This function is called by the graphics library widget manager whenever the "Update Now" button is pressed. It sets a flag that the main loop checks and, when set, causes control to transfer to the boot loader.
[ "This", "function", "is", "called", "by", "the", "graphics", "library", "widget", "manager", "whenever", "the", "\"", "Update", "Now", "\"", "button", "is", "pressed", ".", "It", "sets", "a", "flag", "that", "the", "main", "loop", "checks", "and", "when", "set", "causes", "control", "to", "transfer", "to", "the", "boot", "loader", "." ]
void OnButtonPress(tWidget *pWidget) { g_bFirmwareUpdate = true; }
[ "void", "OnButtonPress", "(", "tWidget", "*", "pWidget", ")", "{", "g_bFirmwareUpdate", "=", "true", ";", "}" ]
This function is called by the graphics library widget manager whenever the "Update Now" button is pressed.
[ "This", "function", "is", "called", "by", "the", "graphics", "library", "widget", "manager", "whenever", "the", "\"", "Update", "Now", "\"", "button", "is", "pressed", "." ]
[]
[ { "param": "pWidget", "type": "tWidget" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pWidget", "type": "tWidget", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7655648256265c07511773203b6a64bb2b33c5a4
junyanl-code/Luminary-Micro-Library
boards/rdk-acim/qs-acim/pwm_ctrl.c
[ "BSD-3-Clause" ]
C
PWMSetMinPulseWidth
void
void PWMSetMinPulseWidth(void) { // // Compute the minimum pulse width in PWM clocks. // g_ulMinPulseWidth = ((((g_sParameters.ucDeadTime + 1) * 20) + (g_sParameters.ucMinPulseWidth * 100) + (PWM_CLOCK_WIDTH - 1)) / PWM_CLOCK_WIDTH); // // If the minimum pulse width parameter is zero, then increment the minimum // pulse width (that is, the dead time) by one to avoid sending pulses into // the dead band unit that are too short. // if(g_sParameters.ucMinPulseWidth == 0) { g_ulMinPulseWidth++; } }
//***************************************************************************** // //! Computes the minimum PWM pulse width. //! //! This function computes the minimum PWM pulse width based on the minimum //! pulse width parameter and the dead time parameter. The dead timers will //! reduce the width of a PWM pulse, so their value must be considered to avoid //! pulses shorter than the parameter value being produced. //! //! \return None. // //*****************************************************************************
Computes the minimum PWM pulse width. This function computes the minimum PWM pulse width based on the minimum pulse width parameter and the dead time parameter. The dead timers will reduce the width of a PWM pulse, so their value must be considered to avoid pulses shorter than the parameter value being produced. \return None.
[ "Computes", "the", "minimum", "PWM", "pulse", "width", ".", "This", "function", "computes", "the", "minimum", "PWM", "pulse", "width", "based", "on", "the", "minimum", "pulse", "width", "parameter", "and", "the", "dead", "time", "parameter", ".", "The", "dead", "timers", "will", "reduce", "the", "width", "of", "a", "PWM", "pulse", "so", "their", "value", "must", "be", "considered", "to", "avoid", "pulses", "shorter", "than", "the", "parameter", "value", "being", "produced", ".", "\\", "return", "None", "." ]
void PWMSetMinPulseWidth(void) { g_ulMinPulseWidth = ((((g_sParameters.ucDeadTime + 1) * 20) + (g_sParameters.ucMinPulseWidth * 100) + (PWM_CLOCK_WIDTH - 1)) / PWM_CLOCK_WIDTH); if(g_sParameters.ucMinPulseWidth == 0) { g_ulMinPulseWidth++; } }
[ "void", "PWMSetMinPulseWidth", "(", "void", ")", "{", "g_ulMinPulseWidth", "=", "(", "(", "(", "(", "g_sParameters", ".", "ucDeadTime", "+", "1", ")", "*", "20", ")", "+", "(", "g_sParameters", ".", "ucMinPulseWidth", "*", "100", ")", "+", "(", "PWM_CLOCK_WIDTH", "-", "1", ")", ")", "/", "PWM_CLOCK_WIDTH", ")", ";", "if", "(", "g_sParameters", ".", "ucMinPulseWidth", "==", "0", ")", "{", "g_ulMinPulseWidth", "++", ";", "}", "}" ]
Computes the minimum PWM pulse width.
[ "Computes", "the", "minimum", "PWM", "pulse", "width", "." ]
[ "//\r", "// Compute the minimum pulse width in PWM clocks.\r", "//\r", "//\r", "// If the minimum pulse width parameter is zero, then increment the minimum\r", "// pulse width (that is, the dead time) by one to avoid sending pulses into\r", "// the dead band unit that are too short.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7655648256265c07511773203b6a64bb2b33c5a4
junyanl-code/Luminary-Micro-Library
boards/rdk-acim/qs-acim/pwm_ctrl.c
[ "BSD-3-Clause" ]
C
PWMSetDeadBand
void
void PWMSetDeadBand(void) { // // Set the dead band times for all three PWM generators. // PWMDeadBandEnable(PWM0_BASE, PWM_GEN_0, g_sParameters.ucDeadTime, g_sParameters.ucDeadTime); PWMDeadBandEnable(PWM0_BASE, PWM_GEN_1, g_sParameters.ucDeadTime, g_sParameters.ucDeadTime); PWMDeadBandEnable(PWM0_BASE, PWM_GEN_2, g_sParameters.ucDeadTime, g_sParameters.ucDeadTime); // // Update the minimum PWM pulse width. // PWMSetMinPulseWidth(); }
//***************************************************************************** // //! Configures the dead timers for the PWM generators. //! //! This function configures the dead timers for all three PWM generators based //! on the dead time parameter. //! //! \return None. // //*****************************************************************************
Configures the dead timers for the PWM generators. This function configures the dead timers for all three PWM generators based on the dead time parameter. \return None.
[ "Configures", "the", "dead", "timers", "for", "the", "PWM", "generators", ".", "This", "function", "configures", "the", "dead", "timers", "for", "all", "three", "PWM", "generators", "based", "on", "the", "dead", "time", "parameter", ".", "\\", "return", "None", "." ]
void PWMSetDeadBand(void) { PWMDeadBandEnable(PWM0_BASE, PWM_GEN_0, g_sParameters.ucDeadTime, g_sParameters.ucDeadTime); PWMDeadBandEnable(PWM0_BASE, PWM_GEN_1, g_sParameters.ucDeadTime, g_sParameters.ucDeadTime); PWMDeadBandEnable(PWM0_BASE, PWM_GEN_2, g_sParameters.ucDeadTime, g_sParameters.ucDeadTime); PWMSetMinPulseWidth(); }
[ "void", "PWMSetDeadBand", "(", "void", ")", "{", "PWMDeadBandEnable", "(", "PWM0_BASE", ",", "PWM_GEN_0", ",", "g_sParameters", ".", "ucDeadTime", ",", "g_sParameters", ".", "ucDeadTime", ")", ";", "PWMDeadBandEnable", "(", "PWM0_BASE", ",", "PWM_GEN_1", ",", "g_sParameters", ".", "ucDeadTime", ",", "g_sParameters", ".", "ucDeadTime", ")", ";", "PWMDeadBandEnable", "(", "PWM0_BASE", ",", "PWM_GEN_2", ",", "g_sParameters", ".", "ucDeadTime", ",", "g_sParameters", ".", "ucDeadTime", ")", ";", "PWMSetMinPulseWidth", "(", ")", ";", "}" ]
Configures the dead timers for the PWM generators.
[ "Configures", "the", "dead", "timers", "for", "the", "PWM", "generators", "." ]
[ "//\r", "// Set the dead band times for all three PWM generators.\r", "//\r", "//\r", "// Update the minimum PWM pulse width.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7655648256265c07511773203b6a64bb2b33c5a4
junyanl-code/Luminary-Micro-Library
boards/rdk-acim/qs-acim/pwm_ctrl.c
[ "BSD-3-Clause" ]
C
PWMSetFrequency
void
void PWMSetFrequency(void) { // // Disable the PWM interrupt temporarily. // IntDisable(INT_PWM0_0); // // Determine the configured PWM frequency. // switch(g_sParameters.usFlags & FLAG_PWM_FREQUENCY_MASK) { // // The PWM frequency is 8 KHz. // case FLAG_PWM_FREQUENCY_8K: { // // Set the PWM frequency variable. // g_ulPWMFrequency = 8000; // // Get the number of PWM clocks in a 8 KHz period. // g_ulPWMClock = PWM_CLOCK / 8000; // // Done with this PWM frequency. // break; } // // The PWM frequency is 12.5 KHz. // case FLAG_PWM_FREQUENCY_12K: { // // Set the PWM frequency variable. // g_ulPWMFrequency = 12500; // // Get the number of PWM clocks in a 12.5 KHz period. // g_ulPWMClock = PWM_CLOCK / 12500; // // Done with this PWM frequency. // break; } // // The PWM frequency is 16 KHz. // case FLAG_PWM_FREQUENCY_16K: { // // Set the PWM frequency variable. // g_ulPWMFrequency = 16000; // // Get the number of PWM clocks in a 16 KHz period. // g_ulPWMClock = PWM_CLOCK / 16000; // // Done with this PWM frequency. // break; } // // The PWM frequency is 20 KHz. // case FLAG_PWM_FREQUENCY_20K: default: { // // Set the PWM frequency variable. // g_ulPWMFrequency = 20000; // // Get the number of PWM clocks in a 20 KHz period. // g_ulPWMClock = PWM_CLOCK / 20000; // // Done with this PWM frequency. // break; } } // // Indicate that the PWM frequency needs to be updated. // HWREGBITW(&g_ulPWMFlags, PWM_FLAG_NEW_FREQUENCY) = 1; // // Re-enable the PWM interrupt. // IntEnable(INT_PWM0_0); }
//***************************************************************************** // //! Sets the frequency of the generated PWM waveforms. //! //! This function configures the frequency of the generated PWM waveforms. The //! frequency update will not occur immediately; the change will be registered //! for synchronous application to the output waveforms to avoid //! discontinuities. //! //! \return None. // //*****************************************************************************
Sets the frequency of the generated PWM waveforms. This function configures the frequency of the generated PWM waveforms. The frequency update will not occur immediately; the change will be registered for synchronous application to the output waveforms to avoid discontinuities. \return None.
[ "Sets", "the", "frequency", "of", "the", "generated", "PWM", "waveforms", ".", "This", "function", "configures", "the", "frequency", "of", "the", "generated", "PWM", "waveforms", ".", "The", "frequency", "update", "will", "not", "occur", "immediately", ";", "the", "change", "will", "be", "registered", "for", "synchronous", "application", "to", "the", "output", "waveforms", "to", "avoid", "discontinuities", ".", "\\", "return", "None", "." ]
void PWMSetFrequency(void) { IntDisable(INT_PWM0_0); switch(g_sParameters.usFlags & FLAG_PWM_FREQUENCY_MASK) { case FLAG_PWM_FREQUENCY_8K: { g_ulPWMFrequency = 8000; g_ulPWMClock = PWM_CLOCK / 8000; break; } case FLAG_PWM_FREQUENCY_12K: { g_ulPWMFrequency = 12500; g_ulPWMClock = PWM_CLOCK / 12500; break; } case FLAG_PWM_FREQUENCY_16K: { g_ulPWMFrequency = 16000; g_ulPWMClock = PWM_CLOCK / 16000; break; } case FLAG_PWM_FREQUENCY_20K: default: { g_ulPWMFrequency = 20000; g_ulPWMClock = PWM_CLOCK / 20000; break; } } HWREGBITW(&g_ulPWMFlags, PWM_FLAG_NEW_FREQUENCY) = 1; IntEnable(INT_PWM0_0); }
[ "void", "PWMSetFrequency", "(", "void", ")", "{", "IntDisable", "(", "INT_PWM0_0", ")", ";", "switch", "(", "g_sParameters", ".", "usFlags", "&", "FLAG_PWM_FREQUENCY_MASK", ")", "{", "case", "FLAG_PWM_FREQUENCY_8K", ":", "{", "g_ulPWMFrequency", "=", "8000", ";", "g_ulPWMClock", "=", "PWM_CLOCK", "/", "8000", ";", "break", ";", "}", "case", "FLAG_PWM_FREQUENCY_12K", ":", "{", "g_ulPWMFrequency", "=", "12500", ";", "g_ulPWMClock", "=", "PWM_CLOCK", "/", "12500", ";", "break", ";", "}", "case", "FLAG_PWM_FREQUENCY_16K", ":", "{", "g_ulPWMFrequency", "=", "16000", ";", "g_ulPWMClock", "=", "PWM_CLOCK", "/", "16000", ";", "break", ";", "}", "case", "FLAG_PWM_FREQUENCY_20K", ":", "default", ":", "{", "g_ulPWMFrequency", "=", "20000", ";", "g_ulPWMClock", "=", "PWM_CLOCK", "/", "20000", ";", "break", ";", "}", "}", "HWREGBITW", "(", "&", "g_ulPWMFlags", ",", "PWM_FLAG_NEW_FREQUENCY", ")", "=", "1", ";", "IntEnable", "(", "INT_PWM0_0", ")", ";", "}" ]
Sets the frequency of the generated PWM waveforms.
[ "Sets", "the", "frequency", "of", "the", "generated", "PWM", "waveforms", "." ]
[ "//\r", "// Disable the PWM interrupt temporarily.\r", "//\r", "//\r", "// Determine the configured PWM frequency.\r", "//\r", "//\r", "// The PWM frequency is 8 KHz.\r", "//\r", "//\r", "// Set the PWM frequency variable.\r", "//\r", "//\r", "// Get the number of PWM clocks in a 8 KHz period.\r", "//\r", "//\r", "// Done with this PWM frequency.\r", "//\r", "//\r", "// The PWM frequency is 12.5 KHz.\r", "//\r", "//\r", "// Set the PWM frequency variable.\r", "//\r", "//\r", "// Get the number of PWM clocks in a 12.5 KHz period.\r", "//\r", "//\r", "// Done with this PWM frequency.\r", "//\r", "//\r", "// The PWM frequency is 16 KHz.\r", "//\r", "//\r", "// Set the PWM frequency variable.\r", "//\r", "//\r", "// Get the number of PWM clocks in a 16 KHz period.\r", "//\r", "//\r", "// Done with this PWM frequency.\r", "//\r", "//\r", "// The PWM frequency is 20 KHz.\r", "//\r", "//\r", "// Set the PWM frequency variable.\r", "//\r", "//\r", "// Get the number of PWM clocks in a 20 KHz period.\r", "//\r", "//\r", "// Done with this PWM frequency.\r", "//\r", "//\r", "// Indicate that the PWM frequency needs to be updated.\r", "//\r", "//\r", "// Re-enable the PWM interrupt.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7655648256265c07511773203b6a64bb2b33c5a4
junyanl-code/Luminary-Micro-Library
boards/rdk-acim/qs-acim/pwm_ctrl.c
[ "BSD-3-Clause" ]
C
PWMUpdateDutyCycle
void
static void PWMUpdateDutyCycle(void) { unsigned long ulWidth; // // Get the pulse width of the U phase of the motor. If the width of the // positive portion of the pulse is less than the minimum pulse width, then // force the signal low continuously. If the width of the negative portion // of the pulse is less than the minimum pulse width, then force the signal // high continuously. // ulWidth = (g_ulPWMDutyCycleU * g_ulPWMClock) / 65536; if(ulWidth < g_ulMinPulseWidth) { ulWidth = g_ulMinPulseWidth; } if((g_ulPWMClock - ulWidth) < g_ulMinPulseWidth) { ulWidth = g_ulPWMClock - g_ulMinPulseWidth; } // // Set the pulse width of the U phase of the motor. // PWMPulseWidthSet(PWM0_BASE, PWM_OUT_0, ulWidth); // // Get the pulse width of the V phase of the motor. // ulWidth = (g_ulPWMDutyCycleV * g_ulPWMClock) / 65536; if(ulWidth < g_ulMinPulseWidth) { ulWidth = g_ulMinPulseWidth; } if((g_ulPWMClock - ulWidth) < g_ulMinPulseWidth) { ulWidth = g_ulPWMClock - g_ulMinPulseWidth; } // // Set the pulse width of the V phase of the motor. // PWMPulseWidthSet(PWM0_BASE, PWM_OUT_2, ulWidth); // // Get the pulse width of the W phase of the motor. // ulWidth = (g_ulPWMDutyCycleW * g_ulPWMClock) / 65536; if(ulWidth < g_ulMinPulseWidth) { ulWidth = g_ulMinPulseWidth; } if((g_ulPWMClock - ulWidth) < g_ulMinPulseWidth) { ulWidth = g_ulPWMClock - g_ulMinPulseWidth; } // // Set the pulse width of the W phase of the motor. // PWMPulseWidthSet(PWM0_BASE, PWM_OUT_4, ulWidth); // // Perform a synchronous update of all three PWM generators. // PWMSyncUpdate(PWM0_BASE, PWM_GEN_0_BIT | PWM_GEN_1_BIT | PWM_GEN_2_BIT); }
//***************************************************************************** // //! Updates the duty cycle in the PWM module. //! //! This function programs the duty cycle of the PWM waveforms into the PWM //! module. The changes will be written to the hardware and the hardware //! instructed to start using the new values the next time its counters reach //! zero. //! //! \return None. // //*****************************************************************************
Updates the duty cycle in the PWM module. This function programs the duty cycle of the PWM waveforms into the PWM module. The changes will be written to the hardware and the hardware instructed to start using the new values the next time its counters reach zero. \return None.
[ "Updates", "the", "duty", "cycle", "in", "the", "PWM", "module", ".", "This", "function", "programs", "the", "duty", "cycle", "of", "the", "PWM", "waveforms", "into", "the", "PWM", "module", ".", "The", "changes", "will", "be", "written", "to", "the", "hardware", "and", "the", "hardware", "instructed", "to", "start", "using", "the", "new", "values", "the", "next", "time", "its", "counters", "reach", "zero", ".", "\\", "return", "None", "." ]
static void PWMUpdateDutyCycle(void) { unsigned long ulWidth; ulWidth = (g_ulPWMDutyCycleU * g_ulPWMClock) / 65536; if(ulWidth < g_ulMinPulseWidth) { ulWidth = g_ulMinPulseWidth; } if((g_ulPWMClock - ulWidth) < g_ulMinPulseWidth) { ulWidth = g_ulPWMClock - g_ulMinPulseWidth; } PWMPulseWidthSet(PWM0_BASE, PWM_OUT_0, ulWidth); ulWidth = (g_ulPWMDutyCycleV * g_ulPWMClock) / 65536; if(ulWidth < g_ulMinPulseWidth) { ulWidth = g_ulMinPulseWidth; } if((g_ulPWMClock - ulWidth) < g_ulMinPulseWidth) { ulWidth = g_ulPWMClock - g_ulMinPulseWidth; } PWMPulseWidthSet(PWM0_BASE, PWM_OUT_2, ulWidth); ulWidth = (g_ulPWMDutyCycleW * g_ulPWMClock) / 65536; if(ulWidth < g_ulMinPulseWidth) { ulWidth = g_ulMinPulseWidth; } if((g_ulPWMClock - ulWidth) < g_ulMinPulseWidth) { ulWidth = g_ulPWMClock - g_ulMinPulseWidth; } PWMPulseWidthSet(PWM0_BASE, PWM_OUT_4, ulWidth); PWMSyncUpdate(PWM0_BASE, PWM_GEN_0_BIT | PWM_GEN_1_BIT | PWM_GEN_2_BIT); }
[ "static", "void", "PWMUpdateDutyCycle", "(", "void", ")", "{", "unsigned", "long", "ulWidth", ";", "ulWidth", "=", "(", "g_ulPWMDutyCycleU", "*", "g_ulPWMClock", ")", "/", "65536", ";", "if", "(", "ulWidth", "<", "g_ulMinPulseWidth", ")", "{", "ulWidth", "=", "g_ulMinPulseWidth", ";", "}", "if", "(", "(", "g_ulPWMClock", "-", "ulWidth", ")", "<", "g_ulMinPulseWidth", ")", "{", "ulWidth", "=", "g_ulPWMClock", "-", "g_ulMinPulseWidth", ";", "}", "PWMPulseWidthSet", "(", "PWM0_BASE", ",", "PWM_OUT_0", ",", "ulWidth", ")", ";", "ulWidth", "=", "(", "g_ulPWMDutyCycleV", "*", "g_ulPWMClock", ")", "/", "65536", ";", "if", "(", "ulWidth", "<", "g_ulMinPulseWidth", ")", "{", "ulWidth", "=", "g_ulMinPulseWidth", ";", "}", "if", "(", "(", "g_ulPWMClock", "-", "ulWidth", ")", "<", "g_ulMinPulseWidth", ")", "{", "ulWidth", "=", "g_ulPWMClock", "-", "g_ulMinPulseWidth", ";", "}", "PWMPulseWidthSet", "(", "PWM0_BASE", ",", "PWM_OUT_2", ",", "ulWidth", ")", ";", "ulWidth", "=", "(", "g_ulPWMDutyCycleW", "*", "g_ulPWMClock", ")", "/", "65536", ";", "if", "(", "ulWidth", "<", "g_ulMinPulseWidth", ")", "{", "ulWidth", "=", "g_ulMinPulseWidth", ";", "}", "if", "(", "(", "g_ulPWMClock", "-", "ulWidth", ")", "<", "g_ulMinPulseWidth", ")", "{", "ulWidth", "=", "g_ulPWMClock", "-", "g_ulMinPulseWidth", ";", "}", "PWMPulseWidthSet", "(", "PWM0_BASE", ",", "PWM_OUT_4", ",", "ulWidth", ")", ";", "PWMSyncUpdate", "(", "PWM0_BASE", ",", "PWM_GEN_0_BIT", "|", "PWM_GEN_1_BIT", "|", "PWM_GEN_2_BIT", ")", ";", "}" ]
Updates the duty cycle in the PWM module.
[ "Updates", "the", "duty", "cycle", "in", "the", "PWM", "module", "." ]
[ "//\r", "// Get the pulse width of the U phase of the motor. If the width of the\r", "// positive portion of the pulse is less than the minimum pulse width, then\r", "// force the signal low continuously. If the width of the negative portion\r", "// of the pulse is less than the minimum pulse width, then force the signal\r", "// high continuously.\r", "//\r", "//\r", "// Set the pulse width of the U phase of the motor.\r", "//\r", "//\r", "// Get the pulse width of the V phase of the motor.\r", "//\r", "//\r", "// Set the pulse width of the V phase of the motor.\r", "//\r", "//\r", "// Get the pulse width of the W phase of the motor.\r", "//\r", "//\r", "// Set the pulse width of the W phase of the motor.\r", "//\r", "//\r", "// Perform a synchronous update of all three PWM generators.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7655648256265c07511773203b6a64bb2b33c5a4
junyanl-code/Luminary-Micro-Library
boards/rdk-acim/qs-acim/pwm_ctrl.c
[ "BSD-3-Clause" ]
C
PWM0IntHandler
void
void PWM0IntHandler(void) { // // Clear the PWM interrupt. This is done twice since the clear will be // ignored by hardware if it occurs on the same cycle as another interrupt // event; the second clear takes care of the case wehre the first gets // ignored. // PWMGenIntClear(PWM0_BASE, PWM_GEN_0, PWM_INT_CNT_ZERO); PWMGenIntClear(PWM0_BASE, PWM_GEN_0, PWM_INT_CNT_ZERO); // // Increment the count of PWM periods. // g_ulPWMPeriodCount++; // // See if it is time for a new PWM duty cycle, based on the correct number // of PWM periods passing and the availability of new duty cycle values. // if((g_ulPWMPeriodCount > g_sParameters.ucUpdateRate) && (HWREGBITW(&g_ulPWMFlags, PWM_FLAG_NEW_DUTY_CYCLE) == 1)) { // // See if the PWM frequency needs to be updated. // if(HWREGBITW(&g_ulPWMFlags, PWM_FLAG_NEW_FREQUENCY) == 1) { // // Set the new PWM period in each of the PWM generators. // PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, g_ulPWMClock); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_1, g_ulPWMClock); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_2, g_ulPWMClock); // // Indicate that the PWM frequency has been updated. // HWREGBITW(&g_ulPWMFlags, PWM_FLAG_NEW_FREQUENCY) = 0; } // // Update the duty cycle. // PWMUpdateDutyCycle(); // // Clear the duty cycle update flag. // HWREGBITW(&g_ulPWMFlags, PWM_FLAG_NEW_DUTY_CYCLE) = 0; } // // If the required number of PWM periods have expired, request an update of // the duty cycle computations. // if(g_ulPWMPeriodCount >= (g_sParameters.ucUpdateRate + 1)) { // // Trigger the waveform update software interrupt. // HWREG(NVIC_SW_TRIG) = INT_PWM0_1 - 16; } // // Increment the millisecond counter. By adding 1000 for each PWM // interrupt, it will take one millisecond for the counter to reach the PWM // frequency. // g_ulPWMMillisecondCount += 1000; // // See if a millisecond has expired. // if(g_ulPWMMillisecondCount >= g_ulPWMFrequency) { // // Trigger the millisecond software interrupt. // HWREG(NVIC_SW_TRIG) = INT_PWM0_2 - 16; // // Decrement the millisecond counter by the PWM frequency, which // corresponds to one millisecond. // g_ulPWMMillisecondCount -= g_ulPWMFrequency; } }
//***************************************************************************** // //! Handles the PWM interrupt. //! //! This function is called as a result of the interrupt generated by the PWM //! module when the counter reaches zero. If an updated PWM frequency or duty //! cycle is available, they will be updated in the hardware by this function. //! //! \return None. // //*****************************************************************************
Handles the PWM interrupt. This function is called as a result of the interrupt generated by the PWM module when the counter reaches zero. If an updated PWM frequency or duty cycle is available, they will be updated in the hardware by this function. \return None.
[ "Handles", "the", "PWM", "interrupt", ".", "This", "function", "is", "called", "as", "a", "result", "of", "the", "interrupt", "generated", "by", "the", "PWM", "module", "when", "the", "counter", "reaches", "zero", ".", "If", "an", "updated", "PWM", "frequency", "or", "duty", "cycle", "is", "available", "they", "will", "be", "updated", "in", "the", "hardware", "by", "this", "function", ".", "\\", "return", "None", "." ]
void PWM0IntHandler(void) { PWMGenIntClear(PWM0_BASE, PWM_GEN_0, PWM_INT_CNT_ZERO); PWMGenIntClear(PWM0_BASE, PWM_GEN_0, PWM_INT_CNT_ZERO); g_ulPWMPeriodCount++; if((g_ulPWMPeriodCount > g_sParameters.ucUpdateRate) && (HWREGBITW(&g_ulPWMFlags, PWM_FLAG_NEW_DUTY_CYCLE) == 1)) { if(HWREGBITW(&g_ulPWMFlags, PWM_FLAG_NEW_FREQUENCY) == 1) { PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, g_ulPWMClock); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_1, g_ulPWMClock); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_2, g_ulPWMClock); HWREGBITW(&g_ulPWMFlags, PWM_FLAG_NEW_FREQUENCY) = 0; } PWMUpdateDutyCycle(); HWREGBITW(&g_ulPWMFlags, PWM_FLAG_NEW_DUTY_CYCLE) = 0; } if(g_ulPWMPeriodCount >= (g_sParameters.ucUpdateRate + 1)) { HWREG(NVIC_SW_TRIG) = INT_PWM0_1 - 16; } g_ulPWMMillisecondCount += 1000; if(g_ulPWMMillisecondCount >= g_ulPWMFrequency) { HWREG(NVIC_SW_TRIG) = INT_PWM0_2 - 16; g_ulPWMMillisecondCount -= g_ulPWMFrequency; } }
[ "void", "PWM0IntHandler", "(", "void", ")", "{", "PWMGenIntClear", "(", "PWM0_BASE", ",", "PWM_GEN_0", ",", "PWM_INT_CNT_ZERO", ")", ";", "PWMGenIntClear", "(", "PWM0_BASE", ",", "PWM_GEN_0", ",", "PWM_INT_CNT_ZERO", ")", ";", "g_ulPWMPeriodCount", "++", ";", "if", "(", "(", "g_ulPWMPeriodCount", ">", "g_sParameters", ".", "ucUpdateRate", ")", "&&", "(", "HWREGBITW", "(", "&", "g_ulPWMFlags", ",", "PWM_FLAG_NEW_DUTY_CYCLE", ")", "==", "1", ")", ")", "{", "if", "(", "HWREGBITW", "(", "&", "g_ulPWMFlags", ",", "PWM_FLAG_NEW_FREQUENCY", ")", "==", "1", ")", "{", "PWMGenPeriodSet", "(", "PWM0_BASE", ",", "PWM_GEN_0", ",", "g_ulPWMClock", ")", ";", "PWMGenPeriodSet", "(", "PWM0_BASE", ",", "PWM_GEN_1", ",", "g_ulPWMClock", ")", ";", "PWMGenPeriodSet", "(", "PWM0_BASE", ",", "PWM_GEN_2", ",", "g_ulPWMClock", ")", ";", "HWREGBITW", "(", "&", "g_ulPWMFlags", ",", "PWM_FLAG_NEW_FREQUENCY", ")", "=", "0", ";", "}", "PWMUpdateDutyCycle", "(", ")", ";", "HWREGBITW", "(", "&", "g_ulPWMFlags", ",", "PWM_FLAG_NEW_DUTY_CYCLE", ")", "=", "0", ";", "}", "if", "(", "g_ulPWMPeriodCount", ">=", "(", "g_sParameters", ".", "ucUpdateRate", "+", "1", ")", ")", "{", "HWREG", "(", "NVIC_SW_TRIG", ")", "=", "INT_PWM0_1", "-", "16", ";", "}", "g_ulPWMMillisecondCount", "+=", "1000", ";", "if", "(", "g_ulPWMMillisecondCount", ">=", "g_ulPWMFrequency", ")", "{", "HWREG", "(", "NVIC_SW_TRIG", ")", "=", "INT_PWM0_2", "-", "16", ";", "g_ulPWMMillisecondCount", "-=", "g_ulPWMFrequency", ";", "}", "}" ]
Handles the PWM interrupt.
[ "Handles", "the", "PWM", "interrupt", "." ]
[ "//\r", "// Clear the PWM interrupt. This is done twice since the clear will be\r", "// ignored by hardware if it occurs on the same cycle as another interrupt\r", "// event; the second clear takes care of the case wehre the first gets\r", "// ignored.\r", "//\r", "//\r", "// Increment the count of PWM periods.\r", "//\r", "//\r", "// See if it is time for a new PWM duty cycle, based on the correct number\r", "// of PWM periods passing and the availability of new duty cycle values.\r", "//\r", "//\r", "// See if the PWM frequency needs to be updated.\r", "//\r", "//\r", "// Set the new PWM period in each of the PWM generators.\r", "//\r", "//\r", "// Indicate that the PWM frequency has been updated.\r", "//\r", "//\r", "// Update the duty cycle.\r", "//\r", "//\r", "// Clear the duty cycle update flag.\r", "//\r", "//\r", "// If the required number of PWM periods have expired, request an update of\r", "// the duty cycle computations.\r", "//\r", "//\r", "// Trigger the waveform update software interrupt.\r", "//\r", "//\r", "// Increment the millisecond counter. By adding 1000 for each PWM\r", "// interrupt, it will take one millisecond for the counter to reach the PWM\r", "// frequency.\r", "//\r", "//\r", "// See if a millisecond has expired.\r", "//\r", "//\r", "// Trigger the millisecond software interrupt.\r", "//\r", "//\r", "// Decrement the millisecond counter by the PWM frequency, which\r", "// corresponds to one millisecond.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7655648256265c07511773203b6a64bb2b33c5a4
junyanl-code/Luminary-Micro-Library
boards/rdk-acim/qs-acim/pwm_ctrl.c
[ "BSD-3-Clause" ]
C
PWMFaultHandler
void
void PWMFaultHandler(void) { // // Clear the fault interrupt. // PWMFaultIntClear(PWM0_BASE); // // Emergency stop the motor drive. // MainEmergencyStop(); // // Indicate that the power module fault has occurred. // MainSetFault(FAULT_POWER_MODULE); }
//***************************************************************************** // //! Handles the PWM fault interrupt. //! //! This function is called as a result of the interrupt generated by the //! assertion of the PWM fault input. It is treated as a sticky fault //! condition and will emergency stop the motor drive. //! //! \return None. // //*****************************************************************************
Handles the PWM fault interrupt. This function is called as a result of the interrupt generated by the assertion of the PWM fault input. It is treated as a sticky fault condition and will emergency stop the motor drive. \return None.
[ "Handles", "the", "PWM", "fault", "interrupt", ".", "This", "function", "is", "called", "as", "a", "result", "of", "the", "interrupt", "generated", "by", "the", "assertion", "of", "the", "PWM", "fault", "input", ".", "It", "is", "treated", "as", "a", "sticky", "fault", "condition", "and", "will", "emergency", "stop", "the", "motor", "drive", ".", "\\", "return", "None", "." ]
void PWMFaultHandler(void) { PWMFaultIntClear(PWM0_BASE); MainEmergencyStop(); MainSetFault(FAULT_POWER_MODULE); }
[ "void", "PWMFaultHandler", "(", "void", ")", "{", "PWMFaultIntClear", "(", "PWM0_BASE", ")", ";", "MainEmergencyStop", "(", ")", ";", "MainSetFault", "(", "FAULT_POWER_MODULE", ")", ";", "}" ]
Handles the PWM fault interrupt.
[ "Handles", "the", "PWM", "fault", "interrupt", "." ]
[ "//\r", "// Clear the fault interrupt.\r", "//\r", "//\r", "// Emergency stop the motor drive.\r", "//\r", "//\r", "// Indicate that the power module fault has occurred.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7655648256265c07511773203b6a64bb2b33c5a4
junyanl-code/Luminary-Micro-Library
boards/rdk-acim/qs-acim/pwm_ctrl.c
[ "BSD-3-Clause" ]
C
PWMGetPeriodCount
null
unsigned long PWMGetPeriodCount(void) { // // Return the count of PWM periods. // return(g_ulPWMPeriodCount); }
//***************************************************************************** // //! Gets the number of PWM interrupts that have occurred. //! //! This function returns the number of PWM interrupts that have been counted. //! Used in conjunction with the desired update rate, missed waveform updates //! can be detected and compensated for. //! //! \return The number of PWM interrupts that have been counted. // //*****************************************************************************
Gets the number of PWM interrupts that have occurred. This function returns the number of PWM interrupts that have been counted. Used in conjunction with the desired update rate, missed waveform updates can be detected and compensated for. \return The number of PWM interrupts that have been counted.
[ "Gets", "the", "number", "of", "PWM", "interrupts", "that", "have", "occurred", ".", "This", "function", "returns", "the", "number", "of", "PWM", "interrupts", "that", "have", "been", "counted", ".", "Used", "in", "conjunction", "with", "the", "desired", "update", "rate", "missed", "waveform", "updates", "can", "be", "detected", "and", "compensated", "for", ".", "\\", "return", "The", "number", "of", "PWM", "interrupts", "that", "have", "been", "counted", "." ]
unsigned long PWMGetPeriodCount(void) { return(g_ulPWMPeriodCount); }
[ "unsigned", "long", "PWMGetPeriodCount", "(", "void", ")", "{", "return", "(", "g_ulPWMPeriodCount", ")", ";", "}" ]
Gets the number of PWM interrupts that have occurred.
[ "Gets", "the", "number", "of", "PWM", "interrupts", "that", "have", "occurred", "." ]
[ "//\r", "// Return the count of PWM periods.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7655648256265c07511773203b6a64bb2b33c5a4
junyanl-code/Luminary-Micro-Library
boards/rdk-acim/qs-acim/pwm_ctrl.c
[ "BSD-3-Clause" ]
C
PWMReducePeriodCount
void
void PWMReducePeriodCount(unsigned long ulCount) { // // Disable the PWM interrupt temporarily. // IntDisable(INT_PWM0_0); // // Decrement the PWM period count by the given number. // g_ulPWMPeriodCount -= ulCount; // // Re-enable the PWM interrupt. // IntEnable(INT_PWM0_0); }
//***************************************************************************** // //! Reduces the count of PWM interrupts. //! //! \param ulCount is the number by which to reduce the PWM interrupt count. //! //! This function reduces the PWM interrupt count by a given number. When the //! waveform values are updated, the interrupt count can be reduced by the //! appropriate amount to maintain a proper indication of when the next //! waveform update should occur. //! //! If the PWM interrupt count is not reduced when the waveforms are //! recomputed, the waveform update software interrupt will not be triggered as //! desired. //! //! \return None. // //*****************************************************************************
Reduces the count of PWM interrupts. \param ulCount is the number by which to reduce the PWM interrupt count. This function reduces the PWM interrupt count by a given number. When the waveform values are updated, the interrupt count can be reduced by the appropriate amount to maintain a proper indication of when the next waveform update should occur. If the PWM interrupt count is not reduced when the waveforms are recomputed, the waveform update software interrupt will not be triggered as desired. \return None.
[ "Reduces", "the", "count", "of", "PWM", "interrupts", ".", "\\", "param", "ulCount", "is", "the", "number", "by", "which", "to", "reduce", "the", "PWM", "interrupt", "count", ".", "This", "function", "reduces", "the", "PWM", "interrupt", "count", "by", "a", "given", "number", ".", "When", "the", "waveform", "values", "are", "updated", "the", "interrupt", "count", "can", "be", "reduced", "by", "the", "appropriate", "amount", "to", "maintain", "a", "proper", "indication", "of", "when", "the", "next", "waveform", "update", "should", "occur", ".", "If", "the", "PWM", "interrupt", "count", "is", "not", "reduced", "when", "the", "waveforms", "are", "recomputed", "the", "waveform", "update", "software", "interrupt", "will", "not", "be", "triggered", "as", "desired", ".", "\\", "return", "None", "." ]
void PWMReducePeriodCount(unsigned long ulCount) { IntDisable(INT_PWM0_0); g_ulPWMPeriodCount -= ulCount; IntEnable(INT_PWM0_0); }
[ "void", "PWMReducePeriodCount", "(", "unsigned", "long", "ulCount", ")", "{", "IntDisable", "(", "INT_PWM0_0", ")", ";", "g_ulPWMPeriodCount", "-=", "ulCount", ";", "IntEnable", "(", "INT_PWM0_0", ")", ";", "}" ]
Reduces the count of PWM interrupts.
[ "Reduces", "the", "count", "of", "PWM", "interrupts", "." ]
[ "//\r", "// Disable the PWM interrupt temporarily.\r", "//\r", "//\r", "// Decrement the PWM period count by the given number.\r", "//\r", "//\r", "// Re-enable the PWM interrupt.\r", "//\r" ]
[ { "param": "ulCount", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulCount", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7655648256265c07511773203b6a64bb2b33c5a4
junyanl-code/Luminary-Micro-Library
boards/rdk-acim/qs-acim/pwm_ctrl.c
[ "BSD-3-Clause" ]
C
PWMSetDutyCycle
void
void PWMSetDutyCycle(unsigned long ulDutyCycleU, unsigned long ulDutyCycleV, unsigned long ulDutyCycleW) { // // Disable the PWM interrupt temporarily. // IntDisable(INT_PWM0_0); // // Save the duty cycles for the three phases. // g_ulPWMDutyCycleU = ulDutyCycleU; g_ulPWMDutyCycleV = ulDutyCycleV; g_ulPWMDutyCycleW = ulDutyCycleW; // // Set the flag indicating that the duty cycles need to be updated. // HWREGBITW(&g_ulPWMFlags, PWM_FLAG_NEW_DUTY_CYCLE) = 1; // // Re-enable the PWM interrupt. // IntEnable(INT_PWM0_0); }
//***************************************************************************** // //! Sets the duty cycle of the generated PWM waveforms. //! //! \param ulDutyCycleU is the duty cycle of the waveform for the U phase of //! the motor, specified as a 16.16 fixed point value between 0.0 and 1.0. //! \param ulDutyCycleV is the duty cycle of the waveform for the V phase of //! the motor, specified as a 16.16 fixed point value between 0.0 and 1.0. //! \param ulDutyCycleW is the duty cycle of the waveform for the W phase of //! the motor, specified as a 16.16 fixed point value between 0.0 and 1.0. //! //! This function configures the duty cycle of the generated PWM waveforms. //! The duty cycle update will not occur immediately; the change will be //! registered for synchronous application to the output waveforms to avoid //! discontinuities. //! //! \return None. // //*****************************************************************************
Sets the duty cycle of the generated PWM waveforms. \param ulDutyCycleU is the duty cycle of the waveform for the U phase of the motor, specified as a 16.16 fixed point value between 0.0 and 1.0. \param ulDutyCycleV is the duty cycle of the waveform for the V phase of the motor, specified as a 16.16 fixed point value between 0.0 and 1.0. \param ulDutyCycleW is the duty cycle of the waveform for the W phase of the motor, specified as a 16.16 fixed point value between 0.0 and 1.0. This function configures the duty cycle of the generated PWM waveforms. The duty cycle update will not occur immediately; the change will be registered for synchronous application to the output waveforms to avoid discontinuities. \return None.
[ "Sets", "the", "duty", "cycle", "of", "the", "generated", "PWM", "waveforms", ".", "\\", "param", "ulDutyCycleU", "is", "the", "duty", "cycle", "of", "the", "waveform", "for", "the", "U", "phase", "of", "the", "motor", "specified", "as", "a", "16", ".", "16", "fixed", "point", "value", "between", "0", ".", "0", "and", "1", ".", "0", ".", "\\", "param", "ulDutyCycleV", "is", "the", "duty", "cycle", "of", "the", "waveform", "for", "the", "V", "phase", "of", "the", "motor", "specified", "as", "a", "16", ".", "16", "fixed", "point", "value", "between", "0", ".", "0", "and", "1", ".", "0", ".", "\\", "param", "ulDutyCycleW", "is", "the", "duty", "cycle", "of", "the", "waveform", "for", "the", "W", "phase", "of", "the", "motor", "specified", "as", "a", "16", ".", "16", "fixed", "point", "value", "between", "0", ".", "0", "and", "1", ".", "0", ".", "This", "function", "configures", "the", "duty", "cycle", "of", "the", "generated", "PWM", "waveforms", ".", "The", "duty", "cycle", "update", "will", "not", "occur", "immediately", ";", "the", "change", "will", "be", "registered", "for", "synchronous", "application", "to", "the", "output", "waveforms", "to", "avoid", "discontinuities", ".", "\\", "return", "None", "." ]
void PWMSetDutyCycle(unsigned long ulDutyCycleU, unsigned long ulDutyCycleV, unsigned long ulDutyCycleW) { IntDisable(INT_PWM0_0); g_ulPWMDutyCycleU = ulDutyCycleU; g_ulPWMDutyCycleV = ulDutyCycleV; g_ulPWMDutyCycleW = ulDutyCycleW; HWREGBITW(&g_ulPWMFlags, PWM_FLAG_NEW_DUTY_CYCLE) = 1; IntEnable(INT_PWM0_0); }
[ "void", "PWMSetDutyCycle", "(", "unsigned", "long", "ulDutyCycleU", ",", "unsigned", "long", "ulDutyCycleV", ",", "unsigned", "long", "ulDutyCycleW", ")", "{", "IntDisable", "(", "INT_PWM0_0", ")", ";", "g_ulPWMDutyCycleU", "=", "ulDutyCycleU", ";", "g_ulPWMDutyCycleV", "=", "ulDutyCycleV", ";", "g_ulPWMDutyCycleW", "=", "ulDutyCycleW", ";", "HWREGBITW", "(", "&", "g_ulPWMFlags", ",", "PWM_FLAG_NEW_DUTY_CYCLE", ")", "=", "1", ";", "IntEnable", "(", "INT_PWM0_0", ")", ";", "}" ]
Sets the duty cycle of the generated PWM waveforms.
[ "Sets", "the", "duty", "cycle", "of", "the", "generated", "PWM", "waveforms", "." ]
[ "//\r", "// Disable the PWM interrupt temporarily.\r", "//\r", "//\r", "// Save the duty cycles for the three phases.\r", "//\r", "//\r", "// Set the flag indicating that the duty cycles need to be updated.\r", "//\r", "//\r", "// Re-enable the PWM interrupt.\r", "//\r" ]
[ { "param": "ulDutyCycleU", "type": "unsigned long" }, { "param": "ulDutyCycleV", "type": "unsigned long" }, { "param": "ulDutyCycleW", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulDutyCycleU", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulDutyCycleV", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulDutyCycleW", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7655648256265c07511773203b6a64bb2b33c5a4
junyanl-code/Luminary-Micro-Library
boards/rdk-acim/qs-acim/pwm_ctrl.c
[ "BSD-3-Clause" ]
C
PWMOutputPrecharge
void
void PWMOutputPrecharge(void) { // // Disable the high side switches. // PWMOutputState(PWM0_BASE, PWM_OUT_1_BIT | PWM_OUT_3_BIT | PWM_OUT_5_BIT, false); // // Enable the low side switches. // PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT | PWM_OUT_2_BIT | PWM_OUT_4_BIT, true); // // Set the PWM duty cycles to 50%. // g_ulPWMDutyCycleU = 32768; g_ulPWMDutyCycleV = 32768; g_ulPWMDutyCycleW = 32768; // // Set the PWM period based on the configured PWM frequency. // PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, g_ulPWMClock); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_1, g_ulPWMClock); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_2, g_ulPWMClock); // // Update the PWM duty cycles. // PWMUpdateDutyCycle(); }
//***************************************************************************** // //! Sets the PWM outputs to precharge the high side gate drives. //! //! This function configures the PWM outputs such that they will start charging //! the bootstrap capacitor on the high side gate drives. Without this step, //! the high side gates will not turn on properly for the first several PWM //! cycles when starting the motor drive. //! //! \return None. // //*****************************************************************************
Sets the PWM outputs to precharge the high side gate drives. This function configures the PWM outputs such that they will start charging the bootstrap capacitor on the high side gate drives. Without this step, the high side gates will not turn on properly for the first several PWM cycles when starting the motor drive. \return None.
[ "Sets", "the", "PWM", "outputs", "to", "precharge", "the", "high", "side", "gate", "drives", ".", "This", "function", "configures", "the", "PWM", "outputs", "such", "that", "they", "will", "start", "charging", "the", "bootstrap", "capacitor", "on", "the", "high", "side", "gate", "drives", ".", "Without", "this", "step", "the", "high", "side", "gates", "will", "not", "turn", "on", "properly", "for", "the", "first", "several", "PWM", "cycles", "when", "starting", "the", "motor", "drive", ".", "\\", "return", "None", "." ]
void PWMOutputPrecharge(void) { PWMOutputState(PWM0_BASE, PWM_OUT_1_BIT | PWM_OUT_3_BIT | PWM_OUT_5_BIT, false); PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT | PWM_OUT_2_BIT | PWM_OUT_4_BIT, true); g_ulPWMDutyCycleU = 32768; g_ulPWMDutyCycleV = 32768; g_ulPWMDutyCycleW = 32768; PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, g_ulPWMClock); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_1, g_ulPWMClock); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_2, g_ulPWMClock); PWMUpdateDutyCycle(); }
[ "void", "PWMOutputPrecharge", "(", "void", ")", "{", "PWMOutputState", "(", "PWM0_BASE", ",", "PWM_OUT_1_BIT", "|", "PWM_OUT_3_BIT", "|", "PWM_OUT_5_BIT", ",", "false", ")", ";", "PWMOutputState", "(", "PWM0_BASE", ",", "PWM_OUT_0_BIT", "|", "PWM_OUT_2_BIT", "|", "PWM_OUT_4_BIT", ",", "true", ")", ";", "g_ulPWMDutyCycleU", "=", "32768", ";", "g_ulPWMDutyCycleV", "=", "32768", ";", "g_ulPWMDutyCycleW", "=", "32768", ";", "PWMGenPeriodSet", "(", "PWM0_BASE", ",", "PWM_GEN_0", ",", "g_ulPWMClock", ")", ";", "PWMGenPeriodSet", "(", "PWM0_BASE", ",", "PWM_GEN_1", ",", "g_ulPWMClock", ")", ";", "PWMGenPeriodSet", "(", "PWM0_BASE", ",", "PWM_GEN_2", ",", "g_ulPWMClock", ")", ";", "PWMUpdateDutyCycle", "(", ")", ";", "}" ]
Sets the PWM outputs to precharge the high side gate drives.
[ "Sets", "the", "PWM", "outputs", "to", "precharge", "the", "high", "side", "gate", "drives", "." ]
[ "//\r", "// Disable the high side switches.\r", "//\r", "//\r", "// Enable the low side switches.\r", "//\r", "//\r", "// Set the PWM duty cycles to 50%.\r", "//\r", "//\r", "// Set the PWM period based on the configured PWM frequency.\r", "//\r", "//\r", "// Update the PWM duty cycles.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7655648256265c07511773203b6a64bb2b33c5a4
junyanl-code/Luminary-Micro-Library
boards/rdk-acim/qs-acim/pwm_ctrl.c
[ "BSD-3-Clause" ]
C
PWMOutputOn
void
void PWMOutputOn(void) { // // Enable all six PWM outputs. // PWMOutputState(PWM0_BASE, (PWM_OUT_0_BIT | PWM_OUT_1_BIT | PWM_OUT_2_BIT | PWM_OUT_3_BIT | PWM_OUT_4_BIT | PWM_OUT_5_BIT), true); }
//***************************************************************************** // //! Turns on all the PWM outputs. //! //! This function turns on all of the PWM outputs, allowing them to be //! propagated to the gate drivers. //! //! \return None. // //*****************************************************************************
Turns on all the PWM outputs. This function turns on all of the PWM outputs, allowing them to be propagated to the gate drivers. \return None.
[ "Turns", "on", "all", "the", "PWM", "outputs", ".", "This", "function", "turns", "on", "all", "of", "the", "PWM", "outputs", "allowing", "them", "to", "be", "propagated", "to", "the", "gate", "drivers", ".", "\\", "return", "None", "." ]
void PWMOutputOn(void) { PWMOutputState(PWM0_BASE, (PWM_OUT_0_BIT | PWM_OUT_1_BIT | PWM_OUT_2_BIT | PWM_OUT_3_BIT | PWM_OUT_4_BIT | PWM_OUT_5_BIT), true); }
[ "void", "PWMOutputOn", "(", "void", ")", "{", "PWMOutputState", "(", "PWM0_BASE", ",", "(", "PWM_OUT_0_BIT", "|", "PWM_OUT_1_BIT", "|", "PWM_OUT_2_BIT", "|", "PWM_OUT_3_BIT", "|", "PWM_OUT_4_BIT", "|", "PWM_OUT_5_BIT", ")", ",", "true", ")", ";", "}" ]
Turns on all the PWM outputs.
[ "Turns", "on", "all", "the", "PWM", "outputs", "." ]
[ "//\r", "// Enable all six PWM outputs.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7655648256265c07511773203b6a64bb2b33c5a4
junyanl-code/Luminary-Micro-Library
boards/rdk-acim/qs-acim/pwm_ctrl.c
[ "BSD-3-Clause" ]
C
PWMOutputOff
void
void PWMOutputOff(void) { // // Disable all six PWM outputs. // PWMOutputState(PWM0_BASE, (PWM_OUT_0_BIT | PWM_OUT_1_BIT | PWM_OUT_2_BIT | PWM_OUT_3_BIT | PWM_OUT_4_BIT | PWM_OUT_5_BIT), false); // // Set the PWM duty cycles to 50%. // g_ulPWMDutyCycleU = 32768; g_ulPWMDutyCycleV = 32768; g_ulPWMDutyCycleW = 32768; // // Set the PWM period so that the ADC runs at 1 KHz. // PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, PWM_CLOCK / 1000); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_1, PWM_CLOCK / 1000); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_2, PWM_CLOCK / 1000); // // Update the PWM duty cycles. // PWMUpdateDutyCycle(); }
//***************************************************************************** // //! Turns off all the PWM outputs. //! //! This function turns off all of the PWM outputs, preventing them from being //! propagates to the gate drivers. //! //! \return None. // //*****************************************************************************
Turns off all the PWM outputs. This function turns off all of the PWM outputs, preventing them from being propagates to the gate drivers. \return None.
[ "Turns", "off", "all", "the", "PWM", "outputs", ".", "This", "function", "turns", "off", "all", "of", "the", "PWM", "outputs", "preventing", "them", "from", "being", "propagates", "to", "the", "gate", "drivers", ".", "\\", "return", "None", "." ]
void PWMOutputOff(void) { PWMOutputState(PWM0_BASE, (PWM_OUT_0_BIT | PWM_OUT_1_BIT | PWM_OUT_2_BIT | PWM_OUT_3_BIT | PWM_OUT_4_BIT | PWM_OUT_5_BIT), false); g_ulPWMDutyCycleU = 32768; g_ulPWMDutyCycleV = 32768; g_ulPWMDutyCycleW = 32768; PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, PWM_CLOCK / 1000); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_1, PWM_CLOCK / 1000); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_2, PWM_CLOCK / 1000); PWMUpdateDutyCycle(); }
[ "void", "PWMOutputOff", "(", "void", ")", "{", "PWMOutputState", "(", "PWM0_BASE", ",", "(", "PWM_OUT_0_BIT", "|", "PWM_OUT_1_BIT", "|", "PWM_OUT_2_BIT", "|", "PWM_OUT_3_BIT", "|", "PWM_OUT_4_BIT", "|", "PWM_OUT_5_BIT", ")", ",", "false", ")", ";", "g_ulPWMDutyCycleU", "=", "32768", ";", "g_ulPWMDutyCycleV", "=", "32768", ";", "g_ulPWMDutyCycleW", "=", "32768", ";", "PWMGenPeriodSet", "(", "PWM0_BASE", ",", "PWM_GEN_0", ",", "PWM_CLOCK", "/", "1000", ")", ";", "PWMGenPeriodSet", "(", "PWM0_BASE", ",", "PWM_GEN_1", ",", "PWM_CLOCK", "/", "1000", ")", ";", "PWMGenPeriodSet", "(", "PWM0_BASE", ",", "PWM_GEN_2", ",", "PWM_CLOCK", "/", "1000", ")", ";", "PWMUpdateDutyCycle", "(", ")", ";", "}" ]
Turns off all the PWM outputs.
[ "Turns", "off", "all", "the", "PWM", "outputs", "." ]
[ "//\r", "// Disable all six PWM outputs.\r", "//\r", "//\r", "// Set the PWM duty cycles to 50%.\r", "//\r", "//\r", "// Set the PWM period so that the ADC runs at 1 KHz.\r", "//\r", "//\r", "// Update the PWM duty cycles.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7655648256265c07511773203b6a64bb2b33c5a4
junyanl-code/Luminary-Micro-Library
boards/rdk-acim/qs-acim/pwm_ctrl.c
[ "BSD-3-Clause" ]
C
PWMOutputDCBrake
void
void PWMOutputDCBrake(unsigned long ulVoltage) { // // Enable the U and V phases and disable the W phase. // PWMOutputState(PWM0_BASE, PWM_OUT_4_BIT | PWM_OUT_5_BIT, false); PWMOutputState(PWM0_BASE, (PWM_OUT_0_BIT | PWM_OUT_1_BIT | PWM_OUT_2_BIT | PWM_OUT_3_BIT), true); // // Set the PWM duty cycles of the U phase to the required voltage level and // the V and W phase to 50%. // g_ulPWMDutyCycleU = ((g_ulPWMClock * ulVoltage) / 160) + 32768; g_ulPWMDutyCycleV = 32768; g_ulPWMDutyCycleW = 32768; // // Update the PWM duty cycles. // PWMUpdateDutyCycle(); }
//***************************************************************************** // //! Sets the PWM outputs to DC injection brake the motor. //! //! \param ulVoltage is the DC voltage to be applied to the motor. This value //! must be less than 160V, half the nominal DC bus voltage (and likely much //! less than that). //! //! This function configures the PWM outputs such that they will provide DC //! injection braking of the motor. //! //! \note Once the motor comes to a complete stop, DC injection braking will //! simply generate heat within the motor, likely causing damage. It is //! important that the DC injection braking be disabled to avoid this //! situation. //! //! \return None. // //*****************************************************************************
Sets the PWM outputs to DC injection brake the motor. \param ulVoltage is the DC voltage to be applied to the motor. This value must be less than 160V, half the nominal DC bus voltage (and likely much less than that). This function configures the PWM outputs such that they will provide DC injection braking of the motor. \note Once the motor comes to a complete stop, DC injection braking will simply generate heat within the motor, likely causing damage. It is important that the DC injection braking be disabled to avoid this situation. \return None.
[ "Sets", "the", "PWM", "outputs", "to", "DC", "injection", "brake", "the", "motor", ".", "\\", "param", "ulVoltage", "is", "the", "DC", "voltage", "to", "be", "applied", "to", "the", "motor", ".", "This", "value", "must", "be", "less", "than", "160V", "half", "the", "nominal", "DC", "bus", "voltage", "(", "and", "likely", "much", "less", "than", "that", ")", ".", "This", "function", "configures", "the", "PWM", "outputs", "such", "that", "they", "will", "provide", "DC", "injection", "braking", "of", "the", "motor", ".", "\\", "note", "Once", "the", "motor", "comes", "to", "a", "complete", "stop", "DC", "injection", "braking", "will", "simply", "generate", "heat", "within", "the", "motor", "likely", "causing", "damage", ".", "It", "is", "important", "that", "the", "DC", "injection", "braking", "be", "disabled", "to", "avoid", "this", "situation", ".", "\\", "return", "None", "." ]
void PWMOutputDCBrake(unsigned long ulVoltage) { PWMOutputState(PWM0_BASE, PWM_OUT_4_BIT | PWM_OUT_5_BIT, false); PWMOutputState(PWM0_BASE, (PWM_OUT_0_BIT | PWM_OUT_1_BIT | PWM_OUT_2_BIT | PWM_OUT_3_BIT), true); g_ulPWMDutyCycleU = ((g_ulPWMClock * ulVoltage) / 160) + 32768; g_ulPWMDutyCycleV = 32768; g_ulPWMDutyCycleW = 32768; PWMUpdateDutyCycle(); }
[ "void", "PWMOutputDCBrake", "(", "unsigned", "long", "ulVoltage", ")", "{", "PWMOutputState", "(", "PWM0_BASE", ",", "PWM_OUT_4_BIT", "|", "PWM_OUT_5_BIT", ",", "false", ")", ";", "PWMOutputState", "(", "PWM0_BASE", ",", "(", "PWM_OUT_0_BIT", "|", "PWM_OUT_1_BIT", "|", "PWM_OUT_2_BIT", "|", "PWM_OUT_3_BIT", ")", ",", "true", ")", ";", "g_ulPWMDutyCycleU", "=", "(", "(", "g_ulPWMClock", "*", "ulVoltage", ")", "/", "160", ")", "+", "32768", ";", "g_ulPWMDutyCycleV", "=", "32768", ";", "g_ulPWMDutyCycleW", "=", "32768", ";", "PWMUpdateDutyCycle", "(", ")", ";", "}" ]
Sets the PWM outputs to DC injection brake the motor.
[ "Sets", "the", "PWM", "outputs", "to", "DC", "injection", "brake", "the", "motor", "." ]
[ "//\r", "// Enable the U and V phases and disable the W phase.\r", "//\r", "//\r", "// Set the PWM duty cycles of the U phase to the required voltage level and\r", "// the V and W phase to 50%.\r", "//\r", "//\r", "// Update the PWM duty cycles.\r", "//\r" ]
[ { "param": "ulVoltage", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulVoltage", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7655648256265c07511773203b6a64bb2b33c5a4
junyanl-code/Luminary-Micro-Library
boards/rdk-acim/qs-acim/pwm_ctrl.c
[ "BSD-3-Clause" ]
C
PWMSetUpdateRate
void
void PWMSetUpdateRate(unsigned char ucUpdateRate) { // // Temporarily disable the PWM period interrupt. Once disabled, it is no // longer possible for the waveform update software interrupt to be // triggered. // IntDisable(INT_PWM0_0); // // Change the update rate parameter. // g_sParameters.ucUpdateRate = ucUpdateRate; // // Re-enable the PWM period interrupt. // IntEnable(INT_PWM0_0); }
//***************************************************************************** // //! Changes the update rate of the motor drive. //! //! \param ucUpdateRate is the number of PWM periods between updates. //! //! This function changes the rate at which the motor drive waveforms are //! recomputed. Lower update values recompute the waveforms more frequently, //! providing more accurate waveforms at the cost of increased processor usage. //! //! \return None. // //*****************************************************************************
Changes the update rate of the motor drive. \param ucUpdateRate is the number of PWM periods between updates. This function changes the rate at which the motor drive waveforms are recomputed. Lower update values recompute the waveforms more frequently, providing more accurate waveforms at the cost of increased processor usage. \return None.
[ "Changes", "the", "update", "rate", "of", "the", "motor", "drive", ".", "\\", "param", "ucUpdateRate", "is", "the", "number", "of", "PWM", "periods", "between", "updates", ".", "This", "function", "changes", "the", "rate", "at", "which", "the", "motor", "drive", "waveforms", "are", "recomputed", ".", "Lower", "update", "values", "recompute", "the", "waveforms", "more", "frequently", "providing", "more", "accurate", "waveforms", "at", "the", "cost", "of", "increased", "processor", "usage", ".", "\\", "return", "None", "." ]
void PWMSetUpdateRate(unsigned char ucUpdateRate) { IntDisable(INT_PWM0_0); g_sParameters.ucUpdateRate = ucUpdateRate; IntEnable(INT_PWM0_0); }
[ "void", "PWMSetUpdateRate", "(", "unsigned", "char", "ucUpdateRate", ")", "{", "IntDisable", "(", "INT_PWM0_0", ")", ";", "g_sParameters", ".", "ucUpdateRate", "=", "ucUpdateRate", ";", "IntEnable", "(", "INT_PWM0_0", ")", ";", "}" ]
Changes the update rate of the motor drive.
[ "Changes", "the", "update", "rate", "of", "the", "motor", "drive", "." ]
[ "//\r", "// Temporarily disable the PWM period interrupt. Once disabled, it is no\r", "// longer possible for the waveform update software interrupt to be\r", "// triggered.\r", "//\r", "//\r", "// Change the update rate parameter.\r", "//\r", "//\r", "// Re-enable the PWM period interrupt.\r", "//\r" ]
[ { "param": "ucUpdateRate", "type": "unsigned char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ucUpdateRate", "type": "unsigned char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7655648256265c07511773203b6a64bb2b33c5a4
junyanl-code/Luminary-Micro-Library
boards/rdk-acim/qs-acim/pwm_ctrl.c
[ "BSD-3-Clause" ]
C
GPIOBIntHandler
void
void GPIOBIntHandler(void) { // // Clear the GPIO interrupt. // GPIOPinIntClear(PIN_FAULT_PORT, PIN_FAULT_PIN); // // Emergency stop the motor drive. // MainEmergencyStop(); // // Indicate that the power module fault has occurred. // MainSetFault(FAULT_POWER_MODULE); }
//***************************************************************************** // //! Handles the PWM fault interrupt. //! //! This function is called as a result of the interrupt generated by the //! assertion of the PWM fault input. It is treated as a sticky fault //! condition and will emergency stop the motor drive. //! //! \return None. // //*****************************************************************************
Handles the PWM fault interrupt. This function is called as a result of the interrupt generated by the assertion of the PWM fault input. It is treated as a sticky fault condition and will emergency stop the motor drive. \return None.
[ "Handles", "the", "PWM", "fault", "interrupt", ".", "This", "function", "is", "called", "as", "a", "result", "of", "the", "interrupt", "generated", "by", "the", "assertion", "of", "the", "PWM", "fault", "input", ".", "It", "is", "treated", "as", "a", "sticky", "fault", "condition", "and", "will", "emergency", "stop", "the", "motor", "drive", ".", "\\", "return", "None", "." ]
void GPIOBIntHandler(void) { GPIOPinIntClear(PIN_FAULT_PORT, PIN_FAULT_PIN); MainEmergencyStop(); MainSetFault(FAULT_POWER_MODULE); }
[ "void", "GPIOBIntHandler", "(", "void", ")", "{", "GPIOPinIntClear", "(", "PIN_FAULT_PORT", ",", "PIN_FAULT_PIN", ")", ";", "MainEmergencyStop", "(", ")", ";", "MainSetFault", "(", "FAULT_POWER_MODULE", ")", ";", "}" ]
Handles the PWM fault interrupt.
[ "Handles", "the", "PWM", "fault", "interrupt", "." ]
[ "//\r", "// Clear the GPIO interrupt.\r", "//\r", "//\r", "// Emergency stop the motor drive.\r", "//\r", "//\r", "// Indicate that the power module fault has occurred.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7655648256265c07511773203b6a64bb2b33c5a4
junyanl-code/Luminary-Micro-Library
boards/rdk-acim/qs-acim/pwm_ctrl.c
[ "BSD-3-Clause" ]
C
PWMInit
void
void PWMInit(void) { // // Make the PWM pins be peripheral function. // GPIOPinTypePWM(PIN_PHASEU_LOW_PORT, PIN_PHASEU_LOW_PIN | PIN_PHASEU_HIGH_PIN); GPIOPinTypePWM(PIN_PHASEV_LOW_PORT, PIN_PHASEV_LOW_PIN | PIN_PHASEV_HIGH_PIN); GPIOPinTypePWM(PIN_PHASEW_LOW_PORT, PIN_PHASEW_LOW_PIN | PIN_PHASEV_HIGH_PIN); // // Configure the three PWM generators for up/down counting mode, // synchronous updates, and to stop at zero on debug events. // PWMGenConfigure(PWM0_BASE, PWM_GEN_0, (PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_SYNC | PWM_GEN_MODE_DBG_STOP)); PWMGenConfigure(PWM0_BASE, PWM_GEN_1, (PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_SYNC | PWM_GEN_MODE_DBG_STOP)); PWMGenConfigure(PWM0_BASE, PWM_GEN_2, (PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_SYNC | PWM_GEN_MODE_DBG_STOP)); // // Set the initial duty cycles to 50%. // g_ulPWMDutyCycleU = 32768; g_ulPWMDutyCycleV = 32768; g_ulPWMDutyCycleW = 32768; // // Configure the PWM period, duty cycle, and dead band. The initial period // is 1 KHz (for triggering the ADC), which will be increased when the // motor starts running. // PWMSetDeadBand(); PWMSetFrequency(); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, PWM_CLOCK / 1000); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_1, PWM_CLOCK / 1000); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_2, PWM_CLOCK / 1000); PWMUpdateDutyCycle(); // // Enable the PWM generators. // PWMGenEnable(PWM0_BASE, PWM_GEN_0); PWMGenEnable(PWM0_BASE, PWM_GEN_1); PWMGenEnable(PWM0_BASE, PWM_GEN_2); // // Synchronize the time base of the generators. // PWMSyncTimeBase(PWM0_BASE, PWM_GEN_0_BIT | PWM_GEN_1_BIT | PWM_GEN_2_BIT); // // Configure an interrupt on the zero event of the first generator, and an // ADC trigger on the load event of the first generator. // PWMGenIntClear(PWM0_BASE, PWM_GEN_0, PWM_INT_CNT_ZERO); PWMGenIntTrigEnable(PWM0_BASE, PWM_GEN_0, PWM_INT_CNT_ZERO | PWM_TR_CNT_LOAD); PWMGenIntTrigEnable(PWM0_BASE, PWM_GEN_1, 0); PWMGenIntTrigEnable(PWM0_BASE, PWM_GEN_2, 0); IntEnable(INT_PWM0_0); IntEnable(INT_PWM0_1); IntEnable(INT_PWM0_2); // // Set all six PWM outputs to go to the inactive state when a fault event // occurs (which includes debug events). // PWMOutputFault(PWM0_BASE, (PWM_OUT_0_BIT | PWM_OUT_1_BIT | PWM_OUT_2_BIT | PWM_OUT_3_BIT | PWM_OUT_4_BIT | PWM_OUT_5_BIT), true); // // Disable all six PWM outputs. // PWMOutputState(PWM0_BASE, (PWM_OUT_0_BIT | PWM_OUT_1_BIT | PWM_OUT_2_BIT | PWM_OUT_3_BIT | PWM_OUT_4_BIT | PWM_OUT_5_BIT), false); // // Configure the fault signal from the power module as a falling edge // interrupt. // GPIODirModeSet(PIN_FAULT_PORT, PIN_FAULT_PIN, GPIO_DIR_MODE_IN); GPIOIntTypeSet(PIN_FAULT_PORT, PIN_FAULT_PIN, GPIO_FALLING_EDGE); GPIOPinIntClear(PIN_FAULT_PORT, PIN_FAULT_PIN); GPIOPinIntEnable(PIN_FAULT_PORT, PIN_FAULT_PIN); IntEnable(INT_GPIOB); }
//***************************************************************************** // //! Initializes the PWM control routines. //! //! This function initializes the PWM module and the control routines, //! preparing them to produce PWM waveforms to drive the power module. //! //! \return None. // //*****************************************************************************
Initializes the PWM control routines. This function initializes the PWM module and the control routines, preparing them to produce PWM waveforms to drive the power module. \return None.
[ "Initializes", "the", "PWM", "control", "routines", ".", "This", "function", "initializes", "the", "PWM", "module", "and", "the", "control", "routines", "preparing", "them", "to", "produce", "PWM", "waveforms", "to", "drive", "the", "power", "module", ".", "\\", "return", "None", "." ]
void PWMInit(void) { GPIOPinTypePWM(PIN_PHASEU_LOW_PORT, PIN_PHASEU_LOW_PIN | PIN_PHASEU_HIGH_PIN); GPIOPinTypePWM(PIN_PHASEV_LOW_PORT, PIN_PHASEV_LOW_PIN | PIN_PHASEV_HIGH_PIN); GPIOPinTypePWM(PIN_PHASEW_LOW_PORT, PIN_PHASEW_LOW_PIN | PIN_PHASEV_HIGH_PIN); PWMGenConfigure(PWM0_BASE, PWM_GEN_0, (PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_SYNC | PWM_GEN_MODE_DBG_STOP)); PWMGenConfigure(PWM0_BASE, PWM_GEN_1, (PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_SYNC | PWM_GEN_MODE_DBG_STOP)); PWMGenConfigure(PWM0_BASE, PWM_GEN_2, (PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_SYNC | PWM_GEN_MODE_DBG_STOP)); g_ulPWMDutyCycleU = 32768; g_ulPWMDutyCycleV = 32768; g_ulPWMDutyCycleW = 32768; PWMSetDeadBand(); PWMSetFrequency(); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, PWM_CLOCK / 1000); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_1, PWM_CLOCK / 1000); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_2, PWM_CLOCK / 1000); PWMUpdateDutyCycle(); PWMGenEnable(PWM0_BASE, PWM_GEN_0); PWMGenEnable(PWM0_BASE, PWM_GEN_1); PWMGenEnable(PWM0_BASE, PWM_GEN_2); PWMSyncTimeBase(PWM0_BASE, PWM_GEN_0_BIT | PWM_GEN_1_BIT | PWM_GEN_2_BIT); PWMGenIntClear(PWM0_BASE, PWM_GEN_0, PWM_INT_CNT_ZERO); PWMGenIntTrigEnable(PWM0_BASE, PWM_GEN_0, PWM_INT_CNT_ZERO | PWM_TR_CNT_LOAD); PWMGenIntTrigEnable(PWM0_BASE, PWM_GEN_1, 0); PWMGenIntTrigEnable(PWM0_BASE, PWM_GEN_2, 0); IntEnable(INT_PWM0_0); IntEnable(INT_PWM0_1); IntEnable(INT_PWM0_2); PWMOutputFault(PWM0_BASE, (PWM_OUT_0_BIT | PWM_OUT_1_BIT | PWM_OUT_2_BIT | PWM_OUT_3_BIT | PWM_OUT_4_BIT | PWM_OUT_5_BIT), true); PWMOutputState(PWM0_BASE, (PWM_OUT_0_BIT | PWM_OUT_1_BIT | PWM_OUT_2_BIT | PWM_OUT_3_BIT | PWM_OUT_4_BIT | PWM_OUT_5_BIT), false); GPIODirModeSet(PIN_FAULT_PORT, PIN_FAULT_PIN, GPIO_DIR_MODE_IN); GPIOIntTypeSet(PIN_FAULT_PORT, PIN_FAULT_PIN, GPIO_FALLING_EDGE); GPIOPinIntClear(PIN_FAULT_PORT, PIN_FAULT_PIN); GPIOPinIntEnable(PIN_FAULT_PORT, PIN_FAULT_PIN); IntEnable(INT_GPIOB); }
[ "void", "PWMInit", "(", "void", ")", "{", "GPIOPinTypePWM", "(", "PIN_PHASEU_LOW_PORT", ",", "PIN_PHASEU_LOW_PIN", "|", "PIN_PHASEU_HIGH_PIN", ")", ";", "GPIOPinTypePWM", "(", "PIN_PHASEV_LOW_PORT", ",", "PIN_PHASEV_LOW_PIN", "|", "PIN_PHASEV_HIGH_PIN", ")", ";", "GPIOPinTypePWM", "(", "PIN_PHASEW_LOW_PORT", ",", "PIN_PHASEW_LOW_PIN", "|", "PIN_PHASEV_HIGH_PIN", ")", ";", "PWMGenConfigure", "(", "PWM0_BASE", ",", "PWM_GEN_0", ",", "(", "PWM_GEN_MODE_UP_DOWN", "|", "PWM_GEN_MODE_SYNC", "|", "PWM_GEN_MODE_DBG_STOP", ")", ")", ";", "PWMGenConfigure", "(", "PWM0_BASE", ",", "PWM_GEN_1", ",", "(", "PWM_GEN_MODE_UP_DOWN", "|", "PWM_GEN_MODE_SYNC", "|", "PWM_GEN_MODE_DBG_STOP", ")", ")", ";", "PWMGenConfigure", "(", "PWM0_BASE", ",", "PWM_GEN_2", ",", "(", "PWM_GEN_MODE_UP_DOWN", "|", "PWM_GEN_MODE_SYNC", "|", "PWM_GEN_MODE_DBG_STOP", ")", ")", ";", "g_ulPWMDutyCycleU", "=", "32768", ";", "g_ulPWMDutyCycleV", "=", "32768", ";", "g_ulPWMDutyCycleW", "=", "32768", ";", "PWMSetDeadBand", "(", ")", ";", "PWMSetFrequency", "(", ")", ";", "PWMGenPeriodSet", "(", "PWM0_BASE", ",", "PWM_GEN_0", ",", "PWM_CLOCK", "/", "1000", ")", ";", "PWMGenPeriodSet", "(", "PWM0_BASE", ",", "PWM_GEN_1", ",", "PWM_CLOCK", "/", "1000", ")", ";", "PWMGenPeriodSet", "(", "PWM0_BASE", ",", "PWM_GEN_2", ",", "PWM_CLOCK", "/", "1000", ")", ";", "PWMUpdateDutyCycle", "(", ")", ";", "PWMGenEnable", "(", "PWM0_BASE", ",", "PWM_GEN_0", ")", ";", "PWMGenEnable", "(", "PWM0_BASE", ",", "PWM_GEN_1", ")", ";", "PWMGenEnable", "(", "PWM0_BASE", ",", "PWM_GEN_2", ")", ";", "PWMSyncTimeBase", "(", "PWM0_BASE", ",", "PWM_GEN_0_BIT", "|", "PWM_GEN_1_BIT", "|", "PWM_GEN_2_BIT", ")", ";", "PWMGenIntClear", "(", "PWM0_BASE", ",", "PWM_GEN_0", ",", "PWM_INT_CNT_ZERO", ")", ";", "PWMGenIntTrigEnable", "(", "PWM0_BASE", ",", "PWM_GEN_0", ",", "PWM_INT_CNT_ZERO", "|", "PWM_TR_CNT_LOAD", ")", ";", "PWMGenIntTrigEnable", "(", "PWM0_BASE", ",", "PWM_GEN_1", ",", "0", ")", ";", "PWMGenIntTrigEnable", "(", "PWM0_BASE", ",", "PWM_GEN_2", ",", "0", ")", ";", "IntEnable", "(", "INT_PWM0_0", ")", ";", "IntEnable", "(", "INT_PWM0_1", ")", ";", "IntEnable", "(", "INT_PWM0_2", ")", ";", "PWMOutputFault", "(", "PWM0_BASE", ",", "(", "PWM_OUT_0_BIT", "|", "PWM_OUT_1_BIT", "|", "PWM_OUT_2_BIT", "|", "PWM_OUT_3_BIT", "|", "PWM_OUT_4_BIT", "|", "PWM_OUT_5_BIT", ")", ",", "true", ")", ";", "PWMOutputState", "(", "PWM0_BASE", ",", "(", "PWM_OUT_0_BIT", "|", "PWM_OUT_1_BIT", "|", "PWM_OUT_2_BIT", "|", "PWM_OUT_3_BIT", "|", "PWM_OUT_4_BIT", "|", "PWM_OUT_5_BIT", ")", ",", "false", ")", ";", "GPIODirModeSet", "(", "PIN_FAULT_PORT", ",", "PIN_FAULT_PIN", ",", "GPIO_DIR_MODE_IN", ")", ";", "GPIOIntTypeSet", "(", "PIN_FAULT_PORT", ",", "PIN_FAULT_PIN", ",", "GPIO_FALLING_EDGE", ")", ";", "GPIOPinIntClear", "(", "PIN_FAULT_PORT", ",", "PIN_FAULT_PIN", ")", ";", "GPIOPinIntEnable", "(", "PIN_FAULT_PORT", ",", "PIN_FAULT_PIN", ")", ";", "IntEnable", "(", "INT_GPIOB", ")", ";", "}" ]
Initializes the PWM control routines.
[ "Initializes", "the", "PWM", "control", "routines", "." ]
[ "//\r", "// Make the PWM pins be peripheral function.\r", "//\r", "//\r", "// Configure the three PWM generators for up/down counting mode,\r", "// synchronous updates, and to stop at zero on debug events.\r", "//\r", "//\r", "// Set the initial duty cycles to 50%.\r", "//\r", "//\r", "// Configure the PWM period, duty cycle, and dead band. The initial period\r", "// is 1 KHz (for triggering the ADC), which will be increased when the\r", "// motor starts running.\r", "//\r", "//\r", "// Enable the PWM generators.\r", "//\r", "//\r", "// Synchronize the time base of the generators.\r", "//\r", "//\r", "// Configure an interrupt on the zero event of the first generator, and an\r", "// ADC trigger on the load event of the first generator.\r", "//\r", "//\r", "// Set all six PWM outputs to go to the inactive state when a fault event\r", "// occurs (which includes debug events).\r", "//\r", "//\r", "// Disable all six PWM outputs.\r", "//\r", "//\r", "// Configure the fault signal from the power module as a falling edge\r", "// interrupt.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7ce846f42a6694bcba13fd55c35f51bf71911785
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/usb_dev_msc/usb_dev_msc.c
[ "BSD-3-Clause" ]
C
RxHandler
null
unsigned long RxHandler(void *pvCBData, unsigned long ulEvent, unsigned long ulMsgValue, void *pvMsgData) { return(0); }
//***************************************************************************** // // Handles bulk driver notifications related to the receive channel (data from // the USB host). // // \param pvCBData is the client-supplied callback pointer for this channel. // \param ulEvent identifies the event we are being notified about. // \param ulMsgValue is an event-specific value. // \param pvMsgData is an event-specific pointer. // // This function is called by the bulk driver to notify us of any events // related to operation of the receive data channel (the OUT channel carrying // data from the USB host). // // \return The return value is event-specific. // //*****************************************************************************
Handles bulk driver notifications related to the receive channel (data from the USB host). \param pvCBData is the client-supplied callback pointer for this channel. \param ulEvent identifies the event we are being notified about. \param ulMsgValue is an event-specific value. \param pvMsgData is an event-specific pointer. This function is called by the bulk driver to notify us of any events related to operation of the receive data channel (the OUT channel carrying data from the USB host). \return The return value is event-specific.
[ "Handles", "bulk", "driver", "notifications", "related", "to", "the", "receive", "channel", "(", "data", "from", "the", "USB", "host", ")", ".", "\\", "param", "pvCBData", "is", "the", "client", "-", "supplied", "callback", "pointer", "for", "this", "channel", ".", "\\", "param", "ulEvent", "identifies", "the", "event", "we", "are", "being", "notified", "about", ".", "\\", "param", "ulMsgValue", "is", "an", "event", "-", "specific", "value", ".", "\\", "param", "pvMsgData", "is", "an", "event", "-", "specific", "pointer", ".", "This", "function", "is", "called", "by", "the", "bulk", "driver", "to", "notify", "us", "of", "any", "events", "related", "to", "operation", "of", "the", "receive", "data", "channel", "(", "the", "OUT", "channel", "carrying", "data", "from", "the", "USB", "host", ")", ".", "\\", "return", "The", "return", "value", "is", "event", "-", "specific", "." ]
unsigned long RxHandler(void *pvCBData, unsigned long ulEvent, unsigned long ulMsgValue, void *pvMsgData) { return(0); }
[ "unsigned", "long", "RxHandler", "(", "void", "*", "pvCBData", ",", "unsigned", "long", "ulEvent", ",", "unsigned", "long", "ulMsgValue", ",", "void", "*", "pvMsgData", ")", "{", "return", "(", "0", ")", ";", "}" ]
Handles bulk driver notifications related to the receive channel (data from the USB host).
[ "Handles", "bulk", "driver", "notifications", "related", "to", "the", "receive", "channel", "(", "data", "from", "the", "USB", "host", ")", "." ]
[]
[ { "param": "pvCBData", "type": "void" }, { "param": "ulEvent", "type": "unsigned long" }, { "param": "ulMsgValue", "type": "unsigned long" }, { "param": "pvMsgData", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pvCBData", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulEvent", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulMsgValue", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pvMsgData", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7ce846f42a6694bcba13fd55c35f51bf71911785
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/usb_dev_msc/usb_dev_msc.c
[ "BSD-3-Clause" ]
C
TxHandler
null
unsigned long TxHandler(void *pvCBData, unsigned long ulEvent, unsigned long ulMsgValue, void *pvMsgData) { return(0); }
//***************************************************************************** // // Handles bulk driver notifications related to the transmit channel (data to // the USB host). // // \param pvCBData is the client-supplied callback pointer for this channel. // \param ulEvent identifies the event we are being notified about. // \param ulMsgValue is an event-specific value. // \param pvMsgData is an event-specific pointer. // // This function is called by the bulk driver to notify us of any events // related to operation of the transmit data channel (the IN channel carrying // data to the USB host). // // \return The return value is event-specific. // //*****************************************************************************
Handles bulk driver notifications related to the transmit channel (data to the USB host). \param pvCBData is the client-supplied callback pointer for this channel. \param ulEvent identifies the event we are being notified about. \param ulMsgValue is an event-specific value. \param pvMsgData is an event-specific pointer. This function is called by the bulk driver to notify us of any events related to operation of the transmit data channel (the IN channel carrying data to the USB host). \return The return value is event-specific.
[ "Handles", "bulk", "driver", "notifications", "related", "to", "the", "transmit", "channel", "(", "data", "to", "the", "USB", "host", ")", ".", "\\", "param", "pvCBData", "is", "the", "client", "-", "supplied", "callback", "pointer", "for", "this", "channel", ".", "\\", "param", "ulEvent", "identifies", "the", "event", "we", "are", "being", "notified", "about", ".", "\\", "param", "ulMsgValue", "is", "an", "event", "-", "specific", "value", ".", "\\", "param", "pvMsgData", "is", "an", "event", "-", "specific", "pointer", ".", "This", "function", "is", "called", "by", "the", "bulk", "driver", "to", "notify", "us", "of", "any", "events", "related", "to", "operation", "of", "the", "transmit", "data", "channel", "(", "the", "IN", "channel", "carrying", "data", "to", "the", "USB", "host", ")", ".", "\\", "return", "The", "return", "value", "is", "event", "-", "specific", "." ]
unsigned long TxHandler(void *pvCBData, unsigned long ulEvent, unsigned long ulMsgValue, void *pvMsgData) { return(0); }
[ "unsigned", "long", "TxHandler", "(", "void", "*", "pvCBData", ",", "unsigned", "long", "ulEvent", ",", "unsigned", "long", "ulMsgValue", ",", "void", "*", "pvMsgData", ")", "{", "return", "(", "0", ")", ";", "}" ]
Handles bulk driver notifications related to the transmit channel (data to the USB host).
[ "Handles", "bulk", "driver", "notifications", "related", "to", "the", "transmit", "channel", "(", "data", "to", "the", "USB", "host", ")", "." ]
[]
[ { "param": "pvCBData", "type": "void" }, { "param": "ulEvent", "type": "unsigned long" }, { "param": "ulMsgValue", "type": "unsigned long" }, { "param": "pvMsgData", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pvCBData", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulEvent", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulMsgValue", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pvMsgData", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7ce846f42a6694bcba13fd55c35f51bf71911785
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/usb_dev_msc/usb_dev_msc.c
[ "BSD-3-Clause" ]
C
UpdateStatus
void
void UpdateStatus(char *pcString, tBoolean bClrBackground) { tRectangle sRect; // // Fill the bottom rows of the screen with blue to create the status area. // sRect.sXMin = 0; sRect.sYMin = GrContextDpyHeightGet(&g_sContext) - DISPLAY_BANNER_HEIGHT - 1; sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1; sRect.sYMax = sRect.sYMin + DISPLAY_BANNER_HEIGHT; // // // GrContextBackgroundSet(&g_sContext, DISPLAY_BANNER_BG); if(bClrBackground) { // // Draw the background of the banner. // GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG); GrRectFill(&g_sContext, &sRect); // // Put a white box around the banner. // GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_FG); GrRectDraw(&g_sContext, &sRect); } // // Write the current state to the left of the status area. // GrContextFontSet(&g_sContext, g_pFontFixed6x8); // // Update the status on the screen. // if(pcString != 0) { GrStringDraw(&g_sContext, pcString, -1, 4, sRect.sYMin + 4, 1); } }
//***************************************************************************** // // This function updates the status area of the screen. It uses the current // state of the application to print the status bar. // //*****************************************************************************
This function updates the status area of the screen. It uses the current state of the application to print the status bar.
[ "This", "function", "updates", "the", "status", "area", "of", "the", "screen", ".", "It", "uses", "the", "current", "state", "of", "the", "application", "to", "print", "the", "status", "bar", "." ]
void UpdateStatus(char *pcString, tBoolean bClrBackground) { tRectangle sRect; sRect.sXMin = 0; sRect.sYMin = GrContextDpyHeightGet(&g_sContext) - DISPLAY_BANNER_HEIGHT - 1; sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1; sRect.sYMax = sRect.sYMin + DISPLAY_BANNER_HEIGHT; GrContextBackgroundSet(&g_sContext, DISPLAY_BANNER_BG); if(bClrBackground) { GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG); GrRectFill(&g_sContext, &sRect); GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_FG); GrRectDraw(&g_sContext, &sRect); } GrContextFontSet(&g_sContext, g_pFontFixed6x8); if(pcString != 0) { GrStringDraw(&g_sContext, pcString, -1, 4, sRect.sYMin + 4, 1); } }
[ "void", "UpdateStatus", "(", "char", "*", "pcString", ",", "tBoolean", "bClrBackground", ")", "{", "tRectangle", "sRect", ";", "sRect", ".", "sXMin", "=", "0", ";", "sRect", ".", "sYMin", "=", "GrContextDpyHeightGet", "(", "&", "g_sContext", ")", "-", "DISPLAY_BANNER_HEIGHT", "-", "1", ";", "sRect", ".", "sXMax", "=", "GrContextDpyWidthGet", "(", "&", "g_sContext", ")", "-", "1", ";", "sRect", ".", "sYMax", "=", "sRect", ".", "sYMin", "+", "DISPLAY_BANNER_HEIGHT", ";", "GrContextBackgroundSet", "(", "&", "g_sContext", ",", "DISPLAY_BANNER_BG", ")", ";", "if", "(", "bClrBackground", ")", "{", "GrContextForegroundSet", "(", "&", "g_sContext", ",", "DISPLAY_BANNER_BG", ")", ";", "GrRectFill", "(", "&", "g_sContext", ",", "&", "sRect", ")", ";", "GrContextForegroundSet", "(", "&", "g_sContext", ",", "DISPLAY_BANNER_FG", ")", ";", "GrRectDraw", "(", "&", "g_sContext", ",", "&", "sRect", ")", ";", "}", "GrContextFontSet", "(", "&", "g_sContext", ",", "g_pFontFixed6x8", ")", ";", "if", "(", "pcString", "!=", "0", ")", "{", "GrStringDraw", "(", "&", "g_sContext", ",", "pcString", ",", "-1", ",", "4", ",", "sRect", ".", "sYMin", "+", "4", ",", "1", ")", ";", "}", "}" ]
This function updates the status area of the screen.
[ "This", "function", "updates", "the", "status", "area", "of", "the", "screen", "." ]
[ "//\r", "// Fill the bottom rows of the screen with blue to create the status area.\r", "//\r", "//\r", "//\r", "//\r", "//\r", "// Draw the background of the banner.\r", "//\r", "//\r", "// Put a white box around the banner.\r", "//\r", "//\r", "// Write the current state to the left of the status area.\r", "//\r", "//\r", "// Update the status on the screen.\r", "//\r" ]
[ { "param": "pcString", "type": "char" }, { "param": "bClrBackground", "type": "tBoolean" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pcString", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bClrBackground", "type": "tBoolean", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7ce846f42a6694bcba13fd55c35f51bf71911785
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/usb_dev_msc/usb_dev_msc.c
[ "BSD-3-Clause" ]
C
USBDMSCEventCallback
null
unsigned long USBDMSCEventCallback(void *pvCBData, unsigned long ulEvent, unsigned long ulMsgParam, void *pvMsgData) { // // Reset the time out every time an event occurs. // g_ulIdleTimeout = USBMSC_ACTIVITY_TIMEOUT; switch(ulEvent) { // // Writing to the device. // case USBD_MSC_EVENT_WRITING: { // // Only update if this is a change. // if(g_eMSCState != MSC_DEV_WRITE) { // // Go to the write state. // g_eMSCState = MSC_DEV_WRITE; // // Cause the main loop to update the screen. // g_ulFlags |= FLAG_UPDATE_STATUS; } break; } // // Reading from the device. // case USBD_MSC_EVENT_READING: { // // Only update if this is a change. // if(g_eMSCState != MSC_DEV_READ) { // // Go to the read state. // g_eMSCState = MSC_DEV_READ; // // Cause the main loop to update the screen. // g_ulFlags |= FLAG_UPDATE_STATUS; } break; } case USBD_MSC_EVENT_IDLE: default: { break; } } return(0); }
//***************************************************************************** // // This function is the call back notification function provided to the USB // library's mass storage class. // //*****************************************************************************
This function is the call back notification function provided to the USB library's mass storage class.
[ "This", "function", "is", "the", "call", "back", "notification", "function", "provided", "to", "the", "USB", "library", "'", "s", "mass", "storage", "class", "." ]
unsigned long USBDMSCEventCallback(void *pvCBData, unsigned long ulEvent, unsigned long ulMsgParam, void *pvMsgData) { g_ulIdleTimeout = USBMSC_ACTIVITY_TIMEOUT; switch(ulEvent) { case USBD_MSC_EVENT_WRITING: { if(g_eMSCState != MSC_DEV_WRITE) { g_eMSCState = MSC_DEV_WRITE; g_ulFlags |= FLAG_UPDATE_STATUS; } break; } case USBD_MSC_EVENT_READING: { if(g_eMSCState != MSC_DEV_READ) { g_eMSCState = MSC_DEV_READ; g_ulFlags |= FLAG_UPDATE_STATUS; } break; } case USBD_MSC_EVENT_IDLE: default: { break; } } return(0); }
[ "unsigned", "long", "USBDMSCEventCallback", "(", "void", "*", "pvCBData", ",", "unsigned", "long", "ulEvent", ",", "unsigned", "long", "ulMsgParam", ",", "void", "*", "pvMsgData", ")", "{", "g_ulIdleTimeout", "=", "USBMSC_ACTIVITY_TIMEOUT", ";", "switch", "(", "ulEvent", ")", "{", "case", "USBD_MSC_EVENT_WRITING", ":", "{", "if", "(", "g_eMSCState", "!=", "MSC_DEV_WRITE", ")", "{", "g_eMSCState", "=", "MSC_DEV_WRITE", ";", "g_ulFlags", "|=", "FLAG_UPDATE_STATUS", ";", "}", "break", ";", "}", "case", "USBD_MSC_EVENT_READING", ":", "{", "if", "(", "g_eMSCState", "!=", "MSC_DEV_READ", ")", "{", "g_eMSCState", "=", "MSC_DEV_READ", ";", "g_ulFlags", "|=", "FLAG_UPDATE_STATUS", ";", "}", "break", ";", "}", "case", "USBD_MSC_EVENT_IDLE", ":", "default", ":", "{", "break", ";", "}", "}", "return", "(", "0", ")", ";", "}" ]
This function is the call back notification function provided to the USB library's mass storage class.
[ "This", "function", "is", "the", "call", "back", "notification", "function", "provided", "to", "the", "USB", "library", "'", "s", "mass", "storage", "class", "." ]
[ "//\r", "// Reset the time out every time an event occurs.\r", "//\r", "//\r", "// Writing to the device.\r", "//\r", "//\r", "// Only update if this is a change.\r", "//\r", "//\r", "// Go to the write state.\r", "//\r", "//\r", "// Cause the main loop to update the screen.\r", "//\r", "//\r", "// Reading from the device.\r", "//\r", "//\r", "// Only update if this is a change.\r", "//\r", "//\r", "// Go to the read state.\r", "//\r", "//\r", "// Cause the main loop to update the screen.\r", "//\r" ]
[ { "param": "pvCBData", "type": "void" }, { "param": "ulEvent", "type": "unsigned long" }, { "param": "ulMsgParam", "type": "unsigned long" }, { "param": "pvMsgData", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pvCBData", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulEvent", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulMsgParam", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pvMsgData", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7ce846f42a6694bcba13fd55c35f51bf71911785
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s3748/usb_dev_msc/usb_dev_msc.c
[ "BSD-3-Clause" ]
C
SysTickHandler
void
void SysTickHandler(void) { // // Call the FatFs tick timer. // disk_timerproc(); if(g_ulIdleTimeout != 0) { g_ulIdleTimeout--; } }
//***************************************************************************** // // This is the handler for this SysTick interrupt. FatFs requires a timer tick // every 10 ms for internal timing purposes. // //*****************************************************************************
This is the handler for this SysTick interrupt. FatFs requires a timer tick every 10 ms for internal timing purposes.
[ "This", "is", "the", "handler", "for", "this", "SysTick", "interrupt", ".", "FatFs", "requires", "a", "timer", "tick", "every", "10", "ms", "for", "internal", "timing", "purposes", "." ]
void SysTickHandler(void) { disk_timerproc(); if(g_ulIdleTimeout != 0) { g_ulIdleTimeout--; } }
[ "void", "SysTickHandler", "(", "void", ")", "{", "disk_timerproc", "(", ")", ";", "if", "(", "g_ulIdleTimeout", "!=", "0", ")", "{", "g_ulIdleTimeout", "--", ";", "}", "}" ]
This is the handler for this SysTick interrupt.
[ "This", "is", "the", "handler", "for", "this", "SysTick", "interrupt", "." ]
[ "//\r", "// Call the FatFs tick timer.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
1002562c8e7b7e5deeb78ad58aca899f137116a1
junyanl-code/Luminary-Micro-Library
boards/rdk-bdc/bdc-ui/buttons.c
[ "BSD-3-Clause" ]
C
ButtonsInit
void
void ButtonsInit(void) { // // Enable the peripherals used by the buttons. // SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); // // Configure the GPIOs used to read the state of the on-board push buttons. // GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7); GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); GPIOPinTypeGPIOInput(GPIO_PORTG_BASE, GPIO_PIN_4); GPIOPadConfigSet(GPIO_PORTG_BASE, GPIO_PIN_4, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); }
//***************************************************************************** // // Initializes the push button driver. // //*****************************************************************************
Initializes the push button driver.
[ "Initializes", "the", "push", "button", "driver", "." ]
void ButtonsInit(void) { SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7); GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); GPIOPinTypeGPIOInput(GPIO_PORTG_BASE, GPIO_PIN_4); GPIOPadConfigSet(GPIO_PORTG_BASE, GPIO_PIN_4, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); }
[ "void", "ButtonsInit", "(", "void", ")", "{", "SysCtlPeripheralEnable", "(", "SYSCTL_PERIPH_GPIOF", ")", ";", "SysCtlPeripheralEnable", "(", "SYSCTL_PERIPH_GPIOG", ")", ";", "GPIOPinTypeGPIOInput", "(", "GPIO_PORTF_BASE", ",", "GPIO_PIN_4", "|", "GPIO_PIN_5", "|", "GPIO_PIN_6", "|", "GPIO_PIN_7", ")", ";", "GPIOPadConfigSet", "(", "GPIO_PORTF_BASE", ",", "GPIO_PIN_4", "|", "GPIO_PIN_5", "|", "GPIO_PIN_6", "|", "GPIO_PIN_7", ",", "GPIO_STRENGTH_2MA", ",", "GPIO_PIN_TYPE_STD_WPU", ")", ";", "GPIOPinTypeGPIOInput", "(", "GPIO_PORTG_BASE", ",", "GPIO_PIN_4", ")", ";", "GPIOPadConfigSet", "(", "GPIO_PORTG_BASE", ",", "GPIO_PIN_4", ",", "GPIO_STRENGTH_2MA", ",", "GPIO_PIN_TYPE_STD_WPU", ")", ";", "}" ]
Initializes the push button driver.
[ "Initializes", "the", "push", "button", "driver", "." ]
[ "//\r", "// Enable the peripherals used by the buttons.\r", "//\r", "//\r", "// Configure the GPIOs used to read the state of the on-board push buttons.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
1002562c8e7b7e5deeb78ad58aca899f137116a1
junyanl-code/Luminary-Micro-Library
boards/rdk-bdc/bdc-ui/buttons.c
[ "BSD-3-Clause" ]
C
ButtonsTick
null
unsigned long ButtonsTick(void) { unsigned long ulData, ulDelta; unsigned long ulReturn; // // Read the state of the push buttons. // ulData = ((GPIOPinRead(GPIO_PORTF_BASE, (GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7)) >> 4) | GPIOPinRead(GPIO_PORTG_BASE, GPIO_PIN_4)); // // Determine the switches that are at a different state than the debounced // state. // ulDelta = ulData ^ g_ucSwitches; // // Increment the clocks by one. // g_ucClockA ^= (g_ucClockB & g_ucClockC); g_ucClockB ^= g_ucClockC; g_ucClockC = ~g_ucClockC; // // Reset the clocks corresponding to switches that have not changed state. // g_ucClockA &= ulDelta; g_ucClockB &= ulDelta; g_ucClockC &= ulDelta; // // Get the new debounced switch state. // g_ucSwitches &= g_ucClockA | g_ucClockB | g_ucClockC; g_ucSwitches |= (~(g_ucClockA | g_ucClockB | g_ucClockC)) & ulData; // // Determine the switches that just changed debounced state. // ulDelta ^= (g_ucClockA | g_ucClockB | g_ucClockC); // // Loop through all of the buttons. // ulReturn = 0; for(ulData = 0; ulData < NUM_BUTTONS; ulData++) { // // Ignore this button if it is not pressed. // if(g_ucSwitches & (1 << ulData)) { continue; } // // Return a button press for this button if it was just pressed. // if(ulDelta & (1 << ulData)) { ulReturn |= 1 << ulData; } // // See if this button has auto-repeat enabled. // if(g_psButtons[ulData].usDelay != 0) { // // Reset the auto-repeat counters if this button was just pressed. // if(ulDelta & (1 << ulData)) { g_psButtons[ulData].ucRepeatCount = 0; g_psButtons[ulData].usCount = g_psButtons[ulData].usDelay; } // // Decrement the auto-repeat count and see if it has reached zero. // if(--g_psButtons[ulData].usCount == 0) { // // Return a button press for this button. // ulReturn |= 1 << ulData; // // Increment the count of auto-repeats if it has not yet // reached 255. // if(g_psButtons[ulData].ucRepeatCount < 255) { g_psButtons[ulData].ucRepeatCount++; } // // Reset the delay count. // g_psButtons[ulData].usCount = g_psButtons[ulData].usRepeatDelay; // // See if the button has been held long enough for an // accelerator. // if(g_psButtons[ulData].ucRepeatCount <= g_psButtons[ulData].ucRepeatCount1) { } else if(g_psButtons[ulData].ucRepeatCount <= g_psButtons[ulData].ucRepeatCount2) { ulReturn |= 0x100 << ulData; } else if(g_psButtons[ulData].ucRepeatCount <= g_psButtons[ulData].ucRepeatCount3) { ulReturn |= 0x10000 << ulData; } else { ulReturn |= 0x1000000 << ulData; } } } } // // Return the set of buttons that were just pressed (or had phantom presses // as a result of auto-repeat). // return(ulReturn); }
//***************************************************************************** // // The button polling routine that must be called on a periodic basis. // //*****************************************************************************
The button polling routine that must be called on a periodic basis.
[ "The", "button", "polling", "routine", "that", "must", "be", "called", "on", "a", "periodic", "basis", "." ]
unsigned long ButtonsTick(void) { unsigned long ulData, ulDelta; unsigned long ulReturn; ulData = ((GPIOPinRead(GPIO_PORTF_BASE, (GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7)) >> 4) | GPIOPinRead(GPIO_PORTG_BASE, GPIO_PIN_4)); ulDelta = ulData ^ g_ucSwitches; g_ucClockA ^= (g_ucClockB & g_ucClockC); g_ucClockB ^= g_ucClockC; g_ucClockC = ~g_ucClockC; g_ucClockA &= ulDelta; g_ucClockB &= ulDelta; g_ucClockC &= ulDelta; g_ucSwitches &= g_ucClockA | g_ucClockB | g_ucClockC; g_ucSwitches |= (~(g_ucClockA | g_ucClockB | g_ucClockC)) & ulData; ulDelta ^= (g_ucClockA | g_ucClockB | g_ucClockC); ulReturn = 0; for(ulData = 0; ulData < NUM_BUTTONS; ulData++) { if(g_ucSwitches & (1 << ulData)) { continue; } if(ulDelta & (1 << ulData)) { ulReturn |= 1 << ulData; } if(g_psButtons[ulData].usDelay != 0) { if(ulDelta & (1 << ulData)) { g_psButtons[ulData].ucRepeatCount = 0; g_psButtons[ulData].usCount = g_psButtons[ulData].usDelay; } if(--g_psButtons[ulData].usCount == 0) { ulReturn |= 1 << ulData; if(g_psButtons[ulData].ucRepeatCount < 255) { g_psButtons[ulData].ucRepeatCount++; } g_psButtons[ulData].usCount = g_psButtons[ulData].usRepeatDelay; if(g_psButtons[ulData].ucRepeatCount <= g_psButtons[ulData].ucRepeatCount1) { } else if(g_psButtons[ulData].ucRepeatCount <= g_psButtons[ulData].ucRepeatCount2) { ulReturn |= 0x100 << ulData; } else if(g_psButtons[ulData].ucRepeatCount <= g_psButtons[ulData].ucRepeatCount3) { ulReturn |= 0x10000 << ulData; } else { ulReturn |= 0x1000000 << ulData; } } } } return(ulReturn); }
[ "unsigned", "long", "ButtonsTick", "(", "void", ")", "{", "unsigned", "long", "ulData", ",", "ulDelta", ";", "unsigned", "long", "ulReturn", ";", "ulData", "=", "(", "(", "GPIOPinRead", "(", "GPIO_PORTF_BASE", ",", "(", "GPIO_PIN_4", "|", "GPIO_PIN_5", "|", "GPIO_PIN_6", "|", "GPIO_PIN_7", ")", ")", ">>", "4", ")", "|", "GPIOPinRead", "(", "GPIO_PORTG_BASE", ",", "GPIO_PIN_4", ")", ")", ";", "ulDelta", "=", "ulData", "^", "g_ucSwitches", ";", "g_ucClockA", "^=", "(", "g_ucClockB", "&", "g_ucClockC", ")", ";", "g_ucClockB", "^=", "g_ucClockC", ";", "g_ucClockC", "=", "~", "g_ucClockC", ";", "g_ucClockA", "&=", "ulDelta", ";", "g_ucClockB", "&=", "ulDelta", ";", "g_ucClockC", "&=", "ulDelta", ";", "g_ucSwitches", "&=", "g_ucClockA", "|", "g_ucClockB", "|", "g_ucClockC", ";", "g_ucSwitches", "|=", "(", "~", "(", "g_ucClockA", "|", "g_ucClockB", "|", "g_ucClockC", ")", ")", "&", "ulData", ";", "ulDelta", "^=", "(", "g_ucClockA", "|", "g_ucClockB", "|", "g_ucClockC", ")", ";", "ulReturn", "=", "0", ";", "for", "(", "ulData", "=", "0", ";", "ulData", "<", "NUM_BUTTONS", ";", "ulData", "++", ")", "{", "if", "(", "g_ucSwitches", "&", "(", "1", "<<", "ulData", ")", ")", "{", "continue", ";", "}", "if", "(", "ulDelta", "&", "(", "1", "<<", "ulData", ")", ")", "{", "ulReturn", "|=", "1", "<<", "ulData", ";", "}", "if", "(", "g_psButtons", "[", "ulData", "]", ".", "usDelay", "!=", "0", ")", "{", "if", "(", "ulDelta", "&", "(", "1", "<<", "ulData", ")", ")", "{", "g_psButtons", "[", "ulData", "]", ".", "ucRepeatCount", "=", "0", ";", "g_psButtons", "[", "ulData", "]", ".", "usCount", "=", "g_psButtons", "[", "ulData", "]", ".", "usDelay", ";", "}", "if", "(", "--", "g_psButtons", "[", "ulData", "]", ".", "usCount", "==", "0", ")", "{", "ulReturn", "|=", "1", "<<", "ulData", ";", "if", "(", "g_psButtons", "[", "ulData", "]", ".", "ucRepeatCount", "<", "255", ")", "{", "g_psButtons", "[", "ulData", "]", ".", "ucRepeatCount", "++", ";", "}", "g_psButtons", "[", "ulData", "]", ".", "usCount", "=", "g_psButtons", "[", "ulData", "]", ".", "usRepeatDelay", ";", "if", "(", "g_psButtons", "[", "ulData", "]", ".", "ucRepeatCount", "<=", "g_psButtons", "[", "ulData", "]", ".", "ucRepeatCount1", ")", "{", "}", "else", "if", "(", "g_psButtons", "[", "ulData", "]", ".", "ucRepeatCount", "<=", "g_psButtons", "[", "ulData", "]", ".", "ucRepeatCount2", ")", "{", "ulReturn", "|=", "0x100", "<<", "ulData", ";", "}", "else", "if", "(", "g_psButtons", "[", "ulData", "]", ".", "ucRepeatCount", "<=", "g_psButtons", "[", "ulData", "]", ".", "ucRepeatCount3", ")", "{", "ulReturn", "|=", "0x10000", "<<", "ulData", ";", "}", "else", "{", "ulReturn", "|=", "0x1000000", "<<", "ulData", ";", "}", "}", "}", "}", "return", "(", "ulReturn", ")", ";", "}" ]
The button polling routine that must be called on a periodic basis.
[ "The", "button", "polling", "routine", "that", "must", "be", "called", "on", "a", "periodic", "basis", "." ]
[ "//\r", "// Read the state of the push buttons.\r", "//\r", "//\r", "// Determine the switches that are at a different state than the debounced\r", "// state.\r", "//\r", "//\r", "// Increment the clocks by one.\r", "//\r", "//\r", "// Reset the clocks corresponding to switches that have not changed state.\r", "//\r", "//\r", "// Get the new debounced switch state.\r", "//\r", "//\r", "// Determine the switches that just changed debounced state.\r", "//\r", "//\r", "// Loop through all of the buttons.\r", "//\r", "//\r", "// Ignore this button if it is not pressed.\r", "//\r", "//\r", "// Return a button press for this button if it was just pressed.\r", "//\r", "//\r", "// See if this button has auto-repeat enabled.\r", "//\r", "//\r", "// Reset the auto-repeat counters if this button was just pressed.\r", "//\r", "//\r", "// Decrement the auto-repeat count and see if it has reached zero.\r", "//\r", "//\r", "// Return a button press for this button.\r", "//\r", "//\r", "// Increment the count of auto-repeats if it has not yet\r", "// reached 255.\r", "//\r", "//\r", "// Reset the delay count.\r", "//\r", "//\r", "// See if the button has been held long enough for an\r", "// accelerator.\r", "//\r", "//\r", "// Return the set of buttons that were just pressed (or had phantom presses\r", "// as a result of auto-repeat).\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
b7012db22b39923ca3094316cfff97de9876d1c8
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9b96/qs-checkout/qs-checkout.c
[ "BSD-3-Clause" ]
C
ThumbwheelCallback
void
void ThumbwheelCallback(unsigned short usMilliVolts) { // // Update our thumbwheel voltage record. // g_usThumbwheelmV = usMilliVolts; // // Tell the main loop to update the display. // g_ulCommandFlags |= COMMAND_THUMB_UPDATE; // // Reset the counter we use to time the thumbwheel updates. // g_ulThumbUpdateTicks = THUMB_UPDATE_TICKS; }
//***************************************************************************** // // This function is called by the thumbwheel driver whenever a new sample has // been captured. It records the new voltage and tells the main loop to update // the display before resetting the counter that will time the next update. // //*****************************************************************************
This function is called by the thumbwheel driver whenever a new sample has been captured. It records the new voltage and tells the main loop to update the display before resetting the counter that will time the next update.
[ "This", "function", "is", "called", "by", "the", "thumbwheel", "driver", "whenever", "a", "new", "sample", "has", "been", "captured", ".", "It", "records", "the", "new", "voltage", "and", "tells", "the", "main", "loop", "to", "update", "the", "display", "before", "resetting", "the", "counter", "that", "will", "time", "the", "next", "update", "." ]
void ThumbwheelCallback(unsigned short usMilliVolts) { g_usThumbwheelmV = usMilliVolts; g_ulCommandFlags |= COMMAND_THUMB_UPDATE; g_ulThumbUpdateTicks = THUMB_UPDATE_TICKS; }
[ "void", "ThumbwheelCallback", "(", "unsigned", "short", "usMilliVolts", ")", "{", "g_usThumbwheelmV", "=", "usMilliVolts", ";", "g_ulCommandFlags", "|=", "COMMAND_THUMB_UPDATE", ";", "g_ulThumbUpdateTicks", "=", "THUMB_UPDATE_TICKS", ";", "}" ]
This function is called by the thumbwheel driver whenever a new sample has been captured.
[ "This", "function", "is", "called", "by", "the", "thumbwheel", "driver", "whenever", "a", "new", "sample", "has", "been", "captured", "." ]
[ "//\r", "// Update our thumbwheel voltage record.\r", "//\r", "//\r", "// Tell the main loop to update the display.\r", "//\r", "//\r", "// Reset the counter we use to time the thumbwheel updates.\r", "//\r" ]
[ { "param": "usMilliVolts", "type": "unsigned short" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "usMilliVolts", "type": "unsigned short", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b7012db22b39923ca3094316cfff97de9876d1c8
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9b96/qs-checkout/qs-checkout.c
[ "BSD-3-Clause" ]
C
OnCheckLED
void
void OnCheckLED(tWidget *pWidget, unsigned long bSelected) { // // Set the state of the user LED on the board to follow the checkbox // selection. // GPIOPinWrite(LED_PORT_BASE, LED_PIN, bSelected ? LED_PIN : 0); // // Play the key click sound. // SoundPlay(g_pusKeyClick, g_ulKeyClickLen); }
//***************************************************************************** // // The LED checkbox widget callback function. // // This function is called whenever someone clicks the "LED" checkbox. // //*****************************************************************************
The LED checkbox widget callback function. This function is called whenever someone clicks the "LED" checkbox.
[ "The", "LED", "checkbox", "widget", "callback", "function", ".", "This", "function", "is", "called", "whenever", "someone", "clicks", "the", "\"", "LED", "\"", "checkbox", "." ]
void OnCheckLED(tWidget *pWidget, unsigned long bSelected) { GPIOPinWrite(LED_PORT_BASE, LED_PIN, bSelected ? LED_PIN : 0); SoundPlay(g_pusKeyClick, g_ulKeyClickLen); }
[ "void", "OnCheckLED", "(", "tWidget", "*", "pWidget", ",", "unsigned", "long", "bSelected", ")", "{", "GPIOPinWrite", "(", "LED_PORT_BASE", ",", "LED_PIN", ",", "bSelected", "?", "LED_PIN", ":", "0", ")", ";", "SoundPlay", "(", "g_pusKeyClick", ",", "g_ulKeyClickLen", ")", ";", "}" ]
The LED checkbox widget callback function.
[ "The", "LED", "checkbox", "widget", "callback", "function", "." ]
[ "//\r", "// Set the state of the user LED on the board to follow the checkbox\r", "// selection.\r", "//\r", "//\r", "// Play the key click sound.\r", "//\r" ]
[ { "param": "pWidget", "type": "tWidget" }, { "param": "bSelected", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pWidget", "type": "tWidget", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bSelected", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b7012db22b39923ca3094316cfff97de9876d1c8
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9b96/qs-checkout/qs-checkout.c
[ "BSD-3-Clause" ]
C
ProcessCommandThumbUpdate
void
void ProcessCommandThumbUpdate(void) { static unsigned short usLastVoltage = 0xFFFF; // // Has the voltage changed since the last call? // if(usLastVoltage != g_usThumbwheelmV) { // // Remember the new voltage. // usLastVoltage = g_usThumbwheelmV; // // Set the slider position appropriately. // SliderValueSet(&g_sThumbwheelSlider, usLastVoltage); // // Format the voltage as a string and display in the appropriate // widget. // usnprintf(g_pucThumbwheelString, SIZE_THUMBWHEEL_BUFFER, "%01d.%02dV ", (usLastVoltage / 1000), ((usLastVoltage / 10) % 100)); // // Make sure the thumbwheel widgets get repainted if visible // if(g_ulCurrentScreen == IO_SCREEN) { WidgetPaint((tWidget *)&g_sPotPos); WidgetPaint((tWidget *)&g_sThumbwheelSlider); } } }
//***************************************************************************** // // This function is called from the main loop to update the displayed // information relating to the thumbwheel potentiometer. The display is only // updated if the thumbwheel potentiometer voltage has changed since the last // time the function was called. // //*****************************************************************************
This function is called from the main loop to update the displayed information relating to the thumbwheel potentiometer. The display is only updated if the thumbwheel potentiometer voltage has changed since the last time the function was called.
[ "This", "function", "is", "called", "from", "the", "main", "loop", "to", "update", "the", "displayed", "information", "relating", "to", "the", "thumbwheel", "potentiometer", ".", "The", "display", "is", "only", "updated", "if", "the", "thumbwheel", "potentiometer", "voltage", "has", "changed", "since", "the", "last", "time", "the", "function", "was", "called", "." ]
void ProcessCommandThumbUpdate(void) { static unsigned short usLastVoltage = 0xFFFF; if(usLastVoltage != g_usThumbwheelmV) { usLastVoltage = g_usThumbwheelmV; SliderValueSet(&g_sThumbwheelSlider, usLastVoltage); usnprintf(g_pucThumbwheelString, SIZE_THUMBWHEEL_BUFFER, "%01d.%02dV ", (usLastVoltage / 1000), ((usLastVoltage / 10) % 100)); if(g_ulCurrentScreen == IO_SCREEN) { WidgetPaint((tWidget *)&g_sPotPos); WidgetPaint((tWidget *)&g_sThumbwheelSlider); } } }
[ "void", "ProcessCommandThumbUpdate", "(", "void", ")", "{", "static", "unsigned", "short", "usLastVoltage", "=", "0xFFFF", ";", "if", "(", "usLastVoltage", "!=", "g_usThumbwheelmV", ")", "{", "usLastVoltage", "=", "g_usThumbwheelmV", ";", "SliderValueSet", "(", "&", "g_sThumbwheelSlider", ",", "usLastVoltage", ")", ";", "usnprintf", "(", "g_pucThumbwheelString", ",", "SIZE_THUMBWHEEL_BUFFER", ",", "\"", "\"", ",", "(", "usLastVoltage", "/", "1000", ")", ",", "(", "(", "usLastVoltage", "/", "10", ")", "%", "100", ")", ")", ";", "if", "(", "g_ulCurrentScreen", "==", "IO_SCREEN", ")", "{", "WidgetPaint", "(", "(", "tWidget", "*", ")", "&", "g_sPotPos", ")", ";", "WidgetPaint", "(", "(", "tWidget", "*", ")", "&", "g_sThumbwheelSlider", ")", ";", "}", "}", "}" ]
This function is called from the main loop to update the displayed information relating to the thumbwheel potentiometer.
[ "This", "function", "is", "called", "from", "the", "main", "loop", "to", "update", "the", "displayed", "information", "relating", "to", "the", "thumbwheel", "potentiometer", "." ]
[ "//\r", "// Has the voltage changed since the last call?\r", "//\r", "//\r", "// Remember the new voltage.\r", "//\r", "//\r", "// Set the slider position appropriately.\r", "//\r", "//\r", "// Format the voltage as a string and display in the appropriate\r", "// widget.\r", "//\r", "//\r", "// Make sure the thumbwheel widgets get repainted if visible\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
b7012db22b39923ca3094316cfff97de9876d1c8
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9b96/qs-checkout/qs-checkout.c
[ "BSD-3-Clause" ]
C
ProcessCommandTouchUpdate
void
void ProcessCommandTouchUpdate(void) { static tBoolean bLastPressed = true; // // Is the screen being pressed? // if(g_bPtrPressed) { long lX, lY; // // Copy the volatiles to keep the compiler from generating a // warning. // lX = g_lPtrX; lY = g_lPtrY; // // Format the string containing the current screen touch // coordinates. // usnprintf(g_pcTouchCoordinates, SIZE_TOUCH_COORD_BUFFER, "(%3d,%3d)", lX, lY); bLastPressed = true; // // Make sure the string gets repainted if visible // if(g_ulCurrentScreen == IO_SCREEN) { WidgetPaint((tWidget *)&g_sTouchPos); } } else { // // The screen is not being pressed so remove the coordinate // information from the display if we have not done so already. // if(bLastPressed) { // // The screen is no longer being pressed. // usnprintf(g_pcTouchCoordinates, SIZE_TOUCH_COORD_BUFFER, "None "); bLastPressed = false; // // Make sure the screen gets repainted. // if(g_ulCurrentScreen == IO_SCREEN) { WidgetPaint((tWidget *)&g_sTouchPos); } } } }
//***************************************************************************** // // This function is called from the main loop to update the displayed // information relating to the touchscreen. The display is only updated if // something significant happened since last time the function was called. // //*****************************************************************************
This function is called from the main loop to update the displayed information relating to the touchscreen. The display is only updated if something significant happened since last time the function was called.
[ "This", "function", "is", "called", "from", "the", "main", "loop", "to", "update", "the", "displayed", "information", "relating", "to", "the", "touchscreen", ".", "The", "display", "is", "only", "updated", "if", "something", "significant", "happened", "since", "last", "time", "the", "function", "was", "called", "." ]
void ProcessCommandTouchUpdate(void) { static tBoolean bLastPressed = true; if(g_bPtrPressed) { long lX, lY; lX = g_lPtrX; lY = g_lPtrY; usnprintf(g_pcTouchCoordinates, SIZE_TOUCH_COORD_BUFFER, "(%3d,%3d)", lX, lY); bLastPressed = true; if(g_ulCurrentScreen == IO_SCREEN) { WidgetPaint((tWidget *)&g_sTouchPos); } } else { if(bLastPressed) { usnprintf(g_pcTouchCoordinates, SIZE_TOUCH_COORD_BUFFER, "None "); bLastPressed = false; if(g_ulCurrentScreen == IO_SCREEN) { WidgetPaint((tWidget *)&g_sTouchPos); } } } }
[ "void", "ProcessCommandTouchUpdate", "(", "void", ")", "{", "static", "tBoolean", "bLastPressed", "=", "true", ";", "if", "(", "g_bPtrPressed", ")", "{", "long", "lX", ",", "lY", ";", "lX", "=", "g_lPtrX", ";", "lY", "=", "g_lPtrY", ";", "usnprintf", "(", "g_pcTouchCoordinates", ",", "SIZE_TOUCH_COORD_BUFFER", ",", "\"", "\"", ",", "lX", ",", "lY", ")", ";", "bLastPressed", "=", "true", ";", "if", "(", "g_ulCurrentScreen", "==", "IO_SCREEN", ")", "{", "WidgetPaint", "(", "(", "tWidget", "*", ")", "&", "g_sTouchPos", ")", ";", "}", "}", "else", "{", "if", "(", "bLastPressed", ")", "{", "usnprintf", "(", "g_pcTouchCoordinates", ",", "SIZE_TOUCH_COORD_BUFFER", ",", "\"", "\"", ")", ";", "bLastPressed", "=", "false", ";", "if", "(", "g_ulCurrentScreen", "==", "IO_SCREEN", ")", "{", "WidgetPaint", "(", "(", "tWidget", "*", ")", "&", "g_sTouchPos", ")", ";", "}", "}", "}", "}" ]
This function is called from the main loop to update the displayed information relating to the touchscreen.
[ "This", "function", "is", "called", "from", "the", "main", "loop", "to", "update", "the", "displayed", "information", "relating", "to", "the", "touchscreen", "." ]
[ "//\r", "// Is the screen being pressed?\r", "//\r", "//\r", "// Copy the volatiles to keep the compiler from generating a\r", "// warning.\r", "//\r", "//\r", "// Format the string containing the current screen touch\r", "// coordinates.\r", "//\r", "//\r", "// Make sure the string gets repainted if visible\r", "//\r", "//\r", "// The screen is not being pressed so remove the coordinate\r", "// information from the display if we have not done so already.\r", "//\r", "//\r", "// The screen is no longer being pressed.\r", "//\r", "//\r", "// Make sure the screen gets repainted.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }