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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 Z- B6 }- Z- h
  1. [code]EDMA sample test application
    8 ]+ l( L% L7 c& ~( U$ H1 f( H) x
  2. /*
    ; |6 t: }7 y0 H
  3. * edma_test.c
    ; m9 }( C! ^/ k! _; S2 C
  4. *
    5 p$ C7 `# Z! _/ c; M5 |, X
  5. * brief  EDMA3 Test Application8 ^$ t4 V9 ?3 a; ?
  6. *: M9 [; l  O0 Y! D' K3 s% y
  7. *   This file contains EDMA3 Test code.
    8 o. U, v0 \8 ~# q, w1 c4 I2 A! C
  8. *
    8 p) x% [, t" T3 ]/ {9 _# Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - G! }  F: {1 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * b# r6 {# l/ I9 t. m& P7 i
  11. *         TO CHANGE.7 ?6 R, h% |& ~$ H9 i: o0 f
  12. *
    # f8 v' O( M5 i/ |( |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. h6 ~( `4 z* i' i! W5 _. L
  14. *- A+ J! I7 s' f
  15. * This program is free software; you can redistribute it and/or/ ~- o4 ~0 N( v# R
  16. * modify it under the terms of the GNU General Public License as+ e' r- D/ [2 z& J% o4 n
  17. * published by the Free Software Foundation version 2.; I( u) ]" {. [/ q5 M7 J
  18. *' g; U- d8 J8 k6 }6 m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! ?' J0 W" d3 Z) D
  20. * kind, whether express or implied; without even the implied warranty% d. O/ v0 Q3 ^/ \( U8 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; G3 d( J0 p. G6 z- y) Y4 q
  22. * GNU General Public License for more details.* E* N. i1 c! M5 U# ]
  23. */
    0 n) J3 j& F' _

  24. 8 {# O1 K6 Y/ B2 ^
  25. #include <linux/module.h>4 `3 _1 [5 z6 e" M" X) ^5 O- U' ?
  26. #include <linux/init.h>( L# O" G; k4 X) A. I( p7 v5 l# [
  27. #include <linux/errno.h>6 e) V2 ]6 n) I; q+ [4 v* Q$ c
  28. #include <linux/types.h>3 \1 N/ `% u# d( `; Q
  29. #include <linux/interrupt.h>
    / _6 m5 _7 {& t' Y$ I7 M
  30. #include <asm/io.h>" S4 j8 T% h: U; I6 B+ }
  31. #include <linux/moduleparam.h>2 ^% x2 ^5 m! n5 _1 }; u; {
  32. #include <linux/sysctl.h>
    ; ?3 C1 U! x. f
  33. #include <linux/mm.h>
    : \; P9 k  n( z/ {% V
  34. #include <linux/dma-mapping.h>$ ^( r* H- \( V: I

  35. , j2 I/ C3 w: Y, W6 j; M
  36. #include <mach/memory.h>$ f* _7 x$ N" [1 }) j
  37. #include <mach/hardware.h>) X" S. P8 o* {) j& f3 Y, u
  38. #include <mach/irqs.h>& |9 R5 K0 T$ y' [* O! B) E* s
  39. #include <asm/hardware/edma.h>
    : b, t3 z4 @$ P9 V

  40.   Z- ^0 S- `1 z' z7 q) h
  41. #undef EDMA3_DEBUG
    + Z4 Q2 S; {2 l$ n+ z/ O2 c1 X+ s( Y
  42. /*#define EDMA3_DEBUG*/) p  @  B! r* k5 {  j1 j

  43. : N# d2 B$ a" U& e- a; v1 K8 u
  44. #ifdef EDMA3_DEBUG
    % ?2 i% D. y/ T" m" e' X  ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 Q/ L$ p9 G4 C$ L( r5 h) r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% P( n. [1 J- E' K- T6 x! s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 R' J& u: s. k9 t# D+ h  k
  48. #else
    2 H" G+ b. k  w/ B7 g
  49. #define DMA_PRINTK( x... )7 A8 K. ]5 c0 C+ M
  50. #define DMA_FN_IN- G6 v- P8 k3 w! M: A% K
  51. #define DMA_FN_OUT- y5 a! D7 _& f* F2 W
  52. #endif4 O, y' j) R$ e$ l
  53. % Q9 ^% @: f7 A/ U% U8 S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 v2 |, A7 |$ Q5 p4 D. `
  55. #define STATIC_SHIFT                3
    8 P# |/ a/ I( m
  56. #define TCINTEN_SHIFT               20
    $ u. ]8 D. K6 A/ a
  57. #define ITCINTEN_SHIFT              21
    6 U) Y) Z( X: l, {) U" i0 q
  58. #define TCCHEN_SHIFT                228 h# Q" L/ o' C
  59. #define ITCCHEN_SHIFT               23
    9 i8 V9 {- U. y
  60. / M4 J1 V# u# x- z1 T+ x
  61. static volatile int irqraised1 = 0;
    # B1 B4 e8 I9 Z. [
  62. static volatile int irqraised2 = 0;
    $ U7 J0 j  T4 h1 E

  63. ' t/ L1 H+ `3 X, S/ ^( K; I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- j" v- @" ]# y9 z# T; |+ k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      p; o# v; p; ?+ r( g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 L7 I& d/ o/ x+ x: H% X

  67. ! y& f/ `- h6 Z+ b
  68. dma_addr_t dmaphyssrc1 = 0;" I* L# i- S% [0 }6 P3 I% @
  69. dma_addr_t dmaphyssrc2 = 0;
    6 V" G+ o4 k  F( ~: i7 p2 _
  70. dma_addr_t dmaphysdest1 = 0;/ R# t. b" _7 Y  D* s1 L. U
  71. dma_addr_t dmaphysdest2 = 0;
    ) G1 q: [! p2 B# h) c3 W0 |

  72. ( ]6 J; m" I  K+ ]+ J  r' y9 N
  73. char *dmabufsrc1 = NULL;
    9 ]; t2 a% T8 P8 k) T7 n
  74. char *dmabufsrc2 = NULL;
    ( ?; m* l; f1 [& k+ K! a; k( b9 L, T
  75. char *dmabufdest1 = NULL;6 p  q" d* K& d0 R
  76. char *dmabufdest2 = NULL;
    9 m6 d8 s" k  Q3 x
  77. 7 f! E* e$ \  e/ H. C
  78. static int acnt = 512;
    * G2 D! g: ?1 ?) t/ v9 X3 w
  79. static int bcnt = 8;
    0 R% l: K" G, Z' t: J# ]: i
  80. static int ccnt = 8;
    + I9 z4 R8 z7 i" N$ W5 W- b6 w
  81. & `9 P- p& M- h2 y6 O' W) d) K
  82. module_param(acnt, int, S_IRUGO);
      e( K1 j1 d: L6 `: Y
  83. module_param(bcnt, int, S_IRUGO);# I" j1 C% {9 j4 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' l6 M7 S2 v+ E5 P2 l) V; D5 W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* h/ \# ]! b: Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- h3 _; k5 [) l$ X: j7 [' u/ j6 p* O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, X3 n% i/ C  a; P: s  w

9 Y1 o. Q' Y# m/ Y+ n8 C+ r) J. W5 H
1 b$ F) U6 S# w+ i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 19:32 , Processed in 0.045627 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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