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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ q9 [& V7 b" U; j  x4 I
  1. [code]EDMA sample test application4 B( `: Q. s1 e3 y
  2. /*) v3 R& M" ]- j  p/ Z+ o
  3. * edma_test.c$ w3 e- T- k! \3 _/ d& P" G! l
  4. *
    ' n* u5 ^4 z$ _
  5. * brief  EDMA3 Test Application. ^% [6 v( Q& |' R# w
  6. *' Q# ~# m" K5 R. x* s
  7. *   This file contains EDMA3 Test code.
    8 c: t! Q0 s, o! t/ E6 q, v
  8. *
    ) w' B. z9 ^% [! n! [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! V! k9 a! w6 W3 D6 U* u+ @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ e0 O6 A- X9 J% G) i: _3 C. M
  11. *         TO CHANGE.
    + ^' G/ p3 k6 e" {- A+ |" U' k
  12. *
    5 r5 E0 ~1 ~; `4 `! R- v6 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* Z* i5 \+ a, a( H. @
  14. *5 l: N( K/ x( g* ~4 K! b# o3 `1 Y
  15. * This program is free software; you can redistribute it and/or
    1 I* ?. |% K  m4 J& W
  16. * modify it under the terms of the GNU General Public License as
    8 s4 H4 O" H/ Q/ v% z8 g
  17. * published by the Free Software Foundation version 2.
    : U7 B( f( |" h. p6 ^: n  I3 f9 ~
  18. *
    * B' C2 E2 k) S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; X; s" R. @3 F: ?
  20. * kind, whether express or implied; without even the implied warranty( _! D  _$ Y- g) e) a9 L. _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 I" {) y6 }9 @6 `2 m
  22. * GNU General Public License for more details.% Y7 R2 w( _' r4 @- p9 U2 K( Y
  23. */
    ! F. _7 Y6 L" n

  24. + L/ b" H5 \7 F
  25. #include <linux/module.h># O8 _- ?3 W8 z& v1 N6 M
  26. #include <linux/init.h>
    * r; `& ^* r; |  C( c( T4 l8 `4 f
  27. #include <linux/errno.h>" V: T* l, v" T
  28. #include <linux/types.h>
    ; s- O& Y  b  D: q
  29. #include <linux/interrupt.h>
    ( e2 \" i. ?' g- ]
  30. #include <asm/io.h>6 W* `4 @8 P- T  G/ k
  31. #include <linux/moduleparam.h>
    % O" Q, ?9 T% E# ]: V$ j7 K$ _- l3 n
  32. #include <linux/sysctl.h>
    , W: R0 [& t. U3 ~
  33. #include <linux/mm.h>
    ! g8 x4 W) @  h, P8 ^
  34. #include <linux/dma-mapping.h>
    - i: W8 U/ F$ n$ X- d; `

  35. % \/ A& ^+ j4 H
  36. #include <mach/memory.h>1 z0 m0 ?0 ~( R" Z  J& p  H
  37. #include <mach/hardware.h>
    " p6 u# N+ u4 W7 }  }: Q
  38. #include <mach/irqs.h>
    1 ~; E/ [, I# C8 D: t
  39. #include <asm/hardware/edma.h>) f9 L/ v+ M1 `
  40. ' A5 _6 O7 O$ m% x# G7 D0 H' i0 R
  41. #undef EDMA3_DEBUG
    % v8 d+ g, r; x+ b( w
  42. /*#define EDMA3_DEBUG*/  i9 Y: s/ _# \% g. X
  43. $ S# s) A: n2 z, D6 G( p
  44. #ifdef EDMA3_DEBUG
    0 `9 B7 H: T3 \' k" x: @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! t+ q7 i7 g* N4 P7 d( v" B2 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # a" N" ^% \' d$ _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 ~+ J- I1 E# {7 p1 x
  48. #else* ?' V; F) b( B0 V
  49. #define DMA_PRINTK( x... )9 x% a/ K2 e& e
  50. #define DMA_FN_IN# D; Y. G) J9 B6 L2 ]7 }1 o" u
  51. #define DMA_FN_OUT* W: y- n; N5 n: R
  52. #endif
    4 y4 ^8 Q5 o6 U2 E0 }

  53. : o$ j+ I2 }0 u/ P" t, S6 O( ^8 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 E; o, p8 w" ?5 ^0 w. O3 |. }7 g
  55. #define STATIC_SHIFT                3
    # d/ J' g, w$ E  N/ S1 |
  56. #define TCINTEN_SHIFT               20
    : n) H4 Y( f4 w4 l
  57. #define ITCINTEN_SHIFT              21
    0 m& `, b# d1 K/ C8 A% C4 N
  58. #define TCCHEN_SHIFT                221 X: b* b- J; m% B( {1 H" m7 }: U
  59. #define ITCCHEN_SHIFT               23( v9 ]: b; z/ i$ A4 S
  60. # E, d7 L& P* |
  61. static volatile int irqraised1 = 0;
    6 U) g7 {$ o; B
  62. static volatile int irqraised2 = 0;7 E" S3 j4 Z; h& r

  63. ; X& e. _& a1 m4 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 m9 t0 a, z9 L5 O; H% E& e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      v$ J, N) ?. j& J# ~# b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / q7 G9 z8 V  Q$ ?
  67. ) \3 L; j" _% V2 _8 Z% N6 z
  68. dma_addr_t dmaphyssrc1 = 0;
    5 C/ o# z3 Z7 i
  69. dma_addr_t dmaphyssrc2 = 0;
      |  U. Z0 |1 o) G
  70. dma_addr_t dmaphysdest1 = 0;: q# F5 ?% W0 k: k
  71. dma_addr_t dmaphysdest2 = 0;- Z8 ~& V! i( C2 o) m

  72. 7 E" q0 W/ H2 r4 W
  73. char *dmabufsrc1 = NULL;
    ' \4 g" v- b; }
  74. char *dmabufsrc2 = NULL;
    ; l, p' W5 ~9 o, S3 v& g
  75. char *dmabufdest1 = NULL;
    8 `, l8 k% D3 t( \0 k6 x
  76. char *dmabufdest2 = NULL;& h% X& x) C( u, b9 k
  77. * X7 H1 o# U$ `3 Q# y7 g. w" p
  78. static int acnt = 512;
    - M9 [  t1 n& {* u% \% x
  79. static int bcnt = 8;
    ' D: r* v) O) \7 T# c- C  @
  80. static int ccnt = 8;
    - I0 Q/ c+ j; s# L$ K- C; U
  81. " R+ U$ J* F  n2 m
  82. module_param(acnt, int, S_IRUGO);
    + k7 s8 h  E! G
  83. module_param(bcnt, int, S_IRUGO);8 {9 H* b/ G% N. W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. y& |! c3 Y- |7 h! P& ]: U
6 N5 Z% S: [0 E" q2 [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( z4 x9 {& W* marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 M0 ]( l' l; Y% H$ B: u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% l! a% H; ]- [3 B: T+ p3 b  ~; O2 h
8 a4 c# k3 |+ C$ O8 i( k+ V" B* b
/ x5 P' G) O/ ~$ Y+ t- \0 ~  P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 10:08 , Processed in 0.040013 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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