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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , N) X; a" U2 r& f) `# w
  1. [code]EDMA sample test application; q9 ~6 \8 }$ z: {6 X
  2. /*
    5 p/ q2 ?8 V" h/ S
  3. * edma_test.c" q; j8 \5 W! }' k% i+ x
  4. *
    1 \" Z# T( S; H+ z4 ]7 }% j) G
  5. * brief  EDMA3 Test Application
    $ J7 w8 @& Y) Q7 S' I+ K; w' ?8 K
  6. *
    + W5 P9 y3 }6 S  z6 g
  7. *   This file contains EDMA3 Test code.+ w8 t! u9 F# ]* c2 X; b8 ~- k- \- c' A
  8. *
    & n* f% R) U; j. B) g' }1 H: U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # ]% s, h+ c# Y6 w/ q! Y  @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! Z7 \0 f: k; \- O$ b: I5 c
  11. *         TO CHANGE.* ]+ Q; Z7 S' w9 B  u6 r" Q8 O
  12. *9 {3 O% P8 Y7 x- C( V7 |$ m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      S2 A0 G% j, g
  14. *0 p5 b  ^: f; d  U, \( S) I
  15. * This program is free software; you can redistribute it and/or* o9 `. o5 x; n! O) S% d9 I
  16. * modify it under the terms of the GNU General Public License as% Z1 \) C/ H/ i, D$ W1 E0 b% Z
  17. * published by the Free Software Foundation version 2.
    " H6 R& r; g- B* n+ I" d& P0 {
  18. *
      Y1 Q& O2 h4 C( |3 t1 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # k, L& ^7 Q  k) c  _7 K
  20. * kind, whether express or implied; without even the implied warranty
    ! V# H+ n( R2 H  f! G! H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! z2 W5 b) d# i8 Z& \; W
  22. * GNU General Public License for more details.' [0 Y$ s( ?* Q/ _$ Z
  23. */
    0 _& s7 a( Q: }! B3 Q; B$ R" Y6 n
  24. , ]3 P, o! @4 ~+ i
  25. #include <linux/module.h>
    / x9 h  {! q4 E
  26. #include <linux/init.h>" R+ c3 L3 z. D1 g$ ?  [
  27. #include <linux/errno.h>7 @  |  D# E$ p
  28. #include <linux/types.h>
    9 y6 w. @) w2 e- \( ?' d1 L1 U
  29. #include <linux/interrupt.h>
    , l8 L/ k( K4 a% }
  30. #include <asm/io.h>" O) x+ x2 [/ q0 }: s, K
  31. #include <linux/moduleparam.h>
    7 e- f' b' u1 F" W3 g# F- [6 `& h' R
  32. #include <linux/sysctl.h>% P9 U7 N% t5 A" t- C
  33. #include <linux/mm.h>
    + t7 l1 P1 V5 j: R; l" e
  34. #include <linux/dma-mapping.h>4 J: Q  o  A# o- z* u# v+ U' e

  35. 1 I: O" n. E" P
  36. #include <mach/memory.h>9 ?8 p1 a% X4 G1 b5 P" e( C
  37. #include <mach/hardware.h>
    $ A' ^# J1 }. _( g" w
  38. #include <mach/irqs.h>4 S. ?3 t# c- F% j3 A0 b: f4 U4 @
  39. #include <asm/hardware/edma.h>
    6 {5 K5 c# [$ s# X
  40. / h, e4 O' [5 `- X2 F1 b2 ]% f& a
  41. #undef EDMA3_DEBUG
    # ^! P4 R2 b. p7 Q/ B9 e% t% {+ w
  42. /*#define EDMA3_DEBUG*/7 `# {; {* }/ W* J3 G
  43. " G: B$ w0 m  z! n: Q
  44. #ifdef EDMA3_DEBUG
    - q- [: q' l7 [9 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) k5 L5 D& ]' V( k1 V9 F8 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + X, |; s& n3 r0 w( C' h: i+ u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 `+ R3 G/ j% ?5 r5 m6 U
  48. #else3 R0 [# |, k- A2 T8 N  o0 V
  49. #define DMA_PRINTK( x... )  ^4 a9 ?9 h3 B, T2 c/ z0 C
  50. #define DMA_FN_IN
    ; B  ]/ l( M5 ^4 o' q/ ]4 L
  51. #define DMA_FN_OUT
    . H) m7 R3 Q* M/ `6 |
  52. #endif9 g* c- m2 z6 C# v9 N3 G
  53. 3 r: H$ }2 `; @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , m7 }& ]* m* l4 p& u
  55. #define STATIC_SHIFT                3
    + |# c; L% y0 K; x9 C0 ~
  56. #define TCINTEN_SHIFT               20
    ' i1 G% B. u+ ~+ E
  57. #define ITCINTEN_SHIFT              213 u: u  u6 j: {3 j# q! L: ?
  58. #define TCCHEN_SHIFT                22  K/ m+ Z) d6 \: o# `6 M
  59. #define ITCCHEN_SHIFT               23" {# D/ _5 [& Z$ U/ m, [  F! S
  60. 0 h) H3 V$ `2 V8 w6 X& H8 q
  61. static volatile int irqraised1 = 0;* ]; Q' x( v: e' b
  62. static volatile int irqraised2 = 0;
    % c; H& t/ O2 T. }$ s$ j
  63. 0 R  R6 |3 s5 z% f/ S7 q0 Y4 Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * N1 _, {9 o, Y9 N! \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + A4 Z/ c1 W0 i3 R# ~8 V" K* {6 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 p. [# E4 l0 ?9 P
  67. " h. |  L6 g0 t( W& c& F
  68. dma_addr_t dmaphyssrc1 = 0;+ a) c- o6 n: U6 X! p
  69. dma_addr_t dmaphyssrc2 = 0;
    1 u/ V- S2 S1 H4 E4 J
  70. dma_addr_t dmaphysdest1 = 0;4 I* G5 E( O9 J# }- `/ J5 c# h$ y8 a- o
  71. dma_addr_t dmaphysdest2 = 0;
    # o# c$ Q' p9 A7 m7 r

  72. 3 W/ l  x: M  \/ C' z
  73. char *dmabufsrc1 = NULL;
    ' a: F( d5 j( d+ e* q
  74. char *dmabufsrc2 = NULL;
    ( I9 s) l- e$ L/ e; C+ C
  75. char *dmabufdest1 = NULL;
    2 N% x$ _" S  ^+ q+ G% L9 c
  76. char *dmabufdest2 = NULL;( O3 Y8 p% m0 J) J, G6 w
  77. 6 v6 ^+ Q  w+ S& s- ?
  78. static int acnt = 512;3 V( A# A* x! {4 V6 G
  79. static int bcnt = 8;3 \4 @2 Y1 a4 n2 Y/ c- p. K
  80. static int ccnt = 8;9 [" h% D% s. l0 ?* e5 c2 S

  81. : T! k  O5 D* _- n2 }+ N' I
  82. module_param(acnt, int, S_IRUGO);' F9 F7 C+ U$ e- o* F
  83. module_param(bcnt, int, S_IRUGO);
    % i5 w7 _* J- p2 v* U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 g1 E$ W( j! \: U: j1 V7 J# L" ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 W9 V: v. s0 h7 M" G9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 H- I- R! z: `/ N' s/ W% L4 y  b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ E4 D* h) f& ]% P' X$ a, e: ]' b
0 ~2 c* f: Q7 k9 N7 }- H; e2 ?, m
/ J) L' N7 I- K2 |. e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 12:39 , Processed in 0.039510 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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