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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& W' c# |+ H1 f% S6 |
  1. [code]EDMA sample test application# |  V$ a1 i; u$ v, H
  2. /*
    & e4 m' e" k$ q2 M9 q( i  r
  3. * edma_test.c$ ^# [7 _+ o2 \* G4 P) N. O
  4. *9 `6 i3 T+ V1 d$ ]4 ~" T
  5. * brief  EDMA3 Test Application
    % B. z; x2 H5 e0 _  K. m) w' `4 y0 k
  6. *
    : k$ l, F, [7 G2 L- F* |
  7. *   This file contains EDMA3 Test code.
    . B. l" h1 b$ k+ c5 G" l+ o
  8. *6 P, t. ~  c- Q3 E: c1 S- ~) o' H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# q4 p4 D$ U( m! x% \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' `- M$ M& P1 B" [
  11. *         TO CHANGE.3 z3 R: s. F3 E/ F
  12. *' l9 v3 X/ P# w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ n4 n/ x9 J8 ]0 O- x) F/ V* o
  14. *
    9 h+ S) W% ]* i, F8 m; f, a* H, ~7 x
  15. * This program is free software; you can redistribute it and/or$ H1 ^( y4 j" O# i) y
  16. * modify it under the terms of the GNU General Public License as
    - @, c2 Q  X3 z/ \0 r
  17. * published by the Free Software Foundation version 2.
    / M7 s2 Y% B1 N, {6 u
  18. *; `& V4 u3 s. H- J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / @8 u5 l( H. v- ^9 N5 i
  20. * kind, whether express or implied; without even the implied warranty
    ( W- F  ]7 R. j! Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , x( l( o) K* p
  22. * GNU General Public License for more details.3 {  j. V: b# i
  23. */
    4 O7 Q" k/ _* T1 c. _- ^
  24. 6 b8 E4 \  W- F- P
  25. #include <linux/module.h>8 |# X  N5 t( L0 b+ X
  26. #include <linux/init.h>6 x4 Y! u5 Q# D$ ]( s
  27. #include <linux/errno.h>% ~7 u. L& G! l' K" [: B
  28. #include <linux/types.h>0 N3 C3 O, N0 S% x
  29. #include <linux/interrupt.h>
    : R  \' s, m# q& ?" I5 r+ q7 I
  30. #include <asm/io.h>
    0 g& x5 }( I* {# z# u: O0 y9 i: p
  31. #include <linux/moduleparam.h>) [2 m" Z& d: U8 Z+ M0 s
  32. #include <linux/sysctl.h>
    0 a3 `) ^4 n$ Y8 O9 f
  33. #include <linux/mm.h>
    , q% ]: ^  x8 n* {; \, H6 w. c6 O6 S
  34. #include <linux/dma-mapping.h>( ]; n7 _. N# j

  35. 4 H2 y4 R1 R  @) M/ N
  36. #include <mach/memory.h>+ P& s+ n- @1 ]0 ~( W' b
  37. #include <mach/hardware.h>
    : s1 `1 W. w! |% v0 z
  38. #include <mach/irqs.h>
    1 r/ }% F' R6 d* A2 @% a
  39. #include <asm/hardware/edma.h>
    + b& o& g' I9 H% s9 k( A
  40. 0 t* M8 y/ q' P5 |# j$ L/ }, g! \
  41. #undef EDMA3_DEBUG
    ' u3 j/ I4 h0 L- [* X& C& s
  42. /*#define EDMA3_DEBUG*/$ H# m% m* z, v" I/ ?& K3 b& B& b
  43. . d" _+ s: q3 k# N# B! c
  44. #ifdef EDMA3_DEBUG
    6 b  r2 F7 U. a2 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . a6 a; W4 A& [6 Y% B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); M1 l: v/ r; q: F. `) C( k* {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! i; z. o: p) ~0 A' w1 |
  48. #else
    + D$ F+ C% @  J8 N
  49. #define DMA_PRINTK( x... )+ y+ h: }: I. r$ Z1 M0 |
  50. #define DMA_FN_IN
    2 b1 @" _3 [9 q  F# D5 ?% w; S6 w- f
  51. #define DMA_FN_OUT
    ( T* @$ I4 O4 D  n# E" _
  52. #endif
    ! Q+ N. B  S4 Y' X# V( P0 o6 u: i
  53. ' A' d8 N" J, d& R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 b9 u% p) G- D6 ^' o
  55. #define STATIC_SHIFT                3
    " K# d# u: `) g- }6 Z3 c; x
  56. #define TCINTEN_SHIFT               202 f% T1 f  X9 P6 U
  57. #define ITCINTEN_SHIFT              216 w6 ?4 E5 |7 |3 Z, J
  58. #define TCCHEN_SHIFT                22$ u# ?- F- M. H
  59. #define ITCCHEN_SHIFT               23
    $ p- ~% `4 c1 ~* M3 c9 s
  60. 6 j* l" l! P, J
  61. static volatile int irqraised1 = 0;
    / `2 ?% @( v3 @9 o+ \
  62. static volatile int irqraised2 = 0;9 p: ~+ g4 t, G' _

  63. - Y) p1 N  P2 Y+ \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ^* k. W; [6 P6 x( Y7 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! D1 }$ S$ O- Z$ N  `7 R6 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 N3 R% d7 J1 S' ~$ X% I  l# H
  67. ! Z; r2 l$ D& g
  68. dma_addr_t dmaphyssrc1 = 0;; B, V' ?2 n2 L- l7 p; m$ _# \
  69. dma_addr_t dmaphyssrc2 = 0;
    # L$ H" t5 v8 }! N
  70. dma_addr_t dmaphysdest1 = 0;
    9 [' J$ b, b, G. s/ {6 k5 H) p
  71. dma_addr_t dmaphysdest2 = 0;
    $ ~& x: Q0 A8 [2 Y* Y
  72. 1 H; h3 O: b3 G9 t+ o; D4 C5 Y  Y
  73. char *dmabufsrc1 = NULL;
    ) r4 H4 f$ N) b; N  ~# T6 u; K2 ~7 h
  74. char *dmabufsrc2 = NULL;
    % I2 ^; p& A3 H& q7 o: J# P
  75. char *dmabufdest1 = NULL;( G$ i5 [9 C* [9 y
  76. char *dmabufdest2 = NULL;
    1 I/ _4 T3 T1 c) c; m7 t, G
  77. 7 r! {, J8 i6 {0 ~' W& u
  78. static int acnt = 512;$ ~$ @9 O: |2 [9 Q( F: i
  79. static int bcnt = 8;1 |7 E! H2 S7 v& n, M- ?9 F
  80. static int ccnt = 8;& ^0 z+ |- K: C
  81. 3 P0 b  M$ b7 J$ s# _# Z
  82. module_param(acnt, int, S_IRUGO);' v9 s4 P! {# F# p5 @5 y) ~
  83. module_param(bcnt, int, S_IRUGO);8 W+ E: x/ ?9 S8 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 N  S' K" j* ~1 Z* n
% ]  ~- o& Z# O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ e' v/ I/ W4 m4 G! Q) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ S3 F4 u: `2 ?8 F; K/ e" e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 N" k3 }8 G( n9 i: s5 }2 R4 h/ A  c! I
) G2 j9 Q* M) r

2 C" x7 z" d. h/ L/ R2 V1 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-2 15:55 , Processed in 0.041348 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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