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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 t! f) Q3 A& U. j7 |. I7 p2 }8 W
  1. [code]EDMA sample test application, D' E7 m; p# k3 ?( i$ J
  2. /*
    2 ?! W$ N6 w% b0 A% u9 a  k1 X
  3. * edma_test.c' q# G# f( T& z% ~1 b; |) A! z
  4. *5 N! u9 A4 E) T- o/ G/ a$ U
  5. * brief  EDMA3 Test Application
    ) ]; C1 k/ `# f2 X; t$ }  k$ F( Y
  6. *- }8 K& T# @; W; b
  7. *   This file contains EDMA3 Test code.
    9 u5 k: |7 H; G( ^% W8 r- E5 E
  8. *& [6 a( m/ d! S* A, _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " f2 P0 I, F/ V/ ^5 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- i4 @0 O7 w) J- G1 ^
  11. *         TO CHANGE.7 {7 E, }2 H0 e
  12. *
    * r! `; U: C0 W' ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % I. S$ `7 B$ I" q
  14. *
    . f! w9 {- ?6 F) }4 q! J
  15. * This program is free software; you can redistribute it and/or. a# K- i) b# U$ R9 C' Z
  16. * modify it under the terms of the GNU General Public License as& u: S6 E# i4 X* r
  17. * published by the Free Software Foundation version 2.
    & L7 q# }9 @6 V3 Q: p. p) q
  18. *
    % ]7 J) f2 {1 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' g  d% x" s0 l+ J+ S3 J" I
  20. * kind, whether express or implied; without even the implied warranty
    4 U2 \9 k4 u+ I6 ]; B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) h: _" L7 P. p$ v7 z: n
  22. * GNU General Public License for more details.' m/ p, G  O! |, O; f
  23. */
    $ i/ f% B! Q2 {* N) D
  24. 4 r  V& ]  _$ d* Q0 ?( U
  25. #include <linux/module.h>
    . {) G0 K. a; `  Y& u  R! t+ [
  26. #include <linux/init.h>
    5 b( B) ^; t2 P8 T) |
  27. #include <linux/errno.h>
    # p3 v; U% o3 [) M3 ^2 M  C- J
  28. #include <linux/types.h>$ @  M( b' ^! I
  29. #include <linux/interrupt.h>! u( R  b6 [  s, x  `. z# B! K4 Q
  30. #include <asm/io.h>% l& ~, y. A& m# l# B$ i( y$ q6 [& n
  31. #include <linux/moduleparam.h>6 b$ d5 ~0 h( i$ R# c; U/ y2 c) E
  32. #include <linux/sysctl.h>& V5 I8 q$ p# F
  33. #include <linux/mm.h>
    ; N3 ~! W, y- }2 n! q! d9 x
  34. #include <linux/dma-mapping.h>
    ( {4 N- ]) Y6 @" s% l
  35. : P. r$ ?& V; T( z* v9 W' F
  36. #include <mach/memory.h>
    - G. [) O& g/ u" N
  37. #include <mach/hardware.h>
    / C' N6 S+ b3 ^- G) @; {4 a" G
  38. #include <mach/irqs.h>
    0 m8 D7 b% S( Q$ `0 q8 _% x& w3 Y' _
  39. #include <asm/hardware/edma.h>, j9 b' O4 D" k0 Y8 m& Z
  40. 5 \% \% G3 X% K) J$ w
  41. #undef EDMA3_DEBUG
    ' l$ x/ s0 ~4 U3 j: Q
  42. /*#define EDMA3_DEBUG*/8 C7 d" t4 X( h& i5 H2 H# j
  43. ! e6 z4 B( k9 y) J2 _1 T7 n  E
  44. #ifdef EDMA3_DEBUG6 k4 M6 U6 A5 S( N8 ~9 n; Z8 p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 k) L: @1 v4 ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : Y5 ]# Z- e3 X% _% X0 U8 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # n: W8 s- U- J, L
  48. #else3 k* k4 l4 l' E
  49. #define DMA_PRINTK( x... )
    8 Q3 ~6 e) ^( z' R1 M
  50. #define DMA_FN_IN
    1 u2 D8 ^8 ?& p! C
  51. #define DMA_FN_OUT: w( r  S5 l/ p7 l
  52. #endif) N2 }% Q' m0 R' \$ ~" }
  53. 9 i4 `+ ~2 c. e& |/ S+ c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # X9 ^! ]3 l/ K% M4 j! v  y
  55. #define STATIC_SHIFT                3$ ]  s" ~& D" ]
  56. #define TCINTEN_SHIFT               20
    . {/ ?1 w7 O% h/ T
  57. #define ITCINTEN_SHIFT              21% Y1 n& w. \; ]. R7 y" D
  58. #define TCCHEN_SHIFT                224 ]/ s$ e& G4 |; B% [3 ]2 P4 l
  59. #define ITCCHEN_SHIFT               23% s$ F+ x$ l& Z# s, I

  60. ( v" ~5 b) k( {6 |7 f* F+ T7 j
  61. static volatile int irqraised1 = 0;9 [1 O) l" h: \6 f* ^
  62. static volatile int irqraised2 = 0;8 U& b* c7 p5 n: v
  63. ! e3 i: [- r( m, g6 \8 ~& v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. }% l, @6 u( F4 t9 i# V/ X* P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 P: S( V* v( p9 v% F) E; i* j- [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 c; z0 l8 C- s

  67. . Q. y  x/ N: T: g( R7 [8 A/ G
  68. dma_addr_t dmaphyssrc1 = 0;! g+ K+ e$ c( ]1 L' W+ `6 x
  69. dma_addr_t dmaphyssrc2 = 0;
    3 G- f6 A; z; T3 P
  70. dma_addr_t dmaphysdest1 = 0;6 h7 r; q9 F# V' P* j/ p
  71. dma_addr_t dmaphysdest2 = 0;
    ; S' ]  \! B2 t, D, m2 _* k; g8 H
  72. / _* P, T' K! @, O% K$ u
  73. char *dmabufsrc1 = NULL;: F% I4 F5 {3 x5 F: H" O& U9 v. x2 I
  74. char *dmabufsrc2 = NULL;) y' y5 N) l8 z6 q: s% f" y
  75. char *dmabufdest1 = NULL;/ W' t7 I' }7 s& d4 a: ?4 V( v
  76. char *dmabufdest2 = NULL;: J# _! O# {, K: Z6 q4 Q* K' \
  77. ; E% _) J% K( c/ H5 k* u7 @
  78. static int acnt = 512;" }. [$ ^& o% w  n& v
  79. static int bcnt = 8;  z' F! V4 f3 y9 g3 j* X
  80. static int ccnt = 8;
    ; V' Y( l% x- H2 T0 r
  81. + \& E( w( t7 x
  82. module_param(acnt, int, S_IRUGO);
    6 \% \1 z: D8 Z$ _5 m' ^3 v
  83. module_param(bcnt, int, S_IRUGO);
    , n  {6 U# Q' C1 B& E6 k8 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 f7 a1 ]  J: s* U5 W6 p, z* Z6 X0 j+ J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 ^5 j  r( T6 T! `+ x8 I1 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# D6 I; L3 k& \* s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 \! A& T, c5 F* p0 q0 T' T

! O$ h& ]) E% t! b$ g+ A  a9 A" P. N
1 ^3 h$ c9 f% M8 v* o! U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 00:31 , Processed in 0.042213 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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