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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ Y, A; y: a% z% a
  1. [code]EDMA sample test application" z! |0 C$ s' l: F* d, u4 z
  2. /*8 r( D5 D' f, v1 ~, E  p( H& k
  3. * edma_test.c
    0 h; P! {' |8 T! g) z
  4. *
    5 I, p0 k% v. R
  5. * brief  EDMA3 Test Application1 _1 k! U2 ?: u0 w& @+ Q
  6. *
    5 I  B# ]$ c0 i% e+ J8 @
  7. *   This file contains EDMA3 Test code.* M! _  |9 g4 [
  8. *
    8 d1 T" S! M6 Q3 I& a: @2 h& U0 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & H7 `+ Y/ O5 h+ E0 E! |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 c# U( u1 g+ _5 G% }3 g# A# G
  11. *         TO CHANGE.
    1 K' E! \9 G, g
  12. *
    $ ~& r4 r$ Q' l5 i4 }  U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ L( i. H! \: j* B* ^! Y
  14. *- q: U! F' R" y; Z6 ?1 O! E# R! ~
  15. * This program is free software; you can redistribute it and/or
    4 p- y8 Q4 L% _% M* C
  16. * modify it under the terms of the GNU General Public License as8 x0 M. r. F( S  ?6 h
  17. * published by the Free Software Foundation version 2.
    8 H2 K. A2 }& m5 L" W
  18. *
    1 i6 w. d$ R+ ^) K7 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - C  R  S4 X# }# I
  20. * kind, whether express or implied; without even the implied warranty* @2 t  p+ @5 l; u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  e) W$ D8 g1 v
  22. * GNU General Public License for more details.
    % L7 \! ^, h5 b; g) i
  23. */2 L# a; B: V" H5 n& A. [

  24. / ?; _- U% }2 T# ?* Z% g" k
  25. #include <linux/module.h>
    7 x( k3 |0 Y0 g1 _9 H
  26. #include <linux/init.h>9 v9 w2 l  `' N. E
  27. #include <linux/errno.h>
    , S: y+ Q; i3 U% S; G! O* G: v
  28. #include <linux/types.h>% C' e! p. n4 I( y9 R! N) V7 p
  29. #include <linux/interrupt.h>
    ; j: \' l+ {+ Y2 z. Z
  30. #include <asm/io.h>
    9 V5 _  c& T" ~. \
  31. #include <linux/moduleparam.h>' D, t2 \" n; N- u
  32. #include <linux/sysctl.h>! G/ H3 u8 `2 a' f3 H
  33. #include <linux/mm.h>
    * U" B' ]9 Z; D9 Y, P# K9 I
  34. #include <linux/dma-mapping.h>" Y. D2 F* \' u- {/ ^

  35. , ~. ^  ^2 y& c' x% y, k5 p' l& v& A5 K
  36. #include <mach/memory.h>
    , l; t" |" w2 T4 q
  37. #include <mach/hardware.h>) Y) r, f. y/ z
  38. #include <mach/irqs.h>
      i+ s* l) _4 S" j0 p
  39. #include <asm/hardware/edma.h>
    5 S, j1 k/ V5 [5 @+ H2 l. J

  40. 7 n* j" S& b+ R
  41. #undef EDMA3_DEBUG
    ! Q, B3 C' n3 I/ e+ N  t: b
  42. /*#define EDMA3_DEBUG*/* P. n. ]6 ]* r3 C, {* E. P9 {" Q* B4 V* [* k

  43. , W# ], Z# R; W. S- F; k4 h
  44. #ifdef EDMA3_DEBUG; V# X& [# F* b; X+ J& q- D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( Y5 R4 `% r2 n- C, j: @- N; J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ z- }& p+ C( b0 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ x% @& _5 C: c! i0 G
  48. #else- k$ n" p& i$ G9 R; u
  49. #define DMA_PRINTK( x... )
    . Q* u) A" m# i/ d9 D
  50. #define DMA_FN_IN0 G4 ~% ~3 @2 a
  51. #define DMA_FN_OUT$ J/ {) f+ y$ h; t  A+ A
  52. #endif
    7 S: a9 {  u2 d6 W1 k
  53. 5 g& x  ]8 F% T! F# I$ I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 o* H: I, @' r/ z8 P
  55. #define STATIC_SHIFT                3
    - c- p3 \7 N) l
  56. #define TCINTEN_SHIFT               20
    5 I2 b. W& D% X
  57. #define ITCINTEN_SHIFT              21- L+ N$ ]- I* Z& n
  58. #define TCCHEN_SHIFT                22
    . |+ x  ]$ K  k+ U( x. F2 V' N
  59. #define ITCCHEN_SHIFT               23
    & H( z9 H2 t5 v( p# E

  60. 0 L0 X4 S4 ~" w# j* ]+ h& \
  61. static volatile int irqraised1 = 0;
    ) X/ Z2 ]  ]( I% U# {7 |9 S" N
  62. static volatile int irqraised2 = 0;/ f& P1 B6 a+ v8 l% b+ [
  63. 5 W- a/ {$ _* t+ {! J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " h, T/ n4 v4 O$ g& W7 V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # y. ~% w5 [" G* G" l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 a/ c  g' q8 Y
  67. 3 v8 e% T- G5 E, U( n, s- w8 p* T# e
  68. dma_addr_t dmaphyssrc1 = 0;
    8 X) z4 M6 y8 u! h) N
  69. dma_addr_t dmaphyssrc2 = 0;% A0 b+ g& [7 r  U+ w
  70. dma_addr_t dmaphysdest1 = 0;; U' r' d  n4 W% J4 c  l1 d$ w
  71. dma_addr_t dmaphysdest2 = 0;
    ' B/ P9 `+ t9 l

  72. 0 N' v! `  l% R& b0 `
  73. char *dmabufsrc1 = NULL;
    2 ]( s, C% c! a
  74. char *dmabufsrc2 = NULL;' s6 C" \( w2 n5 \! V3 t- M" x
  75. char *dmabufdest1 = NULL;: [4 I- w" m9 V3 ~7 ~
  76. char *dmabufdest2 = NULL;
    ( G  n5 l! h8 }! G

  77. " g& {; O" e( G2 t. n( ~; R: U; k
  78. static int acnt = 512;
    1 G4 y/ U- A8 Q  {  ?# E
  79. static int bcnt = 8;
    " G8 H' l$ l- a* c" q& y
  80. static int ccnt = 8;& R5 v& w8 ^2 h

  81. % g# l. `3 U! @" R" h
  82. module_param(acnt, int, S_IRUGO);9 M7 j8 [& d4 C1 J2 L6 d# r/ b
  83. module_param(bcnt, int, S_IRUGO);  A" F" T' x1 m, E$ w% S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" E9 J  `* h+ h  g5 h* O0 h
) e- u& w0 `1 w8 u; D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( R1 c8 s* R+ o+ d' f1 j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 D3 D2 N4 d+ y/ w* t' J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 n6 g# k8 b. H& S8 Q5 \  r
$ m( u+ g6 e7 A5 u0 `
1 P  P# f9 u- D: |% T( X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-20 19:09 , Processed in 0.043620 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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