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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # i/ o4 h! B+ b' t/ P
  1. [code]EDMA sample test application
    " ~  X0 U1 J/ Z" F& E& n# ^& |
  2. /*" d/ e' @5 ^6 P+ v. k  K! g; i- k9 D' R
  3. * edma_test.c$ |& D4 ^+ B& X# O4 X
  4. *
    + \* N. w! H, `
  5. * brief  EDMA3 Test Application
    ! y6 o# c2 F) F- ]
  6. *
    ' e( V; X, c5 ^! U4 s0 P- h7 a- o5 z
  7. *   This file contains EDMA3 Test code., j8 i, Q( p! O% J9 h
  8. *
    . J1 b$ F' b. H! ~6 y+ T) a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* ~( u! ^; B: i; ~- R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 a: d2 i' }, Y, U2 ?2 z. `, y2 J
  11. *         TO CHANGE.% m3 `# G% i- e" A* L& S5 L; t
  12. *
    2 s! Z! G3 Y% \, G3 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 ?5 A7 R4 l" H: d; O6 Q6 F
  14. *, Z) i# C+ o4 V& f$ d2 z
  15. * This program is free software; you can redistribute it and/or
    % |* {6 w( Z7 {% F1 s3 L
  16. * modify it under the terms of the GNU General Public License as
    ( y; ]- Y& A* Y  I* G  G, I
  17. * published by the Free Software Foundation version 2.
    . N0 O8 v2 w6 ?" I2 A; [! f' w
  18. *
    3 l/ r5 j4 ?- k6 B) i) a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ n& ~6 q( W. ~4 \, J& M& K
  20. * kind, whether express or implied; without even the implied warranty
    - t% R) V* X4 r: o$ r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( M: T( ~3 B* d! X; N$ {1 Z* z
  22. * GNU General Public License for more details.  L5 o/ C% X% n4 `
  23. */4 Q- o6 Z+ A( R3 \* x6 Z5 e
  24. 1 ~6 {6 B9 E; i  m% @- n
  25. #include <linux/module.h># {* w8 W) c$ @3 ?% v( ?- X
  26. #include <linux/init.h>
    $ B2 U( N9 ^3 }
  27. #include <linux/errno.h>
    2 S1 B8 C( s& j
  28. #include <linux/types.h>2 z0 w% u$ H! y" Y- n& T. j, j
  29. #include <linux/interrupt.h>6 N& W) e# j% Z) `- x0 v
  30. #include <asm/io.h>8 v; `' a# ?/ f4 F: [3 z  c! B/ Q9 r& C
  31. #include <linux/moduleparam.h>
    8 p1 o# }) R8 ~6 V- I; D3 i. K$ W
  32. #include <linux/sysctl.h>
    / y3 ]! O: v; H+ U$ L
  33. #include <linux/mm.h>
    * w$ y! n1 H" V% b- P
  34. #include <linux/dma-mapping.h>
    % ?7 g) }, H# W1 ~$ _" t

  35. 8 ^) N, l8 G, O2 _; L; t- @, W
  36. #include <mach/memory.h>
    , {  W2 l. o3 o% x* [' }
  37. #include <mach/hardware.h>: g/ [4 F' G" X" H8 s+ v! o
  38. #include <mach/irqs.h>
    1 A4 ?4 S2 S3 R$ y6 o, f" s
  39. #include <asm/hardware/edma.h>
    * R7 c. R3 }- S, E/ ^8 c1 A

  40. 7 l. Q$ {  y8 S% G$ [
  41. #undef EDMA3_DEBUG# L2 M! a: q: j0 y; x
  42. /*#define EDMA3_DEBUG*/7 L9 r2 U% M7 H

  43. + C2 s+ C3 c. ~9 g% a
  44. #ifdef EDMA3_DEBUG3 Z) h6 f9 `8 h: C1 I  V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* |% D9 x) J. C+ I1 `4 Q. }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 h8 @/ ]7 }* b( b$ O# F1 @! e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  j9 Y5 Z; g, ]3 ~* Q0 }3 @
  48. #else: Q/ M+ P" {8 P5 R
  49. #define DMA_PRINTK( x... ), b* _4 H7 @# x
  50. #define DMA_FN_IN# T6 Y( O9 K' Z
  51. #define DMA_FN_OUT. {. v$ s3 p5 ~! w/ f
  52. #endif7 d7 p# @5 W" `
  53. $ I+ J. ?1 _1 w$ n3 o5 z9 Z+ Y1 J; _! ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 ]! |8 V# n' w. X3 Q5 Y$ Y- X
  55. #define STATIC_SHIFT                3* A- z) c+ |1 H# Y/ c2 {) j( i
  56. #define TCINTEN_SHIFT               20
    ' }/ e  _; @- l. |6 p. j
  57. #define ITCINTEN_SHIFT              21% T7 w  J( V0 ^  E% N. J
  58. #define TCCHEN_SHIFT                22* U! g3 ^( V; J( e
  59. #define ITCCHEN_SHIFT               23
    & K' u+ |# `1 W! p6 ~& E: i, x

  60. : A5 S. c2 _1 Y+ z# b2 I3 ]
  61. static volatile int irqraised1 = 0;7 b! g4 X" T8 J% N
  62. static volatile int irqraised2 = 0;
    ; z! m4 |& e/ P: b

  63. ' H; \* L0 C7 ]# \/ b, U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + }5 o& _4 H$ }. J1 }0 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' o- y, K( f) @: y/ f) e3 c" T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) D( N6 Q9 [& W4 M

  67. 7 v2 Q2 V: T: U1 Q4 M1 v
  68. dma_addr_t dmaphyssrc1 = 0;; T; ]# `% I0 L; _/ b5 o1 X
  69. dma_addr_t dmaphyssrc2 = 0;
    1 m* T) {( {2 l
  70. dma_addr_t dmaphysdest1 = 0;/ _, q& _2 {% ]* k; o7 S9 f, |
  71. dma_addr_t dmaphysdest2 = 0;% m7 r# K$ v! w7 B
  72. ; [$ v5 s0 Y, `5 Q# B
  73. char *dmabufsrc1 = NULL;# v7 {8 Y2 M9 \; G- S2 l9 _- ~
  74. char *dmabufsrc2 = NULL;
    2 m4 a  \! l8 f5 E! a8 v
  75. char *dmabufdest1 = NULL;
    - j3 ]9 b, E. V. m4 T) @6 i9 f: j; e
  76. char *dmabufdest2 = NULL;2 m2 a  A3 d; C" _

  77. 6 i* b! b# |+ }. }3 A! ?
  78. static int acnt = 512;
    * C, {# T0 F) O
  79. static int bcnt = 8;
    ( Z- J) W' S, z
  80. static int ccnt = 8;
      b, I4 H2 M# E4 J4 a3 |: U* F3 G* l; \

  81.   w$ `$ H) m& j6 E9 f; C6 x
  82. module_param(acnt, int, S_IRUGO);
    9 L, k! d, s+ e$ @, m
  83. module_param(bcnt, int, S_IRUGO);# y7 P6 K, i# y6 t' R" P" L  [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 M1 r+ x7 @2 N6 B; z
% [2 }9 f$ ?6 ]9 n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. I* M: L- z  T" karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! {$ N5 w6 d6 X- x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ g- s- z/ ^- N3 h
; n9 k5 L: \4 M  R7 F) M6 }) D8 E! s; u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-29 07:25 , Processed in 0.042079 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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