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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / P1 W* x  ?! k7 [; n$ U; [
  1. [code]EDMA sample test application" Y/ G5 L4 Q7 \6 x1 f& b% I0 u% t4 b# @
  2. /*
    0 W. V6 b# o2 R; r" k" b* h/ M
  3. * edma_test.c
    3 J/ }  Y' `6 _: |! F7 x8 b% z
  4. *) B8 N" h; s) G8 i
  5. * brief  EDMA3 Test Application( D0 _' p7 D2 W3 ?4 m6 D/ J9 e
  6. *5 o6 I0 `! J9 r' Y' v$ d) R
  7. *   This file contains EDMA3 Test code.0 D$ a# j! t5 e3 z; ~8 e7 o! n% \$ u
  8. *  F. c: K+ w! i4 w' D) M! n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 R- o6 Q& t0 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - p! o0 N  J. Q4 o1 \/ u8 l
  11. *         TO CHANGE.7 v" t2 J' R& K3 b$ R
  12. *
    - ?. `" s1 ^& ]' ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " @( `# z7 f# T; ^1 c
  14. *3 K& D) c6 F" ]+ ~1 a
  15. * This program is free software; you can redistribute it and/or
      E: a- a5 U* d/ G
  16. * modify it under the terms of the GNU General Public License as' Z$ U; g( a0 J
  17. * published by the Free Software Foundation version 2.
    & H3 `) U# T0 A# [7 X' P1 L$ _4 ?
  18. *6 t$ A6 z( y- I9 d9 |& t  o8 N: {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " R0 g: q: Z' }( C
  20. * kind, whether express or implied; without even the implied warranty
    4 U/ o2 H' W- c4 Y& D6 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 n# P4 Y, x( J+ B" {, a
  22. * GNU General Public License for more details.9 P* i" a3 F: Z/ V7 t4 t
  23. */
      D6 M: T- b! j6 T% t
  24. 5 Y" y7 Y) t4 v# W0 F  x
  25. #include <linux/module.h>2 i+ {' l3 k- e
  26. #include <linux/init.h>+ m8 [- V* j! K  ^% e9 Q
  27. #include <linux/errno.h>; [7 g" {; C3 }. O/ L7 m2 \
  28. #include <linux/types.h>
    2 C5 R) J, `; C4 j
  29. #include <linux/interrupt.h>+ A- O8 H5 w' W. I
  30. #include <asm/io.h>
    & A. ^- z0 O$ ^4 |  e% ^( V3 r3 P
  31. #include <linux/moduleparam.h>2 Z1 y5 @! _, w) s' d' ]
  32. #include <linux/sysctl.h>8 g  F$ p5 d  m9 U% W' v, L
  33. #include <linux/mm.h>
    ( N# a* N# H& `; ?4 v: n
  34. #include <linux/dma-mapping.h>% [1 F. r$ w2 p' @9 j
  35. 9 Y# l" I: Y$ d
  36. #include <mach/memory.h>$ m" B- |+ R6 ^. G
  37. #include <mach/hardware.h>
    ( `) Q1 u3 f3 S( `- A
  38. #include <mach/irqs.h>7 a; B9 F/ O& F/ F4 }
  39. #include <asm/hardware/edma.h>0 b) s$ M2 l: X: G( d- l7 F1 \& J0 o
  40. ) B5 l! R' m, x4 r7 V) P
  41. #undef EDMA3_DEBUG
    ( y' f& t" e# H' _  B
  42. /*#define EDMA3_DEBUG*/
    * F2 a/ d, C5 V: W8 @. x

  43. - O2 t+ n: b3 G8 \8 C" ^
  44. #ifdef EDMA3_DEBUG3 t' \$ ^& j# v) R2 I( w2 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 }2 w/ C6 p6 J" o& ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # {- F  Q/ Z7 e$ I, E: ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 A8 L1 F1 x4 b" \5 s* g. g$ W
  48. #else+ M4 k/ y" x1 M
  49. #define DMA_PRINTK( x... )% h. ]9 A  H2 _1 ~( Y
  50. #define DMA_FN_IN; [8 c/ \- w% W9 m: ^0 J2 f8 K2 u
  51. #define DMA_FN_OUT
    / @! h, T$ n# d  W
  52. #endif
    4 |) x. ~; _/ L0 c! J
  53. 9 T* S0 j5 `" a( d$ j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      K* n3 S, h) f3 c
  55. #define STATIC_SHIFT                3' ?- m( f  ]' @- H' ]9 K, A
  56. #define TCINTEN_SHIFT               20
    3 F: x, Z  H. L# ~0 m$ f0 F
  57. #define ITCINTEN_SHIFT              21# D6 m# Z  f! ~
  58. #define TCCHEN_SHIFT                22
    2 e, a9 r/ ]! W4 k
  59. #define ITCCHEN_SHIFT               233 `2 H" u/ V; |- H- o8 A; D1 r
  60. # O6 z* d- P0 l  |5 Y
  61. static volatile int irqraised1 = 0;
    3 J- I3 }9 A8 {3 Z2 R- p
  62. static volatile int irqraised2 = 0;
    " Q! S& H1 Q% p1 ]3 H3 c
  63. ) S0 ]& G1 c: @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) y, ~& e) G* f3 e/ r0 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 t8 y2 I7 \) b6 H7 J# A& {" F# g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! h, A2 v/ X# t/ u
  67. 7 @- m& A! b7 ~+ X" a& V
  68. dma_addr_t dmaphyssrc1 = 0;# t. e* v0 D; E) o) Y
  69. dma_addr_t dmaphyssrc2 = 0;
    ( b- [2 g( l& B# R. g4 k
  70. dma_addr_t dmaphysdest1 = 0;
    3 B' S: m% k: F4 T/ p& @0 s
  71. dma_addr_t dmaphysdest2 = 0;! U$ G! J: s; Y

  72. ' p' V1 K. ]% z
  73. char *dmabufsrc1 = NULL;9 z7 B4 k# }0 }( Y6 l
  74. char *dmabufsrc2 = NULL;
    0 r( S5 b3 Z5 s( @1 R7 S
  75. char *dmabufdest1 = NULL;
    2 X) a% x0 r5 n# P) p6 i, x7 B
  76. char *dmabufdest2 = NULL;' f/ K; {5 ~6 l' B8 ~2 o
  77. * |; M. R9 z4 P8 Q  [6 v$ g5 b( b$ w
  78. static int acnt = 512;. \! E  o1 e$ F- o" |! S
  79. static int bcnt = 8;2 d3 O; X; j4 e) D. F( K
  80. static int ccnt = 8;  J% p* {6 a) s' g. i! M
  81. 4 @; @# Y. M5 X0 c$ {  `
  82. module_param(acnt, int, S_IRUGO);
    , o- Z" R4 M7 {$ M
  83. module_param(bcnt, int, S_IRUGO);6 ^+ r8 t  O! v3 U7 h" a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' t6 D6 m" C) j! y% F" p( z, s1 X$ `. E; h/ O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% M2 G! K: E6 T2 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: r+ O) u: T. N' p0 H2 [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ J+ ]; ?4 l# F3 ~
' {/ G5 j6 }$ |1 e+ a
  S8 ^. b# s$ a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-18 15:08 , Processed in 0.039274 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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