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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # W: `- {3 E- s6 ~7 n1 E, ~5 J
  1. [code]EDMA sample test application
    , G" G  O& C0 B- O3 a/ @+ G
  2. /*
    ( ?, _/ r, Z% {
  3. * edma_test.c
    5 o% W' R7 |5 z- K3 D; }
  4. *
    8 p5 d4 H! W4 a7 B
  5. * brief  EDMA3 Test Application7 J4 G- G+ Y+ V+ e+ D
  6. ** L5 p% Z) f: H% T/ D1 G9 l. \$ l- F# S
  7. *   This file contains EDMA3 Test code.) K# b  h0 I& m2 X
  8. *
    3 g# u; q& Z2 b0 A1 w. U2 s# G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& O) W0 ^. ~5 _% {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 b' Q8 a+ \  I
  11. *         TO CHANGE.& U' J; R5 G2 I; l  c3 p4 [5 C+ K( x
  12. *7 b- S! C! Y2 _( J: D/ \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 \8 E+ R  ]) A6 x
  14. *
    7 s: ^9 x$ L) @) L; n. T
  15. * This program is free software; you can redistribute it and/or
    7 `% o7 J5 L; O8 G
  16. * modify it under the terms of the GNU General Public License as
    3 E; D: K8 o. A; j9 T3 [
  17. * published by the Free Software Foundation version 2./ z/ X' F4 D  I/ n( ]+ g0 {; ~
  18. *- G  T- p4 V1 B+ E2 H6 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 E3 h/ N2 g$ S' S2 j8 X
  20. * kind, whether express or implied; without even the implied warranty
    1 e& X, h7 ~+ C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 @; x$ ^' G* g% @
  22. * GNU General Public License for more details.5 H! q- Z- x# O! \
  23. */" L$ o, Q( R! V/ g. R, h0 C
  24. " {  v, V& B0 L/ |
  25. #include <linux/module.h>; f/ _$ R7 A  M. f
  26. #include <linux/init.h>
    - U' g' r/ j: r7 G0 `
  27. #include <linux/errno.h>
    : L% O6 U& v. T2 J
  28. #include <linux/types.h>
    ( l. j/ v0 _" R8 n9 |
  29. #include <linux/interrupt.h>
    + x6 t. F* W; B. p2 j9 C
  30. #include <asm/io.h>
    6 q  ~6 B  F* [! E7 ]+ G6 r
  31. #include <linux/moduleparam.h>& l. K9 m' j( v+ Z* U5 D
  32. #include <linux/sysctl.h>
    , b* ~# M# o4 d* t2 A
  33. #include <linux/mm.h>, [4 {3 C# j! r; Y( d  N) K
  34. #include <linux/dma-mapping.h># l$ @4 h& f5 S* t, q" n9 g

  35. 6 b  [& G$ }* x5 g, ]* y2 |( c! u
  36. #include <mach/memory.h>
    ! x3 R" F6 N& S" j, c, G+ u9 Z$ S
  37. #include <mach/hardware.h>3 F4 A) F, i' T7 J% s, q
  38. #include <mach/irqs.h>
    7 q9 \% b3 c# B0 i" B' N. S
  39. #include <asm/hardware/edma.h>
    # N. g* |# O7 j; `, C

  40. & }! y' v: f7 @& Y
  41. #undef EDMA3_DEBUG
    ( l# b5 J* r7 {! N& w
  42. /*#define EDMA3_DEBUG*/  V( l( L" C: |! [
  43. 2 T" g6 t* V' S/ H5 d9 L) L* ]
  44. #ifdef EDMA3_DEBUG4 A! S% r* I; t" V! L8 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( X- a5 t. N7 J: r! ^+ [* o5 d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / k$ H) v! [9 x7 ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . s( i# [7 L- Z; C( |- C
  48. #else" n0 V- }& `: U$ `& A! R0 d
  49. #define DMA_PRINTK( x... )
    6 j% E. z2 v' s# M: r7 y
  50. #define DMA_FN_IN" h" I) {  R5 s* X! ]1 I
  51. #define DMA_FN_OUT$ |# Z0 ?3 o3 C; W5 J
  52. #endif
    ' c  S% ^6 ~! G8 G( ^3 [. x- R
  53. 5 Z2 `0 |2 B% P3 s$ A4 ]+ N) z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * r1 `. T( n- U2 Y7 |6 J
  55. #define STATIC_SHIFT                3% F" O0 T& n: @# x
  56. #define TCINTEN_SHIFT               20
    * u, G% x/ s6 H0 _% o4 z/ {% I
  57. #define ITCINTEN_SHIFT              21* q* ^; V  t$ c/ M. E/ d
  58. #define TCCHEN_SHIFT                22' D9 P8 X0 G' i1 ]* |
  59. #define ITCCHEN_SHIFT               23* n( R$ s$ t( B$ [
  60. # z# A  v- K6 F7 ~6 D7 H3 A$ Q5 Z
  61. static volatile int irqraised1 = 0;
    ' X3 z8 Z& r) _  `
  62. static volatile int irqraised2 = 0;3 z& U1 {6 R5 M1 C2 E! W+ t
  63. 8 V" L  e2 M7 v3 C1 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! F) T/ {+ s; c0 Y1 x4 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! o. ~& J* ]6 u6 V( ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # R( g4 y+ C' ]( ^7 e

  67. 2 g6 b' ~- a* S6 `* O1 M) y( ?  q
  68. dma_addr_t dmaphyssrc1 = 0;7 q: ^6 x& |" l8 }7 ]2 `' f
  69. dma_addr_t dmaphyssrc2 = 0;
    # ]  C$ Z# T1 d3 K( |
  70. dma_addr_t dmaphysdest1 = 0;
    + C$ o4 g/ ], a" c2 P! \. _$ c
  71. dma_addr_t dmaphysdest2 = 0;
    . z* R, G3 N1 b3 a4 P+ n+ O' Q' M
  72. 8 Q; |* U1 B* Y% v! A# D- k
  73. char *dmabufsrc1 = NULL;
    7 _: C6 \" ]3 T: I, x; p
  74. char *dmabufsrc2 = NULL;* R# R/ e8 i" F: ^+ i. [' h, ?
  75. char *dmabufdest1 = NULL;; q7 {; J: G; ?- `- U: ~# ^
  76. char *dmabufdest2 = NULL;
    # ]" F; m( V' }( ?1 n
  77. 6 l5 a% S9 M4 x' w! v' s8 r
  78. static int acnt = 512;8 l6 e7 d% ~4 p
  79. static int bcnt = 8;& c7 z1 V+ [  L! D
  80. static int ccnt = 8;
    7 m8 v# s+ e, j( ?
  81. 9 Y/ R% Q, F" f) n
  82. module_param(acnt, int, S_IRUGO);
    2 \7 T  n, h- B5 c/ ?' q; x
  83. module_param(bcnt, int, S_IRUGO);
    7 A" F3 \' a8 Z1 ^3 l) x# S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 i: ~8 S# v' W7 f& b
" W$ G3 t- D- V9 f, f7 Y! c! E0 y3 s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 K- l1 }( A2 a/ O; [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% C6 I& o& X, G" L) \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 N! R1 p  W/ z' z2 U3 H

2 m6 n6 d& T& u
" t5 G3 A6 W3 f$ i! c' {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 09:07 , Processed in 0.041117 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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