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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ r4 P- h7 m3 |
  1. [code]EDMA sample test application
    3 _- C; @7 R( W' P5 D
  2. /*
    / r. `/ a) K4 [. n% d
  3. * edma_test.c9 H$ @  c. p$ R9 H$ t! a
  4. *3 P  {. q8 _5 `- @* a/ p! m
  5. * brief  EDMA3 Test Application
    5 M- p6 U4 u0 h& c5 U% O
  6. *! P! ]1 Y" I( @( E# n
  7. *   This file contains EDMA3 Test code.4 p5 \7 y2 @8 a! n
  8. *
    * ]( j) o! s/ T6 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 ~1 h/ ~0 s# [7 ^3 }! S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 x; X# {, s1 S) {; G- A
  11. *         TO CHANGE.+ h' ]+ O! ]) q* n& D
  12. *
    . @8 |, R: J( A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + I2 h$ A# B5 p. c5 G' y0 g. x
  14. *% j. \  Q# J8 ?/ ~" s7 U3 |
  15. * This program is free software; you can redistribute it and/or
    % k- L) U3 i  C6 l$ g/ `
  16. * modify it under the terms of the GNU General Public License as( D& c, r& a- Y) e# B5 E& n' c# g
  17. * published by the Free Software Foundation version 2.
    : y8 Z0 I; D: t% S/ M- M7 E/ v
  18. *0 Z  N" F+ L' H  F/ b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 [- d4 F& r: F$ i- u4 v
  20. * kind, whether express or implied; without even the implied warranty7 h$ V$ l0 b( Z2 g( }3 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + l; w( [$ j, ~7 @
  22. * GNU General Public License for more details.) [( C; a& }' a2 D5 N% O% q
  23. */  t) N$ |& _) B8 [3 W; M+ B

  24. ' A7 r% b& p. ?) A4 i6 B
  25. #include <linux/module.h>
    3 v) u2 Y" H, w" Y& P* `
  26. #include <linux/init.h>
    4 P" U4 R; [: D% f4 _
  27. #include <linux/errno.h>+ a; T2 \1 n' L9 O
  28. #include <linux/types.h># Q3 y8 `( [# S8 f# }' @
  29. #include <linux/interrupt.h>$ p9 p6 x1 q& @/ U4 I
  30. #include <asm/io.h>. N0 }* e0 `  E! U, A
  31. #include <linux/moduleparam.h>2 D* p! E6 c, P$ S: N
  32. #include <linux/sysctl.h>
    / k- K' X7 y$ g5 i% ^
  33. #include <linux/mm.h>; U' J# V: B* J  C/ ?7 z
  34. #include <linux/dma-mapping.h>$ L3 e; C) L$ v

  35. . X. n1 d! X, ]$ }( r" B' f
  36. #include <mach/memory.h>, c) J( _8 E+ R, C/ v3 l  j
  37. #include <mach/hardware.h>+ |, O. D1 h/ {: Z
  38. #include <mach/irqs.h>; c  a, N6 @* ]4 P9 o' H
  39. #include <asm/hardware/edma.h>
    / ^" d8 j1 P( t( `% f, M3 [/ \

  40. 0 Q+ i& m' Q1 F) \
  41. #undef EDMA3_DEBUG; Y5 t, B* B/ N- K1 [+ @7 p6 `3 [
  42. /*#define EDMA3_DEBUG*/
    2 N6 H, v6 {- s; _; B8 s0 Z
  43. & O3 P- `4 Z% z$ B/ `: j
  44. #ifdef EDMA3_DEBUG/ J$ h- `4 }1 A; U7 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / H' W5 D' v9 z* h$ b( p+ r. p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' f! c! y' Z) J& s, E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 i; ], F2 s$ B: p
  48. #else
    ( R2 S7 i: D* z& `% c
  49. #define DMA_PRINTK( x... )- R* x! U. V8 f* `" p1 S' R# B# `
  50. #define DMA_FN_IN
    " x! Q4 X% g5 o3 z
  51. #define DMA_FN_OUT- ~4 B) T1 _  v* l# k3 l8 C( K
  52. #endif0 x' W* C4 W* ^) G, X; G
  53. # u  c# j0 W' b% R% y1 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% w5 O9 }9 h4 d# g! k9 Y
  55. #define STATIC_SHIFT                3
    + W2 ~! {8 ?9 {
  56. #define TCINTEN_SHIFT               206 b. M& `/ G7 s+ r
  57. #define ITCINTEN_SHIFT              21
    2 S$ m, W/ ?# |' r) D3 a
  58. #define TCCHEN_SHIFT                22
    0 n( V& {* a" g. \* W& I
  59. #define ITCCHEN_SHIFT               23% d8 z/ @1 s" X) w# d8 M
  60. $ C6 r' G  r6 }& e; [
  61. static volatile int irqraised1 = 0;
    , @9 E) m0 k3 d" U5 X9 H" v& F
  62. static volatile int irqraised2 = 0;4 M( \; q5 G9 W& e& `

  63. 0 B) q. o& T# Z! r  L& w( O+ P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- @( v  K$ ^# L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ e. N7 T6 p; {2 B$ o" `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; J2 c4 w1 K2 Y6 D* l( v( v5 |

  67. , O% i" y, g0 |6 u5 l- X# ]) v
  68. dma_addr_t dmaphyssrc1 = 0;
    2 p, u- c$ f1 Y% E+ e
  69. dma_addr_t dmaphyssrc2 = 0;# b9 J7 r( c3 C4 m" Y# O7 _& |
  70. dma_addr_t dmaphysdest1 = 0;
    # N* p1 ?9 N: y
  71. dma_addr_t dmaphysdest2 = 0;$ {* v: D% T' U3 [

  72. ( k" l+ |" e5 Q$ v3 R
  73. char *dmabufsrc1 = NULL;( N* \$ t/ S( }& b( h; V! N% Z; I
  74. char *dmabufsrc2 = NULL;; i; n' S* ]  p9 ?5 ?0 `
  75. char *dmabufdest1 = NULL;
    ' C" ?& H$ Z3 C: ^* h
  76. char *dmabufdest2 = NULL;
    0 l; L% M" X1 s+ c  ?- i8 R! W9 E1 _
  77. 4 r$ `2 ]$ \3 C4 |+ M, w9 V1 V
  78. static int acnt = 512;0 |0 w! b1 o/ j: Q3 A; ~
  79. static int bcnt = 8;. c; M$ D& d+ e5 \$ A% z& c) t
  80. static int ccnt = 8;
    ! o6 L' M3 [$ {
  81. ' s1 O% u. c* D
  82. module_param(acnt, int, S_IRUGO);
    8 [8 F7 p/ v% M# g9 r
  83. module_param(bcnt, int, S_IRUGO);
    , |3 K0 f& P& F& P3 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: F- r% D6 F# Y6 q! F# S' g7 \: e4 O; g1 |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: A6 N/ N7 l6 m7 h" s, e  _$ Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. U' j+ J" |: E" @, s, p6 F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! l2 g( G1 i* R) `; }7 I! w: q

! w2 Z1 Y9 J2 N% ~# w
) O2 \* j. o/ h7 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-1 17:54 , Processed in 0.039627 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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