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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' Y& f" J) v/ C; @7 O+ i' D
  1. [code]EDMA sample test application
    / I+ m- v# z. Y/ Q
  2. /** M9 S" {5 E: P4 \# h
  3. * edma_test.c0 K$ E, q+ m6 P4 G, y3 @0 u
  4. *
    : C3 c6 Y+ j3 M
  5. * brief  EDMA3 Test Application
    " |1 H' n: U1 a0 S5 s  q0 H
  6. *
    # l' J# E- F7 s, l+ k6 `/ h! h# P
  7. *   This file contains EDMA3 Test code.0 g7 m& Y" w& Y6 S; `1 I5 P
  8. *. o2 N: f; o' C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & T" u/ n6 L! k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 @1 H% K5 {$ |" E0 w+ z& @
  11. *         TO CHANGE." ]9 r1 [$ z7 P9 z; T5 w8 s
  12. *1 O, ^; ]% c; m4 |; ]/ F1 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , H- o9 Z; A: R
  14. *
    5 E0 T( x- i0 t) g2 G( f
  15. * This program is free software; you can redistribute it and/or
    9 W7 n3 K7 |  {$ i6 L
  16. * modify it under the terms of the GNU General Public License as) A' l, O6 y# _/ a8 \; V
  17. * published by the Free Software Foundation version 2.. C1 h5 Y8 j% L+ c5 {, p
  18. *
    5 U; h7 g$ [- u; Y0 o7 ]; e# Y. v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 ]  Z+ {- |! C3 g  ^- J5 ?
  20. * kind, whether express or implied; without even the implied warranty& |4 `* \7 v) s  T8 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' {) r) ?- [/ Q3 H1 C. O# W
  22. * GNU General Public License for more details.0 S2 [* `9 |4 V
  23. */: a# @; g# V+ ^- G1 n& _1 i

  24. 5 O/ s! F) k& ~  K, u' Q5 b! {* X
  25. #include <linux/module.h>. z. R, j& F5 C7 }
  26. #include <linux/init.h>
    6 C) U2 ~, V; [/ |0 u7 C
  27. #include <linux/errno.h>
    0 ^* \, B- W3 S  a" f- v
  28. #include <linux/types.h>& ?+ x) p' x6 V4 s, {+ z: K
  29. #include <linux/interrupt.h>
    ' O! x$ u7 I3 N; B4 C
  30. #include <asm/io.h>" Q! j* ?0 R$ j  C0 Y" A
  31. #include <linux/moduleparam.h>8 Q! [: u0 O6 J% `% b( y( k
  32. #include <linux/sysctl.h>6 m) }- |* o  P1 d* R7 N- H$ s( J$ r
  33. #include <linux/mm.h>% r$ Z+ a: l) \6 N1 T. n
  34. #include <linux/dma-mapping.h>
    7 G% V1 H; t; y$ f
  35. 0 v1 ^4 i' Y: |9 r3 I6 ^; p
  36. #include <mach/memory.h>
    0 g* p! W/ I' y& C* _
  37. #include <mach/hardware.h>1 i8 H& _- ~+ R0 K: X
  38. #include <mach/irqs.h>
    6 j9 R2 w$ J: K/ R1 V7 M5 }
  39. #include <asm/hardware/edma.h>
    # a& z$ O5 y% Z$ ^4 E9 N
  40. . D# U/ l- b6 R* ~, P1 P
  41. #undef EDMA3_DEBUG+ O6 b1 ?# u: [4 E
  42. /*#define EDMA3_DEBUG*/$ _7 _9 v/ M9 m
  43. / |1 }! {8 l( n2 H% `; H
  44. #ifdef EDMA3_DEBUG1 h8 X" H& {8 ]% T. v9 p9 {! u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  R  @1 M1 y+ d; _8 R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); {& E: E" v  d1 \8 f/ G' S3 g% A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      o* f- n/ @" {# L( E
  48. #else
      n5 m6 I% W* p; L+ ?4 I. h  g
  49. #define DMA_PRINTK( x... )/ w: }% ~5 m+ ^* B; L4 j$ q
  50. #define DMA_FN_IN
    # u' m- o/ |- }/ E+ S5 n
  51. #define DMA_FN_OUT
    ! w1 L( V0 H6 h8 a/ u2 S8 q
  52. #endif
    1 {& G" _- r: `, \* ]7 N

  53. ! q+ y  o: }# C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 n" n: L* r  F  B: t/ t/ Z2 x
  55. #define STATIC_SHIFT                3* s+ K& Q, U4 f4 b* ~. v
  56. #define TCINTEN_SHIFT               20
    - h: ?& t& G, `) M
  57. #define ITCINTEN_SHIFT              218 r! Y! @, c4 Y( g- y9 K' z
  58. #define TCCHEN_SHIFT                22
    : ~+ i* @4 W" T# r
  59. #define ITCCHEN_SHIFT               23" I! G% c, S& u
  60. # p# _/ f& v. g  z: r0 o5 r
  61. static volatile int irqraised1 = 0;6 o; K/ `, ~0 @$ {) y8 L
  62. static volatile int irqraised2 = 0;- [6 J0 x" f/ m1 {" |
  63. 0 e; \1 q; j( i, l' F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . x4 D! n+ q8 M- G( x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & B3 k8 m2 Q9 c' t8 a6 A$ @* E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# f+ Z# _5 ^. Q7 A

  67. % F/ q9 }3 D3 I. O% x
  68. dma_addr_t dmaphyssrc1 = 0;
    7 I' H* Z) j4 y2 l# o6 H
  69. dma_addr_t dmaphyssrc2 = 0;
    0 k9 @: N/ z: M+ [4 h; ]
  70. dma_addr_t dmaphysdest1 = 0;
    . u: H; B( r& L3 n
  71. dma_addr_t dmaphysdest2 = 0;* p+ f6 g. }# g' `# k8 q4 B# m

  72. 1 P5 d1 \3 S0 c
  73. char *dmabufsrc1 = NULL;% L; l! }* J* |4 l/ X! `
  74. char *dmabufsrc2 = NULL;
    . A* L6 a7 X* w9 r. P
  75. char *dmabufdest1 = NULL;# K( k( U6 x9 ?2 A: P( l
  76. char *dmabufdest2 = NULL;$ m- e5 r4 m2 M% C' d! f/ q

  77. 6 z! ^- Y" ]' T4 }; k% `' M, T
  78. static int acnt = 512;
    1 y! v9 k& e2 N6 J
  79. static int bcnt = 8;
    2 |  s7 c2 }# N% c" y5 k$ x
  80. static int ccnt = 8;' A2 h4 f" |/ U8 E" \* F( `
  81. " q0 U, k! L5 H5 X3 o
  82. module_param(acnt, int, S_IRUGO);
    : P9 G; @- `  k' A: t
  83. module_param(bcnt, int, S_IRUGO);
    ; @" Z! L# m9 Z3 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 ~. y9 S" n( a6 m* J( R, K6 |: b0 E0 I" A( Q+ o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* c: J" M; C( Q3 @$ m- rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# c) |4 d2 u$ o/ h; {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: B+ {7 ]! K" J( j/ C  c: D# R6 U, w" }* h8 n

; W* U! ^& A0 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-18 07:54 , Processed in 0.040587 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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