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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% I9 Z. x9 V6 ~1 u" S3 R1 J
  1. [code]EDMA sample test application
      `; A" v& s" c  L! c% G
  2. /*6 c& P1 |6 ~& k
  3. * edma_test.c
    4 D  a3 P2 \4 o! X/ H: T/ M3 h
  4. *& O6 `( b) B3 N* A4 _! H
  5. * brief  EDMA3 Test Application5 t' P# r; h$ o' c  `* ^
  6. *) }; W9 s1 J& ]
  7. *   This file contains EDMA3 Test code.
    " W! ?' A. y% e7 b/ |8 T: B
  8. *+ Q% }# _: O" E- p' ~5 W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 C# D9 m, z4 y4 j: f) h2 u* P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & g5 N- i1 z' ^
  11. *         TO CHANGE.7 m, u; H% w- `. Z
  12. *
    5 z& a8 e- n4 R7 b" `; x, z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 w3 w: @/ j' W$ A- U: \
  14. *) R" B8 L' y! i
  15. * This program is free software; you can redistribute it and/or
    8 j& R3 U" |1 i' G! x
  16. * modify it under the terms of the GNU General Public License as
    5 m& \& u" w% A8 J# V6 m5 m
  17. * published by the Free Software Foundation version 2.8 c+ b( ?* B4 B& l- w
  18. *
    % p7 e5 \* c. a$ X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' x1 a6 R4 C0 M# n$ E( Y/ A0 L$ v
  20. * kind, whether express or implied; without even the implied warranty
    * K" {/ V# n" ^6 ?' U# `& e# Q) _0 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 N4 D: |5 c5 S( a4 W/ I
  22. * GNU General Public License for more details.
    % G0 f- `9 V5 ]! P$ g" l- D9 d
  23. */* u, _7 K; @/ U
  24. 1 ^* Z" o% y+ }* X8 n, W0 [
  25. #include <linux/module.h># X! b8 L5 E3 I/ [% i! o+ d7 T' z9 ?
  26. #include <linux/init.h>
    - \" K4 F- O, T- ^! j, E
  27. #include <linux/errno.h>' E8 L* A2 g. v. f. ?4 o* A5 A" P
  28. #include <linux/types.h>; s  i0 d& Y/ a: A" U3 s
  29. #include <linux/interrupt.h>' e9 C5 ?5 M( _
  30. #include <asm/io.h>* _7 c! }# m& u) ]# s; T3 ]
  31. #include <linux/moduleparam.h>, [1 \9 }! I: s4 M8 J; @
  32. #include <linux/sysctl.h>
    ' e6 e0 r. s6 U+ R
  33. #include <linux/mm.h>
    9 i4 M1 R: e  @* D- ]; I
  34. #include <linux/dma-mapping.h>
    ( M( s/ \/ L% S4 D
  35. 9 e9 P- c0 Y7 ^& Y9 B' v% ?3 c+ l+ p
  36. #include <mach/memory.h># t( U* i3 X5 V7 \, O( c4 A
  37. #include <mach/hardware.h>* r- q! d' ?, K# v: U  X3 [; n
  38. #include <mach/irqs.h>
    + M, ]* `3 W# f% y
  39. #include <asm/hardware/edma.h>
    4 Z  k6 v, h  H! S4 M

  40. , `6 F- v0 T3 T
  41. #undef EDMA3_DEBUG9 H  Q. U/ Z) H* H
  42. /*#define EDMA3_DEBUG*/
    % g7 d' a& e: J7 M) u" b( {1 s+ F: z

  43. # I4 J" y) C* K) K% s- w; T
  44. #ifdef EDMA3_DEBUG
    * ]# r" {8 Q  |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " B- q! P4 s  N7 n8 D8 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; g2 R% h: ?) j& n1 M% a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); G$ Z) K9 j" N/ G5 G# n
  48. #else& r) z- p/ j; I* I4 c2 W
  49. #define DMA_PRINTK( x... )" e& l( g  K+ ?$ @) f
  50. #define DMA_FN_IN& i& g( q, B* |, D( L  v/ q! `1 y
  51. #define DMA_FN_OUT
    , j' ?' x# z9 V+ p0 E1 l9 }* O% [
  52. #endif2 b  r- X' J" z: l6 c

  53. & q) q& x3 M+ u2 o2 J+ w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): t$ q( N3 j) N0 A7 A5 p8 V
  55. #define STATIC_SHIFT                3
    6 L- R+ q% f7 V' s! V# T
  56. #define TCINTEN_SHIFT               20
    ! \" `7 L$ i9 C8 Z2 r. ?
  57. #define ITCINTEN_SHIFT              21
    9 G& \8 F/ y* t9 g& o
  58. #define TCCHEN_SHIFT                22: w, _: r3 R3 q& |* L8 X2 ?
  59. #define ITCCHEN_SHIFT               23
    % h4 l0 p, x. D0 D% _
  60. . u' d# F! ?- p5 E: p9 R1 W
  61. static volatile int irqraised1 = 0;
    6 F. v4 Y) _7 L
  62. static volatile int irqraised2 = 0;& v# B1 a+ }8 k* s5 C+ d. \

  63. : b/ i, c* ?& t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ S  S: R5 V/ A  X1 s7 L$ |6 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 Q0 `" R5 d( `- V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 s3 J/ M0 E  p9 F( K$ r
  67. 7 P7 k6 q2 j( F. ~+ ]
  68. dma_addr_t dmaphyssrc1 = 0;
    - w; d$ D; E$ a3 [& m9 m) V
  69. dma_addr_t dmaphyssrc2 = 0;
    : I+ K- ^* |# W! x' S" \2 l
  70. dma_addr_t dmaphysdest1 = 0;; O2 x' b/ m5 F( r' I& R3 H
  71. dma_addr_t dmaphysdest2 = 0;
    , j9 i9 ~1 d! g4 N+ F  y7 J

  72. 4 [$ r* s: O! J( }7 s
  73. char *dmabufsrc1 = NULL;
    # L9 @$ v8 Q) r! y
  74. char *dmabufsrc2 = NULL;
    8 R* e( B3 j/ j
  75. char *dmabufdest1 = NULL;
    & e( o) \  i' D4 {8 l4 h  m
  76. char *dmabufdest2 = NULL;
    ( n9 D! [: z! I
  77. ( R' u, R2 m, z& t2 e9 v
  78. static int acnt = 512;
    8 f+ x! p; o$ D4 B* s( U- a( e
  79. static int bcnt = 8;% i& x/ ~* B5 K9 ^! ^
  80. static int ccnt = 8;
    ! Y% k, P9 E7 P0 S4 d+ C- F: B
  81. : T7 N  G5 c# q; D+ X* x
  82. module_param(acnt, int, S_IRUGO);& O2 ~( ]7 N# W
  83. module_param(bcnt, int, S_IRUGO);
    ; j1 q/ Y8 T# \! _( V9 D0 |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 J, z: T- {8 B& F' D5 m( c
- f! ]  G3 D0 J( v' w- X6 S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- V4 p: l  t. [5 a' z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ q' P3 W' L  B9 m8 X; R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 q8 l5 g* _7 g! Y  {; m
9 O% U% G( s" u* J' l4 X
/ x# s/ K6 m/ W. ]& x/ U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 22:38 , Processed in 0.040075 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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