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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - f+ v0 v! G2 n  l' q. U
  1. [code]EDMA sample test application
    1 F; Z' m) c% ]+ M
  2. /*4 v% E5 W' |9 |( i, G$ V% h
  3. * edma_test.c
    3 d4 A8 q7 n4 a2 t, M7 {% s
  4. *6 H- F) S/ U! H
  5. * brief  EDMA3 Test Application
      i: @8 E$ Y4 D
  6. *
    - c2 `9 ]! i) u# X' L3 i
  7. *   This file contains EDMA3 Test code., u- y* X+ ~7 y2 |+ X& J
  8. *5 b6 y% ?4 z/ Z& j! U' K+ m* T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 \4 g- a2 S& D0 w5 S- U# x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) Q6 G0 v) X+ ^! d* f5 s* {; F% W
  11. *         TO CHANGE.
    ( n7 y. O+ C7 ]! K* G
  12. *. U+ H# _/ k5 J: V8 D5 e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ ^0 m* z2 W& `
  14. ** F. }0 b+ {# T$ [8 s! r
  15. * This program is free software; you can redistribute it and/or3 ]* u3 A2 ^4 n) M+ i; V" p" K
  16. * modify it under the terms of the GNU General Public License as, S. P" A0 \" H$ Q: s2 N+ K# ]
  17. * published by the Free Software Foundation version 2.5 G: s4 o( {! ~+ ?
  18. *
    " u" J, o5 r( M: x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; D) v- t3 V  A% o+ p* b) D
  20. * kind, whether express or implied; without even the implied warranty8 f; X5 g0 I9 R3 r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , g& J2 r0 U2 @
  22. * GNU General Public License for more details.) [' d2 H: q+ e
  23. */7 ^3 q! u6 C3 }2 r" T  J: H& r& g

  24. . p. g/ k5 D- P- f: X
  25. #include <linux/module.h>: w! K( G  L2 W& Q" \
  26. #include <linux/init.h>% l0 r: Q2 I2 ?5 [4 T" O
  27. #include <linux/errno.h>
    $ ?/ r* R# P4 ]% E6 W+ y
  28. #include <linux/types.h>. C/ r# n! W5 d( |
  29. #include <linux/interrupt.h>9 }" B8 s4 Q! u8 T2 k
  30. #include <asm/io.h>
    1 I& n/ P2 w% W7 ^3 S, D# V3 i8 T
  31. #include <linux/moduleparam.h>
    - p0 D6 ?8 Y  O6 u& O: r
  32. #include <linux/sysctl.h>
    ( y( E# D% h: ^# `; H' L; `# H5 S
  33. #include <linux/mm.h>
    2 ]- p- l; S6 _
  34. #include <linux/dma-mapping.h>
    ( L( b  f% ^6 ?2 p: r! \

  35. , {+ ?+ s: D, |( `% Z
  36. #include <mach/memory.h>) {& v* u3 E$ d
  37. #include <mach/hardware.h>" N* p4 w' O% Z( @" h4 u
  38. #include <mach/irqs.h>: a- N# F# u" u* A" k  l
  39. #include <asm/hardware/edma.h>( s0 p* r3 R- Y! J& _; l6 j2 v0 q
  40.   K( {: a, F/ T( f
  41. #undef EDMA3_DEBUG
    ! u2 R. y2 K, ]# L! F; K
  42. /*#define EDMA3_DEBUG*/" s5 L1 T) B+ m9 ^- v1 l4 o
  43. * D5 c3 G8 ]2 }0 K/ C2 Z! `$ P5 A+ M5 Y
  44. #ifdef EDMA3_DEBUG
    * x0 a( o$ @  h2 e1 E0 y6 o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 f: Y' T, ~% C0 I! @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; l" e. D( M! Z: i+ h+ F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / N  P. ^  p1 |$ `, N  j/ B+ v
  48. #else4 k4 ?" S" M8 M( H& ^0 P
  49. #define DMA_PRINTK( x... )0 @4 f" G, ?4 f' M' X/ z& R& q
  50. #define DMA_FN_IN
    / X7 X5 x" {: p$ V+ i; G+ X
  51. #define DMA_FN_OUT* d% R2 \1 z6 t$ Y3 }. N7 L- `
  52. #endif
    " }8 N; o0 }# |, ]: r. d" X8 \  o* \

  53. 2 ?; P' q6 }9 M2 [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 Z& f7 L; y# U8 J2 \
  55. #define STATIC_SHIFT                3
    ; ]/ ^% F0 `0 O/ q8 S
  56. #define TCINTEN_SHIFT               20' Y+ d9 [. ?" c7 b! v2 a
  57. #define ITCINTEN_SHIFT              214 G( s/ l3 C: _& D0 W+ S" s! p7 J
  58. #define TCCHEN_SHIFT                22
    , V/ ^% ?. W1 S7 l5 C8 U) c
  59. #define ITCCHEN_SHIFT               23# c) p" G4 \4 Y7 e9 v7 m
  60. ! d( n/ s; V/ ]" i
  61. static volatile int irqraised1 = 0;
    9 |0 a% R0 T5 e6 m/ {5 |
  62. static volatile int irqraised2 = 0;
    . f6 C! X* l; o6 o6 d* n" J

  63. 1 {1 `! c6 `5 o- d+ Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & y6 N' e# o6 t5 w+ [- o2 K6 X& U1 W. T/ Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . E8 f* t+ t  X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - c" y9 g- S( v& m

  67. 0 e5 f0 a, h, \6 ~! o
  68. dma_addr_t dmaphyssrc1 = 0;5 o. P1 `6 T% e- h
  69. dma_addr_t dmaphyssrc2 = 0;' ^& q1 p! f4 M
  70. dma_addr_t dmaphysdest1 = 0;: b+ X4 t. d5 @& q
  71. dma_addr_t dmaphysdest2 = 0;
    . p' [. c3 I" h# L
  72. 2 R) [1 E# o# G2 y
  73. char *dmabufsrc1 = NULL;* G" a5 C' S  ~0 S4 e7 o4 y
  74. char *dmabufsrc2 = NULL;! @2 |. G1 _# B
  75. char *dmabufdest1 = NULL;
    # @  p) f1 x$ D9 w' l5 M
  76. char *dmabufdest2 = NULL;
    . C: L: y& J3 D, Y6 E% k
  77. & U/ ?, W2 [* X3 |+ {
  78. static int acnt = 512;- N! @0 q+ D: O
  79. static int bcnt = 8;
    2 X- M' {+ w: B5 _! \# B
  80. static int ccnt = 8;' i, e1 \. P8 W; X0 W- `
  81. $ g" C0 y  j- k# c8 w# y
  82. module_param(acnt, int, S_IRUGO);
      z5 s- c' u9 m6 g, Y* Y
  83. module_param(bcnt, int, S_IRUGO);
    4 y4 S8 h( n" A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( o+ ~9 x7 y. u: [9 R+ k, S1 y6 C
3 x  k/ c9 M5 h' Q8 l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' S5 t9 f2 E. W: H/ u4 o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' C1 _: \% Z+ b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 K  A& O( r8 W/ K8 s4 M5 e9 U

4 L: B! j9 Q  ?6 B  q; _, @9 ~- q+ X1 f9 p5 z0 I% ~* r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-10 09:07 , Processed in 0.042122 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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