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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 |% L, e' v1 m4 n
  1. [code]EDMA sample test application
    . |6 b# r  P7 S& u; ^/ o! R; O
  2. /*
    - s/ e" M: p5 n  B
  3. * edma_test.c
    $ N* V. i" b7 o6 p' `% A4 J8 t
  4. *- ]' G' Q0 H0 D; j8 P1 s
  5. * brief  EDMA3 Test Application
    1 \' ]1 |9 |  c- h
  6. *! _# k: M9 L/ h% B' R
  7. *   This file contains EDMA3 Test code.! P# Y; `- |: Y
  8. *
    & T0 h! ~% r2 f% b: }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 b1 g) o3 y* ~- U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 M- ~1 F; c' W7 i4 F. _1 d
  11. *         TO CHANGE.& [% Z0 `: P0 Q& s6 H' H
  12. *
      p" g) @8 a" z6 j0 z$ b+ L( {2 q/ f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 [$ S- @1 _; w6 \  F$ G4 H) U
  14. *% r2 u( x% N/ l0 D6 d, M
  15. * This program is free software; you can redistribute it and/or
    " _, r% m" i* s, w, _
  16. * modify it under the terms of the GNU General Public License as; x# U" \, v1 G2 h3 C# R0 g
  17. * published by the Free Software Foundation version 2.
    ) J. `* Z6 O2 `5 C* n7 P. `
  18. *
    ! L% T3 u7 z4 w( `! {7 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ p1 B0 f- e% ]9 j: h% W( |
  20. * kind, whether express or implied; without even the implied warranty  o* O" v- g6 T# B' a! O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 u4 C8 n# Y' H9 b% B
  22. * GNU General Public License for more details.
    / f5 X) g: h  ^/ B! ?
  23. */
    ( j( X  F, X, ~& @  q/ w( m
  24. 8 z1 l6 Q' {5 |. g5 {8 }
  25. #include <linux/module.h>0 y5 ~. t8 O2 y! Z* r7 j
  26. #include <linux/init.h>* ~1 i3 |# u* D, s# z' P6 T1 A
  27. #include <linux/errno.h>
    2 W9 C4 B( \  R, V' k! C9 g
  28. #include <linux/types.h>0 R1 g. ~1 \+ V4 l: e3 w# ]& F0 \- h
  29. #include <linux/interrupt.h>
    7 A& i: @6 Z2 {* S
  30. #include <asm/io.h>
    6 G8 i, \) @' ?* T! v) _
  31. #include <linux/moduleparam.h>
    9 j  y# y9 U$ W  w8 l# s; Z  P
  32. #include <linux/sysctl.h>5 q. K- }& K1 A8 p4 w( R
  33. #include <linux/mm.h>
    " c7 [! U0 ?2 F
  34. #include <linux/dma-mapping.h>* m; B! M+ B+ P; M( B9 U9 v5 O8 ?- k
  35. ' ?- N# W6 o- g+ {- J
  36. #include <mach/memory.h>. D# X/ ~# ^, Q6 d
  37. #include <mach/hardware.h>
    ! U* H/ o2 ~! P) t
  38. #include <mach/irqs.h>6 ^" n) a( p* U  v
  39. #include <asm/hardware/edma.h>: Q0 W4 H, c! e* x- P: r" `" R

  40. 0 G# w% |+ u  S  e+ C3 h: x; p
  41. #undef EDMA3_DEBUG3 P( K: ~2 I  G. r: q+ S9 N; o8 u
  42. /*#define EDMA3_DEBUG*/
    # o9 z! ~$ o9 u7 j. [4 l) f, G* W

  43. $ }1 X) s6 Q! p1 j
  44. #ifdef EDMA3_DEBUG
    7 _7 O6 B. F% o$ j7 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & g* |) x$ \! `! c  ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). t& X3 f) A% g' c9 a! N. G- Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 J. j. v7 Q# G  O4 L& S: q
  48. #else
    ; w7 P! N% b8 L; a% j2 A( U& R' a
  49. #define DMA_PRINTK( x... )2 \0 C7 p- P9 n9 L# O
  50. #define DMA_FN_IN
    0 C1 V' f& J" V+ N* \: t% M2 q
  51. #define DMA_FN_OUT
    & H, z+ n% }, p/ w1 M
  52. #endif
    7 T! Y( b+ z6 R, I

  53. 4 m9 {, i8 P. F: O5 F; R8 ^" Z- Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : I2 O9 Z9 i4 o# V
  55. #define STATIC_SHIFT                3
    8 e) Y6 L' w* l0 j- Q3 D$ `
  56. #define TCINTEN_SHIFT               20
    * i% S$ e1 D/ z9 K5 L
  57. #define ITCINTEN_SHIFT              21% P, s4 n! ^3 t, z0 C& }! l
  58. #define TCCHEN_SHIFT                22
    ! j2 J* H: x# I" Q4 k: F) j$ P
  59. #define ITCCHEN_SHIFT               239 r# [  X7 v2 g1 R7 M; u. D4 S
  60. $ r$ y3 H" g' N4 l1 b( Q9 y) M
  61. static volatile int irqraised1 = 0;: d! Z8 {3 k. }7 E: ^
  62. static volatile int irqraised2 = 0;
    ) ?5 u8 f, B$ w3 x9 L- g5 k) P; r

  63. 0 V: a4 i; p# H4 Z0 ?/ m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; H) J* R& N$ l8 M5 n1 t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: m, s0 g5 w, O1 J4 P; W9 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % `1 O6 x+ u% T

  67. ; J0 l1 ^  ^- e! K' u+ H
  68. dma_addr_t dmaphyssrc1 = 0;& p* e1 u$ @5 X& d8 W' F  L
  69. dma_addr_t dmaphyssrc2 = 0;0 O6 ]# j; J6 q
  70. dma_addr_t dmaphysdest1 = 0;
    / K# z& {+ |% j- G( A( I
  71. dma_addr_t dmaphysdest2 = 0;* \$ p% q6 C) F" c
  72. $ u& G! }5 z5 e! H' V
  73. char *dmabufsrc1 = NULL;
    * Y8 R9 _6 s& h9 B1 `3 v
  74. char *dmabufsrc2 = NULL;
      y7 Z8 r( S+ F% P6 I
  75. char *dmabufdest1 = NULL;( V' x8 f7 p. t
  76. char *dmabufdest2 = NULL;1 p/ v4 [" ?$ B( j8 V) b
  77. " L4 U3 R3 y  P) G, ?7 C
  78. static int acnt = 512;% q$ Y7 B. d5 g9 `0 S$ i1 b% M
  79. static int bcnt = 8;6 u/ K6 S) J- G. w& M) R! `
  80. static int ccnt = 8;
    2 E! G. D1 D2 `4 c

  81. $ a6 ]+ x& q. ^. ?* e
  82. module_param(acnt, int, S_IRUGO);% k  [  c" A0 p
  83. module_param(bcnt, int, S_IRUGO);
    8 P( V' h( S8 O# q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* c1 Z$ w1 `* T* F0 A+ C8 M
( l( O2 g7 a; t  l3 k+ q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 e' Q) M4 N  @! [- e4 t& d* {& Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' J  b1 s+ {2 e4 K1 S4 d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- n6 s- n& E; p' J7 D
! N# a' r8 l2 ~1 E9 X6 e* G

( N6 `, V0 o7 ]+ B) G2 G6 G  r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 03:59 , Processed in 0.040621 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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