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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 |2 P! d4 ^, ^# R* `6 ~( I( O& M5 K
  1. [code]EDMA sample test application
    6 r+ L" S$ `. @4 b$ m
  2. /*" `' [+ I5 i  K+ g0 Q( D/ Q
  3. * edma_test.c7 `% P+ j" a1 B+ x" A
  4. *
    ' p% q$ ^0 Y" L) I; U6 k- a
  5. * brief  EDMA3 Test Application
    : ~# z' F& b+ z( j+ h: j
  6. *
    & A2 b/ I. J, }& I, [  ^
  7. *   This file contains EDMA3 Test code.' ]8 R) B1 \6 b5 f! d0 }4 H  L
  8. *
    % j* c+ P8 w5 m# ^# [1 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ |6 Z+ u9 A) y! M6 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 m% q6 I+ g- H% w! s+ }0 k5 o
  11. *         TO CHANGE.
    % _& L1 B5 k- [, O) k; H
  12. *
    1 M+ Q! K; I# l4 m, W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 `- S2 h* G4 A. P  X
  14. ** b4 l% G& h. p* V/ y  s2 `
  15. * This program is free software; you can redistribute it and/or
    8 U2 s8 Z" x) T8 _5 j
  16. * modify it under the terms of the GNU General Public License as
    & U( N  V) Q1 j, [
  17. * published by the Free Software Foundation version 2.$ u9 ?! g9 c7 s1 Q3 c: O2 ?+ c
  18. *+ e6 B( H! m+ h% F1 U: v) {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 g; V: ^7 e: d4 A2 }& b
  20. * kind, whether express or implied; without even the implied warranty
    3 S8 \7 C3 _1 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 r2 g( ~% Q6 `& Y! p
  22. * GNU General Public License for more details.
    . V: z, x, k% @" R9 l) y( }) ]
  23. */
    3 F3 x" }! J; z, ^( C9 B5 p2 F* @

  24. . x, V/ ?& Q" G, M
  25. #include <linux/module.h>
    / E2 h7 ?9 N: e
  26. #include <linux/init.h>- V5 u3 F! r' C9 x& B5 `2 t8 j
  27. #include <linux/errno.h>
    % U5 R+ t$ Z5 Z
  28. #include <linux/types.h>8 d/ h# U9 _! o4 u& Q3 }, F
  29. #include <linux/interrupt.h>
    7 ~) _6 E! L/ L
  30. #include <asm/io.h>" _7 k* g0 C( g9 P
  31. #include <linux/moduleparam.h>9 ?" f# K9 N6 x3 V
  32. #include <linux/sysctl.h>
    % R6 T5 l+ J$ o
  33. #include <linux/mm.h>" b; i+ u0 v! b6 X4 l+ [+ L7 G: U
  34. #include <linux/dma-mapping.h>
    - _( Q& E& e/ C  [4 r# G9 B

  35. ; w$ r5 L' {$ B, ]' X
  36. #include <mach/memory.h>
    ( J: ^( W" d( U$ m2 c+ N" H9 [( l
  37. #include <mach/hardware.h>
    7 h: G. K1 j, b2 B; i) h4 W, g
  38. #include <mach/irqs.h>5 o/ T4 B* Q, i
  39. #include <asm/hardware/edma.h>
    7 D. f% k1 p* g! B3 D; l* i
  40. 4 P, M* X3 {+ T/ V+ F4 U
  41. #undef EDMA3_DEBUG
    $ B6 G9 Z3 I' ?" @; P. L6 x
  42. /*#define EDMA3_DEBUG*/
    . ~4 {) @$ }5 r- \2 C2 U1 ]
  43. 8 H. Y, U: G0 c3 }: G3 |4 p0 d
  44. #ifdef EDMA3_DEBUG
    . n) W/ D2 k3 _9 Y( K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ f- ?9 }7 d1 n: k, L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ ~! o! K, Z7 I( U3 Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): h* G: R9 E$ h7 k+ s7 t
  48. #else6 `* {  H5 A4 x
  49. #define DMA_PRINTK( x... )& `$ ]* [' J- {( ]' q% `
  50. #define DMA_FN_IN% |+ R+ ~' `. t2 m# R
  51. #define DMA_FN_OUT
    9 ~& }* p3 g6 u. R( k4 ]! r" n$ y
  52. #endif
    5 m% Q! o# N8 p" D9 X7 a- f

  53. 3 |1 r1 j+ g# \+ n& x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 Z0 y6 O, f4 G2 E, z/ \  C
  55. #define STATIC_SHIFT                3' M( x2 U; b* h6 F- b
  56. #define TCINTEN_SHIFT               20
    " ]: p- q3 V/ V6 g9 k4 Y. y) T
  57. #define ITCINTEN_SHIFT              21* l: c) Y* d1 @( K
  58. #define TCCHEN_SHIFT                22
    & ?$ g" x& R' _4 u
  59. #define ITCCHEN_SHIFT               23. J* Z( H; i% y2 _8 j+ H4 y  `

  60. * _; m7 c3 h: T  |# |
  61. static volatile int irqraised1 = 0;1 j( o4 G: z( B" R* f  k" t( V! y
  62. static volatile int irqraised2 = 0;
    , ]6 {7 ?- s. u! Z

  63. ' R$ c) b, d* `/ {/ g" h, ?2 ~+ _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # B! n" X7 i: u7 s5 k% b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + `" K; S9 e9 z5 P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 T8 |) \, A' k. n7 I- f3 ?

  67. ; g5 f) N, y" p
  68. dma_addr_t dmaphyssrc1 = 0;
    . ^1 ~% P  r/ t3 ]( L) x
  69. dma_addr_t dmaphyssrc2 = 0;
    0 o$ n7 {1 W' \- q. B4 d" q
  70. dma_addr_t dmaphysdest1 = 0;
    7 Z5 d( Y) B1 o& n; \- \
  71. dma_addr_t dmaphysdest2 = 0;
    9 @* @" S, n2 r+ o( y  g& N8 t( P

  72. & J5 m- j4 z3 R/ F
  73. char *dmabufsrc1 = NULL;
    + r- [5 ^* Y  C! t
  74. char *dmabufsrc2 = NULL;$ h! M" w- m* S  @" j3 D
  75. char *dmabufdest1 = NULL;
    9 N4 f- |  h. R9 y
  76. char *dmabufdest2 = NULL;( ~5 L5 c# }1 ]8 X4 ?) ]& z3 [
  77. + V+ R7 a" s( a3 z! D1 y/ z
  78. static int acnt = 512;
    3 O% g( D' Z1 J# t. {& ^
  79. static int bcnt = 8;
    ( h- w/ _5 D8 N3 g9 h
  80. static int ccnt = 8;/ v! }7 j, Q* S4 }6 {

  81. + p9 e! o: `9 p- J& I. K) q
  82. module_param(acnt, int, S_IRUGO);
    0 X+ E9 U. R( H- O1 }" [( M3 e* F
  83. module_param(bcnt, int, S_IRUGO);
    2 n, ?* A3 O8 r8 u* Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) C0 G2 o( F# @0 f1 e& b9 ^

+ W$ `6 i( M% O7 h! B6 X# q  j0 r' s/ H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# }) J) ?1 C8 Y5 {2 }) ^" Q& 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- H) A2 ]' q5 m+ ]9 |- w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 C+ {; \2 O# g: {) l; F

, o0 y1 y! s. y$ W9 e' v5 R- _+ j/ B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-2 18:45 , Processed in 0.041354 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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