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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. z  m3 h- c2 H, V( x* n7 h
  1. [code]EDMA sample test application& r6 Z+ i/ u) _6 M$ D
  2. /*
    + x# k5 Z( u5 R$ q/ T7 r
  3. * edma_test.c  C& v& V* B3 w4 h- [2 a& U0 T
  4. *1 c/ }9 \1 u% ~. A! S1 f
  5. * brief  EDMA3 Test Application4 G6 D/ I& K1 v8 q
  6. *
    ( I  c8 Y# e) }" D% s0 ?- l6 n- F' r
  7. *   This file contains EDMA3 Test code.
    . d! Q6 ~$ M  m+ ?$ \
  8. *
      \6 |4 H8 k0 a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - t, g# R+ b! U7 A2 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; Y: z" C1 e; R) p  v# \
  11. *         TO CHANGE.
    3 N/ `& G7 a' S2 ]
  12. *
    ( V! K( b& R. G. j) R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& Z3 y" q' `* A; k# l. n
  14. *- a6 Q! R5 `- ^) L/ [7 B$ ^3 Q# N
  15. * This program is free software; you can redistribute it and/or
    # z$ Q3 s" j/ E0 q6 V, `& a! ^
  16. * modify it under the terms of the GNU General Public License as1 Y8 ^, F5 l/ Y( V7 k
  17. * published by the Free Software Foundation version 2.
    4 b6 ?  \. \" p9 r
  18. *# N* W( D, G/ z' g" w& V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 o3 z+ ?' @4 @' }. R
  20. * kind, whether express or implied; without even the implied warranty
    / d9 J8 [" o9 i7 I/ N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* {& z9 f: ?( p" }
  22. * GNU General Public License for more details.% |: b: @( U' B: R! B. B
  23. */
    1 }/ X. l) I* o8 F4 I+ _
  24. 0 V' e/ O  a$ R2 Q1 p) L( u1 U
  25. #include <linux/module.h>
    0 N1 j4 d3 W1 R/ e
  26. #include <linux/init.h>) W/ \3 R) |7 h$ s6 V; y
  27. #include <linux/errno.h># B/ F0 g& [8 a1 j! k" y9 s+ H- l
  28. #include <linux/types.h>% H1 m6 c; d8 H  [. S
  29. #include <linux/interrupt.h>
    ' {- e! x& @0 J
  30. #include <asm/io.h>
    ( b- v  e0 D# u; D9 Z4 M3 a* o
  31. #include <linux/moduleparam.h>
    & \+ U" }# P" U9 U* b+ {
  32. #include <linux/sysctl.h>
    & ?& m3 w! H% T8 J
  33. #include <linux/mm.h>
    - N! O0 C- y" }( \
  34. #include <linux/dma-mapping.h>
    # @/ ^% d( f5 {# L. ?; V: L

  35. " ~9 ~4 g/ p: n" J
  36. #include <mach/memory.h>; \8 W2 \7 q3 a: f( t( B" s  N
  37. #include <mach/hardware.h>( O8 @" |9 R. M$ C& L
  38. #include <mach/irqs.h>1 ]0 |; C( v/ B  l, S3 Y- b/ c& W
  39. #include <asm/hardware/edma.h>8 u8 u9 S3 r6 k  o6 E: i, m
  40. - k6 g3 {( |  r0 H9 D+ c  ]3 |3 a
  41. #undef EDMA3_DEBUG
    9 M1 p4 o1 D* C9 S
  42. /*#define EDMA3_DEBUG*/" n; n# C7 D% _3 o+ w: M

  43. & X" m2 Q& n# }- `4 B
  44. #ifdef EDMA3_DEBUG3 @! M% h5 [4 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 X- h3 M6 P& e+ v* M$ t! k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); y$ H. v! d# C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); ^1 a. j, d' X7 o7 l
  48. #else: Y- d! E6 ~0 E+ ]
  49. #define DMA_PRINTK( x... )4 |* u" r3 j( K& \% H$ h; v/ x
  50. #define DMA_FN_IN8 P1 `2 j, d. D- X% E/ t
  51. #define DMA_FN_OUT
    % V3 x, l2 O  i
  52. #endif0 f% v9 M8 x, q" g& R

  53.   t# p/ o6 B6 S7 P1 D6 b* p0 H5 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 W6 M, Q1 e3 l. d
  55. #define STATIC_SHIFT                3  v2 _; t9 z8 G2 i& Y) \6 Y* k. s
  56. #define TCINTEN_SHIFT               20) p& U/ d. Y& E/ K& G0 v
  57. #define ITCINTEN_SHIFT              21
    # i" c' u( S. {1 ~# e, |
  58. #define TCCHEN_SHIFT                22
    $ i! c. [9 v% l8 q2 q# r$ U
  59. #define ITCCHEN_SHIFT               23
      w2 f" i$ |- S3 k

  60. ; E% y" U0 y+ y! G0 B1 V
  61. static volatile int irqraised1 = 0;' Y$ }8 W& `% M$ v) }# c$ {9 I& ^1 G
  62. static volatile int irqraised2 = 0;
    ( X# I! v1 B( D2 N
  63. : S. c" ?  z# k( C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 e6 p' h3 }$ h5 Z3 o8 O6 z3 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ?' P  z+ [) v' }) x# e0 N3 b% Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ O2 U! g& Y! A1 r; c( b

  67. ! d1 p  e3 A* l2 m3 |0 D
  68. dma_addr_t dmaphyssrc1 = 0;2 }/ s5 A- J1 Y, c
  69. dma_addr_t dmaphyssrc2 = 0;
    + X, ?& f% W" y
  70. dma_addr_t dmaphysdest1 = 0;- R8 k6 A) @5 W# G0 P8 n
  71. dma_addr_t dmaphysdest2 = 0;
    6 u: Q; F1 N! g( D. P

  72. * l3 V2 B  f7 B5 k: ~  A8 g
  73. char *dmabufsrc1 = NULL;) M$ u& K2 x' n% L4 h
  74. char *dmabufsrc2 = NULL;2 u6 x3 H: \+ a: w2 {' y
  75. char *dmabufdest1 = NULL;& `1 w$ X3 G8 ~  h# k( P5 K
  76. char *dmabufdest2 = NULL;
    5 u( Y0 d$ e( |8 w8 e9 S$ r! f; o
  77. 2 ]  @$ ^/ G9 {6 q( K
  78. static int acnt = 512;  z; T% u  N- A: j6 y! Q+ _
  79. static int bcnt = 8;4 a; q0 M. |/ Z# m9 D
  80. static int ccnt = 8;
    " V, E. ?1 O! V* x; J9 E( L9 [  g- Y
  81. 0 X0 S% k5 G# n% ^2 e
  82. module_param(acnt, int, S_IRUGO);/ \  K& g& l: T" @
  83. module_param(bcnt, int, S_IRUGO);8 R0 y: [+ B$ T$ A' U  B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" g  B  m9 }4 K; Z& q5 {
, b$ E- q4 l; T. M4 y. C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ F. e  T; H! }) R( g0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& Q* o" j3 [( w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! O8 G/ ?) k& j4 O$ L
7 Q  z* E' ]0 b9 ?( w8 N
, y" v- k( c: T' @) L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-9 11:34 , Processed in 0.041201 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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