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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 O) O" W  S2 F
  1. [code]EDMA sample test application
    ! e9 y5 f8 p+ q
  2. /*
    ( n* b. x$ H' R5 C
  3. * edma_test.c
    " y" y  J, x: u( f; |
  4. *7 ?6 k% I& T- Y" l' Q/ D4 N
  5. * brief  EDMA3 Test Application
    - F3 d; S3 o& I7 e
  6. *
    # E  g! R9 e% j# v. }0 E
  7. *   This file contains EDMA3 Test code.
    / |7 y# X& S$ H
  8. *2 q/ D* ~4 A, P4 ?5 Y* e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 ]8 ~  q4 Y; N7 l6 ~+ _; g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( G1 U0 h( P8 ]1 K* E+ M
  11. *         TO CHANGE.( p* K  z  q+ W* n$ d" l
  12. *
    ' @( v- ~' i7 N" M. i# T# @% w9 a5 g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ K7 v/ Q6 T, U" i4 j+ F
  14. *
    ( H, E. d8 ^! I7 _5 r
  15. * This program is free software; you can redistribute it and/or
    1 ]7 }- x3 P2 p- n; K2 M' u
  16. * modify it under the terms of the GNU General Public License as
    8 ~% o3 Q. W! x/ x& ~2 k' {  @
  17. * published by the Free Software Foundation version 2.
    : f* @7 i+ o- j" R4 M) t+ }4 W' H
  18. *
    $ k% B8 J/ o+ o' Q% T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. O& s2 N6 a+ o" T% W$ b# n
  20. * kind, whether express or implied; without even the implied warranty
    & Z  D2 |( ~  W" k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      _+ F; }6 p2 u# v- H+ }6 Z
  22. * GNU General Public License for more details.; }) c/ {: u* C! X
  23. */" T4 G% K* Y- q- r$ ~2 g  I4 l
  24. + e  O+ e  x2 ^
  25. #include <linux/module.h>; ?  ?# x3 g6 p( L, |" x/ y
  26. #include <linux/init.h>
    % g$ R" q$ O) S3 Z
  27. #include <linux/errno.h>! g6 b/ h) e2 R4 F3 b8 l
  28. #include <linux/types.h>4 L' J( z9 v# \
  29. #include <linux/interrupt.h>; X2 p. z4 A' f' e" j2 H
  30. #include <asm/io.h>
    . O+ D/ B6 F6 X5 D' i% M
  31. #include <linux/moduleparam.h>
    $ y4 f) K1 T! ?
  32. #include <linux/sysctl.h>
    5 s9 G3 p9 s2 `: w
  33. #include <linux/mm.h>
    4 K3 b1 y5 ~; D1 H% u% S
  34. #include <linux/dma-mapping.h>
    8 D  U2 `( v8 @
  35. . N! M: }0 e. R4 |0 J: _4 U  `6 g9 @/ d
  36. #include <mach/memory.h>
    ( I6 C4 g  \* O. T% E
  37. #include <mach/hardware.h>
    " e: [8 l, m: `; h- B
  38. #include <mach/irqs.h>: q4 o- z6 G$ P% q1 N- q
  39. #include <asm/hardware/edma.h>% p5 w$ Q$ {) P
  40. / n$ [! ^3 i& t9 m- E: I' T
  41. #undef EDMA3_DEBUG
    ! H( v+ U9 |* p, R& j6 C2 J
  42. /*#define EDMA3_DEBUG*/5 o3 J, ^! O7 L$ `# n

  43. 5 n4 u6 @! A8 Z  o8 O! J
  44. #ifdef EDMA3_DEBUG+ Q% D( F# @: j- w" Z. r, m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ ^5 g: k. U, M! Y. Y# S+ p7 u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 p9 ]! _3 a9 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( ^+ N; s/ |/ `& p9 {+ w
  48. #else$ V# a1 Z; q$ j
  49. #define DMA_PRINTK( x... )5 A6 C, M; C8 M* \
  50. #define DMA_FN_IN! p! H) w$ F/ }. u9 X5 w3 V
  51. #define DMA_FN_OUT# V8 G# \9 `3 j4 I4 w+ i
  52. #endif
    0 W1 }+ e- Q! f9 c2 Y. X
  53.   @( y. j, @0 Z$ Z8 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 ^+ y7 v( Y6 z- b+ s) _$ s
  55. #define STATIC_SHIFT                3
    ) @3 W' V7 Z8 ~3 q* |) y
  56. #define TCINTEN_SHIFT               20+ g' S& y1 r5 V1 P7 x4 A) r
  57. #define ITCINTEN_SHIFT              21& u0 z4 {; `4 L( W3 G
  58. #define TCCHEN_SHIFT                225 U9 L/ h/ A% c  Y
  59. #define ITCCHEN_SHIFT               233 }: M& ^! x( R/ R, M6 U

  60.   y$ O2 o6 `2 _2 |( Z3 d
  61. static volatile int irqraised1 = 0;
    % S1 Z5 A: f0 B
  62. static volatile int irqraised2 = 0;
    8 }- L9 j/ `/ X2 B

  63. " @- B$ }# N: _$ q, \( Z1 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' I  s4 B- O7 b0 }7 z' B! E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ u* z# m4 \" Q0 x, N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( }6 Y: A/ f1 y# s

  67. 0 U. B, \1 E% S- w+ e
  68. dma_addr_t dmaphyssrc1 = 0;
    + X, K: q' t5 x: h" K" j, T& [
  69. dma_addr_t dmaphyssrc2 = 0;+ D  b) ?3 E* g2 k4 f0 g5 S: h; d
  70. dma_addr_t dmaphysdest1 = 0;, t0 {. T1 B8 T1 i9 |
  71. dma_addr_t dmaphysdest2 = 0;  D: M, n2 W$ s# P7 e0 z9 ?

  72. 3 H# k* S/ s3 \: P
  73. char *dmabufsrc1 = NULL;
      ^+ ^9 I% `2 u, @& h
  74. char *dmabufsrc2 = NULL;
    9 [1 J9 ?) S  r' z, s
  75. char *dmabufdest1 = NULL;
    9 D9 r0 n. K# L* S' e" A
  76. char *dmabufdest2 = NULL;
    6 w) M' [: ~  @) ^# p7 d( ~  G

  77.   z! J& U6 z/ W. @  F' T4 h
  78. static int acnt = 512;
    2 z7 W9 B5 N- \5 Y/ S$ w
  79. static int bcnt = 8;
    # y* |0 C) _# V/ t$ ^, T# x" K
  80. static int ccnt = 8;* O/ m, ], U1 f$ D, _

  81. - U; M% M% @2 C5 n, M$ P
  82. module_param(acnt, int, S_IRUGO);: m9 V* j# Q" A# ?. Y( W
  83. module_param(bcnt, int, S_IRUGO);" \8 L7 m1 k! D  V4 G$ p( p3 X- p( y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 I! g' `8 J1 i9 |: e, M" U
5 h' N% P! o$ h# a* J# T: h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  ?  w. O/ k) O, x  Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- \. `# e1 L' Y& s- {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 O5 u  r9 G. \( F$ G; `5 Y. P- R/ ?& ^& w$ ~0 G
% {1 K" s+ Q; G" x" {0 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 02:43 , Processed in 0.039417 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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