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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, A# Q( d6 [, d: `9 G
  1. [code]EDMA sample test application" q' ~( N$ {+ \. ^: m3 Y
  2. /*
    % z7 U3 p0 e, _) |- o. s
  3. * edma_test.c
    . M& i" V( C' _' f
  4. *; F- a4 h6 i% N. Z
  5. * brief  EDMA3 Test Application
    - T- U: P+ s- H) c, o! |4 w3 b& ^
  6. *
    7 k  h. Y" Z; L) S0 k% g* C  X$ Q
  7. *   This file contains EDMA3 Test code.4 j. p  E# m' X2 m- j0 @
  8. *
    2 W5 u6 K: s& Z' M( O7 m3 a9 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 L- e4 c' N! ~+ T0 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  S- R, a1 w+ V1 J* M7 O+ w
  11. *         TO CHANGE.9 b1 o* g# `0 }) P" c% d# B+ D
  12. *
    8 I+ D# A% s/ D) b* L( O2 u) H* [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 @) @$ j. N  V  C/ G3 ^
  14. *
    ; M- _8 ~. y; p
  15. * This program is free software; you can redistribute it and/or
    . r, c# _, L+ l4 ~' n
  16. * modify it under the terms of the GNU General Public License as1 q; V# f: c6 y7 k
  17. * published by the Free Software Foundation version 2.
    1 ?- _1 b% G/ x" H
  18. *$ Y# ~) V' s. y' j' v, F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 e' @" W) w& D
  20. * kind, whether express or implied; without even the implied warranty
    " c7 a# J$ }5 b1 p" L# C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! b! n- M  D1 Y  S+ J
  22. * GNU General Public License for more details.
    " H2 G8 t; J3 Y
  23. */
    ) z8 e& `+ x$ g! x* d
  24. 9 j! M  X' E$ S
  25. #include <linux/module.h>
    9 \) }; R/ \) d" t3 _' X$ @
  26. #include <linux/init.h>
    & ]" V6 B; b, i0 W0 Y. n0 [1 _8 k
  27. #include <linux/errno.h>
    + ~/ @2 R3 O/ i! I+ Y
  28. #include <linux/types.h>6 f$ s* h8 E2 F/ E! [
  29. #include <linux/interrupt.h>5 n# h! T8 W& _! U
  30. #include <asm/io.h>' F7 l0 F+ K. [
  31. #include <linux/moduleparam.h>
    ; t- F7 U3 K# N4 c
  32. #include <linux/sysctl.h>
    . @7 Y" ?' X. B6 \3 L9 l
  33. #include <linux/mm.h>* {& }  o2 F4 m% X) H
  34. #include <linux/dma-mapping.h>
    % C; H1 F& P0 M0 Q3 M% ]
  35. 7 y, P" r4 g. u* v3 z3 p  f
  36. #include <mach/memory.h>! K! M3 w% }2 r( ?, x' L, w
  37. #include <mach/hardware.h>
    % H  ^: I8 a" B+ O) w, Z( a
  38. #include <mach/irqs.h>
    ; o2 k. V; n+ s1 A4 r8 m
  39. #include <asm/hardware/edma.h>- T2 X0 W; _2 N' u

  40. / G0 V, i$ K. e, P! X, [# W
  41. #undef EDMA3_DEBUG9 N( I' H. ?0 O* Q2 x- L/ P8 _5 o
  42. /*#define EDMA3_DEBUG*/
    ! ?' v7 h; S/ }* d% P1 e
  43. 1 X& h6 r- h7 j/ Z( D* G) r# w3 s
  44. #ifdef EDMA3_DEBUG3 M3 {  U: g+ D- {- @: i: U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): r6 c+ e4 i, J$ i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* }& I2 g/ y9 [& b0 D6 `1 `- [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - B% K4 ^$ Q# T  O' v
  48. #else
    & }0 F: P% B/ P, ^/ [' }% \
  49. #define DMA_PRINTK( x... )+ F3 h% q9 P4 b6 v
  50. #define DMA_FN_IN0 d4 b; G  m) _5 _% C& |$ B' a
  51. #define DMA_FN_OUT
    4 h8 b- k7 p; {- }) W2 l
  52. #endif
    % O; k7 l# F( N8 M9 @

  53. 7 Z) P8 b# n+ G; d& e7 P( Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& q3 h% O6 K$ }- k' y2 D  ~
  55. #define STATIC_SHIFT                3
    % y. @: K& }8 b( p
  56. #define TCINTEN_SHIFT               20; _7 P) ?! a# B
  57. #define ITCINTEN_SHIFT              21! ^8 [7 D1 b) Z5 J! ~$ N' q
  58. #define TCCHEN_SHIFT                221 k  m  T9 r6 \1 F- g6 ~) E% A4 j
  59. #define ITCCHEN_SHIFT               23; o6 r7 m7 y# ]& @1 M% i2 `
  60. - U5 U( }# b7 c3 ]) |8 m9 @
  61. static volatile int irqraised1 = 0;: u# K3 R0 u( K1 j& ~% e
  62. static volatile int irqraised2 = 0;
    5 D  j) _7 V, }4 O
  63. % v7 o8 v! G2 F0 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 y$ |/ k* V; z& D0 i. r! r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 G; U; P3 w8 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 g; }) W( c! y: H' b& \+ `

  67. ' q' B2 j1 r7 v  N/ V3 V/ x
  68. dma_addr_t dmaphyssrc1 = 0;1 C# T/ r: s! w2 h' A! m: f1 N6 V* e
  69. dma_addr_t dmaphyssrc2 = 0;8 ~: E. \% c! d8 v2 M
  70. dma_addr_t dmaphysdest1 = 0;& C- @6 \& T% t* T2 U1 R
  71. dma_addr_t dmaphysdest2 = 0;
    $ |0 M2 J- U& M8 Z
  72. 2 s( H5 ]. C# K; {5 H
  73. char *dmabufsrc1 = NULL;! C: @! u- x  U* d4 t( L( q
  74. char *dmabufsrc2 = NULL;
    - T9 P; P1 T0 s5 p8 i0 O
  75. char *dmabufdest1 = NULL;
    : a; H9 S5 ?* {
  76. char *dmabufdest2 = NULL;/ n3 r5 a, F' B9 R$ G

  77. 3 P& [0 B- _, V2 ?6 ?$ c* y- _( |
  78. static int acnt = 512;
    # M, h8 L+ P0 [/ u
  79. static int bcnt = 8;3 N7 S# w- p' Q" U% D+ v; p) R
  80. static int ccnt = 8;, @" S% w! T& P% p/ ?& }4 p
  81. # [5 d* v. g% h, ~8 j- h' x/ q) ^
  82. module_param(acnt, int, S_IRUGO);+ q5 S- K' Z0 j8 j, A& A8 _
  83. module_param(bcnt, int, S_IRUGO);
    3 i* C. `& e2 _; l& i6 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& N& E! P4 z! H, ~/ E2 g# [4 ^- L; \+ z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  `( x3 p$ u: q5 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' s- {4 C; V& }2 t7 W( q' w7 j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  S# i! k, {/ J9 X; Z, B
- }$ ^( ^1 _' P0 I- p0 S9 j+ `

9 D6 ]( O& K& d, O$ w8 Q' ^/ t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-22 03:26 , Processed in 0.038703 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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