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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ _% ?6 r" k1 Q3 Y
  1. [code]EDMA sample test application) X! N# I% p1 h+ |7 ]$ v
  2. /*( v: }1 F2 ?8 C1 _& Q+ S0 _
  3. * edma_test.c
    6 P  q8 @2 g6 n3 \7 r; x7 M: f
  4. *
    7 s2 t1 \; f& `; a
  5. * brief  EDMA3 Test Application: ]1 O# u" Y3 r0 O
  6. *
    ) x3 t: _! d4 a( m
  7. *   This file contains EDMA3 Test code.4 ^3 \% M7 H# v! m2 G" ~8 f3 C- g
  8. *
    4 B; u4 Y1 C6 r; {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 @6 S6 M% K6 J( l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 W' l! o7 d9 L) m  ^2 H
  11. *         TO CHANGE.
    4 F$ I1 l8 |& \1 J/ ^0 I7 {
  12. *& Z0 O" M  l4 e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// g& Y8 _5 F4 N9 O# X5 {! K
  14. *5 O2 G: u8 G% }" `) y9 y
  15. * This program is free software; you can redistribute it and/or
    1 |! s1 z' O/ x4 G: r. I& w- C5 [' i
  16. * modify it under the terms of the GNU General Public License as6 M! g+ p# T  k; |  g
  17. * published by the Free Software Foundation version 2.: U' d* t6 W" b, |. Q# ]6 w
  18. *7 ~2 g+ k3 D+ {) n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . }. X* l( x9 m- [0 t+ E1 m
  20. * kind, whether express or implied; without even the implied warranty
    ! M# n) V( w' M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 ^% z& ?4 f9 L+ w6 c
  22. * GNU General Public License for more details.
    / m$ T: O( V: }( x6 }, {& a
  23. */8 V/ O9 o; _1 @9 U) s# X1 }
  24. " s, j1 Q  D$ D0 M+ k" z+ J# }" l5 I
  25. #include <linux/module.h>6 u3 p5 d2 ^: e9 ~4 u& e
  26. #include <linux/init.h>
    * ?9 n& J& \, X, n# \' U
  27. #include <linux/errno.h>0 f( d1 h" q& @2 W
  28. #include <linux/types.h>2 v  M$ X( J. h, \4 ~+ l  k
  29. #include <linux/interrupt.h>, p) y: b- x0 [2 m+ `" ]
  30. #include <asm/io.h>
    5 ~2 h+ t9 J5 ]# X3 G6 a3 D; o  z
  31. #include <linux/moduleparam.h>
    * Y" T( q" x! L; [3 n
  32. #include <linux/sysctl.h>
    ! t# [) R/ V2 i6 V( S4 s
  33. #include <linux/mm.h>* b8 G5 y% {3 ^+ ]/ E
  34. #include <linux/dma-mapping.h># h  A3 F% Y* a
  35. 1 v  ~- q  |3 p: M, F* w' F
  36. #include <mach/memory.h>
    . C, q3 ]# `7 @  K( j' S8 P
  37. #include <mach/hardware.h>
    , b+ W, U6 g* S
  38. #include <mach/irqs.h>4 |% X) T+ k3 X4 H5 ^5 `
  39. #include <asm/hardware/edma.h>9 W" r8 d5 R6 K
  40. ( g& l5 E* A) d, G, k
  41. #undef EDMA3_DEBUG' ]; f* s$ Y; c  U4 }7 o9 b
  42. /*#define EDMA3_DEBUG*/8 i0 ?, o! v# V7 s4 C0 d

  43. & C0 L5 g8 u" N( F0 `6 [
  44. #ifdef EDMA3_DEBUG
    0 K$ g" ?3 U2 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( I0 B- B; G( k$ B$ _9 m/ r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 |/ S, e1 l+ |( B) n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , z, [  h9 m3 a$ o
  48. #else
    + e- g# z$ ~/ D' Q0 d
  49. #define DMA_PRINTK( x... )
    ; J7 _3 o# h4 w4 F( z
  50. #define DMA_FN_IN
    5 `5 t8 m( G2 g& ]8 X5 K) G
  51. #define DMA_FN_OUT2 t/ r% ?9 K, X% F4 C# {3 Y& p! z
  52. #endif8 ]& D1 o& w! K; j0 J' A: Y. S* y
  53. " v' ]1 G4 `6 _! f3 B7 u" z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 H* e; _  S( e5 z. W
  55. #define STATIC_SHIFT                3: G- I$ J! f; M7 V4 p" w& F
  56. #define TCINTEN_SHIFT               20
    # F7 y" c8 C! D: `% h
  57. #define ITCINTEN_SHIFT              21
    ! L8 ?# I) O- v1 {
  58. #define TCCHEN_SHIFT                22* m7 A+ N  _4 U. K8 \
  59. #define ITCCHEN_SHIFT               23
    1 |7 g  R% h5 l) z. R. l/ ]: I

  60. % k- F5 u2 }0 X
  61. static volatile int irqraised1 = 0;
    5 ~' c( ^  \' ?) B. c- Q
  62. static volatile int irqraised2 = 0;/ _" |3 J, i# m) I

  63. 1 ^. R- v5 g2 m1 @& C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  g! L; Z# E" `% t% ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . {( H* z7 \  |' e+ e( u! g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 I8 m, {+ ~$ T% ]3 U8 ~

  67. " ~9 ?% D9 ^5 z* P8 B7 w6 r
  68. dma_addr_t dmaphyssrc1 = 0;2 c" n+ b3 o. l/ p" @
  69. dma_addr_t dmaphyssrc2 = 0;
    0 _( w1 j1 J* {% k3 B- w
  70. dma_addr_t dmaphysdest1 = 0;
    / w2 O& ?. W7 |* L" a5 T
  71. dma_addr_t dmaphysdest2 = 0;" v3 y( a9 c- H( c

  72. * m) s  ]0 T0 r
  73. char *dmabufsrc1 = NULL;6 d& \7 t: @6 C& _. X: g3 H. B$ X7 z
  74. char *dmabufsrc2 = NULL;
    ! H8 W' ~9 e$ \& e( e
  75. char *dmabufdest1 = NULL;, y! P- E6 Z% z# c
  76. char *dmabufdest2 = NULL;
      C& h7 k( j/ @! Q* ^

  77. 6 ^# p( L, }9 p) \. U. p* b9 D  d9 W
  78. static int acnt = 512;* c& V- h  o* a) Q& k
  79. static int bcnt = 8;
    $ ]! F! ^/ D5 n7 o
  80. static int ccnt = 8;
    # n: G& T  K. Q3 H9 u
  81. $ r. _* {8 `, K" n$ I$ j
  82. module_param(acnt, int, S_IRUGO);  k% C7 s: M( C: U3 J8 `4 h2 R
  83. module_param(bcnt, int, S_IRUGO);* a5 Z" x( \" g  k; \( C+ T, n! N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. m: u+ s! D4 r9 o
$ Z. m  o7 u  V4 B9 |# N# C# G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 |$ B6 t( r2 A* W$ Xarm-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 a$ ?! C: Y* B" i1 x; t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: Q# J- q  U- P* U3 G
6 D4 U# D$ M6 M
( w) V2 Q) N# z6 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 08:57 , Processed in 0.039712 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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