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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; _8 H1 N6 {0 U! t+ ~+ c% E
  1. [code]EDMA sample test application
    + H+ r  b# f  n9 Y& \  W/ k
  2. /*2 J) I7 F) U. A" }* ~8 `7 j
  3. * edma_test.c
    2 A: s0 F$ J; U, r# y4 f: k; A
  4. *) W1 {8 Q  g2 \, v' F
  5. * brief  EDMA3 Test Application
    2 K. O" c' z7 C" c
  6. *
    & l" X! E  R; [  R6 J" m
  7. *   This file contains EDMA3 Test code.; I, o' I! A4 H! c
  8. *
    3 e$ }4 C5 n/ A; Z; |' v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      @: `2 C4 G. c4 L! j; J  j: g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ F$ Y8 n5 X+ K3 z
  11. *         TO CHANGE.0 M4 K) e+ [# i6 M
  12. *7 E& _, G3 b0 C7 F" s1 ]% J+ p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% _9 c4 l% Q; `
  14. *. t7 M+ H4 i% A& k3 D" n
  15. * This program is free software; you can redistribute it and/or9 }# E0 P9 h. q# H1 @
  16. * modify it under the terms of the GNU General Public License as
    ' {& [+ W7 t# G5 \- Y
  17. * published by the Free Software Foundation version 2.; }; y$ f! X* _4 E
  18. *
    3 T1 b) y% ]8 `4 T2 |! N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 t' c& Y+ G1 P# g3 z+ v5 v
  20. * kind, whether express or implied; without even the implied warranty$ i  P$ \# R! ~- z) z+ [, a+ g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' `0 ?! z/ ~) V! C
  22. * GNU General Public License for more details.
    / c3 K. L% L# ]8 x% V* w+ S
  23. */% m# y$ Q6 w. t7 ~* y

  24. 1 V" v; f% C6 |% P1 b1 j
  25. #include <linux/module.h>% s2 O% V& V) E' N
  26. #include <linux/init.h>% }, Q' ]; n+ a" B$ P
  27. #include <linux/errno.h>
    - F6 P: Z, H. G
  28. #include <linux/types.h>
    6 ^- V! Z* `/ E6 q- O# T4 b
  29. #include <linux/interrupt.h>6 l/ H- r% g4 M3 y4 Z
  30. #include <asm/io.h>
    + z- Q. x2 |+ l# L
  31. #include <linux/moduleparam.h>$ f, U2 S4 W6 v8 i8 t3 n9 p# H8 E
  32. #include <linux/sysctl.h>
    ' h4 a. |; [, c
  33. #include <linux/mm.h># ^: z5 B( L: y' U
  34. #include <linux/dma-mapping.h>
    1 Y( P, `0 f# m; b2 r
  35. ' A: W1 ?$ g9 f3 M
  36. #include <mach/memory.h>. ~( o0 p$ B: v7 y8 J; {6 e
  37. #include <mach/hardware.h>( U: K* u$ v5 Y$ P/ U3 G, C
  38. #include <mach/irqs.h>7 Q; q& }2 o' B2 [8 P" D: m/ v
  39. #include <asm/hardware/edma.h>
    7 ]  l! x  w$ c/ [9 w: b

  40. $ D& A8 G' ~5 H7 N
  41. #undef EDMA3_DEBUG1 C% t. W4 [8 w, N' F8 [
  42. /*#define EDMA3_DEBUG*/
    $ A0 f1 u0 W- o' n3 Q' q  U! T- p! A

  43.   b* |& y/ y6 H
  44. #ifdef EDMA3_DEBUG' {6 ~4 Q# [/ j: C2 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 L) t7 G! m* V2 L' ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), {( o1 k7 s/ G+ k! d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- r- y. C6 a+ }/ ]' H
  48. #else" |+ \. F: w. u
  49. #define DMA_PRINTK( x... )# U7 u1 M1 y* O4 P
  50. #define DMA_FN_IN+ q$ Q6 c3 {( K  e
  51. #define DMA_FN_OUT
    . R9 p+ x- }' |% v7 Y
  52. #endif
    " u8 B6 ~6 J2 t- P# K

  53. + l+ n  Z* t. v- s+ ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% i% j' \' ?5 N) X1 j
  55. #define STATIC_SHIFT                3
    / B/ F, N2 o( U5 ?% S% j  z
  56. #define TCINTEN_SHIFT               20
    0 q6 a6 a6 S- U' [  T' T
  57. #define ITCINTEN_SHIFT              21. g6 v" P0 |. [' I4 ]2 t- ~
  58. #define TCCHEN_SHIFT                22' k5 h1 G# h7 f2 p8 @
  59. #define ITCCHEN_SHIFT               23
    - y+ I* T& m1 Z! O4 l  N4 y- l9 x
  60. + T; B) ]. |/ k; b
  61. static volatile int irqraised1 = 0;2 r( O- a' ?4 A, A
  62. static volatile int irqraised2 = 0;
    - W) a) f$ Z; `
  63. - y( g" Q. V8 k4 N/ v+ L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 ?7 X5 d. D+ c0 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 {, ]/ N; V, \2 j7 u" M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 K7 G! Z$ ?* f% I

  67. 9 s( Q1 Q  a" h# g& [$ P
  68. dma_addr_t dmaphyssrc1 = 0;+ G5 I  g' o- J" q' q5 a
  69. dma_addr_t dmaphyssrc2 = 0;
    $ U1 }. q4 i+ j! w# r" X
  70. dma_addr_t dmaphysdest1 = 0;! S% K& d1 `9 A& ?
  71. dma_addr_t dmaphysdest2 = 0;, C4 k3 K( x6 {

  72. ) c: y0 g+ z9 s; Y, f
  73. char *dmabufsrc1 = NULL;
    * n0 ~) I0 U. J) q4 K9 N# U
  74. char *dmabufsrc2 = NULL;
    3 |3 g0 q5 D, c# m
  75. char *dmabufdest1 = NULL;# M( g5 H9 p+ G2 F6 }1 R! S
  76. char *dmabufdest2 = NULL;4 f  w. }/ `5 T4 }

  77. ( T1 A% Y: C$ W' v9 J& x% N2 l2 j# F
  78. static int acnt = 512;; r2 s8 L; a/ j5 l3 ~1 O2 W. u/ H" X
  79. static int bcnt = 8;
    0 F% x+ u; q3 I+ a+ o
  80. static int ccnt = 8;
    5 M* u/ N: W8 K! z
  81. % ]/ ]8 x: J/ f( t/ w
  82. module_param(acnt, int, S_IRUGO);; u: B, C8 R# I  a5 m# z
  83. module_param(bcnt, int, S_IRUGO);
    5 x" ?) E! s* Z1 z" @/ l8 \, E  Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 M" t2 J3 K) s9 J% Z- Z0 J' t& ~( [6 h3 Z6 P4 D) M6 q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% n& Q5 x6 z$ E) G) b* \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( {( x4 x' D, f. V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ @8 B( G4 Y! D& M2 ]
! U+ k/ s$ q( K+ S: `/ A! s
% R4 `. T5 M/ g- {4 {- c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 21:38 , Processed in 0.042111 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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