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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 Q3 t, g4 a/ `9 g- Z! s
  1. [code]EDMA sample test application/ Q; m- U/ H1 r& U3 ?
  2. /*
    ( F! ]0 \1 K& a8 y* P; z
  3. * edma_test.c
    * y  S# T" R' S) z) s8 b
  4. *) t, l  @5 Y5 V( ]
  5. * brief  EDMA3 Test Application. B# x9 }0 }# |; R3 M$ w0 S
  6. *
    " ^2 Z4 z6 S8 U! H1 Y' L
  7. *   This file contains EDMA3 Test code.5 _+ z% A* c; @/ x
  8. *
    ! Y2 L/ N. U# V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) ]& q3 `- o2 r  ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ V7 T2 t) S% u3 O9 ?3 E$ {
  11. *         TO CHANGE.! a: e/ F( A; ^$ ^' q
  12. *! U6 Z- h7 a6 Y1 }) v8 T) p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      q* k7 G9 T/ r& t9 F8 c* A
  14. *
    , v, S  C. Q: v, H5 \
  15. * This program is free software; you can redistribute it and/or" T8 l- R  R; h1 o& o/ c+ r4 M) u/ X
  16. * modify it under the terms of the GNU General Public License as. H5 s8 C( q! B! W/ E; y: x
  17. * published by the Free Software Foundation version 2.4 y$ R- {/ P" o2 e
  18. *: _2 K" C3 C4 x0 L2 n: w$ B# V% J; K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - g; b. ?2 h# ]. w2 h1 z5 E
  20. * kind, whether express or implied; without even the implied warranty& E/ G5 s0 n: x7 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ y" V  w/ x" {9 z
  22. * GNU General Public License for more details.
      Q7 @0 |$ x! p  `% q8 w( ^3 e
  23. */
    3 M+ ]" @. G% A6 Q; Z
  24. 7 K' ?3 F: [9 V
  25. #include <linux/module.h>
    " g, ]  m# f6 a3 x: u+ H- @0 m
  26. #include <linux/init.h>
    9 L' W( u/ O; w2 |- c
  27. #include <linux/errno.h>/ h  k1 m; [7 Q9 W5 C+ `
  28. #include <linux/types.h>4 h5 S/ k' ~' ]
  29. #include <linux/interrupt.h>" K8 K  \' ^/ b) U  Z
  30. #include <asm/io.h>8 n) n! H+ l3 Y- f
  31. #include <linux/moduleparam.h>! W. A! j; L8 N0 R# ]8 y
  32. #include <linux/sysctl.h>
    ; ^5 v. ~! H+ [' q2 s5 v: e9 O
  33. #include <linux/mm.h>
    * E, S+ {6 ~6 s4 R2 j6 e
  34. #include <linux/dma-mapping.h>! K; D% E' |5 Q1 @( o
  35. * x: O( Z! A0 N8 u0 |6 _) d& m0 E- P
  36. #include <mach/memory.h>+ i9 g7 B; x# I  p5 M
  37. #include <mach/hardware.h>/ F% q6 z; `9 ?) b$ ~) h* ]
  38. #include <mach/irqs.h>
    , v- j3 k4 E! \, k
  39. #include <asm/hardware/edma.h>6 @. _0 [; q& J: d2 O9 R- {

  40. 5 u3 d6 c& q/ C3 H0 V1 ~' Q  V
  41. #undef EDMA3_DEBUG: L9 v# y5 w5 }4 H  b! ?3 k$ N
  42. /*#define EDMA3_DEBUG*/* F4 ?+ l+ @8 h# h" P0 g

  43. # c# ?  [' B8 B  A, P
  44. #ifdef EDMA3_DEBUG2 o! \: E% k5 {) i1 H( {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      C" n4 y$ h6 a6 r2 S: N, l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - J* v6 U8 W% L5 f$ c) G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 H! A. \+ W+ M* Q+ N' ~  u) J
  48. #else
    & e* ^, s6 P2 C, {1 `$ _
  49. #define DMA_PRINTK( x... )
    * c" S& f5 O- G
  50. #define DMA_FN_IN, |' w% b, Q' l
  51. #define DMA_FN_OUT
    0 u! D8 O* r) `4 i5 Y
  52. #endif; q0 W6 p% v* |
  53. 3 z4 G" F% R' t# c8 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# c; O+ M0 A8 u0 @/ d6 J! |# V7 S
  55. #define STATIC_SHIFT                31 A1 v  \' w) Q6 C
  56. #define TCINTEN_SHIFT               20. t& V$ o6 H) ~7 V! f
  57. #define ITCINTEN_SHIFT              211 g3 `. v+ G9 }2 S, q0 \. f
  58. #define TCCHEN_SHIFT                22
    ) f6 ]/ f4 G2 B% G* i) h
  59. #define ITCCHEN_SHIFT               23
    ; G' E, _. P/ w/ n6 {

  60. 9 p( O0 L/ k2 [; B- J
  61. static volatile int irqraised1 = 0;5 h( h/ s" l. ?# X; @- J
  62. static volatile int irqraised2 = 0;; E2 n" b* Z* A& C$ a; S
  63. . Y& B1 \( |) o2 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * `+ ^! w4 g6 D. {2 O: O; J: x5 s6 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 A$ [6 Z+ o) h$ z' P  U( h6 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( X4 x% D, w6 a  y  n3 r
  67. 6 c$ T0 j) M& r
  68. dma_addr_t dmaphyssrc1 = 0;/ q& I1 |: T/ m( U  Y! H
  69. dma_addr_t dmaphyssrc2 = 0;
    % ^5 _4 z5 j# S! j; \2 S+ P# }
  70. dma_addr_t dmaphysdest1 = 0;
    , \$ E4 l' o+ k' j: k% _+ W
  71. dma_addr_t dmaphysdest2 = 0;$ X* b. v8 Z1 j! m  u4 G
  72. ; y/ Z6 U5 e. \8 v
  73. char *dmabufsrc1 = NULL;" X2 Z, u5 V& O- w+ O8 U
  74. char *dmabufsrc2 = NULL;- i" S5 J8 M7 }8 \
  75. char *dmabufdest1 = NULL;! C/ t# g! ~& }2 d5 G+ ?
  76. char *dmabufdest2 = NULL;. P$ z5 C2 [/ H5 m( Y3 Q. P

  77. : m3 }$ B" M3 M
  78. static int acnt = 512;
    4 s2 j. V6 ^& H! W( B
  79. static int bcnt = 8;
    6 ~; t* y) w" p3 b, F" a2 Q! z
  80. static int ccnt = 8;
    ; x; y* c& L% H6 i3 F6 _- I, ]

  81. & {4 R7 i' S5 ~! f* Y8 n3 j
  82. module_param(acnt, int, S_IRUGO);. o) s$ w4 \" Y9 Z3 T
  83. module_param(bcnt, int, S_IRUGO);
    1 l* Z$ ~) e: L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# p: |3 y0 k/ W* {' n0 w# J
  d" v6 [7 H6 v& c$ |, v- p/ [7 y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ I% A, [/ a- H3 Y- f0 m% Q& F! Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 X5 a' N1 ]: S/ m# P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 T8 D7 h4 h% \- Y
4 }- P1 c/ M# D3 m" P0 F; c
2 Z7 p% ^% y& j! F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-12-4 07:32 , Processed in 0.040287 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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