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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 }7 [. q" w3 O6 U" b
  1. [code]EDMA sample test application/ W- j! n: B2 S6 z
  2. /*8 d, [2 ], u9 \' z' c* w
  3. * edma_test.c
    - Y# Z, H# v+ f6 _- P, G
  4. *
    ! E: A4 j" b$ r  b6 F
  5. * brief  EDMA3 Test Application
    ( I: y8 e; i0 ?
  6. *
    ) f3 p( K/ n7 u/ ]1 W
  7. *   This file contains EDMA3 Test code.* S+ X4 |& u& l# L& D9 W" |/ U- _
  8. *) N$ t+ z! U$ N# Z; }1 C, n6 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ J  s& ^3 m/ @4 F% ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; Q$ j# @& l) ?0 k5 v
  11. *         TO CHANGE.
    2 H( j8 u- l8 Q4 C5 k
  12. *' M  u3 P+ {, d) P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 @  f( R7 B; n) R8 f! g9 w
  14. *; U9 M" l! ]' p# p) c
  15. * This program is free software; you can redistribute it and/or
    1 a9 V$ R3 a8 y7 l+ A
  16. * modify it under the terms of the GNU General Public License as$ M7 e9 C* ?  _
  17. * published by the Free Software Foundation version 2.
    # X. Y- h* u" p/ q% h" z
  18. *8 k6 y  P0 ^" ?! H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( [. u) @/ s, Y: q( E1 k
  20. * kind, whether express or implied; without even the implied warranty9 D, T6 f! m7 S: R) e3 i8 d- ^  @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / h+ }6 E/ @, N9 M
  22. * GNU General Public License for more details.
    & p  }- ?; A0 @: u
  23. */$ I, [  {& M. \

  24. 7 r2 s& j) t- D$ V$ a8 j! O3 L
  25. #include <linux/module.h>
    % Q! ?  k  A5 v6 b4 U0 p  g
  26. #include <linux/init.h>
    / v: k( t* ]/ o
  27. #include <linux/errno.h>
    : g. ~: E( U' B0 A: z: H, c" U4 U
  28. #include <linux/types.h>
    5 p" n& W( w2 q% |% y" w5 s7 o
  29. #include <linux/interrupt.h>
    / r# n& l3 O  Z& T- r
  30. #include <asm/io.h>  e1 k3 d" Z# S" D% [( Q- c+ k
  31. #include <linux/moduleparam.h>
    2 R. y9 W  \2 i  e3 [! L
  32. #include <linux/sysctl.h># g1 {+ r1 x4 e2 ?( V
  33. #include <linux/mm.h>0 e2 I0 j: @" t. `( c  q* D
  34. #include <linux/dma-mapping.h>
    6 \8 [' X: v8 X* q4 X

  35. 8 }7 a% g6 s) I7 w1 L/ f4 z
  36. #include <mach/memory.h>6 Q3 ?  l9 |7 d2 p/ C0 k
  37. #include <mach/hardware.h>
    4 D# @4 i3 u- m4 c
  38. #include <mach/irqs.h>
    5 \' A, u$ @* J/ e2 L
  39. #include <asm/hardware/edma.h>. \) y' I; i! @0 M: g; A: |
  40. 8 j8 W8 Y% U- E
  41. #undef EDMA3_DEBUG8 i) o! u* d0 T" [
  42. /*#define EDMA3_DEBUG*/5 q0 Z' {# z) o- P4 J

  43. % E4 ?% Q. I; G/ \* a
  44. #ifdef EDMA3_DEBUG& X9 S2 M5 f; d( z; \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 g7 U+ S7 V9 R) g( e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % l# Q- z) W; R( ?; a$ t! k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # r. L3 t) m) r7 Y
  48. #else% b% @5 k' P" D* P. n
  49. #define DMA_PRINTK( x... ): H  R; [* k1 g) h. C! u
  50. #define DMA_FN_IN
    7 m$ ~* ]2 t9 J3 V( X2 F
  51. #define DMA_FN_OUT
    & n! M" }$ A% |" D# c0 p$ N
  52. #endif
    6 [/ p) H# m# }9 X; T5 P' F

  53. - |8 C/ l5 K' A8 f6 f* ?. y' Q3 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : s$ R9 n: t0 h% b: C9 {
  55. #define STATIC_SHIFT                3  ?( R; N- ?3 [% N- Q4 b
  56. #define TCINTEN_SHIFT               206 x0 d4 Y" P( `/ j
  57. #define ITCINTEN_SHIFT              21
    " r6 R% ]& e8 s2 L+ t  V
  58. #define TCCHEN_SHIFT                227 ]2 N. c& z5 m( I' i! D
  59. #define ITCCHEN_SHIFT               23
    - r3 |3 K# P/ O- \9 [

  60. 2 Q! q& A" [# X# d- i- q3 k
  61. static volatile int irqraised1 = 0;
    3 a/ C+ U. ^. V- q
  62. static volatile int irqraised2 = 0;
    : d) R  L6 S" V9 A; n0 y. O" O

  63. ! E" ~& `  {2 a# u( O/ h. _+ N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 e+ D& G8 @* x# x$ [8 D! ?3 P1 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 ?, x7 h, N/ N4 s+ X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / F% ]1 Q+ O4 p
  67. ' C3 Z- p- d7 G! A8 k
  68. dma_addr_t dmaphyssrc1 = 0;2 M8 q1 a3 _% g4 W1 F. `
  69. dma_addr_t dmaphyssrc2 = 0;
    8 v9 F" y. |* \" ?
  70. dma_addr_t dmaphysdest1 = 0;
    5 g# R0 I/ K9 g9 s$ w1 i' Y6 H% ?
  71. dma_addr_t dmaphysdest2 = 0;- h+ E+ t5 a4 O2 l
  72. " _7 g' M9 c5 n7 B" A
  73. char *dmabufsrc1 = NULL;
    9 R6 x( o( H) O: l8 s3 t1 U
  74. char *dmabufsrc2 = NULL;
    $ J. q9 u; v. {- L" ~
  75. char *dmabufdest1 = NULL;- L' D5 r4 C% I9 ?, X/ O. V
  76. char *dmabufdest2 = NULL;. O3 h; y  x/ v, |
  77. " E8 N" H: v+ _! b: s, ?# B
  78. static int acnt = 512;
    + J  o' M1 ~" [/ G/ C
  79. static int bcnt = 8;
    & Q7 C4 b3 }6 V- L3 w/ f5 U
  80. static int ccnt = 8;$ p5 b" v! K% k9 P# {
  81. 3 l) k7 g' o; }- z% B0 Q
  82. module_param(acnt, int, S_IRUGO);
    % T" B2 |* `* n2 s/ P% H
  83. module_param(bcnt, int, S_IRUGO);
    6 _( `6 y7 h/ D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( Z0 W( {$ I7 E2 O. \2 i1 ]0 U
0 k1 e# \- U: U5 A: r7 l5 v& ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% K: s$ O" y3 j8 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. _6 K6 A* x7 j- `- {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* [% b( E" r2 @$ y! ?
" ~% V, |( E0 |) b! q4 o+ ~

6 _3 @, E' O. b; [; V" h9 ?# T: U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 04:35 , Processed in 0.040287 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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