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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 D% ?' m/ [9 T8 D/ M) T
  1. [code]EDMA sample test application8 g. E; _( }) T  V8 \; p/ ~) m
  2. /*# J: k! v( V; c5 i6 ]1 k9 O. e3 B
  3. * edma_test.c, V) q& ^. E' G( U9 z/ H
  4. *& m% v: F" o: E7 ~% Z6 e0 D
  5. * brief  EDMA3 Test Application* M, m  m  @7 I) Y3 r; m" S+ P( a
  6. *
    : X9 h6 y1 @% L
  7. *   This file contains EDMA3 Test code.
    9 n& q/ H- _* V* d8 K
  8. *' D) X. c6 ~0 z: @( E/ o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% |" O# a( u8 I7 f; a1 ?5 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + B' S' j7 a* e$ C% M1 F& L
  11. *         TO CHANGE.. Y* G" @% V( S+ p9 B! g; A* F
  12. *
    ! B4 o) `- J* e. d& l" r! m( _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 }& c: v; S$ F8 ^: m
  14. *2 w: I8 r4 I4 X% L, `
  15. * This program is free software; you can redistribute it and/or5 k2 |: B. C% e
  16. * modify it under the terms of the GNU General Public License as& k0 R) \; E+ s
  17. * published by the Free Software Foundation version 2.
    $ ^9 ?7 D( w7 I
  18. *2 {. ?. Y9 d2 {' P) i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! ]3 a3 E% z5 i1 A
  20. * kind, whether express or implied; without even the implied warranty
    6 Y3 _+ M. T; I" e2 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & Y6 @# m, z, x9 A6 l# f- |
  22. * GNU General Public License for more details.
    + g  H, b# Z' V; l0 k
  23. */6 ~* ?6 ~! T; t0 ^

  24. / N0 Z  F8 N- F% q4 x' r
  25. #include <linux/module.h>- r; g& j) Q8 Y+ e
  26. #include <linux/init.h>1 ]0 [* t7 s& L) p% D* N
  27. #include <linux/errno.h>
    9 e: W! X3 E1 ]' ?5 h! N9 A
  28. #include <linux/types.h>
    8 T5 ^$ E3 X, U$ U& C( A# C
  29. #include <linux/interrupt.h>
    " t, O  R  t6 S+ ~
  30. #include <asm/io.h>
    ( A& l" ?) m1 ]! |9 F
  31. #include <linux/moduleparam.h>
    . Z8 M3 q& L3 @. y% B; E! B
  32. #include <linux/sysctl.h>
    6 b8 j. \( D5 F/ }! c8 y
  33. #include <linux/mm.h>( l% i) f( m4 H8 ~
  34. #include <linux/dma-mapping.h>
    0 [1 H5 N: K8 ~' A+ i! p
  35. * W/ f+ l% I( g" w( i' R& g
  36. #include <mach/memory.h>
    2 b5 x" _1 g9 O
  37. #include <mach/hardware.h># J$ d6 E6 |' h# ^% u) [$ k* w
  38. #include <mach/irqs.h>
      O5 r# V8 h9 f: v" p6 [
  39. #include <asm/hardware/edma.h>
    8 E' H; f4 j  O6 |/ M1 n7 V

  40. , F' w# J' E% P& Y
  41. #undef EDMA3_DEBUG
    % P$ N# S5 a/ U9 a* B
  42. /*#define EDMA3_DEBUG*/
    ' Z) `) r6 n' n3 c
  43. / c' p2 i% u5 W: S
  44. #ifdef EDMA3_DEBUG
    & \1 k4 ^& ]- _0 ~* t7 W9 W4 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& v9 s, g  L* m. f: \( v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* v7 H& d) {  u$ Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% l" W" s8 a- t, A3 M7 E
  48. #else
    ) {0 L# E9 F7 i9 T4 F
  49. #define DMA_PRINTK( x... )
    & g! }- ^0 {) w7 z
  50. #define DMA_FN_IN
    3 C$ n0 u# r' k0 s5 ]2 |
  51. #define DMA_FN_OUT
    7 K1 c: E" x: Q* \2 p
  52. #endif
    3 H3 _1 B; a+ C1 o6 }1 z) K2 @/ c

  53. $ J" o4 r7 t: K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& S- [+ Z2 g* [6 b0 j
  55. #define STATIC_SHIFT                30 T! n  Z6 h0 Y
  56. #define TCINTEN_SHIFT               20
    . I, o. `- v3 K, W# L( e- _) ]
  57. #define ITCINTEN_SHIFT              21$ s. q$ \6 E4 a* Q
  58. #define TCCHEN_SHIFT                229 r& E6 S* f/ g: G1 a3 B
  59. #define ITCCHEN_SHIFT               233 F0 p6 S( U4 g- n
  60. % {% R8 L9 G% U7 ]- U
  61. static volatile int irqraised1 = 0;9 M- u  t+ i0 j) u1 U
  62. static volatile int irqraised2 = 0;( H- u/ L+ V+ p% p1 C8 [( j* R& J! A
  63. : E5 \+ N- D. v  c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 ^: y$ o4 g1 \! {/ t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , a" ~8 X% g' _0 n! q/ B0 I. ~$ O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . {! f9 x7 ]/ B/ ^! \) B
  67. - |8 J$ J. A" U8 b: G9 |; V
  68. dma_addr_t dmaphyssrc1 = 0;; w7 N7 H/ C5 ^4 h2 m8 x7 `
  69. dma_addr_t dmaphyssrc2 = 0;
    - f/ B6 H" f! r
  70. dma_addr_t dmaphysdest1 = 0;
    0 d! n: Q  h$ c
  71. dma_addr_t dmaphysdest2 = 0;  m; ~, ?# A( k+ x6 s& H

  72. 7 r6 V; q2 ]: N5 M" g* \3 `+ ]: t
  73. char *dmabufsrc1 = NULL;
    8 N- b4 g+ Z$ Z9 W. G3 k
  74. char *dmabufsrc2 = NULL;/ V4 L' S! _- v5 G- x* l7 t
  75. char *dmabufdest1 = NULL;
    ) q$ b1 S0 P1 j1 r
  76. char *dmabufdest2 = NULL;% M2 ]% n+ ~$ t1 J

  77. : A4 s" X) ~1 w( p6 ~$ L
  78. static int acnt = 512;) s7 V% m: Q! S7 W+ f6 b. X
  79. static int bcnt = 8;
    2 M5 ], o5 V8 z7 _+ H5 l: S4 }
  80. static int ccnt = 8;
    , D* \5 [- r9 l, ]6 t2 |( j6 H' X

  81. % I( n8 v, i0 m! G& \$ B
  82. module_param(acnt, int, S_IRUGO);
    + v5 K7 \9 q( j  t* n: Y
  83. module_param(bcnt, int, S_IRUGO);
    5 ~2 K1 u* r/ }. G2 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) G; W. L) e; M4 L( s- r2 w3 e3 ?0 V" y6 ]0 n- d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* d. I1 ^0 a1 b. n  f; `. darm-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, W1 D; t% P6 @( ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 Q$ X5 ~) ?2 |. i; X5 _" }7 {$ ?+ L7 D+ L8 H

$ ?. b# Z9 K1 W. b% ?1 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 19:56 , Processed in 0.039229 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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