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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 ?; R, J1 B  O
  1. [code]EDMA sample test application1 k3 a% F: X3 l+ B" W# @
  2. /*
    , R: F) `! x. ]+ Y
  3. * edma_test.c; G& Q. [5 i) g% _5 t. u9 L) ?
  4. *
    4 |1 t$ J+ k3 A2 |' Y
  5. * brief  EDMA3 Test Application& T  e) E& h" [/ w6 I7 ]# P6 @- @+ H
  6. *& }3 n# F4 Q4 |! r
  7. *   This file contains EDMA3 Test code.
    5 @* ]2 Z* H) F5 ]) k% r
  8. *- ?: u% w/ J6 H, ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 r# x/ G* N. |/ t. J# |) ]# i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- p4 V# r: e0 _. S
  11. *         TO CHANGE.) v  P' s" e8 X; S0 I
  12. *8 O' b# g# J) E- q% g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # s' b3 A1 c. S
  14. ** M9 G- C% ~( @2 B3 a0 q, S; Z
  15. * This program is free software; you can redistribute it and/or
    1 T# p/ W( f* m1 S
  16. * modify it under the terms of the GNU General Public License as: I3 a- f3 G( C/ F1 @
  17. * published by the Free Software Foundation version 2.
    0 Y2 _5 a- z1 P8 X; w2 C
  18. *
    7 a) a4 h- A4 e0 T% S7 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ ~( Z3 X4 b' ^7 B: @+ T
  20. * kind, whether express or implied; without even the implied warranty& F5 `) e% G" u: {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  U" r5 M6 Q1 o( Z1 x/ V* i' y* B
  22. * GNU General Public License for more details.
    " \( q; ]9 [6 a
  23. */
    ) |  D# e" o% Z8 ?0 ^( W

  24. 7 g2 s% S" T  F5 W( F8 A
  25. #include <linux/module.h>
    ( S, I, J, n7 q- Q* f1 o
  26. #include <linux/init.h>4 e/ n- I: \8 l2 I+ i
  27. #include <linux/errno.h>
    8 m3 |+ Z$ G2 {  h
  28. #include <linux/types.h>
    3 W% u& G5 w1 b. I, T# l3 R
  29. #include <linux/interrupt.h>
      u; T# K9 B- g2 R) s% |
  30. #include <asm/io.h>
    ) U: K) r( u' ?% Y/ m" W
  31. #include <linux/moduleparam.h>0 r1 P7 @4 |! y$ M
  32. #include <linux/sysctl.h>
    ) {" @+ q& F& V+ s4 W' o& J- a8 K
  33. #include <linux/mm.h>0 h. U9 B1 K& I, X
  34. #include <linux/dma-mapping.h>
    6 v2 b8 A+ l& S
  35. * `: x% @  @- [
  36. #include <mach/memory.h>
    ( Q2 i" k( N2 f
  37. #include <mach/hardware.h>
    4 }, X9 Z2 K+ g4 o
  38. #include <mach/irqs.h>; G+ ?+ ]* S4 \6 _& e
  39. #include <asm/hardware/edma.h>1 ?& n) m0 J0 Q- j. ?
  40. 9 M! p$ @9 m& a) H& t
  41. #undef EDMA3_DEBUG+ }/ E, _8 U$ V+ V& k
  42. /*#define EDMA3_DEBUG*/( f) O8 [: o: S- V$ f
  43. ! u- E2 F: T8 [+ S, R% r; s: I* D
  44. #ifdef EDMA3_DEBUG
    3 t0 L! y/ ~3 q' `- B1 n, d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), ~( V1 j" J4 ^& T5 S: Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % ]- H& x9 X- o6 g$ j" c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . V, ]7 D- X  }- q3 O$ j/ d
  48. #else
    # w% W% j5 k- U% W* n1 P+ P
  49. #define DMA_PRINTK( x... )
    : \4 ~5 S" w3 j! n* H
  50. #define DMA_FN_IN
    $ @5 H& ^3 z: Q$ f- H8 [
  51. #define DMA_FN_OUT
    # u7 }* [; R7 D+ R, c
  52. #endif& P5 t. Z* T/ ^. `1 U5 k6 s

  53. ! c) t% b$ l. q- M& \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; k2 e7 N2 o: M: ?6 F- N
  55. #define STATIC_SHIFT                31 k  T8 S, u0 o! \3 z
  56. #define TCINTEN_SHIFT               20
    . H5 ^, z6 L, Y  E  _( q2 H
  57. #define ITCINTEN_SHIFT              219 G# C5 }( f4 Z' ^" D; i
  58. #define TCCHEN_SHIFT                22
    1 ^, ?! n# w* A8 ?& q$ V* U: g
  59. #define ITCCHEN_SHIFT               23
    ' S7 E% L  I/ U3 [  P( [( a' ]1 q

  60. ( O9 k+ _' P) @; G+ g5 m: [
  61. static volatile int irqraised1 = 0;9 ]7 P6 ~3 l2 c- N8 J4 u
  62. static volatile int irqraised2 = 0;
    6 g' U+ ~" W7 d

  63. % h5 }* t% C1 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 c: {; R9 i( k- Y( |3 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( E% r- h: Q! @1 b. J! t+ }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( l$ A( ]: M( p/ y2 ?" [
  67. 2 ~$ R& u2 d& A  H! k% J, t4 [
  68. dma_addr_t dmaphyssrc1 = 0;$ l5 L' o2 ^: H- p. c
  69. dma_addr_t dmaphyssrc2 = 0;8 v6 F$ c. N" I% z# U
  70. dma_addr_t dmaphysdest1 = 0;
    / ^7 `9 }0 V1 S5 S/ J; R
  71. dma_addr_t dmaphysdest2 = 0;
    5 c, V# l' s& h7 C# w; l' [* x; S
  72. ; @' m' a% E# b1 V
  73. char *dmabufsrc1 = NULL;
    , m* C5 f. K8 _! {3 z% W2 H$ J* I
  74. char *dmabufsrc2 = NULL;
    " z; V" f3 z: a8 ?% J
  75. char *dmabufdest1 = NULL;; b6 U3 W6 m8 V& c0 N$ A5 v- E2 l
  76. char *dmabufdest2 = NULL;6 a. o3 S4 C( l' O: E& r8 `, N

  77. / r8 M5 I: S  s0 X' s
  78. static int acnt = 512;
    6 w. P( N/ v( o- d+ S" v6 ^
  79. static int bcnt = 8;" L( W$ B0 o% P
  80. static int ccnt = 8;0 D9 a& g) Y" P7 L# ]8 b* E' w' T
  81. : ~0 F1 a7 D$ N! @
  82. module_param(acnt, int, S_IRUGO);$ c  Q; M8 J9 N. {7 b+ e4 J
  83. module_param(bcnt, int, S_IRUGO);
    ; E/ \3 B5 S& M& q( \. n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  s. A' ^' L% B/ F% W
' z8 q( u1 p8 Q/ i, H4 z( {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# y( `/ m# Y9 ~; Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% x: @% q5 y: h5 B" s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! ~8 f. _" {& l0 e; I  ]) N& L3 n
7 z) q9 i: Y% f/ Q+ y9 _9 _* `
" ^/ A$ v. A9 Q! D4 e# Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 06:13 , Processed in 0.038151 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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