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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: v" f/ t( Z, \: f% I7 i& \( F1 X
  1. [code]EDMA sample test application
    ' E/ O. X4 E, ^
  2. /*" A$ E2 {+ j1 }) t# j8 Q
  3. * edma_test.c
    2 v# R1 d3 g% S" s4 t2 y6 u. o  X. C
  4. *0 v8 {* D3 \; O* F  f9 c# ]4 s
  5. * brief  EDMA3 Test Application
    5 V/ A" g8 }9 v, E0 v$ ?& \
  6. *: j0 N$ ~6 j7 a/ m% k" u
  7. *   This file contains EDMA3 Test code.6 c4 o" R5 t0 x/ f) H& Q
  8. *
    $ C' R  O, t# `% S" s/ u5 Q8 q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & `# g. C: n8 l' b5 [8 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& R0 h/ z9 ]! W% {
  11. *         TO CHANGE.5 i' q- A" ~+ _. D; |7 `! h
  12. *0 p: C$ d' S" b5 o: ]$ O0 p, z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      Y; U4 o7 m6 L6 _- [
  14. *
    * \8 g5 ^2 {, N
  15. * This program is free software; you can redistribute it and/or) L3 N& G' }' ]: {
  16. * modify it under the terms of the GNU General Public License as# P$ i* K, ]4 n. t1 A# c* \* {
  17. * published by the Free Software Foundation version 2.
    " i+ ~* `: h9 U
  18. *. }4 m9 B$ u5 q' b: J# W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & z* }+ d# S3 E: w
  20. * kind, whether express or implied; without even the implied warranty
    , J# k  O1 ]- M# P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' V* ]9 Z6 f& z9 ]+ s/ ~! r
  22. * GNU General Public License for more details.
    8 Y$ n, q) V$ C4 I2 s0 V+ M
  23. */; I, M0 g2 Z- H+ h* n6 U
  24. + p( A6 I0 _) U4 ^
  25. #include <linux/module.h>. r0 c5 L* W8 r% Z* j- J  H2 |
  26. #include <linux/init.h>1 T7 X$ M1 A5 G8 w& q5 ?$ S$ u
  27. #include <linux/errno.h>7 h6 D* i( d; Q' X. Z% Z
  28. #include <linux/types.h>
    7 _2 v$ l4 `; Q) @! Q
  29. #include <linux/interrupt.h>
    * w' |+ `% R. d" ~7 y. b2 R
  30. #include <asm/io.h>
    # V- w8 H: g- n9 Q
  31. #include <linux/moduleparam.h>& l6 O  G' |9 U4 O
  32. #include <linux/sysctl.h>
    ; M. x7 Y- p, S. l
  33. #include <linux/mm.h>
    / K0 s, F$ G  x2 }/ r& @
  34. #include <linux/dma-mapping.h>: R: N: R) q8 g( X
  35. . d' Z7 H5 d1 p8 k2 W! x
  36. #include <mach/memory.h>5 }8 v2 `5 v; W
  37. #include <mach/hardware.h>
    8 ?7 ]2 i5 u- _2 L, P
  38. #include <mach/irqs.h>
    . `7 i: P4 p' ~, D9 z
  39. #include <asm/hardware/edma.h>
    1 m% O) N4 v% F

  40.   d. y4 i/ j9 ~4 r$ U3 j
  41. #undef EDMA3_DEBUG- c' J4 \2 [1 W0 G+ B2 F
  42. /*#define EDMA3_DEBUG*/' |6 e/ A+ Y* G# g) v6 G

  43. ) G# U3 J$ ]2 u4 i) C" s
  44. #ifdef EDMA3_DEBUG
    1 K  P1 A/ F, y1 i+ l* k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ s* e" B+ X2 x; ^* F/ F  O# `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 V& a9 q8 X- [+ M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( e+ _1 b; A7 p: W3 k) V* E
  48. #else' F+ s* g& X8 u# ?' o' @+ q( t/ t+ G
  49. #define DMA_PRINTK( x... )
    , ~9 S# |7 [/ |2 [3 ~' `* d
  50. #define DMA_FN_IN- w8 {" E% M4 `, Y
  51. #define DMA_FN_OUT
    # [# Q4 `8 K7 a) D1 U5 c0 h
  52. #endif
    & J5 U' N1 _2 b- K% R6 p6 a
  53. 5 g: {# h1 O$ Y1 C5 b) z5 t) b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      X2 V. \- g+ k# s7 j  D, v
  55. #define STATIC_SHIFT                3
    0 W3 z6 _( O' \0 K# d9 ?; K" v9 U
  56. #define TCINTEN_SHIFT               204 p" m2 o3 t& j/ k7 p5 S0 {
  57. #define ITCINTEN_SHIFT              21- U* \, K9 ~9 g) o6 ~  F  `8 x1 j6 {
  58. #define TCCHEN_SHIFT                22
    ( j. _4 u( U" [7 q
  59. #define ITCCHEN_SHIFT               239 P! p7 B8 o$ B3 H( b" `
  60. - l7 m2 w5 [8 O1 S8 v
  61. static volatile int irqraised1 = 0;6 k' _; R" f0 H2 c! j- A3 f8 q
  62. static volatile int irqraised2 = 0;
    : d) k) T& s( p3 K: x7 `$ I/ Z

  63. % \. J* o! g* e  Y2 G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 r- h: e+ g2 }: ?8 m* t0 W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / f' W4 ~: S' ^0 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* r- C: C7 W/ I

  67. 1 m) o: h! c/ V
  68. dma_addr_t dmaphyssrc1 = 0;3 y& d/ T7 @# w! x- p+ G) B
  69. dma_addr_t dmaphyssrc2 = 0;/ w% D* J/ r6 l4 c: _  T2 R
  70. dma_addr_t dmaphysdest1 = 0;9 I; P: v7 P7 e5 a- T
  71. dma_addr_t dmaphysdest2 = 0;! ]1 U$ h  }1 ]* J4 T

  72. 5 y1 [  H6 M/ n  P4 j# E2 |1 h2 T
  73. char *dmabufsrc1 = NULL;
    4 `: n3 z3 z) @) z
  74. char *dmabufsrc2 = NULL;
    ( A9 |3 @3 G- f! Y6 L# \) H8 K# D
  75. char *dmabufdest1 = NULL;
    & g# ?  h+ |" Y& m1 f
  76. char *dmabufdest2 = NULL;
    4 o9 Q! M1 D/ @) g. g& k  t' {

  77. / L6 H) b' j+ W7 L3 v
  78. static int acnt = 512;2 G, q; P6 ?/ K' H% {3 l" S5 R
  79. static int bcnt = 8;
    & o' |+ o) X  E
  80. static int ccnt = 8;
    # G9 g( e1 p' R9 I5 p, N$ A
  81. # c" o) V; w7 U9 H+ r* U
  82. module_param(acnt, int, S_IRUGO);
    0 V0 S) i4 x+ I5 x/ n8 i% U" V5 H; U
  83. module_param(bcnt, int, S_IRUGO);
    ( K8 T( s* b/ g" c5 f/ n- M; ~5 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 i% O" d( X8 q  B3 q2 A: [, @0 T4 [* s; w+ `' H# Z* l; G! o% e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 u) X6 H/ c/ \, T2 D8 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 f9 T; v# S5 V# Y- c) N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ P9 x" V/ K* U3 u4 T
7 ^# t: A$ w/ f. f( s/ C+ M0 F  O% F& z) g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-7 11:36 , Processed in 0.042513 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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