OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- ^2 g0 l2 E1 y: s( W
  1. [code]EDMA sample test application
    $ m. d/ Z% J3 c) X9 p$ ]
  2. /*0 W3 x3 L; s8 o5 f4 G' I3 X; I
  3. * edma_test.c
    . C+ [$ @3 T. W  Y9 S2 @: Z  l
  4. *
    8 U6 T8 u/ j$ o* M. E
  5. * brief  EDMA3 Test Application
    , J, B! e  H! N4 q* G
  6. *
    3 L7 {0 V; S6 S0 S# _1 k
  7. *   This file contains EDMA3 Test code.
    $ S" J" Y/ n1 Z$ [/ X- ?  U: ^
  8. *0 n3 G. k. r& W. l) j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 e5 W4 u7 u8 }8 H! I& d0 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% L" _* u9 R. u! L
  11. *         TO CHANGE.7 f8 ?! I7 V2 f1 d$ v1 X. X$ V
  12. *
    " ?, P5 x" ^* |' S2 E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + d! w$ H3 q+ ?( l# B3 U
  14. *
    , \& ]6 S. ^: r7 U+ O
  15. * This program is free software; you can redistribute it and/or: i0 j# R9 A4 [' M
  16. * modify it under the terms of the GNU General Public License as
    1 y" W" {% ]  Y0 R& W$ L# m
  17. * published by the Free Software Foundation version 2.) o, Y% h4 k3 L0 b! z. D" C
  18. *- f1 X  y4 W4 K9 b1 }) S3 ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 C, k7 \" U6 W1 X, ~8 f( x2 ^% F
  20. * kind, whether express or implied; without even the implied warranty) P! G# ?& B+ S# e3 X7 y9 _$ I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 T8 e; I$ Z' k) M: t2 l
  22. * GNU General Public License for more details.
    0 r" @- g! e2 x' I& K$ q& ^4 v
  23. */8 F+ ]$ E# q" R* A& S! z+ K7 q" D3 D

  24. ( j: |( y. f7 f' v# l2 l0 |
  25. #include <linux/module.h># p$ `1 q3 l  ~4 m/ @; \
  26. #include <linux/init.h>
    - U# y& K% K5 U  V
  27. #include <linux/errno.h>
    9 F: h. K1 s( @. ~% q
  28. #include <linux/types.h>
    6 V  o6 Z* B6 u8 o% S% d) o
  29. #include <linux/interrupt.h>" s) Z' G1 |" t/ l% G6 y2 e& |
  30. #include <asm/io.h>
      ^# ]9 W/ f0 p- @6 m6 [% N6 h6 ~7 E
  31. #include <linux/moduleparam.h>) D3 a! N( Z* M( D: V6 |/ V# W
  32. #include <linux/sysctl.h>; s6 U' P6 o# c) @, B+ C5 T" |
  33. #include <linux/mm.h>+ p7 y  o2 N8 M0 D$ @
  34. #include <linux/dma-mapping.h>
    & ?; }  C' M3 E& X' V7 P. g' M
  35. 1 l1 a: P1 B0 z$ }
  36. #include <mach/memory.h>
    ; W6 W" U8 S& Z  G  w7 L7 K( N
  37. #include <mach/hardware.h>6 @3 O1 I3 E2 c) O* Y: u4 F  e* O
  38. #include <mach/irqs.h>
    , }0 E7 C( Y- p
  39. #include <asm/hardware/edma.h>' y4 I2 T! E$ ?1 y
  40. / o! `7 O( H, ?# m4 t, r" m/ {) B" |
  41. #undef EDMA3_DEBUG
    ( I# Y) A0 S( k/ t4 `) Z
  42. /*#define EDMA3_DEBUG*/+ O% [7 ~; Q! y  e& s7 G# [
  43. 3 Q, K4 y* s' L6 B! @3 k0 i' W) Y
  44. #ifdef EDMA3_DEBUG
    0 S% }0 s. S, y0 }1 u8 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# F: r/ X9 X5 Z; b  J$ x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 B$ c, @4 j" n! i0 n6 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 f6 d" T  N; R4 j
  48. #else
    3 S/ v2 j0 J% m! A
  49. #define DMA_PRINTK( x... )
    " R4 n* Q" M: V
  50. #define DMA_FN_IN8 U) b3 L0 U: R$ @+ ?, Z
  51. #define DMA_FN_OUT
    8 ]$ C& n$ ~5 Q: `7 {. L
  52. #endif& O, q# z8 _8 E, B) o  u% Y5 T) B

  53. + g; d5 ?( X, z1 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; Q" x& j0 g6 r' }1 q! ]
  55. #define STATIC_SHIFT                3. v7 Q  Y8 w3 F5 I$ d, F
  56. #define TCINTEN_SHIFT               20  I7 Q7 z3 R% @: ]$ H
  57. #define ITCINTEN_SHIFT              21+ V, u4 ~* B; p5 r
  58. #define TCCHEN_SHIFT                22
    / I* n2 A) p( {8 F3 A
  59. #define ITCCHEN_SHIFT               23: o: J3 T+ g9 w2 N9 J$ |, p# |
  60. $ v, X  i8 c7 f! E& U  U
  61. static volatile int irqraised1 = 0;
    ' H( ?. W* [% f, W. u/ W
  62. static volatile int irqraised2 = 0;
    * s8 H; c9 w. F7 S9 }7 M
  63. ( U* {. a3 s3 b8 B' `- {: C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ q2 _& J/ c' g% S. Z: n) H7 q( B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 g% n2 Y2 t: y) J' B! o& V" i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ]. u% b- C& k/ s4 X

  67. ' y- H! g0 H/ v( H8 L
  68. dma_addr_t dmaphyssrc1 = 0;* j/ K: |* `* x
  69. dma_addr_t dmaphyssrc2 = 0;
    ) v5 @: A) k6 L. _
  70. dma_addr_t dmaphysdest1 = 0;5 X9 f, a" T, ^$ {  l) G7 t
  71. dma_addr_t dmaphysdest2 = 0;
    ! [5 X& r1 V5 C* D8 S
  72.   _% y& D  c, k2 }) `+ w8 F
  73. char *dmabufsrc1 = NULL;( N4 E9 Y* P) T) o+ [+ b
  74. char *dmabufsrc2 = NULL;* r, x. \( o- W7 P
  75. char *dmabufdest1 = NULL;2 P, Q  M7 h- J" {- s3 M9 y3 I
  76. char *dmabufdest2 = NULL;
    , J( l$ Y& V3 @. {1 c3 q

  77. & X) L4 l: `) h- h( ?* `1 t* v
  78. static int acnt = 512;
    ; l& V% I+ D- x, ?# l
  79. static int bcnt = 8;; m% F) |% g! F, e9 V1 g
  80. static int ccnt = 8;
    & j% w3 p, L; T
  81. 9 T% z/ B; e1 `
  82. module_param(acnt, int, S_IRUGO);
    % N. @- K  @0 P0 u
  83. module_param(bcnt, int, S_IRUGO);
    & Y' N2 o( t; m( E4 z, R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. v* ?- Q& ?$ }' T

1 }# R5 f0 J! r1 r3 y" m# h) c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  Q4 t+ w+ Z( V1 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 S  L) H: c  p, h! {% x. L3 C3 ]0 Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ s3 |+ C: ]- R. o: x
) b6 n7 w  @0 o5 a/ T! ]
. ~5 p+ _. u$ p4 F# ]$ z" K% B& c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-20 16:33 , Processed in 0.033040 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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