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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 Z) i/ \# R* _/ a  A6 @
  1. [code]EDMA sample test application0 ]$ l0 ~2 N( K: v
  2. /*' X# U+ T: O2 X; E
  3. * edma_test.c6 x) ^9 i/ N2 Y1 a) r
  4. *
    ; j, T# t, r. T
  5. * brief  EDMA3 Test Application& ~# {& T# g" X/ Z. {& A! P" r2 Q2 C! U
  6. *
    6 [8 o# N# h8 Y1 w
  7. *   This file contains EDMA3 Test code.; m7 s; S& p" I/ s
  8. ** _2 ]. w# r. Y7 P% ~7 v+ x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& u5 e3 d4 K, T" [9 ~" K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 w/ I  @6 F8 Z$ l
  11. *         TO CHANGE.
    4 T8 U+ H/ X: B
  12. *1 k" g% L. K9 K& @* M' Y; h9 r& Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& F) d4 v9 Y- f, m0 x+ A
  14. *
    - Z+ |$ n( @9 d5 [& N
  15. * This program is free software; you can redistribute it and/or
    0 k! A" F/ ?" K1 R8 h# y+ O( U
  16. * modify it under the terms of the GNU General Public License as, p1 d6 h& F/ N( }$ j4 J/ N
  17. * published by the Free Software Foundation version 2.
    & Q( V6 d# f8 E9 k0 A' ~
  18. *2 X8 [( R  T) n8 U& J1 W/ Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 d7 U3 P* ^! i6 Y" E% M# G
  20. * kind, whether express or implied; without even the implied warranty! P. E) i( x/ Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ \, V3 |. X* [8 K! _5 L/ q5 _/ n
  22. * GNU General Public License for more details.
    ) [& x0 q& z4 j% \. e. w0 X% G
  23. */1 d' k  d. x/ q1 @; H3 t5 [( o

  24. 2 w. \! d4 |4 o+ j) W- m& M: y. q
  25. #include <linux/module.h>! N$ m( X; a. ~2 h( c
  26. #include <linux/init.h>" W7 C& _( N" g! O! ~2 y4 w) ^* ?
  27. #include <linux/errno.h>
    1 [' b7 U! @% \# F' Q  z4 [# c
  28. #include <linux/types.h>
    5 X/ m9 I7 [3 S8 U. E% U
  29. #include <linux/interrupt.h># e. h( v$ Z4 l4 u- v+ u1 v
  30. #include <asm/io.h>+ L! i+ m! N4 Z% l, g
  31. #include <linux/moduleparam.h>
    - [1 X9 w* e/ V) i1 R
  32. #include <linux/sysctl.h>) s+ d) E- }/ L  C; v% U$ o+ t1 [. t
  33. #include <linux/mm.h>
    " s& D4 b* E; j1 k' \
  34. #include <linux/dma-mapping.h>& ?0 |( j4 J2 _* u+ U
  35. 6 B9 j) K* t$ u$ F) x
  36. #include <mach/memory.h>- O& K/ ?  t; h& i% ^0 F
  37. #include <mach/hardware.h>
    5 C* N: a. \# ^0 o! k, b8 m
  38. #include <mach/irqs.h>
    7 [" V/ Y$ t" b5 t2 |% L% \
  39. #include <asm/hardware/edma.h>( M. o$ ?* M* h: c1 G) v+ R
  40. - D: ~3 f9 g& k6 W; o
  41. #undef EDMA3_DEBUG# z5 ?' p: B( U$ U. j3 [  [" M
  42. /*#define EDMA3_DEBUG*/% C7 {5 M4 T  z( ~( Z2 H; Y
  43. ' H7 ]4 ]5 p, j4 }! Q0 A
  44. #ifdef EDMA3_DEBUG
    * g6 ]1 B' }. v% D* Z% g0 ?5 u  ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). q9 S, D, V) Y- O) Y6 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 s+ O% |! Q" V5 Q4 q9 h. j5 D4 Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 e: O4 G4 b" I3 w2 o
  48. #else
    6 b" q$ x* j/ g! ^$ V6 o
  49. #define DMA_PRINTK( x... )7 x5 R7 Q+ T* q
  50. #define DMA_FN_IN5 q: _3 |* o3 V& o7 Y
  51. #define DMA_FN_OUT
    5 }( k0 J4 e0 ?& z. w; e
  52. #endif6 S1 F9 j  |* b

  53. 2 P- e( E; k9 q4 V% r& Y# t- _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 o# u) ]; R- g  Q$ M1 r4 ]) v( p7 X9 U
  55. #define STATIC_SHIFT                3
    : s* R& f* p  h9 {% f2 D# I, a
  56. #define TCINTEN_SHIFT               20
    1 x1 k: f' {4 h( ^
  57. #define ITCINTEN_SHIFT              21
    8 ]3 `( t; w9 u; v' j: [( A5 o6 `
  58. #define TCCHEN_SHIFT                22# v; A5 V+ G: V6 l6 J( M
  59. #define ITCCHEN_SHIFT               23
    $ d, f2 K8 I9 \$ z( x
  60. $ [2 p; q7 n2 G  R
  61. static volatile int irqraised1 = 0;* {) c: X+ J& r3 V: c, A/ W3 A
  62. static volatile int irqraised2 = 0;
    / @1 o9 ^  c: F# T

  63. ' J6 m! M. L- ]  c4 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 c2 B3 q3 C2 T' h8 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- U! [  C1 N+ h  _. |) ^$ g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & @& B; }! c; ^! a8 m" j# Z
  67. ( o* B9 K- [( A# U; m
  68. dma_addr_t dmaphyssrc1 = 0;
    2 ~7 k. T8 ~$ Y- L# G' j
  69. dma_addr_t dmaphyssrc2 = 0;
    , ?$ R, \! z' G, v7 D5 V2 V8 ~/ I
  70. dma_addr_t dmaphysdest1 = 0;
    ( N8 I3 c. l/ r" k9 \- {
  71. dma_addr_t dmaphysdest2 = 0;% {4 e% L3 v, d, D
  72. ( A' v# Z  O* j( g# Z% Y# y
  73. char *dmabufsrc1 = NULL;( W3 U1 Z% C1 _1 I4 f
  74. char *dmabufsrc2 = NULL;
    6 v4 E' S# v- K: Y  I" P. D6 A5 T5 V
  75. char *dmabufdest1 = NULL;
    ( M9 {( r3 c+ i) u" f
  76. char *dmabufdest2 = NULL;+ N9 q, ~, i9 c; x
  77. 9 b* G6 k) q/ j. S3 j4 l" ~2 J
  78. static int acnt = 512;
    1 w1 v1 [! U& ~6 z8 n. C/ e5 Y
  79. static int bcnt = 8;
    9 [4 W% n2 |: k
  80. static int ccnt = 8;
    " _6 S3 C  I. k- D- i* G
  81. / U, k( \8 B% n7 o  P: H6 J# W6 e
  82. module_param(acnt, int, S_IRUGO);
    $ S& t, w" C' @4 F
  83. module_param(bcnt, int, S_IRUGO);+ e3 r- n1 `( s5 D1 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ Y3 C+ x$ r, K) l8 M( b) {. |+ \3 {

/ h: e; ^! c; v8 u. q+ B* Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ k/ X1 U% ?' J- h: `% v8 M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, K" ]# E2 Q- m' ~- D, U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ ]4 f. l8 r& `3 z7 A' _
) q/ [8 R" D5 o% V

* Z8 v+ u: w- E9 b& d6 `: q& Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 20:09 , Processed in 0.037949 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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