OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ U& \% ?# _  M7 P. W) K1 `
  1. [code]EDMA sample test application
    % a2 D+ E& [% a: j
  2. /*
    9 O8 X- t( T& M7 N3 k, `
  3. * edma_test.c7 J* b4 |+ A0 ]6 `$ y6 s
  4. ** g" z4 K: L# o+ ~( ]; F' }
  5. * brief  EDMA3 Test Application, ]% z7 b0 \. t3 H; j2 f
  6. *7 g8 n& t: D) c2 k; |0 P1 ^# Z
  7. *   This file contains EDMA3 Test code.0 H9 m+ m8 E7 n, _: d5 \
  8. */ `, ~% k( k. ^; W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 r" B5 k! W4 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * M6 N3 p* A4 M7 w1 U- p
  11. *         TO CHANGE.
    : J6 h( B. J# Y9 n" u: E  p
  12. *
    - U8 {* J9 P4 w% f! H$ i, y1 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % ^. }# O" d1 I! f5 ^
  14. *
    ! ~9 T& V3 v1 W9 ?1 V) d1 w, j/ S- }
  15. * This program is free software; you can redistribute it and/or
    - w5 L+ {# I7 ]* m8 z8 i% s
  16. * modify it under the terms of the GNU General Public License as5 {7 n7 m5 H# {5 j! r+ v" D
  17. * published by the Free Software Foundation version 2." H+ n5 h" N/ \# a& S2 r
  18. *
    0 g6 q  L- _: @; w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 f  o# Y- w4 }
  20. * kind, whether express or implied; without even the implied warranty* O+ X" |* k- X9 k1 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) s8 q6 R3 u+ ?% g* e
  22. * GNU General Public License for more details.
    - [+ O) a- `6 E( `( \  j! e
  23. *// p; |" y0 U1 S7 {

  24. . b  S) e/ D3 Q1 A* v9 q/ d9 Y
  25. #include <linux/module.h>+ x+ ?) {' J+ O2 Y5 A  H0 N- `
  26. #include <linux/init.h>  l; N' w9 p3 ~& X
  27. #include <linux/errno.h>9 y$ Q2 K7 I2 U9 U: F
  28. #include <linux/types.h>/ N  y9 O" l# `; B4 ?7 W
  29. #include <linux/interrupt.h>" {5 ?- K6 T' @& D
  30. #include <asm/io.h>3 p% S0 P2 U* L* o. t5 }
  31. #include <linux/moduleparam.h>
    ; @) `# @  M& z5 }1 R+ N
  32. #include <linux/sysctl.h>+ [  R/ k/ J3 |: \$ ?" y* x, N
  33. #include <linux/mm.h>' Z  B# M; I! A3 q# Q4 F( D: d
  34. #include <linux/dma-mapping.h>
    9 ?5 P) O7 ^6 q9 ~; h
  35. " d% y, Y/ G" I7 s9 }5 G( j
  36. #include <mach/memory.h>
    0 s& @* ]/ Z3 H7 I" i
  37. #include <mach/hardware.h>, m. m# r7 r; d  Z
  38. #include <mach/irqs.h>
    , B6 E9 `4 R/ v- J/ }2 n
  39. #include <asm/hardware/edma.h>. X- S) i$ F1 x2 `# o% B& S

  40. $ O4 M! x2 a! a1 O1 U5 V7 g
  41. #undef EDMA3_DEBUG
    ) q, M7 y* h% r8 Z  V' L8 Y
  42. /*#define EDMA3_DEBUG*/
    ) J* i* X% F  Z; s) Y$ T1 D
  43. 9 q- y1 r3 ^0 K. O5 I
  44. #ifdef EDMA3_DEBUG# z4 V! B  c5 [/ B( j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ D- d  e+ t+ q1 f% x% u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 P4 \) l0 W9 {, L5 ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; S2 Q' j1 ^( g: P1 |8 q. V, Y
  48. #else
    / e/ r- F, V. |/ u3 F5 R
  49. #define DMA_PRINTK( x... )3 ^0 L0 W1 ]1 u! g
  50. #define DMA_FN_IN6 E$ h1 B% i2 Y1 N! C! D! E/ ?
  51. #define DMA_FN_OUT; b; H' o% e* ~9 ~' y$ u
  52. #endif# P0 Z4 \9 q* p- X1 R7 U4 ]- _) ?; m
  53. 3 N7 F8 H2 y5 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 t) k1 U4 O2 k8 d& ^
  55. #define STATIC_SHIFT                34 Q5 x( X5 x3 S5 o7 B  H
  56. #define TCINTEN_SHIFT               20* n, b! K3 M9 M0 _' ^) U: X; y
  57. #define ITCINTEN_SHIFT              21
    9 u# W$ t; x! m) W
  58. #define TCCHEN_SHIFT                22
    ; D% S# h% w" D  Y+ I
  59. #define ITCCHEN_SHIFT               23
    0 n; o- h; @# |  ^. }

  60. 8 ~" d" V) {% K: c8 {! |# p
  61. static volatile int irqraised1 = 0;$ P. T# V2 X# f8 l( u: L
  62. static volatile int irqraised2 = 0;& M( G# l- R1 {% \! r9 k1 R
  63. ' M1 p6 v2 @/ ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  z7 E5 r3 f7 [4 C: [0 N& t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# N0 F5 f4 t% B0 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - t, C# Y& ^; U3 E% \
  67. 2 C2 y5 q4 Q$ C
  68. dma_addr_t dmaphyssrc1 = 0;
    * H6 a, Z( T5 u- c4 \
  69. dma_addr_t dmaphyssrc2 = 0;$ ?' t6 u* p  P8 v
  70. dma_addr_t dmaphysdest1 = 0;
    & A+ k% p; w8 D0 z: l( V
  71. dma_addr_t dmaphysdest2 = 0;0 B8 ~4 g$ E8 d( a
  72. 7 x4 b6 S9 B- q% b$ m+ x0 F! c
  73. char *dmabufsrc1 = NULL;
    6 E8 X* U: q. r2 f1 y9 @. Z
  74. char *dmabufsrc2 = NULL;
    * c* O! h/ N; R& w
  75. char *dmabufdest1 = NULL;# F0 j# N; p! L: N# `: j9 d3 K
  76. char *dmabufdest2 = NULL;
    7 X% d$ Q5 e/ ~' R
  77. # }: |$ d4 s( D2 R# q3 r% z
  78. static int acnt = 512;
    $ y4 E, `5 E2 D$ d8 ?
  79. static int bcnt = 8;
    7 R" r1 W5 w9 R& E( l/ c
  80. static int ccnt = 8;2 `. v8 J" C1 r' M. }( R$ ]4 T

  81. 8 J. c+ h" X& D
  82. module_param(acnt, int, S_IRUGO);5 N5 Q* N. t2 T7 o# q  J& u
  83. module_param(bcnt, int, S_IRUGO);
    ! {1 V: j: [2 h0 Q, s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) h% D" J& }# \* y  r: Y. c0 `

1 S, C. [) [7 ?9 P+ ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 H# u2 A# O2 B0 B0 Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# u7 z1 f  P# R: v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ V6 J# k+ g) X: p$ _0 {2 _; G/ e4 g' t/ S! R- K( K$ }' ]  I
9 e/ |( z# ~- o& c2 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 09:41 , Processed in 0.039951 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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