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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* N  L0 _7 r. J. Q; {' j7 w
  1. [code]EDMA sample test application
    9 P; y4 f2 ^/ }
  2. /*
    $ e3 A* k0 ^+ m1 p0 B' R
  3. * edma_test.c
    + u- z0 }# U! V. v1 W" [6 M
  4. *
    + a- f8 J) Q4 M# x
  5. * brief  EDMA3 Test Application
    5 H! N- T/ Q  h" L1 L8 d8 d% l
  6. *
    ( F+ W2 p/ M4 \/ n1 q' n0 H+ j
  7. *   This file contains EDMA3 Test code.
    3 F9 K: _# V) p) M- r5 U3 N% D! ?5 Q
  8. *+ K* n3 c$ a$ m2 ^. I1 A$ Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ a, S. `# \4 Z4 m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , o' j0 C0 D$ ~% U: E- T: i+ |0 @+ y
  11. *         TO CHANGE.) c6 D# H  D4 N2 O2 H9 q/ T
  12. *
      u& h+ Y+ M/ m% x; j' N* A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  C# C0 P0 L" D- e3 ?3 e
  14. *! _% D& r* f% [' ]  }2 q+ p7 [% P
  15. * This program is free software; you can redistribute it and/or
    % y; u" J+ T3 w/ t
  16. * modify it under the terms of the GNU General Public License as
    8 c; F4 z& U4 R9 H- N; F. c
  17. * published by the Free Software Foundation version 2.: d0 ?5 c1 R+ {; [( o
  18. *' H/ b% ]+ b4 z% Z) e% |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % C; c9 h5 a" J8 w6 Q9 u; J
  20. * kind, whether express or implied; without even the implied warranty
    3 k; t: `( v4 \/ F1 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 o( @4 b0 @! I# k0 V, Y! T. |
  22. * GNU General Public License for more details.
    6 q1 o+ a- [% z! C% g
  23. */. u, a" |) U4 x1 h  Y" G

  24. / I6 P2 ~$ z3 l2 r* w- c% l
  25. #include <linux/module.h>8 ~+ ^" Z5 E2 P, ^0 ?
  26. #include <linux/init.h>
    + Z% U5 n* `+ D8 i( ^/ m
  27. #include <linux/errno.h>
    2 f" u" |8 K* c" y8 \8 n
  28. #include <linux/types.h>
    ; G  Y( [8 H) J/ ~6 m
  29. #include <linux/interrupt.h>
    # q2 u( w: _1 |! ^: E' z1 `
  30. #include <asm/io.h>
    $ B7 e' _( Y+ ~; H
  31. #include <linux/moduleparam.h>
    % E* I/ u. R: ]* h$ o
  32. #include <linux/sysctl.h>
    / J0 l9 i3 v' b: F8 e
  33. #include <linux/mm.h>. }/ j. h0 [# {, x; Q
  34. #include <linux/dma-mapping.h>
    6 |$ k" @- x' M4 F- X

  35. 9 v( K3 h. _0 q: a! Q
  36. #include <mach/memory.h>" q) N  p- _& Y$ J, m
  37. #include <mach/hardware.h>
    ! R0 A  [6 ^/ ]
  38. #include <mach/irqs.h>1 r7 c' ~8 `+ T3 ]
  39. #include <asm/hardware/edma.h>$ g4 [( L# Z7 X6 w* x! f) N% {

  40. + x3 c" h( _, y# a- @6 [
  41. #undef EDMA3_DEBUG
    - a' C% a5 D$ ]1 |
  42. /*#define EDMA3_DEBUG*/
    0 S: L/ x. R9 p( O5 |" s( n
  43. 6 Y4 a2 Q; o! B- H( \5 n" P
  44. #ifdef EDMA3_DEBUG
    : _) X* `5 E" K) r; @% z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , b. g4 [9 `, {& m- n- H3 x5 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / o* w: T' p( P8 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ P. X, K3 Z  T: W* d+ a
  48. #else: h, u" s# D# S! q# U
  49. #define DMA_PRINTK( x... )# B3 @( H; h6 O1 J0 I/ E1 n
  50. #define DMA_FN_IN
    , @: V3 d. L% }7 m
  51. #define DMA_FN_OUT
    + \) T/ E' N0 ~9 \$ h5 }
  52. #endif
    2 A! ^9 W: i- Y" k
  53. 2 C; }5 x1 _1 ^5 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 `6 T" @4 d9 Y- e
  55. #define STATIC_SHIFT                3
    0 E4 l  T- q! H1 X* G. ]9 Q; m
  56. #define TCINTEN_SHIFT               20
    5 c0 H8 K8 X+ S( t; Y
  57. #define ITCINTEN_SHIFT              218 u1 C" s) a* S* N- E% L
  58. #define TCCHEN_SHIFT                22. v8 M- i0 `% r7 J4 K# N$ g; A: d
  59. #define ITCCHEN_SHIFT               23
    / q: O' t3 A  d" b
  60. # S" U. ^0 [2 Q, B3 K
  61. static volatile int irqraised1 = 0;: N2 w) Y- I, k
  62. static volatile int irqraised2 = 0;
    & I1 c- D' J- E4 ~, e

  63. # p( [) S; V+ q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% h: {6 n3 J# E; t7 b8 @' s1 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - j% W) N9 e: B% Q+ W8 ]- v7 H) @2 X* f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. v$ ^$ [5 t8 u+ ^

  67. + h' P3 P2 n4 A8 O
  68. dma_addr_t dmaphyssrc1 = 0;
    ! i9 B' }& g. T" K4 i1 R
  69. dma_addr_t dmaphyssrc2 = 0;, B7 d/ F  {+ X4 b
  70. dma_addr_t dmaphysdest1 = 0;
    7 N& ~' Y3 o1 f- Z+ ^
  71. dma_addr_t dmaphysdest2 = 0;
    ; I7 A+ e# d5 K" @) H9 k: z) k
  72. ' T, C7 b6 m( l* C1 L4 ]1 x
  73. char *dmabufsrc1 = NULL;
    8 F7 Y3 g' ^6 p8 ^+ W$ f: U2 ~  v( {
  74. char *dmabufsrc2 = NULL;
    4 q& F% h' {) [. K/ c$ @- c7 e) X0 C9 S
  75. char *dmabufdest1 = NULL;+ N% r- J! z6 }5 d
  76. char *dmabufdest2 = NULL;' ^% n* i, x& Q1 E# _4 j$ ]
  77.   ?5 n$ g' [' s% b* A+ I. ~4 \' Y
  78. static int acnt = 512;! a  a& K- ~' m6 \  o
  79. static int bcnt = 8;
    , \. }' S" E+ @6 \$ R' h
  80. static int ccnt = 8;
    1 b0 W/ `* f7 {& Z

  81. 9 m" w# B) ~5 p- D# |+ A  L
  82. module_param(acnt, int, S_IRUGO);* N' U6 ^  u  G5 \. k/ V  i
  83. module_param(bcnt, int, S_IRUGO);
    : P: Y0 n2 b" ~# J+ n% ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: Q, G0 ]: F9 |4 J' l) C% o9 {6 y
2 S! ^/ `. M/ S9 `2 W, d/ ?! K+ w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( l% J6 Q' _; p6 v: Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 s3 U* C, q% k/ W9 N8 ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 \. k0 {5 H7 X" g" x; n! k, L+ M8 ^  n+ S1 a

# t# E  g: a+ A3 m! ~/ W3 |" @4 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-18 14:32 , Processed in 0.041728 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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