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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & T: d6 c# l* h+ {( N0 P
  1. [code]EDMA sample test application8 y5 G+ p5 U; p9 S3 W" I% e7 L% Q
  2. /*
    / M0 Q/ @6 K* _! ~4 J  V
  3. * edma_test.c' G7 q4 ?8 ^/ o* H9 r1 O9 o( Z
  4. *. c1 ^' i% S+ h( W0 _0 I$ B
  5. * brief  EDMA3 Test Application
    + S* [4 y  U6 J6 n( K; I) h% b. {
  6. *
    + V8 p; |8 O  u( R  ?
  7. *   This file contains EDMA3 Test code.
    " e0 Y4 J; e' l9 E0 K+ B9 X
  8. *
    ( B; E2 T. }, r2 ?( k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* k( a5 x4 M* r, j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % D0 [3 T1 ~, K6 {6 W8 S
  11. *         TO CHANGE.  q+ h  g0 k4 i* {9 a
  12. *6 _1 W4 _0 E+ L# W5 a% R/ ?- g' q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 f9 n1 a% _" ], G" o: ]' R& D5 U7 X
  14. *
    ( N' D1 E& z4 v$ P% G$ m
  15. * This program is free software; you can redistribute it and/or% X+ W4 W. J# ?7 k
  16. * modify it under the terms of the GNU General Public License as& I* S0 ~+ b% h
  17. * published by the Free Software Foundation version 2.
    ; c* P) D! R7 ^# C5 j$ w. y1 z
  18. *3 X. {5 U* [9 O$ n  O6 I$ g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. `9 A: Y  S+ n$ d. F
  20. * kind, whether express or implied; without even the implied warranty
    ' w+ ]- B. E  h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ v0 F5 l' _3 e, c" h
  22. * GNU General Public License for more details.
    9 k$ }$ m, `& T( r& R
  23. */5 h8 y" ]9 h2 S; j# E
  24. ( [8 c6 g2 _. S7 t6 x/ o' O' j
  25. #include <linux/module.h>. j, z5 y7 i3 g1 O% L! H
  26. #include <linux/init.h>: t1 `# f- K3 y# B$ j
  27. #include <linux/errno.h>
    3 G- j5 y9 k$ U$ J& V( R( v1 R
  28. #include <linux/types.h>1 K" W5 z6 R1 x6 B
  29. #include <linux/interrupt.h>5 v  d8 ~  _# M8 S
  30. #include <asm/io.h>
    4 c/ |/ K& V1 y0 r2 T
  31. #include <linux/moduleparam.h>( g. z8 Y* [. ~# |& }. @4 E# w
  32. #include <linux/sysctl.h>6 ^# A& \! {$ Q- B) a' _
  33. #include <linux/mm.h>
    4 P1 n- [- |0 q* A# W& _- ]; T
  34. #include <linux/dma-mapping.h>% Z* s: u1 e" f1 O
  35. ' I! N1 O8 ?' f% r6 z0 w, `% ^
  36. #include <mach/memory.h>7 G* J& d* ]9 T' [- C. Y. a# c
  37. #include <mach/hardware.h>5 i( ?- {* u+ s$ R
  38. #include <mach/irqs.h>$ L. n# W, r& f; s  M& H5 x
  39. #include <asm/hardware/edma.h>6 H+ I7 m: C. U! I
  40. * I% X9 x* V/ ?) p
  41. #undef EDMA3_DEBUG0 H2 c; e6 w( O- k& o; E% J6 c& q8 A
  42. /*#define EDMA3_DEBUG*/
    ( a, E( D4 K; _
  43. ' u6 \5 q+ J$ c/ M3 E. q/ N
  44. #ifdef EDMA3_DEBUG& |, ?0 ^( _* u* V: e3 v1 m) ?5 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . }. D( @9 k' V1 J5 o* Y  W! Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / G( ?0 n  h: m% c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % r$ L' J8 q, b" X& ]
  48. #else) V+ O! l3 I) G
  49. #define DMA_PRINTK( x... )' U- L1 ]  }/ g" P0 D( X* j
  50. #define DMA_FN_IN
    " i5 ~' n- |- X" s  `. ^% P
  51. #define DMA_FN_OUT: X4 A* W4 H8 E& q! U
  52. #endif
    . C  c) f5 c( |/ @! v! ]( i
  53. # Q2 _1 m0 U2 H2 p: n$ S( f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) h" K; z5 d. C
  55. #define STATIC_SHIFT                3
    . M! m$ E5 [. r+ E( [8 v) F$ D
  56. #define TCINTEN_SHIFT               20$ ]0 I8 N& K& p0 g8 |$ z- f
  57. #define ITCINTEN_SHIFT              21# b# j4 f; s. q% y9 \2 \" Q2 ~" p- b
  58. #define TCCHEN_SHIFT                22% A1 r# F( e; B# a3 ?$ @- W# V
  59. #define ITCCHEN_SHIFT               23
    3 q( _7 R4 ?3 |
  60. 1 j1 V" E- Q) @; [
  61. static volatile int irqraised1 = 0;$ G% G/ b* j3 N4 Y+ x5 G
  62. static volatile int irqraised2 = 0;
    ! X5 h: S+ L* O- O: L" M. s8 J
  63. + }* X3 G' K8 l8 |6 s2 ~; N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: u, U1 Q! C  w7 ^" S/ O, T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ t$ D5 p8 V2 K' k* F* A/ O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Z9 S$ l" H) `: \

  67. % n, r  f/ l" f0 U, v# R" }' V& j' F
  68. dma_addr_t dmaphyssrc1 = 0;- k0 z8 l0 E, |3 L; Z! W
  69. dma_addr_t dmaphyssrc2 = 0;/ X6 v2 H& C( v: y) f* r
  70. dma_addr_t dmaphysdest1 = 0;
    # Q- A& d5 ~2 G; o& E( P/ U) z( y
  71. dma_addr_t dmaphysdest2 = 0;
    ' k( i4 v8 d. I. _  O
  72. 0 U5 Z7 s6 k7 t4 E- O1 F! a8 ~" m' J
  73. char *dmabufsrc1 = NULL;
    7 Y- a: J$ N! n
  74. char *dmabufsrc2 = NULL;& y8 _% z# W- e
  75. char *dmabufdest1 = NULL;+ k8 z) d9 S  c1 M% ?
  76. char *dmabufdest2 = NULL;2 N! S9 d4 @9 R% [9 h  E' {5 _
  77. 9 p7 Q0 i* w+ u: v; o
  78. static int acnt = 512;
    4 x# o" W+ V7 b) o& S' S6 i
  79. static int bcnt = 8;
    " z( N1 {9 [6 r6 ?# `" O' r
  80. static int ccnt = 8;3 z  }* ]0 q1 e. @& @. k& @6 _
  81. 9 f) R; G& z: I2 t
  82. module_param(acnt, int, S_IRUGO);* h5 y3 l$ o$ U+ C
  83. module_param(bcnt, int, S_IRUGO);
    8 N6 C9 g1 Y$ L  x" W: z. Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ ?' d2 s; B+ N! _8 _8 X0 [

0 a; \- Y: L. u; }, q8 m) l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 v0 _! ]" d  W/ D: Q+ G; c$ i, m  Z1 Narm-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, k( Q# w  W5 b, |/ c" Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* f! S6 j; f. x% o# K/ l  l( r, }
, z8 Y" C6 k4 @6 M4 n% H! _, Y/ T% w( W/ d( Z" X; b1 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 18:29 , Processed in 0.044717 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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