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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , r: y0 I8 x; u& e8 n
  1. [code]EDMA sample test application+ k& k) a5 a2 N4 z2 j9 P' T7 o/ ^
  2. /*' ^! C$ |! C4 e0 b  ]+ z& f  u
  3. * edma_test.c8 B" m  @; I1 {6 }
  4. *
      ?1 n- R# |' r! y8 x
  5. * brief  EDMA3 Test Application2 i( {) A% E' a- u# s1 b3 x
  6. *, S5 A* @: I" W
  7. *   This file contains EDMA3 Test code.$ B: C. {6 o; n5 W# E. e
  8. *$ u: Z4 S# y8 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! g: I$ B( N% `3 c4 ~4 _% e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : j) M! D/ a( j7 W; k
  11. *         TO CHANGE.4 w- A* i0 f% |2 Z( ?
  12. *
    5 j- s# a% Q, u: B2 i$ v! F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; Z# j& w4 A! B
  14. *2 W0 Y! i8 s8 _, M7 E$ p1 y# z- m  [
  15. * This program is free software; you can redistribute it and/or! q4 S7 f8 g. J& m. f( H( w6 v
  16. * modify it under the terms of the GNU General Public License as
    / o  W! H. k% r  Z$ t* a% |2 S
  17. * published by the Free Software Foundation version 2.
    " k" Y# v- U6 _, f, c) l' p
  18. *. |5 u3 B* _4 d5 i5 y' i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 F- p; r( j1 _  \8 S" u" n
  20. * kind, whether express or implied; without even the implied warranty
    ! {, {. F. F4 W/ W4 j2 \: k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- u# o% G0 Y; Z8 B2 K" i
  22. * GNU General Public License for more details.
    4 b0 w4 Y6 ~) D2 P* k9 p
  23. */2 v* ^; f, ~; y# J# E5 l( c) I

  24. 8 U7 P  R0 X7 ~+ K0 x7 E
  25. #include <linux/module.h>
    : Z( o' G  I: M& [; X9 p$ w+ E0 d
  26. #include <linux/init.h>9 b1 n4 u( ]0 f! _+ e: F
  27. #include <linux/errno.h>; M; ?1 h+ P- K
  28. #include <linux/types.h>; ]. }- V. K% r, D
  29. #include <linux/interrupt.h>; e* L& f  X6 n( z2 ^; |
  30. #include <asm/io.h>0 S" d+ `+ b- ]- y9 d% p* {
  31. #include <linux/moduleparam.h>% N. j6 h. S9 I+ [8 e
  32. #include <linux/sysctl.h>9 C7 y) o& a3 ~6 a- @; h! ]! p1 O! p
  33. #include <linux/mm.h>
    7 D1 g$ d* `6 r# \# \! w
  34. #include <linux/dma-mapping.h>$ J" q# J# @$ ^8 S  _: a! P

  35. " K4 S6 p/ g9 L* z
  36. #include <mach/memory.h>
    6 D0 {# L: v1 B. g- N2 S
  37. #include <mach/hardware.h>& C$ l# w4 w9 t& _$ n4 U7 Z
  38. #include <mach/irqs.h>' g9 m$ v5 ?9 _1 r
  39. #include <asm/hardware/edma.h>5 G+ ?; [! K% n& {

  40. / S" P* u9 e+ |- O: j( S5 j
  41. #undef EDMA3_DEBUG
    ' S' B7 O* W3 N. I' T- u
  42. /*#define EDMA3_DEBUG*/
    ( o. U! p; _+ h4 F# L" p
  43. " e% a1 q2 `; ]: X6 f
  44. #ifdef EDMA3_DEBUG$ [% H8 a7 O. n/ Y- B$ `  q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! h7 _/ ^$ I6 J: D) p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % P8 w& J3 p3 S+ J* O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + \  Q5 R; n  ]
  48. #else) s$ T6 D) ], [6 V. p- K  A
  49. #define DMA_PRINTK( x... )& w. ~$ }( ~) P4 x8 b: u5 Y
  50. #define DMA_FN_IN: O2 V# n. T7 ~+ G4 i
  51. #define DMA_FN_OUT
    9 c* m7 _5 }  B2 n* `9 Y
  52. #endif
    / r# k9 `. t. p

  53. $ ]$ H. A: I" ^* J2 r8 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  c' l; k9 y' N4 j/ A$ Z
  55. #define STATIC_SHIFT                3
    / D; ^) ~, Z9 U/ k! F
  56. #define TCINTEN_SHIFT               20
    ' H$ }% G. R6 I7 N0 \6 B
  57. #define ITCINTEN_SHIFT              210 _: O7 M) t/ e2 r/ Q$ ?5 K
  58. #define TCCHEN_SHIFT                226 @! ?" W5 O1 o8 j$ y1 @
  59. #define ITCCHEN_SHIFT               23/ M% n" B( Z& R: ~  M

  60. ' V' H# {3 j3 J
  61. static volatile int irqraised1 = 0;
    : S: v- ]* d1 |
  62. static volatile int irqraised2 = 0;! ]8 y' G( m1 M! a- }" r; a
  63. ( z/ g' N: Q* L9 ?- p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 z2 n: ^* {; B- S) j7 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* j; b; \2 U$ \  B. n$ Y% O& t0 x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # l5 m. e; B5 r, P0 f4 m! m

  67. ; O* _. b. H( C8 L1 ~5 H$ k
  68. dma_addr_t dmaphyssrc1 = 0;
    $ ~# H6 r& \+ Y% g9 D
  69. dma_addr_t dmaphyssrc2 = 0;
    / E4 z  `+ G' _" k; `) z
  70. dma_addr_t dmaphysdest1 = 0;
    3 O% l" ]. W1 M4 Q
  71. dma_addr_t dmaphysdest2 = 0;
    2 {  F, {, Y" q

  72. $ V/ Y: _9 }. s+ |& d4 \* H, W
  73. char *dmabufsrc1 = NULL;8 L3 G$ g- }# B
  74. char *dmabufsrc2 = NULL;
    + H# v& {# K; h# g5 Y0 E) l# O" t) Z
  75. char *dmabufdest1 = NULL;
    / q- h" {0 `3 C& p9 D; D
  76. char *dmabufdest2 = NULL;0 N* h1 |7 ^) u9 W: U' y

  77. - M& q& Y; [) b# Q+ w
  78. static int acnt = 512;) h9 T9 i0 y: x! g* m9 {) h
  79. static int bcnt = 8;
    5 _5 V. B' ~& e, J
  80. static int ccnt = 8;6 n! n% l' |) b1 z

  81. . Q7 S* J  r" `
  82. module_param(acnt, int, S_IRUGO);
    ( `0 Q$ g: ~" ~
  83. module_param(bcnt, int, S_IRUGO);
    3 G1 j- k4 s( v0 b1 j5 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 U( W" }1 L; E, @7 t! e
; L1 l: y) G; ]  Z/ G2 p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 }/ H! r3 m5 P/ ]+ sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 ?( v+ K" g5 ^6 n, }1 w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* s2 n( D* w& Q9 @# A
% }0 w+ G9 q. i3 V: n1 k6 H/ n! {
8 \5 F* I; H, D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 17:49 , Processed in 0.044390 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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