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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; M' d: d' A. b" _0 a8 R1 |8 L) c6 U  k
  1. [code]EDMA sample test application0 ?( U  R+ {7 U' j$ ~$ j
  2. /*5 I% z+ ]# M) @: x0 E# U
  3. * edma_test.c% M# D2 ^3 ?  T0 P3 ]7 w
  4. *% E1 g) c7 J' H% O( _; O
  5. * brief  EDMA3 Test Application
    + w5 d/ |- o' J( R0 q+ a" w- G, z
  6. *( I- |4 P8 j4 _0 U& t
  7. *   This file contains EDMA3 Test code.
    8 @/ c4 }2 q6 j
  8. *
    2 S! L; @8 t- e! h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - i9 ~- V' \- X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 W0 v  J8 S, P' f. f; ?/ g9 ?% ^
  11. *         TO CHANGE.& n) F6 ?, W, Z
  12. *
    7 V6 R5 ?* T# ]: p+ e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) u9 {& R( o: f- t* J  K
  14. *. R; E( S/ l$ \+ C
  15. * This program is free software; you can redistribute it and/or" S3 y' ?1 ?, s$ F
  16. * modify it under the terms of the GNU General Public License as
    % F4 y6 d! v$ R6 J2 T3 N1 `
  17. * published by the Free Software Foundation version 2.
    5 k3 O6 f0 A2 a2 a' H) p
  18. *) X/ \# a9 d+ B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: \- U8 ]. p7 t3 `, }8 Y. ?
  20. * kind, whether express or implied; without even the implied warranty
    + t1 ~/ S! }) N; ?9 b- S. f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 |) B* K4 m4 ?) L/ T
  22. * GNU General Public License for more details.  \; x$ ?* ]' f) X  f+ C( a
  23. */0 s" \$ ?9 v& u

  24. 5 L' y: y4 S/ U2 H/ d. o# n
  25. #include <linux/module.h>
    # J# V6 g+ X/ L* B' e
  26. #include <linux/init.h>
    0 Q( R* w/ c# y
  27. #include <linux/errno.h>! l7 [( ]# E# x+ Y/ Q- @
  28. #include <linux/types.h>
    3 u) h1 n: A/ y+ ?% ~
  29. #include <linux/interrupt.h>1 `2 C8 @8 c1 z% y/ V- ?% c
  30. #include <asm/io.h>! S, V; q' l. M5 k: j* M( u
  31. #include <linux/moduleparam.h>
    " S" q6 r8 e2 p6 V  q
  32. #include <linux/sysctl.h>4 F/ J8 c5 G  z- }6 z0 b" U
  33. #include <linux/mm.h>7 G0 R* Z# z- y+ w% h
  34. #include <linux/dma-mapping.h>
    ! i8 s6 x4 n+ v" D/ C9 ]

  35. # q% ]) _! C: O6 h
  36. #include <mach/memory.h>
    & V7 ^) B* l* Z
  37. #include <mach/hardware.h>
    % f& o. r) s; A1 L
  38. #include <mach/irqs.h>1 W: L; ]; i/ d# R% {
  39. #include <asm/hardware/edma.h>: u+ L* H! m/ l4 t2 n: q/ t

  40. / V' B8 P' x5 ?1 H2 l9 m2 o) ^2 e  I
  41. #undef EDMA3_DEBUG: n* F. {  ?5 m/ F: k. L5 ?
  42. /*#define EDMA3_DEBUG*/3 b4 t+ T$ O6 D/ f5 @( x
  43. ) s3 ~9 k# Q8 i0 `9 o; b
  44. #ifdef EDMA3_DEBUG4 g6 {$ f* R: i( N9 H" N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 t% z! J! E5 w% w' W* ^0 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): c5 w9 z; T& |) G9 ]; G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) ~; w6 K  U. r% \( ]. z; ~
  48. #else
    + W# c. q: f! p+ Z
  49. #define DMA_PRINTK( x... )( t. l  c" o: q- r4 x1 A+ j
  50. #define DMA_FN_IN
    2 h2 s! k! C0 u- ?
  51. #define DMA_FN_OUT$ f4 O0 D4 ]; }  z  ^1 W
  52. #endif
    - N. d, W0 s4 E/ K4 W

  53. $ o; }5 C( Y- ]  F' d7 i* G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , P! c/ e* I$ X) X* x
  55. #define STATIC_SHIFT                37 Q1 v& Q; N$ X. n: s/ U- T
  56. #define TCINTEN_SHIFT               20  d0 Z2 X6 I  ^% g
  57. #define ITCINTEN_SHIFT              21' H* o9 m9 i6 ?1 q) J/ J0 J8 F1 `
  58. #define TCCHEN_SHIFT                22" D  k2 f# ^/ Q9 A/ E$ X
  59. #define ITCCHEN_SHIFT               23
    ! q( u; ^  s; \4 z. m' p
  60. 1 m/ ^( _$ r9 R( g2 C
  61. static volatile int irqraised1 = 0;5 J! d9 y$ }8 [" I0 ~' D" Y
  62. static volatile int irqraised2 = 0;
    : Z; V# i6 W& x
  63. ! c6 K3 q2 m4 |+ S% T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 B/ w: y3 S3 B4 g) M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 A. P( U4 ]" d( O9 d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  u" `2 @/ {& N$ R: E

  67. + y, J& [, P8 |! l' v
  68. dma_addr_t dmaphyssrc1 = 0;) Q, \# n# ~8 p/ g$ Q
  69. dma_addr_t dmaphyssrc2 = 0;4 ^( ^/ l+ N) [! g! j4 E2 |8 l
  70. dma_addr_t dmaphysdest1 = 0;4 G4 u! D+ e* I. b) ~! r- r5 [
  71. dma_addr_t dmaphysdest2 = 0;
    $ Z3 B7 [/ t7 p( O

  72. 8 R+ j4 O; k3 }5 U! S
  73. char *dmabufsrc1 = NULL;
    ( Q; D" U9 b; v: |1 G9 s
  74. char *dmabufsrc2 = NULL;( B- P* A" {5 x* R) J8 n% |
  75. char *dmabufdest1 = NULL;, {5 c* m  A8 t% w
  76. char *dmabufdest2 = NULL;
    7 g5 o& e& T% r! v3 u4 f) j4 r( l

  77. 9 ~; R0 K1 Q- f0 n! y
  78. static int acnt = 512;  K: p& e" B9 N3 ~' e& T" ^+ l$ U0 {
  79. static int bcnt = 8;# {$ p* G. M) k% g5 J) s
  80. static int ccnt = 8;+ m) W' t/ W, E
  81. - m( k7 m. g+ z' L/ q
  82. module_param(acnt, int, S_IRUGO);% z/ q3 M7 C& T2 W
  83. module_param(bcnt, int, S_IRUGO);8 r3 y) {& d  Q% {: O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% n( K2 B# T* G0 h& i

% Q2 v1 X. p" g# ]0 k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* K" ?. b# o" I1 Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, m  ]- f0 S" L9 M# w1 \8 e% J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( B0 q' }- A7 U: D: m, `

% a$ D- r% b; K, T
, L4 @2 t5 H. Q& ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 10:25 , Processed in 0.039516 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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