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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + y6 t& w4 n$ L3 Y) h
  1. [code]EDMA sample test application
    3 b9 w7 x; j2 t! @. \
  2. /*
    + N" z7 T9 w% l9 p, c
  3. * edma_test.c+ X! x; W  H0 o" X
  4. *7 _2 m0 n+ U- Y) w6 [6 T' L: y
  5. * brief  EDMA3 Test Application" g2 m6 i$ w& ~
  6. *
    4 ^5 x( b7 l/ W$ ?2 D- g1 q* O
  7. *   This file contains EDMA3 Test code.6 k4 L5 J5 Q, u( T( \
  8. *( e- g. c% y9 {% W9 w4 Q( j/ _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" R* z, a/ e* U$ ^4 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. I; X' {1 G( ^
  11. *         TO CHANGE.
    5 ^' r' B+ P! g" o+ g( D: k" i. I
  12. *
    $ n7 }  s3 T; W3 V3 _5 g! ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  k4 q3 L1 A2 ]) Y
  14. *
    % X# D( E1 h8 m% a6 N
  15. * This program is free software; you can redistribute it and/or
    ) v! J! p" M8 W8 d+ r
  16. * modify it under the terms of the GNU General Public License as1 n  \$ k+ n3 c  w. a3 r
  17. * published by the Free Software Foundation version 2.& X4 z; L( k# I* J' Z
  18. *
    + i" H( D/ r4 T  |+ x! W; U, `" I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; H# Y7 g3 ^- e! G
  20. * kind, whether express or implied; without even the implied warranty
    & C7 T% J7 @+ g! }( p  E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 Y* ^9 W1 T. s- Z. B
  22. * GNU General Public License for more details.
    6 l% I; }' N1 Z0 [) z; W, L$ o* L
  23. */
    / P% W" j  ]/ ^5 S

  24. 7 s  I& z! M& y2 [& K$ C
  25. #include <linux/module.h>. o. s6 F! p9 H6 |5 F
  26. #include <linux/init.h>7 F' Q! w- D* s: C
  27. #include <linux/errno.h>
    4 G! `8 J$ ~* S: Y1 P; F
  28. #include <linux/types.h>
    9 ]2 }! M/ t: S8 ^
  29. #include <linux/interrupt.h>
    3 D, B6 T7 _3 o
  30. #include <asm/io.h>
    2 r! ]2 @: W8 I! j0 g) t
  31. #include <linux/moduleparam.h>
    $ }9 z, I2 R- J# d; p( d
  32. #include <linux/sysctl.h>: i& L" v2 d. B/ d/ e
  33. #include <linux/mm.h>
    3 U; a1 a; U+ }! ~9 ]
  34. #include <linux/dma-mapping.h>
    $ H/ F0 Q8 i. q& T4 }# x
  35. . U6 r, h) C! u- P
  36. #include <mach/memory.h>  w" b; D5 L! J) L* J: W: u' e
  37. #include <mach/hardware.h>
    6 ]+ j: y. {3 }+ {
  38. #include <mach/irqs.h>
    7 E; B# Q6 f. n' [! s3 C& l4 J; c& d
  39. #include <asm/hardware/edma.h>9 n7 r, D) ]0 p( s. w! e) ~

  40. " d9 o; M& Y% N1 s7 v& B1 d
  41. #undef EDMA3_DEBUG6 `: s! Z0 x- Q% s
  42. /*#define EDMA3_DEBUG*/: j' R6 o# n$ a1 R
  43. + O+ ^# `! E# B, C6 P
  44. #ifdef EDMA3_DEBUG
    / l, m, \& O3 Y) ^" U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; L( `1 w1 E% s" E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 K( O/ O- x  ~- e/ U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . m: N7 W$ W( u) N& _* \% w" i3 b% ]/ Q
  48. #else; p4 A8 X; p0 k* B8 o
  49. #define DMA_PRINTK( x... )
    - I& B$ C8 \5 X$ l5 T9 S4 u
  50. #define DMA_FN_IN- J) K' @# I' @  [1 Q. v, ?3 u- {
  51. #define DMA_FN_OUT
    - i2 o& y9 z8 M/ O# `: }4 d7 I! @$ n
  52. #endif6 L7 c. s/ \: B. P0 E; V+ m8 S

  53. 6 b* m0 o/ J& }+ Q/ T$ c4 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 W5 h' z# }' n7 U- H
  55. #define STATIC_SHIFT                3$ Z0 F  S& g, {( ~) m$ |; }" Y
  56. #define TCINTEN_SHIFT               20; i; e# [+ O8 z; a8 g; w
  57. #define ITCINTEN_SHIFT              21
    7 R4 p% s+ G/ m7 m
  58. #define TCCHEN_SHIFT                22
    7 T2 Y; P+ U0 p) _
  59. #define ITCCHEN_SHIFT               234 u# F) H' I1 o. o+ B
  60. % R) L5 n4 E+ N+ T- L" Y
  61. static volatile int irqraised1 = 0;# l8 t* O" \  V2 J2 |" @
  62. static volatile int irqraised2 = 0;
    * N  L0 K+ y7 o' @! E% c: y+ g3 B3 m
  63. , I7 A* O, B, k# m$ v5 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + R3 R+ w" A) w' f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: e4 D% P8 ]  O- Q0 U: l( ^5 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 L' p3 G1 E* ]8 e8 t! H& U: }
  67. - z* H5 L: P) H
  68. dma_addr_t dmaphyssrc1 = 0;  [5 S) |: b, U4 I
  69. dma_addr_t dmaphyssrc2 = 0;+ V% H* Q2 I' I' X$ J- ~! A
  70. dma_addr_t dmaphysdest1 = 0;" Q7 ~, u  D; L5 C% T
  71. dma_addr_t dmaphysdest2 = 0;% |% C. o8 l2 O6 L; h( Q6 ?8 K

  72. $ w# I9 K0 w9 J) I" }& a8 K
  73. char *dmabufsrc1 = NULL;$ A) z* c! T! N, I% N, s
  74. char *dmabufsrc2 = NULL;  L" w  f; [/ m, x/ a% Y
  75. char *dmabufdest1 = NULL;
    8 F# \' C3 m1 p
  76. char *dmabufdest2 = NULL;) T! Q3 Y: |7 {, b
  77. # R+ Y) P. g2 S6 K2 h1 u; t8 U
  78. static int acnt = 512;- x' v5 I9 ^' i6 P% N3 Q8 k( _
  79. static int bcnt = 8;4 l, O9 ?/ E$ f' h: q+ U
  80. static int ccnt = 8;
    , T' P4 X, N5 W, n# J

  81. . N" @' o, ?! Q( b
  82. module_param(acnt, int, S_IRUGO);
    3 h& n4 C0 J. R+ O5 R
  83. module_param(bcnt, int, S_IRUGO);2 I1 V0 j7 C7 C' m6 R7 ]0 ?( b9 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. D  m$ K" c1 t# p- B+ C
9 o. D: w8 d) V% Q( x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 M3 N( m0 e' a9 U: q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ o. k' S/ t8 l  D( r  V6 Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 J/ Y7 O! k5 _  p: q' T
% b9 c3 R3 _& r0 Q+ m7 i, P/ r1 S4 c7 H. g
0 ?5 M/ C+ h4 q- P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-16 03:59 , Processed in 0.039178 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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