MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / SendCommand

Method SendCommand

Kernel/src/usb/xhci.cpp:198–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196 }
197
198 void XHCIController::SendCommand(void* data){
199 xhci_trb_t* command = reinterpret_cast<xhci_trb_t*>(data);
200
201 if(commandRingCycleState)
202 command->cycleBit = 1;
203 else command->cycleBit = 0;
204
205 commandRing[commandRingEnqueueIndex++] = *command;
206
207 if(commandRingEnqueueIndex >= commandRingIndexMax - 1){
208 xhci_link_trb_t lnkTrb;
209
210 memset(&lnkTrb, 0, sizeof(xhci_link_trb_t));
211
212 if(commandRingCycleState)
213 lnkTrb.cycleBit = 1;
214 else lnkTrb.cycleBit = 0;
215
216 lnkTrb.interrupterTarget = 0;
217 lnkTrb.interruptOnCompletion = 0;
218 lnkTrb.segmentPtr = cmdRingPointerPhys;
219 lnkTrb.toggleCycle = 1;
220
221 commandRing[commandRingEnqueueIndex] = *reinterpret_cast<xhci_trb_t*>(&lnkTrb);
222 commandRingEnqueueIndex = 0;
223
224 commandRingCycleState = !commandRingCycleState;
225 }
226 }
227
228 void XHCIController::EnableSlot(){
229 xhci_enable_slot_command_trb_t trb;

Callers

nothing calls this directly

Calls 1

memsetFunction · 0.85

Tested by

no test coverage detected