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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - I( _8 K$ g6 _1 N1 u- y
  1. [code]EDMA sample test application
      u$ S3 X+ V0 y0 C( `) l/ ^
  2. /*
    # }4 n+ f' G6 a; G
  3. * edma_test.c
    . a* i  J- {2 R1 `7 F
  4. *
    " k3 y2 n  d. I( V! g0 [
  5. * brief  EDMA3 Test Application
    + \0 S; }" P+ n* u% x
  6. *
    3 U  R+ w' F* ~1 E% ^
  7. *   This file contains EDMA3 Test code.* l- _+ Q# y6 V; X& j  x% X
  8. *9 v9 \3 X$ \) @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& N, b) ~$ }) |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 b5 s0 L7 F) P$ `: Z( |! ]
  11. *         TO CHANGE.
    # {$ Y5 n$ l6 j# Z0 K
  12. *
      V! z2 ~8 o/ `( N+ ]8 p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( ^$ c% k  a0 e4 p, G# V+ {
  14. *
    ) B$ T: ^, S% _1 t- H4 g% v
  15. * This program is free software; you can redistribute it and/or
    % L& h' b$ ~+ G7 z% R  K
  16. * modify it under the terms of the GNU General Public License as
    5 T" V1 \) T4 e
  17. * published by the Free Software Foundation version 2.5 a) ^6 \+ G% Q# a' W; r# z
  18. */ Y5 ~( A4 B2 K* l# O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 A% T' _3 q" f2 G" v2 i! `3 w
  20. * kind, whether express or implied; without even the implied warranty
    2 w2 w4 r4 K% {$ ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) p1 `& U& I6 q$ z5 G
  22. * GNU General Public License for more details.. T1 \) f; i2 q, r+ Q
  23. */
    ' P9 n: y3 [# `& g, O

  24. 9 \6 K9 d$ H4 D7 M0 G( l1 Q2 l
  25. #include <linux/module.h>: _( E  `# Z$ i/ d
  26. #include <linux/init.h>; C6 j9 t/ k: G4 ~
  27. #include <linux/errno.h>% r0 Y% F1 T/ u. ^/ N1 r
  28. #include <linux/types.h>: B" `0 ~. g* D, v  d! u
  29. #include <linux/interrupt.h>0 i" |/ o( E3 s9 S, X  a0 G
  30. #include <asm/io.h>
    4 Z  C9 i5 M* P/ \; h
  31. #include <linux/moduleparam.h>* i* C: W3 k( I' B
  32. #include <linux/sysctl.h>' H; o3 X" w& l3 |( f
  33. #include <linux/mm.h>
    . [8 r. F6 H9 ?1 O5 m2 ]  k6 X9 N
  34. #include <linux/dma-mapping.h>8 E: V! q/ C, g
  35. ) `! ?4 h  @; {5 p
  36. #include <mach/memory.h>* s# }  g3 Z. A4 @0 Z5 T
  37. #include <mach/hardware.h>7 u+ }" L5 A& s, w9 S9 d4 B7 U
  38. #include <mach/irqs.h>
    ) b- Y' {& g! y* X
  39. #include <asm/hardware/edma.h>( X, i  u- v$ E- g* Z/ @
  40. 6 E) [5 P/ x2 e! j
  41. #undef EDMA3_DEBUG' w7 Y1 I5 F8 |0 i8 K9 v" W
  42. /*#define EDMA3_DEBUG*/% l* S8 s8 z1 ~

  43. - K* I  e' _4 L$ N
  44. #ifdef EDMA3_DEBUG7 l. S  G6 P7 A$ m3 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 _$ ]5 V( }5 T. a3 ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 p! |& a1 r1 e3 [0 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 {* u+ W: Z; N6 J$ P! @( v* K1 @! J- U
  48. #else& I! T$ H- U: P+ c9 j" r0 ~
  49. #define DMA_PRINTK( x... )
    & E' P8 O- G# c: j8 n- _1 J- i
  50. #define DMA_FN_IN& X, a- q& w- ^9 c
  51. #define DMA_FN_OUT
    % c$ L! N) N! y1 _
  52. #endif
    " \, n) m& S, `$ R

  53. 3 S& }8 q2 [- O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - u) D+ h2 x3 `  H5 o2 E, C/ e
  55. #define STATIC_SHIFT                30 b4 n" n1 a/ [* D% {6 ]) Q
  56. #define TCINTEN_SHIFT               20( x/ o' W  C! P
  57. #define ITCINTEN_SHIFT              21+ h8 O) h8 v% g+ L
  58. #define TCCHEN_SHIFT                22
    0 t. [2 l6 p6 X) y0 v4 D8 J5 c
  59. #define ITCCHEN_SHIFT               23
    : V( g+ q! o2 Q/ ^+ d

  60.   b1 Y. C& g! S4 i6 p7 j$ U9 A' ~' E
  61. static volatile int irqraised1 = 0;  I: L4 s( n" ]9 @' W
  62. static volatile int irqraised2 = 0;3 P) F' \% D$ J& X$ n( Q& y6 P
  63. 4 ?; J# h+ ~" c0 H, W  V" o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " k# u0 q  p. O& v) T& q  S8 S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) B2 w9 N, o/ Z* q- f5 q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : R  w5 w* e4 u" [5 p0 H

  67. 9 o% K/ E9 Z. k
  68. dma_addr_t dmaphyssrc1 = 0;: U$ Z+ F) i) [0 ^5 M$ ~7 G( [
  69. dma_addr_t dmaphyssrc2 = 0;
    # ~4 Y- S2 ^/ P) O
  70. dma_addr_t dmaphysdest1 = 0;
    + U4 e. A$ J. w1 m6 x1 F+ [
  71. dma_addr_t dmaphysdest2 = 0;4 \$ E* K- n$ T! C
  72. 3 j) p1 B$ o+ G
  73. char *dmabufsrc1 = NULL;! K1 V& c* P9 g) K; {! w
  74. char *dmabufsrc2 = NULL;/ Q3 w/ ]! d6 U# y9 x6 v4 z
  75. char *dmabufdest1 = NULL;4 D# c+ C* }/ H! ~4 z
  76. char *dmabufdest2 = NULL;5 h% \. _; g/ H; ~# x2 Q9 n

  77. ; r6 s- x& v# f0 W4 w0 C, K$ d
  78. static int acnt = 512;
    # C* i$ t9 O3 {- ~" ~
  79. static int bcnt = 8;
    - e4 M& m% p0 [8 ~+ Y
  80. static int ccnt = 8;
    7 \  p  s, C- ^7 W

  81. ( L+ S5 I2 Z" v* i( ]+ x
  82. module_param(acnt, int, S_IRUGO);- i+ F( ]7 y1 |% J3 C4 n/ B
  83. module_param(bcnt, int, S_IRUGO);$ B; p$ @4 R  A/ M0 Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 g# n5 J* J; j/ |  g8 G0 T9 u
& g" c' X  r1 D' q7 m/ }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 |% D0 W6 m1 W! q$ g( ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: s2 V$ T! _7 W; x% S% B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ d+ j3 X. J% C+ J# g! v$ P$ L
( o; R& ]- @# `& d  O. m( z  w2 A- V  g% p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-5 05:27 , Processed in 0.039040 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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