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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 n! f& C* D1 n5 X( H; L
  1. [code]EDMA sample test application+ N  P  V4 \1 [: a: |; ^) P' R
  2. /*
    % a7 G7 d- j' J- D) l
  3. * edma_test.c# Y5 K* A: `8 ~, A  T( n
  4. *
    : P% {6 L% ~; Q6 E6 ^: g* E
  5. * brief  EDMA3 Test Application
    8 f" {6 j* e; {! @
  6. *0 Y" n4 [) B0 H2 ?
  7. *   This file contains EDMA3 Test code.$ D  Q. j+ s2 p( E# h
  8. *7 }7 B- [1 t- z" s5 L" M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " q' H: a% D3 W) I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 b; t1 T$ m7 I+ m2 ~/ C7 U
  11. *         TO CHANGE.
    + `6 T( _3 `: o8 x
  12. *: e$ E1 k# ?* z# X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & }$ I9 _2 U9 R6 L* H  V/ S9 u! e
  14. *
    . s+ Y6 E* {" Z5 E
  15. * This program is free software; you can redistribute it and/or, y- o9 y; ~/ D* Z* Q
  16. * modify it under the terms of the GNU General Public License as) t# _* z, ^4 A  t
  17. * published by the Free Software Foundation version 2.7 y( y: W" N- U( ^, K
  18. *
    - Y. m/ u1 |. Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 q7 e5 \( d6 e
  20. * kind, whether express or implied; without even the implied warranty
    . I& [$ p/ n6 \8 m: x) N' v& v  q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 [# o% k: n9 b9 _) Y* f
  22. * GNU General Public License for more details.
    0 Q5 W6 E0 Q6 G7 C1 {- S
  23. */5 u) L1 J" e3 B3 z* F

  24. 9 G: h5 {$ }6 n( c& }* Q3 C
  25. #include <linux/module.h>
    $ m0 B3 n# f1 @' {( Z
  26. #include <linux/init.h>1 S0 [, u" `, d& P
  27. #include <linux/errno.h>
    ' G: S! I. V5 \9 [2 h
  28. #include <linux/types.h>
    6 B9 p6 B; w) J8 T4 o0 I3 X
  29. #include <linux/interrupt.h>
    ! o7 ^' P2 h0 o) ^0 I2 t: T
  30. #include <asm/io.h>5 V1 I9 x; n, @; y' y
  31. #include <linux/moduleparam.h>4 y8 P9 P. g+ M
  32. #include <linux/sysctl.h>
    & Z, n% [  o9 L. J) G7 M% O/ F) A+ S$ h
  33. #include <linux/mm.h>
    5 Y9 y0 k# D; ]$ O7 z% o
  34. #include <linux/dma-mapping.h>7 P0 R/ A* R4 ?  e
  35. ; A- @* G5 L# V6 T
  36. #include <mach/memory.h>. R$ G5 e) N5 k# M( d# i) U- n
  37. #include <mach/hardware.h>
    % h( N4 V1 w" ~$ Y! `( t
  38. #include <mach/irqs.h>; d( Q  [: o6 T  h
  39. #include <asm/hardware/edma.h>
    ! g/ `! J, g4 Q' r: V" w
  40. ' ~6 N, A1 {9 z! R3 X8 f! C$ B
  41. #undef EDMA3_DEBUG
    ' t, V! w% A; W& @: E( l3 t4 f: e
  42. /*#define EDMA3_DEBUG*/: d8 ^3 q, O+ C0 o

  43. 2 H% g$ U; ?6 r
  44. #ifdef EDMA3_DEBUG
    $ a6 R& d$ q; I" |% M" `7 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 f- _8 K/ _9 r- t. d  h9 V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 a( s( r. b) w, @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 M/ C0 q* o% Q! K
  48. #else
    2 g- J9 M3 E0 a: Y, O- u7 B
  49. #define DMA_PRINTK( x... )
    3 M* n/ l8 _( O& C6 D) ^" I8 r0 z( N; b
  50. #define DMA_FN_IN4 W" M4 S0 D6 L6 g2 N
  51. #define DMA_FN_OUT
    % O  t0 U; G6 V
  52. #endif
    1 y! z% n, G) Z# |

  53. $ S) Y/ s  j3 }' b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' [; H/ j7 h# g. g0 V7 e7 Z
  55. #define STATIC_SHIFT                3
    , u( _$ d* a$ q9 m  v9 D, ^
  56. #define TCINTEN_SHIFT               201 @0 `& S8 z) y6 t' v
  57. #define ITCINTEN_SHIFT              212 f* I+ n+ Z  N+ z
  58. #define TCCHEN_SHIFT                22
    ' [  B& E7 s: V
  59. #define ITCCHEN_SHIFT               235 M& n+ m' j/ a% S) W
  60. * }- J; x( v% M1 k
  61. static volatile int irqraised1 = 0;; C3 N$ _6 B! R& ^: T' l9 P% d7 _
  62. static volatile int irqraised2 = 0;
      y7 S/ _2 z/ x* I
  63. - E6 l+ `+ ]* e; v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 D. d+ }& J2 }6 H% l- N' Y) U, K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 o' h8 m( T8 r% L  q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( O3 Y' `9 Z2 H/ S+ D% y2 F. e: k7 M& k

  67. 3 f9 K/ ]$ k$ c. O" V( Z
  68. dma_addr_t dmaphyssrc1 = 0;
    6 O$ R" ?, n/ d! G
  69. dma_addr_t dmaphyssrc2 = 0;5 Z. W! e, l: V, C7 @
  70. dma_addr_t dmaphysdest1 = 0;
    ! a0 @" t5 D9 d" h. j# T4 W0 W
  71. dma_addr_t dmaphysdest2 = 0;
    - s3 p) ]& [6 Y+ g6 q$ p5 O

  72. 3 Z+ X/ ?7 O+ A' e9 U
  73. char *dmabufsrc1 = NULL;
    : x' |0 I- U3 K" B
  74. char *dmabufsrc2 = NULL;
    * z9 A' P( |1 a* A( c
  75. char *dmabufdest1 = NULL;2 t, l4 s: V  ]
  76. char *dmabufdest2 = NULL;
    # T, n8 I4 [2 W& S3 c3 p- F' I
  77. 5 }$ U, S* Y7 O& F
  78. static int acnt = 512;+ `& y, B  M) G
  79. static int bcnt = 8;/ W4 ^5 @$ ^7 b. @  n2 k
  80. static int ccnt = 8;* e+ G% W2 g4 N0 Y; b& \

  81. 4 O- v# g$ w  P% E
  82. module_param(acnt, int, S_IRUGO);2 ^, [! c; c* k; R
  83. module_param(bcnt, int, S_IRUGO);
    1 m5 ^6 D/ a, {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 H& J5 @4 N% @& Z
1 ~# m; c; f+ }- _, n4 o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 ^3 I- l8 C) Y/ P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 j% G* F' H- g6 o, K; f8 L6 p" ?( f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& e. o* o2 c, R. a# c8 X& Z4 _. ?' x* ?! b# t3 \1 z6 \

- O! S; L# }9 f' g4 Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 02:30 , Processed in 0.040875 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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