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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' y! ~' W  B* ~  R! U! r
  1. [code]EDMA sample test application
    $ Z  d8 K  x+ _. t9 C
  2. /*: i% F3 h; w. G2 A+ q' q
  3. * edma_test.c
    ; m3 G. g& R4 C/ ?' y; H/ a
  4. *
    " {& K4 _% J9 U5 U$ O5 Z1 e& L  V/ T
  5. * brief  EDMA3 Test Application
    - H& ?% r) e. t0 i" Z, U0 A4 S
  6. *
    - r+ ?8 w- Z' y, ]& {6 s: i
  7. *   This file contains EDMA3 Test code.
    + n; y' R8 e% `) R
  8. *: r$ k, k7 C3 Z1 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + A4 P% c" {- |) y; f/ e, H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " U2 r8 E  C% M1 W/ V
  11. *         TO CHANGE.% m3 J$ V% k6 z- Y. Q; E! D% p
  12. *1 O  Q  l4 {; L& d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 X/ ?$ Z/ O3 }$ E- G
  14. *
    5 M: C0 [0 T  I7 J
  15. * This program is free software; you can redistribute it and/or( b4 B, g+ c( ]# ~! T( d
  16. * modify it under the terms of the GNU General Public License as' r8 K& i' L) A' e/ _/ [: g
  17. * published by the Free Software Foundation version 2.0 `# H0 E" u' R* Y8 y
  18. *
    6 L" e- E5 d% h) v( m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 S. t% m3 R) x2 q& N
  20. * kind, whether express or implied; without even the implied warranty
    1 u" q2 @5 d* K# s+ f% ]* C  Q: Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . x+ x3 b/ A" F9 l7 i5 _- Z" |
  22. * GNU General Public License for more details.
    , j$ ]. }/ ]- h
  23. */
    , u2 {5 u$ K6 U- p& b$ p0 h% O
  24. + k, s' F+ S; ]' W( G9 b/ Q
  25. #include <linux/module.h>' R- s- V# A& E
  26. #include <linux/init.h>8 g# P) R" k8 a% q% j
  27. #include <linux/errno.h>3 |7 f) W7 x% K9 u$ y0 f5 Y
  28. #include <linux/types.h>
    6 p4 R  `* R2 _9 W& y- z3 H
  29. #include <linux/interrupt.h>
    : e& M! h5 X% y- t/ L
  30. #include <asm/io.h>$ _. s  w) l) X
  31. #include <linux/moduleparam.h>
    ; g$ {" }8 q+ ?5 b$ U
  32. #include <linux/sysctl.h>
    ; F7 z& B& p/ q2 M
  33. #include <linux/mm.h>
    * l, h& E- C; I. H5 F' n
  34. #include <linux/dma-mapping.h>/ D9 d" x* d$ x+ U9 f2 [

  35. & M7 T3 f) ]2 c3 w0 t1 i9 ]
  36. #include <mach/memory.h># X! |" R& N: y) q% L* o6 q
  37. #include <mach/hardware.h>
    $ e- w% r: P) [
  38. #include <mach/irqs.h>
    8 O: P. g0 @6 O. P
  39. #include <asm/hardware/edma.h>
    ( ]9 V8 K& k4 c3 ]

  40.   {/ f* U' W8 B
  41. #undef EDMA3_DEBUG' x, D1 O/ \$ R1 H3 E# {0 T( ^
  42. /*#define EDMA3_DEBUG*/
    5 m$ W- y  @( p) d( {
  43. $ z) `4 I; Z" u/ a( t, ^! ]
  44. #ifdef EDMA3_DEBUG
    4 j' d# r/ a" v& c8 S: T: ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 _7 B; p/ M/ i# x/ ^' \# q% q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 f. H  V" e1 @5 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ u* q# j7 e; X- B  j
  48. #else
    $ V6 B; `) i- h- j: m) [
  49. #define DMA_PRINTK( x... ). ^# k( B- O, i) G  o) X
  50. #define DMA_FN_IN
    $ C3 d% f% z# T+ y3 Y" u0 J
  51. #define DMA_FN_OUT
    6 x0 C  d/ v% O% }/ U/ \# t7 g
  52. #endif
    6 `( `7 U0 [) H7 ]

  53. $ L& X2 i; N1 P3 Z: f7 C2 y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 r& ]" y0 I. O# d# J! T
  55. #define STATIC_SHIFT                3# }8 P; X+ t( `% |/ T
  56. #define TCINTEN_SHIFT               20
    ! B4 S; \# E( N) z' U- a3 t
  57. #define ITCINTEN_SHIFT              21
    4 `( ]: j# \3 |( ~! a
  58. #define TCCHEN_SHIFT                22( b( w, U/ B0 u/ `
  59. #define ITCCHEN_SHIFT               23
    - y7 H) O% j3 W( t. w' k" \
  60. ) K# U0 D# k9 n+ J1 C- d. j9 p
  61. static volatile int irqraised1 = 0;% w4 B. Z- T8 P4 r5 u4 |( Y
  62. static volatile int irqraised2 = 0;
    1 B& J7 F- q9 ]& l1 U: e
  63. % T7 u4 x7 Z4 x" M2 X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) {( _2 L1 |+ y2 L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! \0 G" k: q, E* H4 d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 y7 J  u% K$ Z) Y5 k

  67. ! V0 e: Z6 D/ ?( t0 l( Q
  68. dma_addr_t dmaphyssrc1 = 0;6 y% {) @# s  M& d' Y* {
  69. dma_addr_t dmaphyssrc2 = 0;+ u* F  N) H+ }9 z$ v$ S
  70. dma_addr_t dmaphysdest1 = 0;& D! Z6 b8 ]! [+ f7 S/ T7 X* I
  71. dma_addr_t dmaphysdest2 = 0;
    9 p# m* Y. b0 e+ h9 b! Q

  72. ; w" s% I/ D0 E- B: v) V
  73. char *dmabufsrc1 = NULL;
    + q; B9 h; Q/ @  C4 V# S4 H
  74. char *dmabufsrc2 = NULL;. i- I7 b+ W9 m0 j$ j
  75. char *dmabufdest1 = NULL;% f' R/ v; @- M$ e0 B
  76. char *dmabufdest2 = NULL;1 I' R. W% R# p- O% a8 s
  77. : ]2 n0 x" \" u
  78. static int acnt = 512;* R# t% G% g* k- n7 D6 \
  79. static int bcnt = 8;
    & o. D, U; D7 Z2 i; j' y. H5 l
  80. static int ccnt = 8;
    , n$ v2 `6 j# G* s* y

  81. : l  N" U- i- f/ r  ]8 Z; ^* ~
  82. module_param(acnt, int, S_IRUGO);
    $ M: }* y; a: ~! ^
  83. module_param(bcnt, int, S_IRUGO);
    & e2 y+ n' u: k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 e: j' d& P9 M

- y" ?/ N7 S+ ]1 X, Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 Q3 `7 ]6 ~; o3 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  B2 r8 d. R9 J. h6 y5 I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 v' I- D1 i! a3 W

1 R" x5 S2 N0 n; a
7 p4 t, a" X* [% \9 u* E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 04:13 , Processed in 0.039637 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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