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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , }7 Z9 T. s, Z' V. [# S
  1. [code]EDMA sample test application# @1 q- p1 h) u
  2. /*
    * S) m" `2 P( P( `
  3. * edma_test.c
    : t6 E; D3 _* ?' l7 T9 e+ k  q6 M
  4. *8 Z) W) R9 `" R9 A
  5. * brief  EDMA3 Test Application$ v: E/ Y" g8 Q
  6. *) v9 G. p8 O7 X
  7. *   This file contains EDMA3 Test code.4 O! Q, @* p& p6 k* m) e
  8. *
    1 X1 H8 b5 I: h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . z$ p. x9 q: R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* I( h& H0 n# ]$ Y5 g
  11. *         TO CHANGE.! c6 T, j8 n* }! i4 C
  12. *5 j  o4 J; [7 q: F' S6 R9 D# I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 _1 [1 |) j. @2 Q- I7 w) X  Z
  14. *
    ; j5 ^! a3 e: @# o
  15. * This program is free software; you can redistribute it and/or
    " p! {: ~0 A- A; Q1 g
  16. * modify it under the terms of the GNU General Public License as
    ) Y) j: w! j0 m# v5 W/ K
  17. * published by the Free Software Foundation version 2.0 a( f6 F8 c8 e) f
  18. *5 _/ E. d% z* r, p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 n  b8 ~, g0 E4 E8 }6 g! j% q
  20. * kind, whether express or implied; without even the implied warranty  @0 _" g- S1 v4 O* X% s( {+ y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( r5 B7 m' _8 D$ k
  22. * GNU General Public License for more details.
    5 }$ G* @( G7 Q
  23. */8 F% N2 Y/ N9 ~

  24. % P& F, H* |& w
  25. #include <linux/module.h>/ [1 G" r' X1 a) A' H( n; u) C4 e
  26. #include <linux/init.h>
    : X8 G5 i- Y" L1 l2 ?5 i
  27. #include <linux/errno.h>: Q2 W+ H1 d/ V6 I7 v5 _+ ?
  28. #include <linux/types.h>% F: ?( q8 G) d& r
  29. #include <linux/interrupt.h>
    $ q1 B9 T! f* t6 |
  30. #include <asm/io.h>( s% ~0 H' w$ J) A
  31. #include <linux/moduleparam.h>+ \* ~4 \' F( Q, ]' x& q6 q7 `4 T
  32. #include <linux/sysctl.h>
    ( Z* `! E! S! t& V; r# H* S# \% I
  33. #include <linux/mm.h>
    , U$ f8 r; V* C2 M  _0 C5 }% x1 c( Z8 R
  34. #include <linux/dma-mapping.h># o, M* Z* g- B2 ~& S
  35. 3 P: D1 j; P# @/ Q% _- d0 c
  36. #include <mach/memory.h>
    . J% O# m5 k1 n% l2 T
  37. #include <mach/hardware.h>1 k) ?) C- ]. J( e( z
  38. #include <mach/irqs.h>3 q. k" ?! C% b
  39. #include <asm/hardware/edma.h>
    0 Q+ M$ C: p( p+ D0 t6 B

  40. ; @& u) C5 I3 ^1 }
  41. #undef EDMA3_DEBUG
    6 F4 }# Q8 o- ^8 j+ w* P
  42. /*#define EDMA3_DEBUG*/. ^4 I' g) L+ C
  43. % j/ ?4 J" d* w& a
  44. #ifdef EDMA3_DEBUG
    3 j* S! p6 F, Z1 v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' _. y3 M1 X  i9 Z8 d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      g0 z; m& X/ c% h8 y4 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 g; K- B5 A5 }3 v" `1 [! @) H
  48. #else7 d& \0 E- p" b8 x0 ~! c# p5 n
  49. #define DMA_PRINTK( x... )
    4 |1 F/ s1 {% G3 `7 ~  \
  50. #define DMA_FN_IN. X+ Z) [0 z8 w! T; Q' y9 K0 z% e$ i
  51. #define DMA_FN_OUT
    / L8 [8 w4 v' W. G: J
  52. #endif
    + e2 }5 a+ ?7 `/ M# o
  53. 9 Z; f) R+ n. @; J8 s3 P3 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 j. K6 I1 U, w. E' m, ]; x) W
  55. #define STATIC_SHIFT                3- a! Y( X4 p1 W
  56. #define TCINTEN_SHIFT               20
    8 l" l3 h, f. m% D
  57. #define ITCINTEN_SHIFT              21! K3 X( w& c6 P' C
  58. #define TCCHEN_SHIFT                22+ {0 g% p- s! k+ R0 N, r* |( M
  59. #define ITCCHEN_SHIFT               23
    3 Q$ j+ h! U5 E  N& ^

  60. 7 y$ z' [- a2 e6 O* {3 q$ F
  61. static volatile int irqraised1 = 0;
    & [$ X8 J% P7 Y; y
  62. static volatile int irqraised2 = 0;6 J, t3 Y5 `' Q

  63. $ G8 ]6 O! \* `, B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & r. O! [& H3 x6 B6 l% Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 O9 E  L3 c% W- N5 Y8 E7 L6 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Y  G$ [- F* M  V. U

  67. " f3 H. k$ p$ ^4 l
  68. dma_addr_t dmaphyssrc1 = 0;5 ]5 v  k: ]4 t' V
  69. dma_addr_t dmaphyssrc2 = 0;4 Y- s9 C8 z8 p( P  T( M* @+ h0 n
  70. dma_addr_t dmaphysdest1 = 0;
    , h# J7 ]/ {; y, @
  71. dma_addr_t dmaphysdest2 = 0;: ?2 z  Z" J; @. S7 I9 e

  72. 5 V% f, q1 v  `! }! _
  73. char *dmabufsrc1 = NULL;
    3 h- w8 _( {4 r; s4 h, I
  74. char *dmabufsrc2 = NULL;
    8 \7 c- O5 J1 q. u- {9 D" {1 P
  75. char *dmabufdest1 = NULL;
    4 U8 v. R0 a. W- n( _
  76. char *dmabufdest2 = NULL;$ Y; F& a) R7 H4 C
  77. 9 p. t6 _: [! @* K
  78. static int acnt = 512;# A4 }% _' z7 V' E( V+ V# o
  79. static int bcnt = 8;
    / W3 ^4 A9 l  f1 a8 p7 u& b
  80. static int ccnt = 8;: z9 O, A% @4 a* m
  81. 4 R* K. w5 \- f. u$ Y9 w
  82. module_param(acnt, int, S_IRUGO);, ^) K! [( L6 d/ C
  83. module_param(bcnt, int, S_IRUGO);# s- ^5 i4 _: G& P  M) U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: G1 m/ R2 t  j$ |! }6 o8 S
( c9 D6 S4 J: _$ [! B9 B7 ~: _7 w; l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 W0 }/ q, }& U) y4 A! Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" }, Y' U8 f5 F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 A9 C, d, G2 t' ~
0 u# M! R3 {( J
8 E- `2 }$ q2 t1 v7 |% R% x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 09:04 , Processed in 0.042901 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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