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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : h$ B' l# Y! l
  1. [code]EDMA sample test application
    0 E: Z& L5 N: a
  2. /*
    7 G8 Q9 @$ W" w3 y8 t& d( a
  3. * edma_test.c: q- w/ e3 L3 X  [4 V
  4. *
    , a7 C2 J# D+ R$ ~; u1 N. ~
  5. * brief  EDMA3 Test Application% p1 J' }% I3 B) S- a, ?4 @
  6. *! ]% w9 w2 l1 ?' d
  7. *   This file contains EDMA3 Test code.
    - M, C9 {& w5 e
  8. *! d  K* A( [) s+ g. ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / u. ?3 ?: x2 {6 G. E  S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * s2 D; }/ x$ b* B# s
  11. *         TO CHANGE.0 j, P7 `2 O' C+ v
  12. *7 R1 g: f% }: \: x8 o/ C! ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. S; D! R/ ?. H2 `% Y9 q
  14. *+ [7 z: _; g4 `( w4 g5 v% {
  15. * This program is free software; you can redistribute it and/or
    1 v2 t+ a! b+ B9 B
  16. * modify it under the terms of the GNU General Public License as- @# v  K3 _; X) [' w6 j1 r
  17. * published by the Free Software Foundation version 2.7 q  P" ^3 v1 X2 I
  18. *
    6 r! s8 ~5 I* U/ L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# u8 o  n, C" `7 A! l( {5 F: m
  20. * kind, whether express or implied; without even the implied warranty: B- ]( x- ~$ g$ F1 L) S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ p- D9 O$ \( z4 f
  22. * GNU General Public License for more details.
    4 B4 l6 H0 C. B: d/ ^( @$ u0 }" O
  23. */
    & B( |' B* l; H  N. \

  24. 0 g" B" ?0 I- J& s! J
  25. #include <linux/module.h>
    ) S) O) E& X- v/ w8 b
  26. #include <linux/init.h>% ~3 U6 F0 a5 ]& g5 v- m
  27. #include <linux/errno.h>  O) g5 h4 ~" z; k
  28. #include <linux/types.h>5 n0 ]& c+ F1 k' |
  29. #include <linux/interrupt.h>
    & a0 ^* `+ X9 z4 D. j
  30. #include <asm/io.h>( t0 H, N" ~! }* J
  31. #include <linux/moduleparam.h>
    , z$ F6 I9 K  o- o, l. a
  32. #include <linux/sysctl.h>- F! H$ L; q! Y
  33. #include <linux/mm.h>$ ^3 ?, w1 l5 L
  34. #include <linux/dma-mapping.h>5 S# c# [0 ?: [
  35.   V3 \5 X9 r1 P. L7 p
  36. #include <mach/memory.h>
    ! I: o- F3 s1 N+ N, L" ~
  37. #include <mach/hardware.h>
    - ]( Y, U' C) S- i7 o, L2 l
  38. #include <mach/irqs.h>
    ! `+ n$ x6 ]( S5 C9 Y! x# P
  39. #include <asm/hardware/edma.h># R( F( t6 m7 X, X

  40. - h& P6 j$ ?6 H* ?+ ]
  41. #undef EDMA3_DEBUG
    4 Y. u- F1 M) M) E* Z
  42. /*#define EDMA3_DEBUG*/. [0 d% a# }7 J0 e

  43. ' z3 V" C' m0 R; B
  44. #ifdef EDMA3_DEBUG
    " i' k6 x4 c/ [7 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 N, ~% i6 P2 q, s  W- n# g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & {1 p- A4 P- r. j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , Q1 R. `% a: y0 n) o
  48. #else* @% D) W+ \& C' k  v( w
  49. #define DMA_PRINTK( x... )' _/ O/ ?# x. f) k0 z* G- s
  50. #define DMA_FN_IN
    " [, ?3 b5 o  s7 B, M8 a' f
  51. #define DMA_FN_OUT
    . ^6 F& @  \- s$ ?1 N( @6 x
  52. #endif
    1 ^' y  ]( S( l6 j

  53. ' r1 z8 ?4 [# ~" o5 u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- R3 u4 U, \" M7 r2 U
  55. #define STATIC_SHIFT                3
    4 Z7 Z5 _& D! G; W' }9 k* Z' C8 M7 C: e& ^
  56. #define TCINTEN_SHIFT               20
    % N) s& }3 \  ?6 Y- F) l" D" H: Q8 K
  57. #define ITCINTEN_SHIFT              212 n% i$ `/ c6 L2 U1 h$ I& P, X2 T; l
  58. #define TCCHEN_SHIFT                22
    1 D8 l( x, \; p
  59. #define ITCCHEN_SHIFT               23
    $ M8 b" F1 F( m1 `3 l, {% z

  60. 3 V: f( N- e' ?# f1 p) A4 ?  S' ^/ M
  61. static volatile int irqraised1 = 0;3 q4 }& S( |, _9 K( d3 G6 h& ~
  62. static volatile int irqraised2 = 0;0 U! ^: X8 ]1 y: ]1 s& q
  63. 9 }( b5 v1 C6 _% v6 t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # F1 ?# _: _  T( m& B4 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ U) A+ p  _# ]1 q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: T& ?) @6 m, \5 g: g/ F

  67. & i7 o' |8 K% v
  68. dma_addr_t dmaphyssrc1 = 0;
    9 {# a& u+ ~, T9 C9 `8 R( A
  69. dma_addr_t dmaphyssrc2 = 0;  \+ L: i2 v; _! S- C" Q+ ]
  70. dma_addr_t dmaphysdest1 = 0;; A5 b; u; ~! n2 [. w" r/ ]
  71. dma_addr_t dmaphysdest2 = 0;( ]' T3 ?( u0 [5 D
  72. 8 S5 B- R- G) G+ k4 _1 [
  73. char *dmabufsrc1 = NULL;
    ' v5 k; J5 u! F8 s. Z
  74. char *dmabufsrc2 = NULL;- B" r, A6 x- H
  75. char *dmabufdest1 = NULL;
    ! N  ^3 Y' m3 A. g: R/ ~- [4 f
  76. char *dmabufdest2 = NULL;' e1 _" W+ b- Y$ W5 D

  77. . `5 c' V" l4 `$ \* y
  78. static int acnt = 512;
    0 }! y6 I) l# i& ^+ D4 q) Y- D
  79. static int bcnt = 8;
    4 ~( D0 ~+ ]# g7 P8 r4 b+ O
  80. static int ccnt = 8;7 a- @# W2 n* @* n# r

  81. 6 d* Z. B' m% d1 p6 `1 @9 P
  82. module_param(acnt, int, S_IRUGO);8 }2 ?* H$ ]; z) ?8 Y
  83. module_param(bcnt, int, S_IRUGO);
    ; E* N8 {: Y) p7 j/ {/ D9 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 e. a$ U1 F$ Q; v+ n; w0 P- v& T! z  b# q% `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  U9 O  g; o9 D  a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% P1 T5 }  u  k5 O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 e4 q. x+ t0 t* J2 M6 |; p

4 v. {3 Q) d4 u4 I; A5 L2 y/ E' |9 O0 T- C# L' j: N3 p: ~. L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-13 10:33 , Processed in 0.045151 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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