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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  |/ M& l. E4 C- N5 J
  1. [code]EDMA sample test application7 l. E9 s) w; Q# a
  2. /*
    % E# ^4 u8 Y  |" F: p, X- g
  3. * edma_test.c. X; v' r$ [2 c8 H6 z$ Q
  4. *
    ( r6 o) G# d) H! `- |6 J. m
  5. * brief  EDMA3 Test Application, R1 H+ N6 l- C7 m5 @5 ~- R
  6. *9 g- H, W# k7 S7 }
  7. *   This file contains EDMA3 Test code.
    / ?. I7 G+ }; Z9 N. G9 M3 P
  8. */ i( i, v* q$ t6 V; o, q) I6 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 @0 R. O5 n3 Z% {; T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " A: R4 |% C1 j9 f  P" ^
  11. *         TO CHANGE.
    1 R- d% G0 t) \# G7 g9 C- H
  12. *8 E$ Y( z' C* t6 Y! x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 C7 w9 G2 g* Y/ K  k% J
  14. *4 |7 p$ v7 T# w& I& z- Z3 s% V
  15. * This program is free software; you can redistribute it and/or! Q) t+ e' ^$ n+ d, V
  16. * modify it under the terms of the GNU General Public License as8 t1 d+ P5 ]/ B" u
  17. * published by the Free Software Foundation version 2.
    $ d: V: g* R, B/ i- D
  18. *. A$ i1 `9 G" ~2 l5 L3 p* V5 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 ^1 J  P3 k) \6 R4 o
  20. * kind, whether express or implied; without even the implied warranty$ ^3 ?4 Q( a8 L% I) F4 H& @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 d& H5 f0 z: ]+ B  s) L* M% Q
  22. * GNU General Public License for more details.6 @0 w+ e% k* h& g9 q2 m* Q6 @
  23. */0 A# T2 N3 n1 V

  24.   U+ Z0 ~6 x/ O5 Y' w
  25. #include <linux/module.h>
    $ w7 e7 Q7 Q. F# [  L8 w. ]
  26. #include <linux/init.h>
    0 R- {4 Q1 K' `. V% k9 \
  27. #include <linux/errno.h>9 [! b8 q$ I: ?* c- |9 k
  28. #include <linux/types.h>
    ! h# G: L  F5 T/ x
  29. #include <linux/interrupt.h>; E* G- Y( m- u# m/ |/ D& s/ j
  30. #include <asm/io.h>; U# v! }5 N$ a+ w% M
  31. #include <linux/moduleparam.h>
    ( H5 @7 q4 E- Z+ @( G* a7 y6 n1 P' l4 o/ ^
  32. #include <linux/sysctl.h>
    # n2 J8 d; g4 y
  33. #include <linux/mm.h>
    7 C, d# |5 p: U5 j  ?& ?& E% `
  34. #include <linux/dma-mapping.h>6 I3 ^5 l: ]) o
  35. " J4 A% j8 t! F/ ?
  36. #include <mach/memory.h>
    ) t3 J* A$ A; a" n1 _  M5 B2 ~
  37. #include <mach/hardware.h>
    , d& ]! D' e( B3 p# U4 P! n) r
  38. #include <mach/irqs.h>8 Q4 Y$ r: T- ^% [- ~
  39. #include <asm/hardware/edma.h>: a7 k" l3 R. ]3 D  b. [8 ]

  40. " ~- a2 H. r: B
  41. #undef EDMA3_DEBUG3 ^0 n. ]" `1 b: H  b
  42. /*#define EDMA3_DEBUG*/
    : s' V) |) z8 R

  43. % J8 Q8 u/ P0 E' X! `
  44. #ifdef EDMA3_DEBUG
    & s( k' _1 W: s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ P/ v. [% g+ c2 x" [$ ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 k& t( k6 E& {: u  l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & ?5 U: T: v) c$ C& P8 K5 `
  48. #else
    ! h; _* y* G6 R( R* o  y
  49. #define DMA_PRINTK( x... )
    7 B/ j- _$ g8 h4 H2 y; j
  50. #define DMA_FN_IN" J: V! ]$ \" N' R/ p8 u# X% E6 b
  51. #define DMA_FN_OUT# k0 |. x2 _' E) \) Y
  52. #endif6 ^# M6 |. T1 m- P0 [6 Z3 J0 A

  53. ' j. s# p* I1 e: W/ c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): x! z, Y, ~% K  W/ ~
  55. #define STATIC_SHIFT                3
    ' P1 c: x! k) s5 Z3 p4 f% o4 q
  56. #define TCINTEN_SHIFT               20
    7 ~% v6 g- R9 Y+ l
  57. #define ITCINTEN_SHIFT              217 D9 L& b) G/ p6 f0 a! H
  58. #define TCCHEN_SHIFT                22) V! L, o3 ?# `; y  o
  59. #define ITCCHEN_SHIFT               23: o% S  ?6 N# _- _/ s5 S
  60. 6 Q& K' e0 `' X/ W
  61. static volatile int irqraised1 = 0;; G- @' U' n/ r! W; {# C6 J- l( M
  62. static volatile int irqraised2 = 0;
    ! y! w) H; I8 t* Z) m) Q* l
  63. 1 F5 o6 s: l) Y, ^' H" \0 _) ]2 n& k9 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ^! f% `5 s2 J/ U" N# q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 u! W/ X8 i! W/ m5 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 d; ~1 B' c2 V2 w% h, S- T

  67. / E- W1 n2 |- B4 ]
  68. dma_addr_t dmaphyssrc1 = 0;
    " F; D$ k1 K! O8 x( o  Y  p
  69. dma_addr_t dmaphyssrc2 = 0;5 ]9 e6 g, f" f0 `) y& ?. n, z
  70. dma_addr_t dmaphysdest1 = 0;
    5 h6 b0 C5 W3 }  l( |' d8 \& r6 C
  71. dma_addr_t dmaphysdest2 = 0;
    ( s% I  Q6 t( C( A; f* ]2 D" w

  72. * f# M( x4 i% ~2 T0 m
  73. char *dmabufsrc1 = NULL;
    + U8 A* `$ F$ J& J% o
  74. char *dmabufsrc2 = NULL;
    - M2 D$ R. o' L+ i9 m; y
  75. char *dmabufdest1 = NULL;
    5 ~) |& J+ n5 b
  76. char *dmabufdest2 = NULL;: Q+ c/ ?% Y- a: U
  77. 9 @' d2 H9 U  `& t* |: _2 k7 V
  78. static int acnt = 512;
    " ?# f6 `; Y9 K1 R: [
  79. static int bcnt = 8;
    ( i4 W% w9 `7 Y  h5 ]
  80. static int ccnt = 8;0 E: c/ h* V7 h. B' `9 E

  81. 7 U9 A. q# G. z9 \- [/ T, `
  82. module_param(acnt, int, S_IRUGO);: O' L# W- l8 @  W; h  A& y
  83. module_param(bcnt, int, S_IRUGO);
      s$ B  G. U8 }. ^4 h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 G$ @6 D2 p1 w; S% b* W
. |" q8 V- }( L! Z7 h9 ]% R% M. P  n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 W6 ?5 V! e) ^0 l7 D: Q+ a8 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  }) v4 K( T4 H" c, _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: D1 r1 w! q8 p4 q/ B+ X

6 l1 E* d& x+ p
4 s% o8 p/ @' c4 R9 a1 `+ |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 07:24 , Processed in 0.038834 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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