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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' |6 v) V! r6 v" p; s7 N& b# i# ]
  1. [code]EDMA sample test application
    % z" t* `% a9 S
  2. /*7 X- z0 ?+ v9 y+ Y4 Z
  3. * edma_test.c
    1 C, p- a3 ]/ s
  4. *
    . u5 X0 D) T' B9 T% q! u1 r
  5. * brief  EDMA3 Test Application+ y6 q2 t4 }: n) o+ a9 z4 S& y0 B
  6. *
    $ `& }# V3 A/ l6 O6 E- _
  7. *   This file contains EDMA3 Test code.
    * I7 C  }1 E+ S. g# V
  8. *# D7 E* B, ~' O3 A+ f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 a* g- j- L% b' b$ _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! |% r. ]; I  m# U, z
  11. *         TO CHANGE., X; V: C: @5 o5 G' t. w
  12. *$ m9 _. i: W5 R: J5 f7 _, w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 m4 V. V- G( t' }) e. A, \
  14. *
    + v5 d" X# s4 ~% D
  15. * This program is free software; you can redistribute it and/or  H7 O4 e( `3 ?# K. O3 k
  16. * modify it under the terms of the GNU General Public License as
    . l( }, k6 _9 d# L/ B3 v
  17. * published by the Free Software Foundation version 2.
    ' i8 F0 j+ o6 `4 E/ q7 h
  18. *+ N- O6 W; M$ `* d) k/ T3 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; g8 V/ C2 Y0 U
  20. * kind, whether express or implied; without even the implied warranty# _# S6 T& H. B+ U- L- W( H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' e! E6 g/ \7 d8 z/ F( v+ N
  22. * GNU General Public License for more details.: t  i* f3 N9 g( Q/ m
  23. */
    ' G& F6 B, ?" E1 G" g4 S- S
  24. 7 ^5 y1 v3 U. y( N
  25. #include <linux/module.h>! P+ H, H6 V& A' Q' x2 l
  26. #include <linux/init.h>* ]- A, g3 S) t3 A) B
  27. #include <linux/errno.h>
    7 ~* G- V" D9 w. G" o
  28. #include <linux/types.h>
    + K- @, X/ V9 `$ w- t
  29. #include <linux/interrupt.h>6 T3 {8 X# z: h. S/ W
  30. #include <asm/io.h>
    4 ^( K( Q$ s( g( k' y- f
  31. #include <linux/moduleparam.h>
    , |) {7 d8 f; ?- ?- g3 u
  32. #include <linux/sysctl.h>/ f& f6 z2 M" p4 X; V) o- f
  33. #include <linux/mm.h>1 }9 G: F' r- L6 E# H$ z
  34. #include <linux/dma-mapping.h>
    " F% f- _+ F6 _; |: F
  35. 7 s! y6 U7 \/ S
  36. #include <mach/memory.h>
    9 L* S( W2 l0 M* b, z
  37. #include <mach/hardware.h>& G, E3 U5 X, F9 @
  38. #include <mach/irqs.h>
      j# P6 w, e9 y0 D
  39. #include <asm/hardware/edma.h>
    0 l# |1 a1 N, H6 G3 Y
  40. ) q8 D7 e3 f( N8 i9 W
  41. #undef EDMA3_DEBUG
    " M4 x2 U& B+ Y* T( f7 L7 r- s! n
  42. /*#define EDMA3_DEBUG*/
    ; l/ t$ y# j1 |, }/ |
  43. & v0 O* G; n+ e; z/ M) z- G. i
  44. #ifdef EDMA3_DEBUG
    ) R# O; V6 j' V- k$ j3 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + F+ I2 b- @& x: k; L" V7 s6 @3 d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ O/ b. h3 G& i3 T* H9 g" K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + O  o( R  {' f; l) B) M( \  k
  48. #else7 |/ O$ b1 r9 @7 D' O4 r
  49. #define DMA_PRINTK( x... )
    # j2 }! c) ^# H" _" ?+ I0 I
  50. #define DMA_FN_IN
    0 M: H) o# Q3 l& C5 M, \9 V3 X
  51. #define DMA_FN_OUT8 d5 m! ~! Z# U4 M- {  N. N" u
  52. #endif* u2 w' }! d' ~" \3 ^6 E& E
  53. ( |  Z$ |9 c" u+ `" Y4 Q' [2 f, t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / i# b$ y+ R/ q( Q' w; w( G. B
  55. #define STATIC_SHIFT                3
    + z0 Y) B' M3 N7 Q
  56. #define TCINTEN_SHIFT               20. Y5 t, G( X* O/ ]0 k: M- G0 F2 Z, v
  57. #define ITCINTEN_SHIFT              21$ u( a% \8 @$ }$ l$ W
  58. #define TCCHEN_SHIFT                22. }  u# R% u- [# Q* I" ^* D; X# B% Y
  59. #define ITCCHEN_SHIFT               23: C  f. S; S- a  }- k" a. {9 S
  60. & f2 {9 x  _! b# W0 {8 _( Q
  61. static volatile int irqraised1 = 0;
    9 A8 v+ a5 I7 f# a8 S
  62. static volatile int irqraised2 = 0;9 \1 B  j0 O. I9 a/ i8 y8 |+ _

  63. 5 M* |! G" i8 z5 H! \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Y% v/ t' f9 h# S, y* k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 t- R8 r5 @# K5 F" b9 ~) u5 p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' T& w9 a  b; F, I% X
  67. ( T* a3 X" E- J3 h
  68. dma_addr_t dmaphyssrc1 = 0;: U* M. w( S2 G1 \, P% Z1 `0 e
  69. dma_addr_t dmaphyssrc2 = 0;' {# l& C0 x( d% Z* g
  70. dma_addr_t dmaphysdest1 = 0;* O% B5 N* @7 u& _0 p/ M8 Y) ?
  71. dma_addr_t dmaphysdest2 = 0;8 c) o7 D' T' Q6 P0 ]2 y
  72. 3 u" j# y! d& N2 t; e
  73. char *dmabufsrc1 = NULL;2 l& V, R* v* k8 i2 F0 z& s& j* q
  74. char *dmabufsrc2 = NULL;
    / r) F: Z6 O4 M$ l% b  f. t
  75. char *dmabufdest1 = NULL;5 u6 |* R0 S- y0 w& C# v( u; E, Y# I
  76. char *dmabufdest2 = NULL;1 Y2 L1 n4 G# J& |( N- e; D

  77. 2 Z5 H; v. Q# v( D
  78. static int acnt = 512;' w) m' v3 j2 O- U# V' I% \+ s
  79. static int bcnt = 8;
    ( ?9 N/ ]; k  Y
  80. static int ccnt = 8;9 Z( O4 k" O7 o  Y0 A5 F

  81. # t8 V4 N1 Z  o/ h  N- U' N
  82. module_param(acnt, int, S_IRUGO);5 M# X, u8 C5 w  u/ s+ P0 e2 f
  83. module_param(bcnt, int, S_IRUGO);& t: f0 b, r" }8 c! G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 I! g3 u, }6 j. \# M3 f  W" G
0 ^& q9 Z8 }% k5 M% F' c2 L! L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. j4 j" r; d) h' w. Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 q. f+ D8 J: B  m! S/ ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( B; U% e. g5 o0 W( g% u

  B- \% G& Q$ [
+ C, u  j4 ^; _8 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 18:30 , Processed in 0.040308 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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