OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 11438|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 p. a- H1 J' A5 a1 I( H3 t& j
  1. [code]EDMA sample test application/ w7 r9 U5 q$ H. o: [
  2. /*
    & B6 S/ `/ B" t. V& D' P
  3. * edma_test.c
    ) o7 L* q2 V: Q
  4. *, D- Y" @% l* t5 S0 O
  5. * brief  EDMA3 Test Application$ F# f* f- ]$ A: V
  6. *
    1 U" c) C. I! S
  7. *   This file contains EDMA3 Test code.
    : @7 {% h) C9 R2 S) L
  8. *6 X+ Z8 g* p& o7 V( f  h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( E  U9 ^' O. F4 H9 ]: A, H& E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 A$ |$ d& c: S. b' o1 i5 m$ q4 Z; ^
  11. *         TO CHANGE.7 U& x/ Z( f+ }% |9 s+ h5 i6 b7 k
  12. *! E, v8 T- u9 X) d' |. H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 d2 `! ^, E! P5 W! _7 ]5 F
  14. ** n, {! [* x& ^5 n  z
  15. * This program is free software; you can redistribute it and/or
    0 {" [5 X! L+ t7 q$ \, j
  16. * modify it under the terms of the GNU General Public License as
    # S! e4 g7 U/ ?8 P4 [
  17. * published by the Free Software Foundation version 2.
    * U, O2 u/ a9 [
  18. *# c' u% u1 B4 r/ \, T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" b- B9 K( O% F9 x# d
  20. * kind, whether express or implied; without even the implied warranty8 F6 e. E( J5 m+ s) |$ L5 e+ {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! c$ F! S  K& Y8 ^" G% d
  22. * GNU General Public License for more details.6 p/ m) \8 m8 l7 n* J* F7 A
  23. */. G. o8 z/ V% R0 y# @

  24. - c% v+ _. c& R: _: d+ \
  25. #include <linux/module.h>/ O4 ~) `  [7 v1 q: V; u' X
  26. #include <linux/init.h>
    + N: [; J3 q" Z$ s  I
  27. #include <linux/errno.h>2 p/ ]. B. j! x% X4 V
  28. #include <linux/types.h>3 q3 n+ P$ D( k
  29. #include <linux/interrupt.h>
    # F( R: c- v; }+ l
  30. #include <asm/io.h>. L7 s6 @% ]; T9 n$ c2 k4 K
  31. #include <linux/moduleparam.h>2 V% y$ f- m/ l8 y
  32. #include <linux/sysctl.h>
    * F; Z7 k7 n6 X. t$ V
  33. #include <linux/mm.h># I' O' N( ^. @, n( n8 ~8 j" X8 @
  34. #include <linux/dma-mapping.h>  Y( w" {6 H) @) A8 ?/ N$ c
  35. $ P+ I& g: Y5 Z' C
  36. #include <mach/memory.h>- _8 @6 M: d! S
  37. #include <mach/hardware.h>( w, h3 D7 l+ o9 Q
  38. #include <mach/irqs.h>% ?. G4 j7 V; V) h4 Q% C" |
  39. #include <asm/hardware/edma.h>
    # Q! V% Q  u  M1 K6 m+ o% D4 p
  40. 3 q0 _! z4 g( Q6 G0 `
  41. #undef EDMA3_DEBUG
    9 Y! F$ Z0 b4 Z4 ^5 H7 |$ }
  42. /*#define EDMA3_DEBUG*/
    ! ^. x$ {9 A$ D3 S; y3 K7 S# i

  43. 8 e4 ~& r9 T7 ^9 ~2 Q9 B, `
  44. #ifdef EDMA3_DEBUG
    7 E8 F+ P& S+ E. z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( ^% C! M' o  O& N3 K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 A: Z2 \7 ]) ^) W1 f% W' c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * E6 m6 ^5 V: L0 a' ?1 t) Y
  48. #else
    ) v+ F) [5 ]7 L! C7 ~' ?# `
  49. #define DMA_PRINTK( x... )
    6 \* ]5 q* T$ m: ?6 J! n
  50. #define DMA_FN_IN  R3 W9 a8 j' t* E
  51. #define DMA_FN_OUT- g7 S1 M+ G1 h" z2 Q6 ?0 {/ P1 [' K) J9 z
  52. #endif  K3 I1 o: s1 V8 i7 i# k

  53. ; P& j$ X7 N3 V' E) u. E& B2 j9 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      c) ?  z' o. s" }3 G( w
  55. #define STATIC_SHIFT                3! p6 z/ c# D' ^1 @: Q3 Y) L9 S
  56. #define TCINTEN_SHIFT               203 ~$ \7 A. J  f6 i; Z
  57. #define ITCINTEN_SHIFT              21
    : }% u* t+ y: b' E7 d8 u0 E( ?3 o4 g
  58. #define TCCHEN_SHIFT                229 X3 l4 d) ~! L, b9 N
  59. #define ITCCHEN_SHIFT               23
    & a6 P/ ~* g3 N+ |, d: u2 l) m+ S2 e* a
  60. 3 ]) n- l, t8 I! \- ]
  61. static volatile int irqraised1 = 0;9 J8 B. x- x) G  H6 R
  62. static volatile int irqraised2 = 0;
    ! {$ ]$ X$ ^3 B' j  A

  63. 4 u/ A' p' J$ e0 i0 B7 v7 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ W" R" \: j9 c  j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - y5 |" P: l" d0 B" t& j( n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. o; Z, ^- z8 g: I1 b, }0 Q' f: i
  67. / [1 I! e  P9 ^7 |, Z# F
  68. dma_addr_t dmaphyssrc1 = 0;
    5 r* p% G# e) G- V
  69. dma_addr_t dmaphyssrc2 = 0;; N/ W/ Z( X% N  a% a5 \% d
  70. dma_addr_t dmaphysdest1 = 0;
    . m, G) O5 Z6 G2 W# z3 A9 O% P
  71. dma_addr_t dmaphysdest2 = 0;1 K3 {6 l; u- {8 c2 P
  72. % \# R% W9 a, ~9 w1 a
  73. char *dmabufsrc1 = NULL;( P- m2 Y/ ^# f5 i$ A& d$ v1 d4 S
  74. char *dmabufsrc2 = NULL;
    ' o, O6 g  i0 @$ O0 @
  75. char *dmabufdest1 = NULL;  H" |0 v# R* W
  76. char *dmabufdest2 = NULL;  `! _( z5 C7 B, l9 U  k! n# L
  77. : A% E0 W7 w% u! m# ^9 `8 v$ o
  78. static int acnt = 512;
    3 g7 Z/ t4 F+ j4 ]/ z3 N7 x
  79. static int bcnt = 8;" p% P/ o) a7 v3 L* T% w
  80. static int ccnt = 8;" ^7 q' e4 ~3 }7 R. F

  81. 2 O2 L% C! C/ Q, F% _/ E
  82. module_param(acnt, int, S_IRUGO);
    ; }+ G, k! W2 ~: k3 V
  83. module_param(bcnt, int, S_IRUGO);
    + |; ~# {$ v9 V' Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 M( X( @+ n. h; }
( O3 d* _1 o0 W9 R; y) l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- k1 V+ U( X  n8 L
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! n1 ^1 |" }1 n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 w' X5 E' b& {4 {2 j1 L0 d- h

$ z- g; U( G& ~) {0 M8 M7 K* W. A8 Z
; F4 c( B, K% \, [1 M- F1 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-2-15 02:24 , Processed in 0.040250 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表