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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; c7 M% g/ s) W- q1 q
  1. [code]EDMA sample test application/ I5 z- E, ^6 i7 t* ~7 B7 L
  2. /*% S8 u4 s4 F7 f. ]- O
  3. * edma_test.c2 ?6 R8 g7 J6 U. t4 w
  4. *
    7 w4 L4 T+ C7 D& l* e
  5. * brief  EDMA3 Test Application. T% H4 E! y4 ]
  6. *" W  c' \: M$ A
  7. *   This file contains EDMA3 Test code.% C7 x# i& q: [% y
  8. *  n+ l' L1 K' s, T! F# Z  H! [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 \5 |+ P# |. U9 f& x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * `. M" J7 F* `( c  j/ P
  11. *         TO CHANGE.
    - v  H5 W: t6 m; N$ D* m: P0 ^& o
  12. *: q9 Y* i& z9 y2 J% V, P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( X1 i& R( G/ y; h
  14. *6 }5 ?, l8 F4 I$ x) w0 g" `
  15. * This program is free software; you can redistribute it and/or
    : X! |+ N/ k- T/ o- `
  16. * modify it under the terms of the GNU General Public License as
    ; v# `! @" \- c6 z+ i+ O) J
  17. * published by the Free Software Foundation version 2.
    + M$ @( D  p6 M4 M9 {8 |, Q
  18. *
    5 D% i) y1 X$ J  f4 y! t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, _1 W7 ~3 e  j* m  }1 x8 u
  20. * kind, whether express or implied; without even the implied warranty* ~  q3 b5 s8 s3 x6 @4 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! C- u& W% Y3 N$ i4 \9 Q& ~! a' v( I: D
  22. * GNU General Public License for more details.
    % ~  B7 G( q& U+ R0 g
  23. */
    6 M* j0 {$ X; l- e% L+ f
  24.   j5 i! |- W) e; s5 b# l/ y
  25. #include <linux/module.h>0 R8 G; ^# B; Y0 Y' d" ~& k' G8 c
  26. #include <linux/init.h>( u& X' d; ^% {  k
  27. #include <linux/errno.h>; A4 N  }+ o4 t+ N& C, i
  28. #include <linux/types.h>$ ?1 T1 w8 l$ S  W. v, J1 R& g
  29. #include <linux/interrupt.h>
    : r+ }7 d$ W. V
  30. #include <asm/io.h>3 R) c% h. B6 ?4 A
  31. #include <linux/moduleparam.h>, R; Z2 r. S, T; F
  32. #include <linux/sysctl.h># w) N" t! `! R  ~
  33. #include <linux/mm.h>9 ^$ d0 l1 U7 {; P( ]* n9 }
  34. #include <linux/dma-mapping.h>7 [4 p/ e! X' H+ K" G% g8 F. ~

  35. " P9 z0 \' x$ }/ j% j5 {6 n
  36. #include <mach/memory.h>: B; g! R4 W+ c  j
  37. #include <mach/hardware.h>( r8 k1 }" P0 G- `5 m1 r/ i
  38. #include <mach/irqs.h>" v2 w  x( i; B( t( J( r
  39. #include <asm/hardware/edma.h>
    , l( K8 G$ X! B( j; r) R9 p

  40. ( \  @- q" D' T( {8 q
  41. #undef EDMA3_DEBUG
    1 r4 L& c' W* \" ?7 \1 D
  42. /*#define EDMA3_DEBUG*/
    0 [3 a& l  h) j& I3 V4 w) c$ o

  43. 8 v/ Y" c% L, W7 h
  44. #ifdef EDMA3_DEBUG
    # @- P5 N, N; ]" z& h) ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 w3 e% ~, o' t/ n) a2 n+ _3 _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - Y1 N. I9 t# k: Z0 ^: z2 R& P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" k% z+ I7 K) F) o
  48. #else
    . D+ f. d& |; L
  49. #define DMA_PRINTK( x... )
    ; F* d: y& ]. v9 A. N& |
  50. #define DMA_FN_IN
    : }) W) {& z  \# l
  51. #define DMA_FN_OUT
    % O: R* b! S& `# [+ J8 B0 _7 ?
  52. #endif% l; p( l' R; L2 L0 V. c" M% s6 U" c
  53. 3 s2 w0 t% C' N; G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ {1 D7 J4 A1 @! [3 f5 I9 y( N7 t
  55. #define STATIC_SHIFT                3
    # H# h4 c; s! ]; ?; m1 Q' K# l* i
  56. #define TCINTEN_SHIFT               20
    ; ^$ L, L4 j2 k% Y. _4 \$ A
  57. #define ITCINTEN_SHIFT              21' K; U" E' H; {
  58. #define TCCHEN_SHIFT                22
    % W2 q6 h* t0 n6 G" `) c4 W4 c' I
  59. #define ITCCHEN_SHIFT               23
    - d- o# i' n' \: F* k4 E& y& U

  60. & [6 J6 P6 V  V
  61. static volatile int irqraised1 = 0;
    * N) T/ u7 j: J# ~/ S+ W
  62. static volatile int irqraised2 = 0;
    ! Q. j7 r$ \* E( T5 M! Y: M$ P* l  ]: [

  63. " i+ o8 G9 J$ ]0 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# @0 `" s5 m; h5 o6 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 U) P3 _1 t% {: ~6 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % ?. e$ n% X3 [& [

  67. # y$ I: d  V  T) I1 r
  68. dma_addr_t dmaphyssrc1 = 0;8 @0 l% v* z; B. P7 j4 y0 \7 F
  69. dma_addr_t dmaphyssrc2 = 0;8 @( [4 l& r9 C. Z- r
  70. dma_addr_t dmaphysdest1 = 0;
    9 @0 F0 c% }* h( N, W# W8 a
  71. dma_addr_t dmaphysdest2 = 0;
    . N# E% c) p) X) R$ v
  72. / ~: M8 ~6 g! t: I
  73. char *dmabufsrc1 = NULL;8 T1 C& r  [  D
  74. char *dmabufsrc2 = NULL;) U0 q# o* x  G2 l! f+ t9 ^* }5 t
  75. char *dmabufdest1 = NULL;
    8 N# J( A9 u& G# m% t, E  _# m8 `
  76. char *dmabufdest2 = NULL;3 }$ W$ ], r% ]4 @

  77. 7 n7 w0 F7 |2 q
  78. static int acnt = 512;
    4 I. F$ O9 b' y- l& _/ Y
  79. static int bcnt = 8;
    # [6 ?6 s0 t( [/ U1 ^
  80. static int ccnt = 8;, A2 W9 v' p; u5 g, [
  81. 4 c! G' m! y3 T& E0 _& |
  82. module_param(acnt, int, S_IRUGO);. R5 L8 p  V, x
  83. module_param(bcnt, int, S_IRUGO);' j, f' d. [1 j+ c& v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) p; w& t( ^) o4 f

  h& T- s3 Q' u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; k, z. d0 o3 ?& |1 z$ t& r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 K( o8 X: J- ~* g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 }2 @* \4 {1 p% b' Q! e- q2 F3 j
2 i/ A' X& P$ \/ U  I; C& z- c

0 m& F8 b6 }6 w7 I7 t( h( @' O' B6 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 04:49 , Processed in 0.039348 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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