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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ W9 Y" N& a6 {# s3 B0 ~8 j
  1. [code]EDMA sample test application% l6 R3 e) g* y
  2. /*" V3 a4 j# U8 h/ d" J: P0 i
  3. * edma_test.c
    , \+ ~; u8 j7 u
  4. *. B% l% P+ H/ z; z
  5. * brief  EDMA3 Test Application8 _5 a  `5 B+ a. h' f/ ~/ i) E3 E
  6. ** a& H5 l9 s% i9 b" J5 P
  7. *   This file contains EDMA3 Test code.
    9 |1 v6 I; v9 `
  8. *
    * `' D6 o  _4 H3 ~6 O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% M; c& I) S; y3 e! H" U( @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, E+ `6 v0 [6 T# l/ A& o$ J+ y
  11. *         TO CHANGE.* V  v, x4 {& W3 `7 ^
  12. *
    0 D) y. z. @* O& b, }" i; W- b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- V, F/ k* g- O4 N  V7 m% O
  14. *
    " x. u0 D, O& T8 _! p
  15. * This program is free software; you can redistribute it and/or/ D& q2 w9 V/ i: y4 v* P1 V
  16. * modify it under the terms of the GNU General Public License as
    9 l& S$ ^! F) x; `
  17. * published by the Free Software Foundation version 2.
    $ [; U( V5 H8 F! ]$ `  V; g0 b
  18. *
    / ~# a; u- u* S% L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 r) x. ^% g6 |0 Y, c# I% t+ X
  20. * kind, whether express or implied; without even the implied warranty
    " {& P, G, n! }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 I7 N) p4 h- V% l
  22. * GNU General Public License for more details.. C+ a% `* S) v
  23. */# p5 k% i. \1 |
  24. ; _5 ]$ B' a  I/ z& M
  25. #include <linux/module.h>- ~3 u5 a: D+ J  m
  26. #include <linux/init.h>& }$ K" z' c% e
  27. #include <linux/errno.h>, z1 M& L6 y! D# J; H
  28. #include <linux/types.h>$ I5 U/ d/ [. q1 [' |- N  W
  29. #include <linux/interrupt.h>4 x+ d  d9 @  W1 z5 p, `
  30. #include <asm/io.h>6 p; N7 K% a1 f* P8 x* P5 `
  31. #include <linux/moduleparam.h>. E9 |* [% ^3 D! Y; B
  32. #include <linux/sysctl.h>8 U0 K$ N( Q* }4 \
  33. #include <linux/mm.h>
    0 _' X, s8 A% H0 v, t
  34. #include <linux/dma-mapping.h>; P1 D' j! l0 S4 I. B/ w  g( L6 k

  35. 3 w- a" F3 {% ^- w3 B
  36. #include <mach/memory.h>
    ( [" g/ d2 ~) e9 J* W( F
  37. #include <mach/hardware.h>+ l8 \2 Y' l7 h  @3 f/ M/ _/ p: }
  38. #include <mach/irqs.h>
    9 d' p8 D) p# Y- F3 D  h
  39. #include <asm/hardware/edma.h>
    $ O* B0 X6 ~* L2 N

  40. * _) k% `; S1 s+ S- n; O1 r' m7 c
  41. #undef EDMA3_DEBUG
    8 A( n" U) u5 ~, T) ^, _* |
  42. /*#define EDMA3_DEBUG*/
    % d/ G4 r  L# ]" ^

  43. # O! [4 |; k! i0 k& g0 |% \
  44. #ifdef EDMA3_DEBUG
    . G" q; G& N; O& P" ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ y+ L/ O) W* d+ P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 Q, l) b: Z" \, t* o. Z6 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* T7 h! Y  F" g9 j
  48. #else* _: v2 f9 L0 V1 N* g- s
  49. #define DMA_PRINTK( x... )
    & ~4 L, Q+ K5 g& B
  50. #define DMA_FN_IN9 X2 |3 _$ L& {1 z) c& s; {: ~
  51. #define DMA_FN_OUT
    . _. B! i% N( g  `! X) M, G9 B
  52. #endif
    ( X* r2 f4 b. G: h

  53. " S2 d9 g% Y2 N$ o+ H; W! V" l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . ?' \; H; c% p! P
  55. #define STATIC_SHIFT                3
    , k7 W. q, m1 s1 X5 b6 o5 J
  56. #define TCINTEN_SHIFT               20
    0 A! O! N8 B  n5 y! G: ~1 z4 D- C0 L
  57. #define ITCINTEN_SHIFT              21, G; P4 E. u. v. A2 f
  58. #define TCCHEN_SHIFT                22
    ) W; q$ H5 S* b6 I- h$ I
  59. #define ITCCHEN_SHIFT               23
    0 e, Q2 G& Z2 p7 ?+ ]" z0 X
  60. ( k' y& [$ V4 }4 V5 @
  61. static volatile int irqraised1 = 0;
    * ^& R5 B' {' g+ T/ b3 E
  62. static volatile int irqraised2 = 0;
    ! t6 |+ v! O+ _1 M  B

  63. * \0 X+ d! c- M0 [# c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . x2 `9 t4 E0 ?* k+ v3 o) V% w" P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) u, m, W8 L  Y7 G1 B$ l, `# S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ l" Q* ]* v% Z( I6 q; C

  67. , [0 K5 E( D6 e. v. o" {' X8 G! o4 {
  68. dma_addr_t dmaphyssrc1 = 0;8 E  V4 `+ G  d* n
  69. dma_addr_t dmaphyssrc2 = 0;
    8 d4 f9 \$ e0 W; y- i9 f
  70. dma_addr_t dmaphysdest1 = 0;
    5 J% ^3 n5 I, o1 K1 |( j
  71. dma_addr_t dmaphysdest2 = 0;
    " H  e% ^( o. F- E- c

  72. ; y) `! U, M8 }. D
  73. char *dmabufsrc1 = NULL;
    4 z4 y2 ^" `( ]7 ~, t4 ?! I7 O3 M  h' L
  74. char *dmabufsrc2 = NULL;
    ) P; p  d, G+ G, Y% h
  75. char *dmabufdest1 = NULL;. E0 T6 d6 V& Z/ Y
  76. char *dmabufdest2 = NULL;
    - N0 l. d8 c3 [) |3 K+ ~0 s! X* M
  77. ' J% l8 {+ F; K+ X
  78. static int acnt = 512;
    9 ^+ \$ d! t. B8 i7 I0 e: V; w
  79. static int bcnt = 8;
    & f7 i, a$ _( w9 f; I
  80. static int ccnt = 8;
    ' ~! s% ]# ~; K

  81.   y$ G8 f+ ?, B7 j% t. W
  82. module_param(acnt, int, S_IRUGO);7 O& w# K; P$ p6 m2 i
  83. module_param(bcnt, int, S_IRUGO);( q/ L% ~- r  b, y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% i  F8 A% _7 `' m) ?7 R+ ~

" I& E; ?7 o2 U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 P/ ]0 ?' w8 L- O+ Tarm-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 D, x: i  N' g& B& P1 z6 q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, i3 b, _4 a% j7 V4 ?2 H+ X, M" e3 ]# U" a) V
, }6 T6 G: d' t3 S8 u8 j- q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 10:31 , Processed in 0.052102 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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