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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 M  d  D! J5 J5 O# V
  1. [code]EDMA sample test application+ t! {5 H; Z; ^/ ?% l1 k& O$ M
  2. /*$ {* z+ B5 ~& h. a4 z1 S5 \8 z- L1 ?
  3. * edma_test.c2 u: v4 u, @/ M' ]
  4. *# w( E6 G# L+ M9 J! G
  5. * brief  EDMA3 Test Application* ~0 Q$ l- a) V2 K
  6. *. r9 {% p3 x6 m- U
  7. *   This file contains EDMA3 Test code.
    6 y: M+ j0 C; h* X( w/ Q
  8. *3 Y, w* l. H% Q( r6 t+ g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 e+ z2 r, u/ J' e( [. D! [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % S% Y) n; v* p( `2 [! I$ T4 f
  11. *         TO CHANGE.
    : g7 p* e' ^4 |' g$ V' b1 |
  12. *
    : W3 p2 X2 f" S. ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / T% }# _/ u5 W
  14. *8 c9 B; x2 h# a7 g  E% m5 }% \, n
  15. * This program is free software; you can redistribute it and/or+ K+ d: Q, }, P7 c( Y
  16. * modify it under the terms of the GNU General Public License as
    : e0 h0 ]% X7 v% k7 J4 p2 f
  17. * published by the Free Software Foundation version 2.: p6 h7 g# v6 a: w( o1 J
  18. *6 ?5 ?- h: W4 S  j2 C" |( q+ B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- T( z, B4 B0 G& X/ X+ x9 v
  20. * kind, whether express or implied; without even the implied warranty1 m& C: A" v# c+ l) S/ S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 ?0 e! r. ^; `2 B0 m' v; n% k/ n7 j
  22. * GNU General Public License for more details.
    2 v2 F  W- Y7 M
  23. */
    ) `$ S% \+ M. S- j
  24. ( _, W9 N: `1 \( A7 O/ {9 o
  25. #include <linux/module.h>
    8 ^& c8 Q& V( L7 R0 w
  26. #include <linux/init.h>
      P5 W. [+ Y  r4 p
  27. #include <linux/errno.h>  g, s7 X+ o4 Y8 g6 m: D
  28. #include <linux/types.h>
    ; U- }7 Y' @& [3 x' J* M: p
  29. #include <linux/interrupt.h>9 {2 v( D, B$ L- `5 `
  30. #include <asm/io.h>% U  j9 u! K( a" ?8 f
  31. #include <linux/moduleparam.h>5 O# B3 ~/ y- D/ n6 f  _
  32. #include <linux/sysctl.h>
      }' ?/ o) K( g+ {' `
  33. #include <linux/mm.h>, z/ z6 a& Z- i' L, b
  34. #include <linux/dma-mapping.h>
    * }' k$ z8 w$ J( |
  35. 4 |4 g$ W: b6 a
  36. #include <mach/memory.h>
    8 u( s( h' G  f; Q
  37. #include <mach/hardware.h>
    $ }' D8 ]& K* j4 q
  38. #include <mach/irqs.h>
    * k! X. N% g) v9 H3 [: p  k
  39. #include <asm/hardware/edma.h>
    * ?' v5 n) f% ~. L( U0 |
  40. 7 s, c& O/ h4 A: a, [6 r* f& L
  41. #undef EDMA3_DEBUG& P8 u9 y  A7 s: ?3 P$ M& o
  42. /*#define EDMA3_DEBUG*/
    4 B( A7 Y7 E1 z

  43. ' j+ ^. x6 n& K1 }+ B9 O  {2 H
  44. #ifdef EDMA3_DEBUG! ~3 E; D8 W  {0 t1 `9 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 A% G0 B& @% U7 A& L. u6 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( \7 H+ p( m6 r! I: s! @" a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 I  I1 j0 i! f5 q% T) E
  48. #else* y; g$ o" J( o" O' O
  49. #define DMA_PRINTK( x... )0 G8 |" M* Q! m- }1 D
  50. #define DMA_FN_IN
    " G5 ]( m3 v9 _8 \( o( G3 o
  51. #define DMA_FN_OUT* ?$ @3 m/ e, w
  52. #endif
    7 ]( H( b1 R; {/ ?" ?9 ~1 a

  53. 8 `  v" M" Y6 {9 t- c. z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 i" P& ], P. O. P4 k6 v& \) D8 @
  55. #define STATIC_SHIFT                32 q5 s: g% u5 z6 E
  56. #define TCINTEN_SHIFT               20
    $ x+ U) R1 ]# R9 |0 I6 m8 f
  57. #define ITCINTEN_SHIFT              21
    - s: F) S6 V  K- S. y
  58. #define TCCHEN_SHIFT                22
    $ h7 T4 |& i  e4 }
  59. #define ITCCHEN_SHIFT               23
    6 e& a, B5 w* ]1 F& o
  60. 1 u7 U# ^  s2 @+ d7 z' l
  61. static volatile int irqraised1 = 0;
    $ c  P% s' _" I
  62. static volatile int irqraised2 = 0;/ _5 Q$ \+ W+ J2 y& o

  63. 1 c& y" z* m( d, H+ \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 P# G( M. l+ Q- G# c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # W7 ~4 v9 A3 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ k( E  W* k, Q& E- O4 q1 Z5 p
  67. $ a  L# g) [( c( t9 k) @
  68. dma_addr_t dmaphyssrc1 = 0;2 T+ m8 {+ G( a- t9 t0 H
  69. dma_addr_t dmaphyssrc2 = 0;  p; R8 _+ i) @0 G' \
  70. dma_addr_t dmaphysdest1 = 0;3 B& j: H# t  N. ~
  71. dma_addr_t dmaphysdest2 = 0;
    ! [+ m" A. A0 ^; F
  72. + @' M% f" e0 f  C9 T. ~' [3 }
  73. char *dmabufsrc1 = NULL;& n  o1 I; l) O/ i! ]
  74. char *dmabufsrc2 = NULL;* o' ?9 ?9 h1 W" y
  75. char *dmabufdest1 = NULL;: p* Q: s) n3 w- Q2 a- G6 ]
  76. char *dmabufdest2 = NULL;
    8 l7 n' K$ N6 a% }6 `# [. t5 w8 Y; P

  77. - L4 U5 \; T  V9 y! r2 D
  78. static int acnt = 512;: `! b5 _0 R1 m5 Q0 H% u2 W
  79. static int bcnt = 8;
    9 }5 K( ?; g7 W5 y! A" R4 J
  80. static int ccnt = 8;2 x, U" l5 K7 D3 y5 Q" U8 w
  81.   z( R6 _4 e0 P
  82. module_param(acnt, int, S_IRUGO);
    5 T" a/ ?/ R! @) _  F
  83. module_param(bcnt, int, S_IRUGO);
    % \( a+ H) i/ c) J9 U$ ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. S- s2 l( M2 F- n; E% j" t% F$ ]% u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 k; z2 W% A0 C. l- ]7 h1 _% J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% T( x! i  l* S  G. u/ C* q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 g! a2 Y$ ^! G9 l. Q4 T  h
6 _& S% w7 a" J! ]$ d

( L9 ]' e9 F4 L; j' U; w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 02:27 , Processed in 0.039372 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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