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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / l7 b! B. i$ K6 b* x; |2 m: x
  1. [code]EDMA sample test application+ ~3 `1 g! F4 I
  2. /*
    " @# e1 Q0 K  T4 B1 l
  3. * edma_test.c  R% x- K: @8 c5 U1 T& R9 c
  4. *
    0 B9 Z) `! {$ [- y/ P' [
  5. * brief  EDMA3 Test Application- w6 |! z# e5 X
  6. ** Z. R- Z( v* K  T2 C" y; E
  7. *   This file contains EDMA3 Test code.0 m! F4 F6 ]& \" A" X5 `
  8. *
    0 }/ f( b9 ~' ~- n  T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ X9 s% h/ O6 X3 L- R! u& ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / `1 @  \4 j: a" e2 H& O
  11. *         TO CHANGE.
    : {, s+ V& ]8 h
  12. *
    $ G* o- `& p5 p5 W3 _5 b# o, T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      u' t+ f3 V2 ^+ N$ @
  14. *
      H8 Z6 Q/ n* Z! a9 G) u+ w
  15. * This program is free software; you can redistribute it and/or
    : i. l) z; j# _* c0 ^  Q8 h/ N
  16. * modify it under the terms of the GNU General Public License as
    ( N! o, c) O7 b: R
  17. * published by the Free Software Foundation version 2.
    - A2 B# @6 a- Q# F
  18. *
    ( R! f: q5 d" y0 q. ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 E' N* U* e, F
  20. * kind, whether express or implied; without even the implied warranty  p, z0 ^9 A) i. v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 n: a5 s- _# L
  22. * GNU General Public License for more details., u) N0 B0 s& j
  23. */
    + k4 X0 h  b" X  A, o! \

  24. . v- [  S: J+ y2 x+ D3 m% p1 i+ X
  25. #include <linux/module.h>
    ' n+ I' |1 X+ [9 M3 I
  26. #include <linux/init.h>
    & t5 |) O$ \+ z/ k
  27. #include <linux/errno.h>* H0 |) J9 P; y6 D- L! \% J+ v0 {
  28. #include <linux/types.h>
    - C# z" {8 l1 U+ {4 S+ E( k  F+ s
  29. #include <linux/interrupt.h>! P* r( a* H3 h" @& U
  30. #include <asm/io.h>
    " ^& _- {# w6 ~8 j; N. r" t
  31. #include <linux/moduleparam.h>, Q" K+ \  R, i
  32. #include <linux/sysctl.h>8 V4 e1 d. D3 J8 L1 W+ p6 U4 O
  33. #include <linux/mm.h>' f# S1 m, P, }! P% k, \0 J4 c
  34. #include <linux/dma-mapping.h>
    7 J6 m9 k3 b( m1 z5 R/ s# U
  35. ) L- M+ N; Y1 H) h4 g5 E
  36. #include <mach/memory.h>
    ; k3 c8 @5 T+ K; V* f" s; T
  37. #include <mach/hardware.h>
    & m  m9 n# p3 q, k, o
  38. #include <mach/irqs.h>1 I5 j, Z7 B8 C) Q4 L; j0 |7 g
  39. #include <asm/hardware/edma.h>% A' ]$ H9 J" o$ I- K" _

  40. 7 x) R/ u6 z( b  W
  41. #undef EDMA3_DEBUG
    7 x" w: ]# ?# ?8 ?
  42. /*#define EDMA3_DEBUG*/- Z, c- e* \: Y+ d! H% T. d
  43. 5 h) z7 M' G1 P( j" E8 x3 ?# G
  44. #ifdef EDMA3_DEBUG
    + r7 g9 {; m* r  N3 u3 }) r/ ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ t* g$ K( Q; ~! b5 {  K* f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; h8 X5 I% {( P# P6 V4 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): n/ G: X8 j0 N, I$ |
  48. #else0 Q5 J+ c5 M2 {$ j/ x* v
  49. #define DMA_PRINTK( x... )
    . w7 ^* _* z+ ]' Y' O* _- r
  50. #define DMA_FN_IN% Q: B' N  r0 Q8 v, e4 G8 Y/ R
  51. #define DMA_FN_OUT
    ' X) f+ J/ E6 n: {( r% \7 L
  52. #endif+ A% X  K; c& ?) K
  53. $ W9 V& Z! W3 t( r  N; ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 ~% f6 r9 R' Q4 Y* a% ^
  55. #define STATIC_SHIFT                3
    8 g* @# d5 l8 C9 j7 n0 |3 ~! f
  56. #define TCINTEN_SHIFT               20
    ! X4 J5 J6 f# H6 [
  57. #define ITCINTEN_SHIFT              21
    ; {/ E( o% X* F+ U
  58. #define TCCHEN_SHIFT                22" Q, v' c4 }9 r2 q2 E6 I% o
  59. #define ITCCHEN_SHIFT               23! k* t; M& K$ Z; i$ W- l9 G; n2 E, q

  60. % n4 y4 F, Y( J  c& x& o" G- X, k
  61. static volatile int irqraised1 = 0;
    2 L) Q& f1 E! p) B0 m
  62. static volatile int irqraised2 = 0;
    / o6 ^! @; e7 j- @

  63. ; D5 {/ A" g$ x7 u$ b, o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* p. Y# f: m: F7 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      z! z. n4 J' K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, B' _* B; z% ?! P

  67. ) N) Y" j; C/ ]) V( k
  68. dma_addr_t dmaphyssrc1 = 0;
    1 c! |6 k0 N& V3 L3 v
  69. dma_addr_t dmaphyssrc2 = 0;
    9 F3 V: t6 t% n% c# w
  70. dma_addr_t dmaphysdest1 = 0;. y: w1 x; d& _* b$ P
  71. dma_addr_t dmaphysdest2 = 0;8 I/ ^$ }9 ?& J

  72.   e. k3 T. a6 b2 |: r
  73. char *dmabufsrc1 = NULL;) T: g8 [2 J0 ?/ d9 E; {* n0 F& p( u
  74. char *dmabufsrc2 = NULL;4 i5 s  K6 f, [% z% }* P" K; e) {
  75. char *dmabufdest1 = NULL;6 P& f6 D0 x- V. T' C5 ]
  76. char *dmabufdest2 = NULL;
    7 M- A0 w+ \/ f" f
  77. ) X; W( |8 R/ M+ Z# Y0 X2 C1 V* }
  78. static int acnt = 512;
    # p/ p- m7 }. D. ^/ ~0 X
  79. static int bcnt = 8;" j. P/ h. p4 @
  80. static int ccnt = 8;) i8 y2 }: n% u9 R1 L( y
  81. 9 {; g0 i1 c( W# M7 h
  82. module_param(acnt, int, S_IRUGO);
    1 i- x5 y( m% ~5 q2 F
  83. module_param(bcnt, int, S_IRUGO);: a! a7 z5 e- n( }# W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 K' P2 ?) g" n7 Z

! ?2 @1 \0 f; B1 m: M1 |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ v7 @- A7 x; O4 R( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 X, }3 K) y0 C5 M: l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" _% P2 g0 J( G
: c, B8 M, w8 v  E2 g6 i4 [/ n; Z4 W
5 N/ R, P9 s" h. I2 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 02:25 , Processed in 0.039157 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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