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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 M, l' c4 E4 x, w( ]
  1. [code]EDMA sample test application
    & T+ d0 q+ O' _0 d4 v' R
  2. /*7 `0 x0 T& P! |" }  \
  3. * edma_test.c
    : b% p, Y( W5 ^0 n( I/ L
  4. *. v8 g$ b9 v& C* S, P) r1 j
  5. * brief  EDMA3 Test Application2 D5 A& s1 }) ~; j  ~  Z! f) j
  6. *, l$ I- F& t( A9 S
  7. *   This file contains EDMA3 Test code.
    % g# {: A4 R' A/ h+ E! X+ d. o/ Q
  8. *: {; w# ]1 s$ a  T% Y* U! D2 a$ ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , B7 F. ?  h' c. L1 U* o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. M+ Y5 V5 d) c: ?* z! m
  11. *         TO CHANGE.% K4 P! f+ V: K5 E. B0 v
  12. *
    + ]2 p  \1 \: Y# S  o8 W& p8 y# R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " w, `# C9 e" R3 `; @" S
  14. *- m8 A8 r6 P; y: w( F5 r
  15. * This program is free software; you can redistribute it and/or# Y, F; S" T3 h! M' i/ A1 V
  16. * modify it under the terms of the GNU General Public License as" x# L' S- t6 P* q; d) a% n+ T' W
  17. * published by the Free Software Foundation version 2.2 x+ o1 Y& a) i
  18. */ J; h: s6 p' _9 c4 i5 H2 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% K9 f; X; H* C. d5 \( [
  20. * kind, whether express or implied; without even the implied warranty
    ' {# |/ G. O; f: I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & a2 y% ?6 p% q$ r
  22. * GNU General Public License for more details.# v. q0 \+ C+ _5 q# P
  23. */2 _! j! P! ]6 a1 T& S) N' ^, [4 k
  24. ; w2 y# G4 F5 M5 [* k: J
  25. #include <linux/module.h>
    % a, t4 B9 }2 I
  26. #include <linux/init.h>
    7 J  l, e: F1 X4 A
  27. #include <linux/errno.h>% X+ _; k! }0 W) j
  28. #include <linux/types.h>
    % g/ S4 X, C: P% p- w
  29. #include <linux/interrupt.h>
    + {. k) y7 E. U2 C/ f/ B
  30. #include <asm/io.h>
    + J/ f$ r9 L1 L9 J" p
  31. #include <linux/moduleparam.h>3 D% ~) J. y6 u' h
  32. #include <linux/sysctl.h>
    6 v) l  \* ?3 B1 N4 S! X0 ^
  33. #include <linux/mm.h>' H$ N6 d. A; c' p0 `) k) T
  34. #include <linux/dma-mapping.h>: ^/ ]$ y+ s: X2 J' ?5 Q  V, K/ Z

  35. ; T3 |0 s9 c# C: j
  36. #include <mach/memory.h>, x- R: `; w0 W/ P
  37. #include <mach/hardware.h>
    ; S3 K- A& a/ X" h6 |% X; Y
  38. #include <mach/irqs.h>
    3 @- {7 b  D8 D
  39. #include <asm/hardware/edma.h>4 U! ~/ E% R8 }
  40. 9 D$ n$ G9 }$ P
  41. #undef EDMA3_DEBUG; z! j0 B4 Z8 `! e  y. M
  42. /*#define EDMA3_DEBUG*/  m6 X- s: O, J2 o$ }' [
  43. # t# ^0 L: j6 R8 }. \
  44. #ifdef EDMA3_DEBUG/ d! I1 C5 z" i) x4 A! ^% N; e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 O+ `6 q& V1 m" o/ c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 Y5 g, }8 ~# T1 T; _. u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( G  d' r5 o! s3 Z/ y; h( p
  48. #else
    2 B! c. |* a5 L
  49. #define DMA_PRINTK( x... )
    9 P* q  M+ t: O9 U! F% x
  50. #define DMA_FN_IN. T2 x  \5 E3 L
  51. #define DMA_FN_OUT- U" R- w4 |  q2 X1 V
  52. #endif/ S. Y4 P- h% U) \  p
  53. . f! {0 m* S) c+ f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 b9 _% o6 y: o( T+ i1 [
  55. #define STATIC_SHIFT                3
    ( y  E6 z" ?* ^* ^* f  C6 D, n6 A
  56. #define TCINTEN_SHIFT               205 M) ~% m% R; ]  m# k/ i
  57. #define ITCINTEN_SHIFT              21
    & z, N# }! B5 E6 Q) h
  58. #define TCCHEN_SHIFT                22
    ) \7 F# t" J6 ]# p* W
  59. #define ITCCHEN_SHIFT               230 g0 G1 u" j  T' V9 ]" q
  60. ; S4 Q. x) T" x+ H
  61. static volatile int irqraised1 = 0;
    8 L; I- Q+ M0 s9 E# R  z
  62. static volatile int irqraised2 = 0;
    1 P$ X; i* U. s$ o

  63. 6 l+ k, Y, ^; Z7 `$ r8 v: Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . k& a1 [; b2 O( P3 Q4 c# h0 r# @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 m  O7 H3 O1 w& l* ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 |6 J2 M. m; ?) G- Z, M

  67. ) b$ F% F+ P' G( {2 Z
  68. dma_addr_t dmaphyssrc1 = 0;
    9 N/ v+ j/ f& e7 t1 o
  69. dma_addr_t dmaphyssrc2 = 0;
    $ ~4 \1 d7 z8 M
  70. dma_addr_t dmaphysdest1 = 0;
    ; j, A4 v5 t+ }1 h2 j8 l" q
  71. dma_addr_t dmaphysdest2 = 0;6 a$ N; p! V3 ^3 f  Z- u# {6 Q
  72. : ?4 Z/ l; T- \5 k* L) u
  73. char *dmabufsrc1 = NULL;
    7 q+ n& b* O0 g" `" \: N; L( }2 e
  74. char *dmabufsrc2 = NULL;
    2 G6 |* `5 q. Z  S
  75. char *dmabufdest1 = NULL;) |9 {5 }5 v7 L2 o& A4 d; T
  76. char *dmabufdest2 = NULL;
    ( p. G7 P0 S! f0 }3 a
  77. 0 u# [- `/ l  n2 [# r0 `& g9 b3 w( k
  78. static int acnt = 512;3 v3 c! _# z: d! ^+ h, D/ @: L
  79. static int bcnt = 8;; ^4 y6 N3 N8 Y0 A, o6 [
  80. static int ccnt = 8;
    , g/ C$ f3 ?- J4 C1 n2 ~( }4 C2 Y! d
  81. $ v8 {: V" m" Y: s; u  b6 Q
  82. module_param(acnt, int, S_IRUGO);
    8 R. G2 f4 E/ Z0 r
  83. module_param(bcnt, int, S_IRUGO);
    $ k3 J% [' K7 r; G2 V: U- }
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 e: o8 e& S% |5 s" r3 [) @" V
4 a+ z8 Q3 B1 Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 k. H1 L& v1 U0 q1 l7 }2 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% e7 ]$ W7 s# y# r4 o' d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ `" h! p+ W8 l4 u7 K1 [3 l9 K5 ^3 `( C% h4 x& ~8 ]

% k  c7 P" P9 l( Q2 F7 H6 x7 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 12:49 , Processed in 0.044505 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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