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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: E1 e+ c# f5 i% z' ~) F  M" m) q
  1. [code]EDMA sample test application
    5 j* P# ^: Q0 @- T+ C
  2. /*
    ! F  V7 y8 s9 ^9 B8 t7 ?  R" i
  3. * edma_test.c5 ~+ Y5 z8 H" O0 L
  4. *' B3 g, p0 |$ K
  5. * brief  EDMA3 Test Application3 }, m7 [# x3 L
  6. *
    ( Y' ?& V5 k/ n: d% ~% `
  7. *   This file contains EDMA3 Test code.- u9 n. w$ O  R5 T2 C1 j
  8. *" j7 F: B5 v. ?7 p! Y4 ?3 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 |7 \% a+ w/ B. T2 \! ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) {5 w  M5 v( Z4 K4 n. H) \
  11. *         TO CHANGE.
    ! P! J' [1 g! x( n! ~
  12. *
    1 N* }4 h+ A8 n$ M; t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 ?- h! C# i- v9 @' o2 u6 ~
  14. *( z2 I7 P8 b! R) O" x2 X
  15. * This program is free software; you can redistribute it and/or
    * w6 l6 O% L: C- L' @5 S
  16. * modify it under the terms of the GNU General Public License as
    6 i% m$ X! E% _- C3 w% |8 d' o
  17. * published by the Free Software Foundation version 2." H+ D& {+ i6 ]4 K" U% q
  18. *
    ) f9 E* L" O8 N7 w% ~& n( N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! f- U" X' {. f+ r
  20. * kind, whether express or implied; without even the implied warranty* b6 O8 J/ W/ R. z8 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" u5 p! D) Z. v; f# h, H6 E# _
  22. * GNU General Public License for more details.
    6 f3 l0 ~+ e# d7 y) K( Q
  23. */
    9 ^) h6 ~, D! @$ {, B9 g

  24. . G* E+ v6 y7 O& a. z; m4 B
  25. #include <linux/module.h>( Y* y: Z( Z6 y4 p  e6 h
  26. #include <linux/init.h>
    ' ?/ m0 V$ h, R6 ^4 x- a8 ]) Q
  27. #include <linux/errno.h>
    ( S! x5 U2 M# V
  28. #include <linux/types.h>
    ( ]0 c. R" w9 f! Q+ e
  29. #include <linux/interrupt.h>
    0 e- m! D! V. @2 [  m9 d8 m
  30. #include <asm/io.h>
    - r, a# M* a5 G1 o
  31. #include <linux/moduleparam.h>. Z0 U, X6 X1 e- d  k
  32. #include <linux/sysctl.h>
    * o1 E% u" k6 C7 r1 U5 [- n* f
  33. #include <linux/mm.h>( ]/ {1 y! N1 B9 A* v
  34. #include <linux/dma-mapping.h>7 d  M, p2 d# l7 y5 A8 o+ E  w% e
  35. 8 u# u2 {" ?5 T  a
  36. #include <mach/memory.h>
    $ J9 O3 n" F5 P: C& L+ q
  37. #include <mach/hardware.h>5 Z% ?! w) E; b) I. l3 J
  38. #include <mach/irqs.h>
    6 ]' ]7 L% L" o4 k( k) K8 p" A
  39. #include <asm/hardware/edma.h>& o6 N8 H( L$ \9 x* g% q

  40. ( Q) ~5 p4 _& J6 @( d6 L6 P
  41. #undef EDMA3_DEBUG0 i, X2 P7 T! ~
  42. /*#define EDMA3_DEBUG*/, w( r! m+ @: v# n  k
  43. 6 f3 s1 H" N+ L9 b
  44. #ifdef EDMA3_DEBUG, r: ^9 r+ U& d+ V# U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# o4 N  Q. n! `" t. T# c  |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( u# v5 v" L0 }$ y) s( }  M# N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! b4 e. d; G4 {7 c& @/ E4 i
  48. #else! v, \$ c( X! p
  49. #define DMA_PRINTK( x... )
      L, q0 B. V  ~$ B
  50. #define DMA_FN_IN
    * Y5 K1 y7 d' F# d/ W
  51. #define DMA_FN_OUT
    " Q. Z' x/ ?7 j1 A
  52. #endif
    ! G( s) L. B) v" n+ s5 m& d
  53. 5 j7 k+ r* b) p7 R) e" i0 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & O5 X! f7 p% b! l- b; w+ [
  55. #define STATIC_SHIFT                3
      g/ K! ~$ R7 }2 k! X
  56. #define TCINTEN_SHIFT               20
    , r" |( g# j6 _/ K  ^( `
  57. #define ITCINTEN_SHIFT              21
    7 K, M( w7 |, S) q
  58. #define TCCHEN_SHIFT                22; j# F7 N) y/ H. f- r
  59. #define ITCCHEN_SHIFT               23/ ~' t, o  S3 r- y3 W

  60. / F* A* \8 o, r! x, H
  61. static volatile int irqraised1 = 0;$ g  ~) r( [, r
  62. static volatile int irqraised2 = 0;
    ( S3 c. s# ~- n3 C% B4 J$ i+ Y
  63. " z- ~( S; f  r" n/ Y6 s' z% v+ P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . N  ~" r7 n$ `0 W( T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ s3 k$ E4 o9 a4 A3 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Y5 v0 W# d: l2 c" ?

  67. " E! G7 i! h3 r. G2 ]7 E
  68. dma_addr_t dmaphyssrc1 = 0;' R! Z! t5 [- ^
  69. dma_addr_t dmaphyssrc2 = 0;
    ' X) a. t+ ]: p3 o9 ?! _9 F
  70. dma_addr_t dmaphysdest1 = 0;
    % q. I% g# f2 o
  71. dma_addr_t dmaphysdest2 = 0;
    ( H. b" D: d- j) E. C" W5 W$ m
  72. * y& t9 e% r' U4 R& W+ I
  73. char *dmabufsrc1 = NULL;9 _, F9 K8 ]: L- h
  74. char *dmabufsrc2 = NULL;* ?/ U. }, b) R- s' U
  75. char *dmabufdest1 = NULL;
    1 d6 |* M/ ]& n- z* P7 L0 z3 f
  76. char *dmabufdest2 = NULL;; M! p& o8 G- J/ {3 J2 ^" ^

  77. " H3 v- J% w) r  M  {. t3 p$ P- W5 U4 M
  78. static int acnt = 512;
    ! y9 `- @# Z: X
  79. static int bcnt = 8;0 T) |% D# n6 I" ~
  80. static int ccnt = 8;
    1 @; y  }/ S2 k" r
  81. 8 e7 M* B8 S7 H3 W0 r8 s- x4 v3 n! u
  82. module_param(acnt, int, S_IRUGO);- o$ @8 q0 k1 S( B( ?
  83. module_param(bcnt, int, S_IRUGO);) |4 c. h5 t! }5 d# ?: N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& M5 ^+ C6 \" `
  z3 w4 _/ I0 c% Q7 u* X" f' O9 p5 i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& Z$ ~& b' h: parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- Q! Y4 F' a: M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* E  i9 e$ J1 s" q% @$ w( ]6 D% G8 R3 _8 h/ C

) f! ^0 b9 _% y- L& v# S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 23:21 , Processed in 0.040355 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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