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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! S5 c* P: X5 {' n9 T5 e7 z
  1. [code]EDMA sample test application# O  u4 S2 G: D' r& {
  2. /*
    8 i- m7 }$ e0 \, a  l
  3. * edma_test.c/ `# j4 f9 e' ]6 ^! p6 V% u: _
  4. *
    7 z2 H- K1 d  E
  5. * brief  EDMA3 Test Application
    % I% ^& S# X0 k6 |0 m( b+ ^" f, K
  6. *
    ( R, [% g+ Y+ L( M* I7 T
  7. *   This file contains EDMA3 Test code.- r  w8 w* l( `+ X
  8. *
    5 h$ M7 F3 N% M: L) }. n8 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' x' K& A  s. N4 ^3 z! O' N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& _9 Z* [2 d9 c7 T
  11. *         TO CHANGE.
    . r( ?9 S4 b( B" P9 a0 u
  12. *
    % F  ]( P8 j- h" U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & B% s; ]- M6 l' s
  14. *
    $ W. j: j: p& d
  15. * This program is free software; you can redistribute it and/or
    ( d. @8 h5 ^1 r7 d8 Z, k
  16. * modify it under the terms of the GNU General Public License as$ [9 G4 u. q5 U( j2 V
  17. * published by the Free Software Foundation version 2.4 n# {. F+ f$ q0 u) `
  18. *& _' V' @5 r- C: Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; o  K8 g8 H1 D( v0 A
  20. * kind, whether express or implied; without even the implied warranty$ l! x5 u5 x9 Q" q. l9 ^' S! Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 _( ^1 [2 y4 I& d
  22. * GNU General Public License for more details.4 R* L+ T* h& G' b' u# D) q
  23. */& z) i$ {; h% ?

  24. . G6 Y0 \% X+ B$ X% J8 D. ?5 t
  25. #include <linux/module.h>
    ' Q/ \: |, P" V7 M1 I+ d
  26. #include <linux/init.h>) P, [! y8 C$ Q, U& N! s$ v/ ?, O2 U
  27. #include <linux/errno.h>
    $ C* Z2 r2 K! ?- f
  28. #include <linux/types.h>
    $ e% V! X, r& t8 G7 ^( S$ V  L: R* H
  29. #include <linux/interrupt.h>
    % a. d# X& a8 d5 p7 M$ [# h
  30. #include <asm/io.h>
    ! J/ n* J& }. M- \) _4 m5 J
  31. #include <linux/moduleparam.h>) P3 f+ `5 r5 B1 |9 p
  32. #include <linux/sysctl.h>
    6 M/ h, S8 }$ e. ~0 {9 N
  33. #include <linux/mm.h>
    6 x0 H+ r, |2 c3 F* U2 g4 h
  34. #include <linux/dma-mapping.h>
    * x  ~) D5 t& ~& N: D

  35. $ ]( b5 B. G7 Z; o6 F
  36. #include <mach/memory.h>6 M1 u. Z+ k3 E2 ]2 o! v
  37. #include <mach/hardware.h>
    0 d! ]% h7 ^& g" ?. a
  38. #include <mach/irqs.h>' V% K- D% U8 _4 {4 p; `
  39. #include <asm/hardware/edma.h># B7 e5 v9 N- b  B3 y
  40. , H) l/ x& s  ?; E9 k, l  {
  41. #undef EDMA3_DEBUG2 [% c  N0 V" ^8 ^
  42. /*#define EDMA3_DEBUG*/2 {; D0 Q9 x$ V7 E3 \3 o2 H- h* V
  43. 7 B9 ?  F! N6 }. a+ S8 r+ v
  44. #ifdef EDMA3_DEBUG
    3 K, p, o7 g' y. [$ @: V0 M  h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      ]4 z6 ~- ^( y" }7 _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * f( p( N- g/ _; q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 D- ?; y1 a: ^( A
  48. #else5 R+ O" S* W7 ~: _  s
  49. #define DMA_PRINTK( x... )
    1 \( y6 I, q% d, X* d/ v7 w
  50. #define DMA_FN_IN
    , |% S) C0 \) @' l( F/ J
  51. #define DMA_FN_OUT
    . r' z2 ^4 h9 m# `6 o6 L2 C  {0 d
  52. #endif" D4 B6 b, ?& @* j: Q3 i
  53. ( }" f4 J3 J* D! i: T2 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& i: e7 j7 Y; `2 S) D
  55. #define STATIC_SHIFT                3
    ; V/ m* t/ c2 Z0 F( w3 x; N9 |
  56. #define TCINTEN_SHIFT               20* ]" B: E, {4 W% W+ {; J1 Y
  57. #define ITCINTEN_SHIFT              21
    5 s, ^7 b( D4 x( M; E+ N3 F; A1 G
  58. #define TCCHEN_SHIFT                22# p9 p# }6 t% c  s
  59. #define ITCCHEN_SHIFT               23
    2 @7 O8 \9 U, {" M
  60. ; l7 D& }. ]! E1 c6 i; J4 M9 ?
  61. static volatile int irqraised1 = 0;& a! l% n( e+ p; k: H- w" X
  62. static volatile int irqraised2 = 0;) J1 Z: L& C+ c# s
  63. * G2 R0 w( o2 X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ?! d! s! r' _# y% i3 a+ w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( g) ~* {9 ^% p+ B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! F* G+ P% [$ h# A2 n' C$ z/ F

  67. 6 p7 F* m% ^' D- [- Y
  68. dma_addr_t dmaphyssrc1 = 0;) t1 U1 o) \$ a/ E# }. n- a
  69. dma_addr_t dmaphyssrc2 = 0;
    / p( e6 ^: Y8 n; j& J5 ?
  70. dma_addr_t dmaphysdest1 = 0;# T( d0 G! {" c# l
  71. dma_addr_t dmaphysdest2 = 0;) z; B7 G7 w9 A  t

  72. 3 {& Q+ }# a; ]- Z0 r( l
  73. char *dmabufsrc1 = NULL;* i1 [# ]% w5 Y' r+ N
  74. char *dmabufsrc2 = NULL;/ @/ N8 Y7 t; N& R; Q
  75. char *dmabufdest1 = NULL;
    5 ?5 ^( S- c* T% l* e( h
  76. char *dmabufdest2 = NULL;: c4 x' a: g$ J
  77. 0 [$ S- g8 F& y6 U
  78. static int acnt = 512;
    1 e7 L2 L% k7 g- s- _/ z+ H
  79. static int bcnt = 8;
    3 L7 \% b! b- g7 W! v  K/ u
  80. static int ccnt = 8;! ?; I1 t& \* f5 J( o$ f' n
  81. $ p% Z, Z, c4 e) p" e, B
  82. module_param(acnt, int, S_IRUGO);' F: x1 w- i- @' }& u4 n
  83. module_param(bcnt, int, S_IRUGO);& `$ l7 H) [' K$ V8 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( X* E* v5 [$ {# j3 \2 g% V8 V# G# W" E( t/ ~7 R5 N2 r' U: }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ S( i4 h8 a2 x7 ?. Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; n/ o# Q& q6 P4 y( D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ Y- g! D8 Y4 W
% U  x$ D* P" P( h

" @% ~+ l8 U! _5 j& K3 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 04:23 , Processed in 0.038343 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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