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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 u  s! ~( K' X6 q& `5 X2 A
  1. [code]EDMA sample test application
    3 F% e9 @% x+ [7 {0 Z2 t
  2. /*7 L; [+ Y: ~8 y9 x8 }. k
  3. * edma_test.c
    6 \/ [2 c# Z; _# G
  4. *$ n, S. d; Y  v  H( `
  5. * brief  EDMA3 Test Application
    , P# `  e9 \/ d/ z5 Z
  6. *
    ; K4 y$ m8 Y6 h1 |0 s  o; j9 d( o9 T
  7. *   This file contains EDMA3 Test code.
    # j7 J) @3 M: A, {6 P/ F
  8. *) L0 j8 ]5 e9 k, b0 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' {  o. d5 `) t! _; n2 _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , `. B" [0 z' ]4 e6 u
  11. *         TO CHANGE.
    9 G; u( R# B: s. G
  12. *0 q6 U! o- E( x2 G: {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 E9 \1 u; S" z% w9 A3 k& m
  14. *
    # r+ I; S% Z& p2 {8 U; E. F$ M& q. M
  15. * This program is free software; you can redistribute it and/or
    4 }, S  o( `4 P2 P7 c$ M
  16. * modify it under the terms of the GNU General Public License as6 c1 _/ z$ C( W3 [
  17. * published by the Free Software Foundation version 2.8 I6 P0 k8 C1 f1 R
  18. *6 i0 s  V9 U; E& W2 v6 S2 ?/ p2 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 n  l9 Y$ h9 F: ?  L
  20. * kind, whether express or implied; without even the implied warranty
    ( }, H: R. j7 K6 R2 |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 d; o, v  v2 P$ d
  22. * GNU General Public License for more details.
    6 D& A! j0 {+ N) b4 X. v
  23. */
    . |% b8 d4 p/ Q$ |' i5 A5 L
  24. 8 y0 {% b1 k; X1 r. A
  25. #include <linux/module.h>
    9 d2 E9 ]' X% P/ _
  26. #include <linux/init.h>  z1 W% J# h" Z
  27. #include <linux/errno.h>
    ( }# [) ^& |  R0 E4 S+ T
  28. #include <linux/types.h>5 g$ A+ k0 I" m+ {) y6 @; P
  29. #include <linux/interrupt.h>1 D$ _" s3 H+ I4 \- V4 |
  30. #include <asm/io.h>/ c& ]" J8 c: r7 K0 h
  31. #include <linux/moduleparam.h>
    0 P2 v6 ]- A, X' r! Y
  32. #include <linux/sysctl.h>/ [5 v% _1 Q( \! ]$ W# f
  33. #include <linux/mm.h>1 @0 q7 w9 Z3 I5 R' W1 B
  34. #include <linux/dma-mapping.h>- r, _/ c1 Q3 o8 Z" X7 t

  35. : ^) K" |5 X/ I# r2 c- A6 D
  36. #include <mach/memory.h>
    $ g% r; i* F, E1 B. {  ?
  37. #include <mach/hardware.h>
    : r2 m  y* j3 G: J
  38. #include <mach/irqs.h>: p) N1 j7 N) `! ]- e6 k* Q
  39. #include <asm/hardware/edma.h>3 d1 y7 t, {* B

  40. + b) i4 U3 f* p
  41. #undef EDMA3_DEBUG
    8 z3 H: U2 C" r2 l) K- R6 Z
  42. /*#define EDMA3_DEBUG*/
    ) A# Z8 [4 d, s- C: ~

  43. * x, o& I( p( l& x, ?
  44. #ifdef EDMA3_DEBUG
    ( t  W# M, I% z+ K# |* V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 ]$ {* F  L# R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / y, B% m& b; [( f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): a* u; B7 k# i2 z! E# g
  48. #else$ }$ u, s# r* D# Q  T! a: [+ w& \6 B
  49. #define DMA_PRINTK( x... )/ _* x! B: M  y
  50. #define DMA_FN_IN
      |  n3 v" l8 D. Y3 c
  51. #define DMA_FN_OUT) {: W+ v7 s3 x4 R" S" a
  52. #endif; b' u% i: ?; k5 P( ?5 X: }9 c) r

  53. - k- v( ]8 A3 g- I$ ~; T. }+ B% [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( X. K2 X9 G0 {# M1 G$ w
  55. #define STATIC_SHIFT                3
    3 L5 q$ [# J. |* a0 u+ q7 I
  56. #define TCINTEN_SHIFT               20
    & j. O' C$ L* \; l
  57. #define ITCINTEN_SHIFT              21
    4 r8 K( M3 z- l0 I0 O/ |9 V& K7 x
  58. #define TCCHEN_SHIFT                22
    " ^) Z9 B7 W9 d8 q
  59. #define ITCCHEN_SHIFT               23
    1 t# l1 S/ X/ J# w% D) t

  60. . S8 V" Q2 b$ |- j, b
  61. static volatile int irqraised1 = 0;
    1 l$ y8 }* J/ `9 ~6 r$ o
  62. static volatile int irqraised2 = 0;
      p- X/ ?6 d4 M6 \! M+ p, D

  63. 3 ~( K; r  y6 C0 d! A+ x" w, a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' m) c+ E& a* V4 S" @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 k, A% [0 S4 e; l( m: X( x# y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 C4 ^: W. o& z6 \6 p- M
  67. , u0 N. o. S  K
  68. dma_addr_t dmaphyssrc1 = 0;8 T/ F5 S5 S- w1 L. @: \8 k
  69. dma_addr_t dmaphyssrc2 = 0;
    ( h( M$ [) b) r( L9 V7 Q
  70. dma_addr_t dmaphysdest1 = 0;
    : ]) v8 J1 n2 f% ?
  71. dma_addr_t dmaphysdest2 = 0;
    " T; |: p( ~/ o
  72. ; t9 A4 ^- o$ ^. g# B1 V
  73. char *dmabufsrc1 = NULL;
    7 O% o; T6 g2 n3 \! X. w9 }
  74. char *dmabufsrc2 = NULL;
    # P  N  H. \* d6 S0 c
  75. char *dmabufdest1 = NULL;* ^/ j. N6 Q" \% J0 o
  76. char *dmabufdest2 = NULL;
    + R5 [" ^' l9 T& N
  77. ' v% ]0 X3 o  d. H
  78. static int acnt = 512;
    1 ^. `" A: S# C; w, y
  79. static int bcnt = 8;" j% m' V9 E9 s& V3 I( D# b
  80. static int ccnt = 8;2 W; U- \* Q  Y, a

  81. 6 c+ r: |  e) s+ h
  82. module_param(acnt, int, S_IRUGO);
    6 q$ x" U1 m* X( s
  83. module_param(bcnt, int, S_IRUGO);# c5 b! L6 a- M' e) \. Y$ c# q1 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 p% v; N; H, |, ?' g$ w

# Q" ?5 m6 L& c& j/ ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ z# S) C) Z4 M- k; R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  ~' r2 W4 ?6 Z5 i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 t) Z+ K; \( W/ `
% ^( J# ]( Q1 l
5 |" H" e) j  j0 t% g' j5 l3 {5 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 04:04 , Processed in 0.039580 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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