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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; y% n: R/ H* z8 p
  1. [code]EDMA sample test application
    - k+ G# f/ k7 O9 Y7 T$ N% l
  2. /*8 X1 J8 w" a' B$ ~$ Z1 q
  3. * edma_test.c
    ! {5 ^. s+ D+ @! S9 e; d; d
  4. */ J& Y& j+ g0 l/ h3 }3 u
  5. * brief  EDMA3 Test Application
    ; u+ Y3 m7 E1 p
  6. *
    : Y1 L3 I' _9 K. t+ W3 ?) A
  7. *   This file contains EDMA3 Test code.( e: J4 \7 g5 j8 c. G% z( u
  8. *
    / \$ s( h& ^0 s! Z8 L6 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; v7 r3 }7 F# s' z) D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 G" x) P4 y* F9 e- C6 e- P
  11. *         TO CHANGE.
    0 x' c6 n- B7 n2 W& G
  12. *
    $ n# ^# x3 u7 d* ?! c/ D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % ~& h" E1 l9 y5 {8 N
  14. *" I! y& w/ ]7 G6 ?- @" X: ~) S8 K
  15. * This program is free software; you can redistribute it and/or' U& F& T  |& `& [0 T) I
  16. * modify it under the terms of the GNU General Public License as8 W" ]. I5 i, G& L8 w8 u8 U
  17. * published by the Free Software Foundation version 2.
    # q( F' q3 O0 y- [
  18. *# R# K/ k% e4 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 o$ w7 p4 a: y  j( H
  20. * kind, whether express or implied; without even the implied warranty7 w' n2 L  A+ ~8 C+ k9 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 M0 r: o  j* _" F  B
  22. * GNU General Public License for more details.( r/ u' ~: D) ^) f" V* k+ H
  23. */
    * f$ @, a' ]& n2 g' \3 T# i" E
  24. 2 J! P% N, |, t3 Y- N6 r
  25. #include <linux/module.h>
    , o* z' l0 m" b3 i1 x" x* R
  26. #include <linux/init.h>
    7 a+ B  A( d2 J7 D# m- i! l; D
  27. #include <linux/errno.h>
    ! s4 V; X4 a1 Y* v' }: F4 Z- U/ u: d
  28. #include <linux/types.h>
    . V8 t" d- m+ d: i! n
  29. #include <linux/interrupt.h># V5 I: f5 b+ b! R, y
  30. #include <asm/io.h>
    3 C+ R0 S% Y( Y! w! m6 T& P, f9 `9 V
  31. #include <linux/moduleparam.h>
    # \- _5 t3 z% y* v9 T" t3 n' J
  32. #include <linux/sysctl.h>- J7 S3 ~) Q/ }
  33. #include <linux/mm.h>
    8 @2 A2 W3 z+ O% Y. S6 p/ A/ P( d8 C
  34. #include <linux/dma-mapping.h>
    " m. u8 d/ ]; g1 C4 \$ B
  35. ( n+ v; {$ O) {* k" `1 [% H
  36. #include <mach/memory.h>
    . l+ r+ l$ ?  w
  37. #include <mach/hardware.h>% s. [( B+ |  B8 ~8 B+ s5 h
  38. #include <mach/irqs.h>: d: D% }) ?" K% {
  39. #include <asm/hardware/edma.h>6 O. t5 H; D: p* u; u& f
  40. ' |0 d. h9 ^9 r8 i' H" M
  41. #undef EDMA3_DEBUG" K, S5 Y$ M1 `( V' R7 i1 L
  42. /*#define EDMA3_DEBUG*/
    % w3 ]- V6 F# \. i4 `% ?
  43. , o4 ^: \0 u8 Q; T
  44. #ifdef EDMA3_DEBUG
    0 g& n; i  }" Q5 `4 ^9 D" A( l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! I! f% ^: \, `# \: s+ {3 ?; L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% a# X1 }! S2 ^" v* x% T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' a/ }4 T; Y9 D; a$ Z! L
  48. #else9 i$ h1 R! k$ F# k' B
  49. #define DMA_PRINTK( x... )4 n" Q/ y; `' A) H2 N
  50. #define DMA_FN_IN: f9 k5 w1 D% R: t' n- [! K
  51. #define DMA_FN_OUT3 g, K% A& F) w6 ]+ e; v6 }
  52. #endif7 ^' e5 b* n$ O

  53. 6 _: t; n1 G3 K" T: D1 \) e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( o1 A! X# G5 D5 ]) E" x0 T
  55. #define STATIC_SHIFT                3$ C+ Z0 ]# L  z$ g# O: j  B. y: `
  56. #define TCINTEN_SHIFT               20
    ! }2 ~' u! J- z. [7 K# Q
  57. #define ITCINTEN_SHIFT              21" M4 I3 g+ U- j- n# p8 {, K0 l) u
  58. #define TCCHEN_SHIFT                22
    : l; Z: C& O! l/ ~+ s3 \) d
  59. #define ITCCHEN_SHIFT               23
    9 m/ i; Y% W9 z1 F  _2 `. E
  60. ! O9 M+ m! T# I' x* m1 I3 i
  61. static volatile int irqraised1 = 0;
    9 V0 ^! P- z4 A. n0 q9 e: W' u
  62. static volatile int irqraised2 = 0;' J7 Z2 {) D; I, g

  63. # G4 l8 ~- R1 e8 \/ s+ |) l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" `- o- G1 K/ k1 V# U: u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: O0 ?3 G* ^+ X$ ?# o4 z- ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( n# k# B2 E4 P1 Z* Q: Z
  67. 5 S. h( f, g. s5 M/ r" }
  68. dma_addr_t dmaphyssrc1 = 0;
    6 t) x7 b$ g) s* W# d# I
  69. dma_addr_t dmaphyssrc2 = 0;( H$ y0 j- R* K& v5 ~  U' k
  70. dma_addr_t dmaphysdest1 = 0;
    7 ?: e6 G7 K8 C% v' I
  71. dma_addr_t dmaphysdest2 = 0;" T) e# c3 ~  w4 ^$ z

  72. + Q- y) U4 r3 S* f
  73. char *dmabufsrc1 = NULL;! q) d: X3 O! [0 V
  74. char *dmabufsrc2 = NULL;; }$ H* ^# \, v  @5 M  B
  75. char *dmabufdest1 = NULL;
    + _0 C, n6 o# S7 M) |
  76. char *dmabufdest2 = NULL;
    ! Z* j$ Z/ @. v/ {
  77. & l, A4 S! E( b6 i, u; R
  78. static int acnt = 512;: w& V' A& a% G3 {5 F* Q0 W$ O8 \6 ]- E
  79. static int bcnt = 8;
    . J; \. K3 D+ c0 o( J& o* ^
  80. static int ccnt = 8;4 z2 c* |  }! q$ \3 p# n

  81. / r$ j/ c2 D' N: p+ Q
  82. module_param(acnt, int, S_IRUGO);5 `% z, @4 ?+ q# K5 \1 a* f6 j8 q
  83. module_param(bcnt, int, S_IRUGO);+ h8 G! `8 J* M0 @7 \4 q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 j, i& W4 @/ L& ~; |- L4 O8 [
6 F6 G( w/ ^4 [6 B, |% Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 a# [. v: F& {) F# U- k' Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 ?9 P7 E; L' F' ^! A; T3 r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' @* e) J2 B# E" g9 l  U
  Y% b4 E) B. o5 h

1 ?- c& ~+ A: g: c: F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-23 18:22 , Processed in 0.039918 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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