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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 |2 {6 F% }$ E% f; k
  1. [code]EDMA sample test application7 H9 S; v& J' M* j5 d/ _
  2. /*8 |* D- {: d7 f
  3. * edma_test.c7 K" P5 p+ }+ b  N
  4. *
    * X- ]+ o9 T- G. d- u
  5. * brief  EDMA3 Test Application
    , p1 H0 Y4 I8 {' y
  6. *
    8 [& d6 ~* z4 ^
  7. *   This file contains EDMA3 Test code.+ D6 n, J( p6 m( m( ~
  8. *
    9 l6 C$ _& H2 f  ~9 \/ u5 U/ m( @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      F4 ~! r; `! n1 g% ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 K9 a& M8 p# c4 @1 M4 q
  11. *         TO CHANGE.6 I3 ?& f' [2 u* C; D% V
  12. *
    ! t: S9 b& s, ^  a( R8 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 Y* V: E$ R2 U2 q& O7 a! ]
  14. *7 u! v) b9 g* X3 A7 g
  15. * This program is free software; you can redistribute it and/or' l! i5 x# |' v7 }9 f
  16. * modify it under the terms of the GNU General Public License as
    ( T* }7 Y% P* i( `  r
  17. * published by the Free Software Foundation version 2.
    , u( _9 w% B2 }) r: [
  18. *# b1 D6 V! q$ O) z% Z, D0 ^. e4 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 `( f) k9 Y7 P/ ^6 i! `+ a2 _1 C
  20. * kind, whether express or implied; without even the implied warranty
    - N9 s# r9 x8 \  o$ B+ B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - Q* v; P- ]$ x4 ^3 m2 v; k
  22. * GNU General Public License for more details.
    $ H% ^3 ]9 ?1 \; d
  23. */+ ?  S6 X" ?6 j$ s- l1 O- K7 r, Q. G
  24. / |( Q5 \. V. g
  25. #include <linux/module.h>
    - f3 s; g  p4 ^) S- ~
  26. #include <linux/init.h># q* `3 X! X! o: ]
  27. #include <linux/errno.h>
    1 ^/ }! F1 S7 h. o
  28. #include <linux/types.h>$ C3 S  N1 U3 d5 ]2 ?. I6 H
  29. #include <linux/interrupt.h>  q& v$ l! G1 j) |% u2 t/ C
  30. #include <asm/io.h>
    % {) _) I* q6 ?2 y6 M) `7 ]1 q
  31. #include <linux/moduleparam.h>
    * @1 ^9 `# b" r' G9 I
  32. #include <linux/sysctl.h>9 B+ l( ^) ^! c( |
  33. #include <linux/mm.h>
      D/ U4 C" {0 S" n# N# z  j/ z
  34. #include <linux/dma-mapping.h>& r. y9 ^/ z  H5 x

  35. : u9 l3 x3 }: z: O! C) X2 |5 @
  36. #include <mach/memory.h>4 ?2 c1 }2 b4 I
  37. #include <mach/hardware.h>
    6 P2 ?- h5 r/ h3 }, W+ Q
  38. #include <mach/irqs.h>9 K! T% Q9 D" W) R6 E
  39. #include <asm/hardware/edma.h>
    - t/ O! @7 Q4 U  I, X3 }7 Y6 R
  40. . ]8 x1 E, |% C! f5 n& n; G+ X
  41. #undef EDMA3_DEBUG
    + @+ E2 R% d/ l" L" x4 P
  42. /*#define EDMA3_DEBUG*/9 z/ L; V# @( O6 B
  43. . e5 G8 N" K5 B+ O- J2 _3 }
  44. #ifdef EDMA3_DEBUG
    0 R- t" n; J) k# z+ G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! X" F; b; R8 b6 t6 h; k7 E6 ^$ q+ g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& m7 b4 G2 v' l  m2 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 I; F3 w  n& W
  48. #else
    ( w' r5 f" }; K% V
  49. #define DMA_PRINTK( x... )
    / T% t7 ^$ w7 T0 Q! Z0 e1 n2 b6 \
  50. #define DMA_FN_IN
    5 c+ a% F+ B! S* h& [( O" {# B  ?
  51. #define DMA_FN_OUT
    ' s- a7 D. G  j. d8 o
  52. #endif& s4 @: [6 K2 [$ U- O) Z6 L

  53. 3 a% b' Q0 W' Z5 }0 H# j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; t( R* |" F8 Y2 D& p6 T
  55. #define STATIC_SHIFT                3
    2 H1 |7 o- }$ L) w
  56. #define TCINTEN_SHIFT               20* u# ^2 ?4 R7 A" \! q, a
  57. #define ITCINTEN_SHIFT              21: z' _5 N0 C. o; Z. U, ?
  58. #define TCCHEN_SHIFT                22
    6 }* S: C& b3 q% ^
  59. #define ITCCHEN_SHIFT               23( e7 ?* S  E6 t* m* S1 u
  60. 5 o( K& Q4 r2 @3 Q
  61. static volatile int irqraised1 = 0;
    , @, w% q  U! Y0 ~# i
  62. static volatile int irqraised2 = 0;* k& s* O1 U6 C

  63. 4 Q0 v+ d$ Y( G7 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ g1 ?: }+ h9 q& E6 b! V* ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( j% E1 D7 w7 {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, d7 ^: x0 _- f

  67. . K9 i' |: Y- X6 ?1 r2 K9 }2 m: c
  68. dma_addr_t dmaphyssrc1 = 0;
    6 b( ]3 Z3 U: _4 ?/ j, V5 c9 I
  69. dma_addr_t dmaphyssrc2 = 0;
    : S9 l+ d* a, e
  70. dma_addr_t dmaphysdest1 = 0;- L* D( r4 G6 @$ [  Z
  71. dma_addr_t dmaphysdest2 = 0;
    ; y. }% U1 M4 h; G5 c

  72. 3 z, r, m0 @) `8 D
  73. char *dmabufsrc1 = NULL;3 L) V' E4 E0 X' ]4 U3 e
  74. char *dmabufsrc2 = NULL;
    + k1 p& z( R" k0 Z) e
  75. char *dmabufdest1 = NULL;- B/ a& g% _$ L8 w) x
  76. char *dmabufdest2 = NULL;
    " o5 _' W. h1 Y* g+ M1 R
  77. ( g$ G$ X0 }7 @- V. K
  78. static int acnt = 512;
    8 o& M" X- s9 k0 L" g+ j
  79. static int bcnt = 8;
    5 |' }: h( ]! ~# F9 _8 N- p& }8 s: A+ \
  80. static int ccnt = 8;( n6 ^6 f! z7 w& T7 z  a- @
  81.   j! I- w) n4 `% \1 W8 t. a4 {
  82. module_param(acnt, int, S_IRUGO);
    ' C/ _% J- Q# \4 h
  83. module_param(bcnt, int, S_IRUGO);0 A, Q4 O( ?0 ~) R6 c7 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( T- o* Z( G$ y
/ e1 Y, Q4 _8 \, H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( U; N3 u) b' w, _% ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 S7 O; A* z) Y& r6 R. Q# P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# g$ \; w. u3 {7 J5 n
1 m8 ?* g0 a/ B2 b

  C/ X# ]. j/ b  N% j# l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 16:07 , Processed in 0.048444 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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