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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- k2 g! w8 ]/ |. m! @* z
  1. [code]EDMA sample test application
    + v! }2 J1 G- P" b
  2. /*4 r5 y8 M) W) n
  3. * edma_test.c
    , M4 B3 c; S9 j" T) }$ q, z2 E
  4. *  \' H6 R' O% M* G+ L
  5. * brief  EDMA3 Test Application! ]) a  O$ ~9 {1 k# `- J
  6. *# w1 n- b. j) V  l4 `1 E4 o1 c4 s
  7. *   This file contains EDMA3 Test code.* J0 r" g- N$ d! ~
  8. *: p+ {1 ?6 t+ q( q' d/ q% R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ n. n" _# h* h0 B' ^6 W: t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 Y3 }# Q( ?" m  w  g
  11. *         TO CHANGE.
    ; @" ?- C3 n, E- R$ m
  12. *
    " E: E; I  _' z. G) G1 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- z3 j/ \6 c! D8 M2 z% X8 w* O
  14. *6 r9 c, O- I0 i; H
  15. * This program is free software; you can redistribute it and/or6 P6 m8 x, Y& m9 k
  16. * modify it under the terms of the GNU General Public License as, X7 k3 k0 }2 F% Y; M% U0 p2 c1 J- s
  17. * published by the Free Software Foundation version 2.
    , D( Z# |/ H7 `# e+ Y0 F
  18. *3 l0 r; k& C9 X& \* j, K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      j" P- F6 d  Q5 M6 A6 M- o2 c
  20. * kind, whether express or implied; without even the implied warranty
    : V% X, J- V) O4 p7 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + O7 @0 {1 c! a5 G9 C# n: y% {0 v! I
  22. * GNU General Public License for more details.
    + b7 z6 R, s4 g4 n4 h# S6 H
  23. */" M( n0 C0 G) Z- C) J* N
  24. 3 z: q0 H" f9 \- v) @. H; ~( p
  25. #include <linux/module.h>
    1 V# c# R1 J$ O5 d3 ?% G* X
  26. #include <linux/init.h>& O/ k- s1 u; ]$ q. D' ~/ F, B6 x
  27. #include <linux/errno.h>; F% [! y" G( ~4 J
  28. #include <linux/types.h>2 E# k' f, k% B+ t3 F) e  L! V2 \' z
  29. #include <linux/interrupt.h>
    2 R. T7 J4 r5 R8 w( V
  30. #include <asm/io.h>' t* n9 c+ @/ H1 r+ Y) `
  31. #include <linux/moduleparam.h>
    7 Z9 V8 N8 q2 R- }$ ?
  32. #include <linux/sysctl.h>( Y4 n6 Q, `' ^9 y8 N
  33. #include <linux/mm.h>
    + X6 t- E+ y5 Y+ \0 t$ A% b1 X
  34. #include <linux/dma-mapping.h>
    ; m# A: P0 `4 S, @; T
  35. - N$ P# b, w/ x' d. D4 n, P
  36. #include <mach/memory.h>
    3 f4 Z1 L/ l. t4 A% t( [# Q! V. j
  37. #include <mach/hardware.h>
    ! z# J7 r! T+ O, D7 W1 p
  38. #include <mach/irqs.h>
    & @, C& v' {* q" I
  39. #include <asm/hardware/edma.h>
    $ U4 G/ T" f5 I" i
  40. " g  `, w  M1 C$ b7 a
  41. #undef EDMA3_DEBUG
    * b3 M4 b0 E6 N
  42. /*#define EDMA3_DEBUG*/7 b$ p, P+ }5 Y4 ]* {8 g* G

  43. - J7 y" K( k; g  C
  44. #ifdef EDMA3_DEBUG- T; F$ V7 S$ U1 [, \: z5 X$ Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 x2 U; B4 S1 @% L2 s8 Z" I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 q8 V; Y. S# j4 t5 L6 E/ Y9 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 v3 g  J# f: }' A3 ~% c
  48. #else
    8 a/ ^. H# e3 s# u; m% Z
  49. #define DMA_PRINTK( x... )/ r, E6 ^! v1 |' l7 S: `7 u* S
  50. #define DMA_FN_IN  k) K% s+ f6 I1 I2 {8 ~/ ~* J
  51. #define DMA_FN_OUT
    0 \6 h! T# v) C$ d5 q5 k+ ~
  52. #endif. N5 K* [6 g, z9 j! m
  53. " Z9 n( M0 Z* u/ t* Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 Z! }; I% A: z5 ^8 Q2 z
  55. #define STATIC_SHIFT                3
    " ?" E0 [0 \. d( e8 B9 Z+ O4 e; I
  56. #define TCINTEN_SHIFT               20# e  N4 R, R9 g% _7 H4 l
  57. #define ITCINTEN_SHIFT              21! H5 \5 r( L0 Y$ T% G
  58. #define TCCHEN_SHIFT                22/ H" E3 W8 A' l& Y2 ]
  59. #define ITCCHEN_SHIFT               231 N6 i) `' Z4 H2 o- |$ u
  60. 8 j! H, p" F+ O9 ?7 _  t
  61. static volatile int irqraised1 = 0;
    " N5 |% \& G+ [. F
  62. static volatile int irqraised2 = 0;- h: y. E3 z2 `3 Q

  63. 6 V1 l3 Z5 a  I4 X' a5 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 n# ]  r# ]: \. l, l" |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , x" }* s2 K7 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 ~; L. j$ a, J: S. b
  67. : W! u! u! r/ s8 l$ J, t5 m9 }
  68. dma_addr_t dmaphyssrc1 = 0;
    0 X2 q) U  M& P) w! _. i; M
  69. dma_addr_t dmaphyssrc2 = 0;
    1 T: F) Z* a  F8 x
  70. dma_addr_t dmaphysdest1 = 0;  A, _9 u8 ]& b8 v, R
  71. dma_addr_t dmaphysdest2 = 0;
    ( i- A" J0 I9 j5 R0 U( d
  72. ( I+ E: K* Z. d  ]5 t1 M' v
  73. char *dmabufsrc1 = NULL;/ Y  w( y6 l( N4 p) v" D- [% F
  74. char *dmabufsrc2 = NULL;
    9 b" @8 S2 ^1 W- [5 e: c
  75. char *dmabufdest1 = NULL;; {: @5 Q& K( J
  76. char *dmabufdest2 = NULL;6 r4 K$ R9 {8 u$ K4 J3 s
  77. , k) f& x. W7 K
  78. static int acnt = 512;& W. B0 Z& ?2 Y) u
  79. static int bcnt = 8;
    ) S: B* f( i0 c6 v# }/ K5 m
  80. static int ccnt = 8;4 o* H/ [( K# w! \- {

  81. . D9 z1 Y* p* K9 ]" c6 x
  82. module_param(acnt, int, S_IRUGO);& w2 U8 |/ [: E' E8 _
  83. module_param(bcnt, int, S_IRUGO);/ [& Y- t; Y7 y. s& X& T* X
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, w, z$ N4 R2 c) N7 r' H

0 A5 E" G+ Q" H, j- T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) m9 p5 o3 H7 K; U) a, w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 g' @+ L4 J1 p9 X7 O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" C% t0 [- E0 B& B, q. @9 }3 N, ?
1 T1 W2 K6 i2 ^& @5 d7 b4 n2 J. `! o3 U' L1 g7 V5 L9 P  Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-20 13:30 , Processed in 0.039482 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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