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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. N. ^* }4 s  `) G" p6 S
  1. [code]EDMA sample test application
    # r9 ]  E' S4 O7 c+ r, j
  2. /*
    $ t9 g7 `0 y* R2 w  B) n
  3. * edma_test.c7 @. W5 U. Q1 T# n
  4. *
    - d" r  a; i! F/ [# X
  5. * brief  EDMA3 Test Application9 k- z  N9 Q& B8 x- Y$ j! X1 S. W2 b7 I# T
  6. *
    3 h7 `. i% Z0 Z) _2 {- A) Q' F
  7. *   This file contains EDMA3 Test code.( ?; [, d  i" K# g' M
  8. *
    5 c9 K+ f) g# }- X' N2 L5 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . T% [. t% j4 L, T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% o+ X$ t) R% d0 P
  11. *         TO CHANGE.
    ' r$ g: z4 L7 X1 b
  12. *
    ! l5 L1 J  x# c/ p. L$ t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( o5 L# j/ E1 K. {4 w) @
  14. *1 O- u3 U4 b7 X
  15. * This program is free software; you can redistribute it and/or( h8 v- l2 E- g! T6 t1 M2 V" @4 A
  16. * modify it under the terms of the GNU General Public License as
    " z7 n" q/ w- D  O! q
  17. * published by the Free Software Foundation version 2.! S" L1 z/ `, h/ n. K: _* f
  18. *
    - Q5 l$ c* p6 D1 {3 b( |& c, j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" _0 o5 C; m: r; I1 H; z& t2 Z- z2 H
  20. * kind, whether express or implied; without even the implied warranty
    - j* J, u. s% |, @" `* Z/ `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  W/ @, b# R1 `" ]! g& j8 Z: c$ |
  22. * GNU General Public License for more details.
    / Z: y0 o0 v) R
  23. */$ G0 F/ u8 B( m% S. Z7 |- ~. `

  24. ! X9 w/ o' A( ?$ ]9 j, v+ g3 ?2 z
  25. #include <linux/module.h>! |- l* c  @* V1 _) f
  26. #include <linux/init.h>5 T- q# Z; A' b& [" p$ _
  27. #include <linux/errno.h>
    ( \! q6 ?% a7 H9 Z" F! T" |% v( k
  28. #include <linux/types.h>7 h. x6 S5 B7 M: E
  29. #include <linux/interrupt.h>
    $ Y% q6 Q% V5 E- V
  30. #include <asm/io.h>
    3 I: M0 t& q. w; G# A/ ~9 f
  31. #include <linux/moduleparam.h>
    ) _1 V: }; \! e3 \  v
  32. #include <linux/sysctl.h>
    9 p6 d# y) k/ e  z
  33. #include <linux/mm.h>
    ) Q: d. S8 ~* t
  34. #include <linux/dma-mapping.h>
    + g/ S9 s' z5 \( N

  35. : C. ~8 V5 O5 A3 P
  36. #include <mach/memory.h>! _  m  z0 I: N# @) i
  37. #include <mach/hardware.h>0 M2 b, ~( s5 z1 a
  38. #include <mach/irqs.h>
    3 p5 W/ c: _$ l
  39. #include <asm/hardware/edma.h>; R" ^  ~! u8 B0 |; y9 ~+ b

  40. % Z* w1 u0 A& `( S1 A* R1 m
  41. #undef EDMA3_DEBUG
    ; }, u/ d2 ^7 a+ l. P4 }
  42. /*#define EDMA3_DEBUG*/
    1 E& k0 P! _9 G; w/ B- ^9 y
  43. " p3 }& \# k! k7 Q9 U+ W/ _9 k
  44. #ifdef EDMA3_DEBUG- n4 P8 {8 o2 m- X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 O" T1 e1 P- g9 f, U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 A9 a* a5 O3 ?5 [/ W0 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 c; `; t; f# J" s( y# o+ M
  48. #else. `5 {: @' [- r( D& N
  49. #define DMA_PRINTK( x... )6 n+ w! \5 a; e- x
  50. #define DMA_FN_IN
    7 k) O) ]/ i# v3 v: A
  51. #define DMA_FN_OUT) U1 G' o& D  x! m4 V& k
  52. #endif
    " {: U" r/ ~1 M$ k- u
  53. & o0 d# h6 ~2 y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " ^. F6 D7 P5 m0 I, x( E: w
  55. #define STATIC_SHIFT                3
    . \7 S, V$ C- W5 ^( C7 ~0 I7 ^
  56. #define TCINTEN_SHIFT               20, n: t! `# x' T  O- O
  57. #define ITCINTEN_SHIFT              212 B1 @. q% J# J# L: C5 ^' E' p
  58. #define TCCHEN_SHIFT                22! i) |4 q4 u# `/ d1 \8 b' u
  59. #define ITCCHEN_SHIFT               23
    3 o; Q- }% a/ y$ P6 L3 Y
  60. : X/ M) k# s3 t, b7 W
  61. static volatile int irqraised1 = 0;) i" ~8 k* I/ X7 Q2 }* y
  62. static volatile int irqraised2 = 0;
    9 ]4 S1 |$ k7 p  }# {
  63. $ S7 z( Q) t- c3 E6 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 O9 @* G, T$ c8 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + M, w2 R+ ^% G( c& `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, r/ t' i# Y2 V
  67. : ]# x" B, T- O: v
  68. dma_addr_t dmaphyssrc1 = 0;
    $ i0 \' X4 ~( N& y* G
  69. dma_addr_t dmaphyssrc2 = 0;) k- P- s2 k' G. B0 b1 y
  70. dma_addr_t dmaphysdest1 = 0;" P' S% c4 n( G
  71. dma_addr_t dmaphysdest2 = 0;. E! ]' [2 O% X# j* U+ N: R

  72. 5 g. g9 p1 @. m% t& _
  73. char *dmabufsrc1 = NULL;
    ) ^0 c* Y- u- G  p
  74. char *dmabufsrc2 = NULL;/ a) V0 {2 b4 v4 c' Y" n
  75. char *dmabufdest1 = NULL;
    / k4 U: D% C( r. o& s" \
  76. char *dmabufdest2 = NULL;" E9 D& r: i+ Z7 m$ Z) [
  77. 5 {5 b8 M/ m7 M# J: b, J; ?
  78. static int acnt = 512;+ K: _- L; w5 }) ~- s
  79. static int bcnt = 8;# D0 i4 ^, ^5 L8 |, n' ~
  80. static int ccnt = 8;
    & Y1 e- R7 B; t( \5 ]# ?; t

  81. ! i& |( |( x! G: M$ Z
  82. module_param(acnt, int, S_IRUGO);
    ! w: U+ l* q& K6 U7 B: T8 I# o
  83. module_param(bcnt, int, S_IRUGO);7 K- A4 b1 R# _4 k" s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# A: m# L9 X% ?6 P6 G& S# e. M/ w; |" i6 z" V( u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; W; t# w0 N* B, q% J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 c& m6 x6 g/ G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! W* _8 v2 C- |
! W: ~, y. c1 ^( F0 d# M* N0 j4 [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-7 18:20 , Processed in 0.040510 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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