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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- l: V, V3 \* ?" X2 v
  1. [code]EDMA sample test application% A0 n! A: o$ p: Y. h6 `
  2. /*
    ( ^% W: j  r' F* P$ f
  3. * edma_test.c. ~' _2 d" }  z& m% [% m
  4. *% D- p/ W+ q' F
  5. * brief  EDMA3 Test Application
    2 q2 U. Y: t3 n6 Y7 {5 N
  6. *
    + L( Y8 _1 V8 u+ F
  7. *   This file contains EDMA3 Test code.7 b! D  x# a4 l1 M
  8. *
    % k3 w8 c/ t7 d% E1 W$ \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 H9 C4 ~) S0 a! Z3 j# ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      X, l. n& G: V
  11. *         TO CHANGE./ R% T; Z; C% A2 g" Y- Z2 n
  12. *
    , T; M! b7 x3 ?; c  U9 F" m6 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 ?/ @4 G1 f- W) d& ~; b
  14. ** {0 r# o% t$ _. ~! a7 l
  15. * This program is free software; you can redistribute it and/or/ U/ y( N& J5 k% C) G8 R
  16. * modify it under the terms of the GNU General Public License as+ V3 h& R; v0 V4 Z: y3 v: F* _
  17. * published by the Free Software Foundation version 2.
    . h$ }$ y" z  `8 i7 i0 M
  18. *
    ) t3 R* C% J+ e- c( k7 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% Q( V/ }8 i( J1 h8 B: K
  20. * kind, whether express or implied; without even the implied warranty
    0 e$ ~$ @! ^# M6 z' e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 t% j! v- n; [/ f
  22. * GNU General Public License for more details.
    5 M* C/ i& u/ D) z* x7 b: Z
  23. */0 p; ^. F) ^; t6 z7 p4 u
  24.   F2 M/ u9 {: L/ V# }" l6 A
  25. #include <linux/module.h>) `% S* N4 H4 J  V( r# a* I
  26. #include <linux/init.h># ]* L0 [* G, c
  27. #include <linux/errno.h>, Y) c% I1 T' T6 R; n% _
  28. #include <linux/types.h>) I/ Y- U. ^. \8 i6 R
  29. #include <linux/interrupt.h>
    * r0 W( i6 d' Z6 ]3 \1 m
  30. #include <asm/io.h>: A- M! H  F% l5 d* u
  31. #include <linux/moduleparam.h>
    7 e- h$ Q& O% N! l+ `  P, ?
  32. #include <linux/sysctl.h>) V) A4 ]* F1 _! x2 T! F
  33. #include <linux/mm.h>( K3 U- A- Z' `+ \
  34. #include <linux/dma-mapping.h>9 M$ W- v; D  d8 N  D1 T$ h' B8 d

  35. : \' Y. Y& v: ~3 l# @0 }
  36. #include <mach/memory.h>8 _7 E0 |" j) m* h$ o, ^
  37. #include <mach/hardware.h>
    0 `! |, T  q0 n  ]
  38. #include <mach/irqs.h>5 U/ l; y* G2 A2 x& D, }8 L0 @4 `% n
  39. #include <asm/hardware/edma.h>
    1 ~4 y2 ?9 z. E5 o  C0 I" s
  40. ( r: B& V' B9 f0 _  Q1 y
  41. #undef EDMA3_DEBUG: g3 O# W) j7 `9 t$ d' h+ o7 ?
  42. /*#define EDMA3_DEBUG*/: `% ^' h4 l' o' t, ~% ?! O
  43. 0 p& F4 i7 K, w5 b  [3 H1 y6 ?" g) R
  44. #ifdef EDMA3_DEBUG
    9 m8 _8 I" C- Q+ w( `& `; f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 {5 u1 X, z- V) ^: r% O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 i( O! ?# S3 v6 f, Y% n  J9 H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 ^7 T0 r3 H$ I; a4 O& h6 |
  48. #else
    ) T2 O( a- s2 F" P2 ^5 C* R
  49. #define DMA_PRINTK( x... )
    2 L. P% [/ ~0 O+ A9 \) x
  50. #define DMA_FN_IN7 u/ h  \; y$ I# B/ G( j
  51. #define DMA_FN_OUT
    5 T* v# }3 v, U/ v. \' }
  52. #endif1 q6 Y# v8 M: R" B! b
  53. 0 K2 W8 e8 {% r7 G! y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ ?% T- j' x. M3 F- D( n5 G+ S
  55. #define STATIC_SHIFT                3
    4 m" m2 M$ \6 l7 g6 q# N
  56. #define TCINTEN_SHIFT               201 C, z" [1 _9 N. P( W
  57. #define ITCINTEN_SHIFT              21- Y! W  J: j2 C. Z  T, n/ v
  58. #define TCCHEN_SHIFT                22* h# b8 K. o* w# P) A8 N
  59. #define ITCCHEN_SHIFT               23  s& S9 s: M, B$ A
  60. 6 ]1 \& @7 w& o; o
  61. static volatile int irqraised1 = 0;5 P7 z, Y. E& W( _$ {
  62. static volatile int irqraised2 = 0;0 C# l' k6 y+ l* E  @; @
  63. 6 |1 O* h# U; F# z3 C' ~( m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 {& E% _# o( d8 F% E6 y9 I6 r  ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* k$ c% r, y5 O/ n- U' ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 P2 U& u$ ?) ]) W( n, U9 U
  67. ! x, e7 N4 {# G, D" _' R
  68. dma_addr_t dmaphyssrc1 = 0;
    8 c9 W$ W. P: w; h3 i
  69. dma_addr_t dmaphyssrc2 = 0;
    ) U( Y, Z  n8 H1 P) R+ Q9 B1 X9 d
  70. dma_addr_t dmaphysdest1 = 0;3 ]" f- x1 F( F2 o& a4 m
  71. dma_addr_t dmaphysdest2 = 0;, O2 d+ @4 R7 [: Q2 r, e
  72. 7 u; a' S( [) P7 f! c( s* d  r' \( ~; V
  73. char *dmabufsrc1 = NULL;
    3 N# K( k# K4 U* n
  74. char *dmabufsrc2 = NULL;
    8 M$ A5 N& S: f1 b: G
  75. char *dmabufdest1 = NULL;
    & |1 [9 x5 r& j8 w; I  U
  76. char *dmabufdest2 = NULL;% }4 I8 j# C+ w2 ~

  77. * H8 q. t( P8 k* T% `, d6 A. |6 `0 b
  78. static int acnt = 512;
    9 e7 M: g) ^# o* c% O# a, ^' X
  79. static int bcnt = 8;
    5 a0 c# `& c1 |; d0 q0 g5 J
  80. static int ccnt = 8;
    ; C3 c  s! _2 ]. _/ ]

  81. - c3 P2 \  `& p# k1 m
  82. module_param(acnt, int, S_IRUGO);
    + k1 C0 z; j) M: _: G
  83. module_param(bcnt, int, S_IRUGO);
    5 h5 z4 B3 D3 b2 l5 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 I6 w! k! d  X6 w: _" |
5 U, l9 [, H3 }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 A5 }" J3 Z7 q( c, ]! Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% D5 l" s  v; V' |- v0 H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) J" @/ B" M9 ]7 a+ ?. h  g7 D6 \4 g  U% Z, K
/ m4 t  _8 h6 k9 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-30 22:02 , Processed in 0.038382 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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