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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " q! p7 k: E- O% i/ j( w* K$ E
  1. [code]EDMA sample test application% {7 J" {% d$ ]
  2. /*; n: w! V8 l# |) A
  3. * edma_test.c7 s9 a  W7 c( k& X4 ?: n+ V
  4. *
    9 D+ H: D5 h0 O, ^" K8 ^
  5. * brief  EDMA3 Test Application
    : r+ L% U# }0 E1 o  M& x" t4 i. l5 l
  6. */ @* T2 Q* O/ @9 ]
  7. *   This file contains EDMA3 Test code.# e7 ?  l8 {5 L/ I- O0 G$ {$ r
  8. *
    1 {5 m( B% t/ o; g7 y7 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - s/ d: [. |: a  W7 O3 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 c, L: ?' C6 B4 ~% f
  11. *         TO CHANGE.  \6 U0 ]$ L& Y  |& v
  12. *
    + Z3 M& E. m4 B8 [% B# U) C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 y8 S# [* n# D: [6 [  @9 P- b
  14. *
    6 t, Z/ A' _; d- \% v0 ~
  15. * This program is free software; you can redistribute it and/or' ~3 f8 m3 T+ Z+ C1 K' H0 `+ H
  16. * modify it under the terms of the GNU General Public License as) J, F% I4 P8 Y8 `- i% a
  17. * published by the Free Software Foundation version 2.
    ! B, m9 X: `$ w' a3 \! v4 K
  18. *% V( q, ^: h: C, H" r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 |5 d0 F9 N, }5 N  G- i- x
  20. * kind, whether express or implied; without even the implied warranty
    * E7 ]' s  A+ Y4 `/ P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 w2 n4 P5 b6 Z* ?: h
  22. * GNU General Public License for more details.
    4 v' s( A/ L! L- ?1 d' K& R
  23. */) I, d, c7 h, G0 j: z: D! _
  24. # j* p7 B3 ~: t* f  q  k6 q7 G' u
  25. #include <linux/module.h>' u% d: |1 o4 x
  26. #include <linux/init.h>  a5 m8 L2 a8 O! ?# Q6 N# Y
  27. #include <linux/errno.h>+ T9 c! p; @/ X
  28. #include <linux/types.h>8 `, _7 D' k5 R
  29. #include <linux/interrupt.h>9 J6 `1 ?) p% t1 i7 e$ Y; t
  30. #include <asm/io.h>( ]; v& W$ d. S, s9 ]. G* @
  31. #include <linux/moduleparam.h>2 ?5 l! q# n1 H$ @' z5 w
  32. #include <linux/sysctl.h>
    9 J0 N4 d( z  J2 ?3 h+ d8 X
  33. #include <linux/mm.h>
    9 O, m3 K( K7 k/ s: @. I
  34. #include <linux/dma-mapping.h>+ E- f# p% Z$ r$ Q( a
  35. ( T% }1 Y, Q" z" t9 L3 W
  36. #include <mach/memory.h>
    ( q2 L! w! V: }1 Q, v1 |2 R. G
  37. #include <mach/hardware.h>
    ( t6 s+ g4 \% u) _
  38. #include <mach/irqs.h>8 N: e  Y6 U8 }  t9 J8 ]- J
  39. #include <asm/hardware/edma.h>  i+ n4 l# f. p% F; r) ^
  40. 6 u, c: \- t/ A# R& F) i: C1 ~. e+ D
  41. #undef EDMA3_DEBUG
    ( g: b: U5 p1 x+ z5 r7 W6 w0 M
  42. /*#define EDMA3_DEBUG*/
      {+ [/ F/ z9 M) z

  43. % \: ~9 B* ~, G5 _+ P; t1 H- G+ P& |
  44. #ifdef EDMA3_DEBUG
    3 n' \6 a5 E0 M' h3 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): T9 P. N# @' q* G1 ~5 q6 k3 L1 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; l2 `: G; j% D+ _  Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 W; t$ o1 r/ n( [7 Z' a8 f* F
  48. #else
    & ^4 ~' C" A" G' I/ {4 ?3 w6 }
  49. #define DMA_PRINTK( x... )
    6 y. |% L8 A- H) A3 \5 w
  50. #define DMA_FN_IN
    9 s& p1 s8 o$ R: I6 d! \
  51. #define DMA_FN_OUT1 {  _7 m" x% ^; U
  52. #endif
    " s; i5 q4 G( ]! _* x5 o& H. Q8 T
  53. 1 T; T- ^1 C! E( e! `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& i+ v  M5 `; w! y
  55. #define STATIC_SHIFT                3
    0 f6 e; n( N- c6 g& |
  56. #define TCINTEN_SHIFT               209 D  |% z( ?* b: S2 s) E* W
  57. #define ITCINTEN_SHIFT              21
    ( s5 d. k; N- Z2 k3 G7 n6 p/ T
  58. #define TCCHEN_SHIFT                22
    ; F( L4 T2 h3 }5 s+ {
  59. #define ITCCHEN_SHIFT               23
    - @& i8 ?0 i8 N) B4 o+ L

  60. 4 _; W/ ^" }/ m8 j; H
  61. static volatile int irqraised1 = 0;
    / O+ _5 V2 p( O5 I$ D5 P
  62. static volatile int irqraised2 = 0;
    ( }) I  ]8 O( w# Z& _
  63. $ B9 v$ r9 G. ]1 Y4 {0 y+ o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / c( V1 Y1 L: n$ ?/ ~: O2 j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ X; Q/ {! Z6 I& a7 }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' r( s* w3 I. l/ r3 O1 _  c1 o/ N/ w5 n8 t

  67. ' q2 j2 A5 y0 i
  68. dma_addr_t dmaphyssrc1 = 0;  i  A' d" r2 p: Q
  69. dma_addr_t dmaphyssrc2 = 0;: }4 ^; F* P6 w" x1 M; {
  70. dma_addr_t dmaphysdest1 = 0;
    ( X# l! x8 T5 F: D# p& z
  71. dma_addr_t dmaphysdest2 = 0;
    ! V$ P. L( \: y1 P0 G2 h" c
  72. 6 t) }2 G  J2 t6 ~6 u
  73. char *dmabufsrc1 = NULL;
    ; S4 r; `0 `! v5 j& A; K& @
  74. char *dmabufsrc2 = NULL;
    1 L& m0 b+ \2 [' m4 P
  75. char *dmabufdest1 = NULL;
    , E" x( _9 b/ |: e" v
  76. char *dmabufdest2 = NULL;4 T% b$ S" h2 D, A$ u/ c
  77. / t1 G8 N  C& k- l6 f  F4 i7 z
  78. static int acnt = 512;
    ) S3 R' L, N( h: f6 O3 D* [
  79. static int bcnt = 8;
    ! @4 ^* {. F7 b7 [9 v, ~4 C$ {2 n5 ~
  80. static int ccnt = 8;
    ( k# y0 z( e0 U& z8 `, J' j

  81.   l( D+ P2 X- u! Z: r
  82. module_param(acnt, int, S_IRUGO);
    ( s" A1 b% i8 s5 |
  83. module_param(bcnt, int, S_IRUGO);# T2 Q& n4 W  p! S9 `+ v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  Q2 \. N- \  L4 e" l* X# \& e) Z

5 s, ~6 y7 z: f5 ?: \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  a% Y6 L/ y5 r: p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' ?' F% M$ `3 c0 Q" I* W5 W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( p: [- Z0 E/ Y& h, l) m1 ]
# E; S8 e5 L7 l/ c. c/ D

- G5 G1 N" U  v5 g# c2 d4 A9 R0 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-10 17:45 , Processed in 0.038586 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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