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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % e. Z4 Y0 ?9 E9 E; I
  1. [code]EDMA sample test application
    4 [' ?5 o; y; K$ R8 \* A! q
  2. /*. T# q# ]7 a5 \$ w+ I- T
  3. * edma_test.c2 F7 {, l4 L% H- Z$ ?
  4. */ g# C9 R' Y& t. P$ O
  5. * brief  EDMA3 Test Application
    - I! k8 g% A& C4 D6 b
  6. *
    0 k. K: G% j( {2 K8 Q* q5 g
  7. *   This file contains EDMA3 Test code.
    5 E4 y" r* n% W6 a1 C  r
  8. *
    2 y* d7 _* }2 U. X0 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 C- c, k5 v8 g9 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * J; ^! s5 _$ ~. l' }+ Z: J
  11. *         TO CHANGE.
    ( ^2 X: l8 L: G6 M: B3 T) K
  12. *& {. Z9 D* O2 S0 a) I0 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # m5 p. D; d, L& A3 D% B( {9 s- t
  14. *
    2 {- ^- @0 d) v. E
  15. * This program is free software; you can redistribute it and/or
    2 Y7 ^3 t3 H8 @% ]
  16. * modify it under the terms of the GNU General Public License as3 c0 ?# |2 n% e! A
  17. * published by the Free Software Foundation version 2.9 I. W5 e3 q& a+ L1 k& o4 R( ]$ J
  18. *
    + F1 g' ]: q& B; U4 Z. l3 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 v7 e8 I9 I/ D3 F  y7 L
  20. * kind, whether express or implied; without even the implied warranty" i0 F9 G5 e, i& G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 U! k7 V  U, ^: o% h& y9 G4 T
  22. * GNU General Public License for more details.. j5 G5 F% y/ v2 v/ }) A1 w! G
  23. */  T1 i/ e* b: T3 Q$ O" i  Q
  24. 6 n7 V! ^( X" B; W
  25. #include <linux/module.h>
    0 Z- m) D# W* t2 ?* V$ g) G
  26. #include <linux/init.h>2 ~8 j/ F' Q' p( D8 q1 F
  27. #include <linux/errno.h>
    0 Q% |" V; ~. K
  28. #include <linux/types.h>) T, D- A/ E5 s4 V4 I; u, e
  29. #include <linux/interrupt.h>; l- o2 {4 n+ `2 f& @- ?% `
  30. #include <asm/io.h>
    ! t1 Z2 D- H4 R4 R$ M  a+ S, s
  31. #include <linux/moduleparam.h>
    : ^+ a4 E; X8 \( g' c) R; ~2 w
  32. #include <linux/sysctl.h>. n2 T7 g7 f$ K  g2 p) L; R
  33. #include <linux/mm.h>
    $ N. U( K: }3 W3 {8 `0 H/ P
  34. #include <linux/dma-mapping.h>
    : d1 L% z: [- ?) |0 `
  35. , a' P8 i1 Z  }! r
  36. #include <mach/memory.h># l: y) N/ f5 L/ j
  37. #include <mach/hardware.h>0 {2 H5 e  [& i4 Q# A1 w
  38. #include <mach/irqs.h>: n! N: W+ s8 y- s  w
  39. #include <asm/hardware/edma.h>
    % V! p; ]  @/ A  j: K1 L% C) ^( x
  40. 9 q$ k- p9 P9 P. u$ A5 f/ `
  41. #undef EDMA3_DEBUG
    ' e; R2 ?, a' _
  42. /*#define EDMA3_DEBUG*/& Y6 E* u$ J# o1 b6 [
  43. 4 Q1 C/ i! ?# N1 W
  44. #ifdef EDMA3_DEBUG
    0 @* q' m' `9 F" O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 l% ]+ U3 h( i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! t' Z: r3 U$ K* Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 @4 f& E& e" J: Q) x$ ]% a( y
  48. #else- O/ s! h( @, H5 R# ]  Q5 W3 d
  49. #define DMA_PRINTK( x... )
    0 R8 H2 n, q2 q" g& a* D
  50. #define DMA_FN_IN
    # {% e0 i% @' X" G' |' m& c6 _/ g
  51. #define DMA_FN_OUT% T% \+ y$ Y2 C
  52. #endif# n& l' v/ Y; {2 `! L6 F8 j

  53. / R' f/ l# ?% L* M" c! p- m, e6 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . J  u+ e8 y/ `3 e0 l
  55. #define STATIC_SHIFT                3' q. _7 K: \" n- P- @1 D7 [) P( b
  56. #define TCINTEN_SHIFT               203 d8 S% Q( h! b4 z8 b8 F. U
  57. #define ITCINTEN_SHIFT              21
    4 r* C  l* m& r9 e
  58. #define TCCHEN_SHIFT                22# [; q: B' {' Z& g' H
  59. #define ITCCHEN_SHIFT               23' a8 H& [: X+ {# d3 O2 r
  60. 8 e# K/ J6 ^. q/ d# W4 m
  61. static volatile int irqraised1 = 0;
    ! ?. M6 o; ~% K8 t
  62. static volatile int irqraised2 = 0;
    3 i' ~9 B& G! L/ P2 |1 O8 ^& p- R
  63. + }0 U" `1 Y8 n/ G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! R$ J2 O% \  b) k0 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ K  e: N0 q- i0 M" q: j' f) _" {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ C# `. h* o7 `  n+ C# M, s& V

  67. * s* o7 o* S) v
  68. dma_addr_t dmaphyssrc1 = 0;- B( |- n9 P! B/ c  k# M
  69. dma_addr_t dmaphyssrc2 = 0;4 I! W* M  \* ~- \
  70. dma_addr_t dmaphysdest1 = 0;- J" |7 Y0 B7 b
  71. dma_addr_t dmaphysdest2 = 0;; G: C" U3 s) p9 @% M8 e
  72. - _( i& [0 L' D* A* B+ E
  73. char *dmabufsrc1 = NULL;
    % D& o5 I7 W* B# l$ [9 [0 W
  74. char *dmabufsrc2 = NULL;
    * s" e+ C! C9 u8 M& V
  75. char *dmabufdest1 = NULL;$ m! x) H# e- Y5 l. w
  76. char *dmabufdest2 = NULL;
    , D2 H( T% {+ ?. W* k

  77. $ {5 Y" \6 H$ {0 H3 P) `4 l
  78. static int acnt = 512;
    ' j3 \1 X" T7 b" ]' q0 Q" a
  79. static int bcnt = 8;! d" u( D2 A4 @* D
  80. static int ccnt = 8;* M# I7 q) f/ o6 ~# T4 f
  81. ! T# m) u0 i$ m
  82. module_param(acnt, int, S_IRUGO);
    + X# e6 G+ X7 s2 ?, z5 s( }
  83. module_param(bcnt, int, S_IRUGO);) i- @& r) S. P. O* O; i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 f- I0 ?8 k) s' H5 j0 }
. I# k+ o+ D' ~" B' ^$ z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ m1 G( c' D/ K, Z  V3 W/ m3 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 y+ p5 ~+ ]% J) F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. m/ r: Q1 j& g0 H1 v8 f0 \
& @6 N5 @' i1 e3 j

; T7 t) s, g6 i. {/ m8 J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-1 06:32 , Processed in 0.041647 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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