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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 e% H8 z3 ^+ j0 r0 p0 Z
  1. [code]EDMA sample test application
    6 L, R0 T7 E& F3 j" e
  2. /*
    ) s6 t) W3 |/ k1 r9 y  M8 e
  3. * edma_test.c; X) H" E* H/ M
  4. *8 X" V4 n! L. \# x& q& @( Z
  5. * brief  EDMA3 Test Application
      {" ?  Q. l# R4 b) y4 M
  6. *
    5 k. n4 c3 K# A7 Q7 ]. d. B9 M2 n
  7. *   This file contains EDMA3 Test code.- b4 a( g9 z6 Q
  8. *7 j0 `7 L8 k3 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - ~: l: k  d/ J( ^7 D( H6 b5 b: L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % Y. V- D0 N7 N+ A. i8 d
  11. *         TO CHANGE.
    , ]8 F+ H; o" _4 x1 \
  12. ** r4 e4 g3 I! E, _0 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 [  ]5 @+ A% @6 ^1 M5 _/ w
  14. *6 k. \% Y+ x+ Z: I& ^- ^
  15. * This program is free software; you can redistribute it and/or
    9 f" |; J2 y$ B) T" B
  16. * modify it under the terms of the GNU General Public License as
    0 N; m% R+ O: V3 c) |4 C
  17. * published by the Free Software Foundation version 2.
    ; T3 E* m( q& T4 N& l; j! r5 M. u9 ]% y
  18. *
    5 A; L7 R3 i6 |$ \. K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 \) g5 {: ^5 i; f: m/ V! ]# |5 y
  20. * kind, whether express or implied; without even the implied warranty( E& Y, K' o5 x& D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / e- U* l% a0 \4 j* x3 u, {
  22. * GNU General Public License for more details.4 E/ q$ H' b4 s$ c. G& `/ v& h
  23. *// @0 m: f# {) O+ N, @% g' e
  24. , Y1 R8 L+ K" r# b8 [
  25. #include <linux/module.h>
    : z: h6 j; s: E$ e3 v! u
  26. #include <linux/init.h>
    1 e( M9 Q# F6 t. t- ]0 |& {
  27. #include <linux/errno.h>' f. i1 K& F, F$ g9 u" j6 i# i
  28. #include <linux/types.h>' L+ e% z5 n+ x# k+ H8 w  [  \
  29. #include <linux/interrupt.h>, z) S" V9 e+ q
  30. #include <asm/io.h>: Z( [, R, v( h2 h) I+ @! E
  31. #include <linux/moduleparam.h>
    ) x4 ]3 i0 _- I( o4 B) U
  32. #include <linux/sysctl.h>
    ' ]1 L# Z% T: C9 w$ }
  33. #include <linux/mm.h>
    $ `2 `2 a, ^  h  |
  34. #include <linux/dma-mapping.h>: J- M* D7 F8 O3 D
  35. : Q; N) N# S" G" [3 C) p0 W
  36. #include <mach/memory.h>9 ~6 c, ]" H, _
  37. #include <mach/hardware.h>3 X0 F0 m) i% P( x2 b6 A" a; r
  38. #include <mach/irqs.h>5 Y0 A. a- m1 s  o6 S
  39. #include <asm/hardware/edma.h>3 W# l1 w8 n# }

  40. . v4 \4 |: A$ }: q4 `
  41. #undef EDMA3_DEBUG
    , [2 B2 H4 Z1 `: I2 Y, G& W
  42. /*#define EDMA3_DEBUG*/6 x7 G; ~" d3 h3 }, C
  43. % ]1 }+ @$ X  S3 |4 T* U
  44. #ifdef EDMA3_DEBUG- O  U* N3 L) j! W  c2 f0 {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 T( C/ P& s9 k; q7 k+ t- o3 s1 D, v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # F6 t4 A: {; _( l1 A' O. o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 K% x  g* l; Q$ K6 c; _$ P. V  A
  48. #else
    , z/ p4 z! O9 ]' v9 t+ r
  49. #define DMA_PRINTK( x... )
    3 f/ h8 x$ c/ H
  50. #define DMA_FN_IN
    4 _: ^- l5 x; v# p
  51. #define DMA_FN_OUT) ?9 [# q6 D# r% K( F5 q
  52. #endif
    / j- u1 v; g/ p. I5 \% Q3 J5 Q
  53. ! a. C8 `6 j' k2 b  P$ f# m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 I! E1 i. Q* H$ u4 I
  55. #define STATIC_SHIFT                3
    ) b" f4 A* X6 H/ @6 H- \
  56. #define TCINTEN_SHIFT               20  _/ o  k! S; ^' R1 t$ {
  57. #define ITCINTEN_SHIFT              21
    9 U% t+ }, \! N
  58. #define TCCHEN_SHIFT                22
    * n+ a  L( f6 v2 w" }3 w; M
  59. #define ITCCHEN_SHIFT               23( J6 |& e  @0 ^

  60. 7 T! B4 R" @( R3 D, O
  61. static volatile int irqraised1 = 0;7 l- Y9 Q# b4 B. E' M
  62. static volatile int irqraised2 = 0;
    & D! t3 ~- V: M( |
  63. 9 U4 o6 T1 k2 O0 a* c6 g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 A' [. d: p( f; _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 U) K8 X8 t# ~, I/ L6 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) e+ c' S/ J& f' W, J$ {- C
  67. * D3 u- j$ z: L
  68. dma_addr_t dmaphyssrc1 = 0;+ d! I& R. ^1 m6 h. k7 b# w0 Y
  69. dma_addr_t dmaphyssrc2 = 0;& y# h- z. r) k0 n6 c
  70. dma_addr_t dmaphysdest1 = 0;2 Z! |7 Q$ b& P+ W$ K$ ^6 S8 `- X  E
  71. dma_addr_t dmaphysdest2 = 0;
    1 G4 Y. ^% f4 g- b9 U9 l1 J
  72. 4 \7 M, E: r  x6 Q
  73. char *dmabufsrc1 = NULL;
    5 v: H8 O( x; M8 d
  74. char *dmabufsrc2 = NULL;  V0 c* Y1 O! S4 X! b
  75. char *dmabufdest1 = NULL;
    / }2 b  h5 h+ A. n% g* b) N
  76. char *dmabufdest2 = NULL;
    . r1 }: T& Z( `

  77. ! U, c* o; _7 e7 T2 W" @' w' v
  78. static int acnt = 512;) ~! w7 k; s6 F. W# g( o
  79. static int bcnt = 8;
    : w/ j1 l' A* a
  80. static int ccnt = 8;
    " f/ z' m- X0 ?8 n* g- L8 ?$ k- g
  81. 8 V) e2 l0 h& v
  82. module_param(acnt, int, S_IRUGO);0 n4 z: {% P3 a9 t' W$ j3 B* U
  83. module_param(bcnt, int, S_IRUGO);
    " S- C4 t! p6 Q* a7 U: d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. q5 c" }/ p+ G  `/ n2 N, T( ^* R& D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 Z$ t0 H+ I! B- K& l2 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) Z, L4 Y& l: Q/ s. A; W0 x$ |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& t9 w' L; z+ x! H9 D  z
! g6 F6 i3 C/ U) h. e( q
  V. w( S9 f; s3 ~0 a; b# I2 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 00:06 , Processed in 0.038559 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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